[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / emit-reloc.s
blob0f3c7b85751122d48e6299a644efdac5913c75af
1 # REQUIRES: x86
2 ## Test that input SHT_REL[A] retained by --emit-relocs are not matched by input section descriptions.
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
5 # RUN: echo "SECTIONS { .rela.dyn : { *(.rela.data) } }" > %t.script
6 # RUN: ld.lld --hash-style=sysv -T %t.script --emit-relocs %t.o -o %t.so -shared
7 # RUN: llvm-readobj -r %t.so | FileCheck %s
9 ## .rela.data is not listed, but don't error.
10 # RUN: echo 'SECTIONS { \
11 # RUN: .dynsym : { *(.dynsym) } \
12 # RUN: .gnu.hash : { *(.gnu.hash) } \
13 # RUN: .hash : { *(.hash) } \
14 # RUN: .dynstr : { *(.dynstr) } \
15 # RUN: .dynamic : { *(.dynamic) } \
16 # RUN: .rela.dyn : { *(.rela.dyn) } \
17 # RUN: .text : { *(.text) } \
18 # RUN: .data : { *(.data) } \
19 # RUN: .comment : { *(.comment) } \
20 # RUN: .symtab : { *(.symtab) } \
21 # RUN: .shstrtab : { *(.shstrtab) } \
22 # RUN: .strtab : { *(.strtab) } \
23 # RUN: }' > %t1.script
24 # RUN: ld.lld -T %t1.script -shared --emit-relocs %t.o --orphan-handling=error -o /dev/null
26 .data
27 .quad .foo
29 # CHECK: Relocations [
30 # CHECK-NEXT: Section ({{.*}}) .rela.dyn {
31 # CHECK-NEXT: 0xF8 R_X86_64_64 .foo 0x0
32 # CHECK-NEXT: }
33 # CHECK-NEXT: Section ({{.*}}) .rela.data {
34 # CHECK-NEXT: 0xF8 R_X86_64_64 .foo 0x0
35 # CHECK-NEXT: }
36 # CHECK-NEXT: ]