Browse Source

clang update to 14.0.1

Signed-off-by: Toshaan Bharvani <toshaan@powerel.org>
master
Toshaan Bharvani 1 year ago
parent
commit
100ff7646f
  1. 33
      SOURCES/0001-Work-around-gcc-miscompile.patch
  2. 10
      SOURCES/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
  3. 98
      SOURCES/0010-PATCH-clang-Produce-DWARF4-by-default.patch
  4. 26
      SOURCES/disable-recommonmark.patch
  5. 61
      SOURCES/llvm-hello.patch
  6. 20
      SOURCES/remove-test.patch
  7. 174
      SPECS/clang.spec

33
SOURCES/0001-Work-around-gcc-miscompile.patch

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
From 0f97b7209eed4a428171af6044fe7e0aaf81ee2a Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov@redhat.com>
Date: Thu, 3 Feb 2022 10:34:44 +0100
Subject: [PATCH] Work around gcc miscompile

This works around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104334,
which miscompiles clang on s390x and ppc64le. The issue is already
fixed on the gcc side, but including this as a temporary workaround
to get a working build.
---
clang/lib/Sema/DeclSpec.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp
index d4dc790c008a..77a1e6c32c6f 100644
--- a/clang/lib/Sema/DeclSpec.cpp
+++ b/clang/lib/Sema/DeclSpec.cpp
@@ -1203,8 +1203,9 @@ void DeclSpec::Finish(Sema &S, const PrintingPolicy &Policy) {
} else if (TypeSpecType == TST_double) {
// vector long double and vector long long double are never allowed.
// vector double is OK for Power7 and later, and ZVector.
- if (getTypeSpecWidth() == TypeSpecifierWidth::Long ||
- getTypeSpecWidth() == TypeSpecifierWidth::LongLong)
+ TypeSpecifierWidth TypeSpecWidth = getTypeSpecWidth();
+ if (TypeSpecWidth == TypeSpecifierWidth::Long ||
+ TypeSpecWidth == TypeSpecifierWidth::LongLong)
S.Diag(TSWRange.getBegin(),
diag::err_invalid_vector_long_double_decl_spec);
else if (!S.Context.getTargetInfo().hasFeature("vsx") &&
--
2.34.1


10
SOURCES/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch

@ -7,18 +7,18 @@ Subject: [PATCH] [PATCH][clang] Make -funwind-tables the default on all archs @@ -7,18 +7,18 @@ Subject: [PATCH] [PATCH][clang] Make -funwind-tables the default on all archs
clang/lib/Driver/ToolChains/Gnu.cpp | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index a27841dc5985..7489e6785150 100644
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp
b/clang/lib/Driver/ToolChains/Gnu.cpp
index d0808d061c82..de9c9743cd38 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2709,6 +2709,12 @@ bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const {
case llvm::Triple::ppc64:
@@ -2701,6 +2701,11 @@ bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const {
case llvm::Triple::ppc64le:
case llvm::Triple::x86:
case llvm::Triple::x86_64:
+
+ // Enable -funwind-tables on all architectures supported by Fedora:
+ // rhbz#1655546
+ case llvm::Triple::x86:
+ case llvm::Triple::systemz:
+ case llvm::Triple::arm:
return true;

98
SOURCES/0010-PATCH-clang-Produce-DWARF4-by-default.patch

@ -0,0 +1,98 @@ @@ -0,0 +1,98 @@
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
diff -ruN clang-14.0.0.src.orig/test/Driver/clang-g-opts.c clang-14.0.0.src/test/Driver/clang-g-opts.c
--- a/clang-14.0.0.src.orig/test/Driver/clang-g-opts.c 2022-03-14 10:44:55.000000000 +0100
+++ b/clang-14.0.0.src/test/Driver/clang-g-opts.c 2022-04-13 06:36:55.832253890 +0200
@@ -32,7 +32,7 @@
// CHECK-WITHOUT-G-NOT: -debug-info-kind
// CHECK-WITH-G: "-debug-info-kind=constructor"
-// CHECK-WITH-G: "-dwarf-version=5"
+// CHECK-WITH-G: "-dwarf-version=4"
// CHECK-WITH-G-DWARF2: "-dwarf-version=2"
// CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone"
--
2.35.1

26
SOURCES/disable-recommonmark.patch

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
diff -ruN clang-14.0.0.src.orig/docs/conf.py clang-14.0.0.src/docs/conf.py
--- a/clang-14.0.0.src.orig/docs/conf.py 2022-03-14 10:44:55.000000000 +0100
+++ b/clang-14.0.0.src/docs/conf.py 2022-04-11 11:13:44.483641113 +0200
@@ -37,20 +37,7 @@
'.rst': 'restructuredtext',
}
-try:
- import recommonmark
-except ImportError:
- # manpages do not use any .md sources
- if not tags.has('builder-man'):
- raise
-else:
- import sphinx
- if sphinx.version_info >= (3, 0):
- # This requires 0.5 or later.
- extensions.append('recommonmark')
- else:
- source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'}
- source_suffix['.md'] = 'markdown'
+import sphinx
# The encoding of source files.
#source_encoding = 'utf-8-sig'

61
SOURCES/llvm-hello.patch

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

20
SOURCES/remove-test.patch

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

174
SPECS/clang.spec

@ -1,43 +1,12 @@ @@ -1,43 +1,12 @@
%bcond_with compat_build
%bcond_with bundle_compat_lib
%bcond_without check

%global maj_ver 13
%global maj_ver 14
%global min_ver 0
%global patch_ver 1
#global rc_ver 4
%global patch_ver 6
%global clang_version %{maj_ver}.%{min_ver}.%{patch_ver}

%global clang_tools_binaries \
%{_bindir}/clang-apply-replacements \
%{_bindir}/clang-change-namespace \
%{_bindir}/clang-check \
%{_bindir}/clang-doc \
%{_bindir}/clang-extdef-mapping \
%{_bindir}/clang-format \
%{_bindir}/clang-include-fixer \
%{_bindir}/clang-move \
%{_bindir}/clang-offload-bundler \
%{_bindir}/clang-offload-wrapper \
%{_bindir}/clang-query \
%{_bindir}/clang-refactor \
%{_bindir}/clang-rename \
%{_bindir}/clang-reorder-fields \
%{_bindir}/clang-repl \
%{_bindir}/clang-scan-deps \
%{_bindir}/clang-tidy \
%{_bindir}/clangd \
%{_bindir}/diagtool \
%{_bindir}/hmaptool \
%{_bindir}/pp-trace

%global clang_binaries \
%{_bindir}/clang \
%{_bindir}/clang++ \
%{_bindir}/clang-%{maj_ver} \
%{_bindir}/clang++-%{maj_ver} \
%{_bindir}/clang-cl \
%{_bindir}/clang-cpp \

%if %{with compat_build}
%global pkg_name clang%{maj_ver}
# Install clang to same prefix as llvm, so that apps that use llvm-config
@ -56,22 +25,12 @@ @@ -56,22 +25,12 @@
%global pkg_libdir %{_libdir}
%endif

%if 0%{?fedora} || 0%{?rhel} > 7
%bcond_without python3
%else
%bcond_with python3
%endif

%bcond_with bundle_compat_lib

%if %{with bundle_compat_lib}
%global compat_maj_ver 12
%global compat_maj_ver 13
%global compat_ver %{compat_maj_ver}.0.1
%endif


%global build_install_prefix %{buildroot}%{install_prefix}

%ifarch ppc64le aarch64
# Too many threads on ppc64 systems causes OOM errors.
%global _smp_mflags -j8
@ -112,15 +71,24 @@ Patch1: 0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch @@ -112,15 +71,24 @@ Patch1: 0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.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
Patch4: 0001-cmake-Allow-shared-libraries-to-customize-the-soname.patch
Patch5: 0001-PATCH-clang-Fix-scan-build-py-executable-lookup-path.patch

# Patches for clang-tools
Patch201: 0001-Confusable-identifiers-detection.patch
Patch202: 0002-Misleading-bidirectional-detection.patch
Patch203: 0003-Misleading-unicode-identifier-detection-pass.patch

BuildRequires: gcc
BuildRequires: gcc-c++
# This patch can be dropped once gcc-12.0.1-0.5.fc36 is in the repo.
Patch5: 0001-Work-around-gcc-miscompile.patch
Patch7: 0010-PATCH-clang-Produce-DWARF4-by-default.patch
Patch8: disable-recommonmark.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

# RHEL only: We build LLVM with clang, which now defaults to using the
# libstdc++ from gcc-toolset-12. Since we're linking some clang
# tools statically to some static libraries from LLVM, we
# need to use libstdc++12 as well. So, use gcc-toolset-12
# to compile clang.
BuildRequires: gcc-toolset-12-gcc-c++
BuildRequires: gcc-toolset-12-annobin-plugin-gcc
BuildRequires: cmake
BuildRequires: ninja-build
%if %{with compat_build}
@ -148,7 +116,7 @@ BuildRequires: python3-lit @@ -148,7 +116,7 @@ BuildRequires: python3-lit
BuildRequires: python3-sphinx
BuildRequires: libatomic

# We need python3-devel for pathfix.py.
# We need python3-devel for %%py3_shebang_fix
BuildRequires: python3-devel

# For reproducible pyc file generation
@ -188,8 +156,7 @@ Requires: gcc-c++ @@ -188,8 +156,7 @@ Requires: gcc-c++

Provides: clang(major) = %{maj_ver}

Conflicts: compiler-rt < %{version}
Conflicts: compiler-rt > %{version}
Conflicts: compiler-rt < 11.0.0

%description
clang: noun
@ -208,12 +175,18 @@ libomp-devel to enable -fopenmp. @@ -208,12 +175,18 @@ libomp-devel to enable -fopenmp.
%package libs
Summary: Runtime library for clang
Requires: %{name}-resource-filesystem%{?_isa} = %{version}
Requires: gcc-toolset-12-gcc-c++
Recommends: compiler-rt%{?_isa} = %{version}
# libomp-devel is required, so clang can find the omp.h header when compiling
# with -fopenmp.
Recommends: libomp-devel%{_isa} = %{version}
Recommends: libomp%{_isa} = %{version}

# Use lld as the default linker on ARM due to rhbz#1918924
%ifarch %{arm}
Requires: lld
%endif

%description libs
Runtime library for clang.

@ -297,11 +270,17 @@ Requires: python3 @@ -297,11 +270,17 @@ Requires: python3
%setup -T -q -b 1 -n %{clang_tools_srcdir}
%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
rm test/clang-tidy/checkers/altera-struct-pack-align.cpp

pathfix.py -i %{__python3} -pn \
clang-tidy/tool/*.py \
%py3_shebang_fix \
clang-tidy/tool/ \
clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py

%setup -q -n %{clang_srcdir}
@ -310,8 +289,8 @@ pathfix.py -i %{__python3} -pn \ @@ -310,8 +289,8 @@ pathfix.py -i %{__python3} -pn \
# failing test case
rm test/CodeGen/profile-filter.c

pathfix.py -i %{__python3} -pn \
tools/clang-format/*.py \
%py3_shebang_fix \
tools/clang-format/ \
tools/clang-format/git-clang-format \
utils/hmaptool/hmaptool \
tools/scan-view/bin/scan-view \
@ -322,7 +301,6 @@ pathfix.py -i %{__python3} -pn \ @@ -322,7 +301,6 @@ pathfix.py -i %{__python3} -pn \
%endif

%build

# We run the builders out of memory on armv7 and i686 when LTO is enabled
%ifarch %{arm} i686
%define _lto_cflags %{nil}
@ -346,6 +324,10 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py @@ -346,6 +324,10 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
%endif

%set_build_flags
CXXFLAGS="$CXXFLAGS -Wno-address -Wno-nonnull -Wno-maybe-uninitialized"
CFLAGS="$CFLAGS -Wno-address -Wno-nonnull -Wno-maybe-uninitialized"

%if %{with bundle_compat_lib}

mv ../clang-%{compat_ver}.src ../clang
@ -361,7 +343,7 @@ mv ../clang-%{compat_ver}.src ../clang @@ -361,7 +343,7 @@ mv ../clang-%{compat_ver}.src ../clang
-DBUILD_SHARED_LIBS=OFF \
-DLLVM_ENABLE_EH=ON \
-DLLVM_ENABLE_RTTI=ON \
-DCMAKE_INSTALL_RPATH:BOOL=";"
-DCMAKE_SKIP_RPATH:BOOL=ON

%ninja_build -C ../clang-compat-libs libclang.so
%ninja_build -C ../clang-compat-libs libclang-cpp.so
@ -369,25 +351,23 @@ mv ../clang-%{compat_ver}.src ../clang @@ -369,25 +351,23 @@ mv ../clang-%{compat_ver}.src ../clang

%endif

# -DCMAKE_INSTALL_RPATH=";" is a workaround for llvm manually setting the
# rpath of libraries and binaries. llvm will skip the manual setting
# if CAMKE_INSTALL_RPATH is set to a value, but cmake interprets this value
# as nothing, so it sets the rpath to "" when installing.
# -DLLVM_ENABLE_NEW_PASS_MANAGER=ON can be removed once this patch is committed:
# https://reviews.llvm.org/D107628
%cmake -G Ninja \
-DCMAKE_C_COMPILER=/opt/rh/gcc-toolset-12/root/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/opt/rh/gcc-toolset-12/root/usr/bin/g++ \
-DLLVM_PARALLEL_LINK_JOBS=1 \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPYTHON_EXECUTABLE=%{__python3} \
-DCMAKE_INSTALL_RPATH:BOOL=";" \
-DCMAKE_SKIP_RPATH:BOOL=ON \
%ifarch s390 s390x %{arm} %ix86 ppc64le
-DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
%endif
%if %{with compat_build}
-DCLANG_BUILD_TOOLS:BOOL=OFF \
-DLLVM_CONFIG:FILEPATH=%{_bindir}/llvm-config-%{maj_ver} \
-DLLVM_CONFIG:FILEPATH=%{pkg_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} \
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \
-DCLANG_INCLUDE_TESTS:BOOL=OFF \
%else
@ -424,11 +404,14 @@ mv ../clang-%{compat_ver}.src ../clang @@ -424,11 +404,14 @@ mv ../clang-%{compat_ver}.src ../clang
-DCLANG_BUILD_EXAMPLES:BOOL=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DCLANG_REPOSITORY_STRING="%{?fedora:Fedora}%{?rhel:Red Hat} %{version}-%{release}" \
-DCLANG_DEFAULT_UNWINDLIB=libgcc
%ifarch %{arm}
-DCLANG_DEFAULT_LINKER=lld \
%endif
-DCLANG_DEFAULT_UNWINDLIB=libgcc \
-DGCC_INSTALL_PREFIX=/opt/rh/gcc-toolset-12/root/usr

%cmake_build


%install

%cmake_install
@ -444,6 +427,8 @@ install -m 0755 ../clang-compat-libs/lib/libclang-cpp.so.%{compat_maj_ver}* %{bu @@ -444,6 +427,8 @@ install -m 0755 ../clang-compat-libs/lib/libclang-cpp.so.%{compat_maj_ver}* %{bu
rm -Rf %{buildroot}%{install_bindir}
rm -Rf %{buildroot}%{install_prefix}/share
rm -Rf %{buildroot}%{install_prefix}/libexec
# Remove scanview-py helper libs
rm -Rf %{buildroot}%{install_prefix}/lib/{libear,libscanbuild}

%else

@ -482,7 +467,7 @@ rm -vf %{buildroot}%{_datadir}/clang/clang-format-bbedit.applescript @@ -482,7 +467,7 @@ rm -vf %{buildroot}%{_datadir}/clang/clang-format-bbedit.applescript
rm -vf %{buildroot}%{_datadir}/clang/clang-format-sublime.py*

# 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/index.js

@ -533,21 +518,25 @@ sed -i -e "s/'ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'/'ASAN_SYMBOLIZER_PAT @@ -533,21 +518,25 @@ sed -i -e "s/'ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'/'ASAN_SYMBOLIZER_PAT
%if %{with check}
# requires lit.py from LLVM utilities
# FIXME: Fix failing ARM tests
SOURCE_DATE_EPOCH=1629181597 LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %cmake_build --target check-all || \
%endif
SOURCE_DATA_EPOCH=1629181597 LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %{__ninja} check-all -C %{__cmake_builddir} || \
%ifarch %{arm}
:
%else
false
%endif

%endif
%endif


%if %{without compat_build}
%files
%license LICENSE.TXT
%{clang_binaries}
%{_bindir}/clang
%{_bindir}/clang++
%{_bindir}/clang-%{maj_ver}
%{_bindir}/clang++-%{maj_ver}
%{_bindir}/clang-cl
%{_bindir}/clang-cpp
%{_mandir}/man1/clang.1.gz
%{_mandir}/man1/clang++.1.gz
%{_mandir}/man1/clang-%{maj_ver}.1.gz
@ -612,7 +601,29 @@ false @@ -612,7 +601,29 @@ false


%files tools-extra
%{clang_tools_binaries}
%{_bindir}/clang-apply-replacements
%{_bindir}/clang-change-namespace
%{_bindir}/clang-check
%{_bindir}/clang-doc
%{_bindir}/clang-extdef-mapping
%{_bindir}/clang-format
%{_bindir}/clang-include-fixer
%{_bindir}/clang-move
%{_bindir}/clang-offload-bundler
%{_bindir}/clang-offload-wrapper
%{_bindir}/clang-linker-wrapper
%{_bindir}/clang-nvlink-wrapper
%{_bindir}/clang-query
%{_bindir}/clang-refactor
%{_bindir}/clang-rename
%{_bindir}/clang-reorder-fields
%{_bindir}/clang-repl
%{_bindir}/clang-scan-deps
%{_bindir}/clang-tidy
%{_bindir}/clangd
%{_bindir}/diagtool
%{_bindir}/hmaptool
%{_bindir}/pp-trace
%{_bindir}/c-index-test
%{_bindir}/find-all-symbols
%{_bindir}/modularize
@ -638,6 +649,15 @@ false @@ -638,6 +649,15 @@ false

%endif
%changelog
* Tue Jul 19 2022 Timm Bäder <tbaeder@redhat.com> - 14.0.6-1
- Update to 14.0.6

* Mon Jun 20 2022 Timm Bäder <tbaeder@redhat.com> - 14.0.5-1
- Update to 14.0.5

* Fri Apr 22 2022 Timm Bäder <tbaeder@redhat.com> - 14.0.0-1
- 14.0.0 Release

* Thu Feb 03 2022 Tom Stellard <tstellar@redhat.com> - 13.0.1-1
- 13.0.1 Release


Loading…
Cancel
Save