[PATCH] D147687: [compiler-rt] [test] Use %clangxx for tests that use -x c++
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 12 02:11:37 PDT 2023
mstorsjo added a comment.
In D147687#4259628 <https://reviews.llvm.org/D147687#4259628>, @MaskRay wrote:
> The change `%clangxx` makes sense but I am curious how `%clang -x c++` broke only in mingw mode.
>
> `ubsan_type_hash_win.cpp` is referenced by `ubsan_handlers_cxx.cpp`. Any idea how `%clang -x c++` invocations extract the archive member corresponding to `ubsan_handlers_cxx.cpp` in mingw mode? AIUI `ubsan_handlers_cxx.cpp` is for some C++ specific `-fsanitize=` modes, which are unrelated to the modes used by these tests.
On Windows (both mingw and msvc mode), the sanitizers are linked in by adding linker directives to the object file - when compiling in C mode, it's `/DEFAULTLIB:libclang_rt.ubsan_standalone-x86_64.a` while C++ mode also brings in `/DEFAULTLIB:libclang_rt.ubsan_standalone_cxx-x86_64.a`.
So when the C++ source brings in `libclang_rt.ubsan_standalone_cxx-x86_64.a`, it loads `__ubsan_handle_cfi_bad_type` from there (instead of using the fallback default `__ubsan_handle_cfi_bad_type_default` within `ubsan_handlers.cpp`) and ends up bringing in `ubsan_handlers_cxx.cpp.obj` and `ubsan_type_hash_itanium.cpp.obj`.
If I forcibly link in `libclang_rt.ubsan_standalone_cxx.a` on Linux too, I end up with the same link error.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147687/new/
https://reviews.llvm.org/D147687
More information about the llvm-commits
mailing list