summaryrefslogtreecommitdiffstats
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
authorMatt Schulte <schultetwin1@gmail.com>2020-03-28 09:54:06 -0700
committerFangrui Song <maskray@google.com>2020-06-16 19:45:27 -0700
commitb980cc1cd3200dbf7603c7dd04335165b7578baa (patch)
treefb839ac5f3b2d7d86bb5300c5db20553a3466f40 /lld/ELF/ScriptParser.cpp
parenta85165ccb9cf05a31a9e33defdd9baff5a6d55f7 (diff)
downloadbcm5719-llvm-b980cc1cd3200dbf7603c7dd04335165b7578baa.tar.gz
bcm5719-llvm-b980cc1cd3200dbf7603c7dd04335165b7578baa.zip
[lld][ELF] Mark empty NOLOAD output sections SHT_NOBITS instead of SHT_PROGBITS
This fixes PR# 45336. Output sections described in a linker script as NOLOAD with no input sections would be marked as SHT_PROGBITS. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D76981 (cherry picked from commit fdc41aa22c60958e6b6df461174b814a4aae3384)
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r--lld/ELF/ScriptParser.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index fd8de3b54bd..80ec8b655b0 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -737,6 +737,7 @@ bool ScriptParser::readSectionDirective(OutputSection *cmd, StringRef tok1, Stri
expect("(");
if (consume("NOLOAD")) {
cmd->noload = true;
+ cmd->type = SHT_NOBITS;
} else {
skip(); // This is "COPY", "INFO" or "OVERLAY".
cmd->nonAlloc = true;
OpenPOWER on IntegriCloud