X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fbin%2Felf.c;h=4456a2c8d56f77b1239b1270f34bf8bff751644d;hb=e9a7ae01935b78f05698668d57c4748a8e931d9a;hp=83dfa8ac883831a2d55167ab753475e36eee137c;hpb=b54bfbc2571229d3477f2b48c7b84dd63307768b;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/bin/elf.c b/KernelLand/Kernel/bin/elf.c index 83dfa8ac..4456a2c8 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) 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) {