diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1998-05-11 20:27:20 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1998-05-11 20:27:20 +0000 |
commit | 33b4bcab9ca33db37b69162dc965c9ac04921b93 (patch) | |
tree | b73a13654c97c581bf68daa700c231c5000f2114 /gnu | |
parent | 2dfd9372f29bb26e55b482d80e77f7189450c11c (diff) |
Make usable as a cross-linker
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/ld/Makefile | 17 | ||||
-rw-r--r-- | gnu/usr.bin/ld/rrs.c | 3 | ||||
-rw-r--r-- | gnu/usr.bin/ld/shlib.c | 1 | ||||
-rw-r--r-- | gnu/usr.bin/ld/vax/md.c | 9 | ||||
-rw-r--r-- | gnu/usr.bin/ld/vax/md.h | 15 |
5 files changed, 30 insertions, 15 deletions
diff --git a/gnu/usr.bin/ld/Makefile b/gnu/usr.bin/ld/Makefile index ad9d90104bf..c9364b5c2c3 100644 --- a/gnu/usr.bin/ld/Makefile +++ b/gnu/usr.bin/ld/Makefile @@ -1,15 +1,24 @@ -# $OpenBSD: Makefile,v 1.2 1996/08/20 05:14:10 tholo Exp $ +# $OpenBSD: Makefile,v 1.3 1998/05/11 20:27:13 niklas Exp $ # $NetBSD: Makefile,v 1.13 1995/04/23 07:58:46 cgd Exp $ +TARGET_MACHINE_ARCH?= $(MACHINE_ARCH) + PROG= ld SRCS= ld.c symbol.c lib.c shlib.c warnings.c etc.c rrs.c xbits.c md.c -CFLAGS += -g -I$(.CURDIR) -I$(.CURDIR)/$(MACHINE_ARCH) +CFLAGS+=-g +CPPFLAGS+= -I$(.CURDIR) -I$(.CURDIR)/$(TARGET_MACHINE_ARCH) +.if ($(TARGET_MACHINE_ARCH) != $(MACHINE_ARCH)) +CPPFLAGS+= -DCROSS_LINKER -DXHOST=$(MACHINE_ARCH) \ + -I${.CURDIR}/../../../sys/arch/${TARGET_MACHINE_ARCH}/include \ + -I${.CURDIR}/../../../include -I${.CURDIR}/../../.. +.else SUBDIR= ldconfig ldd +.endif -.PATH: $(.CURDIR)/$(MACHINE_ARCH) +.PATH: $(.CURDIR)/$(TARGET_MACHINE_ARCH) .include <bsd.prog.mk> -.if !defined(NOPIC) +.if !defined(NOPIC) && ($(TARGET_MACHINE_ARCH) == $(MACHINE_ARCH)) SUBDIR+= rtld .endif diff --git a/gnu/usr.bin/ld/rrs.c b/gnu/usr.bin/ld/rrs.c index dd5a8120ffc..1375c499dc5 100644 --- a/gnu/usr.bin/ld/rrs.c +++ b/gnu/usr.bin/ld/rrs.c @@ -1,4 +1,4 @@ -/* * $OpenBSD: rrs.c,v 1.2 1998/03/26 19:46:23 niklas Exp $*/ +/* * $OpenBSD: rrs.c,v 1.3 1998/05/11 20:27:14 niklas Exp $*/ /* * Copyright (c) 1993 Paul Kranenburg * All rights reserved. @@ -42,6 +42,7 @@ #include <unistd.h> #include <err.h> #include <fcntl.h> +#include <ranlib.h> #include <a.out.h> #include <stab.h> #include <string.h> diff --git a/gnu/usr.bin/ld/shlib.c b/gnu/usr.bin/ld/shlib.c index c6057bb4611..f5e7f148c03 100644 --- a/gnu/usr.bin/ld/shlib.c +++ b/gnu/usr.bin/ld/shlib.c @@ -41,6 +41,7 @@ int isdigit(); #include <sys/stat.h> #include <sys/file.h> #include <sys/time.h> +#include <ranlib.h> #include <a.out.h> #include <ctype.h> #include <dirent.h> diff --git a/gnu/usr.bin/ld/vax/md.c b/gnu/usr.bin/ld/vax/md.c index a5e5b461186..31c625078b7 100644 --- a/gnu/usr.bin/ld/vax/md.c +++ b/gnu/usr.bin/ld/vax/md.c @@ -1,4 +1,4 @@ -/* $OpenBSD: md.c,v 1.2 1996/09/30 22:29:32 deraadt Exp $ */ +/* $OpenBSD: md.c,v 1.3 1998/05/11 20:27:17 niklas Exp $ */ /* $NetBSD: md.c,v 1.1 1995/10/19 13:10:19 ragge Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg @@ -37,6 +37,7 @@ #include <sys/types.h> #include <err.h> #include <fcntl.h> +#include <ranlib.h> #include <a.out.h> #include <stab.h> #include <string.h> @@ -249,15 +250,15 @@ int magic, flags; if (oldmagic || magic == QMAGIC) hp->a_midmag = magic; else - N_SETMAGIC((*hp), magic, MID_I386, flags); + N_SETMAGIC((*hp), magic, MID_VAX, flags); #endif #ifdef FreeBSD if (oldmagic) hp->a_midmag = magic; else if (netzmagic) - N_SETMAGIC_NET((*hp), magic, MID_I386, flags); + N_SETMAGIC_NET((*hp), magic, MID_VAX, flags); else - N_SETMAGIC((*hp), magic, MID_I386, flags); + N_SETMAGIC((*hp), magic, MID_VAX, flags); #endif /* TEXT_START depends on the value of outheader.a_entry. */ diff --git a/gnu/usr.bin/ld/vax/md.h b/gnu/usr.bin/ld/vax/md.h index 65bf5112a45..8328f9182d9 100644 --- a/gnu/usr.bin/ld/vax/md.h +++ b/gnu/usr.bin/ld/vax/md.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md.h,v 1.2 1996/09/30 22:29:32 deraadt Exp $ */ +/* $OpenBSD: md.h,v 1.3 1998/05/11 20:27:19 niklas Exp $ */ /* $NetBSD: md.h,v 1.1 1995/10/19 13:10:20 ragge Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg @@ -36,7 +36,10 @@ #define NEED_SWAP #endif -#define MAX_ALIGNMENT (sizeof (long)) +#undef __LDPGSZ +#include <sys/arch/vax/include/exec.h> + +#define MAX_ALIGNMENT 4 /* (sizeof (long)) */ #if defined(__NetBSD__) || defined(__OpenBSD__) #define PAGSIZ __LDPGSZ @@ -49,13 +52,13 @@ #define N_SET_FLAG(ex,f) (oldmagic || N_GETMAGIC(ex)==QMAGIC ? (0) : \ N_SETMAGIC(ex, \ N_GETMAGIC(ex), \ - MID_MACHINE, \ + MID_VAX, \ N_GETFLAG(ex)|(f))) #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_VAX) #endif @@ -67,11 +70,11 @@ (netzmagic == 0 ? \ N_SETMAGIC(ex, \ N_GETMAGIC(ex), \ - MID_MACHINE, \ + MID_VAX, \ N_GETFLAG(ex)|(f)) : \ N_SETMAGIC_NET(ex, \ N_GETMAGIC_NET(ex), \ - MID_MACHINE, \ + MID_VAX, \ N_GETFLAG_NET(ex)|(f)) )) #define N_IS_DYNAMIC(ex) ((N_GETMAGIC_NET(ex) == ZMAGIC) ? \ |