Diff for /src/lib/libcr/gen/Attic/dlfcn.c between versions 1.2 and 1.3

version 1.2, 2003/06/17 04:26:42 version 1.3, 2004/04/25 12:40:48
Line 24 Line 24
  * SUCH DAMAGE.   * SUCH DAMAGE.
  *   *
  * $FreeBSD: src/lib/libc/gen/dlfcn.c,v 1.6.2.1 2003/02/20 20:42:45 kan Exp $   * $FreeBSD: src/lib/libc/gen/dlfcn.c,v 1.6.2.1 2003/02/20 20:42:45 kan Exp $
 * $DragonFly: src/lib/libc/gen/dlfcn.c,v 1.1 2003/06/16 04:23:06 dillon Exp $ * $DragonFly$
  */   */
   
 /*  
  * Linkage to services provided by the dynamic linker.  These are  
  * implemented differently in ELF and a.out, because the dynamic  
  * linkers have different interfaces.  
  */  
   
 #ifdef __ELF__  
   
 #include <dlfcn.h>  #include <dlfcn.h>
 #include <stddef.h>  #include <stddef.h>
   
Line 116  dlinfo(void *handle, int request, void * Line 108  dlinfo(void *handle, int request, void *
         _rtld_error(sorry);          _rtld_error(sorry);
         return NULL;          return NULL;
 }  }
   
 #else /* a.out format */  
   
 #include <sys/types.h>  
 #include <nlist.h>              /* XXX - Required by link.h */  
 #include <dlfcn.h>  
 #include <link.h>  
 #include <stddef.h>  
   
 /*  
  * For a.out, entry to the dynamic linker is via these trampolines.  
  * They enter the dynamic linker through the ld_entry struct that was  
  * passed back from the dynamic linker at startup time.  
  */  
   
 /* GCC is needed because we use its __builtin_return_address construct. */  
   
 #ifndef __GNUC__  
 #error "GCC is needed to compile this file"  
 #endif  
   
 /*  
  * These variables are set by code in crt0.o.  For compatibility with  
  * old executables, they must be common, not extern.  
  */  
 struct ld_entry *__ldso_entry;          /* Entry points to dynamic linker */  
 int              __ldso_version;        /* Dynamic linker version number */  
   
 int  
 dladdr(const void *addr, Dl_info *dlip)  
 {  
         if (__ldso_entry == NULL || __ldso_version < LDSO_VERSION_HAS_DLADDR)  
                 return 0;  
         return (__ldso_entry->dladdr)(addr, dlip);  
 }  
   
 int  
 dlclose(void *handle)  
 {  
         if (__ldso_entry == NULL)  
                 return -1;  
         return (__ldso_entry->dlclose)(handle);  
 }  
   
 const char *  
 dlerror(void)  
 {  
         if (__ldso_entry == NULL)  
                 return "Service unavailable";  
         return (__ldso_entry->dlerror)();  
 }  
   
 void *  
 dlopen(const char *name, int mode)  
 {  
         if (__ldso_entry == NULL)  
                 return NULL;  
         return (__ldso_entry->dlopen)(name, mode);  
 }  
   
 void *  
 dlsym(void *handle, const char *name)  
 {  
         if (__ldso_entry == NULL)  
                 return NULL;  
         if (__ldso_version >= LDSO_VERSION_HAS_DLSYM3) {  
                 void *retaddr = __builtin_return_address(0); /* __GNUC__ only */  
                 return (__ldso_entry->dlsym3)(handle, name, retaddr);  
         } else  
                 return (__ldso_entry->dlsym)(handle, name);  
 }  
   
 #endif /* __ELF__ */  

Removed from v.1.2  
changed lines
  Added in v.1.3