[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pcc-list
Subject:    Re: [Pcc] Multiple issues still have PCC broken out-of-the-box with musl (and everywhere?)
From:       Rich Felker <dalias () libc ! org>
Date:       2015-04-22 16:42:44
Message-ID: 20150422164244.GD6817 () brightrain ! aerifal ! cx
[Download RAW message or body]

On Wed, Apr 22, 2015 at 08:59:31AM +0000, Thorsten Glaser wrote:
> >4. pcc produces horribly incorrect code for functions which return
> >structures. The code wrongly returns with "ret $0x4" instead of "ret".
> 
> I reported this already.
> 
> There are two ABIs for this: the "pcc struct return" ABI, and the
> "register struct return" one. Many GCC targets' ABI requires the
> "pcc struct return" ABI (e.g. MirBSD/i386/ELF does), and they have
> set their GCC config/{,*/}*.h files to default to it, but contemporary
> PCC *only* implements the "register struct return" ABI.
> 
> This needs to be a run-time option:
> -fpcc-struct-return vs. -freg-struct-return
> 
> This *also* needs to have a compile-time flag to set the default,
> as it absolutely MUST match the ABI the rest of the system expects.

That is NOT the issue here. I don't care which ABI it uses, but I do
care that pcc can call ITS OWN functions, in the same translation unit
and thus necessarily compiled with the same options, that return
structs. Right now, it can't. The code it produces in the caller is
incompatible with the code in the callee. Every call increments %esp
by 4 because both the caller and callee pop the hidden arg.

Rich
_______________________________________________
Pcc mailing list
Pcc@lists.ludd.ltu.se
https://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic