Disable race for risv64

Resolves: RHEL-97549
This commit is contained in:
Louis Abel 2025-06-30 09:08:51 -07:00 committed by Álex Sáez
parent 890360e761
commit c545c23036

View File

@ -7,6 +7,14 @@
%bcond_with ignore_tests
%endif
# Enable race by default
%global race 1
# Disable race on riscv64 as it's not supported
%ifarch riscv64
%global race 0
%endif
# build ids are not currently generated:
# https://code.google.com/p/go/issues/detail?id=5238
#
@ -197,7 +205,9 @@ Provides: bundled(golang(rsc.io/markdown)) = 0.0.0.20240306144322.0bf8f97ee8ef
Requires: %{name}-bin = %{version}-%{release}
Requires: %{name}-src = %{version}-%{release}
%if %{race}
Requires: %{name}-race = %{version}-%{release}
%endif
Patch1: 0001-Modify-go.env.patch
Patch6: 0006-Default-to-ld.bfd-on-ARM64.patch
@ -330,12 +340,14 @@ Requires: delve
%description -n go-toolset
This is the main package for go-toolset.
%if %{race}
%package race
Summary: Race detetector library object files.
Requires: %{name} = %{version}-%{release}
%description race
Binary library objects for Go's race detector.
%endif
%prep
@ -396,6 +408,7 @@ 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}
%ifarch x86_64
pushd "${tsan_go_dir}"
CFLAGS="%{tsan_buildflags} %{tsan_optflag}" CC=clang GOAMD64=v3 ./buildgo.sh
@ -413,6 +426,7 @@ pushd "${tsan_go_dir}"
popd
cp "${tsan_go_dir}"/race_linux_%{gohostarch}.syso ./src/runtime/race/race_linux_%{gohostarch}.syso
%endif
%endif
# bootstrap compiler GOROOT
%if !%{golang_bootstrap}
@ -462,7 +476,9 @@ popd
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared -v -x std
%endif
%if %{race}
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -race std
%endif
%install
rm -rf $RPM_BUILD_ROOT
@ -672,12 +688,14 @@ fi
%{_sysconfdir}/prelink.conf.d
%files src -f go-src.list
%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
%else
%exclude %{goroot}/src/runtime/race/race_linux_%{gohostarch}.syso
%endif
%endif
%files docs -f go-docs.list
@ -698,6 +716,7 @@ fi
%files -n go-toolset
%if %{race}
%files race
%ifarch x86_64
%{goroot}/src/runtime/race/internal/amd64v1/race_linux.syso
@ -705,6 +724,7 @@ fi
%else
%{goroot}/src/runtime/race/race_linux_%{gohostarch}.syso
%endif
%endif
%changelog
%autochangelog