86 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t3// RUN: echo "SECTIONS {" > %t.script4// RUN: echo " .text_low 0x130 : { *(.text) }" >> %t.script5// RUN: echo " .text_high 0xf0000000 : AT(0x1000) { *(.text_high) }" >> %t.script6// RUN: echo " } " >> %t.script7// RUN: ld.lld --script %t.script --pie --static %t -o %t28// RUN: llvm-objdump --no-print-imm-hex -d --triple=armv7a-none-linux-gnueabi --no-show-raw-insn %t2 | FileCheck %s9 10// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t311// RUN: ld.lld --script %t.script --pie %t3 -o %t412// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t4 | FileCheck --check-prefix=CHECK-THUMB %s13 14// Check that we can create Arm and Thumb v7a Position Independent Thunks that15// can span the address space without triggering overflow errors. We use an16// AT(0x1000) for .text_high to avoid creating an almost 4Gb size file.17 .syntax unified18 .text19 .global _start20 .type _start, %function21_start:22 bl high23 bx lr24 25 .section .text_high, "ax", %progbits26 .global high27 .type high, %function28high:29 bl _start30 bx lr31 32// ARMv7a instructions and relocations.33 34// CHECK: Disassembly of section .text_low:35// CHECK-EMPTY:36// CHECK-NEXT: <_start>:37// CHECK-NEXT: 130: bl 0x138 <__ARMV7PILongThunk_high>38// CHECK-NEXT: 134: bx lr39 40// CHECK: <__ARMV7PILongThunk_high>:41// CHECK-NEXT: 138: movw r12, #6520842// CHECK-NEXT: 13c: movt r12, #6143943// 0x140 + 0xEFFF0000 + 0x0000FEB8 + 8 = 0xf0000000 = high44// CHECK-NEXT: 140: add r12, r12, pc45// CHECK-NEXT: 144: bx r1246 47// CHECK: Disassembly of section .text_high:48// CHECK-EMPTY:49// CHECK-NEXT: <high>:50// CHECK-NEXT: f0000000: bl 0xf0000008 <__ARMV7PILongThunk__start>51// CHECK-NEXT: f0000004: bx lr52 53// CHECK: <__ARMV7PILongThunk__start>:54// CHECK-NEXT: f0000008: movw r12, #28055// CHECK-NEXT: f000000c: movt r12, #409656// 0xf0000010 + 0x10000000 + 0x0000118 + 8 = bits32(0x100000130),0x130 = _start57// CHECK-NEXT: f0000010: add r12, r12, pc58// CHECK-NEXT: f0000014: bx r1259 60// Thumbv7a instructions and relocations61// CHECK-THUMB: Disassembly of section .text_low:62// CHECK-THUMB-EMPTY:63// CHECK-THUMB-NEXT: <_start>:64// CHECK-THUMB-NEXT: 130: bl 0x138 <__ThumbV7PILongThunk_high>65// CHECK-THUMB-NEXT: 134: bx lr66 67// CHECK-THUMB: <__ThumbV7PILongThunk_high>:68// CHECK-THUMB-NEXT: 138: movw r12, #6521369// CHECK-THUMB-NEXT: 13c: movt r12, #6143970// 0x140 + 0xEFFF0000 + 0x0000FEBD + 4 = 0xf0000001 = high71// CHECK-THUMB-NEXT: 140: add r12, pc72// CHECK-THUMB-NEXT: 142: bx r1273 74// CHECK-THUMB: Disassembly of section .text_high:75// CHECK-THUMB-EMPTY:76// CHECK-THUMB-NEXT: <high>:77// CHECK-THUMB-NEXT: f0000000: bl 0xf0000008 <__ThumbV7PILongThunk__start>78// CHECK-THUMB-NEXT: f0000004: bx lr79 80// CHECK-THUMB: <__ThumbV7PILongThunk__start>:81// CHECK-THUMB-NEXT: f0000008: movw r12, #28582// CHECK-THUMB-NEXT: f000000c: movt r12, #409683// 0xf0000010 + 0x10000000 + 0x000011d +4 = bits32(0x100000131),0x131 = _start84// CHECK-THUMB-NEXT: f0000010: add r12, pc85// CHECK-THUMB-NEXT: f0000012: bx r1286