Linker error

145 views
Skip to first unread message

Sri

unread,
Nov 29, 2021, 2:46:04 PM11/29/21
to android-ndk
I am trying to use ndk21 in my project, but when I use libc during linking , I get following error. I tried searching in stackoverflow did not find any specific answer. Has anybody faced similar linker issue . Looks like libc.a does not have reference to methods

llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/libc.a(dl_iterate_phdr_static.o): In function `dl_iterate_phdr':
  bionic/libc/bionic/dl_iterate_phdr_static.cpp:41: undefined reference to `__executable_start'
  bionic/libc/bionic/dl_iterate_phdr_static.cpp:41: undefined reference to `__executable_start'

Regards
Sri

Ryan Prichard

unread,
Nov 29, 2021, 11:51:28 PM11/29/21
to andro...@googlegroups.com
It looks like the stub version of dl_iterate_phdr in libc.a is trying to use the __executable_start symbol but can't.

__executable_start is normally a magic symbol that's defined by the linker (e.g. ld.bfd/gold/lld). Maybe Clang is using the macOS ld64 linker for some reason? e.g. pass -v to Clang to see how it's invoking the linker.

libc.a is used for statically-linked executables (as opposed to dynamically-linked executable or dynamic shared libraries). Is that what you're trying to do?

-Ryan


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/08437044-06e1-4f26-bd6b-2ccfdd58f228n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages