You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
704 B

diff --git a/arch/arm/mcount.S b/arch/arm/mcount.S
index bbfc597..eb28831 100644
--- a/arch/arm/mcount.S
+++ b/arch/arm/mcount.S
@@ -60,6 +60,26 @@ GLOBAL(__gnu_mcount_nc)
bx ip
END(__gnu_mcount_nc)
+/* for clang */
+GLOBAL(mcount)
+ push {r0-r3, lr}
+ ands r3, lr, #1 /* check lr for ARM/THUMB detection */
+ add r0, fp, #4 /* r0 points to pushed LR */
+ bne 1f
+ ldr r1, [fp] /* fp (=r11) might point to return address on ARM */
+ ldr r2, [r0]
+ cmp r1, r2
+ moveq r0, lr
+1:
+ mov r1, lr /* child ip */
+ mov r2, sp /* mcount_args */
+
+ bl mcount_entry
+
+ pop {r0-r3, lr}
+ bx lr
+END(mcount)
+
ENTRY(mcount_return)
push {r0-r3, lr, pc} /* ensure 8-byte alignment */