Kernel - Gitignore for build numbers
[tpg/acess2.git] / Kernel / bin / elf.c
index 2f43eee..d04dbda 100644 (file)
@@ -41,7 +41,7 @@ tBinary *Elf_Load(int fp)
        \r
        // Check the file type\r
        if(hdr.ident[0] != 0x7F || hdr.ident[1] != 'E' || hdr.ident[2] != 'L' || hdr.ident[3] != 'F') {\r
-               Warning("Non-ELF File was passed to the ELF loader\n");\r
+               Log_Warning("ELF", "Non-ELF File was passed to the ELF loader");\r
                LEAVE('n');\r
                return NULL;\r
        }\r
@@ -49,7 +49,7 @@ tBinary *Elf_Load(int fp)
        // Check for a program header\r
        if(hdr.phoff == 0) {\r
                #if DEBUG_WARN\r
-               Warning("ELF File does not contain a program header\n");\r
+               Log_Warning("ELF", "File does not contain a program header (phoff == 0)");\r
                #endif\r
                LEAVE('n');\r
                return NULL;\r
@@ -222,7 +222,7 @@ tBinary *Elf_Load(int fp)
                // Reallocate\r
                ret = realloc( ret, sizeof(tBinary) + 3*sizeof(Uint)*j );\r
                if(!ret) {\r
-                       Warning("BIN", "ElfLoad: Unable to reallocate return structure");\r
+                       Log_Warning("BIN", "ElfLoad: Unable to reallocate return structure");\r
                        return NULL;\r
                }\r
                ret->NumPages = j;\r
@@ -347,6 +347,10 @@ int Elf_Relocate(void *Base)
                }\r
        }\r
 \r
+       if( !dynsymtab && iSymCount > 0 ) {\r
+               Log_Warning("ELF", "Elf_Relocate: No Dynamic symbol table, but count >0");\r
+               return 0;\r
+       }\r
 \r
        // Alter Symbols to true base\r
        for(i = 0; i < iSymCount; i ++)\r
@@ -409,7 +413,7 @@ int Elf_Relocate(void *Base)
                for( i = 0; i < j; i++ )\r
                {\r
                        ptr = (void*)(iBaseDiff + rela[i].r_offset);\r
-                       if( !Elf_Int_DoRelocate(rel[i].r_info, ptr, rela[i].r_addend, dynsymtab, (Uint)Base) ) {\r
+                       if( !Elf_Int_DoRelocate(rela[i].r_info, ptr, rela[i].r_addend, dynsymtab, (Uint)Base) ) {\r
                                bFailed = 1;\r
                        }\r
                }\r
@@ -451,8 +455,8 @@ int Elf_Relocate(void *Base)
                return 0;\r
        }\r
        \r
-       LEAVE('x', hdr->entrypoint);\r
-       return hdr->entrypoint;\r
+       LEAVE('x', 1);\r
+       return 1;\r
 }\r
 \r
 /**\r

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