Skip to content
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/cgo: panic in main.(*Package).rewriteRef(0x1043c4d0, 0x1040a080) #8980

Closed
davecheney opened this issue Oct 22, 2014 · 16 comments

Comments

@davecheney
Copy link
Contributor

commented Oct 22, 2014

What steps will reproduce the problem?

On a linux/arm host

env CC=clang ./all.bash

What is the expected output? What do you see instead?

# os/user
os/user/lookup_unix.go:49:10: type C.struct_passwd: undefined C type 'struct passwd'
os/user/lookup_unix.go:50:14: type C.struct_passwd: undefined C type 'struct passwd'
os/user/lookup_unix.go:52:14: type C.long: undefined C type 'long'
os/user/lookup_unix.go:59:13: call of non-function C.sysconf
os/user/lookup_unix.go:59:23: unable to find value of constant C._SC_GETPW_R_SIZE_MAX
os/user/lookup_unix.go:64:9: call of non-function C.malloc
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x1d9ec]

goroutine 1 [running]:
main.(*Package).rewriteRef(0x1043c4d0, 0x1040a080)
        /home/dfc/go/src/cmd/cgo/gcc.go:610 +0xee4
main.(*Package).Translate(0x1043c4d0, 0x1040a080)
        /home/dfc/go/src/cmd/cgo/gcc.go:184 +0x188
main.main()
        /home/dfc/go/src/cmd/cgo/main.go:231 +0xf54

Please use labels and text to provide additional information.

dfc@qnap:~/go/src$ uname -a
Linux qnap 3.14-2-kirkwood #1 Debian 3.14.15-2 (2014-08-09) armv5tel GNU/Linux
dfc@qnap:~/go/src$ clang -v
Debian clang version 3.5.0-6 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
Target: arm-unknown-linux-gnueabi
Thread model: posix
Found candidate GCC installation: /usr/bin/../lib/gcc/arm-linux-gnueabi/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/arm-linux-gnueabi/4.9.1
Found candidate GCC installation: /usr/lib/gcc/arm-linux-gnueabi/4.9
Found candidate GCC installation: /usr/lib/gcc/arm-linux-gnueabi/4.9.1
Selected GCC installation: /usr/bin/../lib/gcc/arm-linux-gnueabi/4.9
Candidate multilib: .;@m32
Selected multilib: .;@m32

dfc@qnap:~/go/src$ hg parents
changeset:   21552:66a91d217fcb
tag:         tip
user:        Dave Cheney <dave@cheney.net>
date:        Wed Oct 22 12:30:15 2014 +1100
summary:     runtime/cgo: encode BLX directly, fixes one clang build error on arm
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Oct 23, 2014

Comment 1:

Does anybody have an easy way to try clang 3.5 on amd64?

Labels changed: added repo-main, release-go1.4.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 28, 2014

Comment 2:

The linux-amd64-clang builder runs clang 3.5.0 (but a slightly different minor minor
version) and seems to be okay. This seems like it may be somehow specific to arm. Or
perhaps just specific to that minor version.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 29, 2014

Comment 3:

Dave, if you can reproduce this, please cd into os/user and run go tool cgo
lookup_unix.go. Please post a comment with the crash message and attach the contents of
the os/user/_cgo directory it leaves behind. Thanks.

Labels changed: added release-go1.4maybe, removed release-go1.4.

Status changed to Accepted.

@davecheney

This comment has been minimized.

Copy link
Contributor Author

commented Nov 2, 2014

Comment 4:

dfc@qnap:~/go/src/os/user$ env CC=clang go tool cgo lookup_unix.go
/home/dfc/go/src/os/user/lookup_unix.go:49:10: type C.struct_passwd: undefined C type
'struct passwd'
/home/dfc/go/src/os/user/lookup_unix.go:50:14: type C.struct_passwd: undefined C type
'struct passwd'
/home/dfc/go/src/os/user/lookup_unix.go:52:14: type C.long: undefined C type 'long'
/home/dfc/go/src/os/user/lookup_unix.go:59:13: call of non-function C.sysconf
/home/dfc/go/src/os/user/lookup_unix.go:59:23: unable to find value of constant
C._SC_GETPW_R_SIZE_MAX
/home/dfc/go/src/os/user/lookup_unix.go:64:9: call of non-function C.malloc
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x1d9ec]
goroutine 1 [running]:
main.(*Package).rewriteRef(0x1043a540, 0x10434040)
    /home/dfc/go/src/cmd/cgo/gcc.go:610 +0xee4
main.(*Package).Translate(0x1043a540, 0x10434040)
    /home/dfc/go/src/cmd/cgo/gcc.go:184 +0x188
main.main()
    /home/dfc/go/src/cmd/cgo/main.go:231 +0xf54

Attachments:

  1. _obj.tar (10240 bytes)
@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 19, 2014

Comment 5:

Labels changed: added release-go1.5, removed release-go1.4maybe.

@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014

@bradfitz bradfitz removed the release-go1.5 label Dec 16, 2014

@rsc rsc removed accepted labels Apr 14, 2015

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2015

@davecheney Can you see if http://golang.org/11222 fixes the problem? It looks right to me but I have no way to test it.

@gopherbot

This comment has been minimized.

Copy link

commented Jun 18, 2015

CL https://golang.org/cl/11222 mentions this issue.

@davecheney

This comment has been minimized.

Copy link
Contributor Author

commented Jun 18, 2015

@ianlancetaylor i'll take a look, it might take some time, that machine has been turned off and packed away.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2015

I guess anybody with an ARM GNU/Linux system could try it.

@davecheney

This comment has been minimized.

Copy link
Contributor Author

commented Jun 18, 2015

I'll try tonight, but I ended up uninstalling clang from all my hosts a
while back, so I need to fix that.

On Thu, 18 Jun 2015 15:24 Ian Lance Taylor notifications@github.com wrote:

I guess anybody with an ARM GNU/Linux system could try it.


Reply to this email directly or view it on GitHub
#8980 (comment).

@davecheney

This comment has been minimized.

Copy link
Contributor Author

commented Jun 18, 2015

@ianlancetaylor

sorry, doesn't look like it's fixed

# net
net/cgo_linux.go:20:26: unable to find value of constant C.AI_CANONNAME
net/cgo_linux.go:20:43: unable to find value of constant C.AI_V4MAPPED
net/cgo_linux.go:20:59: unable to find value of constant C.AI_ALL
net/internal/socktest
os/signal
os/user
# os/user
os/user/lookup_unix.go:55:10: type C.struct_passwd: undefined C type 'struct passwd'
os/user/lookup_unix.go:56:14: type C.struct_passwd: undefined C type 'struct passwd'
os/user/lookup_unix.go:58:14: type C.long: undefined C type 'long'
os/user/lookup_unix.go:65:13: call of non-function C.sysconf
os/user/lookup_unix.go:65:23: unable to find value of constant C._SC_GETPW_R_SIZE_MAX
os/user/lookup_unix.go:70:9: call of non-function C.malloc
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x1cd8c]

goroutine 1 [running]:
main.(*Package).rewriteRef(0x10566000, 0x10548100)
        /root/go/src/cmd/cgo/gcc.go:600 +0x102c
main.(*Package).Translate(0x10566000, 0x10548100)
        /root/go/src/cmd/cgo/gcc.go:170 +0x174
main.main()
        /root/go/src/cmd/cgo/main.go:241 +0xe98
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2015

@davecheney Thanks for testing. That is bizarre. With the CL applied I could certainly expect other problems, but I can't understand how you are seeing the same problems.

I don't suppose the system is available for ssh?

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2015

@davecheney I bet you just tried to rebuild os/user rather than running all.bash. I see that too. The patch is to cmd/cgo, though, so you need to "go install cmd/go" before trying to rebuild os/user.

@davecheney

This comment has been minimized.

Copy link
Contributor Author

commented Jun 19, 2015

This was running

env CC=clang ./all.bash

I'll try to get you SSH to this host. Pls email me a key

On Fri, 19 Jun 2015 15:52 Ian Lance Taylor notifications@github.com wrote:

@davecheney https://github.com/davecheney I bet you just tried to
rebuild os/user rather than running all.bash. I see that too. The patch is
to cmd/cgo, though, so you need to "go install cmd/go" before trying to
rebuild os/user.


Reply to this email directly or view it on GitHub
#8980 (comment).

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2015

Hmmm. bradfitz got me onto an ARM GNU/Linux machine, all.bash failed without CL 11222, passed with it. I only tested the most recent version of the CL, using clang-3.5.

I will send you an SSH key.

@davecheney

This comment has been minimized.

Copy link
Contributor Author

commented Jun 27, 2015

Confirmed. Thanks Ian.

On Sat, Jun 27, 2015 at 2:18 AM, Ian Lance Taylor notifications@github.com
wrote:

Closed #8980 #8980 via 61cd48b
61cd48b
.


Reply to this email directly or view it on GitHub
#8980 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants
You can’t perform that action at this time.