add hooks to support the dladdr function.

This commit is contained in:
scottb 2000-02-07 21:40:40 +00:00
parent 1d46ce41ea
commit c0cf420b69
4 changed files with 17 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: common.c,v 1.4 1999/08/19 20:52:36 kleink Exp $ */ /* $NetBSD: common.c,v 1.5 2000/02/07 21:40:40 scottb Exp $ */
/* /*
* Copyright (c) 1995 Christopher G. Demetriou * Copyright (c) 1995 Christopher G. Demetriou
@ -61,6 +61,7 @@ __weak_alias(dlopen,_dlopen);
__weak_alias(dlclose,_dlclose); __weak_alias(dlclose,_dlclose);
__weak_alias(dlsym,_dlsym); __weak_alias(dlsym,_dlsym);
__weak_alias(dlerror,_dlerror); __weak_alias(dlerror,_dlerror);
__weak_alias(dladdr,_dladdr);
#endif #endif
void void
@ -131,4 +132,13 @@ dlerror()
return ("Dynamic linker interface not available"); return ("Dynamic linker interface not available");
return (__mainprog_obj->dlerror)(); return (__mainprog_obj->dlerror)();
} }
int
dladdr(void *addr, Dl_info *dli)
{
if (__mainprog_obj == NULL)
return -1;
return (__mainprog_obj->dladdr)(addr, dli);
}
#endif /* DYNAMIC */ #endif /* DYNAMIC */

View File

@ -1,4 +1,4 @@
/* $NetBSD: common.h,v 1.3 1999/08/19 20:52:36 kleink Exp $ */ /* $NetBSD: common.h,v 1.4 2000/02/07 21:40:40 scottb Exp $ */
/* /*
* Copyright (c) 1995 Christopher G. Demetriou * Copyright (c) 1995 Christopher G. Demetriou
@ -42,6 +42,7 @@
#define dlclose _dlclose #define dlclose _dlclose
#define dlsym _dlsym #define dlsym _dlsym
#define dlerror _dlerror #define dlerror _dlerror
#define dladdr _dladdr
#endif #endif
#include <dlfcn.h> #include <dlfcn.h>
#include "rtld.h" #include "rtld.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: reloc.c,v 1.24 1999/12/08 08:47:10 itohy Exp $ */ /* $NetBSD: reloc.c,v 1.25 2000/02/07 21:40:41 scottb Exp $ */
/* /*
* Copyright 1996 John D. Polstra. * Copyright 1996 John D. Polstra.
@ -625,6 +625,7 @@ _rtld_relocate_objects(first, bind_now, dodebug)
obj->dlsym = _rtld_dlsym; obj->dlsym = _rtld_dlsym;
obj->dlerror = _rtld_dlerror; obj->dlerror = _rtld_dlerror;
obj->dlclose = _rtld_dlclose; obj->dlclose = _rtld_dlclose;
obj->dladdr = _rtld_dladdr;
/* Set the special PLTGOT entries. */ /* Set the special PLTGOT entries. */
if (obj->pltgot != NULL) { if (obj->pltgot != NULL) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtld.h,v 1.22 1999/12/15 05:22:37 christos Exp $ */ /* $NetBSD: rtld.h,v 1.23 2000/02/07 21:40:42 scottb Exp $ */
/* /*
* Copyright 1996 John D. Polstra. * Copyright 1996 John D. Polstra.
@ -193,6 +193,7 @@ typedef struct Struct_Obj_Entry {
void *(*dlsym) __P((void *, const char *)); void *(*dlsym) __P((void *, const char *));
char *(*dlerror) __P((void)); char *(*dlerror) __P((void));
int (*dlclose) __P((void *)); int (*dlclose) __P((void *));
int (*dladdr) __P((void *, Dl_info *));
int mainprog:1; /* True if this is the main program */ int mainprog:1; /* True if this is the main program */
int rtld:1; /* True if this is the dynamic linker */ int rtld:1; /* True if this is the dynamic linker */