From c4f9949016c24e63d6acd957dd4b7afb9a2ae422 Mon Sep 17 00:00:00 2001 From: Xiao-Long Chen Date: Sun, 28 Aug 2016 16:05:17 -0400 Subject: [PATCH] libmbcommon: Add dummy atexit() until android-ndk/ndk#132 is fixed --- cryptfstool/main.cpp | 2 ++ libmbcommon/include/mbcommon/atexit_hack.c | 36 ++++++++++++++++++++++ mbbootui/main.cpp | 2 ++ mbtool/main.cpp | 2 ++ odinupdater/fuse-sparse.cpp | 4 ++- odinupdater/odinupdater.cpp | 2 ++ 6 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 libmbcommon/include/mbcommon/atexit_hack.c diff --git a/cryptfstool/main.cpp b/cryptfstool/main.cpp index 8b8d8454a..db19aa9c2 100644 --- a/cryptfstool/main.cpp +++ b/cryptfstool/main.cpp @@ -371,3 +371,5 @@ int main(int argc, char *argv[]) return ret ? EXIT_SUCCESS : EXIT_FAILURE; } + +#include "mbcommon/atexit_hack.c" diff --git a/libmbcommon/include/mbcommon/atexit_hack.c b/libmbcommon/include/mbcommon/atexit_hack.c new file mode 100644 index 000000000..81a965107 --- /dev/null +++ b/libmbcommon/include/mbcommon/atexit_hack.c @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2016 Andrew Gunnerson + * + * This file is part of MultiBootPatcher + * + * MultiBootPatcher is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MultiBootPatcher is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MultiBootPatcher. If not, see . + */ + +#ifdef __cplusplus +extern "C" { +#endif + +// HACK: Remove when https://github.com/android-ndk/ndk/issues/132 is released +#ifdef __ARM_ARCH_7A__ +int atexit(void (*function)(void)) +{ + // We don't use atexit() anyway + (void) function; + return 0; +} +#endif + +#ifdef __cplusplus +} +#endif diff --git a/mbbootui/main.cpp b/mbbootui/main.cpp index df0b64eb2..b1128e150 100644 --- a/mbbootui/main.cpp +++ b/mbbootui/main.cpp @@ -725,3 +725,5 @@ void __android_log_assert(const char *cond, const char *tag, } } + +#include "mbcommon/atexit_hack.c" diff --git a/mbtool/main.cpp b/mbtool/main.cpp index 6d01a2dbc..9666a6015 100644 --- a/mbtool/main.cpp +++ b/mbtool/main.cpp @@ -204,3 +204,5 @@ int main(int argc, char *argv[]) return ret; } + +#include "mbcommon/atexit_hack.c" diff --git a/odinupdater/fuse-sparse.cpp b/odinupdater/fuse-sparse.cpp index f1728b90c..74355df0a 100644 --- a/odinupdater/fuse-sparse.cpp +++ b/odinupdater/fuse-sparse.cpp @@ -359,4 +359,6 @@ int main(int argc, char *argv[]) free(arg_ctx.target_file); return fuse_ret; -} \ No newline at end of file +} + +#include "mbcommon/atexit_hack.c" diff --git a/odinupdater/odinupdater.cpp b/odinupdater/odinupdater.cpp index 463db3193..5f75da51a 100644 --- a/odinupdater/odinupdater.cpp +++ b/odinupdater/odinupdater.cpp @@ -909,3 +909,5 @@ int main(int argc, char *argv[]) return flash_zip() ? EXIT_SUCCESS : EXIT_FAILURE; } + +#include "mbcommon/atexit_hack.c"