Skip to content

main/llvm-runtimes: fix MSAN on musl

Sören Tempel requested to merge nmeum/aports:msan-musl into master

Without this patch -fsanitize=memory cannot be used on Alpine.

$ cat test.c
#include <stdio.h>

int main(void) {
        char b[20];
        printf("%c\n", b[5]);
}
$ clang -fsanitize=memory -o test test.c
/usr/bin/ld: /usr/lib/llvm16/lib/clang/16/lib/linux/libclang_rt.msan-x86_64.a(msan_interceptors.cpp.o): in function `__interceptor_getrlimit64':
/home/buildozer/aports/main/llvm-runtimes/src/llvm-project-16.0.6.src/compiler-rt/lib/msan/msan_interceptors.cpp:833: undefined reference to `__sanitizer::struct_rlimit64_sz'
/usr/bin/ld: /usr/lib/llvm16/lib/clang/16/lib/linux/libclang_rt.msan-x86_64.a(msan_interceptors.cpp.o): in function `__interceptor_prlimit64':
/home/buildozer/aports/main/llvm-runtimes/src/llvm-project-16.0.6.src/compiler-rt/lib/msan/msan_interceptors.cpp:853: undefined reference to `__sanitizer::struct_rlimit64_sz'
/usr/bin/ld: /home/buildozer/aports/main/llvm-runtimes/src/llvm-project-16.0.6.src/compiler-rt/lib/msan/msan_interceptors.cpp:853: undefined reference to `__sanitizer::struct_rlimit64_sz'
/usr/bin/ld: /home/buildozer/aports/main/llvm-runtimes/src/llvm-project-16.0.6.src/compiler-rt/lib/msan/msan_interceptors.cpp:855: undefined reference to `__sanitizer::struct_rlimit64_sz'
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)

Merge request reports