diff --git a/llvm10.spec b/llvm11.spec index b8d4b6386..83c7f6535 100644 --- a/llvm10.spec +++ b/llvm11.spec @@ -1,7 +1,17 @@ -%global v_major 10.0 -%global llvm_name llvm%v_major -%global clang_name clang%v_major -%global lld_name lld%v_major +%global v_major 11 +%global v_majmin %v_major.0 +%global llvm_name llvm%v_majmin +%global clang_name clang%v_majmin +%global lld_name lld%v_majmin + +%global llvm_prefix %_prefix/lib/llvm-%v_majmin +%global llvm_bindir %llvm_prefix/bin +%global llvm_libdir %llvm_prefix/%_lib +%global llvm_includedir %llvm_prefix/include +%global llvm_libexecdir %llvm_prefix/libexec +%global llvm_datadir %llvm_prefix/share +%global llvm_man1dir %llvm_datadir/man/man1 +%global llvm_docdir %llvm_datadir/doc # Decrease debuginfo verbosity to reduce memory consumption during final library linking %ifarch %ix86 %arm @@ -19,11 +29,12 @@ %endif Name: %llvm_name -Version: 10.0.1 -Release: alt2 +Version: 11.0.0 +Release: alt1 Summary: The Low Level Virtual Machine Group: Development/C +# TODO: Apache-2-with-LLVM-exceptions License: NCSA Url: http://llvm.org Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%version/llvm-%version.src.tar.xz @@ -38,30 +49,32 @@ Patch4: llvm-alt-triple.patch Patch5: compiler-rt-9-alt-i586-arch.patch Patch6: RH-0001-CMake-Split-static-library-exports-into-their-own-ex.patch Patch7: clang-alt-aarch64-dynamic-linker-path.patch -Patch8: 0001-Don-t-set-rpath-when-installing.patch +#Patch8: 0001-Don-t-set-rpath-when-installing.patch # Is this needed? Patch9: lld-9-alt-mipsel-permit-textrels-by-default.patch Patch10: llvm-10-alt-python3.patch -Patch11: CMake-CheckAtomic.cmake-catch-false-positives-in-RIS.patch -Patch12: Support-Check-for-atomics64-when-deciding-if-latomic.patch -Patch13: dsymutil-Explicitly-link-against-libatomic-when-nece.patch -Patch14: llvm-10-alt-riscv64-config-guess.patch -Patch15: llvm-upstream-D85007.patch +#Patch11: CMake-CheckAtomic.cmake-catch-false-positives-in-RIS.patch # included in LLVM 11 +#Patch12: Support-Check-for-atomics64-when-deciding-if-latomic.patch # included in LLVM 11 +#Patch13: dsymutil-Explicitly-link-against-libatomic-when-nece.patch # included in LLVM 11 +#Patch14: llvm-10-alt-riscv64-config-guess.patch # we'll see +#Patch15: llvm-upstream-D85007.patch # included in LLVM 11 -# ThinLTO requires /proc/cpuinfo to exists so the same does llvm +# ThinLTO requires /proc/cpuinfo to exist; so the same does llvm BuildPreReq: /proc BuildRequires(pre): cmake >= 3.4.3 BuildRequires: rpm-build >= 4.0.4-alt112 libncursesw-devel -BuildRequires: chrpath libstdc++-devel libffi-devel perl-Pod-Parser perl-devel +BuildRequires: libstdc++-devel libffi-devel perl-Pod-Parser perl-devel BuildRequires: python3-module-recommonmark zip zlib-devel binutils-devel ninja-build %if_with clang -BuildRequires: %clang_name %llvm_name-devel %lld_name +#BuildRequires: %clang_name %llvm_name-devel %lld_name +# Use LLVM/Clang/LLD 10 to bootstrap LLVM/Clang/LLD 11. +BuildRequires: clang10.0 llvm10.0-devel lld10.0 %else BuildRequires: gcc-c++ %endif -Provides: llvm = %EVR -Obsoletes: llvm < %version +#Provides: llvm = %EVR +#Obsoletes: llvm < %version %description LLVM is a compiler infrastructure designed for compile-time, link-time, @@ -72,8 +85,8 @@ of programming tools as well as libraries with equivalent functionality. %package devel Group: Development/C Summary: Libraries and header files for LLVM -Provides: llvm-devel = %EVR -Obsoletes: llvm-devel < %version +#Provides: llvm-devel = %EVR +#Obsoletes: llvm-devel < %version Requires: %name = %EVR %description devel @@ -83,8 +96,8 @@ native programs that use the LLVM infrastructure. %package devel-static Summary: Static libraries for LLVM Group: Development/C -Provides: llvm-devel-static = %EVR -Obsoletes: llvm-devel-static < %version +#Provides: llvm-devel-static = %EVR +#Obsoletes: llvm-devel-static < %version Requires: %name-devel = %EVR %description devel-static @@ -102,8 +115,8 @@ Shared libraries for the LLVM compiler infrastructure. Summary: Documentation for LLVM Group: Documentation BuildArch: noarch -Provides: llvm-doc = %EVR -Obsoletes: llvm-doc < %version +#Provides: llvm-doc = %EVR +#Obsoletes: llvm-doc < %version %description doc Documentation for the LLVM compiler infrastructure. @@ -112,8 +125,8 @@ Documentation for the LLVM compiler infrastructure. Summary: A C language family frontend for LLVM Group: Development/C Requires: gcc -Provides: clang = %EVR -Obsoletes: clang < %version +#Provides: clang = %EVR +#Obsoletes: clang < %version %description -n %clang_name clang: noun @@ -135,8 +148,8 @@ Shared libraries for the clang compiler. %package -n %clang_name-devel Summary: Header files for clang Group: Development/C -Provides: clang-devel = %EVR -Obsoletes: clang-devel < %version +#Provides: clang-devel = %EVR +#Obsoletes: clang-devel < %version Requires: %clang_name = %EVR %description -n %clang_name-devel @@ -145,8 +158,8 @@ This package contains header files for the Clang compiler. %package -n %clang_name-devel-static Summary: Static libraries for clang Group: Development/C -Provides: clang-devel-static = %EVR -Obsoletes: clang-devel-static < %version +#Provides: clang-devel-static = %EVR +#Obsoletes: clang-devel-static < %version Requires: %clang_name-devel = %EVR %description -n %clang_name-devel-static @@ -156,8 +169,8 @@ This package contains static libraries for the Clang compiler. Summary: A source code analysis framework Group: Development/C BuildArch: noarch -Provides: clang-analyzer = %EVR -Obsoletes: clang-analyzer < %version +#Provides: clang-analyzer = %EVR +#Obsoletes: clang-analyzer < %version Requires: %clang_name = %EVR %description -n %clang_name-analyzer @@ -170,8 +183,8 @@ intended to run in tandem with a build of a project or code base. Summary: Documentation for Clang Group: Documentation BuildArch: noarch -Provides: clang-doc = %EVR -Obsoletes: clang-doc < %version +#Provides: clang-doc = %EVR +#Obsoletes: clang-doc < %version %description -n %clang_name-doc Documentation for the Clang compiler front-end. @@ -179,8 +192,8 @@ Documentation for the Clang compiler front-end. %package -n %lld_name Summary: LLD - The LLVM Linker Group: Development/C -Provides: lld = %EVR -Obsoletes: lld < %version +#Provides: lld = %EVR +#Obsoletes: lld < %version %description -n %lld_name LLD is a linker from the LLVM project. That is a drop-in replacement for system @@ -190,8 +203,8 @@ useful for toolchain developers. %package -n %lld_name-devel Summary: Header files for LLD Group: Development/C -Provides: lld-devel = %EVR -Obsoletes: lld-devel < %version +#Provides: lld-devel = %EVR +#Obsoletes: lld-devel < %version Requires: %lld_name = %EVR %description -n %lld_name-devel @@ -201,8 +214,8 @@ This package contains header files for the LLD linker. Summary: Documentation for LLD Group: Documentation BuildArch: noarch -Provides: lld-doc = %EVR -Obsoletes: lld-doc < %version +#Provides: lld-doc = %EVR +#Obsoletes: lld-doc < %version %description -n %lld_name-doc Documentation for the LLD linker. @@ -221,19 +234,22 @@ mv compiler-rt-%version.src projects/compiler-rt %patch5 -p1 -b .alt-i586-arch %patch6 -p1 %patch7 -p1 -b .alt-aarch64-dynamic-linker -%patch8 -p1 +#patch8 -p1 %patch9 -p1 -b .alt-mipsel-permit-textrels-by-default %patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 -%patch14 -p1 -%patch15 -p2 +#patch11 -p1 +#patch12 -p1 +#patch13 -p1 +#patch14 -p1 +#patch15 -p2 %build +%define _cmake_skip_rpath -DCMAKE_SKIP_RPATH:BOOL=OFF %cmake -G Ninja \ -DLLVM_PARALLEL_LINK_JOBS=1 \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=%llvm_prefix \ + -DCMAKE_SKIP_INSTALL_RPATH:BOOL=OFF \ -DBUILD_SHARED_LIBS:BOOL=OFF \ -DLLVM_TARGETS_TO_BUILD="host;AMDGPU;BPF;NVPTX;" \ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='AVR' \ @@ -299,13 +315,13 @@ ninja -vvv -j %__nprocs -C BUILD %install pushd BUILD -cmake -DCMAKE_INSTALL_PREFIX=%buildroot%prefix ../ +cmake -DCMAKE_INSTALL_PREFIX=%buildroot%llvm_prefix ../ sed -i 's|man\ tools/lld/docs/docs-lld-html|man|' build.ninja sed -i '/^[[:space:]]*include.*tools\/lld\/docs\/cmake_install.cmake.*/d' tools/lld/cmake_install.cmake popd ninja -C BUILD install -# And prepare Clang documentation +# Prepare Clang documentation. rm -rf BUILD/clang-docs mkdir -p BUILD/clang-docs for f in LICENSE.TXT NOTES.txt README.txt; do @@ -313,111 +329,162 @@ for f in LICENSE.TXT NOTES.txt README.txt; do done rm -rf tools/clang/docs/{doxygen*,Makefile*,*.graffle,tools} -install -m 0755 BUILD/%_lib/LLVMHello.so %buildroot%_libdir/ -install -m 0755 BUILD/%_lib/BugpointPasses.so %buildroot%_libdir/ -mkdir -p %buildroot%_docdir/lld - -file %buildroot%_bindir/* | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d -file %buildroot%_libdir/*.so | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d +install -m 0755 BUILD/%_lib/LLVMHello.so %buildroot%llvm_libdir/ +install -m 0755 BUILD/%_lib/BugpointPasses.so %buildroot%llvm_libdir/ +mkdir -p %buildroot%llvm_docdir/lld %ifarch %ix86 -cd %buildroot%_libdir/clang/%version/lib/linux +cd %buildroot%llvm_libdir/clang/%version/lib/linux ls *-i[3-9]86* | while read f; do ln -s $f $(echo $f | sed 's|i[3-9]86|i386|') ; done %endif +# Symlink executables to %_bindir. +mkdir -p %buildroot%_bindir +for b in %buildroot%llvm_bindir/*; do + bb="$(basename "$b")" + echo "$bb" | grep -q -- '-%v_major$' && continue # if already appended + ln -srv "$b" "%buildroot%_bindir/$bb-%v_major" +done +# Symlink man pages to the man dirs. +for mand in %buildroot%llvm_datadir/man/man*; do + mand_index="${mand##*/man}" + for m in "$mand"/*.[1-9]*; do + # Let's force compress the man page, then symlink it. + # /usr/lib/llvm-11.0/share/man/manD/utilX.D.xz -> /usr/share/man/manD/utilX-11.D.xz + # Otherwise, brp-alt(compress) keeps fucking us up. + # It remakes the symlinks first, then compresses their targets, + # severing the symlinks. + /usr/lib/rpm/compress_files "$m" + + mb="$(basename "$m")" # e. g. llvm-ar.1.xz + new_mb="${mb%%.[1-9]*}-%v_major.$mand_index" # e. g. llvm-ar-11.1.xz + + mkdir -p "%buildroot%_mandir/man$mand_index" + ln -srv "$m" "%buildroot%_mandir/man$mand_index/$new_mb" + done +done + %check %if_enabled tests -LD_LIBRARY_PATH=%buildroot%_libdir:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=%buildroot%llvm_libdir:$LD_LIBRARY_PATH export LD_LIBRARY_PATH ninja -C BUILD check-all || : %endif %files %doc CREDITS.TXT LICENSE.TXT README.txt +%llvm_bindir/* %_bindir/* +%llvm_man1dir/* %_man1dir/* +%exclude %llvm_bindir/llvm-config* %exclude %_bindir/llvm-config* +%exclude %llvm_bindir/*clang* %exclude %_bindir/*clang* -%exclude %_bindir/c-index-test +%exclude %llvm_bindir/c-index-test +%exclude %_bindir/c-index-test-%v_major +%exclude %llvm_bindir/scan-* %exclude %_bindir/scan-* -%exclude %_man1dir/llvm-config.1.* -%exclude %_man1dir/clang.1* -%exclude %_man1dir/scan-build.1* +%exclude %llvm_man1dir/llvm-config.1.* +%exclude %_man1dir/llvm-config-%v_major.1.* +%exclude %llvm_man1dir/clang.1* +%exclude %_man1dir/clang-%v_major.1* +%exclude %llvm_man1dir/scan-build.1* +%exclude %_man1dir/scan-build-%v_major.1* +%exclude %llvm_bindir/lld* %exclude %_bindir/lld* -%exclude %_bindir/ld*.lld -%exclude %_bindir/wasm-ld +%exclude %llvm_bindir/ld*.lld +%exclude %_bindir/ld*.lld-%v_major +%exclude %llvm_bindir/wasm-ld +%exclude %_bindir/wasm-ld-%v_major %files libs -%_libdir/libLLVM-*.so -%_libdir/libLTO.so.* -%_libdir/libRemarks.so.* +%llvm_libdir/libLLVM-*.so +%llvm_libdir/libLTO.so.* +%llvm_libdir/libRemarks.so.* %files devel -%_bindir/llvm-config -%_man1dir/llvm-config.1.* -%_includedir/llvm -%_includedir/llvm-c -%_libdir/libLLVM.so -%_libdir/libLTO.so -%_libdir/LLVMgold.so -%_libdir/libRemarks.so -%_libdir/LLVMHello.so -%_libdir/BugpointPasses.so -%_datadir/cmake/Modules/llvm -%_libdir/cmake/llvm/LLVMConfigExtensions.cmake -%exclude %_datadir/cmake/Modules/llvm/LLVMStaticExports.cmake +%llvm_bindir/llvm-config +%_bindir/llvm-config-%v_major +%llvm_man1dir/llvm-config.1.* +%_man1dir/llvm-config-%v_major.1.* +%llvm_includedir/llvm +%llvm_includedir/llvm-c +%llvm_libdir/libLLVM.so +%llvm_libdir/libLTO.so +%llvm_libdir/LLVMgold.so +%llvm_libdir/libRemarks.so +%llvm_libdir/LLVMHello.so +%llvm_libdir/BugpointPasses.so +%llvm_datadir/cmake/Modules/llvm +%llvm_libdir/cmake/llvm/LLVMConfigExtensions.cmake +%exclude %llvm_datadir/cmake/Modules/llvm/LLVMStaticExports.cmake %files devel-static -%_libdir/*.a -%exclude %_libdir/libclang*.a -%_datadir/cmake/Modules/llvm/LLVMStaticExports.cmake +%llvm_libdir/*.a +%exclude %llvm_libdir/libclang*.a +%llvm_datadir/cmake/Modules/llvm/LLVMStaticExports.cmake %files -n %clang_name %doc BUILD/clang-docs/* +%llvm_bindir/*clang* %_bindir/*clang* -%_bindir/c-index-test -%_man1dir/clang.1* +%llvm_bindir/c-index-test +%_bindir/c-index-test-%v_major +%llvm_man1dir/clang.1* +%_man1dir/clang-%v_major.1* %files -n %clang_name-libs -%_libdir/clang -%_libdir/libclang*.so.* +%llvm_libdir/clang +%llvm_libdir/libclang*.so.* %files -n %clang_name-devel -%_includedir/clang -%_includedir/clang-c -%_libdir/libclang*.so -%_datadir/cmake/Modules/clang +%llvm_includedir/clang +%llvm_includedir/clang-c +%llvm_libdir/libclang*.so +%llvm_datadir/cmake/Modules/clang %files -n %clang_name-devel-static -%_libdir/libclang*.a +%llvm_libdir/libclang*.a %files -n %clang_name-analyzer -%_prefix/libexec/*-analyzer -%_bindir/scan-build -%_bindir/scan-view -%_datadir/scan-build -%_datadir/scan-view -%_man1dir/scan-build.1* +%llvm_prefix/libexec/*-analyzer +%llvm_bindir/scan-build +%_bindir/scan-build-%v_major +%llvm_bindir/scan-view +%_bindir/scan-view-%v_major +%llvm_datadir/scan-build +%llvm_datadir/scan-view +%llvm_man1dir/scan-build.1* +%_man1dir/scan-build-%v_major.1* %files -n %lld_name +%llvm_bindir/lld* %_bindir/lld* -%_bindir/ld*.lld -%_bindir/wasm-ld +%llvm_bindir/ld*.lld +%_bindir/ld*.lld-%v_major +%llvm_bindir/wasm-ld +%_bindir/wasm-ld-%v_major %files -n %lld_name-devel -%dir %_includedir/lld -%_includedir/lld/* +%dir %llvm_includedir/lld +%llvm_includedir/lld/* %files doc -%doc %_docdir/llvm +%doc %llvm_docdir/llvm %files -n %clang_name-doc -%doc %_docdir/clang +%doc %llvm_docdir/clang %files -n %lld_name-doc -%doc %_docdir/lld +%doc %llvm_docdir/lld %changelog +* Tue Oct 13 2020 Arseny Maslennikov 11.0.0-alt1 +- 11.0.0 +- Installed to /usr/lib/llvm-11.0 to ensure peaceful co-existence with other + LLVM versions. + * Wed Aug 12 2020 Aleksei Nikiforov 10.0.1-alt2 - Applied upstream patch which should fix ppc64le-specific issue. diff --git a/clang-9-alt-triple.patch b/clang-9-alt-triple.patch index c19f8fa57..5ff28808d 100644 --- a/clang-9-alt-triple.patch +++ b/clang-9-alt-triple.patch @@ -87,11 +87,10 @@ static const char *const RISCV32LibDirs[] = {"/lib32", "/lib"}; static const char *const RISCV32Triples[] = {"riscv32-unknown-linux-gnu", -@@ -2090,6 +2092,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( +@@ -2144,6 +2144,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu", "riscv64-linux-gnu", "riscv64-unknown-elf", + "riscv64-alt-linux", + "riscv64-redhat-linux", "riscv64-suse-linux"}; - - static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"}; diff --git a/lld-9-alt-mipsel-permit-textrels-by-default.patch b/lld-9-alt-mipsel-permit-textrels-by-default.patch index 6c2e706ba..c94124f32 100644 --- a/lld-9-alt-mipsel-permit-textrels-by-default.patch +++ b/lld-9-alt-mipsel-permit-textrels-by-default.patch @@ -1,9 +1,9 @@ --- llvm-9.0.1.src/tools/lld/ELF/Driver.cpp.alt-mipsel-permit-textrels-by-default 2020-02-10 12:20:18.165558849 +0000 +++ llvm-9.0.1.src/tools/lld/ELF/Driver.cpp 2020-02-10 12:23:22.174099557 +0000 -@@ -936,7 +936,11 @@ static void readConfigs(opt::InputArgLis - config->zRetpolineplt = hasZOption(args, "retpolineplt"); - config->zRodynamic = hasZOption(args, "rodynamic"); +@@ -1067,7 +1067,11 @@ static void readConfigs(opt::InputArgLis + config->zShstk = hasZOption(args, "shstk"); config->zStackSize = args::getZOptionValue(args, OPT_z, "stack-size", 0); + config->zStartStopVisibility = getZStartStopVisibility(args); +#if defined __MIPSEL__ && !defined __mips64 + Config->ZText = getZFlag(Args, "text", "notext", false); +#else @@ -11,4 +11,4 @@ +#endif config->zWxneeded = hasZOption(args, "wxneeded"); - // Parse LTO options. + for (opt::Arg *arg : args.filtered(OPT_z)) {