Implement the "abort" stub in assembly for ARM.
So that we can always get the full stack trace regardless of gcc's handling of the "noreturn" attribute associated with abort(). [cherry-picked from master] BUG:6455193 Change-Id: I0102355f5bf20e636d3feab9d1424495f38e39e2
This commit is contained in:
@@ -102,29 +102,3 @@ abort(void)
|
||||
(void)kill(getpid(), SIGABRT);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
#ifdef __arm__
|
||||
/*
|
||||
* abort() does not return, which gcc interprets to mean that it doesn't
|
||||
* need to preserve any of the callee-save registers. Unfortunately this
|
||||
* includes the link register, so if LR is used there is no way to determine
|
||||
* which function called abort().
|
||||
*
|
||||
* We work around this by inserting a trivial stub that doesn't alter
|
||||
* any of the "interesting" registers and thus doesn't need to save them.
|
||||
* We can't just call __libc_android_abort from C because gcc uses "bl"
|
||||
* without first saving LR, so we use an asm statement. This also has
|
||||
* the side-effect of replacing abort() with __libc_android_abort() in
|
||||
* the stack trace.
|
||||
*
|
||||
* Ideally __libc_android_abort would be static, but I haven't figured out
|
||||
* how to tell gcc to call a static function from an asm statement.
|
||||
*/
|
||||
void
|
||||
abort(void)
|
||||
{
|
||||
asm ("b __libc_android_abort");
|
||||
_exit(1); /* suppress gcc noreturn warnings */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user