(no subject)

Hi everyone,

While adding AddressSanitizer support to
tools/clang/lib/Driver/Tools.cpp I've ran into the following problem.

On Darwin ASan does not play well with the binaries having the MH_PIE bit set.
Because of it we need to add the -no_pie flag to the list of flags
passed to ld (otherwise we'll have MH_PIE on OS X Lion)
as well as remove the -pie flag from the list of options (if both -pie
and -no_pie are passed to ld, the results depend on their order).

However the arguments are passed everywhere as a constant ArgList:

3501 void darwin::link::ConstructJob(Compilation &C, const JobAction &JA,
3502 const InputInfo &Output,
3503 const InputInfoList &Inputs,
3504 const ArgList &Args,
3505 const char *LinkingOutput) const {

, so it's not a good idea to just call Args.eraseArg().

What's the preferred way of not letting an argument make it into the
final CmdArgs of a link job?
Should I copy the input ArgList and filter it, or remove the "-pie"
string directly from CmdArgs?

TIA,
Alexander Potapenko
Software Engineer
Google Moscow