path: root/usr.sbin/crunch/crunchide/exec_elf32.c
diff options
authorEd Maste <emaste@FreeBSD.org>2016-11-17 18:12:17 +0000
committerEd Maste <emaste@FreeBSD.org>2016-11-17 18:12:17 +0000
commitf513dfd44b7e0657b22408848e2450f22379ccbe (patch)
treee80ce95bdb6289ed4e33d0181be3e874bdaf2061 /usr.sbin/crunch/crunchide/exec_elf32.c
parent6e18247a3d423831d88f204daae4f991e5d72fa3 (diff)
crunchide: report explicit error for combined string table
Some tools produce objects with a combined strtab and shstrtab. These objects are not supported by crunchide since it rewrites the symtab and strtab to "hide" symbols. This invalidates section header offsets into a combined strtab/shstrtab. In the future we could support these objects (by ensuring that we retain unmodified section name strings in the output .strtab, and then rewriting each section header's sh_name). MFC after: 1 week Sponsored by: The FreeBSD Foundation
Notes: svn path=/head/; revision=308772
Diffstat (limited to 'usr.sbin/crunch/crunchide/exec_elf32.c')
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.sbin/crunch/crunchide/exec_elf32.c b/usr.sbin/crunch/crunchide/exec_elf32.c
index 6d94429f7e91..9aa29fd8a97b 100644
--- a/usr.sbin/crunch/crunchide/exec_elf32.c
+++ b/usr.sbin/crunch/crunchide/exec_elf32.c
@@ -279,6 +279,10 @@ ELFNAMEEND(hide)(int fd, const char *fn)
weird = 1;
weirdreason = "section header string table does not exist";
+ if (strtabshdr == shstrtabshdr) {
+ weird = 1;
+ weirdreason = "combined strtab and shstrtab not supported";
+ }
if (weirdreason == NULL)
weirdreason = "unsupported";
if (weird) {