Skip to content

Commit 15eb317

Browse files
yangao1xiaoxiang781216
authored andcommitted
libc/arm64: add cfi for optimized func
(gdb) bt #0 arch_strlen () at machine/arm64/gnu/arch_strlen.S:119 #1 0x000000004043a2c0 in strchr (s=s@entry=0x408e5e40 "HELLO WORLD", c=c@entry=87) at machine/arch_libc.c:252 #2 0x0000000040504c6c in strchr (c=87, s=0x408e5e40 "HELLO WORLD") at /home/mi/ssd/dev-system/nuttx/include/string.h:306 apache#3 test_strchr () at hello_main.c:79 apache#4 hello_main (argc=argc@entry=1, argv=argv@entry=0x40b5c090) at hello_main.c:132 apache#5 0x000000004043d958 in nxtask_startup (entrypt=0x40504ba0 <hello_main>, argc=argc@entry=1, argv=argv@entry=0x40b5c090) at sched/task_startup.c:72 apache#6 0x00000000403f1ab4 in nxtask_start () at task/task_start.c:104 apache#7 0x0000000000000000 in ?? () Signed-off-by: yangao1 <yangao1@xiaomi.com>
1 parent 34aef9c commit 15eb317

13 files changed

Lines changed: 39 additions & 0 deletions

libs/libc/machine/arm64/arch_memchr.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
.endm
8282

8383
def_fn ARCH_LIBCFUN(memchr)
84+
.cfi_sections .debug_frame
85+
.cfi_startproc
8486
/* Do not dereference srcin if no bytes to compare. */
8587
cbz cntin, .Lzero_length
8688
/*
@@ -174,6 +176,7 @@ def_fn ARCH_LIBCFUN(memchr)
174176
mov result, #0
175177
ret
176178

179+
.cfi_endproc
177180
.size ARCH_LIBCFUN(memchr), . - ARCH_LIBCFUN(memchr)
178181

179182
#endif

libs/libc/machine/arm64/arch_memcmp.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
.endm
9696

9797
def_fn ARCH_LIBCFUN(memcmp) p2align=6
98+
.cfi_sections .debug_frame
99+
.cfi_startproc
98100
subs limit, limit, 8
99101
b.lo L(less8)
100102

@@ -197,6 +199,7 @@ L(byte_loop):
197199
sub result, data1w, data2w
198200
ret
199201

202+
.cfi_endproc
200203
.size ARCH_LIBCFUN(memcmp), . - ARCH_LIBCFUN(memcmp)
201204

202205
#endif

libs/libc/machine/arm64/arch_memcpy.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@
112112
*/
113113

114114
def_fn ARCH_LIBCFUN(memcpy) p2align=6
115+
.cfi_sections .debug_frame
116+
.cfi_startproc
115117
prfm PLDL1KEEP, [src]
116118
add srcend, src, count
117119
add dstend, dstin, count
@@ -233,6 +235,7 @@ L(copy_long):
233235
stp C_l, C_h, [dstend, -16]
234236
ret
235237

238+
.cfi_endproc
236239
.size ARCH_LIBCFUN(memcpy), . - ARCH_LIBCFUN(memcpy)
237240

238241
#endif

libs/libc/machine/arm64/arch_memmove.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@
101101
*/
102102

103103
def_fn ARCH_LIBCFUN(memmove), 6
104+
.cfi_sections .debug_frame
105+
.cfi_startproc
104106
sub tmp1, dstin, src
105107
cmp count, 96
106108
ccmp tmp1, count, 2, hi
@@ -158,6 +160,7 @@ def_fn ARCH_LIBCFUN(memmove), 6
158160
stp C_l, C_h, [dstin]
159161
3: ret
160162

163+
.cfi_endproc
161164
.size ARCH_LIBCFUN(memmove), . - ARCH_LIBCFUN(memmove)
162165

163166
#endif

libs/libc/machine/arm64/arch_memset.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@
9494

9595
def_fn ARCH_LIBCFUN(memset) p2align=6
9696

97+
.cfi_sections .debug_frame
98+
.cfi_startproc
9799
dup v0.16B, valw
98100
add dstend, dstin, count
99101

@@ -243,6 +245,7 @@ L(zva_other):
243245
sub dst, dst, 32 /* Bias dst for tail loop. */
244246
b L(tail64)
245247

248+
.cfi_endproc
246249
.size ARCH_LIBCFUN(memset), . - ARCH_LIBCFUN(memset)
247250

248251
#endif

libs/libc/machine/arm64/arch_strchr.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585
.endm
8686

8787
def_fn ARCH_LIBCFUN(strchr)
88+
.cfi_sections .debug_frame
89+
.cfi_startproc
8890
/* Magic constant 0x40100401 to allow us to identify which lane
8991
matches the requested byte. Magic constant 0x80200802 used
9092
similarly for NUL termination. */
@@ -162,6 +164,7 @@ def_fn ARCH_LIBCFUN(strchr)
162164
csel result, result, xzr, eq
163165
ret
164166

167+
.cfi_endproc
165168
.size ARCH_LIBCFUN(strchr), . - ARCH_LIBCFUN(strchr)
166169

167170
#endif

libs/libc/machine/arm64/arch_strchrnul.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
.endm
8282

8383
def_fn ARCH_LIBCFUN(strchrnul)
84+
.cfi_sections .debug_frame
85+
.cfi_startproc
8486
/* Magic constant 0x40100401 to allow us to identify which lane
8587
matches the termination condition. */
8688
mov wtmp2, #0x0401
@@ -147,6 +149,7 @@ def_fn ARCH_LIBCFUN(strchrnul)
147149
add result, src, tmp1, lsr #1
148150
ret
149151

152+
.cfi_endproc
150153
.size ARCH_LIBCFUN(strchrnul), . - ARCH_LIBCFUN(strchrnul)
151154

152155
#endif

libs/libc/machine/arm64/arch_strcmp.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777

7878
/* Start of performance-critical section -- one 64B cache line. */
7979
def_fn ARCH_LIBCFUN(strcmp) p2align=6
80+
.cfi_sections .debug_frame
81+
.cfi_startproc
8082
eor tmp1, src1, src2
8183
mov zeroones, #REP8_01
8284
tst tmp1, #7
@@ -206,6 +208,7 @@ L(loop_misaligned):
206208
L(done):
207209
sub result, data1, data2
208210
ret
211+
.cfi_endproc
209212
.size ARCH_LIBCFUN(strcmp), .-ARCH_LIBCFUN(strcmp)
210213

211214
#endif

libs/libc/machine/arm64/arch_strcpy.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108
#define MIN_PAGE_SIZE (1 << MIN_PAGE_P2)
109109

110110
def_fn ARCH_LIBCFUN(strcpy) p2align=6
111+
.cfi_sections .debug_frame
112+
.cfi_startproc
111113
/* For moderately short strings, the fastest way to do the copy is to
112114
calculate the length of the string in the same way as strlen, then
113115
essentially do a memcpy of the result. This avoids the need for
@@ -321,6 +323,7 @@ def_fn ARCH_LIBCFUN(strcpy) p2align=6
321323
bic has_nul2, tmp3, tmp4
322324
b .Lfp_gt8
323325

326+
.cfi_endproc
324327
.size ARCH_LIBCFUN(strcpy), . - ARCH_LIBCFUN(strcpy)
325328

326329
#endif

libs/libc/machine/arm64/arch_strlen.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@
114114
boundary. */
115115

116116
def_fn ARCH_LIBCFUN(strlen) p2align=6
117+
.cfi_sections .debug_frame
118+
.cfi_startproc
117119
and tmp1, srcin, MIN_PAGE_SIZE - 1
118120
mov zeroones, REP8_01
119121
cmp tmp1, MIN_PAGE_SIZE - 16
@@ -243,6 +245,7 @@ L(page_cross):
243245
csel data2, data2, tmp2, eq
244246
b L(page_cross_entry)
245247

248+
.cfi_endproc
246249
.size ARCH_LIBCFUN(strlen), . - ARCH_LIBCFUN(strlen)
247250

248251
#endif

0 commit comments

Comments
 (0)