diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae1a032 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +SOURCES/cfe-5.0.0.src.tar.xz +SOURCES/cmake-3.4.3.tar.gz +SOURCES/llvm-5.0.0.src.tar.xz diff --git a/.llvm-private.metadata b/.llvm-private.metadata new file mode 100644 index 0000000..28739ee --- /dev/null +++ b/.llvm-private.metadata @@ -0,0 +1,3 @@ +8c67071be174c66264b6c7629c291c0e30ecbdc5 SOURCES/cfe-5.0.0.src.tar.xz +49e4f05d46d4752e514b19ba36bf97d20a7da66a SOURCES/cmake-3.4.3.tar.gz +7b0fd212ecc38461e392cbdcbe6a1d4944138a04 SOURCES/llvm-5.0.0.src.tar.xz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/0001-Fix-CMake-include-patch.patch b/SOURCES/0001-Fix-CMake-include-patch.patch new file mode 100644 index 0000000..ed60a3d --- /dev/null +++ b/SOURCES/0001-Fix-CMake-include-patch.patch @@ -0,0 +1,54 @@ +From f8dac15efe0c2330e1d24bcac89b1d01d9c794b9 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Mon, 2 Oct 2017 18:42:32 -0700 +Subject: [PATCH] Fix CMake include patch + +--- + CMakeLists.txt | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 160f3b0..2fd3a27 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -303,6 +303,7 @@ else() + endif() + + # Each of them corresponds to llvm-config's. ++# + set(LLVM_TOOLS_BINARY_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) # --bindir + set(LLVM_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) # --libdir + set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) # --src-root +@@ -768,6 +769,11 @@ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin ) + set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} ) + set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} ) + ++if(INCLUDE_INSTALL_DIR) ++else() ++set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include) ++endif() ++ + if(APPLE AND DARWIN_LTO_LIBRARY) + set(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}") +@@ -949,7 +955,7 @@ add_subdirectory(cmake/modules) + + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) + install(DIRECTORY include/llvm include/llvm-c +- DESTINATION include ++ DESTINATION "${INCLUDE_INSTALL_DIR}" + COMPONENT llvm-headers + FILES_MATCHING + PATTERN "*.def" +@@ -961,7 +967,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) + ) + + install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm +- DESTINATION include ++ DESTINATION "${INCLUDE_INSTALL_DIR}" + COMPONENT llvm-headers + FILES_MATCHING + PATTERN "*.def" +-- +1.8.3.1 + diff --git a/SOURCES/0001-PowerPC-Don-t-use-xscvdpspn-on-the-P7.patch b/SOURCES/0001-PowerPC-Don-t-use-xscvdpspn-on-the-P7.patch new file mode 100644 index 0000000..2fae157 --- /dev/null +++ b/SOURCES/0001-PowerPC-Don-t-use-xscvdpspn-on-the-P7.patch @@ -0,0 +1,79 @@ +From a481ab548d038c1dfd52ee211b997e2dd33ff5ae Mon Sep 17 00:00:00 2001 +From: Hal Finkel +Date: Wed, 6 Sep 2017 03:08:26 +0000 +Subject: [PATCH] [PowerPC] Don't use xscvdpspn on the P7 + +xscvdpspn was not introduced until the P8, so don't use it on the P7. Fixes a +regression introduced in r288152. + +git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312612 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + lib/Target/PowerPC/PPCISelLowering.cpp | 9 ++++++--- + test/CodeGen/PowerPC/fp-splat.ll | 27 +++++++++++++++++++++++++++ + 2 files changed, 33 insertions(+), 3 deletions(-) + create mode 100644 test/CodeGen/PowerPC/fp-splat.ll + +diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp +index 74dedaf..6295693 100644 +--- a/lib/Target/PowerPC/PPCISelLowering.cpp ++++ b/lib/Target/PowerPC/PPCISelLowering.cpp +@@ -7463,9 +7463,11 @@ static SDValue BuildVSLDOI(SDValue LHS, SDValue RHS, unsigned Amt, EVT VT, + /// - The node is a "load-and-splat" + /// In all other cases, we will choose to keep the BUILD_VECTOR. + static bool haveEfficientBuildVectorPattern(BuildVectorSDNode *V, +- bool HasDirectMove) { ++ bool HasDirectMove, ++ bool HasP8Vector) { + EVT VecVT = V->getValueType(0); +- bool RightType = VecVT == MVT::v2f64 || VecVT == MVT::v4f32 || ++ bool RightType = VecVT == MVT::v2f64 || ++ (HasP8Vector && VecVT == MVT::v4f32) || + (HasDirectMove && (VecVT == MVT::v2i64 || VecVT == MVT::v4i32)); + if (!RightType) + return false; +@@ -7627,7 +7629,8 @@ SDValue PPCTargetLowering::LowerBUILD_VECTOR(SDValue Op, + // lowered to VSX instructions under certain conditions. + // Without VSX, there is no pattern more efficient than expanding the node. + if (Subtarget.hasVSX() && +- haveEfficientBuildVectorPattern(BVN, Subtarget.hasDirectMove())) ++ haveEfficientBuildVectorPattern(BVN, Subtarget.hasDirectMove(), ++ Subtarget.hasP8Vector())) + return Op; + return SDValue(); + } +diff --git a/test/CodeGen/PowerPC/fp-splat.ll b/test/CodeGen/PowerPC/fp-splat.ll +new file mode 100644 +index 0000000..9b1ab21 +--- /dev/null ++++ b/test/CodeGen/PowerPC/fp-splat.ll +@@ -0,0 +1,27 @@ ++; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-P8 -check-prefix=CHECK ++; RUN: llc -mcpu=pwr7 -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-P7 -check-prefix=CHECK ++ ++define <4 x float> @test1(float %a) { ++entry: ++; CHECK-LABEL: test1 ++ %vecins = insertelement <4 x float> undef, float %a, i32 0 ++ %vecins1 = insertelement <4 x float> %vecins, float %a, i32 1 ++ %vecins2 = insertelement <4 x float> %vecins1, float %a, i32 2 ++ %vecins3 = insertelement <4 x float> %vecins2, float %a, i32 3 ++ ret <4 x float> %vecins3 ++; CHECK-P8: xscvdpspn ++; CHECK-P7-NOT: xscvdpspn ++; CHECK: blr ++} ++ ++define <2 x double> @test2(double %a) { ++entry: ++; CHECK-LABEL: test2 ++ %vecins = insertelement <2 x double> undef, double %a, i32 0 ++ %vecins1 = insertelement <2 x double> %vecins, double %a, i32 1 ++ ret <2 x double> %vecins1 ++; CHECK-P8: xxspltd ++; CHECK-P7: xxspltd ++; CHECK: blr ++} ++ +-- +1.8.3.1 + diff --git a/SOURCES/clang-config.h b/SOURCES/clang-config.h new file mode 100644 index 0000000..c369b45 --- /dev/null +++ b/SOURCES/clang-config.h @@ -0,0 +1,9 @@ +#include + +#if __WORDSIZE == 32 +#include "config-32.h" +#elif __WORDSIZE == 64 +#include "config-64.h" +#else +#error "Unknown word size" +#endif diff --git a/SOURCES/llvm-config.h b/SOURCES/llvm-config.h new file mode 100644 index 0000000..2fa08c9 --- /dev/null +++ b/SOURCES/llvm-config.h @@ -0,0 +1,9 @@ +#include + +#if __WORDSIZE == 32 +#include "llvm-config-32.h" +#elif __WORDSIZE == 64 +#include "llvm-config-64.h" +#else +#error "Unknown word size" +#endif diff --git a/SPECS/llvm.spec b/SPECS/llvm.spec new file mode 100644 index 0000000..48cca5b --- /dev/null +++ b/SPECS/llvm.spec @@ -0,0 +1,351 @@ +%global maj_ver 5 +%global min_ver 0 +%global patch_ver 0 + +# Components enabled if supported by target architecture: +%ifarch %ix86 x86_64 + %bcond_without gold +%else + %bcond_with gold +%endif + +%if 0%{?rhel} == 6 +%define rhel6 1 +%endif + +# llvm works on the 64-bit versions of these, but not the 32 versions. +# consequently we build swrast on them instead of llvmpipe. +ExcludeArch: ppc s390 %{?rhel6:s390x} + +%ifarch s390x +%global host_target SystemZ +%endif +%ifarch ppc64 ppc64le +%global host_target PowerPC +%endif +%ifarch %ix86 x86_64 +%global host_target X86 +%endif +%ifarch aarch64 +%global host_target AArch64 +%endif +%ifarch %{arm} +%global host_target ARM +%endif + +%ifnarch s390x +%global amdgpu ;AMDGPU +%endif + +%global llvm_lib_suffix rhel + +Name: llvm-private +Version: %{maj_ver}.%{min_ver}.%{patch_ver} +Release: 3%{?dist} +Summary: llvm engine for Mesa + +Group: System Environment/Libraries +License: NCSA +URL: http://llvm.org +Source0: http://llvm.org/releases/%{version}/llvm-%{version}.src.tar.xz +Source1: cmake-3.4.3.tar.gz +Source2: http://llvm.org/releases/%{version}/cfe-%{version}.src.tar.xz +Source100: llvm-config.h +Source101: clang-config.h + +Patch1: 0001-Fix-CMake-include-patch.patch +Patch2: 0001-PowerPC-Don-t-use-xscvdpspn-on-the-P7.patch + +BuildRequires: cmake +BuildRequires: zlib-devel +%if %{with gold} +BuildRequires: binutils-devel +%endif +BuildRequires: libstdc++-static +BuildRequires: python + +%description +This package contains the LLVM-based runtime support for Mesa. It is not a +fully-featured build of LLVM, and use by any package other than Mesa is not +supported. + +%package devel +Summary: Libraries and header files for LLVM +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +This package contains library and header files needed to build the LLVM +support in Mesa. + +%prep +%setup -T -q -b 2 -n cfe-%{version}.src + +%setup -q -n llvm-%{version}.src + +tar xf %{SOURCE1} + +%patch1 -p1 -b .fixinc +%patch2 -p1 -b .xscvdpsp + +%build + +BUILD_DIR=`pwd`/cmake_build +cd cmake-3.4.3 +cmake . -DCMAKE_INSTALL_PREFIX=$BUILD_DIR +make +make install +cd - + + +sed -i 's|ActiveIncludeDir = ActivePrefix + "/include|&/llvm-private|g' tools/llvm-config/llvm-config.cpp + +mkdir -p _build +cd _build + +export PATH=$BUILD_DIR/bin:$PATH +%global __cmake $BUILD_DIR/bin/cmake +# force off shared libs as cmake macros turns it on. +%cmake .. \ + -DINCLUDE_INSTALL_DIR=%{_includedir}/llvm-private \ + -DLLVM_VERSION_SUFFIX="-%{llvm_lib_suffix}" \ + -DBUILD_SHARED_LIBS:BOOL=OFF \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-Bsymbolic -static-libstdc++" \ +%if 0%{?__isa_bits} == 64 + -DLLVM_LIBDIR_SUFFIX=64 \ +%else + -DLLVM_LIBDIR_SUFFIX= \ +%endif + \ + -DLLVM_TARGETS_TO_BUILD="%{host_target}%{?amdgpu};BPF" \ + -DLLVM_ENABLE_LIBCXX:BOOL=OFF \ + -DLLVM_ENABLE_ZLIB:BOOL=ON \ + -DLLVM_ENABLE_FFI:BOOL=OFF \ + -DLLVM_ENABLE_RTTI:BOOL=OFF \ +%if %{with gold} + -DLLVM_BINUTILS_INCDIR=%{_includedir} \ +%endif + \ + -DLLVM_BUILD_RUNTIME:BOOL=ON \ + \ + -DLLVM_INCLUDE_TOOLS:BOOL=ON \ + -DLLVM_BUILD_TOOLS:BOOL=ON \ + \ + -DLLVM_INCLUDE_TESTS:BOOL=ON \ + -DLLVM_BUILD_TESTS:BOOL=ON \ + \ + -DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \ + -DLLVM_BUILD_EXAMPLES:BOOL=OFF \ + \ + -DLLVM_INCLUDE_UTILS:BOOL=ON \ + -DLLVM_INSTALL_UTILS:BOOL=OFF \ + \ + -DLLVM_INCLUDE_DOCS:BOOL=OFF \ + -DLLVM_BUILD_DOCS:BOOL=OFF \ + -DLLVM_ENABLE_SPHINX:BOOL=OFF \ + -DLLVM_ENABLE_DOXYGEN:BOOL=OFF \ + \ + -DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \ + -DLLVM_DYLIB_EXPORT_ALL:BOOL=ON \ + -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ + -DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \ + -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF + +make %{?_smp_mflags} VERBOSE=1 + +# Build clang separately, because we need to build with +# -DBUILD_SHARED_LIBS:BOOL=ON for clang, but we don't want +# this for LLVM. + +cd ../../cfe-%{version}.src +mkdir -p _build +cd _build +%cmake .. \ + -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DLLVM_CONFIG:FILEPATH=%{_builddir}/llvm-%{version}.src/_build/bin/llvm-config \ + \ + -DCLANG_ENABLE_ARCMT:BOOL=ON \ + -DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON \ + -DCLANG_INCLUDE_DOCS:BOOL=ON \ + -DCLANG_INCLUDE_TESTS:BOOL=ON \ + -DCLANG_PLUGIN_SUPPORT:BOOL=ON \ + -DENABLE_LINKER_BUILD_ID:BOOL=ON \ + \ + -DCLANG_BUILD_EXAMPLES:BOOL=OFF \ +%if 0%{?__isa_bits} == 64 + -DLLVM_LIBDIR_SUFFIX=64 \ +%else + -DLLVM_LIBDIR_SUFFIX= \ +%endif + -DLIB_SUFFIX= + +make %{?_smp_mflags} + +%install + +# Install LLVM +cd _build +make install DESTDIR=%{buildroot} + +cd ../../cfe-%{version}.src/_build +make install DESTDIR=%{buildroot} + + +# fix multi-lib +mv -v %{buildroot}%{_bindir}/llvm-config %{buildroot}%{_bindir}/%{name}-config-%{__isa_bits} +mv -v %{buildroot}%{_includedir}/llvm-private/llvm/Config/llvm-config{,-%{__isa_bits}}.h +install -m 0644 %{SOURCE100} %{buildroot}%{_includedir}/llvm-private/llvm/Config/llvm-config.h +mv -v %{buildroot}%{_includedir}/clang/Config/config{,-%{__isa_bits}}.h +install -m 0644 %{SOURCE101} %{buildroot}%{_includedir}/clang/Config/config.h + +rm -f %{buildroot}%{_libdir}/*.a + +rm -f %{buildroot}%{_libdir}/libLLVM.so + +# remove documentation makefiles: +# they require the build directory to work +find examples -name 'Makefile' | xargs -0r rm -f + +# Rename tools needed by rust. +for t in mc ar as; do mv -v %{buildroot}/%{_bindir}/llvm-$t %{buildroot}/%{_bindir}/llvm-private-$t-%{__isa_bits}; done; + +# RHEL: strip out most binaries, most libs, and man pages +ls %{buildroot}%{_bindir}/* | grep -v bin/llvm-private | xargs rm -f +ls %{buildroot}%{_libdir}/* | grep -v libLLVM | grep -v libclang | xargs rm -f +rm -rf %{buildroot}%{_mandir}/man1 + +# RHEL: Strip out some headers Mesa doesn't need +rm -rf %{buildroot}%{_includedir}/llvm-private/llvm/{Assembly} +rm -rf %{buildroot}%{_includedir}/llvm-private/llvm/Option +rm -rf %{buildroot}%{_includedir}/llvm-private/llvm/TableGen +rm -rf %{buildroot}%{_includedir}/llvm-c/lto.h + +# RHEL: Strip out cmake build foo +rm -rf %{buildroot}%{_datadir}/llvm/cmake +rm -rf %{buildroot}%{_libdir}/cmake/clang + +# RHEL: bcc uses find_package(LLVM) in its cmake file, which requires +# LLVMConfig.cmake to be installed. +find %{buildroot}%{_libdir}/cmake/llvm/ ! -name 'LLVMConfig.cmake' -type f -exec rm -rf {} + + + +# RHEL: Strip out eveything in _datadir and _libexedir +rm -rf %{buildroot}%{_datadir}/* +rm -rf %{buildroot}%{_libexecdir}/* + +# clang seems to ignore INCLUDE_INSTALL_DIR +mv %{buildroot}%{_includedir}/{,llvm-private}/clang +mv %{buildroot}%{_includedir}/{,llvm-private}/clang-c + +# Move clang libraries: +mkdir %{buildroot}%{_libdir}/clang-private +for f in `find %{buildroot}%{_libdir} -iname 'libclang*' `; do mv $f %{buildroot}%{_libdir}/clang-private; done + +%check +cd _build +# 3.8.1 note: skx failures are XFAIL. the skylake backport does not wire +# up AVX512 for skylake, but the tests are from code that expects that. +# safe to ignore. +make check-all || : + +cd ../../cfe-%{version}.src/_build +make check-all || : + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%doc LICENSE.TXT +%{_libdir}/libLLVM-%{maj_ver}.%{min_ver}*-%{llvm_lib_suffix}.so +%{_libdir}/clang-private/libclang*.so* + +%files devel +%{_bindir}/llvm-private* +%{_includedir}/llvm-private/llvm +%{_includedir}/llvm-private/llvm-c +%{_libdir}/cmake/llvm/LLVMConfig.cmake +%{_includedir}/llvm-private/clang +%{_includedir}/llvm-private/clang-c +%{_libdir}/clang/%{version}/include + +%changelog +* Thu Dec 14 2017 Tom Stellard - 5.0.0-3 +- Backport r312612 from upstream llvm: [PowerPC] Don't use xscvdpspn on the P7 + +* Thu Oct 19 2017 Tom Stellard - 5.0.0-2 +- Enable BPF target + +* Thu Oct 12 2017 Tom Stellard - 5.0.0-1 +- Update to 5.0.0 + +* Thu Jun 01 2017 Tilmann Scheller - 3.9.1-9 +- Fix two Clang test failures and enable Clang regression tests during build. + +* Mon May 08 2017 Tom Stellard - 3.9.1-8 +- Fix clang headers with multilib. + +* Fri Apr 07 2017 Tom Stellard - 3.9.1-7 +- Add clang libs + +* Mon Mar 27 2017 Tom Stellard - 3.9.1-6 +- Ignore test failures due APFloat unit test failure on AArch64. + +* Mon Feb 27 2017 Tom Stellard - 3.9.1-5 +- Add rust patches + +* Mon Feb 27 2017 Tom Stellard - 3.9.1-4 +- Don't ignore make check failures + +* Mon Feb 27 2017 Tom Stellard - 3.9.1-3 +- Remove old patches + +* Mon Feb 27 2017 Tom Stellard - 3.9.1-2 +- Rename mesa-private-llvm -> llvm-private + +* Tue Jan 10 2017 Jeff Law - 3.9.1-1 +- Update to 3.9.1 + +* Wed Jul 13 2016 Adam Jackson - 3.8.1-1 +- Update to 3.8.1 +- Sync some x86 getHostCPUName updates from trunk + +* Tue Jun 14 2016 Dave Airlie - 3.8.0-2 +- drop private cmake build + +* Thu Mar 10 2016 Dave Airlie 3.8.0-1 +- llvm 3.8.0 final release + +* Thu Mar 03 2016 Dave Airlie 3.8.0-0.2 +- llvm 3.8.0 rc3 release + +* Fri Feb 19 2016 Dave Airlie 3.8.0-0.1 +- llvm 3.8.0 rc2 release + +* Tue Feb 16 2016 Dan HorĂ¡k 3.7.1-7 +- recognize s390 as SystemZ when configuring build + +* Sat Feb 13 2016 Dave Airlie 3.7.1-6 +- export C++ API for mesa. + +* Sat Feb 13 2016 Dave Airlie 3.7.1-5 +- reintroduce llvm-static, clang needs it currently. + +* Fri Feb 12 2016 Dave Airlie 3.7.1-4 +- jump back to single llvm library, the split libs aren't working very well. + +* Fri Feb 05 2016 Dave Airlie 3.7.1-3 +- add missing obsoletes (#1303497) + +* Thu Feb 04 2016 Fedora Release Engineering - 3.7.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Thu Jan 07 2016 Jan Vcelak 3.7.1-1 +- new upstream release +- enable gold linker + +* Wed Nov 04 2015 Jan Vcelak 3.7.0-100 +- fix Requires for subpackages on the main package + +* Tue Oct 06 2015 Jan Vcelak 3.7.0-100 +- initial version using cmake build system