summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/ld
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-04-12 19:33:52 +0000
committerobrien <obrien@FreeBSD.org>2002-04-12 19:33:52 +0000
commit389e1779ffd7b99edf37c98d8f3d92feab749274 (patch)
tree088350dfe9812f57c00bcd094ce6ce4b2281bc1b /contrib/binutils/ld
parent27cb1b2c9ff2bfffd8c9a173674b213b67200bea (diff)
parent18ff9f4f1bddd11c341a37177885ac89fcccedd9 (diff)
downloadFreeBSD-src-389e1779ffd7b99edf37c98d8f3d92feab749274.zip
FreeBSD-src-389e1779ffd7b99edf37c98d8f3d92feab749274.tar.gz
This commit was generated by cvs2svn to compensate for changes in r94536,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/binutils/ld')
-rw-r--r--contrib/binutils/ld/ChangeLog51
-rw-r--r--contrib/binutils/ld/Makefile.am15
-rw-r--r--contrib/binutils/ld/dep-in.sed3
-rw-r--r--contrib/binutils/ld/emulparams/elf32bmip.sh20
-rwxr-xr-xcontrib/binutils/ld/emulparams/elf32bmipn32.sh48
-rwxr-xr-xcontrib/binutils/ld/emulparams/elf32bsmip.sh31
-rw-r--r--contrib/binutils/ld/emulparams/elf32ebmip.sh28
-rw-r--r--contrib/binutils/ld/emulparams/elf32elmip.sh28
-rw-r--r--contrib/binutils/ld/emulparams/elf32lmip.sh31
-rwxr-xr-xcontrib/binutils/ld/emulparams/elf32lsmip.sh31
-rwxr-xr-xcontrib/binutils/ld/emulparams/elf64bmip.sh69
-rwxr-xr-xcontrib/binutils/ld/emulparams/shelf.sh5
-rw-r--r--contrib/binutils/ld/emulparams/shelf_linux.sh14
-rw-r--r--contrib/binutils/ld/emulparams/shl.sh5
-rwxr-xr-xcontrib/binutils/ld/emulparams/shlelf.sh17
-rwxr-xr-xcontrib/binutils/ld/genscripts.sh2
-rw-r--r--contrib/binutils/ld/ldlang.c90
-rw-r--r--contrib/binutils/ld/ldmain.c14
-rw-r--r--contrib/binutils/ld/scripttempl/elf.sc17
-rw-r--r--contrib/binutils/ld/scripttempl/v850.sc8
20 files changed, 201 insertions, 326 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/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) }
OpenPOWER on IntegriCloud