This follows other patches that changed printing immediate values of branch instructions to target addresses, see D76580 (x86), D76591 (PPC), D77853 (AArch64). As observing immediate values might sometimes be useful, they are printed as comments for branch instructions. // llvm-objdump -d output (before) 000200b4 <_start>: 200b4: ff ff ff fa blx #-4 <thumb> 000200b8 <thumb>: 200b8: ff f7 fc ef blx #-8 <_start> // llvm-objdump -d output (after) 000200b4 <_start>: 200b4: ff ff ff fa blx 0x200b8 <thumb> @ imm = #-4 000200b8 <thumb>: 200b8: ff f7 fc ef blx 0x200b4 <_start> @ imm = #-8 // GNU objdump -d. 000200b4 <_start>: 200b4: faffffff blx 200b8 <thumb> 000200b8 <thumb>: 200b8: f7ff effc blx 200b4 <_start> Differential Revision: https://reviews.llvm.org/D104701
42 lines
1.3 KiB
ArmAsm
42 lines
1.3 KiB
ArmAsm
// REQUIRES: arm
|
|
// 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
|
|
// RUN: llvm-objdump --triple=armv7a-none-linux-gnueabi --no-show-raw-insn -d %t2 | FileCheck %s
|
|
|
|
/// 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.
|
|
|
|
.syntax unified
|
|
|
|
.weak target
|
|
.type target, %function
|
|
|
|
.text
|
|
.global _start
|
|
_start:
|
|
/// R_ARM_JUMP24
|
|
b target
|
|
/// R_ARM_CALL
|
|
bl target
|
|
/// R_ARM_CALL with exchange
|
|
blx target
|
|
/// R_ARM_MOVT_PREL
|
|
movt r0, :upper16:target - .
|
|
/// R_ARM_MOVW_PREL_NC
|
|
movw r0, :lower16:target - .
|
|
/// R_ARM_REL32
|
|
.word target - .
|
|
|
|
// CHECK: Disassembly of section .text:
|
|
// CHECK-EMPTY:
|
|
// CHECK-NEXT: 100100b4 <_start>:
|
|
// CHECK-NEXT: 100100b4: b {{.+}} @ imm = #-4
|
|
// CHECK-NEXT: 100100b8: bl {{.+}} @ imm = #-4
|
|
// CHECK-NEXT: 100100bc: bl {{.+}} @ imm = #-4
|
|
// CHECK-NEXT: 100100c0: movt r0, #0
|
|
// CHECK-NEXT: 100100c4: movw r0, #0
|
|
// CHECK: 100100c8: 00 00 00 00 .word 0x00000000
|