Otherwise they exist in several object files, confusing the linker
Signed-off-by: Patrick Georgi patrick.georgi@secunet.com --- payloads/libpayload/include/stdio.h | 4 +--- payloads/libpayload/libc/printf.c | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/payloads/libpayload/include/stdio.h b/payloads/libpayload/include/stdio.h index fb40a0d..b82f380 100644 --- a/payloads/libpayload/include/stdio.h +++ b/payloads/libpayload/include/stdio.h @@ -37,9 +37,7 @@ struct _FILE {
typedef struct _FILE FILE;
-FILE *stdout = &_stdout; -FILE *stdin = &_stdin; -FILE *stderr = &_stderr; +extern FILE *stdout, *stdin, *stderr;
/** * @defgroup printf Print functions diff --git a/payloads/libpayload/libc/printf.c b/payloads/libpayload/libc/printf.c index a1ebb14..5a84ee2 100644 --- a/payloads/libpayload/libc/printf.c +++ b/payloads/libpayload/libc/printf.c @@ -36,6 +36,10 @@ #include <libpayload.h> #include <ctype.h>
+FILE *stdout = &_stdout; +FILE *stdin = &_stdin; +FILE *stderr = &_stderr; + /** Structure for specifying output methods for different printf clones. */ struct printf_spec { /* Output function, returns count of printed characters or EOF. */