summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2000-02-01 21:01:44 +0000
committerMarc Espie <espie@cvs.openbsd.org>2000-02-01 21:01:44 +0000
commit29fc868374b92736d485bb9afaf69c50b0dba453 (patch)
treecb07299db072e92df8d3f7038c3cb8198c349fc9 /gnu/usr.bin
parent77d19cbb15e2e5e01ab46a978f3a3fc67581bff0 (diff)
Cross-tools fixes:
* Rely on BYTE_ORDER instead of specific values of XHOST to determine cross-endianness, * Link necessary cross-includes to the right location, * Add some necessary stubs for cross-endian sparc and cross-endian m68k. This does let i386->m68k work, and probably brings i386->sparc most of the way there... Approved by mickey@, niklas@ is to busy to answer email as usual...
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/ld/Makefile10
-rw-r--r--gnu/usr.bin/ld/arm32/md.h9
-rw-r--r--gnu/usr.bin/ld/i386/md.h8
-rw-r--r--gnu/usr.bin/ld/m68k/md.c13
-rw-r--r--gnu/usr.bin/ld/m68k/md.h21
-rw-r--r--gnu/usr.bin/ld/m88k/md.h8
-rw-r--r--gnu/usr.bin/ld/ns32k/md.h9
-rw-r--r--gnu/usr.bin/ld/sparc/md.h16
-rw-r--r--gnu/usr.bin/ld/vax/md.h8
9 files changed, 76 insertions, 26 deletions
diff --git a/gnu/usr.bin/ld/Makefile b/gnu/usr.bin/ld/Makefile
index f72e628f301..adb1d7f8c4a 100644
--- a/gnu/usr.bin/ld/Makefile
+++ b/gnu/usr.bin/ld/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.6 1999/08/24 19:05:31 niklas Exp $
+# $OpenBSD: Makefile,v 1.7 2000/02/01 21:01:38 espie Exp $
# $NetBSD: Makefile,v 1.13 1995/04/23 07:58:46 cgd Exp $
TARGET_MACHINE_ARCH?= $(MACHINE_ARCH)
@@ -9,8 +9,12 @@ 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}/../../..
+ -Icross-include
+beforedepend:
+ mkdir -p cross-include
+ -rm cross-include/${TARGET_MACHINE_ARCH}
+ ln -sf ${.CURDIR}/../../../sys/arch/${TARGET_MACHINE_ARCH}/include \
+ cross-include/${TARGET_MACHINE_ARCH}
.else
SUBDIR= ldconfig ldd
.endif
diff --git a/gnu/usr.bin/ld/arm32/md.h b/gnu/usr.bin/ld/arm32/md.h
index 1100b094252..a461d93977d 100644
--- a/gnu/usr.bin/ld/arm32/md.h
+++ b/gnu/usr.bin/ld/arm32/md.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: md.h,v 1.1 1996/06/17 00:10:44 deraadt Exp $ */
+/* $OpenBSD: md.h,v 1.2 2000/02/01 21:01:39 espie Exp $ */
/* $NetBSD: md.h,v 1.1 1996/05/17 21:51:10 mark Exp $ */
/*
@@ -32,6 +32,13 @@
*/
/* First cut for arm32 */
+#if defined(CROSS_LINKER)
+#include <sys/endian.h>
+#if BYTE_ORDER != LITTLE_ENDIAN
+#define NEED_SWAP
+#endif
+
+#endif
#define MAX_ALIGNMENT (sizeof (long))
diff --git a/gnu/usr.bin/ld/i386/md.h b/gnu/usr.bin/ld/i386/md.h
index 20262f16dcb..88ff2019c2c 100644
--- a/gnu/usr.bin/ld/i386/md.h
+++ b/gnu/usr.bin/ld/i386/md.h
@@ -1,4 +1,4 @@
-/* * $OpenBSD: md.h,v 1.3 1998/03/26 19:46:40 niklas Exp $*/
+/* * $OpenBSD: md.h,v 1.4 2000/02/01 21:01:39 espie Exp $*/
/*
* Copyright (c) 1993 Paul Kranenburg
* All rights reserved.
@@ -31,9 +31,13 @@
*/
-#if defined(CROSS_LINKER) && defined(XHOST) && XHOST==sparc
+#if defined(CROSS_LINKER)
+#include <sys/endian.h>
+
+#if BYTE_ORDER != LITTLE_ENDIAN
#define NEED_SWAP
#endif
+#endif
#define MAX_ALIGNMENT (sizeof (long))
diff --git a/gnu/usr.bin/ld/m68k/md.c b/gnu/usr.bin/ld/m68k/md.c
index 836ecd7ab4d..b15f764cc46 100644
--- a/gnu/usr.bin/ld/m68k/md.c
+++ b/gnu/usr.bin/ld/m68k/md.c
@@ -1,4 +1,4 @@
-/* * $OpenBSD: md.c,v 1.4 1998/03/26 19:46:59 niklas Exp $*/
+/* * $OpenBSD: md.c,v 1.5 2000/02/01 21:01:39 espie Exp $*/
/*
* Copyright (c) 1993 Paul Kranenburg
* All rights reserved.
@@ -314,9 +314,8 @@ int n;
for (; n; n--, r++) {
r->r_address = md_swap_long(r->r_address);
- bits = ((int *)r)[1];
- r->r_symbolnum = md_swap_long(bits) & 0x00ffffff;
- bits = ((unsigned char *)r)[7];
+ bits = md_swap_long(((int *)r)[1]);
+ r->r_symbolnum = (bits>>8) & 0x00ffffff ;
r->r_pcrel = (bits >> 7) & 1;
r->r_length = (bits >> 5) & 3;
r->r_extern = (bits >> 4) & 1;
@@ -338,8 +337,8 @@ int n;
for (; n; n--, r++) {
r->r_address = md_swap_long(r->r_address);
- ((int *)r)[1] = md_swap_long(r->r_symbolnum) & 0xffffff00;
- bits = (r->r_pcrel & 1) << 7;
+ bits = (r->r_symbolnum & 0x00ffffff) << 8;
+ bits |= (r->r_pcrel & 1) << 7;
bits |= (r->r_length & 3) << 5;
bits |= (r->r_extern & 1) << 4;
bits |= (r->r_baserel & 1) << 3;
@@ -348,7 +347,7 @@ int n;
#ifdef N_SIZE
bits |= (r->r_copy & 1);
#endif
- ((unsigned char *)r)[7] = bits;
+ ((int *)r)[1] = md_swap_long(bits);
}
}
diff --git a/gnu/usr.bin/ld/m68k/md.h b/gnu/usr.bin/ld/m68k/md.h
index d1210c1e446..768e2311d91 100644
--- a/gnu/usr.bin/ld/m68k/md.h
+++ b/gnu/usr.bin/ld/m68k/md.h
@@ -1,12 +1,25 @@
-/* * $OpenBSD: md.h,v 1.2 1998/03/26 19:47:01 niklas Exp $*/
+/* * $OpenBSD: md.h,v 1.3 2000/02/01 21:01:39 espie Exp $*/
/*
* - m68k dependent definitions
*/
-#if defined(CROSS_LINKER) && defined(XHOST) && XHOST==i386
+#if defined(CROSS_LINKER)
+#include <sys/endian.h>
+
+#if BYTE_ORDER != BIG_ENDIAN
#define NEED_SWAP
#endif
+#undef __LDPGSZ
+#undef ELF_TARG_DATA
+#undef ELF_TARG_MACH
+#undef relocation_info
+#undef MID_MACHINE
+#define MID_MACHINE MID_M68K
+#include <m68k/exec.h>
+#endif
+
+
#define MAX_ALIGNMENT (sizeof (long))
#define PAGSIZ __LDPGSZ
@@ -133,8 +146,8 @@ void md_swapout_jmpslot __P((jmpslot_t *, int));
#define md_swapout_so_debug(d) swap_so_debug(d)
#define md_swapin_rrs_hash(f,n) swap_rrs_hash(f,n)
#define md_swapout_rrs_hash(f,n) swap_rrs_hash(f,n)
-#define md_swapin_sod(l,n) swapin_link_object(l,n)
-#define md_swapout_sod(l,n) swapout_link_object(l,n)
+#define md_swapin_sod(l,n) swapin_sod(l,n)
+#define md_swapout_sod(l,n) swapout_sod(l,n)
#define md_swapout_got(g,n) swap_longs((long*)(g),n)
#define md_swapin_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
#define md_swapout_ranlib_hdr(h,n) swap_ranlib_hdr(h,n)
diff --git a/gnu/usr.bin/ld/m88k/md.h b/gnu/usr.bin/ld/m88k/md.h
index 66caeacf28e..cdfdc2aabd1 100644
--- a/gnu/usr.bin/ld/m88k/md.h
+++ b/gnu/usr.bin/ld/m88k/md.h
@@ -1,13 +1,15 @@
-/* * $OpenBSD: md.h,v 1.1 1999/02/09 05:35:14 smurph Exp $*/
+/* * $OpenBSD: md.h,v 1.2 2000/02/01 21:01:40 espie Exp $*/
/*
* - m68k dependent definitions
*/
-#if defined(CROSS_LINKER) && defined(XHOST) && XHOST==i386
+#if defined(CROSS_LINKER)
+#include <sys/endian.h>
+
+#if BYTE_ORDER != BIG_ENDIAN
#define NEED_SWAP
#endif
-#if defined(CROSS_LINKER)
#undef MID_MACHINE
/* XXX */
#define MID_MACHINE 151
diff --git a/gnu/usr.bin/ld/ns32k/md.h b/gnu/usr.bin/ld/ns32k/md.h
index fae9d29c050..b6deca783fe 100644
--- a/gnu/usr.bin/ld/ns32k/md.h
+++ b/gnu/usr.bin/ld/ns32k/md.h
@@ -1,14 +1,19 @@
-/* $OpenBSD: md.h,v 1.3 1998/03/26 19:47:15 niklas Exp $ */
+/* $OpenBSD: md.h,v 1.4 2000/02/01 21:01:41 espie Exp $ */
/* $NetBSD: md.h,v 1.3 1996/02/22 00:20:06 pk Exp $ */
/*
* - ns32k dependent definitions
*/
-#if defined(CROSS_LINKER) && defined(XHOST) && (XHOST==m68k || XHOST==sparc)
+#if defined(CROSS_LINKER)
+#include <sys/endian.h>
+
+#if BYTE_ORDER != LITTLE_ENDIAN
#define NEED_SWAP
#endif
+#endif
+
#define MAX_ALIGNMENT (sizeof (long))
#define PAGSIZ __LDPGSZ
diff --git a/gnu/usr.bin/ld/sparc/md.h b/gnu/usr.bin/ld/sparc/md.h
index ee109673d55..93675ebe787 100644
--- a/gnu/usr.bin/ld/sparc/md.h
+++ b/gnu/usr.bin/ld/sparc/md.h
@@ -1,4 +1,4 @@
-/* * $OpenBSD: md.h,v 1.5 1999/05/24 23:22:02 espie Exp $*/
+/* * $OpenBSD: md.h,v 1.6 2000/02/01 21:01:42 espie Exp $*/
/*
* Copyright (c) 1993 Paul Kranenburg
* All rights reserved.
@@ -34,10 +34,22 @@
* SPARC machine dependent definitions
*/
-#if defined(CROSS_LINKER) && defined(XHOST) && XHOST==i386
+#if defined(CROSS_LINKER)
+
+#include <sys/endian.h>
+#if BYTE_ORDER != BIG_ENDIAN
#define NEED_SWAP
#endif
+#undef __LDPGSZ
+#undef ELF_TARG_DATA
+#undef ELF_TARG_MACH
+#undef relocation_info
+#undef MID_MACHINE
+#define MID_MACHINE MID_SPARC
+#include <sparc/exec.h>
+#endif
+
#define MAX_ALIGNMENT (sizeof (double))
#if defined(__NetBSD__) || defined(__OpenBSD__)
diff --git a/gnu/usr.bin/ld/vax/md.h b/gnu/usr.bin/ld/vax/md.h
index a55783a64f5..60db24e5562 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.5 1998/05/16 07:44:26 niklas Exp $ */
+/* $OpenBSD: md.h,v 1.6 2000/02/01 21:01:43 espie Exp $ */
/* $NetBSD: md.h,v 1.1 1995/10/19 13:10:20 ragge Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@@ -32,10 +32,14 @@
*/
-#if defined(CROSS_LINKER) && defined(XHOST) && XHOST==sparc
+#if defined(CROSS_LINKER)
+#include <sys/endian.h>
+#if BYTE_ORDER != LITTLE_ENDIAN
#define NEED_SWAP
#endif
+#endif
+
/* Remove definitions from the host exec.h */
#undef __LDPGSZ
#ifdef relocation_info