[ELF] Don't create an output section named `/DISCARD/` if it is assigned to the speci...
authorFangrui Song <maskray@google.com>
Mon, 3 Jun 2019 05:34:25 +0000 (05:34 +0000)
committerFangrui Song <maskray@google.com>
Mon, 3 Jun 2019 05:34:25 +0000 (05:34 +0000)
commitabb7484c31d5346c5f7b06fb65549b0fef75dccf
treef5ab5af255663b56ff87a9fe04c3912f6b578a5a
parentc78c999a9cd7a77b9d13c610c9faebac5d560a55
[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
lld/ELF/LinkerScript.cpp
lld/test/ELF/linkerscript/discard-phdr.s