This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Allow TargetLayout descendants to control assignment sections to segments
ClosedPublic

Authored by atanasyan on Apr 21 2015, 10:30 AM.

Details

Reviewers
ruiu
shankarke
Summary

The TargetLayout class puts two sections into the same segment if they have equal segment types and the same section flags (SHF_xxx). To be able to merge some sort of sections into the same segment we drop some flags before comparison. For example to merge string sections into Data segment we drop SHF_STRINGS and SHF_MERGE flags.

The patch allows TargetLayout descendants to drop some target specific section flags. MIPS target needs that to merge .MIPS.options section which has SHF_MIPS_NOSTRIP flag into the LOAD segment.

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan updated this revision to Diff 24142.Apr 21 2015, 10:30 AM
atanasyan retitled this revision from to [ELF] Allow TargetLayout descendants to control assignment sections to segments.
atanasyan updated this object.
atanasyan edited the test plan for this revision. (Show Details)
atanasyan added reviewers: ruiu, shankarke.
atanasyan set the repository for this revision to rL LLVM.
atanasyan added a project: lld.
atanasyan added a subscriber: Unknown Object (MLST).
ruiu accepted this revision.Apr 21 2015, 10:35 AM
ruiu edited edge metadata.

LGTM

lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h
87

I guess you can remove <ELFT> from this line.

lib/ReaderWriter/ELF/TargetLayout.cpp
334

nit: remove () around the _ctx.mergeRODataToTextSegment(). Also remove outermost () (the entire if condition is doubly parenthesized).

342

Remove this blank line.

This revision is now accepted and ready to land.Apr 21 2015, 10:35 AM
shankarke accepted this revision.Apr 21 2015, 11:04 AM
shankarke edited edge metadata.
atanasyan added inline comments.Apr 22 2015, 1:00 AM
lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h
87

MipsTargetLayout is a template class and if I remove <ELFT> I get "'TargetLayout' is not a class, namespace, or enumeration" error.

atanasyan closed this revision.Apr 22 2015, 1:06 AM

Thanks for review.

Closed by commit rL235487.