@@ -23,6 +23,20 @@ routines += ieee128-vfwprintf
routines += ieee128-vswprintf
routines += ieee128-vwprintf
+routines += ieee128-asprintf_chk
+routines += ieee128-dprintf_chk
+routines += ieee128-fprintf_chk
+routines += ieee128-printf_chk
+routines += ieee128-snprintf_chk
+routines += ieee128-sprintf_chk
+
+routines += ieee128-vasprintf_chk
+routines += ieee128-vdprintf_chk
+routines += ieee128-vfprintf_chk
+routines += ieee128-vprintf_chk
+routines += ieee128-vsnprintf_chk
+routines += ieee128-vsprintf_chk
+
# Printing long double values with IEEE binary128 format reuses part
# of the internal float128 implementation (__printf_fp, __printf_fphex,
# and __float128 variables and union members). Thus, the compilation of
@@ -40,12 +54,19 @@ tests-internal += test-wprintf-ieee128 test-wprintf-ibm128
CFLAGS-test-wprintf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-test-wprintf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+tests-internal += test-printf-chk-ieee128 test-printf-chk-ibm128
+CFLAGS-test-printf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+CFLAGS-test-printf-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+
ifeq ($(run-built-tests),yes)
tests-special += $(objpfx)test-printf-ieee128.out
tests-special += $(objpfx)test-printf-ibm128.out
tests-special += $(objpfx)test-wprintf-ieee128.out
tests-special += $(objpfx)test-wprintf-ibm128.out
+
+tests-special += $(objpfx)test-printf-chk-ieee128.out
+tests-special += $(objpfx)test-printf-chk-ibm128.out
endif
$(objpfx)test-printf-ieee128.out: \
@@ -71,4 +92,16 @@ $(objpfx)test-wprintf-ibm128.out: \
$(objpfx)test-wprintf-ibm128
$(SHELL) $^ '$(test-program-prefix)' $@; \
$(evaluate-test)
+
+$(objpfx)test-printf-chk-ieee128.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.sh \
+ $(objpfx)test-printf-chk-ieee128
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
+
+$(objpfx)test-printf-chk-ibm128.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.sh \
+ $(objpfx)test-printf-chk-ibm128
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
endif
@@ -134,5 +134,19 @@ libc {
__vfwprintfieee128;
__vswprintfieee128;
__vwprintfieee128;
+
+ __asprintf_chkieee128;
+ __dprintf_chkieee128;
+ __fprintf_chkieee128;
+ __printf_chkieee128;
+ __snprintf_chkieee128;
+ __sprintf_chkieee128;
+
+ __vasprintf_chkieee128;
+ __vdprintf_chkieee128;
+ __vfprintf_chkieee128;
+ __vprintf_chkieee128;
+ __vsnprintf_chkieee128;
+ __vsprintf_chkieee128;
}
}
new file mode 100644
@@ -0,0 +1,38 @@
+/* Wrapper for __asprintf_chk. IEEE128 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include <libio/libioP.h>
+
+extern int
+___ieee128_asprintf_chk (char **string_ptr, int flag, const char *format, ...)
+{
+ va_list ap;
+ int done;
+
+ unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+ if (flag > 0)
+ mode |= PRINTF_FORTIFY;
+
+ va_start (ap, format);
+ done = __vasprintf_internal (string_ptr, format, ap, mode);
+ va_end (ap);
+
+ return done;
+}
+strong_alias (___ieee128_asprintf_chk, __asprintf_chkieee128)
new file mode 100644
@@ -0,0 +1,38 @@
+/* Wrapper for __dprintf_chk. IEEE128 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include <libio/libioP.h>
+
+extern int
+___ieee128_dprintf_chk (int d, int flag, const char *format, ...)
+{
+ va_list ap;
+ int done;
+
+ unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+ if (flag > 0)
+ mode |= PRINTF_FORTIFY;
+
+ va_start (ap, format);
+ done = __vdprintf_internal (d, format, ap, mode);
+ va_end (ap);
+
+ return done;
+}
+strong_alias (___ieee128_dprintf_chk, __dprintf_chkieee128)
new file mode 100644
@@ -0,0 +1,38 @@
+/* Wrapper for __fprintf_chk. IEEE128 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include <libio/libioP.h>
+
+extern int
+___ieee128_fprintf_chk (FILE *fp, int flag, const char *format, ...)
+{
+ va_list ap;
+ int done;
+
+ unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+ if (flag > 0)
+ mode |= PRINTF_FORTIFY;
+
+ va_start (ap, format);
+ done = __vfprintf_internal (fp, format, ap, mode);
+ va_end (ap);
+
+ return done;
+}
+strong_alias (___ieee128_fprintf_chk, __fprintf_chkieee128)
new file mode 100644
@@ -0,0 +1,38 @@
+/* Wrapper for __printf_chk. IEEE128 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include <libio/libioP.h>
+
+extern int
+___ieee128_printf_chk (int flag, const char *format, ...)
+{
+ va_list ap;
+ int done;
+
+ unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+ if (flag > 0)
+ mode |= PRINTF_FORTIFY;
+
+ va_start (ap, format);
+ done = __vfprintf_internal (stdout, format, ap, mode);
+ va_end (ap);
+
+ return done;
+}
+strong_alias (___ieee128_printf_chk, __printf_chkieee128)
new file mode 100644
@@ -0,0 +1,42 @@
+/* Wrapper for __snprintf_chk. IEEE128 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include <libio/libioP.h>
+
+extern int
+___ieee128_snprintf_chk (char *s, size_t maxlen, int flag, size_t slen,
+ const char *format, ...)
+{
+ va_list ap;
+ int done;
+
+ unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+ if (flag > 0)
+ mode |= PRINTF_FORTIFY;
+
+ if (__glibc_unlikely (slen < maxlen))
+ __chk_fail ();
+
+ va_start (ap, format);
+ done = __vsnprintf_internal (s, maxlen, format, ap, mode);
+ va_end (ap);
+
+ return done;
+}
+strong_alias (___ieee128_snprintf_chk, __snprintf_chkieee128)
new file mode 100644
@@ -0,0 +1,42 @@
+/* Wrapper for __sprintf_chk. IEEE128 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include <libio/libioP.h>
+
+extern int
+___ieee128_sprintf_chk (char *s, int flag, size_t slen,
+ const char *format, ...)
+{
+ va_list ap;
+ int done;
+
+ unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+ if (flag > 0)
+ mode |= PRINTF_FORTIFY;
+
+ if (slen == 0)
+ __chk_fail ();
+
+ va_start (ap, format);
+ done = __vsprintf_internal (s, -1, format, ap, mode);
+ va_end (ap);
+
+ return done;
+}
+strong_alias (___ieee128_sprintf_chk, __sprintf_chkieee128)
new file mode 100644
@@ -0,0 +1,31 @@
+/* Wrapper for __vasprintf_chk. IEEE128 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <libio/libioP.h>
+
+extern int
+___ieee128_vasprintf_chk (char **result_ptr, int flag, const char *format,
+ va_list ap)
+{
+ unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+ if (flag > 0)
+ mode |= PRINTF_FORTIFY;
+
+ return __vasprintf_internal (result_ptr, format, ap, mode);
+}
+strong_alias (___ieee128_vasprintf_chk, __vasprintf_chkieee128)
new file mode 100644
@@ -0,0 +1,30 @@
+/* Wrapper for __vdprintf_chk. IEEE128 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <libio/libioP.h>
+
+extern int
+___ieee128_vdprintf_chk (int d, int flag, const char *format, va_list ap)
+{
+ unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+ if (flag > 0)
+ mode |= PRINTF_FORTIFY;
+
+ return __vdprintf_internal (d, format, ap, mode);
+}
+strong_alias (___ieee128_vdprintf_chk, __vdprintf_chkieee128)
new file mode 100644
@@ -0,0 +1,30 @@
+/* Wrapper for __vfprintf_chk. IEEE128 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <libio/libioP.h>
+
+extern int
+___ieee128_vfprintf_chk (FILE *fp, int flag, const char *format, va_list ap)
+{
+ unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+ if (flag > 0)
+ mode |= PRINTF_FORTIFY;
+
+ return __vfprintf_internal (fp, format, ap, mode);
+}
+strong_alias (___ieee128_vfprintf_chk, __vfprintf_chkieee128)
new file mode 100644
@@ -0,0 +1,30 @@
+/* Wrapper for __vprintf_chk. IEEE128 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <libio/libioP.h>
+
+extern int
+___ieee128_vprintf_chk (int flag, const char *format, va_list ap)
+{
+ unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+ if (flag > 0)
+ mode |= PRINTF_FORTIFY;
+
+ return __vfprintf_internal (stdout, format, ap, mode);
+}
+strong_alias (___ieee128_vprintf_chk, __vprintf_chkieee128)
new file mode 100644
@@ -0,0 +1,34 @@
+/* Wrapper for __vsnprintf_chk. IEEE128 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <libio/libioP.h>
+
+extern int
+___ieee128_vsnprintf_chk (char *string, size_t maxlen, int flag,
+ size_t slen, const char *format, va_list ap)
+{
+ if (__glibc_unlikely (slen < maxlen))
+ __chk_fail ();
+
+ unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+ if (flag > 0)
+ mode |= PRINTF_FORTIFY;
+
+ return __vsnprintf_internal (string, maxlen, format, ap, mode);
+}
+strong_alias (___ieee128_vsnprintf_chk, __vsnprintf_chkieee128)
new file mode 100644
@@ -0,0 +1,34 @@
+/* Wrapper for __vsprintf_chk. IEEE128 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <libio/libioP.h>
+
+extern int
+___ieee128_vsprintf_chk (char *string, int flag, size_t slen,
+ const char *format, va_list ap)
+{
+ unsigned int mode = PRINTF_LDBL_USES_FLOAT128;
+ if (flag > 0)
+ mode |= PRINTF_FORTIFY;
+
+ if (slen == 0)
+ __chk_fail ();
+
+ return __vsprintf_internal (string, -1, format, ap, mode);
+}
+strong_alias (___ieee128_vsprintf_chk, __vsprintf_chkieee128)
new file mode 100644
@@ -0,0 +1 @@
+#include <test-printf-chk-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-printf-chk-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,142 @@
+/* Test for the long double variants of *printf_chk functions.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#define _FORTIFY_SOURCE 2
+
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include <support/check.h>
+
+static void
+do_test_call_varg (FILE *stream, const char *format, ...)
+{
+ char *buffer = NULL;
+ char string[128];
+ int res;
+ va_list args;
+
+ printf ("%20s", "__vasprintf_chk: ");
+ va_start (args, format);
+ res = __vasprintf_chk (&buffer, 1, format, args);
+ va_end (args);
+ if (res == -1)
+ printf ("Error using vasprintf\n");
+ if (buffer == NULL)
+ printf ("Error using vasprintf\n");
+ else
+ {
+ printf ("%s", buffer);
+ free (buffer);
+ }
+ printf ("\n");
+
+ printf ("%20s", "__vdprintf_chk: ");
+ va_start (args, format);
+ __vdprintf_chk (1, 1, format, args);
+ va_end (args);
+ printf ("\n");
+
+ printf ("%20s", "__vfprintf_chk: ");
+ va_start (args, format);
+ __vfprintf_chk (stream, 1, format, args);
+ va_end (args);
+ printf ("\n");
+
+ printf ("%20s", "__vprintf_chk: ");
+ va_start (args, format);
+ __vprintf_chk (1, format, args);
+ va_end (args);
+ printf ("\n");
+
+ printf ("%20s", "__vsnprintf_chk: ");
+ va_start (args, format);
+ __vsnprintf_chk (string, 79, 1, 127, format, args);
+ va_end (args);
+ printf ("%s", string);
+ printf ("\n");
+
+ printf ("%20s", "__vsprintf_chk: ");
+ va_start (args, format);
+ __vsprintf_chk (string, 1, 127, format, args);
+ va_end (args);
+ printf ("%s", string);
+ printf ("\n");
+}
+
+static void
+do_test_call_rarg (FILE *stream, const char *format, long double ld)
+{
+ char *buffer = NULL;
+ char string[128];
+ int res;
+
+ printf ("%20s", "__asprintf_chk: ");
+ res = __asprintf_chk (&buffer, 1, format, ld);
+ if (res == -1)
+ printf ("Error using vasprintf\n");
+ if (buffer == NULL)
+ printf ("Error using asprintf\n");
+ else
+ {
+ printf ("%s", buffer);
+ free (buffer);
+ }
+ printf ("\n");
+
+ printf ("%20s", "__dprintf_chk: ");
+ __dprintf_chk (1, 1, format, ld);
+ printf ("\n");
+
+ printf ("%20s", "__fprintf_chk: ");
+ __fprintf_chk (stdout, 1, format, ld);
+ printf ("\n");
+
+ printf ("%20s", "__printf_chk: ");
+ __printf_chk (1, format, ld);
+ printf ("\n");
+
+ printf ("%20s", "__snprintf_chk: ");
+ __snprintf_chk (string, 79, 1, 127, format, ld);
+ printf ("%s", string);
+ printf ("\n");
+
+ printf ("%20s", "__sprintf_chk: ");
+ __sprintf_chk (string, 1, 127, format, ld);
+ printf ("%s", string);
+ printf ("\n");
+}
+
+static int
+do_test (void)
+{
+ long double ld = -1;
+
+ /* Print in decimal notation. */
+ do_test_call_rarg (stdout, "%.60Lf", ld);
+ do_test_call_varg (stdout, "%.60Lf", ld);
+
+ /* Print in hexadecimal notation. */
+ do_test_call_rarg (stdout, "%.60La", ld);
+ do_test_call_varg (stdout, "%.60La", ld);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
new file mode 100644
@@ -0,0 +1,64 @@
+#!/bin/sh
+# Testing of *printf. IEEE binary128 for powerpc64le version.
+# Copyright (C) 2018 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+set -e
+
+test_program=$1; shift
+test_program_prefix=$1; shift
+test_program_output=$1; shift
+
+status=0
+
+${test_program_prefix} \
+ ${test_program} \
+ > ${test_program_output} || status=1
+
+cat <<'EOF' |
+ __asprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+ __dprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+ __fprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+ __printf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+ __snprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+ __sprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+ __vasprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+ __vdprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+ __vfprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+ __vprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+ __vsnprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+ __vsprintf_chk: -1.000000000000000000000000000000000000000000000000000000000000
+ __asprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+ __dprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+ __fprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+ __printf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+ __snprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+ __sprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+ __vasprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+ __vdprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+ __vfprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+ __vprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+ __vsnprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+ __vsprintf_chk: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+EOF
+cmp - ${test_program_output} > /dev/null 2>&1 ||
+{
+ status=1
+ echo "*** output comparison failed"
+}
+
+exit $status