libgloss fix for bfin port

Jeff Law jeffreyalaw@gmail.com
Tue Dec 19 04:09:03 GMT 2023



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


More information about the Newlib mailing list