* Fix fr30 libgloss build
@ 2023-12-14 14:46 Jeff Law
2023-12-14 15:54 ` Jeff Johnston
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Law @ 2023-12-14 14:46 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]
gcc-14 will default to c99 and as a result a fair amount of old code in
newlib (particularly libgloss) is failing to build. I don't offhand
know how many patches will be necessary to fix the various failures.
I'll just pick them off one by one from my tree.
This particular patch works around the return-mismatch problem
syscalls.c for fr30.
That file is a bit odd in that most functions are declared as returning
an integer, but the implementations look like:
> int
> _read (file, ptr, len)
> int file;
> char * ptr;
> int len;
> {
> asm ("ldi:8 %0, r0" :: "i" (SYS_read) : "r0");
> asm ("int #10");
>
> return;
> }
Note the lack of a value on the "return" statement. The assumption is
that the interrupt handler implementing syscalls will put the return
value into the proper register, so falling off the end of the C function
or returning with no value works in the expected way. It's not good
code, but it probably works.
Working from that assumption I decided to just use a pragma to disable
the upgraded diagnostic from GCC -- essentially preserving existing
behavior.
This is the only fr30 specific issue that needs to be resolved and the
only issue (so far) I've seen of this specific nature.
OK for the trunk?
jeff
[-- Attachment #2: P --]
[-- Type: text/plain, Size: 329 bytes --]
diff --git a/libgloss/fr30/syscalls.c b/libgloss/fr30/syscalls.c
index 2558556b6..36702b03d 100644
--- a/libgloss/fr30/syscalls.c
+++ b/libgloss/fr30/syscalls.c
@@ -5,6 +5,8 @@
#include <sys/stat.h>
#include "../syscall.h"
+#pragma GCC diagnostic ignored "-Wreturn-mismatch"
+
int
_read (file, ptr, len)
int file;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Fix fr30 libgloss build
2023-12-14 14:46 Fix fr30 libgloss build Jeff Law
@ 2023-12-14 15:54 ` Jeff Johnston
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Johnston @ 2023-12-14 15:54 UTC (permalink / raw)
To: Jeff Law; +Cc: newlib
[-- Attachment #1: Type: text/plain, Size: 1508 bytes --]
Looks fine. Feel free to push.
-- Jeff J.
On Thu, Dec 14, 2023 at 9:47 AM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
> gcc-14 will default to c99 and as a result a fair amount of old code in
> newlib (particularly libgloss) is failing to build. I don't offhand
> know how many patches will be necessary to fix the various failures.
> I'll just pick them off one by one from my tree.
>
> This particular patch works around the return-mismatch problem
> syscalls.c for fr30.
>
> That file is a bit odd in that most functions are declared as returning
> an integer, but the implementations look like:
>
> > int
> > _read (file, ptr, len)
> > int file;
> > char * ptr;
> > int len;
> > {
> > asm ("ldi:8 %0, r0" :: "i" (SYS_read) : "r0");
> > asm ("int #10");
> >
> > return;
> > }
>
>
> Note the lack of a value on the "return" statement. The assumption is
> that the interrupt handler implementing syscalls will put the return
> value into the proper register, so falling off the end of the C function
> or returning with no value works in the expected way. It's not good
> code, but it probably works.
>
> Working from that assumption I decided to just use a pragma to disable
> the upgraded diagnostic from GCC -- essentially preserving existing
> behavior.
>
> This is the only fr30 specific issue that needs to be resolved and the
> only issue (so far) I've seen of this specific nature.
>
> OK for the trunk?
>
> jeff
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-14 15:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-14 14:46 Fix fr30 libgloss build Jeff Law
2023-12-14 15:54 ` Jeff Johnston
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).