Hello,

On Fri, 13 Dec 2019, Giovanni Mascellani wrote:

> TinyCC fails to test on i386 on the CI that I just set up. Apparently,
> though, the problem is not in tcc, but in gcc, which is used to compile
> the test program too and compare the results.
> 
> I managed to trim down the offending example to this:
> 
> int main() {
>     asm volatile ("mov %%eax, %%eax\n" : : "i" ("A string"));
>     return 0;
> }
> 
> If I compile this with gcc (9.2) on Debian this happens:
> 
> $ gcc -g -m32 test.c
> test.c: In function ‘main’:
> test.c:3:5: warning: asm operand 0 probably doesn’t match constraints
>     3 |     asm volatile ("mov %%eax, %%eax\n" : : "i" ("A string"));
>       |     ^~~
> test.c:3:5: error: impossible constraint in ‘asm’
> 
> I believe this is wrong, "i" should accept a literal string as value.
> Also, the same program works on Compiler Explorer[1].
> 
>  [1] https://godbolt.org/z/xAP-dy
> 
> I suspect this might be a bug in Debian's gcc. Anybody not using Debian
> could please try to compile this program and see what happens?

I had now time to look into this.  The immediate cause is that new Debian 
enables PIC by default also with -m32, which triggers the error message.  
It was always there, i.e. the construct used in the kernel is only usable 
with either x86-64 or without -fPIC/-fPIE on i386.  There are ways to 
write this construct without triggering the error message, but I want to 
test the thing as written in the kernel.  So the only option besides 
disabling the test is to force non-PIC code for it on i386, which 
means for the whole file.  I've done that now on mob with a lengthy 
comment in tcctest.c.

Oh, and the testing pipeline is useful, thanks for setting it up :-)  
(Though it would be nice if at least the native machines, i.e. 
i386 and x86-64, wouldn't use a full system emulation seemingly without 
paravirt; 8 minutes for a testrun of tcc seems a bit excessive; but as you 
said, definitely better than nothing :) )


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

Reply via email to