From fcfd63adc97a6db9b264e590ff24559632365e28 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Jan 12 2022 12:50:38 +0000 Subject: Prepare for snapshot build Generate new patches: cd ~/llvm-project git checkout streamline git fetch upstream # This is the upstream llvm-project git fetch pagure # This is the Fedora fork of the llvm-project in which all patches are maintained git reset --hard pagure/streamline git rebase upstream/main # Fix any issues during this phase git format-patch upstream/main..pagure/streamline --no-numbered --keep-subject -o ~/dev/rpms/clang -- clang mv *.patch > ~/dev/rpms/clang cd ~/dev/rpms/clang git add *.patch git commit -m "Rebased patches on top of upstream/main" --- diff --git a/0001-Driver-Add-a-gcc-equivalent-triple-to-the-list-of-tr.patch b/0001-Driver-Add-a-gcc-equivalent-triple-to-the-list-of-tr.patch deleted file mode 100644 index 6c94b4d..0000000 --- a/0001-Driver-Add-a-gcc-equivalent-triple-to-the-list-of-tr.patch +++ /dev/null @@ -1,59 +0,0 @@ -From d68a5a7817dc0d43853d8b84c9185dc24338664f Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Wed, 6 Oct 2021 05:32:44 +0000 -Subject: [PATCH] Driver: Add a gcc equivalent triple to the list of triples to - search - -There are some gcc triples, like x86_64-redhat-linux, that provide the -same behavior as a clang triple with a similar name (e.g. -x86_64-redhat-linux-gnu). When searching for a gcc install, also search -for a gcc equivalent triple if one exists. - -Differential Revision: https://reviews.llvm.org/D111207 ---- - clang/lib/Driver/ToolChains/Gnu.cpp | 22 ++++++++++++++++++++++ - 1 file changed, 22 insertions(+) - -diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp -index fe5bda5c6605..fd4a7f72be14 100644 ---- a/clang/lib/Driver/ToolChains/Gnu.cpp -+++ b/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -1884,6 +1884,18 @@ static llvm::StringRef getGCCToolchainDir(const ArgList &Args, - return GCC_INSTALL_PREFIX; - } - -+/// This function takes a 'clang' triple and converts it to an equivalent gcc -+/// triple. -+static const char *ConvertToGccTriple(StringRef CandidateTriple) { -+ return llvm::StringSwitch(CandidateTriple) -+ .Case("aarch64-redhat-linux-gnu", "aarch64-redhat-linux") -+ .Case("i686-redhat-linux-gnu", "i686-redhat-linux") -+ .Case("ppc64le-redhat-linux-gnu", "ppc64le-redhat-linux") -+ .Case("s390x-redhat-linux-gnu", "s390x-redhat-linux") -+ .Case("x86_64-redhat-linux-gnu", "x86_64-redhat-linux") -+ .Default(NULL); -+} -+ - /// Initialize a GCCInstallationDetector from the driver. - /// - /// This performs all of the autodetection and sets up the various paths. -@@ -1904,6 +1916,16 @@ void Generic_GCC::GCCInstallationDetector::init( - // The compatible GCC triples for this particular architecture. - SmallVector CandidateTripleAliases; - SmallVector CandidateBiarchTripleAliases; -+ -+ // In some cases gcc uses a slightly different triple than clang for the -+ // same target. Convert the clang triple to the gcc equivalent and use that -+ // to search for the gcc install. -+ const char *ConvertedTriple = ConvertToGccTriple(TargetTriple.str()); -+ if (ConvertedTriple) { -+ CandidateTripleAliases.push_back(ConvertedTriple); -+ CandidateBiarchTripleAliases.push_back(ConvertedTriple); -+ } -+ - CollectLibDirsAndTriples(TargetTriple, BiarchVariantTriple, CandidateLibDirs, - CandidateTripleAliases, CandidateBiarchLibDirs, - CandidateBiarchTripleAliases); --- -2.26.2 - diff --git a/0001-PATCH-clang-Fix-scan-build-py-executable-lookup-path.patch b/0001-PATCH-clang-Fix-scan-build-py-executable-lookup-path.patch deleted file mode 100644 index 590f273..0000000 --- a/0001-PATCH-clang-Fix-scan-build-py-executable-lookup-path.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 62eaebcb6bb872830299efa3f87506f1d23ef366 Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Mon, 13 Sep 2021 10:25:45 +0200 -Subject: [PATCH][clang] Fix scan-build-py executable lookup path - -Once installed, scan-build-py doesn't know anything about its auxiliary -executable and can't find them. -Use relative path wrt. scan-build-py script. - -Differential Revision: https://reviews.llvm.org/D109659 - -(cherry picked from commit c84755a046bbdcd0564693e30b2508034b06002b) ---- - clang/tools/scan-build-py/lib/libscanbuild/analyze.py | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/clang/tools/scan-build-py/lib/libscanbuild/analyze.py b/clang/tools/scan-build-py/lib/libscanbuild/analyze.py -index 9a249a8..d83ff2a 100644 ---- a/clang/tools/scan-build-py/lib/libscanbuild/analyze.py -+++ b/clang/tools/scan-build-py/lib/libscanbuild/analyze.py -@@ -39,8 +39,10 @@ from libscanbuild.shell import decode - - __all__ = ['scan_build', 'analyze_build', 'analyze_compiler_wrapper'] - --COMPILER_WRAPPER_CC = 'analyze-cc' --COMPILER_WRAPPER_CXX = 'analyze-c++' -+scanbuild_dir = os.path.dirname(__import__('sys').argv[0]) -+ -+COMPILER_WRAPPER_CC = os.path.join(scanbuild_dir, '..', 'libexec', 'analyze-cc') -+COMPILER_WRAPPER_CXX = os.path.join(scanbuild_dir, '..', 'libexec', 'analyze-c++') - - CTU_EXTDEF_MAP_FILENAME = 'externalDefMap.txt' - CTU_TEMP_DEFMAP_FOLDER = 'tmpExternalDefMaps' --- -1.8.3.1 - diff --git a/0001-PATCH-clang-Reorganize-gtest-integration.patch b/0001-PATCH-clang-Reorganize-gtest-integration.patch deleted file mode 100644 index e854f01..0000000 --- a/0001-PATCH-clang-Reorganize-gtest-integration.patch +++ /dev/null @@ -1,42 +0,0 @@ -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/0001-cmake-Allow-shared-libraries-to-customize-the-soname.patch b/0001-cmake-Allow-shared-libraries-to-customize-the-soname.patch deleted file mode 100644 index e425475..0000000 --- a/0001-cmake-Allow-shared-libraries-to-customize-the-soname.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 3dc5722d5c7673a879f2b4680369d3ac8b6b64b6 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Wed, 4 Aug 2021 14:05:38 -0700 -Subject: [PATCH] cmake: Allow shared libraries to customize the soname using - LLVM_ABI_REVISION - -The LLVM_ABI_REVISION variable is intended to be used for release -candidates which introduce an ABI change to a shared library. This -variable can be specified per library, so there is not one global value -for all of LLVM. - -For example, if we LLVM X.0.0-rc2 introduces an ABI change for a library -compared with LLVM X.0.0-rc1, then the LLVM_ABI_REVISION number for -library will be incremented by 1. - -In the main branch, LLVM_ABI_REVISION should always be 0, it is only -meant to be used in the release branch. - -Differential Revision: https://reviews.llvm.org/D105594 ---- - clang/tools/clang-shlib/CMakeLists.txt | 5 +++++ - 3 files changed, 19 insertions(+), 2 deletions(-) - -diff --git a/clang/tools/clang-shlib/CMakeLists.txt b/clang/tools/clang-shlib/CMakeLists.txt -index 9c1f8ea452b3..4d785924e4bb 100644 ---- a/clang/tools/clang-shlib/CMakeLists.txt -+++ b/clang/tools/clang-shlib/CMakeLists.txt -@@ -1,3 +1,8 @@ -+# In the main branch, LLVM_ABI_REVISION should always be 0. In the release -+# branches, this should be incremented before each release candidate every -+# time the ABI of libclang-cpp.so changes. -+set(LLVM_ABI_REVISION 0) -+ - # Building libclang-cpp.so fails if LLVM_ENABLE_PIC=Off - if (NOT LLVM_ENABLE_PIC) - return() --- -2.27.0 - diff --git a/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch b/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch deleted file mode 100644 index 5eb4b3b..0000000 --- a/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch +++ /dev/null @@ -1,29 +0,0 @@ -From c87abee7356b8fde81512ffceadd520776c465d2 Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Thu, 25 Feb 2021 14:09:29 +0100 -Subject: [PATCH] [PATCH][clang] Make -funwind-tables the default on all archs - ---- - clang/lib/Driver/ToolChains/Gnu.cpp | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp -index a27841dc5985..7489e6785150 100644 ---- a/clang/lib/Driver/ToolChains/Gnu.cpp -+++ b/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -2709,6 +2709,12 @@ bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const { - case llvm::Triple::ppc64: - case llvm::Triple::ppc64le: - case llvm::Triple::x86_64: -+ -+ // Enable -funwind-tables on all architectures supported by Fedora: -+ // rhbz#1655546 -+ case llvm::Triple::x86: -+ case llvm::Triple::systemz: -+ case llvm::Triple::arm: - return true; - default: - return false; --- -2.27.0 - diff --git a/0003-PATCH-clang-Don-t-install-static-libraries.patch b/0003-PATCH-clang-Don-t-install-static-libraries.patch deleted file mode 100644 index bc8fa51..0000000 --- a/0003-PATCH-clang-Don-t-install-static-libraries.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 88704fc2eabb9dd19a9c3eb81a9b3dc37d95651c 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 5752f4277444..0f52822d91f0 100644 ---- a/clang/cmake/modules/AddClang.cmake -+++ b/clang/cmake/modules/AddClang.cmake -@@ -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)) - get_target_export_arg(${name} Clang export_to_clangtargets UMBRELLA clang-libraries) - install(TARGETS ${lib} - COMPONENT ${lib} --- -2.30.2 - diff --git a/clang.spec b/clang.spec index 865a026..761c590 100644 --- a/clang.spec +++ b/clang.spec @@ -7,6 +7,19 @@ %global rc_ver 1 %global clang_version %{maj_ver}.%{min_ver}.%{patch_ver} +%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 + +%if %{with snapshot_build} +%undefine rc_ver +%global llvm_snapshot_vers pre%{llvm_snapshot_yyyymmdd}.g%{llvm_snapshot_git_revision_short} +%global clang_srcdir clang-%{llvm_snapshot_version_major}.%{llvm_snapshot_version_minor}.%{llvm_snapshot_version_patch}.src +%global clang_tools_srcdir clang-tools-extra-%{llvm_snapshot_version_major}.%{llvm_snapshot_version_minor}.%{llvm_snapshot_version_patch}.src +%global maj_ver %{llvm_snapshot_version_major} +%global min_ver %{llvm_snapshot_version_minor} +%global patch_ver %{llvm_snapshot_version_patch} +%endif + %global clang_tools_binaries \ %{_bindir}/clang-apply-replacements \ %{_bindir}/clang-change-namespace \ @@ -71,19 +84,25 @@ %endif Name: %pkg_name -Version: %{clang_version}%{?rc_ver:~rc%{rc_ver}} +Version: %{clang_version}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_vers:~%{llvm_snapshot_vers}} Release: 1%{?dist} Summary: A C language family front-end for LLVM License: NCSA URL: http://llvm.org +%if %{with snapshot_build} +Source0: %{llvm_snapshot_source_prefix}clang-%{llvm_snapshot_yyyymmdd}.src.tar.xz +Source1: %{llvm_snapshot_source_prefix}clang-tools-extra-%{llvm_snapshot_yyyymmdd}.src.tar.xz +%else Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{clang_version}%{?rc_ver:-rc%{rc_ver}}/%{clang_srcdir}.tar.xz Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{clang_version}%{?rc_ver:-rc%{rc_ver}}/%{clang_srcdir}.tar.xz.sig %if %{without compat_build} Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{clang_version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{clang_version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz.sig %endif +%if %{without snapshot_build} Source4: tstellar-gpg-key.asc +%endif %if %{without compat_build} Source5: macros.%{name} %endif @@ -261,13 +280,17 @@ Requires: python3 %prep +%if %{without snapshot_build} %{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE3}' --data='%{SOURCE0}' +%endif %if %{with compat_build} %autosetup -n %{clang_srcdir} -p2 %else +%if ! %{with snapshot_build} %{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE2}' --data='%{SOURCE1}' +%endif %setup -T -q -b 1 -n %{clang_tools_srcdir} %autopatch -m200 -p2 @@ -347,6 +370,10 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py %endif %endif \ +%if %{with snapshot_build} + -DLLVM_VERSION_SUFFIX="%{llvm_snapshot_vers}" \ +%endif + \ %if %{with compat_build} -DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen-%{maj_ver} \ %else @@ -461,6 +488,7 @@ rm -Rvf %{buildroot}%{_includedir}/clang-tidy/ %if %{without compat_build} # Add a symlink in /usr/bin to clang-format-diff +%if %{without compat_build} ln -s %{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format-diff %endif @@ -516,9 +544,9 @@ false %files resource-filesystem %dir %{pkg_libdir}/clang/%{version}/ %dir %{pkg_libdir}/clang/%{version}/include/ +%if %{without compat_build} %dir %{pkg_libdir}/clang/%{version}/lib/ %dir %{pkg_libdir}/clang/%{version}/share/ -%if %{without compat_build} %{pkg_libdir}/clang/%{maj_ver} %endif @@ -548,6 +576,7 @@ false %{_bindir}/find-all-symbols %{_bindir}/modularize %{_bindir}/clang-format-diff +%{_bindir}/clang-nvlink-wrapper %{_mandir}/man1/diagtool.1.gz %{_emacs_sitestartdir}/clang-format.el %{_emacs_sitestartdir}/clang-rename.el @@ -569,6 +598,11 @@ false %endif %changelog +%if %{with snapshot_build} +* %{lua: print(os.date("%a %b %d %Y"))} LLVM snapshot build bot +- Snapshot build of %{version} +%endif + * Wed Jan 12 2022 Nikita Popov - 13.0.1~rc1-1 - Update to LLVM 13.0.1rc1