Hi,

I have dug up some old code from a project named CInvoke from 2005 and
tried to compile with tcc, where I ran into two problems.

First, the notation of clobber-registers tcc accepts:

It uses the following notation for inline assembler (i386 win32), where
the clobber-regs are notated as %eax

    __asm__("mov %0, %%eax; \
            mov %1, %%edx" :: \
            "m" ((archvalue).ivallow), \
            "m" ((archvalue).ivalhigh) : \
            "%eax", "%edx");

I'm not firm with assembler these days, so I can't judge if this is even
a legit notation or if gcc just swallows it. But tcc doesn't recognize
the regs, as it won't remove the leading et % char. Would be super easy
to solve, just insert if(str[0]=='%') str++; into asm_clobber to make
sure, it reads the register name correctly. But I'm unsure if  that's
neccessary or if the code is just off.

Second, more important, tcc considers clobbering st (float stack) as
illegal. I found some old mails on this list from 2015 or so, but the
discussion lead nowhere and ended without result. So TCC will refuse to
compile code like the following  :

        __asm__("fldl %0" :: \
                "m" ((archvalue).dval) : \
                "%st"); \

Solving this is far out of reach for me, but I wanted to update the
issue here, maybe someone already has a solution ready to patch :-)

I think the same problems arise for x86_64 and other architectures and OS.

Regards

Michael



_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to