fix: symbol not found when building in baremental environment

This commit is contained in:
Haolan
2025-09-05 16:27:38 +08:00
parent 6588f36123
commit 2d1120bf69
15 changed files with 143 additions and 34 deletions

View File

@@ -0,0 +1,15 @@
//go:build baremental
package unix
import (
_ "unsafe"
)
func Fcntl(fd int, cmd int, arg int) (int, error) {
return 0, nil
}
func fcntl(fd int, cmd int, arg int) (int, error) {
return 0, nil
}

View File

@@ -1,3 +1,5 @@
//go:build !baremental
package unix
import (

View File

@@ -0,0 +1,5 @@
//go:build baremental
package runtime
func c_maxprocs() int32 { return 1 }

View File

@@ -0,0 +1,11 @@
//go:build !baremental
package runtime
const (
LLGoPackage = "link"
LLGoFiles = "_wrap/runtime.c"
)
//go:linkname c_maxprocs C.llgo_maxprocs
func c_maxprocs() int32

View File

@@ -26,11 +26,6 @@ import (
// llgo:skipall
type _runtime struct{}
const (
LLGoPackage = "link"
LLGoFiles = "_wrap/runtime.c"
)
var defaultGOROOT string // set by cmd/link
func GOROOT() string {
@@ -43,9 +38,6 @@ func Version() string {
return buildVersion
}
//go:linkname c_maxprocs C.llgo_maxprocs
func c_maxprocs() int32
func GOMAXPROCS(n int) int {
return int(c_maxprocs())
}