Richard Biener <richard.guent...@gmail.com>  writes:
> On Thu, Dec 4, 2014 at 8:59 AM, Benda Xu <hero...@gentoo.org> wrote:
> > Hello,
> >
> > libc could be installed in a directory prefix. This patch provides a
> > way to specify such a prefix for gcc at configuration time.
> >
> > I have only tested the patch with glibc on amd64, x86 and arm.
> > It is logically straightforward.  Please share your thoughts on it.
> 
> I think you are supposed to use sysroots for that.

This patch would appear to allow the ABI defined locations of a dynamic
linker to be changed which does not seem like a good idea. I.e. My
understanding is that the combination of arch+ABI+Clibrary indicates an
ABI defined absolute path to the dynamic linker as well as name of the
dynamic linker. I'd welcome any correction to that from someone who
lives and breathes this stuff.

I am under the impression that installing glibc with a prefix effectively
breaks the ABI paths and is primarily for testing and/or creating
sysroots for cross compilers and such forth. Such sysroots must be
installed to a target before being used or with qemu user-mode there is
an option to say where your sysroot is so that the dynamic linker can
be located from within that path.

While I believe the dynamic linker paths are hard coded, the library
Locations are more complex especially when multilibs (MULTILIB_OSDIRNAMES)
and/or multiarch gets layered on top.

I'd love to see a description of how all these pieces are intended to
sit together as I too am looking at this area for MIPS sysroots. Perhaps
that is a topic for libc-alpha though.

Thanks,
Matthew

> 
> > Cheers,
> > Benda
> >
> >         * configure.ac: add --with-dynamic-linker-prefix
> >         * configure, config.in: regenerated
> >         * *.h under config: prepend dynamic-linkers with
> >         DYNAMIC_LINKER_PREFIX
> > ---
> >  gcc/config.in                      |  6 ++++++
> >  gcc/config/aarch64/aarch64-linux.h |  3 ++-
> >  gcc/config/alpha/linux-elf.h       |  4 ++--
> >  gcc/config/arm/linux-eabi.h        |  6 +++---
> >  gcc/config/arm/linux-elf.h         |  2 +-
> >  gcc/config/c6x/uclinux-elf.h       |  2 +-
> >  gcc/config/cris/linux.h            |  2 +-
> >  gcc/config/dragonfly.h             |  3 ++-
> >  gcc/config/freebsd-spec.h          |  4 ++--
> >  gcc/config/frv/linux.h             |  2 +-
> >  gcc/config/i386/gnu.h              |  2 +-
> >  gcc/config/i386/kfreebsd-gnu.h     |  2 +-
> >  gcc/config/i386/kfreebsd-gnu64.h   |  6 +++---
> >  gcc/config/i386/linux.h            |  2 +-
> >  gcc/config/i386/linux64.h          |  6 +++---
> >  gcc/config/ia64/linux.h            |  2 +-
> >  gcc/config/knetbsd-gnu.h           |  2 +-
> >  gcc/config/kopensolaris-gnu.h      |  2 +-
> >  gcc/config/linux.h                 | 16 ++++++++--------
> >  gcc/config/m32r/linux.h            |  2 +-
> >  gcc/config/m68k/linux.h            |  2 +-
> >  gcc/config/microblaze/linux.h      |  2 +-
> >  gcc/config/mips/linux.h            | 17 +++++++++--------
> >  gcc/config/mn10300/linux.h         |  2 +-
> >  gcc/config/nios2/linux.h           |  2 +-
> >  gcc/config/pa/pa-linux.h           |  2 +-
> >  gcc/config/rs6000/freebsd64.h      |  4 ++--
> >  gcc/config/rs6000/linux64.h        | 10 +++++-----
> >  gcc/config/rs6000/sysv4.h          |  4 ++--
> >  gcc/config/s390/linux.h            |  4 ++--
> >  gcc/config/sh/linux.h              |  2 +-
> >  gcc/config/sparc/linux.h           |  2 +-
> >  gcc/config/sparc/linux64.h         |  4 ++--
> >  gcc/config/xtensa/linux.h          |  2 +-
> >  gcc/configure                      | 19 +++++++++++++++++++
> >  gcc/configure.ac                   | 10 ++++++++++
> >  36 files changed, 101 insertions(+), 63 deletions(-)
> >
> > diff --git a/gcc/config.in b/gcc/config.in index 65d5e42..7a3f29e
> > 100644
> > --- a/gcc/config.in
> > +++ b/gcc/config.in
> > @@ -63,6 +63,12 @@
> >  #endif
> >
> >
> > +/* root directory of the dynamic linker */ #ifndef USED_FOR_TARGET
> > +#undef DYNAMIC_LINKER_PREFIX #endif
> > +
> > +
> >  /* Define if you want assertions enabled. This is a cheap check. */
> > #ifndef USED_FOR_TARGET  #undef ENABLE_ASSERT_CHECKING diff --git
> > a/gcc/config/aarch64/aarch64-linux.h
> > b/gcc/config/aarch64/aarch64-linux.h
> > index d375624..112f8db 100644
> > --- a/gcc/config/aarch64/aarch64-linux.h
> > +++ b/gcc/config/aarch64/aarch64-linux.h
> > @@ -21,7 +21,8 @@
> >  #ifndef GCC_AARCH64_LINUX_H
> >  #define GCC_AARCH64_LINUX_H
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-
> endian:_be}%{mabi=ilp32:_ilp32}.so.1"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-linux-
> aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-linux-
> aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
> >
> >  #undef  ASAN_CC1_SPEC
> >  #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
> > diff --git a/gcc/config/alpha/linux-elf.h
> > b/gcc/config/alpha/linux-elf.h index bdefe23..e6a7082 100644
> > --- a/gcc/config/alpha/linux-elf.h
> > +++ b/gcc/config/alpha/linux-elf.h
> > @@ -23,8 +23,8 @@ along with GCC; see the file COPYING3.  If not see
> > #define EXTRA_SPECS \  { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
> >
> > -#define GLIBC_DYNAMIC_LINKER   "/lib/ld-linux.so.2"
> > -#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-
> linux.so.2"
> > +#define UCLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-
> uClibc.so.0"
> >  #if DEFAULT_LIBC == LIBC_UCLIBC
> >  #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
> >  #elif DEFAULT_LIBC == LIBC_GLIBC
> > diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
> > index f1f3448..74df9b9 100644
> > --- a/gcc/config/arm/linux-eabi.h
> > +++ b/gcc/config/arm/linux-eabi.h
> > @@ -68,11 +68,11 @@
> >     GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI.  */
> >
> >  #undef  GLIBC_DYNAMIC_LINKER
> > -#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
> > -#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
> > +#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT DYNAMIC_LINKER_PREFIX
> "/lib/ld-linux.so.3"
> > +#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT DYNAMIC_LINKER_PREFIX
> "/lib/ld-linux-armhf.so.3"
> >  #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
> >
> > -#define GLIBC_DYNAMIC_LINKER \
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX \
> >     "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
> >      %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
> >      %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
> > diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
> > index 2bf361a..79b9718 100644
> > --- a/gcc/config/arm/linux-elf.h
> > +++ b/gcc/config/arm/linux-elf.h
> > @@ -62,7 +62,7 @@
> >
> >  #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-
> linux.so.2"
> >
> >  #define LINUX_TARGET_LINK_SPEC  "%{h*} \
> >     %{static:-Bstatic} \
> > diff --git a/gcc/config/c6x/uclinux-elf.h
> > b/gcc/config/c6x/uclinux-elf.h index 3f3964b..d50a83e 100644
> > --- a/gcc/config/c6x/uclinux-elf.h
> > +++ b/gcc/config/c6x/uclinux-elf.h
> > @@ -36,7 +36,7 @@
> >  #define STARTFILE_SPEC \
> >    "%{!shared:crt1%O%s} crti%O%s
> %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
> >
> > -#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
> > +#define UCLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-
> uClibc.so.0"
> >
> >  #undef LINK_SPEC
> >  #define LINK_SPEC ENDIAN_LINK_SPEC \
> > diff --git a/gcc/config/cris/linux.h b/gcc/config/cris/linux.h index
> > af27e10..6663fad 100644
> > --- a/gcc/config/cris/linux.h
> > +++ b/gcc/config/cris/linux.h
> > @@ -102,7 +102,7 @@ along with GCC; see the file COPYING3.  If not see
> > #undef CRIS_DEFAULT_CPU_VERSION  #define CRIS_DEFAULT_CPU_VERSION
> > CRIS_CPU_NG
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> >
> >  #undef CRIS_LINK_SUBTARGET_SPEC
> >  #define CRIS_LINK_SUBTARGET_SPEC \
> > diff --git a/gcc/config/dragonfly.h b/gcc/config/dragonfly.h index
> > 115c25d..4de82ba 100644
> > --- a/gcc/config/dragonfly.h
> > +++ b/gcc/config/dragonfly.h
> > @@ -90,7 +90,8 @@ see the files COPYING3 and COPYING.RUNTIME
> > respectively.  If not, see  #undef  LINK_SPEC  #define LINK_SPEC
> > DFBSD_LINK_SPEC
> >
> > -#define DFBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.2"
> > +#define DFBSD_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/usr/libexec/ld-
> elf.so.2"
> > +#define DFBSD_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/usr/libexec/ld-
> elf.so.2"
> >
> >
> >  /* Use --as-needed -lgcc_s for eh support.  */ diff --git
> > a/gcc/config/freebsd-spec.h b/gcc/config/freebsd-spec.h index
> > 8e77006..3e6b5d3 100644
> > --- a/gcc/config/freebsd-spec.h
> > +++ b/gcc/config/freebsd-spec.h
> > @@ -128,9 +128,9 @@ is built with the --enable-threads configure-time
> option.}          \
> >  #endif
> >
> >  #if FBSD_MAJOR < 6
> > -#define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1"
> > +#define FBSD_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/usr/libexec/ld-
> elf.so.1"
> >  #else
> > -#define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
> > +#define FBSD_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/libexec/ld-
> elf.so.1"
> >  #endif
> >
> >  /* NOTE: The freebsd-spec.h header is included also for various diff
> > --git a/gcc/config/frv/linux.h b/gcc/config/frv/linux.h index
> > 0fc4496..e3550e4 100644
> > --- a/gcc/config/frv/linux.h
> > +++ b/gcc/config/frv/linux.h
> > @@ -34,7 +34,7 @@
> >  #define ENDFILE_SPEC \
> >    "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> >
> >  #undef LINK_SPEC
> >  #define LINK_SPEC "\
> > diff --git a/gcc/config/i386/gnu.h b/gcc/config/i386/gnu.h index
> > 29896e9..4131dc5 100644
> > --- a/gcc/config/i386/gnu.h
> > +++ b/gcc/config/i386/gnu.h
> > @@ -22,7 +22,7 @@ along with GCC.  If not, see
> <http://www.gnu.org/licenses/>.
> >  #define GNU_USER_LINK_EMULATION "elf_i386"
> >
> >  #undef GNU_USER_DYNAMIC_LINKER
> > -#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so"
> > +#define GNU_USER_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld.so"
> >
> >  #undef STARTFILE_SPEC
> >  #if defined HAVE_LD_PIE
> > diff --git a/gcc/config/i386/kfreebsd-gnu.h
> > b/gcc/config/i386/kfreebsd-gnu.h index e487205..7e04011 100644
> > --- a/gcc/config/i386/kfreebsd-gnu.h
> > +++ b/gcc/config/i386/kfreebsd-gnu.h
> > @@ -19,4 +19,4 @@ along with GCC; see the file COPYING3.  If not see
> > <http://www.gnu.org/licenses/>.  */
> >
> >  #define GNU_USER_LINK_EMULATION "elf_i386_fbsd"
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> > diff --git a/gcc/config/i386/kfreebsd-gnu64.h
> > b/gcc/config/i386/kfreebsd-gnu64.h
> > index 1c75c8e..6039212 100644
> > --- a/gcc/config/i386/kfreebsd-gnu64.h
> > +++ b/gcc/config/i386/kfreebsd-gnu64.h
> > @@ -22,6 +22,6 @@ along with GCC; see the file COPYING3.  If not see
> > #define GNU_USER_LINK_EMULATION64 "elf_x86_64_fbsd"
> >  #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64_fbsd"
> >
> > -#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
> > -#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-kfreebsd-x86-64.so.1"
> > -#define GLIBC_DYNAMIC_LINKERX32 "/lib/ld-kfreebsd-x32.so.1"
> > +#define GLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> > +#define GLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/lib/ld-
> kfreebsd-x86-64.so.1"
> > +#define GLIBC_DYNAMIC_LINKERX32 DYNAMIC_LINKER_PREFIX "/lib/ld-
> kfreebsd-x32.so.1"
> > diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h index
> > 1fb1e03..5af8830 100644
> > --- a/gcc/config/i386/linux.h
> > +++ b/gcc/config/i386/linux.h
> > @@ -20,4 +20,4 @@ along with GCC; see the file COPYING3.  If not see
> > <http://www.gnu.org/licenses/>.  */
> >
> >  #define GNU_USER_LINK_EMULATION "elf_i386"
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-
> linux.so.2"
> > diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
> > index a90171e..4435dca 100644
> > --- a/gcc/config/i386/linux64.h
> > +++ b/gcc/config/i386/linux64.h
> > @@ -27,6 +27,6 @@ see the files COPYING3 and COPYING.RUNTIME
> > respectively.  If not, see  #define GNU_USER_LINK_EMULATION64
> "elf_x86_64"
> >  #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
> >
> > -#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
> > -#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
> > -#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
> > +#define GLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/lib/ld-
> linux.so.2"
> > +#define GLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/lib64/ld-
> linux-x86-64.so.2"
> > +#define GLIBC_DYNAMIC_LINKERX32 DYNAMIC_LINKER_PREFIX "/libx32/ld-
> linux-x32.so.2"
> > diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h index
> > e4b12ec..4649575 100644
> > --- a/gcc/config/ia64/linux.h
> > +++ b/gcc/config/ia64/linux.h
> > @@ -55,7 +55,7 @@ do {                                          \
> >  /* Define this for shared library support because it isn't in the
> main
> >     linux.h file.  */
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-linux-
> ia64.so.2"
> >
> >  #undef LINK_SPEC
> >  #define LINK_SPEC "\
> > diff --git a/gcc/config/knetbsd-gnu.h b/gcc/config/knetbsd-gnu.h index
> > 6fbf9d1..2015918 100644
> > --- a/gcc/config/knetbsd-gnu.h
> > +++ b/gcc/config/knetbsd-gnu.h
> > @@ -32,4 +32,4 @@ along with GCC; see the file COPYING3.  If not see
> >
> >
> >  #undef GNU_USER_DYNAMIC_LINKER
> > -#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
> > +#define GNU_USER_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> > diff --git a/gcc/config/kopensolaris-gnu.h
> > b/gcc/config/kopensolaris-gnu.h index f0aaad1..41274d2 100644
> > --- a/gcc/config/kopensolaris-gnu.h
> > +++ b/gcc/config/kopensolaris-gnu.h
> > @@ -31,4 +31,4 @@ along with GCC; see the file COPYING3.  If not see
> >    while (0)
> >
> >  #undef GNU_USER_DYNAMIC_LINKER
> > -#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
> > +#define GNU_USER_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> > diff --git a/gcc/config/linux.h b/gcc/config/linux.h index
> > d38ef81..2992bf5 100644
> > --- a/gcc/config/linux.h
> > +++ b/gcc/config/linux.h
> > @@ -73,14 +73,14 @@ see the files COPYING3 and COPYING.RUNTIME
> respectively.  If not, see
> >     GLIBC_DYNAMIC_LINKER must be defined for each target using them,
> or
> >     GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
> >     supporting both 32-bit and 64-bit compilation.  */ -#define
> > UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
> > -#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
> > -#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
> > -#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
> > -#define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
> > -#define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
> > -#define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
> > -#define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32"
> > +#define UCLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-
> uClibc.so.0"
> > +#define UCLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/lib/ld-
> uClibc.so.0"
> > +#define UCLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/lib/ld64-
> uClibc.so.0"
> > +#define UCLIBC_DYNAMIC_LINKERX32 DYNAMIC_LINKER_PREFIX "/lib/ldx32-
> uClibc.so.0"
> > +#define BIONIC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX
> "/system/bin/linker"
> > +#define BIONIC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX
> "/system/bin/linker"
> > +#define BIONIC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX
> "/system/bin/linker64"
> > +#define BIONIC_DYNAMIC_LINKERX32 DYNAMIC_LINKER_PREFIX
> "/system/bin/linkerx32"
> >
> >  #define GNU_USER_DYNAMIC_LINKER
> \
> >    CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER,
> > \ diff --git a/gcc/config/m32r/linux.h b/gcc/config/m32r/linux.h index
> > 698086b..62aac30 100644
> > --- a/gcc/config/m32r/linux.h
> > +++ b/gcc/config/m32r/linux.h
> > @@ -37,7 +37,7 @@
> >     When the -shared link option is used a final link is not being
> >     done.  */
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-
> linux.so.2"
> >
> >  #undef LINK_SPEC
> >  #if TARGET_LITTLE_ENDIAN
> > diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h index
> > 5a586f5..c8a6416 100644
> > --- a/gcc/config/m68k/linux.h
> > +++ b/gcc/config/m68k/linux.h
> > @@ -71,7 +71,7 @@ along with GCC; see the file COPYING3.  If not see
> >     When the -shared link option is used a final link is not being
> >     done.  */
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> >
> >  #undef LINK_SPEC
> >  #define LINK_SPEC "-m m68kelf %{shared} \ diff --git
> > a/gcc/config/microblaze/linux.h b/gcc/config/microblaze/linux.h index
> > 48038d5..2e95ee3 100644
> > --- a/gcc/config/microblaze/linux.h
> > +++ b/gcc/config/microblaze/linux.h
> > @@ -25,7 +25,7 @@
> >  #undef TLS_NEEDS_GOT
> >  #define TLS_NEEDS_GOT 1
> >
> > -#define DYNAMIC_LINKER "/lib/ld.so.1"
> > +#define DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> >  #undef  SUBTARGET_EXTRA_SPECS
> >  #define SUBTARGET_EXTRA_SPECS \
> >    { "dynamic_linker", DYNAMIC_LINKER } diff --git
> > a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h index
> > a117f90..37bebc0 100644
> > --- a/gcc/config/mips/linux.h
> > +++ b/gcc/config/mips/linux.h
> > @@ -21,23 +21,24 @@ along with GCC; see the file COPYING3.  If not see
> > #define GNU_USER_LINK_EMULATION64 "elf64%{EB:b}%{EL:l}tsmip"
> >  #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
> >
> > -#define GLIBC_DYNAMIC_LINKER32 \
> > +#define GLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX \
> >    "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
> > -#define GLIBC_DYNAMIC_LINKER64 \
> > +#define GLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX \
> >    "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
> > -#define GLIBC_DYNAMIC_LINKERN32 \
> > +#define GLIBC_DYNAMIC_LINKERN32 DYNAMIC_LINKER_PREFIX \
> >    "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
> >
> >  #undef UCLIBC_DYNAMIC_LINKER32
> > -#define UCLIBC_DYNAMIC_LINKER32 \
> > +#define UCLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX \
> >    "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
> >  #undef UCLIBC_DYNAMIC_LINKER64
> > -#define UCLIBC_DYNAMIC_LINKER64 \
> > +#define UCLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX \
> >    "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
> > -#define UCLIBC_DYNAMIC_LINKERN32 \
> > +#define UCLIBC_DYNAMIC_LINKERN32 DYNAMIC_LINKER_PREFIX \
> >    "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
> >
> > -#define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
> > -#define GNU_USER_DYNAMIC_LINKERN32 \
> > +#define BIONIC_DYNAMIC_LINKERN32 DYNAMIC_LINKER_PREFIX
> "/system/bin/linker32"
> > +#define BIONIC_DYNAMIC_LINKERN32 DYNAMIC_LINKER_PREFIX
> "/system/bin/linker32"
> > +#define GNU_USER_DYNAMIC_LINKERN32 DYNAMIC_LINKER_PREFIX \
> >    CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32,
> UCLIBC_DYNAMIC_LINKERN32, \
> >                           BIONIC_DYNAMIC_LINKERN32) diff --git
> > a/gcc/config/mn10300/linux.h b/gcc/config/mn10300/linux.h index
> > 5c465e9..7e4df63 100644
> > --- a/gcc/config/mn10300/linux.h
> > +++ b/gcc/config/mn10300/linux.h
> > @@ -32,7 +32,7 @@
> >  #undef  ASM_SPEC
> >  #define ASM_SPEC ""
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> >
> >  #undef  LINK_SPEC
> >  #define LINK_SPEC "%{mrelax:--relax} %{shared:-shared} \ diff --git
> > a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h index
> > 3e77ca6..2c04908 100644
> > --- a/gcc/config/nios2/linux.h
> > +++ b/gcc/config/nios2/linux.h
> > @@ -26,7 +26,7 @@
> >      }                                           \
> >    while (0)
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-linux-
> nios2.so.1"
> >
> >  #undef LINK_SPEC
> >  #define LINK_SPEC LINK_SPEC_ENDIAN \
> > diff --git a/gcc/config/pa/pa-linux.h b/gcc/config/pa/pa-linux.h index
> > 3c3d51f..405ec6a 100644
> > --- a/gcc/config/pa/pa-linux.h
> > +++ b/gcc/config/pa/pa-linux.h
> > @@ -37,7 +37,7 @@ along with GCC; see the file COPYING3.  If not see
> >  /* Define this for shared library support because it isn't in the
> main
> >     linux.h file.  */
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> >
> >  #undef LINK_SPEC
> >  #define LINK_SPEC "\
> > diff --git a/gcc/config/rs6000/freebsd64.h
> > b/gcc/config/rs6000/freebsd64.h index 1a69aea..b63561f 100644
> > --- a/gcc/config/rs6000/freebsd64.h
> > +++ b/gcc/config/rs6000/freebsd64.h
> > @@ -154,8 +154,8 @@ extern int dot_symbols;
> >    { "link_os_freebsd_spec32",  LINK_OS_FREEBSD_SPEC32 },
> \
> >    { "link_os_freebsd_spec64",  LINK_OS_FREEBSD_SPEC64 },
> >
> > -#define FREEBSD_DYNAMIC_LINKER32 "/libexec/ld-elf32.so.1"
> > -#define FREEBSD_DYNAMIC_LINKER64 "/libexec/ld-elf.so.1"
> > +#define FREEBSD_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/libexec/ld-
> elf32.so.1"
> > +#define FREEBSD_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/libexec/ld-
> elf.so.1"
> >
> >  #define LINK_OS_FREEBSD_SPEC_DEF32 "\
> >    %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \ diff
> > --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
> > index 5f74ed3..c8b4c74 100644
> > --- a/gcc/config/rs6000/linux64.h
> > +++ b/gcc/config/rs6000/linux64.h
> > @@ -361,14 +361,14 @@ extern int dot_symbols;  #undef
> > LINK_OS_DEFAULT_SPEC  #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
> >
> > -#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
> > +#define GLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> >  #ifdef LINUX64_DEFAULT_ABI_ELFv2
> > -#define GLIBC_DYNAMIC_LINKER64
> "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
> > +#define GLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX
> "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
> >  #else
> > -#define GLIBC_DYNAMIC_LINKER64
> "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
> > +#define GLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX
> "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
> >  #endif
> > -#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
> > -#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
> > +#define UCLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/lib/ld-
> uClibc.so.0"
> > +#define UCLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/lib/ld64-
> uClibc.so.0"
> >  #if DEFAULT_LIBC == LIBC_UCLIBC
> >  #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
> >  #elif DEFAULT_LIBC == LIBC_GLIBC
> > diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
> > index a946936..22cfaf9 100644
> > --- a/gcc/config/rs6000/sysv4.h
> > +++ b/gcc/config/rs6000/sysv4.h
> > @@ -762,8 +762,8 @@ ENDIAN_SELECT(" -mbig", " -mlittle",
> > DEFAULT_ASM_ENDIAN)
> >
> >  #define LINK_START_LINUX_SPEC ""
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
> > -#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> > +#define UCLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-
> uClibc.so.0"
> >  #if DEFAULT_LIBC == LIBC_UCLIBC
> >  #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
> >  #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC diff
> > --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h index
> > 65ac229..18807d4 100644
> > --- a/gcc/config/s390/linux.h
> > +++ b/gcc/config/s390/linux.h
> > @@ -60,8 +60,8 @@ along with GCC; see the file COPYING3.  If not see
> > #define MULTILIB_DEFAULTS { "m31" }  #endif
> >
> > -#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
> > -#define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
> > +#define GLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> > +#define GLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/lib/ld64.so.1"
> >
> >  #undef  LINK_SPEC
> >  #define LINK_SPEC \
> > diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h index
> > c0a4ebd..1192636 100644
> > --- a/gcc/config/sh/linux.h
> > +++ b/gcc/config/sh/linux.h
> > @@ -43,7 +43,7 @@ along with GCC; see the file COPYING3.  If not see
> >
> >  #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-
> linux.so.2"
> >
> >  #undef SUBTARGET_LINK_EMUL_SUFFIX
> >  #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
> > diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h index
> > 277e49a..0aaa7c5 100644
> > --- a/gcc/config/sparc/linux.h
> > +++ b/gcc/config/sparc/linux.h
> > @@ -83,7 +83,7 @@ extern const char *host_detect_local_cpu (int argc,
> const char **argv);
> >     When the -shared link option is used a final link is not being
> >     done.  */
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld-
> linux.so.2"
> >
> >  #undef  LINK_SPEC
> >  #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \ diff --git
> > a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h index
> > 7f12881..ecb46a5 100644
> > --- a/gcc/config/sparc/linux64.h
> > +++ b/gcc/config/sparc/linux64.h
> > @@ -84,8 +84,8 @@ along with GCC; see the file COPYING3.  If not see
> >     When the -shared link option is used a final link is not being
> >     done.  */
> >
> > -#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
> > -#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
> > +#define GLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/lib/ld-
> linux.so.2"
> > +#define GLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/lib64/ld-
> linux.so.2"
> >
> >  #ifdef SPARC_BI_ARCH
> >
> > diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h
> > index 100a8c1..f882aea 100644
> > --- a/gcc/config/xtensa/linux.h
> > +++ b/gcc/config/xtensa/linux.h
> > @@ -44,7 +44,7 @@ along with GCC; see the file COPYING3.  If not see
> >    %{mlongcalls:--longcalls} \
> >    %{mno-longcalls:--no-longcalls}"
> >
> > -#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
> > +#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/lib/ld.so.1"
> >
> >  #undef LINK_SPEC
> >  #define LINK_SPEC \
> > diff --git a/gcc/configure b/gcc/configure index 6b46bbb..7bc009b
> > 100755
> > --- a/gcc/configure
> > +++ b/gcc/configure
> > @@ -897,6 +897,7 @@ enable_objc_gc
> >  with_dwarf2
> >  enable_shared
> >  with_native_system_header_dir
> > +with_dynamic_linker_prefix
> >  with_build_sysroot
> >  with_sysroot
> >  with_specs
> > @@ -1686,6 +1687,8 @@ Optional Packages:
> >    --with-native-system-header-dir=dir
> >                            use dir as the directory to look for
> standard
> >                            system header files in.  Defaults to
> /usr/include.
> > +  --with-dynamic-linker-prefix=dir
> > +                          use dir as the root directory of the
> dynamic linker.
> >    --with-build-sysroot=sysroot
> >                            use sysroot as the system root during the
> build
> >    --with-sysroot[=DIR]    search for usr/lib, usr/include, et al,
> within DIR
> > @@ -7270,6 +7273,22 @@ fi
> >
> >
> >
> > +# Check whether --with-dynamic-linker-prefix was given.
> > +if test "${with_dynamic_linker_prefix+set}" = set; then :
> > +  withval=$with_dynamic_linker_prefix; if test x"$withval" != x ;
> then
> > +     DYNAMIC_LINKER_PREFIX="$withval"
> > +  fi
> > +else
> > +  DYNAMIC_LINKER_PREFIX=
> > +fi
> > +
> > +
> > +cat >>confdefs.h <<_ACEOF
> > +#define DYNAMIC_LINKER_PREFIX "$DYNAMIC_LINKER_PREFIX"
> > +_ACEOF
> > +
> > +
> > +
> >  # Check whether --with-build-sysroot was given.
> >  if test "${with_build_sysroot+set}" = set; then :
> >    withval=$with_build_sysroot; if test x"$withval" != x ; then diff
> > --git a/gcc/configure.ac b/gcc/configure.ac index 48c8000..fd67f89
> > 100644
> > --- a/gcc/configure.ac
> > +++ b/gcc/configure.ac
> > @@ -804,6 +804,16 @@ AC_ARG_WITH([native-system-header-dir],
> >   configured_native_system_header_dir="${withval}"
> >  ], [configured_native_system_header_dir=])
> >
> > +AC_ARG_WITH([dynamic-linker-prefix],
> > +  [AS_HELP_STRING([--with-dynamic-linker-prefix=dir],
> > +                  [use dir as the root directory of the dynamic
> > +linker.])],
> > +  [if test x"$withval" != x ; then
> > +     DYNAMIC_LINKER_PREFIX="$withval"
> > +  fi],
> > +  [DYNAMIC_LINKER_PREFIX=])
> > +AC_DEFINE_UNQUOTED(DYNAMIC_LINKER_PREFIX, "$DYNAMIC_LINKER_PREFIX",
> > +                   [root directory of the dynamic linker])
> > +
> >  AC_ARG_WITH(build-sysroot,
> >    [AS_HELP_STRING([--with-build-sysroot=sysroot],
> >                    [use sysroot as the system root during the
> > build])],
> > --
> > 2.1.3
> >

Reply via email to