summaryrefslogtreecommitdiffstats
path: root/contrib/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/binutils')
-rw-r--r--contrib/binutils/FREEBSD-Xlist83
-rw-r--r--contrib/binutils/FREEBSD-upgrade20
-rw-r--r--contrib/binutils/bfd/elf.c5
-rw-r--r--contrib/binutils/bfd/elf32-i386.c9
-rw-r--r--contrib/binutils/bfd/elflink.h4
-rw-r--r--contrib/binutils/bfd/freebsd.h81
-rw-r--r--contrib/binutils/binutils/nm.c2
-rw-r--r--contrib/binutils/binutils/objcopy.12
-rw-r--r--contrib/binutils/binutils/objdump.14
-rw-r--r--contrib/binutils/binutils/strings.c4
-rw-r--r--contrib/binutils/binutils/strip.12
-rw-r--r--contrib/binutils/gas/config/tc-i386.c4
-rw-r--r--contrib/binutils/gas/config/tc-i386.h3
-rwxr-xr-xcontrib/binutils/gas/configure5
-rw-r--r--contrib/binutils/gas/configure.in4
-rw-r--r--contrib/binutils/gas/doc/as.12
-rw-r--r--contrib/binutils/ld/Makefile.in4
-rw-r--r--contrib/binutils/ld/configure.tgt3
-rw-r--r--contrib/binutils/ld/emulparams/i386freebsd.sh6
-rw-r--r--contrib/binutils/ld/emultempl/elf32.em77
20 files changed, 278 insertions, 46 deletions
diff --git a/contrib/binutils/FREEBSD-Xlist b/contrib/binutils/FREEBSD-Xlist
new file mode 100644
index 0000000..548cc42
--- /dev/null
+++ b/contrib/binutils/FREEBSD-Xlist
@@ -0,0 +1,83 @@
+*-hp*
+*-mac*
+*-ncr*
+*.bat
+*.com
+*.info*
+*/arlex.c
+*/arparse.[ch]
+*/deflex.c
+*/gprof
+*/itbl-lex.c
+*/itbl-parse.[ch]
+*/ldgram.[ch]
+*/ldlex.c
+*/sysinfo.[ch]
+*/syslex.c
+*/testsuite
+*/texinfo/*
+*10[23]00*
+*532*
+*COPYING*
+*ChangeLog.*
+*[a-z]29k*
+*[a-z][89]60*
+*a68*
+*adobe*
+*aix*
+*apollo*
+*arm*
+*bout*
+*cisco*
+*d10v*
+*decstation*
+*delt88*
+*delta*
+*dgux*
+*dos*
+*dpx2*
+*dynix*
+*go32*
+*h8[35]00*
+*hp300*
+*hp[-.]*
+*hppa*
+*hpux*
+*irix*
+*lynx*
+*m32r*
+*m[68]8k*
+*mac-*
+*mach*
+*mip*
+*mpw*
+*netware*
+*news*
+*nlm*
+*ns32*
+*oasys*
+*os9*
+*pei*
+*pmac*
+*powerpc*
+*ppc*
+*psos*
+*pyr*
+*riscix*
+*riscos*
+*rs6000*
+*sa29200*
+*som*
+*sparc*
+*st2000*
+*sun*
+*symmetry*
+*tahoe*
+*u68k*
+*vax*
+*vms*
+*vxworks*
+*w65*
+*we32k*
+*win*
+*xcoff*
diff --git a/contrib/binutils/FREEBSD-upgrade b/contrib/binutils/FREEBSD-upgrade
new file mode 100644
index 0000000..6bd545e
--- /dev/null
+++ b/contrib/binutils/FREEBSD-upgrade
@@ -0,0 +1,20 @@
+To strip down a new version of GNU binutils for import, extract
+the files like this:
+
+ tar -xvzf binutils-2.9.1.tar.gz -X FREEBSD-Xlist
+
+Don't eliminate the *z8* files. They're needed because of a stupid
+hard-coded configure script in the opcodes subdirectory.
+
+If you decide to bring in more of the files, import them -- don't
+use "cvs add". And please remember to adjust the contents of
+"FREEBSD-Xlist" so that it reflects what is really imported from
+the vendor.
+
+Many of the files generated by GNU configure are present pre-built in
+the "src/gnu/usr.bin/binutils" tree. These can be regenerated for a
+new version of binutils by running the "update.sh" script in that
+directory.
+
+When upgrading to a new version, you also need to update the VERSION
+definition in "src/gnu/usr.bin/binutils/Makefile.inc0".
diff --git a/contrib/binutils/bfd/elf.c b/contrib/binutils/bfd/elf.c
index 2d8e160..6f43e9e 100644
--- a/contrib/binutils/bfd/elf.c
+++ b/contrib/binutils/bfd/elf.c
@@ -3000,6 +3000,11 @@ prep_headers (abfd)
i_ehdrp->e_version = bed->s->ev_current;
i_ehdrp->e_ehsize = bed->s->sizeof_ehdr;
+#ifdef __FreeBSD__
+ /* Quick and dirty hack to brand the file as a FreeBSD ELF file. */
+ strncpy((char *) &i_ehdrp->e_ident[8], "FreeBSD", EI_NIDENT-8);
+#endif
+
/* no program header, for now. */
i_ehdrp->e_phoff = 0;
i_ehdrp->e_phentsize = 0;
diff --git a/contrib/binutils/bfd/elf32-i386.c b/contrib/binutils/bfd/elf32-i386.c
index a2d53ea..4500c63 100644
--- a/contrib/binutils/bfd/elf32-i386.c
+++ b/contrib/binutils/bfd/elf32-i386.c
@@ -960,10 +960,11 @@ elf_i386_size_dynamic_sections (output_bfd, info)
relocs = true;
/* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL
- entry. The entries in the .rel.plt section
- really apply to the .got section, which we
- created ourselves and so know is not readonly. */
+ section which is in memory at run time, then
+ we probably need a DT_TEXTREL entry. The entries
+ in the .rel.plt section really apply to the
+ .got section, which we created ourselves and so
+ know is not readonly. */
outname = bfd_get_section_name (output_bfd,
s->output_section);
target = bfd_get_section_by_name (output_bfd, outname + 4);
diff --git a/contrib/binutils/bfd/elflink.h b/contrib/binutils/bfd/elflink.h
index 21bd270..4389be0 100644
--- a/contrib/binutils/bfd/elflink.h
+++ b/contrib/binutils/bfd/elflink.h
@@ -719,13 +719,15 @@ elf_link_add_object_symbols (abfd, info)
}
sz = bfd_section_size (abfd, s);
- msg = (char *) bfd_alloc (abfd, sz);
+ msg = (char *) bfd_alloc (abfd, sz+1);
if (msg == NULL)
goto error_return;
if (! bfd_get_section_contents (abfd, s, msg, (file_ptr) 0, sz))
goto error_return;
+ msg[sz] = '\0';
+
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, name, BSF_WARNING, s, (bfd_vma) 0, msg,
false, collect, (struct bfd_link_hash_entry **) NULL)))
diff --git a/contrib/binutils/bfd/freebsd.h b/contrib/binutils/bfd/freebsd.h
index 8bb19ac..8e42124 100644
--- a/contrib/binutils/bfd/freebsd.h
+++ b/contrib/binutils/bfd/freebsd.h
@@ -1,4 +1,4 @@
-/* BFD back-end definitions used by all FreeBSD targets.
+/* BFD back-end definitions used by all FreeBSD a.out targets.
Copyright (C) 1990, 1991, 1992, 1996 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,26 +18,33 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/* FreeBSD ZMAGIC files never have the header in the text. */
-#define N_HEADER_IN_TEXT(x) 0
-
-/* ZMAGIC files start at offset 0. Does not apply to QMAGIC files. */
-#define TEXT_START_ADDR 0
-
-#define N_GETMAGIC_NET(exec) \
- ((exec).a_info & 0xffff)
-#define N_GETMID_NET(exec) \
- (((exec).a_info >> 16) & 0x3ff)
-#define N_GETFLAG_NET(ex) \
- (((exec).a_info >> 26) & 0x3f)
+/* FreeBSD QMAGIC files have the header in the text. */
+#define N_HEADER_IN_TEXT(x) 1
+#define MY_text_includes_header 1
+
+#define TEXT_START_ADDR (TARGET_PAGE_SIZE + 0x20)
+
+/*
+ * FreeBSD uses a weird mix of byte orderings for its a_info field.
+ * Its assembler emits NetBSD style object files, with a big-endian
+ * a_info. Its linker seems to accept either byte ordering, but
+ * emits a little-endian a_info.
+ *
+ * Here, we accept either byte ordering, but always produce
+ * little-endian.
+ *
+ * FIXME - Probably we should always produce the _native_ byte
+ * ordering. I.e., it should be in the architecture-specific
+ * file, not here. But in reality, there is almost zero chance
+ * that FreeBSD will ever use a.out in a new port.
+ */
#define N_MACHTYPE(exec) \
((enum machine_type) \
- ((N_GETMAGIC_NET (exec) == ZMAGIC) ? N_GETMID_NET (exec) : \
- ((exec).a_info >> 16) & 0x3ff))
+ ((freebsd_swap_magic(&(exec).a_info) >> 16) & 0x3ff))
#define N_FLAGS(exec) \
- ((N_GETMAGIC_NET (exec) == ZMAGIC) ? N_GETFLAG_NET (exec) : \
- ((exec).a_info >> 26) & 0x3f)
+ ((enum machine_type) \
+ ((freebsd_swap_magic(&(exec).a_info) >> 26) & 0x3f))
#define N_SET_INFO(exec, magic, type, flags) \
((exec).a_info = ((magic) & 0xffff) \
@@ -55,22 +62,50 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "libbfd.h"
#include "libaout.h"
-/* On FreeBSD, the magic number is always in i386 (little-endian)
- format. I think. */
-#define SWAP_MAGIC(ext) bfd_getl32 (ext)
+#define SWAP_MAGIC(ext) (freebsd_swap_magic(ext))
+#define MY_bfd_final_link freebsd_bfd_final_link
+#define MY_write_object_contents freebsd_write_object_contents
-#define MY_write_object_contents MY(write_object_contents)
-static boolean MY(write_object_contents) PARAMS ((bfd *abfd));
+static boolean freebsd_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *));
+static long freebsd_swap_magic PARAMS ((void *ext));
+static boolean freebsd_write_object_contents PARAMS ((bfd *abfd));
#include "aout-target.h"
+static boolean
+freebsd_bfd_final_link(abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+{
+ obj_aout_subformat (abfd) = q_magic_format;
+ return NAME(aout,final_link) (abfd, info, MY_final_link_callback);
+}
+
+/* Swap a magic number. We accept either endian, whichever looks valid. */
+
+static long
+freebsd_swap_magic(ext)
+ void *ext;
+{
+ long linfo = bfd_getl32(ext);
+ long binfo = bfd_getb32(ext);
+ int lmagic = linfo & 0xffff;
+ int bmagic = binfo & 0xffff;
+ int lmagic_ok = lmagic == OMAGIC || lmagic == NMAGIC ||
+ lmagic == ZMAGIC || lmagic == QMAGIC;
+ int bmagic_ok = bmagic == OMAGIC || bmagic == NMAGIC ||
+ bmagic == ZMAGIC || bmagic == QMAGIC;
+
+ return bmagic_ok && !lmagic_ok ? binfo : linfo;
+}
+
/* Write an object file.
Section contents have already been written. We write the
file header, symbols, and relocation. */
static boolean
-MY(write_object_contents) (abfd)
+freebsd_write_object_contents(abfd)
bfd *abfd;
{
struct external_exec exec_bytes;
diff --git a/contrib/binutils/binutils/nm.c b/contrib/binutils/binutils/nm.c
index 27ae400..d5f7f5c 100644
--- a/contrib/binutils/binutils/nm.c
+++ b/contrib/binutils/binutils/nm.c
@@ -1262,7 +1262,7 @@ static void
print_object_filename_bsd (filename)
char *filename;
{
- if (filename_per_file && !filename_per_symbol)
+ if (filename_per_file)
printf ("\n%s:\n", filename);
}
diff --git a/contrib/binutils/binutils/objcopy.1 b/contrib/binutils/binutils/objcopy.1
index 6c98df8..e724448 100644
--- a/contrib/binutils/binutils/objcopy.1
+++ b/contrib/binutils/binutils/objcopy.1
@@ -253,7 +253,7 @@ most common symbol leading character is underscore. This option will
remove a leading underscore from all global symbols. This can be
useful if you want to link together objects of different file formats
with different conventions for symbol names. This is different from
-@code{--change-leading-char} because it always changes the symbol name
+\fB\-\-change\-leading\-char\fP because it always changes the symbol name
when appropriate, regardless of the object file format of the output
.TP
.B \-\-weaken
diff --git a/contrib/binutils/binutils/objdump.1 b/contrib/binutils/binutils/objdump.1
index 69217b9..5fd1e23 100644
--- a/contrib/binutils/binutils/objdump.1
+++ b/contrib/binutils/binutils/objdump.1
@@ -263,7 +263,7 @@ architectures with the \fB\-i\fP option.
.TP
.B \-\-reloc
Print the relocation entries of the file. If used with \fB\-d\fP or
-\fB\-d\fP, the relocations are printed interspersed with the
+\fB\-D\fP, the relocations are printed interspersed with the
disassembly.
.TP
@@ -308,7 +308,7 @@ sections from an ELF file. This is only useful on systems (such as
Solaris 2.0) in which .stab debugging symbol-table entries are carried
in an ELF section. In most other file formats, debugging symbol-table
entries are interleaved with linkage symbols, and are visible in the
-\-\-syms output.
+\fB\-\-syms\fP output.
.TP
.BI "\-\-start\-address=" "address"
diff --git a/contrib/binutils/binutils/strings.c b/contrib/binutils/binutils/strings.c
index d6a011b..603841e 100644
--- a/contrib/binutils/binutils/strings.c
+++ b/contrib/binutils/binutils/strings.c
@@ -59,9 +59,9 @@
#include "libiberty.h"
#ifdef isascii
-#define isgraphic(c) (isascii (c) && isprint (c))
+#define isgraphic(c) (isascii (c) && (isprint (c) || isblank (c)))
#else
-#define isgraphic(c) (isprint (c))
+#define isgraphic(c) (isprint (c) || isblank (c))
#endif
#ifndef errno
diff --git a/contrib/binutils/binutils/strip.1 b/contrib/binutils/binutils/strip.1
index 7974612..11cdb18 100644
--- a/contrib/binutils/binutils/strip.1
+++ b/contrib/binutils/binutils/strip.1
@@ -150,7 +150,7 @@ other than \fB\-K\fR.
.B \-\-verbose
Verbose output: list all object files modified. In the case of
archives,
-.B "strip \-V"
+.B "strip \-v"
lists all members of the archive.
.TP
diff --git a/contrib/binutils/gas/config/tc-i386.c b/contrib/binutils/gas/config/tc-i386.c
index cc173ec..53df543 100644
--- a/contrib/binutils/gas/config/tc-i386.c
+++ b/contrib/binutils/gas/config/tc-i386.c
@@ -117,7 +117,7 @@ typedef struct _i386_insn i386_insn;
/* This array holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful */
-#if defined (TE_I386AIX) || defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
+#if defined (TE_I386AIX) || (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && !defined(TE_FreeBSD)
const char comment_chars[] = "#/";
#else
const char comment_chars[] = "#";
@@ -131,7 +131,7 @@ const char comment_chars[] = "#";
#NO_APP at the beginning of its output. */
/* Also note that comments started like this one will always work if
'/' isn't otherwise defined. */
-#if defined (TE_I386AIX) || defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
+#if defined (TE_I386AIX) || (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && !defined(TE_FreeBSD)
const char line_comment_chars[] = "";
#else
const char line_comment_chars[] = "/";
diff --git a/contrib/binutils/gas/config/tc-i386.h b/contrib/binutils/gas/config/tc-i386.h
index 5142642..d095d3e 100644
--- a/contrib/binutils/gas/config/tc-i386.h
+++ b/contrib/binutils/gas/config/tc-i386.h
@@ -69,6 +69,9 @@ extern int tc_i386_fix_adjustable PARAMS ((struct fix *));
#define TARGET_ARCH bfd_arch_i386
#ifdef OBJ_AOUT
+#ifdef TE_FreeBSD
+#define TARGET_FORMAT "a.out-i386-freebsd"
+#endif
#ifdef TE_NetBSD
#define TARGET_FORMAT "a.out-i386-netbsd"
#endif
diff --git a/contrib/binutils/gas/configure b/contrib/binutils/gas/configure
index 937b289..93abf8e 100755
--- a/contrib/binutils/gas/configure
+++ b/contrib/binutils/gas/configure
@@ -1445,6 +1445,7 @@ EOF
a29k-*-vxworks*) fmt=coff ;;
alpha*-*-*vms*) fmt=evax ;;
+ alpha-*-freebsd*) fmt=elf em=freebsd ;;
alpha*-*-netware*) fmt=ecoff ;;
alpha*-*-openbsd*) fmt=ecoff ;;
alpha*-*-osf*) fmt=ecoff ;;
@@ -1484,8 +1485,8 @@ EOF
i386-*-lynxos*) fmt=coff em=lynx ;;
i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
fmt=elf ;;
- i386-*-freebsdelf*) fmt=elf ;;
- i386-*-freebsd*) fmt=aout em=386bsd ;;
+ i386-*-freebsdelf*) fmt=elf em=freebsd;;
+ i386-*-freebsd*) fmt=aout em=freebsd bfd_gas=yes ;;
i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
fmt=coff ;;
i386-*-sco3.2v5*) fmt=elf
diff --git a/contrib/binutils/gas/configure.in b/contrib/binutils/gas/configure.in
index ebb6202..47589db 100644
--- a/contrib/binutils/gas/configure.in
+++ b/contrib/binutils/gas/configure.in
@@ -158,8 +158,8 @@ changequote([,])dnl
i386-*-lynxos*) fmt=coff em=lynx ;;
i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
fmt=elf ;;
- i386-*-freebsdelf*) fmt=elf ;;
- i386-*-freebsd*) fmt=aout em=386bsd ;;
+ i386-*-freebsdelf*) fmt=elf em=freebsd;;
+ i386-*-freebsd*) fmt=aout em=freebsd bfd_gas=yes ;;
i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
fmt=coff ;;
i386-*-sco3.2v5*) fmt=elf
diff --git a/contrib/binutils/gas/doc/as.1 b/contrib/binutils/gas/doc/as.1
index adf2886..32cf67c 100644
--- a/contrib/binutils/gas/doc/as.1
+++ b/contrib/binutils/gas/doc/as.1
@@ -9,7 +9,7 @@ GNU as \- the portable GNU assembler.
.na
.B as
.RB "[\|" \-a "[\|" dhlns "\|]" \c
-\&\[\|\=\c
+\&[\|\=\c
.I file\c
\&\|]\|]
.RB "[\|" \-D "\|]"
diff --git a/contrib/binutils/ld/Makefile.in b/contrib/binutils/ld/Makefile.in
index c37aab3..762fa34 100644
--- a/contrib/binutils/ld/Makefile.in
+++ b/contrib/binutils/ld/Makefile.in
@@ -206,6 +206,7 @@ ALL_EMULATIONS = \
ei386aout.o \
ei386bsd.o \
ei386coff.o \
+ ei386freebsd.o \
ei386go32.o \
ei386linux.o \
ei386lynx.o \
@@ -874,6 +875,9 @@ ei386bsd.c: $(srcdir)/emulparams/i386bsd.sh \
ei386coff.c: $(srcdir)/emulparams/i386coff.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS}
${GENSCRIPTS} i386coff "$(tdir_i386coff)"
+ei386freebsd.c: $(srcdir)/emulparams/i386freebsd.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} i386freebsd "$(tdir_i386freebsd)"
ei386go32.c: $(srcdir)/emulparams/i386go32.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386go32.sc ${GEN_DEPENDS}
${GENSCRIPTS} i386go32 "$(tdir_i386go32)"
diff --git a/contrib/binutils/ld/configure.tgt b/contrib/binutils/ld/configure.tgt
index 18c74c4..cb3d437 100644
--- a/contrib/binutils/ld/configure.tgt
+++ b/contrib/binutils/ld/configure.tgt
@@ -86,7 +86,7 @@ i[3456]86-*-netbsd*) targ_emul=i386nbsd ;;
i[3456]86-*-netware) targ_emul=i386nw ;;
i[3456]86-*-elf*) targ_emul=elf_i386 ;;
i[3456]86-*-freebsdelf*) targ_emul=elf_i386 ;;
-i[3456]86-*-freebsd*) targ_emul=i386bsd ;;
+i[3456]86-*-freebsd*) targ_emul=i386freebsd ;;
i[3456]86-*-sysv*) targ_emul=i386coff ;;
i[3456]86-*-ptx*) targ_emul=i386coff ;;
i[3456]86-*-mach*) targ_emul=i386mach ;;
@@ -167,6 +167,7 @@ mips*-*-linux-gnu*) targ_emul=elf32bsmip
mips*-*-lnews*) targ_emul=mipslnews ;;
mn10200-*-*) targ_emul=mn10200 ;;
mn10300-*-*) targ_emul=mn10300 ;;
+alpha*-*-freebsd*) targ_emul=elf64alpha ;;
alpha*-*-linuxecoff*) targ_emul=alpha targ_extra_emuls=elf64alpha
tdir_elf64alpha=`echo ${targ_alias} | sed -e 's/ecoff//'`
;;
diff --git a/contrib/binutils/ld/emulparams/i386freebsd.sh b/contrib/binutils/ld/emulparams/i386freebsd.sh
new file mode 100644
index 0000000..0d5e9ff
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/i386freebsd.sh
@@ -0,0 +1,6 @@
+SCRIPT_NAME=aout
+TEXT_START_ADDR=0x1020
+OUTPUT_FORMAT="a.out-i386-freebsd"
+TARGET_PAGE_SIZE=0x1000
+ARCH=i386
+EXECUTABLE_SYMBOLS='__DYNAMIC = 0;'
diff --git a/contrib/binutils/ld/emultempl/elf32.em b/contrib/binutils/ld/emultempl/elf32.em
index c4debe2..ece1d2e 100644
--- a/contrib/binutils/ld/emultempl/elf32.em
+++ b/contrib/binutils/ld/emultempl/elf32.em
@@ -139,8 +139,69 @@ gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry)
EOF
if [ "x${host}" = "x${target}" ] ; then
if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+ case ${target} in
+ *-*-freebsd*)
+ cat >>e${EMULATION_NAME}.c <<EOF
+/*
+ * Read the system search path the FreeBSD way rather than like Linux.
+ */
+#include <elf.h>
+
+static boolean gld${EMULATION_NAME}_check_ld_elf_hints
+ PARAMS ((const char *, int));
+
+static boolean
+gld${EMULATION_NAME}_check_ld_elf_hints (name, force)
+ const char *name;
+ int force;
+{
+ static boolean initialized;
+ static char *ld_elf_hints;
+
+ if (! initialized)
+ {
+ FILE *f;
+
+ f = fopen (_PATH_ELF_HINTS, FOPEN_RB);
+ if (f != NULL)
+ {
+ struct elfhints_hdr hdr;
+
+ if (fread(&hdr, 1, sizeof(hdr), f) == sizeof(hdr) &&
+ hdr.magic == ELFHINTS_MAGIC &&
+ hdr.version == 1)
+ {
+ if (fseek(f, hdr.strtab + hdr.dirlist, SEEK_SET) != -1)
+ {
+ char *b;
+
+ b = (char *) xmalloc (hdr.dirlistlen + 1);
+ if (fread(b, 1, hdr.dirlistlen + 1, f) !=
+ hdr.dirlistlen + 1)
+ {
+ free(b);
+ }
+ else
+ {
+ ld_elf_hints = b;
+ }
+ }
+ }
+ fclose (f);
+ }
+ initialized = true;
+ }
+
+ if (ld_elf_hints == NULL)
+ return false;
+
+ return gld${EMULATION_NAME}_search_needed (ld_elf_hints, name, force);
+}
+EOF
+ ;;
+ *)
+ cat >>e${EMULATION_NAME}.c <<EOF
/* For a native linker, check the file /etc/ld.so.conf for directories
in which we may find shared libraries. /etc/ld.so.conf is really
only meaningful on Linux, but we check it on other systems anyhow. */
@@ -221,8 +282,8 @@ gld${EMULATION_NAME}_check_ld_so_conf (name, force)
return gld${EMULATION_NAME}_search_needed (ld_so_conf, name, force);
}
-
EOF
+ esac
fi
fi
cat >>e${EMULATION_NAME}.c <<EOF
@@ -335,10 +396,20 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF
if [ "x${host}" = "x${target}" ] ; then
if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
-cat >>e${EMULATION_NAME}.c <<EOF
+ case ${target} in
+ *-*-freebsd*)
+ cat >>e${EMULATION_NAME}.c <<EOF
+ if (gld${EMULATION_NAME}_check_ld_elf_hints (l->name, force))
+ break;
+EOF
+ ;;
+ *)
+ cat >>e${EMULATION_NAME}.c <<EOF
if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
break;
EOF
+ ;;
+ esac
fi
fi
cat >>e${EMULATION_NAME}.c <<EOF
OpenPOWER on IntegriCloud