From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23643 invoked by alias); 10 Nov 2018 23:29:03 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 23622 invoked by uid 89); 10 Nov 2018 23:29:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy= X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 10 Nov 2018 23:29:00 +0000 Received: from librem.wildebeest.org (deer0x01.wildebeest.org [172.31.17.131]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 347583013098; Sun, 11 Nov 2018 00:28:57 +0100 (CET) Received: by librem.wildebeest.org (Postfix, from userid 1000) id D64E914051A; Sun, 11 Nov 2018 00:28:57 +0100 (CET) Date: Sat, 10 Nov 2018 23:29:00 -0000 From: Mark Wielaard To: Milian Wolff Cc: elfutils-devel@sourceware.org Subject: Re: [PATCH] Also find CFI in sections of type SHT_X86_64_UNWIND Message-ID: <20181110232857.GA8166@wildebeest.org> References: <20181029152126.32610-1-milian.wolff@kdab.com> <2537678.yolsnJm5dN@agathebauer> <6704910.BGFJc7X5JR@agathebauer> <20181109165737.GE58451@wildebeest.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="NzB8fVQJ5HfG6fxh" Content-Disposition: inline In-Reply-To: <20181109165737.GE58451@wildebeest.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Flag: NO X-IsSubscribed: yes X-SW-Source: 2018-q4/txt/msg00112.txt.bz2 --NzB8fVQJ5HfG6fxh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 238 Found another issue while testing with a gcc 8.1 and gold setup I noticed some self-tests failed because elflint doesn't know about SHT_X86_64_UNWIND section type and cannot match the PT_GNU_EH_FRAME segment. The attached patch fixes it. --NzB8fVQJ5HfG6fxh Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-elflint-Allow-PT_GNU_EH_FRAME-segment-to-match-SHT_X.patch" Content-length: 1643 >From ad11949bbd22aadd8d0e950ff7defbad7cc271f2 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 10 Nov 2018 23:33:03 +0100 Subject: [PATCH] elflint: Allow PT_GNU_EH_FRAME segment to match SHT_X86_64_UNWIND section. The gold linker might generate an .eh_frame_hdr with a SHT_X86_64_UNWIND type instead of a SHT_PROGBITS type. Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 +++++ src/elflint.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f1a35798..fc6d414f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2018-11-10 Mark Wielaard + + * elflint.c (check_program_header): Allow PT_GNU_EH_FRAME segment + to be matched against SHT_X86_64_UNWIND section. + 2018-10-20 Mark Wielaard * readelf.c (process_elf_file): Use dwelf_elf_begin to open pure_elf. diff --git a/src/elflint.c b/src/elflint.c index fa3af4c5..658f2ae2 100644 --- a/src/elflint.c +++ b/src/elflint.c @@ -4605,8 +4605,10 @@ program header offset in ELF header and PHDR entry do not match")); any = true; shdr = gelf_getshdr (scn, &shdr_mem); if (shdr != NULL - && shdr->sh_type == (is_debuginfo - ? SHT_NOBITS : SHT_PROGBITS) + && ((is_debuginfo && shdr->sh_type == SHT_NOBITS) + || (! is_debuginfo + && (shdr->sh_type == SHT_PROGBITS + || shdr->sh_type == SHT_X86_64_UNWIND))) && elf_strptr (ebl->elf, shstrndx, shdr->sh_name) != NULL && ! strcmp (".eh_frame_hdr", elf_strptr (ebl->elf, shstrndx, shdr->sh_name))) -- 2.19.1 --NzB8fVQJ5HfG6fxh--