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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 00:47:12 PDT 2019


MaskRay created this revision.
MaskRay added reviewers: grimar, peter.smith, ruiu.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

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

PR37836 seems to have been fixed by another change.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D62177

Files:
  ELF/LinkerScript.cpp
  test/ELF/linkerscript/memory5.test


Index: test/ELF/linkerscript/memory5.test
===================================================================
--- test/ELF/linkerscript/memory5.test
+++ test/ELF/linkerscript/memory5.test
@@ -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 assign to Dot does not change the position in a memory region.
 
 MEMORY {
   ram (wxa) : ORIGIN = 0x42000, LENGTH = 0x100000
Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -135,8 +135,6 @@
   // Update to location counter means update to section size.
   if (InSec)
     expandOutputSection(Val - Dot);
-  else if (Val > Dot)
-    expandMemoryRegions(Val - Dot);
 
   Dot = Val;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62177.200418.patch
Type: text/x-patch
Size: 1006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190521/a53fba2b/attachment.bin>


More information about the llvm-commits mailing list