66 lines · plain
1// REQUIRES: aarch642// RUN: split-file %s %t3// RUN: llvm-mc -filetype=obj -triple=aarch64 %t/asm -o %t.o4// RUN: ld.lld --script %t/lds %t.o -o %t/out5// RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t/out | FileCheck %s6// RUN: llvm-nm --no-sort --special-syms %t/out | FileCheck --check-prefix=NM %s7 8//--- asm9// Check that we have the out of branch range calculation right. The immediate10// field is signed so we have a slightly higher negative displacement.11 .section .text_low, "ax", %progbits12 .globl _start13 .type _start, %function14_start:15 // Need thunk to high_target@plt16 bl high_target17 // Need thunk to .text_high+418 bl .text_high+419 ret20 21 .section .text_high, "ax", %progbits22 .globl high_target23 .type high_target, %function24high_target:25 // No Thunk needed as we are within signed immediate range26 bl _start27 ret28 29// CHECK: Disassembly of section .text_low:30// CHECK-EMPTY:31// CHECK-NEXT: <_start>:32// CHECK-NEXT: 2000: bl 0x200c <__AArch64AbsLongThunk_high_target>33// CHECK-NEXT: 2004: bl 0x2010 <__AArch64AbsLongThunk_>34// CHECK-NEXT: ret35// CHECK: <__AArch64AbsLongThunk_high_target>:36// CHECK-NEXT: 200c: b 0x8002000 <high_target>37// CHECK: <__AArch64AbsLongThunk_>:38// CHECK-NEXT: 2010: b 0x8002004 <high_target+0x4>39// CHECK: Disassembly of section .text_high:40// CHECK-EMPTY:41// CHECK-NEXT: <high_target>:42// CHECK-NEXT: 8002000: bl 0x2000 <_start>43// CHECK-NEXT: ret44 45/// Local symbols copied from %t.o46// NM: t $x47// NM-NEXT: t $x48/// Local thunk symbols.49// NM-NEXT: t __AArch64AbsLongThunk_high_target50// NM-NEXT: t $x51// NM-NEXT: t __AArch64AbsLongThunk_{{$}}52// NM-NEXT: t $x53/// Global symbols.54// NM-NEXT: T _start55// NM-NEXT: T high_target56 57//--- lds58PHDRS {59 low PT_LOAD FLAGS(0x1 | 0x4);60 high PT_LOAD FLAGS(0x1 | 0x4);61}62SECTIONS {63 .text_low 0x2000: { *(.text_low) } :low64 .text_high 0x8002000 : { *(.text_high) } :high65}66