This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj] - Map section names to chunks for each ELFYAML::ProgramHeader early. NFCI.
ClosedPublic

Authored by grimar on May 25 2020, 7:39 AM.

Details

Summary

Each ELFYAML::ProgramHeader currently contains a list of section names
included. We are trying to map them to Fill/Sections very late,
though we can create such mapping early, in initProgramHeaders.

The benefit is that with such change it is possible to access mapped
chunks earlier (for example during writing section content) and have
simpler code.

(I am working on a patch to allocate a file space for no-bits sections
if there are non-nobits sections in a segment that follows them. It needs
such change to avoid code duplication).

Diff Detail

Event Timeline

grimar created this revision.May 25 2020, 7:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2020, 7:39 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
MaskRay accepted this revision.May 25 2020, 11:14 AM

LGTM.

This revision is now accepted and ready to land.May 25 2020, 11:14 AM
jhenderson accepted this revision.May 26 2020, 1:56 AM

LGTM, with one suggestion.

llvm/include/llvm/ObjectYAML/ELFYAML.h
503–506

Up to you, but maybe:

Optional<llvm::yaml::Hex64> Offset;

std::vector<SectionName> Sections;
// This vector is parallel to Sections and contains corresponding chunks.
std::vector<Chunk *> Chunks;
grimar marked 2 inline comments as done.May 26 2020, 2:32 AM
grimar added inline comments.
llvm/include/llvm/ObjectYAML/ELFYAML.h
503–506

OK.

This revision was automatically updated to reflect the committed changes.
grimar marked an inline comment as done.