diff options
Diffstat (limited to 'rts/linker/MachO.c')
-rw-r--r-- | rts/linker/MachO.c | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c index ca5befca77..c6a6c28440 100644 --- a/rts/linker/MachO.c +++ b/rts/linker/MachO.c @@ -99,8 +99,6 @@ bool ocMprotect_MachO( ObjectCode *oc ); void ocInit_MachO(ObjectCode * oc) { - ocDeinit_MachO(oc); - oc->info = (struct ObjectCodeFormatInfo*)stgCallocBytes( 1, sizeof *oc->info, "ocInit_MachO(ObjectCodeFormatInfo)"); @@ -162,19 +160,16 @@ ocInit_MachO(ObjectCode * oc) void ocDeinit_MachO(ObjectCode * oc) { - if (oc->info != NULL) { - if(oc->info->n_macho_symbols > 0) { - stgFree(oc->info->macho_symbols); - } + if(oc->info->n_macho_symbols > 0) { + stgFree(oc->info->macho_symbols); + } #if defined(aarch64_HOST_ARCH) - freeGot(oc); - for(int i = 0; i < oc->n_sections; i++) { - freeStubs(&oc->sections[i]); - } -#endif - stgFree(oc->info); - oc->info = NULL; + freeGot(oc); + for(int i = 0; i < oc->n_sections; i++) { + freeStubs(&oc->sections[i]); } +#endif + stgFree(oc->info); } static int @@ -187,22 +182,19 @@ resolveImports( #if defined(x86_64_HOST_ARCH) || defined(aarch64_HOST_ARCH) int -ocAllocateExtras_MachO(ObjectCode* oc) +ocAllocateSymbolExtras_MachO(ObjectCode* oc) { - IF_DEBUG(linker, debugBelch("ocAllocateExtras_MachO: start\n")); + IF_DEBUG(linker, debugBelch("ocAllocateSymbolExtras_MachO: start\n")); if (NULL != oc->info->symCmd) { - IF_DEBUG(linker, - debugBelch("ocAllocateExtras_MachO: allocate %d symbols\n", - oc->info->symCmd->nsyms)); - IF_DEBUG(linker, debugBelch("ocAllocateExtras_MachO: done\n")); - return ocAllocateExtras(oc, oc->info->symCmd->nsyms, 0, 0); + IF_DEBUG(linker, debugBelch("ocAllocateSymbolExtras_MachO: allocate %d symbols\n", oc->info->symCmd->nsyms)); + IF_DEBUG(linker, debugBelch("ocAllocateSymbolExtras_MachO: done\n")); + return ocAllocateSymbolExtras(oc, oc->info->symCmd->nsyms, 0); } - IF_DEBUG(linker, - debugBelch("ocAllocateExtras_MachO: allocated no symbols\n")); - IF_DEBUG(linker, debugBelch("ocAllocateExtras_MachO: done\n")); - return ocAllocateExtras(oc, 0, 0, 0); + IF_DEBUG(linker, debugBelch("ocAllocateSymbolExtras_MachO: allocated no symbols\n")); + IF_DEBUG(linker, debugBelch("ocAllocateSymbolExtras_MachO: done\n")); + return ocAllocateSymbolExtras(oc,0,0); } #else |