Skip to content

cmd/compile: ICE: "makeABIWrapper support for wrapping methods not implemented" #52774

Closed

Description

@ii64

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.

Activity

  1. randall77 commented on May 8, 2022

    @randall77
    Contributor

    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.

  2. gopherbot commented on May 8, 2022

    @gopherbot
    Contributor

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

  3. locked and limited conversation to collaborators on May 8, 2023
  4. added a commit that references this issue on Sep 19, 2024
    eed7757
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions