NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/60904: compiler dumps core cross-building from MacOS on Apple Silicon



>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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 18 21:40:01 +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/main/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.




Home | Main Index | Thread Index | Old Index