From e9980c778b086b6bc751580eb5b3f431549156d8 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sat, 24 Feb 2024 03:41:03 -0800 Subject: [PATCH] Implement stub functions --- native/src/Application.mk | 1 + native/src/crt0/misc.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/native/src/Application.mk b/native/src/Application.mk index 673dde1d3..7a140e9a3 100644 --- a/native/src/Application.mk +++ b/native/src/Application.mk @@ -13,6 +13,7 @@ ifdef B_INIT # Disable all security and debugging features APP_CFLAGS += -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector -U_FORTIFY_SOURCE +APP_LDFLAGS += -Wl,-wrap,abort_message # Override output folder to make sure all dependencies are rebuilt with new CFLAGS NDK_APP_OUT := ./obj/init diff --git a/native/src/crt0/misc.c b/native/src/crt0/misc.c index 649c74109..367cb83b7 100644 --- a/native/src/crt0/misc.c +++ b/native/src/crt0/misc.c @@ -151,3 +151,13 @@ char *basename(const char *path) { int rc = __basename_r(path, buf, sizeof(buf)); return (rc < 0) ? NULL : buf; } + +// Simply just abort when abort_message is called +void __wrap_abort_message(const char* format, ...) { + abort(); +} + +// Don't care about C++ global destructors +int __cxa_atexit(void (*func) (void *), void * arg, void * dso_handle) { + return 0; +}