[llvm] b94a9bc - ARM: Improve branch fixup test
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 5 10:37:34 PDT 2025
Author: Fangrui Song
Date: 2025-07-05T10:37:29-07:00
New Revision: b94a9bc741e5d59df11a4b167e6311661a2551d2
URL: https://github.com/llvm/llvm-project/commit/b94a9bc741e5d59df11a4b167e6311661a2551d2
DIFF: https://github.com/llvm/llvm-project/commit/b94a9bc741e5d59df11a4b167e6311661a2551d2.diff
LOG: ARM: Improve branch fixup test
Added:
llvm/test/MC/ARM/Relocations/thumb-branch-out-of-range.s
llvm/test/MC/ARM/Relocations/thumb-branch.s
Modified:
llvm/test/MC/ARM/elf-thumbfunc-reloc.s
Removed:
llvm/test/MC/ARM/thumb-branches.s
################################################################################
diff --git a/llvm/test/MC/ARM/thumb-branches.s b/llvm/test/MC/ARM/Relocations/thumb-branch-out-of-range.s
similarity index 100%
rename from llvm/test/MC/ARM/thumb-branches.s
rename to llvm/test/MC/ARM/Relocations/thumb-branch-out-of-range.s
diff --git a/llvm/test/MC/ARM/Relocations/thumb-branch.s b/llvm/test/MC/ARM/Relocations/thumb-branch.s
new file mode 100644
index 0000000000000..e0a487b719d8a
--- /dev/null
+++ b/llvm/test/MC/ARM/Relocations/thumb-branch.s
@@ -0,0 +1,21 @@
+// RUN: llvm-mc -filetype=obj -triple=thumbv7a-linux-gnueabi %s -o %t
+// RUN: llvm-objdump -dr %t --triple=thumbv7a | FileCheck %s
+
+// CHECK: f7ff fffe bl {{.*}} @ imm = #-0x4
+// CHECK-NEXT: 00000000: R_ARM_THM_CALL foo
+// CHECK-NEXT: f7ff effe blx {{.*}} @ imm = #-0x4
+// CHECK-NEXT: 00000004: R_ARM_THM_CALL callee_thumb_low
+// CHECK-NEXT: bf00 nop
+// CHECK-NEXT: f7ff effe blx {{.*}} @ imm = #-0x4
+// CHECK-NEXT: 0000000a: R_ARM_THM_CALL callee_thumb_high
+// CHECK-NEXT: 4770 bx lr
+
+ .syntax unified
+ .section .text, "ax",%progbits
+ .thumb
+ bl foo
+
+ blx callee_thumb_low
+ nop
+ blx callee_thumb_high
+ bx lr
diff --git a/llvm/test/MC/ARM/elf-thumbfunc-reloc.s b/llvm/test/MC/ARM/elf-thumbfunc-reloc.s
index fdc49bcde4edc..d52ced6e20a10 100644
--- a/llvm/test/MC/ARM/elf-thumbfunc-reloc.s
+++ b/llvm/test/MC/ARM/elf-thumbfunc-reloc.s
@@ -12,7 +12,6 @@
f:
push {r7, lr}
mov r7, sp
- bl g
pop {r7, pc}
.section .data.rel.local,"aw",%progbits
@@ -20,16 +19,10 @@ ptr:
.long f
-@@ make sure an R_ARM_THM_CALL relocation is generated for the call to g
- at CHECK: Relocations [
- at CHECK-NEXT: Section {{.*}} .rel.text {
- at CHECK-NEXT: 0x4 R_ARM_THM_CALL g
- at CHECK-NEXT: }
-
@@ make sure the relocation is with f. That is one way to make sure it includes
@@ the thumb bit.
- at CHECK-NEXT: Section ({{.*}}) .rel.data.rel.local {
+ at CHECK: Section ({{.*}}) .rel.data.rel.local {
@CHECK-NEXT: 0x0 R_ARM_ABS32 f
@CHECK-NEXT: }
@CHECK-NEXT: ]
More information about the llvm-commits
mailing list