public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2 1/1] sandbox: redefine getc()
@ 2020-09-29 18:43 Heinrich Schuchardt
  2020-09-29 18:50 ` Tom Rini
  0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2020-09-29 18:43 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 on the sandbox only.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
v2:
	apply changes only to the sandbox
---
 include/stdio.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/stdio.h b/include/stdio.h
index aedf374452..43cba1dde5 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -4,6 +4,11 @@
 #include <stdarg.h>
 #include <linux/compiler.h>

+/* The SDL library invokes getc() but this should not be our getc(). */
+#ifdef CONFIG_SANDBOX
+#define getc _u_boot_getc
+#endif
+
 /* stdin */
 int getc(void);
 int tstc(void);
--
2.28.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-30 11:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-29 18:43 [PATCH v2 1/1] sandbox: redefine getc() Heinrich Schuchardt
2020-09-29 18:50 ` Tom Rini
2020-09-30 11:49   ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox