brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · f6815da Raw
80 lines · plain
1# REQUIRES: arm2# RUN: rm -rf %t && split-file %s %t3# RUN: llvm-mc -filetype=obj -triple=armv7-a-none-eabi --arm-add-build-attributes %t/a.s -o %t/a.o4# RUN: ld.lld -pie -T %t/lds %t/a.o -o %t/a5# RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t/a | FileCheck %s6# RUN: llvm-objdump -s --triple=armv7a-none-linux-gnueabi %t/a | FileCheck --check-prefix=CHECK-LE %s7 8# RUN: llvm-mc -filetype=obj -triple=armv7eb-a-none-eabi --arm-add-build-attributes -mcpu=cortex-a8 %t/a.s -o %t/a.o9# RUN: ld.lld -pie -T %t/lds %t/a.o -o %t/a10# RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t/a | FileCheck %s11# RUN: llvm-objdump -s --triple=armv7eb-a-none-eabi %t/a| FileCheck --check-prefix=CHECK-EB %s12# RUN: ld.lld --be8 -pie -T %t/lds %t/a.o -o %t/a13# RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t/a | FileCheck %s14# RUN: llvm-objdump -s --triple=armv7eb-a-none-eabi %t/a| FileCheck --check-prefix=CHECK-LE %s15 16## We create a thunk for dest.17# CHECK-LABEL: <mid>:18# CHECK-NEXT:   2010004:     b       0x2010008 <__ARMV7PILongThunk_dest>19# CHECK-EMPTY:20# CHECK-NEXT:  <__ARMV7PILongThunk_dest>:21# CHECK-NEXT:   2010008:     movw    r12, #6551622# CHECK-NEXT:                movt    r12, #6502323# CHECK-NEXT:                add     r12, r12, pc24# CHECK-NEXT:                bx      r1225 26## The first instruction can reuse the thunk but the second can't.27## If we reuse the thunk for b, we will get an "out of range" error.28# CHECK-LABEL: <high>:29# CHECK-NEXT:   4010000:      bl      0x2010008 <__ARMV7PILongThunk_dest>30# CHECK-NEXT:                 b       0x4010008 <__ARMV7PILongThunk_dest>31# CHECK-EMPTY:32# CHECK-NEXT:  <__ARMV7PILongThunk_dest>:33# CHECK-NEXT:   4010008:      movw    r12, #6551634# CHECK-NEXT:                 movt    r12, #6451135# CHECK-NEXT:                 add     r12, r12, pc36# CHECK-NEXT:                 bx      r1237 38# CHECK-EB: Contents of section .text_low:39# CHECK-EB-NEXT: 10000 e320f000 e12fff1e40# CHECK-EB: Contents of section .text_mid:41# CHECK-EB-NEXT: 2010004 eaffffff e30fcfec e34fcdff e08cc00f42# CHECK-EB-NEXT: 2010014 e12fff1c43# CHECK-EB: Contents of section .text_high:44# CHECK-EB-NEXT: 4010000 eb800000 eaffffff e30fcfec e34fcbff45# CHECK-EB-NEXT: 4010010 e08cc00f e12fff1c46 47# CHECK-LE: Contents of section .text_low:48# CHECK-LE-NEXT: 10000 00f020e3 1eff2fe149# CHECK-LE: Contents of section .text_mid:50# CHECK-LE-NEXT: 2010004 ffffffea eccf0fe3 ffcd4fe3 0fc08ce051# CHECK-LE-NEXT: 2010014 1cff2fe152# CHECK-LE: Contents of section .text_high:53# CHECK-LE-NEXT: 4010000 000080eb ffffffea eccf0fe3 ffcb4fe354# CHECK-LE-NEXT: 4010010 0fc08ce0 1cff2fe155 56#--- a.s57.section .text_low, "ax", %progbits58 59.globl _start60_start:61  nop62dest:63  bx lr64 65.section .text_mid, "ax", %progbits66mid:67  b dest68 69.section .text_high, "ax", %progbits70high:71  bl dest72  b dest73 74#--- lds75SECTIONS {76  .text_low 0x10000: { *(.text_low) }77  .text_mid 0x2010004 : { *(.text_mid) }78  .text_high 0x4010000 : { *(.text_high) }79}80