[LLD][ELF] - Linkerscript: add a support for expressions for section's filling
authorGeorge Rimar <grimar@accesssoftek.com>
Thu, 4 Jul 2019 14:17:31 +0000 (14:17 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Thu, 4 Jul 2019 14:17:31 +0000 (14:17 +0000)
commit0810f16fb9e89e9d7809a0e9a9a7296b35f8ef27
treeb2a2fcb49c589094292451aedb59496872cf7507
parent85fc597f26c81a187c5514d47ee997bc2ea87b1c
[LLD][ELF] - Linkerscript: add a support for expressions for section's filling

Imagine the script:

.section: {
...
} = FILL_EXPR
LLD assumes that FILL_EXPR is a number, and does not allow
it to be an expression. Though that is allowed by specification:
https://sourceware.org/binutils/docs-2.32/ld/Output-Section-Fill.html

This patch adds a support for cases when FILL_EXPR is simple math expression.

Fixes https://bugs.llvm.org/show_bug.cgi?id=42482.

Differential revision: https://reviews.llvm.org/D64130

llvm-svn: 365143
lld/ELF/ScriptLexer.cpp
lld/ELF/ScriptParser.cpp
lld/test/ELF/linkerscript/fill.test
lld/test/ELF/linkerscript/sections-padding.s