import clang-13.0.0-2.el9

This commit is contained in:
CentOS Sources 2021-12-07 13:02:16 -05:00 committed by Stepan Oksanichenko
parent 62898e6df2
commit 6775806b51
14 changed files with 265 additions and 266 deletions

View File

@ -1,3 +1,5 @@
e3cdd3fb39c78a5bcb0a1d5706678cf8643a48f6 SOURCES/clang-12.0.1.src.tar.xz e3cdd3fb39c78a5bcb0a1d5706678cf8643a48f6 SOURCES/clang-12.0.1.src.tar.xz
42f179bb59432c4d2785239952853ad6308d0863 SOURCES/clang-tools-extra-12.0.1.src.tar.xz c071f016b5e8965a52cea4f0905924aaf5495d49 SOURCES/clang-13.0.0.src.tar.xz
7fe8345c57469fcf32945a16dc0a719e9131741c SOURCES/clang-tools-extra-13.0.0.src.tar.xz
619fe668e0972d11d0fa2db670a57a42d02fb8ca SOURCES/llvm-12.0.1.src.tar.xz
b8d2648a01d36ed0186fd2c5af325fd28797f9a0 SOURCES/tstellar-gpg-key.asc b8d2648a01d36ed0186fd2c5af325fd28797f9a0 SOURCES/tstellar-gpg-key.asc

4
.gitignore vendored
View File

@ -1,3 +1,5 @@
SOURCES/clang-12.0.1.src.tar.xz SOURCES/clang-12.0.1.src.tar.xz
SOURCES/clang-tools-extra-12.0.1.src.tar.xz SOURCES/clang-13.0.0.src.tar.xz
SOURCES/clang-tools-extra-13.0.0.src.tar.xz
SOURCES/llvm-12.0.1.src.tar.xz
SOURCES/tstellar-gpg-key.asc SOURCES/tstellar-gpg-key.asc

View File

@ -0,0 +1,59 @@
From d68a5a7817dc0d43853d8b84c9185dc24338664f Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
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<const char *>(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<StringRef, 16> CandidateTripleAliases;
SmallVector<StringRef, 16> 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

View File

@ -0,0 +1,36 @@
From 62eaebcb6bb872830299efa3f87506f1d23ef366 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@redhat.com>
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

View File

@ -0,0 +1,39 @@
From 3dc5722d5c7673a879f2b4680369d3ac8b6b64b6 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
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

View File

@ -1,25 +1,25 @@
From 2c6cd40d016f492d53e16f1c7424a0d9878ae7ec Mon Sep 17 00:00:00 2001 From 88704fc2eabb9dd19a9c3eb81a9b3dc37d95651c Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com> From: Tom Stellard <tstellar@redhat.com>
Date: Fri, 31 Jan 2020 11:04:57 -0800 Date: Fri, 31 Jan 2020 11:04:57 -0800
Subject: [PATCH 3/6] [PATCH][clang] Don't install static libraries Subject: [PATCH][clang] Don't install static libraries
--- ---
clang/cmake/modules/AddClang.cmake | 2 +- clang/cmake/modules/AddClang.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
index 704278a..1737b24 100644 index 5752f4277444..0f52822d91f0 100644
--- a/clang/cmake/modules/AddClang.cmake --- a/clang/cmake/modules/AddClang.cmake
+++ b/clang/cmake/modules/AddClang.cmake +++ b/clang/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}) if(TARGET ${lib})
target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS}) target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS})
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN) - 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)) + if (ARG_SHARED AND (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN))
set(export_to_clangtargets) get_target_export_arg(${name} Clang export_to_clangtargets UMBRELLA clang-libraries)
if(${lib} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR install(TARGETS ${lib}
"clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR COMPONENT ${lib}
-- --
1.8.3.1 2.30.2

View File

@ -1,132 +0,0 @@
From d8af49687765744efaae7ba0f0c4c0fcd58a0e31 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@redhat.com>
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<std::string> 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

View File

@ -1,77 +0,0 @@
From 1ef1e91142ac48ecb826f33e1e7072c7402d9fe7 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@redhat.com>
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<Builtin::Info> 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 <typename> 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<typename> struct __is_floating_point_helper {};
template<> struct __is_floating_point_helper<__float128> {};
--
1.8.3.1

Binary file not shown.

Binary file not shown.

Binary file not shown.

16
SOURCES/macros.clang Normal file
View File

@ -0,0 +1,16 @@
%clang_major_version @@CLANG_MAJOR_VERSION@@
%clang_minor_version @@CLANG_MINOR_VERSION@@
%clang_patch_version @@CLANG_PATCH_VERSION@@
%clang_version %{clang_major_version}.%{clang_minor_version}.%{clang_patch_version}
# This is the path to the clang resource directory that has clang's internal
# headers and libraries. This path should be used by packages that need to
# install files into this directory. This macro's value changes every time
# clang's version changes.
%clang_resource_dir %{_libdir}/clang/%{clang_version}
# This is the path to the clang resource directory that should be used
# by packages that need to read files from this directory at runtime.
# This macro only changes when clang's major version changes.
%clang_resource_dir_readonly %{_libdir}/clang/%{clang_major_version}

View File

@ -1,9 +1,11 @@
%global compat_build 0 %bcond_with compat_build
%bcond_without check
%global maj_ver 12 %global maj_ver 13
%global min_ver 0 %global min_ver 0
%global patch_ver 1 %global patch_ver 0
#%%global rc_ver 5 #global rc_ver 4
%global clang_version %{maj_ver}.%{min_ver}.%{patch_ver}
%global clang_tools_binaries \ %global clang_tools_binaries \
%{_bindir}/clang-apply-replacements \ %{_bindir}/clang-apply-replacements \
@ -20,6 +22,7 @@
%{_bindir}/clang-refactor \ %{_bindir}/clang-refactor \
%{_bindir}/clang-rename \ %{_bindir}/clang-rename \
%{_bindir}/clang-reorder-fields \ %{_bindir}/clang-reorder-fields \
%{_bindir}/clang-repl \
%{_bindir}/clang-scan-deps \ %{_bindir}/clang-scan-deps \
%{_bindir}/clang-tidy \ %{_bindir}/clang-tidy \
%{_bindir}/clangd \ %{_bindir}/clangd \
@ -35,7 +38,7 @@
%{_bindir}/clang-cl \ %{_bindir}/clang-cl \
%{_bindir}/clang-cpp \ %{_bindir}/clang-cpp \
%if 0%{?compat_build} %if %{with compat_build}
%global pkg_name clang%{maj_ver} %global pkg_name clang%{maj_ver}
# Install clang to same prefix as llvm, so that apps that use llvm-config # Install clang to same prefix as llvm, so that apps that use llvm-config
# will also be able to find clang libs. # will also be able to find clang libs.
@ -59,54 +62,63 @@
%bcond_with python3 %bcond_with python3
%endif %endif
%bcond_with bundle_compat_lib %bcond_without bundle_compat_lib
%if %{with bundle_compat_lib} %if %{with bundle_compat_lib}
%global compat_maj_ver 11 %global compat_maj_ver 12
%global compat_ver %{compat_maj_ver}.1.0rc2 %global compat_ver %{compat_maj_ver}.0.1
%endif %endif
%global build_install_prefix %{buildroot}%{install_prefix} %global build_install_prefix %{buildroot}%{install_prefix}
%ifarch ppc64le aarch64 %ifarch ppc64le aarch64
# Too many threads on ppc64 and aarch64 systems causes OOM errors. # Too many threads on ppc64 systems causes OOM errors.
%global _smp_mflags -j8 %global _smp_mflags -j8
%endif %endif
%global clang_srcdir clang-%{version}%{?rc_ver:rc%{rc_ver}}.src %global clang_srcdir clang-%{clang_version}%{?rc_ver:rc%{rc_ver}}.src
%global clang_tools_srcdir clang-tools-extra-%{version}%{?rc_ver:rc%{rc_ver}}.src %global clang_tools_srcdir clang-tools-extra-%{clang_version}%{?rc_ver:rc%{rc_ver}}.src
%if !%{maj_ver} && 0%{?rc_ver}
%global abi_revision 2
%endif
Name: %pkg_name Name: %pkg_name
Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}} Version: %{clang_version}%{?rc_ver:~rc%{rc_ver}}
Release: 5%{?dist} Release: 2%{?dist}
Summary: A C language family front-end for LLVM Summary: A C language family front-end for LLVM
License: NCSA License: NCSA
URL: http://llvm.org URL: http://llvm.org
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_srcdir}.tar.xz 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-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_srcdir}.tar.xz.sig Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{clang_version}%{?rc_ver:-rc%{rc_ver}}/%{clang_srcdir}.tar.xz.sig
%if !0%{?compat_build} %if %{without compat_build}
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz 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-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz.sig Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{clang_version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz.sig
%endif %endif
Source4: tstellar-gpg-key.asc Source4: tstellar-gpg-key.asc
%if %{with bundle_compat_lib} %if %{with bundle_compat_lib}
Source5: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compat_ver}/clang-%{compat_ver}.src.tar.xz Source5: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compat_ver}/clang-%{compat_ver}.src.tar.xz
Source6: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compat_ver}/llvm-%{compat_ver}.src.tar.xz Source6: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compat_ver}/llvm-%{compat_ver}.src.tar.xz
%endif %endif
%if !0%{with compat_build}
Source7: macros.%{name}
%endif
# Patches for clang # Patches for clang
Patch0: 0001-PATCH-clang-Reorganize-gtest-integration.patch Patch0: 0001-PATCH-clang-Reorganize-gtest-integration.patch
Patch1: 0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch Patch1: 0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
Patch2: 0003-PATCH-clang-Don-t-install-static-libraries.patch Patch2: 0003-PATCH-clang-Don-t-install-static-libraries.patch
Patch3: 0004-PATCH-clang-Prefer-gcc-toolchains-with-libgcc_s.so-w.patch Patch3: 0001-Driver-Add-a-gcc-equivalent-triple-to-the-list-of-tr.patch
Patch5: 0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch Patch4: 0001-cmake-Allow-shared-libraries-to-customize-the-soname.patch
Patch5: 0001-PATCH-clang-Fix-scan-build-py-executable-lookup-path.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: cmake BuildRequires: cmake
BuildRequires: ninja-build BuildRequires: ninja-build
%if 0%{?compat_build} %if %{with compat_build}
BuildRequires: llvm%{maj_ver}-devel = %{version} BuildRequires: llvm%{maj_ver}-devel = %{version}
BuildRequires: llvm%{maj_ver}-static = %{version} BuildRequires: llvm%{maj_ver}-static = %{version}
%else %else
@ -125,11 +137,8 @@ BuildRequires: ncurses-devel
# should BuildRequires: emacs if it packages emacs integration files. # should BuildRequires: emacs if it packages emacs integration files.
BuildRequires: emacs BuildRequires: emacs
# These build dependencies are required for the test suite.
%if %with python3
# The testsuite uses /usr/bin/lit which is part of the python3-lit package. # The testsuite uses /usr/bin/lit which is part of the python3-lit package.
BuildRequires: python3-lit BuildRequires: python3-lit
%endif
BuildRequires: python3-sphinx BuildRequires: python3-sphinx
BuildRequires: libatomic BuildRequires: libatomic
@ -205,7 +214,7 @@ Runtime library for clang.
%package devel %package devel
Summary: Development header files for clang Summary: Development header files for clang
%if !0%{?compat_build} %if %{without compat_build}
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
# The clang CMake files reference tools from clang-tools-extra. # The clang CMake files reference tools from clang-tools-extra.
Requires: %{name}-tools-extra%{?_isa} = %{version}-%{release} Requires: %{name}-tools-extra%{?_isa} = %{version}-%{release}
@ -222,7 +231,7 @@ Provides: %{name}-resource-filesystem(major) = %{maj_ver}
%description resource-filesystem %description resource-filesystem
This package owns the clang resouce directory: $libdir/clang/$version/ This package owns the clang resouce directory: $libdir/clang/$version/
%if !0%{?compat_build} %if %{without compat_build}
%package analyzer %package analyzer
Summary: A source code analysis framework Summary: A source code analysis framework
License: NCSA and MIT License: NCSA and MIT
@ -275,7 +284,7 @@ Requires: python3
%setup -T -q -b 6 -n llvm-%{compat_ver}.src %setup -T -q -b 6 -n llvm-%{compat_ver}.src
%endif %endif
%if 0%{?compat_build} %if %{with compat_build}
%autosetup -n %{clang_srcdir} -p2 %autosetup -n %{clang_srcdir} -p2
%else %else
@ -300,7 +309,11 @@ pathfix.py -i %{__python3} -pn \
tools/clang-format/*.py \ tools/clang-format/*.py \
tools/clang-format/git-clang-format \ tools/clang-format/git-clang-format \
utils/hmaptool/hmaptool \ utils/hmaptool/hmaptool \
tools/scan-view/bin/scan-view tools/scan-view/bin/scan-view \
tools/scan-view/share/Reporter.py \
tools/scan-view/share/startfile.py \
tools/scan-build-py/bin/* \
tools/scan-build-py/libexec/*
%endif %endif
%build %build
@ -342,9 +355,11 @@ mv ../clang-%{compat_ver}.src ../clang
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \ -DBUILD_SHARED_LIBS=OFF \
-DLLVM_ENABLE_EH=ON \ -DLLVM_ENABLE_EH=ON \
-DLLVM_ENABLE_RTTI=ON -DLLVM_ENABLE_RTTI=ON \
-DCMAKE_INSTALL_RPATH:BOOL=";"
%ninja_build -C ../clang-compat-libs libclang.so %ninja_build -C ../clang-compat-libs libclang.so
%ninja_build -C ../clang-compat-libs libclang-cpp.so
%endif %endif
@ -353,6 +368,8 @@ mv ../clang-%{compat_ver}.src ../clang
# rpath of libraries and binaries. llvm will skip the manual setting # rpath of libraries and binaries. llvm will skip the manual setting
# if CAMKE_INSTALL_RPATH is set to a value, but cmake interprets this value # if CAMKE_INSTALL_RPATH is set to a value, but cmake interprets this value
# as nothing, so it sets the rpath to "" when installing. # as nothing, so it sets the rpath to "" when installing.
# -DLLVM_ENABLE_NEW_PASS_MANAGER=ON can be removed once this patch is committed:
# https://reviews.llvm.org/D107628
%cmake -G Ninja \ %cmake -G Ninja \
-DLLVM_PARALLEL_LINK_JOBS=1 \ -DLLVM_PARALLEL_LINK_JOBS=1 \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
@ -363,9 +380,9 @@ mv ../clang-%{compat_ver}.src ../clang
-DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
%endif %endif
%if 0%{?compat_build} %if %{with compat_build}
-DCLANG_BUILD_TOOLS:BOOL=OFF \ -DCLANG_BUILD_TOOLS:BOOL=OFF \
-DLLVM_CONFIG:FILEPATH=%{_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} \ -DLLVM_CONFIG:FILEPATH=%{_bindir}/llvm-config-%{maj_ver} \
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \ -DCMAKE_INSTALL_PREFIX=%{install_prefix} \
-DCLANG_INCLUDE_TESTS:BOOL=OFF \ -DCLANG_INCLUDE_TESTS:BOOL=OFF \
%else %else
@ -380,7 +397,7 @@ mv ../clang-%{compat_ver}.src ../clang
%endif %endif
%endif %endif
\ \
%if 0%{compat_build} %if %{with compat_build}
-DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen-%{maj_ver} \ -DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen-%{maj_ver} \
%else %else
-DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen \ -DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen \
@ -393,8 +410,10 @@ mv ../clang-%{compat_ver}.src ../clang
-DLLVM_ENABLE_EH=ON \ -DLLVM_ENABLE_EH=ON \
-DLLVM_ENABLE_RTTI=ON \ -DLLVM_ENABLE_RTTI=ON \
-DLLVM_BUILD_DOCS=ON \ -DLLVM_BUILD_DOCS=ON \
-DLLVM_ENABLE_NEW_PASS_MANAGER=ON \
-DLLVM_ENABLE_SPHINX=ON \ -DLLVM_ENABLE_SPHINX=ON \
-DCLANG_LINK_CLANG_DYLIB=ON \ -DCLANG_LINK_CLANG_DYLIB=ON \
%{?abi_revision:-DLLVM_ABI_REVISION=%{abi_revision}} \
-DSPHINX_WARNINGS_AS_ERRORS=OFF \ -DSPHINX_WARNINGS_AS_ERRORS=OFF \
\ \
-DCLANG_BUILD_EXAMPLES:BOOL=OFF \ -DCLANG_BUILD_EXAMPLES:BOOL=OFF \
@ -411,27 +430,39 @@ mv ../clang-%{compat_ver}.src ../clang
%if %{with bundle_compat_lib} %if %{with bundle_compat_lib}
install -m 0755 ../clang-compat-libs/lib/libclang.so.%{compat_maj_ver}* %{buildroot}%{_libdir} install -m 0755 ../clang-compat-libs/lib/libclang.so.%{compat_maj_ver}* %{buildroot}%{_libdir}
install -m 0755 ../clang-compat-libs/lib/libclang-cpp.so.%{compat_maj_ver}* %{buildroot}%{_libdir}
%endif %endif
%if 0%{?compat_build} %if %{with compat_build}
# Remove binaries/other files # Remove binaries/other files
rm -Rf %{buildroot}%{install_bindir} rm -Rf %{buildroot}%{install_bindir}
rm -Rf %{buildroot}%{install_prefix}/share rm -Rf %{buildroot}%{install_prefix}/share
rm -Rf %{buildroot}%{install_prefix}/libexec rm -Rf %{buildroot}%{install_prefix}/libexec
# Move include files
mkdir -p %{buildroot}%{pkg_includedir}
mv %{buildroot}/%{install_includedir}/clang %{buildroot}/%{pkg_includedir}/
mv %{buildroot}/%{install_includedir}/clang-c %{buildroot}/%{pkg_includedir}/
%else %else
# File in the macros file for other packages to use. We are not doing this
# in the compat package, because the version macros would # conflict with
# eachother if both clang and the clang compat package were installed together.
install -p -m0644 -D %{SOURCE7} %{buildroot}%{_rpmmacrodir}/macros.%{name}
sed -i -e "s|@@CLANG_MAJOR_VERSION@@|%{maj_ver}|" \
-e "s|@@CLANG_MINOR_VERSION@@|%{min_ver}|" \
-e "s|@@CLANG_PATCH_VERSION@@|%{patch_ver}|" \
%{buildroot}%{_rpmmacrodir}/macros.%{name}
# install clang python bindings # install clang python bindings
mkdir -p %{buildroot}%{python3_sitelib}/clang/ mkdir -p %{buildroot}%{python3_sitelib}/clang/
install -p -m644 bindings/python/clang/* %{buildroot}%{python3_sitelib}/clang/ install -p -m644 bindings/python/clang/* %{buildroot}%{python3_sitelib}/clang/
%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/clang %py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/clang
# install scanbuild-py to python sitelib.
mv %{buildroot}%{_prefix}/lib/{libear,libscanbuild} %{buildroot}%{python3_sitelib}
%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/{libear,libscanbuild}
# Fix permissions of scan-view scripts
chmod a+x %{buildroot}%{_datadir}/scan-view/{Reporter.py,startfile.py}
# multilib fix # multilib fix
%multilib_fix_c_header --file %{_includedir}/clang/Config/config.h %multilib_fix_c_header --file %{_includedir}/clang/Config/config.h
@ -474,26 +505,31 @@ pushd %{buildroot}%{_libdir}/clang/
ln -s %{version} %{maj_ver} ln -s %{version} %{maj_ver}
popd popd
%endif
# Create sub-directories in the clang resource directory that will be # Create sub-directories in the clang resource directory that will be
# populated by other packages # populated by other packages
mkdir -p %{buildroot}%{_libdir}/clang/%{version}/{include,lib,share}/ mkdir -p %{buildroot}%{pkg_libdir}/clang/%{version}/{include,lib,share}/
%endif
# Remove clang-tidy headers. We don't ship the libraries for these. # Remove clang-tidy headers. We don't ship the libraries for these.
rm -Rvf %{buildroot}%{_includedir}/clang-tidy/ rm -Rvf %{buildroot}%{_includedir}/clang-tidy/
%if %{without compat_build}
# Add a symlink in /usr/bin to clang-format-diff # Add a symlink in /usr/bin to clang-format-diff
ln -s %{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format-diff ln -s %{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format-diff
%endif
%check %check
# see rhbz#1994082 # see rhbz#1994082
sed -i -e "s/'ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'/'ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH', 'SOURCE_DATE_EPOCH'/" test/lit.cfg.py sed -i -e "s/'ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'/'ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH', 'SOURCE_DATE_EPOCH'/" test/lit.cfg.py
%if !0%{?compat_build} %if %{without compat_build}
%if %{with check}
# requires lit.py from LLVM utilities # requires lit.py from LLVM utilities
# FIXME: Fix failing ARM tests # FIXME: Fix failing ARM tests
SOURCE_DATE_EPOCH=1629181597 LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %cmake_build --target check-all || \ SOURCE_DATE_EPOCH=1629181597 LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %cmake_build --target check-all || \
%endif
%ifarch %{arm} %ifarch %{arm}
: :
%else %else
@ -503,7 +539,7 @@ false
%endif %endif
%if !0%{?compat_build} %if %{without compat_build}
%files %files
%license LICENSE.TXT %license LICENSE.TXT
%{clang_binaries} %{clang_binaries}
@ -514,7 +550,7 @@ false
%endif %endif
%files libs %files libs
%if !0%{?compat_build} %if %{without compat_build}
%{_libdir}/clang/ %{_libdir}/clang/
%{_libdir}/*.so.* %{_libdir}/*.so.*
%else %else
@ -523,15 +559,17 @@ false
%endif %endif
%if %{with bundle_compat_lib} %if %{with bundle_compat_lib}
%{_libdir}/libclang.so.%{compat_maj_ver}* %{_libdir}/libclang.so.%{compat_maj_ver}*
%{_libdir}/libclang-cpp.so.%{compat_maj_ver}*
%endif %endif
%files devel %files devel
%if !0%{?compat_build} %if %{without compat_build}
%{_libdir}/*.so %{_libdir}/*.so
%{_includedir}/clang/ %{_includedir}/clang/
%{_includedir}/clang-c/ %{_includedir}/clang-c/
%{_libdir}/cmake/* %{_libdir}/cmake/*
%dir %{_datadir}/clang/ %dir %{_datadir}/clang/
%{_rpmmacrodir}/macros.%{name}
%else %else
%{pkg_libdir}/*.so %{pkg_libdir}/*.so
%{pkg_includedir}/clang/ %{pkg_includedir}/clang/
@ -544,19 +582,29 @@ false
%dir %{pkg_libdir}/clang/%{version}/include/ %dir %{pkg_libdir}/clang/%{version}/include/
%dir %{pkg_libdir}/clang/%{version}/lib/ %dir %{pkg_libdir}/clang/%{version}/lib/
%dir %{pkg_libdir}/clang/%{version}/share/ %dir %{pkg_libdir}/clang/%{version}/share/
%if !0%{?compat_build} %if %{without compat_build}
%{pkg_libdir}/clang/%{maj_ver} %{pkg_libdir}/clang/%{maj_ver}
%endif %endif
%if !0%{?compat_build} %if %{without compat_build}
%files analyzer %files analyzer
%{_bindir}/scan-view %{_bindir}/scan-view
%{_bindir}/scan-build %{_bindir}/scan-build
%{_bindir}/analyze-build
%{_bindir}/intercept-build
%{_bindir}/scan-build-py
%{_libexecdir}/ccc-analyzer %{_libexecdir}/ccc-analyzer
%{_libexecdir}/c++-analyzer %{_libexecdir}/c++-analyzer
%{_libexecdir}/analyze-c++
%{_libexecdir}/analyze-cc
%{_libexecdir}/intercept-c++
%{_libexecdir}/intercept-cc
%{_datadir}/scan-view/ %{_datadir}/scan-view/
%{_datadir}/scan-build/ %{_datadir}/scan-build/
%{_mandir}/man1/scan-build.1.* %{_mandir}/man1/scan-build.1.*
%{python3_sitelib}/libear
%{python3_sitelib}/libscanbuild
%files tools-extra %files tools-extra
%{clang_tools_binaries} %{clang_tools_binaries}
@ -572,7 +620,7 @@ false
%{_datadir}/clang/clang-format-diff.py* %{_datadir}/clang/clang-format-diff.py*
%{_datadir}/clang/clang-include-fixer.py* %{_datadir}/clang/clang-include-fixer.py*
%{_datadir}/clang/clang-tidy-diff.py* %{_datadir}/clang/clang-tidy-diff.py*
%{_datadir}/clang/run-clang-tidy.py* %{_bindir}/run-clang-tidy
%{_datadir}/clang/run-find-all-symbols.py* %{_datadir}/clang/run-find-all-symbols.py*
%{_datadir}/clang/clang-rename.py* %{_datadir}/clang/clang-rename.py*
@ -585,6 +633,12 @@ false
%endif %endif
%changelog %changelog
* Wed Nov 03 2021 Timm Bäder <tbaeder@redhat.com> - 13.0.0-2
- Ship libclang-cpp.so.12 as well
* Wed Oct 13 2021 Timm Bäder <tbaeder@redhat.com> - 13.0.0-1
- Release 13.0.0
* Tue Aug 17 2021 sguelton@redhat.com - 12.0.1-5 * Tue Aug 17 2021 sguelton@redhat.com - 12.0.1-5
- Force SOURCE_DATE_EPOCH, fix rhbz#1994082 - Force SOURCE_DATE_EPOCH, fix rhbz#1994082