Prepare rtld for symbol versioning. Disable it by default for now.

This commit is contained in:
Alexander Kabaev 2007-04-03 19:01:06 +00:00
parent 0d1778eac6
commit 7ca8e6a670
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168319
4 changed files with 50 additions and 22 deletions

View File

@ -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>

View File

@ -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;
};

View File

@ -0,0 +1,4 @@
# $FreeBSD$
FBSD_1.0 {
};

View File

@ -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 {
};