[PATCH] D67456: lld-link: Add a flag /lldignoreenv that makes lld-link ignore env vars.

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 12:13:38 PDT 2019


thakis created this revision.
thakis added a reviewer: ruiu.
Herald added a project: LLVM.

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.


https://reviews.llvm.org/D67456

Files:
  lld/COFF/Driver.cpp
  lld/COFF/Driver.h
  lld/COFF/DriverUtils.cpp
  lld/COFF/Options.td
  lld/docs/ReleaseNotes.rst
  lld/test/COFF/libpath.test
  lld/test/COFF/linkenv.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67456.219761.patch
Type: text/x-patch
Size: 5748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190911/f084be30/attachment.bin>


More information about the llvm-commits mailing list