[LLD][ELF] - Do not remove empty sections referenced in LOADADDR/ADDR commands.
authorGeorge Rimar <grimar@accesssoftek.com>
Fri, 26 Apr 2019 06:59:30 +0000 (06:59 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Fri, 26 Apr 2019 06:59:30 +0000 (06:59 +0000)
commitdee900ae599bf88d89b2e30fb7c94f18e877c1b4
tree6cd0e6d5303b18809910dfdeb3c9145eeb913b9a
parent2aa0bdeb257bff9f6e564d6400294f8441404e18
[LLD][ELF] - Do not remove empty sections referenced in LOADADDR/ADDR commands.

This is https://bugs.llvm.org//show_bug.cgi?id=38750.

If script references empty sections in LOADADDR/ADDR commands

.empty  : { *(.empty ) }
.text   : AT(LOADADDR (.empty) + SIZEOF (.empty)) { *(.text) }
then an empty section will be removed and LOADADDR/ADDR will evaluate to null.
It is not that user may expect from using of the generic script, what is a common case.

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

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