From patchwork Thu Dec 3 13:38:18 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Cordonnier X-Patchwork-Id: 107200 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.14096.1796305113507502015 for ; Thu, 03 Dec 2026 05:38:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@snap.com header.s=google header.b=Vr+DpxuA; spf=pass (domain: snapchat.com, ip: 209.85.128.48, mailfrom: ecordonnier@snapchat.com) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4bba5e17728so75716795e9.2 for ; Thu, 03 Dec 2026 05:38:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=snap.com; s=google; t=1796305112; x=1796909912; darn=lists.yoctoproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=E7GUsimtzbvp8OJnXcg8ECu2eCijEDobscCsj34t7OQ=; b=Vr+DpxuAY97p5bIErOHc+ai718Q9YQVV3RZ2Kc9ADaoTmdrFbaCSv3FxRMp9W0P7qq YvurdIoMf4mTOcF7BXRiPpRE916N9Za9l3htdExg+0CxOMeSJLcm/CxKfZMVxyVhlN04 jpaoL+K9x7EfAuiIwJfg6qvawlnkVwv0S///4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796305112; x=1796909912; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=E7GUsimtzbvp8OJnXcg8ECu2eCijEDobscCsj34t7OQ=; b=CDx+hxhP/AKK570DBuQk0nzMn89fPKGeJWaH8aruauCVSD+Ozyu9qOvBd1OG5tSdOj 15uJYvr/lGuCBiIY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x+SBs1TiftS6PLMr WrsAzDWbkzlb/1rupexamIWIvx6hUUSH/ X-Received: by 2002:a05:600c:468c:b0:4bb:6d61:af7c with SMTP id 5b1f17b1804b1-4bb88944bf5mr847319145e9.35.1796305111984; Thu, 03 Dec 2026 05:38:31 -0800 (PST) Return-Path: Received: from lj8k2dq3.sc-core.net ([85.237.126.22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe06edeb7sm116661395e9.11.2026.12.03.05.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 05:38:31 -0800 (PST) From: ecordonnier@snap.com To: yocto-patches@lists.yoctoproject.org Cc: Etienne Cordonnier Subject: [meta-darwin][PATCH 3/3] gcc: keep aarch64 outline atomics hidden Date: Thu, 3 Dec 2026 14:38:18 +0100 Message-ID: <20261203133818.967228-3-ecordonnier@snap.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261203133818.967228-1-ecordonnier@snap.com> References: <20261203133818.967228-1-ecordonnier@snap.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 03 Dec 2026 13:38:43 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/5659 From: Etienne Cordonnier 0101 replaces the local STARTFN macro in libgcc/config/aarch64/lse.S with the generic ENTRY macro, so that Mach-O gets the symbol prefix (ASMNAME), the right alignment directive and no .type/.size. STARTFN emitted HIDDEN(\name); ENTRY does not. As a result every __aarch64_{cas,swp,ldadd,ldclr,ldeor,ldset}* helper in libgcc.a, 125 in total, is a default-visibility global instead of hidden. gcc-source is shared by all GCC recipes, so this also affects the Linux aarch64 target libgcc, not only Darwin. Any shared library that pulls the helpers in without --exclude-libs or a version script then exports them, and its consumers bind to that copy instead of the private copy in their own DSO. Mark each helper hidden again. HIDDEN expands to .hidden on ELF and to .private_extern on Mach-O (both defined by 0101), which matches upstream GCC. The same defect is present in iains/gcc-15-branch (gcc-15-3-darwin), the source of 0101. Tested: gcc-source do_patch applies 0104 on top of 0101 without fuzz. Assembling lse.S for aarch64 with and without 0104 for cas8_acq, cas16_acq_rel, swp4_acq_rel, ldadd8_relax, ldclr2_acq, ldset1_rel and ldeor4_relax gives a plain global symbol without it and .hidden with it. Not tested on Darwin. AI-Generated: Claude Sonnet 5.5 Signed-off-by: Etienne Cordonnier --- ...-aarch64-keep-outline-atomics-hidden.patch | 35 +++++++++++++++++++ recipes-devtools/gcc/gcc-source_%.bbappend | 7 ++++ 2 files changed, 42 insertions(+) create mode 100644 recipes-devtools/gcc/files/0104-libgcc-aarch64-keep-outline-atomics-hidden.patch diff --git a/recipes-devtools/gcc/files/0104-libgcc-aarch64-keep-outline-atomics-hidden.patch b/recipes-devtools/gcc/files/0104-libgcc-aarch64-keep-outline-atomics-hidden.patch new file mode 100644 index 0000000..fac1843 --- /dev/null +++ b/recipes-devtools/gcc/files/0104-libgcc-aarch64-keep-outline-atomics-hidden.patch @@ -0,0 +1,35 @@ +Subject: [PATCH] libgcc: aarch64: keep outline atomics hidden after Darwin ENTRY conversion + +0101 replaces lse.S's local STARTFN macro (which emitted HIDDEN(\name)) with +the generic ENTRY macro, which has no HIDDEN. Every __aarch64_{cas,swp,ld*} +helper in libgcc.a thus becomes default-visibility. Mark them hidden again. +HIDDEN is .hidden on ELF and .private_extern on Mach-O. + +Upstream-Status: Inappropriate [fixes a downstream Darwin backport] +--- +--- a/libgcc/config/aarch64/lse.S ++++ b/libgcc/config/aarch64/lse.S +@@ -186,6 +186,7 @@ + + #ifdef L_cas + ++ HIDDEN (ASMNAME (NAME(cas))) + ENTRY (ASMNAME (NAME(cas))) + JUMP_IF_NOT_LSE 8f + +@@ -249,6 +250,7 @@ + # define SWP .inst 0x38208020 + B + N + #endif + ++ HIDDEN (ASMNAME (NAME (swp))) + ENTRY (ASMNAME (NAME (swp))) + JUMP_IF_NOT_LSE 8f + +@@ -293,6 +295,7 @@ + # define LDOP .inst 0x38200020 + OPN + B + N + #endif + ++ HIDDEN (ASMNAME (NAME (LDNM))) + ENTRY (ASMNAME (NAME (LDNM))) + JUMP_IF_NOT_LSE 8f + diff --git a/recipes-devtools/gcc/gcc-source_%.bbappend b/recipes-devtools/gcc/gcc-source_%.bbappend index de18cff..a886d63 100644 --- a/recipes-devtools/gcc/gcc-source_%.bbappend +++ b/recipes-devtools/gcc/gcc-source_%.bbappend @@ -25,6 +25,13 @@ SRC_URI:append = " \ file://0103-libgcc-i386-cpuinfo-avoid-darwin-alias-ice.patch \ " +# 0101 replaces lse.S's STARTFN (which emitted HIDDEN) with the generic ENTRY +# macro, which does not; this restores hidden visibility of the outline-atomic +# helpers, which would otherwise leak out of every shared library using them. +SRC_URI:append = " \ + file://0104-libgcc-aarch64-keep-outline-atomics-hidden.patch \ +" + # gcc-15.3.0 tarball ships zlib/zlib.map with CRLF; 0101 tail hunk is LF-only. python do_patch:prepend() { import pathlib