2 # Check R_MIPS_PCxxx relocations calculation.
4 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
5 # RUN: -mcpu=mips32r6 %s -o %t1.o
6 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
7 # RUN: -mcpu=mips32r6 %S/Inputs/mips-dynamic.s -o %t2.o
8 # RUN: echo "SECTIONS { \
9 # RUN: . = 0x10000; .text ALIGN(0x10000) : { *(.text) } \
10 # RUN: . = 0x30000; .data : { *(.data) } \
12 # RUN: ld.lld %t1.o %t2.o -script %t.script -o %t.exe
13 # RUN: llvm-objdump --mcpu=mips32r6 -d -t -s --no-show-raw-insn %t.exe \
19 lwpc $
6, _foo
# R_MIPS_PC19_S2
20 beqc $
5, $
6, _foo
# R_MIPS_PC16
21 beqzc $
9, _foo
# R_MIPS_PC21_S2
22 bc _foo
# R_MIPS_PC26_S2
23 aluipc $
2, %pcrel_hi
(_foo
) # R_MIPS_PCHI16
24 addiu $
2, $
2, %pcrel_lo
(_foo
) # R_MIPS_PCLO16
27 .word _foo+8-. # R_MIPS_PC32
29 # CHECK: 00020000 g .text 00000000 __start
30 # CHECK: 00020020 g .text 00000000 _foo
32 # CHECK: Contents of section .data:
33 # CHECK-NEXT: 30000 ffff0028 00000000 00000000 00000000
34 # ^-- 0x20020 + 8 - 0x30000
36 # CHECK: Disassembly of section .text:
38 # CHECK-NEXT: <__start>:
39 # CHECK-NEXT: 20000: lwpc $6, 32
40 # ^-- (0x20020-0x20000)>>2
41 # CHECK-NEXT: 20004: beqc $5, $6, 28
42 # ^-- (0x20020-4-0x20004)>>2
43 # CHECK-NEXT: 20008: beqzc $9, 24
44 # ^-- (0x20020-4-0x20008)>>2
45 # CHECK-NEXT: 2000c: bc 20
46 # ^-- (0x20020-4-0x2000c)>>2
47 # CHECK-NEXT: 20010: aluipc $2, 0
48 # ^-- %hi(0x20020-0x20010)
49 # CHECK-NEXT: 20014: addiu $2, $2, 12
50 # ^-- %lo(0x20020-0x20014)