summaryrefslogtreecommitdiff
path: root/libexec/ld.so/sparc64
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2002-07-12 20:18:31 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2002-07-12 20:18:31 +0000
commit80402e9cf360236b13306bcaf6d797f76f687dba (patch)
treecd26d9d127539c446450d138a3b7dafe8da253f5 /libexec/ld.so/sparc64
parent5865d6a998391648e294e7a7d4670166fb810364 (diff)
Change ld.so search order/method to match the a.out ld.so.
run destructors on dlclose() Move more symbols into _dl_ private space, so that the proper (libc) version of the function will be used. Add readdir() functionality to perform the proper library searching. Support DL_PRELOAD Do not relocate symbols if ld.so is being traced (and will exit). Misc lint cleanup. ok art@
Diffstat (limited to 'libexec/ld.so/sparc64')
-rw-r--r--libexec/ld.so/sparc64/archdep.h4
-rw-r--r--libexec/ld.so/sparc64/ldasm.S62
-rw-r--r--libexec/ld.so/sparc64/rtld_machine.c4
-rw-r--r--libexec/ld.so/sparc64/syscall.h19
4 files changed, 66 insertions, 23 deletions
diff --git a/libexec/ld.so/sparc64/archdep.h b/libexec/ld.so/sparc64/archdep.h
index 6ced3ab80b3..756e7f07f56 100644
--- a/libexec/ld.so/sparc64/archdep.h
+++ b/libexec/ld.so/sparc64/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.8 2002/05/24 03:44:38 deraadt Exp $ */
+/* $OpenBSD: archdep.h,v 1.9 2002/07/12 20:18:30 drahn Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -53,7 +53,7 @@ static inline long
_dl_mmap(void *addr, unsigned int len, unsigned int prot,
unsigned int flags, int fd, off_t offset)
{
- return(_dl___syscall((quad_t)SYS_mmap, addr, len, prot,
+ return(_dl__syscall((quad_t)SYS_mmap, addr, len, prot,
flags, fd, 0, offset));
}
diff --git a/libexec/ld.so/sparc64/ldasm.S b/libexec/ld.so/sparc64/ldasm.S
index bcff6965088..eda57732c0e 100644
--- a/libexec/ld.so/sparc64/ldasm.S
+++ b/libexec/ld.so/sparc64/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.11 2002/05/24 04:17:01 deraadt Exp $ */
+/* $OpenBSD: ldasm.S,v 1.12 2002/07/12 20:18:30 drahn Exp $ */
/* $NetBSD: rtld_start.S,v 1.5 2001/08/14 22:17:48 eeh Exp $ */
/*
@@ -219,7 +219,7 @@ _dl_bind_start_1: # (x, y)
.type _dl_close,@function
_dl_close:
mov SYS_close | SYSCALL_G2RFLAG, %g1 ! call sys_close
- add %o7, 8, %g2 ! just return on sucess
+ add %o7, 8, %g2 ! just return on success
t ST_SYSCALL ! off to wonderland
retl
sub %g0, %o0, %o0 ! error: result = -errno
@@ -231,7 +231,7 @@ _dl_close:
.type _dl_exit,@function
_dl_exit:
mov SYS_exit | SYSCALL_G2RFLAG, %g1 ! call sys_exit
- add %o7, 8, %g2 ! just return on sucess
+ add %o7, 8, %g2 ! just return on success
t ST_SYSCALL ! off to wonderland
retl
sub %g0, %o0, %o0 ! error: result = -errno
@@ -251,11 +251,11 @@ _dl_issetugid:
.section ".text"
.align 4
- .global _dl___syscall
- .type _dl___syscall,@function
-_dl___syscall:
+ .global _dl__syscall
+ .type _dl__syscall,@function
+_dl__syscall:
mov SYS___syscall | SYSCALL_G2RFLAG, %g1 ! call sys_exit
- add %o7, 8, %g2 ! just return on sucess
+ add %o7, 8, %g2 ! just return on success
t ST_SYSCALL ! off to wonderland
retl
sub %g0, %o0, %o0 ! error: result = -errno
@@ -267,7 +267,7 @@ _dl___syscall:
.type _dl_munmap,@function
_dl_munmap:
mov SYS_munmap | SYSCALL_G2RFLAG, %g1 ! calling sys_mmap
- add %o7, 8, %g2 ! just return on sucess
+ add %o7, 8, %g2 ! just return on success
t ST_SYSCALL ! off to wonderland
retl
sub %g0, %o0, %o0 ! error: result = -errno
@@ -279,7 +279,7 @@ _dl_munmap:
.type _dl_mprotect,@function
_dl_mprotect:
mov SYS_mprotect | SYSCALL_G2RFLAG, %g1 ! calling sys_mprotect
- add %o7, 8, %g2 ! just return on sucess
+ add %o7, 8, %g2 ! just return on success
t ST_SYSCALL ! off to wonderland
retl
sub %g0, %o0, %o0 ! error: result = -errno
@@ -291,7 +291,7 @@ _dl_mprotect:
.type _dl_open,@function
_dl_open:
mov SYS_open | SYSCALL_G2RFLAG, %g1 ! calling sys_open
- add %o7, 8, %g2 ! just return on sucess
+ add %o7, 8, %g2 ! just return on success
t ST_SYSCALL ! off to wonderland
retl
sub %g0, %o0, %o0 ! error: result = -errno
@@ -303,7 +303,7 @@ _dl_open:
.type _dl_read,@function
_dl_read:
mov SYS_read | SYSCALL_G2RFLAG, %g1 ! calling sys_read
- add %o7, 8, %g2 ! just return on sucess
+ add %o7, 8, %g2 ! just return on success
t ST_SYSCALL ! off to wonderland
retl
sub %g0, %o0, %o0 ! error: result = -errno
@@ -315,7 +315,7 @@ _dl_read:
.type _dl_write,@function
_dl_write:
mov SYS_write | SYSCALL_G2RFLAG, %g1 ! calling sys_write
- add %o7, 8, %g2 ! just return on sucess
+ add %o7, 8, %g2 ! just return on success
t ST_SYSCALL ! off to wonderland
retl
sub %g0, %o0, %o0 ! error: result = -errno
@@ -327,7 +327,43 @@ _dl_write:
.type _dl_stat,@function
_dl_stat:
mov SYS_stat | SYSCALL_G2RFLAG, %g1 ! call sys_stat
- add %o7, 8, %g2 ! just return on sucess
+ add %o7, 8, %g2 ! just return on success
t ST_SYSCALL ! off to wonderland
retl
sub %g0, %o0, %o0 ! error: result = -errno
+
+
+ .section ".text"
+ .align 4
+ .globl _dl_fstat
+ .type _dl_fstat,@function
+_dl_fstat:
+ mov SYS_fstat | SYSCALL_G2RFLAG, %g1 ! call sys_fstat
+ add %o7, 8, %g2 ! just return on success
+ t ST_SYSCALL ! off to wonderland
+ retl
+ sub %g0, %o0, %o0 ! error: result = -errno
+
+
+ .section ".text"
+ .align 4
+ .globl _dl_fcntl
+ .type _dl_fcntl,@function
+_dl_fcntl:
+ mov SYS_fcntl | SYSCALL_G2RFLAG, %g1 ! call sys_fstat
+ add %o7, 8, %g2 ! just return on success
+ t ST_SYSCALL ! off to wonderland
+ retl
+ sub %g0, %o0, %o0 ! error: result = -errno
+
+
+ .section ".text"
+ .align 4
+ .globl _dl_getdirentries
+ .type _dl_getdirentries,@function
+_dl_getdirentries:
+ mov SYS_getdirentries | SYSCALL_G2RFLAG, %g1 ! call sys_fstat
+ add %o7, 8, %g2 ! just return on success
+ t ST_SYSCALL ! off to wonderland
+ retl
+ sub %g0, %o0, %o0 ! error: result = -errno
diff --git a/libexec/ld.so/sparc64/rtld_machine.c b/libexec/ld.so/sparc64/rtld_machine.c
index 7122082b885..bfc20126dc4 100644
--- a/libexec/ld.so/sparc64/rtld_machine.c
+++ b/libexec/ld.so/sparc64/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.16 2002/06/05 23:13:55 art Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.17 2002/07/12 20:18:30 drahn Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -264,6 +264,8 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
else
value = 0;
+ sym = NULL;
+ symn = NULL;
if (RELOC_RESOLVE_SYMBOL(type)) {
sym = object->dyn.symtab;
sym += ELF_R_SYM(relas->r_info);
diff --git a/libexec/ld.so/sparc64/syscall.h b/libexec/ld.so/sparc64/syscall.h
index 9cc0b69ba14..045b15e1bcc 100644
--- a/libexec/ld.so/sparc64/syscall.h
+++ b/libexec/ld.so/sparc64/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.5 2002/03/17 00:22:04 art Exp $ */
+/* $OpenBSD: syscall.h,v 1.6 2002/07/12 20:18:30 drahn Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -35,9 +35,8 @@
#ifndef __DL_SYSCALL_H__
#define __DL_SYSCALL_H__
-#ifdef USE_CACHE
+#include <sys/syscall.h>
#include <sys/stat.h>
-#endif
#ifndef _dl_MAX_ERRNO
#define _dl_MAX_ERRNO 4096
@@ -48,15 +47,21 @@
int _dl_close(int);
int _dl_exit(int);
int _dl_issetugid(void);
-long _dl___syscall(quad_t, ...);
+long _dl__syscall(quad_t, ...);
int _dl_mprotect(const void *, int, int);
int _dl_munmap(const void*, unsigned int);
int _dl_open(const char*, unsigned int);
int _dl_read(int, const char*, int);
-#ifdef USE_CACHE
int _dl_stat(const char *, struct stat *);
-#endif
int _dl_write(int, const char*, int);
+int _dl_fstat(int, struct stat *);
+int _dl_fcntl(int, int, ...);
+int _dl_getdirentries(int, char*, int, long *);
+
+static inline off_t
+_dl_lseek(int fildes, off_t offset, int whence)
+{
+ return _dl__syscall((quad_t)SYS_lseek, fildes, 0, offset, whence);
+}
-#include <elf_abi.h>
#endif /*__DL_SYSCALL_H__*/