freebsd-dev/libexec/rtld-elf
Konstantin Belousov c8da4f07d7 Allow the NULL, RTLD_SELF and RTLD_NEXT handles to work with dlfunc(3).
dlfunc() called dlsym() to do the work, and dlsym() determines the dso
that originating the call by the return address. Due to this, dlfunc()
operated as if the caller is always the libc.

To fix this, move the dlfunc() to rtld, where it can call the internal
implementation of dlsym, and still correctly fetch return address.
Provide usual weak stub for the symbol from libc for static binaries.
dlfunc is put to FBSD_1.0 symver namespace in the ld.so export to
override dlfunc@FBSD_1.0 weak symbol, exported by libc.

Reported, analyzed and tested by:	Tijl Coosemans <tijl ulyssis org>
PR: standards/133339
Reviewed by:	kan
2009-04-03 19:17:23 +00:00
..
amd64 *thwack*! all the world's not i386. 2006-03-29 12:29:01 +00:00
arm Implement ELF symbol versioning using GNU semantics. This code aims 2005-12-18 19:43:33 +00:00
i386 Use C comments since we now preprocess these files with CPP. 2007-04-29 14:05:22 +00:00
ia64 We don't need --export-dynamic for ld-elf.so.1, because it's a 2007-05-16 23:19:51 +00:00
mips This code has no copyright. It is fairly obvious to me that we're a 2008-10-13 20:24:03 +00:00
powerpc Include an extra header to get a function prototype. 2007-11-19 08:58:11 +00:00
sparc64 For un-prototyped static inline functions declared in pthread_md.h on 2007-12-01 14:24:44 +00:00
debug.c
debug.h Use C99's varadic macro syntax instead of gcc's. 2006-03-28 18:26:47 +00:00
libmap.c Fix a malloc overrun in 32-bit compat libmap lookup code. 2006-01-31 06:08:28 +00:00
libmap.h Description from Dan: 2005-02-04 02:46:41 +00:00
Makefile Fix build when WITH_SSP is set explicitly. 2009-02-21 15:04:31 +00:00
malloc.c In preparation for a new malloc implementation: 2006-01-12 07:28:21 +00:00
map_object.c Implement the dynamic string token substitution in the rpath and 2009-03-18 13:40:37 +00:00
rtld_lock.c Add two rtld exported symbols, _rtld_atfork_pre and _rtld_atfork_post. 2008-11-27 11:27:59 +00:00
rtld_lock.h Provide custom simple allocator for rtld locks in libthr. The allocator 2008-12-02 11:58:31 +00:00
rtld_tls.h Add support for Thread Local Storage. 2004-08-03 08:51:00 +00:00
rtld.1 Document RTLD_NODELETE, -z nodelete and -z origin support. 2009-04-01 14:38:20 +00:00
rtld.c Allow the NULL, RTLD_SELF and RTLD_NEXT handles to work with dlfunc(3). 2009-04-03 19:17:23 +00:00
rtld.h Implement support for RTLD_NODELETE flag for dlopen() and -z nodelete 2009-03-30 08:47:28 +00:00
Symbol.map Allow the NULL, RTLD_SELF and RTLD_NEXT handles to work with dlfunc(3). 2009-04-03 19:17:23 +00:00
xmalloc.c