我正在尝试编译一小段内联汇编代码,但出现这样的错误:
错误:-134的值对于170处的1个字节的字段太大
当我删除足够大的代码部分(复制的“ addl”命令”)时,错误消失了,是否有任何标志或类似的东西使我可以制作尽可能长的asm代码,或者出现问题不是因为长?
代码:
int x = 1, sm = 0;
__asm__ __volatile__ (
"movl $100000000, %%ecx\n\t"
"movl $0, %%eax\n\t"
"r:\n\t"
"addl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\t"
"addl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\t"
"addl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\t"
"addl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\t"
"addl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\t"
"addl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\t"
"addl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\t"
"addl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\t"
"addl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\taddl $0,%%eax\n\t"
"loop r\n\t"
"movl %%eax, %0\n\t"
: "=r"(sm)
: "r"(x)
: "%eax", "%ecx"
);