From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qenfGcWX2WLTLBgAWB0awg (envelope-from ) for ; Thu, 21 Jul 2022 14:15:33 -0400 Received: by simark.ca (Postfix, from userid 112) id 55DA91E5EA; Thu, 21 Jul 2022 14:15:33 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.6 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 (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id DD4F31E21F for ; Thu, 21 Jul 2022 14:15:32 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9392C385AE66 for ; Thu, 21 Jul 2022 18:15:32 +0000 (GMT) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by sourceware.org (Postfix) with ESMTPS id 499FB3858C56 for ; Thu, 21 Jul 2022 18:15:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 499FB3858C56 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f42.google.com with SMTP id u14-20020a05600c00ce00b003a323062569so1251805wmm.4 for ; Thu, 21 Jul 2022 11:15:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1QfpdUJYuq46OVEtjVwQEYEmM9sEP2p8k6RmOqO6qF8=; b=qEF4FiF6jA6v7QutMcJpD8pPncMuDXf+ES83ZnW+rJbHPFLbaTVXiKNAqQOeDLv6FI /Ku1+bZkGXiRySgNtcRR83O8h/lRrw00NE3vw0nPeabrBrALcnvMQSTeyAN/OITunUKT FKHlAYDdS5zePGvvX9p0SAz9scm4VVT/rejwnnpTIWTjC3Y/Kx04YqtyqgRMuYF5QOrb W4EvhmGUPD+LWdP+8bGlXPVezbuqlIHn2L3ve1QcnXCMupsAKifNdrd2qV/ivk9Cw61i vWhca9KirKMGs0+U1LlPlquE3/drIhOW1N3JXHyYDl1gPL7oHTcHD56YBK+Z50LQfRKj 0csA== X-Gm-Message-State: AJIora8GRRz+xGSvoFzNxLs6TOUVV4IcdDjtSH+B60+ycAYjpK8iA3ep E2hd+yOcOrlK3xRcCSf0KENEDWdVM9c= X-Google-Smtp-Source: AGRyM1toYrj5lfqjKEzaL4hAaKOUkJpu/UGQpMNHgZLXC9vfMC+i3y2msIvR70XDjg24QDB+QgeANQ== X-Received: by 2002:a05:600c:2110:b0:3a3:1a69:aa7b with SMTP id u16-20020a05600c211000b003a31a69aa7bmr9082817wml.186.1658427319093; Thu, 21 Jul 2022 11:15:19 -0700 (PDT) Received: from ?IPv6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id x5-20020adfdcc5000000b0021d887f9468sm2532779wrm.25.2022.07.21.11.15.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Jul 2022 11:15:18 -0700 (PDT) Subject: Re: [PATCH 1/3] struct packed: Use gcc_struct on Windows To: Eli Zaretskii References: <20220721152132.3489524-1-pedro@palves.net> <20220721152132.3489524-2-pedro@palves.net> <83h73amp19.fsf@gnu.org> <83a692mkj7.fsf@gnu.org> From: Pedro Alves Message-ID: <7b3aa811-a2a8-3b3f-7a6f-40196e4e6901@palves.net> Date: Thu, 21 Jul 2022 19:15:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <83a692mkj7.fsf@gnu.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2022-07-21 6:40 p.m., Eli Zaretskii wrote: >> Cc: gdb-patches@sourceware.org >> From: Pedro Alves >> Date: Thu, 21 Jul 2022 18:05:55 +0100 >> >> On 2022-07-21 5:03 p.m., Eli Zaretskii wrote: >>>> From: Pedro Alves >>>> Date: Thu, 21 Jul 2022 16:21:30 +0100 >>>> >>>> The issue is that mingw gcc defaults to "-mms-bitfields", which >>>> affects how bitfields are laid out. We can however tell GCC that we >>>> want the regular GCC layout instead using attribute gcc_struct. >>> >>> Is that a good idea? It means the code emitted by GCC for this source >>> file will be incompatible with any other library compiled with MinGW >>> that GDB uses. So we are risking ABI incompatibilities here. Right? >>> >> >> No. The attribute only changes the layout of that particular structure. > > And we are 110% sure that structure will never be passed to any other > code? What other code are you talking about? struct packed is used in GDB's internal structures. Nothing outside GDB ever sees it. GDB doesn't export a C api. And if it did, we probably wouldn't use struct packed in exported structures. > >>> Can you tell why we must have the regular GCC layout of bitfields >>> here? >> >> Because without it the struct won't really be packed. > > Can you tell why is that necessary? > > In any case, I'm very uneasy about changes that break ABI > compatibility between parts of a program. > But no ABI compatibility is broken.