Bug 1183043 - go compilers need binutils-gold on aarch64 (and armv7)
go compilers need binutils-gold on aarch64 (and armv7)
Status: IN_PROGRESS
Classification: SUSE Linux Enterprise Server
Product: PUBLIC SUSE Linux Enterprise Server 15 SP3
Classification: SUSE Linux Enterprise Server
Component: Basesystem
unspecified
aarch64 Other
: P3 - Medium : Normal
: unspecified
Assigned To: Jeff Kowalczyk
E-mail List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-03-04 14:14 UTC by Guillaume GARDET
Modified: 2022-07-08 08:40 UTC (History)
7 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume GARDET 2021-03-04 14:14:46 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
************************************
Comment 1 Richard Biener 2021-03-05 12:32:00 UTC
Please fix go instead, gold is unmaintained and not supported.  Note the bug is in the go1.15 package, re-assigning.
Comment 2 Richard Biener 2021-03-05 12:33:09 UTC
This binutils issue is probably related IIRC
Comment 3 Dirk Mueller 2021-03-08 11:32:00 UTC
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.
Comment 4 Richard Biener 2021-03-08 12:03:18 UTC
(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.
Comment 5 Dirk Mueller 2021-03-10 17:56:55 UTC
It appears just removing this quirk code in golang doesn't appear to cause any regression.
Comment 6 Jeff Kowalczyk 2021-03-10 20:11:32 UTC
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.
Comment 7 Jeff Kowalczyk 2021-03-10 20:33:06 UTC
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.
Comment 8 Dan Čermák 2021-10-18 08:05:22 UTC
Jeff, the upstream issue has been marked as fixed, is this fix now in SLE?
Comment 9 Dirk Mueller 2021-10-18 10:56:14 UTC
Its not fixed in code: 

https://github.com/golang/go/blob/master/src/cmd/link/internal/ld/lib.go#L1405
Comment 10 Guillaume GARDET 2021-12-15 10:32:48 UTC
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.
Comment 11 Guillaume GARDET 2022-01-26 09:30:43 UTC
Any update here? 
It seems we need to add 'Requires:  binutils-gold' for go compiler on SLE side as well.
Comment 12 Michael Matz 2022-01-26 13:38:15 UTC
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).
Comment 13 OBSbugzilla Bot 2022-03-09 16:50:04 UTC
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
Comment 14 Dirk Mueller 2022-03-09 17:02:47 UTC
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.
Comment 15 Jeff Kowalczyk 2022-03-09 22:47:36 UTC
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.
Comment 16 OBSbugzilla Bot 2022-03-16 18:50:03 UTC
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
Comment 17 OBSbugzilla Bot 2022-03-16 22:10:03 UTC
This is an autogenerated message for OBS integration:
This bug (1183043) was mentioned in
https://build.opensuse.org/request/show/962280 Factory / go1.16
Comment 22 Swamp Workflow Management 2022-04-12 16:31:45 UTC
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.
Comment 23 Swamp Workflow Management 2022-04-12 19:19:10 UTC
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.
Comment 25 Swamp Workflow Management 2022-04-26 19:18:10 UTC
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.
Comment 26 Vincent Moutoussamy 2022-04-28 09:30:42 UTC
So this bug appears to be fixed and the Maintenance Updates are out right?
Can we please close the bug then? thanks
Comment 31 Martin Liška 2022-06-20 07:31:19 UTC
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?
Comment 32 OBSbugzilla Bot 2022-07-08 08:40:03 UTC
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