From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id srhPFrv6MGrXsgkAWB0awg (envelope-from ) for ; Tue, 16 Jun 2026 03:26:51 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=fdoaE7XN; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=tEozwqV+; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=fdoaE7XN; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=tEozwqV+; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3A19C1E098; Tue, 16 Jun 2026 03:26:51 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A9C9B1E024 for ; Tue, 16 Jun 2026 03:26:49 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C398F48FBCA9 for ; Tue, 16 Jun 2026 07:26:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C398F48FBCA9 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=fdoaE7XN; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=tEozwqV+; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=fdoaE7XN; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=tEozwqV+ Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 6F9354C515FD for ; Tue, 16 Jun 2026 07:26:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F9354C515FD Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6F9354C515FD Authentication-Results: sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781594779; cv=none; b=wVyMLRMT2ryVP09urix34SYrRICD3YN94VhVnmgq7AghLwRaP+DL9BcH7CB6qV2YOjORPQ2B6ZQhDA+HPNDk8yTWsDiDer/aSGy07271TwgC/TrHGyRFH4didDICohSLZHV4Gvml03ZnNrhblplzqzZ1OGjNXFfnSA6TTV//QOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781594779; c=relaxed/simple; bh=OcvL7kOJNI2TdyghqMitpz2hDkW6twLBu+7WDT1dUvM=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=egmM/rH9jtDdfjxezijRbFnoMevBVU+CNANlG7NG/j1kqDZeYzxuH5xHJGhGu0rxmZ553+fBOVgodBW7AvR9d6GPJbB6c4ZdXetMdQU+dg76byBw5yknr85N+UTJADAI/BSRRDzJwYkYd98Xi3lhqCLjJB5co1l/Yh9EgTHRdwU= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=fdoaE7XN; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=tEozwqV+; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=fdoaE7XN; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=tEozwqV+ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F9354C515FD Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64: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 smtp-out1.suse.de (Postfix) with ESMTPS id 655196C871; Tue, 16 Jun 2026 07:26:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1781594778; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IdJJ8pUHtWdtvoth4fnVyEwAtsO1F+TLtWk4AfWM1AM=; b=fdoaE7XNN8GJHkoARdG2ooYW8tXveZHgC6NhY63xiJkw/cKK2fvaPUn218nfXJJiYuigCW b99n5swO7ZcCwwDIQ07L7sRVT5/u8UVQwDM1bBZCd9b80Pmz2vMap4SJOrMJFhlMqUiXZJ mLK2nfG2qn2prdRIJGbd+LyK50mMSZI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1781594778; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IdJJ8pUHtWdtvoth4fnVyEwAtsO1F+TLtWk4AfWM1AM=; b=tEozwqV+HD+99BXrz7ThG4ui2yuz73MS07qcdbQk1iHfpKDOHjTkK0+VI4IGYMeO8x/0mQ b4LEXIfVS9lbbzDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=fdoaE7XN; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=tEozwqV+ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1781594778; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IdJJ8pUHtWdtvoth4fnVyEwAtsO1F+TLtWk4AfWM1AM=; b=fdoaE7XNN8GJHkoARdG2ooYW8tXveZHgC6NhY63xiJkw/cKK2fvaPUn218nfXJJiYuigCW b99n5swO7ZcCwwDIQ07L7sRVT5/u8UVQwDM1bBZCd9b80Pmz2vMap4SJOrMJFhlMqUiXZJ mLK2nfG2qn2prdRIJGbd+LyK50mMSZI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1781594778; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IdJJ8pUHtWdtvoth4fnVyEwAtsO1F+TLtWk4AfWM1AM=; b=tEozwqV+HD+99BXrz7ThG4ui2yuz73MS07qcdbQk1iHfpKDOHjTkK0+VI4IGYMeO8x/0mQ b4LEXIfVS9lbbzDw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 48988779A8; Tue, 16 Jun 2026 07:26:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id DmICEJr6MGoAOwAAD6G6ig (envelope-from ); Tue, 16 Jun 2026 07:26:18 +0000 Message-ID: Date: Tue, 16 Jun 2026 09:26:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [pushed] [gdb/build, clang] Fix ignored aligned attribute To: Tom Tromey Cc: gdb-patches@sourceware.org, Pedro Alves References: <20260612104134.4147876-1-tdevries@suse.de> <874ij7evsh.fsf@tromey.com> Content-Language: en-US From: Tom de Vries In-Reply-To: <874ij7evsh.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Action: no action X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid,sourceware.org:url,gnu.org:url,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 655196C871 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 6/12/26 3:24 PM, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries writes: > > Tom> PR build/34279 reports a build failure with clang. > Tom> This is a regression since commit 6c85ef111b0 ("[gdb] Use using instead of > Tom> typedef"), which did: > Tom> ... > Tom> -typedef long __attribute__ ((__aligned__ (4))) compat_x32_clock_t; > Tom> +using compat_x32_clock_t = long __attribute__ ((__aligned__ (4))); > Tom> ... > > Tom> The problem is that clang ignores the attribute. > > Very surprising. > > Tom> /* For x32, clock_t in _sigchld is 64bit aligned at 4 bytes. */ > Tom> -using compat_x32_clock_t = long __attribute__ ((__aligned__ (4))); > Tom> +typedef long __attribute__ ((__aligned__ (4))) compat_x32_clock_t; > > I think if we need this to remain a typedef, a comment explaining the > reason would be good. I ended up using a suggestion of Pedro ( https://sourceware.org/pipermail/gdb-patches/2026-June/228041.html ): ... -typedef long __attribute__ ((__aligned__ (4))) compat_x32_clock_t; +using compat_x32_clock_t [[gnu::aligned (4)]] = long; ... so I guess such a comment is not needed. FWIW and FTR, I also looked into other ways to fix this. Using the packed template works: ... diff --git a/gdb/nat/amd64-linux-siginfo.c b/gdb/nat/amd64-linux-siginfo.c index 99faccabf37..30a1107d3ea 100644 --- a/gdb/nat/amd64-linux-siginfo.c +++ b/gdb/nat/amd64-linux-siginfo.c @@ -18,6 +18,7 @@ along with this program. If not, see . */ #include +#include "gdbsupport/packed.h" #include "amd64-linux-siginfo.h" #define GDB_SI_SIZE 128 @@ -202,9 +203,6 @@ struct compat_siginfo_t } _sifields; }; -/* For x32, clock_t in _sigchld is 64bit aligned at 4 bytes. */ -typedef long __attribute__ ((__aligned__ (4))) compat_x32_clock_t; - struct __attribute__ ((__aligned__ (8))) compat_x32_siginfo_t { int si_signo; @@ -244,8 +242,8 @@ struct __attribute__ ((__aligned__ (8))) compat_x32_siginfo_t unsigned int _pid; unsigned int _uid; int _status; - compat_x32_clock_t _utime; - compat_x32_clock_t _stime; + packed _utime; + packed _stime; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ @@ -478,10 +476,8 @@ compat_x32_siginfo_from_siginfo (compat_x32_siginfo_t *to, to->cpt_si_pid = from_ptrace.cpt_si_pid; to->cpt_si_uid = from_ptrace.cpt_si_uid; to->cpt_si_status = from_ptrace.cpt_si_status; - memcpy (&to->cpt_si_utime, &from_ptrace.cpt_si_utime, - sizeof (to->cpt_si_utime)); - memcpy (&to->cpt_si_stime, &from_ptrace.cpt_si_stime, - sizeof (to->cpt_si_stime)); + to->cpt_si_utime = from_ptrace.cpt_si_utime; + to->cpt_si_stime = from_ptrace.cpt_si_stime; break; case SIGILL: case SIGFPE: ... Likewise, tagging the struct with attribute packed: ... diff --git a/gdb/nat/amd64-linux-siginfo.c b/gdb/nat/amd64-linux-siginfo.c index 99faccabf37..8279acd4117 100644 --- a/gdb/nat/amd64-linux-siginfo.c +++ b/gdb/nat/amd64-linux-siginfo.c @@ -202,9 +202,6 @@ struct compat_siginfo_t } _sifields; }; -/* For x32, clock_t in _sigchld is 64bit aligned at 4 bytes. */ -typedef long __attribute__ ((__aligned__ (4))) compat_x32_clock_t; - struct __attribute__ ((__aligned__ (8))) compat_x32_siginfo_t { int si_signo; @@ -239,13 +236,13 @@ struct __attribute__ ((__aligned__ (8))) compat_x32_siginfo_t } _rt; /* SIGCHLD */ - struct + struct __attribute__((packed)) { unsigned int _pid; unsigned int _uid; int _status; - compat_x32_clock_t _utime; - compat_x32_clock_t _stime; + long _utime; + long _stime; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ ... Thanks, - Tom