From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UWqNJs2hmWltBwQAWB0awg (envelope-from ) for ; Sat, 21 Feb 2026 07:15:09 -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=B0lRItY5; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 980811E0BA; Sat, 21 Feb 2026 07:15:09 -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 83A861E089 for ; Sat, 21 Feb 2026 07:15:08 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 31ED74B9DB61 for ; Sat, 21 Feb 2026 12:15:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31ED74B9DB61 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=B0lRItY5 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id CA61A4BA23EF for ; Sat, 21 Feb 2026 12:14:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA61A4BA23EF 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 CA61A4BA23EF Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::431 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771676081; cv=none; b=uxuwjk/jqJLi2jJ09q4y1kKG15vs6mVXdxRN7jRxNgtpxzz7+iSSbTBxFhEUa2z5zCgwkGLJNrW9hDhKFG8u610DIG8D1jALLTiVkp6USMjPcwlGZN1QyDHxPOOkOZIW3oFPEbNk+JHq4xhlErP/3Lwy7lJ4Hi+6H/NWqSOiCVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771676081; c=relaxed/simple; bh=JhIJ+/HdDB8Iyc3t9XISheb0KnC29glegU4kJFrp/8I=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=ChmrMBn7llDYBpSoXioCl70rK9CLzT9VVfMqnUdqDyPuS3uInPIMEQjUoJwnmSpoNfXsBHGdPR+dy6bZV/4K2jU9V2qEHbKkrqXg2GGIjGOARoKoNsgs36I4RyExQ+3xbP/J0+N10TaYryPwVFa936p9cZbZFuPqhRpG2dI4AHs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA61A4BA23EF Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-43621bf67ceso1911401f8f.2 for ; Sat, 21 Feb 2026 04:14:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771676080; x=1772280880; 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=EUlHPiHymEiN0qJ0NzJJ353b2qCAvPp+MhOsKApt1ms=; b=B0lRItY5Y7cmoMjh1ylkxVpU+mQL+JOsv7sROB+BUCWCDnQfITqDS/wU9FIrvTYfK4 cQAOWL1ztfYHwLhxTPH13pVY0qJ4DeqQXtjNKv6ox1p2naMh3K3aiDGbYm6MjH/nGqm4 ChTaxUWBxUElxR9fBXUmR6JLzU1/d47QIfJqRYFa58Nn/qvkCpDs3Xs6oL6Ew6LcZ+AZ iCzczRpeY+2igJjp0+VO2flboY1DtkPaB13w9E2QhhPJ9jSWIHrZl/3YcRoG815HVgk+ 0nJTDyfCru1CcCtMkZ0a1QWxFtKTUhRvUJs6i3KCaDhwYZK0ymZQgwSm4q1zPMaCugEy kI5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771676080; x=1772280880; 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=EUlHPiHymEiN0qJ0NzJJ353b2qCAvPp+MhOsKApt1ms=; b=b5qQgOSX5kntoJMahIGoAnYqFiyZdls11C4JT6C5wEC8G+ZNsbYOuORDPFe062mXp9 UjinXc9I5qaOSd59PgY16rhkr1LU49OGnAsnbVFHIXm9OrqB4ztiKZ1YvOSKFsuvQ5oG BUcaDtaHEHsr+u+NXrduA+syQzBa0NR1ICqtj7SyBdD2xM4Fb+NFAlvwPW/jHjkopOrt tITApMH2lI5L7xvnLtFlOaeJ159DJ4SgI/7H8u+yqvZBYQSs1qSfe4fMNeok9F03NXiY V42VTtwQ0mURNFstfagny82Uey3vvnhIYMXfoi+dTOJUybnr87H6aZKRclYIB0zNpppT 87HA== X-Forwarded-Encrypted: i=1; AJvYcCWYpyou7rfsMTkk3vncbSWVyypSVQjYg8bRENkYVOpGWiaw0jVOmr2y6eQh0oJ1rsrUQa9odrHEfANdfA==@sourceware.org X-Gm-Message-State: AOJu0YxEjh+SAzJhRXZtKPUZKRsn3/BCQAIa5bdCgrwTdDEJt2X5QKIT CvtzQn2al4l6i26Sgvp5p786tmbRKG5o2eMF7pmHRWhb3VqdFm1HpEfI X-Gm-Gg: AZuq6aLsZs9PY8/IBwTz2te/KuIXPEPUi5oIYQoNVlChwLNgKGwDmCytN6oPhs8ZG/5 kQtW39Fy5WMF+W55ta5EfeAiA4zNPtBl7zvG1nru4ltFByBNmc/P9/glRQJ6W8U8cYnNoI0QiO+ 0TL45BVWg/HsSox9h4qKSyqm7diBLRTytqqS4225GbzeaEO9mYg2lQjRzKFKC6N3habgCtdJ4fY PJuO4BVRlQ/FsSMYEfu6sYwb4Pn2hhhZct/S8qRMWOkJj+mWCqrHlfdmq28Sz/XKDImderep2yR uwj7AvL7Jv4s6CHrLIQnw0flX8jTwCh1IGrfN+6TW3lrAaFvOVqAnF9kx1+znwImrQRSEj+z/7I d9kobCnEUzg/xSZBScAXKVhVt6kQFfGwTsVsZ8aAcxaS6CtJLMu/rbYz+c0412apewuA6wpcLEq +iZBNJc0FKhH/3VceS37j27wDaQWpW3yEshD3A X-Received: by 2002:a05:6000:40ca:b0:435:9e81:105a with SMTP id ffacd0b85a97d-4396f15b31cmr6085802f8f.20.1771676079380; Sat, 21 Feb 2026 04:14:39 -0800 (PST) Received: from [192.168.0.38] ([86.12.216.189]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d3fdd0sm5588485f8f.19.2026.02.21.04.14.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 Feb 2026 04:14:38 -0800 (PST) Message-ID: <201211e6-3061-4b7d-8e0c-6a9875922bcd@gmail.com> Date: Sat, 21 Feb 2026 12:14:37 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/4] GDB: Add gdb/arch/aarch64-pauth-linux.h 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-2-thiago.bauermann@linaro.org> From: Luis In-Reply-To: <20260217060106.1906312-2-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:00, Thiago Jung Bauermann wrote: > The code supporting Pointer Authentication duplicates the definition of > AARCH64_HWCAP_PACA and of AARCH64_LINUX_SIZEOF_PAUTH between GDB and > gdbserver, so add new header to host those definitions. > > Also, rename AARCH64_HWCAP_PACA to HWCAP_PACA and only define it if it > isn't already defined by the system headers, as is done for other HWCAP > constants. > > Suggested-by: Luis > --- > gdb/Makefile.in | 1 + > gdb/aarch64-linux-nat.c | 3 ++- > gdb/aarch64-linux-tdep.c | 3 ++- > gdb/aarch64-linux-tdep.h | 6 ------ > gdb/arch/aarch64-pauth-linux.h | 31 +++++++++++++++++++++++++++++++ > gdb/arch/aarch64.h | 3 --- > gdbserver/linux-aarch64-low.cc | 8 +++----- > 7 files changed, 39 insertions(+), 16 deletions(-) > create mode 100644 gdb/arch/aarch64-pauth-linux.h > > diff --git a/gdb/Makefile.in b/gdb/Makefile.in > index 2aa95be968ac..8f8a95beccc3 100644 > --- a/gdb/Makefile.in > +++ b/gdb/Makefile.in > @@ -1306,6 +1306,7 @@ HFILES_NO_SRCDIR = \ > arch/aarch64-insn.h \ > arch/aarch64-mte.h \ > arch/aarch64-mte-linux.h \ > + arch/aarch64-pauth-linux.h \ > arch/aarch64-scalable-linux.h \ > arch/amd64.h \ > arch/amd64-linux-tdesc.h \ > diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c > index 028de981588b..d310d3e814b2 100644 > --- a/gdb/aarch64-linux-nat.c > +++ b/gdb/aarch64-linux-nat.c > @@ -53,6 +53,7 @@ > > #include "arch/aarch64-gcs-linux.h" > #include "arch/aarch64-mte-linux.h" > +#include "arch/aarch64-pauth-linux.h" > > #include "nat/aarch64-mte-linux-ptrace.h" > #include "arch/aarch64-scalable-linux.h" > @@ -1012,7 +1013,7 @@ aarch64_linux_nat_target::read_description () > or the streaming vector length, depending on whether streaming mode is > active or not. */ > features.vq = aarch64_sve_get_vq (tid); > - features.pauth = hwcap & AARCH64_HWCAP_PACA; > + features.pauth = hwcap & HWCAP_PACA; > features.gcs = features.gcs_linux = hwcap & HWCAP_GCS; > features.mte = hwcap2 & HWCAP2_MTE; > features.tls = aarch64_tls_register_count (tid); > diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c > index b85c25ecae1d..b5af281d8a40 100644 > --- a/gdb/aarch64-linux-tdep.c > +++ b/gdb/aarch64-linux-tdep.c > @@ -54,6 +54,7 @@ > #include "arch/aarch64-gcs-linux.h" > #include "arch/aarch64-mte.h" > #include "arch/aarch64-mte-linux.h" > +#include "arch/aarch64-pauth-linux.h" > #include "arch/aarch64-scalable-linux.h" > > #include "arch-utils.h" > @@ -1760,7 +1761,7 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch, > have the correct target description with the correct SVE vector > length. */ > features.vq = aarch64_linux_core_read_vq_from_sections (gdbarch, abfd); > - features.pauth = hwcap & AARCH64_HWCAP_PACA; > + features.pauth = hwcap & HWCAP_PACA; > features.gcs = features.gcs_linux = hwcap & HWCAP_GCS; > features.mte = hwcap2 & HWCAP2_MTE; > features.fpmr = hwcap2 & HWCAP2_FPMR; > diff --git a/gdb/aarch64-linux-tdep.h b/gdb/aarch64-linux-tdep.h > index e926687ff6eb..b99fe91f36bd 100644 > --- a/gdb/aarch64-linux-tdep.h > +++ b/gdb/aarch64-linux-tdep.h > @@ -33,16 +33,10 @@ > alignment. */ > #define AARCH64_LINUX_SIZEOF_FPREGSET (33 * V_REGISTER_SIZE) > > -/* The pauth regset consists of 2 X sized registers. */ > -#define AARCH64_LINUX_SIZEOF_PAUTH (2 * X_REGISTER_SIZE) > - > /* The MTE regset consists of a 64-bit register. */ > #define AARCH64_LINUX_SIZEOF_MTE_REGSET (8) > > extern const struct regset aarch64_linux_gregset; > extern const struct regset aarch64_linux_fpregset; > > -/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */ > -#define AARCH64_HWCAP_PACA (1 << 30) > - > #endif /* GDB_AARCH64_LINUX_TDEP_H */ > diff --git a/gdb/arch/aarch64-pauth-linux.h b/gdb/arch/aarch64-pauth-linux.h > new file mode 100644 > index 000000000000..e973c79c8767 > --- /dev/null > +++ b/gdb/arch/aarch64-pauth-linux.h > @@ -0,0 +1,31 @@ > +/* Common Linux target-dependent definitions for AArch64 PAuth. > + > + Copyright (C) 2019-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_ARCH_AARCH64_PAUTH_LINUX_H > +#define GDB_ARCH_AARCH64_PAUTH_LINUX_H > + > +/* Feature check for Pointer Authentication Code Extension. */ > +#ifndef HWCAP_PACA > +#define HWCAP_PACA (1 << 30) > +#endif > + > +/* The pauth regset consists of 2 64-bit registers. */ > +#define AARCH64_LINUX_SIZEOF_PAUTH 16 > + > +#endif /* GDB_ARCH_AARCH64_PAUTH_LINUX_H */ > diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h > index 0e9715a4268a..7856d95a93b1 100644 > --- a/gdb/arch/aarch64.h > +++ b/gdb/arch/aarch64.h > @@ -178,9 +178,6 @@ enum aarch64_regnum > #define AARCH64_PAUTH_DMASK_HIGH_REGNUM(pauth_reg_base) (pauth_reg_base + 2) > #define AARCH64_PAUTH_CMASK_HIGH_REGNUM(pauth_reg_base) (pauth_reg_base + 3) > > -/* This size is only meant for Linux, not bare metal. QEMU exposes 4 masks. */ > -#define AARCH64_PAUTH_REGS_SIZE (16) > - > #define AARCH64_X_REGS_NUM 31 > #define AARCH64_V_REGS_NUM 32 > #define AARCH64_SVE_Z_REGS_NUM AARCH64_V_REGS_NUM > diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc > index b19e605f55d6..69aaabc1a8f9 100644 > --- a/gdbserver/linux-aarch64-low.cc > +++ b/gdbserver/linux-aarch64-low.cc > @@ -45,6 +45,7 @@ > #include "linux-aarch32-tdesc.h" > #include "linux-aarch64-tdesc.h" > #include "nat/aarch64-mte-linux-ptrace.h" > +#include "arch/aarch64-pauth-linux.h" > #include "nat/aarch64-scalable-linux-ptrace.h" > #include "tdesc.h" > > @@ -952,7 +953,7 @@ aarch64_adjust_register_sets (const struct aarch64_features &features) > break; > case NT_ARM_PAC_MASK: > if (features.pauth) > - regset->size = AARCH64_PAUTH_REGS_SIZE; > + regset->size = AARCH64_LINUX_SIZEOF_PAUTH; > break; > case NT_ARM_TAGGED_ADDR_CTRL: > if (features.mte) > @@ -984,9 +985,6 @@ aarch64_adjust_register_sets (const struct aarch64_features &features) > } > } > > -/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */ > -#define AARCH64_HWCAP_PACA (1 << 30) > - > /* Implementation of linux target ops method "low_arch_setup". */ > > void > @@ -1005,7 +1003,7 @@ aarch64_target::low_arch_setup () > > features.vq = aarch64_sve_get_vq (tid); > /* A-profile PAC is 64-bit only. */ > - features.pauth = linux_get_hwcap (pid, 8) & AARCH64_HWCAP_PACA; > + features.pauth = linux_get_hwcap (pid, 8) & HWCAP_PACA; > /* A-profile MTE is 64-bit only. */ > features.mte = linux_get_hwcap2 (pid, 8) & HWCAP2_MTE; > features.tls = aarch64_tls_register_count (tid); Thanks for the cleanup. This one is OK. Approved-By: Luis Machado