diff options
Diffstat (limited to 'contrib/llvm-project/lld/ELF/ScriptParser.cpp')
-rw-r--r-- | contrib/llvm-project/lld/ELF/ScriptParser.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/llvm-project/lld/ELF/ScriptParser.cpp b/contrib/llvm-project/lld/ELF/ScriptParser.cpp index 4d73541b3d42..7fc50b293b15 100644 --- a/contrib/llvm-project/lld/ELF/ScriptParser.cpp +++ b/contrib/llvm-project/lld/ELF/ScriptParser.cpp @@ -1392,7 +1392,7 @@ Expr ScriptParser::readPrimary() { Expr e = readExpr(); if (consume(")")) { e = checkAlignment(e, location); - return [=] { return alignTo(script->getDot(), e().getValue()); }; + return [=] { return alignToPowerOf2(script->getDot(), e().getValue()); }; } expect(","); Expr e2 = checkAlignment(readExpr(), location); @@ -1423,7 +1423,8 @@ Expr ScriptParser::readPrimary() { expect(")"); seenDataAlign = true; return [=] { - return alignTo(script->getDot(), std::max((uint64_t)1, e().getValue())); + uint64_t align = std::max(uint64_t(1), e().getValue()); + return (script->getDot() + align - 1) & -align; }; } if (tok == "DATA_SEGMENT_END") { @@ -1443,7 +1444,7 @@ Expr ScriptParser::readPrimary() { expect(")"); seenRelroEnd = true; Expr e = getPageSize(); - return [=] { return alignTo(script->getDot(), e().getValue()); }; + return [=] { return alignToPowerOf2(script->getDot(), e().getValue()); }; } if (tok == "DEFINED") { StringRef name = unquote(readParenLiteral()); |