[PATCH] D77445: [ELF] -M/-Map: fix VMA/LMA/Size columns of symbol assignments when address/size>=2**32
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 3 17:53:44 PDT 2020
MaskRay created this revision.
MaskRay added reviewers: grimar, psmith, ruiu.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77445
Files:
lld/ELF/LinkerScript.h
lld/test/ELF/map-file-kernel.s
Index: lld/test/ELF/map-file-kernel.s
===================================================================
--- /dev/null
+++ lld/test/ELF/map-file-kernel.s
@@ -0,0 +1,15 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o %t.o
+# RUN: ld.lld -M -T %s %t.o -o /dev/null | FileCheck %s --match-full-lines --strict-whitespace
+
+# CHECK: VMA LMA Size Align Out In Symbol
+# CHECK-NEXT: 0 0 ffffffff80000000 1 . = 0xffffffff80000000
+# CHECK-NEXT:ffffffff80000000 0 100000 1 . += 0x100000
+# CHECK-NEXT:ffffffff80100000 0 0 1 _text = .
+# CHECK-NEXT:ffffffff80100000 ffffffff80100000 0 4 .text
+
+SECTIONS {
+ . = 0xffffffff80000000;
+ . += 0x100000;
+ _text = .;
+}
Index: lld/ELF/LinkerScript.h
===================================================================
--- lld/ELF/LinkerScript.h
+++ lld/ELF/LinkerScript.h
@@ -109,11 +109,11 @@
std::string commandString;
// Address of this assignment command.
- unsigned addr;
+ uint64_t addr;
// Size of this assignment command. This is usually 0, but if
// you move '.' this may be greater than 0.
- unsigned size;
+ uint64_t size;
};
// Linker scripts allow additional constraints to be put on output sections.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77445.254966.patch
Type: text/x-patch
Size: 1343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200404/8ddeee08/attachment.bin>
More information about the llvm-commits
mailing list