Re: libgloss fix for bfin port

Jeff Law <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>

On 12/18/23 09:35, Mike Frysinger wrote:
> On 16 Dec 2023 21:57, Jeff Law wrote:
>> gcc-14 will complain loudly both for calling a function without an
>> in-scope prototype or when the in scope prototype differs from the known
>> signature.
>>
>> "main" happens to be one of the functions the compiler knows about.  So
>> not only do we need to prototype it, we need to make sure the prototype
>> matches what GCC thinks it should be.
>>
>> This fixes the bfin libgloss port to do the right thing for bfin-elf.
>>
>> OK for the trunk?
> 
> OK
> 
>> --- a/libgloss/bfin/syscalls.c
>> +++ b/libgloss/bfin/syscalls.c
>> @@ -27,6 +27,8 @@
>>   #include <reent.h>
>>   #include <unistd.h>
>>   
>> +int main (int, char **, char **);
> 
> shouldn't it have `extern` for completeness at least ?
Sure.  Easy enough to fix.

> 
> would be nice if we had more clarity on 2-vs-3 signature main in newlib,
> but it's fine here to just set another register to 0 before calling.
Yea.  IIRC we can't pass environments on some targets, or at least not 
easily.  -fpermissive might be the only way forward for those, though 
I'd like to avoid -fpermissive if we can.

jeff
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.