From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 1B0361F55B for ; Wed, 20 May 2020 10:34:37 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4D6833952007; Wed, 20 May 2020 10:34:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4D6833952007 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1589970876; bh=w91VbeO8udw+GHbf0HW6mPM5sPEojh2i49rpXTxeU+0=; h=To:Subject:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Tv7cOEty7+2fo3cz3LXFcm62N/ttkq1ujKPS3t61/Aw974rB02KPr5rQ6Or30JjIV y5qjNsZGP4aF4esXX9Lqxg9rQ6VoMw343O5C4/Xg3cCVqASDTmvUDqd2D0Xc88s7M4 Hnr8Av5HRomvMaSt6yCwi7QAP7sLNfCKeIz4L9Bw= Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 6F2DD386F41D for ; Wed, 20 May 2020 10:34:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6F2DD386F41D Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-288-XHDJjsrsOLaVLRdiYtbU8Q-1; Wed, 20 May 2020 06:34:30 -0400 X-MC-Unique: XHDJjsrsOLaVLRdiYtbU8Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 85625872FE0; Wed, 20 May 2020 10:34:29 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-113-191.ams2.redhat.com [10.36.113.191]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D369E5C1D0; Wed, 20 May 2020 10:34:28 +0000 (UTC) To: Szabolcs Nagy Subject: Re: [PATCH v3 03/13] Rewrite abi-note.S in C. References: <6fbbbbbca662497f180ea5356d50a4f16a3b5716.1589552054.git.szabolcs.nagy@arm.com> <877dx99sam.fsf@oldenburg2.str.redhat.com> <20200520102737.GA22228@arm.com> Date: Wed, 20 May 2020 12:34:27 +0200 In-Reply-To: <20200520102737.GA22228@arm.com> (Szabolcs Nagy's message of "Wed, 20 May 2020 11:27:37 +0100") Message-ID: <877dx6dhe4.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Florian Weimer via Libc-alpha Reply-To: Florian Weimer Cc: libc-alpha@sourceware.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" * Szabolcs Nagy: > The 05/18/2020 17:28, Florian Weimer wrote: >> * Szabolcs Nagy: >> >> > +/* Note: Custom type is used as ElfW(Nhdr) is wrong on 64 bit targets. */ >> >> Are you sure about that? >> >> typedef struct >> { >> Elf32_Word n_namesz; /* Length of the note's name. */ >> Elf32_Word n_descsz; /* Length of the note's descriptor. */ >> Elf32_Word n_type; /* Type of the note. */ >> } Elf32_Nhdr; >> >> typedef struct >> { >> Elf64_Word n_namesz; /* Length of the note's name. */ >> Elf64_Word n_descsz; /* Length of the note's descriptor. */ >> Elf64_Word n_type; /* Type of the note. */ >> } Elf64_Nhdr; >> >> The types are the same: >> >> typedef uint32_t Elf32_Word; >> typedef uint32_t Elf64_Word; >> >> I admit this is super-confusing. > > aah i missed this, then the struct can be > > #include > > __attribute__ ((used, aligned (4), section (".note.ABI-tag"))) > static const struct > { > ElfW(Nhdr) nhdr; > char name[4]; > int32_t desc[4]; > } __abi_tag = { > { .n_namesz = 4, .n_descsz = 16, .n_type = 1 }, > "GNU", > { __ABI_TAG_OS, __ABI_TAG_VERSION } > }; > > i think the aligned attribute is still needed in case on > some target uint32_t has smaller alignemnt than 4. Agreed, I think it's needed for m68k. > i can change this if it is considered to be better > or just remove the incorrect comment. I slightly prefer using the type from . Thanks, Florian