X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Fld-acess.so_src%2Felf.c;h=dcde746dda1a3e52ff830caf5032bba649f1feab;hb=560e97380a10c4a8cd8b14b2b7f5d133e32759e0;hp=e1fcd2d4426819899c48b4cae5ebc298a1694cb3;hpb=f67c9f03f7b4aaa3688ef74b255690d52ded3db2;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/ld-acess.so_src/elf.c b/Usermode/Libraries/ld-acess.so_src/elf.c index e1fcd2d4..dcde746d 100644 --- a/Usermode/Libraries/ld-acess.so_src/elf.c +++ b/Usermode/Libraries/ld-acess.so_src/elf.c @@ -315,6 +315,49 @@ int ElfGetSymbol(Uint Base, char *Name, Uint *ret) //DEBUGS("ElfGetSymbol: (Base=0x%x, Name='%s')\n", Base, Name); + // Catch the current executable + #if 0 + if( !hdr->misc.HashTable ) + { + Elf32_Phdr *phtab; + Elf32_Dyn *dynTab = NULL; + int j; + + // Locate the tables + phtab = (void*)( Base + hdr->phoff ); + for( i = 0; i < hdr->phentcount; i ++ ) + { + if( phtab[i].Type == PT_DYNAMIC ) { + dynTab = (void*)phtab[i].VAddr; + break ; + } + } + if( !dynTab ) { + SysDebug("ERROR - Unable to find DYNAMIC segment in %p", (void*)Base); + return 0; + } + + for( j = 0; dynTab[j].d_tag != DT_NULL; j++) + { + switch(dynTab[j].d_tag) + { + // --- Symbol Table --- + case DT_SYMTAB: + hdr->misc.SymTable = dynTab[j].d_val; + break; + // --- Hash Table -- + case DT_HASH: + hdr->misc.HashTable = dynTab[j].d_val; + break; + } + } + } + #endif + + if( !hdr->misc.SymTable || !hdr->misc.HashTable ) { + return 0; + } + pBuckets = (void *) hdr->misc.HashTable; symtab = (void *) hdr->misc.SymTable;