[ELF] - Do not ignore discarding of .rela.plt/.rela.dyn, allow doing custom layout...
authorGeorge Rimar <grimar@accesssoftek.com>
Sat, 24 Mar 2018 13:10:19 +0000 (13:10 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Sat, 24 Mar 2018 13:10:19 +0000 (13:10 +0000)
commitd8281379f97a3e63ac7ab16582c5f81cd01baba9
tree2b6b02f3e6856f9f24f68c02c96e7068a0bc2fb7
parent96d81916b05c32b475fc8e7d77dda1485068c1d0
[ELF] - Do not ignore discarding of .rela.plt/.rela.dyn, allow doing custom layout for them.

Currently when we build input sections list in linker script
we ignore all rel[a] sections. That was done to support
scripts like .rela.dyn : { *(.rela.data) } for emit relocs.

Though as a result following scripts were also silently ignored:

/DISCARD/ : { *(.rela.plt)
/DISCARD/ : { *(.rela.dyn)

and we produced output with this sections. That is not ideal.
The solution this patch suggests is simple: do not ignore synthetic
rel[a] sections. That way we can enable common discarding logic
for them and report a proper error.

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

llvm-svn: 328419
lld/ELF/LinkerScript.cpp
lld/test/ELF/linkerscript/discard-section-err.s
lld/test/ELF/linkerscript/synthetic-relsec-layout.s [new file with mode: 0644]