Page MenuHomePhabricator

[ELF] Set SectionBase::partition in processSectionCommands
ClosedPublic

Authored by MaskRay on Sep 26 2019, 7:48 AM.

Details

Summary

Fixes PR43461 (regression caused by D67504)

The partition field of a SECTIONS specified section is not set after
D67504. The 0 value affects findSection() which checks if the partition
field is 1.

So, Out::initArray = findSection(".init_array") is null, and
DT_INIT_ARRAYSZ is not set.

Diff Detail

Repository
rL LLVM

Event Timeline

MaskRay created this revision.Sep 26 2019, 7:48 AM

Apart from the fix for the test, LGTM.

test/ELF/linkerscript/dynamic.s
11 ↗(On Diff #221953)

Need to include "-T %t.script" to use the linker script.

MaskRay updated this revision to Diff 221973.Sep 26 2019, 9:39 AM
MaskRay marked an inline comment as done.

Fix the test

LGTM too, one really trivial comment nit but just a readability suggestion so not that important.

ELF/LinkerScript.cpp
516 ↗(On Diff #221973)

Really trivial nit, I think the "as what" would be better as "the same way as" Suggest "Set the partition field the same way OutputSection::recordSection() does."

peter.smith accepted this revision.Sep 26 2019, 9:47 AM

Forgot to accept revision

This revision is now accepted and ready to land.Sep 26 2019, 9:47 AM
MaskRay updated this revision to Diff 221975.Sep 26 2019, 10:06 AM
MaskRay marked 2 inline comments as done.

Reword a comment

MaskRay added inline comments.Sep 26 2019, 10:12 AM
ELF/LinkerScript.cpp
516 ↗(On Diff #221973)

Thanks a lot!

This revision was automatically updated to reflect the committed changes.