-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fakecgo: C functions require nosplit #295
Conversation
fakecgo runs on systemstack so we shouldn't ever split the stack. I also updated the size of sigset_t to be the correct size based on the headers. This was needed to make it possible to build with inlining disabled when nosplit was added. Fixes ebitengine#287
internal/fakecgo/libcgo.go
Outdated
// Sources: | ||
// Darwin - https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/_types.h#L74 | ||
// FreeBSD - https://github.com/DoctorWkt/xv6-freebsd/blob/d2a294c2a984baed27676068b15ed9a29b06ab6f/include/signal.h#L98C9-L98C21 | ||
sigset_t [32]byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about Linux?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh it is 128 bytes. Not sure what to do since if it's 128 then it's too big to build when inlining is disabled. I guess inline the functions by hand but that's kind of ugly.
github.com/ebitengine/purego/internal/fakecgo.x_cgo_thread_start: nosplit stack over 792 byte limit
github.com/ebitengine/purego/internal/fakecgo.x_cgo_thread_start<1>
grows 160 bytes, calls github.com/ebitengine/purego/internal/fakecgo._cgo_sys_thread_start<1>
grows 400 bytes, calls github.com/ebitengine/purego/internal/fakecgo._cgo_try_pthread_create<1>
grows 112 bytes, calls github.com/ebitengine/purego/internal/fakecgo.pthread_create<1>
grows 128 bytes, calls github.com/ebitengine/purego/internal/fakecgo.call5<0>
grows 16 bytes, calls indirect
grows 0 bytes, calls runtime.morestack<0>
24 bytes over limit
grows 112 bytes, calls github.com/ebitengine/purego/internal/fakecgo.nanosleep<1>
grows 112 bytes, calls github.com/ebitengine/purego/internal/fakecgo.call5<0>
grows 16 bytes, calls indirect
grows 0 bytes, calls runtime.morestack<0>
8 bytes over limit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM
* fakecgo: C functions require nosplit fakecgo runs on systemstack so we shouldn't ever split the stack. Fixes #287
fakecgo runs on the system stack so we shouldn't ever split the stack.
I also updated the size of sigset_t to be the correct size based on the headers. This was needed to make it possible to build with inlining disabled when nosplit was added.
Fixes #287