fix: symbol not found when building in baremental environment
This commit is contained in:
@@ -21,7 +21,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LLGoPackage = "decl"
|
LLGoPackage = "link"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build !wasm
|
//go:build !wasm && !baremental
|
||||||
|
|
||||||
package debug
|
package debug
|
||||||
|
|
||||||
|
|||||||
40
runtime/internal/clite/debug/debug_baremental.go
Normal file
40
runtime/internal/clite/debug/debug_baremental.go
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
//go:build baremental
|
||||||
|
|
||||||
|
package debug
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
c "github.com/goplus/llgo/runtime/internal/clite"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Info struct {
|
||||||
|
Fname *c.Char
|
||||||
|
Fbase c.Pointer
|
||||||
|
Sname *c.Char
|
||||||
|
Saddr c.Pointer
|
||||||
|
}
|
||||||
|
|
||||||
|
func Address() unsafe.Pointer {
|
||||||
|
panic("not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func Addrinfo(addr unsafe.Pointer, info *Info) c.Int {
|
||||||
|
panic("not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
type Frame struct {
|
||||||
|
PC uintptr
|
||||||
|
Offset uintptr
|
||||||
|
SP unsafe.Pointer
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func StackTrace(skip int, fn func(fr *Frame) bool) {
|
||||||
|
panic("not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func PrintStack(skip int) {
|
||||||
|
panic("not implemented")
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
//go:build wasm
|
||||||
|
|
||||||
package debug
|
package debug
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build linux
|
//go:build linux && !baremental
|
||||||
|
|
||||||
package debug
|
package debug
|
||||||
|
|
||||||
|
|||||||
29
runtime/internal/clite/stdio_baremental.go
Normal file
29
runtime/internal/clite/stdio_baremental.go
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
//go:build baremental
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package c
|
||||||
|
|
||||||
|
import _ "unsafe"
|
||||||
|
|
||||||
|
//go:linkname Stdin stdin
|
||||||
|
var Stdin FilePtr
|
||||||
|
|
||||||
|
//go:linkname Stdout stdout
|
||||||
|
var Stdout FilePtr
|
||||||
|
|
||||||
|
var Stderr FilePtr = Fopen(Str("/dev/stderr"), Str("w"))
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !darwin
|
//go:build !darwin && !baremental
|
||||||
// +build !darwin
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
//go:build !baremental
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
5
runtime/internal/lib/runtime/maxprocs_baremental.go
Normal file
5
runtime/internal/lib/runtime/maxprocs_baremental.go
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
//go:build baremental
|
||||||
|
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
func c_maxprocs() int32 { return 1 }
|
||||||
11
runtime/internal/lib/runtime/maxprocs_default.go
Normal file
11
runtime/internal/lib/runtime/maxprocs_default.go
Normal 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
|
||||||
@@ -26,11 +26,6 @@ import (
|
|||||||
// llgo:skipall
|
// llgo:skipall
|
||||||
type _runtime struct{}
|
type _runtime struct{}
|
||||||
|
|
||||||
const (
|
|
||||||
LLGoPackage = "link"
|
|
||||||
LLGoFiles = "_wrap/runtime.c"
|
|
||||||
)
|
|
||||||
|
|
||||||
var defaultGOROOT string // set by cmd/link
|
var defaultGOROOT string // set by cmd/link
|
||||||
|
|
||||||
func GOROOT() string {
|
func GOROOT() string {
|
||||||
@@ -43,9 +38,6 @@ func Version() string {
|
|||||||
return buildVersion
|
return buildVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname c_maxprocs C.llgo_maxprocs
|
|
||||||
func c_maxprocs() int32
|
|
||||||
|
|
||||||
func GOMAXPROCS(n int) int {
|
func GOMAXPROCS(n int) int {
|
||||||
return int(c_maxprocs())
|
return int(c_maxprocs())
|
||||||
}
|
}
|
||||||
|
|||||||
6
runtime/internal/runtime/rethrow_baremental.go
Normal file
6
runtime/internal/runtime/rethrow_baremental.go
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
//go:build baremental
|
||||||
|
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
// Rethrow rethrows a panic.
|
||||||
|
func Rethrow(link *Defer) {}
|
||||||
29
runtime/internal/runtime/rethrow_default.go
Normal file
29
runtime/internal/runtime/rethrow_default.go
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
//go:build !baremental
|
||||||
|
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
c "github.com/goplus/llgo/runtime/internal/clite"
|
||||||
|
"github.com/goplus/llgo/runtime/internal/clite/debug"
|
||||||
|
"github.com/goplus/llgo/runtime/internal/clite/pthread"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Rethrow rethrows a panic.
|
||||||
|
func Rethrow(link *Defer) {
|
||||||
|
if ptr := excepKey.Get(); ptr != nil {
|
||||||
|
if link == nil {
|
||||||
|
TracePanic(*(*any)(ptr))
|
||||||
|
debug.PrintStack(2)
|
||||||
|
c.Free(ptr)
|
||||||
|
c.Exit(2)
|
||||||
|
} else {
|
||||||
|
c.Siglongjmp(link.Addr, 1)
|
||||||
|
}
|
||||||
|
} else if link == nil && goexitKey.Get() != nil {
|
||||||
|
if pthread.Equal(mainThread, pthread.Self()) != 0 {
|
||||||
|
fatal("no goroutines (main called runtime.Goexit) - deadlock!")
|
||||||
|
c.Exit(2)
|
||||||
|
}
|
||||||
|
pthread.Exit(nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,7 +20,6 @@ import (
|
|||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
c "github.com/goplus/llgo/runtime/internal/clite"
|
c "github.com/goplus/llgo/runtime/internal/clite"
|
||||||
"github.com/goplus/llgo/runtime/internal/clite/debug"
|
|
||||||
"github.com/goplus/llgo/runtime/internal/clite/pthread"
|
"github.com/goplus/llgo/runtime/internal/clite/pthread"
|
||||||
"github.com/goplus/llgo/runtime/internal/clite/setjmp"
|
"github.com/goplus/llgo/runtime/internal/clite/setjmp"
|
||||||
)
|
)
|
||||||
@@ -57,26 +56,6 @@ func Panic(v any) {
|
|||||||
Rethrow((*Defer)(c.GoDeferData()))
|
Rethrow((*Defer)(c.GoDeferData()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rethrow rethrows a panic.
|
|
||||||
func Rethrow(link *Defer) {
|
|
||||||
if ptr := excepKey.Get(); ptr != nil {
|
|
||||||
if link == nil {
|
|
||||||
TracePanic(*(*any)(ptr))
|
|
||||||
debug.PrintStack(2)
|
|
||||||
c.Free(ptr)
|
|
||||||
c.Exit(2)
|
|
||||||
} else {
|
|
||||||
c.Siglongjmp(link.Addr, 1)
|
|
||||||
}
|
|
||||||
} else if link == nil && goexitKey.Get() != nil {
|
|
||||||
if pthread.Equal(mainThread, pthread.Self()) != 0 {
|
|
||||||
fatal("no goroutines (main called runtime.Goexit) - deadlock!")
|
|
||||||
c.Exit(2)
|
|
||||||
}
|
|
||||||
pthread.Exit(nil)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
excepKey pthread.Key
|
excepKey pthread.Key
|
||||||
goexitKey pthread.Key
|
goexitKey pthread.Key
|
||||||
|
|||||||
Reference in New Issue
Block a user