brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 4c5bb2a Raw
76 lines · plain
1// REQUIRES: aarch642// RUN: rm -rf %t && split-file %s %t && cd %t3// RUN: llvm-mc -filetype=obj -triple=aarch64 asm -o a.o4// RUN: ld.lld --script=lds a.o -o exe --defsym absolute=0xf00000005// RUN: llvm-objdump -d --no-show-raw-insn exe | FileCheck %s6 7//--- asm8.section ".note.gnu.property", "a"9.p2align 310.long 411.long 0x1012.long 0x513.asciz "GNU"14 15/// Enable BTI.16.long 0xc0000000 // GNU_PROPERTY_AARCH64_FEATURE_1_AND.17.long 418.long 1          // GNU_PROPERTY_AARCH64_FEATURE_1_BTI.19.long 020 21.section .text.0,"axy",@progbits22.global _start23.type _start,@function24_start:25/// Expect thunk to target a linker generated entry point with BTI landing pad.26/// Two calls to make sure only one landing pad is created.27  bl fn128  b  fn129/// No BTI landing pad is added for absolute symbols.30  bl absolute31 32/// This function does not have a BTI compatible landing pad. Expect a linker33/// generated landing pad for indirect branch thunks.34.section .text.1,"axy",@progbits35.hidden fn136.type fn1,@function37fn1:38  ret39 40// CHECK-LABEL: <_start>:41// CHECK-NEXT:  18001000: bl      0x1800100c <__AArch64AbsXOLongThunk_>42// CHECK-NEXT:            b       0x1800100c <__AArch64AbsXOLongThunk_>43// CHECK-NEXT:            bl      0x18001020 <__AArch64AbsXOLongThunk_absolute>44 45// CHECK-LABEL: <__AArch64AbsXOLongThunk_>:46// CHECK-NEXT:  1800100c: mov     x16, #0x047// CHECK-NEXT:            movk    x16, #0x3000, lsl #1648// CHECK-NEXT:            movk    x16, #0x0, lsl #3249// CHECK-NEXT:            movk    x16, #0x0, lsl #4850// CHECK-NEXT:            br      x1651 52// CHECK-LABEL: <__AArch64AbsXOLongThunk_absolute>:53// CHECK-NEXT:  18001020: mov     x16, #0x054// CHECK-NEXT:            movk    x16, #0xf000, lsl #1655// CHECK-NEXT:            movk    x16, #0x0, lsl #3256// CHECK-NEXT:            movk    x16, #0x0, lsl #4857// CHECK-NEXT:            br      x1658 59// CHECK-LABEL: <__AArch64BTIThunk_>:60// CHECK-NEXT:  30000000: bti     c61 62// CHECK-LABEL: <fn1>:63// CHECK-NEXT:  30000004: ret64 65//--- lds66PHDRS {67  low PT_LOAD FLAGS(0x1 | 0x4);68  mid PT_LOAD FLAGS(0x1 | 0x4);69  high PT_LOAD FLAGS(0x1 | 0x4);70}71SECTIONS {72  .rodata 0x10000000 : { *(.note.gnu.property) } :low73  .text 0x18001000 : { *(.text.0) } :mid74  .text_high 0x30000000 : { *(.text.*) } :high75}76