Skip to content

Draft: configure: Fix false negative in detection of -no-pie support

Ali Abrar requested to merge abrar/ghc:aa-nopie-detection into master

conftest.c was not actually used, so I've removed the line that generates it.

The -Werror here causes some compilers that actually support -no-pie to fail due to -Wunused-command-line-argument. I've replaced it with -Wall so that we'd still get the "unrecognized" warning that we're looking for (for old versions of gcc, cf: #12759 (comment 127342)).

For example, clang 7.0.2 fails with -Werror:

$ aarch64-unknown-linux-android-clang --version
Android (4751641 based on r328903) clang version 7.0.2 (https://android.googlesource.com/toolchain/clang 003100370607242ddd5815e4a043907ea9004281) (https://android.googlesource.com/toolchain/llvm 1d739ffb0366421d383e04ff80ec2ee591315116) (based on LLVM 7.0.2svn)
Target: aarch64-unknown-linux-android
Thread model: posix
InstalledDir: /nix/store/yc0h92wm4ncb69mm3f19a8pf8b5f2k7x-ndk-gcc-binutils/bin

$ aarch64-unknown-linux-android-clang -Werror -no-pie -x c /dev/null -dM -E
clang: error: argument unused during compilation: '-nopie' [-Werror,-Wunused-command-line-argument]

By comparison, gcc 7.4.0 doesn't produce a warning about unused command line arguments.

Edited by Andreas Klebinger

Merge request reports