From c0cf420b69c5c3697e0217dd236aa56ad324ce20 Mon Sep 17 00:00:00 2001 From: scottb Date: Mon, 7 Feb 2000 21:40:40 +0000 Subject: [PATCH] add hooks to support the dladdr function. --- lib/csu/common_elf/common.c | 12 +++++++++++- lib/csu/common_elf/common.h | 3 ++- libexec/ld.elf_so/reloc.c | 3 ++- libexec/ld.elf_so/rtld.h | 3 ++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/csu/common_elf/common.c b/lib/csu/common_elf/common.c index d7f315c0fc3f..31ee824350d1 100644 --- a/lib/csu/common_elf/common.c +++ b/lib/csu/common_elf/common.c @@ -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 @@ -61,6 +61,7 @@ __weak_alias(dlopen,_dlopen); __weak_alias(dlclose,_dlclose); __weak_alias(dlsym,_dlsym); __weak_alias(dlerror,_dlerror); +__weak_alias(dladdr,_dladdr); #endif void @@ -131,4 +132,13 @@ dlerror() return ("Dynamic linker interface not available"); 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 */ diff --git a/lib/csu/common_elf/common.h b/lib/csu/common_elf/common.h index c7f628f1f0ee..93ffd1d6a1fc 100644 --- a/lib/csu/common_elf/common.h +++ b/lib/csu/common_elf/common.h @@ -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 @@ -42,6 +42,7 @@ #define dlclose _dlclose #define dlsym _dlsym #define dlerror _dlerror +#define dladdr _dladdr #endif #include #include "rtld.h" diff --git a/libexec/ld.elf_so/reloc.c b/libexec/ld.elf_so/reloc.c index f52b6d7a2360..df917ae744fd 100644 --- a/libexec/ld.elf_so/reloc.c +++ b/libexec/ld.elf_so/reloc.c @@ -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. @@ -625,6 +625,7 @@ _rtld_relocate_objects(first, bind_now, dodebug) obj->dlsym = _rtld_dlsym; obj->dlerror = _rtld_dlerror; obj->dlclose = _rtld_dlclose; + obj->dladdr = _rtld_dladdr; /* Set the special PLTGOT entries. */ if (obj->pltgot != NULL) { diff --git a/libexec/ld.elf_so/rtld.h b/libexec/ld.elf_so/rtld.h index d734149e5712..e6225dd74e63 100644 --- a/libexec/ld.elf_so/rtld.h +++ b/libexec/ld.elf_so/rtld.h @@ -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. @@ -193,6 +193,7 @@ typedef struct Struct_Obj_Entry { void *(*dlsym) __P((void *, const char *)); char *(*dlerror) __P((void)); int (*dlclose) __P((void *)); + int (*dladdr) __P((void *, Dl_info *)); int mainprog:1; /* True if this is the main program */ int rtld:1; /* True if this is the dynamic linker */