diff --git a/0001-compiler-rt-Fix-FLOAT16-feature-detection.patch b/0001-compiler-rt-Fix-FLOAT16-feature-detection.patch new file mode 100644 index 0000000000000000000000000000000000000000..0459cbc5d9eb15f1ad51d74707b4988049183708 --- /dev/null +++ b/0001-compiler-rt-Fix-FLOAT16-feature-detection.patch @@ -0,0 +1,36 @@ +From ce15f52198639e9195b8833ed60dc1a49c293956 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Tue, 29 Aug 2023 15:49:55 -0700 +Subject: [PATCH] compiler-rt: Fix FLOAT16 feature detection + +CMAKE_TRY_COMPILE_TARGET_TYPE defaults to EXECUTABLE, which causes +any feature detection code snippet without a main function to fail, +so we need to make sure it gets explicitly set to STATIC_LIBRARY. +--- + compiler-rt/lib/builtins/CMakeLists.txt | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt +index 2fc70522895f..e83a1ecea50b 100644 +--- a/compiler-rt/lib/builtins/CMakeLists.txt ++++ b/compiler-rt/lib/builtins/CMakeLists.txt +@@ -12,7 +12,6 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + "at least 3.20.0 now to avoid issues in the future!") + endif() + +- set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + project(CompilerRTBuiltins C ASM) + set(COMPILER_RT_STANDALONE_BUILD TRUE) + set(COMPILER_RT_BUILTINS_STANDALONE_BUILD TRUE) +@@ -56,6 +55,8 @@ if (COMPILER_RT_STANDALONE_BUILD) + "Turns on or off -fPIC for the builtin library source" + ON) + endif() ++ ++set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + + include(builtin-config-ix) + include(CMakePushCheckState) +-- +2.40.1 + diff --git a/add-llvm-cmake-package.patch b/add-llvm-cmake-package.patch deleted file mode 100644 index b7b63b6b85747ca00b11188cf3316e7a9fc0a21e..0000000000000000000000000000000000000000 --- a/add-llvm-cmake-package.patch +++ /dev/null @@ -1,37 +0,0 @@ -commit b18bde7a9bd6ed80f5721c47c805f0158b4fe9f8 -Author: Timm Bäder -Date: Wed Mar 9 07:17:21 2022 +0100 - - [compiler-rt] Add LLVM cmake package in standalone builds - - So the other files from the toplevel cmake/Modules directory have a - chance of being found. - -diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt -index 3a41aa43e406..6516e10fa3c5 100644 ---- a/compiler-rt/CMakeLists.txt -+++ b/compiler-rt/CMakeLists.txt -@@ -28,6 +28,12 @@ else() - set(CMAKE_CFG_RESOLVED_INTDIR "") - endif() - -+if(COMPILER_RT_STANDALONE_BUILD) -+ # Needed to find the other modules from the toplevel cmake/Modules dir -+ find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}") -+ list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}") -+endif() -+ - include(SetPlatformToolchainTools) - include(base-config-ix) - include(CompilerRTUtils) -diff --git a/compiler-rt/test/CMakeLists.txt b/compiler-rt/test/CMakeLists.txt -index 5c2b634e1180..098fb0481517 100644 ---- a/compiler-rt/test/CMakeLists.txt -+++ b/compiler-rt/test/CMakeLists.txt -@@ -1,6 +1,3 @@ --# Needed for lit support in standalone builds. --include(AddLLVM) -- - option(COMPILER_RT_TEST_STANDALONE_BUILD_LIBS - "When set to ON and testing in a standalone build, test the runtime \ - libraries built by this standalone build rather than the runtime libraries \ diff --git a/compiler-rt.spec b/compiler-rt.spec index 68f6f471e9ebcb8c7efb31122a9ad445fac841a8..5c2703ab6d57e7792b6d138b277c5984106a5c1f 100644 --- a/compiler-rt.spec +++ b/compiler-rt.spec @@ -1,7 +1,11 @@ -%define anolis_release .0.3 -%global compiler_rt_version 15.0.7 -#global rc_ver 2 +%define anolis_release .0.1 +%global maj_ver 16 +%global min_ver 0 +%global patch_ver 6 +#global rc_ver 4 +%global compiler_rt_version %{maj_ver}.%{min_ver}.%{patch_ver} %global crt_srcdir compiler-rt-%{compiler_rt_version}%{?rc_ver:rc%{rc_ver}}.src +%global cmake_srcdir cmake-%{compiler_rt_version}%{?rc_ver:rc%{rc_ver}}.src # see https://sourceware.org/bugzilla/show_bug.cgi?id=25271 %global optflags %(echo %{optflags} -D_DEFAULT_SOURCE) @@ -11,7 +15,7 @@ Name: compiler-rt Version: %{compiler_rt_version}%{?rc_ver:~rc%{rc_ver}} -Release: 1%{anolis_release}%{?dist} +Release: 3%{anolis_release}%{?dist} Summary: LLVM "compiler-rt" runtime libraries License: NCSA or MIT @@ -19,16 +23,16 @@ URL: http://llvm.org Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compiler_rt_version}%{?rc_ver:-rc%{rc_ver}}/%{crt_srcdir}.tar.xz Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compiler_rt_version}%{?rc_ver:-rc%{rc_ver}}/%{crt_srcdir}.tar.xz.sig Source2: release-keys.asc - -Patch0: add-llvm-cmake-package.patch +Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compiler_rt_version}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz +Source4: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compiler_rt_version}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz.sig Patch1: 0001-Support-LoongArch.patch # RHEL-specific patches Patch100: 0001-Drop-fno-stack-protector-from-the-compiler-flags.patch Patch101: fix-page-size-constant.patch +Patch102: 0001-compiler-rt-Fix-FLOAT16-feature-detection.patch -BuildRequires: gcc -BuildRequires: gcc-c++ +BuildRequires: clang BuildRequires: cmake BuildRequires: ninja-build BuildRequires: python3 @@ -49,17 +53,29 @@ instrumentation, and Blocks C language extension. %prep %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' +%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE4}' --data='%{SOURCE3}' +%setup -T -q -b 3 -n %{cmake_srcdir} +# TODO: It would be more elegant to set -DLLVM_COMMON_CMAKE_UTILS=%{_builddir}/%{cmake_srcdir}, +# but this is not a CACHED variable, so we can't actually set it externally :( +cd .. +mv %{cmake_srcdir} cmake + %autosetup -n %{crt_srcdir} -p2 %py3_shebang_fix lib/hwasan/scripts/hwasan_symbolize %build +# Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files. +export ASMFLAGS=$CFLAGS mkdir -p %{_vpath_builddir} cd %{_vpath_builddir} %cmake .. -GNinja \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DLLVM_CONFIG_PATH:FILEPATH=%{_bindir}/llvm-config-%{__isa_bits} \ + -DCMAKE_MODULE_PATH=%{_libdir}/cmake/llvm \ + -DCMAKE_SKIP_RPATH:BOOL=ON \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ \ %if 0%{?__isa_bits} == 64 -DLLVM_LIBDIR_SUFFIX=64 \ @@ -76,15 +92,15 @@ cd %{_vpath_builddir} %cmake_install # move blacklist/abilist files to where clang expect them -mkdir -p %{buildroot}%{_libdir}/clang/%{compiler_rt_version}/share -mv -v %{buildroot}%{_datadir}/*list.txt %{buildroot}%{_libdir}/clang/%{compiler_rt_version}/share/ +mkdir -p %{buildroot}%{_libdir}/clang/%{maj_ver}/share +mv -v %{buildroot}%{_datadir}/*list.txt %{buildroot}%{_libdir}/clang/%{maj_ver}/share/ # move sanitizer libs to better place %global libclang_rt_installdir lib/linux -mkdir -p %{buildroot}%{_libdir}/clang/%{compiler_rt_version}/lib -mv -v %{buildroot}%{_prefix}/%{libclang_rt_installdir}/*clang_rt* %{buildroot}%{_libdir}/clang/%{compiler_rt_version}/lib -mkdir -p %{buildroot}%{_libdir}/clang/%{compiler_rt_version}/lib/linux/ -pushd %{buildroot}%{_libdir}/clang/%{compiler_rt_version}/lib +mkdir -p %{buildroot}%{_libdir}/clang/%{maj_ver}/lib +mv -v %{buildroot}%{_prefix}/%{libclang_rt_installdir}/*_rt* %{buildroot}%{_libdir}/clang/%{maj_ver}/lib +mkdir -p %{buildroot}%{_libdir}/clang/%{maj_ver}/lib/linux/ +pushd %{buildroot}%{_libdir}/clang/%{maj_ver}/lib for i in *.a *.so do ln -s ../$i linux/$i @@ -94,11 +110,11 @@ done # the symlinks will be dangling if the 32 bits version is not installed, but that should be fine %ifarch x86_64 -mkdir -p %{buildroot}/%{_exec_prefix}/lib/clang/%{compiler_rt_version}/lib/linux +mkdir -p %{buildroot}/%{_exec_prefix}/lib/clang/%{maj_ver}/lib/linux for i in *.a *.so do target=`echo "$i" | sed -e 's/x86_64/i386/'` - ln -s ../../../../../lib/clang/%{compiler_rt_version}/lib/$target ../../../../%{_lib}/clang/%{compiler_rt_version}/lib/linux/ + ln -s ../../../../../lib/clang/%{maj_ver}/lib/$target ../../../../%{_lib}/clang/%{maj_ver}/lib/linux/ done %endif @@ -112,21 +128,27 @@ popd %files %license LICENSE.TXT %{_includedir}/* -%{_libdir}/clang/%{compiler_rt_version}/lib/* -%{_libdir}/clang/%{compiler_rt_version}/share/* +%{_libdir}/clang/%{maj_ver}/lib/* +%{_libdir}/clang/%{maj_ver}/share/* %ifarch x86_64 aarch64 %{_bindir}/hwasan_symbolize %endif %changelog -* Thu Dec 07 2023 Chen Li - 15.0.7-1.0.3 +* Tue Feb 20 2024 Chen Li - 16.0.6-3.0.1 - Support LoongArch -* Wed Jul 19 2023 Zhao Hang - 15.0.7-1.0.2 -- Add loongarch64 arch +* Fri Oct 13 2023 Nikita Popov - 16.0.6-3 +- Build with clang + +* Tue Aug 29 2023 Tom Stellard - 16.0.6-2 +- Fix FLOAT16 detection + +* Fri Jun 23 2023 Tom Stellard - 16.0.6-1 +- 16.0.6 Release -* Sat Jul 01 2023 Zhao Hang - 15.0.7-1.0.1 -- Remove loongarch64 arch +* Thu Apr 13 2023 Tom Stellard - 16.0.0-1 +- Update to LLVM 16.0.0 * Thu Jan 19 2023 Tom Stellard - 15.0.7-1 - Update to LLVM 15.0.7 diff --git a/download b/download index 42027ee07ec04edcd1c03e2241112a12a6f276d6..e8956fa0f35ef17d1f556c2274a0a9d5af7a0a6b 100644 --- a/download +++ b/download @@ -1,2 +1,4 @@ -12e6777354f0121cbe73ef13342a9302 compiler-rt-15.0.7.src.tar.xz -72a6058efad13f13b371d4eec667aefc compiler-rt-15.0.7.src.tar.xz.sig +b7830bb90e376c90a43c2c190a0a5ffa cmake-16.0.6.src.tar.xz +5f748e5dff6c50d57b20b32a27ac8ed0 cmake-16.0.6.src.tar.xz.sig +79eb1121d4990a6585787e6b68361afe compiler-rt-16.0.6.src.tar.xz +3420051e04da0abea97328be8defb38c compiler-rt-16.0.6.src.tar.xz.sig