Add support for the LD_BIND_NOW environment variable. If it is set to a
nonempty string, then function calls are relocated at program start-up rather than lazily. This variable is standard on Sun and SVR4 systems. The dlopen() function now supports both lazy and immediate binding, as determined by its "mode" argument, which can be either 1 (RTLD_LAZY) or 2 (RTLD_NOW). I will add defines of these symbols to <dlfcn.h> as soon as I've done a little more checking to make sure they won't cause collisions or bootstrapping problems that would break "make world".
This commit is contained in:
parent
7db3588660
commit
c8c8bd539d
@ -27,10 +27,11 @@
|
||||
* (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.12 1995/03/04 17:46:20 nate Exp $
|
||||
* $Id: md.c,v 1.13 1996/10/01 01:27:56 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
@ -171,6 +172,23 @@ u_long addr;
|
||||
sp->reloc_index = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Bind a jmpslot to its target address. TARGET is where the jmpslot
|
||||
* should jump to, and WHERE is a pointer to the jmpslot's address field.
|
||||
* This is called by the dynamic linker when LD_BIND_NOW is set in the
|
||||
* environment.
|
||||
*/
|
||||
void
|
||||
md_bind_jmpslot(target, where)
|
||||
u_long target;
|
||||
caddr_t where;
|
||||
{
|
||||
jmpslot_t *sp =
|
||||
(jmpslot_t *) (where - offsetof(jmpslot_t, addr[0]));
|
||||
|
||||
md_fix_jmpslot(sp, (long) sp, target);
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the relocation record for a RRS jmpslot.
|
||||
*/
|
||||
|
@ -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.h,v 1.12 1995/03/04 17:46:21 nate Exp $
|
||||
* $Id: md.h,v 1.13 1996/10/01 01:27:58 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef __MD_H__
|
||||
@ -232,6 +232,7 @@ long md_get_addend __P((struct relocation_info *, unsigned char *));
|
||||
void md_relocate __P((struct relocation_info *, long, unsigned char *, int));
|
||||
void md_make_jmpslot __P((jmpslot_t *, long, long));
|
||||
void md_fix_jmpslot __P((jmpslot_t *, long, u_long));
|
||||
void md_bind_jmpslot __P((u_long, caddr_t));
|
||||
int md_make_reloc __P((struct relocation_info *, struct relocation_info *, int));
|
||||
void md_make_jmpreloc __P((struct relocation_info *, struct relocation_info *, int));
|
||||
void md_make_gotreloc __P((struct relocation_info *, struct relocation_info *, int));
|
||||
|
@ -27,10 +27,11 @@
|
||||
* (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.12 1995/03/04 17:46:20 nate Exp $
|
||||
* $Id: md.c,v 1.13 1996/10/01 01:27:56 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
@ -171,6 +172,23 @@ u_long addr;
|
||||
sp->reloc_index = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Bind a jmpslot to its target address. TARGET is where the jmpslot
|
||||
* should jump to, and WHERE is a pointer to the jmpslot's address field.
|
||||
* This is called by the dynamic linker when LD_BIND_NOW is set in the
|
||||
* environment.
|
||||
*/
|
||||
void
|
||||
md_bind_jmpslot(target, where)
|
||||
u_long target;
|
||||
caddr_t where;
|
||||
{
|
||||
jmpslot_t *sp =
|
||||
(jmpslot_t *) (where - offsetof(jmpslot_t, addr[0]));
|
||||
|
||||
md_fix_jmpslot(sp, (long) sp, target);
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the relocation record for a RRS jmpslot.
|
||||
*/
|
||||
|
@ -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.h,v 1.12 1995/03/04 17:46:21 nate Exp $
|
||||
* $Id: md.h,v 1.13 1996/10/01 01:27:58 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef __MD_H__
|
||||
@ -232,6 +232,7 @@ long md_get_addend __P((struct relocation_info *, unsigned char *));
|
||||
void md_relocate __P((struct relocation_info *, long, unsigned char *, int));
|
||||
void md_make_jmpslot __P((jmpslot_t *, long, long));
|
||||
void md_fix_jmpslot __P((jmpslot_t *, long, u_long));
|
||||
void md_bind_jmpslot __P((u_long, caddr_t));
|
||||
int md_make_reloc __P((struct relocation_info *, struct relocation_info *, int));
|
||||
void md_make_jmpreloc __P((struct relocation_info *, struct relocation_info *, int));
|
||||
void md_make_gotreloc __P((struct relocation_info *, struct relocation_info *, int));
|
||||
|
Loading…
Reference in New Issue
Block a user