60 lines · plain
1# REQUIRES: mips2# Check handling of N32 ABI relocation records.3 4# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \5# RUN: -target-abi n32 -o %t.o %s6# RUN: echo "SECTIONS { \7# RUN: . = 0x20000; .text ALIGN(0x100) : { *(.text) } \8# RUN: }" > %t.script9# RUN: ld.lld %t.o -script %t.script -o %t.exe10# RUN: llvm-objdump --no-print-imm-hex -t -d -s --no-show-raw-insn %t.exe | FileCheck %s11# RUN: llvm-readelf -h %t.exe | FileCheck -check-prefix=ELF %s12 13 .option pic214 .text15 .type __start, @function16 .global __start17__start:18 lui $gp,%hi(%neg(%gp_rel(__start))) # R_MIPS_GPREL1619 # R_MIPS_SUB20 # R_MIPS_HI1621loc:22 daddiu $gp,$gp,%lo(%neg(%gp_rel(__start))) # R_MIPS_GPREL1623 # R_MIPS_SUB24 # R_MIPS_LO1625 26 .section .rodata,"a",@progbits27 .gpword(loc) # R_MIPS_GPREL3228 29# CHECK: 00020104 l .text 00000000 loc30# CHECK: 00028100 l .got 00000000 .hidden _gp31# CHECK: 00020100 g F .text 00000000 __start32 33# CHECK: Contents of section .rodata:34# CHECK-NEXT: {{[0-9a-f]+}} ffff800435# ^-- loc - _gp36 37# CHECK: Disassembly of section .text:38# CHECK-EMPTY:39# CHECK-NEXT: <__start>:40# CHECK-NEXT: 20100: lui $gp, 141# ^-- 0x20100 - 0x2810042# ^-- 0 - 0xffff800043# ^-- %hi(0x8000)44# CHECK: <loc>:45# CHECK-NEXT: 20104: daddiu $gp, $gp, -3276846# ^-- 0x20100 - 0x2810047# ^-- 0 - 0xffff800048# ^-- %lo(0x8000)49 50# ELF: Class: ELF3251# ELF: Data: 2's complement, big endian52# ELF: Version: 1 (current)53# ELF: OS/ABI: UNIX - System V54# ELF: ABI Version: 055# ELF: Type: EXEC (Executable file)56# ELF: Machine: MIPS R300057# ELF: Version: 0x158# ELF: Entry point address: 0x2010059# ELF: Flags: 0x60000026, pic, cpic, abi2, mips6460