summaryrefslogtreecommitdiffstats
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r--lld/ELF/ScriptParser.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index 531c61e6cb4..29570c80d2f 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -139,11 +139,13 @@ static void moveAbsRight(ExprValue &A, ExprValue &B) {
static ExprValue add(ExprValue A, ExprValue B) {
moveAbsRight(A, B);
- return {A.Sec, A.ForceAbsolute, A.Val + B.getValue(), A.Loc};
+ uint64_t Val = alignTo(A.Val, A.Alignment) + B.getValue();
+ return {A.Sec, A.ForceAbsolute, Val, A.Loc};
}
static ExprValue sub(ExprValue A, ExprValue B) {
- return {A.Sec, A.Val - B.getValue(), A.Loc};
+ uint64_t Val = alignTo(A.Val, A.Alignment) - B.getValue();
+ return {A.Sec, Val, A.Loc};
}
static ExprValue mul(ExprValue A, ExprValue B) {
OpenPOWER on IntegriCloud