-
Notifications
You must be signed in to change notification settings - Fork 281
Closed
Description
We are currently trying to switch to NDK 21 from r18b. In NDK 21, when building a shared object file, it appears that the source file names are included in the resulting .so file. What's the best way to get rid of those filenames from the .so file?
This behaviour can be reproduced with the following setup:
> cat foo.cpp
extern "C" void foo_function() {}
> cat CMakeLists.txt
project(AndroidStripTest CXX)
add_library(
foo SHARED
foo.cpp
)
> mkdir build
> cd build
> cmake -DCMAKE_TOOLCHAIN_FILE=$NDK_ROOT/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_STL=none
> make
> export TOOLCHAIN=$NDK_ROOT/toolchains/llvm/prebuilt/darwin-x86_64
> $TOOLCHAIN/bin/llvm-objcopy --strip-debug \
--discard-all libfoo.so libfoo-stripped.so
> strings libfoo-stripped.so | grep foo.cpp
foo.cpp
Tested with NDK Version: 21.0.6113669