summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/binutils/ld
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2000-09-12 22:26:45 +0000
committerMarc Espie <espie@cvs.openbsd.org>2000-09-12 22:26:45 +0000
commit79a1aac7578f95bec1c4ccb42d72b2fe8bb5c979 (patch)
treea3bcda56100c9436b8d9aff17f03db870aa49da2 /gnu/usr.bin/binutils/ld
parent6f0dcc44234ecb5ec5f57dd9ff28e3d5c40f9e77 (diff)
Resolve other problems that dumb cvs can't find out by itself.
(trivial part done, `interesting' patches remain)
Diffstat (limited to 'gnu/usr.bin/binutils/ld')
-rw-r--r--gnu/usr.bin/binutils/ld/README2
-rw-r--r--gnu/usr.bin/binutils/ld/acconfig.h13
-rw-r--r--gnu/usr.bin/binutils/ld/configure.bat72
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/delta68.sh2
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32_sparc.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32bmip.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32lmip.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32lppc.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf32ppc.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/elf_i386.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/go32.sh7
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/i386moss.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/m68kelf.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/m88kbcs.sh1
-rw-r--r--gnu/usr.bin/binutils/ld/emulparams/pc532machaout.sh7
-rw-r--r--gnu/usr.bin/binutils/ld/emultempl/aix.em9
-rw-r--r--gnu/usr.bin/binutils/ld/emultempl/m88kbcs.em119
-rw-r--r--gnu/usr.bin/binutils/ld/emultempl/stringify.sed4
-rw-r--r--gnu/usr.bin/binutils/ld/genscripts.sh2
-rw-r--r--gnu/usr.bin/binutils/ld/ld.166
-rw-r--r--gnu/usr.bin/binutils/ld/ld.info-4420
-rw-r--r--gnu/usr.bin/binutils/ld/ldlex.h5
-rw-r--r--gnu/usr.bin/binutils/ld/mpw-config.in4
-rw-r--r--gnu/usr.bin/binutils/ld/mpw-emipself.c1470
-rw-r--r--gnu/usr.bin/binutils/ld/mpw-emipsidt.c430
-rw-r--r--gnu/usr.bin/binutils/ld/mpw-make.sed8
-rw-r--r--gnu/usr.bin/binutils/ld/scripttempl/armcoff.sc2
-rw-r--r--gnu/usr.bin/binutils/ld/scripttempl/elfmips.sc179
-rw-r--r--gnu/usr.bin/binutils/ld/scripttempl/go32coff.sc33
-rw-r--r--gnu/usr.bin/binutils/ld/scripttempl/m88kbcs.sc4
-rw-r--r--gnu/usr.bin/binutils/ld/scripttempl/ppcpe.sc1
-rw-r--r--gnu/usr.bin/binutils/ld/testsuite/ld-cdtest/cdtest.exp24
-rw-r--r--gnu/usr.bin/binutils/ld/testsuite/ld-empic/empic.exp24
-rw-r--r--gnu/usr.bin/binutils/ld/testsuite/ld-scripts/defined.exp4
-rw-r--r--gnu/usr.bin/binutils/ld/testsuite/ld-scripts/sizeof.exp4
-rw-r--r--gnu/usr.bin/binutils/ld/testsuite/ld-sh/sh.exp10
-rw-r--r--gnu/usr.bin/binutils/ld/testsuite/ld-srec/srec.exp12
-rw-r--r--gnu/usr.bin/binutils/ld/testsuite/ld-versados/versados.exp12
-rw-r--r--gnu/usr.bin/binutils/ld/testsuite/lib/ld.exp319
39 files changed, 117 insertions, 3160 deletions
diff --git a/gnu/usr.bin/binutils/ld/README b/gnu/usr.bin/binutils/ld/README
index e532253aab1..8947d04156b 100644
--- a/gnu/usr.bin/binutils/ld/README
+++ b/gnu/usr.bin/binutils/ld/README
@@ -34,7 +34,7 @@ directory (one directory above this one).
Porting to a new target
=======================
-See the Porting chapter in the ldint.texinfo manual.
+See the ldint.texinfo manual.
Reporting bugs etc
===========================
diff --git a/gnu/usr.bin/binutils/ld/acconfig.h b/gnu/usr.bin/binutils/ld/acconfig.h
deleted file mode 100644
index 7be98654f56..00000000000
--- a/gnu/usr.bin/binutils/ld/acconfig.h
+++ /dev/null
@@ -1,13 +0,0 @@
-
-/* Whether strstr must be declared even if <string.h> is included. */
-#undef NEED_DECLARATION_STRSTR
-
-/* Whether free must be declared even if <stdlib.h> is included. */
-#undef NEED_DECLARATION_FREE
-
-/* Whether sbrk must be declared even if <unistd.h> is included. */
-#undef NEED_DECLARATION_SBRK
-@TOP@
-
-/* Do we need to use the b modifier when opening binary files? */
-#undef USE_BINARY_FOPEN
diff --git a/gnu/usr.bin/binutils/ld/configure.bat b/gnu/usr.bin/binutils/ld/configure.bat
deleted file mode 100644
index 4643bdb5540..00000000000
--- a/gnu/usr.bin/binutils/ld/configure.bat
+++ /dev/null
@@ -1,72 +0,0 @@
-@echo off
-echo Configuring ld for go32
-echo This makefile will be built for GNUISH make
-rem This batch file assumes a unix-type "sed" program
-
-update ..\bfd\hosts\go32.h sysdep.h
-
-echo # Makefile generated by "configure.bat"> Makefile
-echo LONGARGS = gcc:ar >> Makefile
-echo CC=gcc >> Makefile
-echo host_alias=go32 >> Makefile
-echo target_alias=go32 >> Makefile
-
-update ../bfd/hosts/go32.h sysdep.h
-
-if exist config.sed del config.sed
-
-echo "s/^ \$(srcdir)\/move-if-change/ update/ ">> config.sed
-echo "s/:\([^ ]\)/: \1/g ">> config.sed
-echo "s/^ \ *\.\// go32 / ">> config.sed
-echo "s/`echo \$(srcdir)\///g ">> config.sed
-echo "s/ | sed 's,\^\\\.\/,,'`//g ">> config.sed
-echo "s/^ cd \$(srcdir)[ ]*;// ">> config.sed
-
-echo "/^####$/ i\ ">> config.sed
-echo "CC = gcc\ ">> config.sed
-echo "EMUL=go32\ ">> config.sed
-echo "EMULATION_OFILES=ego32.o ei386aout.o ">> config.sed
-
-echo "/^SHELL *=/ d ">> config.sed
-echo "s/$(SHELL)/sh.exe/g ">> config.sed
-
-echo "s/'"/\\"/g ">> config.sed
-echo "s/"'/\\"/g ">> config.sed
-
-echo "/^ldmain.o: ldmain.c/,/fi/ { ">> config.sed
-echo " s/; *\\$// ">> config.sed
-echo " s/-DSCRIPTDIR[^ ]*/-DSCRIPTDIR=\\".\\"/ ">> config.sed
-echo " s/config.status// ">> config.sed
-echo " /ldmain.o:/ p ">> config.sed
-echo " /(CC)/ p ">> config.sed
-echo " d ">> config.sed
-echo "} ">> config.sed
-
-echo "s/^SHELL.*$/SHELL=sh.exe/ ">> config.sed
-echo "s/genscripts.sh/genscripts.dos/g ">> config.sed
-
-echo "s/^ldemul-list.h/not-ldemul-list.h/ ">> config.sed
-
-sed -e "s/^\"//" -e "s/\"$//" -e "s/[ ]*$//" config.sed > config2.sed
-sed -f config2.sed Makefile.in >> Makefile
-del config.sed
-del config2.sed
-
-echo set -a > genscripts.dj
-sed -e "/^[a-zA-Z0-9_]*=/ s/^/export /" -e "s/(. \(.*\))/sh \1/" -e "/\.em/ d" genscripts.sh >> genscripts.dj
-type emultempl\generic.em >> genscripts.dj
-update genscripts.dj genscripts.dos
-
-echo extern ld_emulation_xfer_type ld_go32_emulation; > ldemul-list.h2
-echo extern ld_emulation_xfer_type ld_i386aout_emulation; >> ldemul-list.h2
-echo #define EMULATION_LIST \>>ldemul-list.h2
-echo &ld_go32_emulation,\>>ldemul-list.h2
-echo &ld_i386aout_emulation,\>>ldemul-list.h2
-echo 0>>ldemul-list.h2
-
-update ldemul-list.h2 ldemul-list.h
-
-if exist ldscripts\dostest goto ldscripts
-mkdir ldscripts
-dir > ldscripts\dostest
-:ldscripts
diff --git a/gnu/usr.bin/binutils/ld/emulparams/delta68.sh b/gnu/usr.bin/binutils/ld/emulparams/delta68.sh
index 640150612bd..e3c59099199 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/delta68.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/delta68.sh
@@ -1,5 +1,5 @@
SCRIPT_NAME=delta68
-OUTPUT_FORMAT="coff-m68k"
+OUTPUT_FORMAT="coff-m68k-sysv"
TEXT_START_ADDR=0x2000
PAGE_SIZE=0x1000000
ARCH=m68k
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32_sparc.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32_sparc.sh
index 3279fc3b6b2..74e2326d53e 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32_sparc.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32_sparc.sh
@@ -5,6 +5,7 @@ MAXPAGESIZE=0x10000
NONPAGED_TEXT_START_ADDR=0x10000
ALIGNMENT=8
ARCH=sparc
+MACHINE=
TEMPLATE_NAME=elf32
DATA_PLT=
GENERATE_SHLIB_SCRIPT=yes
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32bmip.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32bmip.sh
index ffe82628150..473c41169e0 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32bmip.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32bmip.sh
@@ -25,5 +25,6 @@ OTHER_SECTIONS='
.gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
'
ARCH=mips
+MACHINE=
TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32lmip.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32lmip.sh
index a686a9f2449..23312f44aca 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32lmip.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32lmip.sh
@@ -25,5 +25,6 @@ OTHER_SECTIONS='
.gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
'
ARCH=mips
+MACHINE=
TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32lppc.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32lppc.sh
index 65daf8c9eee..edffc610d49 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32lppc.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32lppc.sh
@@ -5,3 +5,4 @@ OUTPUT_FORMAT="elf32-powerpcle"
TEXT_START_ADDR=0x40000
MAXPAGESIZE=0x40000
ARCH=powerpc
+MACHINE=
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32ppc.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32ppc.sh
index fcafd1139ee..3e3880c63d2 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf32ppc.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf32ppc.sh
@@ -5,3 +5,4 @@ OUTPUT_FORMAT="elf32-powerpc"
TEXT_START_ADDR=0x01800000
MAXPAGESIZE=0x10000
ARCH=powerpc
+MACHINE=
diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf_i386.sh b/gnu/usr.bin/binutils/ld/emulparams/elf_i386.sh
index b11b7d71886..dff567bffbc 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/elf_i386.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/elf_i386.sh
@@ -4,6 +4,7 @@ TEXT_START_ADDR=0x08048000
MAXPAGESIZE=0x1000
NONPAGED_TEXT_START_ADDR=0x08048000
ARCH=i386
+MACHINE=
NOP=0x9090
TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes
diff --git a/gnu/usr.bin/binutils/ld/emulparams/go32.sh b/gnu/usr.bin/binutils/ld/emulparams/go32.sh
deleted file mode 100644
index d13357fda7a..00000000000
--- a/gnu/usr.bin/binutils/ld/emulparams/go32.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-SCRIPT_NAME=go32coff
-OUTPUT_FORMAT="coff-go32"
-TEXT_START_ADDR=0x10a8
-TARGET_PAGE_SIZE=0x1000
-SEGMENT_SIZE=0x1000
-NONPAGED_TEXT_START_ADDR=0x0
-ARCH=i386
diff --git a/gnu/usr.bin/binutils/ld/emulparams/i386moss.sh b/gnu/usr.bin/binutils/ld/emulparams/i386moss.sh
index dd214cfacd0..a5e0e05eb22 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/i386moss.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/i386moss.sh
@@ -4,6 +4,7 @@ TEXT_START_ADDR=0x00002000
MAXPAGESIZE=0x1000
NONPAGED_TEXT_START_ADDR=0x00002000
ARCH=i386
+MACHINE=
NOP=0x9090
TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes
diff --git a/gnu/usr.bin/binutils/ld/emulparams/m68kelf.sh b/gnu/usr.bin/binutils/ld/emulparams/m68kelf.sh
index 1044f31165b..ad352c585b3 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/m68kelf.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/m68kelf.sh
@@ -4,6 +4,7 @@ TEXT_START_ADDR=0x80000000
MAXPAGESIZE=0x2000
NONPAGED_TEXT_START_ADDR=${TEXT_START_ADDR}
ARCH=m68k
+MACHINE=
NOP=0x4e75
TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes
diff --git a/gnu/usr.bin/binutils/ld/emulparams/m88kbcs.sh b/gnu/usr.bin/binutils/ld/emulparams/m88kbcs.sh
index 30b783a82f9..6c6737c3329 100644
--- a/gnu/usr.bin/binutils/ld/emulparams/m88kbcs.sh
+++ b/gnu/usr.bin/binutils/ld/emulparams/m88kbcs.sh
@@ -3,4 +3,3 @@ OUTPUT_FORMAT="coff-m88kbcs"
TEXT_START_ADDR=??
TARGET_PAGE_SIZE=??
ARCH=m88k
-TEMPLATE_NAME=m88kbcs
diff --git a/gnu/usr.bin/binutils/ld/emulparams/pc532machaout.sh b/gnu/usr.bin/binutils/ld/emulparams/pc532machaout.sh
deleted file mode 100644
index 07aa985b046..00000000000
--- a/gnu/usr.bin/binutils/ld/emulparams/pc532machaout.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-EMULATION_NAME=pc532machaout
-SCRIPT_NAME=aout
-OUTPUT_FORMAT="a.out-pc532-mach"
-TARGET_PAGE_SIZE=0x1000
-TEXT_START_ADDR="0x10020"
-NONPAGED_TEXT_START_ADDR=0x10000
-ARCH=ns32k
diff --git a/gnu/usr.bin/binutils/ld/emultempl/aix.em b/gnu/usr.bin/binutils/ld/emultempl/aix.em
index 5eff6b59a41..dd81b5f744c 100644
--- a/gnu/usr.bin/binutils/ld/emultempl/aix.em
+++ b/gnu/usr.bin/binutils/ld/emultempl/aix.em
@@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libiberty.h"
#include "getopt.h"
+#include "obstack.h"
#include "bfdlink.h"
#include <ctype.h>
@@ -829,8 +830,12 @@ gld${EMULATION_NAME}_read_file (filename, import)
filename, lineno);
}
- if (strcasecmp (s, "svc") == 0
- || strcasecmp (s, "syscall") == 0)
+ if (s == se)
+ {
+ /* There was no address after all. */
+ }
+ else if (strcasecmp (s, "svc") == 0
+ || strcasecmp (s, "syscall") == 0)
syscall = true;
else
{
diff --git a/gnu/usr.bin/binutils/ld/emultempl/m88kbcs.em b/gnu/usr.bin/binutils/ld/emultempl/m88kbcs.em
deleted file mode 100644
index ebf58bec380..00000000000
--- a/gnu/usr.bin/binutils/ld/emultempl/m88kbcs.em
+++ /dev/null
@@ -1,119 +0,0 @@
-# This shell script emits a C file. -*- C -*-
-# It does some substitutions.
-cat >e${EMULATION_NAME}.c <<EOF
-/* This file is is generated by a shell script. DO NOT EDIT! */
-
-/* emulate the original gld for the given ${EMULATION_NAME}
- Copyright (C) 1991, 1993 Free Software Foundation, Inc.
- Written by Steve Chamberlain steve@cygnus.com
-
-This file is part of GLD, the Gnu Linker.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGET_IS_${EMULATION_NAME}
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-
-#include "ld.h"
-#include "ldemul.h"
-#include "ldfile.h"
-#include "ldmisc.h"
-#include "ldmain.h"
-
-static void
-gld${EMULATION_NAME}_before_parse()
-{
- link_info.lprefix = "@";
- link_info.lprefix_len = 1;
-
- ldfile_output_architecture = bfd_arch_${ARCH};
-}
-
-static char *
-gld${EMULATION_NAME}_get_script(isfile)
- int *isfile;
-EOF
-
-if test -n "$COMPILE_IN"
-then
-# Scripts compiled in.
-
-# sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
-
-cat >>e${EMULATION_NAME}.c <<EOF
-{
- *isfile = 0;
-
- if (link_info.relocateable == true && config.build_constructors == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
- else if (link_info.relocateable == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
- else if (!config.text_read_only)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
- else if (!config.magic_demand_paged)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
- else
- return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
-EOF
-
-else
-# Scripts read from the filesystem.
-
-cat >>e${EMULATION_NAME}.c <<EOF
-{
- *isfile = 1;
-
- if (link_info.relocateable == true && config.build_constructors == true)
- return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocateable == true)
- return "ldscripts/${EMULATION_NAME}.xr";
- else if (!config.text_read_only)
- return "ldscripts/${EMULATION_NAME}.xbn";
- else if (!config.magic_demand_paged)
- return "ldscripts/${EMULATION_NAME}.xn";
- else
- return "ldscripts/${EMULATION_NAME}.x";
-}
-EOF
-
-fi
-
-cat >>e${EMULATION_NAME}.c <<EOF
-
-struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
-{
- gld${EMULATION_NAME}_before_parse,
- syslib_default,
- hll_default,
- after_parse_default,
- after_open_default,
- after_allocation_default,
- set_output_arch_default,
- ldemul_default_target,
- before_allocation_default,
- gld${EMULATION_NAME}_get_script,
- "${EMULATION_NAME}",
- "${OUTPUT_FORMAT}"
-};
-EOF
diff --git a/gnu/usr.bin/binutils/ld/emultempl/stringify.sed b/gnu/usr.bin/binutils/ld/emultempl/stringify.sed
deleted file mode 100644
index a526d3ffc4c..00000000000
--- a/gnu/usr.bin/binutils/ld/emultempl/stringify.sed
+++ /dev/null
@@ -1,4 +0,0 @@
-s/["\\]/\\&/g
-s/$/\\n\\/
-1 s/^/"/
-$ s/$/n"/
diff --git a/gnu/usr.bin/binutils/ld/genscripts.sh b/gnu/usr.bin/binutils/ld/genscripts.sh
index b68a039df08..8294af7068e 100644
--- a/gnu/usr.bin/binutils/ld/genscripts.sh
+++ b/gnu/usr.bin/binutils/ld/genscripts.sh
@@ -129,5 +129,5 @@ for i in $EMULATION_LIBPATH ; do
test "$i" = "$EMULATION_NAME" && COMPILE_IN=true
done
-# Generate em_${EMULATION_NAME}.c.
+# Generate e${EMULATION_NAME}.c.
. ${srcdir}/emultempl/${TEMPLATE_NAME-generic}.em
diff --git a/gnu/usr.bin/binutils/ld/ld.1 b/gnu/usr.bin/binutils/ld/ld.1
index 7dd7f029df0..58516b979b2 100644
--- a/gnu/usr.bin/binutils/ld/ld.1
+++ b/gnu/usr.bin/binutils/ld/ld.1
@@ -50,9 +50,17 @@ ld \- the GNU linker
.RB "[\|" \-embedded\-relocs "\|]"
.RB "[\|" \-E "\|]"
.RB "[\|" \-export\-dynamic "\|]"
-.RB "[\|" \-F "\|]"
+.RB "[\|" "\-f\ "\c
+.I name\c
+\&\|]
+.RB "[\|" "\-\-auxiliary\ "\c
+.I name\c
+\&\|]
.RB "[\|" "\-F\ "\c
-.I format\c
+.I name\c
+\&\|]
+.RB "[\|" "\-\-filter\ "\c
+.I name\c
\&\|]
.RB "[\|" "\-format\ "\c
.I input-format\c
@@ -61,6 +69,12 @@ ld \- the GNU linker
.RB "[\|" \-G
.I size\c
\&\|]
+.RB "[\|" "\-h\ "\c
+.I name\c
+\&\|]
+.RB "[\|" "\-soname\ "\c
+.I name\c
+\&\|]
.RB "[\|" \-\-help "\|]"
.RB "[\|" \-i "\|]"
.RB "[\|" \-l\c
@@ -505,28 +519,24 @@ by a dynamic object. This option is needed for some uses of
.I dlopen.
.TP
-.B \-F
+.BI "-f " "name"
.TP
-.BI "-F" "format"
-Some older linkers used this option throughout a compilation toolchain
-for specifying object-file format for both input and output object
-files. \c
-.B ld\c
-\&'s mechanisms (the \c
-.B \-b\c
-\& or \c
-.B \-format\c
-\& options
-for input files, the \c
-.B TARGET\c
-\& command in linker scripts for output
-files, the \c
-.B GNUTARGET\c
-\& environment variable) are more flexible, but
-but it accepts (and ignores) the \c
-.B \-F\c
-\& option flag for compatibility
-with scripts written to call the old linker.
+.BI "--auxiliary " "name"
+When creating an ELF shared object, set the internal DT_AUXILIARY field
+to the specified name. This tells the dynamic linker that the symbol
+table of the shared object should be used as an auxiliary filter on the
+symbol table of the shared object
+.I name.
+
+.TP
+.BI "-F " "name"
+.TP
+.BI "--filter " "name"
+When creating an ELF shared object, set the internal DT_FILTER field to
+the specified name. This tells the dynamic linker that the symbol table
+of the shared object should be used as a filter on the symbol table of
+the shared object
+.I name.
.TP
.BI "\-format " "input\-format"
@@ -548,6 +558,16 @@ to
under MIPS ECOFF. Ignored for other object file formats.
.TP
+.BI "-h " "name"
+.TP
+.BI "-soname " "name"
+When creating an ELF shared object, set the internal DT_SONAME field to
+the specified name. When an executable is linked with a shared object
+which has a DT_SONAME field, then when the executable is run the dynamic
+linker will attempt to load the shared object specified by the DT_SONAME
+field rather than the using the file name given to the linker.
+
+.TP
.B \-\-help
Print a summary of the command-line options on the standard output and exit.
This option and
diff --git a/gnu/usr.bin/binutils/ld/ld.info-4 b/gnu/usr.bin/binutils/ld/ld.info-4
deleted file mode 100644
index 2352b4ccae5..00000000000
--- a/gnu/usr.bin/binutils/ld/ld.info-4
+++ /dev/null
@@ -1,420 +0,0 @@
-This is Info file ld.info, produced by Makeinfo-1.64 from the input
-file ./ld.texinfo.
-
-START-INFO-DIR-ENTRY
-* Ld: (ld). The GNU linker.
-END-INFO-DIR-ENTRY
-
- This file documents the GNU linker LD.
-
- Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software
-Foundation, Inc.
-
- Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
- Permission is granted to copy and distribute modified versions of
-this manual under the conditions for verbatim copying, provided also
-that the entire resulting derived work is distributed under the terms
-of a permission notice identical to this one.
-
- Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions.
-
-
-File: ld.info, Node: Index, Prev: MRI, Up: Top
-
-Index
-*****
-
-* Menu:
-
-* ": Symbols.
-* *( COMMON ): Section Placement.
-* *(SECTION): Section Placement.
-* -(: Options.
-* -architecture=ARCH: Options.
-* -auxiliary: Options.
-* -cref: Options.
-* -defsym SYMBOL=EXP: Options.
-* -discard-all: Options.
-* -discard-locals: Options.
-* -dynamic-linker FILE: Options.
-* -embedded-relocs: Options.
-* -entry=ENTRY: Options.
-* -export-dynamic: Options.
-* -filter: Options.
-* -force-exe-suffix: Options.
-* -format=FORMAT: Options.
-* -gpsize: Options.
-* -help: Options.
-* -just-symbols=FILE: Options.
-* -library-path=DIR: Options.
-* -library=ARCHIVE: Options.
-* -mri-script=MRI-CMDFILE: Options.
-* -nmagic: Options.
-* -no-keep-memory: Options.
-* -no-whole-archive: Options.
-* -noinhibit-exec: Options.
-* -oformat: Options.
-* -omagic: Options.
-* -output=OUTPUT: Options.
-* -print-map: Options.
-* -relax: Options.
-* -relocateable: Options.
-* -script=SCRIPT: Options.
-* -sort-common: Options.
-* -split-by-file: Options.
-* -split-by-reloc: Options.
-* -stats: Options.
-* -strip-all: Options.
-* -strip-debug: Options.
-* -trace: Options.
-* -trace-symbol=SYMBOL: Options.
-* -traditional-format: Options.
-* -undefined=SYMBOL: Options.
-* -verbose: Options.
-* -version: Options.
-* -version-script=VERSION-SCRIPTFILE: Options.
-* -warn-comon: Options.
-* -warn-constructors: Options.
-* -warn-multiple-gp: Options.
-* -warn-once: Options.
-* -warn-section-align: Options.
-* -whole-archive: Options.
-* -wrap: Options.
-* -AARCH: Options.
-* -aKEYWORD: Options.
-* -assert KEYWORD: Options.
-* -b FORMAT: Options.
-* -Bdynamic: Options.
-* -Bshareable: Options.
-* -Bstatic: Options.
-* -Bsymbolic: Options.
-* -c MRI-CMDFILE: Options.
-* -call_shared: Options.
-* -d: Options.
-* -dc: Options.
-* -dn: Options.
-* -dp: Options.
-* -dy: Options.
-* -E: Options.
-* -e ENTRY: Options.
-* -EB: Options.
-* -EL: Options.
-* -f: Options.
-* -G: Options.
-* -hNAME: Options.
-* -i: Options.
-* -lARCHIVE: Options.
-* -LDIR: Options.
-* -M: Options.
-* -m EMULATION: Options.
-* -Map: Options.
-* -n: Options.
-* -non_shared: Options.
-* -o OUTPUT: Options.
-* -qmagic: Options.
-* -Qy: Options.
-* -r: Options.
-* -R FILE: Options.
-* -rpath: Options.
-* -rpath-link: Options.
-* -S: Options.
-* -shared: Options.
-* -soname=NAME: Options.
-* -static: Options.
-* -t: Options.
-* -T SCRIPT: Options.
-* -Tbss ORG: Options.
-* -Tdata ORG: Options.
-* -Ttext ORG: Options.
-* -u SYMBOL: Options.
-* -Ur: Options.
-* -V: Options.
-* -X: Options.
-* -Y PATH: Options.
-* -y SYMBOL: Options.
-* -z KEYWORD: Options.
-* .: Location Counter.
-* 0x: Integers.
-* :PHDR: Section Options.
-* ;: Assignment.
-* =FILL: Section Options.
-* >REGION: Section Options.
-* -relax on i960: i960.
-* [SECTION...], not supported: Section Placement.
-* ABSOLUTE (MRI): MRI.
-* ALIAS (MRI): MRI.
-* ALIGN (MRI): MRI.
-* BASE (MRI): MRI.
-* CHIP (MRI): MRI.
-* END (MRI): MRI.
-* FORMAT (MRI): MRI.
-* ld bugs, reporting: Bug Reporting.
-* LIST (MRI): MRI.
-* LOAD (MRI): MRI.
-* NAME (MRI): MRI.
-* ORDER (MRI): MRI.
-* PUBLIC (MRI): MRI.
-* SECT (MRI): MRI.
-* GNU linker: Overview.
-* FILENAME: Section Placement.
-* FILENAME(SECTION): Section Placement.
-* SYMBOL = EXPRESSION ;: Section Data Expressions.
-* SYMBOL F= EXPRESSION ;: Section Data Expressions.
-* absolute and relocatable symbols: Assignment.
-* ABSOLUTE(EXP): Arithmetic Functions.
-* ADDR(SECTION): Arithmetic Functions.
-* ALIGN(EXP): Arithmetic Functions.
-* aligning sections: Section Options.
-* allocating memory: MEMORY.
-* architectures: Options.
-* archive files, from cmd line: Options.
-* arithmetic: Expressions.
-* arithmetic operators: Operators.
-* assignment in scripts: Assignment.
-* assignment, in section defn: Section Data Expressions.
-* AT ( LDADR ): Section Options.
-* back end: BFD.
-* BFD canonical format: Canonical format.
-* BFD requirements: BFD.
-* big-endian objects: Options.
-* binary input files: Option Commands.
-* binary input format: Options.
-* BLOCK(ALIGN): Section Options.
-* bug criteria: Bug Criteria.
-* bug reports: Bug Reporting.
-* bugs in ld: Reporting Bugs.
-* BYTE(EXPRESSION): Section Data Expressions.
-* C++ constructors, arranging in link: Option Commands.
-* combining symbols, warnings on: Options.
-* command files: Commands.
-* command line: Options.
-* commands, fundamental: Scripts.
-* comments: Scripts.
-* common allocation <1>: Option Commands.
-* common allocation: Options.
-* commons in output: Section Placement.
-* compatibility, MRI: Options.
-* CONSTRUCTORS: Option Commands.
-* constructors: Options.
-* constructors, arranging in link: Option Commands.
-* contents of a section: Section Placement.
-* crash of linker: Bug Criteria.
-* CREATE_OBJECT_SYMBOLS: Section Data Expressions.
-* cross reference table: Options.
-* cross references: Option Commands.
-* current output location: Location Counter.
-* dbx: Options.
-* decimal integers: Integers.
-* default input format: Environment.
-* DEFINED(SYMBOL): Arithmetic Functions.
-* deleting local symbols: Options.
-* direct output: Section Data Expressions.
-* discontinuous memory: MEMORY.
-* dot: Location Counter.
-* dynamic linker, from command line: Options.
-* dynamic symbol table: Options.
-* ELF program headers: PHDRS.
-* emulation: Options.
-* endianness: Options.
-* entry point, defaults: Entry Point.
-* entry point, from command line: Options.
-* ENTRY(SYMBOL): Entry Point.
-* error on valid input: Bug Criteria.
-* expression evaluation order: Evaluation.
-* expression syntax: Expressions.
-* expression, absolute: Arithmetic Functions.
-* expressions in a section: Section Data Expressions.
-* fatal signal: Bug Criteria.
-* filename symbols: Section Data Expressions.
-* files and sections, section defn: Section Placement.
-* files, including in output sections: Section Placement.
-* fill pattern, entire section: Section Options.
-* FILL(EXPRESSION): Section Data Expressions.
-* first input file: Option Commands.
-* first instruction: Entry Point.
-* FLOAT: Option Commands.
-* FORCE_COMMON_ALLOCATION: Option Commands.
-* format, output file: Option Commands.
-* functions in expression language: Arithmetic Functions.
-* fundamental script commands: Scripts.
-* GNUTARGET <1>: Option Commands.
-* GNUTARGET: Environment.
-* GROUP ( FILES ): Option Commands.
-* grouping input files: Option Commands.
-* groups of archives: Options.
-* H8/300 support: H8/300.
-* header size: Arithmetic Functions.
-* help: Options.
-* hexadecimal integers: Integers.
-* holes: Location Counter.
-* holes, filling: Section Data Expressions.
-* i960 support: i960.
-* INCLUDE FILENAME: Option Commands.
-* including a linker script: Option Commands.
-* including an entire archive: Options.
-* incremental link: Options.
-* INPUT ( FILES ): Option Commands.
-* input file format: Option Commands.
-* input filename symbols: Section Data Expressions.
-* input files, displaying: Options.
-* input files, section defn: Section Placement.
-* input format: Options.
-* input sections to output section: Section Placement.
-* integer notation: Integers.
-* integer suffixes: Integers.
-* internal object-file format: Canonical format.
-* invalid input: Bug Criteria.
-* K and M integer suffixes: Integers.
-* l =: MEMORY.
-* L, deleting symbols beginning: Options.
-* layout of output file: Scripts.
-* lazy evaluation: Evaluation.
-* len =: MEMORY.
-* LENGTH =: MEMORY.
-* link map: Options.
-* link-time runtime library search path: Options.
-* linker crash: Bug Criteria.
-* little-endian objects: Options.
-* load address, specifying: Section Options.
-* LOADADDR(SECTION): Arithmetic Functions.
-* loading, preventing: Section Options.
-* local symbols, deleting: Options.
-* location counter: Location Counter.
-* LONG(EXPRESSION): Section Data Expressions.
-* M and K integer suffixes: Integers.
-* machine architecture, output: Option Commands.
-* machine dependencies: Machine Dependent.
-* MAX: Arithmetic Functions.
-* MEMORY: MEMORY.
-* memory region attributes: MEMORY.
-* memory regions and sections: Section Options.
-* memory usage: Options.
-* MIN: Arithmetic Functions.
-* MIPS embedded PIC code: Options.
-* MRI compatibility: MRI.
-* names: Symbols.
-* naming memory regions: MEMORY.
-* naming output sections: Section Definition.
-* naming the output file <1>: Option Commands.
-* naming the output file: Options.
-* negative integers: Integers.
-* NEXT(EXP): Arithmetic Functions.
-* NMAGIC: Options.
-* NOCROSSREFS ( SECTIONS ): Option Commands.
-* NOFLOAT: Option Commands.
-* NOLOAD: Section Options.
-* Non constant expression: Assignment.
-* o =: MEMORY.
-* objdump -i: BFD.
-* object file management: BFD.
-* object files: Options.
-* object formats available: BFD.
-* object size: Options.
-* octal integers: Integers.
-* OMAGIC: Options.
-* opening object files: BFD outline.
-* Operators for arithmetic: Operators.
-* options: Options.
-* org =: MEMORY.
-* ORIGIN =: MEMORY.
-* OUTPUT ( FILENAME ): Option Commands.
-* output file after errors: Options.
-* output file layout: Scripts.
-* OUTPUT_ARCH ( BFDNAME ): Option Commands.
-* OUTPUT_FORMAT ( BFDNAME ): Option Commands.
-* OVERLAY: Overlays.
-* overlays: Overlays.
-* partial link: Options.
-* path for libraries: Option Commands.
-* PHDRS: PHDRS.
-* precedence in expressions: Operators.
-* prevent unnecessary loading: Section Options.
-* program headers: PHDRS.
-* program headers and sections: Section Options.
-* provide: Assignment.
-* QUAD(EXPRESSION): Section Data Expressions.
-* quoted symbol names: Symbols.
-* read-only text: Options.
-* read/write from cmd line: Options.
-* regions of memory: MEMORY.
-* relaxing addressing modes: Options.
-* relaxing on H8/300: H8/300.
-* relaxing on i960: i960.
-* relocatable and absolute symbols: Assignment.
-* relocatable output: Options.
-* reporting bugs in ld: Reporting Bugs.
-* requirements for BFD: BFD.
-* retaining specified symbols: Options.
-* rounding up location counter: Arithmetic Functions.
-* runtime library name: Options.
-* runtime library search path: Options.
-* scaled integers: Integers.
-* script files: Options.
-* search directory, from cmd line: Options.
-* search path, libraries: Option Commands.
-* SEARCH_DIR ( PATH ): Option Commands.
-* section address <1>: Arithmetic Functions.
-* section address: Section Options.
-* section alignment: Section Options.
-* section alignment, warnings on: Options.
-* section definition: Section Definition.
-* section defn, full syntax: Section Options.
-* section fill pattern: Section Options.
-* section load address: Arithmetic Functions.
-* section size: Arithmetic Functions.
-* section start: Section Options.
-* section, assigning to memory region: Section Options.
-* section, assigning to program header: Section Options.
-* SECTIONS: SECTIONS.
-* segment origins, cmd line: Options.
-* semicolon: Assignment.
-* shared libraries: Options.
-* SHORT(EXPRESSION): Section Data Expressions.
-* SIZEOF(SECTION): Arithmetic Functions.
-* sizeof_headers: Arithmetic Functions.
-* specify load address: Section Options.
-* standard Unix system: Options.
-* start address, section: Section Options.
-* start of execution: Entry Point.
-* STARTUP ( FILENAME ): Option Commands.
-* strip all symbols: Options.
-* strip debugger symbols: Options.
-* stripping all but some symbols: Options.
-* suffixes for integers: Integers.
-* symbol defaults: Arithmetic Functions.
-* symbol definition, scripts: Assignment.
-* symbol names: Symbols.
-* symbol tracing: Options.
-* symbol versions: Version Script.
-* symbol-only input: Options.
-* symbols, from command line: Options.
-* symbols, relocatable and absolute: Assignment.
-* symbols, retaining selectively: Options.
-* synthesizing linker: Options.
-* synthesizing on H8/300: H8/300.
-* TARGET ( FORMAT ): Option Commands.
-* traditional format: Options.
-* unallocated address, next: Arithmetic Functions.
-* undefined symbol: Options.
-* undefined symbols, warnings on: Options.
-* uninitialized data: Section Placement.
-* unspecified memory: Section Data Expressions.
-* usage: Options.
-* variables, defining: Assignment.
-* verbose: Options.
-* version: Options.
-* VERSION {script text}: Version Script.
-* version script: Version Script.
-* version script, symbol versions: Options.
-* versions of symbols: Version Script.
-* warnings, on combining symbols: Options.
-* warnings, on section alignment: Options.
-* warnings, on undefined symbols: Options.
-* what is this?: Overview.
-
-
diff --git a/gnu/usr.bin/binutils/ld/ldlex.h b/gnu/usr.bin/binutils/ld/ldlex.h
index 9f04f7b941d..53444cacad7 100644
--- a/gnu/usr.bin/binutils/ld/ldlex.h
+++ b/gnu/usr.bin/binutils/ld/ldlex.h
@@ -1,5 +1,5 @@
/* ldlex.h -
- Copyright 1991, 1992 Free Software Foundation, Inc.
+ Copyright 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -28,6 +28,7 @@ typedef enum input_enum {
input_selected, /* We've set the initial state. */
input_script,
input_mri_script,
+ input_version_script,
input_defsym
} input_type;
@@ -42,6 +43,8 @@ extern void lex_push_file PARAMS ((FILE *, const char *));
extern void lex_redirect PARAMS ((const char *));
extern void ldlex_script PARAMS ((void));
extern void ldlex_mri_script PARAMS ((void));
+extern void ldlex_version_script PARAMS ((void));
+extern void ldlex_version_file PARAMS ((void));
extern void ldlex_defsym PARAMS ((void));
extern void ldlex_expression PARAMS ((void));
extern void ldlex_both PARAMS ((void));
diff --git a/gnu/usr.bin/binutils/ld/mpw-config.in b/gnu/usr.bin/binutils/ld/mpw-config.in
index 34f9e26e116..b2542cc612c 100644
--- a/gnu/usr.bin/binutils/ld/mpw-config.in
+++ b/gnu/usr.bin/binutils/ld/mpw-config.in
@@ -17,12 +17,12 @@ Else If "{target_canonical}" =~ /i386-\Option-x-go32/
Else If "{target_canonical}" =~ /mips-\Option-x-ecoff/
Set emulname mipsidt
- forward-include "{srcdir}"mpw-mipsidt.c emipsidt.c
+ forward-include "{srcdir}"mpw-idtmips.c emipsidt.c
Set emulation_ofiles "{o}"emipsidt.c.o
Else If "{target_canonical}" =~ /mips-\Option-x-\Option-x/
Set emulname elf32ebmip
- forward-include "{srcdir}"mpw-mipself.c eelf32ebmip.c
+ forward-include "{srcdir}"mpw-elfmips.c eelf32ebmip.c
Set emulation_ofiles "{o}"eelf32ebmip.c.o
Else If "{target_canonical}" =~ /sh-\Option-x-hms/
diff --git a/gnu/usr.bin/binutils/ld/mpw-emipself.c b/gnu/usr.bin/binutils/ld/mpw-emipself.c
deleted file mode 100644
index ec88bb7493e..00000000000
--- a/gnu/usr.bin/binutils/ld/mpw-emipself.c
+++ /dev/null
@@ -1,1470 +0,0 @@
-/* This file is is generated by a shell script. DO NOT EDIT! */
-
-/* 32 bit ELF emulation code for elf32ebmip
- Copyright (C) 1991, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Written by Steve Chamberlain <sac@cygnus.com>
- ELF support by Ian Lance Taylor <ian@cygnus.com>
-
-This file is part of GLD, the Gnu Linker.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGET_IS_elf32ebmip
-
-#include "bfd.h"
-#include "sysdep.h"
-
-#include <ctype.h>
-
-#include "bfdlink.h"
-
-#include "ld.h"
-#include "ldmain.h"
-#include "ldemul.h"
-#include "ldfile.h"
-#include "ldmisc.h"
-#include "ldexp.h"
-#include "ldlang.h"
-#include "ldgram.h"
-
-static void gldelf32ebmip_before_parse PARAMS ((void));
-static boolean gldelf32ebmip_open_dynamic_archive
- PARAMS ((const char *, search_dirs_type *, lang_input_statement_type *));
-static void gldelf32ebmip_after_open PARAMS ((void));
-static void gldelf32ebmip_check_needed
- PARAMS ((lang_input_statement_type *));
-static void gldelf32ebmip_stat_needed
- PARAMS ((lang_input_statement_type *));
-static boolean gldelf32ebmip_search_needed
- PARAMS ((const char *, const char *));
-static boolean gldelf32ebmip_try_needed PARAMS ((const char *));
-static void gldelf32ebmip_before_allocation PARAMS ((void));
-static void gldelf32ebmip_find_statement_assignment
- PARAMS ((lang_statement_union_type *));
-static void gldelf32ebmip_find_exp_assignment PARAMS ((etree_type *));
-static boolean gldelf32ebmip_place_orphan
- PARAMS ((lang_input_statement_type *, asection *));
-static void gldelf32ebmip_place_section
- PARAMS ((lang_statement_union_type *));
-static char *gldelf32ebmip_get_script PARAMS ((int *isfile));
-
-static void
-gldelf32ebmip_before_parse()
-{
- ldfile_output_architecture = bfd_arch_mips;
- config.dynamic_link = true;
-}
-
-/* Try to open a dynamic archive. This is where we know that ELF
- dynamic libraries have an extension of .so. */
-
-static boolean
-gldelf32ebmip_open_dynamic_archive (arch, search, entry)
- const char *arch;
- search_dirs_type *search;
- lang_input_statement_type *entry;
-{
- const char *filename;
- char *string;
-
- if (! entry->is_archive)
- return false;
-
- filename = entry->filename;
-
- string = (char *) xmalloc (strlen (search->name)
- + strlen (filename)
- + strlen (arch)
- + sizeof "/lib.so");
-
- sprintf (string, "%s/lib%s%s.so", search->name, filename, arch);
-
- if (! ldfile_try_open_bfd (string, entry))
- {
- free (string);
- return false;
- }
-
- entry->filename = string;
-
- /* We have found a dynamic object to include in the link. The ELF
- backend linker will create a DT_NEEDED entry in the .dynamic
- section naming this file. If this file includes a DT_SONAME
- entry, it will be used. Otherwise, the ELF linker will just use
- the name of the file. For an archive found by searching, like
- this one, the DT_NEEDED entry should consist of just the name of
- the file, without the path information used to find it. Note
- that we only need to do this if we have a dynamic object; an
- archive will never be referenced by a DT_NEEDED entry.
-
- FIXME: This approach--using bfd_elf_set_dt_needed_name--is not
- very pretty. I haven't been able to think of anything that is
- pretty, though. */
- if (bfd_check_format (entry->the_bfd, bfd_object)
- && (entry->the_bfd->flags & DYNAMIC) != 0)
- {
- char *needed_name;
-
- ASSERT (entry->is_archive && entry->search_dirs_flag);
- needed_name = (char *) xmalloc (strlen (filename)
- + strlen (arch)
- + sizeof "lib.so");
- sprintf (needed_name, "lib%s%s.so", filename, arch);
- bfd_elf_set_dt_needed_name (entry->the_bfd, needed_name);
- }
-
- return true;
-}
-
-
-/* These variables are required to pass information back and forth
- between after_open and check_needed and stat_needed. */
-
-static struct bfd_link_needed_list *global_needed;
-static struct stat global_stat;
-static boolean global_found;
-
-/* This is called after all the input files have been opened. */
-
-static void
-gldelf32ebmip_after_open ()
-{
- struct bfd_link_needed_list *needed, *l;
-
- /* We only need to worry about this when doing a final link. */
- if (link_info.relocateable || link_info.shared)
- return;
-
- /* Get the list of files which appear in DT_NEEDED entries in
- dynamic objects included in the link (often there will be none).
- For each such file, we want to track down the corresponding
- library, and include the symbol table in the link. This is what
- the runtime dynamic linker will do. Tracking the files down here
- permits one dynamic object to include another without requiring
- special action by the person doing the link. Note that the
- needed list can actually grow while we are stepping through this
- loop. */
- needed = bfd_elf_get_needed_list (output_bfd, &link_info);
- for (l = needed; l != NULL; l = l->next)
- {
- struct bfd_link_needed_list *ll;
- const char *lib_path;
- size_t len;
- search_dirs_type *search;
-
- /* If we've already seen this file, skip it. */
- for (ll = needed; ll != l; ll = ll->next)
- if (strcmp (ll->name, l->name) == 0)
- break;
- if (ll != l)
- continue;
-
- /* See if this file was included in the link explicitly. */
- global_needed = l;
- global_found = false;
- lang_for_each_input_file (gldelf32ebmip_check_needed);
- if (global_found)
- continue;
-
- /* We need to find this file and include the symbol table. We
- want to search for the file in the same way that the dynamic
- linker will search. That means that we want to use
- rpath_link, rpath, then the environment variable
- LD_LIBRARY_PATH (native only), then the linker script
- LIB_SEARCH_DIRS. We do not search using the -L arguments. */
- if (gldelf32ebmip_search_needed (command_line.rpath_link,
- l->name))
- continue;
- if (gldelf32ebmip_search_needed (command_line.rpath, l->name))
- continue;
- if (command_line.rpath_link == NULL
- && command_line.rpath == NULL)
- {
- lib_path = (const char *) getenv ("LD_RUN_PATH");
- if (gldelf32ebmip_search_needed (lib_path, l->name))
- continue;
- }
- len = strlen (l->name);
- for (search = search_head; search != NULL; search = search->next)
- {
- char *filename;
-
- if (search->cmdline)
- continue;
- filename = (char *) xmalloc (strlen (search->name) + len + 2);
- sprintf (filename, "%s/%s", search->name, l->name);
- if (gldelf32ebmip_try_needed (filename))
- break;
- free (filename);
- }
- if (search != NULL)
- continue;
-
- einfo ("%P: warning: %s, needed by %B, not found\n",
- l->name, l->by);
- }
-}
-
-/* Search for a needed file in a path. */
-
-static boolean
-gldelf32ebmip_search_needed (path, name)
- const char *path;
- const char *name;
-{
- const char *s;
- size_t len;
-
- if (path == NULL || *path == '\0')
- return false;
- len = strlen (name);
- while (1)
- {
- char *filename, *sset;
-
- s = strchr (path, ':');
- if (s == NULL)
- s = path + strlen (path);
-
- filename = (char *) xmalloc (s - path + len + 2);
- if (s == path)
- sset = filename;
- else
- {
- memcpy (filename, path, s - path);
- filename[s - path] = '/';
- sset = filename + (s - path) + 1;
- }
- strcpy (sset, name);
-
- if (gldelf32ebmip_try_needed (filename))
- return true;
-
- free (filename);
-
- if (*s == '\0')
- break;
- path = s + 1;
- }
-
- return false;
-}
-
-/* This function is called for each possible name for a dynamic object
- named by a DT_NEEDED entry. */
-
-static boolean
-gldelf32ebmip_try_needed (name)
- const char *name;
-{
- bfd *abfd;
-
- abfd = bfd_openr (name, bfd_get_target (output_bfd));
- if (abfd == NULL)
- return false;
- if (! bfd_check_format (abfd, bfd_object))
- {
- (void) bfd_close (abfd);
- return false;
- }
- if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0)
- {
- (void) bfd_close (abfd);
- return false;
- }
-
- /* We've found a dynamic object matching the DT_NEEDED entry. */
-
- /* We have already checked that there is no other input file of the
- same name. We must now check again that we are not including the
- same file twice. We need to do this because on many systems
- libc.so is a symlink to, e.g., libc.so.1. The SONAME entry will
- reference libc.so.1. If we have already included libc.so, we
- don't want to include libc.so.1 if they are the same file, and we
- can only check that using stat. */
-
- if (bfd_stat (abfd, &global_stat) != 0)
- einfo ("%F%P:%B: bfd_stat failed: %E\n", abfd);
- global_found = false;
- lang_for_each_input_file (gldelf32ebmip_stat_needed);
- if (global_found)
- {
- /* Return true to indicate that we found the file, even though
- we aren't going to do anything with it. */
- return true;
- }
-
- /* Tell the ELF backend that don't want the output file to have a
- DT_NEEDED entry for this file. */
- bfd_elf_set_dt_needed_name (abfd, "");
-
- /* Add this file into the symbol table. */
- if (! bfd_link_add_symbols (abfd, &link_info))
- einfo ("%F%B: could not read symbols: %E\n", abfd);
-
- return true;
-}
-
-/* See if an input file matches a DT_NEEDED entry by name. */
-
-static void
-gldelf32ebmip_check_needed (s)
- lang_input_statement_type *s;
-{
- if (global_found)
- return;
-
- if (s->filename != NULL
- && strcmp (s->filename, global_needed->name) == 0)
- {
- global_found = true;
- return;
- }
-
- if (s->the_bfd != NULL)
- {
- const char *soname;
-
- soname = bfd_elf_get_dt_soname (s->the_bfd);
- if (soname != NULL
- && strcmp (soname, global_needed->name) == 0)
- {
- global_found = true;
- return;
- }
- }
-
- if (s->search_dirs_flag
- && s->filename != NULL
- && strchr (global_needed->name, '/') == NULL)
- {
- const char *f;
-
- f = strrchr (s->filename, '/');
- if (f != NULL
- && strcmp (f + 1, global_needed->name) == 0)
- {
- global_found = true;
- return;
- }
- }
-}
-
-/* See if an input file matches a DT_NEEDED entry by running stat on
- the file. */
-
-static void
-gldelf32ebmip_stat_needed (s)
- lang_input_statement_type *s;
-{
- struct stat st;
- const char *suffix;
- const char *soname;
- const char *f;
-
- if (global_found)
- return;
- if (s->the_bfd == NULL)
- return;
-
- if (bfd_stat (s->the_bfd, &st) != 0)
- {
- einfo ("%P:%B: bfd_stat failed: %E\n", s->the_bfd);
- return;
- }
-
- if (st.st_dev == global_stat.st_dev
- && st.st_ino == global_stat.st_ino)
- {
- global_found = true;
- return;
- }
-
- /* We issue a warning if it looks like we are including two
- different versions of the same shared library. For example,
- there may be a problem if -lc picks up libc.so.6 but some other
- shared library has a DT_NEEDED entry of libc.so.5. This is a
- hueristic test, and it will only work if the name looks like
- NAME.so.VERSION. FIXME: Depending on file names is error-prone.
- If we really want to issue warnings about mixing version numbers
- of shared libraries, we need to find a better way. */
-
- if (strchr (global_needed->name, '/') != NULL)
- return;
- suffix = strstr (global_needed->name, ".so.");
- if (suffix == NULL)
- return;
- suffix += sizeof ".so." - 1;
-
- soname = bfd_elf_get_dt_soname (s->the_bfd);
- if (soname == NULL)
- soname = s->filename;
-
- f = strrchr (soname, '/');
- if (f != NULL)
- ++f;
- else
- f = soname;
-
- if (strncmp (f, global_needed->name, suffix - global_needed->name) == 0)
- einfo ("%P: warning: %s, needed by %B, may conflict with %s\n",
- global_needed->name, global_needed->by, f);
-}
-
-/* This is called after the sections have been attached to output
- sections, but before any sizes or addresses have been set. */
-
-static void
-gldelf32ebmip_before_allocation ()
-{
- const char *rpath;
- asection *sinterp;
-
- /* If we are going to make any variable assignments, we need to let
- the ELF backend know about them in case the variables are
- referred to by dynamic objects. */
- lang_for_each_statement (gldelf32ebmip_find_statement_assignment);
-
- /* Let the ELF backend work out the sizes of any sections required
- by dynamic linking. */
- rpath = command_line.rpath;
- if (rpath == NULL)
- rpath = (const char *) getenv ("LD_RUN_PATH");
- if (! bfd_elf32_size_dynamic_sections (output_bfd,
- command_line.soname,
- rpath,
- command_line.export_dynamic,
- &link_info,
- &sinterp))
- einfo ("%P%F: failed to set dynamic section sizes: %E\n");
-
- /* Let the user override the dynamic linker we are using. */
- if (command_line.interpreter != NULL
- && sinterp != NULL)
- {
- sinterp->contents = (bfd_byte *) command_line.interpreter;
- sinterp->_raw_size = strlen (command_line.interpreter) + 1;
- }
-
- /* Look for any sections named .gnu.warning. As a GNU extensions,
- we treat such sections as containing warning messages. We print
- out the warning message, and then zero out the section size so
- that it does not get copied into the output file. */
-
- {
- LANG_FOR_EACH_INPUT_STATEMENT (is)
- {
- asection *s;
- bfd_size_type sz;
- char *msg;
- boolean ret;
-
- if (is->just_syms_flag)
- continue;
-
- s = bfd_get_section_by_name (is->the_bfd, ".gnu.warning");
- if (s == NULL)
- continue;
-
- sz = bfd_section_size (is->the_bfd, s);
- msg = xmalloc ((size_t) sz + 1);
- if (! bfd_get_section_contents (is->the_bfd, s, msg, (file_ptr) 0, sz))
- einfo ("%F%B: Can't read contents of section .gnu.warning: %E\n",
- is->the_bfd);
- msg[sz] = '\0';
- ret = link_info.callbacks->warning (&link_info, msg,
- (const char *) NULL,
- is->the_bfd, (asection *) NULL,
- (bfd_vma) 0);
- ASSERT (ret);
- free (msg);
-
- /* Clobber the section size, so that we don't waste copying the
- warning into the output file. */
- s->_raw_size = 0;
- }
- }
-
-#if defined (TARGET_IS_elf32bmip) || defined (TARGET_IS_elf32lmip)
- /* For MIPS ELF the .reginfo section requires special handling.
- Each input section is 24 bytes, and the final output section must
- also be 24 bytes. We handle this by clobbering all but the first
- input section size to 0. The .reginfo section is handled
- specially by the backend code anyhow. */
- {
- boolean found = false;
- LANG_FOR_EACH_INPUT_STATEMENT (is)
- {
- asection *s;
-
- if (is->just_syms_flag)
- continue;
-
- s = bfd_get_section_by_name (is->the_bfd, ".reginfo");
- if (s == NULL)
- continue;
-
- if (! found)
- {
- found = true;
- continue;
- }
-
- s->_raw_size = 0;
- s->_cooked_size = 0;
- }
- }
-#endif
-}
-
-/* This is called by the before_allocation routine via
- lang_for_each_statement. It locates any assignment statements, and
- tells the ELF backend about them, in case they are assignments to
- symbols which are referred to by dynamic objects. */
-
-static void
-gldelf32ebmip_find_statement_assignment (s)
- lang_statement_union_type *s;
-{
- if (s->header.type == lang_assignment_statement_enum)
- gldelf32ebmip_find_exp_assignment (s->assignment_statement.exp);
-}
-
-/* Look through an expression for an assignment statement. */
-
-static void
-gldelf32ebmip_find_exp_assignment (exp)
- etree_type *exp;
-{
- struct bfd_link_hash_entry *h;
-
- switch (exp->type.node_class)
- {
- case etree_provide:
- h = bfd_link_hash_lookup (link_info.hash, exp->assign.dst,
- false, false, false);
- if (h == NULL)
- break;
-
- /* We call record_link_assignment even if the symbol is defined.
- This is because if it is defined by a dynamic object, we
- actually want to use the value defined by the linker script,
- not the value from the dynamic object (because we are setting
- symbols like etext). If the symbol is defined by a regular
- object, then, as it happens, calling record_link_assignment
- will do no harm. */
-
- /* Fall through. */
- case etree_assign:
- if (strcmp (exp->assign.dst, ".") != 0)
- {
- if (! (bfd_elf32_record_link_assignment
- (output_bfd, &link_info, exp->assign.dst,
- exp->type.node_class == etree_provide ? true : false)))
- einfo ("%P%F: failed to record assignment to %s: %E\n",
- exp->assign.dst);
- }
- gldelf32ebmip_find_exp_assignment (exp->assign.src);
- break;
-
- case etree_binary:
- gldelf32ebmip_find_exp_assignment (exp->binary.lhs);
- gldelf32ebmip_find_exp_assignment (exp->binary.rhs);
- break;
-
- case etree_trinary:
- gldelf32ebmip_find_exp_assignment (exp->trinary.cond);
- gldelf32ebmip_find_exp_assignment (exp->trinary.lhs);
- gldelf32ebmip_find_exp_assignment (exp->trinary.rhs);
- break;
-
- case etree_unary:
- gldelf32ebmip_find_exp_assignment (exp->unary.child);
- break;
-
- default:
- break;
- }
-}
-
-/* Place an orphan section. We use this to put random SHF_ALLOC
- sections in the right segment. */
-
-static asection *hold_section;
-static lang_output_section_statement_type *hold_use;
-static lang_output_section_statement_type *hold_text;
-static lang_output_section_statement_type *hold_rodata;
-static lang_output_section_statement_type *hold_data;
-static lang_output_section_statement_type *hold_bss;
-static lang_output_section_statement_type *hold_rel;
-
-/*ARGSUSED*/
-static boolean
-gldelf32ebmip_place_orphan (file, s)
- lang_input_statement_type *file;
- asection *s;
-{
- lang_output_section_statement_type *place;
- asection *snew, **pps;
- lang_statement_list_type *old;
- lang_statement_list_type add;
- etree_type *address;
- const char *secname, *ps;
- lang_output_section_statement_type *os;
-
- if ((s->flags & SEC_ALLOC) == 0)
- return false;
-
- /* Look through the script to see where to place this section. */
- hold_section = s;
- hold_use = NULL;
- lang_for_each_statement (gldelf32ebmip_place_section);
-
- if (hold_use != NULL)
- {
- /* We have already placed a section with this name. */
- wild_doit (&hold_use->children, s, hold_use, file);
- return true;
- }
-
- secname = bfd_get_section_name (s->owner, s);
-
- /* If this is a final link, then always put .gnu.warning.SYMBOL
- sections into the .text section to get them out of the way. */
- if (! link_info.shared
- && ! link_info.relocateable
- && strncmp (secname, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0
- && hold_text != NULL)
- {
- wild_doit (&hold_text->children, s, hold_text, file);
- return true;
- }
-
- /* Decide which segment the section should go in based on the
- section name and section flags. */
- place = NULL;
- if ((s->flags & SEC_HAS_CONTENTS) == 0
- && hold_bss != NULL)
- place = hold_bss;
- else if ((s->flags & SEC_READONLY) == 0
- && hold_data != NULL)
- place = hold_data;
- else if (strncmp (secname, ".rel", 4) == 0
- && hold_rel != NULL)
- place = hold_rel;
- else if ((s->flags & SEC_CODE) == 0
- && (s->flags & SEC_READONLY) != 0
- && hold_rodata != NULL)
- place = hold_rodata;
- else if ((s->flags & SEC_READONLY) != 0
- && hold_text != NULL)
- place = hold_text;
- if (place == NULL)
- return false;
-
- /* Create the section in the output file, and put it in the right
- place. This shuffling is to make the output file look neater. */
- snew = bfd_make_section (output_bfd, secname);
- if (snew == NULL)
- einfo ("%P%F: output format %s cannot represent section called %s\n",
- output_bfd->xvec->name, secname);
- if (place->bfd_section != NULL)
- {
- for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
- ;
- *pps = snew->next;
- snew->next = place->bfd_section->next;
- place->bfd_section->next = snew;
- }
-
- /* Start building a list of statements for this section. */
- old = stat_ptr;
- stat_ptr = &add;
- lang_list_init (stat_ptr);
-
- /* If the name of the section is representable in C, then create
- symbols to mark the start and the end of the section. */
- for (ps = secname; *ps != '\0'; ps++)
- if (! isalnum (*ps) && *ps != '_')
- break;
- if (*ps == '\0' && config.build_constructors)
- {
- char *symname;
-
- symname = (char *) xmalloc (ps - secname + sizeof "__start_");
- sprintf (symname, "__start_%s", secname);
- lang_add_assignment (exp_assop ('=', symname,
- exp_unop (ALIGN_K,
- exp_intop ((bfd_vma) 1
- << s->alignment_power))));
- }
-
- if (! link_info.relocateable)
- address = NULL;
- else
- address = exp_intop ((bfd_vma) 0);
-
- lang_enter_output_section_statement (secname, address, 0,
- (bfd_vma) 0,
- (etree_type *) NULL,
- (etree_type *) NULL,
- (etree_type *) NULL);
-
- os = lang_output_section_statement_lookup (secname);
- wild_doit (&os->children, s, os, file);
-
- lang_leave_output_section_statement ((bfd_vma) 0, "*default*");
- stat_ptr = &add;
-
- if (*ps == '\0' && config.build_constructors)
- {
- char *symname;
-
- symname = (char *) xmalloc (ps - secname + sizeof "__stop_");
- sprintf (symname, "__stop_%s", secname);
- lang_add_assignment (exp_assop ('=', symname,
- exp_nameop (NAME, ".")));
- }
-
- /* Now stick the new statement list right after PLACE. */
- *add.tail = place->header.next;
- place->header.next = add.head;
-
- stat_ptr = old;
-
- return true;
-}
-
-static void
-gldelf32ebmip_place_section (s)
- lang_statement_union_type *s;
-{
- lang_output_section_statement_type *os;
-
- if (s->header.type != lang_output_section_statement_enum)
- return;
-
- os = &s->output_section_statement;
-
- if (strcmp (os->name, hold_section->name) == 0)
- hold_use = os;
-
- if (strcmp (os->name, ".text") == 0)
- hold_text = os;
- else if (strcmp (os->name, ".rodata") == 0)
- hold_rodata = os;
- else if (strcmp (os->name, ".data") == 0)
- hold_data = os;
- else if (strcmp (os->name, ".bss") == 0)
- hold_bss = os;
- else if (hold_rel == NULL
- && os->bfd_section != NULL
- && strncmp (os->name, ".rel", 4) == 0)
- hold_rel = os;
-}
-
-static char *
-gldelf32ebmip_get_script(isfile)
- int *isfile;
-{
- *isfile = 0;
-
- if (link_info.relocateable == true && config.build_constructors == true)
- return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
- \"elf32-littlemips\")\n\
-OUTPUT_ARCH(mips)\n\
-ENTRY(_start)\n\
- /* For some reason, the Solaris linker makes bad executables\n\
- if gld -r is used and the intermediate file has sections starting\n\
- at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld\n\
- bug. But for now assigning the zero vmas works. */\n\
-SECTIONS\n\
-{\n\
- /* Read-only sections, merged into text segment: */\n\
- .interp 0 : { *(.interp) }\n\
- .reginfo 0 : { *(.reginfo) }\n\
- .dynamic 0 : { *(.dynamic) }\n\
- .dynstr 0 : { *(.dynstr) }\n\
- .dynsym 0 : { *(.dynsym) }\n\
- .hash 0 : { *(.hash) }\n\
- .rel.text 0 : { *(.rel.text) }\n\
- .rela.text 0 : { *(.rela.text) }\n\
- .rel.data 0 : { *(.rel.data) }\n\
- .rela.data 0 : { *(.rela.data) }\n\
- .rel.rodata 0 : { *(.rel.rodata) }\n\
- .rela.rodata 0 : { *(.rela.rodata) }\n\
- .rel.got 0 : { *(.rel.got) }\n\
- .rela.got 0 : { *(.rela.got) }\n\
- .rel.ctors 0 : { *(.rel.ctors) }\n\
- .rela.ctors 0 : { *(.rela.ctors) }\n\
- .rel.dtors 0 : { *(.rel.dtors) }\n\
- .rela.dtors 0 : { *(.rela.dtors) }\n\
- .rel.init 0 : { *(.rel.init) }\n\
- .rela.init 0 : { *(.rela.init) }\n\
- .rel.fini 0 : { *(.rel.fini) }\n\
- .rela.fini 0 : { *(.rela.fini) }\n\
- .rel.bss 0 : { *(.rel.bss) }\n\
- .rela.bss 0 : { *(.rela.bss) }\n\
- .rel.plt 0 : { *(.rel.plt) }\n\
- .rela.plt 0 : { *(.rela.plt) }\n\
- .rodata 0 : { *(.rodata) }\n\
- .rodata1 0 : { *(.rodata1) }\n\
- .init 0 : { *(.init) } =0\n\
- .text 0 :\n\
- {\n\
- *(.text)\n\
- *(.stub)\n\
- /* .gnu.warning sections are handled specially by elf32.em. */\n\
- *(.gnu.warning)\n\
- } =0\n\
- .fini 0 : { *(.fini) } =0\n\
- /* Adjust the address for the data segment. We want to adjust up to\n\
- the same address within the page on the next page up. It would\n\
- be more correct to do this:\n\
- The current expression does not correctly handle the case of a\n\
- text segment ending precisely at the end of a page; it causes the\n\
- data segment to skip a page. The above expression does not have\n\
- this problem, but it will currently (2/95) cause BFD to allocate\n\
- a single segment, combining both text and data, for this case.\n\
- This will prevent the text segment from being shared among\n\
- multiple executions of the program; I think that is more\n\
- important than losing a page of the virtual address space (note\n\
- that no actual memory is lost; the page which is skipped can not\n\
- be referenced). */\n\
- .data 0 :\n\
- {\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- .data1 0 : { *(.data1) }\n\
- .ctors 0 : { *(.ctors) }\n\
- .dtors 0 : { *(.dtors) }\n\
- .got 0 :\n\
- {\n\
- *(.got.plt) *(.got)\n\
- }\n\
- /* We want the small data sections together, so single-instruction offsets\n\
- can access them all, and initialized data all before uninitialized, so\n\
- we can shorten the on-disk segment size. */\n\
- .sdata 0 : { *(.sdata) }\n\
- .sbss 0 : { *(.sbss) *(.scommon) }\n\
- .bss 0 :\n\
- {\n\
- *(.dynbss)\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- /* These are needed for ELF backends which have not yet been\n\
- converted to the new style linker. */\n\
- .stab 0 : { *(.stab) }\n\
- .stabstr 0 : { *(.stabstr) }\n\
- /* DWARF debug sections.\n\
- Symbols in the .debug DWARF section are relative to the beginning of the\n\
- section so we begin .debug at 0. It's not clear yet what needs to happen\n\
- for the others. */\n\
- .debug 0 : { *(.debug) }\n\
- .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
- .debug_aranges 0 : { *(.debug_aranges) }\n\
- .debug_pubnames 0 : { *(.debug_pubnames) }\n\
- .debug_sfnames 0 : { *(.debug_sfnames) }\n\
- .line 0 : { *(.line) }\n\
- /* These must appear regardless of . */\n\
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
-}\n\n";
- else if (link_info.relocateable == true)
- return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
- \"elf32-littlemips\")\n\
-OUTPUT_ARCH(mips)\n\
-ENTRY(_start)\n\
- /* For some reason, the Solaris linker makes bad executables\n\
- if gld -r is used and the intermediate file has sections starting\n\
- at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld\n\
- bug. But for now assigning the zero vmas works. */\n\
-SECTIONS\n\
-{\n\
- /* Read-only sections, merged into text segment: */\n\
- .interp 0 : { *(.interp) }\n\
- .reginfo 0 : { *(.reginfo) }\n\
- .dynamic 0 : { *(.dynamic) }\n\
- .dynstr 0 : { *(.dynstr) }\n\
- .dynsym 0 : { *(.dynsym) }\n\
- .hash 0 : { *(.hash) }\n\
- .rel.text 0 : { *(.rel.text) }\n\
- .rela.text 0 : { *(.rela.text) }\n\
- .rel.data 0 : { *(.rel.data) }\n\
- .rela.data 0 : { *(.rela.data) }\n\
- .rel.rodata 0 : { *(.rel.rodata) }\n\
- .rela.rodata 0 : { *(.rela.rodata) }\n\
- .rel.got 0 : { *(.rel.got) }\n\
- .rela.got 0 : { *(.rela.got) }\n\
- .rel.ctors 0 : { *(.rel.ctors) }\n\
- .rela.ctors 0 : { *(.rela.ctors) }\n\
- .rel.dtors 0 : { *(.rel.dtors) }\n\
- .rela.dtors 0 : { *(.rela.dtors) }\n\
- .rel.init 0 : { *(.rel.init) }\n\
- .rela.init 0 : { *(.rela.init) }\n\
- .rel.fini 0 : { *(.rel.fini) }\n\
- .rela.fini 0 : { *(.rela.fini) }\n\
- .rel.bss 0 : { *(.rel.bss) }\n\
- .rela.bss 0 : { *(.rela.bss) }\n\
- .rel.plt 0 : { *(.rel.plt) }\n\
- .rela.plt 0 : { *(.rela.plt) }\n\
- .rodata 0 : { *(.rodata) }\n\
- .rodata1 0 : { *(.rodata1) }\n\
- .init 0 : { *(.init) } =0\n\
- .text 0 :\n\
- {\n\
- *(.text)\n\
- *(.stub)\n\
- /* .gnu.warning sections are handled specially by elf32.em. */\n\
- *(.gnu.warning)\n\
- } =0\n\
- .fini 0 : { *(.fini) } =0\n\
- /* Adjust the address for the data segment. We want to adjust up to\n\
- the same address within the page on the next page up. It would\n\
- be more correct to do this:\n\
- The current expression does not correctly handle the case of a\n\
- text segment ending precisely at the end of a page; it causes the\n\
- data segment to skip a page. The above expression does not have\n\
- this problem, but it will currently (2/95) cause BFD to allocate\n\
- a single segment, combining both text and data, for this case.\n\
- This will prevent the text segment from being shared among\n\
- multiple executions of the program; I think that is more\n\
- important than losing a page of the virtual address space (note\n\
- that no actual memory is lost; the page which is skipped can not\n\
- be referenced). */\n\
- .data 0 :\n\
- {\n\
- *(.data)\n\
- }\n\
- .data1 0 : { *(.data1) }\n\
- .ctors 0 : { *(.ctors) }\n\
- .dtors 0 : { *(.dtors) }\n\
- .got 0 :\n\
- {\n\
- *(.got.plt) *(.got)\n\
- }\n\
- /* We want the small data sections together, so single-instruction offsets\n\
- can access them all, and initialized data all before uninitialized, so\n\
- we can shorten the on-disk segment size. */\n\
- .sdata 0 : { *(.sdata) }\n\
- .sbss 0 : { *(.sbss) *(.scommon) }\n\
- .bss 0 :\n\
- {\n\
- *(.dynbss)\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- /* These are needed for ELF backends which have not yet been\n\
- converted to the new style linker. */\n\
- .stab 0 : { *(.stab) }\n\
- .stabstr 0 : { *(.stabstr) }\n\
- /* DWARF debug sections.\n\
- Symbols in the .debug DWARF section are relative to the beginning of the\n\
- section so we begin .debug at 0. It's not clear yet what needs to happen\n\
- for the others. */\n\
- .debug 0 : { *(.debug) }\n\
- .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
- .debug_aranges 0 : { *(.debug_aranges) }\n\
- .debug_pubnames 0 : { *(.debug_pubnames) }\n\
- .debug_sfnames 0 : { *(.debug_sfnames) }\n\
- .line 0 : { *(.line) }\n\
- /* These must appear regardless of . */\n\
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
-}\n\n";
- else if (!config.text_read_only)
- return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
- \"elf32-littlemips\")\n\
-OUTPUT_ARCH(mips)\n\
-ENTRY(_start)\n\
- SEARCH_DIR(/usr/local/mips-elf/lib);\n\
-/* Do we need any of these for elf?\n\
- __DYNAMIC = 0; */\n\
-SECTIONS\n\
-{\n\
- /* Read-only sections, merged into text segment: */\n\
- . = 0x0400000;\n\
- .interp : { *(.interp) }\n\
- .reginfo : { *(.reginfo) }\n\
- .dynamic : { *(.dynamic) }\n\
- .dynstr : { *(.dynstr) }\n\
- .dynsym : { *(.dynsym) }\n\
- .hash : { *(.hash) }\n\
- .rel.text : { *(.rel.text) }\n\
- .rela.text : { *(.rela.text) }\n\
- .rel.data : { *(.rel.data) }\n\
- .rela.data : { *(.rela.data) }\n\
- .rel.rodata : { *(.rel.rodata) }\n\
- .rela.rodata : { *(.rela.rodata) }\n\
- .rel.got : { *(.rel.got) }\n\
- .rela.got : { *(.rela.got) }\n\
- .rel.ctors : { *(.rel.ctors) }\n\
- .rela.ctors : { *(.rela.ctors) }\n\
- .rel.dtors : { *(.rel.dtors) }\n\
- .rela.dtors : { *(.rela.dtors) }\n\
- .rel.init : { *(.rel.init) }\n\
- .rela.init : { *(.rela.init) }\n\
- .rel.fini : { *(.rel.fini) }\n\
- .rela.fini : { *(.rela.fini) }\n\
- .rel.bss : { *(.rel.bss) }\n\
- .rela.bss : { *(.rela.bss) }\n\
- .rel.plt : { *(.rel.plt) }\n\
- .rela.plt : { *(.rela.plt) }\n\
- .rodata : { *(.rodata) }\n\
- .rodata1 : { *(.rodata1) }\n\
- .init : { *(.init) } =0\n\
- .text :\n\
- {\n\
- _ftext = . ;\n\
- *(.text)\n\
- *(.stub)\n\
- /* .gnu.warning sections are handled specially by elf32.em. */\n\
- *(.gnu.warning)\n\
- } =0\n\
- _etext = .;\n\
- PROVIDE (etext = .);\n\
- .fini : { *(.fini) } =0\n\
- /* Adjust the address for the data segment. We want to adjust up to\n\
- the same address within the page on the next page up. It would\n\
- be more correct to do this:\n\
- . = .;\n\
- The current expression does not correctly handle the case of a\n\
- text segment ending precisely at the end of a page; it causes the\n\
- data segment to skip a page. The above expression does not have\n\
- this problem, but it will currently (2/95) cause BFD to allocate\n\
- a single segment, combining both text and data, for this case.\n\
- This will prevent the text segment from being shared among\n\
- multiple executions of the program; I think that is more\n\
- important than losing a page of the virtual address space (note\n\
- that no actual memory is lost; the page which is skipped can not\n\
- be referenced). */\n\
- . += . - 0x0400000;\n\
- .data :\n\
- {\n\
- _fdata = . ;\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- .data1 : { *(.data1) }\n\
- .ctors : { *(.ctors) }\n\
- .dtors : { *(.dtors) }\n\
- _gp = ALIGN(16) + 0x7ff0;\n\
- .got :\n\
- {\n\
- *(.got.plt) *(.got)\n\
- }\n\
- /* We want the small data sections together, so single-instruction offsets\n\
- can access them all, and initialized data all before uninitialized, so\n\
- we can shorten the on-disk segment size. */\n\
- .sdata : { *(.sdata) }\n\
- .lit8 : { *(.lit8) }\n\
- .lit4 : { *(.lit4) }\n\
- _edata = .;\n\
- PROVIDE (edata = .);\n\
- __bss_start = .;\n\
- _fbss = .;\n\
- .sbss : { *(.sbss) *(.scommon) }\n\
- .bss :\n\
- {\n\
- *(.dynbss)\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- _end = . ;\n\
- PROVIDE (end = .);\n\
- /* These are needed for ELF backends which have not yet been\n\
- converted to the new style linker. */\n\
- .stab 0 : { *(.stab) }\n\
- .stabstr 0 : { *(.stabstr) }\n\
- /* DWARF debug sections.\n\
- Symbols in the .debug DWARF section are relative to the beginning of the\n\
- section so we begin .debug at 0. It's not clear yet what needs to happen\n\
- for the others. */\n\
- .debug 0 : { *(.debug) }\n\
- .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
- .debug_aranges 0 : { *(.debug_aranges) }\n\
- .debug_pubnames 0 : { *(.debug_pubnames) }\n\
- .debug_sfnames 0 : { *(.debug_sfnames) }\n\
- .line 0 : { *(.line) }\n\
- /* These must appear regardless of . */\n\
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
-}\n\n";
- else if (!config.magic_demand_paged)
- return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
- \"elf32-littlemips\")\n\
-OUTPUT_ARCH(mips)\n\
-ENTRY(_start)\n\
- SEARCH_DIR(/usr/local/mips-elf/lib);\n\
-/* Do we need any of these for elf?\n\
- __DYNAMIC = 0; */\n\
-SECTIONS\n\
-{\n\
- /* Read-only sections, merged into text segment: */\n\
- . = 0x0400000;\n\
- .interp : { *(.interp) }\n\
- .reginfo : { *(.reginfo) }\n\
- .dynamic : { *(.dynamic) }\n\
- .dynstr : { *(.dynstr) }\n\
- .dynsym : { *(.dynsym) }\n\
- .hash : { *(.hash) }\n\
- .rel.text : { *(.rel.text) }\n\
- .rela.text : { *(.rela.text) }\n\
- .rel.data : { *(.rel.data) }\n\
- .rela.data : { *(.rela.data) }\n\
- .rel.rodata : { *(.rel.rodata) }\n\
- .rela.rodata : { *(.rela.rodata) }\n\
- .rel.got : { *(.rel.got) }\n\
- .rela.got : { *(.rela.got) }\n\
- .rel.ctors : { *(.rel.ctors) }\n\
- .rela.ctors : { *(.rela.ctors) }\n\
- .rel.dtors : { *(.rel.dtors) }\n\
- .rela.dtors : { *(.rela.dtors) }\n\
- .rel.init : { *(.rel.init) }\n\
- .rela.init : { *(.rela.init) }\n\
- .rel.fini : { *(.rel.fini) }\n\
- .rela.fini : { *(.rela.fini) }\n\
- .rel.bss : { *(.rel.bss) }\n\
- .rela.bss : { *(.rela.bss) }\n\
- .rel.plt : { *(.rel.plt) }\n\
- .rela.plt : { *(.rela.plt) }\n\
- .rodata : { *(.rodata) }\n\
- .rodata1 : { *(.rodata1) }\n\
- .init : { *(.init) } =0\n\
- .text :\n\
- {\n\
- _ftext = . ;\n\
- *(.text)\n\
- *(.stub)\n\
- /* .gnu.warning sections are handled specially by elf32.em. */\n\
- *(.gnu.warning)\n\
- } =0\n\
- _etext = .;\n\
- PROVIDE (etext = .);\n\
- .fini : { *(.fini) } =0\n\
- /* Adjust the address for the data segment. We want to adjust up to\n\
- the same address within the page on the next page up. It would\n\
- be more correct to do this:\n\
- . = 0x10000000;\n\
- The current expression does not correctly handle the case of a\n\
- text segment ending precisely at the end of a page; it causes the\n\
- data segment to skip a page. The above expression does not have\n\
- this problem, but it will currently (2/95) cause BFD to allocate\n\
- a single segment, combining both text and data, for this case.\n\
- This will prevent the text segment from being shared among\n\
- multiple executions of the program; I think that is more\n\
- important than losing a page of the virtual address space (note\n\
- that no actual memory is lost; the page which is skipped can not\n\
- be referenced). */\n\
- . += 0x10000000 - 0x0400000;\n\
- .data :\n\
- {\n\
- _fdata = . ;\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- .data1 : { *(.data1) }\n\
- .ctors : { *(.ctors) }\n\
- .dtors : { *(.dtors) }\n\
- _gp = ALIGN(16) + 0x7ff0;\n\
- .got :\n\
- {\n\
- *(.got.plt) *(.got)\n\
- }\n\
- /* We want the small data sections together, so single-instruction offsets\n\
- can access them all, and initialized data all before uninitialized, so\n\
- we can shorten the on-disk segment size. */\n\
- .sdata : { *(.sdata) }\n\
- .lit8 : { *(.lit8) }\n\
- .lit4 : { *(.lit4) }\n\
- _edata = .;\n\
- PROVIDE (edata = .);\n\
- __bss_start = .;\n\
- _fbss = .;\n\
- .sbss : { *(.sbss) *(.scommon) }\n\
- .bss :\n\
- {\n\
- *(.dynbss)\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- _end = . ;\n\
- PROVIDE (end = .);\n\
- /* These are needed for ELF backends which have not yet been\n\
- converted to the new style linker. */\n\
- .stab 0 : { *(.stab) }\n\
- .stabstr 0 : { *(.stabstr) }\n\
- /* DWARF debug sections.\n\
- Symbols in the .debug DWARF section are relative to the beginning of the\n\
- section so we begin .debug at 0. It's not clear yet what needs to happen\n\
- for the others. */\n\
- .debug 0 : { *(.debug) }\n\
- .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
- .debug_aranges 0 : { *(.debug_aranges) }\n\
- .debug_pubnames 0 : { *(.debug_pubnames) }\n\
- .debug_sfnames 0 : { *(.debug_sfnames) }\n\
- .line 0 : { *(.line) }\n\
- /* These must appear regardless of . */\n\
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
-}\n\n";
- else if (link_info.shared)
- return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
- \"elf32-littlemips\")\n\
-OUTPUT_ARCH(mips)\n\
-ENTRY(_start)\n\
- SEARCH_DIR(/usr/local/mips-elf/lib);\n\
-/* Do we need any of these for elf?\n\
- __DYNAMIC = 0; */\n\
-SECTIONS\n\
-{\n\
- /* Read-only sections, merged into text segment: */\n\
- . = 0x5ffe0000 + SIZEOF_HEADERS;\n\
- .reginfo : { *(.reginfo) }\n\
- .dynamic : { *(.dynamic) }\n\
- .dynstr : { *(.dynstr) }\n\
- .dynsym : { *(.dynsym) }\n\
- .hash : { *(.hash) }\n\
- .rel.text : { *(.rel.text) }\n\
- .rela.text : { *(.rela.text) }\n\
- .rel.data : { *(.rel.data) }\n\
- .rela.data : { *(.rela.data) }\n\
- .rel.rodata : { *(.rel.rodata) }\n\
- .rela.rodata : { *(.rela.rodata) }\n\
- .rel.got : { *(.rel.got) }\n\
- .rela.got : { *(.rela.got) }\n\
- .rel.ctors : { *(.rel.ctors) }\n\
- .rela.ctors : { *(.rela.ctors) }\n\
- .rel.dtors : { *(.rel.dtors) }\n\
- .rela.dtors : { *(.rela.dtors) }\n\
- .rel.init : { *(.rel.init) }\n\
- .rela.init : { *(.rela.init) }\n\
- .rel.fini : { *(.rel.fini) }\n\
- .rela.fini : { *(.rela.fini) }\n\
- .rel.bss : { *(.rel.bss) }\n\
- .rela.bss : { *(.rela.bss) }\n\
- .rel.plt : { *(.rel.plt) }\n\
- .rela.plt : { *(.rela.plt) }\n\
- .rodata : { *(.rodata) }\n\
- .rodata1 : { *(.rodata1) }\n\
- .init : { *(.init) } =0\n\
- .text :\n\
- {\n\
- *(.text)\n\
- *(.stub)\n\
- /* .gnu.warning sections are handled specially by elf32.em. */\n\
- *(.gnu.warning)\n\
- } =0\n\
- .fini : { *(.fini) } =0\n\
- /* Adjust the address for the data segment. We want to adjust up to\n\
- the same address within the page on the next page up. It would\n\
- be more correct to do this:\n\
- . = 0x10000000;\n\
- The current expression does not correctly handle the case of a\n\
- text segment ending precisely at the end of a page; it causes the\n\
- data segment to skip a page. The above expression does not have\n\
- this problem, but it will currently (2/95) cause BFD to allocate\n\
- a single segment, combining both text and data, for this case.\n\
- This will prevent the text segment from being shared among\n\
- multiple executions of the program; I think that is more\n\
- important than losing a page of the virtual address space (note\n\
- that no actual memory is lost; the page which is skipped can not\n\
- be referenced). */\n\
- . += 0x10000;\n\
- .data :\n\
- {\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- .data1 : { *(.data1) }\n\
- .ctors : { *(.ctors) }\n\
- .dtors : { *(.dtors) }\n\
- _gp = ALIGN(16) + 0x7ff0;\n\
- .got :\n\
- {\n\
- *(.got.plt) *(.got)\n\
- }\n\
- /* We want the small data sections together, so single-instruction offsets\n\
- can access them all, and initialized data all before uninitialized, so\n\
- we can shorten the on-disk segment size. */\n\
- .sdata : { *(.sdata) }\n\
- .lit8 : { *(.lit8) }\n\
- .lit4 : { *(.lit4) }\n\
- .sbss : { *(.sbss) *(.scommon) }\n\
- .bss :\n\
- {\n\
- *(.dynbss)\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- /* These are needed for ELF backends which have not yet been\n\
- converted to the new style linker. */\n\
- .stab 0 : { *(.stab) }\n\
- .stabstr 0 : { *(.stabstr) }\n\
- /* DWARF debug sections.\n\
- Symbols in the .debug DWARF section are relative to the beginning of the\n\
- section so we begin .debug at 0. It's not clear yet what needs to happen\n\
- for the others. */\n\
- .debug 0 : { *(.debug) }\n\
- .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
- .debug_aranges 0 : { *(.debug_aranges) }\n\
- .debug_pubnames 0 : { *(.debug_pubnames) }\n\
- .debug_sfnames 0 : { *(.debug_sfnames) }\n\
- .line 0 : { *(.line) }\n\
- /* These must appear regardless of . */\n\
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
-}\n\n";
- else
- return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
- \"elf32-littlemips\")\n\
-OUTPUT_ARCH(mips)\n\
-ENTRY(_start)\n\
- SEARCH_DIR(/usr/local/mips-elf/lib);\n\
-/* Do we need any of these for elf?\n\
- __DYNAMIC = 0; */\n\
-SECTIONS\n\
-{\n\
- /* Read-only sections, merged into text segment: */\n\
- . = 0x0400000;\n\
- .interp : { *(.interp) }\n\
- .reginfo : { *(.reginfo) }\n\
- .dynamic : { *(.dynamic) }\n\
- .dynstr : { *(.dynstr) }\n\
- .dynsym : { *(.dynsym) }\n\
- .hash : { *(.hash) }\n\
- .rel.text : { *(.rel.text) }\n\
- .rela.text : { *(.rela.text) }\n\
- .rel.data : { *(.rel.data) }\n\
- .rela.data : { *(.rela.data) }\n\
- .rel.rodata : { *(.rel.rodata) }\n\
- .rela.rodata : { *(.rela.rodata) }\n\
- .rel.got : { *(.rel.got) }\n\
- .rela.got : { *(.rela.got) }\n\
- .rel.ctors : { *(.rel.ctors) }\n\
- .rela.ctors : { *(.rela.ctors) }\n\
- .rel.dtors : { *(.rel.dtors) }\n\
- .rela.dtors : { *(.rela.dtors) }\n\
- .rel.init : { *(.rel.init) }\n\
- .rela.init : { *(.rela.init) }\n\
- .rel.fini : { *(.rel.fini) }\n\
- .rela.fini : { *(.rela.fini) }\n\
- .rel.bss : { *(.rel.bss) }\n\
- .rela.bss : { *(.rela.bss) }\n\
- .rel.plt : { *(.rel.plt) }\n\
- .rela.plt : { *(.rela.plt) }\n\
- .rodata : { *(.rodata) }\n\
- .rodata1 : { *(.rodata1) }\n\
- .init : { *(.init) } =0\n\
- .text :\n\
- {\n\
- _ftext = . ;\n\
- *(.text)\n\
- *(.stub)\n\
- /* .gnu.warning sections are handled specially by elf32.em. */\n\
- *(.gnu.warning)\n\
- } =0\n\
- _etext = .;\n\
- PROVIDE (etext = .);\n\
- .fini : { *(.fini) } =0\n\
- /* Adjust the address for the data segment. We want to adjust up to\n\
- the same address within the page on the next page up. It would\n\
- be more correct to do this:\n\
- . = 0x10000000;\n\
- The current expression does not correctly handle the case of a\n\
- text segment ending precisely at the end of a page; it causes the\n\
- data segment to skip a page. The above expression does not have\n\
- this problem, but it will currently (2/95) cause BFD to allocate\n\
- a single segment, combining both text and data, for this case.\n\
- This will prevent the text segment from being shared among\n\
- multiple executions of the program; I think that is more\n\
- important than losing a page of the virtual address space (note\n\
- that no actual memory is lost; the page which is skipped can not\n\
- be referenced). */\n\
- . += 0x10000000 - 0x0400000;\n\
- .data :\n\
- {\n\
- _fdata = . ;\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- .data1 : { *(.data1) }\n\
- .ctors : { *(.ctors) }\n\
- .dtors : { *(.dtors) }\n\
- _gp = ALIGN(16) + 0x7ff0;\n\
- .got :\n\
- {\n\
- *(.got.plt) *(.got)\n\
- }\n\
- /* We want the small data sections together, so single-instruction offsets\n\
- can access them all, and initialized data all before uninitialized, so\n\
- we can shorten the on-disk segment size. */\n\
- .sdata : { *(.sdata) }\n\
- .lit8 : { *(.lit8) }\n\
- .lit4 : { *(.lit4) }\n\
- _edata = .;\n\
- PROVIDE (edata = .);\n\
- __bss_start = .;\n\
- _fbss = .;\n\
- .sbss : { *(.sbss) *(.scommon) }\n\
- .bss :\n\
- {\n\
- *(.dynbss)\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- _end = . ;\n\
- PROVIDE (end = .);\n\
- /* These are needed for ELF backends which have not yet been\n\
- converted to the new style linker. */\n\
- .stab 0 : { *(.stab) }\n\
- .stabstr 0 : { *(.stabstr) }\n\
- /* DWARF debug sections.\n\
- Symbols in the .debug DWARF section are relative to the beginning of the\n\
- section so we begin .debug at 0. It's not clear yet what needs to happen\n\
- for the others. */\n\
- .debug 0 : { *(.debug) }\n\
- .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
- .debug_aranges 0 : { *(.debug_aranges) }\n\
- .debug_pubnames 0 : { *(.debug_pubnames) }\n\
- .debug_sfnames 0 : { *(.debug_sfnames) }\n\
- .line 0 : { *(.line) }\n\
- /* These must appear regardless of . */\n\
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
-}\n\n";
-}
-
-struct ld_emulation_xfer_struct ld_elf32ebmip_emulation =
-{
- gldelf32ebmip_before_parse,
- syslib_default,
- hll_default,
- after_parse_default,
- gldelf32ebmip_after_open,
- after_allocation_default,
- set_output_arch_default,
- ldemul_default_target,
- gldelf32ebmip_before_allocation,
- gldelf32ebmip_get_script,
- "elf32ebmip",
- "elf32-bigmips",
- NULL,
- NULL,
- gldelf32ebmip_open_dynamic_archive,
- gldelf32ebmip_place_orphan
-};
diff --git a/gnu/usr.bin/binutils/ld/mpw-emipsidt.c b/gnu/usr.bin/binutils/ld/mpw-emipsidt.c
deleted file mode 100644
index 554f9a8c50c..00000000000
--- a/gnu/usr.bin/binutils/ld/mpw-emipsidt.c
+++ /dev/null
@@ -1,430 +0,0 @@
-/* This file is is generated by a shell script. DO NOT EDIT! */
-
-/* Handle embedded relocs for MIPS.
- Copyright 1994 Free Software Foundation, Inc.
- Written by Ian Lance Taylor <ian@cygnus.com> based on generic.em.
-
-This file is part of GLD, the Gnu Linker.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGET_IS_mipsidt
-
-#include "libiberty.h"
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-
-#include "ld.h"
-#include "ldmain.h"
-#include "ldemul.h"
-#include "ldfile.h"
-#include "ldmisc.h"
-
-static void gldmipsidt_before_parse PARAMS ((void));
-static void gldmipsidt_after_open PARAMS ((void));
-static void check_sections PARAMS ((bfd *, asection *, PTR));
-static void gldmipsidt_after_allocation PARAMS ((void));
-static char *gldmipsidt_get_script PARAMS ((int *isfile));
-
-static void
-gldmipsidt_before_parse()
-{
-#ifndef TARGET_ /* I.e., if not generic. */
- ldfile_output_architecture = bfd_arch_mips;
-#endif /* not TARGET_ */
-}
-
-/* This function is run after all the input files have been opened.
- We create a .rel.sdata section for each input file with a non zero
- .sdata section. The BFD backend will fill in these sections with
- magic numbers which can be used to relocate the data section at run
- time. This will only do the right thing if all the input files
- have been compiled using -membedded-pic. */
-
-static void
-gldmipsidt_after_open ()
-{
- bfd *abfd;
-
- if (! command_line.embedded_relocs
- || link_info.relocateable)
- return;
-
- for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next)
- {
- asection *datasec;
-
- datasec = bfd_get_section_by_name (abfd, ".sdata");
-
- /* Note that we assume that the reloc_count field has already
- been set up. We could call bfd_get_reloc_upper_bound, but
- that returns the size of a memory buffer rather than a reloc
- count. We do not want to call bfd_canonicalize_reloc,
- because although it would always work it would force us to
- read in the relocs into BFD canonical form, which would waste
- a significant amount of time and memory. */
- if (datasec != NULL && datasec->reloc_count > 0)
- {
- asection *relsec;
-
- relsec = bfd_make_section (abfd, ".rel.sdata");
- if (relsec == NULL
- || ! bfd_set_section_flags (abfd, relsec,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY))
- || ! bfd_set_section_alignment (abfd, relsec, 2)
- || ! bfd_set_section_size (abfd, relsec,
- datasec->reloc_count * 4))
- einfo ("%F%B: can not create .rel.sdata section: %E");
- }
-
- /* Double check that all other data sections are empty, as is
- required for embedded PIC code. */
- bfd_map_over_sections (abfd, check_sections, (PTR) datasec);
- }
-}
-
-/* Check that of the data sections, only the .sdata section has
- relocs. This is called via bfd_map_over_sections. */
-
-static void
-check_sections (abfd, sec, sdatasec)
- bfd *abfd;
- asection *sec;
- PTR sdatasec;
-{
- if ((bfd_get_section_flags (abfd, sec) & SEC_CODE) == 0
- && sec != (asection *) sdatasec
- && sec->reloc_count != 0)
- einfo ("%F%X: section %s has relocs; can not use --embedded-relocs",
- abfd, bfd_get_section_name (abfd, sec));
-}
-
-/* This function is called after the section sizes and offsets have
- been set. If we are generating embedded relocs, it calls a special
- BFD backend routine to do the work. */
-
-static void
-gldmipsidt_after_allocation ()
-{
- bfd *abfd;
-
- if (! command_line.embedded_relocs
- || link_info.relocateable)
- return;
-
- for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next)
- {
- asection *datasec, *relsec;
- char *errmsg;
-
- datasec = bfd_get_section_by_name (abfd, ".sdata");
-
- if (datasec == NULL || datasec->reloc_count == 0)
- continue;
-
- relsec = bfd_get_section_by_name (abfd, ".rel.sdata");
- ASSERT (relsec != NULL);
-
- if (! bfd_mips_ecoff_create_embedded_relocs (abfd, &link_info,
- datasec, relsec,
- &errmsg))
- {
- if (errmsg == NULL)
- einfo ("%B%X: can not create runtime reloc information: %E",
- abfd);
- else
- einfo ("%X%B: can not create runtime reloc information: %s",
- abfd, errmsg);
- }
- }
-}
-
-static char *
-gldmipsidt_get_script(isfile)
- int *isfile;
-{
- *isfile = 0;
-
- if (link_info.relocateable == true && config.build_constructors == true)
- return
-concat(
-"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\
- \"ecoff-littlemips\")\n\
- SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\
-ENTRY(start)\n\
-SECTIONS\n\
-{\n\
- .text : {\n\
- ;\n\
- *(.init)\n\
- ;\n\
- *(.text)\n\
- *(.rel.sdata)\n\
- *(.fini)\n\
- ;\n\
- ;\n\
- }\n\
- "," .rdata : {\n\
- *(.rdata)\n\
- }\n\
- .data : {\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- .lit8 : {\n\
- *(.lit8)\n\
- }\n\
- .lit4 : {\n\
- *(.lit4)\n\
- }\n\
- "," .sdata : {\n\
- *(.sdata)\n\
- }\n\
- .sbss : {\n\
- *(.sbss)\n\
- *(.scommon)\n\
- }\n\
- .bss : {\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
-}\n\n", NULL)
- ; else if (link_info.relocateable == true) return
-"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\
- \"ecoff-littlemips\")\n\
- SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\
-ENTRY(start)\n\
-SECTIONS\n\
-{\n\
- .text : {\n\
- ;\n\
- *(.init)\n\
- ;\n\
- *(.text)\n\
- *(.rel.sdata)\n\
- *(.fini)\n\
- ;\n\
- ;\n\
- }\n\
- .rdata : {\n\
- *(.rdata)\n\
- }\n\
- .data : {\n\
- *(.data)\n\
- }\n\
- .lit8 : {\n\
- *(.lit8)\n\
- }\n\
- .lit4 : {\n\
- *(.lit4)\n\
- }\n\
- .sdata : {\n\
- *(.sdata)\n\
- }\n\
- .sbss : {\n\
- *(.sbss)\n\
- *(.scommon)\n\
- }\n\
- .bss : {\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
-}\n\n"
- ; else if (!config.text_read_only) return
-concat(
-"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\
- \"ecoff-littlemips\")\n\
- SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\
-ENTRY(start)\n\
-SECTIONS\n\
-{\n\
- . = 0xa0012000;\n\
- .text : {\n\
- _ftext = . ;\n\
- *(.init)\n\
- eprol = .;\n\
- *(.text)\n\
- PROVIDE (__runtime_reloc_start = .);\n\
- *(.rel.sdata)\n\
- PROVIDE (__runtime_reloc_stop = .);\n\
- *(.fini)\n\
- etext = .;\n\
- _etext = .;\n\
-"," }\n\
- . = .;\n\
- .rdata : {\n\
- *(.rdata)\n\
- }\n\
- _fdata = ALIGN(16);\n\
- .data : {\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- _gp = ALIGN(16) + 0x8000;\n\
- .lit8 : {\n\
- *(.lit8)\n\
- }\n\
- .lit4 : {\n\
- *(.lit4)\n\
- }\n\
- .sdata : {\n\
- *(.sdata)\n\
- }\n\
-"," edata = .;\n\
- _edata = .;\n\
- _fbss = .;\n\
- .sbss : {\n\
- *(.sbss)\n\
- *(.scommon)\n\
- }\n\
- .bss : {\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- end = .;\n\
- _end = .;\n\
-}\n\n"
-, NULL)
- ; else if (!config.magic_demand_paged) return
-concat (
-"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\
- \"ecoff-littlemips\")\n\
- SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\
-ENTRY(start)\n\
-SECTIONS\n\
-{\n\
- . = 0xa0012000;\n\
- .text : {\n\
- _ftext = . ;\n\
- *(.init)\n\
- eprol = .;\n\
- *(.text)\n\
- PROVIDE (__runtime_reloc_start = .);\n\
- *(.rel.sdata)\n\
- PROVIDE (__runtime_reloc_stop = .);\n\
- *(.fini)\n\
- etext = .;\n\
- _etext = .;\n\
- "," }\n\
- . = .;\n\
- .rdata : {\n\
- *(.rdata)\n\
- }\n\
- _fdata = ALIGN(16);\n\
- .data : {\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- _gp = ALIGN(16) + 0x8000;\n\
- .lit8 : {\n\
- *(.lit8)\n\
- "," }\n\
- .lit4 : {\n\
- *(.lit4)\n\
- }\n\
- .sdata : {\n\
- *(.sdata)\n\
- }\n\
- edata = .;\n\
- _edata = .;\n\
- _fbss = .;\n\
- .sbss : {\n\
- *(.sbss)\n\
- *(.scommon)\n\
- "," }\n\
- .bss : {\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- end = .;\n\
- _end = .;\n\
-}\n\n"
-, NULL)
- ; else return
-concat (
-"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\
- \"ecoff-littlemips\")\n\
- SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\
-ENTRY(start)\n\
-SECTIONS\n\
-{\n\
- . = 0xa0012000;\n\
- .text : {\n\
- _ftext = . ;\n\
- *(.init)\n\
- eprol = .;\n\
- *(.text)\n\
- PROVIDE (__runtime_reloc_start = .);\n\
- *(.rel.sdata)\n\
- PROVIDE (__runtime_reloc_stop = .);\n\
- *(.fini)\n\
- etext = .;\n\
- _etext = .;\n\
- "," }\n\
- . = .;\n\
- .rdata : {\n\
- *(.rdata)\n\
- }\n\
- _fdata = ALIGN(16);\n\
- .data : {\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- _gp = ALIGN(16) + 0x8000;\n\
- .lit8 : {\n\
- *(.lit8)\n\
- }\n\
- .lit4 : {\n\
- *(.lit4)\n\
- "," }\n\
- .sdata : {\n\
- *(.sdata)\n\
- }\n\
- edata = .;\n\
- _edata = .;\n\
- _fbss = .;\n\
- .sbss : {\n\
- *(.sbss)\n\
- *(.scommon)\n\
- }\n\
- .bss : {\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- end = .;\n\
- _end = .;\n\
-}\n\n"
-, NULL)
-; }
-
-struct ld_emulation_xfer_struct ld_mipsidt_emulation =
-{
- gldmipsidt_before_parse,
- syslib_default,
- hll_default,
- after_parse_default,
- gldmipsidt_after_open,
- gldmipsidt_after_allocation,
- set_output_arch_default,
- ldemul_default_target,
- before_allocation_default,
- gldmipsidt_get_script,
- "mipsidt",
- "ecoff-bigmips"
-};
diff --git a/gnu/usr.bin/binutils/ld/mpw-make.sed b/gnu/usr.bin/binutils/ld/mpw-make.sed
index 0d00fde5230..c91970839a9 100644
--- a/gnu/usr.bin/binutils/ld/mpw-make.sed
+++ b/gnu/usr.bin/binutils/ld/mpw-make.sed
@@ -80,13 +80,7 @@
install \\Option-f all install-only\
\
install-only \\Option-f\
- If "`Exists "{prefix}"`" == ""\
- Echo "{prefix}" does not exist, cannot install anything\
- Exit 1\
- End If\
- If "`Exists "{bindir}"`" == ""\
- NewFolder "{bindir}"\
- End If\
+ NewFolderRecursive "{bindir}"\
Duplicate -y :ld.new "{bindir}"ld\
diff --git a/gnu/usr.bin/binutils/ld/scripttempl/armcoff.sc b/gnu/usr.bin/binutils/ld/scripttempl/armcoff.sc
index cca8f03c62f..9f9cd7c1d03 100644
--- a/gnu/usr.bin/binutils/ld/scripttempl/armcoff.sc
+++ b/gnu/usr.bin/binutils/ld/scripttempl/armcoff.sc
@@ -31,7 +31,7 @@ SECTIONS
*(.fini)
${RELOCATING+ etext = .;}
}
- .data ${RELOCATING+${DATA_ADDR-0x40000 + (. & 0xffc00fff)}} : {
+ .data ${RELOCATING+${DATA_ADDR-0x40000 + (. & 0xfffc0fff)}} : {
${RELOCATING+ __data_start__ = . ;}
*(.data)
${RELOCATING+ __data_end__ = . ;}
diff --git a/gnu/usr.bin/binutils/ld/scripttempl/elfmips.sc b/gnu/usr.bin/binutils/ld/scripttempl/elfmips.sc
deleted file mode 100644
index 46008c45370..00000000000
--- a/gnu/usr.bin/binutils/ld/scripttempl/elfmips.sc
+++ /dev/null
@@ -1,179 +0,0 @@
-#
-# Unusual variables checked by this code:
-# NOP - two byte opcode for no-op (defaults to 0)
-# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
-# OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
-# (e.g., .PARISC.milli)
-# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
-# (e.g., .PARISC.global)
-# OTHER_SECTIONS - at the end
-# EXECUTABLE_SYMBOLS - symbols that must be defined for an
-# executable (e.g., _DYNAMIC_LINK)
-# TEXT_START_SYMBOLS - symbols that appear at the start of the
-# .text section.
-# DATA_START_SYMBOLS - symbols that appear at the start of the
-# .data section.
-# OTHER_BSS_SYMBOLS - symbols that appear at the start of the
-# .bss section besides __bss_start.
-# EMBEDDED - whether this is for an embedded system.
-#
-# When adding sections, do note that the names of some sections are used
-# when specifying the start address of the next.
-#
-
-# We use a start address of __start for Irix 5, _start for other
-# targets. This is for compatibility with Irix 5, and with old MIPS
-# ELF toolchains.
-if [ -z "$ENTRY" ]; then
- case "${target}" in
- mips*-*-irix5*) ENTRY=__start ;;
- *) ENTRY=_start ;;
- esac
-fi
-
-# if this is for an embedded system, don't add SIZEOF_HEADERS.
-if [ -z "$EMBEDDED" ]; then
- test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
-else
- test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
-fi
-
-test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
-test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
-test "$LD_FLAG" = "N" && DATA_ADDR=.
-INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
-cat <<EOF
-OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
- "${LITTLE_OUTPUT_FORMAT}")
-OUTPUT_ARCH(${ARCH})
-ENTRY(${ENTRY})
-
-${RELOCATING+${LIB_SEARCH_DIRS}}
-${RELOCATING+/* Do we need any of these for elf?
- __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
-${RELOCATING+${EXECUTABLE_SYMBOLS}}
-${RELOCATING- /* For some reason, the Solaris linker makes bad executables
- if gld -r is used and the intermediate file has sections starting
- at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
- bug. But for now assigning the zero vmas works. */}
-SECTIONS
-{
- /* Read-only sections, merged into text segment: */
- ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_BASE_ADDRESS};}}
- ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR} + SIZEOF_HEADERS;}}
- ${CREATE_SHLIB-${INTERP}}
- .reginfo ${RELOCATING-0} : { *(.reginfo) }
- .dynamic ${RELOCATING-0} : { *(.dynamic) }
- .dynstr ${RELOCATING-0} : { *(.dynstr) }
- .dynsym ${RELOCATING-0} : { *(.dynsym) }
- .hash ${RELOCATING-0} : { *(.hash) }
- .rel.text ${RELOCATING-0} : { *(.rel.text) }
- .rela.text ${RELOCATING-0} : { *(.rela.text) }
- .rel.data ${RELOCATING-0} : { *(.rel.data) }
- .rela.data ${RELOCATING-0} : { *(.rela.data) }
- .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) }
- .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) }
- .rel.got ${RELOCATING-0} : { *(.rel.got) }
- .rela.got ${RELOCATING-0} : { *(.rela.got) }
- .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
- .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
- .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
- .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
- .rel.init ${RELOCATING-0} : { *(.rel.init) }
- .rela.init ${RELOCATING-0} : { *(.rela.init) }
- .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
- .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
- .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
- .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
- .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
- .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
- .rodata ${RELOCATING-0} : { *(.rodata) }
- .rodata1 ${RELOCATING-0} : { *(.rodata1) }
- .init ${RELOCATING-0} : { *(.init) } =${NOP-0}
- .text ${RELOCATING-0} :
- {
- ${RELOCATING+${TEXT_START_SYMBOLS}}
- *(.text)
- *(.stub)
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- } =${NOP-0}
- ${RELOCATING+_etext = .;}
- ${RELOCATING+PROVIDE (etext = .);}
- .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0}
-
- /* Adjust the address for the data segment. We want to adjust up to
- the same address within the page on the next page up. It would
- be more correct to do this:
- ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE})
- + ((ALIGN(8) + ${MAXPAGESIZE} - ALIGN(${MAXPAGESIZE}))
- & (${MAXPAGESIZE} - 1)};}
- The current expression does not correctly handle the case of a
- text segment ending precisely at the end of a page; it causes the
- data segment to skip a page. The above expression does not have
- this problem, but it will currently (2/95) cause BFD to allocate
- a single segment, combining both text and data, for this case.
- This will prevent the text segment from being shared among
- multiple executions of the program; I think that is more
- important than losing a page of the virtual address space (note
- that no actual memory is lost; the page which is skipped can not
- be referenced). */
- ${CREATE_SHLIB-${RELOCATING+. += ${DATA_ADDR} - ${TEXT_START_ADDR};}}
- ${RELOCATING+. += 0x10000;}
- .data ${RELOCATING-0} :
- {
- ${RELOCATING+${DATA_START_SYMBOLS}}
- *(.data)
- ${CONSTRUCTING+CONSTRUCTORS}
- }
- .data1 ${RELOCATING-0} : { *(.data1) }
- .ctors ${RELOCATING-0} : { *(.ctors) }
- .dtors ${RELOCATING-0} : { *(.dtors) }
- ${RELOCATING+${OTHER_GOT_SYMBOLS}}
- .got ${RELOCATING-0} :
- {
- *(.got.plt) *(.got)
- }
- /* We want the small data sections together, so single-instruction offsets
- can access them all, and initialized data all before uninitialized, so
- we can shorten the on-disk segment size. */
- .sdata ${RELOCATING-0} : { *(.sdata) }
- ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
- ${RELOCATING+_edata = .;}
- ${RELOCATING+PROVIDE (edata = .);}
- ${RELOCATING+__bss_start = .;}
- ${RELOCATING+${OTHER_BSS_SYMBOLS}}
- .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) }
- .bss ${RELOCATING-0} :
- {
- *(.dynbss)
- *(.bss)
- *(COMMON)
- }
- ${RELOCATING+_end = . ;}
- ${RELOCATING+PROVIDE (end = .);}
-
- /* These are needed for ELF backends which have not yet been
- converted to the new style linker. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
-
- /* DWARF debug sections.
- Symbols in the .debug DWARF section are relative to the beginning of the
- section so we begin .debug at 0. It's not clear yet what needs to happen
- for the others. */
- .debug 0 : { *(.debug) }
- .debug_info 0 : { *(.debug_info) }
- .debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line) }
- .debug_frame 0 : { *(.debug_frame) }
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- .line 0 : { *(.line) }
-
- /* These must appear regardless of ${RELOCATING}. */
- ${OTHER_SECTIONS}
-}
-EOF
diff --git a/gnu/usr.bin/binutils/ld/scripttempl/go32coff.sc b/gnu/usr.bin/binutils/ld/scripttempl/go32coff.sc
deleted file mode 100644
index 40f6076345a..00000000000
--- a/gnu/usr.bin/binutils/ld/scripttempl/go32coff.sc
+++ /dev/null
@@ -1,33 +0,0 @@
-# Linker script for 386 go32
-# DJ Delorie (dj@ctron.com)
-
-test -z "$ENTRY" && ENTRY=start
-cat <<EOF
-OUTPUT_FORMAT("${OUTPUT_FORMAT}")
-${LIB_SEARCH_DIRS}
-
-ENTRY(${ENTRY})
-
-SECTIONS
-{
- .text ${RELOCATING+ 0x1000+SIZEOF_HEADERS} : {
- *(.text)
- ${RELOCATING+ etext = . ; _etext = .};
- ${RELOCATING+ . = ALIGN(0x200);}
- }
- .data ${RELOCATING+ ${DATA_ALIGNMENT}} : {
- ${RELOCATING+ *(.ctor)}
- ${RELOCATING+ *(.dtor)}
- *(.data)
- ${RELOCATING+ edata = . ; _edata = .};
- ${RELOCATING+ . = ALIGN(0x200);}
- }
- .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
- {
- *(.bss)
- *(COMMON)
- ${RELOCATING+ end = . ; _end = .};
- ${RELOCATING+ . = ALIGN(0x200);}
- }
-}
-EOF
diff --git a/gnu/usr.bin/binutils/ld/scripttempl/m88kbcs.sc b/gnu/usr.bin/binutils/ld/scripttempl/m88kbcs.sc
index 8e6027660b5..f52b14dc0ce 100644
--- a/gnu/usr.bin/binutils/ld/scripttempl/m88kbcs.sc
+++ b/gnu/usr.bin/binutils/ld/scripttempl/m88kbcs.sc
@@ -21,11 +21,11 @@ SECTIONS
${RELOCATING+ *(.tdesc)}
${RELOCATING+ __.text_end = .} ;
${RELOCATING+ __.initp.start = .};
- ${RELOCATING+ __.initp.end =.};
+ ${RELOCATING+ __.initp.end = .};
${RELOCATING+ __.fini_start = .};
${RELOCATING+ *(.fini) }
${RELOCATING+ __.fini_end = .};
- ${RELOCATING+_etext =.};
+ ${RELOCATING+_etext = .};
}
.data ${RELOCATING+ NEXT (0x400000) + ((SIZEOF(.text) + ADDR(.text)) % 0x2000)} :
{
diff --git a/gnu/usr.bin/binutils/ld/scripttempl/ppcpe.sc b/gnu/usr.bin/binutils/ld/scripttempl/ppcpe.sc
index 12bd9d8cc51..40fbe33bb79 100644
--- a/gnu/usr.bin/binutils/ld/scripttempl/ppcpe.sc
+++ b/gnu/usr.bin/binutils/ld/scripttempl/ppcpe.sc
@@ -32,6 +32,7 @@ SECTIONS
{
${RELOCATING+ *(.init);}
*(.text)
+ *(.gcc_except_table)
${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
LONG (-1); *(.ctors); *(.ctor); LONG (0); }
${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
diff --git a/gnu/usr.bin/binutils/ld/testsuite/ld-cdtest/cdtest.exp b/gnu/usr.bin/binutils/ld/testsuite/ld-cdtest/cdtest.exp
index 828975dc6a3..ccbe35e3709 100644
--- a/gnu/usr.bin/binutils/ld/testsuite/ld-cdtest/cdtest.exp
+++ b/gnu/usr.bin/binutils/ld/testsuite/ld-cdtest/cdtest.exp
@@ -1,5 +1,5 @@
# Expect script for LD cdtest Tests
-# Copyright (C) 1993,1994,1995 Free Software Foundation
+# Copyright (C) 1993,1994,1995, 1997 Free Software Foundation
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,9 +35,9 @@ if { [which $CXX] == 0 } {
return
}
-if { ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
- || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
- || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
+if { ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
+ || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
+ || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
unresolved $test1
unresolved $test2
return
@@ -54,10 +54,10 @@ if ![ld_link $ld tmpdir/cdtest {tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/c
verbose "$exec_output" 1
fail $test1
} else {
- send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n"
- verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat"
- catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output
- set exec_output [prune_system_crud $host_triplet $exec_output]
+ send_log "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat\n"
+ verbose "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat"
+ catch "exec diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat" exec_output
+ set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
pass $test1
@@ -83,10 +83,10 @@ if ![ld_relocate $ld tmpdir/cdtest.o {-Ur tmpdir/cdtest-foo.o tmpdir/cdtest-bar.
verbose "$exec_output" 1
fail $test2
} else {
- send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n"
- verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat"
- catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output
- set exec_output [prune_system_crud $host_triplet $exec_output]
+ send_log "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat\n"
+ verbose "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat"
+ catch "exec diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat" exec_output
+ set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
pass $test2
diff --git a/gnu/usr.bin/binutils/ld/testsuite/ld-empic/empic.exp b/gnu/usr.bin/binutils/ld/testsuite/ld-empic/empic.exp
index 97cb72ff59b..2d528bef1f6 100644
--- a/gnu/usr.bin/binutils/ld/testsuite/ld-empic/empic.exp
+++ b/gnu/usr.bin/binutils/ld/testsuite/ld-empic/empic.exp
@@ -1,5 +1,5 @@
# Expect script for ld-empic tests
-# Copyright (C) 1994,1995 Free Software Foundation
+# Copyright (C) 1994,1995, 1996, 1997 Free Software Foundation
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,15 +38,15 @@ if { [which $CC] == 0 } {
# (by experimentation) to force the linker to relax twice--that is,
# the first relaxation pass will force another call to be out of
# range, requiring a second relaxation pass.
-if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax1.c tmpdir/relax1.o]
- || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax2.c tmpdir/relax2.o]
- || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax3.c tmpdir/relax3.o]
- || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax4.c tmpdir/relax4.o] } {
+if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax1.c tmpdir/relax1.o]
+ || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax2.c tmpdir/relax2.o]
+ || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax3.c tmpdir/relax3.o]
+ || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax4.c tmpdir/relax4.o] } {
unresolved $testname
return
}
-if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir$subdir/relax.t tmpdir/relax1.o tmpdir/relax2.o tmpdir/relax3.o tmpdir/relax4.o"] {
+if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir/$subdir/relax.t tmpdir/relax1.o tmpdir/relax2.o tmpdir/relax3.o tmpdir/relax4.o"] {
fail $testname
} else {
# Check that the relaxation produced the correct result. Check
@@ -227,9 +227,9 @@ set testname "run embedded PIC code"
# Compile the program which will run the test. This code must be
# compiled for the host, not the target.
-send_log "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir$subdir/run.c\n"
-verbose "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir$subdir/run.c"
-catch "exec $CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir$subdir/run.c" exec_output
+send_log "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c\n"
+verbose "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c"
+catch "exec $CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c" exec_output
if ![string match "" $exec_output] {
send_log "$exec_output\n"
verbose "$exec_output"
@@ -238,9 +238,9 @@ if ![string match "" $exec_output] {
}
# Compile and link the test.
-if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/runtesti.s tmpdir/runtesti.o]
- || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/runtest1.c tmpdir/runtest1.o]
- || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/runtest2.c tmpdir/runtest2.o] } {
+if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtesti.s tmpdir/runtesti.o]
+ || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtest1.c tmpdir/runtest1.o]
+ || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtest2.c tmpdir/runtest2.o] } {
unresolved $testname
return
}
diff --git a/gnu/usr.bin/binutils/ld/testsuite/ld-scripts/defined.exp b/gnu/usr.bin/binutils/ld/testsuite/ld-scripts/defined.exp
index 5e98f39a39f..6da26bc3bc2 100644
--- a/gnu/usr.bin/binutils/ld/testsuite/ld-scripts/defined.exp
+++ b/gnu/usr.bin/binutils/ld/testsuite/ld-scripts/defined.exp
@@ -4,12 +4,12 @@
set testname "DEFINED"
set prms_id 5699
-if ![ld_assemble $as $srcdir$subdir/defined.s tmpdir/def.o] {
+if ![ld_assemble $as $srcdir/$subdir/defined.s tmpdir/def.o] {
unresolved $testname
return
}
-if ![ld_simple_link $ld tmpdir/def "-T $srcdir$subdir/defined.t tmpdir/def.o"] {
+if ![ld_simple_link $ld tmpdir/def "-T $srcdir/$subdir/defined.t tmpdir/def.o"] {
fail $testname
} else {
if ![ld_nm $nm tmpdir/def] {
diff --git a/gnu/usr.bin/binutils/ld/testsuite/ld-scripts/sizeof.exp b/gnu/usr.bin/binutils/ld/testsuite/ld-scripts/sizeof.exp
index dc5a4ed35a6..3bdefd4f0dc 100644
--- a/gnu/usr.bin/binutils/ld/testsuite/ld-scripts/sizeof.exp
+++ b/gnu/usr.bin/binutils/ld/testsuite/ld-scripts/sizeof.exp
@@ -4,12 +4,12 @@
set testname "SIZEOF"
-if ![ld_assemble $as $srcdir$subdir/sizeof.s tmpdir/sizeof.o] {
+if ![ld_assemble $as $srcdir/$subdir/sizeof.s tmpdir/sizeof.o] {
unresolved $testname
return
}
-if ![ld_simple_link $ld tmpdir/sizeof "-T $srcdir$subdir/sizeof.t tmpdir/sizeof.o"] {
+if ![ld_simple_link $ld tmpdir/sizeof "-T $srcdir/$subdir/sizeof.t tmpdir/sizeof.o"] {
fail $testname
return
}
diff --git a/gnu/usr.bin/binutils/ld/testsuite/ld-sh/sh.exp b/gnu/usr.bin/binutils/ld/testsuite/ld-sh/sh.exp
index 3bbbaf64780..c646d269a89 100644
--- a/gnu/usr.bin/binutils/ld/testsuite/ld-sh/sh.exp
+++ b/gnu/usr.bin/binutils/ld/testsuite/ld-sh/sh.exp
@@ -1,5 +1,5 @@
# Expect script for ld-sh tests
-# Copyright (C) 1995, 1996 Free Software Foundation
+# Copyright (C) 1995, 1996, 1997 Free Software Foundation
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if ![istarget sh*-*-*] {
set testsimple "SH simple relaxing"
-if ![ld_assemble $as "-relax $srcdir$subdir/sh1.s" tmpdir/sh1.o] {
+if ![ld_assemble $as "-relax $srcdir/$subdir/sh1.s" tmpdir/sh1.o] {
unresolved $testsimple
} else { if ![ld_simple_link $ld tmpdir/sh1 "-relax tmpdir/sh1.o"] {
fail $testsimple
@@ -81,7 +81,7 @@ if ![ld_simple_link $ld tmpdir/sh1.s1 "-relax -oformat srec tmpdir/sh1.o"] {
send_log "cmp tmpdir/sh1.s1 tmpdir/sh1.s2\n"
verbose "cmp tmpdir/sh1.s1 tmpdir/sh1.s2"
catch "exec cmp tmpdir/sh1.s1 tmpdir/sh1.s2" exec_output
- set exec_output [prune_system_crud $host_triplet $exec_output]
+ set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] {
send_log "$exec_output\n"
verbose "$exec_output"
@@ -104,8 +104,8 @@ if { [which $CC] == 0 } {
return
}
-if {![ld_assemble $as "-relax $srcdir$subdir/start.s" tmpdir/start.o] \
- || ![ld_compile $CC "-O -mrelax $srcdir$subdir/sh2.c" tmpdir/sh2.o]} {
+if {![ld_assemble $as "-relax $srcdir/$subdir/start.s" tmpdir/start.o] \
+ || ![ld_compile $CC "-O -mrelax $srcdir/$subdir/sh2.c" tmpdir/sh2.o]} {
unresolved $testlink
unresolved $testjsr
unresolved $testrun
diff --git a/gnu/usr.bin/binutils/ld/testsuite/ld-srec/srec.exp b/gnu/usr.bin/binutils/ld/testsuite/ld-srec/srec.exp
index 0b09ddb5437..ca38a00484c 100644
--- a/gnu/usr.bin/binutils/ld/testsuite/ld-srec/srec.exp
+++ b/gnu/usr.bin/binutils/ld/testsuite/ld-srec/srec.exp
@@ -267,7 +267,7 @@ proc run_srec_test { test objs } {
send_log "$objcopy -O srec tmpdir/sr1 tmpdir/sr1.sr\n"
verbose "$objcopy -O srec tmpdir/sr1 tmpdir/sr1.sr"
catch "exec $objcopy -O srec tmpdir/sr1 tmpdir/sr1.sr" exec_output
- set exec_output [prune_system_crud $host_triplet $exec_output]
+ set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] {
send_log "$exec_output\n"
verbose "$exec_output"
@@ -315,10 +315,10 @@ if { ![ld_compile $CC $srcdir/$subdir/sr1.c tmpdir/sr1.o] \
# sections where objdump finds them. I don't know which is wrong.
setup_xfail "i*86-*-aout*"
-# These tests fail on the MIPS ELF target because the GP value in the
-# .reginfo section is not updated when the S-record version is written
-# out.
-setup_xfail "mips*-*-elf*" "mips*-*-irix5*" "mips*-*-irix6*"
+# These tests fail on the native MIPS ELF targets because the GP value
+# in the .reginfo section is not updated when the S-record version is
+# written out. The mips-elf target itself does not use a .reginfo section.
+setup_xfail "mips*-*-irix5*" "mips*-*-irix6*"
# The S-record linker doesn't do the magic TOC handling that XCOFF
# linkers do.
@@ -367,7 +367,7 @@ if ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/sr3.cc tmpdir/sr3.
# See above.
setup_xfail "i*86-*-aout*"
-setup_xfail "mips*-*-elf*" "mips*-*-irix5*" "mips*-*-irix6*"
+setup_xfail "mips*-*-irix5*" "mips*-*-irix6*"
setup_xfail "*-*-aix*" "*-*-xcoff*"
setup_xfail "arm*-*-*"
setup_xfail "strongarm*-*-*"
diff --git a/gnu/usr.bin/binutils/ld/testsuite/ld-versados/versados.exp b/gnu/usr.bin/binutils/ld/testsuite/ld-versados/versados.exp
index fde5e183c0f..2d2c0663bed 100644
--- a/gnu/usr.bin/binutils/ld/testsuite/ld-versados/versados.exp
+++ b/gnu/usr.bin/binutils/ld/testsuite/ld-versados/versados.exp
@@ -1,5 +1,5 @@
# Expect script for ld-versados tests
-# Copyright (C) 1995 Free Software Foundation
+# Copyright (C) 1995, 1996, 1997 Free Software Foundation
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -50,8 +50,8 @@ proc inspect { whichone } {
return 0
}
- send_log "$objdump -s $srcdir$subdir/$whichone.ook >tmpdir/$whichone.dok\n"
- catch "exec $objdump -s $srcdir$subdir/$whichone.ook | grep -v srec >tmpdir/$whichone.dok" exec_output
+ send_log "$objdump -s $srcdir/$subdir/$whichone.ook >tmpdir/$whichone.dok\n"
+ catch "exec $objdump -s $srcdir/$subdir/$whichone.ook | grep -v srec >tmpdir/$whichone.dok" exec_output
if ![string match "" $exec_output] {
send_log "$exec_output\n"
@@ -73,7 +73,7 @@ proc inspect { whichone } {
}
if ![ld_simple_link $ld tmpdir/t1.out \
- " -T $srcdir$subdir/t1.ld $srcdir$subdir/t1-1.ro $srcdir$subdir/t1-2.ro"] {
+ " -T $srcdir/$subdir/t1.ld $srcdir/$subdir/t1-1.ro $srcdir/$subdir/t1-2.ro"] {
fail $testname
return
} else {
@@ -85,8 +85,8 @@ if ![ld_simple_link $ld tmpdir/t1.out \
if ![ld_simple_link $ld tmpdir/t2.out \
- " -T $srcdir$subdir/t2.ld $srcdir$subdir/t2-2.ro \
- $srcdir$subdir/t2-1.ro $srcdir$subdir/t2-3.ro"] {
+ " -T $srcdir/$subdir/t2.ld $srcdir/$subdir/t2-2.ro \
+ $srcdir/$subdir/t2-1.ro $srcdir/$subdir/t2-3.ro"] {
fail $testname
return
} else {
diff --git a/gnu/usr.bin/binutils/ld/testsuite/lib/ld.exp b/gnu/usr.bin/binutils/ld/testsuite/lib/ld.exp
deleted file mode 100644
index 849a6d84afe..00000000000
--- a/gnu/usr.bin/binutils/ld/testsuite/lib/ld.exp
+++ /dev/null
@@ -1,319 +0,0 @@
-#
-# default_ld_version
-# extract and print the version number of ld
-#
-proc default_ld_version { ld } {
- global host_triplet
-
- if { [which $ld] == 0 } then {
- perror "$ld does not exist"
- exit 1
- }
-
- catch "exec $ld --version" tmp
- set tmp [prune_system_crud $host_triplet $tmp]
- regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" $tmp version cyg number
- if [info exists number] then {
- clone_output "$ld $number\n"
- }
-}
-
-#
-# default_ld_relocate
-# link an object using relocation
-#
-proc default_ld_relocate { ld target objects } {
- global HOSTING_EMU
- global host_triplet
-
- if { [which $ld] == 0 } then {
- perror "$ld does not exist"
- return 0
- }
-
- verbose -log "$ld $HOSTING_EMU -o $target -r $objects"
-
- catch "exec $ld $HOSTING_EMU -o $target -r $objects" exec_output
- set exec_output [prune_system_crud $host_triplet $exec_output]
- if [string match "" $exec_output] then {
- return 1
- } else {
- verbose -log "$exec_output"
- return 0
- }
-}
-
-
-#
-# default_ld_link
-# link a program using ld
-#
-proc default_ld_link { ld target objects } {
- global HOSTING_EMU
- global HOSTING_CRT0
- global HOSTING_LIBS
- global host_triplet
-
- set objs "$HOSTING_CRT0 $objects"
- set libs "$HOSTING_LIBS"
-
- if { [which $ld] == 0 } then {
- perror "$ld does not exist"
- return 0
- }
-
- verbose -log "$ld $HOSTING_EMU -o $target $objs $libs"
-
- catch "exec $ld $HOSTING_EMU -o $target $objs $libs" exec_output
- set exec_output [prune_system_crud $host_triplet $exec_output]
- if [string match "" $exec_output] then {
- return 1
- } else {
- verbose -log "$exec_output"
- return 0
- }
-}
-
-#
-# default_ld_simple_link
-# link a program using ld, without including any libraries
-#
-proc default_ld_simple_link { ld target objects } {
- global host_triplet
-
- if { [which $ld] == 0 } then {
- perror "$ld does not exist"
- return 0
- }
-
- verbose -log "$ld -o $target $objects"
-
- catch "exec $ld -o $target $objects" exec_output
- set exec_output [prune_system_crud $host_triplet $exec_output]
-
- # We don't care if we get a warning about a non-existent start
- # symbol, since the default linker script might use ENTRY.
- regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
-
- if [string match "" $exec_output] then {
- return 1
- } else {
- verbose -log "$exec_output"
- return 0
- }
-}
-
-#
-# default_ld_compile
-# compile an object using cc
-#
-proc default_ld_compile { cc source object } {
- global CFLAGS
- global srcdir
- global subdir
- global host_triplet
-
- set cc_prog $cc
- if {[llength $cc_prog] > 1} then {
- set cc_prog [lindex $cc_prog 0]
- }
- if {[which $cc_prog] == 0} then {
- perror "$cc_prog does not exist"
- return 0
- }
-
- catch "exec rm -f $object" exec_output
-
- verbose -log "$cc -I$srcdir$subdir -c $CFLAGS $source -o $object"
-
- catch "exec $cc -I$srcdir$subdir -c $CFLAGS $source -o $object" exec_output
- set exec_output [prune_system_crud $host_triplet $exec_output]
- if [string match "" $exec_output] then {
- if {![file exists $object]} then {
- regexp ".*/(\[^/\]*)$" $source all dobj
- regsub "\\.c" $dobj ".o" realobj
- verbose "looking for $realobj"
- if {[file exists $realobj]} then {
- verbose -log "mv $realobj $object"
- catch "exec mv $realobj $object" exec_output
- set exec_output [prune_system_crud $host_triplet $exec_output]
- if {![string match "" $exec_output]} then {
- verbose -log "$exec_output"
- perror "could not move $realobj to $object"
- return 0
- }
- } else {
- perror "$object not found after compilation"
- return 0
- }
- }
- return 1
- } else {
- verbose -log "$exec_output"
- perror "$source: compilation failed"
- return 0
- }
-}
-
-#
-# default_ld_assemble
-# assemble a file
-#
-proc default_ld_assemble { as source object } {
- global ASFLAGS
- global host_triplet
-
- if {[which $as] == 0} then {
- perror "$as does not exist"
- return 0
- }
-
- if ![info exists ASFLAGS] { set ASFLAGS "" }
-
- verbose -log "$as $ASFLAGS -o $object $source"
-
- catch "exec $as $ASFLAGS -o $object $source" exec_output
- set exec_output [prune_system_crud $host_triplet $exec_output]
- if [string match "" $exec_output] then {
- return 1
- } else {
- verbose -log "$exec_output"
- perror "$source: assembly failed"
- return 0
- }
-}
-
-#
-# default_ld_nm
-# run nm on a file, putting the result in the array nm_output
-#
-proc default_ld_nm { nm object } {
- global NMFLAGS
- global nm_output
- global host_triplet
-
- if {[which $nm] == 0} then {
- perror "$nm does not exist"
- return 0
- }
-
- if ![info exists NMFLAGS] { set NMFLAGS "" }
-
- verbose -log "$nm $NMFLAGS $object >tmpdir/nm.out"
-
- catch "exec $nm $NMFLAGS $object >tmpdir/nm.out" exec_output
- set exec_output [prune_system_crud $host_triplet $exec_output]
- if [string match "" $exec_output] then {
- set file [open tmpdir/nm.out r]
- while { [gets $file line] != -1 } {
- verbose "$line" 2
- if [regexp "^(\[0-9a-fA-F\]+) \[a-zA-Z0-9\] (.+)$" $line whole value name] {
- verbose "Setting nm_output($name) to 0x$value" 2
- set nm_output($name) 0x$value
- }
- }
- close $file
- return 1
- } else {
- verbose -log "$exec_output"
- perror "$object: nm failed"
- return 0
- }
-}
-
-#
-# simple_diff
-# compares two files line-by-line
-# returns differences if exist
-# returns null if file(s) cannot be opened
-#
-proc simple_diff { file_1 file_2 } {
- global target
-
- set eof -1
- set differences 0
-
- if [file exists $file_1] then {
- set file_a [open $file_1 r]
- } else {
- warning "$file_1 doesn't exist"
- return
- }
-
- if [file exists $file_2] then {
- set file_b [open $file_2 r]
- } else {
- fail "$file_2 doesn't exist"
- return
- }
-
- verbose "# Diff'ing: $file_1 $file_2\n" 2
-
- while { [gets $file_a line] != $eof } {
- if [regexp "^#.*$" $line] then {
- continue
- } else {
- lappend list_a $line
- }
- }
- close $file_a
-
- while { [gets $file_b line] != $eof } {
- if [regexp "^#.*$" $line] then {
- continue
- } else {
- lappend list_b $line
- }
- }
- close $file_b
-
- for { set i 0 } { $i < [llength $list_a] } { incr i } {
- set line_a [lindex $list_a $i]
- set line_b [lindex $list_b $i]
-
- verbose "\t$file_1: $i: $line_a\n" 3
- verbose "\t$file_2: $i: $line_b\n" 3
- if [string compare $line_a $line_b] then {
- verbose -log "\t$file_1: $i: $line_a\n"
- verbose -log "\t$file_2: $i: $line_b\n"
-
- fail "Test: $target"
- return
- }
- }
-
- if { [llength $list_a] != [llength $list_b] } {
- fail "Test: $target"
- return
- }
-
- if $differences<1 then {
- pass "Test: $target"
- }
-}
-
-# This definition is taken from an unreleased version of DejaGnu. Once
-# that version gets released, and has been out in the world for a few
-# months at least, it may be safe to delete this copy.
-if ![string length [info proc prune_system_crud]] {
- #
- # prune_system_crud -- delete various system verbosities from TEXT on SYSTEM
- #
- # An example is:
- # ld.so: warning: /usr/lib/libc.so.1.8.1 has older revision than expected 9
- #
- # SYSTEM is typical $target_triplet or $host_triplet.
- #
- # This is useful when trying to do pattern matches on program output.
- # Sites with particular verbose os's may wish to override this in site.exp.
- #
- proc prune_system_crud { system text } {
- # This is from sun4's. Do it for all machines for now.
- # The "\\1" is to try to preserve a "\n" but only if necessary.
- regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text "\\1" text
-
- # It might be tempting to get carried away and delete blank lines, etc.
- # Just delete *exactly* what we're ask to, and that's it.
- return $text
- }
-}