Skip to content

cmd/compile: malformed linker symbol for generic method with a receiver that is an alias to a pointer #81165

Closed

Description

@GongT

Go version

go version go1.27.0 linux/amd64

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE='auto'
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN='/data/DevelopmentRoot/GoLang/bin'
GOCACHE='/data/Volumes/CacheSlow/golang'
GOCACHEPROG=''
GODEBUG=''
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/golang/go-build1023568466=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/data/DevelopmentRoot/github.com/gongt/go/go.mod'
GOMODCACHE='/data/Volumes/CacheSlow/golang.mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPACKAGESDRIVER=''
GOPATH='/data/DevelopmentRoot/GoLang'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org'
GOROOT='/opt/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.27.0'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

go build main.go

package main

import "fmt"

type someType struct{}
type Alias = *someType

//go:noinline
func (tm Alias) FailedLink[T any](v T) {
	fmt.Println(v)
}

//go:noinline
func (tm *someType) SuccessLink[T any](v T) {
	fmt.Println(v)
}

func main() {
	var value someType
	value.SuccessLink(42)
	value.FailedLink(42)
}

What did you see happen?

main.main: relocation target main.(*someType).FailedLink[go.shape.int] not defined

What did you expect to see?

It should compile

Activity

  1. self-assigned this
    on Aug 28, 2026
  2. gopherbot commented on Aug 28, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/823684 mentions this issue: cmd/compile: fix incorrect qualifying generic methods with alias receiver

  3. mrkfrmn commented on Aug 28, 2026

    @mrkfrmn
    Contributor

    @gopherbot please backport this to Go 1.27—this is correct code that should compile.

  4. changed the title [-]cmd/compile: link fail when receiver is a pointer type alias[/-] [+]cmd/compile: malformed linker symbol for generic method with a receiver that is an alias to a pointer[/+] on Aug 28, 2026
  5. gopherbot commented on Aug 28, 2026

    @gopherbot
    Contributor

    Backport issue(s) opened: #81195 (for 1.27).

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

  6. added a commit that references this issue on Aug 28, 2026
    ea7d327
  7. added this to the Go1.28 milestone on Aug 28, 2026
  8. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    on Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

NeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions