[commit: ghc] master: Added support to cross-compile to android (3c9d630)

David Terei davidterei at gmail.com
Fri Jan 25 07:45:30 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/3c9d63042da2a1aa6874562e5d3abb4c88fafdb9

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

commit 3c9d63042da2a1aa6874562e5d3abb4c88fafdb9
Author: Nathan <nathan.huesken at posteo.de>
Date:   Wed Jan 23 18:07:19 2013 +0100

    Added support to cross-compile to android
    
    Signed-off-by: David Terei <davidterei at gmail.com>

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

 aclocal.m4                          |    6 ++++++
 compiler/llvmGen/LlvmCodeGen/Ppr.hs |    3 +++
 compiler/utils/Platform.hs          |    2 ++
 3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 57e35a2..edbe389 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -251,6 +251,9 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS],
         dragonfly|osf1|hpux|linuxaout|freebsd2|cygwin32|gnu|nextstep2|nextstep3|sunos4|ultrix|irix|aix)
             test -z "[$]2" || eval "[$]2=OSUnknown"
             ;;
+        linux-android)
+            test -z "[$]2" || eval "[$]2=OSAndroid"
+            ;;
         *)
             echo "Unknown OS '[$]1'"
             exit 1
@@ -1821,6 +1824,9 @@ AC_DEFUN([GHC_CONVERT_VENDOR],[
 # converts os from gnu to ghc naming, and assigns the result to $target_var
 AC_DEFUN([GHC_CONVERT_OS],[
 case "$1" in
+  linux-android*)
+    $2="linux-android"
+    ;;
   linux-*|linux)
     $2="linux"
     ;;
diff --git a/compiler/llvmGen/LlvmCodeGen/Ppr.hs b/compiler/llvmGen/LlvmCodeGen/Ppr.hs
index 218870a..5d9fb23 100644
--- a/compiler/llvmGen/LlvmCodeGen/Ppr.hs
+++ b/compiler/llvmGen/LlvmCodeGen/Ppr.hs
@@ -58,6 +58,9 @@ moduleLayout = sdocWithPlatform $ \platform ->
     Platform { platformArch = ArchARM {}, platformOS = OSLinux } ->
         text "target datalayout = \"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32\""
         $+$ text "target triple = \"arm-unknown-linux-gnueabi\""
+    Platform { platformArch = ArchARM {}, platformOS = OSAndroid } ->
+        text "target datalayout = \"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32\""
+        $+$ text "target triple = \"arm-unknown-linux-androideabi\""
     _ ->
         -- FIX: Other targets
         empty
diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs
index 661e03a..090ce41 100644
--- a/compiler/utils/Platform.hs
+++ b/compiler/utils/Platform.hs
@@ -70,6 +70,7 @@ data OS
         | OSHaiku
         | OSOsf3
         | OSQNXNTO
+        | OSAndroid
         deriving (Read, Show, Eq)
 
 -- | ARM Instruction Set Architecture, Extensions and ABI
@@ -112,6 +113,7 @@ osElfTarget OSHaiku     = True
 osElfTarget OSOsf3      = False -- I don't know if this is right, but as
                                 -- per comment below it's safe
 osElfTarget OSQNXNTO    = False
+osElfTarget OSAndroid   = True
 osElfTarget OSUnknown   = False
  -- Defaulting to False is safe; it means don't rely on any
  -- ELF-specific functionality.  It is important to have a default for





More information about the ghc-commits mailing list