Error: suffix or operands invalid for `push
Error: suffix or operands invalid for `pop'
主要是pushl popl等造成。
以下是在网上找的一个列子
#include
int main(void)
{
char *str="Hello, Gcc Inline Assembly World!";
__asm__ __volatile__ (
"pushl %0;"
"call puts;"
:
:"m"(str)
);
return 0;
}
需要熟悉64指令集方能正确处理。但是若要在64位上正确编译32位,则 需要增加 -m32参数
gcc -m32 test.c
然而会报错
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: 没有那个文件或目录
这个错误主要是没有安装multilib包
在ubuntu 下安装如下
sudo apt-get install g++-4.4-multilib
以上问题是指64位下编译32位,如果直接编译64呢? 还希望各位高手赐教!