From c62ebad871264657a54a1e800fa00f2c82a61743 Mon Sep 17 00:00:00 2001 From: Dale Rahn Date: Wed, 21 Mar 2001 13:51:59 +0000 Subject: __va_list is specified differently with the powerpc ABI than it is on other platforms, the list is a pointer, thus va_copy should allocate data (using alloca) for that pointer before copying the contents of the data. This allows several gnu programs to build and run correctly which insist on multiply parsing the vararg/stdarg data passed to a function. --- sys/arch/powerpc/include/va-ppc.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sys/arch/powerpc/include') diff --git a/sys/arch/powerpc/include/va-ppc.h b/sys/arch/powerpc/include/va-ppc.h index 54486c16a94..501d37d8cd0 100644 --- a/sys/arch/powerpc/include/va-ppc.h +++ b/sys/arch/powerpc/include/va-ppc.h @@ -242,7 +242,14 @@ __extension__ (*({ \ #define va_end(AP) ((void)0) /* Copy __gnuc_va_list into another variable of this type. */ -#define __va_copy(dest, src) *(dest) = *(src) +#define __va_copy(dest, src) \ +__extension__ ({ \ + (dest) = \ + (struct __va_list_tag *)__builtin_alloca(sizeof(__gnuc_va_list)); \ + *(dest) = *(src);\ + }) + + #endif /* __VA_PPC_H__ */ #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ -- cgit v1.2.3