ld.bfd: omit DF_1_PIE when targeting Android
Some versions of the Android dynamic linker (e.g. N) print a warning:
WARNING: linker: /data/local/tmp/a.out: unsupported flags DT_FLAGS_1=0x8000000
${target} will be something like:
- arm-unknown-linux-androideabi
- aarch64-unknown-linux-android
- i686-pc-linux-android
Bug: https://github.com/android-ndk/ndk/issues/602
Test: manual:
1. create a standalone ARM64 toolchain with NDK r16b
2. echo 'int main() {}' > justmain.c
3. ~/stand-arm64-21-libc++-r16b/bin/clang justmain.c -pie -fPIE \
-fuse-ld=bfd && \
readelf -d a.out | grep FLAG
-- OUTPUT: 0x000000006ffffffb (FLAGS_1) Flags: 8000000
4. ~/stand-arm64-21-libc++-r16b/bin/clang justmain.c -pie -fPIE \
-fuse-ld=bfd \
-B ~/android/ndk/out/binutils/linux/arm64/install/binutils-arm64-linux/aarch64-linux-android/bin && \
readelf -d a.out | grep FLAG
-- OUTPUT: nothing
Change-Id: I040b6edbd8d7943b790db0ef19b76cfdffc1ccdf
1 file changed