This is an archive of the discontinued LLVM Phabricator instance.

[ELF] nmagic or omagic: don't allocate PT_PHDR or PF_R PT_LOAD for the !hasPhdrsCommands case
ClosedPublic

Authored by MaskRay on Sep 7 2019, 10:48 PM.

Details

Summary
part.phdrs = script->hasPhdrsCommands() ? script->createPhdrs() : createPhdrs(part);

createPhdrs() allocates a PT_PHDR and a PF_R PT_LOAD, which will be
deleted later in LinkerScript::allocateHeaders, but leave a gap between
the program headers and the first section. Don't allocate them to avoid
the gap. PT_INTERP is likely not needed as well.

Diff Detail

Repository
rL LLVM

Event Timeline

MaskRay created this revision.Sep 7 2019, 10:48 PM
MaskRay updated this revision to Diff 219288.Sep 8 2019, 11:52 PM
MaskRay edited the summary of this revision. (Show Details)

Delete variable paged

ruiu accepted this revision.Sep 9 2019, 1:23 AM

LGTM

This revision is now accepted and ready to land.Sep 9 2019, 1:23 AM
This revision was automatically updated to reflect the committed changes.