简体   繁体   中英

NDK12b: Different ELF produced by clang vs gcc using the standalone toolchain and the same build scripts

Our product contains multiple source packages. Some of the source packages are built using autotool/conf.

Based on what google said of switching to clang as a default compiler for the NDK starting with NDK-13, we went ahead with the switch in the *.mk files as well as in our env setup and build scripts. No make files where changed.

We were using NDK-10d which is old, so we switched to NDK-12b. We also generated a standalone toolchain from it, as recommended by Android's documentation, to simplify our build scripts and standardize across all.

The issue I am facing is the crash on launch as soon as the native code is loaded. What I have noticed is a warning in logcat regarding: unused DT entry: type 0x6ffffffe ( VERNEED ) and 0x6fffffff ( VERNEEDNUM ).

Then, the dreaded: A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x30 in tid 22246 .

The stack trace tells me very, very little:

08-11 15:31:02.421 128-128/? I/DEBUG:     #00 pc 00036b8c  /system/lib/libc.so
08-11 15:31:02.421 128-128/? I/DEBUG:     #01 pc 0003817b  /system/lib/libc.so (vfprintf+18)
08-11 15:31:02.421 128-128/? I/DEBUG:     #02 pc 00035251  /system/lib/libc.so (fprintf+12)
08-11 15:31:02.421 128-128/? I/DEBUG:     #03 pc 000015fd  /data/app/com.myapp.demo-1/lib/arm/libappdebug.so (pipe_listen+328)
08-11 15:31:02.421 128-128/? I/DEBUG:     #04 pc 0001659b  /system/lib/libc.so
08-11 15:31:02.421 128-128/? I/DEBUG:     #05 pc 000144c3  /system/lib/libc.so

Notice that comparing the data within the ELFs as dumped by readelf -d shows the absence of those 2 DT entries in the binaries generated by arm-linux-androideabi-gcc-4.9 builds.

Any ideas, pointers, ...anything at all ..., would be much appreciated cuz i have been stuck for (blush) 3 days now.

Thanks.

You need to look into the problem of your unused DT entry . If you're using your library to pipe stuff somewhere else, that warning will appear at every run and endanger your pipe to receive garbage, or your app to receive excpetions. Please have a look at my post here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM