All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] common: redefine getc()
@ 2020-09-28 23:45 Heinrich Schuchardt
  0 siblings, 0 replies; only message in thread
From: Heinrich Schuchardt @ 2020-09-28 23:45 UTC (permalink / raw)
  To: u-boot

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

    int getc(FILE *)

This does not match our definition.

    int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol to be called _u_boot_getc(). To keep the coding
changes minimal use a define.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 include/_exports.h | 2 +-
 include/exports.h  | 2 +-
 include/stdio.h    | 2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/_exports.h b/include/_exports.h
index 1e9ba86108..1da78dea1a 100644
--- a/include/_exports.h
+++ b/include/_exports.h
@@ -8,7 +8,7 @@
 #define EXPORT_FUNC(a, b, c, ...)
 #endif
 	EXPORT_FUNC(get_version, unsigned long, get_version, void)
-	EXPORT_FUNC(getc, int, getc, void)
+	EXPORT_FUNC(getc, int, _u_boot_getc, void)
 	EXPORT_FUNC(tstc, int, tstc, void)
 	EXPORT_FUNC(putc, void, putc, const char)
 	EXPORT_FUNC(puts, void, puts, const char *)
diff --git a/include/exports.h b/include/exports.h
index b300554091..f982b1b49b 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -20,7 +20,7 @@ void jumptable_init(void);

 /* These are declarations of exported functions available in C code */
 unsigned long get_version(void);
-int  getc(void);
+int  _u_boot_getc(void);
 int  tstc(void);
 void putc(const char);
 void puts(const char*);
diff --git a/include/stdio.h b/include/stdio.h
index aedf374452..a204e06c69 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -4,6 +4,8 @@
 #include <stdarg.h>
 #include <linux/compiler.h>

+#define getc _u_boot_getc
+
 /* stdin */
 int getc(void);
 int tstc(void);
--
2.28.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-28 23:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28 23:45 [PATCH 1/1] common: redefine getc() Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.