brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 91de45d Raw
66 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv6m-none-eabi %s -o %t3// RUN: echo "SECTIONS { \4// RUN:       . = SIZEOF_HEADERS; \5// RUN:       .text_low : { *(.text_low) *(.text_low2) } \6// RUN:       .text_high 0x2000000 : { *(.text_high) *(.text_high2) } \7// RUN:       } " > %t.script8// RUN: ld.lld --no-rosegment --script %t.script %t -o %t29// RUN: llvm-objdump --no-print-imm-hex -d %t2 --triple=armv6m-none-eabi | FileCheck %s10// RUN: ld.lld --no-rosegment --script %t.script %t -o %t3 --pie11// RUN: llvm-objdump --no-print-imm-hex -d %t3 --triple=armv6m-none-eabi | FileCheck --check-prefix=CHECK-PI %s12 13// Range extension thunks for Arm Architecture v6m. Only Thumb instructions14// are permitted which limits the access to instructions that can access the15// high registers (r8 - r15), this means that the thunks have to spill16// low registers (r0 - r7) in order to perform the transfer of control.17 18 .syntax unified19 .section .text_low, "ax", %progbits20 .thumb21 .type _start, %function22 .balign 423 .globl _start24_start:25 bl far26 27 .section .text_high, "ax", %progbits28 .globl far29 .type far, %function30far:31 bx lr32 33// CHECK: Disassembly of section .text_low:34// CHECK-EMPTY:35// CHECK-NEXT: <_start>:36// CHECK-NEXT:       94:        f000 f800       bl      0x98 <__Thumbv6MABSLongThunk_far>37// CHECK: <__Thumbv6MABSLongThunk_far>:38// CHECK-NEXT:       98:        b403    push    {r0, r1}39// CHECK-NEXT:       9a:        4801    ldr     r0, [pc, #4]40// CHECK-NEXT:       9c:        9001    str     r0, [sp, #4]41// CHECK-NEXT:       9e:        bd01    pop     {r0, pc}42// CHECK:       a0:     01 00 00 02     .word   0x0200000143// CHECK: Disassembly of section .text_high:44// CHECK-EMPTY:45// CHECK-NEXT: <far>:46// CHECK-NEXT:  2000000:        4770    bx      lr47 48// CHECK-PI: Disassembly of section .text_low:49// CHECK-PI-EMPTY:50// CHECK-PI-NEXT: <_start>:51// CHECK-PI-NEXT:      130:     f000 f800       bl      0x134 <__Thumbv6MPILongThunk_far>52// CHECK-PI: <__Thumbv6MPILongThunk_far>:53// CHECK-PI-NEXT:      134:     b401    push    {r0}54// CHECK-PI-NEXT:      136:     4802    ldr     r0, [pc, #8]55// CHECK-PI-NEXT:      138:     4684    mov     r12, r056// CHECK-PI-NEXT:      13a:     bc01    pop     {r0}57// pc = pc (0x13c + 4) + r12 (1fffec1) = 0x2000001 = .far58// CHECK-PI-NEXT:      13c:     44e7    add     pc, r1259// CHECK-PI-NEXT:      13e:     46c0    mov     r8, r860// CHECK-PI:           140:     c1 fe ff 01     .word   0x01fffec161 62// CHECK-PI: Disassembly of section .text_high:63// CHECK-PI-EMPTY:64// CHECK-PI-NEXT: <far>:65// CHECK-PI-NEXT:  2000000:     4770    bx      lr66