sandbox: redefine getc()
PATCH v2 1/1 sandbox: redefine getc()
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.
---
v2:
apply changes only to the sandbox
--- include/stdio.h | 5 +++++ 1 file changed, 5 insertions(+)
include/stdio.h +5 -0
@@ -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
PATCH v2 1/1 sandbox: redefine getc()
Quoted 11 lines · Heinrich Schuchardt
The sandbox is built with the SDL2 library with invokes the X11 library which in turn calls
getc(). Butgetc()in glibc is defined asint
getc(FILE *)This does not match our definition.
int getc(void)
The sandbox crashes when called with parameter -l.
Quoted 7 lines
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 <[email protected]>---
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?
Signature · 8 lines
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>
PATCH v2 1/1 sandbox: redefine getc()
Dear Tom,
Quoted 5 lines · 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_FUNCline be:EXPORT_FUNC(getc, int, getchar, void)
I guess we could, indeed.
Quoted 1 line
and that might be the clean solution here?
Probably.
I haven't tested this, though.
Best regards,
Wolfgang Denk
Signature · 5 lines
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