Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src add hooks to support the dladdr function.



details:   https://anonhg.NetBSD.org/src/rev/212ebce18f31
branches:  trunk
changeset: 481851:212ebce18f31
user:      scottb <scottb%NetBSD.org@localhost>
date:      Mon Feb 07 21:40:40 2000 +0000

description:
add hooks to support the dladdr function.

diffstat:

 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(-)

diffs (82 lines):

diff -r 8720df63a159 -r 212ebce18f31 lib/csu/common_elf/common.c
--- a/lib/csu/common_elf/common.c       Mon Feb 07 21:24:48 2000 +0000
+++ b/lib/csu/common_elf/common.c       Mon Feb 07 21:40:40 2000 +0000
@@ -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(dlclose,_dlclose);
 __weak_alias(dlsym,_dlsym);
 __weak_alias(dlerror,_dlerror);
+__weak_alias(dladdr,_dladdr);
 #endif
 
 void
@@ -131,4 +132,13 @@
                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 -r 8720df63a159 -r 212ebce18f31 lib/csu/common_elf/common.h
--- a/lib/csu/common_elf/common.h       Mon Feb 07 21:24:48 2000 +0000
+++ b/lib/csu/common_elf/common.h       Mon Feb 07 21:40:40 2000 +0000
@@ -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 <dlfcn.h>
 #include "rtld.h"
diff -r 8720df63a159 -r 212ebce18f31 libexec/ld.elf_so/reloc.c
--- a/libexec/ld.elf_so/reloc.c Mon Feb 07 21:24:48 2000 +0000
+++ b/libexec/ld.elf_so/reloc.c Mon Feb 07 21:40:40 2000 +0000
@@ -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 @@
                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 -r 8720df63a159 -r 212ebce18f31 libexec/ld.elf_so/rtld.h
--- a/libexec/ld.elf_so/rtld.h  Mon Feb 07 21:24:48 2000 +0000
+++ b/libexec/ld.elf_so/rtld.h  Mon Feb 07 21:40:40 2000 +0000
@@ -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 @@
        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 */



Home | Main Index | Thread Index | Old Index