[commit: ghc] ghc-8.2: Use non-canocalized triple as cross-compiler prefix (83b7f9f)

git at git.haskell.org git at git.haskell.org
Thu Apr 27 20:10:07 UTC 2017


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

On branch  : ghc-8.2
Link       : http://ghc.haskell.org/trac/ghc/changeset/83b7f9f5d2e1bffb1181f4ccad19678120a3cac6/ghc

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

commit 83b7f9f5d2e1bffb1181f4ccad19678120a3cac6
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date:   Thu Apr 6 08:51:22 2017 +0100

    Use non-canocalized triple as cross-compiler prefix
    
    I've noticed the problem when tried to install
    cross-compiler using following configuration:
    
        $ ./configure --target=s390x-unknown-linux-gnu
        make install Stage1Only=YES
    
    Instead of expected tool prefix
        's390x-unknown-linux-gnu-'
    Result was:
        's390x-ibm-linux-gnu-'
    
    It's problematic as installed binaries appear in
    unpredictable location.
    
    The problem is caused by use of ${target} autoconf variable.
    ${target} contains a canocalized triplet.
    
    Luckily we already have non-canonucalized target triplet
    in ${TargetPlatformFull} variable. The change uses that
    instead.
    
    Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
    (cherry picked from commit 844704b4883e1d603a5048ddc6cbad737ba8d9e8)


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

83b7f9f5d2e1bffb1181f4ccad19678120a3cac6
 configure.ac | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index ec567ac..38eb5ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -425,12 +425,6 @@ with a cross-compiler.  To cross-compile GHC itself, set TARGET: stage
 GHC.
 ])
 fi
-if test "$CrossCompiling" = "YES"
-then
-  CrossCompilePrefix="${target}-"
-else
-  CrossCompilePrefix=""
-fi
 # Despite its similarity in name to TargetPlatform, TargetPlatformFull is used
 # in calls to subproject configure scripts and thus must be set to the autoconf
 # triple, not the normalized GHC triple that TargetPlatform is set to.
@@ -446,6 +440,8 @@ fi
 # all be taken care of for us if we configured the subprojects using
 # AC_CONFIG_DIR, but unfortunately Cabal needs to be the one to do the
 # configuration.
+#
+# We also use non-canonicalized triple when install stage1 crosscompiler
 if test -z "${target_alias}"
 then
   # --target wasn't given; use result from AC_CANONICAL_TARGET
@@ -453,6 +449,13 @@ then
 else
   TargetPlatformFull="${target_alias}"
 fi
+if test "$CrossCompiling" = "YES"
+then
+  # Use value passed by user from --target=
+  CrossCompilePrefix="${TargetPlatformFull}-"
+else
+  CrossCompilePrefix=""
+fi
 AC_SUBST(CrossCompiling)
 AC_SUBST(CrossCompilePrefix)
 AC_SUBST(TargetPlatformFull)



More information about the ghc-commits mailing list