[PATCH] D39885: Disable GC and ICF when /debug is present

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 10 12:32:44 PST 2017


pcc added a comment.

In https://reviews.llvm.org/D39885#922173, @mstorsjo wrote:

> For the MinGW frontend, we decided to pass `-debug:dwarf` by default, unless the caller passed `-s`. Doesn't this change mean that a user that links without `-s` and then manually strips the binary later would end up with a larger and less optimized binary than if you would have linked it with `-s` in the first place?


I think that for mingw we will want to explicitly pass either `/opt:noref` or `/opt:ref` depending on whether the user passed `--gc-sections`. The same applies to `/opt:icf` and `--icf=all`.



================
Comment at: lld/COFF/Driver.cpp:915
       }
+      if (S == "ref") {
+        Config->DoGC = true;
----------------
I don't think this is right. It will mean that `/debug /opt:ref` will not enable ICF, which doesn't appear to be consistent with what link.exe does.


https://reviews.llvm.org/D39885





More information about the llvm-commits mailing list