[commit: ghc] ghc-8.2: Various patches to support android cross compilation (56c5738)

git at git.haskell.org git at git.haskell.org
Wed Mar 29 23:42:00 UTC 2017


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

On branch  : ghc-8.2
Link       : http://ghc.haskell.org/trac/ghc/changeset/56c57384ccbf73d6a9594af38ac6c1babd14ad4c/ghc

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

commit 56c57384ccbf73d6a9594af38ac6c1babd14ad4c
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Wed Mar 29 17:29:58 2017 -0400

    Various patches to support android cross compilation
    
    - Better test for SHT_INIT_ARRAY than openbsd_HOST_OS
      This is actually bens patch:
      https://gist.github.com/bgamari/c846e6a5f2cd988716cd5e36c68d5bef
    - linux-android defines.
    - No need for -lpthread on OSAndroid
      However, I’m confused why we do not use the AC NEED_PTHREAD_LIB
      value here?
    - Use mmap on android
    - Support `none` vendor.
    
    Reviewers: austin, hvr, bgamari, erikd, simonmar
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie, erikd
    
    Differential Revision: https://phabricator.haskell.org/D3356
    
    (cherry picked from commit 924a65fc27bb2a3e24489f7baea7ad5fb8a556ac)


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

56c57384ccbf73d6a9594af38ac6c1babd14ad4c
 aclocal.m4                      |  2 +-
 compiler/main/DriverPipeline.hs |  2 +-
 configure.ac                    |  2 +-
 rts/linker/Elf.c                | 10 +++++++---
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 6341bc9..2062b0d 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -227,7 +227,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS],
 
     checkVendor() {
         case [$]1 in
-        dec|unknown|hp|apple|next|sun|sgi|ibm|montavista|portbld)
+        dec|none|unknown|hp|apple|next|sun|sgi|ibm|montavista|portbld)
             ;;
         *)
             echo "Unknown vendor [$]1"
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 1549722..2670993 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1895,7 +1895,7 @@ linkBinary' staticLink dflags o_files dep_packages = do
     let thread_opts
          | WayThreaded `elem` ways dflags =
             let os = platformOS (targetPlatform dflags)
-            in if os `elem` [OSMinGW32, OSFreeBSD, OSOpenBSD,
+            in if os `elem` [OSMinGW32, OSFreeBSD, OSOpenBSD, OSAndroid,
                              OSNetBSD, OSHaiku, OSQNXNTO, OSiOS, OSDarwin]
                then []
                else ["-lpthread"]
diff --git a/configure.ac b/configure.ac
index af62bd9..9ae97b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1081,7 +1081,7 @@ dnl ** Use MMAP in the runtime linker?
 dnl --------------------------------------------------------------
 
 case ${TargetOS} in
-    linux|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2)
+    linux|linux-android|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2)
         RtsLinkerUseMmap=1
         ;;
     darwin)
diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c
index e8f6aab..66b8f71 100644
--- a/rts/linker/Elf.c
+++ b/rts/linker/Elf.c
@@ -1,6 +1,10 @@
 #include "Rts.h"
 
-#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(gnu_HOST_OS)
+#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) \
+|| defined(linux_android_HOST_OS) \
+|| defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) \
+|| defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) \
+|| defined(openbsd_HOST_OS) || defined(gnu_HOST_OS)
 
 #include "RtsUtils.h"
 #include "RtsSymbolInfo.h"
@@ -613,13 +617,13 @@ static int getSectionKind_ELF( Elf_Shdr *hdr, int *is_bss )
         /* .rodata-style section */
         return SECTIONKIND_CODE_OR_RODATA;
     }
-#ifndef openbsd_HOST_OS
+#ifdef SHT_INIT_ARRAY
     if (hdr->sh_type == SHT_INIT_ARRAY
         && (hdr->sh_flags & SHF_ALLOC) && (hdr->sh_flags & SHF_WRITE)) {
        /* .init_array section */
         return SECTIONKIND_INIT_ARRAY;
     }
-#endif /* not OpenBSD */
+#endif /* not SHT_INIT_ARRAY */
     if (hdr->sh_type == SHT_NOBITS
         && (hdr->sh_flags & SHF_ALLOC) && (hdr->sh_flags & SHF_WRITE)) {
         /* .bss-style section */



More information about the ghc-commits mailing list