From b1089128a2e3d87076ca1482df142a93a335d1ef Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 4 Oct 2023 14:16:37 +0200 Subject: [PATCH] Update to LLVM 17.0.2 Resolves: RHEL-9028 --- .gitignore | 4 +- ...ler-rt-Fix-FLOAT16-feature-detection.patch | 36 ++++++ add-llvm-cmake-package.patch | 37 ------ compiler-rt.spec | 109 +++++++++--------- sources | 6 +- 5 files changed, 97 insertions(+), 95 deletions(-) create mode 100644 0001-compiler-rt-Fix-FLOAT16-feature-detection.patch delete mode 100644 add-llvm-cmake-package.patch diff --git a/.gitignore b/.gitignore index edcebe6..ec8b696 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ SOURCES/compiler-rt-15.0.7.src.tar.xz -SOURCES/release-keys.asc /compiler-rt-15.0.7.src.tar.xz -/release-keys.asc /compiler-rt-16.0.0.src.tar.xz /compiler-rt-16.0.0.src.tar.xz.sig /cmake-16.0.0.src.tar.xz @@ -10,3 +8,5 @@ SOURCES/release-keys.asc /compiler-rt-16.0.6.src.tar.xz.sig /cmake-16.0.6.src.tar.xz /cmake-16.0.6.src.tar.xz.sig +/compiler-rt-17.0.2.src.tar.xz +/compiler-rt-17.0.2.src.tar.xz.sig 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 0000000..8228ddc --- /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 +@@ -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 + diff --git a/add-llvm-cmake-package.patch b/add-llvm-cmake-package.patch deleted file mode 100644 index b7b63b6..0000000 --- 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 da03277..6b8a598 100644 --- a/compiler-rt.spec +++ b/compiler-rt.spec @@ -1,10 +1,28 @@ -%global maj_ver 16 +%bcond_with snapshot_build + +%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 + +%global maj_ver 17 %global min_ver 0 -%global patch_ver 6 +%global patch_ver 2 #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 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) @@ -13,17 +31,22 @@ %global optflags %(echo %{optflags} -Dasm=__asm__) Name: compiler-rt -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} Summary: LLVM "compiler-rt" runtime libraries License: NCSA or MIT 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 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 -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 +%endif + +Patch0: 0001-compiler-rt-Fix-FLOAT16-feature-detection.patch # RHEL-specific patches Patch100: 0001-Drop-fno-stack-protector-from-the-compiler-flags.patch @@ -34,9 +57,10 @@ BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: ninja-build BuildRequires: python3 -# We need python3-devel for pathfix.py. +# We need python3-devel for %%py3_shebang_fix BuildRequires: python3-devel BuildRequires: llvm-devel = %{version} +BuildRequires: llvm-cmake-utils = %{version} # For gpg source verification BuildRequires: gnupg2 @@ -51,27 +75,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 +# compiler-rt does not allow configuring LLVM_COMMON_CMAKE_UTILS. +ln -s %{_datadir}/llvm/cmake ../cmake + %py3_shebang_fix lib/hwasan/scripts/hwasan_symbolize %build +%undefine __cmake_in_source_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 \ +%cmake -GNinja \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_MODULE_PATH=%{_libdir}/cmake/llvm \ -DCMAKE_SKIP_RPATH:BOOL=ON \ + -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 -DLLVM_LIBDIR_SUFFIX=64 \ @@ -84,53 +110,32 @@ cd %{_vpath_builddir} %install -cd %{_vpath_builddir} %cmake_install - -# move blacklist/abilist files to where clang expect them -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/%{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 -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 - +%ifarch ppc64le +# Fix install path on ppc64le so that the directory name matches the triple used +# by clang. +mv %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/powerpc64le-redhat-linux-gnu %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/ppc64le-redhat-linux-gnu %endif -popd - %check - #%%cmake_build --target check-compiler-rt %files %license LICENSE.TXT -%{_includedir}/* -%{_libdir}/clang/%{maj_ver}/lib/* -%{_libdir}/clang/%{maj_ver}/share/* %ifarch x86_64 aarch64 -%{_bindir}/hwasan_symbolize +%{_prefix}/lib/clang/%{maj_ver}/bin/* %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 +* Wed Oct 04 2023 Nikita Popov - 17.0.2-1 +- Update to LLVM 17.0.2 + * Fri Jun 23 2023 Tom Stellard - 16.0.6-1 - 16.0.6 Release diff --git a/sources b/sources index 26bbcaf..a4af071 100644 --- a/sources +++ b/sources @@ -1,4 +1,2 @@ -SHA512 (compiler-rt-16.0.6.src.tar.xz) = 852e2105facb12ea0943aa24e0c220f76671ad76dfe7d07b8164c3a1d8360670ca565a2b6dd590722b974e16a2adf3c466fdabdfd3bb3ebbd005162c8ac4406c -SHA512 (compiler-rt-16.0.6.src.tar.xz.sig) = 3c86a39829c02c61258874a8729b50a4b562716fcf901a69fe4bf6316b91c0f56596a20b98e74881b729773a34c3b4d4fa01cbc2ada81ed452a3cc2ad7ea3bbb -SHA512 (cmake-16.0.6.src.tar.xz) = 52ecd941d2d85a5b668caa5d0d40480cb6a97b3bf1174e634c2a93e9ef6d03670ca7e96abb0a60cb33ba537b93d5788754dab1f2f45c1f623f788162717d088b -SHA512 (cmake-16.0.6.src.tar.xz.sig) = d20c5e51315aa476775e6ce886684b9f882ce283fc40aa6c1b8f03964c77a1e745e2e1fb00b3488dddfe1a04378e2bfd090350de28e58088525a5305ecb1bea6 +SHA512 (compiler-rt-17.0.2.src.tar.xz) = ba7875ff9c55485002c172cca7777a3f9e0f1ca39a51e9ffa4f1308b675b7365902f02ba6d62519593eb5512d3ca37d0cf94969a0d21041e4a0e94e61cb3ff8a +SHA512 (compiler-rt-17.0.2.src.tar.xz.sig) = 922bdb7f21e3bf4a4a7553967572cee6cc0090f5f4a2f6fcc470390fb4073fa61c6e54afe088885a35cb8ead2758e90e82101cf2aecb2de1c0e19ebd54e90ec2