[commit: ghc] ghc-8.6: rts/MachO: A bit of refactoring in ocGetNames (b44caa0)
git at git.haskell.org
git at git.haskell.org
Thu Nov 22 21:55:57 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.6
Link : http://ghc.haskell.org/trac/ghc/changeset/b44caa05ad949519431059b07370615c0f513c9c/ghc
>---------------------------------------------------------------
commit b44caa05ad949519431059b07370615c0f513c9c
Author: Dario Bertini <berdario at google.com>
Date: Fri Nov 16 15:48:36 2018 +0100
rts/MachO: A bit of refactoring in ocGetNames
Eliminates a bit of repetition.
(cherry picked from commit b2f6f896a0bae0e68ec629bd6817a2cb2533a12c)
>---------------------------------------------------------------
b44caa05ad949519431059b07370615c0f513c9c
rts/linker/MachO.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c
index 70acb16..b5caa7b 100644
--- a/rts/linker/MachO.c
+++ b/rts/linker/MachO.c
@@ -1612,7 +1612,6 @@ ocGetNames_MachO(ObjectCode* oc)
"ocGetNames_MachO(oc->symbols)");
if (oc->info->symCmd) {
- debugBelch("ocGetNames_MachO: %d macho symbols\n", oc->info->n_macho_symbols);
for (size_t i = 0; i < oc->info->n_macho_symbols; i++) {
SymbolName* nm = oc->info->macho_symbols[i].name;
if(oc->info->nlist[i].n_type & N_STAB)
@@ -1662,14 +1661,14 @@ ocGetNames_MachO(ObjectCode* oc)
if (oc->info->symCmd) {
for (int i = 0; i < oc->n_symbols; i++) {
- if((oc->info->nlist[i].n_type & N_TYPE) == N_UNDF
- && (oc->info->nlist[i].n_type & N_EXT)
- && (oc->info->nlist[i].n_value != 0)) {
-
- SymbolName* nm = oc->info->macho_symbols[i].name;
- unsigned long sz = oc->info->nlist[i].n_value;
+ SymbolName* nm = oc->info->macho_symbols[i].name;
+ MachONList *nlist = &oc->info->nlist[i];
+ if((nlist->n_type & N_TYPE) == N_UNDF
+ && (nlist->n_type & N_EXT)
+ && (nlist->n_value != 0)) {
+ unsigned long sz = nlist->n_value;
- oc->info->nlist[i].n_value = commonCounter;
+ nlist->n_value = commonCounter;
/* also set the final address to the macho_symbol */
oc->info->macho_symbols[i].addr = (void*)commonCounter;
More information about the ghc-commits
mailing list