mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
runtime: restore error message on early needm
needm used to print an error before exiting when it was called too early, but this error was lost in the transition to Go. Bring back the error so we don't silently exit(1) when this happens. Change-Id: I8086932783fd29a337d7dea31b9d6facb64cb5c1 Reviewed-on: https://go-review.googlesource.com/1226 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
e8f13700b7
commit
76f71959c8
|
@ -861,8 +861,7 @@ func needm(x byte) {
|
|||
if needextram != 0 {
|
||||
// Can happen if C/C++ code calls Go from a global ctor.
|
||||
// Can not throw, because scheduler is not initialized yet.
|
||||
// XXX
|
||||
// write(2, unsafe.Pointer("fatal error: cgo callback before cgo call\n"), sizeof("fatal error: cgo callback before cgo call\n") - 1)
|
||||
write(2, unsafe.Pointer(&earlycgocallback[0]), int32(len(earlycgocallback)))
|
||||
exit(1)
|
||||
}
|
||||
|
||||
|
@ -898,6 +897,8 @@ func needm(x byte) {
|
|||
minit()
|
||||
}
|
||||
|
||||
var earlycgocallback = []byte("fatal error: cgo callback before cgo call\n")
|
||||
|
||||
// newextram allocates an m and puts it on the extra list.
|
||||
// It is called with a working local m, so that it can do things
|
||||
// like call schedlock and allocate.
|
||||
|
|
Loading…
Reference in a new issue