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: invalid offset for DS form load/store 00376 while building kubernetes binaries on ppc64le platform #42181

Closed
mkumatag opened this issue Oct 24, 2020 · 11 comments

Comments

@mkumatag
Copy link

@mkumatag mkumatag commented Oct 24, 2020

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

[root@mkumatag-workspace kubernetes]# go version
go version devel +d05c035365 Sat Oct 24 02:36:08 2020 +0000 linux/ppc64le
[root@mkumatag-workspace kubernetes]#

Does this issue reproduce with the latest release?

yes seeing the issue post c3fe874

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

go env Output
$ go env

GO111MODULE=""
GOARCH="ppc64le"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="ppc64le"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/root/ds/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/ds"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/root/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/root/go/pkg/tool/linux_ppc64le"
GCCGO="gccgo"
GOPPC64="power8"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build710863202=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ git clone https://github.com/kubernetes/kubernetes.git
$ cd kubernetes
$ make cross

this runs underneath the following command which is failing:

go install -installsuffix static -gcflags ' -trimpath=/root/kubernetes' -asmflags -trimpath=/root/kubernetes -ldflags '-s -w -buildid= -X '\''k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.buildDate=2020-10-24T02:59:44Z'\'' -X '\''k8s.io/kubernetes/vendor/k8s.io/component-base/version.buildDate=2020-10-24T02:59:44Z'\'' -X '\''k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitCommit=1f756e4a375ce0fe7bd0e35f9dd45fec32df007a'\'' -X '\''k8s.io/kubernetes/vendor/k8s.io/component-base/version.gitCommit=1f756e4a375ce0fe7bd0e35f9dd45fec32df007a'\'' -X '\''k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitTreeState=dirty'\'' -X '\''k8s.io/kubernetes/vendor/k8s.io/component-base/version.gitTreeState=dirty'\'' -X '\''k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitVersion=v1.20.0-alpha.3.112+1f756e4a375ce0-dirty'\'' -X '\''k8s.io/kubernetes/vendor/k8s.io/component-base/version.gitVersion=v1.20.0-alpha.3.112+1f756e4a375ce0-dirty'\'' -X '\''k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitMajor=1'\'' -X '\''k8s.io/kubernetes/vendor/k8s.io/component-base/version.gitMajor=1'\'' -X '\''k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitMinor=20+'\'' -X '\''k8s.io/kubernetes/vendor/k8s.io/component-base/version.gitMinor=20+'\''' -tags selinux,notest, k8s.io/kubernetes/cmd/kube-proxy k8s.io/kubernetes/cmd/kube-apiserver k8s.io/kubernetes/cmd/kube-controller-manager k8s.io/kubernetes/cmd/kubeadm k8s.io/kubernetes/cmd/kube-scheduler k8s.io/kubernetes/cmd/kubectl

What did you expect to see?

clean run

What did you see instead?

+++ [1023 18:23:35] Building go targets for linux/ppc64le:
    cmd/kube-proxy
    cmd/kube-apiserver
    cmd/kube-controller-manager
    cmd/kubelet
    cmd/kubeadm
    cmd/kube-scheduler
    vendor/k8s.io/kube-aggregator
    vendor/k8s.io/apiextensions-apiserver
    cluster/gce/gci/mounter
# k8s.io/kubernetes/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec
compile: invalid offset for DS form load/store 00376 (/home/prow/go/src/github.com/kubernetes/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/default_value_decoders.go:694)	MOVD	R4, "".dc+17(R1)
!!! [1023 18:26:48] Call tree:
!!! [1023 18:26:48]  1: /home/prow/go/src/github.com/kubernetes/kubernetes/hack/lib/golang.sh:708 kube::golang::build_some_binaries(...)
!!! [1023 18:26:48]  2: /home/prow/go/src/github.com/kubernetes/kubernetes/hack/lib/golang.sh:863 kube::golang::build_binaries_for_platform(...)
!!! [1023 18:26:48]  3: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [1023 18:26:48] Call tree:
!!! [1023 18:26:48]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [1023 18:26:48] Call tree:
!!! [1023 18:26:48]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
make[1]: *** [Makefile:93: all] Error 1
make: *** [Makefile:507: cross] Error 1
@mkumatag
Copy link
Author

@mkumatag mkumatag commented Oct 24, 2020

Loading

@laboger
Copy link
Contributor

@laboger laboger commented Oct 26, 2020

Looks like it is storing the arg into the wrong offset before a call.

Loading

@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Oct 26, 2020

@dr2chase may be related to call lowering. Maybe we didn't put the right offset in some case?

Loading

@dr2chase
Copy link
Contributor

@dr2chase dr2chase commented Oct 26, 2020

Looks plausible that this is related to call lowering. Does reproducing this require that I run it on a PPC, or can I just specify GOARCH and GOLANG?

Loading

@dr2chase dr2chase self-assigned this Oct 26, 2020
@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Oct 26, 2020

Since it is a compile-time error, you probably can reproduce by doing a cross compilation. On the other hand, building Kubernetes is a painful process...

Loading

@dr2chase
Copy link
Contributor

@dr2chase dr2chase commented Oct 26, 2020

I am learning that. I like how the "cross" target doesn't tell me where to find the list of all the stuff it cross-compiles for -- who would ever need to know that?. I've been git-grepping and editing, thus far with no success in pruning the build.

Loading

@dr2chase
Copy link
Contributor

@dr2chase dr2chase commented Oct 26, 2020

This looks wrong. Consider what happens if a boolean field precedes a pointer:

func (e *ssafn) SplitStruct(name ssa.LocalSlot, i int) ssa.LocalSlot {
	n := name.N.(*Node)
	st := name.Type
	ft := st.FieldType(i)
	var offset int64
	for f := 0; f < i; f++ {
		offset += st.FieldType(f).Size()
	}
	if n.Class() == PAUTO && !n.Name.Addrtaken() {
		// Note: the _ field may appear several times.  But
		// have no fear, identically-named but distinct Autos are
		// ok, albeit maybe confusing for a debugger.
		return e.splitSlot(&name, "."+st.FieldName(i), offset, ft)
	}

There is nonetheless something peculiar about PPC here, versus the other architectures.

Loading

@laboger
Copy link
Contributor

@laboger laboger commented Oct 26, 2020

Maybe the file you are looking for is hack/lib/golang.sh?

I have been able to isolate the failing compile command on a ppc64le, but not sure how to get anything useful from there since the compile fails. If there is something I can generate let me know.

Loading

@dr2chase
Copy link
Contributor

@dr2chase dr2chase commented Oct 26, 2020

I have what looks like a fix, testing it now to see if it broke anything else.

Loading

@dr2chase
Copy link
Contributor

@dr2chase dr2chase commented Oct 26, 2020

I am a little mystified at the code I included above; perhaps in the AUTO case it simply does not matter. The bug in my code is that it ONLY uses that loop-computed offset, which is clearly going to go wrong. What's unclear is if there is any problem in not using that loop-computed offset -- I have to assume we never did use it, else PPC would fail a lot more.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Oct 26, 2020

Change https://golang.org/cl/265277 mentions this issue: cmd/compile: make sure field offset is alsigned for structure splitting

Loading

@gopherbot gopherbot closed this in 2414e1f Oct 28, 2020
@golang golang locked and limited conversation to collaborators Dec 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants