From 4891f212ab13941cbe89471114dc1e5cf0f8affb Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 17 Aug 2021 20:04:08 -0700 Subject: [PATCH] altos: Prepare for picolibc stdio change Instead of __iob, picolibc will use stdin, stdout and stderr globals. Signed-off-by: Keith Packard --- src/kernel/ao_stdio.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/kernel/ao_stdio.c b/src/kernel/ao_stdio.c index a42c97fb..c578c57c 100644 --- a/src/kernel/ao_stdio.c +++ b/src/kernel/ao_stdio.c @@ -188,4 +188,20 @@ ao_flushc(FILE *ignore) static FILE __stdio = FDEV_SETUP_STREAM(ao_putc, ao_getc, ao_flushc, _FDEV_SETUP_RW); +#ifdef PICOLIBC_STDIO_GLOBALS + +#ifdef __strong_reference +#define STDIO_ALIAS(x) __strong_reference(stdin, x); +#else +#define STDIO_ALIAS(x) FILE *const x = &__stdio; +#endif + +FILE *const stdin = &__stdio; +STDIO_ALIAS(stdout); +STDIO_ALIAS(stderr); + +#else + FILE *const __iob[3] = { &__stdio, &__stdio, &__stdio }; + +#endif -- 2.30.2