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
17 lines
487 B
ArmAsm
17 lines
487 B
ArmAsm
# REQUIRES: x86
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
|
# RUN: echo "SECTIONS { .foo : { *(.rela.dyn) } }" > %t.script
|
|
# RUN: ld.lld -T %t.script %t.o -o %t.so -shared
|
|
# RUN: llvm-readobj -r %t.so | FileCheck %s
|
|
|
|
# Check we are able to do custom layout for synthetic sections.
|
|
# (here we check we can place synthetic .rela.dyn into .foo).
|
|
|
|
# CHECK: Relocations [
|
|
# CHECK: Section ({{.*}}) .foo {
|
|
# CHECK: R_X86_64_64 .foo 0x0
|
|
# CHECK: }
|
|
|
|
.data
|
|
.quad .foo
|