-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Fix references to required libraries when building LLVM with ASAN and MultiThreaded[Debug] on Windows #139657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… MultiThreaded[Debug] on Windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but please wait for @barcharcraz
Ping @barcharcraz |
Ping @barcharcraz -- @vitalybuka , would it be OK to merge this in if I do not get a response this week from @barcharcraz ? |
I have seen your pings and will look today :) |
lgtm but I question if we really need to be messing with the linker flags here in the first place. This is exactly what the clang driver does if you link through it with /fsanitize=address or what link.exe does when it sees the asan directive. |
Thanks for the review @barcharcraz ! I will verify this some time next week. |
Hi @barcharcraz , I re-reviewed these changes and can confirm they are still necessary in the case of building LLVM / Clang with
It indeed does look like the appropriate libraries will be added automatically as per: llvm-project/clang/lib/Driver/ToolChains/MSVC.cpp Lines 203 to 228 in fccab5d
However, at least from the CMake options I'm using and my build environment, it appears that linking is invoked directly via the linker rather than linking via the compiler driver invoking the linker. Therefore, unless there's a CMake flag or some other bits of configuration I may be overlooking (please let me know if that is the case), it seems like this change is required. I will wait a few more days before merging to give you time to reply in-case there's extra discussion that may be worth having. Thanks again for reviewing, sorry if my pings were a bit annoying 😅... |
After #81677, statically linking ASAN under Windows is no longer supported. Therefore, when using Clang built past 53a81d4 to build LLVM / Clang with
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded[Debug] -DLLVM_USE_SANITIZER=Address
, a different set of dependent libraries must be linked. This is mentioned in the description of #81677 and also in https://devblogs.microsoft.com/cppblog/msvc-address-sanitizer-one-dll-for-all-runtime-configurations/.