summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-aout/Makefile14
-rw-r--r--libexec/rtld-aout/i386/md.c47
-rw-r--r--libexec/rtld-aout/i386/md.h89
-rw-r--r--libexec/rtld-aout/i386/mdprologue.S64
-rw-r--r--libexec/rtld-aout/rtld.c110
-rw-r--r--libexec/rtld-aout/shlib.c4
6 files changed, 132 insertions, 196 deletions
diff --git a/libexec/rtld-aout/Makefile b/libexec/rtld-aout/Makefile
index d8c9165..7c81145 100644
--- a/libexec/rtld-aout/Makefile
+++ b/libexec/rtld-aout/Makefile
@@ -1,10 +1,9 @@
-# $Id: Makefile,v 1.12 1994/08/28 18:48:32 bde Exp $
+# $Id: Makefile,v 1.13 1994/09/18 19:41:38 swallace Exp $
PROG= ld.so
SRCS= mdprologue.S rtld.c malloc.c shlib.c etc.c md.c
NOMAN= noman
LDDIR?= $(.CURDIR)/..
-#PICFLAG=-pic
PICFLAG=-fpic
CFLAGS+=-I$(LDDIR) -I$(.CURDIR) -I$(LDDIR)/$(MACHINE) $(PICFLAG) -DRTLD
LDFLAGS+=-Bshareable -Bsymbolic -assert nosymbolic
@@ -14,18 +13,9 @@ LDADD+= -lc_pic -lgcc_pic
BINDIR= /usr/libexec
INSTALLFLAGS+= -fschg
-.SUFFIXES: .S
-
.PATH: $(LDDIR) $(LDDIR)/$(MACHINE)
$(PROG): ${OBJS} ${DPADD}
- $(LD) -o $(PROG) $(LDFLAGS) $(OBJS) $(LDDESTDIR) $(LDADD)
-
-.S.o:
-.if defined(DESTDIR)
- ${CPP} -I${DESTDIR}/usr/include ${.IMPSRC} | ${AS} ${ASFLAGS} -o ${.TARGET} -
-.else
- ${CPP} ${.IMPSRC} | ${AS} ${ASFLAGS} -o ${.TARGET} -
-.endif
+ $(LD) -o $(PROG) $(LDFLAGS) $(OBJS) $(LDADD)
.include <bsd.prog.mk>
diff --git a/libexec/rtld-aout/i386/md.c b/libexec/rtld-aout/i386/md.c
index 40d9916..07271fc 100644
--- a/libexec/rtld-aout/i386/md.c
+++ b/libexec/rtld-aout/i386/md.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: md.c,v 1.10 1994/06/15 22:40:44 rich Exp $
+ * $Id: md.c,v 1.11 1994/12/23 22:31:12 nate Exp $
*/
#include <sys/param.h>
@@ -58,9 +58,10 @@ unsigned char *addr;
return get_short(addr);
case 2:
return get_long(addr);
+ default:
+ errx(1, "Unsupported relocation size: %x",
+ RELOC_TARGET_SIZE(rp));
}
- errx(1, "Unsupported relocation size: %x", RELOC_TARGET_SIZE(rp));
- return 0;
}
/*
@@ -76,15 +77,17 @@ int relocatable_output;
switch (RELOC_TARGET_SIZE(rp)) {
case 0:
put_byte(addr, relocation);
- return;
+ break;
case 1:
put_short(addr, relocation);
- return;
+ break;
case 2:
put_long(addr, relocation);
- return;
+ break;
+ default:
+ errx(1, "Unsupported relocation size: %x",
+ RELOC_TARGET_SIZE(rp));
}
- errx(1, "Unsupported relocation size: %x", RELOC_TARGET_SIZE(rp));
}
/*
@@ -257,7 +260,7 @@ int magic, flags;
#endif
/* TEXT_START depends on the value of outheader.a_entry. */
- if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
+ if (!(link_mode & SHAREABLE))
hp->a_entry = PAGSIZ;
}
#endif /* RTLD */
@@ -305,15 +308,15 @@ int n;
for (; n; n--, r++) {
r->r_address = md_swap_long(r->r_address);
bits = ((int *)r)[1];
- r->r_symbolnum = md_swap_long(bits & 0xffffff00);
+ r->r_symbolnum = md_swap_long(bits) & 0x00ffffff;
r->r_pcrel = (bits & 1);
- r->r_length = ((bits >> 1) & 3);
- r->r_extern = ((bits >> 3) & 1);
- r->r_baserel = ((bits >> 4) & 1);
- r->r_jmptable = ((bits >> 5) & 1);
- r->r_relative = ((bits >> 6) & 1);
+ r->r_length = (bits >> 1) & 3;
+ r->r_extern = (bits >> 3) & 1;
+ r->r_baserel = (bits >> 4) & 1;
+ r->r_jmptable = (bits >> 5) & 1;
+ r->r_relative = (bits >> 6) & 1;
#ifdef N_SIZE
- r->r_copy = ((bits >> 7) & 1);
+ r->r_copy = (bits >> 7) & 1;
#endif
}
}
@@ -327,15 +330,15 @@ int n;
for (; n; n--, r++) {
r->r_address = md_swap_long(r->r_address);
- bits = (md_swap_long(r->r_symbolnum) & 0xffffff00);
+ bits = md_swap_long(r->r_symbolnum) & 0xffffff00;
bits |= (r->r_pcrel & 1);
- bits |= ((r->r_length << 1) & 6);
- bits |= ((r->r_extern << 3) & 8);
- bits |= ((r->r_baserel << 4) & 0x10);
- bits |= ((r->r_jmptable << 5) & 0x20);
- bits |= ((r->r_relative << 6) & 0x40);
+ bits |= (r->r_length & 3) << 1;
+ bits |= (r->r_extern & 1) << 3;
+ bits |= (r->r_baserel & 1) << 4;
+ bits |= (r->r_jmptable & 1) << 5;
+ bits |= (r->r_relative & 1) << 6;
#ifdef N_SIZE
- bits |= ((r->r_copy << 7) & 0x80);
+ bits |= (r->r_copy & 1) << 7;
#endif
((int *)r)[1] = bits;
}
diff --git a/libexec/rtld-aout/i386/md.h b/libexec/rtld-aout/i386/md.h
index 89c1213..da5283d 100644
--- a/libexec/rtld-aout/i386/md.h
+++ b/libexec/rtld-aout/i386/md.h
@@ -27,14 +27,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: md.h,v 1.10 1994/06/15 22:40:46 rich Exp $
+ * $Id: md.h,v 1.11 1994/12/23 22:31:14 nate Exp $
*/
#if defined(CROSS_LINKER) && defined(XHOST) && XHOST==sparc
-
#define NEED_SWAP
-
#endif
#define MAX_ALIGNMENT (sizeof (long))
@@ -144,6 +142,34 @@ typedef struct jmpslot {
#ifdef CROSS_LINKER
+#define get_byte(p) ( ((unsigned char *)(p))[0] )
+
+#define get_short(p) ( ( ((unsigned char *)(p))[0] << 8) | \
+ ( ((unsigned char *)(p))[1] ) \
+ )
+
+#define get_long(p) ( ( ((unsigned char *)(p))[0] << 24) | \
+ ( ((unsigned char *)(p))[1] << 16) | \
+ ( ((unsigned char *)(p))[2] << 8 ) | \
+ ( ((unsigned char *)(p))[3] ) \
+ )
+
+#define put_byte(p, v) { ((unsigned char *)(p))[0] = ((unsigned long)(v)); }
+
+#define put_short(p, v) { ((unsigned char *)(p))[0] = \
+ ((((unsigned long)(v)) >> 8) & 0xff); \
+ ((unsigned char *)(p))[1] = \
+ ((((unsigned long)(v)) ) & 0xff); }
+
+#define put_long(p, v) { ((unsigned char *)(p))[0] = \
+ ((((unsigned long)(v)) >> 24) & 0xff); \
+ ((unsigned char *)(p))[1] = \
+ ((((unsigned long)(v)) >> 16) & 0xff); \
+ ((unsigned char *)(p))[2] = \
+ ((((unsigned long)(v)) >> 8) & 0xff); \
+ ((unsigned char *)(p))[3] = \
+ ((((unsigned long)(v)) ) & 0xff); }
+
#ifdef NEED_SWAP
/* Define IO byte swapping routines */
@@ -177,67 +203,11 @@ void md_swapout_jmpslot __P((jmpslot_t *, int));
#define md_swap_long(x) ( (((x) >> 24) & 0xff ) | (((x) >> 8 ) & 0xff00 ) | \
(((x) << 8 ) & 0xff0000) | (((x) << 24) & 0xff000000))
-#define get_byte(p) ( ((unsigned char *)(p))[0] )
-
-#define get_short(p) ( ( ((unsigned char *)(p))[1] << 8) | \
- ( ((unsigned char *)(p))[0] ) \
- )
-#define get_long(p) ( ( ((unsigned char *)(p))[3] << 24) | \
- ( ((unsigned char *)(p))[2] << 16) | \
- ( ((unsigned char *)(p))[1] << 8 ) | \
- ( ((unsigned char *)(p))[0] ) \
- )
-
-#define put_byte(p, v) { ((unsigned char *)(p))[0] = ((unsigned long)(v)); }
-
-#define put_short(p, v) { ((unsigned char *)(p))[1] = \
- ((((unsigned long)(v)) >> 8) & 0xff); \
- ((unsigned char *)(p))[0] = \
- ((((unsigned long)(v)) ) & 0xff); }
-
-#define put_long(p, v) { ((unsigned char *)(p))[3] = \
- ((((unsigned long)(v)) >> 24) & 0xff); \
- ((unsigned char *)(p))[2] = \
- ((((unsigned long)(v)) >> 16) & 0xff); \
- ((unsigned char *)(p))[1] = \
- ((((unsigned long)(v)) >> 8) & 0xff); \
- ((unsigned char *)(p))[0] = \
- ((((unsigned long)(v)) ) & 0xff); }
-
#else /* We need not swap, but must pay attention to alignment: */
#define md_swap_short(x) (x)
#define md_swap_long(x) (x)
-#define get_byte(p) ( ((unsigned char *)(p))[0] )
-
-#define get_short(p) ( ( ((unsigned char *)(p))[0] << 8) | \
- ( ((unsigned char *)(p))[1] ) \
- )
-
-#define get_long(p) ( ( ((unsigned char *)(p))[0] << 24) | \
- ( ((unsigned char *)(p))[1] << 16) | \
- ( ((unsigned char *)(p))[2] << 8 ) | \
- ( ((unsigned char *)(p))[3] ) \
- )
-
-
-#define put_byte(p, v) { ((unsigned char *)(p))[0] = ((unsigned long)(v)); }
-
-#define put_short(p, v) { ((unsigned char *)(p))[0] = \
- ((((unsigned long)(v)) >> 8) & 0xff); \
- ((unsigned char *)(p))[1] = \
- ((((unsigned long)(v)) ) & 0xff); }
-
-#define put_long(p, v) { ((unsigned char *)(p))[0] = \
- ((((unsigned long)(v)) >> 24) & 0xff); \
- ((unsigned char *)(p))[1] = \
- ((((unsigned long)(v)) >> 16) & 0xff); \
- ((unsigned char *)(p))[2] = \
- ((((unsigned long)(v)) >> 8) & 0xff); \
- ((unsigned char *)(p))[3] = \
- ((((unsigned long)(v)) ) & 0xff); }
-
#endif /* NEED_SWAP */
#else /* Not a cross linker: use native */
@@ -254,4 +224,3 @@ void md_swapout_jmpslot __P((jmpslot_t *, int));
#define put_long(where,what) (*(long *)(where) = (what))
#endif /* CROSS_LINKER */
-
diff --git a/libexec/rtld-aout/i386/mdprologue.S b/libexec/rtld-aout/i386/mdprologue.S
index 43640c6..1de0f72 100644
--- a/libexec/rtld-aout/i386/mdprologue.S
+++ b/libexec/rtld-aout/i386/mdprologue.S
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: mdprologue.S,v 1.4 1994/06/15 22:40:49 rich Exp $
+ * $Id: mdprologue.S,v 1.7 1994/12/04 07:42:44 mycroft Exp $
*/
/*
@@ -35,7 +35,6 @@
*/
#include <sys/syscall.h>
-#define LCALL(x,y) .byte 0x9a ; .long y; .word x
.text
.globl _binder, _binder_entry
@@ -46,76 +45,49 @@
_rtl: # crt0 calls us here
pushl %ebp # Allocate stack frame
- movl %esp, %ebp
+ movl %esp,%ebp
pushl %ebx
+
call 1f # PIC function prologue
1:
popl %ebx
- addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx
- movl 12(%ebp), %eax # Extract data from interface structure
+ movl 12(%ebp),%eax # Extract data from interface structure
movl (%eax),%eax # base address of ld.so (first field)
# setup arguments for rtld()
- movl (%ebx), %ecx # 1st entry in GOT is our __DYNAMIC
- addl %eax, %ecx # add load address
+ movl (%ebx),%ecx # 1st entry in GOT is our __DYNAMIC
+ addl %eax,%ecx # add load address
pushl %ecx # 3rd arg
pushl 12(%ebp) # 2nd arg == &crt.
pushl 8(%ebp) # 1st arg == version
- addl _rtld@GOT(%ebx), %eax # relocate address of function
+ addl _rtld@GOT(%ebx),%eax # relocate address of function
call %eax # _rtld(version, crtp, DYNAMIC)
addl $12,%esp # pop arguments
- movl -4(%ebp), %ebx # restore %ebx
- leave # remove stack frame,
- ret # let's rock
+ popl %ebx
+ leave # remove stack frame
+ ret
# First call to a procedure generally comes through here for
# binding.
_binder_entry:
pushl %ebp # setup a stack frame
- movl %esp, %ebp
+ movl %esp,%ebp
pusha # save all regs
- movl $0, %eax # clear
- movl 4(%ebp), %esi # return address in PLT
- movw (%esi), %ax # get hold of relocation number
- subl $6, %esi # make it point to the jmpslot
+ xorl %eax,%eax # clear
+ movl 4(%ebp),%esi # return address in PLT
+ movw (%esi),%ax # get hold of relocation number
+ subl $6,%esi # make it point to the jmpslot
pushl %eax # pushd arguments
pushl %esi #
call _binder@PLT # _binder(rpc, index)
- addl $8, %esp # pop arguments
- movl %eax, 4(%ebp) # return value from _binder() == actual
+ addl $8,%esp # pop arguments
+ movl %eax,4(%ebp) # return value from _binder() == actual
# address of function
popa # restore regs
leave # remove our stack frame
ret
-
- # Special system call stubs which return real and effective user and group
- # id's. Saves overhead of making separate calls for each.
- # !! Relies on compatability option in BSD 4.three-and-a-half
-
- .globl _getreuid, _getregid
-_getreuid:
- lea SYS_getuid, %eax
- LCALL(7,0)
- jc out
- movl 4(%esp), %ecx # get 1st arg
- movl %eax, (%ecx) # put value in it
- movl 8(%esp), %ecx # same for 2nd arg
- movl %edx, (%ecx) #
- ret # done
-
-_getregid:
- lea SYS_getgid, %eax
- LCALL(7,0)
- jc out
- movl 4(%esp), %ecx # get 1st arg
- movl %eax, (%ecx) # put value in it
- movl 8(%esp), %ecx # same for 2nd arg
- movl %edx, (%ecx) #
- ret # done
-
-out: jmp cerror@PLT # Call common error routine
-
diff --git a/libexec/rtld-aout/rtld.c b/libexec/rtld-aout/rtld.c
index 6332911..c2e6021 100644
--- a/libexec/rtld-aout/rtld.c
+++ b/libexec/rtld-aout/rtld.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: rtld.c,v 1.20 1995/01/12 19:12:29 joerg Exp $
+ * $Id: rtld.c,v 1.21 1995/02/07 13:33:42 jkh Exp $
*/
#include <sys/param.h>
@@ -38,9 +38,8 @@
#include <sys/resource.h>
#include <sys/errno.h>
#include <sys/mman.h>
-#ifndef BSD
+#ifndef MAP_COPY
#define MAP_COPY MAP_PRIVATE
-#define MAP_ANON 0
#endif
#include <err.h>
#include <fcntl.h>
@@ -58,8 +57,19 @@
#include "ld.h"
-#ifndef BSD /* Need do better than this */
-#define NEED_DEV_ZERO 1
+#ifndef MAP_ANON
+#define MAP_ANON 0
+#define anon_open() do { \
+ if ((anon_fd = open("/dev/zero", O_RDWR, 0)) == -1) \
+ err("open: %s", "/dev/zero"); \
+} while (0)
+#define anon_close() do { \
+ (void)close(anon_fd); \
+ anon_fd = -1; \
+} while (0)
+#else
+#define anon_open()
+#define anon_close()
#endif
/*
@@ -135,6 +145,7 @@ static int careful;
static char __main_progname[] = "main";
static char *main_progname = __main_progname;
static char us[] = "/usr/libexec/ld.so";
+static int anon_fd = -1;
struct so_map *link_map_head, *main_map;
struct so_map **link_map_tail = &link_map_head;
@@ -166,14 +177,15 @@ static void init_map __P((struct so_map *, char *));
static char *rtfindlib __P((char *, int, int, int *));
void binder_entry __P((void));
long binder __P((jmpslot_t *));
-static void maphints __P((void));
-static void unmaphints __P((void));
static struct nzlist *lookup __P((char *, struct so_map **, int));
static inline struct rt_symbol *lookup_rts __P((char *));
static struct rt_symbol *enter_rts __P((char *, long, int, caddr_t,
long, struct so_map *));
static void generror __P((char *, ...));
+static void maphints __P((void));
+static void unmaphints __P((void));
+
static inline int
strcmp (register const char *s1, register const char *s2)
{
@@ -251,6 +263,7 @@ struct _dynamic *dp;
if (getenv("LD_NOSTD_PATH") == NULL)
std_search_path();
+ anon_open();
/* Load required objects into the process address space */
load_objects(crtp, dp);
@@ -301,11 +314,12 @@ struct _dynamic *dp;
ddp->dd_sym_loaded = 1;
}
- /* Forget hints so that hints file can go away if it is unlinked */
+ /* Close the hints file */
unmaphints();
/* Close our file descriptor */
(void)close(crtp->crt_ldfd);
+ anon_close();
return 0;
}
@@ -511,9 +525,9 @@ again:
return NULL;
}
- if ((addr = mmap(0, hdr.a_text + hdr.a_data,
- PROT_READ|PROT_EXEC,
- MAP_COPY, fd, 0)) == (caddr_t)-1) {
+ if ((addr = mmap(0, hdr.a_text + hdr.a_data + hdr.a_bss,
+ PROT_READ|PROT_EXEC,
+ MAP_COPY, fd, 0)) == (caddr_t)-1) {
generror ("mmap failed for \"%s\" : %s",
path, strerror (errno));
(void)close(fd);
@@ -528,29 +542,17 @@ again:
return NULL;
}
- (void)close(fd);
-
- fd = -1;
-#ifdef NEED_DEV_ZERO
- if ((fd = open("/dev/zero", O_RDWR, 0)) == -1) {
- generror ("open failed for \"/dev/zero\" : %s",
- strerror (errno));
- return NULL;
- }
-#endif
- if (hdr.a_bss && mmap(addr + hdr.a_text + hdr.a_data, hdr.a_bss,
- PROT_READ|PROT_WRITE|PROT_EXEC,
- MAP_ANON|MAP_FIXED|MAP_COPY,
- fd, hdr.a_text + hdr.a_data) == (caddr_t)-1) {
+ if (mmap(addr + hdr.a_text + hdr.a_data, hdr.a_bss,
+ PROT_READ|PROT_WRITE|PROT_EXEC,
+ MAP_ANON|MAP_COPY|MAP_FIXED,
+ anon_fd, 0) == (caddr_t)-1) {
generror ("mmap failed for \"%s\" : %s",
path, strerror (errno));
(void)close(fd);
return NULL;
- }
+ }
-#ifdef NEED_DEV_ZERO
- close(fd);
-#endif
+ (void)close(fd);
/* Assume _DYNAMIC is the first data item */
dp = (struct _dynamic *)(addr+hdr.a_text);
@@ -634,7 +636,7 @@ caddr_t addr;
if (getenv("LD_SUPPRESS_WARNINGS") == NULL &&
getenv("LD_WARN_NON_PURE_CODE") != NULL)
- warnx("ld.so: warning: non pure code in %s at %x (%s)\n",
+ warnx("warning: non pure code in %s at %x (%s)",
smp->som_path, r->r_address, sym);
if (smp->som_write == 0 &&
@@ -884,7 +886,7 @@ lookup(name, src_map, strong)
* Search all maps for a definition of NAME
*/
for (smp = link_map_head; smp; smp = smp->som_next) {
- int buckets = LD_BUCKETS(smp->som_dynamic);
+ int buckets;
long hashval;
struct rrs_hash *hp;
char *cp;
@@ -896,10 +898,13 @@ lookup(name, src_map, strong)
char *stringbase;
int symsize;
- if (LM_PRIVATE(smp)->spd_flags & RTLD_RTLD)
+ if (*src_map && smp != *src_map)
continue;
- if (*src_map && smp != *src_map)
+ if ((buckets = LD_BUCKETS(smp->som_dynamic)) == 0)
+ continue;
+
+ if (LM_PRIVATE(smp)->spd_flags & RTLD_RTLD)
continue;
restart:
@@ -1042,8 +1047,9 @@ binder(jsp)
}
+static int hfd;
+static long hsize;
static struct hints_header *hheader;
-static long hmsize;
static struct hints_bucket *hbuckets;
static char *hstrtab;
@@ -1053,52 +1059,47 @@ static char *hstrtab;
maphints __P((void))
{
caddr_t addr;
- long msize;
- int fd;
- if ((fd = open(_PATH_LD_HINTS, O_RDONLY, 0)) == -1) {
+ if ((hfd = open(_PATH_LD_HINTS, O_RDONLY, 0)) == -1) {
hheader = (struct hints_header *)-1;
return;
}
- msize = PAGSIZ;
- addr = mmap(0, msize, PROT_READ, MAP_COPY, fd, 0);
+ hsize = PAGSIZ;
+ addr = mmap(0, hsize, PROT_READ, MAP_COPY, hfd, 0);
if (addr == (caddr_t)-1) {
- close(fd);
+ close(hfd);
hheader = (struct hints_header *)-1;
return;
}
hheader = (struct hints_header *)addr;
if (HH_BADMAG(*hheader)) {
- munmap(addr, msize);
- close(fd);
+ munmap(addr, hsize);
+ close(hfd);
hheader = (struct hints_header *)-1;
return;
}
if (hheader->hh_version != LD_HINTS_VERSION_1) {
- munmap(addr, msize);
- close(fd);
+ munmap(addr, hsize);
+ close(hfd);
hheader = (struct hints_header *)-1;
return;
}
- hmsize = msize;
- if (hheader->hh_ehints > msize) {
- hmsize = hheader->hh_ehints;
- if (mmap(addr+msize, hheader->hh_ehints - msize,
+ if (hheader->hh_ehints > hsize) {
+ if (mmap(addr+hsize, hheader->hh_ehints - hsize,
PROT_READ, MAP_COPY|MAP_FIXED,
- fd, msize) != (caddr_t)(addr+msize)) {
+ hfd, hsize) != (caddr_t)(addr+hsize)) {
- munmap((caddr_t)hheader, msize);
- close(fd);
+ munmap((caddr_t)hheader, hsize);
+ close(hfd);
hheader = (struct hints_header *)-1;
return;
}
}
- close(fd);
hbuckets = (struct hints_bucket *)(addr + hheader->hh_hashtab);
hstrtab = (char *)(addr + hheader->hh_strtab);
@@ -1107,8 +1108,10 @@ maphints __P((void))
static void
unmaphints()
{
+
if (HINTS_VALID) {
- munmap((caddr_t)hheader, hmsize);
+ munmap((caddr_t)hheader, hsize);
+ close(hfd);
hheader = NULL;
}
}
@@ -1404,4 +1407,3 @@ char *fmt;
(void)write(1, buf, strlen(buf));
va_end(ap);
}
-
diff --git a/libexec/rtld-aout/shlib.c b/libexec/rtld-aout/shlib.c
index 058689a..38cb2d1 100644
--- a/libexec/rtld-aout/shlib.c
+++ b/libexec/rtld-aout/shlib.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: shlib.c,v 1.10 1994/12/23 22:30:51 nate Exp $
+ * $Id: shlib.c,v 1.11 1995/01/05 02:36:29 swallace Exp $
*/
#include <sys/param.h>
@@ -54,7 +54,7 @@ char *strsep();
* Standard directories to search for files specified by -l.
*/
#ifndef STANDARD_SEARCH_DIRS
-#define STANDARD_SEARCH_DIRS "/usr/lib", "/usr/X11R6/lib", "/usr/local/lib"
+#define STANDARD_SEARCH_DIRS "/usr/lib", "/usr/local/lib"
#endif
/*
OpenPOWER on IntegriCloud