From dd8136324cfe8110cbb8a7b2883a8c8ad33cefbe Mon Sep 17 00:00:00 2001 From: dbenoit Date: Wed, 13 May 2026 11:26:53 -0400 Subject: [PATCH] Conditionalize baseline ISA Related: RHEL-175604 --- golang.spec | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/golang.spec b/golang.spec index f84a4a0..f146775 100644 --- a/golang.spec +++ b/golang.spec @@ -99,6 +99,20 @@ %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 +%global goamd64 v3 +%global goppc64 power9 +%endif +%endif + %global go_api 1.26 # Use only for prerelease versions #global go_prerelease rc3 @@ -342,6 +356,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.