Commit 0a8d6618 by Ben Collins Committed by Jakub Jelinek

Makefile.in: Pass a new MULTILIB_EXCLUSIONS option as the sixth argument to genmultilib.

	* Makefile.in: Pass a new MULTILIB_EXCLUSIONS option as the sixth
	argument to genmultilib.
	* genmultilib: accept new MULTILIB_EXCLUSIONS option and output
	the contents into the multilib.h header.
	* gcc.c: Declare multilib_exclusions for the specs file.
	(set_multilib_dir): Use it.
	(print_multilib_info): Likewise.
	* t-linux64: Declare arguments for new MULTILIB_EXCLUSIONS option
	to pass to genmultilib.

From-SVN: r32365
parent fd05eb80
1999-12-16 Ben Collins <bcollins@debian.org>
* Makefile.in: Pass a new MULTILIB_EXCLUSIONS option as the sixth
argument to genmultilib.
* genmultilib: accept new MULTILIB_EXCLUSIONS option and output
the contents into the multilib.h header.
* gcc.c: Declare multilib_exclusions for the specs file.
(set_multilib_dir): Use it.
(print_multilib_info): Likewise.
* t-linux64: Declare arguments for new MULTILIB_EXCLUSIONS option
to pass to genmultilib.
2000-03-06 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2000-03-06 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* builtins.c (built_in_class_names, built_in_names): Constify a * builtins.c (built_in_class_names, built_in_names): Constify a
......
...@@ -1182,7 +1182,8 @@ s-mlib: $(srcdir)/genmultilib Makefile ...@@ -1182,7 +1182,8 @@ s-mlib: $(srcdir)/genmultilib Makefile
"$(MULTILIB_DIRNAMES)" \ "$(MULTILIB_DIRNAMES)" \
"$(MULTILIB_MATCHES)" \ "$(MULTILIB_MATCHES)" \
"$(MULTILIB_EXCEPTIONS)" \ "$(MULTILIB_EXCEPTIONS)" \
"$(MULTILIB_EXTRA_OPTS)" > tmp-mlib.h "$(MULTILIB_EXTRA_OPTS)" \
"$(MULTILIB_EXCLUSIONS)" > tmp-mlib.h
$(SHELL) $(srcdir)/move-if-change tmp-mlib.h multilib.h $(SHELL) $(srcdir)/move-if-change tmp-mlib.h multilib.h
touch s-mlib touch s-mlib
......
MULTILIB_OPTIONS = m64/m32 mno-app-regs|mcmodel=medany MULTILIB_OPTIONS = m64/m32 mno-app-regs|mcmodel=medany
MULTILIB_DIRNAMES = 64 32 alt MULTILIB_DIRNAMES = 64 32 alt
MULTILIB_MATCHES = mcmodel?medany=mcmodel?medmid MULTILIB_MATCHES = mcmodel?medany=mcmodel?medmid
MULTILIB_EXCEPTIONS = *m32/*medany *m32/*mno-app-regs MULTILIB_EXCEPTIONS = m32/mno-app-regs* m32/mcmodel=*
MULTILIB_EXCLUSIONS = m32/!m64/mno-app-regs m32/!m64/mcmodel=medany
LIBGCC = stmp-multilib LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib INSTALL_LIBGCC = install-multilib
......
...@@ -511,6 +511,7 @@ static struct obstack multilib_obstack; ...@@ -511,6 +511,7 @@ static struct obstack multilib_obstack;
static char *multilib_select; static char *multilib_select;
static char *multilib_matches; static char *multilib_matches;
static char *multilib_defaults; static char *multilib_defaults;
static char *multilib_exclusions;
#include "multilib.h" #include "multilib.h"
/* Check whether a particular argument is a default argument. */ /* Check whether a particular argument is a default argument. */
...@@ -1143,6 +1144,7 @@ static struct spec_list static_specs[] = { ...@@ -1143,6 +1144,7 @@ static struct spec_list static_specs[] = {
INIT_STATIC_SPEC ("multilib_defaults", &multilib_defaults), INIT_STATIC_SPEC ("multilib_defaults", &multilib_defaults),
INIT_STATIC_SPEC ("multilib_extra", &multilib_extra), INIT_STATIC_SPEC ("multilib_extra", &multilib_extra),
INIT_STATIC_SPEC ("multilib_matches", &multilib_matches), INIT_STATIC_SPEC ("multilib_matches", &multilib_matches),
INIT_STATIC_SPEC ("multilib_exclusions", &multilib_exclusions),
INIT_STATIC_SPEC ("linker", &linker_name_spec), INIT_STATIC_SPEC ("linker", &linker_name_spec),
}; };
...@@ -5083,6 +5085,13 @@ main (argc, argv) ...@@ -5083,6 +5085,13 @@ main (argc, argv)
obstack_1grow (&multilib_obstack, 0); obstack_1grow (&multilib_obstack, 0);
multilib_matches = obstack_finish (&multilib_obstack); multilib_matches = obstack_finish (&multilib_obstack);
q = multilib_exclusions_raw;
while ((p = *q++) != (char *) 0)
obstack_grow (&multilib_obstack, p, strlen (p));
obstack_1grow (&multilib_obstack, 0);
multilib_exclusions = obstack_finish (&multilib_obstack);
need_space = FALSE; need_space = FALSE;
for (i = 0; for (i = 0;
i < sizeof (multilib_defaults_raw) / sizeof (multilib_defaults_raw[0]); i < sizeof (multilib_defaults_raw) / sizeof (multilib_defaults_raw[0]);
...@@ -5929,23 +5938,82 @@ default_arg (p, len) ...@@ -5929,23 +5938,82 @@ default_arg (p, len)
return 0; return 0;
} }
/* Work out the subdirectory to use based on the /* Work out the subdirectory to use based on the options. The format of
options. The format of multilib_select is a list of elements. multilib_select is a list of elements. Each element is a subdirectory
Each element is a subdirectory name followed by a list of options name followed by a list of options followed by a semicolon. The format
followed by a semicolon. gcc will consider each line in turn. If of multilib_exclusions is the same, but without the preceding
none of the options beginning with an exclamation point are directory. First gcc will check the exclusions, if none of the options
present, and all of the other options are present, that beginning with an exclamation point are present, and all of the other
subdirectory will be used. */ options are present, then we will ignore this completely. Passing
that, gcc will consider each multilib_select in turn using the same
rules for matching the options. If a match is found, that subdirectory
will be used. */
static void static void
set_multilib_dir () set_multilib_dir ()
{ {
char *p = multilib_select; char *p;
int this_path_len; int this_path_len;
char *this_path, *this_arg; char *this_path, *this_arg;
int not_arg; int not_arg;
int ok; int ok;
p = multilib_exclusions;
while (*p != '\0')
{
/* Ignore newlines. */
if (*p == '\n')
{
++p;
continue;
}
/* Check the arguments. */
ok = 1;
while (*p != ';')
{
if (*p == '\0')
abort ();
if (! ok)
{
++p;
continue;
}
this_arg = p;
while (*p != ' ' && *p != ';')
{
if (*p == '\0')
abort ();
++p;
}
if (*this_arg != '!')
not_arg = 0;
else
{
not_arg = 1;
++this_arg;
}
ok = used_arg (this_arg, p - this_arg);
if (not_arg)
ok = ! ok;
if (*p == ' ')
++p;
}
if (ok)
{
return;
}
++p;
}
p = multilib_select;
while (*p != '\0') while (*p != '\0')
{ {
/* Ignore newlines. */ /* Ignore newlines. */
...@@ -6037,7 +6105,8 @@ set_multilib_dir () ...@@ -6037,7 +6105,8 @@ set_multilib_dir ()
matches. The options are print without a leading dash. There are matches. The options are print without a leading dash. There are
no spaces to make it easy to use the information in the shell. no spaces to make it easy to use the information in the shell.
Each subdirectory is printed only once. This assumes the ordering Each subdirectory is printed only once. This assumes the ordering
generated by the genmultilib script. */ generated by the genmultilib script. Also, we leave out ones that match
the exclusions. */
static void static void
print_multilib_info () print_multilib_info ()
...@@ -6049,6 +6118,7 @@ print_multilib_info () ...@@ -6049,6 +6118,7 @@ print_multilib_info ()
while (*p != '\0') while (*p != '\0')
{ {
skip = 0;
/* Ignore newlines. */ /* Ignore newlines. */
if (*p == '\n') if (*p == '\n')
{ {
...@@ -6065,12 +6135,103 @@ print_multilib_info () ...@@ -6065,12 +6135,103 @@ print_multilib_info ()
++p; ++p;
} }
/* If this is a duplicate, skip it. */ /* Check for matches with the multilib_exclusions. We don't bother
skip = (last_path != 0 && p - this_path == last_path_len with the '!' in either list. If any of the exclusion rules match
&& ! strncmp (last_path, this_path, last_path_len)); all of its options with the select rule, we skip it. */
{
char *e = multilib_exclusions;
char *this_arg;
while (*e != '\0')
{
int m = 1;
/* Ignore newlines. */
if (*e == '\n')
{
++e;
continue;
}
/* Check the arguments. */
while (*e != ';')
{
char *q;
int mp = 0;
if (*e == '\0')
abort ();
if (! m)
{
++e;
continue;
}
this_arg = e;
while (*e != ' ' && *e != ';')
{
if (*e == '\0')
abort ();
++e;
}
q = p + 1;
while (*q != ';')
{
char *arg;
int len = e - this_arg;
if (*q == '\0')
abort ();
arg = q;
while (*q != ' ' && *q != ';')
{
if (*q == '\0')
abort ();
++q;
}
last_path = this_path; if (! strncmp(arg, this_arg, (len < q - arg) ? q - arg : len) ||
last_path_len = p - this_path; default_arg(this_arg, e - this_arg))
{
mp = 1;
break;
}
if (*q == ' ')
++q;
}
if (! mp)
m = 0;
if (*e == ' ')
++e;
}
if (m)
{
skip = 1;
break;
}
if (*e != '\0')
++e;
}
}
if (! skip)
{
/* If this is a duplicate, skip it. */
skip = (last_path != 0 && p - this_path == last_path_len
&& ! strncmp (last_path, this_path, last_path_len));
last_path = this_path;
last_path_len = p - this_path;
}
/* If this directory requires any default arguments, we can skip /* If this directory requires any default arguments, we can skip
it. We will already have printed a directory identical to it. We will already have printed a directory identical to
......
...@@ -53,6 +53,16 @@ ...@@ -53,6 +53,16 @@
# The optional fifth argument is a list of options that should be # The optional fifth argument is a list of options that should be
# used whenever building multilib libraries. # used whenever building multilib libraries.
# The optional sixth argument is a list of exclusions used internally by
# the compiler similar to exceptions. The difference being that exclusions
# allow matching default options that genmultilib does not know about and
# is done at runtime as opposed to being sorted out at compile time.
# Each element in the list is a seperate exclusion rule. Each rule is
# a list of options (sans preceding '-') seperated by a '/'. The options
# on the rule are grouped as an AND operation, and all options much match
# for the rule to exclude a set. Options can be preceded with a '!' to
# match a logical NOT.
# The output looks like # The output looks like
# #define MULTILIB_MATCHES "\ # #define MULTILIB_MATCHES "\
# SUBDIRECTORY OPTIONS;\ # SUBDIRECTORY OPTIONS;\
...@@ -66,23 +76,28 @@ ...@@ -66,23 +76,28 @@
# The order of the subdirectories is such that they can be created in # The order of the subdirectories is such that they can be created in
# order; that is, a subdirectory is preceded by all its parents. # order; that is, a subdirectory is preceded by all its parents.
# Here is a example (this is simplified from the actual 680x0 case): # Here is an example (this is from the actual sparc64 case):
# genmultilib "m68000/m68020 msoft-float" "m68000 m68020 msoft-float" # genmultilib 'm64/m32 mno-app-regs|mcmodel=medany' '64 32 alt'
# "m68000=mc68000" # 'mcmodel?medany=mcmodel?medmid' 'm32/mno-app-regs* m32/mcmodel=*'
# 'm32/!m64/mno-app-regs m32/!m64/mcmodel=medany'
# This produces: # This produces:
# ". !m68000 !mc68000 !m68020 !msoft-float;", # ". !m64 !m32 !mno-app-regs !mcmodel=medany;",
# "m68000 m68000 !m68020 !msoft-float;", # "64 m64 !m32 !mno-app-regs !mcmodel=medany;",
# "m68000 mc60000 !m68020 !msoft-float;", # "32 !m64 m32 !mno-app-regs !mcmodel=medany;",
# "m68020 !m68000 !mc68000 m68020 !msoft-float;", # "alt !m64 !m32 mno-app-regs mcmodel=medany;",
# "msoft-float !m68000 !mc68000 !m68020 msoft-float;", # "alt !m64 !m32 mno-app-regs !mcmodel=medany;",
# "m68000/msoft-float m68000 !m68020 msoft-float;", # "alt !m64 !m32 !mno-app-regs mcmodel=medany;",
# "m68000/msoft-float mc68000 !m68020 msoft-float;", # "64/alt m64 !m32 mno-app-regs mcmodel=medany;",
# "m68020/msoft-float !m68000 !mc68000 m68020 msoft-float;", # "64/alt m64 !m32 mno-app-regs !mcmodel=medany;",
# "64/alt m64 !m32 !mno-app-regs mcmodel=medany;",
# #
# The effect is that `gcc -msoft-float' (for example) will append # The effect is that `gcc -mno-app-regs' (for example) will append "alt"
# msoft-float to the directory name when searching for libraries or # to the directory name when searching for libraries or startup files and
# startup files, and `gcc -m68000 -msoft-float' (for example) will # `gcc -m32 -mcmodel=medany' (for example) will append "32/alt". Also note
# append m68000/msoft-float. # that exclusion above is moot, unless the compiler had a default of -m32,
# which would mean that all of the "alt" directories (not the 64/alt ones)
# would be ignored (not generated, nor used) since the exclusion also
# matches the multilib_default args.
# Copy the positional parameters into variables. # Copy the positional parameters into variables.
options=$1 options=$1
...@@ -90,6 +105,7 @@ dirnames=$2 ...@@ -90,6 +105,7 @@ dirnames=$2
matches=$3 matches=$3
exceptions=$4 exceptions=$4
extra=$5 extra=$5
exclusions=$6
echo "static char *multilib_raw[] = {" echo "static char *multilib_raw[] = {"
...@@ -286,6 +302,17 @@ echo "};" ...@@ -286,6 +302,17 @@ echo "};"
# Output the default options now # Output the default options now
echo "" echo ""
echo "static char *multilib_extra = \"${extra}\";" echo "static char *multilib_extra = \"${extra}\";"
# Output the exclusion rules now
echo ""
echo "static char *multilib_exclusions_raw[] = {"
for rule in ${exclusions}; do
s=`echo ${rule} | sed -e 's,/, ,g'`
echo "\"${s};\","
done
echo "NULL"
echo "};"
rm -f tmpmultilib2 rm -f tmpmultilib2
exit 0 exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment