summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2002-04-30 09:34:53 +0000
committerru <ru@FreeBSD.org>2002-04-30 09:34:53 +0000
commitd2cb56e26ce9b15e3b6f97b81a3ffe0555f63dd6 (patch)
treee675fa2c0c3c637a8bffa06bf11440ad780ddec6
parentb6b2470fee2f571cb813096fa5097867bdc21e83 (diff)
downloadFreeBSD-src-d2cb56e26ce9b15e3b6f97b81a3ffe0555f63dd6.zip
FreeBSD-src-d2cb56e26ce9b15e3b6f97b81a3ffe0555f63dd6.tar.gz
Make crunchide(1) a cross-tool; needed for cross-arch "make release".
Note that a.out is only supported for the non-cross i386 case.
-rw-r--r--Makefile.inc13
-rw-r--r--usr.sbin/crunch/crunchide/Makefile4
-rw-r--r--usr.sbin/crunch/crunchide/crunchide.c2
-rw-r--r--usr.sbin/crunch/crunchide/exec_aout.c3
-rw-r--r--usr.sbin/crunch/crunchide/exec_elf32.c8
-rw-r--r--usr.sbin/crunch/crunchide/extern.h7
6 files changed, 19 insertions, 8 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index fac487b..b37c2748 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -646,7 +646,8 @@ _xlint= usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint
cross-tools:
.for _tool in ${_btxld} ${_elf2exe} \
- gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc ${_xlint}
+ gnu/usr.bin/binutils usr.bin/objformat usr.sbin/crunch/crunchide \
+ gnu/usr.bin/cc ${_xlint}
cd ${.CURDIR}/${_tool}; \
${MAKE} obj; \
${MAKE} depend; \
diff --git a/usr.sbin/crunch/crunchide/Makefile b/usr.sbin/crunch/crunchide/Makefile
index 8af6b33..ae91f3e 100644
--- a/usr.sbin/crunch/crunchide/Makefile
+++ b/usr.sbin/crunch/crunchide/Makefile
@@ -3,8 +3,10 @@
PROG= crunchide
SRCS= crunchide.c exec_elf32.c exec_elf64.c
-.if ${MACHINE_ARCH} == i386
+TARGET_ARCH?= ${MACHINE_ARCH}
+.if ${TARGET_ARCH} == i386 && ${MACHINE_ARCH} == i386
SRCS+= exec_aout.c
.endif
+CFLAGS+=-Darch_${TARGET_ARCH}
.include <bsd.prog.mk>
diff --git a/usr.sbin/crunch/crunchide/crunchide.c b/usr.sbin/crunch/crunchide/crunchide.c
index 1538567..32b0451 100644
--- a/usr.sbin/crunch/crunchide/crunchide.c
+++ b/usr.sbin/crunch/crunchide/crunchide.c
@@ -208,7 +208,7 @@ struct {
int (*check)(int, const char *); /* 1 if match, zero if not */
int (*hide)(int, const char *); /* non-zero if error */
} exec_formats[] = {
-#ifdef __i386__
+#if defined(__i386__) && defined(arch_i386)
#ifdef NLIST_AOUT
{ "a.out", check_aout, hide_aout, },
#endif
diff --git a/usr.sbin/crunch/crunchide/exec_aout.c b/usr.sbin/crunch/crunchide/exec_aout.c
index 9f68115..7122994 100644
--- a/usr.sbin/crunch/crunchide/exec_aout.c
+++ b/usr.sbin/crunch/crunchide/exec_aout.c
@@ -28,6 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: exec_aout.c,v 1.6 1997/08/02 21:30:17 perry Exp $");
+__FBSDID("$FreeBSD$");
#endif
#include <unistd.h>
@@ -56,7 +57,7 @@ struct nlist *symbase;
#define IS_GLOBAL_DEFINED(sp) \
(((sp)->n_type & N_EXT) && ((sp)->n_type & N_TYPE) != N_UNDF)
-#ifdef __sparc
+#ifdef arch_sparc
/* is the relocation entry dependent on a symbol? */
#define IS_SYMBOL_RELOC(rp) \
((rp)->r_extern || \
diff --git a/usr.sbin/crunch/crunchide/exec_elf32.c b/usr.sbin/crunch/crunchide/exec_elf32.c
index 0087408..3df4059 100644
--- a/usr.sbin/crunch/crunchide/exec_elf32.c
+++ b/usr.sbin/crunch/crunchide/exec_elf32.c
@@ -55,7 +55,13 @@ static const char rcsid[] =
#if (defined(NLIST_ELF32) && (ELFSIZE == 32)) || \
(defined(NLIST_ELF64) && (ELFSIZE == 64))
-#include <machine/elf.h>
+#define __ELF_WORD_SIZE ELFSIZE
+#if (ELFSIZE == 32)
+#include <sys/elf32.h>
+#elif (ELFSIZE == 64)
+#include <sys/elf64.h>
+#endif
+#include <sys/elf_generic.h>
#define CONCAT(x,y) __CONCAT(x,y)
#define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
diff --git a/usr.sbin/crunch/crunchide/extern.h b/usr.sbin/crunch/crunchide/extern.h
index a3d6586..4625246 100644
--- a/usr.sbin/crunch/crunchide/extern.h
+++ b/usr.sbin/crunch/crunchide/extern.h
@@ -1,4 +1,5 @@
/* $NetBSD: extern.h,v 1.5 1998/05/06 13:16:57 mycroft Exp $ */
+/* $FreeBSD$ */
/*
* Copyright (c) 1997 Christopher G. Demetriou. All rights reserved.
@@ -30,14 +31,14 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef __alpha__
+#ifdef arch_alpha
#define NLIST_ECOFF
#define NLIST_ELF64
#else
-#ifdef __mips__
+#ifdef arch_mips
#define NLIST_ELF32
#else
-#ifdef __powerpc__
+#ifdef arch_powerpc
#define NLIST_ELF32
#else
#define NLIST_AOUT
OpenPOWER on IntegriCloud