summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2007-04-03 19:01:06 +0000
committerkan <kan@FreeBSD.org>2007-04-03 19:01:06 +0000
commit98adf88c304eb2eadbd10ec8472a845aeb755736 (patch)
tree8128149729aeb70909229b9d329024aabba0a14d /libexec/rtld-elf
parentd6c8ea9c78c51df998f734054595d574676131fa (diff)
downloadFreeBSD-src-98adf88c304eb2eadbd10ec8472a845aeb755736.zip
FreeBSD-src-98adf88c304eb2eadbd10ec8472a845aeb755736.tar.gz
Prepare rtld for symbol versioning. Disable it by default for now.
Diffstat (limited to 'libexec/rtld-elf')
-rw-r--r--libexec/rtld-elf/Makefile38
-rw-r--r--libexec/rtld-elf/Symbol.map18
-rw-r--r--libexec/rtld-elf/Versions.def4
-rw-r--r--libexec/rtld-elf/i386/Symbol.map12
4 files changed, 50 insertions, 22 deletions
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 <bsd.symver.mk>
.include <bsd.prog.mk>
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 {
+};
OpenPOWER on IntegriCloud