File clang-Define-DCONFIG_CC_IS_CLANG-in-KBuildHelper-get.patch of Package bcc.39855
From 467dffb5ff4457b0daa890ac2d843edba66de549 Mon Sep 17 00:00:00 2001
From: Jerome Marchand <jmarchan@redhat.com>
Date: Sun, 18 May 2025 04:17:34 +0200
Subject: [PATCH 1/1] clang: Define DCONFIG_CC_IS_CLANG in
KBuildHelper::get_flags() (#5172) (#5293)
On powerpc, many tools fail with an "invalid output constraint '=YZ<>'
in asm" error. This come from the following code in
arch/powerpc/include/asm/asm-compat.h:
Because CONFIG_CC_IS_CLANG is not defined in the headers, we end up
using a constraint that is not understoog by clang.
Defining CONFIG_CC_IS_CLANG in KBuildHelper::get_flags() fixes this
error and possibly other similar error.
Suggested-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
src/cc/frontends/clang/kbuild_helper.cc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/cc/frontends/clang/kbuild_helper.cc b/src/cc/frontends/clang/kbuild_helper.cc
index d326c6b5..31d5acae 100644
--- a/src/cc/frontends/clang/kbuild_helper.cc
+++ b/src/cc/frontends/clang/kbuild_helper.cc
@@ -140,6 +140,13 @@ int KBuildHelper::get_flags(const char *uname_machine, vector<string> *cflags) {
cflags->push_back("-ffine-grained-bitfield-accesses");
#endif
+ /*
+ * kernel is usually build with gcc and the kernel devel header
+ * reflects that fact. However we build with clang and this must be
+ * set to avoid some compilation errors
+ */
+ cflags->push_back("-DCONFIG_CC_IS_CLANG");
+
return 0;
}
--
2.50.1