Re: [RFC PATCH v2 3/8] tools/nolibc: i386: Implement syscall with 6 arguments

From: Willy Tarreau
Date: Wed Mar 23 2022 - 03:10:32 EST


On Wed, Mar 23, 2022 at 01:29:39PM +0700, Ammar Faizi wrote:
> On 3/22/22 8:37 PM, David Laight wrote:
> > dunno, 'asm' register variables are rather more horrid and
> > should probably only be used (for asm statements) when there aren't
> > suitable register constraints.
> >
> > (I'm sure there is a comment about that in the gcc docs.)
>
> ^ Hey David, yes you're right, that is very interesting...
>
> I hit a GCC bug when playing with syscall6() implementation here.
>
> Using register variables for all inputs for syscall6() causing GCC 11.2
> stuck in an endless loop with 100% CPU usage. Reproducible with several
> versions of GCC.
>
> In GCC 6.3, the syscall6() implementation above yields ICE (Internal
> Compiler Error):
> ```
> <source>: In function '__sys_mmap':
> <source>:35:1: error: unable to find a register to spill

Now I'm pretty sure that it was the issue I faced when trying long ago,
I remember this error message before I found it wiser to give up.

Willy