带有'l'后缀的不正确的寄存器'%rbx' [英] incorrect register '%rbx' used with 'l' suffix
本文介绍了带有'l'后缀的不正确的寄存器'%rbx'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用gcc编译器在linux下编译此代码:
I'm trying to compile this code under linux with gcc compiler :
static inline unsigned long get_current(void)
{
unsigned long current;
asm volatile (
" movl %%esp, %%eax;"
" andl %1, %%eax;"
" movl (%%eax), %0;"
: "=r" (current)
: "i" (0xfffff000)
);
return current;
}
但是我遇到了这个错误:
But i'm getting this error :
program.c: Assembler messages: program.c:455: Error: incorrect
register `%rbx' used with `l' suffix
这是怎么了?
推荐答案
很明显,您正在编译64位.如果不是您想要的,请尝试使用gcc -m32,或者使用64位寄存器(在x64上%esp完全没有意义).
Obviously, you're compiling for 64 bits. Try using gcc -m32 if it's not what you want, or use 64-bit registers (%esp makes no sense at all on x64).
这篇关于带有'l'后缀的不正确的寄存器'%rbx'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文