From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KWmxJhujmWnnCAQAWB0awg (envelope-from ) for ; Sat, 21 Feb 2026 07:20:43 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=VCDWHgZD; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 976951E0BA; Sat, 21 Feb 2026 07:20:43 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 38C7E1E089 for ; Sat, 21 Feb 2026 07:20:42 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 030134B9DB61 for ; Sat, 21 Feb 2026 12:20:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 030134B9DB61 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=VCDWHgZD Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 614144BA2E3D for ; Sat, 21 Feb 2026 12:20:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 614144BA2E3D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 614144BA2E3D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771676413; cv=none; b=mUWAtTB2lij7IdW/NFFAvAq/W6li5+gZJFXKCGCfUESyOqqmH8yeWaacDUmgAru1EiZ8zHpB7AHhZjBTZ0PF/U2SkC42nv56SAZW111mPH0NJdT4V65XwSFHJcv42i1YYV/ol7vpK6Bo9UXvgHZHhLySYDT2Gv3NCn+eBN4WXyY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771676413; c=relaxed/simple; bh=JcGuqt8+WZijyveuLwSIlOzqA4tYrvEHKy82nwWvQ6w=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=nwWCYzsTj3ytJ9Lhy8IL83M9d0jTl8LgZixUVmG8eRZT3ayTAEX9khtjsi4KQNPNZz6+kkjoszE9uQl2L2TXIK9m4/Hbpz8f3LN3szgDTNddR7q3qxras2XtV2U8F4B0KiLNZ3X6PGmbc/JrbQKCj0gz5R6ES8eYnJsMo6ro9VQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 614144BA2E3D Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4806f3fc50bso32592805e9.0 for ; Sat, 21 Feb 2026 04:20:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771676412; x=1772281212; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=oVWLWUsrNc9Lp80eyb22eeaDhFu0dhRvjHiPpUpxfzQ=; b=VCDWHgZDy5+tll47081LCWWSqp5WqTB0atg1M969cCIsH1U/Tv438pg0PQTHhBhqWB cU8fnN6GryNYgRvh3zSwE5C5z0E2+14hVij4qy3cv7RVWqhRPVqOhAIM2YLvxnZKD0Az PXLrjBjSvUcL2BY32H0ui1HXOl8dp6r+hF0ibCAaJofk9LSG8APx2o3dXvaFEIw9FP5u D3N4jHBkJ5mAYSKmksxGRYctcdR8o1/8hgl/avkn+xKlQdbQ81Vet9uWh0cGUkDRo2gB 8fPGYE1iMrkGa8RGgChQVhsiT1/PsqKpMNAVxmWJfNO/QpztnsCoyRxGXI1gj54PhZr7 zrGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771676412; x=1772281212; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oVWLWUsrNc9Lp80eyb22eeaDhFu0dhRvjHiPpUpxfzQ=; b=PK4+CgOjmcxHTT+xE7C+Na7sgD852nKMP4EK7EmfwYzENbSWbDA1XQ0Sez2yfQyssl Sjf015yvjiuBarwvUOTTd0t/3IC0Wyi629afaUOXyOAbYKSAjryh41yIddCo4Ivqxz1x 4oRyJJSM7vBrYXuqDvUfpdJdhAOGZg08hLzn4cmO7wEkiI1B1w5at5F9i0/iyuXPWhaK wJ9AVCRDH8EN5YnegjAnSPs9OYv64nQhoE6fimdEhH5yOrpBVOpSAoSRdEXUSt5TqL27 Wg23iAiL9g4xI85zLVBRy/OfTqpxU/6T7woIaLnkDe88MFcaT53joSjPpcUeFIulR5zQ cLfg== X-Forwarded-Encrypted: i=1; AJvYcCXzBH2ELMWo3kiGtDXLT8nGUw5X/AV9FwbgTleJrutSefUFUvv0m3+MZjrEldrXFEms2BMx9bT06fZ2qA==@sourceware.org X-Gm-Message-State: AOJu0YwOTgJ1K4A6n92NNzpxcDT4eA7aOqRW5wsNA3XvvhY2Fue9XZjR pmBdbYAN4oK3mPn0uWsLPsAAGh6gKDSGpUvhXNnzmAixbKIE4otm0H1I9Cww8Q== X-Gm-Gg: AZuq6aJt4poAQ1i6AzoRlIIbQUsNBiCdHV4B6cRvvJjEBpoQjKOHTimN2b/HX91AxqI 7dwFodXHYuifq51IqRqJLoyp1anp2fb/8I7aBHkF06i5wtitMrMqxuzayN0lWIR2+iyH27rIEof ObKXTmHX60ewfdGMw+X5A43naiItMjjDAsinjq59XzcRdQtlRbG/FPyf0cQIBKNji6o6ug5xNKW Xr3aBQekrQ6a1U4wUngNYOMdbfzvGr5nZQ4+IVg3ABxuMowLRCCeMhqidt7mq+c5JizLXgtc9vA 3OGKx4eokXJqTsZQqRklNSgSAgI9/CtjGwdmZzwafzztTTpFKomtue9lvL4S7pRaYnWloXpVlLD 6+JPtYZwZfnycQGUvMMNazfjUtVqViGhr7RLiiZ6JVRWqjuvqWtkAk3g2lcd5EtyuwGVZhGQJYG J3x6ZGHdRiDiaBqkhXlBZfqTc4Huz2O/miYMLB X-Received: by 2002:a05:600c:6217:b0:47b:de05:aa28 with SMTP id 5b1f17b1804b1-483a95eb4d5mr48135085e9.2.1771676412152; Sat, 21 Feb 2026 04:20:12 -0800 (PST) Received: from [192.168.0.38] ([86.12.216.189]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970c00c18sm4939556f8f.14.2026.02.21.04.20.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 Feb 2026 04:20:11 -0800 (PST) Message-ID: <094e3fe6-ea89-47c9-8e30-dbcd11a2b329@gmail.com> Date: Sat, 21 Feb 2026 12:20:10 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 3/4] GDB: aarch64-linux: Move definition of struct user_gcs Content-Language: en-US To: Thiago Jung Bauermann , gdb-patches@sourceware.org Cc: Chris Packham , Tom Tromey , Simon Marchi References: <20260217060106.1906312-1-thiago.bauermann@linaro.org> <20260217060106.1906312-4-thiago.bauermann@linaro.org> From: Luis In-Reply-To: <20260217060106.1906312-4-thiago.bauermann@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 17/02/2026 06:01, Thiago Jung Bauermann wrote: > Only native code should use struct user_gcs, so its definition should be > in a native-specific file and not in a file under gdb/arch/. > > To fix this problem, create gdb/nat/aarch64-gcs-linux-ptrace.h and move > the struct user_gcs definition to it, as suggested by Luis. > > To fix the use of struct user_gcs in gdb/aarch64-linuxt-dep.c, define a > macro with the size of the GCS regset in gdb/arch/aarch64-gcs-linux.h > and use it in aarch64-linux-tdep.c, as is done for other regsets and > following a suggestion from Simon Marchi. > > Suggested-by: Luis > Suggested-by: Simon Marchi > --- > Changes since v2: > - Don't rename gdb/arch/aarch64-gcs-linux.h to gdb/arch/aarch64-linux.h, > as suggested by Luis. > - Create gdb/nat/aarch64-gcs-linux-ptrace.h to contain definition of > struct user_gcs, as suggested by Luis. > - Don't rename HWCAP_GCS to AARCH64_HWCAP_GCS, as suggested by Luis. > - Move definition of AARCH64_LINUX_SIZEOF_GCS_REGSET from > gdb/aarch64-linux-tdep.h to gdb/arch/aarch64-gcs-linux.h, as suggested > by Luis. > - Move changes to HWCAP_PACA to separate patch. > > gdb/Makefile.in | 1 + > gdb/aarch64-linux-nat.c | 1 + > gdb/aarch64-linux-tdep.c | 5 ++-- > gdb/arch/aarch64-gcs-linux.h | 17 ++----------- > gdb/nat/aarch64-gcs-linux-ptrace.h | 40 ++++++++++++++++++++++++++++++ > gdbserver/linux-aarch64-low.cc | 1 + > 6 files changed, 48 insertions(+), 17 deletions(-) > create mode 100644 gdb/nat/aarch64-gcs-linux-ptrace.h > > diff --git a/gdb/Makefile.in b/gdb/Makefile.in > index f0f10e3946bf..0ac45bd9d326 100644 > --- a/gdb/Makefile.in > +++ b/gdb/Makefile.in > @@ -1550,6 +1550,7 @@ HFILES_NO_SRCDIR = \ > nat/aarch64-hw-point.h \ > nat/aarch64-linux.h \ > nat/aarch64-linux-hw-point.h \ > + nat/aarch64-gcs-linux-ptrace.h \ > nat/aarch64-mte-linux-ptrace.h \ > nat/aarch64-scalable-linux-ptrace.h \ > nat/aarch64-scalable-linux-sigcontext.h \ > diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c > index 9f85d96b59ef..a49b82ca43c8 100644 > --- a/gdb/aarch64-linux-nat.c > +++ b/gdb/aarch64-linux-nat.c > @@ -34,6 +34,7 @@ > #include "arch/arm.h" > #include "nat/aarch64-linux.h" > #include "nat/aarch64-linux-hw-point.h" > +#include "nat/aarch64-gcs-linux-ptrace.h" > #include "nat/aarch64-scalable-linux-ptrace.h" > > #include "elf/external.h" > diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c > index c17ccbc66220..f0935cbd67e8 100644 > --- a/gdb/aarch64-linux-tdep.c > +++ b/gdb/aarch64-linux-tdep.c > @@ -1736,8 +1736,9 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, > gcs_regmap, regcache_supply_regset, regcache_collect_regset > }; > > - cb (".reg-aarch-gcs", sizeof (user_gcs), sizeof (user_gcs), > - &aarch64_linux_gcs_regset, "GCS registers", cb_data); > + cb (".reg-aarch-gcs", AARCH64_LINUX_SIZEOF_GCS_REGSET, > + AARCH64_LINUX_SIZEOF_GCS_REGSET, &aarch64_linux_gcs_regset, > + "GCS registers", cb_data); > } > } > > diff --git a/gdb/arch/aarch64-gcs-linux.h b/gdb/arch/aarch64-gcs-linux.h > index b31fc32daa03..015a49b25976 100644 > --- a/gdb/arch/aarch64-gcs-linux.h > +++ b/gdb/arch/aarch64-gcs-linux.h > @@ -20,25 +20,12 @@ > #ifndef GDB_ARCH_AARCH64_GCS_LINUX_H > #define GDB_ARCH_AARCH64_GCS_LINUX_H > > -#include > - > /* Feature check for Guarded Control Stack. */ > #ifndef HWCAP_GCS > #define HWCAP_GCS (1ULL << 32) > #endif > > -/* Make sure we only define these if the kernel header doesn't. */ > -#ifndef GCS_MAGIC > - > -/* GCS state (NT_ARM_GCS). */ > - > -struct user_gcs > -{ > - uint64_t features_enabled; > - uint64_t features_locked; > - uint64_t gcspr_el0; > -}; > - > -#endif /* GCS_MAGIC */ > +/* The GCS regset consists of 3 64-bit registers. */ > +#define AARCH64_LINUX_SIZEOF_GCS_REGSET (3 * 8) > > #endif /* GDB_ARCH_AARCH64_GCS_LINUX_H */ > diff --git a/gdb/nat/aarch64-gcs-linux-ptrace.h b/gdb/nat/aarch64-gcs-linux-ptrace.h > new file mode 100644 > index 000000000000..f45a1059cd0a > --- /dev/null > +++ b/gdb/nat/aarch64-gcs-linux-ptrace.h > @@ -0,0 +1,40 @@ > +/* Common native Linux definitions for AArch64 Guarded Control Stack. > + > + Copyright (C) 2025-2026 Free Software Foundation, Inc. > + > + This file is part of GDB. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +#ifndef GDB_NAT_AARCH64_GCS_LINUX_PTRACE_H > +#define GDB_NAT_AARCH64_GCS_LINUX_PTRACE_H > + > +#include > +#include > + > +/* Make sure we only define these if the kernel header doesn't. */ > +#ifndef GCS_MAGIC > + > +/* GCS state (NT_ARM_GCS). */ > + > +struct user_gcs > +{ > + uint64_t features_enabled; > + uint64_t features_locked; > + uint64_t gcspr_el0; > +}; > + > +#endif /* GCS_MAGIC */ > + > +#endif /* GDB_NAT_AARCH64_GCS_LINUX_PTRACE_H */ > diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc > index 6b61f6d5a815..55e55b2df0ab 100644 > --- a/gdbserver/linux-aarch64-low.cc > +++ b/gdbserver/linux-aarch64-low.cc > @@ -45,6 +45,7 @@ > #include "arch/aarch64-scalable-linux.h" > #include "linux-aarch32-tdesc.h" > #include "linux-aarch64-tdesc.h" > +#include "nat/aarch64-gcs-linux-ptrace.h" > #include "nat/aarch64-mte-linux-ptrace.h" > #include "arch/aarch64-pauth-linux.h" > #include "nat/aarch64-scalable-linux-ptrace.h" Thanks. Also OK. Approved-By: Luis Machado