2 # RUN: rm -rf %t && split-file %s %t && cd %t
3 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c,+relax a.s -o a.o
5 # RUN: ld.lld -T lds a.o -o a
6 # RUN: llvm-objdump -d --no-show-raw-insn -M no-aliases a | FileCheck %s
8 ## Unsure whether this needs a diagnostic. GNU ld allows this.
9 # RUN: ld.lld -T lds -pie a.o -o a.pie
10 # RUN: llvm-objdump -d --no-show-raw-insn -M no-aliases a.pie | FileCheck %s
12 # RUN: ld.lld -T lds -pie -z notext -z ifunc-noplt a.o -o a.ifunc-noplt
13 # RUN: llvm-objdump -d --no-show-raw-insn -M no-aliases a.ifunc-noplt | FileCheck %s --check-prefix=CHECK2
15 # CHECK-LABEL: <_start>:
16 # CHECK-NEXT: jal zero, 0x8 <abs>
17 # CHECK-NEXT: jal zero, 0x8 <abs>
18 # CHECK-NEXT: jal ra, 0x8 <abs>
19 # CHECK-NEXT: auipc t1, 0xfff00
20 # CHECK-NEXT: jalr zero, -0x4(t1)
23 # CHECK-LABEL: <.mid>:
24 # CHECK-NEXT: jal zero, 0x101000
25 # CHECK-NEXT: c.j 0x101000
28 # CHECK2-LABEL: <.mid>:
29 # CHECK2-NEXT: auipc t1, 0x0
30 # CHECK2-NEXT: jalr zero, 0x0(t1)
31 # CHECK2-NEXT: auipc t1, 0x0
32 # CHECK2-NEXT: jalr zero, 0x0(t1)
41 tail
abs # not relaxed
43 .section .mid,"ax",@progbits
45 tail ifunc@plt
# not relaxed
48 .type ifunc, @gnu_indirect_function
54 .text 0x100000 : { *(.text) }
55 .mid 0x100800 : { *(.mid) }
56 .iplt 0x101000 : { *(.iplt) }