Things got resolved after moving to older ndk where it supports gcc.

On Mon, Jun 27, 2022, 4:04 AM John Reiser <jrei...@bitwagon.com> wrote:

> > Upon moving to next. It landed into another issue. seems it is not easy
> to cross compile the valgrind to Android as they mentioned
> https://valgrind.org/docs/manual/dist.readme-android.html <
> https://valgrind.org/docs/manual/dist.readme-android.html>
> >
> > Should i need to contact valgrind developers list to support.
> >
> > ../coregrind/link_tool_exe_linux 0x58000000
> /local/mnt/workspace/Android_ndk/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android31-clang
>  -O3 --target=aarch64-linux-android31-clang
> >
> --gcc-toolchain=/local/mnt/workspace/Android_ndk/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/
> --sysroot=/local/mnt/workspace/Android_ndk/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/sysroot
>   -o memcheck-arm-linux  -m32 -O2 -g -Wall -Wmissing-prototypes -Wshadow
> > -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wcast-qual
> -Wwrite-strings -Wempty-body -Wformat -Wformat-security
> -Wignored-qualifiers -Wenum-conversion -finline-functions
> -fno-stack-protector -fno-strict-aliasing -fno-builtin -Wno-cast-align
> -Wno-self-assign -Wno-tautological-compare
> >   -marm -mcpu=cortex-a8 -O2 -static -nodefaultlibs -nostartfiles -u
> _start   -m32 -Wl,-z,noexecstack memcheck_arm_linux-mc_leakcheck.o
> memcheck_arm_linux-mc_malloc_wrappers.o memcheck_arm_linux-mc_main.o
> memcheck_arm_linux-mc_main_asm.o memcheck_arm_linux-mc_translate.o
> > memcheck_arm_linux-mc_machine.o memcheck_arm_linux-mc_errors.o
> ../coregrind/libcoregrind-arm-linux.a ../VEX/libvex-arm-linux.a
> > ld: error: undefined symbol: __aeabi_uidivmod
> >  >>> referenced by mc_leakcheck.c:837
> >  >>>
> memcheck_arm_linux-mc_leakcheck.o:(heuristic_reachedness)
> >  >>> referenced by m_execontext.c:346
> >  >>>
> libcoregrind_arm_linux_a-m_execontext.o:(record_ExeContext_wrk2) in archive
> ../coregrind/libcoregrind-arm-linux.a
> >  >>> referenced by m_execontext.c:346
> >  >>>
> libcoregrind_arm_linux_a-m_execontext.o:(record_ExeContext_wrk2) in archive
> ../coregrind/libcoregrind-arm-linux.a
> >  >>> referenced 11 more times
> >  >    [[snip]]
>
> You should contact whoever supports aarch64-linux-android31-clang and
> complaln
> that their linker step for static linking forgets to reference a static
> library
> that contains __aeabi_uidivmod, __aeabi_d2ulz, __aeabi_ul2d,
> __aeabi_uldivmod,
> __aeabi_uidiv, __aeabi_idiv, __aeabi_idivmod, and __aeabi_ldivmod .
>
> I found them in:
> -----
> $ nm -gop --defined-only $(find . -name '*.a' 2>/dev/null)  | grep
> __aeabi_uidivmod
> ./Android/Sdk/build-tools/32.0.0/renderscript/lib/intermediates/armeabi-v7a/libcompiler_rt.a:aeabi_uidivmod.o:00000000
> T __aeabi_uidivmod
> ./Android/Sdk/build-tools/32.1.0-rc1/renderscript/lib/intermediates/armeabi-v7a/libcompiler_rt.a:aeabi_uidivmod.o:00000000
> T __aeabi_uidivmod
> ./Android/Sdk/build-tools/30.0.3/renderscript/lib/intermediates/armeabi-v7a/libcompiler_rt.a:aeabi_uidivmod.o:00000000
> T __aeabi_uidivmod
> $
> -----
> and similarly for the other undefined symbols.
>
> Therefore a workaround is to append explicit names for the files that
> contain
> those runtime symbols that you desire.
>
> The hint on how to investigate this problem is in
> valgrind/coregrind/link_tool_exe_linux
> which is a well-documented perl script that contains
> -----
> # So: what we actually do:
> #
> #   pass the specified command to the linker as-is, except, ...
>
> my $cmd = join(" ", @ARGV, "-static -Wl,-Ttext-segment=$ala");
>
> #print "link_tool_exe_linux: $cmd\n";
>
>
> # Execute the command:
> my $r = system($cmd);
> -----
> which shows that aarch64-linux-android31-clang is at fault when static
> linking.
> (Forgetting the case of static linking is a common error in cross-building
> systems.)
>
>
> _______________________________________________
> Valgrind-users mailing list
> Valgrind-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
>
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to