This is an archive of the discontinued LLVM Phabricator instance.

lld-link: Use opt:noref by default in debug builds
AcceptedPublic

Authored by alex.telishev on Aug 24 2017, 1:28 PM.

Details

Reviewers
ruiu
Summary

MSVC linker uses /opt:icf as default in release builds (no /DEBUG) and /opt:noref in debug builds. We should do the same

Diff Detail

Event Timeline

alex.telishev created this revision.Aug 24 2017, 1:28 PM
ruiu added inline comments.Aug 24 2017, 1:31 PM
lld/COFF/Driver.cpp
850–854

Instead of adding a new if, move line 760-766 here and set DoGC and DoICF to false in that if.

Set DoGC and DoICF flags together with Debug

ruiu accepted this revision.Aug 24 2017, 1:49 PM

LGTM

lld/COFF/Driver.cpp
844

It is a bit odd that you mentioned only /opt:noref. I'd probably write a comment:

// /debug implies /opt:noref and /opt:noicf. This is compatible with MSVC.
This revision is now accepted and ready to land.Aug 24 2017, 1:49 PM
ruiu added a comment.Aug 24 2017, 1:49 PM

Sorry, please add a test for this and upload a patch again.

Fixed tests and added test for /DEBUG implying /opt:noref.