This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj][COFF] Add support for extended relocation tables
ClosedPublic

Authored by sdmitriev on Nov 14 2019, 9:36 AM.

Details

Summary

The tool does not correctly handle COFF sections with extended relocation tables (with IMAGE_SCN_LNK_NRELOC_OVFL bit set), this patch fixes this problem.

But I have cheated a bit in the test (to make it smaller) because extended relocation table is supposed to be used when the number of relocations exceeds 65534. Otherwise the test size would be pretty big.

Diff Detail

Event Timeline

sdmitriev created this revision.Nov 14 2019, 9:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 14 2019, 9:36 AM
MaskRay added inline comments.Nov 14 2019, 10:40 AM
llvm/lib/ObjectYAML/COFFEmitter.cpp
515

Be consistent: /*Type=*/

llvm/test/tools/yaml2obj/coff-xrelocs.yaml
2

A file-level comment about the purpose of the test. The mapping xrelocs -> extended relocation table is not very obvious.

Maybe it is time to place binary format specific tests in their own directories, and for this one, COFF/?

sdmitriev marked an inline comment as done.

Addressed review comments.

llvm/test/tools/yaml2obj/coff-xrelocs.yaml
2

A file-level comment about the purpose of the test. The mapping xrelocs -> extended relocation table is not very obvious.

Done.

Maybe it is time to place binary format specific tests in their own directories, and for this one, COFF/?

This should probably be done in separate commit.

This revision is now accepted and ready to land.Nov 14 2019, 11:45 AM
This revision was automatically updated to reflect the committed changes.
MaskRay added inline comments.Nov 14 2019, 1:04 PM
llvm/test/tools/yaml2obj/coff-xrelocs.yaml
2

I have created https://reviews.llvm.org/D70264 to reorganize the tests.