2015-12-16 22:45:09 +08:00
|
|
|
# Check R_MIPS_HI16 / LO16 relocations calculation against _gp_disp.
|
|
|
|
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t1.o
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
|
|
|
|
# RUN: %S/Inputs/mips-dynamic.s -o %t2.o
|
|
|
|
# RUN: ld.lld %t1.o %t2.o -o %t.exe
|
|
|
|
# RUN: llvm-objdump -d -t %t.exe | FileCheck -check-prefix=EXE %s
|
|
|
|
# RUN: ld.lld %t1.o %t2.o -shared -o %t.so
|
|
|
|
# RUN: llvm-objdump -d -t %t.so | FileCheck -check-prefix=SO %s
|
|
|
|
|
|
|
|
# REQUIRES: mips
|
|
|
|
|
|
|
|
.text
|
|
|
|
.globl __start
|
|
|
|
__start:
|
|
|
|
lui $t0,%hi(_gp_disp)
|
|
|
|
addi $t0,$t0,%lo(_gp_disp)
|
|
|
|
lw $v0,%call16(_foo)($gp)
|
2016-04-15 05:10:05 +08:00
|
|
|
bar:
|
|
|
|
lui $t0,%hi(_gp_disp)
|
|
|
|
addi $t0,$t0,%lo(_gp_disp)
|
2015-12-16 22:45:09 +08:00
|
|
|
|
|
|
|
# EXE: Disassembly of section .text:
|
|
|
|
# EXE-NEXT: __start:
|
2017-01-10 09:21:30 +08:00
|
|
|
# EXE-NEXT: 20000: 3c 08 00 02 lui $8, 2
|
|
|
|
# ^-- %hi(0x47ff0-0x20000)
|
2017-01-17 05:17:23 +08:00
|
|
|
# EXE-NEXT: 20004: 21 08 80 00 addi $8, $8, -32768
|
|
|
|
# ^-- %lo(0x38000-0x20004+4)
|
2016-04-15 05:10:05 +08:00
|
|
|
# EXE: bar:
|
2017-01-17 05:17:23 +08:00
|
|
|
# EXE-NEXT: 2000c: 3c 08 00 01 lui $8, 1
|
|
|
|
# ^-- %hi(0x38000-0x2000c)
|
|
|
|
# EXE-NEXT: 20010: 21 08 7f f4 addi $8, $8, 32756
|
|
|
|
# ^-- %lo(0x38000-0x20010+4)
|
2015-12-16 22:45:09 +08:00
|
|
|
|
|
|
|
# EXE: SYMBOL TABLE:
|
2016-04-15 05:10:05 +08:00
|
|
|
# EXE: 0002000c .text 00000000 bar
|
2017-01-17 05:17:23 +08:00
|
|
|
# EXE: 00038000 *ABS* 00000000 .hidden _gp
|
2015-12-16 22:45:09 +08:00
|
|
|
# EXE: 00020000 .text 00000000 __start
|
|
|
|
|
|
|
|
# SO: Disassembly of section .text:
|
|
|
|
# SO-NEXT: __start:
|
2017-01-10 09:21:30 +08:00
|
|
|
# SO-NEXT: 10000: 3c 08 00 02 lui $8, 2
|
2017-01-17 05:17:23 +08:00
|
|
|
# ^-- %hi(0x28000-0x10000)
|
|
|
|
# SO-NEXT: 10004: 21 08 80 00 addi $8, $8, -32768
|
|
|
|
# ^-- %lo(0x28000-0x10004+4)
|
2016-04-15 05:10:05 +08:00
|
|
|
# SO: bar:
|
2017-01-17 05:17:23 +08:00
|
|
|
# SO-NEXT: 1000c: 3c 08 00 01 lui $8, 1
|
|
|
|
# ^-- %hi(0x28000-0x1000c)
|
|
|
|
# SO-NEXT: 10010: 21 08 7f f4 addi $8, $8, 32756
|
|
|
|
# ^-- %lo(0x28000-0x10010+4)
|
2015-12-16 22:45:09 +08:00
|
|
|
|
|
|
|
# SO: SYMBOL TABLE:
|
2016-04-15 05:10:05 +08:00
|
|
|
# SO: 0001000c .text 00000000 bar
|
2017-01-17 05:17:23 +08:00
|
|
|
# SO: 00028000 *ABS* 00000000 .hidden _gp
|
2015-12-16 22:45:09 +08:00
|
|
|
# SO: 00010000 .text 00000000 __start
|