summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>2021-05-27 22:59:56 +0200
committerKhem Raj <raj.khem@gmail.com>2021-07-14 09:53:49 -0700
commit8463239cac07c2ced6dc467490cd83779a793ee3 (patch)
tree33ab11aaaa4486b22282fcf66712c2b62cb1b8ec
parent0e37c5009f59076584407dbfb653bbabfb7e7bc1 (diff)
downloadmeta-clang-8463239cac07c2ced6dc467490cd83779a793ee3.tar.gz
Allow building cpufrequtils with clang
Make sure invalid assembly code isn't included even in unreachable code; remove TOOLCHAIN=gcc workaround. Signed-off-by: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>
-rw-r--r--conf/nonclangable.conf5
-rw-r--r--recipes-bsp/cpufrequtils/cpufrequtils/cpufrequtils-008-fix-build-on-non-x86.patch32
-rw-r--r--recipes-bsp/cpufrequtils/cpufrequtils_%.bbappend2
3 files changed, 34 insertions, 5 deletions
diff --git a/conf/nonclangable.conf b/conf/nonclangable.conf
index a51213f..a7f32d4 100644
--- a/conf/nonclangable.conf
+++ b/conf/nonclangable.conf
@@ -1,9 +1,4 @@
1TOOLCHAIN_pn-u-boot = "gcc" 1TOOLCHAIN_pn-u-boot = "gcc"
2# In file included from utils/aperf.c:56:
3# utils/cpuid.h:17:8: error: invalid output constraint '=a' in asm
4# : "=a" (*eax),
5# (seen on aarch64 with clang 12.0, cpufrequtils 008)
6TOOLCHAIN_pn-cpufrequtils = "gcc"
7# crash embeds version of gdb which is not buildable with clang 2# crash embeds version of gdb which is not buildable with clang
8TOOLCHAIN_pn-crash = "gcc" 3TOOLCHAIN_pn-crash = "gcc"
9TOOLCHAIN_pn-elfutils = "gcc" 4TOOLCHAIN_pn-elfutils = "gcc"
diff --git a/recipes-bsp/cpufrequtils/cpufrequtils/cpufrequtils-008-fix-build-on-non-x86.patch b/recipes-bsp/cpufrequtils/cpufrequtils/cpufrequtils-008-fix-build-on-non-x86.patch
new file mode 100644
index 0000000..0006add
--- /dev/null
+++ b/recipes-bsp/cpufrequtils/cpufrequtils/cpufrequtils-008-fix-build-on-non-x86.patch
@@ -0,0 +1,32 @@
1From: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>
2Date: Thu, 27 May 2021 22:51:00 +0200
3Subject: [PATCH] utils: Fix build on non-x86 with clang
4
5Without this patch, there is an invalid asm construct (forcing EAX) on
6non-x86 architectures in unreachable code.
7
8gcc allows this (because it throws out the unreachable code before checking
9it), but clang does not.
10
11Signed-off-by: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>
12Upstream-Status: Pending
13
14diff -up git/utils/cpuid.h.omv~ git/utils/cpuid.h
15--- git/utils/cpuid.h.omv~ 2021-05-27 22:44:44.833614642 +0200
16+++ git/utils/cpuid.h 2021-05-27 22:45:25.546050445 +0200
17@@ -1,6 +1,8 @@
18 #ifndef _CPUFREQ_CPUID_H
19 #define _CPUFREQ_CPUID_H
20
21+#if defined(__i386__) || defined(__x86_64__)
22+
23 static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
24 unsigned int *ecx, unsigned int *edx)
25 {
26@@ -72,4 +74,6 @@ static inline unsigned int cpuid_edx(uns
27 return edx;
28 }
29
30+#endif /* i386 || x86_64 */
31+
32 #endif /* _CPUFREQ_CPUID_H */
diff --git a/recipes-bsp/cpufrequtils/cpufrequtils_%.bbappend b/recipes-bsp/cpufrequtils/cpufrequtils_%.bbappend
new file mode 100644
index 0000000..3b201f1
--- /dev/null
+++ b/recipes-bsp/cpufrequtils/cpufrequtils_%.bbappend
@@ -0,0 +1,2 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2SRC_URI_append = " file://cpufrequtils-008-fix-build-on-non-x86.patch"