Get shared libraries a lot closer to working.
This commit is contained in:
parent
8bef431273
commit
bb27fa210f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: md.c,v 1.8 1998/09/05 13:08:39 pk Exp $ */
|
||||
/* $NetBSD: md.c,v 1.9 1998/10/12 01:33:35 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -64,6 +64,8 @@ unsigned char *addr;
|
|||
case 1:
|
||||
return get_short(addr);
|
||||
case 2:
|
||||
if (rp->r_baserel)
|
||||
return 0;
|
||||
return get_long(addr);
|
||||
default:
|
||||
errx(1, "Unsupported relocation size: %x",
|
||||
|
@ -81,12 +83,6 @@ long relocation;
|
|||
unsigned char *addr;
|
||||
int relocatable_output;
|
||||
{
|
||||
/*
|
||||
*
|
||||
*/
|
||||
if (rp->r_baserel && rp->r_pcrel && !relocatable_output)
|
||||
relocation += got_symbol->value - (rp->r_address + 4);
|
||||
|
||||
switch (RELOC_TARGET_SIZE(rp)) {
|
||||
case 0:
|
||||
put_byte(addr, relocation);
|
||||
|
@ -95,6 +91,10 @@ int relocatable_output;
|
|||
put_short(addr, relocation);
|
||||
break;
|
||||
case 2:
|
||||
#ifndef RTLD
|
||||
if (rp->r_baserel)
|
||||
relocation += got_symbol->value + get_long(addr);
|
||||
#endif
|
||||
put_long(addr, relocation);
|
||||
break;
|
||||
default:
|
||||
|
@ -222,17 +222,6 @@ struct relocation_info *rp, *r;
|
|||
int type;
|
||||
got_t *gotp;
|
||||
{
|
||||
/*
|
||||
* this is a fixup from text space.
|
||||
* consider that addend is really -pc_offset + addend.
|
||||
* so remove -pc_offset from addend (which is stored in
|
||||
* the got).
|
||||
* movl l^datum+4, r0 --> movl @_datum@GOT, r0
|
||||
* _datum@GOT: .long 4
|
||||
*/
|
||||
if (rp->r_baserel && rp->r_pcrel)
|
||||
*gotp += (rp->r_address + 4);
|
||||
|
||||
r->r_baserel = 1;
|
||||
if (type & RELTYPE_RELATIVE)
|
||||
r->r_relative = 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: md.h,v 1.6 1998/09/05 13:08:39 pk Exp $ */
|
||||
/* $NetBSD: md.h,v 1.7 1998/10/12 01:33:35 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -42,13 +42,13 @@
|
|||
|
||||
#define MAX_ALIGNMENT (sizeof (long))
|
||||
|
||||
#ifdef NetBSD
|
||||
#ifdef __NetBSD__
|
||||
#define PAGSIZ __LDPGSZ
|
||||
#else
|
||||
#define PAGSIZ 1024
|
||||
#endif
|
||||
|
||||
#if defined(NetBSD) || defined(CROSS_LINKER)
|
||||
#if defined(__NetBSD__) || defined(CROSS_LINKER)
|
||||
|
||||
#define N_SET_FLAG(ex,f) (oldmagic || N_GETMAGIC(ex)==QMAGIC ? (0) : \
|
||||
N_SETMAGIC(ex, \
|
||||
|
@ -59,7 +59,8 @@
|
|||
#define N_IS_DYNAMIC(ex) ((N_GETFLAG(ex) & EX_DYNAMIC))
|
||||
|
||||
#define N_BADMID(ex) \
|
||||
(N_GETMID(ex) != 0 && N_GETMID(ex) != MID_MACHINE)
|
||||
(N_GETMID(ex) != 0 && N_GETMID(ex) != MID_MACHINE \
|
||||
&& N_GETMID(ex) != MID_VAX1K)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -113,6 +114,7 @@ typedef struct jmpslot {
|
|||
u_short reloc_index;
|
||||
} jmpslot_t;
|
||||
|
||||
#define JMPSLOT_RELOC_MASK 0xffff
|
||||
/*
|
||||
* following defines are untested since VAX doesn't support PIC (yet?)
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: md.c,v 1.8 1998/09/05 13:08:39 pk Exp $ */
|
||||
/* $NetBSD: md.c,v 1.9 1998/10/12 01:33:35 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -64,6 +64,8 @@ unsigned char *addr;
|
|||
case 1:
|
||||
return get_short(addr);
|
||||
case 2:
|
||||
if (rp->r_baserel)
|
||||
return 0;
|
||||
return get_long(addr);
|
||||
default:
|
||||
errx(1, "Unsupported relocation size: %x",
|
||||
|
@ -81,12 +83,6 @@ long relocation;
|
|||
unsigned char *addr;
|
||||
int relocatable_output;
|
||||
{
|
||||
/*
|
||||
*
|
||||
*/
|
||||
if (rp->r_baserel && rp->r_pcrel && !relocatable_output)
|
||||
relocation += got_symbol->value - (rp->r_address + 4);
|
||||
|
||||
switch (RELOC_TARGET_SIZE(rp)) {
|
||||
case 0:
|
||||
put_byte(addr, relocation);
|
||||
|
@ -95,6 +91,10 @@ int relocatable_output;
|
|||
put_short(addr, relocation);
|
||||
break;
|
||||
case 2:
|
||||
#ifndef RTLD
|
||||
if (rp->r_baserel)
|
||||
relocation += got_symbol->value + get_long(addr);
|
||||
#endif
|
||||
put_long(addr, relocation);
|
||||
break;
|
||||
default:
|
||||
|
@ -222,17 +222,6 @@ struct relocation_info *rp, *r;
|
|||
int type;
|
||||
got_t *gotp;
|
||||
{
|
||||
/*
|
||||
* this is a fixup from text space.
|
||||
* consider that addend is really -pc_offset + addend.
|
||||
* so remove -pc_offset from addend (which is stored in
|
||||
* the got).
|
||||
* movl l^datum+4, r0 --> movl @_datum@GOT, r0
|
||||
* _datum@GOT: .long 4
|
||||
*/
|
||||
if (rp->r_baserel && rp->r_pcrel)
|
||||
*gotp += (rp->r_address + 4);
|
||||
|
||||
r->r_baserel = 1;
|
||||
if (type & RELTYPE_RELATIVE)
|
||||
r->r_relative = 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: md.h,v 1.6 1998/09/05 13:08:39 pk Exp $ */
|
||||
/* $NetBSD: md.h,v 1.7 1998/10/12 01:33:35 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -42,13 +42,13 @@
|
|||
|
||||
#define MAX_ALIGNMENT (sizeof (long))
|
||||
|
||||
#ifdef NetBSD
|
||||
#ifdef __NetBSD__
|
||||
#define PAGSIZ __LDPGSZ
|
||||
#else
|
||||
#define PAGSIZ 1024
|
||||
#endif
|
||||
|
||||
#if defined(NetBSD) || defined(CROSS_LINKER)
|
||||
#if defined(__NetBSD__) || defined(CROSS_LINKER)
|
||||
|
||||
#define N_SET_FLAG(ex,f) (oldmagic || N_GETMAGIC(ex)==QMAGIC ? (0) : \
|
||||
N_SETMAGIC(ex, \
|
||||
|
@ -59,7 +59,8 @@
|
|||
#define N_IS_DYNAMIC(ex) ((N_GETFLAG(ex) & EX_DYNAMIC))
|
||||
|
||||
#define N_BADMID(ex) \
|
||||
(N_GETMID(ex) != 0 && N_GETMID(ex) != MID_MACHINE)
|
||||
(N_GETMID(ex) != 0 && N_GETMID(ex) != MID_MACHINE \
|
||||
&& N_GETMID(ex) != MID_VAX1K)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -113,6 +114,7 @@ typedef struct jmpslot {
|
|||
u_short reloc_index;
|
||||
} jmpslot_t;
|
||||
|
||||
#define JMPSLOT_RELOC_MASK 0xffff
|
||||
/*
|
||||
* following defines are untested since VAX doesn't support PIC (yet?)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue