From 08bee7e51a143a8e3242cbaf705cb91343bd7caf Mon Sep 17 00:00:00 2001 From: sergesanspaille Date: Mar 17 2021 07:35:44 +0000 Subject: Simplify patch management through %autopatch --- diff --git a/0001-PATCH-clang-Reorganize-gtest-integration.patch b/0001-PATCH-clang-Reorganize-gtest-integration.patch index 3cfd780..e854f01 100644 --- a/0001-PATCH-clang-Reorganize-gtest-integration.patch +++ b/0001-PATCH-clang-Reorganize-gtest-integration.patch @@ -1,7 +1,7 @@ From c6b921c8d833546946b70a8c2640032fd7c62461 Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Thu, 25 Feb 2021 14:04:52 +0100 -Subject: [PATCH 1/7] [PATCH][clang] Reorganize gtest integration +Subject: [PATCH 1/6] [PATCH][clang] Reorganize gtest integration --- clang/CMakeLists.txt | 12 +++++------- diff --git a/0001-PATCH-clang-tools-extra-Make-clangd-CompletionModel-.patch b/0001-PATCH-clang-tools-extra-Make-clangd-CompletionModel-.patch new file mode 100644 index 0000000..4745e78 --- /dev/null +++ b/0001-PATCH-clang-tools-extra-Make-clangd-CompletionModel-.patch @@ -0,0 +1,31 @@ +From 84e4fe467f290c85b3d7d22c7333d192e1282054 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +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 + diff --git a/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch b/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch new file mode 100644 index 0000000..0a29dd4 --- /dev/null +++ b/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch @@ -0,0 +1,40 @@ +From 07b062e1f7c3359550aa8c0a7b86f6054971439d Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +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 +- + clang/lib/Driver/ToolChains/Gnu.cpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp +index b2ddef1..715b323 100644 +--- a/clang/lib/Driver/ToolChain.cpp ++++ b/clang/lib/Driver/ToolChain.cpp +@@ -257,7 +257,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const { + } + + bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const { +- return false; ++ return true; + } + + Tool *ToolChain::getClang() const { +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index 1d8a3cd..5deeb10 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2713,7 +2713,7 @@ bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const { + case llvm::Triple::x86_64: + return true; + default: +- return false; ++ return true; + } + } + +-- +1.8.3.1 + diff --git a/0003-PATCH-clang-Don-t-install-static-libraries.patch b/0003-PATCH-clang-Don-t-install-static-libraries.patch new file mode 100644 index 0000000..82f99a7 --- /dev/null +++ b/0003-PATCH-clang-Don-t-install-static-libraries.patch @@ -0,0 +1,25 @@ +From 2c6cd40d016f492d53e16f1c7424a0d9878ae7ec Mon Sep 17 00:00:00 2001 +From: Tom Stellard +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 + diff --git a/0003-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch b/0003-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch deleted file mode 100644 index e88997b..0000000 --- a/0003-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 8a4eb9e3fa9456de3da47115bdbd47dc552b5263 Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Thu, 25 Feb 2021 14:09:29 +0100 -Subject: [PATCH 3/7] [PATCH][clang] Make -funwind-tables the default on all - archs - ---- - clang/lib/Driver/ToolChain.cpp | 2 +- - clang/lib/Driver/ToolChains/Gnu.cpp | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp -index c4c71e1..d237cc6 100644 ---- a/clang/lib/Driver/ToolChain.cpp -+++ b/clang/lib/Driver/ToolChain.cpp -@@ -257,7 +257,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const { - } - - bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const { -- return false; -+ return true; - } - - Tool *ToolChain::getClang() const { -diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp -index 1d8a3cd..5deeb10 100644 ---- a/clang/lib/Driver/ToolChains/Gnu.cpp -+++ b/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -2713,7 +2713,7 @@ bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const { - case llvm::Triple::x86_64: - return true; - default: -- return false; -+ return true; - } - } - --- -1.8.3.1 - diff --git a/0004-PATCH-clang-Don-t-install-static-libraries.patch b/0004-PATCH-clang-Don-t-install-static-libraries.patch deleted file mode 100644 index 3bc4b0f..0000000 --- a/0004-PATCH-clang-Don-t-install-static-libraries.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 9e32a3c1481e5bccd951789bb3676cd8c85c0244 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Fri, 31 Jan 2020 11:04:57 -0800 -Subject: [PATCH 4/7] [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 - diff --git a/0004-PATCH-clang-Prefer-gcc-toolchains-with-libgcc_s.so-w.patch b/0004-PATCH-clang-Prefer-gcc-toolchains-with-libgcc_s.so-w.patch new file mode 100644 index 0000000..4f2cf39 --- /dev/null +++ b/0004-PATCH-clang-Prefer-gcc-toolchains-with-libgcc_s.so-w.patch @@ -0,0 +1,132 @@ +From d8af49687765744efaae7ba0f0c4c0fcd58a0e31 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +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 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 + diff --git a/0005-PATCH-clang-Partially-Revert-scan-view-Remove-Report.patch b/0005-PATCH-clang-Partially-Revert-scan-view-Remove-Report.patch new file mode 100644 index 0000000..868fe59 --- /dev/null +++ b/0005-PATCH-clang-Partially-Revert-scan-view-Remove-Report.patch @@ -0,0 +1,224 @@ +From ea01f898fd74bae23d8be31f1a29b542e886e3a5 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +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 """\ ++ ++%s: ++ ++"""%(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 """\ ++ ++%s:"""%(self.getName(),r.getName(),self.getName(),'\n'.join(["""\ ++"""%(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 + diff --git a/0005-PATCH-clang-Prefer-gcc-toolchains-with-libgcc_s.so-w.patch b/0005-PATCH-clang-Prefer-gcc-toolchains-with-libgcc_s.so-w.patch deleted file mode 100644 index 1cd7fc6..0000000 --- a/0005-PATCH-clang-Prefer-gcc-toolchains-with-libgcc_s.so-w.patch +++ /dev/null @@ -1,132 +0,0 @@ -From ca5dec7a5ec6ca29ee6c4f2a35aaec03ad2e8238 Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Wed, 23 Sep 2020 12:47:30 +0000 -Subject: [PATCH 5/7] [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 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 - diff --git a/0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch b/0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch new file mode 100644 index 0000000..91e82b5 --- /dev/null +++ b/0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch @@ -0,0 +1,77 @@ +From 1ef1e91142ac48ecb826f33e1e7072c7402d9fe7 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +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 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 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 struct __is_floating_point_helper {}; + template<> struct __is_floating_point_helper<__float128> {}; +-- +1.8.3.1 + diff --git a/0006-PATCH-clang-Partially-Revert-scan-view-Remove-Report.patch b/0006-PATCH-clang-Partially-Revert-scan-view-Remove-Report.patch deleted file mode 100644 index 12555ff..0000000 --- a/0006-PATCH-clang-Partially-Revert-scan-view-Remove-Report.patch +++ /dev/null @@ -1,224 +0,0 @@ -From 88134d9897dce14e34c51406320764356bfde6a4 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Tue, 9 Feb 2021 13:35:43 -0800 -Subject: [PATCH 6/7] [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 """\ -+ -+%s: -+ -+"""%(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 """\ -+ -+%s:"""%(self.getName(),r.getName(),self.getName(),'\n'.join(["""\ -+"""%(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 - diff --git a/0007-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch b/0007-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch deleted file mode 100644 index f667694..0000000 --- a/0007-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 7e0b36755d9bcccaddd1c4c1c69b1f12b729cf4e Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Mon, 15 Mar 2021 09:28:48 +0100 -Subject: [PATCH 7/7] [PATCH][clang] Allow __ieee128 as an alias to __float128 - on ppc - -This matches gcc behavior. - -Backported from https://reviews.llvm.org/D97846 ---- - 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 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 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 struct __is_floating_point_helper {}; - template<> struct __is_floating_point_helper<__float128> {}; --- -1.8.3.1 - diff --git a/clang.spec b/clang.spec index 7e3d55a..0998933 100644 --- a/clang.spec +++ b/clang.spec @@ -85,17 +85,19 @@ Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{versio %endif Source4: tstellar-gpg-key.asc +# 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 + +# Patches for clang-tools-extra %if !0%{?compat_build} -Patch21: completion-model-cmake.patch +Patch201: 0001-PATCH-clang-tools-extra-Make-clangd-CompletionModel-.patch %endif -Patch4: 0001-PATCH-clang-Reorganize-gtest-integration.patch -Patch13: 0003-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch -Patch15: 0004-PATCH-clang-Don-t-install-static-libraries.patch -Patch17: 0005-PATCH-clang-Prefer-gcc-toolchains-with-libgcc_s.so-w.patch -Patch19: 0006-PATCH-clang-Partially-Revert-scan-view-Remove-Report.patch -Patch20: 0007-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch - BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: cmake @@ -258,30 +260,22 @@ 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} -%patch21 -p1 -b .comp-model +%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} - -%patch4 -p2 -b .gtest -%patch13 -p2 -b .unwind-default -%patch15 -p2 -b .no-install-static -%patch17 -p2 -b .check-gcc_s -%patch19 -p2 -b .scan-view-remove-files-fix -%patch20 -p2 -b .ieee128 - +%autopatch -M200 -p2 # failing test case rm test/CodeGen/profile-filter.c diff --git a/completion-model-cmake.patch b/completion-model-cmake.patch deleted file mode 100644 index 925294d..0000000 --- a/completion-model-cmake.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -Naur clang-tools-extra-12.0.0rc1.src.orig/clangd/quality/CompletionModel.cmake clang-tools-extra-12.0.0rc1.src/clangd/quality/CompletionModel.cmake ---- clang-tools-extra-12.0.0rc1.src.orig/clangd/quality/CompletionModel.cmake 2021-02-14 17:03:14.000000000 +0100 -+++ clang-tools-extra-12.0.0rc1.src/clangd/quality/CompletionModel.cmake 2021-02-14 20:57:51.000000000 +0100 -@@ -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)