Source-Changes-HG archive

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

[src/netbsd-1-4]: src/libexec/ld.aout_so Pull up revisions 1.75, 1.78-1.80 (re...



details:   https://anonhg.NetBSD.org/src/rev/416c1a8e3b85
branches:  netbsd-1-4
changeset: 471266:416c1a8e3b85
user:      he <he%NetBSD.org@localhost>
date:      Sun Apr 01 15:48:57 2001 +0000

description:
Pull up revisions 1.75,1.78-1.80 (requested by itohy)
  Several changes to consolidate with main trunk:
   o Use MAP_PRIVATE instead of MAP_COPY.
   o Deal correctly with an empty hints file.
   o Deal correctly with common symbols in shared libraries.
     Fixes PR#10940.

diffstat:

 libexec/ld.aout_so/rtld.c |  26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diffs (90 lines):

diff -r 5a00fd675757 -r 416c1a8e3b85 libexec/ld.aout_so/rtld.c
--- a/libexec/ld.aout_so/rtld.c Sun Apr 01 15:47:54 2001 +0000
+++ b/libexec/ld.aout_so/rtld.c Sun Apr 01 15:48:57 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtld.c,v 1.73.2.2 2000/10/31 12:31:25 he Exp $ */
+/*     $NetBSD: rtld.c,v 1.73.2.3 2001/04/01 15:48:57 he Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -42,9 +42,6 @@
 #include <sys/time.h>
 #include <sys/errno.h>
 #include <sys/mman.h>
-#ifndef MAP_COPY
-#define MAP_COPY       MAP_PRIVATE
-#endif
 #include <err.h>
 #include <dlfcn.h>
 #include <fcntl.h>
@@ -653,6 +650,10 @@
        if (smp)
                name += (long)LM_LDBASE(smp);
 
+#ifdef DEBUG
+       xprintf("map_object: loading %s\n", name);
+#endif
+
        if (sodp->sod_library) {
                usehints = 1;
 again:
@@ -711,7 +712,7 @@
 
        if ((addr = mmap(0, hdr.a_text + hdr.a_data + hdr.a_bss,
                 PROT_READ|PROT_EXEC,
-                MAP_FILE|MAP_COPY, fd, 0)) == (caddr_t)-1) {
+                MAP_FILE|MAP_PRIVATE, fd, 0)) == (caddr_t)-1) {
                (void)close(fd);
                return NULL;
        }
@@ -727,7 +728,7 @@
 
        if (mmap(addr + hdr.a_text + hdr.a_data, hdr.a_bss,
                 PROT_READ|PROT_WRITE|PROT_EXEC,
-                MAP_ANON|MAP_COPY|MAP_FIXED,
+                MAP_ANON|MAP_PRIVATE|MAP_FIXED,
                 anon_fd, 0) == (caddr_t)-1) {
                (void)close(fd);
                return NULL;
@@ -1083,8 +1084,11 @@
        struct rt_symbol        *rtsp;
        struct  nzlist          *weak_np = 0;
 
-       if ((rtsp = lookup_rts(name)) != NULL)
+       if ((rtsp = lookup_rts(name)) != NULL) {
+               /* common symbol is not a member of particular shlib */
+               *src_map = NULL;
                return (rtsp->rt_sp);
+       }
 
        weak_smp = NULL; /* XXX - gcc! */
 
@@ -1211,6 +1215,9 @@
        rtsp = enter_rts(name, (long)calloc(1, common_size),
                                        N_UNDF + N_EXT, 0, common_size, NULL);
 
+       /* common symbol is not a member of particular shlib */
+       *src_map = NULL;
+
 #if DEBUG
 xprintf("Allocating common: %s size %d at %#x\n", name, common_size, rtsp->rt_sp->nz_value);
 #endif
@@ -1408,7 +1415,7 @@
 
        hsize = (hsize + PAGSIZ - 1) & -PAGSIZ;
 
-       addr = mmap(0, hsize, PROT_READ, MAP_FILE|MAP_COPY, hfd, 0);
+       addr = mmap(0, hsize, PROT_READ, MAP_FILE|MAP_PRIVATE, hfd, 0);
        if (addr == (caddr_t)-1)
                goto nohints;
 
@@ -1477,6 +1484,9 @@
 {
        struct hints_bucket     *bp;
 
+       if (hheader->hh_nbucket == 0)
+               return (NULL);
+
        bp = hbuckets + (hinthash(name, major, minor) % hheader->hh_nbucket);
 
        while (1) {



Home | Main Index | Thread Index | Old Index