From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3512 invoked by alias); 27 Feb 2019 13:12:27 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 3499 invoked by uid 89); 27 Feb 2019 13:12:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS autolearn=no version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Feb 2019 13:12:26 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D0BF3C007346; Wed, 27 Feb 2019 13:12:24 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-117-252.ams2.redhat.com [10.36.117.252]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC637100190E; Wed, 27 Feb 2019 13:12:23 +0000 (UTC) From: Florian Weimer To: Richard Biener Cc: Mark Wielaard , gcc@gcc.gnu.org Subject: Re: [RFC] Change PCH "checksum" References: <4b144c8b12b3413b1ec450d9ba468b71dd5b4547.camel@klomp.org> Date: Wed, 27 Feb 2019 13:12:00 -0000 In-Reply-To: (Richard Biener's message of "Tue, 26 Feb 2019 09:33:30 +0100 (CET)") Message-ID: <87imx5tlxm.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2019-02/txt/msg00159.txt.bz2 * Richard Biener: >> Since the introduction of GNU Property notes this is (sadly) no longer >> the correct way to iterate through ELF notes. The padding of names and >> desc might now depend on the alignment of the PT_NOTE segment. >> https://sourceware.org/ml/binutils/2018-09/msg00359.html > > Ick, that's of course worse ;) So it's not entirely clear what > the correct thing to do is - from how I read the mail at the above > link only iff sh_align of the note section is exactly 8 the above > ALIGN would use 8 byte alignment and else 4 is correct (independent > on sh_align). Or can I assume sh_align of the note section is > "correct" for all existing binaries? sh_align doesn't come into play if you look at program headers. A GNU build ID note will not end up in a PT_NOTE segment with 8-byte alignment, so I think you can skip those early, like this: + if (info->dlpi_phdr[i].p_type != PT_NOTE + || info->dlpi_phdr[i].p_align != 4) + continue; (Untested, of course.) Thanks, Florian