[libcxx-commits] [libcxx] [libcxxabi] [libunwind] [llvm] [runtimes] Probe for -nostdlib++ and -nostdinc++ with the C compiler (PR #108357)

Vitaly Buka via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 17 19:35:50 PST 2024


vitalybuka wrote:

The problem is that some of check_cxx_source_compiles invocation does:

```
cat t.cpp 
int main() {
 }

/usr/local/google/home/vitalybuka/tmp/bot/llvm_build0/bin/clang++ -fsanitize=memory  -nostdlib++ -nostdinc++  -fuse-ld=lld t.cpp 

>> referenced by ubsan_type_hash_itanium.cpp:245 (/usr/local/google/home/vitalybuka/tmp/bot/llvm-project/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp:245)
>>>               ubsan_type_hash_itanium.cpp.o:(__ubsan::checkDynamicType(void*, void*, unsigned long)) in archive /usr/local/google/home/vitalybuka/tmp/bot/llvm_build0/lib/clang/20/lib/x86_64-unknown-linux-gnu/libclang_rt.msan_cxx.a

ld.lld: error: undefined symbol: typeinfo for __cxxabiv1::__class_type_info
>>> referenced by ubsan_type_hash_itanium.cpp:245 (/usr/local/google/home/vitalybuka/tmp/bot/llvm-project/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp:245)
>>>               ubsan_type_hash_itanium.cpp.o:(__ubsan::checkDynamicType(void*, void*, unsigned long)) in archive /usr/local/google/home/vitalybuka/tmp/bot/llvm_build0/lib/clang/20/lib/x86_64-unknown-linux-gnu/libclang_rt.msan_cxx.a
>>> referenced by ubsan_type_hash_itanium.cpp:0 (/usr/local/google/home/vitalybuka/tmp/bot/llvm-project/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp:0)
>>>               ubsan_type_hash_itanium.cpp.o:(isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*, __cxxabiv1::__class_type_info const*, long)) in archive /usr/local/google/home/vitalybuka/tmp/bot/llvm_build0/lib/clang/20/lib/x86_64-unknown-linux-gnu/libclang_rt.msan_cxx.a
>>> referenced by ubsan_type_hash_itanium.cpp:141 (/usr/local/google/home/vitalybuka/tmp/bot/llvm-project/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp:141)
>>>               ubsan_type_hash_itanium.cpp.o:(isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*, __cxxabiv1::__class_type_info const*, long)) in archive /usr/local/google/home/vitalybuka/tmp/bot/llvm_build0/lib/clang/20/lib/x86_64-unknown-linux-gnu/libclang_rt.msan_cxx.a
>>> referenced 2 more times

and so on
```

So -nostdlib++ removes libc++ but does not remove msan_cxx.a.

My guess we need to fix the driver to do so.

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


More information about the libcxx-commits mailing list