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

ARMv7 (5g, 5l) #898

Closed
gopherbot opened this issue Jul 1, 2010 · 6 comments
Closed

ARMv7 (5g, 5l) #898

gopherbot opened this issue Jul 1, 2010 · 6 comments

Comments

@gopherbot
Copy link

by chris.vanhorne:

Tested against release (as of 6/30/10) and tip (6470c731be0).

GOARCH=arm, GOOS=linux, gcc=4.4.3 (Ubuntu 4.4.3-4ubuntu5)

Code running under the ARMv7 architecture [1] compiled with 5g/5l does not exhibit the
same behavior as 386 8g/8l.

Using the simple web server example from golang.org [2], the IP and Port values become
null and 0 when the type is converted from a TCPAddr to sockaddr.

ListenTCP in net/tcpsock.go is passed an instance of type TCPAddr which is then
converted to a sockaddr via the toAddr() call in net/tcpsock.go, but the IP and Port
fields are then null and 0 when entering the toAddr function. This later causes an
allocation loop when attempting to call TCPAddr.String() with null arguments in
net/fd.go:newFD at the following line:
        var ls, rs string
        if laddr != nil {
                ls = laddr.String() // stuck and looped allocation here
        }

With a few rudimentary debugging print statements [3], the differences between the 386
and ARM code can be seen when attempting to run the example Go web server:

386:/tmp$ ./test
net/tcpsock.go:toAddr: a.IP=, a.Port=12345
net/tcpsock.go:sockaddr: a.IP=, a.Port=12345
net/ipsock.go:ipToSockaddr: ip=, port=12345
^C
386:/tmp$

and the ARM execution:
# ./test
net/tcpsock.go:toAddr: a.IP=, a.Port=12345
net/tcpsock.go:sockaddr: a.IP=?, a.Port=0
net/ipsock.go:ipToSockaddr: ip=?, port=0
[1]   Killed                  ./test 
arm#


[1] 
# cat /proc/cpuinfo
Processor       : ARMv7 Processor rev 2 (v7l)
BogoMIPS        : 162.54
Features        : swp half thumb fastmult vfp edsp thumbee neon
CPU implementer : 0x51
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0x00f
CPU revision    : 2


[2] 
package main

import (
       "fmt"
       "http"
)

func handler(c *http.Conn, r *http.Request) {
       fmt.Fprintf(c, "Hi there, I love %s!", r.URL.Path[1:])
}

func main() {
       http.HandleFunc("/", handler)
       http.ListenAndServe(":8080", nil)
}


[3] Attached diff with print debugging

Attachments:

  1. debug1.diff (1187 bytes)
@rsc
Copy link
Contributor

rsc commented Jul 1, 2010

Comment 1:

Owner changed to k...@golang.org.

Status changed to Accepted.

@gopherbot
Copy link
Author

Comment 2 by tereniaopensim:

I wonder if this is caused by the issue reported in #588

@KaiBackman
Copy link

Comment 3:

Owner changed to k...@golang.org.

@gopherbot
Copy link
Author

Comment 4 by stephenm@golang.org:

This seems to have been fixed in the tip (e3c23620297a) - a quick test on an arm7 under
ubuntu 10.10 doesn't show any problems with the example code that you cite. Not sure
exactly what change would have fixed the problem. Can you please check again with the
most recent tip? Thanks.

Owner changed to stephenm@golang.org.

Status changed to WaitingForReply.

@gopherbot
Copy link
Author

Comment 5 by chris.vanhorne:

Tested with r57 and the above code works now (s/Conn/ResponseWriter/). Device used was
an ARMv7 HTC Evo.

@gopherbot
Copy link
Author

Comment 6 by stephenm@golang.org:

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants