53 lines · plain
1# REQUIRES: mips2# Check R_MIPS_PCxxx relocations calculation.3 4# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \5# RUN: -mcpu=mips32r6 %s -o %t1.o6# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \7# RUN: -mcpu=mips32r6 %S/Inputs/mips-dynamic.s -o %t2.o8# RUN: echo "SECTIONS { \9# RUN: . = 0x10000; .text ALIGN(0x10000) : { *(.text) } \10# RUN: . = 0x30000; .data : { *(.data) } \11# RUN: }" > %t.script12# RUN: ld.lld %t1.o %t2.o -script %t.script -o %t.exe13# RUN: llvm-objdump --no-print-imm-hex --mcpu=mips32r6 -d -t -s --no-show-raw-insn %t.exe \14# RUN: | FileCheck %s15 16 .text17 .globl __start18__start:19 lwpc $6, _foo # R_MIPS_PC19_S220 beqc $5, $6, _foo # R_MIPS_PC1621 beqzc $9, _foo # R_MIPS_PC21_S222 bc _foo # R_MIPS_PC26_S223 aluipc $2, %pcrel_hi(_foo) # R_MIPS_PCHI1624 addiu $2, $2, %pcrel_lo(_foo) # R_MIPS_PCLO1625 26 .data27 .word _foo+8-. # R_MIPS_PC3228 29# CHECK: 00020000 g .text 00000000 __start30# CHECK: 00020020 g .text 00000000 _foo31 32# CHECK: Contents of section .data:33# CHECK-NEXT: 30000 ffff0028 00000000 00000000 0000000034# ^-- 0x20020 + 8 - 0x3000035 36# CHECK: Disassembly of section .text:37# CHECK-EMPTY:38# CHECK-NEXT: <__start>:39# CHECK-NEXT: 20000: lwpc $6, 3240# ^-- (0x20020-0x20000)>>241# CHECK-NEXT: 20004: beqc $5, $6, 0x2002042# ^-- (0x20020-4-0x20004)>>243# CHECK-NEXT: 20008: nop44# CHECK-NEXT: 2000c: beqzc $9, 0x2002045# ^-- (0x20020-4-0x2000c)>>246# CHECK-NEXT: 20010: nop47# CHECK-NEXT: 20014: bc 0x2002048# ^-- (0x20020-4-0x200014)>>249# CHECK-NEXT: 20018: aluipc $2, 050# ^-- %hi(0x20020-0x20018)51# CHECK-NEXT: 2001c: addiu $2, $2, 452# ^-- %lo(0x20020-0x2001c)53