[ELF] Don't advance position in a memory region when assigning to the Dot

For memory5.test, ld.bfd appears to ignore `. += 0x2000;`, so the test was testing
a wrong behavior. After deleting the code added in rLLD336335, we match ld.bfd and thus fix PR41357.

PR37836 (memory4.test) seems to have been fixed by another change.

Reviewed By: ruiu

Differential Revision: https://reviews.llvm.org/D62177

llvm-svn: 361228
This commit is contained in:
Fangrui Song 2019-05-21 08:21:44 +00:00
parent 3141bbd52d
commit ecf4c9e13c
2 changed files with 2 additions and 4 deletions

View File

@ -135,8 +135,6 @@ void LinkerScript::setDot(Expr E, const Twine &Loc, bool InSec) {
// Update to location counter means update to section size.
if (InSec)
expandOutputSection(Val - Dot);
else if (Val > Dot)
expandMemoryRegions(Val - Dot);
Dot = Val;
}

View File

@ -5,9 +5,9 @@
# RUN: llvm-objdump -section-headers %t.so | FileCheck %s
# CHECK: 1 .text 00000001 0000000000042000
# CHECK-NEXT: 2 .data 00000001 0000000000044001
# CHECK-NEXT: 2 .data 00000001 0000000000042001
## Test that assign to Dot changes the position in a memory region.
## Test that assigning to Dot does not change the position in a memory region.
MEMORY {
ram (wxa) : ORIGIN = 0x42000, LENGTH = 0x100000