2018-06-27 00:58:19 +08:00
|
|
|
# REQUIRES: mips
|
2016-07-21 04:15:33 +08:00
|
|
|
# Check PLT entries generation in case of R6 ABI version.
|
|
|
|
|
2019-09-10 06:04:20 +08:00
|
|
|
# RUN: echo "SECTIONS { \
|
|
|
|
# RUN: . = 0x10000; .text ALIGN(0x10000) : { *(.text) } \
|
|
|
|
# RUN: . = 0x30000; .data : { *(.data) } \
|
|
|
|
# RUN: }" > %t.script
|
|
|
|
|
2016-07-21 04:15:33 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
|
|
|
|
# RUN: -mcpu=mips32r6 %s -o %t1.o
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
|
|
|
|
# RUN: -mcpu=mips32r6 %S/Inputs/mips-dynamic.s -o %t2.o
|
2019-07-25 15:12:23 +08:00
|
|
|
# RUN: ld.lld %t2.o -shared -soname=t.so -o %t.so
|
2019-09-10 06:04:20 +08:00
|
|
|
# RUN: ld.lld %t1.o %t.so -script %t.script -o %t.exe
|
2019-07-25 15:12:23 +08:00
|
|
|
# RUN: llvm-objdump -d --no-show-raw-insn %t.exe | FileCheck %s --check-prefixes=DEFAULT,CHECK
|
|
|
|
# RUN: ld.lld %t2.o -shared -soname=t.so -o %t.so -z hazardplt
|
2019-09-10 06:04:20 +08:00
|
|
|
# RUN: ld.lld %t1.o %t.so -script %t.script -o %t.exe -z hazardplt
|
2019-07-25 15:12:23 +08:00
|
|
|
# RUN: llvm-objdump -d --no-show-raw-insn %t.exe | FileCheck %s --check-prefixes=HAZARDPLT,CHECK
|
2016-07-21 04:15:33 +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: <__start>:
|
2019-07-25 15:12:23 +08:00
|
|
|
# CHECK-NEXT: 20000: jal 131120
|
|
|
|
# ^-- 0x20030 gotplt[foo0]
|
|
|
|
# CHECK-NEXT: 20004: nop
|
2016-07-21 04:15:33 +08:00
|
|
|
#
|
2019-05-01 18:40:48 +08:00
|
|
|
# CHECK-EMPTY:
|
2016-07-21 04:15:33 +08:00
|
|
|
# CHECK-NEXT: Disassembly of section .plt:
|
2019-05-01 18:40:48 +08:00
|
|
|
# CHECK-EMPTY:
|
2020-03-06 06:18:38 +08:00
|
|
|
# CHECK-NEXT: <.plt>:
|
2019-07-25 15:12:23 +08:00
|
|
|
# CHECK-NEXT: 20010: aui $gp, $zero, 3
|
|
|
|
# CHECK-NEXT: 20014: lw $25, 4($gp)
|
|
|
|
# CHECK-NEXT: 20018: addiu $gp, $gp, 4
|
|
|
|
# CHECK-NEXT: 2001c: subu $24, $24, $gp
|
|
|
|
# CHECK-NEXT: 20020: move $15, $ra
|
|
|
|
# CHECK-NEXT: 20024: srl $24, $24, 2
|
|
|
|
# DEFAULT: 20028: jalr $25
|
|
|
|
# HAZARDPLT: 20028: jalr.hb $25
|
|
|
|
# CHECK-NEXT: 2002c: addiu $24, $24, -2
|
2016-07-21 04:15:33 +08:00
|
|
|
|
2019-07-25 15:12:23 +08:00
|
|
|
# CHECK-NEXT: 20030: aui $15, $zero, 3
|
|
|
|
# CHECK-NEXT: 20034: lw $25, 12($15)
|
|
|
|
# DEFAULT: 20038: jr $25
|
|
|
|
# HAZARDPLT: 20038: jr.hb $25
|
|
|
|
# CHECK-NEXT: 2003c: addiu $24, $15, 12
|
2016-07-21 04:15:33 +08:00
|
|
|
|
|
|
|
.text
|
|
|
|
.global __start
|
|
|
|
__start:
|
|
|
|
jal foo0 # R_MIPS_26 against 'foo0' from DSO
|