From patchwork Sun Aug 21 00:14:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Klose X-Patchwork-Id: 110792 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 6E19DB6F75 for ; Sun, 21 Aug 2011 10:14:44 +1000 (EST) Received: (qmail 3123 invoked by alias); 21 Aug 2011 00:14:41 -0000 Received: (qmail 3115 invoked by uid 22791); 21 Aug 2011 00:14:38 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, TW_CP, TW_CX, TW_LN X-Spam-Check-By: sourceware.org Received: from einhorn.in-berlin.de (HELO einhorn.in-berlin.de) (192.109.42.8) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 21 Aug 2011 00:14:22 +0000 X-Envelope-From: doko@ubuntu.com Received: from [192.168.42.109] (dslb-088-073-073-173.pools.arcor-ip.net [88.73.73.173]) (authenticated bits=0) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id p7L0EBhW009566; Sun, 21 Aug 2011 02:14:11 +0200 Message-ID: <4E504DD2.6020509@ubuntu.com> Date: Sun, 21 Aug 2011 02:14:10 +0200 From: Matthias Klose User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20110809 Thunderbird/6.0 MIME-Version: 1.0 To: GCC Patches CC: Steve Langasek Subject: Re: [patch] support for multiarch systems References: <4E501045.40102@ubuntu.com> In-Reply-To: <4E501045.40102@ubuntu.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 08/20/2011 09:51 PM, Matthias Klose wrote: > Multiarch [1] is the term being used to refer to the capability of a system to > install and run applications of multiple different binary targets on the same > system. The idea and name of multiarch dates back to 2004/2005 [2] (to be > confused with multiarch in glibc). attached is an updated patch which includes feedback from Jakub and Joseph. Matthias 2011-08-21 Matthias Klose * doc/invoke.texi: Document -print-multiarch. * doc/install.texi: Document --enable-multiarch. * doc/fragments.texi (MULTILIB_OSDIRNAMES): Document optional multiarch name. (MULTIARCH_DIRNAME): Document. * configure.ac: New option --enable-multiarch. Substitute with_float. * configure: Regenerate. * Makefile.in (s-mlib): Pass MULTIARCH_DIRNAME to genmultilib. (if_multiarch): Helper macro for use in tmake_files. (with_float): Define. * genmultilib: Add new option for the multiarch name. * gcc.c (multiarch_dir): Define. (for_each_path): Search for multiarch suffixes. (driver_handle_option): Handle multiarch option. (do_spec_1): Pass -imultiarch if defined. (main): Print multiarch. (set_multilib_dir): Separate multilib and multiarch names from multilib_select. (print_multilib_info): Ignore multiarch names in multilib_select. * incpath.c (add_standard_paths): Search the multiarch include dirs. * cppdeault.h (default_include): Document multiarch in multilib member. * cppdefault.c: [LOCAL_INCLUDE_DIR, STANDARD_INCLUDE_DIR] Add an include directory for multiarch directories. * common.opt: New options --print-multiarch and -imultilib. * config/s390/t-linux64: Add multiarch names in MULTILIB_OSDIRNAMES. * config/sparc/t-linux64: Likewise. * config/powerpc/t-linux64: Likewise. * config/i386/t-linux64: Likewise. * config/mips/t-linux64: Likewise. * config/alpha/t-linux: Define MULTIARCH_DIRNAME. * config/arm/t-linux: Likewise. * config/i386/t-linux: Likewise. * config/pa/t-linux: Likewise. * config/sparc/t-linux: Likewise. * config/ia64/t-glibc: Define MULTIARCH_DIRNAME for linux target. * gcc/config/i386/t-gnu: New, Define MULTIARCH_DIRNAME. * gcc/config/i386/t-kfreebsd: New, Define MULTIARCH_DIRNAME and MULTILIB_OSDIRNAMES. Index: gcc/doc/fragments.texi =================================================================== --- gcc/doc/fragments.texi (revision 177846) +++ gcc/doc/fragments.texi (working copy) @@ -128,6 +128,33 @@ of options to be used for all builds. If you set this, you should probably set @code{CRTSTUFF_T_CFLAGS} to a dash followed by it. +@findex MULTILIB_OSDIRNAMES +@item MULTILIB_OSDIRNAMES +If @code{MULTILIB_OPTIONS} is used, this variable specifies the list +of OS subdirectory names. The format is either the same as of +@code{MULTILIB_DIRNAMES}, or a set of mappings. When it is the same +as @code{MULTILIB_DIRNAMES}, it describes the multilib directories +using OS conventions, rather than GCC conventions. When it is a set +of mappings of the form @var{gccdir}=@var{osdir}, the left side gives +the GCC convention and the right gives the equivalent OS defined +location. If the @var{osdir} part begins with a @samp{!}, the os +directory names are used exclusively. Use the mapping when there is +no one-to-one equivalence between GCC levels and the OS. + +For multilib enabled configurations (see @code{MULTIARCH_DIRNAME}) +below), the multilib name is appended to each directory name, separated +by a colon (e.g. @samp{../lib:x86_64-linux-gnu}). + +@findex MULTIARCH_DIRNAME +@item MULTIARCH_DIRNAME +If @code{MULTIARCH_DIRNAME} is used, this variable specifies the +multiarch name for this configuration. For multiarch enabled +configurations it is used to search libraries and crt files in +@file{/lib/@var{multiarch}} and @file{/usr/lib/@var{multiarch}}, and +system header files in @file{/usr/include/@var{multiarch}}. +@code{MULTIARCH_DIRNAME} is not used for multilib enabled +configurations, but encoded in @code{MULTILIB_OSDIRNAMES} instead. + @findex NATIVE_SYSTEM_HEADER_DIR @item NATIVE_SYSTEM_HEADER_DIR If the default location for system headers is not @file{/usr/include}, Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 177846) +++ gcc/doc/invoke.texi (working copy) @@ -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}. Index: gcc/doc/install.texi =================================================================== --- gcc/doc/install.texi (revision 177846) +++ gcc/doc/install.texi (working copy) @@ -1028,6 +1028,11 @@ conventions, etc.@: should not be built. The default is to build a predefined set of them. +@item --enable-multiarch +Specify wether to enable or disable multiarch support. The default is +to detect for glibc start files in a multiarch location, and enable it +if the files are found. + Some targets provide finer-grained control over which multilibs are built (e.g., @option{--disable-softfloat}): @table @code Index: gcc/incpath.c =================================================================== --- gcc/incpath.c (revision 177846) +++ gcc/incpath.c (working copy) @@ -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); } Index: gcc/gcc.c =================================================================== --- gcc/gcc.c (revision 177846) +++ gcc/gcc.c (working copy) @@ -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 Index: gcc/genmultilib =================================================================== --- gcc/genmultilib (revision 177846) +++ gcc/genmultilib (working copy) @@ -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 Index: gcc/configure.ac =================================================================== --- gcc/configure.ac (revision 177846) +++ gcc/configure.ac (working copy) @@ -611,6 +611,21 @@ [], [enable_multilib=yes]) AC_SUBST(enable_multilib) +# Determine whether or not multiarch is enabled. +AC_ARG_ENABLE(multiarch, +[AS_HELP_STRING([--enable-multiarch], + [enable support for multiarch paths])], +[case "${withval}" in +yes|no|auto-detect) enable_multiarch=$withval;; +*) AC_MSG_ERROR(bad value ${withval} given for --enable-multiarch option) ;; +esac], [enable_multiarch=auto-detect]) +AC_MSG_CHECKING(for multiarch configuration) +AC_SUBST(enable_multiarch) +AC_MSG_RESULT($enable_multiarch) + +# needed for setting the multiarch name on ARM +AC_SUBST(with_float) + # Enable __cxa_atexit for C++. AC_ARG_ENABLE(__cxa_atexit, [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])], Index: gcc/cppdefault.c =================================================================== --- gcc/cppdefault.c (revision 177846) +++ gcc/cppdefault.c (working copy) @@ -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 } Index: gcc/cppdefault.h =================================================================== --- gcc/cppdefault.h (revision 177846) +++ gcc/cppdefault.h (working copy) @@ -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[]; Index: gcc/common.opt =================================================================== --- gcc/common.opt (revision 177846) +++ gcc/common.opt (working copy) @@ -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= Set to be the default plugin directory +imultiarch +Common Joined Separate RejectDriver Var(imultiarch) Init(0) +-imultiarch Set 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) Index: gcc/config.gcc =================================================================== --- gcc/config.gcc (revision 177846) +++ gcc/config.gcc (working copy) @@ -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" Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 177846) +++ gcc/Makefile.in (working copy) @@ -350,6 +350,17 @@ enable_plugin = @enable_plugin@ +# Multiarch support +enable_multiarch = @enable_multiarch@ +with_float = @with_float@ +ifeq ($(enable_multiarch),yes) + if_multiarch = $(1) +else ifeq ($(enable_multiarch),auto-detect) + if_multiarch = $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib/*/crti.o),$(1)) +else + if_multiarch = +endif + CPPLIB = ../libcpp/libcpp.a CPPINC = -I$(srcdir)/../libcpp/include @@ -1935,10 +1946,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 Index: gcc/config/alpha/t-linux =================================================================== --- gcc/config/alpha/t-linux (revision 177846) +++ gcc/config/alpha/t-linux (working copy) @@ -1 +1,3 @@ SHLIB_MAPFILES += $(srcdir)/config/alpha/libgcc-alpha-ldbl.ver + +MULTIARCH_DIRNAME = $(call if_multiarch,alpha-linux-gnu) Index: gcc/config/s390/t-linux64 =================================================================== --- gcc/config/s390/t-linux64 (revision 177846) +++ gcc/config/s390/t-linux64 (working copy) @@ -7,4 +7,5 @@ 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$(call if_multiarch,:s390x-linux-gnu) +MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu) Index: gcc/config/sparc/t-linux64 =================================================================== --- gcc/config/sparc/t-linux64 (revision 177846) +++ gcc/config/sparc/t-linux64 (working copy) @@ -26,7 +26,8 @@ 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$(call if_multiarch,:sparc64-linux-gnu) +MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:sparc-linux-gnu) LIBGCC = stmp-multilib INSTALL_LIBGCC = install-multilib Index: gcc/config/sparc/t-linux =================================================================== --- gcc/config/sparc/t-linux (revision 177846) +++ gcc/config/sparc/t-linux (working copy) @@ -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 = $(call if_multiarch,sparc-linux-gnu) Index: gcc/config/i386/t-kfreebsd =================================================================== --- gcc/config/i386/t-kfreebsd (revision 0) +++ gcc/config/i386/t-kfreebsd (revision 0) @@ -0,0 +1,5 @@ +MULTIARCH_DIRNAME = $(call if_multiarch,i386-kfreebsd-gnu) + +# MULTILIB_OSDIRNAMES are set in t-linux64. +KFREEBSD_OS = $(filter kfreebsd%, $(word 3, $(subst -, ,$(target)))) +MULTILIB_OSDIRNAMES := $(subst linux,$(KFREEBSD_OS),$(MULTILIB_OSDIRNAMES)) Index: gcc/config/i386/t-gnu =================================================================== --- gcc/config/i386/t-gnu (revision 0) +++ gcc/config/i386/t-gnu (revision 0) @@ -0,0 +1 @@ +MULTIARCH_DIRNAME = $(call if_multiarch,i386-gnu) Index: gcc/config/i386/t-linux =================================================================== --- gcc/config/i386/t-linux (revision 177846) +++ gcc/config/i386/t-linux (working copy) @@ -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 = $(call if_multiarch,i386-linux-gnu) Index: gcc/config/i386/t-linux64 =================================================================== --- gcc/config/i386/t-linux64 (revision 177846) +++ gcc/config/i386/t-linux64 (working copy) @@ -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$(call if_multiarch,:x86_64-linux-gnu) +MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu) MULTILIB_OSDIRNAMES+= mx32=../libx32 LIBGCC = stmp-multilib Index: gcc/config/ia64/t-glibc =================================================================== --- gcc/config/ia64/t-glibc (revision 177846) +++ gcc/config/ia64/t-glibc (working copy) @@ -1 +1,5 @@ SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-glibc.ver + +ifneq (,$(findstring linux, $(target))) +MULTIARCH_DIRNAME = $(call if_multiarch,ia64-linux-gnu) +endif Index: gcc/config/m68k/t-linux =================================================================== --- gcc/config/m68k/t-linux (revision 177846) +++ gcc/config/m68k/t-linux (working copy) @@ -21,6 +21,8 @@ # Only include multilibs for 680x0 CPUs with an MMU. M68K_MLIB_CPU += && (CPU ~ "^m680") && (FLAGS ~ "FL_MMU") +MULTIARCH_DIRNAME = $(call if_multiarch,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 Index: gcc/config/rs6000/t-linux64 =================================================================== --- gcc/config/rs6000/t-linux64 (revision 177846) +++ gcc/config/rs6000/t-linux64 (working copy) @@ -33,5 +33,7 @@ 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$(call if_multiarch,:powerpc64-linux-gnu) +MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu) +MULTILIB_OSDIRNAMES += nof MULTILIB_MATCHES = $(MULTILIB_MATCHES_FLOAT) Index: gcc/config/arm/t-linux-eabi =================================================================== --- gcc/config/arm/t-linux-eabi (revision 177846) +++ gcc/config/arm/t-linux-eabi (working copy) @@ -28,6 +28,8 @@ #MULTILIB_DIRNAMES += fa606te fa626te fmp626 fa726te #MULTILIB_EXCEPTIONS += *mthumb/*mcpu=fa606te *mthumb/*mcpu=fa626te *mthumb/*mcpu=fmp626 *mthumb/*mcpu=fa726te* +MULTIARCH_DIRNAME = $(call if_multiarch,arm-linux-gnueabi$(if $(filter hard,$(with_float)),hf)) + # Use a version of div0 which raises SIGFPE, and a special __clear_cache. LIB1ASMFUNCS := $(filter-out _dvmd_tls,$(LIB1ASMFUNCS)) _dvmd_lnx _clear_cache Index: gcc/config/pa/t-linux =================================================================== --- gcc/config/pa/t-linux (revision 177846) +++ gcc/config/pa/t-linux (working copy) @@ -35,3 +35,5 @@ # Compile crtbeginS.o and crtendS.o as PIC. CRTSTUFF_T_CFLAGS_S = -fPIC + +MULTIARCH_DIRNAME = $(call if_multiarch,hppa-linux-gnu) Index: gcc/config/mips/t-linux64 =================================================================== --- gcc/config/mips/t-linux64 (revision 177846) +++ gcc/config/mips/t-linux64 (working copy) @@ -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$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32) \ + ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu) \ + ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64) EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o