diff --git a/.gitignore b/.gitignore index 8e0d4d3..4ae12cb 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ /go-go-1.15.5-1-openssl-fips.tar.gz /go-go-1.15.7-1-openssl-fips.tar.gz /go-go-1.16.1-2-openssl-fips.tar.gz +/go-go-1.16.4-1-openssl-fips.tar.gz diff --git a/golang.spec b/golang.spec index d0bd3b2..67f754f 100644 --- a/golang.spec +++ b/golang.spec @@ -96,12 +96,12 @@ %endif %global go_api 1.16 -%global go_version 1.16.1 -%global pkg_release 2 +%global go_version 1.16.4 +%global pkg_release 1 Name: golang Version: %{go_version} -Release: 3%{?dist} +Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain License: BSD and Public Domain @@ -147,6 +147,14 @@ Patch223: golang-1.15-warnCN.patch Patch1939923: skip_test_rhbz1939923.patch +# cmd/link/internal: fix use of DynlinkingGo with ppc64le trampolines +# https://go-review.googlesource.com/c/go/+/315289 +Patch1957961: rhbz1957961.patch + +# cmd/link: disable plugin support if cgo is disabled +# https://go-review.googlesource.com/c/go/+/314449/ +Patch1955035: rhbz1955035.patch + # Having documentation separate was broken Obsoletes: %{name}-docs < 1.1-4 @@ -244,6 +252,10 @@ Requires: %{name} = %{version}-%{release} %patch1939923 -p1 +%patch1957961 -p1 + +%patch1955035 -p1 + cp %{SOURCE1} ./src/runtime/ %build @@ -516,6 +528,11 @@ cd .. %endif %changelog +* Fri May 14 2021 Alejandro Sáez - 1.16.1-4 +- Rebase to 1.16.4 +- Resolves: rhbz#1955035 +- Resolves: rhbz#1957961 + * Thu Apr 15 2021 Mohan Boddu - 1.16.1-3 - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 diff --git a/rhbz1955035.patch b/rhbz1955035.patch new file mode 100644 index 0000000..024eafe --- /dev/null +++ b/rhbz1955035.patch @@ -0,0 +1,42 @@ +From 4ec78a579cc3c83a7d0afc7483fb3e69e2fd87a7 Mon Sep 17 00:00:00 2001 +From: "Paul E. Murphy" +Date: Tue, 27 Apr 2021 15:05:51 -0500 +Subject: [PATCH] cmd/link: disable plugin support if cgo is disabled + +Functional plugin support requires cgo to be enabled. Disable +it if the environment has disabled cgo. + +This prevents unexpected linker failures when linking large +binaries with cgo disabled which use the plugin package. + +Fixes #45564 + +Change-Id: Ib71f0e089f7373b7b3e3cd53da3612291e7bc473 +Reviewed-on: https://go-review.googlesource.com/c/go/+/314449 +Run-TryBot: Paul Murphy +Reviewed-by: Cherry Zhang +TryBot-Result: Go Bot +Trust: Lynn Boger +--- + src/cmd/link/internal/ld/lib.go | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go +index 0e77424884..f7a32aebae 100644 +--- a/src/cmd/link/internal/ld/lib.go ++++ b/src/cmd/link/internal/ld/lib.go +@@ -533,7 +533,10 @@ func (ctxt *Link) loadlib() { + // up symbol by name may not get expected result. + + iscgo = ctxt.LibraryByPkg["runtime/cgo"] != nil +- ctxt.canUsePlugins = ctxt.LibraryByPkg["plugin"] != nil ++ ++ // Plugins a require cgo support to function. Similarly, plugins may require additional ++ // internal linker support on some platforms which may not be implemented. ++ ctxt.canUsePlugins = ctxt.LibraryByPkg["plugin"] != nil && iscgo + + // We now have enough information to determine the link mode. + determineLinkMode(ctxt) +-- +2.30.2 + diff --git a/rhbz1957961.patch b/rhbz1957961.patch new file mode 100644 index 0000000..a28e384 --- /dev/null +++ b/rhbz1957961.patch @@ -0,0 +1,75 @@ +From 079dfdbb94013e05660e54e6c7c3654468bc4160 Mon Sep 17 00:00:00 2001 +From: Lynn Boger +Date: Thu, 29 Apr 2021 16:07:25 -0500 +Subject: [PATCH] cmd/link/internal: fix use of DynlinkingGo with ppc64le + trampolines + +When creating programs with large text sections on ppc64le, +trampolines are needed for calls that are too far; however +they are not created if the code is generated such that the TOC +register r2 is initialized and maintained in the code because +then the external linker can create the trampolines. Previously +the function DynlinkingGo was used to determine this but in the +case where plugins are used, this could return true even though +r2 is not valid. + +To fix this problem I've added a new function r2Valid which returns +true when the build options indicate that the r2 is +initialized and maintained. Because of the ways that +DynlinkingGo is used I wanted to maintain its previous +behavior. + +Fixes #45850 + +Change-Id: I6d902eba6ad41757aa6474948b79acdbd479cb38 +Reviewed-on: https://go-review.googlesource.com/c/go/+/315289 +Trust: Lynn Boger +Run-TryBot: Lynn Boger +Reviewed-by: Cherry Zhang +TryBot-Result: Go Bot +--- + src/cmd/link/internal/ppc64/asm.go | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/src/cmd/link/internal/ppc64/asm.go b/src/cmd/link/internal/ppc64/asm.go +index 602f0b5299..539afac187 100644 +--- a/src/cmd/link/internal/ppc64/asm.go ++++ b/src/cmd/link/internal/ppc64/asm.go +@@ -642,6 +642,16 @@ func archrelocaddr(ldr *loader.Loader, target *ld.Target, syms *ld.ArchSyms, r l + return int64(o2)<<32 | int64(o1) + } + ++// Determine if the code was compiled so that the TOC register R2 is initialized and maintained ++func r2Valid(ctxt *ld.Link) bool { ++ switch ctxt.BuildMode { ++ case ld.BuildModeCArchive, ld.BuildModeCShared, ld.BuildModePIE, ld.BuildModeShared, ld.BuildModePlugin: ++ return true ++ } ++ // -linkshared option ++ return ctxt.IsSharedGoLink() ++} ++ + // resolve direct jump relocation r in s, and add trampoline if necessary + func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) { + +@@ -649,7 +659,7 @@ func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) { + // For internal linking, trampolines are always created for long calls. + // For external linking, the linker can insert a call stub to handle a long call, but depends on having the TOC address in + // r2. For those build modes with external linking where the TOC address is not maintained in r2, trampolines must be created. +- if ctxt.IsExternal() && (ctxt.DynlinkingGo() || ctxt.BuildMode == ld.BuildModeCArchive || ctxt.BuildMode == ld.BuildModeCShared || ctxt.BuildMode == ld.BuildModePIE) { ++ if ctxt.IsExternal() && r2Valid(ctxt) { + // No trampolines needed since r2 contains the TOC + return + } +@@ -703,7 +713,7 @@ func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) { + } + } + if ldr.SymType(tramp) == 0 { +- if ctxt.DynlinkingGo() || ctxt.BuildMode == ld.BuildModeCArchive || ctxt.BuildMode == ld.BuildModeCShared || ctxt.BuildMode == ld.BuildModePIE { ++ if r2Valid(ctxt) { + // Should have returned for above cases + ctxt.Errorf(s, "unexpected trampoline for shared or dynamic linking") + } else { +-- +2.30.2 + diff --git a/sources b/sources index a30a7bb..aa77346 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go-go-1.16.1-2-openssl-fips.tar.gz) = fbc59c8a7c6e697f45dae53ef5209dbeb6e48425e3add738c8aa3a26639c412f89444713e490c956ff16e869c6cfbb142061e796bcf0aaea7a8a29b20d25ae61 +SHA512 (go-go-1.16.4-1-openssl-fips.tar.gz) = c99957801440519fa5145a6901fd513baa087584a7d51c726e2ac61094cf65e81798b2773c4a74fa7e904934452709a97c91e3d9cd1695b8537e4858e15b5e47