summaryrefslogtreecommitdiff
path: root/rts/Linker.c
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2017-03-21 11:01:11 -0400
committerBen Gamari <ben@smart-cactus.org>2017-03-26 21:37:22 -0400
commit938392c8515ccbe894714f43852fe604a21ce30b (patch)
tree8aaf01157295d1810946d3e979f447e2e0944007 /rts/Linker.c
parent8ed29b50376856018dfbbcbd6d728c69af0c9f29 (diff)
downloadhaskell-938392c8515ccbe894714f43852fe604a21ce30b.tar.gz
Add ocInit_MachO
This adds ocInit_MachO function, used to populate the extended ObjectCode structure, and the corresponding stgFree. It also adds defines for iOS, such that MachO.o is also compiled for iOS targets. Depends on D3239 --- This is just one of the pieces for the rts linker support for ios (aarch64-macho) --- The following diagram and legend tries to explain the dependencies a bit: ``` .- D3240 v D3255 <- D3252 <- This <- D3239 ^ '- D3238 ``` - 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 data structure. - in D3255 we finally introduce the aarch64-mach-o linker. Reviewers: rwbarton, bgamari, austin, erikd, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3251
Diffstat (limited to 'rts/Linker.c')
-rw-r--r--rts/Linker.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index 87f1eebf04..529af9ac9a 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1186,6 +1186,10 @@ void freeObjectCode (ObjectCode *oc)
}
#endif
+#if defined(OBJECTFORMAT_MACHO)
+ ocDeinit_MachO(oc);
+#endif
+
stgFree(oc->fileName);
stgFree(oc->archiveMemberName);
@@ -1389,6 +1393,11 @@ preloadObjectFile (pathchar *path)
oc = mkOc(path, image, fileSize, true, NULL, misalignment);
+#ifdef OBJFORMAT_MACHO
+ if (ocVerifyImage_MachO( oc ))
+ ocInit_MachO( oc );
+#endif
+
return oc;
}