diff options
| author | George Rimar <grimar@accesssoftek.com> | 2016-07-26 14:00:10 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2016-07-26 14:00:10 +0000 |
| commit | 528e0bfa12f34d5e1527b0de7039181b335f0bc6 (patch) | |
| tree | 501cbbb374e6ba7f8b14c6927f88d3ec9653df63 | |
| parent | 6151699b086f5610e286a6da0d30c56b124add9b (diff) | |
| download | bcm5719-llvm-528e0bfa12f34d5e1527b0de7039181b335f0bc6.tar.gz bcm5719-llvm-528e0bfa12f34d5e1527b0de7039181b335f0bc6.zip | |
[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
llvm-svn: 276745
| -rw-r--r-- | lld/ELF/LinkerScript.cpp | 2 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/linkerscript-locationcounter.s | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 0ea99200464..c7219f6335e 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -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") { diff --git a/lld/test/ELF/linkerscript/linkerscript-locationcounter.s b/lld/test/ELF/linkerscript/linkerscript-locationcounter.s index 93f7778db69..ac31ca48412 100644 --- a/lld/test/ELF/linkerscript/linkerscript-locationcounter.s +++ b/lld/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: |

