summaryrefslogtreecommitdiff
path: root/lang/gcc10
diff options
context:
space:
mode:
authormrg <mrg@pkgsrc.org>2021-04-24 09:35:31 +0000
committermrg <mrg@pkgsrc.org>2021-04-24 09:35:31 +0000
commit334f49bcfb18a109c4a2de096184f66026a93d5e (patch)
tree9b6c75ac75a9542f64267884dd734dd6f0c712eb /lang/gcc10
parent36bd8eb29b013bc2fd8620f03f97de8e3c2727df (diff)
downloadpkgsrc-334f49bcfb18a109c4a2de096184f66026a93d5e.tar.gz
pull in fixes for arm64eb from netbsd src.
Diffstat (limited to 'lang/gcc10')
-rw-r--r--lang/gcc10/distinfo5
-rw-r--r--lang/gcc10/patches/patch-gcc_config.gcc236
-rw-r--r--lang/gcc10/patches/patch-gcc_config_aarch64_aarch64-netbsd.h18
-rw-r--r--lang/gcc10/patches/patch-gcc_config_aarch64_driver-aarch64.c184
4 files changed, 442 insertions, 1 deletions
diff --git a/lang/gcc10/distinfo b/lang/gcc10/distinfo
index 4d1731cff4d..b8955094a95 100644
--- a/lang/gcc10/distinfo
+++ b/lang/gcc10/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.7 2021/04/16 15:03:42 ryoon Exp $
+$NetBSD: distinfo,v 1.8 2021/04/24 09:35:31 mrg Exp $
SHA1 (gcc-10.3.0.tar.xz) = fb51ed1660c065898c75951fb38e1ebad7d49feb
RMD160 (gcc-10.3.0.tar.xz) = 8edb715cf1159fd8de773d0d5208d2e83ca36402
@@ -11,8 +11,11 @@ Size (isl-0.16.1.tar.bz2) = 1626446 bytes
SHA1 (patch-contrib_download__prerequisites) = 9cdcde21ab174052911447d20762ddfd40aa8791
SHA1 (patch-fixincludes_inclhack.def) = 7b00974d3f52a8364190a607f52a5d7e8a6db41a
SHA1 (patch-gcc_Makefile.in) = c0f97c75ba1d37eae894141edd58bb36b734f651
+SHA1 (patch-gcc_config.gcc) = 6523fd234687e13abd54009a770f1c0acbcd62c7
SHA1 (patch-gcc_config.host) = 8920ce841f6088b365c9b590e3ea9535bd880b40
SHA1 (patch-gcc_config_aarch64_aarch64-builtins.c) = 87185f5c2e2dbe4195cb19fe6213d2d616d5519b
+SHA1 (patch-gcc_config_aarch64_aarch64-netbsd.h) = abf19e2445bce1773162bddef16cd7f41eb36827
+SHA1 (patch-gcc_config_aarch64_driver-aarch64.c) = 7e17b49924ddd9ff33d049d6539e4df77d14d3e5
SHA1 (patch-gcc_config_sparc_sparc.c) = e9cb956f3769642bcd0ba4a477d16c73dea46014
SHA1 (patch-gcc_configure) = 6a2d8eeeed2bf08c3c81291178e669dc91c913ce
SHA1 (patch-gcc_ggc-common.c) = 3e325767922ab7d2079fdb9a3d6b6aa531a2fea5
diff --git a/lang/gcc10/patches/patch-gcc_config.gcc b/lang/gcc10/patches/patch-gcc_config.gcc
new file mode 100644
index 00000000000..b2b44ad1f8c
--- /dev/null
+++ b/lang/gcc10/patches/patch-gcc_config.gcc
@@ -0,0 +1,236 @@
+$NetBSD: patch-gcc_config.gcc,v 1.1 2021/04/24 09:35:31 mrg Exp $
+
+Match what is in NetBSD src. Fixes at least aarch64eb, and
+probably several others.
+
+--- gcc/config.gcc.orig 2021-04-08 04:56:28.033740243 -0700
++++ gcc/config.gcc 2021-04-24 00:16:20.082096330 -0700
+@@ -462,6 +462,16 @@
+ cpu_type=m32r
+ extra_options="${extra_options} g.opt"
+ ;;
++m5200-*-*|m5407-*-*)
++ cpu_type=m68k
++ extra_headers=math-68881.h
++ extra_options="${extra_options} m68k/m68k-tables.opt"
++ ;;
++m680[012]0-*-*)
++ cpu_type=m68k
++ extra_headers=math-68881.h
++ extra_options="${extra_options} m68k/m68k-tables.opt"
++ ;;
+ m68k-*-*)
+ extra_headers=math-68881.h
+ extra_options="${extra_options} m68k/m68k-tables.opt"
+@@ -877,6 +887,11 @@
+ case ${enable_threads} in
+ "" | yes | posix) thread_file='posix' ;;
+ esac
++ case ${target} in
++ arm*-* | i[34567]86-* | powerpc*-* | sparc*-* | x86_64-*)
++ default_gnu_indirect_function=yes
++ ;;
++ esac
+ nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h"
+ default_use_cxa_atexit=yes
+ target_has_targetdm=yes
+@@ -1111,6 +1126,11 @@
+ tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-netbsd.h"
+ tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-netbsd"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++ case $target in
++ aarch64_be-*)
++ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
++ ;;
++ esac
+ ;;
+ aarch64*-*-linux*)
+ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h"
+@@ -1252,7 +1272,6 @@
+ with_tls=${with_tls:-gnu}
+ ;;
+ arm*-*-netbsdelf*)
+- target_cpu_cname="strongarm"
+ tmake_file="${tmake_file} arm/t-arm"
+ tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+@@ -1261,26 +1280,33 @@
+ esac
+ case ${target} in
+ arm*-*-netbsdelf-*eabi*)
+- tm_file="$tm_file arm/bpabi.h arm/netbsd-elf.h arm/netbsd-eabi.h"
+- tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi"
++ tm_file="${tm_file} arm/bpabi.h arm/netbsd-elf.h arm/netbsd-eabi.h"
++ # GCC 7 vs NetBSD/eabi -> avoid arm unwinder
++ #tmake_file="$tmake_file arm/t-bpabi"
++ tmake_file="$tmake_file arm/t-netbsdeabi"
++ # The EABI requires the use of __cxa_atexit.
++ default_use_cxa_atexit=yes
+ ;;
+ *)
+- tm_file="$tm_file arm/netbsd-elf.h"
++ tm_file="$tm_file arm/bpabi.h arm/netbsd-elf.h"
++ #tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi"
+ tmake_file="$tmake_file arm/t-netbsd"
+ ;;
+ esac
+ tm_file="${tm_file} arm/aout.h arm/arm.h"
+ case ${target} in
+ arm*-*-netbsdelf-*eabihf*)
+- # Hard-float requires at least Arm v5te
+- target_cpu_cname="arm10e"
+ tm_defines="${tm_defines} TARGET_DEFAULT_FLOAT_ABI=ARM_FLOAT_ABI_HARD"
+ ;;
+ esac
+ case ${target} in
+- armv6*) target_cpu_cname="arm1176jzf-s";;
+- armv7*) target_cpu_cname="generic-armv7-a";;
++ armv4*) with_cpu=${with_cpu:-strongarm};;
++ armv6*) with_cpu=${with_cpu:-arm1176jzf-s};;
++ armv7*) with_cpu=${with_cpu:-cortex-a8};;
++ arm*eabihf*) with_cpu=${with_cpu:-arm10e};;
++ arm*) with_cpu=${with_cpu:-arm9e};;
+ esac
++ target_cpu_cname="$with_cpu"
+ ;;
+ arm*-*-linux-* | arm*-*-uclinuxfdpiceabi)
+ tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
+@@ -1928,6 +1954,7 @@
+ ;;
+ x86_64-*-netbsd*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${nbsd_tm_file} i386/x86-64.h i386/netbsd64.h"
++ tmake_file="${tmake_file} i386/t-netbsd64"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+ ;;
+ i[34567]86-*-openbsd*)
+@@ -2250,6 +2277,16 @@
+ target_cpu_default="${target_cpu_default}|MASK_GNU_LD"
+ fi
+ ;;
++ia64*-*-netbsd*)
++ tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file} ia64/sysv4.h ia64/netbsd.h"
++ target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
++ tmake_file="${tmake_file} ia64/t-ia64"
++ if test x$with_system_libunwind != xyes ; then
++ tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
++ fi
++ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
++ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++ ;;
+ ia64*-*-freebsd*)
+ tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} ia64/sysv4.h ia64/freebsd.h"
+ target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
+@@ -2362,8 +2399,25 @@
+ ;;
+ esac
+ ;;
+-m68k*-*-netbsdelf*)
++m68010-*-netbsdelf* | m68k-*-netbsdelf* | m5407-*-netbsdelf*)
+ default_m68k_cpu=68020
++ case ${target} in
++ m5407*)
++ with_arch=${with_arch:-cf}
++ target_cpu_default="mcf5475"
++# target="`echo ${target} | sed 's/m68kcf/m68k/'`"
++ ;;
++ m68010*)
++ target_cpu_default="m68010"
++ tmake_file="${tmake_file} m68k/t-m68kelf m68k/t-m68010-netbsd"
++ default_m68k_cpu=68010
++ tmake_file="${tmake_file} m68k/t-floatlib"
++ ;;
++ *)
++ with_arch=${with_arch:-m68k}
++ tmake_file="${tmake_file} m68k/t-floatlib"
++ ;;
++ esac
+ default_cf_cpu=5475
+ tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file} m68k/netbsd-elf.h"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+@@ -2503,6 +2557,26 @@
+ # automatically detect that GAS supports it, yet we require it.
+ gcc_cv_initfini_array=yes
+ ;;
++riscv*-*-netbsd*) # NetBSD RISC-V
++ tm_file="elfos.h ${tm_file} ${nbsd_tm_file} riscv/netbsd.h"
++ tm_defines="${tm_defines} CHAR_FAST8=1 SHORT_FAST16=1"
++ case ${target} in
++ riscv32*) tm_defines="${tm_defines} TARGET_64BIT_DEFAULT=0" ;;
++ *) tmake_file="${tmake_file} riscv/t-netbsd64" ;;
++ esac
++ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++ tmake_file="${tmake_file} riscv/t-riscv"
++ gnu_ld=yes
++ gas=yes
++ gcc_cv_initfini_array=yes
++ ;;
++mips64*-*-netbsd*) # NetBSD/mips64, either endian.
++ target_cpu_default="MASK_ABICALLS|MASK_FLOAT64|MASK_SOFT_FLOAT_ABI"
++ tm_file="elfos.h ${tm_file} mips/elf.h ${nbsd_tm_file} mips/netbsd.h mips/netbsd64.h"
++ tmake_file="${tmake_file} mips/t-netbsd64"
++ tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
++ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++ ;;
+ mips*-*-netbsd*) # NetBSD/mips, either endian.
+ target_cpu_default="MASK_ABICALLS"
+ tm_file="elfos.h ${tm_file} mips/elf.h ${nbsd_tm_file} mips/netbsd.h"
+@@ -2918,11 +2992,24 @@
+ ;;
+ esac
+ ;;
+-powerpc-*-netbsd*)
+- tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h ${nbsd_tm_file} freebsd-spec.h rs6000/sysv4.h rs6000/netbsd.h"
++powerpc*-*-netbsd*)
++ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h ${nbsd_tm_file} freebsd-spec.h"
++ case ${target} in
++ powerpc64*)
++ tm_file="rs6000/biarch64.h ${tm_file}"
++ tm_file="${tm_file} rs6000/sysv4.h rs6000/default64.h rs6000/netbsd64.h"
++ tmake_file="${tmake_file} rs6000/t-netbsd64"
++ ;;
++ *)
++ tm_file="${tm_file} rs6000/sysv4.h rs6000/netbsd.h"
++ tmake_file="${tmake_file} rs6000/t-netbsd"
++ ;;
++ esac
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+- tmake_file="${tmake_file} rs6000/t-netbsd"
+- extra_options="${extra_options} rs6000/sysv4.opt"
++ extra_options="${extra_options} rs6000/sysv4.opt rs6000/linux64.opt"
++ if test x${enable_secureplt} != xno; then
++ tm_file="rs6000/secureplt.h ${tm_file}"
++ fi
+ ;;
+ powerpc-*-eabisimaltivec*)
+ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/eabisim.h rs6000/eabialtivec.h"
+@@ -3394,9 +3481,11 @@
+ sparc64-*-netbsd*)
+ tm_file="sparc/biarch64.h ${tm_file}"
+ tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h ${nbsd_tm_file} sparc/netbsd-elf.h"
++ tm_file="${tm_file} sparc/default64.h"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+ extra_options="${extra_options} sparc/long-double-switch.opt"
+ tmake_file="${tmake_file} sparc/t-sparc sparc/t-netbsd64"
++ with_cpu=ultrasparc
+ ;;
+ sparc64-*-openbsd*)
+ tm_file="sparc/openbsd1-64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp64-elf.h"
+@@ -3911,6 +4000,9 @@
+ frv550-*-*linux*)
+ with_cpu=fr550
+ ;;
++ m5200-*-*|m5407-*-*)
++ with_cpu=${default_cf_cpu}
++ ;;
+ m68k*-*-*)
+ case "$with_arch" in
+ "cf")
+@@ -4421,7 +4513,7 @@
+ esac
+ ;;
+
+- fido-*-* | m68k*-*-*)
++ fido-*-* | m68k*-*-* | m5200-*-* | m5407-*-*)
+ supported_defaults="arch cpu"
+ case "$with_arch" in
+ "" | "m68k"| "cf")
diff --git a/lang/gcc10/patches/patch-gcc_config_aarch64_aarch64-netbsd.h b/lang/gcc10/patches/patch-gcc_config_aarch64_aarch64-netbsd.h
new file mode 100644
index 00000000000..c94f2cbd373
--- /dev/null
+++ b/lang/gcc10/patches/patch-gcc_config_aarch64_aarch64-netbsd.h
@@ -0,0 +1,18 @@
+$NetBSD: patch-gcc_config_aarch64_aarch64-netbsd.h,v 1.1 2021/04/24 09:35:31 mrg Exp $
+
+Match what is in NetBSD src. Fixes at least aarch64eb, and
+probably several others.
+
+--- gcc/config/aarch64/aarch64-netbsd.h.orig 2021-04-08 04:56:28.033740243 -0700
++++ gcc/config/aarch64/aarch64-netbsd.h 2021-04-24 00:16:41.451665444 -0700
+@@ -20,6 +20,10 @@
+ #ifndef GCC_AARCH64_NETBSD_H
+ #define GCC_AARCH64_NETBSD_H
+
++/* NetBSD malloc(3) does 64, not 128 bytes. */
++#undef MALLOC_ABI_ALIGNMENT
++#define MALLOC_ABI_ALIGNMENT 64
++
+ #define TARGET_LINKER_BIG_EMULATION "aarch64nbsdb"
+ #define TARGET_LINKER_LITTLE_EMULATION "aarch64nbsd"
+
diff --git a/lang/gcc10/patches/patch-gcc_config_aarch64_driver-aarch64.c b/lang/gcc10/patches/patch-gcc_config_aarch64_driver-aarch64.c
new file mode 100644
index 00000000000..f0f2bfef5f4
--- /dev/null
+++ b/lang/gcc10/patches/patch-gcc_config_aarch64_driver-aarch64.c
@@ -0,0 +1,184 @@
+$NetBSD: patch-gcc_config_aarch64_driver-aarch64.c,v 1.1 2021/04/24 09:35:31 mrg Exp $
+
+Match what is in NetBSD src. Fixes at least aarch64eb, and
+probably several others.
+
+--- gcc/config/aarch64/driver-aarch64.c.orig 2021-04-08 04:56:28.041740341 -0700
++++ gcc/config/aarch64/driver-aarch64.c 2021-04-24 00:16:45.471750258 -0700
+@@ -25,6 +25,7 @@
+ #include "system.h"
+ #include "coretypes.h"
+ #include "tm.h"
++#include "diagnostic-core.h"
+
+ /* Defined in common/config/aarch64/aarch64-common.c. */
+ std::string aarch64_get_extension_string_for_isa_flags (uint64_t, uint64_t);
+@@ -244,6 +245,14 @@
+ ARGC and ARGV are set depending on the actual arguments given
+ in the spec. */
+
++#ifdef __NetBSD__
++/* The NetBSD/arm64 platform may not export linux-style /proc/cpuinfo,
++ but the data is available via a sysctl(3) interface. */
++#include <sys/param.h>
++#include <sys/sysctl.h>
++#include <aarch64/armreg.h>
++#endif
++
+ const char *
+ host_detect_local_cpu (int argc, const char **argv)
+ {
+@@ -282,6 +291,7 @@
+ if (!arch && !tune && !cpu)
+ goto not_found;
+
++#ifndef __NetBSD__
+ fcpu_info = getenv ("GCC_CPUINFO");
+ if (fcpu_info)
+ f = fopen (fcpu_info, "r");
+@@ -374,6 +384,145 @@
+
+ fclose (f);
+ f = NULL;
++#else
++ unsigned int curcpu;
++ size_t len;
++ char impl_buf[8];
++ int mib[2], ncpu;
++
++ mib[0] = CTL_HW;
++ mib[1] = HW_NCPU;
++ len = sizeof(ncpu);
++ if (sysctl(mib, 2, &ncpu, &len, NULL, 0) == -1)
++ goto not_found;
++
++ for (curcpu = 0; curcpu < ncpu; curcpu++)
++ {
++ char path[128];
++ struct aarch64_sysctl_cpu_id id;
++
++ len = sizeof id;
++ snprintf(path, sizeof path, "machdep.cpu%d.cpu_id", curcpu);
++ if (sysctlbyname(path, &id, &len, NULL, 0) != 0)
++ goto not_found;
++
++ unsigned cimp = __SHIFTOUT(id.ac_midr, MIDR_EL1_IMPL);
++ if (cimp == INVALID_IMP)
++ goto not_found;
++
++ if (imp == INVALID_IMP)
++ imp = cimp;
++ /* FIXME: BIG.little implementers are always equal. */
++ else if (imp != cimp)
++ goto not_found;
++
++ unsigned cvariant = __SHIFTOUT(id.ac_midr, MIDR_EL1_VARIANT);
++ if (!contains_core_p (variants, cvariant))
++ {
++ if (n_variants == 2)
++ goto not_found;
++
++ variants[n_variants++] = cvariant;
++ }
++
++ unsigned ccore = __SHIFTOUT(id.ac_midr, MIDR_EL1_PARTNUM);
++ if (!contains_core_p (cores, ccore))
++ {
++ if (n_cores == 2)
++ goto not_found;
++
++ cores[n_cores++] = ccore;
++ }
++
++ if (!tune && !processed_exts)
++ {
++ std::string exts;
++
++ /* These are all the extensions from aarch64-option-extensions.def. */
++ if (__SHIFTOUT(id.ac_aa64pfr0, ID_AA64PFR0_EL1_FP) == ID_AA64PFR0_EL1_FP_IMPL)
++ exts += "fp ";
++ if (__SHIFTOUT(id.ac_aa64pfr0, ID_AA64PFR0_EL1_ADVSIMD) == ID_AA64PFR0_EL1_ADV_SIMD_IMPL)
++ exts += "asimd ";
++#ifdef ID_AA64ISAR0_EL1_RDM
++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_RDM) == ID_AA64ISAR0_EL1_RDM_SQRDML)
++ exts += "asimdrdm ";
++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_DP) == ID_AA64ISAR0_EL1_DP_UDOT)
++ exts += "asimddp ";
++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_FHM) == ID_AA64ISAR0_EL1_FHM_FMLAL)
++ exts += "asimdfml ";
++#endif
++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_AES) == ID_AA64ISAR0_EL1_AES_AES)
++ exts += "aes ";
++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_AES) == ID_AA64ISAR0_EL1_AES_PMUL)
++ exts += "aes pmull ";
++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_CRC32) == ID_AA64ISAR0_EL1_CRC32_CRC32X)
++ exts += "crc32 ";
++#ifdef ID_AA64ISAR0_EL1_ATOMIC
++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_ATOMIC) == ID_AA64ISAR0_EL1_ATOMIC_SWP)
++ exts += "atomics ";
++#endif
++ if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA1) & ID_AA64ISAR0_EL1_SHA1_SHA1CPMHSU) != 0)
++ exts += "sha1 ";
++ if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA2) & ID_AA64ISAR0_EL1_SHA2_SHA256HSU) != 0)
++ exts += "sha2 ";
++#ifdef ID_AA64ISAR0_EL1_SHA2_SHA512HSU
++ if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA2) & ID_AA64ISAR0_EL1_SHA2_SHA512HSU) != 0)
++ exts += "sha512 ";
++ if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA3) & ID_AA64ISAR0_EL1_SHA3_EOR3) != 0)
++ exts += "sha3 ";
++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SM3) == ID_AA64ISAR0_EL1_SM3_SM3)
++ exts += "sm3 ";
++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SM4) == ID_AA64ISAR0_EL1_SM4_SM4)
++ exts += "sm4 ";
++ if (__SHIFTOUT(id.ac_aa64pfr0, ID_AA64PFR0_EL1_SVE) == ID_AA64PFR0_EL1_SVE_IMPL)
++ exts += "sve ";
++ if (__SHIFTOUT(id.ac_aa64isar1, ID_AA64ISAR1_EL1_LRCPC) == ID_AA64ISAR1_EL1_LRCPC_PR)
++ exts += "lrcpc ";
++#endif
++
++ for (i = 0; i < num_exts; i++)
++ {
++ const char *p = aarch64_extensions[i].feat_string;
++
++ /* If the feature contains no HWCAPS string then ignore it for the
++ auto detection. */
++ if (*p == '\0')
++ continue;
++
++ bool enabled = true;
++
++ /* This may be a multi-token feature string. We need
++ to match all parts, which could be in any order. */
++ size_t len = strlen (exts.c_str());
++ do
++ {
++ const char *end = strchr (p, ' ');
++ if (end == NULL)
++ end = strchr (p, '\0');
++ if (memmem (exts.c_str(), len, p, end - p) == NULL)
++ {
++ /* Failed to match this token. Turn off the
++ features we'd otherwise enable. */
++ enabled = false;
++ break;
++ }
++ if (*end == '\0')
++ break;
++ p = end + 1;
++ }
++ while (1);
++
++ if (enabled)
++ extension_flags |= aarch64_extensions[i].flag;
++ else
++ extension_flags &= ~(aarch64_extensions[i].flag);
++ }
++
++ processed_exts = true;
++ }
++ }
++ /* End of NetBSD specific section. */
++#endif
+
+ /* Weird cpuinfo format that we don't know how to handle. */
+ if (n_cores == 0