2018-06-27 00:58:19 +08:00
|
|
|
# REQUIRES: mips
|
2016-05-08 22:08:40 +08:00
|
|
|
# Check handling multiple MIPS N64 ABI relocations packed
|
|
|
|
# into the single relocation record.
|
|
|
|
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.o
|
|
|
|
# RUN: ld.lld %t.o -o %t.exe
|
2019-07-25 15:12:23 +08:00
|
|
|
# RUN: llvm-objdump -d -s -t --no-show-raw-insn %t.exe | FileCheck %s
|
2016-05-08 22:08:40 +08:00
|
|
|
# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s
|
|
|
|
|
|
|
|
# CHECK: __start:
|
2019-07-25 15:12:23 +08:00
|
|
|
# CHECK-NEXT: 20000: lui $gp, 1
|
|
|
|
# ^-- 0x20000 - 0x37ff0
|
|
|
|
# ^-- 0 - 0xfffffffffffe8010
|
|
|
|
# ^-- %hi(0x17ff0)
|
2016-05-08 22:08:40 +08:00
|
|
|
# CHECK: loc:
|
2019-07-25 15:12:23 +08:00
|
|
|
# CHECK-NEXT: 20004: daddiu $gp, $gp, 32752
|
|
|
|
# ^-- 0x20000 - 0x37ff0
|
|
|
|
# ^-- 0 - 0xfffffffffffe8010
|
|
|
|
# ^-- %lo(0x17ff0)
|
2016-05-08 22:08:40 +08:00
|
|
|
|
|
|
|
# CHECK: Contents of section .rodata:
|
2017-12-05 23:33:14 +08:00
|
|
|
# CHECK-NEXT: {{[0-9a-f]+}} ffffffff fffe8014
|
|
|
|
# ^-- 0x20004 - 0x37ff0 = 0xfffffffffffe8014
|
2016-05-08 22:08:40 +08:00
|
|
|
|
|
|
|
# CHECK: 0000000000020004 .text 00000000 loc
|
2017-09-15 09:49:01 +08:00
|
|
|
# CHECK: 0000000000037ff0 .got 00000000 .hidden _gp
|
2016-05-08 22:08:40 +08:00
|
|
|
# CHECK: 0000000000020000 .text 00000000 __start
|
|
|
|
|
|
|
|
# REL: Relocations [
|
|
|
|
# REL-NEXT: ]
|
|
|
|
|
|
|
|
.text
|
|
|
|
.global __start
|
|
|
|
__start:
|
|
|
|
lui $gp,%hi(%neg(%gp_rel(__start))) # R_MIPS_GPREL16
|
|
|
|
# R_MIPS_SUB
|
|
|
|
# R_MIPS_HI16
|
|
|
|
loc:
|
|
|
|
daddiu $gp,$gp,%lo(%neg(%gp_rel(__start))) # R_MIPS_GPREL16
|
|
|
|
# R_MIPS_SUB
|
|
|
|
# R_MIPS_LO16
|
|
|
|
|
|
|
|
.section .rodata,"a",@progbits
|
|
|
|
.gpdword(loc) # R_MIPS_GPREL32
|
|
|
|
# R_MIPS_64
|