[clang] [compiler-rt] Move interceptors for libresolv functions to MSan (PR #119071)
Aaron Puchert via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 19 04:57:11 PST 2024
aaronpuchert wrote:
Without these two options, the build fails for me:
```
FAILED: bin/llvm-jitlink
: && /usr/bin/clang++ --sysroot=/home/aaron/chrome-sysroot -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fno-pie -fuse-ld=lld -Wl,--color-diagnostics -Wl,--export-dynamic -Wl,--gc-sections tools/llvm-jitlink/CMakeFiles/llvm-jitlink.dir/llvm-jitlink.cpp.o tools/llvm-jitlink/CMakeFiles/llvm-jitlink.dir/llvm-jitlink-coff.cpp.o tools/llvm-jitlink/CMakeFiles/llvm-jitlink.dir/llvm-jitlink-elf.cpp.o tools/llvm-jitlink/CMakeFiles/llvm-jitlink.dir/llvm-jitlink-macho.cpp.o tools/llvm-jitlink/CMakeFiles/llvm-jitlink.dir/llvm-jitlink-statistics.cpp.o -o bin/llvm-jitlink -Wl,-rpath,"\$ORIGIN/../lib:" [...] -ldl -lpthread -lm /home/aaron/chrome-sysroot/usr/lib/x86_64-linux-gnu/libz.so lib/libLLVMDemangle.a && :
ld.lld: error: undefined symbol: shm_open
>>> referenced by MemoryMapper.cpp
>>> MemoryMapper.cpp.o:(llvm::orc::SharedMemoryMapper::reserve(unsigned long, llvm::unique_function<void (llvm::Expected<llvm::orc::ExecutorAddrRange>)>)::$_0::operator()(llvm::Error, llvm::Expected<std::pair<llvm::orc::ExecutorAddr, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>)) in archive lib/libLLVMOrcJIT.a
>>> did you mean: sem_open
>>> defined in: /home/aaron/chrome-sysroot/usr/lib/x86_64-linux-gnu/libpthread.so
ld.lld: error: undefined symbol: shm_unlink
>>> referenced by MemoryMapper.cpp
>>> MemoryMapper.cpp.o:(llvm::orc::SharedMemoryMapper::reserve(unsigned long, llvm::unique_function<void (llvm::Expected<llvm::orc::ExecutorAddrRange>)>)::$_0::operator()(llvm::Error, llvm::Expected<std::pair<llvm::orc::ExecutorAddr, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>)) in archive lib/libLLVMOrcJIT.a
>>> did you mean: sem_unlink
>>> defined in: /home/aaron/chrome-sysroot/usr/lib/x86_64-linux-gnu/libpthread.so
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
```
Apparently we're missing `-lrt`, which has the functions:
```
> readelf --dyn-syms --wide /home/aaron/chrome-sysroot/usr/lib/x86_64-linux-gnu/librt.so | grep shm
55: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __shm_directory at GLIBC_PRIVATE (12)
73: 0000000000004640 353 FUNC GLOBAL DEFAULT 14 shm_open@@GLIBC_2.2.5
91: 00000000000047b0 303 FUNC GLOBAL DEFAULT 14 shm_unlink@@GLIBC_2.2.5
```
Why are we not linking with that? It's correctly detected:
```
-- Looking for shm_open in rt
-- Looking for shm_open in rt - found
```
Have to investigate. Without sysroot but otherwise the same command line I can't reproduce it.
https://github.com/llvm/llvm-project/pull/119071
More information about the llvm-commits
mailing list