[PATCH] D22807: [ELF] Linkerscript: simplify DATA_SEGMENT_ALIGN evaluation

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 07:00:33 PDT 2016


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar, davide, evgeny777.

As was suggested by Rafael, we can simplify the evaluation of DATA_SEGMENT_ALIGN
just to simple align. That way it will work exactly like we have in non-script case.

This is not really neccessary to support DATA_SEGMENT_RELRO_END, but
since them are relative, I think it is a good start.pouint.

https://reviews.llvm.org/D22807

Files:
  ELF/LinkerScript.cpp
  test/ELF/linkerscript/linkerscript-locationcounter.s

Index: test/ELF/linkerscript/linkerscript-locationcounter.s
===================================================================
--- test/ELF/linkerscript/linkerscript-locationcounter.s
+++ test/ELF/linkerscript/linkerscript-locationcounter.s
@@ -288,7 +288,7 @@
 # CHECK-NEXT:   Flags [
 # CHECK-NEXT:     SHF_ALLOC
 # CHECK-NEXT:   ]
-# CHECK-NEXT:   Address: 0x26008
+# CHECK-NEXT:   Address: 0x26000
 # CHECK-NEXT:   Offset:
 # CHECK-NEXT:   Size:
 # CHECK-NEXT:   Link:
Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -813,7 +813,7 @@
     expect(")");
     return [=](uint64_t Dot) -> uint64_t {
       uint64_t Val = E(Dot);
-      return alignTo(Dot, Val) + (Dot & (Val - 1));
+      return alignTo(Dot, Val);
     };
   }
   if (Tok == "DATA_SEGMENT_END") {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22807.65509.patch
Type: text/x-patch
Size: 883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160726/ba081d92/attachment.bin>


More information about the llvm-commits mailing list