Source-Changes-HG archive

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

[src/trunk]: src/libexec/ld.elf_so Also set __mainprog_obj so .ini sections c...



details:   https://anonhg.NetBSD.org/src/rev/daae6d28be94
branches:  trunk
changeset: 488017:daae6d28be94
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jun 16 19:51:05 2000 +0000

description:
Also set __mainprog_obj so .ini sections can call dlopen()

diffstat:

 libexec/ld.elf_so/rtld.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r 998220636c86 -r daae6d28be94 libexec/ld.elf_so/rtld.c
--- a/libexec/ld.elf_so/rtld.c  Fri Jun 16 19:33:50 2000 +0000
+++ b/libexec/ld.elf_so/rtld.c  Fri Jun 16 19:51:05 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtld.c,v 1.33 2000/06/03 06:51:57 jdolecek Exp $        */
+/*     $NetBSD: rtld.c,v 1.34 2000/06/16 19:51:05 christos Exp $        */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -278,6 +278,7 @@
        const char    **argv;
        Obj_Entry       *obj;
        const char **real___progname;
+       const Obj_Entry **real___mainprog_obj;
        char ***real_environ;
 #if defined(RTLD_DEBUG) && !defined(RTLD_RELOCATE_SELF)
        int             i = 0;
@@ -460,8 +461,8 @@
                _rtld_die();
 
        /*
-        * Set the __progname and environ before calling
-        * anything that might use them.
+        * Set the __progname,  environ and, __mainprog_obj before
+        * calling anything that might use them.
         */
        real___progname = _rtld_objmain_sym("__progname");
        if (real___progname) {
@@ -473,6 +474,9 @@
        real_environ = _rtld_objmain_sym("environ");
        if (real_environ)
                *real_environ = environ;
+       real___mainprog_obj = _rtld_objmain_sym("__mainprog_obj");
+       if (real___mainprog_obj)
+               *real___mainprog_obj = _rtld_objmain;
 
        dbg(("calling _init functions"));
        _rtld_call_init_functions(_rtld_objmain->next);
@@ -658,7 +662,8 @@
 
        if (obj != NULL) {
                ++obj->dl_refcount;
-               if (mode & RTLD_GLOBAL && _rtld_objlist_find(&_rtld_list_global, obj) == NULL)
+               if ((mode & RTLD_GLOBAL) &&
+                   _rtld_objlist_find(&_rtld_list_global, obj) == NULL)
                        _rtld_objlist_add(&_rtld_list_global, obj);
                if (*old_obj_tail != NULL) {    /* We loaded something new. */
                        assert(*old_obj_tail == obj);



Home | Main Index | Thread Index | Old Index