Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux '中的不可能约束;asm&x27;错误_Linux_Arm_Cross Compiling - Fatal编程技术网

Linux '中的不可能约束;asm&x27;错误

Linux '中的不可能约束;asm&x27;错误,linux,arm,cross-compiling,Linux,Arm,Cross Compiling,我尝试用ARMLIUX 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 ‘v

我尝试用ARMLIUX 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

我尝试在
gcc-4.7(SUSE linux)4.7.2 20130108上编译
Cpuid()。也不是
gcc(Ubuntu 4.8.2-19ubuntu1)4.8.2
也不是
clangversion3.5-1ubuntu1(trunk)
。这是内联x86程序集。它不会为ARM编译。@BrettHale谢谢你,伙计。您知道它是否可以轻松更改以适合ARM吗?此实用程序专门用于x86/x86-64。这本书是由拥有大量x86微优化和体系结构分析资源的人撰写的。恐怕你运气不好。