sim/testsuite/cris/c: Use -sim3 but only for newlib targets
authorHans-Peter Nilsson <hp@axis.com>
Mon, 14 Feb 2022 22:50:36 +0000 (23:50 +0100)
committerHans-Peter Nilsson <hp@bitrange.com>
Mon, 14 Feb 2022 22:50:36 +0000 (23:50 +0100)
commit56ba3848dc13ea58359f7eb1a5440297bfe82c6e
tree9e9a43daeea03874df86938c64b4f19cd28964fe
parent3e6dc39ed7a82facdc2b78c6f7a73ce5beff3cdf
sim/testsuite/cris/c: Use -sim3 but only for newlib targets

Commit a39487c6685f "sim: cris: use -sim with C tests for cris-elf
targets" caused " -sim" to be appended to CFLAGS_FOR_TARGET for
cris*-*-elf, where testing had until then relied on
"RUNTESTFLAGS=--target_board=cris-sim" being passed when running "make
check-sim", adding the right options.  While "-sim" happens to work,
the baseboard-file cris-sim.exp uses "-sim3" so for consistency use
that instead.

Then commit b42f20d2ac72 "sim: testsuite: drop most specific istarget
checks" caused " -sim" to be appended for *all* targets, which just
doesn't work.  For example, for crisv32-linux-gnu, that's not a
recognized option and will cause a dejagnu error and further testing
in c.exp will be aborted.

While cris-sim.exp appends "-static" for *-linux-gnu, further changes
in the test-suite have caused "linux"-specific tests to break, so that
part will be tended to separately.

But, save and restore CFLAGS_FOR_TARGET around the modification and
use where needed, to not have the CRIS-specific modification affect a
continuing test-run (possibly for other targets).

sim/testsuite/cris:
* c/c.exp (CFLAGS_FOR_TARGET): Replace appended option " -sim"
with " -sim3", but do it conditionally for newlib targets.  Save
and restore CFLAGS_FOR_TARGET in saved_CFLAGS_FOR_TARGET such
that it doesn't affect the value of CFLAGS_FOR_TARGET outside
c.exp.
sim/testsuite/cris/c/c.exp