From 71e9ae01bcccbecf80ff4e606a24b2cce016bd26 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 13 Oct 2023 15:46:34 +0200 Subject: [PATCH] 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 --- compiler-rt.spec | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler-rt.spec b/compiler-rt.spec index 6b8a598..4433738 100644 --- a/compiler-rt.spec +++ b/compiler-rt.spec @@ -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 - 17.0.2-2 +- Build with clang + * Wed Oct 04 2023 Nikita Popov - 17.0.2-1 - Update to LLVM 17.0.2