This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho][rfc] Have Symbol::getVA() return a non-relative virtual address
ClosedPublic

Authored by int3 on Apr 14 2020, 4:47 PM.

Details

Summary

Currently, getVA() returns a virtual address with the assumption that
the ImageBase is zero. As I understand, this is what lld-ELF is doing.
However, under our current design, it seems like an awkward setup --
I'm finding that I have to add and subtract ImageBase in several places
to make things work out.

As such, I think it's simpler to have getVA() return a non-relative VA,
but I'm not sure if I'm missing something. Would love to hear more from
folks familiar with lld-ELF.

Diff Detail

Event Timeline

int3 created this revision.Apr 14 2020, 4:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2020, 4:47 PM

I'm in favor of this, since it makes the VA actually be a VA and not an RVA :)

int3 updated this revision to Diff 257860.Apr 15 2020, 2:53 PM

subtract ImageBase for entryoff

smeenai accepted this revision.Apr 24 2020, 12:37 PM

This one needs to be properly stacked, I think.

This revision is now accepted and ready to land.Apr 24 2020, 12:37 PM
This revision was automatically updated to reflect the committed changes.