-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
cmd/link, runtime: Invalid symbol table for cgo function #10747
Comments
so the panic only happens with -linkmode=internal?
If that's the case, it's probably because the linker set maxpc of the main
moduledata to cover all the functions (notably, including the external
functions), rather than only the Go functions.
|
Smaller replication at http://play.golang.org/p/vbF8LEsMsm Prints
in internal mode
in auto mode. |
This bug is why the race detector builds are intermittently failing. I'll have a shot at this. |
The simple fix of just not putting out pcln info for external functions didn't seem to work. Leaving this for people who know the linker. |
CL https://golang.org/cl/11652 mentions this issue. |
CL https://golang.org/cl/11657 mentions this issue. |
The old code was recording the current table output offset, so the table from the next function would be used instead of the runtime realizing that there was no table at all. Add debug constant in runtime to check this for every function at startup. It's too expensive to do that by default, but we can do the last five functions. The end of the table is usually where the C symbols end up, so that's where the problems typically are. Fixes #10747. Fixes #11396. Change-Id: I13592e78017969fc22979fa902e19e1b151d41b1 Reviewed-on: https://go-review.googlesource.com/11657 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Russ Cox <rsc@golang.org>
While running cgo tests for https://go-review.googlesource.com/#/c/9506/, I encountered a problem where the symbol table will return an invalid entry if queried for a cgo function. Even though we don't seem to lookup cgo functions in the symbol table right now, I'd expect it to return nil instead of an invalid entry. Reproducing is a case of applying the testing patch on top of 9506 and running
GOTRACEBACK=3 go test -ldflags '-linkmode=internal'
in misc/cgo/test. Fails about 50% of the time.The Error
While the function for the PC 0x582ef6 is:
This is the testing patch applied on top of CL9506:
The text was updated successfully, but these errors were encountered: