From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6FDC2139082 for ; Sun, 22 Jan 2017 17:59:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C06F3E0EED; Sun, 22 Jan 2017 17:59:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9D24AE0EEB for ; Sun, 22 Jan 2017 17:59:34 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7A23C340EDA for ; Sun, 22 Jan 2017 17:59:33 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4680C2CB6 for ; Sun, 22 Jan 2017 17:59:32 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1479944177.5e9d4e12714a20e25f233caa6c7246d0802a2a76.vapier@gentoo> Subject: [gentoo-commits] proj/pax-utils:master commit in: / X-VCS-Repository: proj/pax-utils X-VCS-Files: dumpelf.c X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 5e9d4e12714a20e25f233caa6c7246d0802a2a76 X-VCS-Branch: master Date: Sun, 22 Jan 2017 17:59:32 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 7244daf0-8596-4787-9828-c0b6bcbf9b46 X-Archives-Hash: 4fa036fd4b855ecc3d39c67abae0433a commit: 5e9d4e12714a20e25f233caa6c7246d0802a2a76 Author: Mike Frysinger gentoo org> AuthorDate: Wed Nov 23 23:36:17 2016 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Wed Nov 23 23:36:17 2016 +0000 URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=5e9d4e12 dumpelf: add support for prelink sections dumpelf.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/dumpelf.c b/dumpelf.c index 066a239..6b2458a 100644 --- a/dumpelf.c +++ b/dumpelf.c @@ -324,6 +324,24 @@ static void dump_phdr(elfobj *elf, const void *phdr_void, size_t phdr_cnt) DUMP_PHDR(64) } +static const char *timestamp(uint64_t stamp) +{ + /* This doesn't work when run on a 32-bit host with 32-bit time_t beyond + * beyond 2038, but we'll worry about that later. + */ + static char buf[20]; + time_t t; + struct tm *tm; + + t = stamp; + tm = gmtime(&t); + snprintf (buf, sizeof(buf), "%04u-%02u-%02u %02u:%02u:%02u", + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec); + + return buf; +} + static void dump_shdr(elfobj *elf, const void *shdr_void, size_t shdr_cnt, const char *section_name) { size_t i; @@ -412,6 +430,22 @@ static void dump_shdr(elfobj *elf, const void *shdr_void, size_t shdr_cnt, const case SHT_NOTE: \ dump_notes(elf, B, vdata, vdata + EGET(shdr->sh_size)); \ break; \ + case SHT_GNU_LIBLIST: { \ + Elf##B##_Lib *lib = vdata; \ + printf("\n\t/%c section dump:\n", '*'); \ + for (i = 0; i < EGET(shdr->sh_size) / EGET(shdr->sh_entsize); ++i) { \ + printf("\t * Elf%i_Lib lib%zu = {\n", B, i); \ + printf("\t * \t.l_name = %"PRIu64",\n", EGET(lib->l_name)); \ + printf("\t * \t.l_time_stamp = 0x%"PRIX64", (%s)\n", \ + EGET(lib->l_time_stamp), timestamp(EGET(lib->l_time_stamp))); \ + printf("\t * \t.l_checksum = 0x%"PRIX64",\n", EGET(lib->l_checksum)); \ + printf("\t * \t.l_version = %"PRIu64",\n", EGET(lib->l_version)); \ + printf("\t * \t.l_flags = 0x%"PRIX64"\n", EGET(lib->l_flags)); \ + printf("\t * };\n"); \ + ++lib; \ + } \ + printf("\t */\n"); \ + } \ default: { \ if (be_verbose <= 1) \ break; \