diff options
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r-- | lld/ELF/ScriptParser.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index 6f16c45baab..ff650d8ef87 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -1097,6 +1097,16 @@ Expr ScriptParser::readPrimary() { return Cmd->getLMA(); }; } + if (Tok == "MAX" || Tok == "MIN") { + expect("("); + Expr A = readExpr(); + expect(","); + Expr B = readExpr(); + expect(")"); + if (Tok == "MIN") + return [=] { return std::min(A().getValue(), B().getValue()); }; + return [=] { return std::max(A().getValue(), B().getValue()); }; + } if (Tok == "ORIGIN") { StringRef Name = readParenLiteral(); if (Script->MemoryRegions.count(Name) == 0) { |