diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2024-04-14 17:38:42 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-04-14 17:40:12 +0000 |
commit | 8b181c2fbaa8c6b32e5510ef6e3a6d364ff4710e (patch) | |
tree | 823e2a0df27f760f10b84eb1626e25327ad4b944 /contrib | |
parent | e6a4b57239dafc6c944473326891d46d966c0264 (diff) | |
download | src-8b181c2fbaa8c6b32e5510ef6e3a6d364ff4710e.tar.gz src-8b181c2fbaa8c6b32e5510ef6e3a6d364ff4710e.zip |
sanitizers: mark __elf_aux_vector as weak, to allow linking without libsys
After libsys was introduced, linking sanitized programs started failing
with:
# c++ -fsanitize=address main.cc
ld: error: undefined symbol: __elf_aux_vector
>>> referenced by sanitizer_linux_libcdep.cpp:950 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp:950)
>>> sanitizer_linux_libcdep.o:(__sanitizer::ReExec()) in archive /usr/lib/clang/17/lib/freebsd/libclang_rt.asan-x86_64.a
c++: error: linker command failed with exit code 1 (use -v to see invocation)
Mark __elf_aux_vector as weak in the internal sanitizer declaration, so
the linker will accept it at link time. The dynamic linker will then
take care of the symbol at run time.
Suggestion by: brooks
PR: 276104, 277393
MFC after: 1 month
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp index cccbb4d256df..962fff53e447 100644 --- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp +++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp @@ -53,7 +53,7 @@ // that, it was never implemented. So just define it to zero. # undef MAP_NORESERVE # define MAP_NORESERVE 0 -extern const Elf_Auxinfo *__elf_aux_vector; +extern const Elf_Auxinfo *__elf_aux_vector __attribute__ ((weak)); # endif # if SANITIZER_NETBSD |