Gentoo Archives: gentoo-commits

From: "Robin H. Johnson (robbat2)" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-block/fio/files: fio-2.0.14-pic-clobber-fix.patch
Date: Wed, 27 Mar 2013 01:59:29
Message-Id: 20130327015926.D39D32171C@flycatcher.gentoo.org
1 robbat2 13/03/27 01:59:26
2
3 Added: fio-2.0.14-pic-clobber-fix.patch
4 Log:
5 PIC compile fixes for 32-bit.
6
7 (Portage version: 2.2.0_alpha169/cvs/Linux x86_64, unsigned Manifest commit)
8
9 Revision Changes Path
10 1.1 sys-block/fio/files/fio-2.0.14-pic-clobber-fix.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-block/fio/files/fio-2.0.14-pic-clobber-fix.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-block/fio/files/fio-2.0.14-pic-clobber-fix.patch?rev=1.1&content-type=text/plain
14
15 Index: fio-2.0.14-pic-clobber-fix.patch
16 ===================================================================
17 diff -Nuar fio-2.0.14.orig/arch/arch-x86-common.h fio-2.0.14/arch/arch-x86-common.h
18 --- fio-2.0.14.orig/arch/arch-x86-common.h 2013-02-21 18:12:32.000000000 +0000
19 +++ fio-2.0.14/arch/arch-x86-common.h 2013-03-27 01:48:04.000000000 +0000
20 @@ -6,10 +6,24 @@
21 static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
22 unsigned int *ecx, unsigned int *edx)
23 {
24 +#ifdef __PIC__
25 + /* 32-bit Hardened GCC (PIC) uses register EBX, so it must be preserved
26 + * Fix ported from Gentoo's x86info-1.24-pic patch
27 + * http://tuxion.com/2010/07/02/clobber-registers.html */
28 + asm volatile(
29 + "movl %%ebx,%%edi\n"
30 + "cpuid\n"
31 + "movl %%ebx,%1\n"
32 + "movl %%edi,%%ebx\n"
33 + : "=a" (*eax), "=m" (*ebx), "=c" (*ecx), "=d" (*edx)
34 + : "0" (*eax), "2" (*ecx)
35 + : "memory", "%edi");
36 +#else
37 asm volatile("cpuid"
38 : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
39 : "0" (*eax), "2" (*ecx)
40 : "memory");
41 +#endif
42 }
43
44 static inline void cpuid(unsigned int op,