public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim: cris: use -sim with C tests for cris-elf targets
@ 2021-01-07  6:41 Mike Frysinger
  2021-01-07  9:29 ` Andrew Burgess
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2021-01-07  6:41 UTC (permalink / raw)
  To: gdb-patches

Building the C tests with a cris-elf toolchain (gcc-10.2 &
newlib-4.1.0) currently fail due to warnings it emits:
cris-elf-ld: libc.a(lib_a-closer.o): in function `_close_r':
newlib/libc/reent/closer.c:47: warning: _close is not implemented and will always fail

This is because the default target for cris-elf is bare metal, not
the simulator.  For that, we need -sim.  So add it for elf targets.

We don't add it for all targets as the simulator (and testsuite)
run both libgloss programs as well as Linux userspace programs.
---
 sim/testsuite/sim/cris/ChangeLog | 4 ++++
 sim/testsuite/sim/cris/c/c.exp   | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/sim/testsuite/sim/cris/ChangeLog b/sim/testsuite/sim/cris/ChangeLog
index 62ac790f8c92..5ff077c486d1 100644
--- a/sim/testsuite/sim/cris/ChangeLog
+++ b/sim/testsuite/sim/cris/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-07  Mike Frysinger  <vapier@gentoo.org>
+
+	* c/c.exp [cris*-*-elf] (CFLAGS_FOR_TARGET): Add -sim.
+
 2021-01-07  Mike Frysinger  <vapier@gentoo.org>
 
 	* c/kill2.c: Include unistd.h.
diff --git a/sim/testsuite/sim/cris/c/c.exp b/sim/testsuite/sim/cris/c/c.exp
index c9df98381e64..034c4bfd8f74 100644
--- a/sim/testsuite/sim/cris/c/c.exp
+++ b/sim/testsuite/sim/cris/c/c.exp
@@ -26,6 +26,10 @@ if [istarget cris-*-*] {
     set mach "crisv32"
 }
 
+if [istarget cris*-*-elf] {
+    append CFLAGS_FOR_TARGET " -sim"
+}
+
 # Using target_compile, since it is less noisy,
 if { [target_compile $srcdir/$subdir/hello.c compilercheck.x \
 	  "executable" "" ] == "" } {
-- 
2.28.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] sim: cris: use -sim with C tests for cris-elf targets
  2021-01-07  6:41 [PATCH] sim: cris: use -sim with C tests for cris-elf targets Mike Frysinger
@ 2021-01-07  9:29 ` Andrew Burgess
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Burgess @ 2021-01-07  9:29 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: gdb-patches

* Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> [2021-01-07 01:41:57 -0500]:

> Building the C tests with a cris-elf toolchain (gcc-10.2 &
> newlib-4.1.0) currently fail due to warnings it emits:
> cris-elf-ld: libc.a(lib_a-closer.o): in function `_close_r':
> newlib/libc/reent/closer.c:47: warning: _close is not implemented and will always fail
> 
> This is because the default target for cris-elf is bare metal, not
> the simulator.  For that, we need -sim.  So add it for elf targets.
> 
> We don't add it for all targets as the simulator (and testsuite)
> run both libgloss programs as well as Linux userspace programs.
> ---
>  sim/testsuite/sim/cris/ChangeLog | 4 ++++
>  sim/testsuite/sim/cris/c/c.exp   | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/sim/testsuite/sim/cris/ChangeLog b/sim/testsuite/sim/cris/ChangeLog
> index 62ac790f8c92..5ff077c486d1 100644
> --- a/sim/testsuite/sim/cris/ChangeLog
> +++ b/sim/testsuite/sim/cris/ChangeLog
> @@ -1,3 +1,7 @@
> +2021-01-07  Mike Frysinger  <vapier@gentoo.org>
> +
> +	* c/c.exp [cris*-*-elf] (CFLAGS_FOR_TARGET): Add -sim.
> +

LGTM.

Thanks,
Andrew


>  2021-01-07  Mike Frysinger  <vapier@gentoo.org>
>  
>  	* c/kill2.c: Include unistd.h.
> diff --git a/sim/testsuite/sim/cris/c/c.exp b/sim/testsuite/sim/cris/c/c.exp
> index c9df98381e64..034c4bfd8f74 100644
> --- a/sim/testsuite/sim/cris/c/c.exp
> +++ b/sim/testsuite/sim/cris/c/c.exp
> @@ -26,6 +26,10 @@ if [istarget cris-*-*] {
>      set mach "crisv32"
>  }
>  
> +if [istarget cris*-*-elf] {
> +    append CFLAGS_FOR_TARGET " -sim"
> +}
> +
>  # Using target_compile, since it is less noisy,
>  if { [target_compile $srcdir/$subdir/hello.c compilercheck.x \
>  	  "executable" "" ] == "" } {
> -- 
> 2.28.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-07  9:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07  6:41 [PATCH] sim: cris: use -sim with C tests for cris-elf targets Mike Frysinger
2021-01-07  9:29 ` Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).