60 lines · plain
1// REQUIRES: arm2// This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice.3// XFAIL: main-run-twice4// RUN: rm -rf %t && split-file %s %t5// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv6m-none-eabi %t/a.s -o %t/a.o6// RUN: ld.lld --no-rosegment --script %t/a.t %t/a.o -o %t/a7// RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn -d %t/a --triple=armv6m-none-eabi | FileCheck %s8// RUN: not ld.lld --no-rosegment --script %t/a.t %t/a.o -o %t/a2 --pie 2>&1 | FileCheck --check-prefix=CHECK-PI %s9// RUN: rm -f %t/a %t/a210 11// Range extension thunks for Arm Architecture v6m. Only Thumb instructions12// are permitted which limits the access to instructions that can access the13// high registers (r8 - r15), this means that the thunks have to spill14// low registers (r0 - r7) in order to perform the transfer of control.15 16//--- a.t17SECTIONS {18 .text_low 0x11345670 : { *(.text_low) }19 .text_high 0x12345678 : { *(.text_high) }20}21 22//--- a.s23// The 'y' on the .section directive means that this section is eXecute Only code24 .syntax unified25 .section .text_low, "axy", %progbits26 .thumb27 .type _start, %function28 .balign 429 .globl _start30_start:31 bl far32 33 .section .text_high, "ax", %progbits34 .globl far35 .type far, %function36far:37 bx lr38 39// CHECK: Disassembly of section .text_low:40// CHECK-EMPTY:41// CHECK-NEXT: <_start>:42// CHECK-NEXT: 11345670: bl 0x11345674 <__Thumbv6MABSXOLongThunk_far>43// CHECK: <__Thumbv6MABSXOLongThunk_far>:44// CHECK-NEXT: push {r0, r1}45// CHECK-NEXT: movs r0, #1846// CHECK-NEXT: lsls r0, r0, #847// CHECK-NEXT: adds r0, #5248// CHECK-NEXT: lsls r0, r0, #849// CHECK-NEXT: adds r0, #8650// CHECK-NEXT: lsls r0, r0, #851// CHECK-NEXT: adds r0, #12152// CHECK-NEXT: str r0, [sp, #4]53// CHECK-NEXT: pop {r0, pc}54// CHECK: Disassembly of section .text_high:55// CHECK-EMPTY:56// CHECK-NEXT: <far>:57// CHECK-NEXT: 12345678: bx lr58 59// CHECK-PI: error: relocation R_ARM_THM_CALL to far not supported for Armv6-M targets for position independent and execute only code60