From bb27fa210f198675dbae425801d0465dba23bacd Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 12 Oct 1998 01:33:35 +0000 Subject: [PATCH] Get shared libraries a lot closer to working. --- gnu/usr.bin/ld/arch/vax/md.c | 25 +++++++------------------ gnu/usr.bin/ld/arch/vax/md.h | 10 ++++++---- libexec/ld.aout_so/arch/vax/md.c | 25 +++++++------------------ libexec/ld.aout_so/arch/vax/md.h | 10 ++++++---- 4 files changed, 26 insertions(+), 44 deletions(-) diff --git a/gnu/usr.bin/ld/arch/vax/md.c b/gnu/usr.bin/ld/arch/vax/md.c index c1b73d704a2a..53bd5c651a54 100644 --- a/gnu/usr.bin/ld/arch/vax/md.c +++ b/gnu/usr.bin/ld/arch/vax/md.c @@ -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; diff --git a/gnu/usr.bin/ld/arch/vax/md.h b/gnu/usr.bin/ld/arch/vax/md.h index 353b652d036b..e8d1cdb13dd4 100644 --- a/gnu/usr.bin/ld/arch/vax/md.h +++ b/gnu/usr.bin/ld/arch/vax/md.h @@ -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?) */ diff --git a/libexec/ld.aout_so/arch/vax/md.c b/libexec/ld.aout_so/arch/vax/md.c index c1b73d704a2a..53bd5c651a54 100644 --- a/libexec/ld.aout_so/arch/vax/md.c +++ b/libexec/ld.aout_so/arch/vax/md.c @@ -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; diff --git a/libexec/ld.aout_so/arch/vax/md.h b/libexec/ld.aout_so/arch/vax/md.h index 353b652d036b..e8d1cdb13dd4 100644 --- a/libexec/ld.aout_so/arch/vax/md.h +++ b/libexec/ld.aout_so/arch/vax/md.h @@ -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?) */