[Bug 1170826] New: Go packages miss binutils-gold dependency
http://bugzilla.opensuse.org/show_bug.cgi?id=1170826 Bug ID: 1170826 Summary: Go packages miss binutils-gold dependency Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: aarch64 OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Development Assignee: screening-team-bugs@suse.de Reporter: guillaume.gardet@arm.com QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- On arm and aarch64, 'go' requires 'binutils-gold' dependency at runtime, but go packages only require it as BuildRequires. So, binutils-gold must be installed manually, which breaks some builds in OBS, such as rclone [0]. Without 'binutils-gold', we ge the following error: [ 138s] /usr/lib64/go/1.11/pkg/tool/linux_arm64/link: running gcc failed: exit status 1 [ 138s] collect2: fatal error: cannot find 'ld' So, we need to add 'Requires: binutils-gold' to all go1.x packages. [0]: https://build.opensuse.org/package/show/network/rclone -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1170826 Guillaume GARDET <guillaume.gardet@arm.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |afaerber@suse.com, | |dmueller@suse.com, | |guillaume.gardet@arm.com -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1170826 http://bugzilla.opensuse.org/show_bug.cgi?id=1170826#c1 --- Comment #1 from Guillaume GARDET <guillaume.gardet@arm.com> --- SR to devel projects for go >= 1.10: * go1.10: https://build.opensuse.org/request/show/798922 * go1.11: https://build.opensuse.org/request/show/798918 * go1.12: https://build.opensuse.org/request/show/798917 * go1.13: https://build.opensuse.org/request/show/798919 * go1.14: https://build.opensuse.org/request/show/798920 It should probably be updated in SLE/Leap as well. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1170826 http://bugzilla.opensuse.org/show_bug.cgi?id=1170826#c4 Guillaume GARDET <guillaume.gardet@arm.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jkowalczyk@suse.com Flags| |needinfo?(jkowalczyk@suse.c | |om) --- Comment #4 from Guillaume GARDET <guillaume.gardet@arm.com> --- (In reply to Swamp Workflow Management from comment #2)
This is an autogenerated message for OBS integration: This bug (1170826) was mentioned in https://build.opensuse.org/request/show/799322 Factory / go1.10 https://build.opensuse.org/request/show/799324 Factory / go1.11 https://build.opensuse.org/request/show/799325 Factory / go1.12 https://build.opensuse.org/request/show/799326 Factory / go1.13 https://build.opensuse.org/request/show/799327 Factory / go1.14
Those updates should probably go to SLE as well. See https://build.opensuse.org/package/show/network/rclone build now succeeds on Factory/aarch64, whereas it fails on SLE15/aarch64 @Jeff, what do you think? -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1170826 http://bugzilla.opensuse.org/show_bug.cgi?id=1170826#c15 Jeff Kowalczyk <jkowalczyk@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Flags|needinfo?(jkowalczyk@suse.c | |om), | |needinfo?(guillaume.gardet@ | |arm.com) | --- Comment #15 from Jeff Kowalczyk <jkowalczyk@suse.com> --- It does seem that go1.x on ARM depends on the gold linker for stated reasons of GNU linker behavior with COPY relocations. The error "collect2: fatal error: cannot find 'ld'" likely results from the flag "-fuse-ld=gold" being automatically applied: go1.14 $ grep gold -B 19 -A 3 src/cmd/link/internal/ld/lib.go if ctxt.IsELF && ctxt.DynlinkingGo() { // We force all symbol resolution to be done at program startup // because lazy PLT resolution can use large amounts of stack at // times we cannot allow it to do so. argv = append(argv, "-Wl,-znow") // Do not let the host linker generate COPY relocations. These // can move symbols out of sections that rely on stable offsets // from the beginning of the section (like sym.STYPE). argv = append(argv, "-Wl,-znocopyreloc") if ctxt.Arch.InFamily(sys.ARM, sys.ARM64) && objabi.GOOS == "linux" { // On ARM, the GNU linker will generate COPY relocations // even with -znocopyreloc set. // https://sourceware.org/bugzilla/show_bug.cgi?id=19962 // // On ARM64, the GNU linker will fail instead of // generating COPY relocations. // // In both cases, switch to gold. argv = append(argv, "-fuse-ld=gold") // If gold is not installed, gcc will silently switch // back to ld.bfd. So we parse the version information // and provide a useful error if gold is missing. cmd := exec.Command(*flagExtld, "-fuse-ld=gold", "-Wl,--version") if out, err := cmd.CombinedOutput(); err == nil { if !bytes.Contains(out, []byte("GNU gold")) { log.Fatalf("ARM external linker must be gold (issue #15696), but is not: %s", out) } } } https://github.com/golang/go/blob/release-branch.go1.14/src/cmd/link/interna... Notably, Android was removed in late 2019 from the platforms where "-fuse-ld=gold" is automatically applied: https://github.com/golang/go/commit/d3c2b1f17600fadeebf62d65c85baf3bef879e2b "The NDK is switching to ldd, and will stop including the gold linker." There is active development on the internal Go linker, which may influence what degree of accommodations should be made for gold: https://golang.org/doc/go1.15#linker (go1.15 was released 2020-08-11) "... This release includes substantial improvements to the Go linker, which reduce linker resource usage (both time and memory) and improve code robustness/maintainability. For a representative set of large Go programs, linking is 20% faster and requires 30% less memory on average, for ELF-based OSes (Linux, FreeBSD, NetBSD, OpenBSD, Dragonfly, and Solaris) running on amd64 architectures, with more modest improvements for other architecture/OS combinations. The key contributors to better linker performance are a newly redesigned object file format, and a revamping of internal phases to increase concurrency (for example, applying relocations to symbols in parallel). Object files in Go 1.15 are slightly larger than their 1.14 equivalents. These changes are part of a multi-release project to modernize the Go linker, meaning that there will be additional linker improvements expected in future releases. The linker now defaults to internal linking mode for -buildmode=pie on linux/amd64 and linux/arm64, so these configurations no longer require a C linker. External linking mode (which was the default in Go 1.14 for -buildmode=pie) can still be requested with -ldflags=-linkmode=external flag. Building a better Go linker (2019) https://golang.org/s/better-linker -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1170826 http://bugzilla.opensuse.org/show_bug.cgi?id=1170826#c16 --- Comment #16 from Jeff Kowalczyk <jkowalczyk@suse.com> --- I have added a comment to the open Go upstream issue tracking the dependency on gold: https://github.com/golang/go/issues/22040#issuecomment-673580134 asking for feedback on whether the proposed binutils patch proposed in https://sourceware.org/bugzilla/show_bug.cgi?id=19962 would address the issues with ld on arm and aarch64: --- a/bfd/elf32-arm.c +++ a/bfd/elf32-arm.c @@ -14112,11 +14112,15 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info, s = bfd_get_linker_section (dynobj, ".dynbss"); BFD_ASSERT (s != NULL); - /* We must generate a R_ARM_COPY reloc to tell the dynamic linker to - copy the initial value out of the dynamic object and into the - runtime process image. We need to remember the offset into the + /* If allowed, we must generate a R_ARM_COPY reloc to tell the dynamic + linker to copy the initial value out of the dynamic object and into + the runtime process image. We need to remember the offset into the .rel(a).bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) + if (info->nocopyreloc == 0 + && (h->root.u.def.section->flags & SEC_ALLOC) != 0 + /* PR 16177: A copy is only needed if the input section is readonly. */ + && (h->root.u.def.section->flags & SEC_READONLY) == 0 + && h->size != 0) { asection *srel; -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1170826 http://bugzilla.opensuse.org/show_bug.cgi?id=1170826#c17 --- Comment #17 from Jeff Kowalczyk <jkowalczyk@suse.com> --- go upstream replies that no, the proposed patch is only for 32-bit arm (I should have noticed that before asking) and would likely not resolve go's issue with ld on aarch64. Leaving a note for myself on how to track changes in binutils upstream:the proposed patch was added to binutils 2016-04-19 soon after the bug report: https://sourceware.org/git/?p=binutils-gdb.git;a=blobdiff;f=bfd/elf32-arm.c;... That commit is present in: binutils-gdb $ git branch --contains 5522f910cb539905d6adfdceab208ddfa5e84557 binutils-2_32-branch * master I will also do some checking to better understand and document how the conditional check in Go code: if ctxt.Arch.InFamily(sys.ARM, sys.ARM64) maps to our armv7l and aarch64 at runtime. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1170826 http://bugzilla.opensuse.org/show_bug.cgi?id=1170826#c24 --- Comment #24 from Jeff Kowalczyk <jkowalczyk@suse.com> --- Based on the Go source excerpt from https://bugzilla.opensuse.org/show_bug.cgi?id=1170826#c15 , I do not think any go build command will currently run on ARM if the gold linker is not available. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1170826 Martin Li��ka <martin.liska@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.liska@suse.com -- You are receiving this mail because: You are on the CC list for the bug.
participants (2)
-
bugzilla_noreply@novell.com
-
bugzilla_noreply@suse.com