This is an archive of the discontinued LLVM Phabricator instance.

[ELF] -M/-Map: fix VMA/LMA/Size columns of symbol assignments when address/size>=2**32
ClosedPublic

Authored by MaskRay on Apr 3 2020, 5:23 PM.

Details

Summary

SymbolAssignment::addr stores the location counter. The type should be
uint64_t instead of unsigned. The upper half of the address space is
commonly used by operating system kernels.

Similarly, SymbolAssignment::size should be an uint64_t. A kernel linker
script can move the location counter from 0 to the upper half of the
address space.

Diff Detail

Event Timeline

MaskRay created this revision.Apr 3 2020, 5:23 PM
grimar added a comment.Apr 6 2020, 2:08 AM

The code change LG, few comments about the test.

lld/test/ELF/map-file-kernel.s
1 ↗(On Diff #254966)

map-file-kernel.s probably doesn't describe the intention of the test? Not sure why there is "kernel" mentioned.

7 ↗(On Diff #254966)

The second check line looks broken/shifted because of the huge size it seems, isn't?
Are we going to fix it or was your intention just to document this behavior?
(If we want to fix this, I guess it can be done in another patch, but I'd probably add a comment regarding this line then).

11 ↗(On Diff #254966)

Perhaps would be good to add the comment daying what we wanted to test here.
Without knowledge about the code change it is unclear what is tested perhaps.

MaskRay updated this revision to Diff 255403.Apr 6 2020, 10:39 AM
MaskRay marked 4 inline comments as done.

Address comments

MaskRay added inline comments.Apr 6 2020, 11:58 AM
lld/test/ELF/map-file-kernel.s
1 ↗(On Diff #254966)

Renamed to map-file-64bit.s

7 ↗(On Diff #254966)

Just to document the behavior. This is very uncommon. In an arbitrary Linux vmlinux.lds, there is only one such line: there is just one far-distance symbol assignment.

grimar accepted this revision.Apr 7 2020, 3:30 AM

LGTM

This revision is now accepted and ready to land.Apr 7 2020, 3:30 AM
This revision was automatically updated to reflect the committed changes.