This is an archive of the discontinued LLVM Phabricator instance.

Change our linker script expr representation
ClosedPublic

Authored by rafael on Mar 13 2017, 6:55 AM.

Details

Reviewers
ruiu
Summary

This fixes pr32031 by representing the expressions results as a SectionBase and offset. This allows us to use an input section directly instead of getting lost trying to compute an offset in an outputsection when not all the information is available yet.

This also creates a struct to represent the *value* of and expression, allowing the expression itself to be a simple typedef. I think this is easier to read and will make it easier to extend the expression computation to handle more complicated cases.

Diff Detail

Event Timeline

rafael created this revision.Mar 13 2017, 6:55 AM
ruiu edited edge metadata.Mar 13 2017, 10:51 AM

I'm not a huge fan of operator overloading. That is undeniably convenient and useful in some situations, but for this file this is probably a bit too much. Do you mind if I ask you to do this without operator overloading?

grimar added a subscriber: grimar.Mar 14 2017, 8:47 AM
rafael updated this revision to Diff 91997.Mar 16 2017, 6:56 AM

Rebased again.

Given that this fixes a bug, opens the way to fix more bugs with regards to what is or is not absolute, and the only disagreement is on the use of operator overloading, I would like to request that

  • We check this in
  • I will try to fix more cases and add diagnostics on invalid expressions.
  • We then discuss alternative proposals to operator overloading.

getting phab to send email

rafael updated this revision to Diff 92089.Mar 16 2017, 5:29 PM

Avoid operator overloading by renaming the functions.

ruiu accepted this revision.Mar 16 2017, 5:47 PM

LGTM

This revision is now accepted and ready to land.Mar 16 2017, 5:47 PM