Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jun 2026 19:00:00 +0000
From:      Lorenzo Salvadore <salvadore@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 6931d2c01673 - main - lang/gcc17-devel: Fix build on arm64
Message-ID:  <6a304bb0.24471.15aa8268@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by salvadore:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6931d2c01673c154dcc5459cafb5058f73740f63

commit 6931d2c01673c154dcc5459cafb5058f73740f63
Author:     Lorenzo Salvadore <salvadore@FreeBSD.org>
AuthorDate: 2026-05-09 14:36:12 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2026-06-15 18:57:48 +0000

    lang/gcc17-devel: Fix build on arm64
    
    GCC upstream has removed conditional definitions for some constants,
    defining them directly with the same values used on Linux. However,
    FreeBSD values for the same constants are different. Then revert
    upstream commit.
    
    Co-authored-by: Mark Millard <marklmi26-fbsd@yahoo.com>
    PR:             294062
    Reported by:    Luke Yasuda <jing@jing.rocks>
---
 lang/gcc17-devel/files/patch-libcxxrt              |   4 +-
 .../files/patch-libgcc_config_aarch64_cpuinfo.c    | 273 +++++++++++++++++++++
 2 files changed, 275 insertions(+), 2 deletions(-)

diff --git a/lang/gcc17-devel/files/patch-libcxxrt b/lang/gcc17-devel/files/patch-libcxxrt
index 4225df7aad1e..260094f0100c 100644
--- a/lang/gcc17-devel/files/patch-libcxxrt
+++ b/lang/gcc17-devel/files/patch-libcxxrt
@@ -5,9 +5,9 @@ different C++ ABIs is not supported unless subset via DT_FILTER.
 https://github.com/llvm/llvm-project/commit/35479ffb1251
 https://github.com/freebsd/freebsd-src/commit/cf56074e5271
 
---- gcc/cp/g++spec.cc.orig	2022-07-31 22:32:16 UTC
+--- gcc/cp/g++spec.cc.orig	2026-06-12 11:06:15 UTC
 +++ gcc/cp/g++spec.cc
-@@ -60,7 +60,7 @@ along with GCC; see the file COPYING3.  If not see
+@@ -62,7 +62,7 @@ along with GCC; see the file COPYING3.  If not see
  #endif
  
  #ifndef LIBCXXABI
diff --git a/lang/gcc17-devel/files/patch-libgcc_config_aarch64_cpuinfo.c b/lang/gcc17-devel/files/patch-libgcc_config_aarch64_cpuinfo.c
new file mode 100644
index 000000000000..0d82769f7293
--- /dev/null
+++ b/lang/gcc17-devel/files/patch-libgcc_config_aarch64_cpuinfo.c
@@ -0,0 +1,273 @@
+Revert upstream commit a6bb693.
+That commit removed conditional definitions for some constants and
+enforced them to haved the same values than on Linux. But we are on
+FreeBSD: ABI is different.
+
+See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294062 for details.
+
+--- libgcc/config/aarch64/cpuinfo.c.orig	2026-05-03 15:39:45 UTC
++++ libgcc/config/aarch64/cpuinfo.c
+@@ -47,61 +47,208 @@ typedef struct __ifunc_arg_t {
+   unsigned long _hwcap4;
+ } __ifunc_arg_t;
+ 
++#if __has_include(<asm/hwcap.h>)
++#include <asm/hwcap.h>
++
++#ifndef _IFUNC_ARG_HWCAP
+ #define _IFUNC_ARG_HWCAP (1ULL << 62)
++#endif
++#ifndef AT_HWCAP
+ #define AT_HWCAP 16
++#endif
++#ifndef HWCAP_FP
++#define HWCAP_FP (1 << 0)
++#endif
++#ifndef HWCAP_ASIMD
++#define HWCAP_ASIMD (1 << 1)
++#endif
++#ifndef HWCAP_EVTSTRM
++#define HWCAP_EVTSTRM (1 << 2)
++#endif
++#ifndef HWCAP_AES
++#define HWCAP_AES (1 << 3)
++#endif
++#ifndef HWCAP_PMULL
++#define HWCAP_PMULL (1 << 4)
++#endif
++#ifndef HWCAP_SHA1
++#define HWCAP_SHA1 (1 << 5)
++#endif
++#ifndef HWCAP_SHA2
++#define HWCAP_SHA2 (1 << 6)
++#endif
++#ifndef HWCAP_CRC32
++#define HWCAP_CRC32 (1 << 7)
++#endif
++#ifndef HWCAP_ATOMICS
++#define HWCAP_ATOMICS (1 << 8)
++#endif
++#ifndef HWCAP_FPHP
++#define HWCAP_FPHP (1 << 9)
++#endif
++#ifndef HWCAP_ASIMDHP
++#define HWCAP_ASIMDHP (1 << 10)
++#endif
++#ifndef HWCAP_CPUID
++#define HWCAP_CPUID (1 << 11)
++#endif
++#ifndef HWCAP_ASIMDRDM
++#define HWCAP_ASIMDRDM (1 << 12)
++#endif
++#ifndef HWCAP_JSCVT
++#define HWCAP_JSCVT (1 << 13)
++#endif
++#ifndef HWCAP_FCMA
++#define HWCAP_FCMA (1 << 14)
++#endif
++#ifndef HWCAP_LRCPC
++#define HWCAP_LRCPC (1 << 15)
++#endif
++#ifndef HWCAP_DCPOP
++#define HWCAP_DCPOP (1 << 16)
++#endif
++#ifndef HWCAP_SHA3
++#define HWCAP_SHA3 (1 << 17)
++#endif
++#ifndef HWCAP_SM3
++#define HWCAP_SM3 (1 << 18)
++#endif
++#ifndef HWCAP_SM4
++#define HWCAP_SM4 (1 << 19)
++#endif
++#ifndef HWCAP_ASIMDDP
++#define HWCAP_ASIMDDP (1 << 20)
++#endif
++#ifndef HWCAP_SHA512
++#define HWCAP_SHA512 (1 << 21)
++#endif
++#ifndef HWCAP_SVE
++#define HWCAP_SVE (1 << 22)
++#endif
++#ifndef HWCAP_ASIMDFHM
++#define HWCAP_ASIMDFHM (1 << 23)
++#endif
++#ifndef HWCAP_DIT
++#define HWCAP_DIT (1 << 24)
++#endif
++#ifndef HWCAP_ILRCPC
++#define HWCAP_ILRCPC (1 << 26)
++#endif
++#ifndef HWCAP_FLAGM
++#define HWCAP_FLAGM (1 << 27)
++#endif
++#ifndef HWCAP_SSBS
++#define HWCAP_SSBS (1 << 28)
++#endif
++#ifndef HWCAP_SB
++#define HWCAP_SB (1 << 29)
++#endif
++#ifndef HWCAP_PACA
++#define HWCAP_PACA (1 << 30)
++#endif
++#ifndef HWCAP_PACG
++#define HWCAP_PACG (1UL << 31)
++#endif
++
++#ifndef AT_HWCAP2
+ #define AT_HWCAP2 26
++#endif
++#ifndef HWCAP2_DCPODP
++#define HWCAP2_DCPODP (1 << 0)
++#endif
++#ifndef HWCAP2_SVE2
++#define HWCAP2_SVE2 (1 << 1)
++#endif
++#ifndef HWCAP2_SVEAES
++#define HWCAP2_SVEAES (1 << 2)
++#endif
++#ifndef HWCAP2_SVEPMULL
++#define HWCAP2_SVEPMULL (1 << 3)
++#endif
++#ifndef HWCAP2_SVEBITPERM
++#define HWCAP2_SVEBITPERM (1 << 4)
++#endif
++#ifndef HWCAP2_SVESHA3
++#define HWCAP2_SVESHA3 (1 << 5)
++#endif
++#ifndef HWCAP2_SVESM4
++#define HWCAP2_SVESM4 (1 << 6)
++#endif
++#ifndef HWCAP2_FLAGM2
++#define HWCAP2_FLAGM2 (1 << 7)
++#endif
++#ifndef HWCAP2_FRINT
++#define HWCAP2_FRINT (1 << 8)
++#endif
++#ifndef HWCAP2_SVEI8MM
++#define HWCAP2_SVEI8MM (1 << 9)
++#endif
++#ifndef HWCAP2_SVEF32MM
++#define HWCAP2_SVEF32MM (1 << 10)
++#endif
++#ifndef HWCAP2_SVEF64MM
++#define HWCAP2_SVEF64MM (1 << 11)
++#endif
++#ifndef HWCAP2_SVEBF16
++#define HWCAP2_SVEBF16 (1 << 12)
++#endif
++#ifndef HWCAP2_I8MM
++#define HWCAP2_I8MM (1 << 13)
++#endif
++#ifndef HWCAP2_BF16
++#define HWCAP2_BF16 (1 << 14)
++#endif
++#ifndef HWCAP2_DGH
++#define HWCAP2_DGH (1 << 15)
++#endif
++#ifndef HWCAP2_RNG
++#define HWCAP2_RNG (1 << 16)
++#endif
++#ifndef HWCAP2_BTI
++#define HWCAP2_BTI (1 << 17)
++#endif
++#ifndef HWCAP2_MTE
++#define HWCAP2_MTE (1 << 18)
++#endif
++#ifndef HWCAP2_RPRES
++#define HWCAP2_RPRES (1 << 21)
++#endif
++#ifndef HWCAP2_MTE3
++#define HWCAP2_MTE3 (1 << 22)
++#endif
++#ifndef HWCAP2_SME
++#define HWCAP2_SME (1 << 23)
++#endif
++#ifndef HWCAP2_SME_I16I64
++#define HWCAP2_SME_I16I64 (1 << 24)
++#endif
++#ifndef HWCAP2_SME_F64F64
++#define HWCAP2_SME_F64F64 (1 << 25)
++#endif
++#ifndef HWCAP2_WFXT
++#define HWCAP2_WFXT (1UL << 31)
++#endif
++#ifndef HWCAP2_EBF16
++#define HWCAP2_EBF16 (1UL << 32)
++#endif
++#ifndef HWCAP2_SVE_EBF16
++#define HWCAP2_SVE_EBF16 (1UL << 33)
++#endif
++#ifndef HWCAP2_SME2
++#define HWCAP2_SME2 (1UL << 37)
++#endif
++#ifndef HWCAP2_LRCPC3
++#define HWCAP2_LRCPC3	(1UL << 46)
++#endif
++
++#ifndef AT_HWCAP3
+ #define AT_HWCAP3 29
++#endif
++
++#ifndef AT_HWCAP4
+ #define AT_HWCAP4 30
++#endif
+ 
+-#define HWCAP_FP		(1 << 0)
+-#define HWCAP_ASIMD		(1 << 1)
+-#define HWCAP_PMULL		(1 << 4)
+-#define HWCAP_SHA2		(1 << 6)
+-#define HWCAP_CRC32		(1 << 7)
+-#define HWCAP_ATOMICS		(1 << 8)
+-#define HWCAP_FPHP		(1 << 9)
+-#define HWCAP_ASIMDHP		(1 << 10)
+-#define HWCAP_ASIMDRDM		(1 << 12)
+-#define HWCAP_JSCVT		(1 << 13)
+-#define HWCAP_FCMA		(1 << 14)
+-#define HWCAP_LRCPC		(1 << 15)
+-#define HWCAP_DCPOP		(1 << 16)
+-#define HWCAP_SHA3		(1 << 17)
+-#define HWCAP_SM3		(1 << 18)
+-#define HWCAP_SM4		(1 << 19)
+-#define HWCAP_ASIMDDP		(1 << 20)
+-#define HWCAP_SVE		(1 << 22)
+-#define HWCAP_ASIMDFHM		(1 << 23)
+-#define HWCAP_DIT		(1 << 24)
+-#define HWCAP_ILRCPC		(1 << 26)
+-#define HWCAP_FLAGM		(1 << 27)
+-#define HWCAP_SSBS		(1 << 28)
+-#define HWCAP_SB		(1 << 29)
+-
+-#define HWCAP2_DCPODP		(1 << 0)
+-#define HWCAP2_SVE2		(1 << 1)
+-#define HWCAP2_SVEPMULL		(1 << 3)
+-#define HWCAP2_SVEBITPERM	(1 << 4)
+-#define HWCAP2_SVESHA3		(1 << 5)
+-#define HWCAP2_SVESM4		(1 << 6)
+-#define HWCAP2_FLAGM2		(1 << 7)
+-#define HWCAP2_FRINT		(1 << 8)
+-#define HWCAP2_SVEF32MM		(1 << 10)
+-#define HWCAP2_SVEF64MM		(1 << 11)
+-#define HWCAP2_I8MM		(1 << 13)
+-#define HWCAP2_BF16		(1 << 14)
+-#define HWCAP2_RNG		(1 << 16)
+-#define HWCAP2_BTI		(1 << 17)
+-#define HWCAP2_MTE		(1 << 18)
+-#define HWCAP2_SME		(1 << 23)
+-#define HWCAP2_SME_I16I64	(1 << 24)
+-#define HWCAP2_SME_F64F64	(1 << 25)
+-#define HWCAP2_WFXT		(1UL << 31)
+-#define HWCAP2_CSSC		(1UL << 34)
+-#define HWCAP2_SME2		(1UL << 37)
+-#define HWCAP2_MOPS		(1UL << 43)
+-#define HWCAP2_LRCPC3		(1UL << 46)
+-
+ #define __IFUNC_ARG_SIZE_HWCAP2 (sizeof (unsigned long) * 3)
+ #define __IFUNC_ARG_SIZE_HWCAP3 (sizeof (unsigned long) * 4)
+ #define __IFUNC_ARG_SIZE_HWCAP4 (sizeof (unsigned long) * 5)
+@@ -258,4 +405,5 @@ __init_cpu_features(void)
+ #undef getCPUFeature
+ #undef setCPUFeature
+ }
++#endif /* __has_include(<asm/hwcap.h>)  */
+ #endif /* __has_include(<sys/auxv.h>)  */


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a304bb0.24471.15aa8268>