From 5dd81617388065d717ddae49f1e1deb3a2e0f004 Mon Sep 17 00:00:00 2001 From: Eduard Abdullin Date: Tue, 9 Dec 2025 17:20:22 +0000 Subject: [PATCH] Update env var for v2 Disable race for riscv64 --- golang.spec | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/golang.spec b/golang.spec index 419b397..34c413e 100644 --- a/golang.spec +++ b/golang.spec @@ -5,7 +5,7 @@ release_number = 1; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); -}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}.alma.1 +}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}.alma.2 ## END: Set by rpmautospec %bcond_with bootstrap @@ -17,6 +17,11 @@ %bcond_with ignore_tests %endif +%global race 1 +%ifarch riscv64 +%global race 0 +%endif + # Enable race by default %global race 1 @@ -216,8 +221,10 @@ Provides: bundled(golang(rsc.io/markdown)) = 0.0.0.20240306144322.0bf8f97ee8ef Requires: %{name}-bin = %{version}-%{release} Requires: %{name}-src = %{version}-%{release} %if %{race} +%if %{race} Requires: %{name}-race = %{version}-%{release} %endif +%endif Patch1: 0001-Modify-go.env.patch Patch6: 0006-Default-to-ld.bfd-on-ARM64.patch @@ -423,15 +430,24 @@ 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}" + %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 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 popd cp "${tsan_go_dir}"/race_linux_amd64.syso ./src/runtime/race/internal/amd64v1/race_linux.syso @@ -442,6 +458,7 @@ 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} @@ -455,7 +472,11 @@ 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' pushd src @@ -466,7 +487,11 @@ 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' DEFAULT_GO_LD_FLAGS="" @@ -491,9 +516,11 @@ 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 @@ -615,7 +642,11 @@ 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' %if !%{external_linker} export GO_LDFLAGS="-linkmode internal" @@ -704,6 +735,7 @@ 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 @@ -711,6 +743,7 @@ fi %exclude %{goroot}/src/runtime/race/race_linux_%{gohostarch}.syso %endif %endif +%endif %files docs -f go-docs.list @@ -731,6 +764,7 @@ fi %files -n go-toolset +%if %{race} %if %{race} %files race %ifarch x86_64 @@ -740,10 +774,12 @@ fi %{goroot}/src/runtime/race/race_linux_%{gohostarch}.syso %endif %endif +%endif %changelog -* Thu Nov 20 2025 Eduard Abdullin - 1.25.3-1.alma.1 +* Tue Dec 09 2025 Eduard Abdullin - 1.25.3-1.alma.2 - Update env var for v2 +- Disable race for riscv64 ## START: Generated by rpmautospec * Wed Oct 29 2025 Alejandro Sáez - 1.25.3-1