User/Kernel - ARMv7 fixes (relocation of .text)
[tpg/acess2.git] / Usermode / Libraries / ld-acess.so_src / loadlib.c
index 3f8e674..f59caf2 100644 (file)
@@ -15,7 +15,6 @@
 
 // === PROTOTYPES ===
 void   *IsFileLoaded(const char *file);
- int   GetSymbolFromBase(void *base, const char *name, void **ret, size_t *size);
 
 // === IMPORTS ===
 extern const struct {
@@ -88,6 +87,9 @@ void *LoadLibrary(const char *SoName, const char *SearchDir, char **envp)
        
        // Load Symbols
        fEntry = DoRelocate( base, envp, filename );
+       if( !fEntry ) {
+               return 0;
+       }
        
        // Call Entrypoint
        DEBUGS(" LoadLibrary: '%s' Entry %p", SoName, fEntry);
@@ -198,26 +200,31 @@ void Unload(void *Base)
  \fn Uint GetSymbol(const char *name)
  \brief Gets a symbol value from a loaded library
 */
-void *GetSymbol(const char *name, size_t *Size)
+int GetSymbol(const char *name, void **Value, size_t *Size)
 {
         int    i;
-       void    *ret;
        
        //SysDebug("ciNumLocalExports = %i", ciNumLocalExports);
        for(i=0;i<ciNumLocalExports;i++)
        {
-               if( strcmp(caLocalExports[i].Name, name) == 0 )
-                       return caLocalExports[i].Value;
+               if( strcmp(caLocalExports[i].Name, name) == 0 ) {
+                       *Value = caLocalExports[i].Value;
+                       if(Size)
+                               *Size = 0;
+                       return 1;
+               }
        }
        
        // Entry 0 is ld-acess, ignore it
        for(i = 1; i < MAX_LOADED_LIBRARIES; i ++)
        {
-               if(gLoadedLibraries[i].Base == 0)       break;
+               if(gLoadedLibraries[i].Base == 0)
+                       break;
                
                //SysDebug(" GetSymbol: Trying 0x%x, '%s'",
                //      gLoadedLibraries[i].Base, gLoadedLibraries[i].Name);
-               if(GetSymbolFromBase(gLoadedLibraries[i].Base, name, &ret, Size))       return ret;
+               if(GetSymbolFromBase(gLoadedLibraries[i].Base, name, Value, Size))
+                       return 1;
        }
        SysDebug("GetSymbol: === Symbol '%s' not found ===", name);
        return 0;

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