7da378f9de
The current lookup prefers a strong definition to a STB_WEAK definition (similar to glibc pre-2.2 behavior) which does not conform to the ELF specification. The non-compliant behavior provoked https://reviews.llvm.org/D4418 which was intended to fix -shared-libasan but introduced new problems (and caused some sanitizer tests (e.g. test/asan/TestCases/interception_failure_test.cpp) to fail): sanitizer interceptors are STB_GLOBAL instead of STB_WEAK, so defining a second STB_GLOBAL interceptor can lead to a multiple definition linker error. For example, in a -fsanitize={address,memory,...} build, libc functions like malloc/free/strtol/... cannot be provided by user object files. See https://docs.freebsd.org/cgi/getmsg.cgi?fetch=16483939+0+archive/2014/freebsd-current/20140716.freebsd-current for discussions. This patch implements the ELF-compliant behavior when LD_DYNAMIC_WEAK is set. STB_WEAK wrestling in symbol lookups in `Search the dynamic linker itself` are untouched. Reviewed by: kib MFC after: 1 week Differential revision: https://reviews.freebsd.org/D26352 |
||
---|---|---|
.. | ||
aarch64 | ||
amd64 | ||
arm | ||
i386 | ||
mips | ||
powerpc | ||
powerpc64 | ||
riscv | ||
rtld-libc | ||
tests | ||
debug.c | ||
debug.h | ||
libmap.c | ||
libmap.conf | ||
libmap.h | ||
Makefile | ||
Makefile.depend | ||
map_object.c | ||
paths.h | ||
rtld_lock.c | ||
rtld_lock.h | ||
rtld_malloc.c | ||
rtld_malloc.h | ||
rtld_printf.c | ||
rtld_printf.h | ||
rtld_tls.h | ||
rtld_utrace.h | ||
rtld.1 | ||
rtld.c | ||
rtld.h | ||
Symbol.map | ||
xmalloc.c |