mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 11:13:27 +00:00
runtime: add syscall.runtimeClearenv for Go 1.26
Go 1.26 added syscall.runtimeClearenv (called by syscall.Clearenv) which must be provided by the runtime via go:linkname. Without it, the os package fails to link.
This commit is contained in:
@@ -27,6 +27,16 @@ func syscallUnsetenv(key string) {
|
|||||||
unsetenv(&keydata[0])
|
unsetenv(&keydata[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear the environment.
|
||||||
|
// Called from Go 1.26 and above.
|
||||||
|
//
|
||||||
|
//go:linkname syscallClearenv syscall.runtimeClearenv
|
||||||
|
func syscallClearenv(env map[string]int) {
|
||||||
|
for k := range env {
|
||||||
|
syscallUnsetenv(k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Compatibility with Go 1.19 and below.
|
// Compatibility with Go 1.19 and below.
|
||||||
//
|
//
|
||||||
//go:linkname syscall_setenv_c syscall.setenv_c
|
//go:linkname syscall_setenv_c syscall.setenv_c
|
||||||
|
|||||||
Reference in New Issue
Block a user