[uClibc]__va_copy in new stdio

Miles Bader miles at lsi.nec.co.jp
Wed Mar 13 02:23:47 UTC 2002


<stdarg.h> on my platform doesn't define `__va_copy', so the function
`_ppfs_prepargs' in libc/stdio/printf.c gets undefined symbol errors
when linking.

The glibc manual suggests that a simple copy will often suffice for
platforms that don't have this macro (and indeed, of the platforms I
noticed that define it, only the PPC uses something besides a simple
copy).

So how about the following patch:


--- printf.c.~1.22.~	Wed Mar 13 10:01:33 2002
+++ printf.c	Wed Mar 13 11:16:17 2002
@@ -468,7 +468,14 @@ void _ppfs_prepargs(register ppfs_t *ppf
 {
 	int i;
 
+#ifdef __va_copy
 	__va_copy(ppfs->arg, arg);
+#else
+#warning __va_copy is not defined, using a simple copy instead...
+	/* the glibc manual suggests that this will usually suffice when
+	   __va_copy doesn't exist.  */
+	ppfs->arg = arg;
+#endif
 
 	if ((i = ppfs->maxposarg) > 0)  { /* init for positional args */
 		ppfs->num_data_args = i;


-Miles
-- 
We live, as we dream -- alone....



More information about the uClibc mailing list