aperf: fix compilation on x86-32 with -fPIC
PATCH 1/1 aperf: fix compilation on x86-32 with -fPIC
ebx is used to store the GOT pointer when compiled with -fPIC, so it's not usable by inline assembly.
https://bugs.gentoo.org/375967
Signed-off-by Matt Turner <[email protected]>
--- utils/cpuid.h | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)
utils/cpuid.h +13 -1
@@ -5,9 +5,21 @@ static inline void __cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { /* ecx is often an input as well as an output. */ - asmvolatile ("cpuid" + asm volatile( +#if defined(__i386__) && defined(__PIC__) + "push %%ebx\n" + "cpuid\n" + "movl %%ebx, %1\n" + "pop %%ebx\n" +#else + "cpuid\n" +#endif : "=a" (*eax), +#if defined(__i386__) && defined(__PIC__) + "=r" (*ebx), +#else "=b" (*ebx), +#endif "=c" (*ecx), "=d" (*edx) : "0" (*eax), "2" (*ecx));
Signature · 1 line
1.7.3.4
Dominik Brodowski
Appliedapplied, thanks.
Best,
Dominik
Quoted 40 lines · Matt Turner
ebx is used to store the GOT pointer when compiled with -fPIC, so it's not usable by inline assembly.
https://bugs.gentoo.org/375967
Signed-off-by Matt Turner <[email protected]>--- utils/cpuid.h | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)utils/cpuid.h +13
-1@@ -5,9 +5,21 @@ static inline void __cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { /* ecx is often an input as well as an output. */ - asmvolatile ("cpuid" + asm volatile( +#if defined(__i386__) && defined(__PIC__) + "push %%ebx\n" + "cpuid\n" + "movl %%ebx, %1\n" + "pop %%ebx\n" +#else + "cpuid\n" +#endif : "=a" (*eax), +#if defined(__i386__) && defined(__PIC__) + "=r" (*ebx), +#else "=b" (*ebx), +#endif "=c" (*ecx), "=d" (*edx) : "0" (*eax), "2" (*ecx));Signature · 1 line
1.7.3.4