summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorDario Bertini <berdario@google.com>2018-11-16 15:48:36 +0100
committerBen Gamari <ben@smart-cactus.org>2018-11-22 16:04:45 -0500
commitb2f6f896a0bae0e68ec629bd6817a2cb2533a12c (patch)
tree6e52649428402074883911ee9611e3b945741a8a /rts
parent9e0a23b95c285c4019fd2d36102374ee582f1dcb (diff)
downloadhaskell-b2f6f896a0bae0e68ec629bd6817a2cb2533a12c.tar.gz
rts/MachO: A bit of refactoring in ocGetNames
Eliminates a bit of repetition.
Diffstat (limited to 'rts')
-rw-r--r--rts/linker/MachO.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c
index 46fb657e12..87888e9c87 100644
--- a/rts/linker/MachO.c
+++ b/rts/linker/MachO.c
@@ -1613,7 +1613,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)
@@ -1663,14 +1662,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;