summaryrefslogtreecommitdiffstats
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-04-26 06:59:30 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-04-26 06:59:30 +0000
commitdee900ae599bf88d89b2e30fb7c94f18e877c1b4 (patch)
tree6cd0e6d5303b18809910dfdeb3c9145eeb913b9a /lld/ELF/ScriptParser.cpp
parent2aa0bdeb257bff9f6e564d6400294f8441404e18 (diff)
downloadbcm5719-llvm-dee900ae599bf88d89b2e30fb7c94f18e877c1b4.tar.gz
bcm5719-llvm-dee900ae599bf88d89b2e30fb7c94f18e877c1b4.zip
[LLD][ELF] - Do not remove empty sections referenced in LOADADDR/ADDR commands.
This is https://bugs.llvm.org//show_bug.cgi?id=38750. If script references empty sections in LOADADDR/ADDR commands .empty : { *(.empty ) } .text : AT(LOADADDR (.empty) + SIZEOF (.empty)) { *(.text) } then an empty section will be removed and LOADADDR/ADDR will evaluate to null. It is not that user may expect from using of the generic script, what is a common case. Differential revision: https://reviews.llvm.org/D54621 llvm-svn: 359279
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 783d20c2025..741b32ff031 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -1154,6 +1154,7 @@ Expr ScriptParser::readPrimary() {
if (Tok == "ADDR") {
StringRef Name = readParenLiteral();
OutputSection *Sec = Script->getOrCreateOutputSection(Name);
+ Sec->UsedInExpression = true;
return [=]() -> ExprValue {
checkIfExists(Sec, Location);
return {Sec, false, 0, Location};
@@ -1230,6 +1231,7 @@ Expr ScriptParser::readPrimary() {
if (Tok == "LOADADDR") {
StringRef Name = readParenLiteral();
OutputSection *Cmd = Script->getOrCreateOutputSection(Name);
+ Cmd->UsedInExpression = true;
return [=] {
checkIfExists(Cmd, Location);
return Cmd->getLMA();
OpenPOWER on IntegriCloud