diff --git a/.gitignore b/.gitignore index b55ec3f..cefb579 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -SOURCES/clang-12.0.1.src.tar.xz -SOURCES/llvm-12.0.1.src.tar.xz +SOURCES/clang-13.0.1.src.tar.xz +SOURCES/llvm-13.0.1.src.tar.xz diff --git a/.llvm-compat.metadata b/.llvm-compat.metadata index 30bcc2b..a8d26b7 100644 --- a/.llvm-compat.metadata +++ b/.llvm-compat.metadata @@ -1,2 +1,2 @@ -e3cdd3fb39c78a5bcb0a1d5706678cf8643a48f6 SOURCES/clang-12.0.1.src.tar.xz -619fe668e0972d11d0fa2db670a57a42d02fb8ca SOURCES/llvm-12.0.1.src.tar.xz +9cdc305550fbd27d52d023e8506c50c41e97b7fa SOURCES/clang-13.0.1.src.tar.xz +8e50e3e47b6a14a0848862c574fb0007db212482 SOURCES/llvm-13.0.1.src.tar.xz diff --git a/SOURCES/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch b/SOURCES/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch deleted file mode 100644 index a3c514a..0000000 --- a/SOURCES/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch +++ /dev/null @@ -1,132 +0,0 @@ -From d8af49687765744efaae7ba0f0c4c0fcd58a0e31 Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Wed, 23 Sep 2020 12:47:30 +0000 -Subject: [PATCH 4/6] [PATCH][clang] Prefer gcc toolchains with libgcc_s.so - when not static linking libgcc - -Fedora ships cross-compilers on all platforms, so a user could end up -with a gcc x86_64 cross-compiler installed on an x86_64 system. clang -maintains a list of supported triples for each target and when all -else is equal will prefer toolchains with triples that appear earlier -in the list. - -The cross-compiler triple on Fedora is x86_64-linux-gnu and this comes -before the Fedora system compiler's triple: x86_64-redhat-linux in -the triples list, so the cross compiler is always preferred. This -is a problem, because the cross compiler is missing libraries, like -libgcc_s.so, that clang expects to be there so linker invocations -will fail. - -This patch fixes this by checking for the existence of libgcc_s.so -when it is required and taking that into account when selecting a -toolchain. ---- - lib/Driver/ToolChains/Gnu.cpp | 16 ++++++++++++++-- - lib/Driver/ToolChains/Gnu.h | 4 +++- - .../usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o | 0 - .../usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o | 0 - .../usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so | 0 - ang/test/Driver/linux-ld.c | 12 ++++++++++++ - 6 files changed, 29 insertions(+), 3 deletions(-) - create mode 100644 test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o - create mode 100644 test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o - create mode 100644 test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so - -diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp -index 5deeb10..5d51517 100644 ---- a/lib/Driver/ToolChains/Gnu.cpp -+++ b/lib/Driver/ToolChains/Gnu.cpp -@@ -2539,6 +2539,8 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( - (TargetArch == llvm::Triple::x86 && - TargetTriple.getOS() != llvm::Triple::Solaris)}}; - -+ bool NeedLibgccShared = !Args.hasArg(options::OPT_static_libgcc) && -+ !Args.hasArg(options::OPT_static); - for (auto &Suffix : Suffixes) { - if (!Suffix.Active) - continue; -@@ -2556,8 +2558,17 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( - continue; // Saw this path before; no need to look at it again. - if (CandidateVersion.isOlderThan(4, 1, 1)) - continue; -- if (CandidateVersion <= Version) -- continue; -+ -+ bool CandidateHasLibGccShared = false; -+ if (CandidateVersion <= Version) { -+ if (NeedLibgccShared && !HasLibGccShared) { -+ CandidateHasLibGccShared = -+ D.getVFS().exists(LI->path() + "/libgcc_s.so"); -+ -+ } -+ if (HasLibGccShared || !CandidateHasLibGccShared) -+ continue; -+ } - - if (!ScanGCCForMultilibs(TargetTriple, Args, LI->path(), - NeedsBiarchSuffix)) -@@ -2571,6 +2582,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( - GCCInstallPath = (LibDir + "/" + LibSuffix + "/" + VersionText).str(); - GCCParentLibPath = (GCCInstallPath + "/../" + Suffix.ReversePath).str(); - IsValid = true; -+ HasLibGccShared = CandidateHasLibGccShared; - } - } - } -diff --git a/lib/Driver/ToolChains/Gnu.h b/lib/Driver/ToolChains/Gnu.h -index 90d3baf..9d0cea2 100644 ---- a/lib/Driver/ToolChains/Gnu.h -+++ b/lib/Driver/ToolChains/Gnu.h -@@ -190,6 +190,7 @@ public: - /// Driver, and has logic for fuzzing that where appropriate. - class GCCInstallationDetector { - bool IsValid; -+ bool HasLibGccShared; - llvm::Triple GCCTriple; - const Driver &D; - -@@ -216,7 +217,8 @@ public: - const std::string GentooConfigDir = "/etc/env.d/gcc"; - - public: -- explicit GCCInstallationDetector(const Driver &D) : IsValid(false), D(D) {} -+ explicit GCCInstallationDetector(const Driver &D) -+ : IsValid(false), HasLibGccShared(false), D(D) {} - void init(const llvm::Triple &TargetTriple, const llvm::opt::ArgList &Args, - ArrayRef ExtraTripleAliases = None); - -diff --git a/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o b/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o -new file mode 100644 -index 0000000..e69de29 -diff --git a/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o b/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o -new file mode 100644 -index 0000000..e69de29 -diff --git a/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so b/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so -new file mode 100644 -index 0000000..e69de29 -diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c -index 24d3c78..071bb9b 100644 ---- a/test/Driver/linux-ld.c -+++ b/test/Driver/linux-ld.c -@@ -784,6 +784,18 @@ - // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtend.o" - // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtn.o" - // -+// Check that clang does not select the cross compiler by default on Fedora 28. -+// -+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -+// RUN: --target=x86_64-unknown-linux-gnu \ -+// RUN: --gcc-toolchain="" \ -+// RUN: --sysroot=%S/Inputs/fedora_28_tree \ -+// RUN: | FileCheck --check-prefix=CHECK-FEDORA-28-X86_64 %s -+// -+// CHECK-FEDORA-28-X86_64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" -+// CHECK-FEDORA-28-X86_64: "[[SYSROOT]]/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o" -+// CHECK-FEDORA-28-X86_64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-redhat-linux/7" -+// - // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ - // RUN: --target=arm-unknown-linux-gnueabi -rtlib=platform \ - // RUN: --gcc-toolchain="" \ --- -1.8.3.1 - diff --git a/SOURCES/0001-clang-Don-t-install-static-libraries.patch b/SOURCES/0001-clang-Don-t-install-static-libraries.patch index da5b4e7..f5059b5 100644 --- a/SOURCES/0001-clang-Don-t-install-static-libraries.patch +++ b/SOURCES/0001-clang-Don-t-install-static-libraries.patch @@ -11,15 +11,15 @@ diff --git clang-a/cmake/modules/AddClang.cmake clang-b/cmake/modules/AddClang.c index 704278a0e93..1737b24a2bc 100644 --- clang-a/cmake/modules/AddClang.cmake +++ clang-b/cmake/modules/AddClang.cmake -@@ -111,7 +111,7 @@ macro(add_clang_library name) +@@ -113,7 +113,7 @@ macro(add_clang_library name) if(TARGET ${lib}) target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS}) - if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN) + if (ARG_SHARED AND (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)) - set(export_to_clangtargets) - if(${lib} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR - "clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR + get_target_export_arg(${name} Clang export_to_clangtargets UMBRELLA clang-libraries) + install(TARGETS ${lib} + COMPONENT ${lib} -- 2.18.1 diff --git a/SOURCES/0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch b/SOURCES/0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch deleted file mode 100644 index 7547279..0000000 --- a/SOURCES/0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 1ef1e91142ac48ecb826f33e1e7072c7402d9fe7 Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Wed, 3 Mar 2021 09:58:31 +0100 -Subject: [PATCH 6/6] [PATCH][clang] Allow __ieee128 as an alias to __float128 - on ppc - -This matches gcc behavior. - -Differential Revision: https://reviews.llvm.org/D97846 - -(cherry picked from commit 4aa510be78a75a4da82657fe433016f00dad0784) ---- - include/Basic/LangOptions.def | 1 + - lib/Basic/IdentifierTable.cpp | 3 +++ - lib/Basic/Targets/PPC.cpp | 1 + - test/Sema/128bitfloat.cpp | 7 +++++++ - 4 files changed, 12 insertions(+) - -diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def -index c01f0cc..3c22393e 100644 ---- a/include/clang/Basic/LangOptions.def -+++ b/include/clang/Basic/LangOptions.def -@@ -107,6 +107,7 @@ LANGOPT(Bool , 1, 0, "bool, true, and false keywords") - LANGOPT(Half , 1, 0, "half keyword") - LANGOPT(WChar , 1, CPlusPlus, "wchar_t keyword") - LANGOPT(Char8 , 1, 0, "char8_t keyword") -+LANGOPT(IEEE128 , 1, 0, "__ieee128 keyword") - LANGOPT(DeclSpecKeyword , 1, 0, "__declspec keyword") - BENIGN_LANGOPT(DollarIdents , 1, 1, "'$' in identifiers") - BENIGN_LANGOPT(AsmPreprocessor, 1, 0, "preprocessor in asm mode") -diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp -index 51c6e02..cedc94a 100644 ---- a/lib/Basic/IdentifierTable.cpp -+++ b/lib/Basic/IdentifierTable.cpp -@@ -227,6 +227,9 @@ void IdentifierTable::AddKeywords(const LangOptions &LangOpts) { - if (LangOpts.DeclSpecKeyword) - AddKeyword("__declspec", tok::kw___declspec, KEYALL, LangOpts, *this); - -+ if (LangOpts.IEEE128) -+ AddKeyword("__ieee128", tok::kw___float128, KEYALL, LangOpts, *this); -+ - // Add the 'import' contextual keyword. - get("import").setModulesImport(true); - } -diff --git a/lib/Basic/Targets/PPC.cpp b/lib/Basic/Targets/PPC.cpp -index ff09c0f..38f286c 100644 ---- a/lib/Basic/Targets/PPC.cpp -+++ b/lib/Basic/Targets/PPC.cpp -@@ -551,6 +551,7 @@ void PPCTargetInfo::adjust(LangOptions &Opts) { - LongDoubleFormat = Opts.PPCIEEELongDouble - ? &llvm::APFloat::IEEEquad() - : &llvm::APFloat::PPCDoubleDouble(); -+ Opts.IEEE128 = 1; - } - - ArrayRef PPCTargetInfo::getTargetBuiltins() const { -diff --git a/test/Sema/128bitfloat.cpp b/test/Sema/128bitfloat.cpp -index 4a826b4..6a9ae74 100644 ---- a/test/Sema/128bitfloat.cpp -+++ b/test/Sema/128bitfloat.cpp -@@ -6,6 +6,13 @@ - // RUN: %clang_cc1 -triple x86_64-windows-msvc -verify -std=c++11 %s - - #if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) -+ -+#if defined(__ppc__) -+template struct __is_float128 { static constexpr bool value = false; }; -+template <> struct __is_float128<__float128> { static constexpr bool value = true; }; -+static_assert(__is_float128<__ieee128>::value, "__ieee128 aliases to __float128"); -+#endif -+ - __float128 f; - template struct __is_floating_point_helper {}; - template<> struct __is_floating_point_helper<__float128> {}; --- -1.8.3.1 - diff --git a/SPECS/llvm-compat.spec b/SPECS/llvm-compat.spec index c44eca6..753344a 100644 --- a/SPECS/llvm-compat.spec +++ b/SPECS/llvm-compat.spec @@ -1,11 +1,14 @@ -%global maj_ver 12 +%global maj_ver 13 %global min_ver 0 %global patch_ver 1 -%global baserelease 4 +%global baserelease 2 # Limit build jobs on ppc64 systems to avoid running out of memory. %global _smp_mflags -j8 +%global install_prefix %{_libdir}/llvm%{maj_ver} +%global pkg_libdir %{install_prefix}/lib/ + Name: llvm-compat Version: %{maj_ver}.%{min_ver}.%{patch_ver} Release: %{baserelease}%{?dist} @@ -21,11 +24,9 @@ Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{versio # Clang Patches: Patch101: 0001-PATCH-clang-Reorganize-gtest-integration.patch Patch102: 0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch -Patch103: 0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch # Not Upstream Patch115: 0001-clang-Don-t-install-static-libraries.patch -Patch117: 0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch BuildRequires: gcc @@ -88,11 +89,6 @@ pushd llvm-build -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ %endif -%if 0%{?__isa_bits} == 64 - -DLLVM_LIBDIR_SUFFIX=64 \ -%else - -DLLVM_LIBDIR_SUFFIX= \ -%endif \ -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;ARM;Mips;BPF;WebAssembly" \ -DLLVM_ENABLE_LIBCXX:BOOL=OFF \ @@ -103,6 +99,7 @@ pushd llvm-build -DLLVM_DYLIB_EXPORT_ALL:BOOL=ON \ -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ -DLLVM_INCLUDE_TESTS=OFF \ + -DCMAKE_INSTALL_PREFIX=%{install_prefix} DESTDIR=%{buildroot} %__ninja %__ninja_common_opts -l 8 LLVM llvm-config @@ -125,12 +122,8 @@ pushd clang-build -DLLVM_ENABLE_RTTI=ON \ -DLLVM_INCLUDE_TESTS=OFF \ -DCMAKE_SKIP_RPATH:BOOL=ON \ -%if 0%{?__isa_bits} == 64 - -DLLVM_LIBDIR_SUFFIX=64 \ -%else - -DLLVM_LIBDIR_SUFFIX= \ -%endif - -DLIB_SUFFIX= + -DLIB_SUFFIX= \ + -DCMAKE_INSTALL_PREFIX=%{install_prefix} export DESTDIR=%{buildroot} %__ninja help | grep 'libclang[a-zA-Z0-9]*.so' | cut -d ':' -f 1 | xargs %__ninja %__ninja_common_opts -l 8 @@ -150,7 +143,14 @@ cd .. DESTDIR=%{buildroot} %__ninja %__ninja_common_opts -l 8 install-LLVM -C llvm-build -install clang-build/%{_lib}/*.so.%{maj_ver} %{buildroot}%{_libdir} +mkdir -p %{buildroot}%{pkg_libdir} +install clang-build/lib/*.so.%{maj_ver} %{buildroot}%{pkg_libdir} + +# Create ld.so.conf.d entry +mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d +cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf << EOF +%{pkg_libdir} +EOF %check @@ -160,13 +160,17 @@ install clang-build/%{_lib}/*.so.%{maj_ver} %{buildroot}%{_libdir} %files %files libs -%{_libdir}/libLLVM-%{maj_ver}.so -%{_libdir}/libclang*.so.%{maj_ver} +%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf +%{pkg_libdir}/libLLVM-%{maj_ver}.so +%{pkg_libdir}/libclang*.so.%{maj_ver} %ifnarch %ix86 -%{_libdir}/libclang-cpp*.so.%{maj_ver} +%{pkg_libdir}/libclang-cpp*.so.%{maj_ver} %endif %changelog +* Thu Apr 07 2022 Timm Bäder - 13.0.1-1 +- Update to 13.0.1 + * Tue Nov 23 2021 Tom Stellard - 12.0.1-4 - Add libclang-cpp.so to package