From 3384374ae96df45cd57a8479d7e112538511cad3 Mon Sep 17 00:00:00 2001 From: David Benoit Date: Mon, 19 May 2025 09:50:56 -0400 Subject: [PATCH] Update to Go 1.24.3 Resolves: RHEL-87633 Resolves: RHEL-85255 Resolves: RHEL-33420 --- .gitignore | 3 +++ fedora.go | 5 ++++ golang.spec | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++--- sources | 5 ++-- 4 files changed, 82 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 6da793a..3fa7ab2 100644 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,6 @@ /go1.23.1.src.tar.gz /go1.23.6.src.tar.gz /go1.23.6-1-openssl-fips.tar.gz +/go1.24.3.src.tar.gz +/go1.24.3-1-openssl-fips.tar.gz +/compiler-rt-18.1.8.src.tar.xz diff --git a/fedora.go b/fedora.go index 81b28ba..60e460d 100644 --- a/fedora.go +++ b/fedora.go @@ -1,5 +1,10 @@ +//go:build rpm_crashtraceback // +build rpm_crashtraceback + +// Copyright 2017 The Fedora Project Contributors. All rights reserved. +// Use of this source code is governed by the MIT license. + package runtime func init() { diff --git a/golang.spec b/golang.spec index a8b92da..a07cebd 100644 --- a/golang.spec +++ b/golang.spec @@ -104,10 +104,10 @@ %global gohostarch riscv64 %endif -%global go_api 1.23 +%global go_api 1.24 # Use only for prerelease versions #global go_prerelease rc3 -%global go_patch 6 +%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 @@ -116,6 +116,9 @@ # For rpmdev-bumpspec and releng automation. %global baserelease 1 +# LLVM compiler-rt version for race detector +%global llvm_compiler_rt_version 18.1.8 + Name: golang Version: %{go_version} Release: %autorelease @@ -134,6 +137,7 @@ Source0: https://go.dev/dl/go%{go_source}.src.tar.gz Source1: https://github.com/golang-fips/go/archive/refs/tags/go%{go_source}-%{pkg_release}-openssl-fips.tar.gz # make possible to override default traceback level at build time by setting build tag rpm_crashtraceback Source2: fedora.go +Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{llvm_compiler_rt_version}/compiler-rt-%{llvm_compiler_rt_version}.src.tar.xz # The compiler is written in Go. Needs go(1.4+) compiler for build. %if !%{golang_bootstrap} @@ -166,6 +170,9 @@ BuildRequires: perl-interpreter, procps-ng %if 0%{?rhel} BuildRequires: perl %endif +# For building llvm address sanitizer for Go race detector +BuildRequires: libstdc++-devel +BuildRequires: clang Provides: go = %{version}-%{release} @@ -186,6 +193,7 @@ Provides: bundled(golang(golang.org/x/tools)) = 0.11.1.0.20230712164437.1ca21856 Requires: %{name}-bin = %{version}-%{release} Requires: %{name}-src = %{version}-%{release} +Requires: %{name}-race = %{version}-%{release} Patch1: 0001-Modify-go.env.patch Patch6: 0006-Default-to-ld.bfd-on-ARM64.patch @@ -316,11 +324,21 @@ Requires: delve %description -n go-toolset This is the main package for go-toolset. +%package race +Summary: Race detetector library object files. +Requires: %{name} = %{version}-%{release} + +%description race +Binary library objects for Go's race detector. + + %prep %autosetup -p1 -n go # Copy fedora.go to ./src/runtime/ cp %{SOURCE2} ./src/runtime/ sed -i '1s/$/ (%{?rhel:Red Hat} %{version}-%{release})/' VERSION +# 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. rm -rf src/crypto/internal/boring/syso @@ -357,6 +375,39 @@ uname -a cat /proc/cpuinfo cat /proc/meminfo +# Build race detector .syso's from llvm sources +# The race detector requests a -fno-exceptions build. +%global tsan_buildflags %(rpm -D 'toolchain clang' -E '%{optflags}' | sed 's/-fexceptions//') +%global tsan_optflag -O1 +mkdir ../llvm + +tar -xf %{SOURCE3} -C ../llvm +tsan_go_dir="../llvm/compiler-rt-%{llvm_compiler_rt_version}.src/lib/tsan/go" + +# The script uses uname -a and grep to set the GOARCH. This +# is unreliable and can get the wrong architecture in +# circumstances like cross-architecture emulation. We fix it +# by just reading GOARCH directly from Go. +export GOARCH=$(go env GOARCH) + +%ifarch x86_64 +pushd "${tsan_go_dir}" + CFLAGS="%{tsan_buildflags} %{tsan_optflag}" CC=clang GOAMD64=v3 ./buildgo.sh +popd +cp "${tsan_go_dir}"/race_linux_amd64.syso ./src/runtime/race/internal/amd64v3/race_linux.syso + +pushd "${tsan_go_dir}" + 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 + +%else +pushd "${tsan_go_dir}" + CFLAGS="%{tsan_buildflags} %{tsan_optflag}" CC=clang ./buildgo.sh +popd +cp "${tsan_go_dir}"/race_linux_%{gohostarch}.syso ./src/runtime/race/race_linux_%{gohostarch}.syso +%endif + # bootstrap compiler GOROOT %if !%{golang_bootstrap} export GOROOT_BOOTSTRAP=/ @@ -401,6 +452,8 @@ popd GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared -v -x std %endif +GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -race std + %install rm -rf $RPM_BUILD_ROOT # remove GC build cache @@ -552,9 +605,9 @@ echo "=== Start testing ===" echo "=== Run all crypto test skipping tls ===" pushd crypto # run all crypto tests but skip tls, we will run fips specific tls tests later - go test $(go list ./... | grep -v tls) -v + go test $(go list ./... | grep -v tls) -v -skip="TestEd25519Vectors|TestACVP" # check that signature functions have parity between boring and notboring - CGO_ENABLED=0 go test $(go list ./... | grep -v tls) -v + CGO_ENABLED=0 go test $(go list ./... | grep -v tls) -v -skip="TestEd25519Vectors|TestACVP" popd echo "=== Run tls tests ===" # run all fips specific tls tests @@ -607,6 +660,12 @@ fi %{_sysconfdir}/prelink.conf.d %files src -f go-src.list +%ifarch x86_64 +%exclude %{goroot}/src/runtime/race/internal/amd64v1/race_linux.syso +%exclude %{goroot}/src/runtime/race/internal/amd64v3/race_linux.syso +%else +%exclude %{goroot}/src/runtime/race/race_linux_%{gohostarch}.syso +%endif %files docs -f go-docs.list @@ -627,5 +686,13 @@ fi %files -n go-toolset +%files race +%ifarch x86_64 +%{goroot}/src/runtime/race/internal/amd64v1/race_linux.syso +%{goroot}/src/runtime/race/internal/amd64v3/race_linux.syso +%else +%{goroot}/src/runtime/race/race_linux_%{gohostarch}.syso +%endif + %changelog %autochangelog diff --git a/sources b/sources index 0172c85..cbe68ab 100644 --- a/sources +++ b/sources @@ -1,2 +1,3 @@ -SHA512 (go1.23.6.src.tar.gz) = c504476d42cdbcd1b6afe53c0974e82c19eb0efac974bc06d41c1641440676891cfe6416455a0cfc81fe82902a9b82ea0a1d95089c676667d05487e45f5e04e3 -SHA512 (go1.23.6-1-openssl-fips.tar.gz) = 9dfbc3d050fe8738d4affa31e26d0b8fbdcd0b112e9f03307f32f2ad6f49b7556dd7090f942e3ac7ef00b5714ee7be017df93c9105c2b92422e99e8d88ff7e98 +SHA512 (go1.24.3.src.tar.gz) = 05d19372fb923eeea19395b4de569d2ecfec7fadf2d8236d47cd667982de51c569e9816372cb79e32166553f9bcbe68f7bc2a6ded5655809b1caf5bd941011e7 +SHA512 (go1.24.3-1-openssl-fips.tar.gz) = dd4ffe1cb7bf4ab553504ff63af2313d84445a197b259283debe2cc19a0ab205ece6d3ca06ad1c830cb4b3ac1b87fffee28d6030c47bbc383507e3b264cf5281 +SHA512 (compiler-rt-18.1.8.src.tar.xz) = fb8795bd51c9b005c2ad1975591e9e2715740d6407ccad41379f136ef2e8d24ded8b97b01165a3ae4bd377119a6a1049ca05d3220404fc12bee86114ff2bff0d