Compare commits

...

2 Commits

6 changed files with 180 additions and 82 deletions

View File

@ -1,4 +1,2 @@
0de534cfef38697e115c3ae80634765f05e78e5b SOURCES/cmake-16.0.6.src.tar.xz 6ecbfa5516b60adb4e4e60f991b0d8ddf5aab12a SOURCES/compiler-rt-18.1.8.src.tar.xz
2db5c88fe9277bb0fa85f49b58e946e49ff235c2 SOURCES/cmake-16.0.6.src.tar.xz.sig 7aa7c3702e6f12f4426c83a232de1349eacbadf2 SOURCES/compiler-rt-18.1.8.src.tar.xz.sig
28ddc89aac54cbfa6d0a0cd07a14bbd3f3a01d5f SOURCES/compiler-rt-16.0.6.src.tar.xz
7374cad6da4c3c936c26e72175bdff52ab3e98e5 SOURCES/compiler-rt-16.0.6.src.tar.xz.sig

6
.gitignore vendored
View File

@ -1,4 +1,2 @@
SOURCES/cmake-16.0.6.src.tar.xz SOURCES/compiler-rt-18.1.8.src.tar.xz
SOURCES/cmake-16.0.6.src.tar.xz.sig SOURCES/compiler-rt-18.1.8.src.tar.xz.sig
SOURCES/compiler-rt-16.0.6.src.tar.xz
SOURCES/compiler-rt-16.0.6.src.tar.xz.sig

View File

@ -0,0 +1,25 @@
From 5f73befe5a0df82e455f4b1052e62f34009e98bb Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Tue, 23 Apr 2024 15:08:34 -0700
Subject: [PATCH] Fix page size constant on aarch64 and ppc64le
---
compiler-rt/lib/cfi/cfi.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/compiler-rt/lib/cfi/cfi.cpp b/compiler-rt/lib/cfi/cfi.cpp
index ad1c91623514..e7e86e5807a8 100644
--- a/compiler-rt/lib/cfi/cfi.cpp
+++ b/compiler-rt/lib/cfi/cfi.cpp
@@ -53,6 +53,8 @@ namespace __cfi {
#if SANITIZER_LOONGARCH64
#define kCfiShadowLimitsStorageSize 16384 // 16KiB on loongarch64 per page
+#elif defined(__aarch64__) || defined(__powerpc64__)
+#define kCfiShadowLimitsStorageSize 65536 // 1 page
#else
#define kCfiShadowLimitsStorageSize 4096 // 1 page
#endif
--
2.40.1

View File

@ -0,0 +1,36 @@
From ce15f52198639e9195b8833ed60dc1a49c293956 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
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
@@ -5,7 +5,6 @@
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
cmake_minimum_required(VERSION 3.20.0)
- 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)
@@ -50,6 +49,8 @@ if (COMPILER_RT_STANDALONE_BUILD)
ON)
endif()
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+
include(builtin-config-ix)
include(CMakeDependentOption)
include(CMakePushCheckState)
--
2.41.0

View File

@ -1,15 +0,0 @@
diff -ruN compiler-rt-14.0.0.src.orig/lib/cfi/cfi.cpp compiler-rt-14.0.0.src/lib/cfi/cfi.cpp
--- a/compiler-rt-14.0.0.src.orig/lib/cfi/cfi.cpp 2022-03-14 10:44:55.000000000 +0100
+++ b/compiler-rt-14.0.0.src/lib/cfi/cfi.cpp 2022-05-25 17:03:51.114415534 +0200
@@ -51,7 +51,11 @@
namespace __cfi {
+#if defined(__aarch64__) || defined(__powerpc64__)
+#define kCfiShadowLimitsStorageSize 65536 // 1 page
+#else
#define kCfiShadowLimitsStorageSize 4096 // 1 page
+#endif
// Lets hope that the data segment is mapped with 4K pages.
// The pointer to the cfi shadow region is stored at the start of this page.
// The rest of the page is unused and re-mapped read-only.

View File

@ -1,10 +1,36 @@
%global maj_ver 16 %bcond_with snapshot_build
%global min_ver 0
%global patch_ver 6 %if %{with snapshot_build}
# Unlock LLVM Snapshot LUA functions
%{llvm_sb_verbose}
%{llvm_sb}
%endif
# Opt out of https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer
# https://bugzilla.redhat.com/show_bug.cgi?id=2158587
%undefine _include_frame_pointers
%bcond_with compat_build
%global maj_ver 18
%global min_ver 1
%global patch_ver 8
#global rc_ver 4 #global rc_ver 4
%if %{with snapshot_build}
%global maj_ver %{llvm_snapshot_version_major}
%global min_ver %{llvm_snapshot_version_minor}
%global patch_ver %{llvm_snapshot_version_patch}
%undefine rc_ver
%endif
%global compiler_rt_version %{maj_ver}.%{min_ver}.%{patch_ver} %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 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
%if %{with compat_build}
%global pkg_name compiler-rt%{maj_ver}
%else
%global pkg_name compiler-rt
%endif
# see https://sourceware.org/bugzilla/show_bug.cgi?id=25271 # see https://sourceware.org/bugzilla/show_bug.cgi?id=25271
%global optflags %(echo %{optflags} -D_DEFAULT_SOURCE) %global optflags %(echo %{optflags} -D_DEFAULT_SOURCE)
@ -12,36 +38,42 @@
# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93615 # see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93615
%global optflags %(echo %{optflags} -Dasm=__asm__) %global optflags %(echo %{optflags} -Dasm=__asm__)
Name: compiler-rt Name: %{pkg_name}
Version: %{compiler_rt_version}%{?rc_ver:~rc%{rc_ver}} Version: %{compiler_rt_version}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}}
Release: 1%{?dist} Release: 1%{?dist}
Summary: LLVM "compiler-rt" runtime libraries Summary: LLVM "compiler-rt" runtime libraries
License: NCSA or MIT License: NCSA or MIT
URL: http://llvm.org URL: http://llvm.org
%if %{with snapshot_build}
Source0: %{llvm_snapshot_source_prefix}compiler-rt-%{llvm_snapshot_yyyymmdd}.src.tar.xz
%{llvm_snapshot_extra_source_tags}
%else
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compiler_rt_version}%{?rc_ver:-rc%{rc_ver}}/%{crt_srcdir}.tar.xz 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 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 Source2: release-keys.asc
Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compiler_rt_version}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz %endif
Source4: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compiler_rt_version}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz.sig
Patch0: 0001-compiler-rt-Fix-FLOAT16-feature-detection.patch
# RHEL-specific patches # RHEL-specific patches
Patch100: 0001-Drop-fno-stack-protector-from-the-compiler-flags.patch Patch100: 0001-Drop-fno-stack-protector-from-the-compiler-flags.patch
Patch101: fix-page-size-constant.patch Patch101: 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch
BuildRequires: gcc BuildRequires: clang
BuildRequires: gcc-c++
BuildRequires: cmake BuildRequires: cmake
BuildRequires: ninja-build BuildRequires: ninja-build
BuildRequires: python3 BuildRequires: python3
# We need python3-devel for pathfix.py. # We need python3-devel for %%py3_shebang_fix
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: llvm-devel = %{version} BuildRequires: llvm-devel = %{version}
BuildRequires: llvm-cmake-utils = %{version}
# For gpg source verification # For gpg source verification
BuildRequires: gnupg2 BuildRequires: gnupg2
Requires: clang-resource-filesystem%{?isa} = %{version} Requires: clang-resource-filesystem%{?isa} = %{version}
Provides: %{name}(major) = %{maj_ver}
%description %description
The compiler-rt project is a part of the LLVM project. It provides The compiler-rt project is a part of the LLVM project. It provides
@ -51,27 +83,33 @@ instrumentation, and Blocks C language extension.
%prep %prep
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %{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 %autosetup -n %{crt_srcdir} -p2
# compiler-rt does not allow configuring LLVM_COMMON_CMAKE_UTILS.
ln -s %{_datadir}/llvm/cmake ../cmake
%py3_shebang_fix lib/hwasan/scripts/hwasan_symbolize %py3_shebang_fix lib/hwasan/scripts/hwasan_symbolize
%build %build
# Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files. %undefine __cmake_in_source_build
export ASMFLAGS=$CFLAGS
mkdir -p %{_vpath_builddir}
cd %{_vpath_builddir}
%cmake .. -GNinja \ # Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files.
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_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_MODULE_PATH=%{_libdir}/cmake/llvm \ -DCMAKE_MODULE_PATH=%{_libdir}/cmake/llvm \
-DCMAKE_SKIP_RPATH:BOOL=ON \ -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 \
\
%if %{with snapshot_build}
-DLLVM_VERSION_SUFFIX="%{llvm_snapshot_version_suffix}" \
%endif
\ \
%if 0%{?__isa_bits} == 64 %if 0%{?__isa_bits} == 64
-DLLVM_LIBDIR_SUFFIX=64 \ -DLLVM_LIBDIR_SUFFIX=64 \
@ -84,53 +122,71 @@ cd %{_vpath_builddir}
%install %install
cd %{_vpath_builddir}
%cmake_install %cmake_install
%ifarch ppc64le
# move blacklist/abilist files to where clang expect them # Fix install path on ppc64le so that the directory name matches the triple used
mkdir -p %{buildroot}%{_libdir}/clang/%{maj_ver}/share # by clang.
mv -v %{buildroot}%{_datadir}/*list.txt %{buildroot}%{_libdir}/clang/%{maj_ver}/share/ mv %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/powerpc64le-redhat-linux-gnu %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/ppc64le-redhat-linux-gnu
%endif
# move sanitizer libs to better place %ifarch %{ix86}
%global libclang_rt_installdir lib/linux # Fix install path on ix86 so that the directory name matches the triple used
mkdir -p %{buildroot}%{_libdir}/clang/%{maj_ver}/lib # by clang on both actual ix86 and on x86_64 with -m32:
mv -v %{buildroot}%{_prefix}/%{libclang_rt_installdir}/*_rt* %{buildroot}%{_libdir}/clang/%{maj_ver}/lib %if "%{_target_cpu}" != "i386"
mkdir -p %{buildroot}%{_libdir}/clang/%{maj_ver}/lib/linux/ ln -s i386-redhat-linux-gnu %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/%{_target_cpu}-redhat-linux-gnu
pushd %{buildroot}%{_libdir}/clang/%{maj_ver}/lib %endif
for i in *.a *.so
do
ln -s ../$i linux/$i
done
# multilib support: also create symlink from lib to lib64, fixes rhbz#1678240
# 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/%{maj_ver}/lib/linux
for i in *.a *.so
do
target=`echo "$i" | sed -e 's/x86_64/i386/'`
ln -s ../../../../../lib/clang/%{maj_ver}/lib/$target ../../../../%{_lib}/clang/%{maj_ver}/lib/linux/
done
%endif %endif
popd
%check %check
#%%cmake_build --target check-compiler-rt #%%cmake_build --target check-compiler-rt
%files %files
%license LICENSE.TXT %license LICENSE.TXT
%{_includedir}/*
%{_libdir}/clang/%{maj_ver}/lib/*
%{_libdir}/clang/%{maj_ver}/share/*
%ifarch x86_64 aarch64 %ifarch x86_64 aarch64
%{_bindir}/hwasan_symbolize %{_prefix}/lib/clang/%{maj_ver}/bin/*
%endif %endif
%{_prefix}/lib/clang/%{maj_ver}/include/*
%{_prefix}/lib/clang/%{maj_ver}/lib/*
%{_prefix}/lib/clang/%{maj_ver}/share/*
#%ifarch x86_64 aarch64
#{_bindir}/hwasan_symbolize
#%endif
%changelog %changelog
* Tue Jul 09 2024 Tom Stellard <tstellar@redhat.com> - 18.1.8-1
- 18.1.8 Release
* Fri Mar 22 2024 Tom Stellard <tstellar@redhat.com> - 18.1.2-1
- 18.1.2 Release
* Tue Mar 12 2024 Tom Stellard <tstellar@redhat.com> - 18.1.1-1
- 18.1.1 Release
* Wed Feb 28 2024 Tom Stellard <tstellar@redhat.com> - 18.1.0~rc4-1
- 18.1.0-rc4 Release
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 17.0.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 17.0.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
%{?llvm_snapshot_changelog_entry}
* Mon Dec 18 2023 Jeremy Newton <alexjnewt at hotmail dot com> - 17.0.6-3
- Add compiler-rt(major) provides
* Wed Dec 13 2023 Miro Hrončok <mhroncok@redhat.com> - 17.0.6-2
- Fix install path on i686
* Wed Nov 29 2023 Nikita Popov <npopov@redhat.com> - 17.0.6-1
- Update to LLVM 17.0.6
* 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
* Fri Jun 23 2023 Tom Stellard <tstellar@redhat.com> - 16.0.6-1 * Fri Jun 23 2023 Tom Stellard <tstellar@redhat.com> - 16.0.6-1
- 16.0.6 Release - 16.0.6 Release