From 18cee9bfed176b900c2d497ee49b55797363e049 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Thu, 14 Jun 2012 16:47:38 +0800 Subject: [PATCH] Kernel/modules - moved relocation to before dep checks, the strings need to be relocated first :/ --- KernelLand/Kernel/modules.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/KernelLand/Kernel/modules.c b/KernelLand/Kernel/modules.c index e3e0ebeb..8202b086 100644 --- a/KernelLand/Kernel/modules.c +++ b/KernelLand/Kernel/modules.c @@ -351,9 +351,17 @@ int Module_LoadFile(const char *Path, const char *ArgString) Log_Warning("Module", "Module_LoadFile - Unable to load '%s'", Path); return 0; } + + // TODO: I need a way of relocating the dependencies before everything else, so + // they can be resolved before any other link errors + if( !Binary_Relocate(base) ) { + Log_Warning("Relocation of module %s failed", Path); + Binary_Unload(base); + return 0; + } // Check for Acess Driver - if( Binary_FindSymbol(base, "DriverInfo", (Uint*)&info ) ) + if( Binary_FindSymbol(base, "DriverInfo", (Uint*)&info ) == 0 ) { for( loader = gModule_Loaders; loader; loader = loader->Next) { @@ -375,12 +383,6 @@ int Module_LoadFile(const char *Path, const char *ArgString) return 0; } - if( !Binary_Relocate(base) ) { - Log_Warning("Relocation of module %s failed", Path); - Binary_Unload(base); - return 0; - } - // Initialise (and register) if( loader ? loader->Loader(base) : Module_int_Initialise( info, ArgString ) ) { -- 2.20.1