aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/crunch
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2010-08-12 14:16:57 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2010-08-12 14:16:57 +0000
commit2c4575477e89aac571921b86889e0d76b733acf6 (patch)
treef079bbe24fbbd10fd462be5ee18fe7327dbdb899 /usr.sbin/crunch
parent854c2875cc7a1045c889badf6f1ccc45cc436fe3 (diff)
downloadsrc-2c4575477e89aac571921b86889e0d76b733acf6.tar.gz
src-2c4575477e89aac571921b86889e0d76b733acf6.zip
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.
Notes
Notes: svn path=/head/; revision=211222
Diffstat (limited to 'usr.sbin/crunch')
-rw-r--r--usr.sbin/crunch/crunchide/exec_elf32.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/crunch/crunchide/exec_elf32.c b/usr.sbin/crunch/crunchide/exec_elf32.c
index 61d02419c9c7..2b2e27f82a2a 100644
--- a/usr.sbin/crunch/crunchide/exec_elf32.c
+++ b/usr.sbin/crunch/crunchide/exec_elf32.c
@@ -60,10 +60,15 @@ __FBSDID("$FreeBSD$");
#include <sys/elf32.h>
#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 <sys/elf64.h>
#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 <sys/elf_generic.h>
@@ -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) ||