Bug 1568199 - buildmode=shared is broken on aarch64 without sufficiently new binutils
Summary: buildmode=shared is broken on aarch64 without sufficiently new binutils
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: golang
Version: 7.6
Hardware: aarch64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Derek Parker
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-17 00:27 UTC by Stephen
Modified: 2018-07-17 00:43 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-07-16 21:55:26 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Stephen 2018-04-17 00:27:35 UTC
Description of problem:

The problem is about the golang 1.9.4 RPM package, which I believe is going to be shipped with Redhat Enterprise Linux 7.5. 

The symptom is go build with -buildmode=share is broken when the external linker is invoked through gcc. 

The reason is the "go link" tool is looking for gold as the GNU linker, ld, was known to ignore -Wl,-z,nocopyreloc on ARM and to fail with the option on ARM64. However, gold is included in the binutils packages that are sufficiently new. 

Thus, it seems that golang 1.9.4 package should have one more line of BuildRequires line to include sufficiently new binutils package. 

Version-Release number of selected component (if applicable):
Golang 1.9.4 that is or will be found in RHEL 7.5

How reproducible:
With any hello world go file, go build -buildmode=shared hello.go

Steps to Reproduce:
1. Write, or copy and paste a "Hello World" Go program
2. go build -buildmode=shared hello.go
3.

Actual results:
Build failure, and the message says that gcc cannot find ld

Expected results:
Just building normally, and producing an executable file named "hello"

Additional info:
We suggest that the BuildRequires line for binutils that has gold should be added to the golang.spec file

Comment 2 Stephen 2018-04-18 10:58:16 UTC
I would like to add a few things that I forgot. 

I was building the RPM on RHEL 7.4 base Oracle Linux. The binutils there did not include gold linker. Once I have built binutils that is in the OL 7.5 repo, which corresponds RHEL 7.5, then the gold linker was available and the bug has gone.

Comment 3 Stephen 2018-04-21 06:36:19 UTC
This bug blocks building golang package. The rpm build internally runs a set of test cases. In case that some of the tests fail, the build process terminates with non-zero status. And, the misc/cgo/testshared fails. 

In RHEL 7.4, there was actually a patch to golang source code, so that the failing test is effectively skipped. In 7.5, the patch has been removed. The removal makes sense to me only if the build machine has the gold linker. 

Building golang 1.9.4 rpm on RHEL 7.4 without gold in binutils failed. That's why I believe the "BuildRequires" for newer binutils might be required.

Comment 4 Derek Parker 2018-07-12 17:16:54 UTC
Is this still reproducible with the latest go-toolset-7-golang package?

Comment 5 Stephen 2018-07-14 04:00:54 UTC
I cannot find go-toolset-7-golang package. Perhaps, what I am using is not RedHat Enterprise Linux(a.k.a. RHEL) but Oracle Linux (a.k.a. OL). 

My understanding on the relation between RHEL and OL is that Oracle engineers add a few Oracle-specific things to RHEL in order to get OL. For example, golang package in OL is from the golang package from RHEL. 

When it comes to the version of each distro, I am not really sure. I am looking into OL 7.5, which I guess is based on RHEL 7.5. That's just my guess based on the Oracle's internal repo name, though. 

OL that I have used seems to be missing go-toolset-7-golang. Thus, I might not be able to tell whether the problem is reproducible with the package or not.

Comment 6 Matt Newsome 2018-07-16 21:55:26 UTC
We're unable to support Oracle Linux. Please contact your vendor.

Comment 7 Stephen 2018-07-17 00:43:12 UTC
Although I found this issue from Oracle Linux, the issue is also in Redhat Enterprise. I do not know what is the deal between OL and RHEL. However, many OL rpms including golang are identical to RHEL rpms. Thus, I am sure that this issue is reproducible in RHEL, too, as long as particular version of Redhat do not have ld.gold. I filed this bug, hoping that the bug is fixed in the upstream (e.g. RHEL). That was why I filed the bug here.


Note You need to log in before you can comment on or make changes to this bug.