* [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* [PATCH v2 1/1] sandbox: redefine getc()
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
0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2020-09-29 18:50 UTC (permalink / raw)
To: u-boot
On Tue, Sep 29, 2020 at 08:43:12PM +0200, Heinrich Schuchardt wrote:
> 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
Wolfgang, I was wondering could we not, given the few callers of 'getc'
carefully change our internal usage / name to 'getchar', which is more
POSIX-like and have our EXPORT_FUNC line be:
EXPORT_FUNC(getc, int, getchar, void)
and that might be the clean solution here?
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200929/2b60e470/attachment.sig>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/1] sandbox: redefine getc()
2020-09-29 18:50 ` Tom Rini
@ 2020-09-30 11:49 ` Wolfgang Denk
0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2020-09-30 11:49 UTC (permalink / raw)
To: u-boot
Dear Tom,
In message <20200929185004.GO14816@bill-the-cat> you wrote:
>
> Wolfgang, I was wondering could we not, given the few callers of 'getc'
> carefully change our internal usage / name to 'getchar', which is more
> POSIX-like and have our EXPORT_FUNC line be:
> EXPORT_FUNC(getc, int, getchar, void)
I guess we could, indeed.
> and that might be the clean solution here?
Probably.
I haven't tested this, though.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If I have seen further it is by standing on the shoulders of giants.
- Isaac Newton, Letter to Robert Hooke, 5 February 1676
^ permalink raw reply [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