fix: symbol not found when building in baremental environment
This commit is contained in:
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"
|
||||
|
||||
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/setjmp"
|
||||
)
|
||||
@@ -57,26 +56,6 @@ func Panic(v any) {
|
||||
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 (
|
||||
excepKey pthread.Key
|
||||
goexitKey pthread.Key
|
||||
|
||||
Reference in New Issue
Block a user