This is an archive of the discontinued LLVM Phabricator instance.

Add the /order option.
ClosedPublic

Authored by ruiu on Jan 26 2018, 12:41 PM.

Details

Summary

With the /order option, you can give an order file. An order file
contains symbol names, one per line, and the linker places comdat
sections in that given order. The option is used often to optimize
an output binary for (in particular, startup) speed by improving
locality.

Diff Detail

Repository
rL LLVM

Event Timeline

ruiu created this revision.Jan 26 2018, 12:41 PM
ruiu updated this revision to Diff 131644.Jan 26 2018, 1:06 PM
  • added a missing test file
pcc added inline comments.Jan 26 2018, 1:55 PM
lld/COFF/Driver.cpp
781 ↗(On Diff #131644)

According to https://msdn.microsoft.com/en-us/library/00kh39zz.aspx it looks like the names need to be mangled on 32-bit platforms.

ruiu updated this revision to Diff 131656.Jan 26 2018, 2:15 PM
  • add a comment about "_".
lld/COFF/Driver.cpp
781 ↗(On Diff #131644)

Actually that document is wrong. I added a comment about that.

ruiu updated this revision to Diff 131666.Jan 26 2018, 3:35 PM
  • Fix the underscore issue.
ruiu added a comment.Jan 26 2018, 3:37 PM

As you pointed out, my last comment was wrong. The MSVC linker mangles symbols with "_" if it is on i386 and is not mangled yet.

I tried to add a warning message to warn on unused symbol names in symbol ordering file, but it seems a bit more complicated to do that than I originally thought, so I'll leave it for a follow-up patch.

pcc accepted this revision.Jan 26 2018, 4:26 PM

LGTM

This revision is now accepted and ready to land.Jan 26 2018, 4:26 PM
This revision was automatically updated to reflect the committed changes.