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: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Oct 18 21:40:01 +0000 2026
>Closed-Date: Sun Nov 01 03:40:26 +0000 2026
>Last-Modified: Sun Nov 01 03:40:26 +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.
From: GOVIND PANDEY <govindup63@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: toolchain/60904: compiler dumps core cross-building from MacOS on
Apple Silicon
Date: Sun, 18 Oct 2026 20:53:12 -0400
--00000000000051f966065e26f0c2
Content-Type: text/plain; charset="UTF-8"
Hi,
I can confirm both the problem and the fix on the netbsd-11 branch, in
case it helps with the pullup.
Host: Darwin 27.0.0 arm64, Apple M4 (MacBook Air, 10 cores)
Tree: netbsd-11 from the git mirror, 36cf5108d (2026-10-14)
Build: ./build.sh -U -u -m amd64 -j10 tools
With tools/gmp/Makefile at 1.6 (so assembly enabled on arm64, GMP 6.2.1
with ten mpn/arm64/*.asm files that use x18), I took the resulting
x86_64--netbsd-gcc and compiled a 300-line C file of long double
constant expressions 600 times, 24 in parallel. 62 of them died:
44 internal compiler error: Segmentation fault: 11
27 internal compiler error: Bus error: 10
6 internal compiler error: Abort trap: 6
1 internal compiler error: Trace/BPT trap: 5
(some runs printed two signatures, hence the total over 62.)
I then applied the 1.6 -> 1.7 change to tools/gmp/Makefile, which
applies cleanly with patch -p1 since the branch copy is identical to
HEAD at 1.6, removed the gmp, mpfr, mpc and gcc objects and rebuilt
tools. GMP's config.status now shows --disable-assembly and nothing
under mpn/ is built from .asm. The same stress run, done twice:
600 compiles, 24 parallel, 0 failures
600 compiles, 24 parallel, 0 failures
I haven't tried netbsd-10, mostly because I'm short on disk for a
second tree.
Thanks,
Govind Pandey
--00000000000051f966065e26f0c2
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<html><body><div dir=3D"auto">Hi,<br><br>I can confirm both the problem and=
the fix on the netbsd-11 branch, in<br>case it helps with the pullup.<br><=
br>Host: Darwin 27.0.0 arm64, Apple M4 (MacBook Air, 10 cores)<br>Tree: net=
bsd-11 from the git mirror, 36cf5108d (2026-10-14)<br>Build: ./build.sh -U =
-u -m amd64 -j10 tools<br><br>With tools/gmp/Makefile at 1.6 (so assembly e=
nabled on arm64, GMP 6.2.1<br>with ten mpn/arm64/*.asm files that use x18),=
I took the resulting<br>x86_64--netbsd-gcc and compiled a 300-line C file =
of long double<br>constant expressions 600 times, 24 in parallel. 62 of the=
m died:<br><br> 44 internal compiler error: Segmentation fault: 11<br> 27=
internal compiler error: Bus error: 10<br> 6 internal compiler error: Ab=
ort trap: 6<br> 1 internal compiler error: Trace/BPT trap: 5<br><br>(some=
runs printed two signatures, hence the total over 62.)<br><br>I then appli=
ed the 1.6 -> 1.7 change to tools/gmp/Makefile, which<br>applies cleanly=
with patch -p1 since the branch copy is identical to<br>HEAD at 1.6, remov=
ed the gmp, mpfr, mpc and gcc objects and rebuilt<br>tools. GMP's confi=
g.status now shows --disable-assembly and nothing<br>under mpn/ is built fr=
om .asm. The same stress run, done twice:<br><br> 600 compiles, 24 paralle=
l, 0 failures<br> 600 compiles, 24 parallel, 0 failures<br><br>I haven'=
;t tried netbsd-10, mostly because I'm short on disk for a<br>second tr=
ee.<br><br>Thanks,<br>Govind Pandey<br></div></body></html>
--00000000000051f966065e26f0c2--
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60904 CVS commit: [netbsd-11] src/tools/gmp
Date: Tue, 20 Oct 2026 19:01:29 +0000
Module Name: src
Committed By: martin
Date: Tue Oct 20 19:01:29 UTC 2026
Modified Files:
src/tools/gmp [netbsd-11]: Makefile
Log Message:
Pull up following revision(s) (requested by tls in ticket #533):
tools/gmp/Makefile: revision 1.7
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.6.2.1 src/tools/gmp/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60904 CVS commit: [netbsd-10] src/tools/gmp
Date: Tue, 20 Oct 2026 19:02:33 +0000
Module Name: src
Committed By: martin
Date: Tue Oct 20 19:02:33 UTC 2026
Modified Files:
src/tools/gmp [netbsd-10]: Makefile
Log Message:
Pull up following revision(s) (requested by tls in ticket #1366):
tools/gmp/Makefile: revision 1.7
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.5.2.1 -r1.5.2.2 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: needs-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 01 Nov 2026 03:40:26 +0000
State-Changed-Why:
pullups complete
>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.