compiler: add //go:linkname support for globals

We previously used our own //go:extern but //go:linkname is probably the
better choice since it's used in the math/bits package.
This commit is contained in:
Ayke van Laethem
2025-02-25 13:04:34 +01:00
parent 38e3d55e64
commit adc0cae960
3 changed files with 14 additions and 2 deletions
+6
View File
@@ -2,6 +2,12 @@ package main
import _ "unsafe"
// Use the go:linkname mechanism to link this global to a different package.
// This is used in math/bits.
//
//go:linkname linknamedGlobal runtime.testLinknamedGlobal
var linknamedGlobal int
// Creates an external global with name extern_global.
//
//go:extern extern_global