Release 13.0.0

Resolves: rhbz#2001107
This commit is contained in:
Timm Bäder 2021-10-14 09:25:28 +02:00
parent abdc9191f6
commit 93917103b9
10 changed files with 258 additions and 267 deletions

5
.gitignore vendored
View File

@ -172,3 +172,8 @@
/clang-12.0.1.src.tar.xz.sig
/clang-tools-extra-12.0.1.src.tar.xz
/clang-tools-extra-12.0.1.src.tar.xz.sig
/clang-13.0.0.src.tar.xz
/clang-13.0.0.src.tar.xz.sig
/clang-tools-extra-13.0.0.src.tar.xz
/clang-tools-extra-13.0.0.src.tar.xz.sig
/llvm-12.0.1.src.tar.xz

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>
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 +-
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
index 5752f4277444..0f52822d91f0 100644
--- a/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})
target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS})
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
+ if (ARG_SHARED AND (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN))
set(export_to_clangtargets)
if(${lib} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
"clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
get_target_export_arg(${name} Clang export_to_clangtargets UMBRELLA clang-libraries)
install(TARGETS ${lib}
COMPONENT ${lib}
--
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

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 patch_ver 1
#%%global rc_ver 5
%global patch_ver 0
#global rc_ver 4
%global clang_version %{maj_ver}.%{min_ver}.%{patch_ver}
%global clang_tools_binaries \
%{_bindir}/clang-apply-replacements \
@ -20,6 +22,7 @@
%{_bindir}/clang-refactor \
%{_bindir}/clang-rename \
%{_bindir}/clang-reorder-fields \
%{_bindir}/clang-repl \
%{_bindir}/clang-scan-deps \
%{_bindir}/clang-tidy \
%{_bindir}/clangd \
@ -35,7 +38,7 @@
%{_bindir}/clang-cl \
%{_bindir}/clang-cpp \
%if 0%{?compat_build}
%if %{with compat_build}
%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.
@ -59,54 +62,63 @@
%bcond_with python3
%endif
%bcond_with bundle_compat_lib
%bcond_without bundle_compat_lib
%if %{with bundle_compat_lib}
%global compat_maj_ver 11
%global compat_ver %{compat_maj_ver}.1.0rc2
%global compat_maj_ver 12
%global compat_ver %{compat_maj_ver}.0.1
%endif
%global build_install_prefix %{buildroot}%{install_prefix}
%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
%endif
%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
%global clang_srcdir clang-%{clang_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
Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}
Release: 5%{?dist}
Version: %{clang_version}%{?rc_ver:~rc%{rc_ver}}
Release: 1%{?dist}
Summary: A C language family front-end for LLVM
License: NCSA
URL: http://llvm.org
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{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
%if !0%{?compat_build}
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
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
Source4: tstellar-gpg-key.asc
%if %{with bundle_compat_lib}
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
%endif
%if !0%{with compat_build}
Source7: macros.%{name}
%endif
# 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
Patch3: 0001-Driver-Add-a-gcc-equivalent-triple-to-the-list-of-tr.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-c++
BuildRequires: cmake
BuildRequires: ninja-build
%if 0%{?compat_build}
%if %{with compat_build}
BuildRequires: llvm%{maj_ver}-devel = %{version}
BuildRequires: llvm%{maj_ver}-static = %{version}
%else
@ -125,11 +137,8 @@ BuildRequires: ncurses-devel
# should BuildRequires: emacs if it packages emacs integration files.
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.
BuildRequires: python3-lit
%endif
BuildRequires: python3-sphinx
BuildRequires: libatomic
@ -205,7 +214,7 @@ Runtime library for clang.
%package devel
Summary: Development header files for clang
%if !0%{?compat_build}
%if %{without compat_build}
Requires: %{name}%{?_isa} = %{version}-%{release}
# The clang CMake files reference tools from clang-tools-extra.
Requires: %{name}-tools-extra%{?_isa} = %{version}-%{release}
@ -222,7 +231,7 @@ Provides: %{name}-resource-filesystem(major) = %{maj_ver}
%description resource-filesystem
This package owns the clang resouce directory: $libdir/clang/$version/
%if !0%{?compat_build}
%if %{without compat_build}
%package analyzer
Summary: A source code analysis framework
License: NCSA and MIT
@ -275,7 +284,7 @@ Requires: python3
%setup -T -q -b 6 -n llvm-%{compat_ver}.src
%endif
%if 0%{?compat_build}
%if %{with compat_build}
%autosetup -n %{clang_srcdir} -p2
%else
@ -300,7 +309,9 @@ pathfix.py -i %{__python3} -pn \
tools/clang-format/*.py \
tools/clang-format/git-clang-format \
utils/hmaptool/hmaptool \
tools/scan-view/bin/scan-view
tools/scan-view/bin/scan-view \
tools/scan-build-py/bin/* \
tools/scan-build-py/libexec/*
%endif
%build
@ -342,7 +353,8 @@ mv ../clang-%{compat_ver}.src ../clang
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DLLVM_ENABLE_EH=ON \
-DLLVM_ENABLE_RTTI=ON
-DLLVM_ENABLE_RTTI=ON \
-DCMAKE_INSTALL_RPATH:BOOL=";"
%ninja_build -C ../clang-compat-libs libclang.so
@ -353,6 +365,8 @@ mv ../clang-%{compat_ver}.src ../clang
# 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
# 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 \
-DLLVM_PARALLEL_LINK_JOBS=1 \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
@ -363,9 +377,9 @@ mv ../clang-%{compat_ver}.src ../clang
-DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
%endif
%if 0%{?compat_build}
%if %{with compat_build}
-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} \
-DCLANG_INCLUDE_TESTS:BOOL=OFF \
%else
@ -380,7 +394,7 @@ mv ../clang-%{compat_ver}.src ../clang
%endif
%endif
\
%if 0%{compat_build}
%if %{with compat_build}
-DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen-%{maj_ver} \
%else
-DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen \
@ -393,8 +407,10 @@ mv ../clang-%{compat_ver}.src ../clang
-DLLVM_ENABLE_EH=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_BUILD_DOCS=ON \
-DLLVM_ENABLE_NEW_PASS_MANAGER=ON \
-DLLVM_ENABLE_SPHINX=ON \
-DCLANG_LINK_CLANG_DYLIB=ON \
%{?abi_revision:-DLLVM_ABI_REVISION=%{abi_revision}} \
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
\
-DCLANG_BUILD_EXAMPLES:BOOL=OFF \
@ -413,25 +429,33 @@ mv ../clang-%{compat_ver}.src ../clang
install -m 0755 ../clang-compat-libs/lib/libclang.so.%{compat_maj_ver}* %{buildroot}%{_libdir}
%endif
%if 0%{?compat_build}
%if %{with compat_build}
# Remove binaries/other files
rm -Rf %{buildroot}%{install_bindir}
rm -Rf %{buildroot}%{install_prefix}/share
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
# 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
mkdir -p %{buildroot}%{python3_sitelib}/clang/
install -p -m644 bindings/python/clang/* %{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}
# multilib fix
%multilib_fix_c_header --file %{_includedir}/clang/Config/config.h
@ -474,26 +498,31 @@ pushd %{buildroot}%{_libdir}/clang/
ln -s %{version} %{maj_ver}
popd
%endif
# Create sub-directories in the clang resource directory that will be
# 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.
rm -Rvf %{buildroot}%{_includedir}/clang-tidy/
%if %{without compat_build}
# Add a symlink in /usr/bin to clang-format-diff
ln -s %{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format-diff
%endif
%check
# 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
%if !0%{?compat_build}
%if %{without compat_build}
%if %{with check}
# requires lit.py from LLVM utilities
# FIXME: Fix failing ARM tests
SOURCE_DATE_EPOCH=1629181597 LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %cmake_build --target check-all || \
%endif
%ifarch %{arm}
:
%else
@ -503,7 +532,7 @@ false
%endif
%if !0%{?compat_build}
%if %{without compat_build}
%files
%license LICENSE.TXT
%{clang_binaries}
@ -514,7 +543,7 @@ false
%endif
%files libs
%if !0%{?compat_build}
%if %{without compat_build}
%{_libdir}/clang/
%{_libdir}/*.so.*
%else
@ -526,12 +555,13 @@ false
%endif
%files devel
%if !0%{?compat_build}
%if %{without compat_build}
%{_libdir}/*.so
%{_includedir}/clang/
%{_includedir}/clang-c/
%{_libdir}/cmake/*
%dir %{_datadir}/clang/
%{_rpmmacrodir}/macros.%{name}
%else
%{pkg_libdir}/*.so
%{pkg_includedir}/clang/
@ -544,19 +574,29 @@ false
%dir %{pkg_libdir}/clang/%{version}/include/
%dir %{pkg_libdir}/clang/%{version}/lib/
%dir %{pkg_libdir}/clang/%{version}/share/
%if !0%{?compat_build}
%if %{without compat_build}
%{pkg_libdir}/clang/%{maj_ver}
%endif
%if !0%{?compat_build}
%if %{without compat_build}
%files analyzer
%{_bindir}/scan-view
%{_bindir}/scan-build
%{_bindir}/analyze-build
%{_bindir}/intercept-build
%{_bindir}/scan-build-py
%{_libexecdir}/ccc-analyzer
%{_libexecdir}/c++-analyzer
%{_libexecdir}/analyze-c++
%{_libexecdir}/analyze-cc
%{_libexecdir}/intercept-c++
%{_libexecdir}/intercept-cc
%{_datadir}/scan-view/
%{_datadir}/scan-build/
%{_mandir}/man1/scan-build.1.*
%{python3_sitelib}/libear
%{python3_sitelib}/libscanbuild
%files tools-extra
%{clang_tools_binaries}
@ -572,7 +612,7 @@ false
%{_datadir}/clang/clang-format-diff.py*
%{_datadir}/clang/clang-include-fixer.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/clang-rename.py*
@ -585,6 +625,9 @@ false
%endif
%changelog
* 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
- Force SOURCE_DATE_EPOCH, fix rhbz#1994082

16
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,4 +1,6 @@
SHA512 (clang-13.0.0.src.tar.xz) = b9ae85a7f0a66ae42a6d76a4e1ea0940bf622f7fbd21d078c9fef146087c70abb0a597a1cfda4e8706b1fbc74d170986451f5f2d642f685a5c355da8a572fb26
SHA512 (clang-tools-extra-13.0.0.src.tar.xz) = e8fc33441b6845984f3d1c947efb48f141700ebb4c146323d78eb6e28e36042f3d7179abfcfad2ec1c2c1a0bd3e5ef55ceda2c20fcc794b895cfe732fb095f2a
SHA512 (clang-tools-extra-13.0.0.src.tar.xz.sig) = 4f61831ed46896c80d9de16fe446049092b14484b6d01e3943635e91d1cd4991057b740b7bb45679107234586c9ca72664c05ffd0595d8d311d710eca00ed640
SHA512 (clang-13.0.0.src.tar.xz.sig) = 3341f4daec11898cde69c4c72c9bdd247dac38018c53963cc34e7e32372f4b66cfca86a59ff492c578e5e2761aaba159f3ef9904cb1f4f493b6d238d415de789
SHA512 (clang-12.0.1.src.tar.xz) = 405011f0974b239427ca87c65e7485709c77705a9b7d51d679fe2abec79865f8c51c7ab085b4e6bf7aa4d0eade4b1438d88dd5feb56b434dc5d718ebf5715efa
SHA512 (clang-12.0.1.src.tar.xz.sig) = e8e87b84e0ea47afb9038c03327120deb8a785ce688fbe268658d4f8792e299ca4d5796c1077b745839226e4af211f37cc1b17348c59604fed6ab6ae0c2c3899
SHA512 (clang-tools-extra-12.0.1.src.tar.xz) = be4975c81c83f98deb5f6e0cc170fb6740bc46396d5bd8f25b55270ed874bb099b6d6f0e413617396f5ab67182314735580f44be1913d9be44ae288cf8c4fd7c
SHA512 (clang-tools-extra-12.0.1.src.tar.xz.sig) = ae418961ea307fcf65bf427d1d9e9ae966d3fbc48787c1683bc72bbb9019b1958880a39e39502dd1e45f7c42736377d35f1e0ae9ad013627313d58d82de9b41a
SHA512 (llvm-12.0.1.src.tar.xz) = ff674afb4c8eea699a4756f1bb463f15098a7fa354c733de83c024f8f0cf238cd5f19ae3ec446831c7109235e293e2bf31d8562567ede163c8ec53af7306ba0f