-
Notifications
You must be signed in to change notification settings - Fork 282
Closed
Description
Description
Cannot resolve symbols (crash location) from crash dump from binary that is linked with -fuse=lld
. I'm using ndk-stack
to resolve symbols from crash dump. When using current default linker from ndk, things work fine.
Here is small example to reproduce:
Structure:
├── application
│ ├── application.cpp
│ └── CMakeLists.txt
└── build_and_run.sh
application/application.cpp
#include <cstdlib>
int main(void)
{
abort();
}
application/CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(application)
add_executable(application application.cpp)
project(application-lld)
add_executable(application-lld application.cpp)
target_link_libraries(application-lld
PUBLIC
-fuse-ld=lld
)
build_and_run.sh
#!/usr/bin/env bash
set -e
HERE=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
ANDROID_NDK=$HOME/Android/Sdk/ndk/21.0.6113669
ANDROID_ABI=arm64-v8a
ANDROID_NATIVE_API_LEVEL=29
function compile()
{
printf '\nConfigure & Compile test applications ...\n\n'
mkdir "$HERE/build"
cd "$HERE/build"
cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=$ANDROID_ABI \
-DANDROID_NATIVE_API_LEVEL=$ANDROID_NATIVE_API_LEVEL \
-DANDROID_TOOLCHAIN=clang \
-DANDROID_STL=c++_static \
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$HERE/bin \
"$HERE/application"
cmake --build . -- -j1 -v
printf '\nConfigure & Compile test applications DONE\n\n'
}
function run()
{
printf '\nRun with & without LLD\n'
adb logcat -c
adb push $HERE/bin/application /data/local/tmp/
adb push $HERE/bin/application-lld /data/local/tmp/
set +e
adb shell /data/local/tmp/application
adb shell /data/local/tmp/application-lld
set -e
}
function crash_dump()
{
printf '\nCrash dumps:\n\n'
adb logcat -d | ndk-stack -sym $HERE/bin
}
compile
run
crash_dump
Output crash dumps:
Default linker
********** Crash dump: **********
Build fingerprint: 'OPPO/PCCM00/OP46C3:9/PKQ1.190223.001/1553783366:user/release-keys'
#00 0x00000000000223bc /system/lib64/libc.so (abort+116)
#01 0x0000000000000704 /data/local/tmp/application
main
/home/mikaheli/Desktop/LLDTEST/application/application.cpp:5:2
#02 0x00000000000ca024 /system/lib64/libc.so (__libc_init+88)
Crash dump is completed
LLD linker
********** Crash dump: **********
Build fingerprint: 'OPPO/PCCM00/OP46C3:9/PKQ1.190223.001/1553783366:user/release-keys'
#00 0x00000000000223bc /system/lib64/libc.so (abort+116)
#01 0x0000000000000094 /data/local/tmp/application-lld (offset 0x1000)
__libc_init
??:0:0
Crash dump is completed
Environment Details
- NDK Version: 21.0.6113669
- Build system: CMake
- Host OS: MX Linux 18.3 / Windows 10
- ABI: arm64-v8a / armeabi-v7a
- NDK API level: 24/29 tested
- Device API level:
HaiPhan2002