2017-03-07 17:45:04 +08:00
|
|
|
# REQUIRES: mips
|
|
|
|
# Check LA25 stubs creation with caller in different Output Section to callee.
|
|
|
|
# This stub code is necessary when non-PIC code calls PIC function.
|
|
|
|
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
|
|
|
|
# RUN: %p/Inputs/mips-fpic.s -o %t-fpic.o
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
|
|
|
|
# RUN: %p/Inputs/mips-fnpic.s -o %t-fnpic.o
|
|
|
|
# RUN: ld.lld -r %t-fpic.o %t-fnpic.o -o %t-sto-pic.o
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
|
|
|
|
# RUN: %p/Inputs/mips-pic.s -o %t-pic.o
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t-npic.o
|
|
|
|
# RUN: ld.lld %t-npic.o %t-pic.o %t-sto-pic.o -o %t.exe
|
2019-09-10 06:04:20 +08:00
|
|
|
# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t.exe | FileCheck %s
|
2017-03-07 17:45:04 +08:00
|
|
|
|
|
|
|
# CHECK: Disassembly of section .text:
|
2019-05-01 18:40:48 +08:00
|
|
|
# CHECK-EMPTY:
|
2020-03-06 06:18:38 +08:00
|
|
|
# CHECK-NEXT: <__LA25Thunk_foo1a>:
|
2019-09-10 06:04:20 +08:00
|
|
|
# CHECK-NEXT: lui $25, 0x2
|
|
|
|
# CHECK-NEXT: j {{.*}} <foo1a>
|
|
|
|
# CHECK-NEXT: addiu $25, $25, {{.*}}
|
2018-11-16 13:30:47 +08:00
|
|
|
|
2020-03-06 06:18:38 +08:00
|
|
|
# CHECK: <__LA25Thunk_foo1b>:
|
2019-09-10 06:04:20 +08:00
|
|
|
# CHECK-NEXT: lui $25, 0x2
|
|
|
|
# CHECK-NEXT: j {{.*}} <foo1b>
|
|
|
|
# CHECK-NEXT: addiu $25, $25, {{.*}}
|
2018-11-16 13:30:47 +08:00
|
|
|
|
2020-03-06 06:18:38 +08:00
|
|
|
# CHECK: <foo1a>:
|
2019-09-10 06:04:20 +08:00
|
|
|
# CHECK-NEXT: nop
|
2018-11-16 13:30:47 +08:00
|
|
|
|
2020-03-06 06:18:38 +08:00
|
|
|
# CHECK: <foo1b>:
|
2019-09-10 06:04:20 +08:00
|
|
|
# CHECK-NEXT: nop
|
2018-11-16 13:30:47 +08:00
|
|
|
|
2020-03-06 06:18:38 +08:00
|
|
|
# CHECK: <__LA25Thunk_foo2>:
|
2019-09-10 06:04:20 +08:00
|
|
|
# CHECK-NEXT: lui $25, 0x2
|
|
|
|
# CHECK-NEXT: j {{.*}} <foo2>
|
|
|
|
# CHECK-NEXT: addiu $25, $25, {{.*}}
|
2018-11-16 13:30:47 +08:00
|
|
|
|
2020-03-06 06:18:38 +08:00
|
|
|
# CHECK: <foo2>:
|
2019-09-10 06:04:20 +08:00
|
|
|
# CHECK-NEXT: nop
|
2018-11-16 13:30:47 +08:00
|
|
|
|
2020-03-06 06:18:38 +08:00
|
|
|
# CHECK: <__LA25Thunk_fpic>:
|
2019-09-10 06:04:20 +08:00
|
|
|
# CHECK-NEXT: lui $25, 0x2
|
|
|
|
# CHECK-NEXT: j {{.*}} <fpic>
|
|
|
|
# CHECK-NEXT: addiu $25, $25, {{.*}}
|
2018-11-16 13:30:47 +08:00
|
|
|
|
2020-03-06 06:18:38 +08:00
|
|
|
# CHECK: <fpic>:
|
2019-09-10 06:04:20 +08:00
|
|
|
# CHECK-NEXT: nop
|
2018-11-16 13:30:47 +08:00
|
|
|
|
2020-03-06 06:18:38 +08:00
|
|
|
# CHECK: <fnpic>:
|
2019-09-10 06:04:20 +08:00
|
|
|
# CHECK-NEXT: nop
|
2019-05-01 18:40:48 +08:00
|
|
|
# CHECK-EMPTY:
|
2019-09-10 06:04:20 +08:00
|
|
|
# CHECK-NEXT: Disassembly of section .differentos:
|
2019-05-01 18:40:48 +08:00
|
|
|
# CHECK-EMPTY:
|
2020-03-06 06:18:38 +08:00
|
|
|
# CHECK-NEXT: <__start>:
|
2019-09-10 06:04:20 +08:00
|
|
|
# CHECK-NEXT: jal {{.*}} <__LA25Thunk_foo1a>
|
|
|
|
# CHECK-NEXT: nop
|
|
|
|
# CHECK-NEXT: jal {{.*}} <__LA25Thunk_foo2>
|
|
|
|
# CHECK-NEXT: nop
|
|
|
|
# CHECK-NEXT: jal {{.*}} <__LA25Thunk_foo1b>
|
|
|
|
# CHECK-NEXT: nop
|
|
|
|
# CHECK-NEXT: jal {{.*}} <__LA25Thunk_foo2>
|
|
|
|
# CHECK-NEXT: nop
|
|
|
|
# CHECK-NEXT: jal {{.*}} <__LA25Thunk_fpic>
|
|
|
|
# CHECK-NEXT: nop
|
|
|
|
# CHECK-NEXT: jal {{.*}} <fnpic>
|
|
|
|
|
|
|
|
.section .differentos, "ax", %progbits
|
2017-03-07 17:45:04 +08:00
|
|
|
.globl __start
|
|
|
|
__start:
|
|
|
|
jal foo1a
|
|
|
|
jal foo2
|
|
|
|
jal foo1b
|
|
|
|
jal foo2
|
|
|
|
jal fpic
|
|
|
|
jal fnpic
|