[ulib][musl] Add cfi directives for cortex-strings

This commit adds CFI directives for the cortex-strings functions in the
libc, so unwinders can unwind through them.

The change just adds .cfi_startproc and .cfi_endproc on each function.
The functions don't touch the stack, so those are the only two
directives needed.

Change-Id: I8fdd75c085d818db4ed9b0b5780635aec1b4cf66
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/559662
Reviewed-by: Roland McGrath <mcgrathr@google.com>
Commit-Queue: Marco Vanotti <mvanotti@google.com>
diff --git a/zircon/third_party/lib/cortex-strings/src/aarch64/memchr.S b/zircon/third_party/lib/cortex-strings/src/aarch64/memchr.S
index a3492d4..c973e57 100644
--- a/zircon/third_party/lib/cortex-strings/src/aarch64/memchr.S
+++ b/zircon/third_party/lib/cortex-strings/src/aarch64/memchr.S
@@ -73,6 +73,7 @@
 	.global \f
 	.type \f, %function
 \f:
+	.cfi_startproc
 	.endm
 
 def_fn memchr
@@ -169,4 +170,5 @@
 	mov	result, #0
 	ret
 
+	.cfi_endproc
 	.size	memchr, . - memchr
diff --git a/zircon/third_party/lib/cortex-strings/src/aarch64/memcmp.S b/zircon/third_party/lib/cortex-strings/src/aarch64/memcmp.S
index abba416..39788c1 100644
--- a/zircon/third_party/lib/cortex-strings/src/aarch64/memcmp.S
+++ b/zircon/third_party/lib/cortex-strings/src/aarch64/memcmp.S
@@ -37,6 +37,7 @@
 	.global \f
 	.type \f, %function
 \f:
+	.cfi_startproc
 	.endm
 
 /* Parameters and result.  */
@@ -159,4 +160,5 @@
 	b.eq	1b
 	sub	result, data1, data2
 	ret
+	.cfi_endproc
 	.size memcmp, . - memcmp
diff --git a/zircon/third_party/lib/cortex-strings/src/aarch64/memcpy.S b/zircon/third_party/lib/cortex-strings/src/aarch64/memcpy.S
index cbae371..5ac87802 100644
--- a/zircon/third_party/lib/cortex-strings/src/aarch64/memcpy.S
+++ b/zircon/third_party/lib/cortex-strings/src/aarch64/memcpy.S
@@ -89,6 +89,7 @@
 	.global \f
 	.type \f, %function
 \f:
+	.cfi_startproc
 	.endm
 
 /* Copies are split into 3 main cases: small copies of up to 16 bytes,
@@ -222,4 +223,5 @@
 	stp	C_l, C_h, [dstend, -16]
 	ret
 
+	.cfi_endproc
 	.size	memcpy, . - memcpy
diff --git a/zircon/third_party/lib/cortex-strings/src/aarch64/memmove.S b/zircon/third_party/lib/cortex-strings/src/aarch64/memmove.S
index 9a3fc8e..cb60490 100644
--- a/zircon/third_party/lib/cortex-strings/src/aarch64/memmove.S
+++ b/zircon/third_party/lib/cortex-strings/src/aarch64/memmove.S
@@ -63,6 +63,7 @@
 	.global \f
 	.type \f, %function
 \f:
+	.cfi_startproc
 	.endm
 
 /* Parameters and result.  */
@@ -154,4 +155,5 @@
 .Lmemcpy:
 	b	memcpy
 
+	.cfi_endproc
 	.size	memmove, . - memmove
diff --git a/zircon/third_party/lib/cortex-strings/src/aarch64/memset.S b/zircon/third_party/lib/cortex-strings/src/aarch64/memset.S
index 2d6675a..41d3fae 100644
--- a/zircon/third_party/lib/cortex-strings/src/aarch64/memset.S
+++ b/zircon/third_party/lib/cortex-strings/src/aarch64/memset.S
@@ -80,6 +80,7 @@
 	.global \f
 	.type \f, %function
 \f:
+	.cfi_startproc
 	.endm
 
 def_fn memset p2align=6
@@ -232,4 +233,5 @@
 4:	add	count, count, zva_len
 	b	L(tail64)
 
+	.cfi_endproc
 	.size	memset, . - memset
diff --git a/zircon/third_party/lib/cortex-strings/src/aarch64/strchr.S b/zircon/third_party/lib/cortex-strings/src/aarch64/strchr.S
index a268915..9587f28 100644
--- a/zircon/third_party/lib/cortex-strings/src/aarch64/strchr.S
+++ b/zircon/third_party/lib/cortex-strings/src/aarch64/strchr.S
@@ -76,6 +76,7 @@
 	.global \f
 	.type \f, %function
 \f:
+	.cfi_startproc
 	.endm
 
 def_fn strchr
@@ -156,4 +157,5 @@
 	csel	result, result, xzr, eq
 	ret
 
+	.cfi_endproc
 	.size	strchr, . - strchr
diff --git a/zircon/third_party/lib/cortex-strings/src/aarch64/strchrnul.S b/zircon/third_party/lib/cortex-strings/src/aarch64/strchrnul.S
index 956aa5e..a56774e 100644
--- a/zircon/third_party/lib/cortex-strings/src/aarch64/strchrnul.S
+++ b/zircon/third_party/lib/cortex-strings/src/aarch64/strchrnul.S
@@ -72,6 +72,7 @@
 	.global \f
 	.type \f, %function
 \f:
+	.cfi_startproc
 	.endm
 
 def_fn strchrnul
@@ -141,4 +142,5 @@
 	add	result, src, tmp1, lsr #1
 	ret
 
+	.cfi_endproc
 	.size	strchrnul, . - strchrnul
diff --git a/zircon/third_party/lib/cortex-strings/src/aarch64/strcmp.S b/zircon/third_party/lib/cortex-strings/src/aarch64/strcmp.S
index e5af383..e12dfd5 100644
--- a/zircon/third_party/lib/cortex-strings/src/aarch64/strcmp.S
+++ b/zircon/third_party/lib/cortex-strings/src/aarch64/strcmp.S
@@ -35,6 +35,7 @@
 	.global \f
 	.type \f, %function
 \f:
+	.cfi_startproc
 	.endm
 
 #define REP8_01 0x0101010101010101
@@ -164,3 +165,5 @@
 	b.eq	.Lmisaligned8
 	sub	result, data1, data2
 	ret
+	.cfi_endproc
+	.size   strcmp, . - strcmp
diff --git a/zircon/third_party/lib/cortex-strings/src/aarch64/strcpy.S b/zircon/third_party/lib/cortex-strings/src/aarch64/strcpy.S
index 3d0d7f5..55342d3 100644
--- a/zircon/third_party/lib/cortex-strings/src/aarch64/strcpy.S
+++ b/zircon/third_party/lib/cortex-strings/src/aarch64/strcpy.S
@@ -74,6 +74,7 @@
 	.global \f
 	.type \f, %function
 \f:
+	.cfi_startproc
 	.endm
 
 	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
@@ -333,4 +334,5 @@
 	bic	has_nul2, tmp3, tmp4
 	b	.Lfp_gt8
 
+	.cfi_endproc
 	.size	STRCPY, . - STRCPY
diff --git a/zircon/third_party/lib/cortex-strings/src/aarch64/strlen.S b/zircon/third_party/lib/cortex-strings/src/aarch64/strlen.S
index 5850640..375f5f3 100644
--- a/zircon/third_party/lib/cortex-strings/src/aarch64/strlen.S
+++ b/zircon/third_party/lib/cortex-strings/src/aarch64/strlen.S
@@ -57,6 +57,7 @@
 	.global \f
 	.type \f, %function
 \f:
+	.cfi_startproc
 	.endm
 
 	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
@@ -230,4 +231,5 @@
 	csel	data2, data2, tmp2, eq
 	b	L(page_cross_entry)
 
+	.cfi_endproc
 	.size	strlen, . - strlen
diff --git a/zircon/third_party/lib/cortex-strings/src/aarch64/strncmp.S b/zircon/third_party/lib/cortex-strings/src/aarch64/strncmp.S
index 2136787..5257218 100644
--- a/zircon/third_party/lib/cortex-strings/src/aarch64/strncmp.S
+++ b/zircon/third_party/lib/cortex-strings/src/aarch64/strncmp.S
@@ -35,6 +35,7 @@
 	.global \f
 	.type \f, %function
 \f:
+	.cfi_startproc
 	.endm
 
 #define REP8_01 0x0101010101010101
@@ -219,4 +220,5 @@
 	b.eq	1b
 	sub	result, data1, data2
 	ret
+	.cfi_endproc
 	.size strncmp, . - strncmp
diff --git a/zircon/third_party/lib/cortex-strings/src/aarch64/strnlen.S b/zircon/third_party/lib/cortex-strings/src/aarch64/strnlen.S
index c0e6098..2165d5a 100644
--- a/zircon/third_party/lib/cortex-strings/src/aarch64/strnlen.S
+++ b/zircon/third_party/lib/cortex-strings/src/aarch64/strnlen.S
@@ -57,6 +57,7 @@
 	.global \f
 	.type \f, %function
 \f:
+	.cfi_startproc
 	.endm
 
 #define REP8_01 0x0101010101010101
@@ -178,4 +179,5 @@
 	csinv	data1, data1, xzr, le
 	csel	data2, data2, data2a, le
 	b	.Lrealigned
+	.cfi_endproc
 	.size	strnlen, . - .Lstart	/* Include pre-padding in size.  */