On Tue, Dec 23, 2014 at 9:19 AM, Andrew Haley <aph@xxxxxxxxxx> wrote: > On 12/23/2014 10:05 AM, Cyd Haselton wrote: >> Last additional questions: >> 1) Why did the 4.8.3 on-device build pick up the necessary -ldl from >> LIBS, while the 4.9.2 build does not? >> (I've been working on this problem for a while...including going >> through the Changelogs for GCC, libgcc, etc...I've not found what >> changed between 4.8.x and 4.9.x that would cause this) > > I don't know. linus-android.h does contain > > #define ANDROID_LIB_SPEC \ > "%{!static: -ldl}" > > so it should work. Does that appear in -dumpspecs? It does. However, -ldl does not appear in the link-command section of dumpspecs...specifically for libasan...as it does for the build version (4.8.3) build version: *snip* %{!nostdlib:%{!nodefaultlibs:%{fsanitize=address: %{static-libasan:-ldl -lpthread} *snip* stage1 version *snip* %{!nostdlib:%{!nodefaultlibs:%{%:sanitize(address): %{static-libasan:%:include(libsanitizer.spec)%(link_libasan)} %{static:%ecannot specify -static with -fsanitize=address}} %{%:sanitize(thread): %{static-libtsan:%:include(libsanitizer.spec)%(link_libtsan)} %{!pie:%{!shared:%e-fsanitize=thread linking must be done with -pie or -shared}}} %{%:sanitize(undefined):%{static-libubsan:-Bstatic} -lubsan %{static-libubsan:-Bdynamic} %{static-libubsan:%:include(libsanitizer.spec)%(link_libubsan)}} %{%:sanitize(leak): %{static-liblsan:%:include(libsanitizer.spec)%(link_liblsan)}}}} *snip* > >> 2) Are the linker script specs visible by gcc -dumpspecs, and editable >> by modifying linux-android.h and gnu-user.h? >> (I've modified both to add -ldl, with no results...i.e. same error) > > No. GCC doesn't even know that /usr/lib/libc.so is a linker script. > > Given that Android doesn't seem to use this scheme, it's probably a > red herring. > > Andrew. > If all else fails a linker script, ported to Android, may be something to investigate...especially given the env i'm working with.