Am Dienstag, den 22.02.2011, 11:23 -0700 schrieb Marc Jones: 
> This change breaks the default config build of libpayload. The problem
> is stdio.h and curses.h having FILE definitions. stdio.h include is
> commented out of curses.h, but adding it causes multiple definition
> issues. Do you have thoughts on the right way to fix this?
Updated patch attached.


Patrick

-- 
Patrick Georgi
SINA-Development - High Security
secunet Security Networks AG - Mergenthalerallee 77 - 65760 Eschborn, Germany
Phone +49 201 54 54-3610 - Fax +49 201 54 54-1325 - www.secunet.com 

Sitz: Kronprinzenstraße 30, 45128 Essen / Amtsgericht Essen HRB 13615
Vorstand: Dr. Rainer Baumgart (Vors.), Thomas Koelzer, Thomas Pleines
Aufsichtsratsvorsitzender: Dr. Karsten Ottenberg
From 07607cbb537033da33ec4d33178a99c32b19a699 Mon Sep 17 00:00:00 2001
From: Patrick Georgi <patrick.geo...@secunet.com>
Date: Tue, 15 Feb 2011 15:46:48 +0100
Subject: [PATCH] libpayload: Move stdin/stdout/stderr away from headers

Otherwise they exist in several object files, confusing the linker

Signed-off-by: Patrick Georgi <patrick.geo...@secunet.com>
---
 payloads/libpayload/include/curses.h |    6 +-----
 payloads/libpayload/include/stdio.h  |    7 +------
 payloads/libpayload/libc/printf.c    |    7 +++++++
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/payloads/libpayload/include/curses.h b/payloads/libpayload/include/curses.h
index 6c9307a..1859f02 100644
--- a/payloads/libpayload/include/curses.h
+++ b/payloads/libpayload/include/curses.h
@@ -148,11 +148,7 @@ typedef unsigned long chtype;
 typedef unsigned long mmask_t;
 #endif
 
-//// #include <stdio.h>
-struct _IO_FILE {
-	// FIXME
-};
-typedef struct _IO_FILE FILE;
+#include <stdio.h>
 //// #include <ncursesw/unctrl.h>
 #include <stdarg.h>	/* we need va_list */
 //// #define va_list int	// FIXME
diff --git a/payloads/libpayload/include/stdio.h b/payloads/libpayload/include/stdio.h
index fb40a0d..d39e9f8 100644
--- a/payloads/libpayload/include/stdio.h
+++ b/payloads/libpayload/include/stdio.h
@@ -32,14 +32,9 @@
 
 #include <stddef.h>
 
-struct _FILE {
-} _stdout, _stdin, _stderr;
-
 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..389d227 100644
--- a/payloads/libpayload/libc/printf.c
+++ b/payloads/libpayload/libc/printf.c
@@ -36,6 +36,13 @@
 #include <libpayload.h>
 #include <ctype.h>
 
+static struct _FILE {
+} _stdout, _stdin, _stderr;
+
+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. */
-- 
1.7.1

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to