Re: can't find a register in class 'GENERAL_REGS' while reloading 'asm'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael Haubenwallner <michael.haubenwallner@xxxxxxxxxx> writes:

> in openssl-0.9.8e there is some inlined assembler code, which does not
> compile with -fpic (or -fPIC) and -O0 on x86-linux-gnu.

> openssl-error.c:28: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'

>        asm volatile (
>                "pushl	%%ebx\n"
>                "	leal	16(%0),%%edx\n"
>                "	leal	32(%0),%%ebx\n"
>                ".byte 0xf3,0x0f,0xa7,0xc8" "\n"
>                "	popl	%%ebx"
>                : "=a"(iv), "=c"(cnt), "=D"(out), "=S"(inp)
>                : "0"(cdata), "1"(cnt), "2"(out), "3"(inp), "m"(*cdata)
>                : "edx", "cc", "memory"
>        );

This puts iv in %eax, cnt in %ecx, out in %edi, inp in %esi, and it
lists *cdata as an explicit input.  You are using -fpic so %ebx is
used as a PIC register.  %ebp is the frame pointer.  %edx is in the
list of clobbered registers.  You are left with no registers to hold
*cdata.

I think I would write this more like
    xchg  %ebx, %2
    .byte 0xf3, 0x0f, 0xa7, 0xc8
    xchg %ebx, %2
: "+c" (cnt), "+d" (cdata->len), "+r" (cdata->addr), "+D" (out), "+S" (inp)
: "cc", "memory"

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux