This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Simplify handling of AT section attribute.
ClosedPublic

Authored by ikudrin on Feb 14 2018, 5:04 AM.

Details

Summary

The patch is going to replace the implementation from r323625.

The original implementation adds a section with AT attribute into the same load segment
as a previous section if that segment does not contain a section with a customized LMA.
After that, this attribute affects not only this and following sections, as required by specs,
but also previous sections in that segment.

I believe that a better way is to just start a new segment if we encounter a section
with AT attribute, with the only exception for the very first section, because we have added
header sections in the first load segment. It looks like GNU ld does the same.

Diff Detail

Event Timeline

ikudrin created this revision.Feb 14 2018, 5:04 AM
grimar added inline comments.Feb 14 2018, 5:20 AM
test/ELF/linkerscript/at5.s
10

Seems you forget to remove debug tee %t2.log

10

*forgot

ikudrin updated this revision to Diff 134218.Feb 14 2018, 6:29 AM
  • Remove "tee". Thanks, George!
ikudrin marked 2 inline comments as done.Feb 14 2018, 6:29 AM
ikudrin updated this revision to Diff 134376.Feb 14 2018, 9:03 PM

Update according to Rafael's comments:

  • Replace !FirstLoadSection with Load->LastSec != Out::ProgramHeaders.
  • Add a corresponding comment.
ikudrin accepted this revision.Feb 14 2018, 10:11 PM

Accepted by @rafael in the mailing list.

This revision is now accepted and ready to land.Feb 14 2018, 10:11 PM
This revision was automatically updated to reflect the committed changes.