From 2bb8c54eec9b9460a04c0e1bb76826cdf327948f Mon Sep 17 00:00:00 2001 From: Matt Schulte Date: Sat, 28 Mar 2020 09:54:06 -0700 Subject: [PATCH] [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 --- lld/ELF/ScriptParser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index fd8de3b54bd72d..80ec8b655b0413 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;