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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 01:21:44 PDT 2019


Author: maskray
Date: Tue May 21 01:21:44 2019
New Revision: 361228

URL: http://llvm.org/viewvc/llvm-project?rev=361228&view=rev
Log:
[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

Modified:
    lld/trunk/ELF/LinkerScript.cpp
    lld/trunk/test/ELF/linkerscript/memory5.test

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=361228&r1=361227&r2=361228&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue May 21 01:21:44 2019
@@ -135,8 +135,6 @@ void LinkerScript::setDot(Expr E, const
   // Update to location counter means update to section size.
   if (InSec)
     expandOutputSection(Val - Dot);
-  else if (Val > Dot)
-    expandMemoryRegions(Val - Dot);
 
   Dot = Val;
 }

Modified: lld/trunk/test/ELF/linkerscript/memory5.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/memory5.test?rev=361228&r1=361227&r2=361228&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/memory5.test (original)
+++ lld/trunk/test/ELF/linkerscript/memory5.test Tue May 21 01:21:44 2019
@@ -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




More information about the llvm-commits mailing list