import clang-12.0.1-5.el9

This commit is contained in:
CentOS Sources 2021-11-03 00:17:02 -04:00 committed by Stepan Oksanichenko
commit 62898e6df2
10 changed files with 1400 additions and 0 deletions

3
.clang.metadata Normal file
View File

@ -0,0 +1,3 @@
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

3
.gitignore vendored Normal file
View File

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

View File

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

View File

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

View File

@ -0,0 +1,25 @@
From 2c6cd40d016f492d53e16f1c7424a0d9878ae7ec 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
---
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

View File

@ -0,0 +1,132 @@
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

@ -0,0 +1,77 @@
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.

1089
SPECS/clang.spec Normal file

File diff suppressed because it is too large Load Diff