AlmaLinux changes: Add x86_64_v2 support

Disable race for riscv64
This commit is contained in:
Eduard Abdullin 2026-05-19 11:04:28 +00:00 committed by root
commit dc235ee680
4 changed files with 39 additions and 92 deletions

2
.gitignore vendored
View File

@ -181,3 +181,5 @@
/go1.26.1-1-openssl-fips.tar.gz
/go1.26.2.src.tar.gz
/go1.26.2-2-openssl-fips.tar.gz
/go1.26.3.src.tar.gz
/go1.26.3-1-openssl-fips.tar.gz

View File

@ -1,46 +0,0 @@
From 46ec67413008607e2150e3395668e54e538c5b6b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= <asm@redhat.com>
Date: Wed, 19 Jun 2024 10:18:58 +0200
Subject: [PATCH] Default to ld.bfd on ARM64
---
src/cmd/link/internal/ld/lib.go | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index eab74dc328..b401f58727 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -1620,22 +1620,16 @@ func (ctxt *Link) hostlink() {
}
if ctxt.Arch.InFamily(sys.ARM64) && buildcfg.GOOS == "linux" {
- // On ARM64, the GNU linker will fail with
- // -znocopyreloc if it thinks a COPY relocation is
- // required. Switch to gold.
- // https://sourceware.org/bugzilla/show_bug.cgi?id=19962
- // https://go.dev/issue/22040
- altLinker = "gold"
-
- // If gold is not installed, gcc will silently switch
- // back to ld.bfd. So we parse the version information
- // and provide a useful error if gold is missing.
+ // Use ld.bfd as the default linker
+ altLinker = "bfd"
+
+ // Provide a useful error if ld.bfd is missing
name, args := flagExtld[0], flagExtld[1:]
- args = append(args, "-fuse-ld=gold", "-Wl,--version")
+ args = append(args, "-fuse-ld=bfd", "-Wl,--version")
cmd := exec.Command(name, args...)
if out, err := cmd.CombinedOutput(); err == nil {
- if !bytes.Contains(out, []byte("GNU gold")) {
- log.Fatalf("ARM64 external linker must be gold (issue #15696, 22040), but is not: %s", out)
+ if !bytes.Contains(out, []byte("GNU ld")) {
+ log.Fatalf("ARM64 external linker must be ld.bfd, but is not: %s", out)
}
}
}
--
2.45.1

View File

@ -68,11 +68,6 @@
%global fail_on_tests 1
%global race 1
%ifarch riscv64
%global race 0
%endif
# shared mode is breaks Go 1.21 in ELN
%global shared 0
@ -104,14 +99,32 @@
%global gohostarch riscv64
%endif
# Set the RHEL architecture baseline.
%if 0%{?rhel} < 9
%global goamd64 v1
%global goppc64 power8
%else
%if 0%{?rhel} < 10
%global goamd64 v2
%global goppc64 power8
%else
%ifarch x86_64_v2
%global goamd64 v2
%else
%global goamd64 v3
%endif
%global goppc64 power9
%endif
%endif
%global go_api 1.26
# Use only for prerelease versions
#global go_prerelease rc3
%global go_patch 2
%global go_patch 3
%global go_version %{go_api}%{?go_patch:.%{go_patch}}%{?go_prerelease:~%{go_prerelease}}
%global go_source %{go_api}%{?go_patch:.%{go_patch}}%{?go_prerelease}
# Go FIPS package release
%global pkg_release 2
%global pkg_release 1
# For rpmdev-bumpspec and releng automation.
%global baserelease 1
@ -202,7 +215,6 @@ Requires: %{name}-race = %{version}-%{release}
%endif
Patch1: 0001-Modify-go.env.patch
Patch6: 0006-Default-to-ld.bfd-on-ARM64.patch
# Related: https://sourceware.org/bugzilla/show_bug.cgi?id=33204
Patch7: revert_dwarf5.patch
Patch8: skip-TestTerminalSignal-in-container.patch
@ -348,6 +360,14 @@ Binary library objects for Go's race detector.
# Copy fedora.go to ./src/runtime/
cp %{SOURCE2} ./src/runtime/
sed -i '1s/$/ (%{?rhel:Red Hat} %{version}-%{release})/' VERSION
# Historically the ISA baselines have been set in modify-go.env.patch.
# This will prevent us sharing a specfile across major RHEL versions.
# As such, we must override the baselines set in the patch file.
sed -iE "s/^.*baseline for RHEL.*$//" go.env
sed -i "s/GOAMD64=.*/GOAMD64=%{goamd64}/" go.env
sed -i "s/GOPPC64=.*/GOPPC64=%{goppc64}/" go.env
# Delete the bundled race detector objects.
find ./src/runtime/race/ -name "race_*.syso" -exec rm {} \;
# Delete the boring binary blob. We use the system OpenSSL instead.
@ -376,11 +396,6 @@ rm -rf src/crypto/internal/boring/syso
popd
%endif
%ifarch x86_64_v2
sed -i 's/^GOAMD64=v3$/GOAMD64=v2/' ./go.env
grep -q '^GOAMD64=v2$' ./go.env
%endif
%build
# -x: print commands as they are executed
# -e: exit immediately if a command exits with a non-zero status
@ -406,7 +421,6 @@ tsan_go_dir="../llvm/compiler-rt-%{llvm_compiler_rt_version}.src/lib/tsan/go"
# by just reading GOARCH directly from Go.
export GOARCH=$(go env GOARCH)
%if %{race}
%if %{race}
%ifarch x86_64
pushd "${tsan_go_dir}"
@ -419,11 +433,7 @@ popd
cp "${tsan_go_dir}"/race_linux_amd64.syso ./src/runtime/race/internal/amd64v3/race_linux.syso
pushd "${tsan_go_dir}"
%ifarch x86_64_v2
CFLAGS="%{tsan_buildflags} %{tsan_optflag}" CC=clang GOAMD64=v2 ./buildgo.sh
%else
CFLAGS="%{tsan_buildflags} %{tsan_optflag}" CC=clang GOAMD64=v3 ./buildgo.sh
%endif
CFLAGS="%{tsan_buildflags} %{tsan_optflag}" CC=clang GOAMD64=v1 ./buildgo.sh
popd
cp "${tsan_go_dir}"/race_linux_amd64.syso ./src/runtime/race/internal/amd64v1/race_linux.syso
@ -434,7 +444,6 @@ popd
cp "${tsan_go_dir}"/race_linux_%{gohostarch}.syso ./src/runtime/race/race_linux_%{gohostarch}.syso
%endif
%endif
%endif
# bootstrap compiler GOROOT
%if !%{golang_bootstrap}
@ -448,12 +457,8 @@ export GOROOT_FINAL=%{goroot}
export GOHOSTOS=linux
export GOHOSTARCH=%{gohostarch}
%ifarch x86_64_v2
export GOAMD64=v2
%else
export GOAMD64=v3
%endif
export GOPPC64='power9'
export GOAMD64=%{goamd64}
export GOPPC64=%{goppc64}
pushd src
# use our gcc options for this build, but store gcc as default for compiler
@ -463,12 +468,8 @@ export CC="gcc"
export CC_FOR_TARGET="gcc"
export GOOS=linux
export GOARCH=%{gohostarch}
%ifarch x86_64_v2
export GOAMD64=v2
%else
export GOAMD64=v3
%endif
export GOPPC64='power9'
export GOAMD64=%{goamd64}
export GOPPC64=%{goppc64}
DEFAULT_GO_LD_FLAGS=""
%if !%{external_linker}
@ -492,11 +493,9 @@ popd
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared -v -x std
%endif
%if %{race}
%if %{race}
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -race std
%endif
%endif
%install
rm -rf $RPM_BUILD_ROOT
@ -627,12 +626,8 @@ go env
export CC="gcc"
export CFLAGS="$RPM_OPT_FLAGS"
export LDFLAGS="$RPM_LD_FLAGS"
%ifarch x86_64_v2
export GOAMD64=v2
%else
export GOAMD64=v3
%endif
export GOPPC64='power9'
export GOAMD64=%{goamd64}
export GOPPC64=%{goppc64}
%if !%{external_linker}
export GO_LDFLAGS="-linkmode internal"
%else
@ -720,7 +715,6 @@ fi
%files src -f go-src.list
%if %{race}
%if %{race}
%ifarch x86_64
%exclude %{goroot}/src/runtime/race/internal/amd64v1/race_linux.syso
%exclude %{goroot}/src/runtime/race/internal/amd64v3/race_linux.syso
@ -728,7 +722,6 @@ fi
%exclude %{goroot}/src/runtime/race/race_linux_%{gohostarch}.syso
%endif
%endif
%endif
%files docs -f go-docs.list
@ -749,7 +742,6 @@ fi
%files -n go-toolset
%if %{race}
%if %{race}
%files race
%ifarch x86_64
@ -759,7 +751,6 @@ fi
%{goroot}/src/runtime/race/race_linux_%{gohostarch}.syso
%endif
%endif
%endif
%changelog
%autochangelog

View File

@ -1,3 +1,3 @@
SHA512 (go1.26.2.src.tar.gz) = 370773727c0e6fbf0acd534726938aaaa03ff785f0634c258c94a7a896e9a27acc0ba57120967f711a942e9e275cec46251a194d6f84ba15f28b5dcf0efed673
SHA512 (go1.26.2-2-openssl-fips.tar.gz) = 3b086cd73f7520eb786b866043c31f0d6a75294fbbee9390adb688ee7dd5666183789897cb9ac7dfbaa993310ae6decec9889eecb4c3f0bd708b1d660e3330c9
SHA512 (go1.26.3.src.tar.gz) = 9c673a9ec7783a345b6294984486a5c76ba52de3eb72c95cbd68626312d100c50adb7a3ed15c93d1dc9ce9969b0f6fb4b86c87771118091cc7b0297afaf74fec
SHA512 (go1.26.3-1-openssl-fips.tar.gz) = dddc3d4bead27ec546a8304afd915646ee9707d6563e77d7579c7cbae2a8eb6597ffb955e1e55fddbcb66aee8bba812b6b4b3bd3af3c6d3a04c31be5f982ec65
SHA512 (compiler-rt-18.1.8.src.tar.xz) = fb8795bd51c9b005c2ad1975591e9e2715740d6407ccad41379f136ef2e8d24ded8b97b01165a3ae4bd377119a6a1049ca05d3220404fc12bee86114ff2bff0d