Sanitizer runtime link deps handling passes --no-as-needed because of
PR15823, but it never undoes it and this flag may affect other libraries
that come later on the link line. To avoid this, wrap Sanitizer link
deps in --push/pop-state.
Details
Diff Detail
- Repository
- rC Clang
Event Timeline
Unfortunately it looks like the Android NDK uses some ancient version of gold that doesn't support --push-state, so we probably can't rely on being able to use it.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/17287/steps/run%20lit%20tests%20%5Bi686%2Ffugu-userdebug%2FN2G48C%5D/logs/stdio
As an alternative solution, could we add these flags at the start of the linker command line? That way, we're guaranteed that the linker will be in the --no-as-needed state.
gold --push-state seems a new thing. It is available since Dec 2016 (version 1.14)
I'm also interested in the history of
// Force linking against the system libraries sanitizers depends on // (see PR15823 why this is necessary). CmdArgs.push_back("--no-as-needed");
PR15823 leans slightly toward the user-error side to me. Shouldn't the user ensure the use of -Wl,--as-needed is eventually closed so that system libraries start with the -Wl--no-as-needed state?
I have already reverted the change as r347430 after seeing the failure on sanitizer bots.