From 9403a5e31738d0ddc25ae373166f798d64219c3f56e16a69654764e3148681d6 Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Sat, 31 Aug 2024 21:34:12 +0000 Subject: [PATCH] - Add clang-Fix-build-with-GCC-14-on-ARM.patch to fix build with GCC 14 on aarch64. (boo#1229868, gh#llvm/llvm-project#78691) OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm17?expand=0&rev=31 --- clang-Fix-build-with-GCC-14-on-ARM.patch | 50 ++++++++++++++++++++++++ llvm17.changes | 6 +++ llvm17.spec | 3 ++ 3 files changed, 59 insertions(+) create mode 100644 clang-Fix-build-with-GCC-14-on-ARM.patch diff --git a/clang-Fix-build-with-GCC-14-on-ARM.patch b/clang-Fix-build-with-GCC-14-on-ARM.patch new file mode 100644 index 0000000..66a7143 --- /dev/null +++ b/clang-Fix-build-with-GCC-14-on-ARM.patch @@ -0,0 +1,50 @@ +From 4b0c8c8576f95ddc216c9b33fce9f4226f465d00 Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Fri, 19 Jan 2024 15:19:58 +0100 +Subject: [PATCH] [Clang] Fix build with GCC 14 on ARM (#78704) + +GCC 14 defines `__arm_streaming` as a macro expanding to +`[[arm::streaming]]`. Due to the nested macro use, this gets expanded +prior to concatenation. + +It doesn't look like C++ has a really clean way to prevent macro +expansion. The best I have found is to use `EMPTY ## X` where `EMPTY` is +an empty macro argument, so this is the hack I'm implementing here. + +Fixes https://github.com/llvm/llvm-project/issues/78691. +--- + clang/include/clang/Basic/TokenKinds.def | 3 ++- + clang/utils/TableGen/ClangAttrEmitter.cpp | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def +index ef0dad0f2dcd..3add13c079f3 100644 +--- a/clang/include/clang/Basic/TokenKinds.def ++++ b/clang/include/clang/Basic/TokenKinds.def +@@ -752,8 +752,9 @@ KEYWORD(__builtin_available , KEYALL) + KEYWORD(__builtin_sycl_unique_stable_name, KEYSYCL) + + // Keywords defined by Attr.td. ++// The "EMPTY ## X" is used to prevent early macro-expansion of the keyword. + #ifndef KEYWORD_ATTRIBUTE +-#define KEYWORD_ATTRIBUTE(X) KEYWORD(X, KEYALL) ++#define KEYWORD_ATTRIBUTE(X, EMPTY) KEYWORD(EMPTY ## X, KEYALL) + #endif + #include "clang/Basic/AttrTokenKinds.inc" + +diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp +index b5813c6abc2b..79db17501b64 100644 +--- a/clang/utils/TableGen/ClangAttrEmitter.cpp ++++ b/clang/utils/TableGen/ClangAttrEmitter.cpp +@@ -3430,7 +3430,7 @@ void EmitClangAttrTokenKinds(RecordKeeper &Records, raw_ostream &OS) { + "RegularKeyword attributes with arguments are not " + "yet supported"); + OS << "KEYWORD_ATTRIBUTE(" +- << S.getSpellingRecord().getValueAsString("Name") << ")\n"; ++ << S.getSpellingRecord().getValueAsString("Name") << ", )\n"; + } + OS << "#undef KEYWORD_ATTRIBUTE\n"; + } +-- +2.46.0 + diff --git a/llvm17.changes b/llvm17.changes index a8afa71..1d253ea 100644 --- a/llvm17.changes +++ b/llvm17.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sat Aug 31 21:29:58 UTC 2024 - Aaron Puchert + +- Add clang-Fix-build-with-GCC-14-on-ARM.patch to fix build with + GCC 14 on aarch64. (boo#1229868, gh#llvm/llvm-project#78691) + ------------------------------------------------------------------- Tue Aug 20 21:20:37 UTC 2024 - Aaron Puchert diff --git a/llvm17.spec b/llvm17.spec index c9c2ebb..522d880 100644 --- a/llvm17.spec +++ b/llvm17.spec @@ -388,6 +388,8 @@ Patch3: default-to-i586.patch Patch4: clang-resourcedirs.patch Patch5: llvm-remove-clang-only-flags.patch Patch6: llvm-fix-find-gcc5-install.patch +# PATCH-FIX-UPSTREAM -- Backport of commit d54dfdd1b53ff72344287d250c2b67329792c840. +Patch7: clang-Fix-build-with-GCC-14-on-ARM.patch Patch9: link-clang-shared.patch Patch10: link-clang-tools-extra-shared.patch # PATCH-FIX-OPENSUSE lldb-cmake.patch -- Fix ncurses include path. @@ -849,6 +851,7 @@ pushd clang-%{_version}.src %patch -P 3 -p1 %patch -P 4 -p1 %patch -P 6 -p1 +%patch -P 7 -p2 %patch -P 9 -p2 # We hardcode openSUSE