Skip to content

cmd/link: external linking is not reproducible on some platforms #46334

Open
@mdempsky

Description

@mdempsky

I've noticed that running go build -a -v -toolexec='toolstash -cmp' std cmd fails on ppc64le, because some binaries (e.g., cmd/pprof) report differences.

I haven't investigated much yet, but as a hunch I suspect it's related to ppc64le not supporting internal linking for cgo. E.g., cmd/pprof depends on net (which uses cgo) and fails, but cmd/gofmt passes. Also, I'm not able to reproduce the issue when cross-building either ppc64le->amd64 or amd64->ppc64le (where both modes disable cgo), or if I build natively on ppc64le with CGO_ENABLED=0.

Notably though, go build -ldflags=-linkmode=external -toolexec='toolstash -cmp' cmd/pprof does not fail on amd64. So maybe the non-determinism is specific to the external linker used on my ppc64le system vs my amd64 system.

Happy to run additional experiments to help narrow down the cause of failure.

My ppc64le system is running Fedora 34, with GCC 11.0.1 and GNU ld 2.35.1-41.fc34. The amd64 test system is a Google corp workstation.

/cc @cherrymui @rsc

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    Status

    Triage Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions