[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / mips-hilo-gp-disp.s
blob3be462c94fb49e29808b5ef366959146244e1e45
1 # REQUIRES: mips
2 # Check R_MIPS_HI16 / LO16 relocations calculation against _gp_disp.
4 # RUN: echo "SECTIONS { \
5 # RUN: . = 0x10000; .text ALIGN(0x1000) : { *(.text) } \
6 # RUN: . = 0x30000; .got : { *(.got) } \
7 # RUN: }" > %t.script
8 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t1.o
9 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
10 # RUN: %S/Inputs/mips-dynamic.s -o %t2.o
11 # RUN: ld.lld %t1.o %t2.o --script %t.script -o %t.exe
12 # RUN: llvm-objdump -d -t --no-show-raw-insn %t.exe | FileCheck %s
13 # RUN: ld.lld %t1.o %t2.o -shared --script %t.script -o %t.so
14 # RUN: llvm-objdump -d -t --no-show-raw-insn %t.so | FileCheck %s
16 .text
17 .globl __start
18 __start:
19 lui $t0,%hi(_gp_disp)
20 addi $t0,$t0,%lo(_gp_disp)
21 lw $v0,%call16(_foo)($gp)
22 bar:
23 lui $t0,%hi(_gp_disp)
24 addi $t0,$t0,%lo(_gp_disp)
26 # CHECK: SYMBOL TABLE:
27 # CHECK: 0001100c l .text 00000000 bar
28 # CHECK: 00037ff0 l .got 00000000 .hidden _gp
29 # CHECK: 00011000 g .text 00000000 __start
31 # CHECK: Disassembly of section .text:
32 # CHECK-EMPTY:
33 # CHECK-NEXT: <__start>:
34 # CHECK-NEXT: 11000: lui $8, 2
35 # ^-- %hi(0x37ff0-0x11000)
36 # CHECK-NEXT: 11004: addi $8, $8, 28656
37 # ^-- %lo(0x37ff0-0x11004+4)
38 # CHECK: <bar>:
39 # CHECK-NEXT: 1100c: lui $8, 2
40 # ^-- %hi(0x37ff0-0x1100c)
41 # CHECK-NEXT: 11010: addi $8, $8, 28644
42 # ^-- %lo(0x37ff0-0x11010+4)