Build with clang

This is necessary to detect the correct float16 ABI.

Also fix setting of ASMFLAGS, so -fcf-protection gets set properly.

Resolves: RHEL-8713
This commit is contained in:
Nikita Popov 2023-10-13 15:46:34 +02:00
parent b1089128a2
commit 71e9ae01bc

View File

@ -32,7 +32,7 @@
Name: compiler-rt
Version: %{compiler_rt_version}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}}
Release: 1%{?dist}
Release: 2%{?dist}
Summary: LLVM "compiler-rt" runtime libraries
License: NCSA or MIT
@ -52,8 +52,7 @@ Patch0: 0001-compiler-rt-Fix-FLOAT16-feature-detection.patch
Patch100: 0001-Drop-fno-stack-protector-from-the-compiler-flags.patch
Patch101: fix-page-size-constant.patch
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: clang
BuildRequires: cmake
BuildRequires: ninja-build
BuildRequires: python3
@ -86,12 +85,16 @@ ln -s %{_datadir}/llvm/cmake ../cmake
%undefine __cmake_in_source_build
# Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files.
export ASMFLAGS=$CFLAGS
export ASMFLAGS="%{build_cflags}"
# RHEL 8 specific: "global toolchain clang" is not supported on RHEL 8, so explicitly enable
# clang in cmake. This is necessary to get the correct float16 ABI.
%cmake -GNinja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_MODULE_PATH=%{_libdir}/cmake/llvm \
-DCMAKE_SKIP_RPATH:BOOL=ON \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCOMPILER_RT_INSTALL_PATH=%{_prefix}/lib/clang/%{maj_ver} \
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
\
@ -133,6 +136,9 @@ mv %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/powerpc64le-redhat-linux-gnu
#%endif
%changelog
* Fri Oct 13 2023 Nikita Popov <npopov@redhat.com> - 17.0.2-2
- Build with clang
* Wed Oct 04 2023 Nikita Popov <npopov@redhat.com> - 17.0.2-1
- Update to LLVM 17.0.2