From 7fd13601052a2e5452ab3135d9bf2fb3de46a708 Mon Sep 17 00:00:00 2001 From: Daniel Thornburgh Date: Tue, 21 May 2024 18:57:29 -0700 Subject: [PATCH] Make standard file streams nonnull in minimal stdio --- mos-platform/common/c/stdio-minimal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mos-platform/common/c/stdio-minimal.c b/mos-platform/common/c/stdio-minimal.c index 5a2fdc67..b32a8f6d 100644 --- a/mos-platform/common/c/stdio-minimal.c +++ b/mos-platform/common/c/stdio-minimal.c @@ -5,9 +5,10 @@ #include #include -__attribute__((weak)) FILE *stdin; -__attribute__((weak)) FILE *stdout; -__attribute__((weak)) FILE *stderr; +// These need to be non-null, but their contents otherwise doesn't matter. +__attribute__((weak)) FILE *stdin = (FILE *)1; +__attribute__((weak)) FILE *stdout = (FILE *)1; +__attribute__((weak)) FILE *stderr = (FILE *)1; // Character input/output functions