X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fbin%2Felf.c;h=f4c73e2940a38c9421a6b426a4a3752e7979dcb2;hb=34e8f9c025a5fe5ebc90ada5690685821827a5e7;hp=b0d96cace9a1ec72728a326fbdccc24b59f099b2;hpb=d1530bb39a40caa7ce083245905c13f8e6399c96;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/bin/elf.c b/KernelLand/Kernel/bin/elf.c index b0d96cac..f4c73e29 100644 --- a/KernelLand/Kernel/bin/elf.c +++ b/KernelLand/Kernel/bin/elf.c @@ -1,19 +1,37 @@ /* - * Acess v0.1 - * ELF Executable Loader Code + * Acess2 Kernel + * - By John Hodge (thePowersGang) + * + * elf.c + * - ELF Executable Loader Code */ #define DEBUG 0 #include #include +// ---- Import linking code from userland #define _COMMON_H #define SysDebug(v...) LOG(v) -#define DISABLE_ELF64 -void *GetSymbol(const char *Name, size_t *Size); -void *GetSymbol(const char *Name, size_t *Size) { Uint val; Binary_GetSymbol(Name, &val); if(Size)*Size=0; return (void*)val; }; +#if BITS <= 32 +# define DISABLE_ELF64 +#endif +static int GetSymbol(const char *Name, void **Value, size_t *Size); +static int GetSymbol(const char *Name, void **Value, size_t *Size) { + Uint val; + if(!Binary_GetSymbol(Name, &val)) { + Log_Notice("ELF", "Lookup of '%s' failed", Name); + return 0; + } + if(Size) + *Size=0; + *Value = (void*)val; + return 1; +} #define AddLoaded(a,b) do{}while(0) #define LoadLibrary(a,b,c) (Log_Debug("ELF", "Module requested lib '%s'",a),0) +#define _SysSetMemFlags(ad,f,m) do{}while(0) #include "../../../Usermode/Libraries/ld-acess.so_src/elf.c" +// ---- / ---- #define DEBUG_WARN 1 @@ -291,7 +309,7 @@ tBinary *Elf_Load32(int FD, Elf32_Ehdr *Header) int Elf_Relocate(void *Base) { - return ElfRelocate(Base, (char**){NULL}, "") != NULL; + return ElfRelocate(Base, (char**){NULL}, "") != NULL; } int Elf_GetSymbol(void *Base, const char *Name, Uint *ret) {