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/link: relocation addend overflows on darwin/arm64 #42738
Comments
CC @cherrymui. |
What is your program? Do you actually allocate 1729382219220254720 byte? |
It's hashicorp's nomad Looks like this may be specific to cgo, if I set I don't believe we deliberately allocate 1729382219220254720 bytes; this program compiles and runs with cgo enabled on all the major platforms. |
The size of the Can you give complete and precise instructions for recreating the problem, starting from scratch? Thanks. |
I noticed the problem also exists with Consul, which is easier to build and has fewer interesting dependencies. This script should be enough to recreate the problem in an isolated-ish setup. #!/usr/bin/env bash
set -euo pipefail
# Setup GOPATH
export GOPATH="$(mktemp -d)/go"
mkdir -p "${GOPATH}/src/github.com/hashicorp"
# Clone consul
git clone -b v1.8.5 git@github.com:hashicorp/consul.git "${GOPATH}/src/github.com/hashicorp/consul"
pushd "${GOPATH}/src/github.com/hashicorp/consul"
# Install and sign
go install
codesign -s - "${GOPATH}/bin/consul"
# Try to run
${GOPATH}/bin/consul |
I tried the consul@v1.8.5 repro and I'm able to reproduce on a M1 Mac with 8 GB RAM at:
I minified it down to: package main
import _ "github.com/hashicorp/consul/command"
func main() {} Then to: go.mod
package main
import (
"github.com/hashicorp/consul/agent"
"github.com/hashicorp/consul/command/flags"
"github.com/mitchellh/cli"
)
func main() { println("issue 42738") }
func init() {
registry["agent"] = func(ui cli.Ui) (cli.Command, error) {
return (*cmd)(nil), nil
}
}
type cmd struct {
_ *flags.HTTPFlags
}
func (*cmd) Run(args []string) int {
agent.NewBaseDeps(nil, nil)
return 1
}
func (*cmd) Synopsis() string { return "" }
func (*cmd) Help() string { return "" }
type Factory func(cli.Ui) (cli.Command, error)
var registry = make(map[string]Factory) Which fails in the same way when run:
Yet:
If either In case it helps, here's output of both runs with
|
In the course of whittling this down I ran into this panic, seems like it might just be another side affect of memory corruption?
|
This issue doesn’t have a milestone yet. I don’t know what it should be set to, but I’ll try Go1.16 optimistically, since it would be good if it is possible to resolve it by then and allow affected Go programs to run. |
Those allocation sizes are enormous, which doesn't make sense. In fact, those hex looks like instruction bytes (e.g. 97b93923f94023e3 is |
I think I understand it now. In Not sure what the best solution is. Maybe we should not create such big symbols when combining type symbols (and other "grouped" symbols). That would need a non-trivial amount of work, though. |
Change https://golang.org/cl/276694 mentions this issue: |
Mach-O relocation addend is signed 24-bit. If the addend overflows, it is better to fail the build than emitting an incorrect binary. (I'm still working on a fix.) Updates #42738. Change-Id: I647f0cd4f6b84d9ac75ef3bf36673bea01dfc211 Reviewed-on: https://go-review.googlesource.com/c/go/+/276694 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
Change https://golang.org/cl/278332 mentions this issue: |
CL https://golang.org/cl/278332 should fix this. Could you give it a try? Thanks. |
@cherrymui looks like that CL did the trick!
|
Thanks for confirming! |
Apologies if it's too early to be filing bugs around darwin/arm64 or if this is already known.
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Built Go following #38485 (comment)
Build nomad
f-darwin-arm64
branchRun
nomad version
What did you expect to see?
Version output
What did you see instead?
The text was updated successfully, but these errors were encountered: