summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LinkerScript.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-06-03 05:34:25 +0000
committerFangrui Song <maskray@google.com>2019-06-03 05:34:25 +0000
commitabb7484c31d5346c5f7b06fb65549b0fef75dccf (patch)
treef5ab5af255663b56ff87a9fe04c3912f6b578a5a /lld/ELF/LinkerScript.cpp
parentc78c999a9cd7a77b9d13c610c9faebac5d560a55 (diff)
downloadbcm5719-llvm-abb7484c31d5346c5f7b06fb65549b0fef75dccf.tar.gz
bcm5719-llvm-abb7484c31d5346c5f7b06fb65549b0fef75dccf.zip
[ELF] Don't create an output section named `/DISCARD/` if it is assigned to the special phdr `NONE`
Fixes the remaining issue of PR41673 after D61186: with `/DISCARD/ { ... } :NONE`, we may create an output section named `/DISCARD/`. Note, if an input section is named `/DISCARD/`, ld.bfd discards it but lld keeps it. It is probably not worth copying this behavior as it is unrealistic. Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D62768 llvm-svn: 362356
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
-rw-r--r--lld/ELF/LinkerScript.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index a6354c841c2..3f68e6eff87 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -824,6 +824,9 @@ void LinkerScript::assignOffsets(OutputSection *Sec) {
}
static bool isDiscardable(OutputSection &Sec) {
+ if (Sec.Name == "/DISCARD/")
+ return true;
+
// We do not remove empty sections that are explicitly
// assigned to any segment.
if (!Sec.Phdrs.empty())
OpenPOWER on IntegriCloud