From: Thiago Jung Bauermann Date: Thu, 4 Sep 2025 16:50:44 +0000 (-0300) Subject: GDB: aarch64-linux: Define HWCAP_GCS as unsigned long long value X-Git-Tag: gdb-17-branchpoint~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11d649801563e8ee26b8f0c227c115bca55abc0c;p=thirdparty%2Fbinutils-gdb.git GDB: aarch64-linux: Define HWCAP_GCS as unsigned long long value 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 --- diff --git a/gdb/arch/aarch64-gcs-linux.h b/gdb/arch/aarch64-gcs-linux.h index 922c779d139..018ca37a522 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 77672047556..f3362cb1eb4 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 3d895350ae4..754fda1edba 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 95518b68bd7..c062feaba7a 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 39519e46705..9eb2e9eaa96 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 5ba1c9059d0..fe4178ebba7 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) {