https://bugs.kde.org/show_bug.cgi?id=368529

--- Comment #1 from c...@google.com ---
The undefined symbols were due to the use of builtin functions
like __aeabi_memcpy* and __aeabi_memclr* from clang/llvm compiler.
Those symbols pulled in other modules in Android libc.a and then
require atexit and pthread_atfork, which are not defined in libc.a.

A better solution is to define those __aeabi_* functions in m_main.c,
as it already defines memcpy to VG_(memcpy) and memset to VG_(memset).
The following is the suggested diff.

diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index 140efbf..66f04df 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -2883,6 +2883,46 @@ void __aeabi_unwind_cpp_pr1(void){
    VG_(printf)("Something called __aeabi_unwind_cpp_pr1()\n");
    vg_assert(0);
 }
+
+#if defined(ANDROID) && defined(__clang__)
+/* Replace __aeabi_memcpy* functions with vgPlain_memcpy. */
+void* __aeabi_memcpy(void *dest, const void *src, SizeT n);
+void* __aeabi_memcpy(void *dest, const void *src, SizeT n)
+{
+    return VG_(memcpy)(dest, src, n);
+}
+
+void* __aeabi_memcpy4(void *dest, const void *src, SizeT n);
+void* __aeabi_memcpy4(void *dest, const void *src, SizeT n)
+{
+    return VG_(memcpy)(dest, src, n);
+}
+
+void* __aeabi_memcpy8(void *dest, const void *src, SizeT n);
+void* __aeabi_memcpy8(void *dest, const void *src, SizeT n)
+{
+    return VG_(memcpy)(dest, src, n);
+}
+
+/* Replace __aeabi_memclr* functions with vgPlain_memset. */
+void* __aeabi_memclr(void *dest, SizeT n);
+void* __aeabi_memclr(void *dest, SizeT n)
+{
+    return VG_(memset)(dest, 0, n);
+}
+
+void* __aeabi_memclr4(void *dest, SizeT n);
+void* __aeabi_memclr4(void *dest, SizeT n)
+{
+    return VG_(memset)(dest, 0, n);
+}
+
+void* __aeabi_memclr8(void *dest, SizeT n);
+void* __aeabi_memclr8(void *dest, SizeT n)
+{
+    return VG_(memset)(dest, 0, n);
+}
+#endif /* ANDROID __clang__ */
 #endif

 /* ---------------- Requirement 2 ---------------- */

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to