This is an archive of the discontinued LLVM Phabricator instance.

Change how we compute offsets with linker scripts
ClosedPublic

Authored by rafael on Sep 14 2016, 11:26 AM.

Details

Summary

This fixes pr30367, but more importantly, it changes how we compute offsets.

Now offset computation in a walk over linker script commands, like the rest of assignAddresses. IMHO this is simpler to understand and if we ever have to create mulitple outputsections or chunks to change how we handle test/ELF/linkerscript/alternate-sections.s it should be easier to do it.

Diff Detail

Event Timeline

rafael retitled this revision from to Change how we compute offsets with linker scripts.
rafael updated this object.
rafael added reviewers: evgeny777, ruiu, grimar.
rafael added a subscriber: llvm-commits.
ruiu added inline comments.Sep 14 2016, 12:47 PM
ELF/LinkerScript.cpp
149

Update this comment.

151–152

get is not an appropriate prefix for this function as this now returns nothing.

160

Remove V and add directly to I->Sections? V seems useless.

165–166

clear and then early return?

321–323

You can remove the second insert.

evgeny777 accepted this revision.Sep 15 2016, 2:23 AM
evgeny777 edited edge metadata.

Great, it fixes my problem with merging R/W/X sections! LGTM

This revision is now accepted and ready to land.Sep 15 2016, 2:23 AM
grimar added inline comments.Sep 15 2016, 3:54 AM
ELF/LinkerScript.cpp
334

Not sure but may do something with this comment as it is not so clear anymore which for-loop is mentioned.