rts/MachO: Add a bit more debugging output to getNames
authorDario Bertini <berdario@google.com>
Fri, 16 Nov 2018 14:46:54 +0000 (15:46 +0100)
committerBen Gamari <ben@smart-cactus.org>
Thu, 22 Nov 2018 21:06:09 +0000 (16:06 -0500)
(cherry picked from commit 9e0a23b95c285c4019fd2d36102374ee582f1dcb)

rts/linker/MachO.c

index 5812e89..70acb16 100644 (file)
@@ -1612,14 +1612,17 @@ 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)
-                ;
+            {
+                IF_DEBUG(linker, debugBelch("ocGetNames_MachO: Skip STAB: %s\n", nm));
+            }
             else if((oc->info->nlist[i].n_type & N_TYPE) == N_SECT)
             {
                 if(oc->info->nlist[i].n_type & N_EXT)
                 {
-                    SymbolName* nm = oc->info->macho_symbols[i].name;
                     if (   (oc->info->nlist[i].n_desc & N_WEAK_DEF)
                         && lookupSymbol_(nm)) {
                         // weak definition, and we already have a definition
@@ -1643,12 +1646,12 @@ ocGetNames_MachO(ObjectCode* oc)
                 }
                 else
                 {
-                    IF_DEBUG(linker, debugBelch("ocGetNames_MachO: \t...not external, skipping\n"));
+                    IF_DEBUG(linker, debugBelch("ocGetNames_MachO: \t...not external, skipping %s\n", nm));
                 }
             }
             else
             {
-                IF_DEBUG(linker, debugBelch("ocGetNames_MachO: \t...not defined in this section, skipping\n"));
+                IF_DEBUG(linker, debugBelch("ocGetNames_MachO: \t...not defined in this section, skipping %s\n", nm));
             }
         }
     }