From ca8fcc9479edd4a60c7a2632577608b5513ec1ba Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 25 May 2026 19:00:53 +0200 Subject: [PATCH] cli: clarify runtime.alloc linker error with -gc=none This should help people figure out the actual problem if they run into this. --- builder/tools.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builder/tools.go b/builder/tools.go index 8a5762cb5..56d5a5847 100644 --- a/builder/tools.go +++ b/builder/tools.go @@ -121,9 +121,11 @@ func parseLLDErrors(text string) error { if matches != nil { parsedError = true line, _ := strconv.Atoi(matches[3]) - // TODO: detect common mistakes like -gc=none? msg := "linker could not find symbol " + symbolName - if symbolName == "runtime.alloc_noheap" { + switch symbolName { + case "runtime.alloc": + msg = "object allocated on the heap with -gc=none" + case "runtime.alloc_noheap": msg = "object allocated on the heap in //go:noheap function" } linkErrors = append(linkErrors, scanner.Error{