From 571bbd0d48d5872eacbd0b681fce6e1ae754520b Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz Date: Mon, 26 Nov 2018 21:35:43 +0000 Subject: [PATCH] sourcebuild.texi: Document check_effective_target_newlib_nano_io. 2018-11-26 Jozef Lawrynowicz gcc/ChangeLog: * doc/sourcebuild.texi: Document check_effective_target_newlib_nano_io. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_newlib_nano_io): New. * gcc.c-torture/execute/920501-8.c: Register undefined linker symbol _printf_float for newlib_nano_io target. * gcc.c-torture/execute/930513-1.c: Likewise. * gcc.dg/torture/builtin-sprintf.c: Likewise. * gcc.c-torture/execute/ieee/920810-1.x: New. From-SVN: r266488 --- gcc/ChangeLog | 4 ++++ gcc/doc/sourcebuild.texi | 4 ++++ gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/gcc.c-torture/execute/920501-8.c | 2 ++ gcc/testsuite/gcc.c-torture/execute/930513-1.c | 2 ++ gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.x | 4 ++++ gcc/testsuite/gcc.dg/torture/builtin-sprintf.c | 3 ++- gcc/testsuite/lib/target-supports.exp | 5 +++++ 8 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.x diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2d7bcb83f33..fd5e8c292a4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2018-11-26 Jozef Lawrynowicz + + * doc/sourcebuild.texi: Document check_effective_target_newlib_nano_io. + 2018-11-26 Jakub Jelinek PR target/88195 diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index b8ab0ee629f..6a81b17693f 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2152,6 +2152,10 @@ Target supports @code{mmap}. @item newlib Target supports Newlib. +@item newlib_nano_io +GCC was configured with @code{--enable-newlib-nano-formatted-io}, which reduces +the code size of Newlib formatted I/O functions. + @item pow10 Target provides @code{pow10} function. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 47f8b199357..c617d27fc65 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2018-11-26 Jozef Lawrynowicz + + * lib/target-supports.exp (check_effective_target_newlib_nano_io): New. + * gcc.c-torture/execute/920501-8.c: Register undefined linker symbol + _printf_float for newlib_nano_io target. + * gcc.c-torture/execute/930513-1.c: Likewise. + * gcc.dg/torture/builtin-sprintf.c: Likewise. + * gcc.c-torture/execute/ieee/920810-1.x: New. + 2018-11-26 Jakub Jelinek PR target/88195 diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-8.c b/gcc/testsuite/gcc.c-torture/execute/920501-8.c index 62780a08cc7..7e4fa172ccd 100644 --- a/gcc/testsuite/gcc.c-torture/execute/920501-8.c +++ b/gcc/testsuite/gcc.c-torture/execute/920501-8.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-Wl,-u,_printf_float" { target newlib_nano_io } } */ + #include #include diff --git a/gcc/testsuite/gcc.c-torture/execute/930513-1.c b/gcc/testsuite/gcc.c-torture/execute/930513-1.c index 4544471ec7d..f1630076800 100644 --- a/gcc/testsuite/gcc.c-torture/execute/930513-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/930513-1.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-Wl,-u,_printf_float" { target newlib_nano_io } } */ + #include char buf[2]; diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.x new file mode 100644 index 00000000000..8edec730dce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.x @@ -0,0 +1,4 @@ +if { [check_effective_target_newlib_nano_io] } { + lappend additional_flags "-Wl,-u,_printf_float" +} +return 0 diff --git a/gcc/testsuite/gcc.dg/torture/builtin-sprintf.c b/gcc/testsuite/gcc.dg/torture/builtin-sprintf.c index 6f8b7a9fb1b..5684fd704ae 100644 --- a/gcc/testsuite/gcc.dg/torture/builtin-sprintf.c +++ b/gcc/testsuite/gcc.dg/torture/builtin-sprintf.c @@ -1,6 +1,7 @@ /* PR tree-optimization/86274 - SEGFAULT when logging std::to_string(NAN) { dg-do run } - { dg-options "-O2 -Wall" } */ + { dg-options "-O2 -Wall" } + { dg-additional-options "-Wl,-u,_printf_float" { target newlib_nano_io } } */ #define X "0xdeadbeef" #define nan(x) __builtin_nan (x) diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index fe7169158e4..7bfd5c32354 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -6710,6 +6710,11 @@ proc check_effective_target_newlib {} { }] } +# Return true if GCC was configured with --enable-newlib-nano-formatted-io +proc check_effective_target_newlib_nano_io { } { + return [check_configured_with "--enable-newlib-nano-formatted-io"] +} + # Some newlib versions don't provide a frexpl and instead depend # on frexp to implement long double conversions in their printf-like # functions. This leads to broken results. Detect such versions here. -- 2.30.2