2018-06-27 06:20:04 +08:00
|
|
|
// REQUIRES: arm
|
2020-01-06 22:16:05 +08:00
|
|
|
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
|
|
|
|
// RUN: ld.lld --image-base=0x10000000 %t -o %t2
|
2020-03-16 08:47:44 +08:00
|
|
|
// RUN: llvm-objdump --triple=armv7a-none-linux-gnueabi --no-show-raw-insn -d %t2 | FileCheck %s
|
2016-11-09 18:22:29 +08:00
|
|
|
|
2020-04-18 23:06:37 +08:00
|
|
|
/// Check that the ARM ABI rules for undefined weak symbols are applied.
|
|
|
|
/// Branch instructions are resolved to the next instruction. Undefined
|
|
|
|
/// Symbols in relative are resolved to the place so S - P + A = A.
|
|
|
|
/// We place the image-base at 0x10000000 to test that a range extensions thunk
|
|
|
|
/// is not generated.
|
2016-11-09 18:22:29 +08:00
|
|
|
|
|
|
|
.syntax unified
|
|
|
|
|
|
|
|
.weak target
|
2020-02-13 16:42:17 +08:00
|
|
|
.type target, %function
|
2016-11-09 18:22:29 +08:00
|
|
|
|
|
|
|
.text
|
|
|
|
.global _start
|
|
|
|
_start:
|
2020-04-18 23:06:37 +08:00
|
|
|
/// R_ARM_JUMP24
|
2016-11-09 18:22:29 +08:00
|
|
|
b target
|
2020-04-18 23:06:37 +08:00
|
|
|
/// R_ARM_CALL
|
2016-11-09 18:22:29 +08:00
|
|
|
bl target
|
2020-04-18 23:06:37 +08:00
|
|
|
/// R_ARM_CALL with exchange
|
2016-11-09 18:22:29 +08:00
|
|
|
blx target
|
2020-04-18 23:06:37 +08:00
|
|
|
/// R_ARM_MOVT_PREL
|
2016-11-09 18:22:29 +08:00
|
|
|
movt r0, :upper16:target - .
|
2020-04-18 23:06:37 +08:00
|
|
|
/// R_ARM_MOVW_PREL_NC
|
2016-11-09 18:22:29 +08:00
|
|
|
movw r0, :lower16:target - .
|
2020-04-18 23:06:37 +08:00
|
|
|
/// R_ARM_REL32
|
2016-11-09 18:22:29 +08:00
|
|
|
.word target - .
|
|
|
|
|
|
|
|
// CHECK: Disassembly of section .text:
|
2019-05-01 18:40:48 +08:00
|
|
|
// CHECK-EMPTY:
|
2020-04-18 23:06:37 +08:00
|
|
|
// CHECK-NEXT: 100100b4 <_start>:
|
|
|
|
// CHECK-NEXT: 100100b4: b #-4
|
|
|
|
// CHECK-NEXT: 100100b8: bl #-4
|
|
|
|
// CHECK-NEXT: 100100bc: bl #-4
|
|
|
|
// CHECK-NEXT: 100100c0: movt r0, #0
|
|
|
|
// CHECK-NEXT: 100100c4: movw r0, #0
|
|
|
|
// CHECK: 100100c8: 00 00 00 00 .word 0x00000000
|