[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / arm-abs32-dyn.s
blob9055aaf46a42f186796abee5a3b4d6e5625bd01f
1 // REQUIRES: arm
2 // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux %s -o %t.o
4 /// Creates a R_ARM_ABS32 relocation against foo and bar, bar has hidden
5 /// visibility so we expect a R_ARM_RELATIVE
6 .syntax unified
7 .globl foo
8 foo:
9 .globl bar
10 .hidden bar
11 bar:
13 .data
14 .word foo
15 .word bar
17 /// In PIC mode, if R_ARM_TARGET1 represents R_ARM_ABS32 (the default), an
18 /// R_ARM_TARGET1 to a non-preemptable symbol also creates an R_ARM_RELATIVE in
19 /// a writable section.
20 .word bar(target1)
22 // RUN: ld.lld -shared -o %t.so %t.o
23 // RUN: llvm-readobj --symbols --dyn-relocations %t.so | FileCheck %s
24 // RUN: llvm-readelf -x .data %t.so | FileCheck --check-prefix=HEX %s
26 // CHECK: Dynamic Relocations {
27 // CHECK-NEXT: 0x30204 R_ARM_RELATIVE
28 // CHECK-NEXT: 0x30208 R_ARM_RELATIVE
29 // CHECK-NEXT: 0x30200 R_ARM_ABS32 foo
30 // CHECK-NEXT: }
32 // CHECK: Symbols [
33 // CHECK: Symbol {
34 // CHECK: Name: bar
35 // CHECK-NEXT: Value: 0x101A8
37 // CHECK: Symbol {
38 // CHECK: Name: foo
39 // CHECK-NEXT: Value: 0x101A8
41 // HEX: 0x00030200 00000000 a8010100 a8010100