From: ecordonnier@snap.com
To: yocto-patches@lists.yoctoproject.org
Cc: Etienne Cordonnier <ecordonnier@snap.com>
Subject: [meta-darwin][PATCH 09/21] gcc: fix Darwin ICE from weak-alias __cpu_indicator_init_local
Date: Wed, 14 Oct 2026 16:10:30 +0200 [thread overview]
Message-ID: <20261014141209.488034-9-ecordonnier@snap.com> (raw)
In-Reply-To: <20261014141209.488034-1-ecordonnier@snap.com>
From: Etienne Cordonnier <ecordonnier@snap.com>
nativesdk-libgcc:do_compile fails building libgcc/config/i386/cpuinfo.c
for x86_64-snapndk-darwin21 with:
libgcc/config/i386/cpuinfo.c:68:3: internal compiler error: in
assemble_alias, at varasm.cc:6627
OE-core's 0020-libgcc_s-Use-alias-for-__cpu_indicator_init patch (a
2015 musl-compat fix, not OS-gated) adds a weak alias definition of
__cpu_indicator_init_local. GCC's Darwin/Mach-O backend cannot emit
that weak+alias combination and ICEs instead of erroring out.
Add a new patch (0103) via the shared gcc-source_%.bbappend that
replaces the alias with a plain forwarding function body, gated on
__APPLE__ so non-Darwin builds keep taking the original weak-alias
path unchanged. Preserves the __cpu_indicator_init_local symbol name
that gcc/config/i386/i386-expand.cc calls from __builtin_cpu_init.
This surfaced now because GCC was bumped 13.3 -> 15.3 as part of the
scarthgap -> wrynose migration; whether this specific Darwin-hosted
libgcc + 0020-patch combination ever actually compiled under GCC 13.3
is unverified (GCC 13.3 source isn't available locally to diff
varasm.cc/cpuinfo.c against).
AI-Generated: Claude Sonnet 5
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
---
...-i386-cpuinfo-avoid-darwin-alias-ice.patch | 44 +++++++++++++++++++
recipes-devtools/gcc/gcc-source_%.bbappend | 7 +++
2 files changed, 51 insertions(+)
create mode 100644 recipes-devtools/gcc/files/0103-libgcc-i386-cpuinfo-avoid-darwin-alias-ice.patch
diff --git a/recipes-devtools/gcc/files/0103-libgcc-i386-cpuinfo-avoid-darwin-alias-ice.patch b/recipes-devtools/gcc/files/0103-libgcc-i386-cpuinfo-avoid-darwin-alias-ice.patch
new file mode 100644
index 0000000..3e9bb9b
--- /dev/null
+++ b/recipes-devtools/gcc/files/0103-libgcc-i386-cpuinfo-avoid-darwin-alias-ice.patch
@@ -0,0 +1,44 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Etienne Cordonnier <ecordonnier@snap.com>
+Date: Thu, 18 Sep 2026 12:00:00 +0200
+Subject: [PATCH] libgcc/i386: avoid weak alias for __cpu_indicator_init_local
+ on Darwin
+
+0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
+(carried from OE-core) adds a weak alias definition of
+__cpu_indicator_init_local in libgcc/config/i386/cpuinfo.c. GCC's
+assemble_alias (gcc/varasm.cc) cannot emit this weak+alias combination
+for the Darwin/Mach-O backend and ICEs instead of erroring out:
+
+ libgcc/config/i386/cpuinfo.c:68:3: internal compiler error: in
+ assemble_alias, at varasm.cc:6627
+
+Use a plain forwarding function body on Darwin instead of the
+weak alias. This keeps the same externally visible symbol name that
+gcc/config/i386/i386-expand.cc calls from __builtin_cpu_init, so
+non-Darwin targets (which take the weak-alias branch below unchanged)
+are unaffected.
+
+Upstream-Status: Inappropriate [OE specific]
+---
+ libgcc/config/i386/cpuinfo.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
+index e980030ef23..a1b2c3d4e5f 100644
+--- a/libgcc/config/i386/cpuinfo.c
++++ b/libgcc/config/i386/cpuinfo.c
+@@ -64,6 +64,11 @@
+ }
+
+ #ifndef SHARED
++#if defined(__APPLE__)
++/* weak+alias here ICEs GCC's assemble_alias for Mach-O (gcc/varasm.cc). */
++int __cpu_indicator_init_local (void) { return __cpu_indicator_init (); }
++#else
+ int __cpu_indicator_init_local (void)
+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
+ #endif
++#endif
+--
+2.43.0
diff --git a/recipes-devtools/gcc/gcc-source_%.bbappend b/recipes-devtools/gcc/gcc-source_%.bbappend
index 0f05b8e..de18cff 100644
--- a/recipes-devtools/gcc/gcc-source_%.bbappend
+++ b/recipes-devtools/gcc/gcc-source_%.bbappend
@@ -18,6 +18,13 @@ SRC_URI:append = " \
file://0102-aarch64-on-aarch64.patch \
"
+# 0020 (carried from OE-core) adds a weak alias for __cpu_indicator_init_local
+# in libgcc/config/i386/cpuinfo.c; GCC ICEs emitting that for Mach-O. Guarded
+# by __APPLE__, so this only changes behavior on Darwin.
+SRC_URI:append = " \
+ file://0103-libgcc-i386-cpuinfo-avoid-darwin-alias-ice.patch \
+"
+
# gcc-15.3.0 tarball ships zlib/zlib.map with CRLF; 0101 tail hunk is LF-only.
python do_patch:prepend() {
import pathlib
--
2.43.0
next prev parent reply other threads:[~2026-10-14 14:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 14:10 [meta-darwin][PATCH 01/21] meta-darwin: bump layer series to wrynose (6.0.3) ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 03/21] clang: regenerate Darwin SDK fixes patch for the wrynose base ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 04/21] automake: drop obsolete Darwin bbappend ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 05/21] zstd: rebase LC_RPATH patch for upstream's new zstdmt guard, scope to darwin21 ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 06/21] darwin recipes: fix S/WORKDIR/destsuffix breakage from git-fetcher UNPACKDIR relocation ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 07/21] cctools-port-crosssdk: fix stale virtual/binutils provider name ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 08/21] libdispatch-native, libtapi-native, cctools-port-crosssdk: fix ineffective clang selection ecordonnier
2026-10-14 14:10 ` ecordonnier [this message]
2026-10-14 14:10 ` [meta-darwin][PATCH 10/21] libgcrypt: drop libcap capabilities support for Darwin nativesdk ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 11/21] sqlite3: fix Darwin nativesdk build (SONAME + shell link) ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 12/21] libarchive: drop acl/xattr PACKAGECONFIGs for Darwin nativesdk ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 13/21] clang: scope -femulated-tls/-Wno-elaborated-enum-base to toolchain-clang ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 14/21] clang: disable clangd's XPC transport for the Darwin nativesdk build ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 15/21] clang/lldb: move LLDB support to its own nativesdk-lldb recipe ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 16/21] darwin-common: don't treat buildpaths QA as an error for the SDK ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 17/21] darwin-common: add the nativesdk include dir to the header search path ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 18/21] util-linux-libuuid: fix GCC ICE in uuid_time.c on Darwin nativesdk ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 19/21] libedit: don't include glibc's stdc-predef.h " ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 20/21] bash: link the in-tree readline " ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 21/21] gdb-cross-canadian: point --with-liblzma-prefix at the SDK sysroot prefix ecordonnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261014141209.488034-9-ecordonnier@snap.com \
--to=ecordonnier@snap.com \
--cc=yocto-patches@lists.yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.