libdyld: handle existing but undefined symbols during lookup.
authorwhitequark <whitequark@whitequark.org>
Sun, 2 Aug 2015 02:49:15 +0000 (05:49 +0300)
committerwhitequark <whitequark@whitequark.org>
Sun, 2 Aug 2015 02:56:11 +0000 (05:56 +0300)
software/libdyld/dyld.c

index 112f2e04effd737a9fc8b9eb2181e4dc724dcbf5..da531b6d1ac21ee7e63840fe3561aefc44da1963 100644 (file)
@@ -171,5 +171,9 @@ void *dyld_lookup(const char *symbol, struct dyld_info *info) {
         index = info->hash.chain[index];
     }
 
-    return (void*)(info->base + info->symtab[index].st_value);
+    Elf32_Addr value = info->symtab[index].st_value;
+    if(value != 0)
+        return (void*)(info->base + value);
+    else
+        return NULL;
 }