[6/7,MSP430,TESTSUITE] Fix tests requiring float printf support when GCC was configured with --enable-newlib-nano-formatted-io

Message ID 1a8ccaa3-739c-bf83-f484-de4e3a64e9ed@mittosystems.com
State New
Headers show
Series
  • Fix GCC tests for msp430-elf
Related show

Commit Message

Jozef Lawrynowicz Nov. 14, 2018, 3:58 p.m.
Patch 6 fixes tests expecting printf float support for targets which have been
configured with "newlib-nano-formatted-io". When newlib is configured in this
way, float printf is enabled at build time by registering _printf_float as an
undefined symbol.

Comments

Mike Stump Nov. 26, 2018, 8:26 p.m. | #1
On Nov 14, 2018, at 7:58 AM, Jozef Lawrynowicz <jozef.l@mittosystems.com> wrote:
> 

> Patch 6 fixes tests expecting printf float support for targets which have been

> configured with "newlib-nano-formatted-io". When newlib is configured in this

> way, float printf is enabled at build time by registering _printf_float as an

> undefined symbol.


Ok.

Patch

From 15a04e0139ec40196ddb79f1125635029dccae68 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Sat, 10 Nov 2018 16:02:25 +0000
Subject: [PATCH 6/7] [TESTSUITE] Fix tests requiring float printf support when
 GCC was configured with --enable-newlib-nano-formatted-io

2018-11-14  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	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.
---
 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               | 4 ++++
 5 files changed, 14 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.x

diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-8.c b/gcc/testsuite/gcc.c-torture/execute/920501-8.c
index 62780a0..7e4fa17 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 <stdio.h>
 #include <stdarg.h>
 
diff --git a/gcc/testsuite/gcc.c-torture/execute/930513-1.c b/gcc/testsuite/gcc.c-torture/execute/930513-1.c
index 4544471..f163007 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 <stdio.h>
 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 0000000..8edec730
--- /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 6f8b7a9..5684fd7 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 5235d5e..ced1582 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -8946,3 +8946,7 @@  proc check_effective_target_cet { } {
 	}
     } "-O2" ]
 }
+
+proc check_effective_target_newlib_nano_io { } {
+    return [check_configured_with "--enable-newlib-nano-formatted-io"]
+}
-- 
2.7.4