-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: building with -gcflags="-N -l" fails #18774
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
Comments
Dup of #14319, although that issue has gotten rather complicated. |
Note that this is not a stack overflow in the compiler. It is the compiler reporting that the runtime does not guarantee enough stack space for this code to succeed. |
It's a very unclear message, if situation is not a stack overflow.
Runtime can't allocate enough stack space? Is it not a stack overflow? |
How to tune runtime parameters to fix it? |
Try nudging 880 up to 912 on these three lines:
This may cause other problems, and I am surprised it got as large as 880. |
It is not a stack overflow in the compiler. It is the compiler reporting that when you try to run your program it may get a stack overflow at runtime. |
I note that you may not care about compiling the runtime package itself with |
Is it a stack checker, like address sanitizer, yes?
Ok, thank you. |
Comparing this to address sanitizer is somewhat misleading. Go stacks have unlimited size. This is implemented by a small prologue at each function which checks whether there is enough stack space available to run the function. If there is not, the entire stack is copied to a larger stack, and then the function continues. Implementing this requires some functions that do not copy the stack: functions that implement stack coying, that handle signals, that implement cgo calls. Those functions are in the runtime package. The test for whether there is enough stack space available to run a function ensures that there is a small amount of stack space always available to run those runtime functions if necessary. When you compile with |
Thanks. It's interesting. It's not a sanitizer, really, but more similar to stack guards. |
What actual problem are you trying to solve? |
I crossbuild people's go code with my own buildsystem, which executes go get/go build, and I need to implement debug mode for people, who want to debug under Linux/macos (and, maybe windows). |
Actually, closing in favor of #14319 |
What version of Go are you using (
go version
)?1.6.2 on Linux, 1.7 windows/amd64 on windows.
What operating system and processor architecture are you using (
go env
)?Windows x86_64, Linux x86_64, MacOS x86_64.
What did you do?
I had built go package and have got stack overflow in the go compiler (with a specific parameters combination). Problem is reproduced on all operating systems, described above.
What did you expect to see?
Compiled binary.
Remarks
Look at the
pkgdir
parameter,gcflags
-N
option and GOOS/GOARCH environment variables.Under Windows it was reproduced even without -pkgdir.
The text was updated successfully, but these errors were encountered: