Skip to content

Commit

Permalink
[ELF] Don't advance position in a memory region when assigning to the…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
MaskRay committed May 21, 2019
1 parent 3141bbd commit ecf4c9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions lld/ELF/LinkerScript.cpp
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions lld/test/ELF/linkerscript/memory5.test
Expand Up @@ -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
Expand Down

0 comments on commit ecf4c9e

Please sign in to comment.