X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fbin%2Felf.c;h=4bc13b16a29f007190712c9a5c84442ba8391665;hb=701555cd9e3aa5131572043867e15387db3cddef;hp=6719a41fb6d5babacd5b4e073696c11be145250c;hpb=38e4b28d370c5f9284b285a71518ae2b6bce125c;p=tpg%2Facess2.git diff --git a/Kernel/bin/elf.c b/Kernel/bin/elf.c index 6719a41f..4bc13b16 100644 --- a/Kernel/bin/elf.c +++ b/Kernel/bin/elf.c @@ -3,7 +3,7 @@ * ELF Executable Loader Code */ #define DEBUG 0 -#include +#include #include #include "elf.h" @@ -461,7 +461,7 @@ int Elf_Int_DoRelocate(Uint r_info, Uint32 *ptr, Uint32 addend, Elf32_Sym *symta if( !Elf_GetSymbol((void*)base, sSymName, &val) ) // Search this binary first if( !Binary_GetSymbol( sSymName, &val ) ) return 0; - //LOG("R_386_32 *0x%x += 0x%x('%s')", ptr, val, sSymName); + LOG("R_386_32 *0x%x += 0x%x('%s')", ptr, val, sSymName); *ptr = val + addend; break; @@ -470,7 +470,7 @@ int Elf_Int_DoRelocate(Uint r_info, Uint32 *ptr, Uint32 addend, Elf32_Sym *symta if( !Elf_GetSymbol( (void*)base, sSymName, &val ) ) if( !Binary_GetSymbol( sSymName, &val ) ) return 0; - //LOG("R_386_PC32 *0x%x = 0x%x + 0x%x('%s') - 0x%x", ptr, *ptr, val, sSymName, (Uint)ptr ); + LOG("R_386_PC32 *0x%x = 0x%x + 0x%x('%s') - 0x%x", ptr, *ptr, val, sSymName, (Uint)ptr ); // TODO: Check if it needs the true value of ptr or the compiled value // NOTE: Testing using true value *ptr = val + addend - (Uint)ptr; @@ -481,7 +481,7 @@ int Elf_Int_DoRelocate(Uint r_info, Uint32 *ptr, Uint32 addend, Elf32_Sym *symta if( !Elf_GetSymbol( (void*)base, sSymName, &val ) ) if( !Binary_GetSymbol( sSymName, &val ) ) return 0; - //LOG("R_386_GLOB_DAT *0x%x = 0x%x (%s)", ptr, val, sSymName); + LOG("R_386_GLOB_DAT *0x%x = 0x%x (%s)", ptr, val, sSymName); *ptr = val; break; @@ -490,13 +490,13 @@ int Elf_Int_DoRelocate(Uint r_info, Uint32 *ptr, Uint32 addend, Elf32_Sym *symta if( !Elf_GetSymbol( (void*)base, sSymName, &val ) ) if( !Binary_GetSymbol( sSymName, &val ) ) return 0; - //LOG("R_386_JMP_SLOT *0x%x = 0x%x (%s)", ptr, val, sSymName); + LOG("R_386_JMP_SLOT *0x%x = 0x%x (%s)", ptr, val, sSymName); *ptr = val; break; // Base Address (B+A) case R_386_RELATIVE: - //LOG("R_386_RELATIVE *0x%x = 0x%x + 0x%x", ptr, base, addend); + LOG("R_386_RELATIVE *0x%x = 0x%x + 0x%x", ptr, base, addend); *ptr = base + addend; break; @@ -539,7 +539,7 @@ int Elf_GetSymbol(void *Base, char *Name, Uint *ret) // Check Bucket i = pBuckets[ iNameHash ]; if(symtab[i].shndx != SHN_UNDEF && strcmp(symtab[i].name, Name) == 0) { - *ret = symtab[ i ].value; + if(ret) *ret = symtab[ i ].value; return 1; } @@ -548,7 +548,7 @@ int Elf_GetSymbol(void *Base, char *Name, Uint *ret) { i = pChains[i]; if(symtab[i].shndx != SHN_UNDEF && strcmp(symtab[ i ].name, Name) == 0) { - *ret = symtab[ i ].value; + if(ret) *ret = symtab[ i ].value; return 1; } }