https://bugs.kde.org/show_bug.cgi?id=368529
Bug ID: 368529 Summary: Android arm target link error, missing atexit and pthread_atfork Product: valgrind Version: 3.11.0 Platform: Android OS: other Status: UNCONFIRMED Severity: grave Priority: NOR Component: general Assignee: jsew...@acm.org Reporter: c...@google.com When creating a statically linked valgrind for Android arm target and compiled by clang/llvm compiler, the atexit and pthread_atfork functions are used indirectly but undefined in Android libc.a. The link failed with undefined message like: external/jemalloc/src/jemalloc.c:1343: error: undefined reference to 'pthread_atfork' external/jemalloc/src/jemalloc.c:1279: error: undefined reference to 'atexit' The following diff should fixed the problem for Android arm target: diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 140efbf..634822e 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -3998,6 +3998,15 @@ UWord voucher_mach_msg_set ( UWord arg1 ) #endif +/*====================================================================*/ +/*=== Dummy atexit and pthread_atfork for Android clang/llvm, arm ===*/ +/*====================================================================*/ + +#if defined(ANDROID) && defined(__clang__) && defined(__arm__) +__attribute__((weak)) void atexit() {} +__attribute__((weak)) void pthread_atfork() {} +#endif + /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/ Reproducible: Always Steps to Reproduce: Build Android's external/valgrind project for aosp_arm-eng target. Actual Results: link error: external/jemalloc/src/jemalloc.c:1343: error: undefined reference to 'pthread_atfork' external/jemalloc/src/jemalloc.c:1279: error: undefined reference to 'atexit' Expected Results: successful link -- You are receiving this mail because: You are watching all bug changes.