diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-10-02 18:45:54 -0400 |
---|---|---|
committer | Ben Gamari <ben@well-typed.com> | 2021-10-03 22:00:52 +0000 |
commit | 96b8de3ce8a746c9d9c309ad134b4e29233af7a9 (patch) | |
tree | e11fde63b3a8ea66a74ba3d9c9439bdcc6156401 | |
parent | 91cd124843d3c03639ec12a62b2b43d9b45a8d52 (diff) | |
download | haskell-wip/fix-nopie.tar.gz |
configure: Fix redundant-argument warning from -no-pie checkwip/fix-nopie
Modern clang versions are quite picky when it comes to reporting
redundant arguments. In particular, they will warn when -no-pie is
passed when no linking is necessary.
Previously the configure script used a `$CC -Werror -no-pie -E`
invocation to test whether `-no-pie` is necessary. Unfortunately, this
meant that clang would throw a redundant argument warning, causing
configure to conclude that `-no-pie` was not supported. We now rather
use `$CC -Werror -no-pie`, ensuring that linking is necessary and
avoiding this failure mode.
Fixes #20463.
-rw-r--r-- | m4/fp_gcc_supports_no_pie.m4 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/m4/fp_gcc_supports_no_pie.m4 b/m4/fp_gcc_supports_no_pie.m4 index 880a1e4cfa..d86cf3590e 100644 --- a/m4/fp_gcc_supports_no_pie.m4 +++ b/m4/fp_gcc_supports_no_pie.m4 @@ -5,10 +5,10 @@ AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE], [ AC_REQUIRE([AC_PROG_CC]) - AC_MSG_CHECKING([whether GCC supports -no-pie]) + AC_MSG_CHECKING([whether CC supports -no-pie]) echo 'int main() { return 0; }' > conftest.c # Some GCC versions only warn when passed an unrecognized flag. - if $CC -no-pie -Werror -x c /dev/null -dM -E > conftest.txt 2>&1 && ! grep -i unrecognized conftest.txt > /dev/null 2>&1; then + if $CC -no-pie -Werror -x c conftest.c -o conftest > conftest.txt 2>&1 && ! grep -i unrecognized conftest.txt > /dev/null 2>&1; then CONF_GCC_SUPPORTS_NO_PIE=YES AC_MSG_RESULT([yes]) else |