Fix missing declarations in libgloss m68k

Jean-Paul Mari <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAO_9iwZntF6L5PNWOa4UZqvphTFrQ2M64gGbw8X-2YBuJ1y8aA@mail.gmail.com>
This patch avoids compilation errors.
libgloss_m68k.patch (application/octet-stream, 3.3 KB)
From 2fa6d5b198b2e3b8a96ba1008006021c3ccf781f Mon Sep 17 00:00:00 2001
From: Jean-Paul Mari <[email protected]>
Date: Thu, 16 Jan 2025 17:39:42 -0500
Subject: [PATCH 0/1] *** SUBJECT HERE ***

*** BLURB HERE ***

Jean-Paul Mari (1):
  Fix missing declarations in libgloss m68k

 libgloss/m68k/leds.c       | 2 ++
 libgloss/m68k/mc68ec.c     | 2 +-
 libgloss/m68k/sim-abort.c  | 3 +++
 libgloss/m68k/sim-funcs.c  | 1 +
 libgloss/m68k/sim-inbyte.c | 2 ++
 libgloss/m68k/sim-print.c  | 2 ++
 libgloss/m68k/sim-sbrk.c   | 2 ++
 7 files changed, 13 insertions(+), 1 deletion(-)

-- 
2.45.2.windows.1

From 2fa6d5b198b2e3b8a96ba1008006021c3ccf781f Mon Sep 17 00:00:00 2001
From: Jean-Paul Mari <[email protected]>
Date: Thu, 16 Jan 2025 17:34:43 -0500
Subject: [PATCH 1/1] Fix missing declarations in libgloss m68k

This avoid compilation errors.
---
 libgloss/m68k/leds.c       | 2 ++
 libgloss/m68k/mc68ec.c     | 2 +-
 libgloss/m68k/sim-abort.c  | 3 +++
 libgloss/m68k/sim-funcs.c  | 1 +
 libgloss/m68k/sim-inbyte.c | 2 ++
 libgloss/m68k/sim-print.c  | 2 ++
 libgloss/m68k/sim-sbrk.c   | 2 ++
 7 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/libgloss/m68k/leds.c b/libgloss/m68k/leds.c
index b9112376d..96904762b 100644
--- a/libgloss/m68k/leds.c
+++ b/libgloss/m68k/leds.c
@@ -15,6 +15,8 @@
  */
 #include "leds.h"
 
+extern void delay(int);
+
 /*
  * led_putnum -- print a hex number on the LED. the value of num must be a char with
  *              the ascii value. ie... number 0 is '0', a is 'a', ' ' (null) clears
diff --git a/libgloss/m68k/mc68ec.c b/libgloss/m68k/mc68ec.c
index 76e737fe7..5543defb3 100644
--- a/libgloss/m68k/mc68ec.c
+++ b/libgloss/m68k/mc68ec.c
@@ -25,7 +25,7 @@
  *          prompt. It can be restarted from there.
  */
 void
-_exit (int_status)
+_exit (int status)
 {
   /* Use `i' constraint to get proper immediate-operand syntax for
      target assembler configuration.  */
diff --git a/libgloss/m68k/sim-abort.c b/libgloss/m68k/sim-abort.c
index 4960de8f8..affc2c672 100644
--- a/libgloss/m68k/sim-abort.c
+++ b/libgloss/m68k/sim-abort.c
@@ -14,6 +14,9 @@
  * they apply.
  */
 
+#include <stdlib.h>
+#include <unistd.h>
+
 void abort(void)
 {
   write (2, "Abort called.\n", sizeof("Abort called.\n")-1);
diff --git a/libgloss/m68k/sim-funcs.c b/libgloss/m68k/sim-funcs.c
index 712c566b2..865e752f4 100644
--- a/libgloss/m68k/sim-funcs.c
+++ b/libgloss/m68k/sim-funcs.c
@@ -15,6 +15,7 @@
 
 #define _XOPEN_SOURCE
 #include <unistd.h>
+#include <stdlib.h>
 
 int
 kill(int pid, int sig)
diff --git a/libgloss/m68k/sim-inbyte.c b/libgloss/m68k/sim-inbyte.c
index 3fa3f2474..7d2c97254 100644
--- a/libgloss/m68k/sim-inbyte.c
+++ b/libgloss/m68k/sim-inbyte.c
@@ -14,6 +14,8 @@
  * they apply.
  */
 
+#include <unistd.h>
+
 int
 inbyte ()
 {
diff --git a/libgloss/m68k/sim-print.c b/libgloss/m68k/sim-print.c
index 18ca02261..907c54144 100644
--- a/libgloss/m68k/sim-print.c
+++ b/libgloss/m68k/sim-print.c
@@ -13,6 +13,8 @@
  * they apply.
  */
 
+#include <unistd.h>
+
 /*
  * print -- do a raw print of a string
  */ 
diff --git a/libgloss/m68k/sim-sbrk.c b/libgloss/m68k/sim-sbrk.c
index 83e5287eb..771eecf06 100644
--- a/libgloss/m68k/sim-sbrk.c
+++ b/libgloss/m68k/sim-sbrk.c
@@ -14,6 +14,8 @@
  * they apply.
  */
 
+extern int brk(void *addr);
+
 extern char _end[];
 static char *curbrk = _end;
 
-- 
2.45.2.windows.1
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.