You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to run Android builders directly from the device without a host. To do that, make.bash must successfully complete. However, the Android kernel will only execute PIE executables, which means that the toolchain must be built with the equivalent of -buildmode=pie enabled all the time.
After hacking buildmode=pie, ./make.bash will complain that the bootstrap process does not converge. The root cause is that the build ids of the toolchain never converge.
To demonstrate the problem, I'm building cmd/compile with buildmode=pie on my host linux machine and comparing the build ids.
What version of Go are you using (go version)?
$ go version
go version devel +cb6646234c Fri Apr 5 20:54:50 2019 +0000 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
$ go install -buildmode=pie cmd/compile && file ../pkg/tool/linux_amd64/compile
../pkg/tool/linux_amd64/compile: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, Go BuildID=p1yMqYIYR70YO68fXa_U/2AOqrHjBazbV9Pmqp2sx/mXSClqAD4HkdJo6pdJuD/f1DbS9Mtz2lCJo8Le99p, BuildID[sha1]=4bf0f9af8307f82987827bc36d9df21b954621dc, not stripped
$ go install -buildmode=pie cmd/compile && file ../pkg/tool/linux_amd64/compile
../pkg/tool/linux_amd64/compile: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, Go BuildID=3JjeFa844Dxo9khAB0VA/4Cl1BAWmnJOrPX_KfkEv/mXSClqAD4HkdJo6pdJuD/TdYbWSqMM26Lmo_Gf6WL, BuildID[sha1]=68be3330ad82371c8c3823114e337ef9a3a26e03, not stripped
What did you expect to see?
The same build ids in two consecutive builds of cmd/compile.
What did you see instead?
The build ids never converge.
buildmode=pie enables external linking (#18968), but the test for reproducible Cgo builds does pass for me with PIE enabled:
$ go test -buildmode=pie -run TestCgoConsistentResults cmd/go
ok cmd/go 2.318s
The text was updated successfully, but these errors were encountered:
It seems the culprit the ELF build ids. Using --build-id=none makes the build ids match:
$ CGO_LDFLAGS="-Wl,--build-id=none" go install -buildmode=pie -a cmd/compile && file ../pkg/tool/linux_amd64/compile
../pkg/tool/linux_amd64/compile: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, Go BuildID=VzdcHcFht3eH3P1KPRnn/ZK6he554u3xbpIEMBilo/mXSClqAD4HkdJo6pdJuD/aM9_XXpJYAYVBAex8sXW, not stripped
$ CGO_LDFLAGS="-Wl,--build-id=none" go install -buildmode=pie -a cmd/compile && file ../pkg/tool/linux_amd64/compile
../pkg/tool/linux_amd64/compile: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, Go BuildID=VzdcHcFht3eH3P1KPRnn/ZK6he554u3xbpIEMBilo/mXSClqAD4HkdJo6pdJuD/aM9_XXpJYAYVBAex8sXW, not stripped
I'm trying to run Android builders directly from the device without a host. To do that, make.bash must successfully complete. However, the Android kernel will only execute PIE executables, which means that the toolchain must be built with the equivalent of -buildmode=pie enabled all the time.
After hacking buildmode=pie, ./make.bash will complain that the bootstrap process does not converge. The root cause is that the build ids of the toolchain never converge.
To demonstrate the problem, I'm building cmd/compile with buildmode=pie on my host linux machine and comparing the build ids.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
The same build ids in two consecutive builds of cmd/compile.
What did you see instead?
The build ids never converge.
buildmode=pie enables external linking (#18968), but the test for reproducible Cgo builds does pass for me with PIE enabled:
The text was updated successfully, but these errors were encountered: