wip: build race detector on amd64
Related: RHEL-33421
This commit is contained in:
parent
b53fd755a3
commit
fa0e185f49
5
Makefile
Normal file
5
Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
mockbuild:
|
||||
centpkg mockbuild
|
||||
|
||||
spectool:
|
||||
spectool -g golang.spec
|
22
golang.spec
22
golang.spec
@ -97,6 +97,12 @@
|
||||
%global version %{go_version}
|
||||
%global pkg_release 1
|
||||
|
||||
# LLVM source SHA for race detector build
|
||||
%global compiler_rt_go_race_sha 51bfeff0e4b0757ff773da6882f4d538996c9b04
|
||||
|
||||
# For rpmdev-bumpspec and releng automation.
|
||||
%global baserelease 3
|
||||
|
||||
Name: golang
|
||||
Version: %{version}
|
||||
Release: 1%{?dist}
|
||||
@ -114,6 +120,7 @@ Source0: https://github.com/golang/go/archive/refs/tags/go%{version}.tar.
|
||||
Source1: https://github.com/golang-fips/go/archive/refs/tags/go%{version}-%{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/archive/%{compiler_rt_go_race_sha}.tar.gz
|
||||
|
||||
# The compiler is written in Go. Needs go(1.4+) compiler for build.
|
||||
# Actual Go based bootstrap compiler provided by above source.
|
||||
@ -132,6 +139,10 @@ BuildRequires: openssl-devel
|
||||
# for tests
|
||||
BuildRequires: pcre-devel, glibc-static, perl
|
||||
|
||||
# Necessary for building llvm address sanitizer for Go race detector
|
||||
BuildRequires: libstdc++-devel
|
||||
BuildRequires: clang
|
||||
|
||||
Provides: go = %{version}-%{release}
|
||||
Requires: %{name}-bin = %{version}-%{release}
|
||||
Requires: %{name}-src = %{version}-%{release}
|
||||
@ -270,6 +281,7 @@ popd
|
||||
sed -i '1s/$/ (%{?rhel:Red Hat} %{version}-%{release})/' VERSION
|
||||
|
||||
cp %{SOURCE2} ./src/runtime/
|
||||
# If FIPS is enabled, install the FIPS source
|
||||
|
||||
%build
|
||||
set -xe
|
||||
@ -278,6 +290,16 @@ uname -a
|
||||
cat /proc/cpuinfo
|
||||
cat /proc/meminfo
|
||||
|
||||
# Build race detector .syso's from llvm sources
|
||||
%global tsan_buildflags %(echo %{build_cflags} | sed 's/-mtls-dialect=gnu2//')
|
||||
mkdir ../llvm
|
||||
tar -xf %{SOURCE3} -C ../llvm
|
||||
tsan_go_dir="../llvm/llvm-project-%{compiler_rt_go_race_sha}/compiler-rt/lib/tsan/go"
|
||||
pushd "${tsan_go_dir}"
|
||||
CFLAGS="${tsan_buildflags}" CC=clang GOAMD64=v3 ./buildgo.sh
|
||||
popd
|
||||
cp "${tsan_go_dir}"/race_linux_amd64.syso ./src/runtime/race/internal/amd64v3/race_linux.syso
|
||||
|
||||
# bootstrap compiler GOROOT
|
||||
%if !%{golang_bootstrap}
|
||||
export GOROOT_BOOTSTRAP=/
|
||||
|
Loading…
Reference in New Issue
Block a user