[PATCH] D118162: [tblgen] Disable lsan weak hook when building with msvc

pierre gousseau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 05:48:18 PST 2022


pgousseau added a comment.

In D118162#3272215 <https://reviews.llvm.org/D118162#3272215>, @aaron.ballman wrote:

> I'm a bit confused as to why this change is needed. My understanding is that `__SANITIZE_ADDRESS__` is only defined when the user passes `-fsanitize=address` (so they explicitly opted in). So isn't the issue here that the user asked for something unsupported and the solution is for them to not pass that compiler argument on Windows? Alternatively, should the fix be to require `__has_feature(leak_sanitizer)` to return true instead of using `||`?
>
> (I'm a bit worried that we're carving out an exception for something that's feature testable and when the feature eventually gets supported on Windows, nobody will remember to go remove the special exceptions.)

Thank you for reviewing!

cl.exe does not support __has_feature unfortunately.

I have not tried but maybe an alternative would be to check the output of an instrumented exe with ASAN_OPTIONS=detect_leaks=1 during cmake? WDYT?
eg:

  cl.exe -fsanitize=address t.c /w /nologo /link /DEBUG && env ASAN_OPTIONS=detect_leaks=1 t.exe
  t.c
     Creating library t.lib and object t.exp
  
  ==28436==AddressSanitizer: detect_leaks is not supported on this platform.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118162/new/

https://reviews.llvm.org/D118162



More information about the llvm-commits mailing list