"Fossies" - the Fresh Open Source Software Archive

Member "ipfire-2.x-2.27-core174/src/patches/cpufrequtils/0006-aperf-fix-compilation-on-x86-32-with-fPIC.patch" (7 Apr 2023, 1245 Bytes) of package /linux/misc/ipfire-2.x-2.27-core174.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Diff source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 From 9085ce6f615d9d2e0182d3ce029b882835bd0a6b Mon Sep 17 00:00:00 2001
    2 From: Matt Turner <mattst88@gmail.com>
    3 Date: Tue, 26 Jul 2011 19:28:31 -0400
    4 Subject: [PATCH 6/8] aperf: fix compilation on x86-32 with -fPIC
    5 
    6 ebx is used to store the GOT pointer when compiled with -fPIC, so it's
    7 not usable by inline assembly.
    8 
    9 https://bugs.gentoo.org/375967
   10 
   11 Signed-off-by: Matt Turner <mattst88@gmail.com>
   12 Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
   13 ---
   14  utils/cpuid.h |   14 +++++++++++++-
   15  1 file changed, 13 insertions(+), 1 deletion(-)
   16 
   17 diff --git a/utils/cpuid.h b/utils/cpuid.h
   18 index 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 -- 
   45 1.7.10
   46