@@ -11023,7 +11023,7 @@ index f25db3b0a..8e1626550 100644
1102311023 for i in $(srcdir)/libc/sys/$(sys_dir)/sys/*.h; do \
1102411024 if [ -f $$i ]; then \
1102511025diff --git a/newlib/configure.host b/newlib/configure.host
11026- index ff2e51275..7ef23d5f6 100644
11026+ index ff2e51275..dfa957d55 100644
1102711027--- a/newlib/configure.host
1102811028+++ b/newlib/configure.host
1102911029@@ -646,6 +646,14 @@ newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVID
@@ -11041,14 +11041,15 @@ index ff2e51275..7ef23d5f6 100644
1104111041 arm*-*-pe)
1104211042 syscall_dir=syscalls
1104311043 newlib_cflags="${newlib_cflags} -DHAVE_SYSCONF_PAGESIZE"
11044- @@ -818,7 +826,13 @@ newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVID
11044+ @@ -818,7 +826,14 @@ newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVID
1104511045 default_newlib_io_long_long="yes"
1104611046 newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
1104711047 ;;
1104811048- powerpc*-*-eabi* | \
1104911049+ powerpc*-*-eabi*)
11050- + default_newlib_io_c99_formats="yes"
11050+ + default_newlib_io_c99_formats="yes"
1105111051+ default_newlib_io_long_long="yes"
11052+ + default_newlib_io_pos_args="yes"
1105211053+ newlib_cflags="${newlib_cflags} -DHAVE_ASSERT_FUNC -DABORT_PROVIDED -DCUSTOM_MALLOC_LOCK -D__DYNAMIC_REENT__ -DGETREENT_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -D__DEFAULT_UTF8__"
1105311054+ newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections"
1105411055+ syscall_dir=syscalls
@@ -11960,7 +11961,7 @@ index d8dfdbd82..a85b5a99b 100644
1196011961 return 0;
1196111962 }
1196211963diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
11963- index feb1fab56..7a59eb21f 100644
11964+ index feb1fab56..99ec9c458 100644
1196411965--- a/newlib/libc/stdio/vfprintf.c
1196511966+++ b/newlib/libc/stdio/vfprintf.c
1196611967@@ -108,6 +108,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
@@ -11972,7 +11973,28 @@ index feb1fab56..7a59eb21f 100644
1197211973 #if defined(LIBC_SCCS) && !defined(lint)
1197311974 /*static char *sccsid = "from: @(#)vfprintf.c 5.50 (Berkeley) 12/16/92";*/
1197411975 static char *rcsid = "$Id$";
11975- @@ -1188,7 +1190,7 @@ reswitch: switch (ch) {
11976+ @@ -548,12 +550,19 @@ _VFPRINTF_R (struct _reent *data,
11977+ #endif
11978+
11979+ /* Macros to support positional arguments */
11980+ +
11981+ +#if _ARCH_PPC
11982+ +#define __VALIST_PTR(arg) ((va_list *)(arg))
11983+ +#else
11984+ +#define __VALIST_PTR(arg) (&(arg))
11985+ +#endif
11986+ +
11987+ #ifndef _NO_POS_ARGS
11988+ # define GET_ARG(n, ap, type) \
11989+ (is_pos_arg \
11990+ ? (n < numargs \
11991+ ? args[n].val_##type \
11992+ - : get_arg (data, n, fmt_anchor, &ap, &numargs, args, \
11993+ + : get_arg (data, n, fmt_anchor, __VALIST_PTR(ap), &numargs, args, \
11994+ arg_type, &saved_fmt)->val_##type) \
11995+ : (arg_index++ < numargs \
11996+ ? args[n].val_##type \
11997+ @@ -1188,7 +1197,7 @@ reswitch: switch (ch) {
1197611998 string:
1197711999 #endif
1197812000 sign = '\0';
@@ -11981,7 +12003,7 @@ index feb1fab56..7a59eb21f 100644
1198112003 /* Behavior is undefined if the user passed a
1198212004 NULL string when precision is not 0.
1198312005 However, if we are not optimizing for size,
11984- @@ -1198,7 +1200 ,7 @@ string:
12006+ @@ -1198,7 +1207 ,7 @@ string:
1198512007 size = ((unsigned) prec > 6U) ? 6 : prec;
1198612008 }
1198712009 else
@@ -11991,7 +12013,7 @@ index feb1fab56..7a59eb21f 100644
1199112013 if (ch == 'S' || (flags & LONGINT)) {
1199212014 mbstate_t ps;
1199312015diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c
11994- index 71e2c3e22..bd2d635ed 100644
12016+ index 71e2c3e22..960c41608 100644
1199512017--- a/newlib/libc/stdio/vfscanf.c
1199612018+++ b/newlib/libc/stdio/vfscanf.c
1199712019@@ -74,6 +74,8 @@ These are GNU extensions.
@@ -12003,8 +12025,28 @@ index 71e2c3e22..bd2d635ed 100644
1200312025 #include <_ansi.h>
1200412026 #include <reent.h>
1200512027 #include <newlib.h>
12028+ @@ -572,12 +574,18 @@ __SVFSCANF_R (struct _reent *rptr,
12029+ {10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
12030+
12031+ /* Macro to support positional arguments */
12032+ +#if _ARCH_PPC
12033+ +#define __VALIST_PTR(arg) ((va_list *)(arg))
12034+ +#else
12035+ +#define __VALIST_PTR(arg) (&(arg))
12036+ +#endif
12037+ +
12038+ #ifndef _NO_POS_ARGS
12039+ # define GET_ARG(n, ap, type) \
12040+ ((type) (is_pos_arg \
12041+ ? (n < numargs \
12042+ ? args[n] \
12043+ - : get_arg (n, &ap, &numargs, args)) \
12044+ + : get_arg (n, __VALIST_PTR(ap), &numargs, args)) \
12045+ : (arg_index++ < numargs \
12046+ ? args[n] \
12047+ : (numargs < MAX_POS_ARGS \
1200612048diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c
12007- index 5a5c36829..3eaca0ce6 100644
12049+ index 5a5c36829..3ecba7bd4 100644
1200812050--- a/newlib/libc/stdio/vfwprintf.c
1200912051+++ b/newlib/libc/stdio/vfwprintf.c
1201012052@@ -92,6 +92,9 @@ SEEALSO
@@ -12017,8 +12059,28 @@ index 5a5c36829..3eaca0ce6 100644
1201712059 #include <newlib.h>
1201812060
1201912061 #ifdef INTEGER_ONLY
12062+ @@ -538,11 +541,18 @@ _VFWPRINTF_R (struct _reent *data,
12063+
12064+ /* Macros to support positional arguments */
12065+ #ifndef _NO_POS_ARGS
12066+ +
12067+ +#if _ARCH_PPC
12068+ +#define __VALIST_PTR(arg) ((va_list *)(arg))
12069+ +#else
12070+ +#define __VALIST_PTR(arg) (&(arg))
12071+ +#endif
12072+ +
12073+ # define GET_ARG(n, ap, type) \
12074+ (is_pos_arg \
12075+ ? (n < numargs \
12076+ ? args[n].val_##type \
12077+ - : get_arg (data, n, fmt_anchor, &ap, &numargs, args, \
12078+ + : get_arg (data, n, fmt_anchor, __VALIST_PTR(ap), &numargs, args, \
12079+ arg_type, &saved_fmt)->val_##type) \
12080+ : (arg_index++ < numargs \
12081+ ? args[n].val_##type \
1202012082diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c
12021- index d2f91dde2..de80cc0c0 100644
12083+ index d2f91dde2..7c44f29fb 100644
1202212084--- a/newlib/libc/stdio/vfwscanf.c
1202312085+++ b/newlib/libc/stdio/vfwscanf.c
1202412086@@ -74,6 +74,9 @@ PORTABILITY
@@ -12031,6 +12093,26 @@ index d2f91dde2..de80cc0c0 100644
1203112093 #include <_ansi.h>
1203212094 #include <reent.h>
1203312095 #include <newlib.h>
12096+ @@ -479,11 +482,18 @@ __SVFWSCANF_R (struct _reent *rptr,
12097+
12098+ /* Macro to support positional arguments */
12099+ #ifndef _NO_POS_ARGS
12100+ +
12101+ +#if _ARCH_PPC
12102+ +#define __VALIST_PTR(arg) ((va_list *)(arg))
12103+ +#else
12104+ +#define __VALIST_PTR(arg) (&(arg))
12105+ +#endif
12106+ +
12107+ # define GET_ARG(n, ap, type) \
12108+ ((type) (is_pos_arg \
12109+ ? (n < numargs \
12110+ ? args[n] \
12111+ - : get_arg (n, &ap, &numargs, args)) \
12112+ + : get_arg (n, __VALIST_PTR(ap), &numargs, args)) \
12113+ : (arg_index++ < numargs \
12114+ ? args[n] \
12115+ : (numargs < MAX_POS_ARGS \
1203412116diff --git a/newlib/libc/stdlib/__call_atexit.c b/newlib/libc/stdlib/__call_atexit.c
1203512117index 710440389..985e720bf 100644
1203612118--- a/newlib/libc/stdlib/__call_atexit.c
0 commit comments