Fix all debug directives.
The backtrace when a fortify check failed was not correct. This change
adds all of the necessary directives to get a correct backtrace.
Fix the strcmp directives and change all labels to local labels.
Testing:
- Verify that the runtime can decode the stack for __memcpy_chk, __memset_chk,
__strcpy_chk, __strcat_chk fortify failures.
- Verify that gdb can decode the stack properly when hitting a fortify check.
- Verify that the runtime can decode the stack for a seg fault for all of the
_chk functions and for memcpy/memset.
- Verify that gdb can decode the stack for a seg fault for all of the _chk
functions and for memcpy/memset.
- Verify that the runtime can decode the stack for a seg fault for strcmp.
- Verify that gdb can decode the stack for a seg fault in strcmp.
Bug: 10342460
Bug: 10345269
Merge from internal master.
(cherry-picked from 05332f2ce7e542d32ff4d5cd9f60248ad71fbf0d)
Change-Id: Ibc919b117cfe72b9ae97e35bd48185477177c5ca
diff --git a/libc/arch-arm/krait/bionic/memcpy.S b/libc/arch-arm/krait/bionic/memcpy.S
index 3b4fca4..e433402 100644
--- a/libc/arch-arm/krait/bionic/memcpy.S
+++ b/libc/arch-arm/krait/bionic/memcpy.S
@@ -55,22 +55,23 @@
ENTRY(memcpy)
.cfi_startproc
pld [r1, #64]
- .save {r0, lr}
stmfd sp!, {r0, lr}
+ .save {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
.cfi_rel_offset lr, 4
-
- #include "memcpy_base.S"
.cfi_endproc
END(memcpy)
- .fnstart
+#define MEMCPY_BASE __memcpy_base
+#define MEMCPY_BASE_ALIGNED __memcpy_base_aligned
+#include "memcpy_base.S"
+
+ENTRY(__memcpy_chk_fail)
.cfi_startproc
-__memcpy_chk_fail:
// Preserve lr for backtrace.
- .save {lr}
push {lr}
+ .save {lr}
.cfi_def_cfa_offset 4
.cfi_rel_offset lr, 0
@@ -84,7 +85,7 @@
error_message:
.word error_string-(1b+4)
.cfi_endproc
- .fnend
+END(__memcpy_chk_fail)
.data
error_string: