From 11d649801563e8ee26b8f0c227c115bca55abc0c Mon Sep 17 00:00:00 2001 From: Thiago Jung Bauermann Date: Thu, 4 Sep 2025 13:50:44 -0300 Subject: GDB: aarch64-linux: Define HWCAP_GCS as unsigned long long value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On platforms where long is 32 bits, this change fixes a build failure: /home/linux/arm/gdb/src/gdb/aarch64-linux-tdep.c: In function ‘const target_desc* aarch64_linux_core_read_description(gdbarch*, target_ops*, bfd*)’: /home/linux/arm/gdb/src/gdb/arch/aarch64-gcs-linux.h:27:24: error: left shift count >= width of type [-Werror=shift-count-overflow] 27 | #define HWCAP_GCS (1UL << 32) | ~~~~^~~~~ /home/linux/arm/gdb/src/gdb/aarch64-linux-tdep.c:1714:47: note: in expansion of macro ‘HWCAP_GCS’ 1714 | features.gcs = features.gcs_linux = hwcap & HWCAP_GCS; | ^~~~~~~~~ Suggested-by: Tom de Vries Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33372 --- gdb/arch/aarch64-gcs-linux.h | 2 +- gdb/testsuite/gdb.arch/aarch64-gcs-core.c | 2 +- gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.c | 2 +- gdb/testsuite/gdb.arch/aarch64-gcs-return.c | 2 +- gdb/testsuite/gdb.arch/aarch64-gcs.c | 2 +- gdb/testsuite/lib/gdb.exp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gdb/arch/aarch64-gcs-linux.h b/gdb/arch/aarch64-gcs-linux.h index 922c779..018ca37 100644 --- a/gdb/arch/aarch64-gcs-linux.h +++ b/gdb/arch/aarch64-gcs-linux.h @@ -24,7 +24,7 @@ /* Feature check for Guarded Control Stack. */ #ifndef HWCAP_GCS -#define HWCAP_GCS (1UL << 32) +#define HWCAP_GCS (1ULL << 32) #endif /* Make sure we only define these if the kernel header doesn't. */ diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-core.c b/gdb/testsuite/gdb.arch/aarch64-gcs-core.c index 7767204..f3362cb 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs-core.c +++ b/gdb/testsuite/gdb.arch/aarch64-gcs-core.c @@ -23,7 +23,7 @@ /* Feature check for Guarded Control Stack. */ #ifndef HWCAP_GCS -#define HWCAP_GCS (1UL << 32) +#define HWCAP_GCS (1ULL << 32) #endif #ifndef PR_GET_SHADOW_STACK_STATUS diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.c b/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.c index 3d89535..754fda1 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.c +++ b/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.c @@ -23,7 +23,7 @@ /* Feature check for Guarded Control Stack. */ #ifndef HWCAP_GCS -#define HWCAP_GCS (1UL << 32) +#define HWCAP_GCS (1ULL << 32) #endif #ifndef PR_GET_SHADOW_STACK_STATUS diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-return.c b/gdb/testsuite/gdb.arch/aarch64-gcs-return.c index 95518b6..c062fea 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs-return.c +++ b/gdb/testsuite/gdb.arch/aarch64-gcs-return.c @@ -23,7 +23,7 @@ /* Feature check for Guarded Control Stack. */ #ifndef HWCAP_GCS -#define HWCAP_GCS (1UL << 32) +#define HWCAP_GCS (1ULL << 32) #endif #ifndef PR_GET_SHADOW_STACK_STATUS diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs.c b/gdb/testsuite/gdb.arch/aarch64-gcs.c index 39519e4..9eb2e9e 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs.c +++ b/gdb/testsuite/gdb.arch/aarch64-gcs.c @@ -24,7 +24,7 @@ /* Feature check for Guarded Control Stack. */ #ifndef HWCAP_GCS -#define HWCAP_GCS (1UL << 32) +#define HWCAP_GCS (1ULL << 32) #endif #ifndef PR_GET_SHADOW_STACK_STATUS diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 5ba1c90..fe4178e 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5351,7 +5351,7 @@ gdb_caching_proc allow_aarch64_gcs_tests {} { /* Feature check for Guarded Control Stack. */ #ifndef HWCAP_GCS - #define HWCAP_GCS (1UL << 32) + #define HWCAP_GCS (1ULL << 32) #endif int main (void) { -- cgit v1.1