ld-acess - Fixed bugs due to not testing from AcessNative changes
[tpg/acess2.git] / Usermode / Libraries / ld-acess.so_src / elf.c
index e1fcd2d..dcde746 100644 (file)
@@ -315,6 +315,49 @@ int ElfGetSymbol(Uint Base, char *Name, Uint *ret)
 \r
        //DEBUGS("ElfGetSymbol: (Base=0x%x, Name='%s')\n", Base, Name);\r
 \r
+       // Catch the current executable\r
+       #if 0\r
+       if( !hdr->misc.HashTable )\r
+       {\r
+               Elf32_Phdr      *phtab;\r
+               Elf32_Dyn       *dynTab = NULL;\r
+                int    j;\r
+               \r
+               // Locate the tables\r
+               phtab = (void*)( Base + hdr->phoff );\r
+               for( i = 0; i < hdr->phentcount; i ++ )\r
+               {\r
+                       if( phtab[i].Type == PT_DYNAMIC ) {\r
+                               dynTab = (void*)phtab[i].VAddr;\r
+                               break ;\r
+                       }\r
+               }\r
+               if( !dynTab ) {\r
+                       SysDebug("ERROR - Unable to find DYNAMIC segment in %p", (void*)Base);\r
+                       return 0;\r
+               }\r
+               \r
+               for( j = 0; dynTab[j].d_tag != DT_NULL; j++)\r
+               {\r
+                       switch(dynTab[j].d_tag)\r
+                       {\r
+                       // --- Symbol Table ---\r
+                       case DT_SYMTAB:\r
+                               hdr->misc.SymTable = dynTab[j].d_val;\r
+                               break;\r
+                       // --- Hash Table --\r
+                       case DT_HASH:\r
+                               hdr->misc.HashTable = dynTab[j].d_val;\r
+                               break;\r
+                       }\r
+               }\r
+       }\r
+       #endif\r
+       \r
+       if( !hdr->misc.SymTable || !hdr->misc.HashTable ) {\r
+               return 0;\r
+       }\r
+\r
        pBuckets = (void *) hdr->misc.HashTable;\r
        symtab = (void *) hdr->misc.SymTable;\r
        

UCC git Repository :: git.ucc.asn.au