From 172a59335fa6c76b17fb6795e87fbc7fcfd198e6 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Wed, 30 Jan 2019 10:05:19 -0500 Subject: Revert "Batch merge" This reverts commit 76c8fd674435a652c75a96c85abbf26f1f221876. --- rts/linker/MachO.c | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) (limited to 'rts/linker/MachO.c') 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 -- cgit v1.2.1