Revert r218541 - Don't link in sanitizer runtimes if -nostdlib/-nodefaultlibs is provided.
This is a sad thing to do, but all the alternatives look ugly. Looks like there are legitimate cases when users may want to link with sanitizer runtimes *and* -nodefaultlibs (and ensure they provide replacements for system libraries). For example, this happens in libc++ test suite. "-nodefaultlibs" is told to link only the libraries explicitly provided by the user, and providing "-fsanitize=address" is a clear indication of intention to link with ASan runtime. We can't easily introduce analogue of "-print-libgcc-name": linking with sanitizers runtimes is not trivial: some runtimes are split into several archive libraries, which are required to be wrapped in -whole-archive/-no-whole-archive. If "-fsanitize=whatever" and "-nodefaultlibs" are provided, system library dependencies of sanitizer runtimes (-lc/-ldl/-lpthread/-lrt) will *not* be linked, and user would have to link them in manually. Note that this can cause problems, as failing to provide "-lrt" might lead to crashes in runtime during ASan initialization. But looks like we should bite this bullet. See r218541 review thread for the discussion. llvm-svn: 220455
Loading
Please sign in to comment