Page MenuHomePhabricator

lld-link: Add a flag /lldignoreenv that makes lld-link ignore env vars.
ClosedPublic

Authored by thakis on Wed, Sep 11, 12:12 PM.

Details

Summary

This is useful for enforcing that builds are independent of the
environment; it can be used when all system library paths are added
via /libpath: already. It's similar ot cl.exe's /X flag.

Since it should also affect %LINK% (the other caller of
Process::GetEnv in lld/COFF), the early-option-parsing needs
to move around a bit. The options are:

  • Add a manual loop over the argv ArrayRef and look for "/lldignoreenv". This repeats the name of the flag in both Options.td and in DriverUtils.cpp.
  • Add yet another table.ParseArgs() call just for /lldignoreenv before adding %LINK%.
  • Use the existing early ParseArgs() that's there for --rsp-quoting and use it for /lldignoreenv for %LINK% as well. This means --rsp-quoting and /lldignoreenv can't be passed via %LINK%.

I went with the third approach.

Diff Detail

Repository
rL LLVM

Event Timeline

thakis created this revision.Wed, Sep 11, 12:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptWed, Sep 11, 12:12 PM
ruiu accepted this revision.Fri, Sep 13, 3:38 AM

LGTM

This revision is now accepted and ready to land.Fri, Sep 13, 3:38 AM
This revision was automatically updated to reflect the committed changes.