[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / relative-dynamic-reloc-pie.s
blob00b6ae5f290349cbf2c4b88c372eb7ed65261fad
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3 # RUN: ld.lld -pie %t.o -o %t.pie
4 # RUN: llvm-readobj -r --dyn-syms %t.pie | FileCheck %s
6 ## Test that we create R_X86_64_RELATIVE relocations with -pie.
7 # CHECK: Relocations [
8 # CHECK-NEXT: Section ({{.*}}) .rela.dyn {
9 # CHECK-NEXT: 0x[[FOO_ADDR:.*]] R_X86_64_RELATIVE - 0x[[FOO_ADDR]]
10 # CHECK-NEXT: 0x[[#%X,BAR_ADDR:]] R_X86_64_RELATIVE
11 # CHECK-SAME: - 0x[[#BAR_ADDR]]
12 # CHECK-NEXT: 0x[[#BAR_ADDR + 8]] R_X86_64_RELATIVE - 0x[[#BAR_ADDR + 1]]
13 # CHECK-NEXT: }
14 # CHECK-NEXT: ]
16 .globl _start
17 _start:
18 nop
20 .data
21 foo:
22 .quad foo
24 .hidden bar
25 .global bar
26 bar:
27 .quad bar
28 .quad bar + 1