diff options
author | 2001-04-18 18:35:24 +0000 | |
---|---|---|
committer | 2001-04-18 18:35:24 +0000 | |
commit | b46333bbc1bf6a3dbf1c8d9b06704248b2383742 (patch) | |
tree | 867d02f736090fc64bfd4c9b863e3ce705cbb1f1 | |
parent | add MySQL port, ok deraadt@ (diff) | |
download | wireguard-openbsd-b46333bbc1bf6a3dbf1c8d9b06704248b2383742.tar.xz wireguard-openbsd-b46333bbc1bf6a3dbf1c8d9b06704248b2383742.zip |
date: 2001/04/18 18:33:13; author: drahn; state: Exp; lines: +41 -0
Use the /var/run/ld.so.hints for looking up transitive dependancies on shared
libraries in ld, this is done in linux with ld.so.conf, but the string
is stored in ld.so.hints for openbsd. Fixes some "-rpath" compilation
errors. as with the linux case, this is only for the native ld.
Ok'd by espie@.
-rw-r--r-- | gnu/usr.bin/binutils/ld/emultempl/elf32.em | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gnu/usr.bin/binutils/ld/emultempl/elf32.em b/gnu/usr.bin/binutils/ld/emultempl/elf32.em index d629d9a245b..3698885e23d 100644 --- a/gnu/usr.bin/binutils/ld/emultempl/elf32.em +++ b/gnu/usr.bin/binutils/ld/emultempl/elf32.em @@ -325,6 +325,14 @@ EOF if [ "x${host}" = "x${target}" ] ; then case " ${EMULATION_LIBPATH} " in *" ${EMULATION_NAME} "*) + case ${target} in + *-*-openbsd*) +cat >>e${EMULATION_NAME}.c <<EOF +#include <fcntl.h> +#include <link.h> +EOF + ;; + esac cat >>e${EMULATION_NAME}.c <<EOF /* For a native linker, check the file /etc/ld.so.conf for directories @@ -345,8 +353,41 @@ gld${EMULATION_NAME}_check_ld_so_conf (name, force) if (! initialized) { FILE *f; +EOF + case ${target} in + *-*-openbsd*) + cat >>e${EMULATION_NAME}.c <<EOF + struct hints_header hdr; + off_t diroff; + int fd; + char *buf; + + f = fopen(_PATH_LD_HINTS, FOPEN_RT); + if (f != NULL) + { + if ( fread (&hdr, sizeof (struct hints_header), 1, f) == 1) { + if (!HH_BADMAG(hdr)) { + diroff = (hdr.hh_strtab + hdr.hh_dirlist); + fseek(f, diroff, SEEK_SET); + } else { + fclose(f); + f = NULL; + } + } else { + fclose(f); + f = NULL; + } + } +EOF + ;; + *) +cat >>e${EMULATION_NAME}.c <<EOF f = fopen ("/etc/ld.so.conf", FOPEN_RT); +EOF + ;; + esac +cat >>e${EMULATION_NAME}.c <<EOF if (f != NULL) { char *b; |