[RFC PATCH v1] arm: lib: add __gnu_thumb1_case_si

Francis Laniel francis.laniel at amarulasolutions.com
Sat Apr 1 23:54:39 CEST 2023


The assembly for __gnu_thumb1_case_si was taken from upstream gcc and adapted
as width suffix was removed for the add instruction [1].

Signed-off-by: Francis Laniel <francis.laniel at amarulasolutions.com>
Tested-by: Tony Dinh <mibodhi at gmail.com>
[1] https://github.com/gcc-mirror/gcc/blob/4f181f9c7ee3efc509d185fdfda33be9018f1611/libgcc/config/arm/lib1funcs.S#L2156
---
 arch/arm/lib/lib1funcs.S | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/lib/lib1funcs.S b/arch/arm/lib/lib1funcs.S
index 7ff4446dd6..79cedc0aad 100644
--- a/arch/arm/lib/lib1funcs.S
+++ b/arch/arm/lib/lib1funcs.S
@@ -424,4 +424,21 @@ ENTRY(__gnu_thumb1_case_uhi)
 	ret	lr
 ENDPROC(__gnu_thumb1_case_uhi)
 .popsection
+
+/* Taken and adapted from: https://github.com/gcc-mirror/gcc/blob/4f181f9c7ee3efc509d185fdfda33be9018f1611/libgcc/config/arm/lib1funcs.S#L2156 */
+.pushsection .text.__gnu_thumb1_case_si, "ax"
+ENTRY(__gnu_thumb1_case_si)
+	push	{r0, r1}
+	mov	r1, lr
+	adds	r1, r1, #2	/* Align to word.  */
+	lsrs	r1, r1, #2
+	lsls	r0, r0, #2
+	lsls	r1, r1, #2
+	ldr	r0, [r1, r0]
+	adds	r0, r0, r1
+	mov	lr, r0
+	pop	{r0, r1}
+	mov	pc, lr		/* We know we were called from thumb code.  */
+ENDPROC(__gnu_thumb1_case_si)
+.popsection
 #endif
--
2.34.1



More information about the U-Boot mailing list