[PATCH] D39216: [COFF] Clean up boolean flag handling

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 23 16:35:59 PDT 2017


smeenai created this revision.

LLD's handling of boolean flags is suboptimal:

- All boolean flags have a corresponding `:no` flag to turn the flag off, and the linker should scan for both the non-suffixed and suffixed flags (and the last one should win), but right now it only scans for either the suffixed or non-suffixed flag (depending on the default flag value).
- The `B` multiclass only allows specifying help text for the suffixed (`:no`) flag, but for some flags (e.g. `/appcontainer`) the help text should be associated with the non-suffixed flag instead.

Extend the `B` multiclass to have help text for both non-suffixed and
suffixed flag variants, and alter the existing help text accordingly in
some cases. Scan for both the non-suffixed and suffixed variants in the
driver and set config values accordingly.

This should mostly have no behavior change, apart from the added help
text and the modified argument scanning. Some flags are handled slightly
differently now, however; for example, LLD would previously always treat
64-bit images as large address aware, whereas `/largeaddressaware:no` is
now respected for 64-bit images (which is also how link.exe behaves).


https://reviews.llvm.org/D39216

Files:
  COFF/Driver.cpp
  COFF/Options.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39216.119969.patch
Type: text/x-patch
Size: 6306 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171023/39282d00/attachment.bin>


More information about the llvm-commits mailing list