[PATCH] D54805: [Driver] Use --push/pop-state with Sanitizer link deps

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 21 14:48:21 PST 2018


MaskRay added a comment.

In https://reviews.llvm.org/D54805#1305749, @pcc wrote:

> 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 to 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?


Repository:
  rC Clang

https://reviews.llvm.org/D54805





More information about the cfe-commits mailing list