NetBSD Problem Report #60904
From tls@panix.com Sun Oct 18 21:38:35 2026
Return-Path: <tls@panix.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id A7BE51A923B
for <gnats-bugs@gnats.NetBSD.org>; Sun, 18 Oct 2026 21:38:35 +0000 (UTC)
Message-Id: <4j7Br93s56zfYm@panix5.panix.com>
Date: Sun, 18 Oct 2026 17:38:33 -0400 (EDT)
From: tls@panix.com
Reply-To: tls@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: compiler dumps core cross-building from MacOS on Apple Silicon
X-Send-Pr-Version: 3.95
X-From4GNATS: "tls@panix.com via gnats" <gnats-admin@NetBSD.org>
>Number: 60904
>Category: toolchain
>Synopsis: compiler dumps core cross-building from MacOS on Apple Silicon
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: toolchain-manager
>State: needs-pullups
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Oct 18 21:40:01 +0000 2026
>Closed-Date:
>Last-Modified: Sun Oct 18 23:07:30 +0000 2026
>Originator: Thor Lancelot Simon
>Release: NetBSD 10.0 through NetBSD-current as of 2026-10-18
>Organization:
>Environment:
System: Darwin lungfish.hvg.tjls.com 27.0.0 Darwin Kernel Version 27.0.0: Tue
Aug 11 21:05:42 PDT 2026; root:xnu-13432.1.9~1/RELEASE_ARM64_T6031 arm64
Architecture: arm
Machine: arm64
>Description:
In highly parallel builds for 64-bit targets (amd64, aarch64) on
Darwin (MacOS) on Apple Silicon (arm64), NetBSD's cross-gcc segfaults
while building various files in the in-tree gcc, typically those
containing "long double" constants.
The problem is that the GMP in external/lgpl3 has 64-bit ARM ASM
files that use register x18, which is forbidden by the ABI
(see https://github.com/ARM-software/abi-aa/blob/7485cc1a1240d9143c6c759390469ae0cbe2d02e/aapcs64/aapcs64.rst#table-2
and the note immediately below).
MacOS zeroes this register after a context switch. If a compilation
is in one of those GMP routines while the compiler is switched away
from, x18 will magically change value to 0 and Bad Things will happen.
>How-To-Repeat:
Get yourself a spiffy new Mac with 28 cores and run
build.sh -m amd64 -u -U -j28 tools distribution.
>Fix:
The fix is to avoid use of x18. It appears GMP did this upstream a
few years later.
>Release-Note:
>Audit-Trail:
From: "Thor Lancelot Simon" <tls@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60904 CVS commit: src/tools/gmp
Date: Sun, 18 Oct 2026 23:04:41 +0000
Module Name: src
Committed By: tls
Date: Sun Oct 18 23:04:41 UTC 2026
Modified Files:
src/tools/gmp: Makefile
Log Message:
Fix compiler core dumps on MacOS on Apple Silicon (PR toolchain/60904),
by disabling the use of the broken arm64 asm that comes with the present
version of GMP (we can re-enable it when we upgrade).
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tools/gmp/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->needs-pullups
State-Changed-By: tls@NetBSD.org
State-Changed-When: Sun, 18 Oct 2026 23:07:30 +0000
State-Changed-Why:
Needs pullups to NetBSD-10 and NetBSD-11 which have the broken GMP.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.