mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 11:37:46 +00:00
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:
Vendored
+6
@@ -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
|
||||
|
||||
Vendored
+1
@@ -3,6 +3,7 @@ source_filename = "pragma.go"
|
||||
target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20"
|
||||
target triple = "wasm32-unknown-wasi"
|
||||
|
||||
@runtime.testLinknamedGlobal = external global i32, align 4
|
||||
@extern_global = external global [0 x i8], align 1
|
||||
@main.alignedGlobal = hidden global [4 x i32] zeroinitializer, align 32
|
||||
@main.alignedGlobal16 = hidden global [4 x i32] zeroinitializer, align 16
|
||||
|
||||
Reference in New Issue
Block a user