“asm”错误中不可能的约束

我想用arm-linux-gnueabi-g ++交叉编译一个c ++文件。

make CROSS_COMPILE=arm-linux-gnueabi- all 

但是发生错误:

 arm-linux-gnueabi-g++ -O2 -c -oa32.o PMCTestA.cpp In file included from PMCTest.h:54:0, from PMCTestA.cpp:24: PMCTestLinux.h: In member function 'void CCounters::GetProcessorVendor()': PMCTestLinux.h:63:73: error: impossible constraint in 'asm' make: *** [a32.o] Error 1 

下面是第61行PMCTestLinux.h中的部分代码:

 static void Cpuid (int Output[4], int aa) { int a, b, c, d; __asm("cpuid" : "=a"(a),"=b"(b),"=c"(c),"=d"(d) : "a"(aa),"c"(0) : ); Output[0] = a; Output[1] = b; Output[2] = c; Output[3] = d; } static inline void Serialize () { // serialize CPU __asm__ __volatile__ ( "xorl %%eax, %%eax \n cpuid " : : : "%eax","%ebx","%ecx","%edx" ); } static inline int Readtsc() { // read time stamp counter int r; __asm__ __volatile__ ( "rdtsc" : "=a"(r) : : "%edx"); return r; } static inline int Readpmc(int nPerfCtr) { // read performance monitor counter number nPerfCtr int r; __asm__ __volatile__ ( "rdpmc" : "=a"(r) : "c"(nPerfCtr) : "%edx"); return r; } 

有谁知道这个错误的一些事情? 我不确定问题是关于编译器的。 我的系统是Ubuntu 10.04,arm-linux-gnueabi-g ++的版本是4.7.3