diff options
author | obrien <obrien@FreeBSD.org> | 2002-04-12 19:33:52 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2002-04-12 19:33:52 +0000 |
commit | 18ff9f4f1bddd11c341a37177885ac89fcccedd9 (patch) | |
tree | b6180daa6d6e558ce86214f98d103e01ff4e70ff /contrib/binutils/ld | |
parent | 1d1ccbf8e10277966ecf3c150370a50c9e184b35 (diff) | |
download | FreeBSD-src-18ff9f4f1bddd11c341a37177885ac89fcccedd9.zip FreeBSD-src-18ff9f4f1bddd11c341a37177885ac89fcccedd9.tar.gz |
Import of Binutils from the FSF 2.12 branch.
(this fixes several linker problems and coredumps)
These bits are taken from the FSF anoncvs repo on 10-April-2002 13:24 Zulu
Diffstat (limited to 'contrib/binutils/ld')
22 files changed, 282 insertions, 415 deletions
diff --git a/contrib/binutils/ld/ChangeLog b/contrib/binutils/ld/ChangeLog index 941ffeb..0848b49 100644 --- a/contrib/binutils/ld/ChangeLog +++ b/contrib/binutils/ld/ChangeLog @@ -1,3 +1,51 @@ +2002-04-04 Alan Modra <amodra@bigpond.net.au> + + * dep-in.sed: Cope with absolute paths. + * Makefile.am (dep.sed): Subst TOPDIR and BFDDIR. + Run "make dep-am". + * Makefile.in: Regenerate. + + Merge from mainline. + 2002-03-28 Alan Modra <amodra@bigpond.net.au> + * configure.host: Set up for generic hosts first, then tweak as + necessary in more specific targets. + (HOSTING_LIBS): Include libgcc_eh.a if found. + +2002-03-28 Alan Modra <amodra@bigpond.net.au> + + Merge from mainline. + 2002-03-21 Albert Chin-A-Young <china@thewrittenword.com> + * genscripts.sh (LIB_SEARCH_DIRS): Quote path. + + 2002-03-20 Alan Modra <amodra@bigpond.net.au> + * ldlang.c (ldlang_add_undef): If the output bfd has been opened, + add the symbol to the linker hash table immediately. + (lang_place_undefineds): Split symbol creation out.. + (insert_undefined): ..to here. + + 2002-03-18 Alan Modra <amodra@bigpond.net.au> + * ldmain.c (main): Move .text readonly flag fudges from here.. + * ldlang.c (lang_process): ..to here. + + 2002-03-14 Alan Modra <amodra@bigpond.net.au> + * ldlang.c (lang_check): Remove the word size check added in last + change. Treat emitrelocations case as for relocatable links. + + 2002-03-13 Alan Modra <amodra@bigpond.net.au> + * ldlang.c (lang_check): Do relocatable link checks first, so that + warn_mismatch can't override. Check compatible and word size too. + + 2002-03-04 H.J. Lu <hjl@gnu.org> + * scripttempl/elf.sc: Put .preinit_array, .init_array and + .fini_array in the data segment. + + 2002-03-04 Alan Modra <amodra@bigpond.net.au> + * scripttempl/elf.sc: Correct syntax errors in 2002-03-01 commit. + + 2002-03-01 David Mosberger <davidm@hpl.hp.com> + * scripttempl/elf.sc (SECTIONS): Add entries for .preinit_array, + .init_array, and .fini_array. + 2002-03-18 David O'Brien <obrien@FreeBSD.org> * emultempl/elf32.em: Use lbasename vs. basename to fix problem where @@ -8,10 +56,7 @@ Mon Mar 18 18:07:20 CET 2002 Jan Hubicka <jh@suse.cz> Andreas Jaeger <aj@suse.de> Andreas Schwab <schwab@suse.de> - * cpu-i386.c (bfd_x86_64_arch): Rename to "i386:x86-64" - * configure.tgt (x86_64-*-linux-gnu*): Configure i386 as native. - * elf_x86_64.sh (ARCH): Set to i386:x86-64 set libraries to default to lib64 paths. diff --git a/contrib/binutils/ld/Makefile.am b/contrib/binutils/ld/Makefile.am index bff2045..3959ac5 100644 --- a/contrib/binutils/ld/Makefile.am +++ b/contrib/binutils/ld/Makefile.am @@ -1175,7 +1175,9 @@ DEP1: $(CFILES) $(GENERATED_CFILES) dep.sed: dep-in.sed config.status sed <$(srcdir)/dep-in.sed >dep.sed \ -e 's!@INCDIR@!$(INCDIR)!' \ - -e 's!@SRCDIR@!$(srcdir)!' + -e 's!@BFDDIR@!$(BFDDIR)!' \ + -e 's!@SRCDIR@!$(srcdir)!' \ + -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/ld$$,,`'!' dep: DEP sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile @@ -1258,16 +1260,17 @@ pe-dll.o: pe-dll.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ ld.h $(INCDIR)/bin-bugs.h ldexp.h ldlang.h ldwrite.h \ ldmisc.h ldgram.h ldmain.h ldfile.h ldemul.h $(INCDIR)/coff/internal.h \ - ../bfd/libcoff.h deffile.h pe-dll.h + $(BFDDIR)/libcoff.h deffile.h pe-dll.h ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \ ldver.h ldlang.h ldfile.h ldemul.h ldmisc.h ldmain.h \ mri.h ldctor.h ldlex.h -ldlex.o: ldlex.c ../bfd/bfd.h $(INCDIR)/symcat.h sysdep.h \ - config.h $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h \ - ld.h $(INCDIR)/bin-bugs.h ldgram.h ldmisc.h ldexp.h \ - ldlang.h ldfile.h ldlex.h ldmain.h $(INCDIR)/libiberty.h +ldlex.o: ldlex.c $(INCDIR)/ansidecl.h ../bfd/bfd.h \ + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/safe-ctype.h ld.h $(INCDIR)/bin-bugs.h ldgram.h \ + ldmisc.h ldexp.h ldlang.h ldfile.h ldlex.h ldmain.h \ + $(INCDIR)/libiberty.h deffilep.o: deffilep.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ $(INCDIR)/safe-ctype.h ../bfd/bfd.h $(INCDIR)/symcat.h \ sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \ diff --git a/contrib/binutils/ld/Makefile.in b/contrib/binutils/ld/Makefile.in index b778681..1521f5e 100644 --- a/contrib/binutils/ld/Makefile.in +++ b/contrib/binutils/ld/Makefile.in @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -507,7 +507,7 @@ deffilep.c ldgram.c ldlex.c DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(ld_new_SOURCES) $(EXTRA_ld_new_SOURCES) OBJECTS = $(ld_new_OBJECTS) @@ -695,7 +695,7 @@ uninstall-info: else ii=; fi; \ list='$(INFO_DEPS)'; \ for file in $$list; do \ - test -z "$ii" \ + test -z "$$ii" \ || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \ done @$(NORMAL_UNINSTALL) @@ -808,7 +808,7 @@ maintainer-clean-recursive: dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ - test "$$subdir" = "." && dot_seen=yes; \ + test "$$subdir" != "." || dot_seen=yes; \ done; \ test "$$dot_seen" = "no" && rev=". $$rev"; \ target=`echo $@ | sed s/-recursive//`; \ @@ -1870,7 +1870,9 @@ DEP1: $(CFILES) $(GENERATED_CFILES) dep.sed: dep-in.sed config.status sed <$(srcdir)/dep-in.sed >dep.sed \ -e 's!@INCDIR@!$(INCDIR)!' \ - -e 's!@SRCDIR@!$(srcdir)!' + -e 's!@BFDDIR@!$(BFDDIR)!' \ + -e 's!@SRCDIR@!$(srcdir)!' \ + -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/ld$$,,`'!' dep: DEP sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile @@ -1953,16 +1955,17 @@ pe-dll.o: pe-dll.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ ld.h $(INCDIR)/bin-bugs.h ldexp.h ldlang.h ldwrite.h \ ldmisc.h ldgram.h ldmain.h ldfile.h ldemul.h $(INCDIR)/coff/internal.h \ - ../bfd/libcoff.h deffile.h pe-dll.h + $(BFDDIR)/libcoff.h deffile.h pe-dll.h ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \ ldver.h ldlang.h ldfile.h ldemul.h ldmisc.h ldmain.h \ mri.h ldctor.h ldlex.h -ldlex.o: ldlex.c ../bfd/bfd.h $(INCDIR)/symcat.h sysdep.h \ - config.h $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h \ - ld.h $(INCDIR)/bin-bugs.h ldgram.h ldmisc.h ldexp.h \ - ldlang.h ldfile.h ldlex.h ldmain.h $(INCDIR)/libiberty.h +ldlex.o: ldlex.c $(INCDIR)/ansidecl.h ../bfd/bfd.h \ + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/safe-ctype.h ld.h $(INCDIR)/bin-bugs.h ldgram.h \ + ldmisc.h ldexp.h ldlang.h ldfile.h ldlex.h ldmain.h \ + $(INCDIR)/libiberty.h deffilep.o: deffilep.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ $(INCDIR)/safe-ctype.h ../bfd/bfd.h $(INCDIR)/symcat.h \ sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \ diff --git a/contrib/binutils/ld/configure.host b/contrib/binutils/ld/configure.host index fc79d83..56a950c 100644 --- a/contrib/binutils/ld/configure.host +++ b/contrib/binutils/ld/configure.host @@ -11,11 +11,51 @@ HDEFINES= HOSTING_CRT0=/lib/crt0.o -HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc' +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= +# +# Generic configurations: +# + +case "${host}" in + +*-*-freebsd*) + NATIVE_LIB_DIRS=/usr/lib + # 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 + # dummy specs files to handle this. + echo "-dynamic-linker `${CC} --print-file-name=ld-elf.so.1`" > specs + HOSTING_CRT0='-dynamic-linker `${CC} --print-file-name=ld-elf.so.1` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `${CC} --print-file-name=crtbegin.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`' + ;; + +*-*-linux*aout* | *-*-linux*oldld) + HOSTING_CRT0=/usr/lib/crt0.o + ;; + +*-*-linux*libc1*) + HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`' + HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o' + ;; + +*-*-linux*) + HOSTING_CRT0='-dynamic-linker `egrep "ld[^ ]*\.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*\.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`' + ;; + +esac + +# +# Now more specific configurations +# + case "${host}" in +*-*-linux*aout* | *-*-linux*oldld | *-*-linux*libc1*) + # No further tweaking needed + ;; + alpha*-*-netbsd*) # The new BSD `make' has a bug: it doesn't pass empty arguments in # shell commands. So we need to make this value non-empty in order @@ -26,8 +66,7 @@ alpha*-*-netbsd*) ;; arm*-*-linux-gnu*) - HOSTING_CRT0='-p -dynamic-linker `fgrep ld-linux.so \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld-linux.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='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `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_CRT0='-p '`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]*\*,ld-linux,g"` ;; i[3456]86-*-bsd* | i[34567]86-*-freebsd[12] | i[34567]86-*-freebsd[12]\.* | i[34567]86-*-freebsd*aout* | i[3456]86-*-netbsd*) @@ -41,23 +80,23 @@ i[3456]86-*-bsd* | i[34567]86-*-freebsd[12] | i[34567]86-*-freebsd[12]\.* | i[34 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_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `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/ccs/lib ;; i[3456]86-sequent-ptx* | i[3456]86-sequent-sysv*) HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`' + HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`' ;; i[3456]86-*-sysv*) HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; fi` /lib/crtn.o' + HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; fi` /lib/crtn.o' ;; 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_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `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/ccs/lib ;; @@ -73,46 +112,31 @@ i[3456]86-*-sco* | i[3456]86-*-isc*) ${CC} -c crtend.c -o crtend.o rm -f crtend.c HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /lib/crtn.o' - ;; - -i[3456]86-*-linux*aout* | i[3456]86-*-linux*oldld) - HOSTING_CRT0=/usr/lib/crt0.o - ;; - -i[3456]86-*-linux*libc1*) - HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o' - ;; - -i[3456]86-*-linux-gnu*) - HOSTING_CRT0='-dynamic-linker `fgrep ld-linux.so \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld-linux.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='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `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="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /lib/crtn.o' ;; i[3456]86-*-lynxos*) HOSTING_CRT0=/lib/init1.o - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc -lm /lib/initn.o' + HOSTING_LIBS="$HOSTING_LIBS"' -lm /lib/initn.o' ;; i[3456]86-pc-interix*) HOSTING_CRT0='$$INTERIX_ROOT/usr/lib/crt0.o' NATIVE_LIB_DIRS='$$INTERIX_ROOT/usr/lib/' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L $$X/local_bin -L $$INTERIX_ROOT/usr/lib -lc -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' ;; i[3456]86-*-cygwin*) - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`' + HOSTING_LIBS="$HOSTING_LIBS"' -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`' ;; ia64-*-linux-gnu*) - HOSTING_CRT0='-dynamic-linker `egrep "ld-linux-ia64.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld-linux-ia64.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='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `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_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]*\*,ld-linux-ia64,g"` ;; 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_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `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/lib/ia64l64 ;; @@ -120,48 +144,32 @@ mips*-dec-bsd*) HOSTING_CRT0=/usr/lib/crt0.o ;; -mips*-sgi-irix4*) +mips*-sgi-irix4* | mips*-sgi-irix5*) HOSTING_CRT0=/usr/lib/crt1.o - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o' - ;; - -mips*-sgi-irix5*) - HOSTING_CRT0=/usr/lib/crt1.o - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o' + HOSTING_LIBS="$HOSTING_LIBS"' /usr/lib/crtn.o' ;; mips*-sgi-irix6*) HOSTING_CRT0='/usr/lib32/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o ; else ${CC} -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L/usr/lib32 -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o ; else ${CC} -print-file-name=crtend.o; fi` /usr/lib32/crtn.o -init __do_global_ctors -fini __do_global_dtors' + HOSTING_LIBS='-L/usr/lib32 '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o ; else ${CC} -print-file-name=crtend.o; fi` /usr/lib32/crtn.o -init __do_global_ctors -fini __do_global_dtors' ;; mips*-*-linux-gnu*) - HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o' - ;; - -m68*-*-linux*aout*) - HOSTING_CRT0=/usr/lib/crt0.o - ;; - -m68*-*-linux*libc1*) - HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o' + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"` ;; m68*-*-linux-gnu*) - HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o' + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"` ;; m68*-*-lynxos*) HOSTING_CRT0=/lib/init1.o - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc -lm /lib/initn.o' + HOSTING_LIBS="$HOSTING_LIBS"' -lm /lib/initn.o' ;; m68*-motorola-sysv) HOSTING_CRT0='`if [ -f ../gcc/crt0.o ]; then echo ../gcc/crt0.o; elif [ -f \`${CC} -print-file-name=\`crt0.o ]; then echo \`${CC} -print-file-name=\`crt0.o; else echo /lib/crt0.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc881 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`' + HOSTING_LIBS=`echo "$HOSTING_LIBS" | sed -e "s,-lc,-lc881,"` ;; m68*-sun-*) @@ -176,62 +184,43 @@ m88*-*-dgux*) m88*-motorola-sysv3) HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`' + HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`' ;; powerpc*-*-linux-gnu*) - HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o' + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"` ;; s390x-*-linux-gnu*) - HOSTING_CRT0='-dynamic-linker /lib/ld64.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='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L `dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `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_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld64.so.1,"` ;; s390-*-linux-gnu*) - HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o' + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"` ;; 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_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `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/ccs/lib ;; sparc-*-linux-gnu*) - HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.2 `${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='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `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_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld-linux.so.2,"` ;; sparc64-*-linux-gnu*) - HOSTING_CRT0='-dynamic-linker /lib64/ld-linux.so.2 `${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='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `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_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib64/ld-linux.so.2,"` ;; x86_64-*-linux-gnu*) - HOSTING_CRT0='-dynamic-linker /lib64/ld-linux-x86-64.so.2 `${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='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `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_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib64/ld-linux-x86-64.so.2,"` ;; -# -# Generic configurations: -# - *-*-freebsd*) - NATIVE_LIB_DIRS=/usr/lib - # 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 - # dummy specs files to handle this. - echo "-dynamic-linker `${CC} --print-file-name=ld-elf.so.1`" > specs - HOSTING_CRT0='-dynamic-linker `${CC} --print-file-name=ld-elf.so.1` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `${CC} --print-file-name=crtbegin.o`' - HOSTING_LIBS='`${CC} -print-libgcc-file-name` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `${CC} -print-libgcc-file-name` `${CC} --print-file-name=crtend.o` `${CC} --print-file-name=crtn.o`' ;; *-*-linux*) - HOSTING_CRT0='-dynamic-linker `egrep "ld[^ ]*\.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*.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='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`' ;; alpha*-*-*) diff --git a/contrib/binutils/ld/dep-in.sed b/contrib/binutils/ld/dep-in.sed index 89b1201..aad7d92 100644 --- a/contrib/binutils/ld/dep-in.sed +++ b/contrib/binutils/ld/dep-in.sed @@ -3,6 +3,9 @@ /\\$/b loop s!@INCDIR@!$(INCDIR)!g +s!@TOPDIR@/include!$(INCDIR)!g +s!@BFDDIR@!$(BFDDIR)!g +s!@TOPDIR@/bfd!$(BFDDIR)!g s!@SRCDIR@/!!g s! \.\./bfd/hosts/[^ ]*\.h! !g diff --git a/contrib/binutils/ld/emulparams/elf32bmip.sh b/contrib/binutils/ld/emulparams/elf32bmip.sh index 473c411..fa7d671 100644 --- a/contrib/binutils/ld/emulparams/elf32bmip.sh +++ b/contrib/binutils/ld/emulparams/elf32bmip.sh @@ -1,22 +1,27 @@ +# If you change this file, please also look at files which source this one: +# elf32b4300.sh elf32bsmip.sh elf32btsmip.sh elf32ebmip.sh elf32lmip.sh + SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-bigmips" BIG_OUTPUT_FORMAT="elf32-bigmips" LITTLE_OUTPUT_FORMAT="elf32-littlemips" TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 +test -n "${EMBEDDED}" || DATA_ADDR=0x10000000 MAXPAGESIZE=0x40000 NONPAGED_TEXT_START_ADDR=0x0400000 SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' +test -n "${EMBEDDED}" || TEXT_DYNAMIC= +INITIAL_READONLY_SECTIONS=" + .reginfo ${RELOCATING-0} : { *(.reginfo) } +" OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' OTHER_GOT_SYMBOLS=' _gp = ALIGN(16) + 0x7ff0; ' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' +OTHER_SDATA_SECTIONS=" + .lit8 ${RELOCATING-0} : { *(.lit8) } + .lit4 ${RELOCATING-0} : { *(.lit4) } +" TEXT_START_SYMBOLS='_ftext = . ;' DATA_START_SYMBOLS='_fdata = . ;' OTHER_BSS_SYMBOLS='_fbss = .;' @@ -27,4 +32,5 @@ OTHER_SECTIONS=' ARCH=mips MACHINE= TEMPLATE_NAME=elf32 +EXTRA_EM_FILE=mipself GENERATE_SHLIB_SCRIPT=yes diff --git a/contrib/binutils/ld/emulparams/elf32bmipn32.sh b/contrib/binutils/ld/emulparams/elf32bmipn32.sh index 56f42a9..8dc1735 100755 --- a/contrib/binutils/ld/emulparams/elf32bmipn32.sh +++ b/contrib/binutils/ld/emulparams/elf32bmipn32.sh @@ -1,3 +1,6 @@ +# If you change this file, please also look at files which source this one: +# elf64bmip.sh elf64btsmip.sh + # This is an ELF platform. SCRIPT_NAME=elf @@ -17,11 +20,11 @@ ENTRY=__start OTHER_GOT_SYMBOLS=' _gp = ALIGN(16) + 0x7ff0; ' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } - .srdata : { *(.srdata) } -' +OTHER_SDATA_SECTIONS=" + .lit8 ${RELOCATING-0} : { *(.lit8) } + .lit4 ${RELOCATING-0} : { *(.lit4) } + .srdata ${RELOCATING-0} : { *(.srdata) } +" # Magic symbols. TEXT_START_SYMBOLS='_ftext = . ;' @@ -41,35 +44,28 @@ EXECUTABLE_SYMBOLS=" # segment. WRITABLE_RODATA= -OTHER_RELOCATING_SECTIONS=' - .MIPS.events.text : +OTHER_SECTIONS=" + .MIPS.events.text ${RELOCATING-0} : { - *(.MIPS.events.text) - *(.MIPS.events.gnu.linkonce.t*) + *(.MIPS.events.text${RELOCATING+ .MIPS.events.gnu.linkonce.t*}) } - .MIPS.content.text : + .MIPS.content.text ${RELOCATING-0} : { - *(.MIPS.content.text) - *(.MIPS.content.gnu.linkonce.t*) + *(.MIPS.content.text${RELOCATING+ .MIPS.content.gnu.linkonce.t*}) } - .MIPS.events.data : + .MIPS.events.data ${RELOCATING-0} : { - *(.MIPS.events.data) - *(.MIPS.events.gnu.linkonce.d*) + *(.MIPS.events.data${RELOCATING+ .MIPS.events.gnu.linkonce.d*}) } - .MIPS.content.data : + .MIPS.content.data ${RELOCATING-0} : { - *(.MIPS.content.data) - *(.MIPS.content.gnu.linkonce.d*) + *(.MIPS.content.data${RELOCATING+ .MIPS.content.gnu.linkonce.d*}) } - .MIPS.events.rodata : + .MIPS.events.rodata ${RELOCATING-0} : { - *(.MIPS.events.rodata) - *(.MIPS.events.gnu.linkonce.r*) + *(.MIPS.events.rodata${RELOCATING+ .MIPS.events.gnu.linkonce.r*}) } - .MIPS.content.rodata : + .MIPS.content.rodata ${RELOCATING-0} : { - *(.MIPS.content.rodata) - *(.MIPS.content.gnu.linkonce.r*) - } -' + *(.MIPS.content.rodata${RELOCATING+ .MIPS.content.gnu.linkonce.r*}) + }" diff --git a/contrib/binutils/ld/emulparams/elf32bsmip.sh b/contrib/binutils/ld/emulparams/elf32bsmip.sh index 09f1307..5b2939a 100755 --- a/contrib/binutils/ld/emulparams/elf32bsmip.sh +++ b/contrib/binutils/ld/emulparams/elf32bsmip.sh @@ -1,31 +1,2 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes +. ${srcdir}/emulparams/elf32bmip.sh ENTRY=__start diff --git a/contrib/binutils/ld/emulparams/elf32ebmip.sh b/contrib/binutils/ld/emulparams/elf32ebmip.sh index 00ea8fd..704b43e 100644 --- a/contrib/binutils/ld/emulparams/elf32ebmip.sh +++ b/contrib/binutils/ld/emulparams/elf32ebmip.sh @@ -1,28 +1,2 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes EMBEDDED=yes +. ${srcdir}/emulparams/elf32bmip.sh diff --git a/contrib/binutils/ld/emulparams/elf32elmip.sh b/contrib/binutils/ld/emulparams/elf32elmip.sh index cf008c8..c94e503 100644 --- a/contrib/binutils/ld/emulparams/elf32elmip.sh +++ b/contrib/binutils/ld/emulparams/elf32elmip.sh @@ -1,28 +1,2 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlemips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes EMBEDDED=yes +. ${srcdir}/emulparams/elf32lmip.sh diff --git a/contrib/binutils/ld/emulparams/elf32lmip.sh b/contrib/binutils/ld/emulparams/elf32lmip.sh index 23312f4..14d4ded 100644 --- a/contrib/binutils/ld/emulparams/elf32lmip.sh +++ b/contrib/binutils/ld/emulparams/elf32lmip.sh @@ -1,30 +1,7 @@ -SCRIPT_NAME=elf +# If you change this file, please also look at files which source this one: +# elf32elmip.sh elf32lsmip.sh + +. ${srcdir}/emulparams/elf32bmip.sh OUTPUT_FORMAT="elf32-littlemips" BIG_OUTPUT_FORMAT="elf32-bigmips" LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes diff --git a/contrib/binutils/ld/emulparams/elf32lsmip.sh b/contrib/binutils/ld/emulparams/elf32lsmip.sh index 4bdc8a1..62e4f98 100755 --- a/contrib/binutils/ld/emulparams/elf32lsmip.sh +++ b/contrib/binutils/ld/emulparams/elf32lsmip.sh @@ -1,31 +1,2 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlemips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes +. ${srcdir}/emulparams/elf32lmip.sh ENTRY=__start diff --git a/contrib/binutils/ld/emulparams/elf64bmip.sh b/contrib/binutils/ld/emulparams/elf64bmip.sh index a4852d5..990fcb6 100755 --- a/contrib/binutils/ld/emulparams/elf64bmip.sh +++ b/contrib/binutils/ld/emulparams/elf64bmip.sh @@ -1,79 +1,12 @@ -# This is an ELF platform. -SCRIPT_NAME=elf - -# Handle both big- and little-ended 32-bit MIPS objects. -ARCH=mips +. ${srcdir}/emulparams/elf32bmipn32.sh OUTPUT_FORMAT="elf64-bigmips" BIG_OUTPUT_FORMAT="elf64-bigmips" LITTLE_OUTPUT_FORMAT="elf64-littlemips" - -# Note that the elf32 template is used for 64-bit emulations as well -# as 32-bit emulations. ELFSIZE=64 -TEMPLATE_NAME=elf32 - -TEXT_START_ADDR=0x10000000 -MAXPAGESIZE=0x100000 -ENTRY=__start - -# GOT-related settings. -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } - .srdata : { *(.srdata) } -' -# Magic symbols. -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' # IRIX6 defines these symbols. 0x40 is the size of the ELF header. EXECUTABLE_SYMBOLS=" __dso_displacement = 0; __elf_header = ${TEXT_START_ADDR}; __program_header_table = ${TEXT_START_ADDR} + 0x40; " - -# There are often dynamic relocations against the .rodata section. -# Setting DT_TEXTREL in the .dynamic section does not convince the -# IRIX6 linker to permit relocations against the text segment. -# Following the IRIX linker, we simply put .rodata in the data -# segment. -WRITABLE_RODATA= - - -OTHER_RELOCATING_SECTIONS=' - .MIPS.events.text : - { - *(.MIPS.events.text) - *(.MIPS.events.gnu.linkonce.t*) - } - .MIPS.content.text : - { - *(.MIPS.content.text) - *(.MIPS.content.gnu.linkonce.t*) - } - .MIPS.events.data : - { - *(.MIPS.events.data) - *(.MIPS.events.gnu.linkonce.d*) - } - .MIPS.content.data : - { - *(.MIPS.content.data) - *(.MIPS.content.gnu.linkonce.d*) - } - .MIPS.events.rodata : - { - *(.MIPS.events.rodata) - *(.MIPS.events.gnu.linkonce.r*) - } - .MIPS.content.rodata : - { - *(.MIPS.content.rodata) - *(.MIPS.content.gnu.linkonce.r*) - } -' diff --git a/contrib/binutils/ld/emulparams/shelf.sh b/contrib/binutils/ld/emulparams/shelf.sh index 95db587..27b73b6 100755 --- a/contrib/binutils/ld/emulparams/shelf.sh +++ b/contrib/binutils/ld/emulparams/shelf.sh @@ -1,3 +1,6 @@ +# If you change this file, please also look at files which source this one: +# shlelf.sh, shelf_nbsd.sh + SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-sh" TEXT_START_ADDR=0x1000 @@ -14,4 +17,4 @@ CTOR_START='___ctors = .;' CTOR_END='___ctors_end = .;' DTOR_START='___dtors = .;' DTOR_END='___dtors_end = .;' -OTHER_RELOCATING_SECTIONS='.stack 0x30000 : { _stack = .; *(.stack) }' +STACK_ADDR=0x30000 diff --git a/contrib/binutils/ld/emulparams/shelf_linux.sh b/contrib/binutils/ld/emulparams/shelf_linux.sh index d7b7631..b841bef 100644 --- a/contrib/binutils/ld/emulparams/shelf_linux.sh +++ b/contrib/binutils/ld/emulparams/shelf_linux.sh @@ -1,14 +1,2 @@ -SCRIPT_NAME=elf +. ${srcdir}/emulparams/shlelf_linux.sh OUTPUT_FORMAT="elf32-shbig-linux" -TEXT_START_ADDR=0x400000 -MAXPAGESIZE=0x10000 -ARCH=sh -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes - -DATA_START_SYMBOLS='__data_start = . ;'; - -OTHER_READWRITE_SECTIONS=' - .note.ABI-tag : { *(.note.ABI-tag) } -' diff --git a/contrib/binutils/ld/emulparams/shl.sh b/contrib/binutils/ld/emulparams/shl.sh index 360aac8..5fbb165 100644 --- a/contrib/binutils/ld/emulparams/shl.sh +++ b/contrib/binutils/ld/emulparams/shl.sh @@ -1,5 +1,2 @@ -SCRIPT_NAME=sh +. ${srcdir}/emulparams/sh.sh OUTPUT_FORMAT="coff-shl" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 -ARCH=sh diff --git a/contrib/binutils/ld/emulparams/shlelf.sh b/contrib/binutils/ld/emulparams/shlelf.sh index bb27f86..e19678b 100755 --- a/contrib/binutils/ld/emulparams/shlelf.sh +++ b/contrib/binutils/ld/emulparams/shlelf.sh @@ -1,17 +1,2 @@ -SCRIPT_NAME=elf +. ${srcdir}/emulparams/shelf.sh OUTPUT_FORMAT="elf32-shl" -TEXT_START_ADDR=0x1000 -MAXPAGESIZE=128 -ARCH=sh -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -EMBEDDED=yes - -# These are for compatibility with the COFF toolchain. -ENTRY=start -CTOR_START='___ctors = .;' -CTOR_END='___ctors_end = .;' -DTOR_START='___dtors = .;' -DTOR_END='___dtors_end = .;' -OTHER_RELOCATING_SECTIONS='.stack 0x30000 : { _stack = .; *(.stack) }' diff --git a/contrib/binutils/ld/genscripts.sh b/contrib/binutils/ld/genscripts.sh index 501a68c..fe1fa49 100755 --- a/contrib/binutils/ld/genscripts.sh +++ b/contrib/binutils/ld/genscripts.sh @@ -69,7 +69,7 @@ fi # Always search $(tooldir)/lib, aka /usr/local/TARGET/lib. LIB_PATH=${LIB_PATH}:${tool_lib} -LIB_SEARCH_DIRS=`echo ${LIB_PATH} | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g'` +LIB_SEARCH_DIRS=`echo ${LIB_PATH} | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");/g'` # Generate 5 or 6 script files from a master script template in # ${srcdir}/scripttempl/${SCRIPT_NAME}.sh. Which one of the 5 or 6 diff --git a/contrib/binutils/ld/ldlang.c b/contrib/binutils/ld/ldlang.c index a5b1dd7..5257547 100644 --- a/contrib/binutils/ld/ldlang.c +++ b/contrib/binutils/ld/ldlang.c @@ -92,6 +92,7 @@ static bfd *open_output PARAMS ((const char *)); static void ldlang_open_output PARAMS ((lang_statement_union_type *)); static void open_input_bfds PARAMS ((lang_statement_union_type *, boolean)); static void lang_reasonable_defaults PARAMS ((void)); +static void insert_undefined PARAMS ((const char *)); static void lang_place_undefineds PARAMS ((void)); static void map_input_to_output_sections PARAMS ((lang_statement_union_type *, const char *, @@ -2007,7 +2008,11 @@ lang_reasonable_defaults () } /* Add the supplied name to the symbol table as an undefined reference. - Remove items from the chain as we open input bfds. */ + This is a two step process as the symbol table doesn't even exist at + the time the ld command line is processed. First we put the name + on a list, then, once the output file has been opened, transfer the + name to the symbol table. */ + typedef struct ldlang_undef_chain_list { struct ldlang_undef_chain_list *next; @@ -2028,6 +2033,28 @@ ldlang_add_undef (name) ldlang_undef_chain_list_head = new; new->name = xstrdup (name); + + if (output_bfd != NULL) + insert_undefined (new->name); +} + +/* Insert NAME as undefined in the symbol table. */ + +static void +insert_undefined (name) + const char *name; +{ + struct bfd_link_hash_entry *h; + + h = bfd_link_hash_lookup (link_info.hash, name, true, false, true); + if (h == (struct bfd_link_hash_entry *) NULL) + einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n")); + if (h->type == bfd_link_hash_new) + { + h->type = bfd_link_hash_undefined; + h->u.undef.abfd = NULL; + bfd_link_add_undef (link_info.hash, h); + } } /* Run through the list of undefineds created above and place them @@ -2043,17 +2070,7 @@ lang_place_undefineds () ptr != (ldlang_undef_chain_list_type *) NULL; ptr = ptr->next) { - struct bfd_link_hash_entry *h; - - h = bfd_link_hash_lookup (link_info.hash, ptr->name, true, false, true); - if (h == (struct bfd_link_hash_entry *) NULL) - einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n")); - if (h->type == bfd_link_hash_new) - { - h->type = bfd_link_hash_undefined; - h->u.undef.abfd = NULL; - bfd_link_add_undef (link_info.hash, h); - } + insert_undefined (ptr->name); } } @@ -3517,8 +3534,25 @@ lang_check () file = file->input_statement.next) { input_bfd = file->input_statement.the_bfd; - compatible = bfd_arch_get_compatible (input_bfd, - output_bfd); + compatible = bfd_arch_get_compatible (input_bfd, output_bfd); + + /* In general it is not possible to perform a relocatable + link between differing object formats when the input + file has relocations, because the relocations in the + input format may not have equivalent representations in + the output format (and besides BFD does not translate + relocs for other link purposes than a final link). */ + if ((link_info.relocateable || link_info.emitrelocations) + && (compatible == NULL + || bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd)) + && (bfd_get_file_flags (input_bfd) & HAS_RELOC) != 0) + { + einfo (_("%P%F: Relocatable linking with relocations from format %s (%B) to format %s (%B) is not supported\n"), + bfd_get_target (input_bfd), input_bfd, + bfd_get_target (output_bfd), output_bfd); + /* einfo with %F exits. */ + } + if (compatible == NULL) { if (command_line.warn_mismatch) @@ -3526,18 +3560,6 @@ lang_check () bfd_printable_name (input_bfd), input_bfd, bfd_printable_name (output_bfd)); } - else if (link_info.relocateable - /* In general it is not possible to perform a relocatable - link between differing object formats when the input - file has relocations, because the relocations in the - input format may not have equivalent representations in - the output format (and besides BFD does not translate - relocs for other link purposes than a final link). */ - && bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd) - && (bfd_get_file_flags (input_bfd) & HAS_RELOC) != 0) - einfo (_("%P%F: Relocatable linking with relocations from format %s (%B) to format %s (%B) is not supported\n"), - bfd_get_target (input_bfd), input_bfd, - bfd_get_target (output_bfd), output_bfd); else if (bfd_count_sections (input_bfd)) { /* If the input bfd has no contents, it shouldn't set the @@ -4141,6 +4163,22 @@ lang_process () /* Find any sections not attached explicitly and handle them. */ lang_place_orphans (); + if (! link_info.relocateable) + { + /* Look for a text section and set the readonly attribute in it. */ + asection *found = bfd_get_section_by_name (output_bfd, ".text"); + + if (found != (asection *) NULL) + { + if (config.text_read_only) + found->flags |= SEC_READONLY; + else + found->flags &= ~SEC_READONLY; + } + } + + /* Do anything special before sizing sections. This is where ELF + and other back-ends size dynamic sections. */ ldemul_before_allocation (); /* We must record the program headers before we try to fix the diff --git a/contrib/binutils/ld/ldmain.c b/contrib/binutils/ld/ldmain.c index 12e31dd..5bda3d3 100644 --- a/contrib/binutils/ld/ldmain.c +++ b/contrib/binutils/ld/ldmain.c @@ -404,20 +404,6 @@ main (argc, argv) /* Print error messages for any missing symbols, for any warning symbols, and possibly multiple definitions. */ - if (! link_info.relocateable) - { - /* Look for a text section and switch the readonly attribute in it. */ - asection *found = bfd_get_section_by_name (output_bfd, ".text"); - - if (found != (asection *) NULL) - { - if (config.text_read_only) - found->flags |= SEC_READONLY; - else - found->flags &= ~SEC_READONLY; - } - } - if (link_info.relocateable) output_bfd->flags &= ~EXEC_P; else diff --git a/contrib/binutils/ld/scripttempl/elf.sc b/contrib/binutils/ld/scripttempl/elf.sc index fe8e242..fd31d03 100644 --- a/contrib/binutils/ld/scripttempl/elf.sc +++ b/contrib/binutils/ld/scripttempl/elf.sc @@ -272,6 +272,23 @@ cat <<EOF ${CREATE_SHLIB-${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))};}} ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))};}} + /* Ensure the __preinit_array_start label is properly aligned. We + could instead move the label definition inside the section, but + the linker would then create the section even if it turns out to + be empty, which isn't pretty. */ + ${RELOCATING+. = ALIGN(${ALIGNMENT});} + ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_start = .);}} + .preinit_array ${RELOCATING-0} : { *(.preinit_array) } + ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_end = .);}} + + ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}} + .init_array ${RELOCATING-0} : { *(.init_array) } + ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}} + + ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}} + .fini_array ${RELOCATING-0} : { *(.fini_array) } + ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}} + .data ${RELOCATING-0} : { ${RELOCATING+${DATA_START_SYMBOLS}} diff --git a/contrib/binutils/ld/scripttempl/v850.sc b/contrib/binutils/ld/scripttempl/v850.sc index 90731de..8958321 100644 --- a/contrib/binutils/ld/scripttempl/v850.sc +++ b/contrib/binutils/ld/scripttempl/v850.sc @@ -42,6 +42,8 @@ SECTIONS .rela.data : { *(.rela.data) } .rel.rodata : { *(.rel.rodata) } .rela.rodata : { *(.rela.rodata) } + .rel.gcc_except_table : { *(.rel.gcc_except_table) } + .rela.gcc_except_table : { *(.rela.gcc_except_table) } .rel.got : { *(.rel.got) } .rela.got : { *(.rela.got) } .rel.ctors : { *(.rel.ctors) } @@ -115,6 +117,12 @@ SECTIONS KEEP (*crtend.o(.dtors)) ${CONSTRUCTING+___dtors_end = .;} } + .jcr : + { + KEEP (*(.jcr)) + } + + .gcc_except_table : { *(.gcc_except_table) } .got : { *(.got.plt) *(.got) } .dynamic : { *(.dynamic) } |