diff options
-rw-r--r-- | gnu/usr.bin/ld/i386/md-static-funcs.c | 7 | ||||
-rw-r--r-- | gnu/usr.bin/ld/i386/md.c | 20 | ||||
-rw-r--r-- | gnu/usr.bin/ld/i386/md.h | 18 | ||||
-rw-r--r-- | gnu/usr.bin/ld/sparc/md.c | 4 | ||||
-rw-r--r-- | gnu/usr.bin/ld/sparc/md.h | 12 | ||||
-rw-r--r-- | libexec/rtld-aout/i386/md-static-funcs.c | 7 | ||||
-rw-r--r-- | libexec/rtld-aout/i386/md.c | 20 | ||||
-rw-r--r-- | libexec/rtld-aout/i386/md.h | 18 |
8 files changed, 81 insertions, 25 deletions
diff --git a/gnu/usr.bin/ld/i386/md-static-funcs.c b/gnu/usr.bin/ld/i386/md-static-funcs.c index 64491e3..8a672ed 100644 --- a/gnu/usr.bin/ld/i386/md-static-funcs.c +++ b/gnu/usr.bin/ld/i386/md-static-funcs.c @@ -1,16 +1,17 @@ /* - * $Id: md-static-funcs.c,v 1.2 1994/02/13 20:42:06 jkh Exp $ + * $Id: md-static-funcs.c,v 1.3 1995/11/02 18:47:55 nate Exp $ * * Called by ld.so when onanating. * This *must* be a static function, so it is not called through a jmpslot. */ -static inline void +static void md_relocate_simple(r, relocation, addr) struct relocation_info *r; long relocation; char *addr; { - *(long *)addr += relocation; + if (r->r_relative) + *(long *)addr += relocation; } diff --git a/gnu/usr.bin/ld/i386/md.c b/gnu/usr.bin/ld/i386/md.c index 07271fc..546bd8e 100644 --- a/gnu/usr.bin/ld/i386/md.c +++ b/gnu/usr.bin/ld/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.11 1994/12/23 22:31:12 nate Exp $ + * $Id: md.c,v 1.12 1995/03/04 17:46:20 nate Exp $ */ #include <sys/param.h> @@ -40,7 +40,13 @@ #include <stab.h> #include <string.h> -#include "ld.h" +#include "dynamic.h" + +#if defined(RTLD) && defined(SUN_COMPAT) +#define REL_SIZE(r) (2) /* !!!!! Sun BUG compatible */ +#else +#define REL_SIZE(r) ((r)->r_length) +#endif /* * Get relocation addend corresponding to relocation record RP @@ -51,7 +57,7 @@ md_get_addend(rp, addr) struct relocation_info *rp; unsigned char *addr; { - switch (RELOC_TARGET_SIZE(rp)) { + switch (REL_SIZE(rp)) { case 0: return get_byte(addr); case 1: @@ -60,7 +66,7 @@ unsigned char *addr; return get_long(addr); default: errx(1, "Unsupported relocation size: %x", - RELOC_TARGET_SIZE(rp)); + REL_SIZE(rp)); } } @@ -74,7 +80,7 @@ long relocation; unsigned char *addr; int relocatable_output; { - switch (RELOC_TARGET_SIZE(rp)) { + switch (REL_SIZE(rp)) { case 0: put_byte(addr, relocation); break; @@ -86,7 +92,7 @@ int relocatable_output; break; default: errx(1, "Unsupported relocation size: %x", - RELOC_TARGET_SIZE(rp)); + REL_SIZE(rp)); } } @@ -102,7 +108,7 @@ int type; /* Relocation size */ r->r_length = rp->r_length; - if (RELOC_PCREL_P(rp)) + if (rp->r_pcrel) r->r_pcrel = 1; if (type & RELTYPE_RELATIVE) diff --git a/gnu/usr.bin/ld/i386/md.h b/gnu/usr.bin/ld/i386/md.h index da5283d..f7ad9d4 100644 --- a/gnu/usr.bin/ld/i386/md.h +++ b/gnu/usr.bin/ld/i386/md.h @@ -27,9 +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.h,v 1.11 1994/12/23 22:31:14 nate Exp $ + * $Id: md.h,v 1.12 1995/03/04 17:46:21 nate Exp $ */ +#ifndef __MD_H__ +#define __MD_H__ #if defined(CROSS_LINKER) && defined(XHOST) && XHOST==sparc #define NEED_SWAP @@ -224,3 +226,17 @@ void md_swapout_jmpslot __P((jmpslot_t *, int)); #define put_long(where,what) (*(long *)(where) = (what)) #endif /* CROSS_LINKER */ + +void md_init_header __P((struct exec *, int, int)); +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)); +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)); +void md_make_copyreloc __P((struct relocation_info *, struct relocation_info *)); +void md_set_breakpoint __P((long, long *)); + + +#endif /* __MD_H__ */ diff --git a/gnu/usr.bin/ld/sparc/md.c b/gnu/usr.bin/ld/sparc/md.c index 508d37d..68831a6 100644 --- a/gnu/usr.bin/ld/sparc/md.c +++ b/gnu/usr.bin/ld/sparc/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.7 1994/02/13 20:43:03 jkh Exp $ + * $Id: md.c,v 1.8 1994/06/15 22:41:19 rich Exp $ */ #include <sys/param.h> @@ -40,7 +40,7 @@ #include <stab.h> #include <string.h> -#include "ld.h" +#include "dynamic.h" /* * Relocation masks and sizes for the Sparc architecture. diff --git a/gnu/usr.bin/ld/sparc/md.h b/gnu/usr.bin/ld/sparc/md.h index f83c1ff..421cbd6 100644 --- a/gnu/usr.bin/ld/sparc/md.h +++ b/gnu/usr.bin/ld/sparc/md.h @@ -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.6 1994/02/13 20:43:07 jkh Exp $ + * $Id: md.h,v 1.7 1995/03/04 17:46:25 nate Exp $ */ /* @@ -290,3 +290,13 @@ void md_swapout_jmpslot __P((jmpslot_t *, int)); #endif /* CROSS_LINKER */ +void md_init_header __P((struct exec *, int, int)); +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)); +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)); +void md_make_copyreloc __P((struct relocation_info *, struct relocation_info *)); +void md_set_breakpoint __P((long, long *)); diff --git a/libexec/rtld-aout/i386/md-static-funcs.c b/libexec/rtld-aout/i386/md-static-funcs.c index 64491e3..8a672ed 100644 --- a/libexec/rtld-aout/i386/md-static-funcs.c +++ b/libexec/rtld-aout/i386/md-static-funcs.c @@ -1,16 +1,17 @@ /* - * $Id: md-static-funcs.c,v 1.2 1994/02/13 20:42:06 jkh Exp $ + * $Id: md-static-funcs.c,v 1.3 1995/11/02 18:47:55 nate Exp $ * * Called by ld.so when onanating. * This *must* be a static function, so it is not called through a jmpslot. */ -static inline void +static void md_relocate_simple(r, relocation, addr) struct relocation_info *r; long relocation; char *addr; { - *(long *)addr += relocation; + if (r->r_relative) + *(long *)addr += relocation; } diff --git a/libexec/rtld-aout/i386/md.c b/libexec/rtld-aout/i386/md.c index 07271fc..546bd8e 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.11 1994/12/23 22:31:12 nate Exp $ + * $Id: md.c,v 1.12 1995/03/04 17:46:20 nate Exp $ */ #include <sys/param.h> @@ -40,7 +40,13 @@ #include <stab.h> #include <string.h> -#include "ld.h" +#include "dynamic.h" + +#if defined(RTLD) && defined(SUN_COMPAT) +#define REL_SIZE(r) (2) /* !!!!! Sun BUG compatible */ +#else +#define REL_SIZE(r) ((r)->r_length) +#endif /* * Get relocation addend corresponding to relocation record RP @@ -51,7 +57,7 @@ md_get_addend(rp, addr) struct relocation_info *rp; unsigned char *addr; { - switch (RELOC_TARGET_SIZE(rp)) { + switch (REL_SIZE(rp)) { case 0: return get_byte(addr); case 1: @@ -60,7 +66,7 @@ unsigned char *addr; return get_long(addr); default: errx(1, "Unsupported relocation size: %x", - RELOC_TARGET_SIZE(rp)); + REL_SIZE(rp)); } } @@ -74,7 +80,7 @@ long relocation; unsigned char *addr; int relocatable_output; { - switch (RELOC_TARGET_SIZE(rp)) { + switch (REL_SIZE(rp)) { case 0: put_byte(addr, relocation); break; @@ -86,7 +92,7 @@ int relocatable_output; break; default: errx(1, "Unsupported relocation size: %x", - RELOC_TARGET_SIZE(rp)); + REL_SIZE(rp)); } } @@ -102,7 +108,7 @@ int type; /* Relocation size */ r->r_length = rp->r_length; - if (RELOC_PCREL_P(rp)) + if (rp->r_pcrel) r->r_pcrel = 1; if (type & RELTYPE_RELATIVE) diff --git a/libexec/rtld-aout/i386/md.h b/libexec/rtld-aout/i386/md.h index da5283d..f7ad9d4 100644 --- a/libexec/rtld-aout/i386/md.h +++ b/libexec/rtld-aout/i386/md.h @@ -27,9 +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.h,v 1.11 1994/12/23 22:31:14 nate Exp $ + * $Id: md.h,v 1.12 1995/03/04 17:46:21 nate Exp $ */ +#ifndef __MD_H__ +#define __MD_H__ #if defined(CROSS_LINKER) && defined(XHOST) && XHOST==sparc #define NEED_SWAP @@ -224,3 +226,17 @@ void md_swapout_jmpslot __P((jmpslot_t *, int)); #define put_long(where,what) (*(long *)(where) = (what)) #endif /* CROSS_LINKER */ + +void md_init_header __P((struct exec *, int, int)); +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)); +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)); +void md_make_copyreloc __P((struct relocation_info *, struct relocation_info *)); +void md_set_breakpoint __P((long, long *)); + + +#endif /* __MD_H__ */ |