[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / relocation-copy-relro.s
blob91994501a301dbde837da5dc52bb4d56907a3a45
1 // REQUIRES: x86
3 // Reserve space for copy relocations of read-only symbols in .bss.rel.ro
5 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
6 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/relocation-copy-relro.s -o %t2.o
7 // RUN: ld.lld -shared %t2.o -soname=so -o %t.so
8 // RUN: ld.lld %t.o %t.so -o %t3
9 // RUN: llvm-readobj -S -l -r %t3 | FileCheck %s
11 // CHECK: Name: .bss.rel.ro
12 // CHECK-NEXT: Type: SHT_NOBITS (0x8)
13 // CHECK-NEXT: Flags [ (0x3)
14 // CHECK-NEXT: SHF_ALLOC (0x2)
15 // CHECK-NEXT: SHF_WRITE (0x1)
16 // CHECK-NEXT: ]
17 // CHECK-NEXT: Address: 0x202368
18 // CHECK-NEXT: Offset: 0x368
19 // CHECK-NEXT: Size: 8
21 // CHECK: Type: PT_GNU_RELRO (0x6474E552)
22 // CHECK-NEXT: Offset: 0x2A8
23 // CHECK-NEXT: VirtualAddress: 0x2022A8
24 // CHECK-NEXT: PhysicalAddress: 0x2022A8
25 // CHECK-NEXT: FileSize: 192
26 // CHECK-NEXT: MemSize: 3416
28 // CHECK: 0x202368 R_X86_64_COPY a 0x0
29 // CHECK: 0x20236C R_X86_64_COPY b 0x0
31 .text
32 .global _start
33 _start:
34 movl $1, a
35 movl $2, b