From owner-svn-src-head@FreeBSD.ORG Sat Jul 26 20:00:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4E315D84; Sat, 26 Jul 2014 20:00:46 +0000 (UTC) Received: from mho-01-ewr.mailhop.org (mho-03-ewr.mailhop.org [204.13.248.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 20E662D03; Sat, 26 Jul 2014 20:00:45 +0000 (UTC) Received: from c-50-155-136-3.hsd1.co.comcast.net ([50.155.136.3] helo=ilsoft.org) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1XB895-000AaP-RD; Sat, 26 Jul 2014 20:00:44 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id s6QK0gtt003975; Sat, 26 Jul 2014 14:00:42 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 50.155.136.3 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/yoUwbtYLMlB9BmNXlZCzw X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r269143 - head/usr.bin/elfdump From: Ian Lepore To: Andreas Tobler In-Reply-To: <201407261944.s6QJikAI024004@svn.freebsd.org> References: <201407261944.s6QJikAI024004@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Sat, 26 Jul 2014 14:00:42 -0600 Message-ID: <1406404842.56408.26.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jul 2014 20:00:46 -0000 On Sat, 2014-07-26 at 19:44 +0000, Andreas Tobler wrote: > Author: andreast > Date: Sat Jul 26 19:44:45 2014 > New Revision: 269143 > URL: http://svnweb.freebsd.org/changeset/base/269143 > > Log: > Further improvements on elfdump, to follow up r269092: > > - Add ARM specific section header types. > - Add SHT_GNU_HASH section header type. > - Improve reporting of undefined tags in d_tags. > - Add DT_GNU_HASH tag. > > Reviewed by: emaste > > Modified: > head/usr.bin/elfdump/elfdump.c > > Modified: head/usr.bin/elfdump/elfdump.c > ============================================================================== > --- head/usr.bin/elfdump/elfdump.c Sat Jul 26 19:27:34 2014 (r269142) > +++ head/usr.bin/elfdump/elfdump.c Sat Jul 26 19:44:45 2014 (r269143) > @@ -167,7 +167,10 @@ static int elf64_offsets[] = { > > /* http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#tag_encodings */ > static const char * > -d_tags(u_int64_t tag) { > +d_tags(u_int64_t tag) > +{ > + static char unknown_tag[48]; > + > switch (tag) { > case 0: return "DT_NULL"; > case 1: return "DT_NEEDED"; > @@ -215,6 +218,7 @@ d_tags(u_int64_t tag) { > case 0x6ffffdfe: return "DT_SYMINSZ"; > case 0x6ffffdff: return "DT_SYMINENT (DT_VALRNGHI)"; > case 0x6ffffe00: return "DT_ADDRRNGLO"; > + case 0x6ffffef5: return "DT_GNU_HASH"; > case 0x6ffffef8: return "DT_GNU_CONFLICT"; > case 0x6ffffef9: return "DT_GNU_LIBLIST"; > case 0x6ffffefa: return "DT_SUNW_CONFIG"; > @@ -236,8 +240,10 @@ d_tags(u_int64_t tag) { > case 0x7ffffffd: return "DT_SUNW_AUXILIARY"; > case 0x7ffffffe: return "DT_SUNW_USED"; > case 0x7fffffff: return "DT_SUNW_FILTER"; > - default: return "ERROR: TAG NOT DEFINED"; > } > + snprintf(unknown_tag, sizeof(unknown_tag), > + "ERROR: TAG NOT DEFINED -- tag 0x%jx", (uintmax_t)tag); > + return (unknown_tag); > } > > static const char * > @@ -334,6 +340,7 @@ sh_types(uint64_t machine, uint64_t sht) > switch (sht) { > case 0x6ffffff0: return "XXX:VERSYM"; > case 0x6ffffff4: return "SHT_SUNW_dof"; > + case 0x6ffffff6: return "SHT_GNU_HASH"; > case 0x6ffffff7: return "SHT_GNU_LIBLIST"; > case 0x6ffffffc: return "XXX:VERDEF"; > case 0x6ffffffd: return "SHT_SUNW(GNU)_verdef"; > @@ -347,6 +354,15 @@ sh_types(uint64_t machine, uint64_t sht) > } else if (sht < 0x80000000) { > /* 0x70000000-0x7fffffff processor-specific semantics */ > switch (machine) { > + case EM_ARM: > + switch (sht) { > + case 0x70000001: return "SHT_ARM_EXIDX"; > + case 0x70000002: return "SHT_ARM_PREEMPTMAP"; > + case 0x70000003: return "SHT_ARM_ATTRIBUTES"; > + case 0x70000004: return "SHT_ARM_DEBUGOVERLAY"; > + case 0x70000005: return "SHT_ARM_OVERLAYSECTION"; > + } > + break; > case EM_MIPS: > switch (sht) { > case 0x7000000d: return "SHT_MIPS_OPTIONS"; > I'm curious why this code is all full of 0xnnnnnnnn numbers when there are named constants defined for all this stuff. -- Ian