66 lines · plain
1# REQUIRES: loongarch2## Relax R_LARCH_CALL36. This test tests boundary cases and some special symbols.3 4# RUN: rm -rf %t && split-file %s %t && cd %t5# RUN: llvm-mc -filetype=obj -triple=loongarch64 -mattr=+relax a.s -o a.o6 7# RUN: ld.lld -T lds a.o -o a8# RUN: llvm-objdump -d --no-show-raw-insn a | FileCheck %s --check-prefixes=RELAX,RELAX-MID9 10## Unsure whether this needs a diagnostic. GNU ld allows this.11# RUN: ld.lld -T lds -pie a.o -o a.pie12# RUN: llvm-objdump -d --no-show-raw-insn a.pie | FileCheck %s --check-prefixes=RELAX,RELAX-MID13 14# RUN: ld.lld -T lds -pie -z notext -z ifunc-noplt a.o -o a.ifunc-noplt15# RUN: llvm-objdump -d --no-show-raw-insn a.ifunc-noplt | FileCheck %s --check-prefixes=RELAX,NORELAX-MID16 17# RELAX-LABEL: <_start>:18## offset = 0x10000000 - 0x8000000 = 0x8000000(134217728), hi=512, lo18=019# RELAX-NEXT: 8000000: pcaddu18i $ra, 51220# RELAX-NEXT: jirl $ra, $ra, 021# RELAX-NEXT: bl 13421772022# RELAX-NEXT: bl -13421772823## offset = 12 - 0x8000010 = -0x8000004(-134217732), hi=512, lo18=-424# RELAX-NEXT: 8000010: pcaddu18i $ra, -51225# RELAX-NEXT: jirl $ra, $ra, -426# RELAX-EMPTY:27 28# RELAX-MID-LABEL: <.mid>:29## offset = 0x8010000 - 0x8008000 = 3276830# RELAX-MID-NEXT: 8008000: bl 3276831# RELAX-MID-NEXT: b 3276432# RELAX-MID-EMPTY:33 34# NORELAX-MID-LABEL: <.mid>:35# NORELAX-MID-NEXT: 8008000: pcaddu18i $ra, 036# NORELAX-MID-NEXT: jirl $ra, $ra, 037# NORELAX-MID-NEXT: pcaddu18i $t0, 038# NORELAX-MID-NEXT: jr $t039# NORELAX-MID-EMPTY:40 41#--- a.s42.global _start, ifunc43_start:44 call36 pos # exceed positive range (.text+0x7fffffc), not relaxed45 call36 pos # relaxed46 call36 neg # relaxed47 call36 neg # exceed negative range (.text+16-0x8000000), not relaxed48 49.section .mid,"ax",@progbits50.balign 1651 call36 ifunc # enable ifunc, not relaxed52 tail36 $t0, ifunc # enable ifunc, not relaxed53 54.type ifunc, @gnu_indirect_function55ifunc:56 ret57 58#--- lds59SECTIONS {60 .text 0x8000000 : { *(.text) }61 .mid 0x8008000 : { *(.mid) }62 .iplt 0x8010000 : { *(.iplt) }63}64neg = 12;65pos = 0x10000000;66