You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ go version
go version devel +5c9035a Fri Dec 2 19:19:03 2016 +0000 linux/amd64
$ cd $GOROOT/src/net/http
$ go test -a -gcflags '-l=4' -v .
# testmain
net/http.(*http2Transport).RoundTripOpt: relocation target net.byteIndex not defined
net/http.(*http2Transport).RoundTripOpt: relocation target net.byteIndex not defined
net/http.(*http2ClientConn).encodeHeaders: relocation target net.byteIndex not defined
net/http.(*http2ClientConn).encodeHeaders: relocation target net.byteIndex not defined
net/http.cleanHost: relocation target net.byteIndex not defined
net/http.cleanHost: relocation target net.byteIndex not defined
...
net/http.cleanHost: undefined: "net.byteIndex"
/home/david/go/pkg/tool/linux_amd64/link: too many errors
FAIL net/http [build failed]
Let's look at the cleanHost function in net/http/request.go to understand what's happening. The cleanHost function calls net.JoinHostPort, which is inlined by the compiler. The body of net.JoinHostPort has a call to net.byteIndex which is linknamed in net/parse.go:
//go:linkname byteIndex strings.IndexByte
func byteIndex(s string, c byte) int
The export data used to inline net.JoinHostPort does not include linknames, so the compiler can't find net.byteIndex when it appears in the body of cleanHost after inlining.
One solution is to include linknames in export data.
The text was updated successfully, but these errors were encountered:
The
net/http
tests fail with-l=4
:Let's look at the
cleanHost
function innet/http/request.go
to understand what's happening. ThecleanHost
function callsnet.JoinHostPort
, which is inlined by the compiler. The body ofnet.JoinHostPort
has a call tonet.byteIndex
which is linknamed innet/parse.go
:The export data used to inline
net.JoinHostPort
does not include linknames, so the compiler can't findnet.byteIndex
when it appears in the body ofcleanHost
after inlining.One solution is to include linknames in export data.
The text was updated successfully, but these errors were encountered: