43 lines · plain
1# REQUIRES: mips2# Check R_MIPS_HI16 / LO16 relocations calculation against _gp_disp.3 4# RUN: echo "SECTIONS { \5# RUN: . = 0x10000; .text ALIGN(0x1000) : { *(.text) } \6# RUN: . = 0x30000; .got : { *(.got) } \7# RUN: }" > %t.script8# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t1.o9# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \10# RUN: %S/Inputs/mips-dynamic.s -o %t2.o11# RUN: ld.lld %t1.o %t2.o --script %t.script -o %t.exe12# RUN: llvm-objdump --no-print-imm-hex -d -t --no-show-raw-insn %t.exe | FileCheck %s13# RUN: ld.lld %t1.o %t2.o -shared --script %t.script -o %t.so14# RUN: llvm-objdump --no-print-imm-hex -d -t --no-show-raw-insn %t.so | FileCheck %s15 16 .text17 .globl __start18__start:19 lui $t0,%hi(_gp_disp)20 addi $t0,$t0,%lo(_gp_disp)21 lw $v0,%call16(_foo)($gp)22bar:23 lui $t0,%hi(_gp_disp)24 addi $t0,$t0,%lo(_gp_disp)25 26# CHECK: SYMBOL TABLE:27# CHECK: 0001100c l .text 00000000 bar28# CHECK: 00037ff0 l .got 00000000 .hidden _gp29# CHECK: 00011000 g .text 00000000 __start30 31# CHECK: Disassembly of section .text:32# CHECK-EMPTY:33# CHECK-NEXT: <__start>:34# CHECK-NEXT: 11000: lui $8, 235# ^-- %hi(0x37ff0-0x11000)36# CHECK-NEXT: 11004: addi $8, $8, 2865637# ^-- %lo(0x37ff0-0x11004+4)38# CHECK: <bar>:39# CHECK-NEXT: 1100c: lui $8, 240# ^-- %hi(0x37ff0-0x1100c)41# CHECK-NEXT: 11010: addi $8, $8, 2864442# ^-- %lo(0x37ff0-0x11010+4)43