summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/LinkerScript.cpp2
-rw-r--r--lld/test/ELF/linkerscript/no-space.s4
-rw-r--r--lld/test/ELF/linkerscript/va.s6
3 files changed, 8 insertions, 4 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index b979d06b927..5cdee7082e1 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -595,7 +595,7 @@ void LinkerScript<ELFT>::assignAddresses(std::vector<PhdrEntry<ELFT>> &Phdrs) {
}
// Assign addresses as instructed by linker script SECTIONS sub-commands.
- Dot = getHeaderSize();
+ Dot = 0;
for (const std::unique_ptr<BaseCommand> &Base : Opt.Commands) {
if (auto *Cmd = dyn_cast<SymbolAssignment>(Base.get())) {
diff --git a/lld/test/ELF/linkerscript/no-space.s b/lld/test/ELF/linkerscript/no-space.s
index 9291109f6f2..a96797269e4 100644
--- a/lld/test/ELF/linkerscript/no-space.s
+++ b/lld/test/ELF/linkerscript/no-space.s
@@ -5,6 +5,10 @@
# RUN: ld.lld -o %t --script %t.script %t.o -shared
# RUN: llvm-readobj -elf-output-style=GNU -l %t | FileCheck %s
+# RUN: echo "SECTIONS {foo : {*(foo*)} }" > %t.script
+# RUN: ld.lld -o %t --script %t.script %t.o -shared
+# RUN: llvm-readobj -elf-output-style=GNU -l %t | FileCheck %s
+
# There is not enough address space available for the header, so just start the PT_LOAD
# after it.
diff --git a/lld/test/ELF/linkerscript/va.s b/lld/test/ELF/linkerscript/va.s
index 8d25c833ec3..854ebcef014 100644
--- a/lld/test/ELF/linkerscript/va.s
+++ b/lld/test/ELF/linkerscript/va.s
@@ -7,9 +7,9 @@
# CHECK: Sections:
# CHECK-NEXT: Idx Name Size Address Type
# CHECK-NEXT: 0 00000000 0000000000000000
-# CHECK-NEXT: 1 .text 00000001 00000000000000e8 TEXT DATA
-# CHECK-NEXT: 2 .foo 00000004 00000000000000e9 DATA
-# CHECK-NEXT: 3 .boo 00000004 00000000000000ed DATA
+# CHECK-NEXT: 1 .text 00000001 0000000000000000 TEXT DATA
+# CHECK-NEXT: 2 .foo 00000004 0000000000000001 DATA
+# CHECK-NEXT: 3 .boo 00000004 0000000000000005 DATA
.global _start
_start:
OpenPOWER on IntegriCloud