• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// REQUIRES: arm
2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t
3// RUN: ld.lld %t --shared -o %t.so
4// RUN: llvm-objdump -d --no-show-raw-insn --triple=thumbv7a-none-linux-gnueabi %t.so | FileCheck %s
5 .syntax unified
6 .global sym1
7 .global elsewhere
8 .weak weakref
9sym1:
10 b.w elsewhere
11 b.w weakref
12
13 bl elsewhere
14 bl weakref
15
16// Check that we generate a thunk for an undefined symbol called via a plt
17// entry.
18
19// CHECK: Disassembly of section .text:
20// CHECK-EMPTY:
21// CHECK-NEXT: <sym1>:
22// CHECK-NEXT:     101e0: b.w #12 <__ThumbV7PILongThunk_elsewhere>
23// CHECK-NEXT:           b.w #20 <__ThumbV7PILongThunk_weakref>
24// CHECK-NEXT:           blx #68
25// CHECK-NEXT:           blx #80
26// CHECK: <__ThumbV7PILongThunk_elsewhere>:
27// CHECK-NEXT:     101f0: movw    r12, #52
28// CHECK-NEXT:           movt    r12, #0
29// CHECK-NEXT:           add     r12, pc
30// CHECK-NEXT:           bx      r12
31// CHECK: <__ThumbV7PILongThunk_weakref>:
32// CHECK-NEXT:     101fc: movw    r12, #56
33// CHECK-NEXT:           movt    r12, #0
34// CHECK-NEXT:           add     r12, pc
35// CHECK-NEXT:           bx      r12
36
37// CHECK: Disassembly of section .plt:
38// CHECK-EMPTY:
39// CHECK-NEXT: <$a>:
40// CHECK-NEXT:     10210: str     lr, [sp, #-4]!
41// CHECK-NEXT:           add     lr, pc, #0, #12
42// CHECK-NEXT:           add     lr, lr, #32
43// CHECK-NEXT:           ldr     pc, [lr, #148]!
44// CHECK: <$d>:
45// CHECK-NEXT:     10220: d4 d4 d4 d4 .word   0xd4d4d4d4
46// CHECK-NEXT:           .word   0xd4d4d4d4
47// CHECK-NEXT:           .word   0xd4d4d4d4
48// CHECK-NEXT:           .word   0xd4d4d4d4
49// CHECK: <$a>:
50// CHECK-NEXT:     10230: add     r12, pc, #0, #12
51// CHECK-NEXT:           add     r12, r12, #32
52// CHECK-NEXT:           ldr     pc, [r12, #124]!
53// CHECK: <$d>:
54// CHECK-NEXT:     1023c: d4 d4 d4 d4 .word   0xd4d4d4d4
55// CHECK: <$a>:
56// CHECK-NEXT:     10240: add     r12, pc, #0, #12
57// CHECK-NEXT:           add     r12, r12, #32
58// CHECK-NEXT:           ldr     pc, [r12, #112]!
59// CHECK: <$d>:
60// CHECK-NEXT:     1024c: d4 d4 d4 d4 .word   0xd4d4d4d4
61