* Makefile.am (eelf32iq10.c): Fix tab/whitespace mixup.

* Makefile.am (ldmain.o): Add @TARGET_SYSTEM_ROOT_DEFINE@.
	(GENSCRIPTS): Add @use_sysroot@.
	* Makefile.in: Regenerated.
	* configure.host: Move setting of NATIVE_LIB_DIRS to...
	* configure.tgt: ... here.  Use ${target} instead of ${host}
	for NATIVE_LIB_DIRS.
	* configure.in: Add --with-sysroot.
	* configure: Regenerated.
	* genscripts.sh: Accept use_sysroot option.  Set new variables
	NATIVE and USE_LIBPATH.  Prepend "=" to directory names if
	$use_sysroot.  Don't search $tool_lib if $use_sysroot.
	* ldfile.c (ldfile_add_library_path): Handle leading '='.
	* ldmain.c (TARGET_SYSTEM_ROOT): Define if not defined.
	(ld_sysroot): New variable.
	(main): Initialize ld_sysroot.
	* ldmain.h (ld_sysroot): New extern.
	* emultempl/elf32.em: Use NATIVE and USE_LIBPATH instead of
	searching $EMULATION_LIBPATH.
	(gld${EMULATION_NAME}_add_sysroot): New function.
	(gld${EMULATION_NAME}_check_ld_so_conf): Use it.  Honor ld_sysroot.
	(gld${EMULATION_NAME}_after_open): Likewise.  Only search
	environment variables if $NATIVE.
	* ld.texinfo (Options): Mention "=" prefix in the description of -L.
	* NEWS: Mention --with-sysroot.

	* emulparams/elf32bmipn32-defs.sh: Set NATIVE and LIBPATH_SUFFIX
	instead of setting LIB_PATH.
	* emulparams/elf32ppc.sh: Likewise.
	* emulparams/elf64_s390.sh: Likewise.
	* emulparams/elf64_sparc.sh: Likewise.
	* emulparams/elf64ppc.sh: Likewise.
	* emulparams/elf_x86_64.sh: Likewise.

	* emulparams/elf64_aix.sh: Add "=" prefixes to LIB_PATH.
	* emulparams/elf64hppa.sh: Add "=" prefixes to LIB_PATH.
This commit is contained in:
Daniel Jacobowitz
2003-01-06 16:14:01 +00:00
parent b089b3da75
commit 9c8ebd6a51
22 changed files with 648 additions and 412 deletions

View File

@ -1,3 +1,43 @@
2003-01-06 Daniel Jacobowitz <drow@mvista.com>
* Makefile.am (eelf32iq10.c): Fix tab/whitespace mixup.
* Makefile.am (ldmain.o): Add @TARGET_SYSTEM_ROOT_DEFINE@.
(GENSCRIPTS): Add @use_sysroot@.
* Makefile.in: Regenerated.
* configure.host: Move setting of NATIVE_LIB_DIRS to...
* configure.tgt: ... here. Use ${target} instead of ${host}
for NATIVE_LIB_DIRS.
* configure.in: Add --with-sysroot.
* configure: Regenerated.
* genscripts.sh: Accept use_sysroot option. Set new variables
NATIVE and USE_LIBPATH. Prepend "=" to directory names if
$use_sysroot. Don't search $tool_lib if $use_sysroot.
* ldfile.c (ldfile_add_library_path): Handle leading '='.
* ldmain.c (TARGET_SYSTEM_ROOT): Define if not defined.
(ld_sysroot): New variable.
(main): Initialize ld_sysroot.
* ldmain.h (ld_sysroot): New extern.
* emultempl/elf32.em: Use NATIVE and USE_LIBPATH instead of
searching $EMULATION_LIBPATH.
(gld${EMULATION_NAME}_add_sysroot): New function.
(gld${EMULATION_NAME}_check_ld_so_conf): Use it. Honor ld_sysroot.
(gld${EMULATION_NAME}_after_open): Likewise. Only search
environment variables if $NATIVE.
* ld.texinfo (Options): Mention "=" prefix in the description of -L.
* NEWS: Mention --with-sysroot.
* emulparams/elf32bmipn32-defs.sh: Set NATIVE and LIBPATH_SUFFIX
instead of setting LIB_PATH.
* emulparams/elf32ppc.sh: Likewise.
* emulparams/elf64_s390.sh: Likewise.
* emulparams/elf64_sparc.sh: Likewise.
* emulparams/elf64ppc.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* emulparams/elf64_aix.sh: Add "=" prefixes to LIB_PATH.
* emulparams/elf64hppa.sh: Add "=" prefixes to LIB_PATH.
2003-01-03 Charles Wilson <cwilson@ece.gatech.edu> 2003-01-03 Charles Wilson <cwilson@ece.gatech.edu>
* ld/pe-dll.c (autofilter_symbollist): Add cygwin_crt0. * ld/pe-dll.c (autofilter_symbollist): Add cygwin_crt0.

View File

@ -393,7 +393,10 @@ po/POTFILES.in: @MAINT@ Makefile
&& mv tmp $(srcdir)/po/POTFILES.in && mv tmp $(srcdir)/po/POTFILES.in
ldmain.o: ldmain.c config.status ldmain.o: ldmain.c config.status
$(COMPILE) -c -DDEFAULT_EMULATION='"$(EMUL)"' -DSCRIPTDIR='"$(scriptdir)"' -DBINDIR='"$(bindir)"' -DTARGET='"@target@"' $(srcdir)/ldmain.c $(COMPILE) -c -DDEFAULT_EMULATION='"$(EMUL)"' \
-DSCRIPTDIR='"$(scriptdir)"' -DBINDIR='"$(bindir)"' \
-DTARGET='"@target@"' @TARGET_SYSTEM_ROOT_DEFINE@ \
$(srcdir)/ldmain.c
ldemul-list.h: Makefile ldemul-list.h: Makefile
(echo "/* This file is automatically generated. DO NOT EDIT! */";\ (echo "/* This file is automatically generated. DO NOT EDIT! */";\
@ -415,7 +418,7 @@ stringify.sed: ${srcdir}/emultempl/$(STRINGIFY)
# These all start with e so 'make clean' can find them. # These all start with e so 'make clean' can find them.
GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@
GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
@TDIRS@ @TDIRS@
@ -707,7 +710,7 @@ eelf32iq2000.c: $(srcdir)/emulparams/elf32iq2000.sh \
${GENSCRIPTS} elf32iq2000 "$(tdir_iq2000)" ${GENSCRIPTS} elf32iq2000 "$(tdir_iq2000)"
eelf32iq10.c: $(srcdir)/emulparams/elf32iq10.sh \ eelf32iq10.c: $(srcdir)/emulparams/elf32iq10.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/iq2000.sc ${GEN_DEPENDS} $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/iq2000.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32iq10 "$(tdir_iq10)" ${GENSCRIPTS} elf32iq10 "$(tdir_iq10)"
eelf64alpha.c: $(srcdir)/emulparams/elf64alpha.sh \ eelf64alpha.c: $(srcdir)/emulparams/elf64alpha.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf64alpha "$(tdir_elf64alpha)" ${GENSCRIPTS} elf64alpha "$(tdir_elf64alpha)"

View File

@ -1,6 +1,6 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am # Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
@ -100,12 +100,15 @@ POSUB = @POSUB@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
STRINGIFY = @STRINGIFY@ STRINGIFY = @STRINGIFY@
STRIP = @STRIP@ STRIP = @STRIP@
TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@ USE_NLS = @USE_NLS@
VERSION = @VERSION@ VERSION = @VERSION@
bfdincludedir = @bfdincludedir@ bfdincludedir = @bfdincludedir@
bfdlibdir = @bfdlibdir@ bfdlibdir = @bfdlibdir@
l = @l@ l = @l@
use_sysroot = @use_sysroot@
INTLLIBS = @INTLLIBS@ INTLLIBS = @INTLLIBS@
@ -507,7 +510,7 @@ POTFILES = $(CFILES) $(HFILES) $(EMULATION_FILES)
# These all start with e so 'make clean' can find them. # These all start with e so 'make clean' can find them.
GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@
GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
# We need this for automake to use YLWRAP. # We need this for automake to use YLWRAP.
@ -578,7 +581,7 @@ deffilep.c ldgram.c ldlex.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar TAR = tar
GZIP_ENV = --best GZIP_ENV = --best
SOURCES = $(ld_new_SOURCES) $(EXTRA_ld_new_SOURCES) SOURCES = $(ld_new_SOURCES) $(EXTRA_ld_new_SOURCES)
OBJECTS = $(ld_new_OBJECTS) OBJECTS = $(ld_new_OBJECTS)
@ -766,7 +769,7 @@ uninstall-info:
else ii=; fi; \ else ii=; fi; \
list='$(INFO_DEPS)'; \ list='$(INFO_DEPS)'; \
for file in $$list; do \ for file in $$list; do \
test -z "$$ii" \ test -z "$ii" \
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \ || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
done done
@$(NORMAL_UNINSTALL) @$(NORMAL_UNINSTALL)
@ -879,7 +882,7 @@ maintainer-clean-recursive:
dot_seen=no; \ dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \ rev="$$subdir $$rev"; \
test "$$subdir" != "." || dot_seen=yes; \ test "$$subdir" = "." && dot_seen=yes; \
done; \ done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \ test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \ target=`echo $@ | sed s/-recursive//`; \
@ -1121,7 +1124,10 @@ po/POTFILES.in: @MAINT@ Makefile
&& mv tmp $(srcdir)/po/POTFILES.in && mv tmp $(srcdir)/po/POTFILES.in
ldmain.o: ldmain.c config.status ldmain.o: ldmain.c config.status
$(COMPILE) -c -DDEFAULT_EMULATION='"$(EMUL)"' -DSCRIPTDIR='"$(scriptdir)"' -DBINDIR='"$(bindir)"' -DTARGET='"@target@"' $(srcdir)/ldmain.c $(COMPILE) -c -DDEFAULT_EMULATION='"$(EMUL)"' \
-DSCRIPTDIR='"$(scriptdir)"' -DBINDIR='"$(bindir)"' \
-DTARGET='"@target@"' @TARGET_SYSTEM_ROOT_DEFINE@ \
$(srcdir)/ldmain.c
ldemul-list.h: Makefile ldemul-list.h: Makefile
(echo "/* This file is automatically generated. DO NOT EDIT! */";\ (echo "/* This file is automatically generated. DO NOT EDIT! */";\
@ -1425,9 +1431,6 @@ eelf32i370.c: $(srcdir)/emulparams/elf32i370.sh \
eelf32ip2k.c: $(srcdir)/emulparams/elf32ip2k.sh \ eelf32ip2k.c: $(srcdir)/emulparams/elf32ip2k.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/ip2k.sc ${GEN_DEPENDS} $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/ip2k.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32ip2k "$(tdir_ip2k)" ${GENSCRIPTS} elf32ip2k "$(tdir_ip2k)"
eelf32ip2k.c: $(srcdir)/emulparams/elf32ip2k.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/ip2k.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32ip2k "$(tdir_ip2k)"
eelf32iq2000.c: $(srcdir)/emulparams/elf32iq2000.sh \ eelf32iq2000.c: $(srcdir)/emulparams/elf32iq2000.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/iq2000.sc ${GEN_DEPENDS} $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/iq2000.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32iq2000 "$(tdir_iq2000)" ${GENSCRIPTS} elf32iq2000 "$(tdir_iq2000)"

View File

@ -1,5 +1,8 @@
-*- text -*- -*- text -*-
* Added --with-sysroot configure switch to specify a target system root, for
linking against a target filesystem image.
* Added --accept-unknown-linker-format to restore old linker behaviour (pre * Added --accept-unknown-linker-format to restore old linker behaviour (pre
2.14) of silently accepting and linking in any files in an unknown binary 2.14) of silently accepting and linking in any files in an unknown binary
file format. file format.

491
ld/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -7,12 +7,10 @@
# HDEFINES host specific compiler flags # HDEFINES host specific compiler flags
# HOSTING_CRT0 crt0.o file used for bootstrapping # HOSTING_CRT0 crt0.o file used for bootstrapping
# HOSTING_LIBS libraries used for bootstrapping # HOSTING_LIBS libraries used for bootstrapping
# NATIVE_LIB_DIRS library directories to search on this host
HDEFINES= HDEFINES=
HOSTING_CRT0=/lib/crt0.o HOSTING_CRT0=/lib/crt0.o
HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ]; then libgcc=../gcc/libgcc.a; else libgcc=\`${CC} -print-libgcc-file-name\`; fi; if [ -f ../gcc/libgcc_eh.a ]; then libgcc="$libgcc ../gcc/libgcc_eh.a"; else libgcc_eh=\`${CC} -print-file-name=libgcc_eh.a\`; if [ x"$libgcc_eh" != xlibgcc_eh.a ]; then libgcc="$libgcc $libgcc_eh"; fi; fi; echo $libgcc -lc $libgcc`' HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ]; then libgcc=../gcc/libgcc.a; else libgcc=\`${CC} -print-libgcc-file-name\`; fi; if [ -f ../gcc/libgcc_eh.a ]; then libgcc="$libgcc ../gcc/libgcc_eh.a"; else libgcc_eh=\`${CC} -print-file-name=libgcc_eh.a\`; if [ x"$libgcc_eh" != xlibgcc_eh.a ]; then libgcc="$libgcc $libgcc_eh"; fi; fi; echo $libgcc -lc $libgcc`'
NATIVE_LIB_DIRS='/usr/local/lib /lib /usr/lib'
# #
# Generic configurations: # Generic configurations:
@ -21,7 +19,6 @@ NATIVE_LIB_DIRS='/usr/local/lib /lib /usr/lib'
case "${host}" in case "${host}" in
*-*-freebsd*) *-*-freebsd*)
NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
# Older versions of gcc do not use a specs file. In those cases, # Older versions of gcc do not use a specs file. In those cases,
# gcc -print-file-name=specs will simply print specs. We create a # gcc -print-file-name=specs will simply print specs. We create a
# dummy specs files to handle this. # dummy specs files to handle this.
@ -65,7 +62,6 @@ arm*-*-linux-gnu*)
;; ;;
hppa*64*-*-hpux11*) hppa*64*-*-hpux11*)
NATIVE_LIB_DIRS=/usr/lib/pa20_64
HOSTING_CRT0=/usr/ccs/lib/pa20_64/crt0.o HOSTING_CRT0=/usr/ccs/lib/pa20_64/crt0.o
# Even if CC is not gcc, the tests use gcc. # Even if CC is not gcc, the tests use gcc.
HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else if test "$GCC" = yes; then ${CC} --print-libgcc-file-name; else gcc --print-libgcc-file-name; fi fi` -lc /usr/lib/pa20_64/milli.a' HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else if test "$GCC" = yes; then ${CC} --print-libgcc-file-name; else gcc --print-libgcc-file-name; fi fi` -lc /usr/lib/pa20_64/milli.a'
@ -78,7 +74,6 @@ i[3456]86-*-bsd* | i[34567]86-*-freebsd[12] | i[34567]86-*-freebsd[12]\.* | i[34
i[3456]86-*-sysv4*) i[3456]86-*-sysv4*)
HOSTING_CRT0='/usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`' HOSTING_CRT0='/usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /usr/ccs/lib/crtn.o' HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /usr/ccs/lib/crtn.o'
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;; ;;
i[3456]86-sequent-ptx* | i[3456]86-sequent-sysv*) i[3456]86-sequent-ptx* | i[3456]86-sequent-sysv*)
@ -94,7 +89,6 @@ i[3456]86-*-sysv*)
i[3456]86-*-solaris*) i[3456]86-*-solaris*)
HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`' HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`' HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;; ;;
i[3456]86-*-sco* | i[3456]86-*-isc*) i[3456]86-*-sco* | i[3456]86-*-isc*)
@ -119,7 +113,6 @@ i[3456]86-*-lynxos*)
i[3456]86-pc-interix*) i[3456]86-pc-interix*)
HOSTING_CRT0='$$INTERIX_ROOT/usr/lib/crt0.o' HOSTING_CRT0='$$INTERIX_ROOT/usr/lib/crt0.o'
NATIVE_LIB_DIRS='/usr/local/lib $$INTERIX_ROOT/usr/lib /lib /usr/lib'
HOSTING_LIBS='-L $$X/local_bin -L $$INTERIX_ROOT/usr/lib '"$HOSTING_LIBS"' -lcpsx -lc -lcpsx $$INTERIX_ROOT/usr/lib/psxdll.a $$INTERIX_ROOT/usr/lib/psxdll2.a' HOSTING_LIBS='-L $$X/local_bin -L $$INTERIX_ROOT/usr/lib '"$HOSTING_LIBS"' -lcpsx -lc -lcpsx $$INTERIX_ROOT/usr/lib/psxdll.a $$INTERIX_ROOT/usr/lib/psxdll2.a'
;; ;;
@ -134,7 +127,6 @@ ia64-*-linux-gnu*)
ia64-*-aix*) ia64-*-aix*)
HOSTING_CRT0='-dynamic-linker `egrep "libc.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/libc.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`' HOSTING_CRT0='-dynamic-linker `egrep "libc.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/libc.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`' HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
NATIVE_LIB_DIRS='/usr/local/lib /usr/lib/ia64l64 /lib /usr/lib'
;; ;;
mips*-dec-bsd*) mips*-dec-bsd*)
@ -203,7 +195,6 @@ s390-*-linux-gnu*)
sparc*-*-solaris2*) sparc*-*-solaris2*)
HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`' HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`' HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;; ;;
sparc-*-linux-gnu*) sparc-*-linux-gnu*)
@ -232,7 +223,6 @@ x86_64-*-linux-gnu*)
alpha*-*-*) alpha*-*-*)
HOSTING_CRT0=/usr/ccs/lib/crt0.o HOSTING_CRT0=/usr/ccs/lib/crt0.o
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;; ;;
esac esac

View File

@ -30,6 +30,41 @@ AC_ARG_ENABLE(64-bit-bfd,
*) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;; *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
esac],[want64=false])dnl esac],[want64=false])dnl
AC_ARG_WITH(sysroot,
[ --with-sysroot[=DIR] Search for usr/lib et al within DIR.],
[
case ${with_sysroot} in
yes) AC_ERROR(with-sysroot must specify path) ;;
*) TARGET_SYSTEM_ROOT=$with_sysroot ;;
esac
TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
use_sysroot=yes
if test "x$exec_prefix" = xNONE; then
if test "x$prefix" = xNONE; then
test_prefix=/usr/local
else
test_prefix=$prefix
fi
else
test_prefix=$exec_prefix
fi
case ${TARGET_SYSTEM_ROOT} in
${test_prefix}*)
t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
TARGET_SYSTEM_ROOT_DEFINE="$t"
;;
esac
], [
use_sysroot=no
TARGET_SYSTEM_ROOT=
TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"'
])
AC_SUBST(use_sysroot)
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
AC_ARG_ENABLE(build-warnings, AC_ARG_ENABLE(build-warnings,
[ --enable-build-warnings enable build-time compiler warnings if gcc is used], [ --enable-build-warnings enable build-time compiler warnings if gcc is used],

View File

@ -9,6 +9,8 @@
# targ_extra_emuls additional linker emulations to provide # targ_extra_emuls additional linker emulations to provide
# targ_extra_libpath additional linker emulations using LIB_PATH # targ_extra_libpath additional linker emulations using LIB_PATH
# targ_extra_ofiles additional objects needed by the emulation # targ_extra_ofiles additional objects needed by the emulation
# NATIVE_LIB_DIRS library directories to search on this host
# (if we are a native or sysrooted linker)
targ_extra_emuls= targ_extra_emuls=
targ_extra_ofiles= targ_extra_ofiles=
@ -541,3 +543,49 @@ ip2k-*-elf) targ_emul=elf32ip2k ;;
exit 1 exit 1
esac esac
NATIVE_LIB_DIRS='/usr/local/lib /lib /usr/lib'
case "${target}" in
*-*-freebsd*)
NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
;;
hppa*64*-*-hpux11*)
NATIVE_LIB_DIRS=/usr/lib/pa20_64
;;
i[3456]86-*-sysv4*)
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;
i[3456]86-*-solaris*)
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;
i[3456]86-pc-interix*)
NATIVE_LIB_DIRS='/usr/local/lib $$INTERIX_ROOT/usr/lib /lib /usr/lib'
;;
ia64-*-aix*)
NATIVE_LIB_DIRS='/usr/local/lib /usr/lib/ia64l64 /lib /usr/lib'
;;
sparc*-*-solaris2*)
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;
*-*-linux*)
;;
*-*-freebsd*)
;;
*-*-netbsd*)
;;
alpha*-*-*)
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;
esac

View File

@ -21,19 +21,14 @@ esac
if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then
case " $EMULATION_LIBPATH " in case " $EMULATION_LIBPATH " in
*" ${EMULATION_NAME} "*) *" ${EMULATION_NAME} "*)
LIB_PATH=${libdir} NATIVE=yes
for lib in ${NATIVE_LIB_DIRS}; do ;;
case :${LIB_PATH}: in
*:${lib}:*) ;;
*) LIB_PATH=${LIB_PATH}:${lib} ;;
esac
done
# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,$ELFSIZE:,g`$LIB_PATH
;;
esac esac
fi fi
# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
LIBPATH_SUFFIX=$ELFSIZE
GENERATE_SHLIB_SCRIPT=yes GENERATE_SHLIB_SCRIPT=yes
TEXT_START_ADDR=0x10000000 TEXT_START_ADDR=0x10000000

View File

@ -25,19 +25,14 @@ OTHER_GOT_RELOC_SECTIONS="
# Treat a host that matches the target with the possible exception of "64" # Treat a host that matches the target with the possible exception of "64"
# in the name as if it were native. # in the name as if it were native.
if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then
case " $EMULATION_LIBPATH " in case " $EMULATION_LIBPATH " in
*" ${EMULATION_NAME} "*) *" ${EMULATION_NAME} "*)
LIB_PATH=${libdir} NATIVE=yes
for lib in ${NATIVE_LIB_DIRS}; do ;;
case :${LIB_PATH}: in esac
*:${lib}:*) ;;
*) LIB_PATH=${LIB_PATH}:${lib} ;;
esac
done
# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
case "$EMULATION_NAME" in
*64*) LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,64:,g`$LIB_PATH
esac
;;
esac
fi fi
# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
case "$EMULATION_NAME" in
*64*) LIBPATH_SUFFIX=64 ;;
esac

View File

@ -18,4 +18,4 @@ OTHER_READONLY_SECTIONS="
.opd ${RELOCATING-0} : { *(.opd) } .opd ${RELOCATING-0} : { *(.opd) }
.IA_64.unwind_info ${RELOCATING-0} : { *(.IA_64.unwind_info*${RELOCATING+ .gnu.linkonce.ia64unwi.*}) } .IA_64.unwind_info ${RELOCATING-0} : { *(.IA_64.unwind_info*${RELOCATING+ .gnu.linkonce.ia64unwi.*}) }
.IA_64.unwind ${RELOCATING-0} : { *(.IA_64.unwind*${RELOCATING+ .gnu.linkonce.ia64unw.*}) }" .IA_64.unwind ${RELOCATING-0} : { *(.IA_64.unwind*${RELOCATING+ .gnu.linkonce.ia64unw.*}) }"
LIB_PATH=/usr/lib/ia64l64:/usr/lib:/usr/local/lib LIB_PATH="=/usr/lib/ia64l64:=/usr/lib:=/usr/local/lib"

View File

@ -16,26 +16,17 @@ if test `echo "$host" | sed -e s/390x/390/` \
= `echo "$target" | sed -e s/390x/390/`; then = `echo "$target" | sed -e s/390x/390/`; then
case " $EMULATION_LIBPATH " in case " $EMULATION_LIBPATH " in
*" ${EMULATION_NAME} "*) *" ${EMULATION_NAME} "*)
LIB_PATH=${libdir} NATIVE=yes
for lib in ${NATIVE_LIB_DIRS}; do
case :${LIB_PATH}: in
*:${lib}:*) ;;
*) LIB_PATH=${LIB_PATH}:${lib} ;;
esac
done
case "$target" in
s390*-linux*)
suffix=64 ;;
esac
# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first
# on Linux.
if [ -n "$suffix" ]; then
case "$EMULATION_NAME" in
*64*)
LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,$suffix:,g`$LIB_PATH ;;
esac
fi ;;
esac esac
fi fi
# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first
# on Linux.
case "$target" in
s390*-linux*)
case "$EMULATION_NAME" in
*64*)
LIBPATH_SUFFIX=$suffix ;;
esac
;;
esac

View File

@ -28,31 +28,23 @@ if test `echo "$host" | sed -e 's/64//;s/v[789]//'` \
= `echo "$target" | sed -e 's/64//;s/v[789]//'`; then = `echo "$target" | sed -e 's/64//;s/v[789]//'`; then
case " $EMULATION_LIBPATH " in case " $EMULATION_LIBPATH " in
*" ${EMULATION_NAME} "*) *" ${EMULATION_NAME} "*)
LIB_PATH=${libdir} NATIVE=yes
for lib in ${NATIVE_LIB_DIRS}; do ;;
case :${LIB_PATH}: in
*:${lib}:*) ;;
*) LIB_PATH=${LIB_PATH}:${lib} ;;
esac
done
# Linux and Solaris modify the default library search path
# to first include a 64-bit specific directory. It's put
# in slightly different places on the two systems.
case "$target" in
sparc*-linux*)
suffix=64 ;;
sparc*-solaris*)
suffix=/sparcv9 ;;
esac
# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first
# on Linux and /lib/sparcv9, /usr/lib/sparcv9 etc. on Solaris.
if [ -n "$suffix" ]; then
case "$EMULATION_NAME" in
*64*)
LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,$suffix:,g`$LIB_PATH ;;
esac
fi ;;
esac esac
fi fi
# Linux and Solaris modify the default library search path
# to first include a 64-bit specific directory. It's put
# in slightly different places on the two systems.
# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first
# on Linux and /lib/sparcv9, /usr/lib/sparcv9 etc. on Solaris.
case "$EMULATION_NAME" in
*64*)
case "$target" in
sparc*-linux*)
suffix=64 ;;
sparc*-solaris*)
suffix=/sparcv9 ;;
esac
;;
esac

View File

@ -1,6 +1,6 @@
. ${srcdir}/emulparams/hppa64linux.sh . ${srcdir}/emulparams/hppa64linux.sh
OUTPUT_FORMAT="elf64-hppa" OUTPUT_FORMAT="elf64-hppa"
LIB_PATH=/usr/lib/pa20_64:/opt/langtools/lib/pa20_64 LIB_PATH="=/usr/lib/pa20_64:=/opt/langtools/lib/pa20_64"
TEXT_START_ADDR=0x4000000000001000 TEXT_START_ADDR=0x4000000000001000
DATA_ADDR=0x8000000000001000 DATA_ADDR=0x8000000000001000
TARGET_PAGE_SIZE=4096 TARGET_PAGE_SIZE=4096

View File

@ -34,18 +34,14 @@ OTHER_READWRITE_SECTIONS="
# Treat a host that matches the target with the possible exception of "64" # Treat a host that matches the target with the possible exception of "64"
# in the name as if it were native. # in the name as if it were native.
if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then
case " $EMULATION_LIBPATH " in case " $EMULATION_LIBPATH " in
*" ${EMULATION_NAME} "*) *" ${EMULATION_NAME} "*)
LIB_PATH=${libdir} NATIVE=yes
for lib in ${NATIVE_LIB_DIRS}; do ;;
case :${LIB_PATH}: in esac
*:${lib}:*) ;;
*) LIB_PATH=${LIB_PATH}:${lib} ;;
esac
done
# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
case "$EMULATION_NAME" in
*64*) LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,64:,g`$LIB_PATH
esac
esac
fi fi
# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
case "$EMULATION_NAME" in
*64*) LIBPATH_SUFFIX=64 ;;
esac

View File

@ -15,27 +15,16 @@ NO_SMALL_DATA=yes
if [ "x${host}" = "x${target}" ]; then if [ "x${host}" = "x${target}" ]; then
case " $EMULATION_LIBPATH " in case " $EMULATION_LIBPATH " in
*" ${EMULATION_NAME} "*) *" ${EMULATION_NAME} "*)
LIB_PATH=${libdir} NATIVE=yes
for lib in ${NATIVE_LIB_DIRS}; do
case :${LIB_PATH}: in
*:${lib}:*) ;;
*) LIB_PATH=${LIB_PATH}:${lib} ;;
esac
done
# Linux modify the default library search path to first include
# a 64-bit specific directory.
case "$target" in
x86_64*-linux*)
suffix=64 ;;
esac
# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
if [ -n "$suffix" ]; then
case "$EMULATION_NAME" in
*64*)
LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,$suffix:,g`$LIB_PATH ;;
esac
fi ;;
esac esac
fi fi
# Linux modify the default library search path to first include
# a 64-bit specific directory.
case "$target" in
x86_64*-linux*)
case "$EMULATION_NAME" in
*64*) LIBPATH_SUFFIX=$suffix ;;
esac
;;
esac

View File

@ -13,7 +13,7 @@ cat >e${EMULATION_NAME}.c <<EOF
/* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME} /* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002 Free Software Foundation, Inc. 2002, 2003 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com> Written by Steve Chamberlain <sac@cygnus.com>
ELF support by Ian Lance Taylor <ian@cygnus.com> ELF support by Ian Lance Taylor <ian@cygnus.com>
@ -439,12 +439,48 @@ gld${EMULATION_NAME}_search_needed (path, name, force)
} }
EOF EOF
if [ "x${host}" = "x${target}" ] ; then if [ "x${USE_LIBPATH}" = xyes ] ; then
case " ${EMULATION_LIBPATH} " in case ${target} in
*" ${EMULATION_NAME} "*) *-*-linux-gnu*)
case ${target} in cat >>e${EMULATION_NAME}.c <<EOF
*-*-linux-gnu*)
cat >>e${EMULATION_NAME}.c <<EOF /* Add the sysroot to every entry in a colon-separated path. */
static char *
gld${EMULATION_NAME}_add_sysroot (path)
const char *path;
{
int len, colons, i;
char *ret, *p;
len = strlen (path);
colons = 0;
i = 0;
while (path[i])
if (path[i++] == ':')
colons++;
if (path[i])
colons++;
len = len + colons * strlen (ld_sysroot);
ret = xmalloc (len + 1);
strcpy (ret, ld_sysroot);
p = ret + strlen (ret);
i = 0;
while (path[i])
if (path[i] == ':')
{
strcpy (p, ld_sysroot);
p = p + strlen (p);
i++;
}
else
*p++ = path[i++];
*p = 0;
return ret;
}
/* For a native linker, check the file /etc/ld.so.conf for directories /* For a native linker, check the file /etc/ld.so.conf for directories
in which we may find shared libraries. /etc/ld.so.conf is really in which we may find shared libraries. /etc/ld.so.conf is really
@ -464,8 +500,11 @@ gld${EMULATION_NAME}_check_ld_so_conf (name, force)
if (! initialized) if (! initialized)
{ {
FILE *f; FILE *f;
char *tmppath;
f = fopen ("/etc/ld.so.conf", FOPEN_RT); tmppath = concat (ld_sysroot, "/etc/ld.so.conf", NULL);
f = fopen (tmppath, FOPEN_RT);
free (tmppath);
if (f != NULL) if (f != NULL)
{ {
char *b; char *b;
@ -515,6 +554,13 @@ gld${EMULATION_NAME}_check_ld_so_conf (name, force)
fclose (f); fclose (f);
if (b)
{
char *d = gld${EMULATION_NAME}_add_sysroot (b);
free (b);
b = d;
}
ld_so_conf = b; ld_so_conf = b;
} }
@ -528,9 +574,8 @@ gld${EMULATION_NAME}_check_ld_so_conf (name, force)
} }
EOF EOF
# Linux # Linux
;; ;;
esac
esac esac
fi fi
cat >>e${EMULATION_NAME}.c <<EOF cat >>e${EMULATION_NAME}.c <<EOF
@ -644,16 +689,12 @@ gld${EMULATION_NAME}_after_open ()
size_t len; size_t len;
search_dirs_type *search; search_dirs_type *search;
EOF EOF
if [ "x${host}" = "x${target}" ] ; then if [ "x${USE_LIBPATH}" = xyes ] ; then
case " ${EMULATION_LIBPATH} " in
*" ${EMULATION_NAME} "*)
cat >>e${EMULATION_NAME}.c <<EOF cat >>e${EMULATION_NAME}.c <<EOF
const char *lib_path; const char *lib_path;
struct bfd_link_needed_list *rp; struct bfd_link_needed_list *rp;
int found; int found;
EOF EOF
;;
esac
fi fi
cat >>e${EMULATION_NAME}.c <<EOF cat >>e${EMULATION_NAME}.c <<EOF
@ -661,13 +702,15 @@ cat >>e${EMULATION_NAME}.c <<EOF
l->name, force)) l->name, force))
break; break;
EOF EOF
if [ "x${host}" = "x${target}" ] ; then if [ "x${USE_LIBPATH}" = xyes ] ; then
case " ${EMULATION_LIBPATH} " in
*" ${EMULATION_NAME} "*)
cat >>e${EMULATION_NAME}.c <<EOF cat >>e${EMULATION_NAME}.c <<EOF
if (gld${EMULATION_NAME}_search_needed (command_line.rpath, if (gld${EMULATION_NAME}_search_needed (command_line.rpath,
l->name, force)) l->name, force))
break; break;
EOF
fi
if [ "x${NATIVE}" = xyes ] ; then
cat >>e${EMULATION_NAME}.c <<EOF
if (command_line.rpath_link == NULL if (command_line.rpath_link == NULL
&& command_line.rpath == NULL) && command_line.rpath == NULL)
{ {
@ -679,22 +722,25 @@ cat >>e${EMULATION_NAME}.c <<EOF
lib_path = (const char *) getenv ("LD_LIBRARY_PATH"); lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, force)) if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, force))
break; break;
EOF
fi
if [ "x${USE_LIBPATH}" = xyes ] ; then
cat >>e${EMULATION_NAME}.c <<EOF
found = 0; found = 0;
rp = bfd_elf_get_runpath_list (output_bfd, &link_info); rp = bfd_elf_get_runpath_list (output_bfd, &link_info);
for (; !found && rp != NULL; rp = rp->next) for (; !found && rp != NULL; rp = rp->next)
{ {
char *tmpname = gld${EMULATION_NAME}_add_sysroot (rp->name);
found = (rp->by == l->by found = (rp->by == l->by
&& gld${EMULATION_NAME}_search_needed (rp->name, && gld${EMULATION_NAME}_search_needed (tmpname,
l->name, l->name,
force)); force));
free (tmpname);
} }
if (found) if (found)
break; break;
EOF EOF
;;
esac
fi fi
cat >>e${EMULATION_NAME}.c <<EOF cat >>e${EMULATION_NAME}.c <<EOF
len = strlen (l->name); len = strlen (l->name);
@ -713,19 +759,15 @@ cat >>e${EMULATION_NAME}.c <<EOF
if (search != NULL) if (search != NULL)
break; break;
EOF EOF
if [ "x${host}" = "x${target}" ] ; then if [ "x${USE_LIBPATH}" = xyes ] ; then
case " ${EMULATION_LIBPATH} " in case ${target} in
*" ${EMULATION_NAME} "*) *-*-linux-gnu*)
case ${target} in cat >>e${EMULATION_NAME}.c <<EOF
*-*-linux-gnu*)
cat >>e${EMULATION_NAME}.c <<EOF
if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force)) if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
break; break;
EOF EOF
# Linux # Linux
;; ;;
esac
;;
esac esac
fi fi
cat >>e${EMULATION_NAME}.c <<EOF cat >>e${EMULATION_NAME}.c <<EOF

View File

@ -3,12 +3,12 @@
# #
# Usage: genscripts.sh srcdir libdir exec_prefix \ # Usage: genscripts.sh srcdir libdir exec_prefix \
# host target target_alias default_emulation \ # host target target_alias default_emulation \
# native_lib_dirs this_emulation tool_dir # native_lib_dirs use_sysroot this_emulation tool_dir
# #
# Sample usage: # Sample usage:
# genscripts.sh /djm/ld-devo/devo/ld /usr/local/lib /usr/local \ # genscripts.sh /djm/ld-devo/devo/ld /usr/local/lib /usr/local \
# sparc-sun-sunos4.1.3 sparc-sun-sunos4.1.3 sparc-sun-sunos4.1.3 sun4 \ # sparc-sun-sunos4.1.3 sparc-sun-sunos4.1.3 sparc-sun-sunos4.1.3 sun4 \
# "" sun3 sparc-sun-sunos4.1.3 # "" no sun3 sparc-sun-sunos4.1.3
# produces sun3.x sun3.xbn sun3.xn sun3.xr sun3.xu em_sun3.c # produces sun3.x sun3.xbn sun3.xn sun3.xr sun3.xu em_sun3.c
srcdir=$1 srcdir=$1
@ -19,8 +19,10 @@ target=$5
target_alias=$6 target_alias=$6
EMULATION_LIBPATH=$7 EMULATION_LIBPATH=$7
NATIVE_LIB_DIRS=$8 NATIVE_LIB_DIRS=$8
EMULATION_NAME=$9 use_sysroot=$9
shift 9 shift 9
EMULATION_NAME=$1
shift
# Can't use ${1:-$target_alias} here due to an Ultrix shell bug. # Can't use ${1:-$target_alias} here due to an Ultrix shell bug.
if [ "x$1" = "x" ] ; then if [ "x$1" = "x" ] ; then
tool_lib=${exec_prefix}/${target_alias}/lib tool_lib=${exec_prefix}/${target_alias}/lib
@ -37,31 +39,66 @@ else
mkdir ldscripts mkdir ldscripts
fi fi
# Set some flags for the emultempl scripts. USE_LIBPATH will
# be set for any libpath-using emulation; NATIVE will be set for a
# libpath-using emulation where ${host} = ${target}. NATIVE
# may already have been set by the emulparams file, but that's OK
# (it'll just get set to "yes" twice).
case " $EMULATION_LIBPATH " in
*" ${EMULATION_NAME} "*)
if [ "x${host}" = "x${target}" ] ; then
NATIVE=yes
USE_LIBPATH=yes
elif [ "x${use_sysroot}" = "xyes" ] ; then
USE_LIBPATH=yes
fi
;;
esac
# If the emulparams file sets NATIVE, make sure USE_LIBPATH is set also.
if test "x$NATIVE" = "xyes" ; then
USE_LIBPATH=yes
fi
# Set the library search path, for libraries named by -lfoo. # Set the library search path, for libraries named by -lfoo.
# If LIB_PATH is defined (e.g., by Makefile) and non-empty, it is used. # If LIB_PATH is defined (e.g., by Makefile) and non-empty, it is used.
# Otherwise, the default is set here. # Otherwise, the default is set here.
# #
# The format is the usual list of colon-separated directories. # The format is the usual list of colon-separated directories.
# To force a logically empty LIB_PATH, do LIBPATH=":". # To force a logically empty LIB_PATH, do LIBPATH=":".
#
# If we are using a sysroot, prefix library paths with "=" to indicate this.
#
# If the emulparams file set LIBPATH_SUFFIX, prepend an extra copy of
# the library path with the suffix applied.
if [ "x${LIB_PATH}" = "x" ] ; then if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then
if [ "x${host}" = "x${target}" ] ; then if [ x"$use_sysroot" != xyes ] ; then
case " $EMULATION_LIBPATH " in LIB_PATH=${libdir}
*" ${EMULATION_NAME} "*) fi
# Native, and default or emulation requesting LIB_PATH. for lib in ${NATIVE_LIB_DIRS}; do
LIB_PATH=${libdir} # The "=" is harmless if we aren't using a sysroot, but also needless.
for lib in ${NATIVE_LIB_DIRS}; do if [ "x${use_sysroot}" = "xyes" ] ; then
case :${LIB_PATH}: in lib="=${lib}"
*:${lib}:*) ;; fi
*) LIB_PATH=${LIB_PATH}:${lib} ;; case :${LIB_PATH}: in
esac *:${lib}:*) ;;
done ::) LIB_PATH=${lib} ;;
*) LIB_PATH=${LIB_PATH}:${lib} ;;
esac esac
done
if test -n "$LIBPATH_SUFFIX" ; then
LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,${LIBPATH_SUFFIX}:,g`$LIB_PATH
fi fi
fi fi
# Always search $(tooldir)/lib, aka /usr/local/TARGET/lib.
LIB_PATH=${tool_lib}:${LIB_PATH} # Always search $(tooldir)/lib, aka /usr/local/TARGET/lib, except for
# sysrooted configurations.
if [ "x${use_sysroot}" != "xyes" ] ; then
LIB_PATH=${tool_lib}:${LIB_PATH}
fi
LIB_SEARCH_DIRS=`echo ${LIB_PATH} | sed -e 's/:/ /g' -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");/g'` LIB_SEARCH_DIRS=`echo ${LIB_PATH} | sed -e 's/:/ /g' -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");/g'`

View File

@ -1,7 +1,7 @@
\input texinfo \input texinfo
@setfilename ld.info @setfilename ld.info
@c Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, @c Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
@c 2001, 2002 Free Software Foundation, Inc. @c 2001, 2002, 2003 Free Software Foundation, Inc.
@syncodeindex ky cp @syncodeindex ky cp
@include configdoc.texi @include configdoc.texi
@c (configdoc.texi is generated by the Makefile) @c (configdoc.texi is generated by the Makefile)
@ -60,7 +60,7 @@ END-INFO-DIR-ENTRY
This file documents the @sc{gnu} linker LD version @value{VERSION}. This file documents the @sc{gnu} linker LD version @value{VERSION}.
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000,
2001, 2002 Free Software Foundation, Inc. 2001, 2002, 2003 Free Software Foundation, Inc.
@ignore @ignore
@ -104,7 +104,8 @@ notice identical to this one except for the removal of this paragraph
@vskip 0pt plus 1filll @vskip 0pt plus 1filll
@c man begin COPYRIGHT @c man begin COPYRIGHT
Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc. Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001,
2002, 2003 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 under the terms of the GNU Free Documentation License, Version 1.1
@ -609,6 +610,9 @@ on the command line are searched before the default directories. All
@option{-L} options apply to all @option{-l} options, regardless of the @option{-L} options apply to all @option{-l} options, regardless of the
order in which the options appear. order in which the options appear.
If @var{searchdir} begins with @code{=}, then the @code{=} will be replaced
by the @dfn{sysroot prefix}, a path specified when the linker is configured.
@ifset UsesEnvVars @ifset UsesEnvVars
The default set of paths searched (without being specified with The default set of paths searched (without being specified with
@samp{-L}) depends on which emulation mode @command{ld} is using, and in @samp{-L}) depends on which emulation mode @command{ld} is using, and in

View File

@ -1,5 +1,5 @@
/* Linker file opening and searching. /* Linker file opening and searching.
Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002 Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker. This file is part of GLD, the Gnu Linker.
@ -88,6 +88,11 @@ ldfile_add_library_path (name, cmdline)
new->cmdline = cmdline; new->cmdline = cmdline;
*search_tail_ptr = new; *search_tail_ptr = new;
search_tail_ptr = &new->next; search_tail_ptr = &new->next;
/* If a directory is marked as honoring sysroot, prepend the sysroot path
now. */
if (new->name[0] == '=')
new->name = concat (ld_sysroot, &new->name[1], NULL);
} }
/* Try to open a BFD for a lang_input_statement. */ /* Try to open a BFD for a lang_input_statement. */

View File

@ -55,6 +55,10 @@ extern PTR sbrk ();
#endif #endif
#endif #endif
#ifndef TARGET_SYSTEM_ROOT
#define TARGET_SYSTEM_ROOT ""
#endif
int main PARAMS ((int, char **)); int main PARAMS ((int, char **));
static char *get_emulation PARAMS ((int, char **)); static char *get_emulation PARAMS ((int, char **));
@ -68,6 +72,9 @@ const char *output_filename = "a.out";
/* Name this program was invoked by. */ /* Name this program was invoked by. */
char *program_name; char *program_name;
/* The prefix for system library directories. */
char *ld_sysroot;
/* The file that we're creating. */ /* The file that we're creating. */
bfd *output_bfd = 0; bfd *output_bfd = 0;
@ -189,6 +196,23 @@ main (argc, argv)
xatexit (remove_output); xatexit (remove_output);
#ifdef TARGET_SYSTEM_ROOT_RELOCATABLE
ld_sysroot = make_relative_prefix (program_name, BINDIR,
TARGET_SYSTEM_ROOT);
if (ld_sysroot)
{
struct stat s;
int res = stat (ld_sysroot, &s) == 0 && S_ISDIR (s.st_mode);
if (!res)
{
free (ld_sysroot);
ld_sysroot = TARGET_SYSTEM_ROOT;
}
}
#else
ld_sysroot = TARGET_SYSTEM_ROOT;
#endif
/* Set the default BFD target based on the configured target. Doing /* Set the default BFD target based on the configured target. Doing
this permits the linker to be configured for a particular target, this permits the linker to be configured for a particular target,
and linked against a shared BFD library which was configured for and linked against a shared BFD library which was configured for

View File

@ -1,5 +1,5 @@
/* ldmain.h - /* ldmain.h -
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2002 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2002, 2003
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker. This file is part of GLD, the Gnu Linker.
@ -23,6 +23,7 @@
#define LDMAIN_H #define LDMAIN_H
extern char *program_name; extern char *program_name;
extern char *ld_sysroot;
extern bfd *output_bfd; extern bfd *output_bfd;
extern char *default_target; extern char *default_target;
extern bfd_boolean trace_files; extern bfd_boolean trace_files;