Fix crash with some older GCC versions. Reported in issue #7.

This commit is contained in:
Moinak Ghosh 2013-05-01 19:27:43 +05:30
parent eae16b82d3
commit 6e4d45b644
2 changed files with 11 additions and 5 deletions

View file

@ -112,8 +112,12 @@ cpu_exec_cpuid_ext(uint32_t* regs)
exec_cpuid(regs);
}
/*
* The function below is not inlined as it appears to bork optimized
* code generation on some older buggy GCC versions.
*/
void
cpuid_get_raw_data(struct cpu_raw_data_t* data)
NOINLINE_ATTR cpuid_get_raw_data(struct cpu_raw_data_t* data)
{
unsigned i;
for (i = 0; i < 32; i++)

View file

@ -116,11 +116,13 @@ typedef int32_t bsize_t;
# define ATOMIC_SUB(var, val) __sync_fetch_and_sub(&var, val)
# define PREFETCH_WRITE(x, n) __builtin_prefetch((x), 1, (n))
# define PREFETCH_READ(x, n) __builtin_prefetch((x), 0, (n))
# define NOINLINE_ATTR __attribute__((noinline))
#else
# define likely(expr) (expr)
# define unlikely(expr) (expr)
# define PREFETCH_WRITE(x, n)
# define PREFETCH_READ(x, n)
# define NOINLINE_ATTR
# if defined(sun) || defined (__sun)
# include <atomic.h>
# define ATOMIC_ADD(var, val) atomic_add_int(&var, val)