This linker warning comes up when running executables compiled using the ndk's cmake:
$ /path/to/executable
WARNING: linker: /path/to/executable: unsupported flags DT_FLAGS_1=0x8000001
This problem is not present in older versions of the ndk. The following sequence will reproduce this bug:
zx2c4@thinkpad /tmp/ndkfail $ grep Revision /opt/android-sdk-update-manager/ndk-bundle/source.properties
Pkg.Revision = 16.1.4479499
zx2c4@thinkpad /tmp/ndkfail $ adb shell getprop ro.build.version.release
7.1.2
zx2c4@thinkpad /tmp/ndkfail $ adb shell getprop ro.build.version.sdk
25
zx2c4@thinkpad /tmp/ndkfail $ echo -e '#include <stdio.h>\nint main() { puts("hello world"); return 0; }' > a.c
zx2c4@thinkpad /tmp/ndkfail $ echo -e 'cmake_minimum_required(VERSION 3.4.1)\nadd_executable(a a.c)' > CMakeLists.txt
zx2c4@thinkpad /tmp/ndkfail $ /opt/android-sdk-update-manager/cmake/3.6.4111459/bin/cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-21 -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=/opt/android-sdk-update-manager/ndk-bundle -DCMAKE_TOOLCHAIN_FILE=/opt/android-sdk-update-manager/ndk-bundle/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/opt/android-sdk-update-manager/cmake/3.6.4111459/bin/ninja "-GAndroid Gradle - Ninja" .
CMake Warning at /opt/android-sdk-update-manager/ndk-bundle/build/cmake/android.toolchain.cmake:63 (message):
Using custom NDK path (ANDROID_NDK is set):
/opt/android-sdk-update-manager/ndk-bundle
Call Stack (most recent call first):
/opt/android-sdk-update-manager/cmake/3.6.4111459/share/cmake-3.6/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt
-- Check for working C compiler: /opt/android-sdk-update-manager/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
-- Check for working C compiler: /opt/android-sdk-update-manager/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /opt/android-sdk-update-manager/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
-- Check for working CXX compiler: /opt/android-sdk-update-manager/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/ndkfail
zx2c4@thinkpad /tmp/ndkfail $ ninja -v
[1/2] /opt/android-sdk-update-manager/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-none-linux-android --gcc-toolchain=/opt/android-sdk-update-manager/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 --sysroot=/opt/android-sdk-update-manager/ndk-bundle/sysroot -isystem /opt/android-sdk-update-manager/ndk-bundle/sysroot/usr/include/aarch64-linux-android -D__ANDROID_API__=21 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIE -MD -MT CMakeFiles/a.dir/a.c.o -MF CMakeFiles/a.dir/a.c.o.d -o CMakeFiles/a.dir/a.c.o -c /tmp/ndkfail/a.c
[2/2] : && /opt/android-sdk-update-manager/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-none-linux-android --gcc-toolchain=/opt/android-sdk-update-manager/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 --sysroot=/opt/android-sdk-update-manager/ndk-bundle/sysroot -isystem /opt/android-sdk-update-manager/ndk-bundle/sysroot/usr/include/aarch64-linux-android -D__ANDROID_API__=21 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a --sysroot /opt/android-sdk-update-manager/ndk-bundle/platforms/android-21/arch-arm64 -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections -Wl,-z,nocopyreloc -pie -fPIE CMakeFiles/a.dir/a.c.o -o a -latomic -lm && :
zx2c4@thinkpad /tmp/ndkfail $ adb push a /data/local/tmp
a: 1 file pushed. 1.5 MB/s (9400 bytes in 0.006s)
zx2c4@thinkpad /tmp/ndkfail $ adb shell /data/local/tmp/a
WARNING: linker: /data/local/tmp/a: unsupported flags DT_FLAGS_1=0x8000001
hello world
This linker warning comes up when running executables compiled using the ndk's cmake:
This problem is not present in older versions of the ndk. The following sequence will reproduce this bug: