Gentoo Archives: gentoo-commits

From: "Matt Turner (mattst88)" <mattst88@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-power/cpufrequtils/files: cpufrequtils-008-fix-compilation-on-x86-32-with-fPIC.patch
Date: Tue, 26 Jul 2011 23:30:17
Message-Id: 20110726233007.EAA282004B@flycatcher.gentoo.org
1 mattst88 11/07/26 23:30:07
2
3 Added:
4 cpufrequtils-008-fix-compilation-on-x86-32-with-fPIC.patch
5 Log:
6 Fix compilatin on x86-32 with -fPIC (for hardened), bug 375967.
7
8 (Portage version: 2.1.10.3/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.1 sys-power/cpufrequtils/files/cpufrequtils-008-fix-compilation-on-x86-32-with-fPIC.patch
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/cpufrequtils/files/cpufrequtils-008-fix-compilation-on-x86-32-with-fPIC.patch?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/cpufrequtils/files/cpufrequtils-008-fix-compilation-on-x86-32-with-fPIC.patch?rev=1.1&content-type=text/plain
15
16 Index: cpufrequtils-008-fix-compilation-on-x86-32-with-fPIC.patch
17 ===================================================================
18 From 28b7205609252b365b5fbcb140de22858cd631da Mon Sep 17 00:00:00 2001
19 From: Matt Turner <mattst88@×××××.com>
20 Date: Mon, 25 Jul 2011 15:11:46 -0400
21 Subject: [PATCH] aperf: fix compilation on x86-32 with -fPIC
22
23 ebx is used to store the GOT pointer when compiled with -fPIC, so it's
24 not usable by inline assembly.
25
26 https://bugs.gentoo.org/375967
27
28 Signed-off-by: Matt Turner <mattst88@×××××.com>
29 ---
30 utils/cpuid.h | 14 +++++++++++++-
31 1 files changed, 13 insertions(+), 1 deletions(-)
32
33 diff --git a/utils/cpuid.h b/utils/cpuid.h
34 index 2bac69a..53da789 100644
35 --- a/utils/cpuid.h
36 +++ b/utils/cpuid.h
37 @@ -5,9 +5,21 @@ static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
38 unsigned int *ecx, unsigned int *edx)
39 {
40 /* ecx is often an input as well as an output. */
41 - asm volatile("cpuid"
42 + asm volatile(
43 +#if defined(__i386__) && defined(__PIC__)
44 + "push %%ebx\n"
45 + "cpuid\n"
46 + "movl %%ebx, %1\n"
47 + "pop %%ebx\n"
48 +#else
49 + "cpuid\n"
50 +#endif
51 : "=a" (*eax),
52 +#if defined(__i386__) && defined(__PIC__)
53 + "=r" (*ebx),
54 +#else
55 "=b" (*ebx),
56 +#endif
57 "=c" (*ecx),
58 "=d" (*edx)
59 : "0" (*eax), "2" (*ecx));
60 --
61 1.7.3.4