diff options
author | Moritz Angermann <moritz.angermann@gmail.com> | 2017-03-21 10:59:49 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-03-26 21:37:22 -0400 |
commit | 8ed29b50376856018dfbbcbd6d728c69af0c9f29 (patch) | |
tree | aac472b4456e3d5268ea7108ddc347426fe75d20 /rts/Linker.c | |
parent | fdbbd63db18cf3ba0cd8f0d61da904317ae5ae01 (diff) | |
download | haskell-8ed29b50376856018dfbbcbd6d728c69af0c9f29.tar.gz |
rts linker: Introduce MachOTypes
This diff introduces MachOTypes, to reduce the need to typing `struct`
all the time. It also coaleces the 64 and non 64 structs. It also adds
additional fiedls to the object code structure for macho, which makes
working with macho object code much simpler and requires less passing
around of variabls or address recomputation for the header, symbol
table, etc...
Furthermore this diff introduces a type for a linked list of stubs.
I had to move the #ifdef from the bottom of the file up, to be able to
extend the object code structure conditional on the use of the macho file format.
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 <- D3251 <- This
^
'- 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, erikd, simonmar, rwbarton, bgamari
Subscribers: rwbarton, thomie, ryantrinkle
Differential Revision: https://phabricator.haskell.org/D3239
Diffstat (limited to 'rts/Linker.c')
-rw-r--r-- | rts/Linker.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rts/Linker.c b/rts/Linker.c index 7654f2b534..87f1eebf04 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1163,6 +1163,9 @@ void freeObjectCode (ObjectCode *oc) break; } } + if (oc->sections[i].info) { + stgFree(oc->sections[i].info); + } } stgFree(oc->sections); } @@ -1732,6 +1735,9 @@ addSection (Section *s, SectionKind kind, SectionAlloc alloc, s->mapped_start = mapped_start; /* start of mmap() block */ s->mapped_size = mapped_size; /* size of mmap() block */ + s->info = (SectionFormatInfo*)stgCallocBytes(1, sizeof(SectionFormatInfo), + "addSection(SectionFormatInfo)"); + IF_DEBUG(linker, debugBelch("addSection: %p-%p (size %" FMT_Word "), kind %d\n", start, (void*)((StgWord)start + size), |