[PATCH] Introduce new gold plugin option "relocation-pic"

Peter Collingbourne peter at pcc.me.uk
Thu Feb 13 12:08:09 PST 2014


  I'm not sure if this is correct. If an executable is being linked statically I think it will still need to be a PIE if a sanitizer which needs the lower pages is enabled. But then again libc or other system static libraries may have been built as non-PIC so PIE linking might fail. I think the right thing to do might be to always try to link a PIE if the sanitizer needs it, and let the linker complain if it doesn't work, i.e. rewrite like this:

    const bool IsPIE =
  		​    !Args.hasArg(options::OPT_shared) &&
  		​    (Args.hasArg(options::OPT_pie) || Sanitize.hasZeroBaseShadow() ||
  		​     (isAndroid && !Args.hasArg(options::OPT_static)));

  Adding Alexey Samsonov, who may be able to confirm the correct behavior here (also since there aren't enough Alexeys on this thread).

http://llvm-reviews.chandlerc.com/D2668



More information about the llvm-commits mailing list