This is an archive of the discontinued LLVM Phabricator instance.

[COFF] Update comment to reflect link.exe behavior. NFC
ClosedPublic

Authored by smeenai on Jan 26 2018, 2:51 PM.

Details

Summary

In my experimentation with link.exe from both VS 2015 and 2017, it
always produces images with truncated section names. Update the comment
accordingly.

Diff Detail

Repository
rL LLVM

Event Timeline

smeenai created this revision.Jan 26 2018, 2:51 PM

I'm putting this up for review mostly so that someone else can also confirm that link.exe always truncates section names.

ruiu added a comment.Jan 26 2018, 2:56 PM

I think what the original comment was trying to say is, emitting preserving a long section name (by emitting /<N> as the section name and put the real name at the N byte in the symbol table) would be useful for libunwind, though that's different from what we are doing now and what MSVC does.

In D42603#989622, @ruiu wrote:

I think what the original comment was trying to say is, emitting preserving a long section name (by emitting /<N> as the section name and put the real name at the N byte in the symbol table) would be useful for libunwind, though that's different from what we are doing now and what MSVC does.

IIRC the motivation for this change was actually the opposite. libunwind needed to determine the eh_frame section at runtime, but wasn't able to do so because of the string table not being loaded. @mstorsjo can confirm when he sees this though.

ruiu accepted this revision.Jan 26 2018, 3:02 PM

Ah, right. Looks like we can avoid confusion by not mentioning libunwind at all here. LGTM

Thank you for doing this.

This revision is now accepted and ready to land.Jan 26 2018, 3:02 PM

LGTM. I confirmed this with link.exe with the test case from long-section-names.test. I don't remember what I originally tested, that the previous comment was based on - maybe it was just a mixup.

This revision was automatically updated to reflect the committed changes.
rnk added a comment.Jan 29 2018, 9:50 AM

MSVC always truncates, but the BFD linker doesn't. The extra string table in the executable is their idea. The comments should reflect that.