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
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
Build failure, and the message says that gcc cannot find ld
Just building normally, and producing an executable file named "hello"
We suggest that the BuildRequires line for binutils that has gold should be added to the golang.spec file
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.
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.
Is this still reproducible with the latest go-toolset-7-golang package?
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.
We're unable to support Oracle Linux. Please contact your vendor.
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.