summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2017-03-21 11:02:20 -0400
committerBen Gamari <ben@smart-cactus.org>2017-03-26 21:37:23 -0400
commite8a27410d0e51062422cb4782913bbbdf9deea74 (patch)
tree8b622eb6bf03ea4085161515c0ba73ccd1467c0d /configure.ac
parentf1ce27669a43710a3dfcafd61d34601f395231bc (diff)
downloadhaskell-e8a27410d0e51062422cb4782913bbbdf9deea74.tar.gz
Adds aarch64 linker for mach-o files.
This is the final commit that ties them all together. Here we add the aarch64 linker for macho files. - In D3238 we started allowing preloading object code with mmap in iOS, where we can't have r+w+x. - In D3239 we introduced a richer extension of the object code data type to make working with mach-o files easier. - In D3240 we set the stage to allow loading archives (.a) on iOS - In D3251 we added init and deinit functions to populate and depopulate the enriched object code data structure for mach-o files. - In D3252 we refactored most of the MachO.c file to use the new types and datastructure. This commit will than finally add the aarch64 (arm64) linker for mach-o files to ghc, using the improved foundation we have constructed above. The dependency structure therefore is as follows ``` .- D3240 v This <- D3252 <- D3251 <- D3239 ^ '- D3238 ``` Depends: D3252, D3240, D3238 Test Plan: To test this with iOS, we also need the remote-iserv diff D3233. With all that in place, proceed as follows: - Build ghc for the host ``` ghc $ ./configure --prefix=/test/opt \ --disable-large-address-space \ --with-llc=/path/to/llvm-3.9/bin/llc \ --with-opt=/path/to/llvm-3.9/bin/opt # edit mk/build.mk to specify quick ghc $ make && make install ``` - Build ghc for ios ``` ghc $ ./configure --target=aarch64-apple-darwin14 \ --prefix=/test/opt \ --disable-large-address-space \ --with-llc=/path/to/llvm-3.9/bin/llc \ --with-opt=/path/to/llvm-3.9/bin/opt \ --with-ghc=/test/bin/ghc \ --enable-bootstrap-with-devel-snapshot # edit mk/build.mk to specify quick-cross ghc $ make && make install ``` - Obtain the iOS wrapper scripts from https://github.com/angerman/ghc-ios-scripts and place them in PATH. - Build iserv-proxy for the host ``` ghc/iserv $ cabal install -fproxy -flibrary ``` - Build iserv-library for the target ``` # build cryptonite without integer-gmp ghc/iserv $ aarch64-apple-darwin14-cabal install cryptonite -f-integer-gmp ghc/iserv $ aarch64-apple-darwin14-cabal install -flibrary ``` - Create an iOS application with the following `main.m`: ``` #import <UIKit/UIKit.h> #include "HsFFI.h" extern void startSlave(bool, int, const char *); int main(int argc, char * argv[]) { const char * documents_path = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] firstObject].path.UTF8String; hs_init(NULL, NULL); startSlave(false, 5000, documents_path); @autoreleasepool { return UIApplicationMain(argc, argv, nil, nil); } } ``` and link it with: the iserv archive from `~/.cabal/lib/aarch64-ios-ghc` as well as all dependent archives. - Build, Install and Launch the iserv-slave application on your iphone - Compile some Template Haskell code with the `aarch64-apple-darwin14-ghc`, through the `iserv-proxy` ``` app $ aarch64-apple-darwin14-ghc Module.hs \ -threaded -staticlib \ -outputdir build/aarch64 -pgmlibtool libtool-quiet -stubdir . \ -fexternal-interpreter \ -pgmi=$HOME/.cabal/bin/iserv-proxy \ -opti10.0.0.1 \ -opti5000 ``` where 10.0.0.1 is the ip of your iserv-slave. magic. Reviewers: rwbarton, bgamari, austin, hvr, erikd, simonmar Subscribers: thomie, erikd, ryantrinkle Differential Revision: https://phabricator.haskell.org/D3255
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac2
1 files changed, 1 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index dd338a8418..547e9b1551 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1084,7 +1084,7 @@ case ${TargetOS} in
linux|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2)
RtsLinkerUseMmap=1
;;
- darwin)
+ darwin|ios)
# Don't use mmap on powerpc/darwin as the mmap there doesn't support
# reallocating. Reallocating is needed to allocate jump islands just
# after each object image. Jumps to these jump islands use relative