aboutsummaryrefslogtreecommitdiff
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-07-10 14:36:48 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-07-10 14:36:48 +0000
commitc44a23f8f450bdb8cec784ef0c4f0ca502b7524f (patch)
tree6bc41118316a133ac53e230f607b3385138c40db /lld/ELF/ScriptParser.cpp
parentd5214dfa7b5650745eaeb102857c9e90adb16137 (diff)
downloadllvm-c44a23f8f450bdb8cec784ef0c4f0ca502b7524f.zip
llvm-c44a23f8f450bdb8cec784ef0c4f0ca502b7524f.tar.gz
llvm-c44a23f8f450bdb8cec784ef0c4f0ca502b7524f.tar.bz2
[LLD][ELF] - Linkerscript: fix FILL() expressions handling.
D64130 introduced a bug described in the following message: https://reviews.llvm.org/D64130#1571560 The problem can happen with the following script: SECTIONS { .out : { ... FILL(0x10101010) *(.aaa) ... } The current code tries to read (0x10101010) as an expression and does not break when meets *, what results in a script parsing error. In this patch, I verify that FILL command's expression always wrapped in (). And at the same time =<fillexp> expression can be both wrapped or unwrapped. I checked it matches to bfd/gold. Differential revision: https://reviews.llvm.org/D64476 llvm-svn: 365635
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r--lld/ELF/ScriptParser.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index b0f710b..9076a1c 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -828,7 +828,9 @@ OutputSection *ScriptParser::readOutputSectionDescription(StringRef outSec) {
// We handle the FILL command as an alias for =fillexp section attribute,
// which is different from what GNU linkers do.
// https://sourceware.org/binutils/docs/ld/Output-Section-Data.html
+ expect("(");
cmd->filler = readFill();
+ expect(")");
} else if (tok == "SORT") {
readSort();
} else if (tok == "INCLUDE") {