-
Notifications
You must be signed in to change notification settings - Fork 18k
gccgo with ld.gold: panic when running code that works with go 1.6.1 #15549
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
@tamird -- I tried to reproduce this bug today, but could not build the package in question: % go get -d github.com/cockroachdb/cockroach/sql github.com/cockroachdb/cockroach/roachpbgb.xjqchip.workers.dev/cockroachdb/cockroach/roachpb/api.pb.go:1486: undefined: grpc.SupportPackageIsVersion2 It looks as though the protobuf go sources need to be regenerated? |
Please use the |
Thanks. I can now sql to build and the test runs.
gccgo runtime is currently back at 1.4. |
Something's funky here - we are definitely not building on 1.7. Take a look at the file from which the error is originating: https://github.com/golang/net/blob/master/context/go17.go#L5 Why is it being compiled? Looks like you found another bug in gccgo. |
Hmm-- I think i may have shot myslef in the foot there (I modified the makefile to get around the version check). Stay tuned, I will try again. |
I suspect the problem you are having is that the Go 1.7 version of the go tool sets the go1.7 build tag irrespective of the version of gccgo (#8851). You will generally have a better time if you use the version of the go tool that comes with the version of gccgo you are using -- on Debian/Ubuntu that would be installed as /usr/bin/go-6. |
I am able to build now with gccgo after recreating my GOPATH from scratch. So far I have not been able to reproduce the panic, however-- test passes OK. This is with top-of-trunk gcc/gccgo; I will make another attempt using the official GCC 6.1.0 bits. @tamird, is there anything you can recommend that will speed up the cockroachdb builds? The build process includes a lot of C++ compilations, all of which are being done serially, so I am spending much time waiting for compiles to complete. I tried passing -j20 to make and GOFLAGS="-p 20", but from what I can tell GOFLAGS isn't being passed through to 'glock's, so there is zero parallelism. |
OK, I am stumped. I repeated the process with a fresh copy of gcc 6.1.0 built with ../gcc-6.1.0/configure --prefix=/tmp/gcc-6.1.0/cross --enable-languages=c,c++,go --enable-libgo --disable-bootstrap and I get the same result (test passes, no panic). |
@tamird -- closing this bug out for now, since I can't reproduce it. Please re-open if there is a better reproducer. |
@thanm sorry for the delay, I was out last week. I notice that you compiled gcc using different flags than I did. It's also possible that today's version of Cockroach doesn't tickle this bug. I'm re-testing now. |
OK, bad things still happen with a current version of CockroachDB (this time it's a segfault):
Note that this gccgo was compiled using:
Now testing without the gold linker. |
Indeed, this doesn't repro without the gold linker (but continues to repro with it):
For reference, I'm using:
@thanm I can't reopen this myself, could you? |
Thanks, that's helpful. I'll take another shot with gold enabled. |
The crash is taking place early, during static initialization for the main load module. Trace below. Things look kosher as far as I can tell until we hit je_malloc_mutex_init, where it looks as though there is a linker issue. The more-stack sequence in the prolog of the function is OK, but once we get into the main body things are messed up. Here is the code:
and here is the object code from the .o file:
however here is the object code from the a.out:
The other calls in the function are similarly mangled (target of zero). Not sure how this happened, but it would definitely point to a linker error. I'll see about building a debuggable ld.gold to find out what is going haywire. Full trace:
|
OK, it appears that the mysterious "callq 0" is due to the linker options, which include " -Wl,-unresolved-symbols=ignore-all". When I remove that, the link fails with /tmp/go-build793160650/github.com/cockroachdb/cockroach/sql/_test/_testmain.go:2: error: undefined reference to 'internal_golang_org_x_net_http2_hpack..import' Adding -lpthread eliminates the pstread issues, but doesn't eliminate the undefined reference to internal_golang_org_x_net_http2_hpack..import. Still working on tracking that down. I would suggest removing " -Wl,-unresolved-symbols=ignore-all" from the linker options -- that seems like asking for trouble from my perspective. |
Couldn't agree more! However: #14985 On Jul 27, 2016 15:08, "Than McIntosh" [email protected] wrote:
|
Update: the internal_golang_org_x_net_http2_hpack..import undef was a red herring (pilot error). I can get the test to pass by adding "-lpthread" to cli/start_jemalloc.go immediately following the "-Wl,-unresolved-symbols=ignore-all". E.g. -// #cgo linux LDFLAGS: -Wl,-unresolved-symbols=ignore-all Will close out the bug again assuming you can reproduce this. |
How come |
This is needed when using gccgo with ld.gold. See golang/go#15549.
Ah, this is of course a different between Confirmed that this is working. Thanks for digging! |
Please answer these questions before submitting your issue. Thanks!
go version
)?go env
)?Note I had to first delete
github.com/cockroachdb/cockroach/sql/{parallel,logic}_test.go
due to #15544.Note I had to use
-gccgoflags='-Xlinker --allow-multiple-definition
due to #15547.The text was updated successfully, but these errors were encountered: