brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 997b503 Raw
50 lines · plain
1# REQUIRES: aarch642# RUN: rm -rf %t && split-file %s %t3# RUN: llvm-mc -filetype=obj -triple=aarch64 %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 7## We create a thunk for dest.8# CHECK-LABEL: <mid>:9# CHECK-NEXT:   8010008:       b       0x801000c <__AArch64ADRPThunk_>10# CHECK-EMPTY:11# CHECK-NEXT:  <__AArch64ADRPThunk_>:12# CHECK-NEXT:   801000c:       adrp    x16, 0x1000013# CHECK-NEXT:                  add     x16, x16, #414# CHECK-NEXT:                  br      x1615 16## The first instruction can reuse the thunk but the second can't.17## If we reuse the thunk for b, we will get an "out of range" error.18# CHECK-LABEL: <high>:19# CHECK-NEXT:  1001000c:       bl      0x801000c <__AArch64ADRPThunk_>20# CHECK-NEXT:                  b       0x10010014 <__AArch64ADRPThunk_>21# CHECK-EMPTY:22# CHECK-NEXT:  <__AArch64ADRPThunk_>:23# CHECK-NEXT:  10010014:       adrp    x16, 0x1000024# CHECK-NEXT:                  add     x16, x16, #425# CHECK-NEXT:                  br      x1626 27#--- a.s28.section .text_low, "ax", %progbits29.globl _start30_start:31  nop32dest:33  ret34 35.section .text_mid, "ax", %progbits36mid:37  b dest38 39.section .text_high, "ax", %progbits40high:41  bl dest42  b dest43 44#--- lds45SECTIONS {46  .text_low 0x10000: { *(.text_low) }47  .text_mid 0x8010008 : { *(.text_mid) }48  .text_high 0x1001000c : { *(.text_high) }49}50