diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-10-02 18:45:54 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-03 23:25:11 -0400 |
commit | e8693713a40072a0dec5e83b1a31ffb0ee881633 (patch) | |
tree | f49939f128a5e3ca0b257a469a2f5c2ab63942e1 | |
parent | ed0e29f1f51664dd7591935967838ff25de6a8bd (diff) | |
download | haskell-e8693713a40072a0dec5e83b1a31ffb0ee881633.tar.gz |
configure: Fix redundant-argument warning from -no-pie check
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 |