[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / mips-got-hilo.s
blob7b89a7937bb20e1ac4306fc91a94883c474d047c
1 # REQUIRES: mips
2 # Check R_MIPS_GOT_HI16 / R_MIPS_GOT_LO16 relocations calculation.
4 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
5 # RUN: ld.lld %t.o -shared -o %t.so
6 # RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck %s
7 # RUN: llvm-readelf -r -s -A %t.so | FileCheck -check-prefix=GOT %s
9 # CHECK: Disassembly of section .text:
10 # CHECK-EMPTY:
11 # CHECK-NEXT: <foo>:
12 # CHECK-NEXT: {{.*}}: lui $2, 0
13 # CHECK-NEXT: {{.*}}: lw $2, -32736($2)
14 # CHECK-NEXT: {{.*}}: lui $2, 0
15 # CHECK-NEXT: {{.*}}: lw $2, -32744($2)
16 # CHECK-NEXT: {{.*}}: lui $2, 0
17 # CHECK-NEXT: {{.*}}: lw $2, -32740($2)
19 # GOT: There are no relocations in this file
21 # GOT: Symbol table '.symtab'
22 # GOT: {{.*}}: [[LOC1:[0-9a-f]+]] {{.*}} loc1
23 # GOT: {{.*}}: [[LOC2:[0-9a-f]+]] {{.*}} loc2
25 # GOT: Primary GOT:
26 # GOT: Local entries:
27 # GOT-NEXT: Address Access Initial
28 # GOT-NEXT: {{.*}} -32744(gp) [[LOC1]]
29 # GOT-NEXT: {{.*}} -32740(gp) [[LOC2]]
30 # GOT-EMPTY:
31 # GOT-NEXT: Global entries:
32 # GOT-NEXT: Address Access Initial Sym.Val. Type Ndx Name
33 # GOT-NEXT: {{.*}} -32736(gp) 00000000 00000000 NOTYPE UND bar
35 .text
36 .global foo
37 foo:
38 lui $2, %got_hi(bar)
39 lw $2, %got_lo(bar)($2)
40 lui $2, %got_hi(loc1)
41 lw $2, %got_lo(loc1)($2)
42 lui $2, %got_hi(loc2)
43 lw $2, %got_lo(loc2)($2)
45 .data
46 loc1:
47 .word 0
48 loc2:
49 .word 0