Update to 14.0.0

This commit is contained in:
Timm Bäder 2022-03-09 15:08:40 +01:00
parent 822eb1d32d
commit add0accd52
7 changed files with 246 additions and 49 deletions

View File

@ -1,36 +0,0 @@
From 62eaebcb6bb872830299efa3f87506f1d23ef366 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@redhat.com>
Date: Mon, 13 Sep 2021 10:25:45 +0200
Subject: [PATCH][clang] Fix scan-build-py executable lookup path
Once installed, scan-build-py doesn't know anything about its auxiliary
executable and can't find them.
Use relative path wrt. scan-build-py script.
Differential Revision: https://reviews.llvm.org/D109659
(cherry picked from commit c84755a046bbdcd0564693e30b2508034b06002b)
---
clang/tools/scan-build-py/lib/libscanbuild/analyze.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/clang/tools/scan-build-py/lib/libscanbuild/analyze.py b/clang/tools/scan-build-py/lib/libscanbuild/analyze.py
index 9a249a8..d83ff2a 100644
--- a/clang/tools/scan-build-py/lib/libscanbuild/analyze.py
+++ b/clang/tools/scan-build-py/lib/libscanbuild/analyze.py
@@ -39,8 +39,10 @@ from libscanbuild.shell import decode
__all__ = ['scan_build', 'analyze_build', 'analyze_compiler_wrapper']
-COMPILER_WRAPPER_CC = 'analyze-cc'
-COMPILER_WRAPPER_CXX = 'analyze-c++'
+scanbuild_dir = os.path.dirname(__import__('sys').argv[0])
+
+COMPILER_WRAPPER_CC = os.path.join(scanbuild_dir, '..', 'libexec', 'analyze-cc')
+COMPILER_WRAPPER_CXX = os.path.join(scanbuild_dir, '..', 'libexec', 'analyze-c++')
CTU_EXTDEF_MAP_FILENAME = 'externalDefMap.txt'
CTU_TEMP_DEFMAP_FOLDER = 'tmpExternalDefMaps'
--
1.8.3.1

View File

@ -7,18 +7,18 @@ Subject: [PATCH] [PATCH][clang] Make -funwind-tables the default on all archs
clang/lib/Driver/ToolChains/Gnu.cpp | 6 ++++++ clang/lib/Driver/ToolChains/Gnu.cpp | 6 ++++++
1 file changed, 6 insertions(+) 1 file changed, 6 insertions(+)
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp
index a27841dc5985..7489e6785150 100644 b/clang/lib/Driver/ToolChains/Gnu.cpp
index d0808d061c82..de9c9743cd38 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp --- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/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 { @@ -2701,6 +2701,11 @@ bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const {
case llvm::Triple::ppc64:
case llvm::Triple::ppc64le: case llvm::Triple::ppc64le:
case llvm::Triple::x86:
case llvm::Triple::x86_64: case llvm::Triple::x86_64:
+ +
+ // Enable -funwind-tables on all architectures supported by Fedora: + // Enable -funwind-tables on all architectures supported by Fedora:
+ // rhbz#1655546 + // rhbz#1655546
+ case llvm::Triple::x86:
+ case llvm::Triple::systemz: + case llvm::Triple::systemz:
+ case llvm::Triple::arm: + case llvm::Triple::arm:
return true; return true;

View File

@ -0,0 +1,86 @@
From 6509777d4c12a42c7487814d868375a86712bf5b Mon Sep 17 00:00:00 2001
From: Konrad Kleine <kkleine@redhat.com>
Date: Thu, 24 Mar 2022 09:44:21 +0100
Subject: [PATCH][clang]Produce DWARF4 by default
Have a look at the following commit to see when the move from DWARF 4 to 5 first happened upstream:
https://github.com/llvm/llvm-project/commit/d3b26dea16108c427b19b5480c9edc76edf8f5b4?diff=unified
---
clang/include/clang/Driver/ToolChain.h | 2 +-
clang/test/CodeGen/dwarf-version.c | 4 ++--
clang/test/Driver/cl-options.c | 2 +-
clang/test/Driver/ve-toolchain.c | 2 +-
clang/test/Driver/ve-toolchain.cpp | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
index adf1753e8d3a..c8adc4d917ce 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -515,7 +515,7 @@ public:
// Return the DWARF version to emit, in the absence of arguments
// to the contrary.
- virtual unsigned GetDefaultDwarfVersion() const { return 5; }
+ virtual unsigned GetDefaultDwarfVersion() const { return 4; }
// Some toolchains may have different restrictions on the DWARF version and
// may need to adjust it. E.g. NVPTX may need to enforce DWARF2 even when host
diff --git a/clang/test/CodeGen/dwarf-version.c b/clang/test/CodeGen/dwarf-version.c
index 0a6fa4768026..96f01749d0d8 100644
--- a/clang/test/CodeGen/dwarf-version.c
+++ b/clang/test/CodeGen/dwarf-version.c
@@ -2,8 +2,8 @@
// RUN: %clang -target x86_64-linux-gnu -gdwarf-3 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER3
// RUN: %clang -target x86_64-linux-gnu -gdwarf-4 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4
// RUN: %clang -target x86_64-linux-gnu -gdwarf-5 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
-// RUN: %clang -target x86_64-linux-gnu -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
-// RUN: %clang -target x86_64-linux-gnu -gdwarf -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
+// RUN: %clang -target x86_64-linux-gnu -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4
+// RUN: %clang -target x86_64-linux-gnu -gdwarf -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4
// The -isysroot is used as a hack to avoid LIT messing with the SDKROOT
// environment variable which indirecty overrides the version in the target
diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index f332cd83b26e..911779fffbef 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -597,7 +597,7 @@
// RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s
// Z7_gdwarf: "-gcodeview"
// Z7_gdwarf: "-debug-info-kind=constructor"
-// Z7_gdwarf: "-dwarf-version=
+// Z7_gdwarf: "-dwarf-version=4
// RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s
// CXX11: -std=c++11
diff --git a/clang/test/Driver/ve-toolchain.c b/clang/test/Driver/ve-toolchain.c
index 753dee19fcbf..dfd12cc0bba4 100644
--- a/clang/test/Driver/ve-toolchain.c
+++ b/clang/test/Driver/ve-toolchain.c
@@ -6,7 +6,7 @@
/// Checking dwarf-version
// RUN: %clang -### -g -target ve %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s
-// DWARF_VER: "-dwarf-version=5"
+// DWARF_VER: "-dwarf-version=4"
///-----------------------------------------------------------------------------
/// Checking include-path
diff --git a/clang/test/Driver/ve-toolchain.cpp b/clang/test/Driver/ve-toolchain.cpp
index 4b2b9c5747fe..3a196dd94ca1 100644
--- a/clang/test/Driver/ve-toolchain.cpp
+++ b/clang/test/Driver/ve-toolchain.cpp
@@ -7,7 +7,7 @@
// RUN: %clangxx -### -g -target ve-unknown-linux-gnu \
// RUN: %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s
-// DWARF_VER: "-dwarf-version=5"
+// DWARF_VER: "-dwarf-version=4"
///-----------------------------------------------------------------------------
/// Checking include-path
--
2.35.1

View File

@ -1,10 +1,10 @@
%bcond_with compat_build %bcond_with compat_build
%bcond_without check %bcond_without check
%global maj_ver 13 %global maj_ver 14
%global min_ver 0 %global min_ver 0
%global patch_ver 1 %global patch_ver 0
#global rc_ver 3 #global rc_ver 4
%global clang_version %{maj_ver}.%{min_ver}.%{patch_ver} %global clang_version %{maj_ver}.%{min_ver}.%{patch_ver}
%if %{with compat_build} %if %{with compat_build}
@ -41,7 +41,7 @@
Name: %pkg_name Name: %pkg_name
Version: %{clang_version}%{?rc_ver:~rc%{rc_ver}} Version: %{clang_version}%{?rc_ver:~rc%{rc_ver}}
Release: 2%{?dist} Release: 1%{?dist}
Summary: A C language family front-end for LLVM Summary: A C language family front-end for LLVM
License: NCSA License: NCSA
@ -63,9 +63,17 @@ Patch1: 0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
Patch2: 0003-PATCH-clang-Don-t-install-static-libraries.patch Patch2: 0003-PATCH-clang-Don-t-install-static-libraries.patch
Patch3: 0001-Driver-Add-a-gcc-equivalent-triple-to-the-list-of-tr.patch Patch3: 0001-Driver-Add-a-gcc-equivalent-triple-to-the-list-of-tr.patch
Patch4: 0001-cmake-Allow-shared-libraries-to-customize-the-soname.patch Patch4: 0001-cmake-Allow-shared-libraries-to-customize-the-soname.patch
Patch5: 0001-PATCH-clang-Fix-scan-build-py-executable-lookup-path.patch
# This patch can be dropped once gcc-12.0.1-0.5.fc36 is in the repo. # This patch can be dropped once gcc-12.0.1-0.5.fc36 is in the repo.
Patch6: 0001-Work-around-gcc-miscompile.patch Patch5: 0001-Work-around-gcc-miscompile.patch
# https://github.com/llvm/llvm-project/commit/fed96f31bb5b68f77dd617ee8e698dd8171ee71b
Patch6: m-branch-protection.patch
Patch7: 0010-PATCH-clang-Produce-DWARF4-by-default.patch
# Patches for clang-tools-extra
# See https://reviews.llvm.org/D120301
Patch201: llvm-hello.patch
# See https://github.com/llvm/llvm-project/issues/54116
Patch202: remove-test.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: gcc-c++
@ -94,6 +102,7 @@ BuildRequires: emacs
BuildRequires: python3-lit BuildRequires: python3-lit
BuildRequires: python3-sphinx BuildRequires: python3-sphinx
BuildRequires: python3-recommonmark
BuildRequires: libatomic BuildRequires: libatomic
# We need python3-devel for %%py3_shebang_fix # We need python3-devel for %%py3_shebang_fix
@ -244,6 +253,12 @@ Requires: python3
%setup -T -q -b 1 -n %{clang_tools_srcdir} %setup -T -q -b 1 -n %{clang_tools_srcdir}
%autopatch -m200 -p2 %autopatch -m200 -p2
# This test is broken upstream. It is a clang-tidy unittest
# that includes a file from clang, breaking standalone builds.
# https://github.com/llvm/llvm-project/issues/54116
rm unittests/clang-tidy/ReadabilityModuleTest.cpp
# failing test case # failing test case
rm test/clang-tidy/checkers/altera-struct-pack-align.cpp rm test/clang-tidy/checkers/altera-struct-pack-align.cpp
@ -269,7 +284,6 @@ rm test/CodeGen/profile-filter.c
%endif %endif
%build %build
# We run the builders out of memory on armv7 and i686 when LTO is enabled # We run the builders out of memory on armv7 and i686 when LTO is enabled
%ifarch %{arm} i686 %ifarch %{arm} i686
%define _lto_cflags %{nil} %define _lto_cflags %{nil}
@ -293,6 +307,11 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /') %global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
%endif %endif
%set_build_flags
CXXFLAGS="$CXXFLAGS -Wno-address -Wno-nonnull -Wno-maybe-uninitialized"
CFLAGS="$CFLAGS -Wno-address -Wno-nonnull -Wno-maybe-uninitialized"
# -DLLVM_ENABLE_NEW_PASS_MANAGER=ON can be removed once this patch is committed: # -DLLVM_ENABLE_NEW_PASS_MANAGER=ON can be removed once this patch is committed:
# https://reviews.llvm.org/D107628 # https://reviews.llvm.org/D107628
%cmake -G Ninja \ %cmake -G Ninja \
@ -401,7 +420,7 @@ rm -vf %{buildroot}%{_datadir}/clang/clang-format-bbedit.applescript
rm -vf %{buildroot}%{_datadir}/clang/clang-format-sublime.py* rm -vf %{buildroot}%{_datadir}/clang/clang-format-sublime.py*
# TODO: Package html docs # TODO: Package html docs
rm -Rvf %{buildroot}%{_docdir}/clang/html rm -Rvf %{buildroot}%{_docdir}/Clang/clang/html
rm -Rvf %{buildroot}%{_datadir}/clang/clang-doc-default-stylesheet.css rm -Rvf %{buildroot}%{_datadir}/clang/clang-doc-default-stylesheet.css
rm -Rvf %{buildroot}%{_datadir}/clang/index.js rm -Rvf %{buildroot}%{_datadir}/clang/index.js
@ -576,6 +595,9 @@ false
%endif %endif
%changelog %changelog
* Wed Mar 23 2022 Timm Bäder <tbaeder@redhat.com> - 14.0.0-1
- Update to 14.0.0
* Wed Feb 16 2022 Tom Stellard <tstellar@redhat.com> - 13.0.1-2 * Wed Feb 16 2022 Tom Stellard <tstellar@redhat.com> - 13.0.1-2
- Fix some rpmlinter errors - Fix some rpmlinter errors

61
llvm-hello.patch Normal file
View File

@ -0,0 +1,61 @@
diff -ruN a/clang-tools-extra-14.0.0rc2.src.orig/test/clang-tidy/CTTestTidyModule.cpp a/clang-tools-extra-14.0.0rc2.src/test/clang-tidy/CTTestTidyModule.cpp
--- a/clang-tools-extra-14.0.0rc2.src.orig/test/clang-tidy/CTTestTidyModule.cpp 2022-03-02 01:46:37.000000000 +0100
+++ a/clang-tools-extra-14.0.0rc2.src/test/clang-tidy/CTTestTidyModule.cpp 2022-03-07 08:52:20.009112976 +0100
@@ -1,4 +1,4 @@
-// REQUIRES: plugins
+// REQUIRES: plugins, llvm-hello
// RUN: clang-tidy -checks='-*,mytest*' --list-checks -load %llvmshlibdir/CTTestTidyModule%pluginext -load %llvmshlibdir/LLVMHello%pluginext | FileCheck --check-prefix=CHECK-LIST %s
// CHECK-LIST: Enabled checks:
// CHECK-LIST-NEXT: mytest1
diff -ruN a/clang-tools-extra-14.0.0rc2.src.orig/test/CMakeLists.txt a/clang-tools-extra-14.0.0rc2.src/test/CMakeLists.txt
--- a/clang-tools-extra-14.0.0rc2.src.orig/test/CMakeLists.txt 2022-03-02 01:46:37.000000000 +0100
+++ a/clang-tools-extra-14.0.0rc2.src/test/CMakeLists.txt 2022-03-07 10:58:56.172490672 +0100
@@ -15,10 +15,15 @@
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
+if (TARGET LLVMHello)
+ set (LLVM_HAS_LLVM_HELLO 1)
+endif()
+
llvm_canonicalize_cmake_booleans(
CLANG_TIDY_ENABLE_STATIC_ANALYZER
CLANG_PLUGIN_SUPPORT
LLVM_INSTALL_TOOLCHAIN_ONLY
+ LLVM_HAS_LLVM_HELLO
)
configure_lit_site_cfg(
@@ -97,7 +102,10 @@
endif()
if(TARGET CTTestTidyModule)
- list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule LLVMHello)
+ list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule)
+ if (TARGET LLVMHello)
+ list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule) # Should be LLVMHello?
+ endif()
target_include_directories(CTTestTidyModule PUBLIC BEFORE "${CLANG_TOOLS_SOURCE_DIR}")
if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
set(LLVM_LINK_COMPONENTS
diff -ruN a/clang-tools-extra-14.0.0rc2.src.orig/test/lit.cfg.py a/clang-tools-extra-14.0.0rc2.src/test/lit.cfg.py
--- a/clang-tools-extra-14.0.0rc2.src.orig/test/lit.cfg.py 2022-03-02 01:46:37.000000000 +0100
+++ a/clang-tools-extra-14.0.0rc2.src/test/lit.cfg.py 2022-03-07 08:52:20.010112983 +0100
@@ -155,3 +155,6 @@
# Plugins (loadable modules)
if config.has_plugins and config.llvm_plugin_ext:
config.available_features.add('plugins')
+
+if config.has_llvm_hello:
+ config.available_features.add('llvm-hello')
diff -ruN a/clang-tools-extra-14.0.0rc2.src.orig/test/lit.site.cfg.py.in a/clang-tools-extra-14.0.0rc2.src/test/lit.site.cfg.py.in
--- a/clang-tools-extra-14.0.0rc2.src.orig/test/lit.site.cfg.py.in 2022-03-02 01:46:37.000000000 +0100
+++ a/clang-tools-extra-14.0.0rc2.src/test/lit.site.cfg.py.in 2022-03-07 10:59:17.202663983 +0100
@@ -13,6 +13,7 @@
config.target_triple = "@TARGET_TRIPLE@"
config.clang_tidy_staticanalyzer = @CLANG_TIDY_ENABLE_STATIC_ANALYZER@
config.has_plugins = @CLANG_PLUGIN_SUPPORT@ & ~@LLVM_INSTALL_TOOLCHAIN_ONLY@
+config.has_llvm_hello = @LLVM_HAS_LLVM_HELLO@
# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.

44
m-branch-protection.patch Normal file
View File

@ -0,0 +1,44 @@
commit fed96f31bb5b68f77dd617ee8e698dd8171ee71b
Author: Tom Stellard <tstellar@redhat.com>
Date: Tue Mar 22 23:17:39 2022 -0700
Re-commit: Driver: Don't warn on -mbranch-protection when linking
This is a re-commit of 98fd3b359866f474ab1c097c22fb5c3be356b996. The
newly added test was failing on the bots, and I've fixed the test now so
that it doesn't actually invoke the linker.
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index d37d3a31fe07..6ed87f9a464d 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3444,6 +3444,7 @@ def msign_return_address_EQ : Joined<["-"], "msign-return-address=">,
Flags<[CC1Option]>, Group<m_Group>, Values<"none,all,non-leaf">,
HelpText<"Select return address signing scope">;
def mbranch_protection_EQ : Joined<["-"], "mbranch-protection=">,
+ Group<m_Group>,
HelpText<"Enforce targets of indirect branches and function returns">;
def mharden_sls_EQ : Joined<["-"], "mharden-sls=">,
diff --git a/clang/test/Driver/aarch64-security-options.c b/clang/test/Driver/aarch64-security-options.c
index 6ea4b8ae5838..4bd73e06d255 100644
--- a/clang/test/Driver/aarch64-security-options.c
+++ b/clang/test/Driver/aarch64-security-options.c
@@ -27,6 +27,9 @@
// RUN: %clang -target aarch64--none-eabi -c %s -### -mbranch-protection=bar 2>&1 | \
// RUN: FileCheck %s --check-prefix=BAD-BP-PROTECTION --check-prefix=WARN
+// RUN: %clang -target aarch64--none-eabi -### -o /dev/null -mbranch-protection=standard /dev/null 2>&1 | \
+// RUN: FileCheck --allow-empty %s --check-prefix=LINKER-DRIVER
+
// WARN-NOT: warning: ignoring '-mbranch-protection=' option because the 'aarch64' architecture does not support it [-Wbranch-protection]
// RA-OFF: "-msign-return-address=none"
@@ -46,3 +49,7 @@
// BAD-B-KEY-COMBINATION: invalid branch protection option 'b-key' in '-mbranch-protection={{.*}}'
// BAD-LEAF-COMBINATION: invalid branch protection option 'leaf' in '-mbranch-protection={{.*}}'
+
+// Check that the linker driver doesn't warn about -mbranch-protection=standard
+// as an unused option.
+// LINKER-DRIVER-NOT: warning:

20
remove-test.patch Normal file
View File

@ -0,0 +1,20 @@
diff --git a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
index 253f78eb36ea..1199da3e4cfd 100644
--- a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
+++ b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
@@ -30,7 +30,6 @@ add_extra_unittest(ClangTidyTests
OptionsProviderTest.cpp
OverlappingReplacementsTest.cpp
UsingInserterTest.cpp
- ReadabilityModuleTest.cpp
TransformerClangTidyCheckTest.cpp
)
@@ -54,7 +53,6 @@ target_link_libraries(ClangTidyTests
clangTidyGoogleModule
clangTidyLLVMModule
clangTidyObjCModule
- clangTidyReadabilityModule
clangTidyUtils
LLVMTestingSupport
)