This is an archive of the discontinued LLVM Phabricator instance.

COFF: Merge .idata, .didat and .edata into .rdata by default.
ClosedPublic

Authored by pcc on Apr 17 2018, 2:17 PM.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

pcc created this revision.Apr 17 2018, 2:17 PM
pcc added inline comments.Apr 17 2018, 2:18 PM
lld/test/COFF/pdb-publics-import.test
39 ↗(On Diff #142828)

This is the only weird thing in the test updates.

@zturner I'm not sure if this is a pre-existing problem with our pdb emission?

pcc added inline comments.Apr 17 2018, 2:31 PM
lld/test/COFF/pdb-publics-import.test
39 ↗(On Diff #142828)

Actually looks like it was an off-by-one error in llvm-pdbutil -- fix incoming

zturner added inline comments.Apr 17 2018, 2:37 PM
lld/test/COFF/pdb-publics-import.test
39 ↗(On Diff #142828)

I don't know if this is a pre-existing problem, it may be due to the patch.

Short version: can you run llvm-pdbutil dump -section-headers on the new PDB? My guess is that you will see less than 2 sections here. At the very least, comparing the output of the tool with this option before and after your patch should provide a clue.

Long version: The printing code here is using the section index (the 2 from 0002:0000) as an index into a list of section names.

It generates this list of section names by looking in the "optional debug stream array" in the DBI stream of the PDB. Essentially this is an array of stream indices, where each array index has a special hardcoded meaning. One of these (at index DbgHeaderType::SectionHdr, whose value is I think 5) represents the index of a stream which contains a list of section headers.

So the printing code looks at index 5 in this array, loads the specified stream, gets the list of section header, and then reads the second one.

If there are less than 2 though, it will print ??? for the section name.

So my suspicion is that something about this patch is causing only 1 entry to be written here instead of 2.

In LLD, this is set on this line:

// Add COFF section header stream.
ExitOnErr(
    DbiBuilder.addDbgStream(pdb::DbgHeaderType::SectionHdr, SectionTable));

So check there and see that SectionTable contains the proper list of sections.

39 ↗(On Diff #142828)

Oh cool. Could be that too :)

pcc updated this revision to Diff 142837.Apr 17 2018, 2:41 PM
  • Revert change to pdb-publics-import.test
ruiu accepted this revision.Apr 17 2018, 2:43 PM

LGTM

This revision is now accepted and ready to land.Apr 17 2018, 2:43 PM
This revision was automatically updated to reflect the committed changes.