[commit: ghc] ghc-7.10: configure: Test for #9920 when compiling for arm (b856f3f)

git at git.haskell.org git at git.haskell.org
Sat Apr 25 06:28:54 UTC 2015


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

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/b856f3f3d7850ca0456dd80aaa59241b3d297ab9/ghc

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

commit b856f3f3d7850ca0456dd80aaa59241b3d297ab9
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date:   Sat Apr 25 08:27:49 2015 +0200

    configure: Test for #9920 when compiling for arm
    
    The ghc-7.10 branch requires use of llvm-3.5, but the llvm-3.5.0
    release had a bug that was fixed in llvm-3.5.1.
    
    When we are targeting arm, test for this bug in the llvm program
    `llc` during confgure and if present, abort configuration with
    an informative error message.
    
    Signed-off-by: Erik de Castro Lopo <erikd at mega-nerd.com>
    
    Differential Revision: https://phabricator.haskell.org/D857


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

b856f3f3d7850ca0456dd80aaa59241b3d297ab9
 configure.ac | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/configure.ac b/configure.ac
index d99d1d5..bbf346b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -558,6 +558,40 @@ then
 fi
 AC_SUBST([GHC_LLVM_AFFECTED_BY_9439])
 
+dnl ** Bug 9920: Llvm version 3.5.0 was released with a bug in the ARM version
+dnl of the GHC calling convention implementation. This bug was fixed in the
+dnl 3.5.1 release but some Linux distributions are likely to patch llvm
+dnl 3.5.0 rather than release a new 3.5.1 version.
+dnl
+dnl Unfortunately we don't know whether the user is going to request a
+dnl build with the LLVM backend as this is only given in build.mk.
+
+if test ${TargetArch} = arm ; then
+    AC_MSG_CHECKING(if llvm version is affected by bug 9920)
+    rm -f conftest.ll conftest.asm
+    cat << LLVM_IR_CODE > conftest.ll
+declare cc10 void @target_function()
+define cc10 void @test_direct_tail() {
+ tail call cc10 void @target_function()
+ ret void
+}
+LLVM_IR_CODE
+
+    res=$(${LlcCmd} -mtriple=armv7-eabi conftest.ll -o conftest.asm)
+    if test $? -eq 0 ; then
+        if test $(grep -c target_function conftest.asm) -eq 1 ; then
+            AC_MSG_RESULT(no)
+        else
+            AC_MSG_RESULT(yes)
+            echo
+            AC_MSG_FAILURE([Cannot compile for ARM with ${LlcCmd}. See GHC trac ticket #9920.], 1)
+        fi
+    else
+        AC_MSG_WARN([unexpected output $res])
+    fi
+	rm -f conftest.ll conftest.asm
+fi
+
 dnl ** Can the unix package be built?
 dnl --------------------------------------------------------------
 



More information about the ghc-commits mailing list