53 lines · plain
1# REQUIRES: mips2# Check R_MIPS_HI16 / LO16 relocations calculation.3 4# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o5# RUN: echo "SECTIONS { . = 0x20000; .text ALIGN(0x1000) : { *(.text) } }" > %t.script6# RUN: ld.lld %t.o --script %t.script -o %t.exe7# RUN: llvm-objdump --no-print-imm-hex -d -t --no-show-raw-insn %t.exe | FileCheck %s8 9 .text10 .globl __start11__start:12 lui $t0,%hi(__start)13 lui $t1,%hi(g1)14 addi $t0,$t0,%lo(__start+4)15 addi $t0,$t0,%lo(g1+8)16 17 lui $t0,%hi(l1+0x10000)18 lui $t1,%hi(l1+0x20000)19 addi $t0,$t0,%lo(l1+(-4))20 21 .data22 .type l1,@object23 .size l1,424l1:25 .word 026 27 .globl g128 .type g1,@object29 .size g1,430g1:31 .word 032 33# CHECK: SYMBOL TABLE:34# CHECK: 0021020 l O .data 00000004 l135# CHECK: 0021000 g .text 00000000 __start36# CHECK: 0021024 g O .data 00000004 g137 38# CHECK: <__start>:39# CHECK-NEXT: 21000: lui $8, 240# ^-- %hi(__start+4)41# CHECK-NEXT: 21004: lui $9, 242# ^-- %hi(g1+8)43# CHECK-NEXT: 21008: addi $8, $8, 410044# ^-- %lo(__start+4)45# CHECK-NEXT: 2100c: addi $8, $8, 414046# ^-- %lo(g1+8)47# CHECK-NEXT: 21010: lui $8, 348# ^-- %hi(l1+0x10000-4)49# CHECK-NEXT: 21014: lui $9, 450# ^-- %hi(l1+0x20000-4)51# CHECK-NEXT: 21018: addi $8, $8, 412452# ^-- %lo(l1-4)53