This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj][obj2yaml] Support custom ELF section header string table name
ClosedPublic

Authored by jhenderson on Jun 10 2021, 7:48 AM.

Details

Summary

This patch adds support for a new field in the FileHeader, which states the name to use for the section header string table. This also allows combining the string table with another string table in the object, e.g. the symbol name string table. The field is optional. By default, .shstrtab will continue to be used.

This partially fixes https://bugs.llvm.org/show_bug.cgi?id=50506.

Diff Detail

Event Timeline

jhenderson created this revision.Jun 10 2021, 7:48 AM
jhenderson requested review of this revision.Jun 10 2021, 7:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 10 2021, 7:48 AM

Fix missed clang-format issue, and unchecked Exception (caused by broken check).

The Exception couldn't possibly fail anyway, as the section names were already checked.

Higuoxing accepted this revision.Jun 15 2021, 10:59 PM

This patch looks great! I think the tests have covered everything.

llvm/lib/ObjectYAML/ELFEmitter.cpp
1926

Nit: finalise -> finalize

llvm/test/tools/obj2yaml/ELF/shstrtab.yaml
27

The value of e_shstrndx is 0xffff, right?

llvm/tools/obj2yaml/elf2yaml.cpp
520
This revision is now accepted and ready to land.Jun 15 2021, 10:59 PM