• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// REQUIRES: arm
2// RUN: llvm-mc --triple=armv7a-linux-gnueabihf -arm-add-build-attributes -filetype=obj -o %t.o %s
3// RUN: ld.lld %t.o -o %t
4// RUN: llvm-objdump --triple=armv7a-none-linux-gnueabi -d --no-show-raw-insn %t | FileCheck %s
5
6/// A symbol assignment defined alias inherits st_type and gets the same treatment.
7// RUN: llvm-mc --triple=armv7a-linux-gnueabihf -arm-add-build-attributes -filetype=obj --defsym ALIAS=1 -o %t1.o %s
8// RUN: ld.lld --defsym foo=foo1 %t1.o -o %t1
9// RUN: llvm-objdump --triple=armv7a-none-linux-gnueabi -d --no-show-raw-insn %t | FileCheck %s
10
11/// Non-preemptible ifuncs are called via a PLT entry which is always Arm
12/// state, expect the ARM callers to go direct to the PLT entry, Thumb
13/// branches are indirected via state change thunks, the bl is changed to blx.
14
15 .syntax unified
16 .text
17 .balign 0x1000
18.ifdef ALIAS
19 .type foo1 STT_GNU_IFUNC
20 .globl foo1
21foo1:
22.else
23 .type foo STT_GNU_IFUNC
24 .globl foo
25foo:
26.endif
27 bx lr
28
29 .section .text.1, "ax", %progbits
30 .arm
31 .global _start
32_start:
33 b foo
34 bl foo
35
36 .section .text.2, "ax", %progbits
37 .thumb
38 .global thumb_caller
39thumb_caller:
40 b foo
41 b.w foo
42 bl foo
43
44// CHECK:      00021004 <_start>:
45// CHECK-NEXT: b       #36 <$a>
46// CHECK-NEXT: bl      #32 <$a>
47
48// CHECK:      0002100c <thumb_caller>:
49// CHECK-NEXT: b.w     #8
50// CHECK-NEXT: b.w     #4
51// CHECK-NEXT: blx     #24
52
53// CHECK:      00021018 <__Thumbv7ABSLongThunk_foo>:
54// CHECK-NEXT: movw    r12, #4144
55// CHECK-NEXT: movt    r12, #2
56// CHECK-NEXT: bx      r12
57
58// CHECK: Disassembly of section .iplt:
59
60// CHECK:      00021030 <$a>:
61// CHECK-NEXT: add     r12, pc, #0, #12
62// CHECK-NEXT: add     r12, r12, #16, #20
63// CHECK-NEXT: ldr     pc, [r12, #8]!
64