[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] Inline ASM Clobber Register problems
From: |
draco |
Subject: |
[Tinycc-devel] Inline ASM Clobber Register problems |
Date: |
Sat, 12 Oct 2024 09:46:43 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Tinycc-devel] Inline ASM Clobber Register problems,
draco <=