From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 14:16:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FF2910656A4; Thu, 12 Aug 2010 14:16:57 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F0BD8FC22; Thu, 12 Aug 2010 14:16:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CEGvDg002949; Thu, 12 Aug 2010 14:16:57 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CEGvEl002947; Thu, 12 Aug 2010 14:16:57 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008121416.o7CEGvEl002947@svn.freebsd.org> From: Adrian Chadd Date: Thu, 12 Aug 2010 14:16:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211222 - head/usr.sbin/crunch/crunchide X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2010 14:16:57 -0000 Author: adrian Date: Thu Aug 12 14:16:57 2010 New Revision: 211222 URL: http://svn.freebsd.org/changeset/base/211222 Log: Fix crunchide to work on sparc64 and perhaps other 64 bit platforms. I used the wrong type when setting st_name in the symbol table entry struct. It's an Elf64_Word which is defined as an unsigned 32 bit int on both 32 and 64 bit platforms. To make things sensible, define some new macros to use as "word" macros and use those, rather than simply using the explicit 32 bit macros. Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c ============================================================================== --- head/usr.sbin/crunch/crunchide/exec_elf32.c Thu Aug 12 13:58:46 2010 (r211221) +++ head/usr.sbin/crunch/crunchide/exec_elf32.c Thu Aug 12 14:16:57 2010 (r211222) @@ -60,10 +60,15 @@ __FBSDID("$FreeBSD$"); #include #define xewtoh(x) ((data == ELFDATA2MSB) ? be32toh(x) : le32toh(x)) #define htoxew(x) ((data == ELFDATA2MSB) ? htobe32(x) : htole32(x)) +#define wewtoh(x) ((data == ELFDATA2MSB) ? be32toh(x) : le32toh(x)) +#define htowew(x) ((data == ELFDATA2MSB) ? htobe32(x) : htole32(x)) #elif (ELFSIZE == 64) #include #define xewtoh(x) ((data == ELFDATA2MSB) ? be64toh(x) : le64toh(x)) #define htoxew(x) ((data == ELFDATA2MSB) ? htobe64(x) : htole64(x)) +/* elf64 Elf64_Word are 32 bits */ +#define wewtoh(x) ((data == ELFDATA2MSB) ? be32toh(x) : le32toh(x)) +#define htowew(x) ((data == ELFDATA2MSB) ? htobe32(x) : htole32(x)) #endif #include @@ -345,7 +350,7 @@ ELFNAMEEND(hide)(int fd, const char *fn) goto bad; } - sp->st_name = htoxew(nstrtab_nextoff); + sp->st_name = htowew(nstrtab_nextoff); /* if it's a keeper or is undefined, don't rename it. */ if (in_keep_list(symname) ||