aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-04-06 14:57:15 +0000
committerlloyd <[email protected]>2011-04-06 14:57:15 +0000
commit23ba06f8c8da7d71f4590e5402f50e266eb57f30 (patch)
tree1e016dc4aad741cfd2daf925e726d050481b79b2 /src
parentd0777c4db5f465a237d6a1113961ee0dbb5d392f (diff)
Call GCC's __get_cpuid macro from a function marked noinline to work
around a bug in GCC 4.[456] that prevents compilation when using optimization and PIC on 32-bit x86.
Diffstat (limited to 'src')
-rw-r--r--src/utils/cpuid.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/utils/cpuid.cpp b/src/utils/cpuid.cpp
index 9ea9e82ad..7f3b4d9b8 100644
--- a/src/utils/cpuid.cpp
+++ b/src/utils/cpuid.cpp
@@ -30,8 +30,15 @@
// Only available starting in GCC 4.3
#include <cpuid.h>
- #define CALL_CPUID(type, out) \
- do { __get_cpuid(type, out, out+1, out+2, out+3); } while(0);
+
+ /*
+ * Prevent inlining to work around GCC bug 44174
+ */
+ void __attribute__((__noinline__)) CALL_CPUID(Botan::u32bit type,
+ Botan::u32bit out[4])
+ {
+ __get_cpuid(type, out, out+1, out+2, out+3);
+ }
#else
#warning "No method of calling CPUID for this compiler"