https://gcc.gnu.org/g:e3d2277d519ae75cf91980151abefc76cd25d6ce

commit r16-7916-ge3d2277d519ae75cf91980151abefc76cd25d6ce
Author: Alice Carlotti <[email protected]>
Date:   Wed Mar 4 14:58:21 2026 +0000

    aarch64 libgcc: Fix mingw build [PR124333]
    
    Make __aarch64_cpu_features unconditionally available.  This permits the
    unconditional use of this global inside __arm_get_current_vg, which was
    introduced in r16-7637-g41b4a73f370116.
    
    For now this global is only initialised when <sys/auxv.h> is available,
    but we can extend this in future to support other ways of initialising
    the bits used for SME support, and use this remove __aarch64_have_sme.
    This approach was recently adopted by LLVM.
    
    This patch does introduce an inconsistency with __aarch64_have_sme when
    <sys/auxv.h> is unavailable.  However, this doesn't introduce any
    regressions, because one of the following conditions will hold:
    
    1. SVE is enabled at compile time whenever we use a streaming or
    streaming compatible function.  In this case the compiler won't need to
    use __arm_get_current_vg, so it doesn't matter if it gives the wrong
    answer.
    
    2. There is a use of a streaming or streaming compatible function when
    we don't know whether SVE is enabled.  In order to get correct DWARF
    unwind information, we then have to be able to test for SVE availability
    at runtime.  This isn't possible until a working __arm_get_current_vg
    implementation is available, so the configuration has never (yet) been
    supported.
    
    libgcc/ChangeLog:
    
            PR target/124333
            * config/aarch64/cpuinfo.c: Define __aarch64_cpu_features
            unconditionally.

Diff:
---
 libgcc/config/aarch64/cpuinfo.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/libgcc/config/aarch64/cpuinfo.c b/libgcc/config/aarch64/cpuinfo.c
index 849c67fdc3b9..93d9491f7a48 100644
--- a/libgcc/config/aarch64/cpuinfo.c
+++ b/libgcc/config/aarch64/cpuinfo.c
@@ -24,6 +24,13 @@
 
 #include "common/config/aarch64/cpuinfo.h"
 
+/* Architecture features used in Function Multi Versioning, and also in some
+   SME support routines.  */
+struct {
+  unsigned long long features;
+  /* As features grows new fields could be added.  */
+} __aarch64_cpu_features __attribute__((visibility("hidden"), nocommon));
+
 #if __has_include(<sys/auxv.h>)
 #include <sys/auxv.h>
 
@@ -40,12 +47,6 @@ typedef struct __ifunc_arg_t {
   unsigned long _hwcap4;
 } __ifunc_arg_t;
 
-/* Architecture features used in Function Multi Versioning.  */
-struct {
-  unsigned long long features;
-  /* As features grows new fields could be added.  */
-} __aarch64_cpu_features __attribute__((visibility("hidden"), nocommon));
-
 #define _IFUNC_ARG_HWCAP (1ULL << 62)
 #define AT_HWCAP 16
 #define AT_HWCAP2 26

Reply via email to