[LLD][ELF] - Linkerscript: fix FILL() expressions handling.
authorGeorge Rimar <grimar@accesssoftek.com>
Wed, 10 Jul 2019 14:36:48 +0000 (14:36 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Wed, 10 Jul 2019 14:36:48 +0000 (14:36 +0000)
commitc44a23f8f450bdb8cec784ef0c4f0ca502b7524f
tree6bc41118316a133ac53e230f607b3385138c40db
parentd5214dfa7b5650745eaeb102857c9e90adb16137
[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
lld/ELF/ScriptParser.cpp
lld/test/ELF/linkerscript/fill.test
lld/test/ELF/linkerscript/sections-padding.s