]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/cpufrequtils/0006-aperf-fix-compilation-on-x86-32-with-fPIC.patch
cpufrequtils: add some patches from the debian patchset
[ipfire-2.x.git] / src / patches / cpufrequtils / 0006-aperf-fix-compilation-on-x86-32-with-fPIC.patch
CommitLineData
f50b0cbf
AF
1From 9085ce6f615d9d2e0182d3ce029b882835bd0a6b Mon Sep 17 00:00:00 2001
2From: Matt Turner <mattst88@gmail.com>
3Date: Tue, 26 Jul 2011 19:28:31 -0400
4Subject: [PATCH 6/8] aperf: fix compilation on x86-32 with -fPIC
5
6ebx is used to store the GOT pointer when compiled with -fPIC, so it's
7not usable by inline assembly.
8
9https://bugs.gentoo.org/375967
10
11Signed-off-by: Matt Turner <mattst88@gmail.com>
12Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
13---
14 utils/cpuid.h | 14 +++++++++++++-
15 1 file changed, 13 insertions(+), 1 deletion(-)
16
17diff --git a/utils/cpuid.h b/utils/cpuid.h
18index 2bac69a..53da789 100644
19--- a/utils/cpuid.h
20+++ b/utils/cpuid.h
21@@ -5,9 +5,21 @@ static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
22 unsigned int *ecx, unsigned int *edx)
23 {
24 /* ecx is often an input as well as an output. */
25- asm volatile("cpuid"
26+ asm volatile(
27+#if defined(__i386__) && defined(__PIC__)
28+ "push %%ebx\n"
29+ "cpuid\n"
30+ "movl %%ebx, %1\n"
31+ "pop %%ebx\n"
32+#else
33+ "cpuid\n"
34+#endif
35 : "=a" (*eax),
36+#if defined(__i386__) && defined(__PIC__)
37+ "=r" (*ebx),
38+#else
39 "=b" (*ebx),
40+#endif
41 "=c" (*ecx),
42 "=d" (*edx)
43 : "0" (*eax), "2" (*ecx));
44--
451.7.10
46