[PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

Kuba Brecka via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 8 01:43:25 PDT 2016

kubabrecka added a comment.

Anyone who uses `-nostdlib` or `-nodefaultlibs` has to be aware that his program will be linked with less stuff than usual and has to expect linker error.  If such a user doesn’t know that ASan and TSan require a dylib on macOS, he should be able to figure this out from the error/warning.

That being said, I am in favor for the current patch (don’t link sanitizer runtime automatically with -nostdlib, but do so with an explicit -flink-sanitizer-runtimes), plus an explicit warning when using `-nostdlib` and `-fsanitize=...` together without `-flink-sanitizer-runtimes`, which should suggest to use the new option.

Could we consider renaming `-flink-sanitizer-runtimes` to something that starts with `-fsanitize`?  All current sanitizer flags start with `-fsanitize`, they never use the word sanitize/sanitizer in the middle.  We also already have `-fsanitize-link-c++-runtime`.


More information about the cfe-commits mailing list