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: ICE: "makeABIWrapper support for wrapping methods not implemented" #52774

Closed
ii64 opened this issue May 8, 2022 · 2 comments
Closed

Comments

@ii64
Copy link

@ii64 ii64 commented May 8, 2022

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

$ go version
go version go1.18.1 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ii64/.cache/go-build"
GOENV="/home/ii64/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ii64/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ii64/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.1"
GCCGO="/usr/local/bin/gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3997478366=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Wrapping (Msd).String() with decorator_func_String, and put it back using //go:linktime

https://go.dev/play/p/16jLlQCA9Yf

package main

import _ "unsafe"

type Msd struct {
	In string
}

func (m Msd) String() string {
	return `{In:"` + m.In + `"}`
}

//go:linkname decorator_orig_func_String Msd.String
func decorator_orig_func_String(m Msd) string

//go:linkname Msd.String decorator_func_String
func decorator_func_String(m Msd) string {
	return decorator_orig_func_String(m)
}

func main() {
	println(Msd{"hello world"}.String())
}

What did you expect to see?

Compiled successfully

What did you see instead?

<autogenerated>:1: internal compiler error: panic: makeABIWrapper support for wrapping methods not implemented

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new

Go build failed.
@randall77
Copy link
Contributor

@randall77 randall77 commented May 8, 2022

Yes, you can't linkname to a method currently. I'll update the error message to make it clear it is a missing feature, not an ICE.

@gopherbot
Copy link

@gopherbot gopherbot commented May 8, 2022

Change https://go.dev/cl/404936 mentions this issue: cmd/compile: trying to linkname a method is not an ICE, just an error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants