Commit 924a65fc authored by Moritz Angermann's avatar Moritz Angermann Committed by Ben Gamari

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
parent 81f5b6ec
......@@ -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"
......
......@@ -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"]
......
......@@ -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|ios)
......
#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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment