From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id AR/OA59spmlM0hEAWB0awg (envelope-from ) for ; Tue, 03 Mar 2026 00:07:43 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=GxtB9BG6; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id F23131E0DD; Tue, 03 Mar 2026 00:07:42 -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,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 DBB7E1E08D for ; Tue, 03 Mar 2026 00:07:41 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 667704BA2E13 for ; Tue, 3 Mar 2026 05:07:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 667704BA2E13 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=GxtB9BG6 Received: from mail-dl1-x1232.google.com (mail-dl1-x1232.google.com [IPv6:2607:f8b0:4864:20::1232]) by sourceware.org (Postfix) with ESMTPS id ED09C4BA2E1C for ; Tue, 3 Mar 2026 05:06:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ED09C4BA2E1C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ED09C4BA2E1C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1232 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772514410; cv=none; b=cMoSHvNWz0yRTbWzZUHmqlh2eoIyuggp2QfefX9x41VRGkqXQ44ES7b30YGAZi2MUcIkEAlkFROKxSL1l/RpAKAMSvXPV0r++o6AD0kM6DTw5jokSrD9mNoqlrmB8QnQ4yYXnBz9K3546xJsVJgB4ZKLTA1bYAh18f5NKrlFxqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772514410; c=relaxed/simple; bh=rrnPKAVMHjn+xX6ciO1JSytmVihLA910qxbwpsHvnB8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=OvretcuaGKblEg0fzLGP8syEOXlyRV3WH/yKYXm4h5xjOZuSaHVYY2i9huWYxW9uDC3zjyH8zL0Xa44frdAoyhj8MF6RCVQFaBWQWZwnRbEHR9yvqX2g18ZN6++ddJmS7UsZgFJANl+w7JnylgoNkdjohrdtDBreKutL4/OOtLY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED09C4BA2E1C Received: by mail-dl1-x1232.google.com with SMTP id a92af1059eb24-12758ce1e8dso841062c88.0 for ; Mon, 02 Mar 2026 21:06:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772514409; x=1773119209; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rMHMzmpaGnV/TOqoFncCY4yu7Z0P9ui99xWwEXESNcI=; b=GxtB9BG6VzEJbMoY3uDVgltI2X3OD74o9B6T5g4RD96r4YmmXRtiklCWi1fRPUaVCV 4ULlilquJ4in8GsX46ZR+lmWl8K9usLFU971C3i5zXTEG/0+xf5fPzP2ANTvQlmUot5y GxNOV4YY8Y6GQXCY8RM9UNqdReFpdLxqChoUAUkY6KhDileQK4DAQnGxFxJ/6IY7rSrI yAKDy9CEf771n6D3KZo8cJyMtEjdhpFepkitx8nz4i9di3pNBe3ziK3B0fj8sb896hoP o1pYV2mh/rCFpymJuJ8Nu0BdRVE3XQz7aNnYA5GgkmPO7rCOvhzTQDjTm3Og+G16oIQ7 wJ1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772514409; x=1773119209; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rMHMzmpaGnV/TOqoFncCY4yu7Z0P9ui99xWwEXESNcI=; b=VLMYEFQqjTX0EA9Bdj5Z5Xxlism2YY7fafBHVmzRr/VtFOKv8NUgSmdHG1uVXqMGft IPj4aObFBw+W4TzVt4EvuOW+9HnBBno8H1xHZM6MQJXc7GegwVDj3W5LrkSqe6MEx6/I Ltshm9Hbg0utb+3YGQc7omGa1tSdYZ3PeI3qGnjPKPhu3Lwrw+j8A9WEWh6h8Ekt5PvX cM8dNVTDh1+AkcnMzSaN9m6Vy7BpDwEoRHzTNzo57BYLr6hEfFZFY+/vVy2LNhION5Pk cl5MUKlnaWk2R4+K62zH9F/b8glcpj9mnb0btAvYBTa+VsoqACUgcCXxuibQkjBL9Z2j 9uAQ== X-Gm-Message-State: AOJu0Yy+zejp0ZkVcS//uhpXZXVbYFnWlI+Q7eUueNklCCyOOcFT+CgD POmWREib8vczw/q9x4IBGqEcPwkFN0oZBRtn+COeM2AHIiTDwpULboL7BEQuncS+VoSzmB5VxDT bkMu7YMY= X-Gm-Gg: ATEYQzxcnvDHBC43EAiSM2V/Npikzyj+bgVICxBeVCPCm3V7xo88+VSN/HqaQp7H0Kt 2r1KqBiVZxelKO95/aPh6zhGUmE1XW9E4X9m/wD6dmSSfAXjTWnBOfb+VkoVfe3VveEhbqIPXt8 CXjE2Wmn6w92ItoMzp+K3f5kWW/BXCBdvLBd4OKE1niYl5Br5ubctO7kGde3OsR5+dtk0i8+LSO IpTJLDmu6mmYhCtDLJN/WUh885yiSZO64PMMmDjl+6DkUYbi0g+XW2czaTxe9aNpxu2WDDyfPRC dg5FYSGQHehHvz6kS9kymJWSjoLHv5azeDj9mVet9zKrK/Mq8lKCRafJDV1HNdcukv9FNNQCYY/ 0NvNotY2q8KyfUuK7/Nt1sTZpCFsa7wzsT9pA+6kdPKO3zkhiPf1kfsF3rhQgHhLl46F1YXxbxp 3Tx88BGeL0W4bBUY2DIGe9kWachLynir0C9w== X-Received: by 2002:a05:7022:4590:b0:11b:c4ee:66b with SMTP id a92af1059eb24-1278fd6e09bmr7251665c88.37.1772514408624; Mon, 02 Mar 2026 21:06:48 -0800 (PST) Received: from localhost ([2804:14d:7e39:8083:f04c:42e3:5943:38f6]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2be204146bcsm1118106eec.18.2026.03.02.21.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Mar 2026 21:06:48 -0800 (PST) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Cc: Chris Packham , Luis , Tom Tromey , Simon Marchi , sunilkumar.dora@windriver.com Subject: [PATCH v4 2/6] GDB: Add aarch64-fpmr-linux.h to gdb/arch/ and gdb/nat/ Date: Tue, 3 Mar 2026 02:06:37 -0300 Message-ID: <20260303050641.198127-3-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260303050641.198127-1-thiago.bauermann@linaro.org> References: <20260303050641.198127-1-thiago.bauermann@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 GDB conditionally defines HWCAP2_FPMR in gdb/arch/aarch64.h, but that's not the best place for it since it's a Linux-specific definition. Add new Linux- and feature-specific headers to contain it, one for target-dependent code and the other for native code. The target-dependant code should use AARCH64_HWCAP2_FPRM in gdb/arch/aarch64-pauth-linux.h while native code should use HWCAP2_FPRM, which will hopefully be defined by the system headers but with a backup definition in gdb/nat/aarch64-pauth-linux.h if it isn't. Suggested-by: Luis Suggested-by: Simon Marchi --- Changes since v3: - Also create gdb/nat/aarch64-fpmr-linux.h header. - Add AARCH64_HWCAP2_FPMR and use it in gdb/aarch64-linux-tdep.c. gdb/Makefile.in | 2 ++ gdb/aarch64-linux-nat.c | 1 + gdb/aarch64-linux-tdep.c | 3 ++- gdb/arch/aarch64-fpmr-linux.h | 26 ++++++++++++++++++++++++++ gdb/arch/aarch64.h | 5 ----- gdb/nat/aarch64-fpmr-linux.h | 28 ++++++++++++++++++++++++++++ gdbserver/linux-aarch64-low.cc | 1 + 7 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 gdb/arch/aarch64-fpmr-linux.h create mode 100644 gdb/nat/aarch64-fpmr-linux.h diff --git a/gdb/Makefile.in b/gdb/Makefile.in index a412f3b3c592..3d9bc86a97fd 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1301,6 +1301,7 @@ HFILES_NO_SRCDIR = \ amdgpu-tdep.h \ annotate.h \ arch/aarch32.h \ + arch/aarch64-fpmr-linux.h \ arch/aarch64-gcs-linux.h \ arch/aarch64.h \ arch/aarch64-insn.h \ @@ -1546,6 +1547,7 @@ HFILES_NO_SRCDIR = \ mn10300-tdep.h \ moxie-tdep.h \ namespace.h \ + nat/aarch64-fpmr-linux.h \ nat/aarch64-hw-point.h \ nat/aarch64-linux.h \ nat/aarch64-linux-hw-point.h \ diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index f64cc0a97d88..81a46ee1f0d0 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -32,6 +32,7 @@ #include "aarch32-linux-nat.h" #include "aarch32-tdep.h" #include "arch/arm.h" +#include "nat/aarch64-fpmr-linux.h" #include "nat/aarch64-linux.h" #include "nat/aarch64-linux-hw-point.h" #include "nat/aarch64-pauth-linux.h" diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index d3d4c9e1de38..504e4126f1bc 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -51,6 +51,7 @@ #include "record-full.h" #include "linux-record.h" +#include "arch/aarch64-fpmr-linux.h" #include "arch/aarch64-gcs-linux.h" #include "arch/aarch64-mte.h" #include "arch/aarch64-mte-linux.h" @@ -1764,7 +1765,7 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch, features.pauth = hwcap & AARCH64_HWCAP_PACA; features.gcs = features.gcs_linux = hwcap & HWCAP_GCS; features.mte = hwcap2 & HWCAP2_MTE; - features.fpmr = hwcap2 & HWCAP2_FPMR; + features.fpmr = hwcap2 & AARCH64_HWCAP2_FPMR; /* Handle the TLS section. */ asection *tls = bfd_get_section_by_name (abfd, ".reg-aarch-tls"); diff --git a/gdb/arch/aarch64-fpmr-linux.h b/gdb/arch/aarch64-fpmr-linux.h new file mode 100644 index 000000000000..5495cf8c0018 --- /dev/null +++ b/gdb/arch/aarch64-fpmr-linux.h @@ -0,0 +1,26 @@ +/* Common Linux target-dependent definitions for AArch64 FPMR. + + 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_ARCH_AARCH64_FPMR_LINUX_H +#define GDB_ARCH_AARCH64_FPMR_LINUX_H + +/* Feature check for Floating Point Mode Register. */ +#define AARCH64_HWCAP2_FPMR (1ULL << 48) + +#endif /* GDB_ARCH_AARCH64_FPMR_LINUX_H */ diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h index 7856d95a93b1..c9a89ac40986 100644 --- a/gdb/arch/aarch64.h +++ b/gdb/arch/aarch64.h @@ -243,9 +243,4 @@ enum aarch64_regnum /* Size of the SME2 ZT0 register in bytes. */ #define AARCH64_SME2_ZT0_SIZE 64 -/* Feature check for Floating Point Mode Register. */ -#ifndef HWCAP2_FPMR -#define HWCAP2_FPMR (1ULL << 48) -#endif /* HWCAP2_FPMR */ - #endif /* GDB_ARCH_AARCH64_H */ diff --git a/gdb/nat/aarch64-fpmr-linux.h b/gdb/nat/aarch64-fpmr-linux.h new file mode 100644 index 000000000000..bb0243a89396 --- /dev/null +++ b/gdb/nat/aarch64-fpmr-linux.h @@ -0,0 +1,28 @@ +/* Common Linux native definitions for AArch64 FPMR. + + 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_FPMR_LINUX_H +#define GDB_NAT_AARCH64_FPMR_LINUX_H + +/* Feature check for Floating Point Mode Register. */ +#ifndef HWCAP2_FPMR +#define HWCAP2_FPMR (1ULL << 48) +#endif /* HWCAP2_FPMR */ + +#endif /* GDB_NAT_AARCH64_FPMR_LINUX_H */ diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc index 07ddfb324466..a6439943e855 100644 --- a/gdbserver/linux-aarch64-low.cc +++ b/gdbserver/linux-aarch64-low.cc @@ -46,6 +46,7 @@ #include "arch/aarch64-scalable-linux.h" #include "linux-aarch32-tdesc.h" #include "linux-aarch64-tdesc.h" +#include "nat/aarch64-fpmr-linux.h" #include "nat/aarch64-mte-linux-ptrace.h" #include "nat/aarch64-scalable-linux-ptrace.h" #include "tdesc.h"