Bugzilla – Bug 1183043
go compilers need binutils-gold on aarch64 (and armv7)
Last modified: 2022-07-08 08:40:03 UTC
go compilers _require_ binutils-gold on aarch64 (and armv7). For example openSUSE:Backports:SLE-15-SP3/rclone fails to build with go1.15 (from SLE15:Update) with: ************************************ [ 63s] + go build -o rclone -mod=vendor -buildmode=pie [ 100s] # github.com/rclone/rclone [ 100s] /usr/lib64/go/1.15/pkg/tool/linux_arm64/link: running gcc failed: exit status 1 [ 100s] collect2: fatal error: cannot find 'ld' [ 100s] compilation terminated. ************************************ This is because of: ************************************ # Needed on arm aarch64 to avoid # collect2: fatal error: cannot find 'ld'- %ifarch %arm aarch64 %if 0%{?is_opensuse} Requires: binutils-gold %else Recommends: binutils-gold %endif %endif ************************************
Please fix go instead, gold is unmaintained and not supported. Note the bug is in the go1.15 package, re-assigning.
This binutils issue is probably related IIRC
This is an upstream issue: https://github.com/golang/go/blame/f21be2fdc6f1becdbed1592ea0b245cdeedc5ac8/src/cmd/link/internal/ld/lib.go#L1389-L1409 there is no condition to not use gold on arm and aarch64.
(In reply to Dirk Mueller from comment #3) > This is an upstream issue: > > https://github.com/golang/go/blame/f21be2fdc6f1becdbed1592ea0b245cdeedc5ac8/ > src/cmd/link/internal/ld/lib.go#L1389-L1409 > > there is no condition to not use gold on arm and aarch64. But the underlying issue is the linked binutils issue which has an untested and unmerged patch. But yes, go would need to be patched to remove the hack for the -znocopyreloc issue.
It appears just removing this quirk code in golang doesn't appear to cause any regression.
If or when the current version of GNU ld fixes the problem reported in https://sourceware.org/bugzilla/show_bug.cgi?id=19962 that led go to impose the hard dependency on gold, I'm all in favor of removing the dependency. I haven't had the time yet to get up to speed on ELF inspection tools to adequately review the patch in ld#19962 for effect or regressions. The author of gold indicated the suggested ld#19962 patch was not germane to the issue in https://github.com/golang/go/issues/22040#issuecomment-673580134 It would be best to update and close ld#19962 so upstream go can be persuaded to include the change in go1.17. The go1.17 submissions window is currently open. Given the nature of the change (arguments to tools), I could submit the change request to the currently supported go1.15 and go1.16.
Regressions on go1.15+ may need to be assessed using go build -ldflags=-linkmode=external to trigger the use of gold: https://golang.org/doc/go1.15#linker "... These changes are part of a multi-release project to modernize the Go linker https://golang.org/s/better-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.
Jeff, the upstream issue has been marked as fixed, is this fix now in SLE?
Its not fixed in code: https://github.com/golang/go/blob/master/src/cmd/link/internal/ld/lib.go#L1405
go1.16 in SLE15-SP4 is also affected. See rclone failing on aarch64 in backports: https://build.opensuse.org/package/live_build_log/openSUSE:Backports:SLE-15-SP4/rclone/standard/aarch64 [ 178s] + go build -o rclone -mod=vendor -buildmode=pie [ 219s] # github.com/rclone/rclone [ 219s] /usr/lib64/go/1.16/pkg/tool/linux_arm64/link: running gcc failed: exit status 1 [ 219s] collect2: fatal error: cannot find 'ld' [ 219s] compilation terminated. If I add 'BuildRequires: binutils-gold' in rclone package, then the build succeeds. But it does not sound good to add a workaround in every packages using go.
Any update here? It seems we need to add 'Requires: binutils-gold' for go compiler on SLE side as well.
This would still rely on an unmaintained linker. Go simply needs fixing or it needs to be investigated why comment #17 doesn't seem to apply (where its claimed that go 1.15+ (hence 1.16) should use the internal linker on arm64 with '-buildmode=pie', as in the log file above).
This is an autogenerated message for OBS integration: This bug (1183043) was mentioned in https://build.opensuse.org/request/show/960521 Factory / helm https://build.opensuse.org/request/show/960523 Backports:SLE-15-SP4 / helm
I've submitted a revert of the problematic part to upstream golang. lets see how it goes: https://go-review.googlesource.com/c/go/+/391115 will also include in tumbleweed go1.18.
Thanks for the CL to upstream, Dirk. The BFD.ld version test and source comment is for 2.25: ld --version 2>&1 | grep -E "GNU ld.*2\.25" However the commit message mentions 2.35. I presume 2.35 is the intended minimum version? Should the version test be for any version below 2.35? I can't determine where in upstream binutils git history the fix was implemented. FYI There is also the proposed change: https://golang.org/cl/366279 cmd/link: use gold on ARM/ARM64 only if gold is available to address: https://github.com/golang/go/issues/22040 cmd/link: stop requiring gold on arm64 when GNU ld is fixed #22040 CL 366279 relies on runtime environment behavior, which seems problematic. I greatly prefer your solution to test for a suitable ld version at go toolchain build time.
This is an autogenerated message for OBS integration: This bug (1183043) was mentioned in https://build.opensuse.org/request/show/962259 Factory / go1.17 https://build.opensuse.org/request/show/962260 Factory / go1.18
This is an autogenerated message for OBS integration: This bug (1183043) was mentioned in https://build.opensuse.org/request/show/962280 Factory / go1.16
SUSE-SU-2022:1164-1: An update that solves one vulnerability and has two fixes is now available. Category: security (important) Bug References: 1182345,1183043,1196732 CVE References: CVE-2022-24921 JIRA References: Sources used: openSUSE Leap 15.4 (src): go1.16-1.16.15-150000.1.46.1 openSUSE Leap 15.3 (src): go1.16-1.16.15-150000.1.46.1 SUSE Manager Server 4.1 (src): go1.16-1.16.15-150000.1.46.1 SUSE Manager Retail Branch Server 4.1 (src): go1.16-1.16.15-150000.1.46.1 SUSE Manager Proxy 4.1 (src): go1.16-1.16.15-150000.1.46.1 SUSE Linux Enterprise Server for SAP 15-SP2 (src): go1.16-1.16.15-150000.1.46.1 SUSE Linux Enterprise Server 15-SP2-LTSS (src): go1.16-1.16.15-150000.1.46.1 SUSE Linux Enterprise Server 15-SP2-BCL (src): go1.16-1.16.15-150000.1.46.1 SUSE Linux Enterprise Realtime Extension 15-SP2 (src): go1.16-1.16.15-150000.1.46.1 SUSE Linux Enterprise Module for Development Tools 15-SP3 (src): go1.16-1.16.15-150000.1.46.1 SUSE Linux Enterprise High Performance Computing 15-SP2-LTSS (src): go1.16-1.16.15-150000.1.46.1 SUSE Linux Enterprise High Performance Computing 15-SP2-ESPOS (src): go1.16-1.16.15-150000.1.46.1 SUSE Enterprise Storage 7 (src): go1.16-1.16.15-150000.1.46.1 NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
SUSE-SU-2022:1167-1: An update that solves one vulnerability and has two fixes is now available. Category: security (important) Bug References: 1183043,1190649,1196732 CVE References: CVE-2022-24921 JIRA References: Sources used: openSUSE Leap 15.4 (src): go1.17-1.17.8-150000.1.25.1 openSUSE Leap 15.3 (src): go1.17-1.17.8-150000.1.25.1 SUSE Manager Server 4.1 (src): go1.17-1.17.8-150000.1.25.1 SUSE Manager Retail Branch Server 4.1 (src): go1.17-1.17.8-150000.1.25.1 SUSE Manager Proxy 4.1 (src): go1.17-1.17.8-150000.1.25.1 SUSE Linux Enterprise Server for SAP 15-SP2 (src): go1.17-1.17.8-150000.1.25.1 SUSE Linux Enterprise Server 15-SP2-LTSS (src): go1.17-1.17.8-150000.1.25.1 SUSE Linux Enterprise Server 15-SP2-BCL (src): go1.17-1.17.8-150000.1.25.1 SUSE Linux Enterprise Realtime Extension 15-SP2 (src): go1.17-1.17.8-150000.1.25.1 SUSE Linux Enterprise Module for Development Tools 15-SP4 (src): go1.17-1.17.8-150000.1.25.1 SUSE Linux Enterprise Module for Development Tools 15-SP3 (src): go1.17-1.17.8-150000.1.25.1 SUSE Linux Enterprise High Performance Computing 15-SP2-LTSS (src): go1.17-1.17.8-150000.1.25.1 SUSE Linux Enterprise High Performance Computing 15-SP2-ESPOS (src): go1.17-1.17.8-150000.1.25.1 SUSE Enterprise Storage 7 (src): go1.17-1.17.8-150000.1.25.1 NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
SUSE-SU-2022:1410-1: An update that solves three vulnerabilities and has two fixes is now available. Category: security (moderate) Bug References: 1183043,1193742,1198423,1198424,1198427 CVE References: CVE-2022-24675,CVE-2022-27536,CVE-2022-28327 JIRA References: Sources used: openSUSE Leap 15.4 (src): go1.18-1.18.1-150000.1.11.1 openSUSE Leap 15.3 (src): go1.18-1.18.1-150000.1.11.1 SUSE Linux Enterprise Module for Development Tools 15-SP4 (src): go1.18-1.18.1-150000.1.11.1 SUSE Linux Enterprise Module for Development Tools 15-SP3 (src): go1.18-1.18.1-150000.1.11.1 NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
So this bug appears to be fixed and the Maintenance Updates are out right? Can we please close the bug then? thanks
So right now, it seems the latest go release packages don't depend on gold linker (with the pending patch that needs to be upstreamed). However, the current ring0+1 contains now 8 package versions (the oldest version is 1.9). @Dirk: Can we please remove the older releases which still do depend on binutils-gold?
This is an autogenerated message for OBS integration: This bug (1183043) was mentioned in https://build.opensuse.org/request/show/987816 Backports:SLE-15-SP3 / helm