[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 05:17:01 PST 2024


aaronpuchert wrote:

That configuration output is from `compiler-rt`, but we need it in `llvm`. In `llvm/lib/ExecutionEngine/Orc/CMakeLists.txt`:
```cmake
if( CMAKE_HOST_UNIX AND HAVE_LIBRT )
  set(rt_lib rt)
endif()
```
We have `CMAKE_HOST_UNIX` = 1, but `HAVE_LIBRT` is empty. It comes from `check_library_exists(rt clock_gettime "" HAVE_LIBRT)` in `llvm/cmake/config-ix.cmake`. The corresponding output:
```
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - not found
```
This looks correct to me:
```
> readelf --dyn-syms --wide /home/aaron/chrome-sysroot/usr/lib/x86_64-linux-gnu/librt.so | grep clock_gettime
    38: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __clock_gettime at GLIBC_PRIVATE (7)
```
Instead it's in `libc.so.6`:
```
> readelf --dyn-syms --wide /home/aaron/chrome-sysroot/lib/x86_64-linux-gnu/libc.so.6 | grep clock_gettime
   840: 00000000000c3420   111 FUNC    GLOBAL DEFAULT   13 __clock_gettime@@GLIBC_PRIVATE
  1748: 00000000000c3420   111 FUNC    GLOBAL DEFAULT   13 clock_gettime at GLIBC_2.2.5
  1751: 00000000000c3420   111 FUNC    GLOBAL DEFAULT   13 clock_gettime@@GLIBC_2.17
```
On my system that's not an issue because `libc.so` has both `clock_gettime` and `shm_open`, so `librt.so` is never needed. Do you have any additional patches or why does this work for you?

https://github.com/llvm/llvm-project/pull/119071


More information about the llvm-commits mailing list