diff --git a/.clang.metadata b/.clang.metadata index a41b878..745aeb0 100644 --- a/.clang.metadata +++ b/.clang.metadata @@ -1,3 +1,3 @@ -02c87f5e07f2a1c1e2dbb8ce8328f0106d70b10d SOURCES/clang-11.0.0.src.tar.xz -b77dc0494894b997c8f4012debbf0bf469462386 SOURCES/clang-tools-extra-11.0.0.src.tar.xz -32fa4b0193960f05064f2ab31b5a89c7cf48a0b9 SOURCES/hans-gpg-key.asc +e3cdd3fb39c78a5bcb0a1d5706678cf8643a48f6 SOURCES/clang-12.0.1.src.tar.xz +42f179bb59432c4d2785239952853ad6308d0863 SOURCES/clang-tools-extra-12.0.1.src.tar.xz +b8d2648a01d36ed0186fd2c5af325fd28797f9a0 SOURCES/tstellar-gpg-key.asc diff --git a/.gitignore b/.gitignore index 5665b65..7735e94 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -SOURCES/clang-11.0.0.src.tar.xz -SOURCES/clang-tools-extra-11.0.0.src.tar.xz -SOURCES/hans-gpg-key.asc +SOURCES/clang-12.0.1.src.tar.xz +SOURCES/clang-tools-extra-12.0.1.src.tar.xz +SOURCES/tstellar-gpg-key.asc 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 0050b40..0000000 --- a/SOURCES/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 67013ee5feecca0c1e1dd8a149b20779a9b6c12a Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Wed, 23 Sep 2020 12:47:30 +0000 -Subject: [PATCH] Driver: 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 - .../lib/gcc/x86_64-redhat-linux/7/libgcc_s.so | 0 - 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 c8a7fce0..f28792b7 100644 ---- a/lib/Driver/ToolChains/Gnu.cpp -+++ b/lib/Driver/ToolChains/Gnu.cpp -@@ -2500,6 +2500,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; -@@ -2517,8 +2519,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)) -@@ -2532,6 +2543,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 52690ab4..2a4452d9 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; - -@@ -213,7 +214,8 @@ public: - MultilibSet Multilibs; - - 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 00000000..e69de29b -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 00000000..e69de29b -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 00000000..e69de29b -diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c -index ec539522..95725d5c 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="" \ --- -2.25.2 - diff --git a/SOURCES/0001-Make-funwind-tables-the-default-for-all-archs.patch b/SOURCES/0001-Make-funwind-tables-the-default-for-all-archs.patch deleted file mode 100644 index d9e9125..0000000 --- a/SOURCES/0001-Make-funwind-tables-the-default-for-all-archs.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 690373af5a5d50cf115ed6e4d2849bb786f9dc8e Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Tue, 10 Dec 2019 09:18:03 +0000 -Subject: [PATCH] Make -funwind-tables the default for all archs - ---- - clang/lib/Driver/ToolChain.cpp | 2 +- - clang/lib/Driver/ToolChains/Gnu.cpp | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp -index b1fddb0af55..43af40ed0e8 100644 ---- a/clang/lib/Driver/ToolChain.cpp -+++ b/clang/lib/Driver/ToolChain.cpp -@@ -244,7 +244,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const { - } - - bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const { -- return false; -+ return true; - } - - Tool *ToolChain::getClang() const { -diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp -index 33cdd3585c2..15e82be8f3a 100644 ---- a/clang/lib/Driver/ToolChains/Gnu.cpp -+++ b/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -2535,7 +2535,7 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const { - } - - bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const { -- return getArch() == llvm::Triple::x86_64; -+ return true; - } - - bool Generic_GCC::isPICDefault() const { --- -2.20.1 - diff --git a/SOURCES/0001-PATCH-clang-Reorganize-gtest-integration.patch b/SOURCES/0001-PATCH-clang-Reorganize-gtest-integration.patch new file mode 100644 index 0000000..e854f01 --- /dev/null +++ b/SOURCES/0001-PATCH-clang-Reorganize-gtest-integration.patch @@ -0,0 +1,42 @@ +From c6b921c8d833546946b70a8c2640032fd7c62461 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Thu, 25 Feb 2021 14:04:52 +0100 +Subject: [PATCH 1/6] [PATCH][clang] Reorganize gtest integration + +--- + clang/CMakeLists.txt | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt +index 9e74014..0185276 100644 +--- a/clang/CMakeLists.txt ++++ b/clang/CMakeLists.txt +@@ -153,12 +153,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) + set(LLVM_UTILS_PROVIDED ON) + set(CLANG_TEST_DEPS FileCheck count not) + endif() +- set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest) +- if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h +- AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} +- AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt) +- add_subdirectory(${UNITTEST_DIR} utils/unittest) +- endif() + else() + # Seek installed Lit. + find_program(LLVM_LIT +@@ -537,7 +531,11 @@ endif() + + + if( CLANG_INCLUDE_TESTS ) +- if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h) ++ set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest) ++ if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h ++ AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} ++ AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt) ++ add_subdirectory(${UNITTEST_DIR} utils/unittest) + add_subdirectory(unittests) + list(APPEND CLANG_TEST_DEPS ClangUnitTests) + list(APPEND CLANG_TEST_PARAMS +-- +1.8.3.1 + diff --git a/SOURCES/0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch b/SOURCES/0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch deleted file mode 100644 index f4f0fa3..0000000 --- a/SOURCES/0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 09ae3ef5710a89505318ec721c65b6c838147276 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Thu, 7 Feb 2019 21:05:37 -0800 -Subject: [PATCH] ToolChain: Add -lgcc_s to the linker flags when using libc++ - -The libc++ build for Fedora does not include an implementation of -libunwind, so we need to explicitly link against something that -provides this implementation. ---- - clang/lib/Driver/ToolChain.cpp | 1 + - clang/test/Driver/netbsd.cpp | 4 ++-- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp -index 88a627e..cb99844 100644 ---- a/lib/Driver/ToolChain.cpp -+++ b/lib/Driver/ToolChain.cpp -@@ -767,6 +767,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args, - switch (Type) { - case ToolChain::CST_Libcxx: - CmdArgs.push_back("-lc++"); -+ CmdArgs.push_back("-lgcc_s"); - break; - - case ToolChain::CST_Libstdcxx: -diff --git a/test/Driver/netbsd.cpp b/test/Driver/netbsd.cpp -index 4af7d83..ff18c62 100644 ---- a/test/Driver/netbsd.cpp -+++ b/test/Driver/netbsd.cpp -@@ -131,7 +131,7 @@ - // ARM-7: clang{{.*}}" "-cc1" "-triple" "armv5e-unknown-netbsd7.0.0-eabi" - // ARM-7: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so" - // ARM-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}eabi{{/|\\\\}}crti.o" --// ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lm" "-lc" -+// ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lgcc_s" "-lm" "-lc" - // ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o" - - // AARCH64: clang{{.*}}" "-cc1" "-triple" "aarch64-unknown-netbsd" -@@ -250,7 +250,7 @@ - // S-ARM-7: clang{{.*}}" "-cc1" "-triple" "armv5e-unknown-netbsd7.0.0-eabi" - // S-ARM-7: ld{{.*}}" "--eh-frame-hdr" "-Bstatic" - // S-ARM-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}eabi{{/|\\\\}}crti.o" --// S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lm" "-lc" -+// S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lgcc_s" "-lm" "-lc" - // S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o" - - // S-AARCH64: clang{{.*}}" "-cc1" "-triple" "aarch64-unknown-netbsd" --- -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 deleted file mode 100644 index 8c80dd3..0000000 --- a/SOURCES/0001-clang-Don-t-install-static-libraries.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 8097a9d4295dbc39cbd541ccace7bc5884852366 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Fri, 31 Jan 2020 11:04:57 -0800 -Subject: [PATCH] clang: Don't install static libraries - ---- - clang/cmake/modules/AddClang.cmake | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake -index 704278a0e93..1737b24a2bc 100644 ---- a/clang/cmake/modules/AddClang.cmake -+++ b/clang/cmake/modules/AddClang.cmake -@@ -111,7 +111,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 --- -2.18.1 - diff --git a/SOURCES/0001-clang-Fix-spurious-test-failure.patch b/SOURCES/0001-clang-Fix-spurious-test-failure.patch deleted file mode 100644 index 07c45b6..0000000 --- a/SOURCES/0001-clang-Fix-spurious-test-failure.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 5bfce60443b1c3f4066f506e47cbdc7c4263bb10 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Tue, 11 Aug 2020 18:32:08 -0700 -Subject: [PATCH] clang: Fix spurious test failure - ---- - clang/test/Driver/crash-report-modules.m | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/clang/test/Driver/crash-report-modules.m b/clang/test/Driver/crash-report-modules.m -index e6d03353379..9519adf6f4b 100644 ---- a/clang/test/Driver/crash-report-modules.m -+++ b/clang/test/Driver/crash-report-modules.m -@@ -19,7 +19,7 @@ - @import simple; - const int x = MODULE_MACRO; - --// CHECK: PLEASE submit a bug report to {{.*}} and include the crash backtrace, preprocessed source, and associated run script. -+// CHECK: PLEASE submit a bug report to {{.*}}and include the crash backtrace, preprocessed source, and associated run script. - // CHECK: Preprocessed source(s) and associated run script(s) are located at: - // CHECK-NEXT: note: diagnostic msg: {{.*}}.m - // CHECK-NEXT: note: diagnostic msg: {{.*}}.cache --- -2.18.1 - diff --git a/SOURCES/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch b/SOURCES/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch new file mode 100644 index 0000000..0a29dd4 --- /dev/null +++ b/SOURCES/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch @@ -0,0 +1,40 @@ +From 07b062e1f7c3359550aa8c0a7b86f6054971439d Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Thu, 25 Feb 2021 14:09:29 +0100 +Subject: [PATCH 2/6] [PATCH][clang] Make -funwind-tables the default on all + archs + +--- + clang/lib/Driver/ToolChain.cpp | 2 +- + clang/lib/Driver/ToolChains/Gnu.cpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp +index b2ddef1..715b323 100644 +--- a/clang/lib/Driver/ToolChain.cpp ++++ b/clang/lib/Driver/ToolChain.cpp +@@ -257,7 +257,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const { + } + + bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const { +- return false; ++ return true; + } + + Tool *ToolChain::getClang() const { +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index 1d8a3cd..5deeb10 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2713,7 +2713,7 @@ bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const { + case llvm::Triple::x86_64: + return true; + default: +- return false; ++ return true; + } + } + +-- +1.8.3.1 + diff --git a/SOURCES/0002-gtest-reorg.patch b/SOURCES/0002-gtest-reorg.patch deleted file mode 100644 index 121ac46..0000000 --- a/SOURCES/0002-gtest-reorg.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 1f26a0284925859b72ee520ce74452d77d822409 Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Mon, 28 Jan 2019 19:12:27 +0000 -Subject: [PATCH 2/2] [PATCH] gtest reorg - ---- - CMakeLists.txt | 12 +++++------- - 1 file changed, 5 insertions(+), 7 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c2016a45ca..48ea3c3bb9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -157,12 +157,6 @@ Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") - set(LLVM_UTILS_PROVIDED ON) - set(CLANG_TEST_DEPS FileCheck count not) - endif() -- set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest) -- if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h -- AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} -- AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt) -- add_subdirectory(${UNITTEST_DIR} utils/unittest) -- endif() - else() - # Seek installed Lit. - find_program(LLVM_LIT -@@ -507,7 +501,11 @@ endif() - - - if( CLANG_INCLUDE_TESTS ) -- if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h) -+ set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest) -+ if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h -+ AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} -+ AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt) -+ add_subdirectory(${UNITTEST_DIR} utils/unittest) - add_subdirectory(unittests) - list(APPEND CLANG_TEST_DEPS ClangUnitTests) - list(APPEND CLANG_TEST_PARAMS --- -2.19.2 - diff --git a/SOURCES/0003-PATCH-clang-Don-t-install-static-libraries.patch b/SOURCES/0003-PATCH-clang-Don-t-install-static-libraries.patch new file mode 100644 index 0000000..82f99a7 --- /dev/null +++ b/SOURCES/0003-PATCH-clang-Don-t-install-static-libraries.patch @@ -0,0 +1,25 @@ +From 2c6cd40d016f492d53e16f1c7424a0d9878ae7ec Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Fri, 31 Jan 2020 11:04:57 -0800 +Subject: [PATCH 3/6] [PATCH][clang] Don't install static libraries + +--- + clang/cmake/modules/AddClang.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake +index 704278a..1737b24 100644 +--- a/clang/cmake/modules/AddClang.cmake ++++ b/clang/cmake/modules/AddClang.cmake +@@ -111,7 +111,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 +-- +1.8.3.1 + diff --git a/SOURCES/0004-PATCH-clang-Prefer-gcc-toolchains-with-libgcc_s.so-w.patch b/SOURCES/0004-PATCH-clang-Prefer-gcc-toolchains-with-libgcc_s.so-w.patch new file mode 100644 index 0000000..4f2cf39 --- /dev/null +++ b/SOURCES/0004-PATCH-clang-Prefer-gcc-toolchains-with-libgcc_s.so-w.patch @@ -0,0 +1,132 @@ +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. +--- + clang/lib/Driver/ToolChains/Gnu.cpp | 16 ++++++++++++++-- + clang/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 + clang/test/Driver/linux-ld.c | 12 ++++++++++++ + 6 files changed, 29 insertions(+), 3 deletions(-) + create mode 100644 clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o + create mode 100644 clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o + create mode 100644 clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so + +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index 5deeb10..5d51517 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/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/clang/lib/Driver/ToolChains/Gnu.h b/clang/lib/Driver/ToolChains/Gnu.h +index 90d3baf..9d0cea2 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.h ++++ b/clang/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/clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o b/clang/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/clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o b/clang/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/clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so b/clang/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/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c +index 24d3c78..071bb9b 100644 +--- a/clang/test/Driver/linux-ld.c ++++ b/clang/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/0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch b/SOURCES/0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch new file mode 100644 index 0000000..91e82b5 --- /dev/null +++ b/SOURCES/0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch @@ -0,0 +1,77 @@ +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) +--- + clang/include/clang/Basic/LangOptions.def | 1 + + clang/lib/Basic/IdentifierTable.cpp | 3 +++ + clang/lib/Basic/Targets/PPC.cpp | 1 + + clang/test/Sema/128bitfloat.cpp | 7 +++++++ + 4 files changed, 12 insertions(+) + +diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def +index c01f0cc..3c22393e 100644 +--- a/clang/include/clang/Basic/LangOptions.def ++++ b/clang/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/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp +index 51c6e02..cedc94a 100644 +--- a/clang/lib/Basic/IdentifierTable.cpp ++++ b/clang/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/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp +index ff09c0f..38f286c 100644 +--- a/clang/lib/Basic/Targets/PPC.cpp ++++ b/clang/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/clang/test/Sema/128bitfloat.cpp b/clang/test/Sema/128bitfloat.cpp +index 4a826b4..6a9ae74 100644 +--- a/clang/test/Sema/128bitfloat.cpp ++++ b/clang/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/SOURCES/clang-11.0.0.src.tar.xz.sig b/SOURCES/clang-11.0.0.src.tar.xz.sig deleted file mode 100644 index b5378e0..0000000 Binary files a/SOURCES/clang-11.0.0.src.tar.xz.sig and /dev/null differ diff --git a/SOURCES/clang-12.0.1.src.tar.xz.sig b/SOURCES/clang-12.0.1.src.tar.xz.sig new file mode 100644 index 0000000..0d806a5 Binary files /dev/null and b/SOURCES/clang-12.0.1.src.tar.xz.sig differ diff --git a/SOURCES/clang-tools-extra-11.0.0.src.tar.xz.sig b/SOURCES/clang-tools-extra-11.0.0.src.tar.xz.sig deleted file mode 100644 index 5ff2b0a..0000000 Binary files a/SOURCES/clang-tools-extra-11.0.0.src.tar.xz.sig and /dev/null differ diff --git a/SOURCES/clang-tools-extra-12.0.1.src.tar.xz.sig b/SOURCES/clang-tools-extra-12.0.1.src.tar.xz.sig new file mode 100644 index 0000000..8bceb38 Binary files /dev/null and b/SOURCES/clang-tools-extra-12.0.1.src.tar.xz.sig differ diff --git a/SPECS/clang.spec b/SPECS/clang.spec index fa6c2e3..9389c18 100644 --- a/SPECS/clang.spec +++ b/SPECS/clang.spec @@ -1,10 +1,9 @@ %global compat_build 0 -%global maj_ver 11 +%global maj_ver 12 %global min_ver 0 -%global patch_ver 0 -#%%global rc_ver 6 -%global baserelease 1 +%global patch_ver 1 +#%%global rc_ver 5 %global clang_tools_binaries \ %{_bindir}/clang-apply-replacements \ @@ -37,20 +36,21 @@ %{_bindir}/clang-cpp \ %if 0%{?compat_build} -%global pkg_name clang%{maj_ver}.%{min_ver} +%global pkg_name clang%{maj_ver} # Install clang to same prefix as llvm, so that apps that use llvm-config # will also be able to find clang libs. -%global install_prefix %{_libdir}/llvm%{maj_ver}.%{min_ver} +%global install_prefix %{_libdir}/llvm%{maj_ver} %global install_bindir %{install_prefix}/bin %global install_includedir %{install_prefix}/include %global install_libdir %{install_prefix}/lib %global pkg_bindir %{install_bindir} -%global pkg_includedir %{_includedir}/llvm%{maj_ver}.%{min_ver} +%global pkg_includedir %{install_includedir} %global pkg_libdir %{install_libdir} %else %global pkg_name clang %global install_prefix /usr +%global pkg_libdir %{_libdir} %endif %if 0%{?fedora} || 0%{?rhel} > 7 @@ -61,15 +61,14 @@ %global build_install_prefix %{buildroot}%{install_prefix} -# Too many threads causes OOM errors. -%global _smp_mflags -j8 +%global _smp_mflags -j2 %global clang_srcdir clang-%{version}%{?rc_ver:rc%{rc_ver}}.src %global clang_tools_srcdir clang-tools-extra-%{version}%{?rc_ver:rc%{rc_ver}}.src Name: %pkg_name -Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: %{baserelease}%{?rc_ver:.rc%{rc_ver}}%{?dist} +Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}} +Release: 1%{?dist} Summary: A C language family front-end for LLVM License: NCSA @@ -80,33 +79,36 @@ Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{versio Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz.sig %endif -Source4: https://prereleases.llvm.org/%{version}/hans-gpg-key.asc +Source4: tstellar-gpg-key.asc -Patch4: 0002-gtest-reorg.patch -Patch11: 0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch -Patch13: 0001-Make-funwind-tables-the-default-for-all-archs.patch +# Patches for clang +Patch0: 0001-PATCH-clang-Reorganize-gtest-integration.patch +Patch1: 0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch +Patch2: 0003-PATCH-clang-Don-t-install-static-libraries.patch +Patch3: 0004-PATCH-clang-Prefer-gcc-toolchains-with-libgcc_s.so-w.patch +Patch5: 0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch -# Not Upstream -Patch15: 0001-clang-Don-t-install-static-libraries.patch -Patch16: 0001-clang-Fix-spurious-test-failure.patch -Patch17: 0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch +# Patches for clang-tools-extra +%if !0%{?compat_build} +%ifarch ix86 +Patch201 clangd-tests.patch +%endif +%endif BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: ninja-build %if 0%{?compat_build} -BuildRequires: llvm%{maj_ver}.%{min_ver}-devel = %{version} -BuildRequires: llvm%{maj_ver}.%{min_ver}-static = %{version} +BuildRequires: llvm%{maj_ver}-devel = %{version} +BuildRequires: llvm%{maj_ver}-static = %{version} %else BuildRequires: llvm-devel = %{version} -%if 0%{?enable_test_pkg} BuildRequires: llvm-test = %{version} -BuildRequires: llvm-googletest = %{version} -%endif # llvm-static is required, because clang-tablegen needs libLLVMTableGen, which # is not included in libLLVM.so. BuildRequires: llvm-static = %{version} +BuildRequires: llvm-googletest = %{version} %endif BuildRequires: libxml2-devel @@ -128,6 +130,13 @@ BuildRequires: libatomic # We need python3-devel for pathfix.py. BuildRequires: python3-devel +%if ! 0%{?rhel} +# For reproducible pyc file generation +# See https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_Appendix/#_byte_compilation_reproducibility +BuildRequires: /usr/bin/marshalparser +%global py_reproducible_pyc_path %{buildroot}%{python3_sitelib} +%endif + # Needed for %%multilib_fix_c_header BuildRequires: multilib-rpm-config @@ -168,8 +177,13 @@ The goal of the Clang project is to create a new C, C++, Objective C and Objective C++ front-end for the LLVM compiler. Its tools are built as libraries and designed to be loosely-coupled and extensible. +Install compiler-rt if you want the Blocks C language extension or to +enable sanitization and profiling options when building, and +libomp-devel to enable -fopenmp. + %package libs Summary: Runtime library for clang +Requires: %{name}-resource-filesystem%{?_isa} = %{version} Recommends: compiler-rt%{?_isa} = %{version} # libomp-devel is required, so clang can find the omp.h header when compiling # with -fopenmp. @@ -191,6 +205,13 @@ Requires: %{name}-libs = %{version}-%{release} %description devel Development header files for clang. +%package resource-filesystem +Summary: Filesystem package that owns the clang resource directory +Provides: %{name}-resource-filesystem(major) = %{maj_ver} + +%description resource-filesystem +This package owns the clang resouce directory: $libdir/clang/$version/ + %if !0%{?compat_build} %package analyzer Summary: A source code analysis framework @@ -238,25 +259,23 @@ Requires: python3 %prep %if 0%{?compat_build} -%autosetup -n %{clang_srcdir} -p1 +%autosetup -n %{clang_srcdir} -p2 %else %setup -T -q -b 1 -n %{clang_tools_srcdir} +%autopatch -m200 -p2 +# failing test case +rm test/clang-tidy/checkers/altera-struct-pack-align.cpp pathfix.py -i %{__python3} -pn \ clang-tidy/tool/*.py \ clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py %setup -q -n %{clang_srcdir} +%autopatch -M200 -p2 -%patch4 -p1 -b .gtest -%patch11 -p1 -b .libcxx-fix -%patch13 -p2 -b .unwind-all -%patch15 -p2 -b .no-install-static -%patch16 -p2 -b .test-fix2 -%patch17 -p1 -b .check-gcc_s - -mv ../%{clang_tools_srcdir} tools/extra +# failing test case +rm test/CodeGen/profile-filter.c pathfix.py -i %{__python3} -pn \ tools/clang-format/*.py \ @@ -267,14 +286,26 @@ pathfix.py -i %{__python3} -pn \ %build +# We run the builders out of memory on armv7 and i686 when LTO is enabled +%ifarch %{arm} i686 +%define _lto_cflags %{nil} +%else +# This package does not ship any object files or static libraries, so we +# don't need -ffat-lto-objects. +%global _lto_cflags %(echo %{_lto_cflags} | sed 's/-ffat-lto-objects//') +%endif + +# lto builds with gcc 11 fail while running the lit tests. +%define _lto_cflags %{nil} + %if 0%{?__isa_bits} == 64 sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@/64/g' test/lit.cfg.py %else sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py %endif -mkdir -p _build -cd _build +mkdir -p %{_vpath_builddir} +cd %{_vpath_builddir} %ifarch s390 s390x %{arm} %ix86 ppc64le # Decrease debuginfo verbosity to reduce memory consumption during final library linking @@ -296,11 +327,13 @@ cd _build -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ %endif %if 0%{?compat_build} - -DLLVM_CONFIG:FILEPATH=%{_bindir}/llvm-config-%{maj_ver}.%{min_ver}-%{__isa_bits} \ + -DCLANG_BUILD_TOOLS:BOOL=OFF \ + -DLLVM_CONFIG:FILEPATH=%{_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} \ -DCMAKE_INSTALL_PREFIX=%{install_prefix} \ -DCLANG_INCLUDE_TESTS:BOOL=OFF \ %else -DCLANG_INCLUDE_TESTS:BOOL=ON \ + -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=../../%{clang_tools_srcdir} \ -DLLVM_EXTERNAL_LIT=%{_bindir}/lit \ -DLLVM_MAIN_SRC_DIR=%{_datadir}/llvm/src \ %if 0%{?__isa_bits} == 64 @@ -310,10 +343,10 @@ cd _build %endif %endif \ -%if !0%{compat_build} - -DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen \ +%if 0%{compat_build} + -DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen-%{maj_ver} \ %else - -DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen-%{maj_ver}.%{min_ver} \ + -DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen \ %endif -DCLANG_ENABLE_ARCMT:BOOL=ON \ -DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON \ @@ -329,12 +362,16 @@ cd _build \ -DCLANG_BUILD_EXAMPLES:BOOL=OFF \ -DBUILD_SHARED_LIBS=OFF \ - -DCLANG_REPOSITORY_STRING="%{?fedora:Fedora}%{?rhel:Red Hat} %{version}-%{release}" + -DCLANG_REPOSITORY_STRING="%{?fedora:Fedora}%{?rhel:Red Hat} %{version}-%{release}" \ + -DCLANG_DEFAULT_UNWINDLIB=libgcc -%ninja_build -l 8 +%cmake_build %install -%ninja_install -C _build + +pushd %{_vpath_builddir} +%cmake_install +popd %if 0%{?compat_build} @@ -369,9 +406,9 @@ rm -vf %{buildroot}%{_datadir}/clang/clang-format-bbedit.applescript rm -vf %{buildroot}%{_datadir}/clang/clang-format-sublime.py* # TODO: Package html docs -rm -Rvf %{buildroot}%{_pkgdocdir} -rm -Rvf %{buildroot}%{install_prefix}/share/clang/clang-doc-default-stylesheet.css -rm -Rvf %{buildroot}%{install_prefix}/share/clang/index.js +rm -Rvf %{buildroot}%{_docdir}/clang/html +rm -Rvf %{buildroot}%{_datadir}/clang/clang-doc-default-stylesheet.css +rm -Rvf %{buildroot}%{_datadir}/clang/index.js # TODO: What are the Fedora guidelines for packaging bash autocomplete files? rm -vf %{buildroot}%{_datadir}/clang/bash-autocomplete.sh @@ -397,23 +434,29 @@ pushd %{buildroot}%{_libdir}/clang/ ln -s %{version} %{maj_ver} popd +# Create sub-directories in the clang resource directory that will be +# populated by other packages +mkdir -p %{buildroot}%{_libdir}/clang/%{version}/{include,lib,share}/ + %endif # Remove clang-tidy headers. We don't ship the libraries for these. rm -Rvf %{buildroot}%{_includedir}/clang-tidy/ +# Add a symlink in /usr/bin to clang-format-diff +ln -s %{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format-diff + %check +cd %{_vpath_builddir} + %if !0%{?compat_build} # requires lit.py from LLVM utilities -# FIXME: Fix failing ARM tests, s390x i686 and ppc64le tests -# FIXME: Ignore test failures until rhbz#1715016 is fixed. -%if 0%{?enable_test_pkg} -LD_LIBRARY_PATH=%{buildroot}%{_libdir} ninja check-all -C _build || \ -%endif -%ifarch s390x i686 ppc64le %{arm} +# FIXME: Fix failing ARM tests +LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %cmake_build --target check-all || \ +%ifarch %{arm} : %else -: +false %endif %endif @@ -452,6 +495,15 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ninja check-all -C _build || \ %{pkg_libdir}/cmake/ %endif +%files resource-filesystem +%dir %{pkg_libdir}/clang/%{version}/ +%dir %{pkg_libdir}/clang/%{version}/include/ +%dir %{pkg_libdir}/clang/%{version}/lib/ +%dir %{pkg_libdir}/clang/%{version}/share/ +%if !0%{?compat_build} +%{pkg_libdir}/clang/%{maj_ver} +%endif + %if !0%{?compat_build} %files analyzer %{_bindir}/scan-view @@ -467,6 +519,7 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ninja check-all -C _build || \ %{_bindir}/c-index-test %{_bindir}/find-all-symbols %{_bindir}/modularize +%{_bindir}/clang-format-diff %{_mandir}/man1/diagtool.1.gz %{_emacs_sitestartdir}/clang-format.el %{_emacs_sitestartdir}/clang-rename.el @@ -488,6 +541,12 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ninja check-all -C _build || \ %endif %changelog +* Fri Jul 16 2021 sguelton@redhat.com - 12.0.1-1 +- 12.0.1 release + +* Thu May 6 2021 sguelton@redhat.com - 12.0.0-1 +- 12.0.0 release + * Thu Oct 29 2020 sguelton@redhat.com - 11.0.0-1 - 11.0.0 final release