compiler: add //go:noheap pragma

This commit is contained in:
Ayke van Laethem
2026-05-20 11:01:50 +02:00
committed by Ayke
parent 7b486e398a
commit 85d223c5e2
12 changed files with 135 additions and 10 deletions
+5 -1
View File
@@ -122,12 +122,16 @@ func parseLLDErrors(text string) error {
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" {
msg = "object allocated on the heap in //go:noheap function"
}
linkErrors = append(linkErrors, scanner.Error{
Pos: token.Position{
Filename: matches[2],
Line: line,
},
Msg: "linker could not find symbol " + symbolName,
Msg: msg,
})
}
}