12.0.0 Release

Related: rhbz#1928132
This commit is contained in:
Tom Stellard 2021-02-10 05:48:42 -08:00
parent a331ce6981
commit 50d4f87e06
33 changed files with 708 additions and 336 deletions

24
.gitignore vendored
View File

@ -143,3 +143,27 @@
/clang-tools-extra-11.1.0rc2.src.tar.xz
/clang-tools-extra-11.1.0rc2.src.tar.xz.sig
/clang-11.1.0rc2.src.tar.xz.sig
/clang-12.0.0rc1.src.tar.xz
/clang-tools-extra-12.0.0rc1.src.tar.xz
/clang-tools-extra-12.0.0rc1.src.tar.xz.sig
/clang-12.0.0rc1.src.tar.xz.sig
/clang-12.0.0rc2.src.tar.xz
/clang-tools-extra-12.0.0rc2.src.tar.xz
/clang-tools-extra-12.0.0rc2.src.tar.xz.sig
/clang-12.0.0rc2.src.tar.xz.sig
/clang-12.0.0rc3.src.tar.xz
/clang-12.0.0rc3.src.tar.xz.sig
/clang-tools-extra-12.0.0rc3.src.tar.xz
/clang-tools-extra-12.0.0rc3.src.tar.xz.sig
/clang-12.0.0rc4.src.tar.xz
/clang-tools-extra-12.0.0rc4.src.tar.xz
/clang-tools-extra-12.0.0rc4.src.tar.xz.sig
/clang-12.0.0rc4.src.tar.xz.sig
/clang-12.0.0rc5.src.tar.xz
/clang-tools-extra-12.0.0rc5.src.tar.xz
/clang-tools-extra-12.0.0rc5.src.tar.xz.sig
/clang-12.0.0rc5.src.tar.xz.sig
/clang-12.0.0.src.tar.xz
/clang-12.0.0.src.tar.xz.sig
/clang-tools-extra-12.0.0.src.tar.xz
/clang-tools-extra-12.0.0.src.tar.xz.sig

View File

@ -1,17 +1,17 @@
From 1f26a0284925859b72ee520ce74452d77d822409 Mon Sep 17 00:00:00 2001
From c6b921c8d833546946b70a8c2640032fd7c62461 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@redhat.com>
Date: Mon, 28 Jan 2019 19:12:27 +0000
Subject: [PATCH 2/2] [PATCH] gtest reorg
Date: Thu, 25 Feb 2021 14:04:52 +0100
Subject: [PATCH 1/6] [PATCH][clang] Reorganize gtest integration
---
CMakeLists.txt | 12 +++++-------
clang/CMakeLists.txt | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2016a45ca..48ea3c3bb9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -157,12 +157,6 @@ Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
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()
@ -24,7 +24,7 @@ index c2016a45ca..48ea3c3bb9 100644
else()
# Seek installed Lit.
find_program(LLVM_LIT
@@ -507,7 +501,11 @@ endif()
@@ -537,7 +531,11 @@ endif()
if( CLANG_INCLUDE_TESTS )
@ -38,5 +38,5 @@ index c2016a45ca..48ea3c3bb9 100644
list(APPEND CLANG_TEST_DEPS ClangUnitTests)
list(APPEND CLANG_TEST_PARAMS
--
2.19.2
1.8.3.1

View File

@ -0,0 +1,31 @@
From 84e4fe467f290c85b3d7d22c7333d192e1282054 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@redhat.com>
Date: Wed, 17 Mar 2021 08:32:56 +0100
Subject: [PATCH] [PATCH][clang-tools-extra] Make clangd CompletionModel usable
even with non-standard (but supported) layout
llvm supports specifying a non-standard layout where each project lies in its
own place. Do not assume a fixed layout and use the appropriate cmake variable
instead.
---
clang-tools-extra/clangd/quality/CompletionModel.cmake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang-tools-extra/clangd/quality/CompletionModel.cmake b/clang-tools-extra/clangd/quality/CompletionModel.cmake
index 60c6d2a..41bc2ed 100644
--- a/clang-tools-extra/clangd/quality/CompletionModel.cmake
+++ b/clang-tools-extra/clangd/quality/CompletionModel.cmake
@@ -5,8 +5,8 @@
# will define a C++ class called ${cpp_class} - which may be a
# namespace-qualified class name.
function(gen_decision_forest model filename cpp_class)
- set(model_compiler ${CMAKE_SOURCE_DIR}/../clang-tools-extra/clangd/quality/CompletionModelCodegen.py)
-
+ set(model_compiler ${LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR}/clangd/quality/CompletionModelCodegen.py)
+
set(output_dir ${CMAKE_CURRENT_BINARY_DIR})
set(header_file ${output_dir}/${filename}.h)
set(cpp_file ${output_dir}/${filename}.cpp)
--
1.8.3.1

View File

@ -1,50 +0,0 @@
From 09ae3ef5710a89505318ec721c65b6c838147276 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Thu, 7 Feb 2019 21:05:37 -0800
Subject: [PATCH] ToolChain: Add -lgcc_s to the linker flags when using libc++
The libc++ build for Fedora does not include an implementation of
libunwind, so we need to explicitly link against something that
provides this implementation.
---
clang/lib/Driver/ToolChain.cpp | 1 +
clang/test/Driver/netbsd.cpp | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index 88a627e..cb99844 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -767,6 +767,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
switch (Type) {
case ToolChain::CST_Libcxx:
CmdArgs.push_back("-lc++");
+ CmdArgs.push_back("-lgcc_s");
break;
case ToolChain::CST_Libstdcxx:
diff --git a/test/Driver/netbsd.cpp b/test/Driver/netbsd.cpp
index 4af7d83..ff18c62 100644
--- a/test/Driver/netbsd.cpp
+++ b/test/Driver/netbsd.cpp
@@ -131,7 +131,7 @@
// ARM-7: clang{{.*}}" "-cc1" "-triple" "armv5e-unknown-netbsd7.0.0-eabi"
// ARM-7: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
// ARM-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}eabi{{/|\\\\}}crti.o"
-// ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lm" "-lc"
+// ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lgcc_s" "-lm" "-lc"
// ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
// AARCH64: clang{{.*}}" "-cc1" "-triple" "aarch64-unknown-netbsd"
@@ -250,7 +250,7 @@
// S-ARM-7: clang{{.*}}" "-cc1" "-triple" "armv5e-unknown-netbsd7.0.0-eabi"
// S-ARM-7: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
// S-ARM-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}eabi{{/|\\\\}}crti.o"
-// S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lm" "-lc"
+// S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lgcc_s" "-lm" "-lc"
// S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
// S-AARCH64: clang{{.*}}" "-cc1" "-triple" "aarch64-unknown-netbsd"
--
1.8.3.1

View File

@ -1,25 +0,0 @@
From 5bfce60443b1c3f4066f506e47cbdc7c4263bb10 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Tue, 11 Aug 2020 18:32:08 -0700
Subject: [PATCH] clang: Fix spurious test failure
---
clang/test/Driver/crash-report-modules.m | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/test/Driver/crash-report-modules.m b/clang/test/Driver/crash-report-modules.m
index e6d03353379..9519adf6f4b 100644
--- a/clang/test/Driver/crash-report-modules.m
+++ b/clang/test/Driver/crash-report-modules.m
@@ -19,7 +19,7 @@
@import simple;
const int x = MODULE_MACRO;
-// CHECK: PLEASE submit a bug report to {{.*}} and include the crash backtrace, preprocessed source, and associated run script.
+// CHECK: PLEASE submit a bug report to {{.*}}and include the crash backtrace, preprocessed source, and associated run script.
// CHECK: Preprocessed source(s) and associated run script(s) are located at:
// CHECK-NEXT: note: diagnostic msg: {{.*}}.m
// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
--
2.18.1

View File

@ -1,47 +0,0 @@
From ad7211df6f257e39da2e5a11b2456b4488f32a1e Mon Sep 17 00:00:00 2001
From: Oliver Bruns <obruns@gmail.com>
Date: Mon, 6 Apr 2020 10:38:30 +0200
Subject: [PATCH] [clang] fix undefined behaviour in
RawComment::getFormattedText()
Summary:
Calling `back()` and `pop_back()` on the empty string is undefined
behavior [1,2].
The issue manifested itself as an uncaught `std::out_of_range` exception
when running `clangd` compiled on RHEL7 using devtoolset-9.
[1] https://en.cppreference.com/w/cpp/string/basic_string/back
[2] https://en.cppreference.com/w/cpp/string/basic_string/pop_back
Fixes: 1ff7c32fc91c607b690d4bb9cf42f406be8dde68
Reviewers: teemperor, ioeric, cfe-commits
Reviewed By: teemperor
Subscribers: ilya-biryukov, kadircet, usaxena95
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77468
---
clang/lib/AST/RawCommentList.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/AST/RawCommentList.cpp b/clang/lib/AST/RawCommentList.cpp
index 8552b4fcd2b..a8d15036cab 100644
--- a/clang/lib/AST/RawCommentList.cpp
+++ b/clang/lib/AST/RawCommentList.cpp
@@ -431,7 +431,7 @@ std::string RawComment::getFormattedText(const SourceManager &SourceMgr,
};
auto DropTrailingNewLines = [](std::string &Str) {
- while (Str.back() == '\n')
+ while (!Str.empty() && Str.back() == '\n')
Str.pop_back();
};
--
2.25.2

View File

@ -1,99 +0,0 @@
From 11857d49948b845dcfd7c7f78595095e3add012d Mon Sep 17 00:00:00 2001
From: Rong Xu <xur@google.com>
Date: Tue, 25 Feb 2020 08:04:01 -0800
Subject: [PATCH] [remark][diagnostics] [codegen] Fix PR44896
This patch fixes PR44896. For IR input files, option fdiscard-value-names
should be ignored as we need named values in loadModule().
Commit 60d3947922 sets this option after loadModule() where valued names
already created. This creates an inconsistent state in setNameImpl()
that leads to a seg fault.
This patch forces fdiscard-value-names to be false for IR input files.
This patch also emits a warning of "ignoring -fdiscard-value-names" if
option fdiscard-value-names is explictly enabled in the commandline for
IR input files.
Differential Revision: https://reviews.llvm.org/D74878
---
clang/include/clang/Basic/DiagnosticDriverKinds.td | 3 +++
clang/lib/CodeGen/CodeGenAction.cpp | 3 +++
clang/lib/Driver/ToolChains/Clang.cpp | 10 +++++++++-
clang/test/CodeGen/PR44896.ll | 15 +++++++++++++++
4 files changed, 30 insertions(+), 1 deletion(-)
create mode 100644 clang/test/CodeGen/PR44896.ll
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index ecd871e..48ece91 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -271,6 +271,9 @@ def warn_drv_unsupported_debug_info_opt_for_target : Warning<
InGroup<UnsupportedTargetOpt>;
def warn_c_kext : Warning<
"ignoring -fapple-kext which is valid for C++ and Objective-C++ only">;
+def warn_ignoring_fdiscard_for_bitcode : Warning<
+ "ignoring -fdiscard-value-names for LLVM Bitcode">,
+ InGroup<UnusedCommandLineArgument>;
def warn_drv_input_file_unused : Warning<
"%0: '%1' input unused%select{ when '%3' is present|}2">,
InGroup<UnusedCommandLineArgument>;
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp
index 5ebc34c..81946b1 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -1146,6 +1146,9 @@ void CodeGenAction::ExecuteAction() {
CI.getTargetOpts(), CI.getLangOpts(),
CI.getFrontendOpts().ShowTimers,
std::move(LinkModules), *VMContext, nullptr);
+ // PR44896: Force DiscardValueNames as false. DiscardValueNames cannot be
+ // true here because the valued names are needed for reading textual IR.
+ Ctx.setDiscardValueNames(false);
Ctx.setDiagnosticHandler(
std::make_unique<ClangDiagnosticHandler>(CodeGenOpts, &Result));
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 19a23c9..d387a1d 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4332,8 +4332,16 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// Discard value names in assert builds unless otherwise specified.
if (Args.hasFlag(options::OPT_fdiscard_value_names,
- options::OPT_fno_discard_value_names, !IsAssertBuild))
+ options::OPT_fno_discard_value_names, !IsAssertBuild)) {
+ if (Args.hasArg(options::OPT_fdiscard_value_names) &&
+ (std::any_of(Inputs.begin(), Inputs.end(),
+ [](const clang::driver::InputInfo &II) {
+ return types::isLLVMIR(II.getType());
+ }))) {
+ D.Diag(diag::warn_ignoring_fdiscard_for_bitcode);
+ }
CmdArgs.push_back("-discard-value-names");
+ }
// Set the main file name, so that debug info works even with
// -save-temps.
diff --git a/clang/test/CodeGen/PR44896.ll b/clang/test/CodeGen/PR44896.ll
new file mode 100644
index 0000000..a4d3445
--- /dev/null
+++ b/clang/test/CodeGen/PR44896.ll
@@ -0,0 +1,15 @@
+; RUN: %clang -fdiscard-value-names -S %s -o /dev/null 2>&1 | FileCheck --check-prefix=WARNING %s
+; RUN: %clang -S %s -o /dev/null 2>&1 | FileCheck --check-prefix=NOWARNING %s
+; RUN: %clang_cc1 -S -emit-llvm %s -discard-value-names -o /dev/null
+; PR 44896
+
+; WARNING: ignoring -fdiscard-value-names for LLVM Bitcode
+; NOWARNING-NOT: ignoring -fdiscard-value-names for LLVM Bitcode
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64--linux-gnu"
+
+define linkonce i8* @b(i8* %a) {
+ ret i8* %a
+}
+
--
1.8.3.1

View File

@ -1,7 +1,8 @@
From 690373af5a5d50cf115ed6e4d2849bb786f9dc8e Mon Sep 17 00:00:00 2001
From 07b062e1f7c3359550aa8c0a7b86f6054971439d Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@redhat.com>
Date: Tue, 10 Dec 2019 09:18:03 +0000
Subject: [PATCH] Make -funwind-tables the default for all archs
Date: Thu, 25 Feb 2021 14:09:29 +0100
Subject: [PATCH 2/6] [PATCH][clang] Make -funwind-tables the default on all
archs
---
clang/lib/Driver/ToolChain.cpp | 2 +-
@ -9,10 +10,10 @@ Subject: [PATCH] Make -funwind-tables the default for all archs
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index b1fddb0af55..43af40ed0e8 100644
index b2ddef1..715b323 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -244,7 +244,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const {
@@ -257,7 +257,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const {
}
bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const {
@ -22,18 +23,18 @@ index b1fddb0af55..43af40ed0e8 100644
Tool *ToolChain::getClang() const {
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 33cdd3585c2..15e82be8f3a 100644
index 1d8a3cd..5deeb10 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2535,7 +2535,7 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const {
@@ -2713,7 +2713,7 @@ bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const {
case llvm::Triple::x86_64:
return true;
default:
- return false;
+ return true;
}
}
bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const {
- return getArch() == llvm::Triple::x86_64;
+ return true;
}
bool Generic_GCC::isPICDefault() const {
--
2.20.1
1.8.3.1

View File

@ -1,14 +1,14 @@
From 8097a9d4295dbc39cbd541ccace7bc5884852366 Mon Sep 17 00:00:00 2001
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] clang: Don't install static libraries
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 704278a0e93..1737b24a2bc 100644
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)
@ -21,5 +21,5 @@ index 704278a0e93..1737b24a2bc 100644
if(${lib} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
"clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
--
2.18.1
1.8.3.1

View File

@ -1,8 +1,8 @@
From 67013ee5feecca0c1e1dd8a149b20779a9b6c12a Mon Sep 17 00:00:00 2001
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] Driver: Prefer gcc toolchains with libgcc_s.so when not
static linking libgcc
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
@ -21,22 +21,22 @@ This patch fixes this by checking for the existence of libgcc_s.so
when it is required and taking that into account when selecting a
toolchain.
---
lib/Driver/ToolChains/Gnu.cpp | 16 ++++++++++++++--
lib/Driver/ToolChains/Gnu.h | 4 +++-
.../usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o | 0
.../usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o | 0
.../lib/gcc/x86_64-redhat-linux/7/libgcc_s.so | 0
test/Driver/linux-ld.c | 12 ++++++++++++
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 test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o
create mode 100644 test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o
create mode 100644 test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so
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/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
index c8a7fce0..f28792b7 100644
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -2500,6 +2500,8 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
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)}};
@ -45,7 +45,7 @@ index c8a7fce0..f28792b7 100644
for (auto &Suffix : Suffixes) {
if (!Suffix.Active)
continue;
@@ -2517,8 +2519,17 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
@@ -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;
@ -65,7 +65,7 @@ index c8a7fce0..f28792b7 100644
if (!ScanGCCForMultilibs(TargetTriple, Args, LI->path(),
NeedsBiarchSuffix))
@@ -2532,6 +2543,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
@@ -2571,6 +2582,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
GCCInstallPath = (LibDir + "/" + LibSuffix + "/" + VersionText).str();
GCCParentLibPath = (GCCInstallPath + "/../" + Suffix.ReversePath).str();
IsValid = true;
@ -73,10 +73,10 @@ index c8a7fce0..f28792b7 100644
}
}
}
diff --git a/lib/Driver/ToolChains/Gnu.h b/lib/Driver/ToolChains/Gnu.h
index 52690ab4..2a4452d9 100644
--- a/lib/Driver/ToolChains/Gnu.h
+++ b/lib/Driver/ToolChains/Gnu.h
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 {
@ -85,8 +85,8 @@ index 52690ab4..2a4452d9 100644
llvm::Triple GCCTriple;
const Driver &D;
@@ -213,7 +214,8 @@ public:
MultilibSet Multilibs;
@@ -216,7 +217,8 @@ public:
const std::string GentooConfigDir = "/etc/env.d/gcc";
public:
- explicit GCCInstallationDetector(const Driver &D) : IsValid(false), D(D) {}
@ -95,19 +95,19 @@ index 52690ab4..2a4452d9 100644
void init(const llvm::Triple &TargetTriple, const llvm::opt::ArgList &Args,
ArrayRef<std::string> ExtraTripleAliases = None);
diff --git a/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o b/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o
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 00000000..e69de29b
diff --git a/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o b/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o
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 00000000..e69de29b
diff --git a/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so b/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so
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 00000000..e69de29b
diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c
index ec539522..95725d5c 100644
--- a/test/Driver/linux-ld.c
+++ b/test/Driver/linux-ld.c
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"
@ -128,5 +128,5 @@ index ec539522..95725d5c 100644
// RUN: --target=arm-unknown-linux-gnueabi -rtlib=platform \
// RUN: --gcc-toolchain="" \
--
2.25.2
1.8.3.1

View File

@ -0,0 +1,224 @@
From ea01f898fd74bae23d8be31f1a29b542e886e3a5 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Tue, 9 Feb 2021 13:35:43 -0800
Subject: [PATCH 5/6] [PATCH][clang] Partially Revert "scan-view: Remove
Reporter.py and associated AppleScript files"
This reverts some of commit dbb01536f6f49fa428f170e34466072ef439b3e9.
The Reporter module was still being used by the ScanView.py module and deleting
it caused scan-view to fail. This commit adds back Reporter.py but removes the
code the references the AppleScript files which were removed in
dbb01536f6f49fa428f170e34466072ef439b3e9.
Differential Revision: https://reviews.llvm.org/D96367
---
clang/tools/scan-view/CMakeLists.txt | 1 +
clang/tools/scan-view/share/Reporter.py | 183 ++++++++++++++++++++++++++++++++
2 files changed, 184 insertions(+)
create mode 100644 clang/tools/scan-view/share/Reporter.py
diff --git a/clang/tools/scan-view/CMakeLists.txt b/clang/tools/scan-view/CMakeLists.txt
index dd3d334..eccc6b8 100644
--- a/clang/tools/scan-view/CMakeLists.txt
+++ b/clang/tools/scan-view/CMakeLists.txt
@@ -5,6 +5,7 @@ set(BinFiles
set(ShareFiles
ScanView.py
+ Reporter.py
startfile.py
bugcatcher.ico)
diff --git a/clang/tools/scan-view/share/Reporter.py b/clang/tools/scan-view/share/Reporter.py
new file mode 100644
index 0000000..31a14fb
--- /dev/null
+++ b/clang/tools/scan-view/share/Reporter.py
@@ -0,0 +1,183 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""Methods for reporting bugs."""
+
+import subprocess, sys, os
+
+__all__ = ['ReportFailure', 'BugReport', 'getReporters']
+
+#
+
+class ReportFailure(Exception):
+ """Generic exception for failures in bug reporting."""
+ def __init__(self, value):
+ self.value = value
+
+# Collect information about a bug.
+
+class BugReport(object):
+ def __init__(self, title, description, files):
+ self.title = title
+ self.description = description
+ self.files = files
+
+# Reporter interfaces.
+
+import os
+
+import email, mimetypes, smtplib
+from email import encoders
+from email.message import Message
+from email.mime.base import MIMEBase
+from email.mime.multipart import MIMEMultipart
+from email.mime.text import MIMEText
+
+#===------------------------------------------------------------------------===#
+# ReporterParameter
+#===------------------------------------------------------------------------===#
+
+class ReporterParameter(object):
+ def __init__(self, n):
+ self.name = n
+ def getName(self):
+ return self.name
+ def getValue(self,r,bugtype,getConfigOption):
+ return getConfigOption(r.getName(),self.getName())
+ def saveConfigValue(self):
+ return True
+
+class TextParameter (ReporterParameter):
+ def getHTML(self,r,bugtype,getConfigOption):
+ return """\
+<tr>
+<td class="form_clabel">%s:</td>
+<td class="form_value"><input type="text" name="%s_%s" value="%s"></td>
+</tr>"""%(self.getName(),r.getName(),self.getName(),self.getValue(r,bugtype,getConfigOption))
+
+class SelectionParameter (ReporterParameter):
+ def __init__(self, n, values):
+ ReporterParameter.__init__(self,n)
+ self.values = values
+
+ def getHTML(self,r,bugtype,getConfigOption):
+ default = self.getValue(r,bugtype,getConfigOption)
+ return """\
+<tr>
+<td class="form_clabel">%s:</td><td class="form_value"><select name="%s_%s">
+%s
+</select></td>"""%(self.getName(),r.getName(),self.getName(),'\n'.join(["""\
+<option value="%s"%s>%s</option>"""%(o[0],
+ o[0] == default and ' selected="selected"' or '',
+ o[1]) for o in self.values]))
+
+#===------------------------------------------------------------------------===#
+# Reporters
+#===------------------------------------------------------------------------===#
+
+class EmailReporter(object):
+ def getName(self):
+ return 'Email'
+
+ def getParameters(self):
+ return [TextParameter(x) for x in ['To', 'From', 'SMTP Server', 'SMTP Port']]
+
+ # Lifted from python email module examples.
+ def attachFile(self, outer, path):
+ # Guess the content type based on the file's extension. Encoding
+ # will be ignored, although we should check for simple things like
+ # gzip'd or compressed files.
+ ctype, encoding = mimetypes.guess_type(path)
+ if ctype is None or encoding is not None:
+ # No guess could be made, or the file is encoded (compressed), so
+ # use a generic bag-of-bits type.
+ ctype = 'application/octet-stream'
+ maintype, subtype = ctype.split('/', 1)
+ if maintype == 'text':
+ fp = open(path)
+ # Note: we should handle calculating the charset
+ msg = MIMEText(fp.read(), _subtype=subtype)
+ fp.close()
+ else:
+ fp = open(path, 'rb')
+ msg = MIMEBase(maintype, subtype)
+ msg.set_payload(fp.read())
+ fp.close()
+ # Encode the payload using Base64
+ encoders.encode_base64(msg)
+ # Set the filename parameter
+ msg.add_header('Content-Disposition', 'attachment', filename=os.path.basename(path))
+ outer.attach(msg)
+
+ def fileReport(self, report, parameters):
+ mainMsg = """\
+BUG REPORT
+---
+Title: %s
+Description: %s
+"""%(report.title, report.description)
+
+ if not parameters.get('To'):
+ raise ReportFailure('No "To" address specified.')
+ if not parameters.get('From'):
+ raise ReportFailure('No "From" address specified.')
+
+ msg = MIMEMultipart()
+ msg['Subject'] = 'BUG REPORT: %s'%(report.title)
+ # FIXME: Get config parameters
+ msg['To'] = parameters.get('To')
+ msg['From'] = parameters.get('From')
+ msg.preamble = mainMsg
+
+ msg.attach(MIMEText(mainMsg, _subtype='text/plain'))
+ for file in report.files:
+ self.attachFile(msg, file)
+
+ try:
+ s = smtplib.SMTP(host=parameters.get('SMTP Server'),
+ port=parameters.get('SMTP Port'))
+ s.sendmail(msg['From'], msg['To'], msg.as_string())
+ s.close()
+ except:
+ raise ReportFailure('Unable to send message via SMTP.')
+
+ return "Message sent!"
+
+class BugzillaReporter(object):
+ def getName(self):
+ return 'Bugzilla'
+
+ def getParameters(self):
+ return [TextParameter(x) for x in ['URL','Product']]
+
+ def fileReport(self, report, parameters):
+ raise NotImplementedError
+
+
+class RadarClassificationParameter(SelectionParameter):
+ def __init__(self):
+ SelectionParameter.__init__(self,"Classification",
+ [['1', 'Security'], ['2', 'Crash/Hang/Data Loss'],
+ ['3', 'Performance'], ['4', 'UI/Usability'],
+ ['6', 'Serious Bug'], ['7', 'Other']])
+
+ def saveConfigValue(self):
+ return False
+
+ def getValue(self,r,bugtype,getConfigOption):
+ if bugtype.find("leak") != -1:
+ return '3'
+ elif bugtype.find("dereference") != -1:
+ return '2'
+ elif bugtype.find("missing ivar release") != -1:
+ return '3'
+ else:
+ return '7'
+
+###
+
+def getReporters():
+ reporters = []
+ reporters.append(EmailReporter())
+ return reporters
+
--
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

3
clang.rpmlintrc Normal file
View File

@ -0,0 +1,3 @@
# clang needs libstdc++-devel installed in order to compile c++ programs.
addFilter("E: devel-dependency libstdc\+\+-devel")
addFilter("E: explicit-lib-dependency libstdc\+\+-devel")

View File

@ -1,10 +1,9 @@
%global compat_build 0
%global maj_ver 11
%global min_ver 1
%global maj_ver 12
%global min_ver 0
%global patch_ver 0
%global rc_ver 2
%global baserelease 5
#%%global rc_ver 5
%global clang_tools_binaries \
%{_bindir}/clang-apply-replacements \
@ -37,16 +36,16 @@
%{_bindir}/clang-cpp \
%if 0%{?compat_build}
%global pkg_name clang%{maj_ver}.%{min_ver}
%global pkg_name clang%{maj_ver}
# Install clang to same prefix as llvm, so that apps that use llvm-config
# will also be able to find clang libs.
%global install_prefix %{_libdir}/llvm%{maj_ver}.%{min_ver}
%global install_prefix %{_libdir}/llvm%{maj_ver}
%global install_bindir %{install_prefix}/bin
%global install_includedir %{install_prefix}/include
%global install_libdir %{install_prefix}/lib
%global pkg_bindir %{install_bindir}
%global pkg_includedir %{_includedir}/llvm%{maj_ver}.%{min_ver}
%global pkg_includedir %{install_includedir}
%global pkg_libdir %{install_libdir}
%else
%global pkg_name clang
@ -71,8 +70,8 @@
%global clang_tools_srcdir clang-tools-extra-%{version}%{?rc_ver:rc%{rc_ver}}.src
Name: %pkg_name
Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: %{?rc_ver:0.}%{baserelease}%{?rc_ver:.rc%{rc_ver}}%{?dist}
Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}
Release: 1%{?dist}
Summary: A C language family front-end for LLVM
License: NCSA
@ -85,22 +84,26 @@ Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{versio
%endif
Source4: tstellar-gpg-key.asc
Patch4: 0002-gtest-reorg.patch
Patch11: 0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch
Patch13: 0001-Make-funwind-tables-the-default-for-all-archs.patch
# Patches for clang
Patch0: 0001-PATCH-clang-Reorganize-gtest-integration.patch
Patch1: 0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
Patch2: 0003-PATCH-clang-Don-t-install-static-libraries.patch
Patch3: 0004-PATCH-clang-Prefer-gcc-toolchains-with-libgcc_s.so-w.patch
Patch4: 0005-PATCH-clang-Partially-Revert-scan-view-Remove-Report.patch
Patch5: 0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch
# Not Upstream
Patch15: 0001-clang-Don-t-install-static-libraries.patch
Patch16: 0001-clang-Fix-spurious-test-failure.patch
Patch17: 0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch
# Patches for clang-tools-extra
%if !0%{?compat_build}
Patch201: 0001-PATCH-clang-tools-extra-Make-clangd-CompletionModel-.patch
%endif
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: ninja-build
%if 0%{?compat_build}
BuildRequires: llvm%{maj_ver}.%{min_ver}-devel = %{version}
BuildRequires: llvm%{maj_ver}.%{min_ver}-static = %{version}
BuildRequires: llvm%{maj_ver}-devel = %{version}
BuildRequires: llvm%{maj_ver}-static = %{version}
%else
BuildRequires: llvm-devel = %{version}
BuildRequires: llvm-test = %{version}
@ -129,6 +132,13 @@ BuildRequires: libatomic
# We need python3-devel for pathfix.py.
BuildRequires: python3-devel
# For reproducible pyc file generation
# See https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_Appendix/#_byte_compilation_reproducibility
%if 0%{?fedora}
BuildRequires: /usr/bin/marshalparser
%global py_reproducible_pyc_path %{buildroot}%{python3_sitelib}
%endif
# Needed for %%multilib_fix_c_header
BuildRequires: multilib-rpm-config
@ -256,27 +266,25 @@ Requires: python3
%{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE3}' --data='%{SOURCE0}'
%if 0%{?compat_build}
%autosetup -n %{clang_srcdir} -p1
%autosetup -n %{clang_srcdir} -p2
%else
%{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE2}' --data='%{SOURCE1}'
%setup -T -q -b 1 -n %{clang_tools_srcdir}
%autopatch -m200 -p2
# failing test case
rm test/clang-tidy/checkers/altera-struct-pack-align.cpp
pathfix.py -i %{__python3} -pn \
clang-tidy/tool/*.py \
clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py
%setup -q -n %{clang_srcdir}
%autopatch -M200 -p2
%patch4 -p1 -b .gtest
%patch11 -p1 -b .libcxx-fix
%patch13 -p2 -b .unwind-all
%patch15 -p2 -b .no-install-static
%patch16 -p2 -b .test-fix2
%patch17 -p1 -b .check-gcc_s
mv ../%{clang_tools_srcdir} tools/extra
# failing test case
rm test/CodeGen/profile-filter.c
pathfix.py -i %{__python3} -pn \
tools/clang-format/*.py \
@ -325,11 +333,13 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
%endif
%if 0%{?compat_build}
-DLLVM_CONFIG:FILEPATH=%{_bindir}/llvm-config-%{maj_ver}.%{min_ver}-%{__isa_bits} \
-DCLANG_BUILD_TOOLS:BOOL=OFF \
-DLLVM_CONFIG:FILEPATH=%{_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} \
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \
-DCLANG_INCLUDE_TESTS:BOOL=OFF \
%else
-DCLANG_INCLUDE_TESTS:BOOL=ON \
-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=../%{clang_tools_srcdir} \
-DLLVM_EXTERNAL_LIT=%{_bindir}/lit \
-DLLVM_MAIN_SRC_DIR=%{_datadir}/llvm/src \
%if 0%{?__isa_bits} == 64
@ -339,10 +349,10 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
%endif
%endif
\
%if !0%{compat_build}
-DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen \
%if 0%{compat_build}
-DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen-%{maj_ver} \
%else
-DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen-%{maj_ver}.%{min_ver} \
-DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen \
%endif
-DCLANG_ENABLE_ARCMT:BOOL=ON \
-DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON \
@ -358,7 +368,8 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
\
-DCLANG_BUILD_EXAMPLES:BOOL=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DCLANG_REPOSITORY_STRING="%{?fedora:Fedora}%{?rhel:Red Hat} %{version}-%{release}"
-DCLANG_REPOSITORY_STRING="%{?fedora:Fedora}%{?rhel:Red Hat} %{version}-%{release}" \
-DCLANG_DEFAULT_UNWINDLIB=libgcc
%cmake_build
@ -436,6 +447,9 @@ mkdir -p %{buildroot}%{_libdir}/clang/%{version}/{include,lib,share}/
# Remove clang-tidy headers. We don't ship the libraries for these.
rm -Rvf %{buildroot}%{_includedir}/clang-tidy/
# Add a symlink in /usr/bin to clang-format-diff
ln -s %{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format-diff
%check
%if !0%{?compat_build}
# requires lit.py from LLVM utilities
@ -507,6 +521,7 @@ false
%{_bindir}/c-index-test
%{_bindir}/find-all-symbols
%{_bindir}/modularize
%{_bindir}/clang-format-diff
%{_mandir}/man1/diagtool.1.gz
%{_emacs_sitestartdir}/clang-format.el
%{_emacs_sitestartdir}/clang-rename.el
@ -528,6 +543,9 @@ false
%endif
%changelog
* Fri Apr 16 2021 Tom Stellard <tstellar@redhat.cm> - 12.0.0-1
- 12.0.0 Release
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 11.1.0-0.5.rc2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937

View File

@ -1,4 +1,4 @@
SHA512 (clang-11.1.0rc2.src.tar.xz) = cae207e69b6d7df31303b1c73d55d82091babedbe0dc684aab1b603ce7e749d98a11a14ae9e3848dcb95a5840b38de56f407dda10b8b80eac3a6ce09ca44758a
SHA512 (clang-tools-extra-11.1.0rc2.src.tar.xz) = 462a15d571b0f7bb02641cf1ebfa8e510c6877839f6cdae48a8535ef481ec4ffdcf062fc7cfd8ea791bc4f8dff45f2104151cae6fa94d1091f995bcf8b87c0e5
SHA512 (clang-tools-extra-11.1.0rc2.src.tar.xz.sig) = 7cb6632673c9739c87f1a8cc643e7f5583b52fc893d489d738216b423ceba6e97454323674cf0ee178e4141171d24eefc1b0786fad84efcb2bdb27d6033393b3
SHA512 (clang-11.1.0rc2.src.tar.xz.sig) = 4921b2c4ef64c57d7135989349da8999b621c182362c0edabb23c67192052729afc9ba09888ee683cb10e39d5645250b1b62100c22ded8ac05f1ca0ba36b8e64
SHA512 (clang-12.0.0.src.tar.xz) = f5613b9bffc962467d3bedb7f66b4e057e2781eb63c5dadfd3cf0b02453e29eff0a4f844889031292f06a8b4c081d4d41c515b7f719826ce5c4209a09df9f1f6
SHA512 (clang-12.0.0.src.tar.xz.sig) = 9780c2f68dfd7ea633dd137dda265ffda6425be658b0724e25dadb6abc54d3368e7850687ce38f4c3bf0c7049a2c1bd2fb299cec5f548c38f3bc4ca1f8877437
SHA512 (clang-tools-extra-12.0.0.src.tar.xz) = e0323a2506da748b5de32a3df53a987f3f74184c2d02d4e7b173e23e54396427e2d9b6600a7962795020bfc2c0dae16b210a69a4b8784086d1470d88f423c330
SHA512 (clang-tools-extra-12.0.0.src.tar.xz.sig) = 30afa9c2411417c30a47dcdcfe97ebf353ad1de1a98ed82d45bdfb3fafc30dcb335f6fd18ff3b44e2ed34ff5137932e3a4675289242712df01b8b6da8877fcef

View File

@ -0,0 +1,7 @@
#!/bin/bash
set -ex
# Check that clang-format-diff is in PATH.
# rhbz#1939018
clang-format-diff -h

View File

@ -0,0 +1,5 @@
#include <stdio.h>
void hello() {
printf("Hello World\n");
}

View File

@ -0,0 +1,5 @@
#include <iostream>
void hello() {
std::cout << "Hello World\n";
}

View File

@ -0,0 +1,6 @@
void hello();
int main(int argc, char **argv) {
hello();
return 0;
}

View File

@ -0,0 +1,6 @@
void hello();
int main(int argc, char **argv) {
hello();
return 0;
}

20
tests/fedora-flags/runtest.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
set -ex pipefail
cflags=`rpm -D '%toolchain clang' -E %{build_cflags}`
cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}`
ldflags=`rpm -D '%toolchain clang' -E %{build_ldflags}`
# Test a c program
clang $cflags -c hello.c -o hello.o
clang $cflags -c main.c -o main.o
clang $ldflags -o hello main.o hello.o
./hello | grep "Hello World"
# Test a cxx program
clang++ $cxxflags -c hello.cpp -o hello-cpp.o
clang++ $cxxflags -c main.cpp -o main-cpp.o
clang++ $ldflags -o hello-cpp main-cpp.o hello-cpp.o
./hello-cpp | grep "Hello World"

View File

@ -0,0 +1,8 @@
#include <omp.h>
#include <stdio.h>
int main(int argc, char **argv) {
int nthreads = omp_get_num_threads();
printf("Num Threads: %d\n", nthreads);
return 0;
}

7
tests/libomp/runtest.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -exo pipefail
clang -fopenmp openmp-compile-link-test.c
./a.out | grep "Num Threads: 1"

29
tests/llvm-toolchain/runtest.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
# Tests for using a full LLVM toolchain: clang + compiler-rt + libcxx + lld
set -ex pipefail
# Test compile a C program.
cat << EOF | \
clang -fuse-ld=lld -rtlib=compiler-rt -x c - && \
./a.out | grep 'Hello World'
#include<stdio.h>
int main(int argc, char **argv) {
printf("Hello World\n");
return 0;
}
EOF
# Test compile a C++ program.
cat << EOF | \
clang++ -x c++ -fuse-ld=lld -rtlib=compiler-rt -stdlib=libc++ - && \
./a.out | grep 'Hello World'
#include <iostream>
int main(int argc, char **argv) {
std::cout << "Hello World\n";
return 0;
}
EOF

10
tests/rhbz_1647130/runtest.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -e
set -x
tmp_cpp=`mktemp -t XXXXX.cpp`
tmp_dir=`mktemp -d`
echo 'int main(int argc, char*argv[]) { while(argc--) new int(); return 0; }' > $tmp_cpp
scan-build -o $tmp_dir clang++ -c $tmp_cpp -o /dev/null
(scan-view --no-browser $tmp_dir/* & WPID=$! && sleep 10s && kill $WPID)

View File

@ -0,0 +1,15 @@
#include <charconv>
#include <iostream>
#include <cstring>
using namespace std;
int main(int argc, char **argv)
{
size_t r=0;
const char *begin = argv[1];
const char *end = begin + strlen(begin);
from_chars(begin, end, r);
cout << r << '\n';
return 0;
}

6
tests/rhbz_1657544/runtest.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
set -e
set -x
clang++ from_chars.cpp
./a.out 100 | grep 100

View File

@ -15,10 +15,7 @@
- role: standard-test-basic
tags:
- classic
repositories:
- repo: "https://src.fedoraproject.org/tests/clang.git"
dest: "clang"
required_packages:
- clang
tests:
- clang/libomp
- libomp

View File

@ -17,25 +17,29 @@
- lld
- compiler-rt
- libcxx-devel
- libcxx-static
- glibc-devel
- glibc-static
- gcc
# Required for fedora-flags:
- annobin
- redhat-rpm-config
# Required for clang-format-diff
- clang-tools-extra
repositories:
- repo: "https://src.fedoraproject.org/tests/llvm-test-suite.git"
- repo: "https://src.fedoraproject.org/rpms/llvm-test-suite.git"
dest: "llvm-test-suite"
- repo: "https://src.fedoraproject.org/tests/clang.git"
dest: "clang"
tests:
- rhbz#482491:
dir: ./
run: find /usr -name 'libgcc_s.so*' && echo "int main(){}" | clang -v -x c -
- llvm-test-suite/test-suite
- llvm-test-suite/tests/test-suite
# ABI test suite is too greedy on the FS
#- llvm-test-suite/abi-test-suite
- clang/rhbz_1657544
- clang/rhbz_1647130
- clang/llvm-toolchain
- clang/fedora-flags
- rhbz_1657544
- rhbz_1647130
- llvm-toolchain
- fedora-flags
- toolchains
- clang-format-diff

View File

@ -17,7 +17,7 @@
tags:
- classic
repositories:
- repo: "https://src.fedoraproject.org/tests/pocl.git"
- repo: "https://src.fedoraproject.org/rpms/pocl.git"
dest: "pocl"
required_packages:
- ocl-icd-devel
@ -25,4 +25,4 @@
- gcc
tests:
# rhbz#1582884
- pocl/simple-opencl-no-clang:
- pocl/tests/simple-opencl-no-clang

5
tests/toolchains/hello.c Normal file
View File

@ -0,0 +1,5 @@
#include<stdio.h>
int main(int argc, char **argv) {
printf("Hello World\n");
return 0;
}

View File

@ -0,0 +1,5 @@
#include <iostream>
int main(int argc, char **argv) {
std::cout << "Hello World\n";
return 0;
}

80
tests/toolchains/runtest.sh Executable file
View File

@ -0,0 +1,80 @@
#!/bin/sh
set pipefail
status=0
test_toolchain() {
toolchain=$@
args=""
while [ $# -gt 0 ]; do
case $1 in
clang)
compiler=$1
src=hello.c
;;
clang++)
compiler=$1
src=hello.cpp
;;
compiler-rt)
args="$args -rtlib=$1"
;;
libc++)
args="$args -stdlib=$1"
;;
lld)
args="$args -fuse-ld=$1"
;;
*)
args="$args $1"
;;
esac
shift
done
cmd="$compiler $args $src"
rm -f a.out
echo "* $toolchain"
echo " command: $cmd"
if $cmd && ./a.out | grep -q 'Hello World'; then
echo " PASS"
else
echo " FAIL"
status=1
fi
}
clang --version
dnf info installed clang | grep ^Source
echo ""
for compiler in clang clang++; do
for rtlib in "" compiler-rt; do
for linker in "" lld; do
for cxxlib in "" libc++; do
if [ "$compiler" = "clang" -a -n "$cxxlib" ]; then
continue
fi
for args in "" -static; do
# Skip known failures
# TODO: Fix these
if [[ "$args" = "-static" && "$rtlib" = "compiler-rt" ]]; then
continue
fi
# Static libc++ needs -pthread
if [[ "$args" = "-static" && "$cxxlib" = "libc++" ]]; then
args="$args -pthread"
fi
test_toolchain $compiler $rtlib $linker $cxxlib $args
done
done
done
done
done
exit $status