This change add bti instructions at the beginning of arm specific
libgcc hand written assembly routines.
2022-03-31 Andrea Corallo <[email protected]>
* libgcc/config/arm/crti.S (FUNC_START): Add bti instruction if
necessary.
* libgcc/config/arm/lib1funcs.S (THUMB_FUNC_START, FUNC_START):
Likewise.
diff --git a/libgcc/config/arm/crti.S b/libgcc/config/arm/crti.S
index 0192972a7e6..bac2d87fbb9 100644
--- a/libgcc/config/arm/crti.S
+++ b/libgcc/config/arm/crti.S
@@ -51,7 +51,9 @@
.macro FUNC_START
#ifdef __thumb__
.thumb
-
+#if defined(__ARM_FEATURE_BTI)
+ bti
+#endif
push {r3, r4, r5, r6, r7, lr}
#else
.arm
diff --git a/libgcc/config/arm/lib1funcs.S b/libgcc/config/arm/lib1funcs.S
index 8c39c9f20a2..45dfb5da9ee 100644
--- a/libgcc/config/arm/lib1funcs.S
+++ b/libgcc/config/arm/lib1funcs.S
@@ -345,6 +345,9 @@ LSYM(Ldiv0):
TYPE (\name)
.thumb_func
SYM (\name):
+#if defined(__ARM_FEATURE_BTI)
+ bti
+#endif
.endm
/* Function start macros. Variants for ARM and Thumb. */
@@ -372,6 +375,9 @@ SYM (\name):
THUMB_FUNC
THUMB_SYNTAX
SYM (__\name):
+#if defined(__ARM_FEATURE_BTI)
+ bti
+#endif
.endm
.macro ARM_SYM_START name