[lld] r276745 - [ELF] Linkerscript: simplify DATA_SEGMENT_ALIGN evaluation
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 26 07:00:10 PDT 2016
Author: grimar
Date: Tue Jul 26 09:00:10 2016
New Revision: 276745
URL: http://llvm.org/viewvc/llvm-project?rev=276745&view=rev
Log:
[ELF] Linkerscript: simplify DATA_SEGMENT_ALIGN evaluation
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.
Change was suggested by Rafael Ávila de Espíndola
Differential revision: https://reviews.llvm.org/D22807
Modified:
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/test/ELF/linkerscript/linkerscript-locationcounter.s
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=276745&r1=276744&r2=276745&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue Jul 26 09:00:10 2016
@@ -813,7 +813,7 @@ Expr ScriptParser::readPrimary() {
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") {
Modified: lld/trunk/test/ELF/linkerscript/linkerscript-locationcounter.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/linkerscript-locationcounter.s?rev=276745&r1=276744&r2=276745&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/linkerscript-locationcounter.s (original)
+++ lld/trunk/test/ELF/linkerscript/linkerscript-locationcounter.s Tue Jul 26 09:00:10 2016
@@ -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:
More information about the llvm-commits
mailing list