diff --git a/0001-Fix-for-compiler-rt-stand-alone-builds.patch b/0001-Fix-for-compiler-rt-stand-alone-builds.patch new file mode 100644 index 0000000000000000000000000000000000000000..0e290d652d9680f1163a58f81956826e350bfd0d --- /dev/null +++ b/0001-Fix-for-compiler-rt-stand-alone-builds.patch @@ -0,0 +1,25 @@ +From c6d15e4a5fc0a012356eb984e617ddb6d05ff8a6 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Fri, 29 Jul 2022 23:37:43 -0700 +Subject: [PATCH] Fix for compiler-rt stand-alone builds + +--- + compiler-rt/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt +index 62737735695f..70568cdb201c 100644 +--- a/compiler-rt/CMakeLists.txt ++++ b/compiler-rt/CMakeLists.txt +@@ -68,7 +68,7 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOL + "Build for a bare-metal target.") + + if (COMPILER_RT_STANDALONE_BUILD) +- load_llvm_config() ++ find_package(LLVM) + if (TARGET intrinsics_gen) + # Loading the llvm config causes this target to be imported so place it + # under the appropriate folder in an IDE. +-- +2.27.0 + diff --git a/compiler-rt-15.0.7.src.tar.xz b/compiler-rt-15.0.7.src.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..c5659383f7d8e95fc178d06ddc1d6988d85d8d3e Binary files /dev/null and b/compiler-rt-15.0.7.src.tar.xz differ diff --git a/compiler-rt-15.0.7.src.tar.xz.sig b/compiler-rt-15.0.7.src.tar.xz.sig new file mode 100644 index 0000000000000000000000000000000000000000..bb33dfff35ab9184cfceb01b5fd1ee3e6ed21bcd Binary files /dev/null and b/compiler-rt-15.0.7.src.tar.xz.sig differ diff --git a/compiler-rt.spec b/compiler-rt.spec new file mode 100644 index 0000000000000000000000000000000000000000..610a1c574d035143d36736e27c1c30804c9953d2 --- /dev/null +++ b/compiler-rt.spec @@ -0,0 +1,128 @@ +%bcond_without sys_llvm +%bcond_without check + +%global maj_ver 15 +%global min_ver 0 +%global patch_ver 7 +%global crt_version %{maj_ver}.%{min_ver}.%{patch_ver} +%global crt_srcdir compiler-rt-%{version}%{?rc_ver:rc%{rc_ver}}.src +%global optflags %(echo %{optflags} -D_DEFAULT_SOURCE) +%global optflags %(echo %{optflags} -Dasm=__asm__) + +Name: compiler-rt +Version: %{crt_version} +Release: 1 +Summary: LLVM "compiler-rt" runtime libraries + +License: NCSA or MIT +URL: http://llvm.org +Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{crt_srcdir}.tar.xz +Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{crt_srcdir}.tar.xz.sig + +Patch0: 0001-Fix-for-compiler-rt-stand-alone-builds.patch + +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: cmake +BuildRequires: ninja-build +BuildRequires: python3 +# We need python3-devel for pathfix.py. +BuildRequires: python3-devel +BuildRequires: llvm-devel = %{version} +BuildRequires: llvm-test = %{version} + +Requires: clang-resource-filesystem%{?isa} = %{version} + +%description +The compiler-rt project is a part of the LLVM project. It provides +implementation of the low-level target-specific hooks required by +code generation, sanitizer runtimes and profiling library for code +instrumentation, and Blocks C language extension. + +%prep +%autosetup -n %{crt_srcdir} -p2 +pathfix.py -i %{__python3} -pn lib/hwasan/scripts/hwasan_symbolize + +%build +# Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files. +export ASMFLAGS=$CFLAGS +mkdir -p _build +cd _build +%cmake .. \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_MODULE_PATH=%{_libdir}/cmake/llvm \ + -DCMAKE_SKIP_RPATH:BOOL=ON \ +%if 0%{?__isa_bits} == 64 + -DLLVM_LIBDIR_SUFFIX=64 \ +%else + -DLLVM_LIBDIR_SUFFIX= \ +%endif + -DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF # could be on? + +%make_build + +%install +cd _build +%make_install + + +# move blacklist/abilist files to where clang expect them +mkdir -p %{buildroot}%{_libdir}/clang/%{version}/share +mv -v %{buildroot}%{_datadir}/*list.txt %{buildroot}%{_libdir}/clang/%{version}/share/ + +# move sanitizer libs to better place +%global libclang_rt_installdir lib/linux +mkdir -p %{buildroot}%{_libdir}/clang/%{version}/lib +mv -v %{buildroot}%{_prefix}/%{libclang_rt_installdir}/*clang_rt* %{buildroot}%{_libdir}/clang/%{version}/lib +mkdir -p %{buildroot}%{_libdir}/clang/%{version}/lib/linux/ +pushd %{buildroot}%{_libdir}/clang/%{version}/lib +for i in *.a *.so +do + ln -s ../$i linux/$i +done +popd + +# 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 %{ix86} +%post +if test "`uname -m`" = x86_64 +then + cd %{_libdir}/clang/%{version}/lib + mkdir -p ../../../../lib64/clang/%{version}/lib + for i in *.a *.so + do + ln -s ../../../../%{_lib}/clang/%{version}/lib/$i ../../../../lib64/clang/%{version}/lib/$i + done +fi + +%preun + +if test "`uname -m`" = x86_64 +then + cd %{_libdir}/clang/%{version}/lib + for i in *.a *.so + do + rm ../../../../lib64/clang/%{version}/lib/$i + done + rmdir -p ../../../../lib64/clang/%{version}/lib 2>/dev/null 1>/dev/null || : +fi + +%endif + +%check + +#%%cmake_build --target check-compiler-rt + +%files +%license LICENSE.TXT +%{_includedir}/* +%{_libdir}/clang/%{version}/lib/* +%{_libdir}/clang/%{version}/share/* +%ifarch x86_64 aarch64 +%{_bindir}/hwasan_symbolize +%endif + +%changelog +* Fri Jul 14 2023 cf-zhao - 15.0.7-1 +- Package init diff --git a/compiler-rt.yaml b/compiler-rt.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7d98bd835f0acc97da741f20f900a6ebae1512c5 --- /dev/null +++ b/compiler-rt.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: llvm/llvm-project +tag_prefix: ^llvmorg- +seperator: .