This is an archive of the discontinued LLVM Phabricator instance.

Compute value of local symbol with getVA.
ClosedPublic

Authored by rafael on Mar 10 2016, 11:29 AM.

Details

Reviewers
ruiu
Summary

This is the third part of the series to use SymbolBody for locals.

Diff Detail

Event Timeline

rafael retitled this revision from to Compute value of local symbol with getVA..
rafael updated this object.
rafael added a reviewer: ruiu.
rafael added a subscriber: llvm-commits.
ruiu edited edge metadata.Mar 10 2016, 12:19 PM

This is very similar to a change that I have locally.

ELF/Symbols.cpp
79–82

This covers a special case, and I don't think absence of the input section always means that we want TocBase. Can you move this InputSectionBase::relocate like this?

// PPC64 has a special relocation representing the TOC base pointer
// that does not have a corresponding symbol.
if (Config->EMachine == EM_PPC64 && RI.getType(false) == R_PPC64_TOC) {
  uintX_t SymVA = getPPC64TocBase() + A;
  Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA, 0);
  continue;
}
95–98

In this case Addend is taken into consideration.

103

... and adding an addend again? Is this correct?

rafael edited edge metadata.

Implement code review comments.

ruiu added inline comments.Mar 10 2016, 7:15 PM
ELF/Symbols.cpp
33

I think it makes more sense to keep it as a member function of SymbolBody.

ruiu accepted this revision.Mar 10 2016, 7:16 PM
ruiu edited edge metadata.

LGTM given that comment is addressed.

This revision is now accepted and ready to land.Mar 10 2016, 7:16 PM
ruiu added inline comments.Mar 13 2016, 2:03 PM
ELF/Symbols.cpp
103

Addend is passed by reference and a new value may be assigned in getSymVA. So, doesn't this expression depend on the order of evaluation? If Addend is evaluated first and then the function is called, you will get a different value, no?

Eugene.Zelenko added a subscriber: Eugene.Zelenko.

Committed in r263225.