X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=Kernel%2Fbin%2Felf.c;h=d04dbda45b2c3a669d24bb4bae80d01ef72a4aeb;hb=d7d0479311c4dba418ee880f27f01418fd536344;hp=2f43eee85904159fce69b7fd3eae637bf7749d74;hpb=9d85201216cb35e1b1e051b1d7cdc38eaa5befa4;p=tpg%2Facess2.git diff --git a/Kernel/bin/elf.c b/Kernel/bin/elf.c index 2f43eee8..d04dbda4 100644 --- a/Kernel/bin/elf.c +++ b/Kernel/bin/elf.c @@ -41,7 +41,7 @@ tBinary *Elf_Load(int fp) // Check the file type if(hdr.ident[0] != 0x7F || hdr.ident[1] != 'E' || hdr.ident[2] != 'L' || hdr.ident[3] != 'F') { - Warning("Non-ELF File was passed to the ELF loader\n"); + Log_Warning("ELF", "Non-ELF File was passed to the ELF loader"); LEAVE('n'); return NULL; } @@ -49,7 +49,7 @@ tBinary *Elf_Load(int fp) // Check for a program header if(hdr.phoff == 0) { #if DEBUG_WARN - Warning("ELF File does not contain a program header\n"); + Log_Warning("ELF", "File does not contain a program header (phoff == 0)"); #endif LEAVE('n'); return NULL; @@ -222,7 +222,7 @@ tBinary *Elf_Load(int fp) // Reallocate ret = realloc( ret, sizeof(tBinary) + 3*sizeof(Uint)*j ); if(!ret) { - Warning("BIN", "ElfLoad: Unable to reallocate return structure"); + Log_Warning("BIN", "ElfLoad: Unable to reallocate return structure"); return NULL; } ret->NumPages = j; @@ -347,6 +347,10 @@ int Elf_Relocate(void *Base) } } + if( !dynsymtab && iSymCount > 0 ) { + Log_Warning("ELF", "Elf_Relocate: No Dynamic symbol table, but count >0"); + return 0; + } // Alter Symbols to true base for(i = 0; i < iSymCount; i ++) @@ -409,7 +413,7 @@ int Elf_Relocate(void *Base) for( i = 0; i < j; i++ ) { ptr = (void*)(iBaseDiff + rela[i].r_offset); - if( !Elf_Int_DoRelocate(rel[i].r_info, ptr, rela[i].r_addend, dynsymtab, (Uint)Base) ) { + if( !Elf_Int_DoRelocate(rela[i].r_info, ptr, rela[i].r_addend, dynsymtab, (Uint)Base) ) { bFailed = 1; } } @@ -451,8 +455,8 @@ int Elf_Relocate(void *Base) return 0; } - LEAVE('x', hdr->entrypoint); - return hdr->entrypoint; + LEAVE('x', 1); + return 1; } /**