summaryrefslogtreecommitdiff
path: root/rts/linker/MachO.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix invalid printf formatSylvain Henry2020-06-231-1/+1
|
* Fix build warning; add more informative information to the linker; fix ↵Moritz Angermann2020-04-221-4/+15
| | | | linker for empty sections
* Fix more typos, via an improved Levenshtein-style correctorBrian Wignall2020-01-121-3/+3
|
* Fix typos, using Wikipedia list of common typosBrian Wignall2019-11-281-1/+1
|
* rts/linker: Ensure that code isn't writableBen Gamari2019-11-041-149/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | For many years the linker would simply map all of its memory with PROT_READ|PROT_WRITE|PROT_EXEC. However operating systems have been becoming increasingly reluctant to accept this practice (e.g. #17353 and #12657) and for good reason: writable code is ripe for exploitation. Consequently mmapForLinker now maps its memory with PROT_READ|PROT_WRITE. After the linker has finished filling/relocating the mapping it must then call mmapForLinkerMarkExecutable on the sections of the mapping which contain executable code. Moreover, to make all of this possible it was necessary to redesign the m32 allocator. First, we gave (in an earlier commit) each ObjectCode its own m32_allocator. This was necessary since code loading and symbol resolution/relocation are currently interleaved, meaning that it is not possible to enforce W^X when symbols from different objects reside in the same page. We then redesigned the m32 allocator to take advantage of the fact that all of the pages allocated with the allocator die at the same time (namely, when the owning ObjectCode is unloaded). This makes a number of things simpler (e.g. no more page reference counting; the interface provided by the allocator for freeing is simpler). See Note [M32 Allocator] for details.
* [linker, macho] Don't map/allocate zero size sections and segmentsArtem Pyanykh2019-10-041-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Zero size sections are common even during regular build on MacOS. For instance: ``` $ ar -xv libHSghc-prim-0.6.1.a longlong.o $ otool -l longlong.o longlong.o: Mach header magic cputype cpusubtype caps filetype ncmds sizeofcmds flags 0xfeedfacf 16777223 3 0x00 1 2 176 0x00002000 Load command 0 cmd LC_SEGMENT_64 cmdsize 152 segname vmaddr 0x0000000000000000 vmsize 0x0000000000000000 <-- segment size = 0 fileoff 208 filesize 0 maxprot 0x00000007 initprot 0x00000007 nsects 1 flags 0x0 Section sectname __text segname __TEXT addr 0x0000000000000000 size 0x0000000000000000 <-- section size = 0 offset 208 align 2^0 (1) reloff 0 nreloc 0 flags 0x80000000 reserved1 0 reserved2 0 cmd LC_BUILD_VERSION cmdsize 24 platform macos sdk 10.14 minos 10.14 ntools 0 ``` The issue of `mmap`ing 0 bytes was resolved in !1050, but the problem remained. These 0 size segments and sections were still allocated in object code, which lead to failed `ASSERT(size > 0)` in `addProddableBlock` further down the road. With this change zero size segments **and** sections are not mapped/allocated at all. Test plan: 1. Build statically linked GHC. 2. Run `ghc --interactive`. Observe that REPL loads successfully (which was not the case before). 3. Load several more compiled hs files into repl. No failures.
* Fix two lint failures in rts/linker/MachO.cMatthew Pickering2019-06-081-2/+2
|
* rts: Handle zero-sized mappings in MachO linkerBen Gamari2019-05-301-2/+6
| | | | | | | As noted in #16701, it is possible that we will find that an object has no segments needing to be mapped. Previously this would result in mmap being called for a zero-length mapping, which would fail. We now simply skip the mmap call in this case; the rest of the logic just works.
* Gracefully handle error condition in Mach-O relocateSectionArtem Pyanykh2019-03-201-1/+6
|
* Directly test section alignment, fix internal reloc probing lengthArtem Pyanykh2019-03-201-2/+6
|
* Add missing levels to SegmentProt enumArtem Pyanykh2019-03-201-3/+3
|
* Address some todos and fixmesArtem Pyanykh2019-03-201-15/+20
|
* Use segments for section layoutArtem Pyanykh2019-03-201-89/+214
|
* Adjust section placement and relocation logic for Mach-OArtem Pyanykh2019-03-201-112/+217
| | | | | | | | | | | | | | 1. Place each section on a separate page to ensure required alignment (wastes lots ot space, needs to be improved). 2. Unwire relocation logic from macho sections (the most fiddly part is adjusting internal relocations). Other todos: 0. Add a test for section alignment. 1. Investigate 32bit relocations! 2. Fix memory leak in ZEROPAGE section allocation. 3. Fix creating redundant jump islands for GOT. 4. Investigate more compact section placement.
* Drop support for i386 and PowerPC in MachO linkerArtem Pyanykh2019-02-221-219/+7
| | | | | | Some code is broken, there are no CI targets (so not obvious how to test), and no one seems to have built GHC for any of the above platforms in years.
* Allocate bss section within proper range of other sectionsZejun Wu2019-01-301-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This re-applies {D5195} and {D5235}, they were reverted as part of diff stack to unbreak i386. The proper fix is done in {D5289}. Allocate bss section within proper range of other sections: * when `+RTS -xp` is passed, allocate it contiguously as we did for jump islands * when we mmap the code to lower 2Gb, we should allocate bss section there too Test Plan: 1. `./validate` 2. with ``` DYNAMIC_GHC_PROGRAMS = NO DYNAMIC_BY_DEFAULT = NO ``` `TEST="T15729" make test` passed in both linux (both i386 and x86_64) and macos. 3. Also test in a use case where we used to encouter error like: ``` ghc-iserv-prof: R_X86_64_PC32 relocation out of range: (noname) = b90282ba ``` and now, everything works fine. Reviewers: simonmar, bgamari, angerman, erikd Reviewed By: simonmar Subscribers: rwbarton, carter GHC Trac Issues: #15729 Differential Revision: https://phabricator.haskell.org/D5290
* Add a RTS option -xp to load PIC object anywhere in address spaceZejun Wu2019-01-301-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This re-applies {D5195} with fixes for i386: * Fix unused label warnings, see {D5230} or {D5273} * Fix a silly bug introduced by moving `#if` {P190} Add a RTS option -xp to load PIC object anywhere in address space. We do this by relaxing the requirement of <0x80000000 result of `mmapForLinker` and implying USE_CONTIGUOUS_MMAP. We also need to change calls to `ocInit` and `ocGetNames` to avoid dangling pointers when the address of `oc->image` is changed by `ocAllocateSymbolExtra`. Test Plan: See {D5195}, also test under i386: ``` $ uname -a Linux watashi-arch32 4.18.5-arch1-1.0-ARCH #1 SMP PREEMPT Tue Aug 28 20:45:30 CEST 2018 i686 GNU/Linux $ cd testsuite/tests/th/ && make test ... ``` will run `./validate` on stacked diff. Reviewers: simonmar, bgamari, alpmestan, trommler, hvr, erikd Reviewed By: simonmar Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5289
* Revert "Batch merge"Ben Gamari2019-01-301-24/+16
| | | | This reverts commit 76c8fd674435a652c75a96c85abbf26f1f221876.
* Batch mergeBen Gamari2019-01-301-16/+24
|
* PPC NCG: Remove Darwin supportPeter Trommler2019-01-011-264/+3
| | | | | | | Support for Mac OS X on PowerPC has been dropped by Apple years ago. We follow suit and remove PowerPC support for Darwin. Fixes #16106.
* linker: store entire link map and use it.Tamar Christina2018-12-041-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This fixes a corner case in which we have seen the symbol multiple times in different static libraries, but due to a depencency we end up loading the symbol from a library other than the first one. Previously the runtime linker would only track symbols from the first library and did not store the full link map. In this case it was unable to find the address for the symbols in the second library during delay loading. This change stores the address of all symbols seen so a full link map is generated, such that when we make a different decision later than what was expected we're able to still correctly load the library. Test Plan: ./validate, new testcase T15894 Reviewers: angerman, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, carter GHC Trac Issues: #15894 Differential Revision: https://phabricator.haskell.org/D5353
* rts/MachO: Iterate through N (all) symbols, not M external symbolsDario Bertini2018-11-221-1/+1
| | | | Fixes #15105
* rts/MachO: A bit of refactoring in ocGetNamesDario Bertini2018-11-221-8/+7
| | | | Eliminates a bit of repetition.
* rts/MachO: Add a bit more debugging output to getNamesDario Bertini2018-11-221-4/+7
|
* rts: Add FALLTHROUGH macroBen Gamari2018-11-021-0/+1
| | | | | | | | | | | | | | | | | | | Instead of using the GCC `/* fallthrough */` syntax we now use the `__attribute__((fallthrough))`, which Phyx says should be more portable than the former. Also adds a missing fallthrough annotation in the MachO linker, fixing #14613. Reviewers: erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, carter GHC Trac Issues: #14613 Differential Revision: https://phabricator.haskell.org/D5292
* Revert "Add a RTS option -xp to load PIC object anywhere in address space"Ben Gamari2018-10-301-13/+8
| | | | This reverts commit 5403a8636fe82f971234873564f3a05393b89b7a.
* Revert "Allocate bss section within proper range of other sections"Ben Gamari2018-10-301-15/+12
| | | | | | | | This reverts commit e019ec94f12268dd92ea5d5204e9e57e7ebf10ca. This sadly breaks the external interpreter on i386. For instance, see https://circleci.com/gh/ghc/ghc/10925.
* Allocate bss section within proper range of other sectionsZejun Wu2018-10-151-12/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allocate bss section within proper range of other sections: * when `+RTS -xp` is passed, allocate it contiguously as we did for jump islands * when we mmap the code to lower 2Gb, we should allocate bss section there too This depends on {D5195} Test Plan: 1. `./validate` 2. with ``` DYNAMIC_GHC_PROGRAMS = NO DYNAMIC_BY_DEFAULT = NO ``` `TEST="T15729" make test` passed in both linux and macos. 3. Also test in a use case where we used to encouter error like: ``` ghc-iserv-prof: R_X86_64_PC32 relocation out of range: (noname) = b90282ba ``` and now, everything works fine. Reviewers: simonmar, bgamari, angerman, erikd Reviewed By: simonmar Subscribers: rwbarton, carter GHC Trac Issues: #15729 Differential Revision: https://phabricator.haskell.org/D5219
* Add a RTS option -xp to load PIC object anywhere in address spaceZejun Wu2018-10-151-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a RTS option -xp to load PIC object anywhere in address space. We do this by relaxing the requirement of <0x80000000 result of `mmapForLinker` and implying USE_CONTIGUOUS_MMAP. We also need to change calls to `ocInit` and `ocGetNames` to avoid dangling pointers when the address of `oc->image` is changed by `ocAllocateSymbolExtra`. Test Plan: ``` $ uname -a Linux localhost 4.18.8-arch1-1-ARCH #1 SMP PREEMPT Sat Sep 15 20:34:48 UTC 2018 x86_64 GNU/Linux $ cat mk/build.mk DYNAMIC_GHC_PROGRAMS = NO DYNAMIC_BY_DEFAULT = NO GhcRTSWays += thr_debug EXTRA_HC_OPTS += -debug WAY_p_HC_OPTS += -fPIC -fexternal-dynamic-refs $ inplace/bin/ghc-stage2 --interactive -prof +RTS -xp GHCi, version 8.7.20180928: http://www.haskell.org/ghc/ :? for help ghc-stage2: R_X86_64_32 relocation out of range: ghczmprim_GHCziTypes_ZMZN_closure = 7f690bffab59 Recompile /data/users/watashi/ghc/libraries/ghc-prim/dist-install/build/HSghc-prim -0.5.3.o with -fPIC -fexternal-dynamic-refs. ghc-stage2: unable to load package `ghc-prim-0.5.3' $ strace -f -e open,mmap inplace/bin/ghc-stage2 --interactive -prof -fexternal-interpreter -opti+RTS -opti-xp ... [pid 1355283] open("/data/users/watashi/ghc/libraries/base/dist-install/build/libHSbas e-4.12.0.0_p.a", O_RDONLY) = 14 [pid 1355283] mmap(NULL, 8192, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6a84842000 [pid 1355283] open("/data/users/watashi/ghc/libraries/base/dist-install/build/libHSbas e-4.12.0.0_p.a", O_RDONLY) = 14 [pid 1355283] mmap(NULL, 8192, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6a84676000 ... Prelude> System.Posix.Process.getProcessID ... [pid 1355283] open("/data/users/watashi/ghc/libraries/unix/dist-install/build/libHSuni x-2.7.2.2_p.a", O_RDONLY) = 14 [pid 1355283] mmap(NULL, 45056, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6a67d60000 [pid 1355283] open("/data/users/watashi/ghc/libraries/unix/dist-install/build/libHSuni x-2.7.2.2_p.a", O_RDONLY) = 14 [pid 1355283] mmap(NULL, 57344, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6a67d52000 ... ``` ``` $ uname -a Darwin watashis-iMac.local 18.0.0 Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64 $ mv /Users/watashi/gao/ghc/libraries/integer-gmp/dist-install/build/HSintege r-gmp-1.0.2.0.o{,._DISABLE_GHC_ISSUE_15105} $ inplace/bin/ghc-stage2 --interactive +RTS -xp GHCi, version 8.7.20181003: http://www.haskell.org/ghc/ :? for help Prelude> System.Posix.Process.getProcessID 42791 Prelude> Data.Set.fromList [1 .. 10] fromList [1,2,3,4,5,6,7,8,9,10] Prelude> Leaving GHCi. $ inplace/bin/ghc-stage2 --interactive -prof -fexternal-interpreter GHCi, version 8.7.20181003: http://www.haskell.org/ghc/ :? for help Prelude> System.Posix.Process.getProcessID 42806 Prelude> Data.Set.fromList [1 .. 10] fromList [1,2,3,4,5,6,7,8,9,10] Prelude> Leaving GHCi. ``` Also test with something that used to hit the 2Gb limit and it loads and runs without problem. Reviewers: simonmar, bgamari, angerman, Phyx, hvr, erikd Reviewed By: simonmar Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5195
* [linker] fix armv7 & add aarch64Moritz Angermann2017-06-081-67/+67
| | | | | | | | | | | | | | | This adds Global Offset Table logic, as well as PLT like logic for armv7 and aarch64; which replaces the preexisting symbolExtras logic, by placing the PLT tables next to the separtely loaded sections. This is needed to ensure that the symbol stubs are in range. Reviewers: bgamari, austin, erikd, simonmar Reviewed By: bgamari Subscribers: Ericson2314, ryantrinkle, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3448
* tweak to minimize diff against ocInit_ELFGabor Greif2017-05-051-2/+2
|
* rts: Fix MachO from D3527Ben Gamari2017-05-041-3/+3
| | | | | We gave up on typedefing {Section,ObjectCode}FormatInfo structs but MachO never got the memo.
* Prefer #if defined to #ifdefBen Gamari2017-04-281-11/+11
| | | | Our new CPP linter enforces this.
* Enable new warning for fragile/incorrect CPP #if usageErik de Castro Lopo2017-04-281-4/+6
| | | | | | | | | | | | | | | | The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. Test Plan: Validate on Linux and Windows Reviewers: austin, angerman, simonmar, bgamari, Phyx Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3278
* catch the case where there is no symCmdMoritz Angermann2017-04-211-1/+3
| | | | | | | | | | | | | | | | | We do check for symCmd, to set the info->nlist value, but forgot to do the same check for info->names. Thus when trying to extract stroff from symCmd, we hit a segfault. Test Plan: The validation failure on windows is rather suspicious... let's try this one Reviewers: bgamari, adinapoli, austin, erikd, simonmar Reviewed By: adinapoli Subscribers: thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D3468
* Revert "linker/mach-o: Catch the case where there is no symCmd"Ben Gamari2017-04-181-3/+1
| | | | | | This causes validation failures on Windows. This reverts commit 6c05b27e5bafe9f232e7014f4760335f5e3ba591.
* linker/mach-o: Catch the case where there is no symCmdMoritz Angermann2017-04-151-1/+3
| | | | | | | | | | | | | | We do check for symCmd, to set the info->nlist value, but forgot to do the same check for info->names. Thus when trying to extract stroff from symCmd, we hit a segfault. Reviewers: bgamari, adinapoli, austin, erikd, simonmar Reviewed By: bgamari, adinapoli Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3459
* Revert "Enable new warning for fragile/incorrect CPP #if usage"Ben Gamari2017-04-051-6/+4
| | | | | | | | This is causing too much platform dependent breakage at the moment. We will need a more rigorous testing strategy before this can be merged again. This reverts commit 7e340c2bbf4a56959bd1e95cdd1cfdb2b7e537c2.
* Enable new warning for fragile/incorrect CPP #if usageErik de Castro Lopo2017-04-051-4/+6
| | | | | | | | | | | | | | | | The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. Test Plan: Validate on Linux and Windows Reviewers: austin, angerman, simonmar, bgamari, Phyx Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3278
* Spelling in comments only [ci skip]Gabor Greif2017-03-281-4/+4
|
* Adds aarch64 linker for mach-o files.Moritz Angermann2017-03-261-27/+721
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Refactor MachO.cMoritz Angermann2017-03-261-251/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Rename existing structs with typedefs from MachOTypes. - Update the following functions to make use of the extended ObjectCode structure: - ocAllocateSymbolExtras_MachO - resolveImports - ocGetNames_MachO - ocResolve_MachO - ocRunInit_MachO - repalce int with size_t for fread - Add aarch64 to the 64bit magic header check. Depends on D3239, D3251 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 <- This <- D3251 <- 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: austin, rwbarton, erikd, simonmar, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3252
* Add ocInit_MachOMoritz Angermann2017-03-261-4/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Spelling fixes in comments [ci skip]Gabor Greif2017-01-181-1/+1
|
* linker: Split MachO implementation into new source fileBen Gamari2016-11-021-0/+1244
Test Plan: Validate Reviewers: erikd, austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2649