[Intel-gfx] xf86-video-intel (git-13461a1): BROKEN with clang-3.2 due to __cpuid() not available?

Sedat Dilek sedat.dilek at gmail.com
Tue Feb 26 13:35:51 CET 2013


With xf86-video-intel-git13461a1 [1] I see this:

[ build-log ]
...
  CC     sna_cpu.lo
8 warnings generated.
  CC     sna_damage.lo
  CC     sna_display.lo
sna_cpu.c:47:2: error: implicit declaration of function '__cpuid' is
invalid in C99 [-Werror,-Wimplicit-function-declaration]
        __cpuid(1, eax, ebx, ecx, edx);
        ^
sna_cpu.c:49:12: error: use of undeclared identifier 'bit_SSE3'
        if (eax & bit_SSE3)
                  ^
sna_cpu.c:52:12: error: use of undeclared identifier 'bit_SSSE3'
        if (eax & bit_SSSE3)
                  ^
sna_cpu.c:55:12: error: use of undeclared identifier 'bit_SSE4_1'
        if (eax & bit_SSE4_1)
                  ^
sna_cpu.c:58:12: error: use of undeclared identifier 'bit_SSE4_2'
        if (eax & bit_SSE4_2)
                  ^
sna_cpu.c:61:12: error: use of undeclared identifier 'bit_AVX'
        if (eax & bit_AVX)
                  ^
sna_cpu.c:64:12: error: use of undeclared identifier 'bit_MMX'
        if (edx & bit_MMX)
                  ^
sna_cpu.c:67:12: error: use of undeclared identifier 'bit_SSE'
        if (edx & bit_SSE)
                  ^
sna_cpu.c:70:12: error: use of undeclared identifier 'bit_SSE2'
        if (edx & bit_SSE2)
                  ^
sna_cpu.c:73:12: error: use of undeclared identifier 'bit_SSE4a'
        if (edx & bit_SSE4a)
                  ^
10 errors generated.
make[4]: *** [sna_cpu.lo] Error 1
make[4]: *** Waiting for unfinished jobs....

I checked for installed cpuid.h files, can't say if you this requires
the one from kernel or compiler sources.

In my running Linux-Next (next-20130226) kernel I have no "cpuid.h" header-file.

Checking the compiler side:

[ /usr/lib/gcc/x86_64-linux-gnu/4.6/include/cpuid.h ]
...
#if __GNUC__ >= 3
#define __cpuid(level, a, b, c, d)                      \
  __asm__ ("xchg{l}\t{%%}ebx, %1\n\t"                   \
           "cpuid\n\t"                                  \
           "xchg{l}\t{%%}ebx, %1\n\t"                   \
           : "=a" (a), "=r" (b), "=c" (c), "=d" (d)     \
           : "0" (level))
...
#endif
...

[ /opt/llvm/lib/clang/3.2/include/cpuid.h ]
...
static inline int __get_cpuid (unsigned int level, unsigned int *eax,
                               unsigned int *ebx, unsigned int *ecx,
                               unsigned int *edx) {
    __asm("cpuid" : "=a"(*eax), "=b" (*ebx), "=c"(*ecx), "=d"(*edx) :
"0"(level));
    return 1;
}
...

So, clang should be treated differently?

Regards,
- Sedat -

[1] http://cgit.freedesktop.org/xorg/driver/xf86-video-intel/commit/src/sna/sna_cpu.c?id=13461a18b1605feb17304d52136d100df50ca296
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-3-2_cpuid.h
Type: text/x-chdr
Size: 1606 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20130226/5e2b9f0c/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-4-6_cpuid.h
Type: text/x-chdr
Size: 5624 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20130226/5e2b9f0c/attachment-0001.h>


More information about the Intel-gfx mailing list