[ELF] - Do not remove empty sections that use symbols in expressions.
authorGeorge Rimar <grimar@accesssoftek.com>
Thu, 1 Mar 2018 12:27:04 +0000 (12:27 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Thu, 1 Mar 2018 12:27:04 +0000 (12:27 +0000)
commitc4df670deaf3dc7f9e560d2a6429e4364334dcf3
treebe13aff08bc44f44386f25321cf2fe3540092298
parentd1cf7ff5abec182785731e6077bfcaa32ea9d5e3
[ELF] - Do not remove empty sections that use symbols in expressions.

This is PR36515.

Currenly if we have a script like .debug_info 0 : { *(.debug_info) },
we would not remove this section and keep it in the output.
That does not work, because it is common case for
debug sections to have a zero address expression.
Patch changes behavior so that we remove only sections
that do not use symbols in its expressions.

Differential revision: https://reviews.llvm.org/D43863

llvm-svn: 326430
lld/ELF/LinkerScript.cpp
lld/ELF/OutputSections.h
lld/ELF/ScriptParser.cpp
lld/test/ELF/linkerscript/empty-sections-expressions.s [new file with mode: 0644]