2018-06-27 06:20:04 +08:00
|
|
|
// REQUIRES: arm
|
2018-08-20 17:37:50 +08:00
|
|
|
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t
|
2017-01-04 17:45:45 +08:00
|
|
|
// RUN: ld.lld %t --shared -o %t.so
|
2021-07-29 03:47:12 +08:00
|
|
|
// RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck %s
|
2017-01-04 17:45:45 +08:00
|
|
|
.syntax unified
|
|
|
|
.global sym1
|
|
|
|
.global elsewhere
|
|
|
|
.weak weakref
|
|
|
|
sym1:
|
|
|
|
b.w elsewhere
|
|
|
|
b.w weakref
|
|
|
|
|
2020-02-08 01:43:40 +08:00
|
|
|
bl elsewhere
|
|
|
|
bl weakref
|
|
|
|
|
2017-01-04 17:45:45 +08:00
|
|
|
// Check that we generate a thunk for an undefined symbol called via a plt
|
|
|
|
// entry.
|
|
|
|
|
|
|
|
// CHECK: Disassembly of section .text:
|
2019-05-01 18:40:48 +08:00
|
|
|
// CHECK-EMPTY:
|
2020-03-06 06:18:38 +08:00
|
|
|
// CHECK-NEXT: <sym1>:
|
2021-06-30 17:34:52 +08:00
|
|
|
// CHECK-NEXT: 101e0: b.w 0x101f0 <__ThumbV7PILongThunk_elsewhere>
|
|
|
|
// CHECK-NEXT: b.w 0x101fc <__ThumbV7PILongThunk_weakref>
|
|
|
|
// CHECK-NEXT: blx 0x10230
|
|
|
|
// CHECK-NEXT: blx 0x10240
|
2020-03-06 06:18:38 +08:00
|
|
|
// CHECK: <__ThumbV7PILongThunk_elsewhere>:
|
2020-04-18 23:06:37 +08:00
|
|
|
// CHECK-NEXT: 101f0: movw r12, #52
|
2020-02-08 01:43:40 +08:00
|
|
|
// CHECK-NEXT: movt r12, #0
|
|
|
|
// CHECK-NEXT: add r12, pc
|
|
|
|
// CHECK-NEXT: bx r12
|
2020-03-06 06:18:38 +08:00
|
|
|
// CHECK: <__ThumbV7PILongThunk_weakref>:
|
2020-04-18 23:06:37 +08:00
|
|
|
// CHECK-NEXT: 101fc: movw r12, #56
|
2020-02-08 01:43:40 +08:00
|
|
|
// CHECK-NEXT: movt r12, #0
|
|
|
|
// CHECK-NEXT: add r12, pc
|
|
|
|
// CHECK-NEXT: bx r12
|
2017-01-04 17:45:45 +08:00
|
|
|
|
2019-08-21 23:30:55 +08:00
|
|
|
// CHECK: Disassembly of section .plt:
|
|
|
|
// CHECK-EMPTY:
|
2020-03-06 06:18:38 +08:00
|
|
|
// CHECK-NEXT: <$a>:
|
2020-04-18 23:06:37 +08:00
|
|
|
// CHECK-NEXT: 10210: str lr, [sp, #-4]!
|
2020-02-08 01:43:40 +08:00
|
|
|
// CHECK-NEXT: add lr, pc, #0, #12
|
2020-04-18 23:06:37 +08:00
|
|
|
// CHECK-NEXT: add lr, lr, #32
|
2020-02-08 01:43:40 +08:00
|
|
|
// CHECK-NEXT: ldr pc, [lr, #148]!
|
2020-03-06 06:18:38 +08:00
|
|
|
// CHECK: <$d>:
|
2020-04-18 23:06:37 +08:00
|
|
|
// CHECK-NEXT: 10220: d4 d4 d4 d4 .word 0xd4d4d4d4
|
2020-02-08 01:43:40 +08:00
|
|
|
// CHECK-NEXT: .word 0xd4d4d4d4
|
|
|
|
// CHECK-NEXT: .word 0xd4d4d4d4
|
|
|
|
// CHECK-NEXT: .word 0xd4d4d4d4
|
2020-03-06 06:18:38 +08:00
|
|
|
// CHECK: <$a>:
|
2020-04-18 23:06:37 +08:00
|
|
|
// CHECK-NEXT: 10230: add r12, pc, #0, #12
|
|
|
|
// CHECK-NEXT: add r12, r12, #32
|
2020-02-08 01:43:40 +08:00
|
|
|
// CHECK-NEXT: ldr pc, [r12, #124]!
|
2020-03-06 06:18:38 +08:00
|
|
|
// CHECK: <$d>:
|
2020-04-18 23:06:37 +08:00
|
|
|
// CHECK-NEXT: 1023c: d4 d4 d4 d4 .word 0xd4d4d4d4
|
2020-03-06 06:18:38 +08:00
|
|
|
// CHECK: <$a>:
|
2020-04-18 23:06:37 +08:00
|
|
|
// CHECK-NEXT: 10240: add r12, pc, #0, #12
|
|
|
|
// CHECK-NEXT: add r12, r12, #32
|
2020-02-08 01:43:40 +08:00
|
|
|
// CHECK-NEXT: ldr pc, [r12, #112]!
|
2020-03-06 06:18:38 +08:00
|
|
|
// CHECK: <$d>:
|
2020-04-18 23:06:37 +08:00
|
|
|
// CHECK-NEXT: 1024c: d4 d4 d4 d4 .word 0xd4d4d4d4
|