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/compile, cmd/link: relocation target go.builtin.error.Error not defined #29304

Closed
akavel opened this issue Dec 17, 2018 · 7 comments

Comments

Projects
None yet
6 participants
@akavel
Copy link
Contributor

commented Dec 17, 2018

What version of Go are you using (go version)?

$ go version
go version go1.11.3 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

Repro on play.golang.org.

What did you do?

https://play.golang.org/p/6NvGso5fqRg

package main

import (
	"fmt"
)

func main() {
	var err error
	fmt.Println(error.Error(err))
}

What did you expect to see?

Some understandable/user-friendly error message, pointing to line 9. (Or, actually, maybe this line is actually correct and should compile? Not 100% sure. With go1.9 it seemed to compile correctly and work!)

What did you see instead?

main.main: relocation target go.builtin.error.Error not defined

@akavel akavel changed the title relocation target go.builtin.error.Error not defined compile: relocation target go.builtin.error.Error not defined Dec 17, 2018

@akavel akavel changed the title compile: relocation target go.builtin.error.Error not defined relocation target go.builtin.error.Error not defined Dec 17, 2018

@bradfitz bradfitz changed the title relocation target go.builtin.error.Error not defined cmd/compile: relocation target go.builtin.error.Error not defined Dec 17, 2018

@bradfitz bradfitz added the NeedsFix label Dec 17, 2018

@bradfitz bradfitz changed the title cmd/compile: relocation target go.builtin.error.Error not defined cmd/compile, cmd/link: relocation target go.builtin.error.Error not defined Dec 17, 2018

@bradfitz

This comment has been minimized.

Copy link
Member

commented Dec 17, 2018

This worked in Go 1.10 but was broken in Go 1.11.

cmd/compile succeeds but cmd/link fails. Not sure whether cmd/compile output garbage, though.

bradfitz@gdev:~$ cat > x.go
package main

import (
        "fmt"
        "reflect"
)

func main() {
        fmt.Println(reflect.TypeOf(error.Error))
}


bradfitz@gdev:~$ GOROOT=$HOME/go1.10 go run x.go
func(error) string

bradfitz@gdev:~$ GOROOT=$HOME/go1.11 go run x.go
# command-line-arguments
go.builtin.error.Error·f: relocation target go.builtin.error.Error not defined

bradfitz@gdev:~$ go run x.go
# command-line-arguments
go.builtin.error.Error·f: relocation target go.builtin.error.Error not defined

/cc @griesemer @mdempsky @josharian @cherrymui @heschik @ianlancetaylor

@bradfitz bradfitz added this to the Go1.12 milestone Dec 17, 2018

@bradfitz

This comment has been minimized.

Copy link
Member

commented Dec 17, 2018

Probably warrants a backport too.

@ALTree

This comment has been minimized.

Copy link
Member

commented Dec 17, 2018

git bisect points to 80bbad0 (cmd/compile: omit unnecessary interface method expression wrappers).

@griesemer

This comment has been minimized.

Copy link
Contributor

commented Dec 17, 2018

Simpler reproducer:

package main

func main() {
	_ = error.Error(nil)
}
@gopherbot

This comment has been minimized.

Copy link

commented Dec 17, 2018

Change https://golang.org/cl/154578 mentions this issue: cmd/compile: generate interface method expression wrapper for error.Error

@bradfitz

This comment has been minimized.

Copy link
Member

commented Dec 17, 2018

@gopherbot, please backport to Go 1.11.

@gopherbot

This comment has been minimized.

Copy link

commented Dec 17, 2018

Backport issue(s) opened: #29307 (for 1.11).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.