This is an archive of the discontinued LLVM Phabricator instance.

[LLD] [COFF] Always include the size of the string table size field
ClosedPublic

Authored by mstorsjo on Nov 10 2017, 1:57 AM.

Details

Summary

Even if we don't actually write any string table contents, the 4 byte size for the string table will always be written. Make sure we accommodate for this in the file size. Since this size is aligned up, this would seldom be an issue in practice.

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.Nov 10 2017, 1:57 AM
ruiu accepted this revision.Nov 13 2017, 2:10 AM

LGTM, but please add a testcase before committing.

This revision is now accepted and ready to land.Nov 13 2017, 2:10 AM
mstorsjo updated this revision to Diff 122905.Nov 14 2017, 1:32 PM

Here's a testcase for this issue. In practice it's clearly pathological, but still - with this testcase, LLD would earlier output a broken file, as detected by both llvm-readobj and dumpbin.exe. Will commit in a while since it's already approved.

This revision was automatically updated to reflect the committed changes.