altos: Prepare for picolibc stdio change
authorKeith Packard <keithp@keithp.com>
Wed, 18 Aug 2021 03:04:08 +0000 (20:04 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 7 Sep 2021 06:07:56 +0000 (23:07 -0700)
Instead of __iob, picolibc will use stdin, stdout and stderr globals.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/kernel/ao_stdio.c

index a42c97fbb2ecd085c87ce6b59ace4aaae788aa1c..c578c57cd920b3bc6ea5e4af4c1af8520cfd8283 100644 (file)
@@ -188,4 +188,20 @@ ao_flushc(FILE *ignore)
 
 static FILE __stdio = FDEV_SETUP_STREAM(ao_putc, ao_getc, ao_flushc, _FDEV_SETUP_RW);
 
 
 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 };
 FILE *const __iob[3] = { &__stdio, &__stdio, &__stdio };
+
+#endif