From 7cedcfa76533364b4b480d671cf4aa29fddca5f6 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Thu, 7 Jan 1999 14:03:27 +0000 Subject: [PATCH] ld was kinly looking up the Linux /etc/ld.so.conf (which we don't have). Teach it about the FreeBSD equivalent, because there are some funny things going on with -rpath that I can't quite get a handle on. It looks like setting an rpath on a new shared object overrides all the implicit DT_RPATH's from the dependencies, causing them to fail at link time (but not runtime). --- contrib/binutils/ld/emultempl/elf32.em | 77 +++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 3 deletions(-) diff --git a/contrib/binutils/ld/emultempl/elf32.em b/contrib/binutils/ld/emultempl/elf32.em index c4debe2a92a0..ece1d2e0fae2 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 <>e${EMULATION_NAME}.c < +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 <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <name, force)) + break; +EOF + ;; + *) + cat >>e${EMULATION_NAME}.c <name, force)) break; EOF + ;; + esac fi fi cat >>e${EMULATION_NAME}.c <