From 98adf88c304eb2eadbd10ec8472a845aeb755736 Mon Sep 17 00:00:00 2001 From: kan Date: Tue, 3 Apr 2007 19:01:06 +0000 Subject: Prepare rtld for symbol versioning. Disable it by default for now. --- libexec/rtld-elf/Makefile | 38 ++++++++++++++++---------------------- libexec/rtld-elf/Symbol.map | 18 ++++++++++++++++++ libexec/rtld-elf/Versions.def | 4 ++++ libexec/rtld-elf/i386/Symbol.map | 12 ++++++++++++ 4 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 libexec/rtld-elf/Symbol.map create mode 100644 libexec/rtld-elf/Versions.def create mode 100644 libexec/rtld-elf/i386/Symbol.map (limited to 'libexec/rtld-elf') diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile index 3179495..fb5bb98 100644 --- a/libexec/rtld-elf/Makefile +++ b/libexec/rtld-elf/Makefile @@ -16,34 +16,27 @@ SYMLINKS= ${BINDIR}/${PROG} /usr/libexec/${PROG} MLINKS= rtld.1 ld-elf.so.1.1 \ rtld.1 ld.so.1 -.if exists(${.CURDIR}/${MACHINE_ARCH}/Makefile.inc) -.include "${.CURDIR}/${MACHINE_ARCH}/Makefile.inc" -.endif - -# If LDSCRIPT is defined, we build the dynamic linker as an -# executable. Otherwise we build it as a shared object. We ignore -# LDSCRIPT if the running kernel is too old to support it. -.if defined(LDSCRIPT) -KERN_OSRELDATE!= /sbin/sysctl -n kern.osreldate 2>/dev/null || echo 0 -.if ${KERN_OSRELDATE} >= 400001 -LDSO_IS_EXECUTABLE= -.endif -.endif - -.ifdef LDSO_IS_EXECUTABLE -OBJS+= dyn_hack.so -LDFLAGS+= -Wl,-T,${LDSCRIPT} -Wl,-E -Wl,-Bstatic -DPADD= ${LIBC} -LDADD= -lc -.else CFLAGS+= -fpic -DPIC LDFLAGS+= -shared -Wl,-Bsymbolic DPADD= ${LIBC_PIC} LDADD= -lc_pic + +.if defined(SYMVER_ENABLED) +SYMBOL_MAPS= ${.CURDIR}/Symbol.map +VERSION_DEF= ${.CURDIR}/Versions.def +VERSION_MAP= Version.map +LDFLAGS+= -Wl,--version-script=${VERSION_MAP} + +${PROG}: ${VERSION_MAP} + +.if exists(${.CURDIR}/${MACHINE_ARCH}/Symbol.map) +SYMBOL_MAPS+= ${.CURDIR}/${MACHINE_ARCH}/Symbol.map +.endif .endif -dyn_hack.so: - ${CC} -shared -nostdlib -o dyn_hack.so -x c /dev/null +.if exists(${.CURDIR}/${MACHINE_ARCH}/Makefile.inc) +.include "${.CURDIR}/${MACHINE_ARCH}/Makefile.inc" +.endif # Since moving rtld-elf to /libexec, we need to create a symlink. # Fixup the existing binary that's there so we can symlink over it. @@ -54,4 +47,5 @@ beforeinstall: .PATH: ${.CURDIR}/${MACHINE_ARCH} +.include .include diff --git a/libexec/rtld-elf/Symbol.map b/libexec/rtld-elf/Symbol.map new file mode 100644 index 0000000..571f8f1 --- /dev/null +++ b/libexec/rtld-elf/Symbol.map @@ -0,0 +1,18 @@ +# $FreeBSD$ + +FBSD_1.0 { + _rtld_error; + dlclose; + dlerror; + dlopen; + dlsym; + dlvsym; + dladdr; + dllockinit; + dlinfo; + dl_iterate_phdr; + _rtld_thread_init; + _rtld_allocate_tls; + _rtld_free_tls; + __tls_get_addr; +}; diff --git a/libexec/rtld-elf/Versions.def b/libexec/rtld-elf/Versions.def new file mode 100644 index 0000000..d8df441 --- /dev/null +++ b/libexec/rtld-elf/Versions.def @@ -0,0 +1,4 @@ +# $FreeBSD$ + +FBSD_1.0 { +}; diff --git a/libexec/rtld-elf/i386/Symbol.map b/libexec/rtld-elf/i386/Symbol.map new file mode 100644 index 0000000..8533215 --- /dev/null +++ b/libexec/rtld-elf/i386/Symbol.map @@ -0,0 +1,12 @@ +# $FreeBSD$ + +FBSD_1.0 { + ___tls_get_addr; +}; + +# This is our private namespace. Any global interfaces that are +# strictly for use only by other FreeBSD applications and libraries +# are listed here. We use a separate namespace so we can write +# simple ABI-checking tools. +FBSDprivate { +}; -- cgit v1.1