diff options
author | emaste <emaste@FreeBSD.org> | 2015-04-18 00:30:36 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2015-04-18 00:30:36 +0000 |
commit | 7aef26e2497d38ff979b1bbe7ceb8c38da7e6079 (patch) | |
tree | 027510eff060fb3d766129a773853386439e0dff /usr.sbin/crunch/crunchide | |
parent | 0ca0c32a7dcaf2a2f844bdc7ab38e42fd6aad8e2 (diff) | |
download | FreeBSD-src-7aef26e2497d38ff979b1bbe7ceb8c38da7e6079.zip FreeBSD-src-7aef26e2497d38ff979b1bbe7ceb8c38da7e6079.tar.gz |
crunchide: always include both 32- and 64-bit ELF support
This avoids the need to build a target-specific crunchide for cross-
uilds.
Differential Revision: https://reviews.freebsd.org/D2314
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin/crunch/crunchide')
-rw-r--r-- | usr.sbin/crunch/crunchide/Makefile | 14 | ||||
-rw-r--r-- | usr.sbin/crunch/crunchide/exec_elf32.c | 5 |
2 files changed, 6 insertions, 13 deletions
diff --git a/usr.sbin/crunch/crunchide/Makefile b/usr.sbin/crunch/crunchide/Makefile index 49bb557..467b0b6 100644 --- a/usr.sbin/crunch/crunchide/Makefile +++ b/usr.sbin/crunch/crunchide/Makefile @@ -1,19 +1,9 @@ # $FreeBSD$ PROG= crunchide -SRCS= crunchide.c +SRCS= crunchide.c exec_elf32.c exec_elf64.c -TARGET_ARCH?= ${MACHINE_ARCH} - -.if ${TARGET_ARCH} == aarch64 || ${TARGET_ARCH} == amd64 || \ - ${TARGET_ARCH} == powerpc64 || \ - ${TARGET_ARCH} == sparc64 || ${TARGET_ARCH:Mmips64*} -CFLAGS+=-DNLIST_ELF64 -SRCS+= exec_elf64.c +CFLAGS+=-DNLIST_ELF32 -DNLIST_ELF64 exec_elf64.o: exec_elf32.c -.else -CFLAGS+=-DNLIST_ELF32 -SRCS+= exec_elf32.c -.endif .include <bsd.prog.mk> diff --git a/usr.sbin/crunch/crunchide/exec_elf32.c b/usr.sbin/crunch/crunchide/exec_elf32.c index 10e7d27..da2b6c1 100644 --- a/usr.sbin/crunch/crunchide/exec_elf32.c +++ b/usr.sbin/crunch/crunchide/exec_elf32.c @@ -79,6 +79,9 @@ __FBSDID("$FreeBSD$"); #define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y)))) #define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE)) #define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x))) +#ifndef ELFCLASS +#define ELFCLASS CONCAT(ELFCLASS,ELFSIZE) +#endif #define xe16toh(x) ((data == ELFDATA2MSB) ? be16toh(x) : le16toh(x)) #define xe32toh(x) ((data == ELFDATA2MSB) ? be32toh(x) : le32toh(x)) @@ -167,7 +170,7 @@ ELFNAMEEND(check)(int fd, const char *fn) if (read(fd, &eh, sizeof eh) != sizeof eh) return 0; - if (IS_ELF(eh) == 0) + if (IS_ELF(eh) == 0 || eh.e_ident[EI_CLASS] != ELFCLASS) return 0; data = eh.e_ident[EI_DATA]; |