===================================================================
@@ -5937,6 +5937,11 @@
@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
+@item -print-multiarch
+@opindex print-multiarch
+Print the path to OS libraries for the selected multiarch,
+relative to some @file{lib} subdirectory.
+
@item -print-prog-name=@var{program}
@opindex print-prog-name
Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
===================================================================
@@ -150,8 +150,14 @@
if (!filename_ncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
{
char *str = concat (iprefix, p->fname + len, NULL);
- if (p->multilib && imultilib)
+ if (p->multilib == 1 && imultilib)
str = concat (str, dir_separator_str, imultilib, NULL);
+ else if (p->multilib == 2)
+ {
+ if (!imultiarch)
+ continue;
+ str = concat (str, dir_separator_str, imultiarch, NULL);
+ }
add_path (str, SYSTEM, p->cxx_aware, false);
}
}
@@ -195,8 +201,14 @@
else
str = update_path (p->fname, p->component);
- if (p->multilib && imultilib)
+ if (p->multilib == 1 && imultilib)
str = concat (str, dir_separator_str, imultilib, NULL);
+ else if (p->multilib == 2)
+ {
+ if (!imultiarch)
+ continue;
+ str = concat (str, dir_separator_str, imultiarch, NULL);
+ }
add_path (str, SYSTEM, p->cxx_aware, false);
}
===================================================================
@@ -1147,6 +1147,11 @@
set_multilib_dir based on the compilation options. */
static const char *multilib_os_dir;
+
+/* Subdirectory to use for locating libraries in multiarch conventions. Set by
+ set_multilib_dir based on the compilation options. */
+
+static const char *multiarch_dir;
/* Structure to keep track of the specs that have been defined so far.
These are accessed using %(specname) in a compiler or link
@@ -2072,6 +2077,7 @@
struct prefix_list *pl;
const char *multi_dir = NULL;
const char *multi_os_dir = NULL;
+ const char *multiarch_suffix = NULL;
const char *multi_suffix;
const char *just_multi_suffix;
char *path = NULL;
@@ -2089,11 +2095,14 @@
}
if (do_multi && multilib_os_dir && strcmp (multilib_os_dir, ".") != 0)
multi_os_dir = concat (multilib_os_dir, dir_separator_str, NULL);
+ if (multiarch_dir)
+ multiarch_suffix = concat (multiarch_dir, dir_separator_str, NULL);
while (1)
{
size_t multi_dir_len = 0;
size_t multi_os_dir_len = 0;
+ size_t multiarch_len = 0;
size_t suffix_len;
size_t just_suffix_len;
size_t len;
@@ -2102,6 +2111,8 @@
multi_dir_len = strlen (multi_dir);
if (multi_os_dir)
multi_os_dir_len = strlen (multi_os_dir);
+ if (multiarch_suffix)
+ multiarch_len = strlen (multiarch_suffix);
suffix_len = strlen (multi_suffix);
just_suffix_len = strlen (just_multi_suffix);
@@ -2140,6 +2151,16 @@
break;
}
+ /* Now try the multiarch path. */
+ if (!skip_multi_dir
+ && !pl->require_machine_suffix && multiarch_dir)
+ {
+ memcpy (path + len, multiarch_suffix, multiarch_len + 1);
+ ret = callback (path, callback_info);
+ if (ret)
+ break;
+ }
+
/* Now try the base path. */
if (!pl->require_machine_suffix
&& !(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir))
@@ -3238,6 +3259,7 @@
case OPT_print_multi_directory:
case OPT_print_sysroot:
case OPT_print_multi_os_directory:
+ case OPT_print_multiarch:
case OPT_print_sysroot_headers_suffix:
case OPT_time:
case OPT_wrapper:
@@ -4891,6 +4913,15 @@
do_spec_1 (" ", 0, NULL);
}
+ if (multiarch_dir)
+ {
+ do_spec_1 ("-imultiarch", 1, NULL);
+ /* Make this a separate argument. */
+ do_spec_1 (" ", 0, NULL);
+ do_spec_1 (multiarch_dir, 1, NULL);
+ do_spec_1 (" ", 0, NULL);
+ }
+
if (gcc_exec_prefix)
{
do_spec_1 ("-iprefix", 1, NULL);
@@ -6508,6 +6539,15 @@
return (0);
}
+ if (print_multiarch)
+ {
+ if (multiarch_dir == NULL)
+ printf ("\n");
+ else
+ printf ("%s\n", multiarch_dir);
+ return (0);
+ }
+
if (print_sysroot)
{
if (target_system_root)
@@ -7483,10 +7523,26 @@
q++;
if (q < end)
{
- char *new_multilib_os_dir = XNEWVEC (char, end - q);
+ const char *q2 = q + 1;
+ char *new_multilib_os_dir;
+
+ while (q2 < end && *q2 != ':')
+ q2++;
+ if (*q2 == ':')
+ end = q2;
+ new_multilib_os_dir = XNEWVEC (char, end - q);
memcpy (new_multilib_os_dir, q + 1, end - q - 1);
new_multilib_os_dir[end - q - 1] = '\0';
multilib_os_dir = new_multilib_os_dir;
+
+ end = this_path + this_path_len;
+ if (q2 < end && *q2 == ':')
+ {
+ char *new_multiarch_dir = XNEWVEC (char, end - q2);
+ memcpy (new_multiarch_dir, q2 + 1, end - q2 - 1);
+ new_multiarch_dir[end - q2 - 1] = '\0';
+ multiarch_dir = new_multiarch_dir;
+ }
break;
}
}
@@ -7548,7 +7604,7 @@
/* When --disable-multilib was used but target defines
MULTILIB_OSDIRNAMES, entries starting with .: are there just
to find multilib_os_dir, so skip them from output. */
- if (this_path[0] == '.' && this_path[1] == ':')
+ if (this_path[0] == '.' && this_path[1] == ':' && this_path[2] != ':')
skip = 1;
/* Check for matches with the multilib_exclusions. We don't bother
===================================================================
@@ -73,6 +73,8 @@
# the os directory names are used exclusively. Use the mapping when
# there is no one-to-one equivalence between GCC levels and the OS.
+# The optional eight argument is the multiarch name.
+
# The last option should be "yes" if multilibs are enabled. If it is not
# "yes", all GCC multilib dir names will be ".".
@@ -121,7 +123,8 @@
extra=$5
exclusions=$6
osdirnames=$7
-enable_multilib=$8
+multiarch=$8
+enable_multilib=$9
echo "static const char *const multilib_raw[] = {"
@@ -222,6 +225,9 @@
# names.
toosdirnames=
defaultosdirname=
+if [ -n "${multiarch}" ]; then
+ defaultosdirname=::${multiarch}
+fi
if [ -n "${osdirnames}" ]; then
set x ${osdirnames}
shift
@@ -229,6 +235,9 @@
case "$1" in
.=*)
defaultosdirname=`echo $1 | sed 's|^.=|:|'`
+ if [ -n "${multiarch}" ]; then
+ defaultosdirname=${defaultosdirname}:${multiarch}
+ fi
shift
;;
*=*)
@@ -314,13 +323,13 @@
dirout=`echo ${combo} | sed -e 's/=/-/g'`
fi
# Remove the leading and trailing slashes.
- dirout=`echo ${dirout} | sed -e 's|^/||' -e 's|/$||g'`
+ dirout=`echo ${dirout} | sed -e 's|^/||' -e 's|/*:/*|:|' -e 's|/$||g'`
# Use the OS directory names rather than the option names.
if [ -n "${toosdirnames}" ]; then
osdirout=`echo ${combo} | sed ${toosdirnames}`
# Remove the leading and trailing slashes.
- osdirout=`echo ${osdirout} | sed -e 's|^/||' -e 's|/$||g'`
+ osdirout=`echo ${osdirout} | sed -e 's|^/||' -e 's|/*:/*|:|' -e 's|/$||g'`
if [ "x${enable_multilib}" != xyes ]; then
dirout=".:${osdirout}"
disable_multilib=yes
===================================================================
@@ -64,6 +64,7 @@
#endif
#ifdef LOCAL_INCLUDE_DIR
/* /usr/local/include comes before the fixincluded header files. */
+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
{ LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
#endif
#ifdef PREFIX_INCLUDE_DIR
@@ -95,6 +96,7 @@
#endif
#ifdef STANDARD_INCLUDE_DIR
/* /usr/include comes dead last. */
+ { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0, 1, 2 },
{ STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0, 1, 0 },
#endif
{ 0, 0, 0, 0, 0, 0 }
===================================================================
@@ -43,9 +43,11 @@
C++. */
const char add_sysroot; /* FNAME should be prefixed by
cpp_SYSROOT. */
- const char multilib; /* FNAME should have the multilib path
- specified with -imultilib
- appended. */
+ const char multilib; /* FNAME should have appended
+ - the multilib path specified with -imultilib
+ when 1 is passed,
+ - the multiarch path specified with
+ -imultiarch, when 2 is passed. */
};
extern const struct default_include cpp_include_defaults[];
===================================================================
@@ -345,6 +345,9 @@
-print-multi-os-directory
Driver Alias(print-multi-os-directory)
+-print-multiarch
+Driver Alias(print-multiarch)
+
-print-prog-name
Driver Separate Alias(print-prog-name=)
@@ -2231,6 +2234,10 @@
Common Joined Var(plugindir_string) Init(0)
-iplugindir=<dir> Set <dir> to be the default plugin directory
+imultiarch
+Common Joined Separate RejectDriver Var(imultiarch) Init(0)
+-imultiarch <dir> Set <dir> to be the multiarch include subdirectory
+
l
Driver Joined Separate
@@ -2288,6 +2295,9 @@
print-multi-os-directory
Driver Var(print_multi_os_directory)
+
+print-multiarch
+Driver Var(print_multiarch)
print-prog-name=
Driver JoinedOrMissing Var(print_prog_name)
===================================================================
@@ -1315,12 +1315,14 @@
;;
i[34567]86-*-kfreebsd*-gnu)
tm_file="${tm_file} i386/gnu-user.h kfreebsd-gnu.h i386/kfreebsd-gnu.h"
+ tmake_file="${tmake_file} i386/t-kfreebsd"
;;
i[34567]86-*-kopensolaris*-gnu)
tm_file="${tm_file} i386/gnu-user.h kopensolaris-gnu.h i386/kopensolaris-gnu.h"
;;
i[34567]86-*-gnu*)
tm_file="$tm_file i386/gnu-user.h gnu.h i386/gnu.h"
+ tmake_file="${tmake_file} i386/t-gnu"
;;
esac
tmake_file="${tmake_file} i386/t-crtstuff"
===================================================================
@@ -1935,10 +1935,11 @@
"$(MULTILIB_EXTRA_OPTS)" \
"$(MULTILIB_EXCLUSIONS)" \
"$(MULTILIB_OSDIRNAMES)" \
+ "$(MULTIARCH_DIRNAME)" \
"@enable_multilib@" \
> tmp-mlib.h; \
else \
- $(SHELL) $(srcdir)/genmultilib '' '' '' '' '' '' '' no \
+ $(SHELL) $(srcdir)/genmultilib '' '' '' '' '' '' '' "$(MULTIARCH_DIRNAME)" no \
> tmp-mlib.h; \
fi
$(SHELL) $(srcdir)/../move-if-change tmp-mlib.h multilib.h
===================================================================
@@ -1 +1,3 @@
SHLIB_MAPFILES += $(srcdir)/config/alpha/libgcc-alpha-ldbl.ver
+
+MULTIARCH_DIRNAME = alpha-linux-gnu
===================================================================
@@ -7,4 +7,4 @@
MULTILIB_OPTIONS = m64/m31
MULTILIB_DIRNAMES = 64 32
-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
+MULTILIB_OSDIRNAMES = ../lib64:s390x-linux-gnu $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib):s390-linux-gnu
===================================================================
@@ -26,7 +26,7 @@
MULTILIB_OPTIONS = m64/m32
MULTILIB_DIRNAMES = 64 32
-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
+MULTILIB_OSDIRNAMES = ../lib64:sparc64-linux-gnu $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib):sparc-linux-gnu
LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
===================================================================
@@ -3,3 +3,5 @@
# Avoid the t-linux version file.
SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver \
$(srcdir)/config/sparc/libgcc-sparc-glibc.ver
+
+MULTIARCH_DIRNAME = sparc-linux-gnu
===================================================================
@@ -0,0 +1,5 @@
+MULTIARCH_DIRNAME = i386-kfreebsd-gnu
+
+# MULTILIB_OSDIRNAMES are set in t-linux64.
+KFREEBSD_OS = $(filter kfreebsd%, $(word 3, $(subst -, ,$(arch2))))
+MULTILIB_OSDIRNAMES := $(subst linux,$(KFREEBSD_OS),$(MULTILIB_OSDIRNAMES))
===================================================================
@@ -0,0 +1 @@
+MULTIARCH_DIRNAME = i386-gnu
===================================================================
@@ -3,3 +3,5 @@
# t-slibgcc-elf-ver and t-linux
SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver \
$(srcdir)/config/i386/libgcc-glibc.ver
+
+MULTIARCH_DIRNAME = i386-linux-gnu
===================================================================
@@ -34,8 +34,8 @@
comma=,
MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
-MULTILIB_OSDIRNAMES = m64=../lib64
-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
+MULTILIB_OSDIRNAMES = m64=../lib64:x86_64-linux-gnu
+MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib):i386-linux-gnu
MULTILIB_OSDIRNAMES+= mx32=../libx32
LIBGCC = stmp-multilib
===================================================================
@@ -1 +1,5 @@
SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-glibc.ver
+
+ifneq (,$(findstring linux, $(target)))
+MULTIARCH_DIRNAME = ia64-linux-gnu
+endif
===================================================================
@@ -21,6 +21,8 @@
# Only include multilibs for 680x0 CPUs with an MMU.
M68K_MLIB_CPU += && (CPU ~ "^m680") && (FLAGS ~ "FL_MMU")
+MULTIARCH_DIRNAME = m68k-linux-gnu
+
# This rule uses MULTILIB_MATCHES to generate a definition of
# SYSROOT_SUFFIX_SPEC.
sysroot-suffix.h: $(srcdir)/config/m68k/print-sysroot-suffix.sh
===================================================================
@@ -33,5 +33,5 @@
MULTILIB_EXTRA_OPTS = fPIC mstrict-align
MULTILIB_EXCEPTIONS = m64/msoft-float
MULTILIB_EXCLUSIONS = m64/!m32/msoft-float
-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib) nof
+MULTILIB_OSDIRNAMES = ../lib64:powerpc64-linux-gnu $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib):powerpc-linux-gnu nof
MULTILIB_MATCHES = $(MULTILIB_MATCHES_FLOAT)
===================================================================
@@ -35,3 +35,5 @@
# Compile crtbeginS.o and crtendS.o as PIC.
CRTSTUFF_T_CFLAGS_S = -fPIC
+
+MULTIARCH_DIRNAME = hppa-linux-gnu
===================================================================
@@ -22,6 +22,10 @@
else
MULTILIB_DIRNAMES = n32 32 64
endif
-MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64
+MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(arch)))),el)
+MULTILIB_OSDIRNAMES = \
+ ../lib32:mips64$(MIPS_EL)-linux-gnuabin32 \
+ ../lib:mips$(MIPS_EL)-linux-gnu \
+ ../lib64:mips64$(MIPS_EL)-linux-gnuabi64
EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o