升级gcc 4.8 / devtoolset-2后,汇编程序错误(“setz”的操作数类型不匹配)

时间:2017-08-29 04:04:55

标签: c gcc assembly x86 inline-assembly

通过devtoolset-2升级到gcc 4.8后,我无法再在我们的旧应用程序中编译一个第三方文件,它抱怨Error: operand type mismatch for setz 我们没有编写代码,并且已经在各种gcc版本上编译了10多年。

我也升级了binutils。

我不知道汇编程序。代码中只有两个setz命令。语法有什么问题,我该如何解决?谢谢你的帮助。

    setz %%bl;\
    cmpb $0,%%al;\
    setz %0;\
    xorb %%bl,2(%%edi);\

32位Centos 6. Core 2 Duo。编译行:

cc -W -Wall -O3 -DHAS_STDINT -Wall -mmmx -fasm -c -o h264/decoder/biaridecod.o h264/decoder/biaridecod.c
h264/decoder/biaridecod.c: Assembler messages:
h264/decoder/biaridecod.c:319: Error: operand type mismatch for `setz'

工具信息

$ which as cc
/opt/rh/devtoolset-2/root/usr/bin/as
/opt/rh/devtoolset-2/root/usr/bin/cc
$ as --version
GNU assembler version 2.23.52.0.1-10.el6 20130226
$ cc --version
cc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)

代码片段

inline unsigned int biari_decode_symbol(DecodingEnvironmentPtr dep, BiContextTypePtr bi_ct )
{
    unsigned int bit;

    asm volatile("\
    movl $0,%0;\
    movl %1,%%esi;\
    movl %2,%%edi;\
    movl 4(%%esi),%%eax;\
    movzwl (%%edi),%%ebx;\
    movl 8(%%esi),%%ecx;\
    movl %%eax,%%edx;\
    shrl $6,%%eax;\
    andl $3,%%eax;\
    movzbl rLPS_table_64x4(%%eax,%%ebx,4),%%ebx;\
    subl %%ebx,%%edx;\
    movzbl 2(%%edi),%%eax;\
    cmpl %%edx,%%ecx;\
    jge DL_BIGA;\
    movl %%eax,%0;\
    cmpw $62,(%%edi);\
    jge DL_ENDA;\
    incw (%%edi);\
    jmp DL_ENDA;\
DL_BIGA:\
    subl %%edx,%%ecx;\
    movl %%ebx,%%edx;\
    movl %%ecx,8(%%esi);\
    cmpw $0,(%%edi);\
    setz %%bl;\
    cmpb $0,%%al;\
    setz %0;\
    xorb %%bl,2(%%edi);\
    movzwl (%%edi),%%eax;\
    movzwl AC_next_state_LPS_64(,%%eax,2),%%ebx;\
    movw %%bx,(%%edi);\
DL_ENDA:\
    bsr %%edx,%%ebx;\
    movl $8,%%ecx;\
    subl %%ebx,%%ecx;\
    xorl %%eax,%%eax;\
    cmpl $0,%%ecx;\
    cmovle %%eax,%%ecx;\
    movl %%ecx,%%ebx;\
    shll %%cl,%%edx;\
    movl %%edx,4(%%esi);\
    cmpl $0,%%ebx;\
    jle DL_WHILE_END;\
DL_WHILEA:\
    cmp $0,16(%%esi);\
    jg DL_IFA;\
    movl 20(%%esi),%%eax;\
    movl 24(%%esi),%%edi;\
    movl (%%eax),%%edx;\
    incl (%%eax);\
    movzbl (%%edi,%%edx),%%ecx;\
    movl $8,16(%%esi);\
    movl %%ecx,12(%%esi);\
    DL_IFA:\
    movl 12(%%esi),%%edx;\
    movl 16(%%esi),%%ecx;\
    movl $1,%%eax;\
    cmpl %%ecx,%%ebx;\
    cmovl %%ebx,%%ecx;\
    shll %%cl,8(%%esi);\
    subl %%ecx,16(%%esi);\
    shll %%cl,%%eax;\
    subl %%ecx,%%ebx;\
    decl %%eax;\
    movl 16(%%esi),%%ecx;\
    shrl %%cl,%%edx;\
    andl %%eax,%%edx;\
    orl %%edx,8(%%esi);\
    cmpl $0,%%ebx;\
    jg DL_WHILEA;\
DL_WHILE_END:"
    :"=g"(bit)
    :"g"(dep),"g"(bi_ct)
    :"eax","ebx","ecx","edx","esi","edi","mm0","mm1","mm2","mm3","mm4","mm5","mm6","mm7");

    return(bit);

0 个答案:

没有答案