-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: crashes on ppc64le and others #25863
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
Comments
Builders on linux/ppc64{,le} are also failing since commit bd83774 (which corresponds to https://golang.org/cl/111682): https://build.golang.org/log/69ba9e8f2e58f832e1f045a76e932a5b3c1d2eb4 /cc @aclements @ianlancetaylor @heschik |
...and the linux/arm64, linux/arm, linux/mips, linux/s390x builders fail as well, though not with a segfault during bootstrap but during various tests: linux/arm: https://build.golang.org/log/ce0ac926b3379a141c368e72328120ff16e75928 |
CC @aclements @heschik |
If I look at the readelf output for go_bootstrap after this change, the section names are garbage. Otherwise the rest looks the same.
|
How could this pass the trybots for ppc64x? |
I think there are currently no trybots for linux/ppc64x /cc @bradfitz |
Last time I asked, I was told there was some compile-only testing done, but obviously not since in this case the toolchain doesn't even build. |
@laboger, @tklauser, we do indeed compile for ppc64 on trybots, but it's cross-compiled from Linux, not run on real ppc64 hardware, which seems to be the issue here. Looks like it does cross-compile fine from Linux. The definition from x/build/dashboard/builders.go is: addMiscCompile := func(suffix, rx string) {
addBuilder(BuildConfig{
Name: "misc-compile" + suffix,
HostType: "host-linux-jessie",
TryBot: true,
TryOnly: true,
CompileOnly: true,
Notes: "Runs buildall.sh to cross-compile std packages for " + rx + ", but doesn't run any tests.",
allScriptArgs: []string{
// Filtering pattern to buildall.bash:
rx,
},
})
}
addMiscCompile("", "^(linux-arm64|linux-s390x|solaris-amd64|darwin-386)$") // 4 ports
addMiscCompile("-mobile", "(^android|darwin-arm64)") // 5 ports
addMiscCompile("-nacl", "^nacl") // 3
addMiscCompile("-mips", "^linux-mips") // 4
addMiscCompile("-ppc", "^linux-ppc64") // 2
addMiscCompile("-plan9", "^plan9-") // 3
addMiscCompile("-freebsd", "^freebsd-") // 3
addMiscCompile("-netbsd", "^netbsd-") // 3
addMiscCompile("-openbsd", "^openbsd-") // 3 Again, the goal of TryBots is to be fast and have decent coverage to catch most mistakes, but not all. |
Cross compiling doesn't crash, but the resulting binaries are still broken. It'd be hard to know that without running them though. The most obvious problem is that the location of .shstrtab is wrong, which is why the section names are gibberish. In the hello world program I built, .shstrtab in the ELF headers:
But looking at the actual binary, the correct location is 0xd4d00. I'll poke around for my own curiosity but Austin is probably better suited for this. |
Actually the whole section table appears to be wrong. Before this CL for the cmd/go binary "There are 37 section headers, starting at offset 0x270", after this CL "There are 24 section headers, starting at offset 0x1c8". And the section header types don't match up at all (which you would expect if it was just the names that were broken). |
Okay. I was able to fix the problems with the section headers, As always with the linker I'm using a mix of guesswork and brute force, but I think the immediate problem is in datoff(). It only looks at Segtext and Segdata, but .shstrtab is in Segrodata. On amd64, rodata comes right after text (other than a bit of padding) and so that doesn't matter, but on arm64 and ppc64le there seems to be a sizeable gap for some reason. Changing datoff() to check against Segrodata fixes the section headers:
but probably the bigger problem is the gap. I presume it's new after Austin's CL, though I didn't check. Austin, I think you were probably external linking and the external threw away a bunch of sections that it didn't know what to do with? I only see 24 sections in my binaries. |
FWIW, when I originally wrote the patch I verified that binaries were identical on all supported OSes and arches. Either I did that wrong (certainly possible) or something happened in the rebase to master. |
@heschik, you're right that it looked completely different for me because I was external linking. You're also right that there are some gaps that were added by my CL. In some cases (the |
The gaps are happening because previously we computed Fileoff as |
Change https://golang.org/cl/118716 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Affects master, bisected and the issues started with commit
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
Build/Bootstrap of GC(all.bash) passing
What did you see instead?
Notes
Doesn't seems to be related to the boostrap compiler as have been using 9ef9765 for bisect and also tried few builds with go1.10 and go1.9, this issue seems to span all Fedora releases.
CC'ed @laboger
The text was updated successfully, but these errors were encountered: