[commit: ghc] master: configure: Verify that GCC recognizes -no-pie flag (011af2b)

git at git.haskell.org git at git.haskell.org
Mon Nov 14 19:13:54 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/011af2bf448c28db68a55293abaa5b294f170e37/ghc

>---------------------------------------------------------------

commit 011af2bf448c28db68a55293abaa5b294f170e37
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Mon Nov 14 14:13:30 2016 -0500

    configure: Verify that GCC recognizes -no-pie flag
    
    It seems like GCC versions prior to 4.8 exit with code 0 when faced with
    an unrecognized flag. Silly compilers.
    
    Test Plan: Validate
    
    Reviewers: hvr, austin, ggreif
    
    Reviewed By: ggreif
    
    Subscribers: thomie, erikd
    
    Differential Revision: https://phabricator.haskell.org/D2707
    
    GHC Trac Issues: #12759


>---------------------------------------------------------------

011af2bf448c28db68a55293abaa5b294f170e37
 aclocal.m4 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/aclocal.m4 b/aclocal.m4
index aea85f4..5d39570 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1333,7 +1333,8 @@ AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE],
    AC_REQUIRE([AC_PROG_CC])
    AC_MSG_CHECKING([whether GCC supports -no-pie])
    echo 'int main() { return 0; }' > conftest.c
-   if ${CC-cc} -o conftest -no-pie conftest.c > /dev/null 2>&1; then
+   # Some GCC versions only warn when passed an unrecognized flag.
+   if $CC -no-pie -x c /dev/null -dM -E > 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



More information about the ghc-commits mailing list