[compiler-rt] ab05827 - [compiler-rt][ARM] Make interworking test compatible with BTI (#226154)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 01:27:39 PDT 2026


Author: Ties Stuij
Date: 2026-09-29T09:27:31+01:00
New Revision: ab0582707ef7ea0c4b03dff58ae9c32a9bdfec5c

URL: https://github.com/llvm/llvm-project/commit/ab0582707ef7ea0c4b03dff58ae9c32a9bdfec5c
DIFF: https://github.com/llvm/llvm-project/commit/ab0582707ef7ea0c4b03dff58ae9c32a9bdfec5c.diff

LOG: [compiler-rt][ARM] Make interworking test compatible with BTI (#226154)

In the aeabi_cmpflags_interwork_test.c test wrappers, we should return
through lr instead of r3 so that runs with BTI enabled don't fail. As
returns through lr don't require a landing pad, and returns through r3
do.

Added: 
    

Modified: 
    compiler-rt/test/builtins/Unit/arm/aeabi_cmpflags_interwork_test.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/builtins/Unit/arm/aeabi_cmpflags_interwork_test.c b/compiler-rt/test/builtins/Unit/arm/aeabi_cmpflags_interwork_test.c
index 50c2dafeae2a8..e6e90c340b173 100644
--- a/compiler-rt/test/builtins/Unit/arm/aeabi_cmpflags_interwork_test.c
+++ b/compiler-rt/test/builtins/Unit/arm/aeabi_cmpflags_interwork_test.c
@@ -6,6 +6,9 @@
 // ARMv4T Thumb code can not read status register. These helpers call
 // the EABI comparison functions and turn Z/C flags into numbers:
 // -1 for less, 0 for equal, and 1 for greater or unordered
+//
+// We need to return through LR so BTI does not need a landing pad.
+// But as thumb-1 cannot pop into LR, we go through r3.
 __asm__(".globl call_aeabi_cfcmple\n"
         ".thumb_func\n"
         "call_aeabi_cfcmple:\n"
@@ -24,7 +27,8 @@ __asm__(".globl call_aeabi_cfcmple\n"
         "3:\n"
         "  pop {r4}\n"
         "  pop {r3}\n"
-        "  bx r3\n"
+        "  mov lr, r3\n"
+        "  bx lr\n"
 
         ".globl call_aeabi_cdcmple\n"
         ".thumb_func\n"
@@ -44,7 +48,8 @@ __asm__(".globl call_aeabi_cfcmple\n"
         "3:\n"
         "  pop {r4}\n"
         "  pop {r3}\n"
-        "  bx r3\n");
+        "  mov lr, r3\n"
+        "  bx lr\n");
 
 extern int call_aeabi_cfcmple(float, float);
 extern int call_aeabi_cdcmple(double, double);


        


More information about the llvm-commits mailing list