This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH] MIPS: If a test in the MIPS testsuite requires standard library support check the sysroot supports the required test options.
- From: Toma Tabacu <Toma dot Tabacu at imgtec dot com>
- To: Andrew Bennett <Andrew dot Bennett at imgtec dot com>, Matthew Fortune <Matthew dot Fortune at imgtec dot com>, "'Moore, Catherine'" <Catherine_Moore at mentor dot com>, "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 17 Nov 2016 12:54:02 +0000
- Subject: RE: [PATCH] MIPS: If a test in the MIPS testsuite requires standard library support check the sysroot supports the required test options.
- Authentication-results: sourceware.org; auth=none
- References: <0DA23CC379F5F945ACB41CF394B98277210F9A11@LEMAIL01.le.imgtec.org> <FD3DCEAC5B03E9408544A1E416F112420192C97995@NA-MBX-04.mgc.mentorg.com> <6D39441BF12EF246A7ABCE6654B023532124BA16@LEMAIL01.le.imgtec.org> <0DA23CC379F5F945ACB41CF394B98277211136C2@LEMAIL01.le.imgtec.org> <0DA23CC379F5F945ACB41CF394B982776D88AD11@HHMAIL01.hh.imgtec.org>
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Andrew Bennett
> Sent: 03 November 2016 11:33
> To: Matthew Fortune; 'Moore, Catherine'; 'gcc-patches@gcc.gnu.org'
> Subject: RE: [PATCH] MIPS: If a test in the MIPS testsuite requires standard
> library support check the sysroot supports the required test options.
>
> Ping.
>
>
> Regards,
>
>
>
> Andrew
>
> > -----Original Message-----
> > From: Andrew Bennett
> > Sent: 28 August 2015 16:50
> > To: Matthew Fortune; Moore, Catherine; gcc-patches@gcc.gnu.org
> > Subject: RE: [PATCH] MIPS: If a test in the MIPS testsuite requires standard
> > library support check the sysroot supports the required test options.
> >
> > > I had some comments on this that I hadn't got round to posting. The fix in
> > > this patch is not general enough as the missing header problem comes in
> > > two (related) forms:
> > >
> > > 1) Using the new MTI and IMG sysroot layout we can end up with GCC
> looking
> > > for headers in a sysroot that simply does not exist. The current patch
> > > handles this.
> > > 2) Using any sysroot layout (i.e. a simple mips-linux-gnu) it is possible
> > > for the stdlib.h header to be found but the ABI dependent gnu-stubs
> > > header may not be installed depending on soft/hard nan1985/nan2008.
> > >
> > > The test for stdlib.h needs to therefore verify that preprocessing succeeds
> > > rather than just testing for an error relating to stdlib.h. This could be
> > > done by adding a further option to mips_preprocess to indicate the
> processor
> > > output should go to a file and that the caller wants the messages emitted
> > > by the compiler instead.
> > >
> > > A second issue is that you have added (REQUIRES_STDLIB) to too many
> tests.
> > > You only need to add it to tests that request a compiler option (via
> > > dg-options) that could potentially lead to forcing soft/hard nan1985/nan2008
> > > directly or indirectly. So -mips32r6 implies nan2008 so you need it -
> > mips32r5
> > > implies nan1985 so you need it. There are at least two tests which don't
> > > need the option but you need to check them all so we don't run the check
> > > needlessly.
> >
> > The updated patch and ChangeLog that addresses Matthew's comments is
> below.
> >
> > Ok to commit?
> >
> > Regards,
> >
> >
> > Andrew
> >
> >
> > testsuite/
> >
> > * gcc.target/mips/loongson-simd.c (dg-options): Add
> > (REQUIRES_STDLIB).
> > * gcc.target/mips/loongson-shift-count-truncated-1.c: Ditto
> > * gcc.target/mips/mips-3d-1.c: Ditto
> > * gcc.target/mips/mips-3d-2.c: Ditto
> > * gcc.target/mips/mips-3d-3.c: Ditto
> > * gcc.target/mips/mips-3d-4.c: Ditto
> > * gcc.target/mips/mips-3d-5.c: Ditto
> > * gcc.target/mips/mips-3d-6.c: Ditto
> > * gcc.target/mips/mips-3d-7.c: Ditto
> > * gcc.target/mips/mips-3d-8.c: Ditto
> > * gcc.target/mips/mips-3d-9.c: Ditto
> > * gcc.target/mips/mips-ps-1.c: Ditto
> > * gcc.target/mips/mips-ps-2.c: Ditto
> > * gcc.target/mips/mips-ps-3.c: Ditto
> > * gcc.target/mips/mips-ps-4.c: Ditto
> > * gcc.target/mips/mips-ps-6.c: Ditto
> > * gcc.target/mips/mips16-attributes.c: Ditto
> > * gcc.target/mips/mips32-dsp-run.c: Ditto
> > * gcc.target/mips/mips32-dsp.c: Ditto
> > * gcc.target/mips/save-restore-1.c: Ditto
> > * gcc.target/mips/mips.exp (mips_option_groups): Add stdlib.
> > (mips_preprocess): Add ignore_output argument that when set
> > will not return the pre-processed output.
> > (mips_arch_info): Update arguments for the call to
> > mips_preprocess.
> > (mips-dg-init): Ditto.
> > (mips-dg-options): Check if a test having test option
> > (REQUIRES_STDLIB) has the required sysroot support for
> > the current test options.
> >
> >
> >
> > diff --git a/gcc/testsuite/gcc.target/mips/loongson-shift-count-truncated-1.c
> > b/gcc/testsuite/gcc.target/mips/loongson-shift-count-truncated-1.c
> > index f57a18c..baed48c 100644
> > --- a/gcc/testsuite/gcc.target/mips/loongson-shift-count-truncated-1.c
> > +++ b/gcc/testsuite/gcc.target/mips/loongson-shift-count-truncated-1.c
> > @@ -4,7 +4,7 @@
> > /* loongson.h does not handle or check for MIPS16ness. There doesn't
> > seem any good reason for it to, given that the Loongson processors
> > do not support MIPS16. */
> > -/* { dg-options "isa=loongson -mhard-float -mno-mips16" } */
> > +/* { dg-options "isa=loongson -mhard-float -mno-mips16
> (REQUIRES_STDLIB)" }
> > */
> > /* See PR 52155. */
> > /* { dg-options "isa=loongson -mhard-float -mno-mips16 -mlong64" { mips*-
> *-
> > elf* && ilp32 } } */
> >
> > diff --git a/gcc/testsuite/gcc.target/mips/loongson-simd.c
> > b/gcc/testsuite/gcc.target/mips/loongson-simd.c
> > index 6d2ceb6..f263b43 100644
> > --- a/gcc/testsuite/gcc.target/mips/loongson-simd.c
> > +++ b/gcc/testsuite/gcc.target/mips/loongson-simd.c
> > @@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
> > because inclusion of some system headers e.g. stdint.h will fail due to
> > not
> > finding stubs-o32_hard.h. */
> > /* { dg-require-effective-target mips_nanlegacy } */
> > -/* { dg-options "isa=loongson -mhard-float -mno-micromips -mno-mips16 -
> flax-
> > vector-conversions" } */
> > +/* { dg-options "isa=loongson -mhard-float -mno-micromips -mno-mips16 -
> flax-
> > vector-conversions (REQUIRES_STDLIB)" } */
> >
> > #include "loongson.h"
> > #include <stdio.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-1.c
> > b/gcc/testsuite/gcc.target/mips/mips-3d-1.c
> > index f11ffc5..3a3318d 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-3d-1.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-3d-1.c
> > @@ -1,5 +1,5 @@
> > /* { dg-do run } */
> > -/* { dg-options "-mips3d" } */
> > +/* { dg-options "-mips3d (REQUIRES_STDLIB)" } */
> >
> > /* Test MIPS-3D builtin functions */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-2.c
> > b/gcc/testsuite/gcc.target/mips/mips-3d-2.c
> > index b04c3bf..3464ed4 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-3d-2.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-3d-2.c
> > @@ -1,5 +1,5 @@
> > /* { dg-do run } */
> > -/* { dg-options "-mips3d" } */
> > +/* { dg-options "-mips3d (REQUIRES_STDLIB)" } */
> >
> > /* Test MIPS-3D branch-if-any-two builtin functions */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-3.c
> > b/gcc/testsuite/gcc.target/mips/mips-3d-3.c
> > index e4de8fb..1051afd 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-3d-3.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-3d-3.c
> > @@ -1,5 +1,5 @@
> > /* { dg-do run } */
> > -/* { dg-options "-mips3d" } */
> > +/* { dg-options "-mips3d (REQUIRES_STDLIB)" } */
> >
> > /* Test MIPS-3D absolute compare builtin functions */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-4.c
> > b/gcc/testsuite/gcc.target/mips/mips-3d-4.c
> > index 3d28d7f..f898346 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-3d-4.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-3d-4.c
> > @@ -1,5 +1,5 @@
> > /* { dg-do run } */
> > -/* { dg-options "-mips3d" } */
> > +/* { dg-options "-mips3d (REQUIRES_STDLIB)" } */
> >
> > /* Test MIPS-3D branch-if-any-four builtin functions */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-5.c
> > b/gcc/testsuite/gcc.target/mips/mips-3d-5.c
> > index a433675..21638f1 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-3d-5.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-3d-5.c
> > @@ -1,5 +1,5 @@
> > /* { dg-do run } */
> > -/* { dg-options "-mips3d" } */
> > +/* { dg-options "-mips3d (REQUIRES_STDLIB)" } */
> >
> > /* Test MIPS-3D absolute-compare & branch-if-any-four builtin functions */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-6.c
> > b/gcc/testsuite/gcc.target/mips/mips-3d-6.c
> > index e6b44f0..2b2417c 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-3d-6.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-3d-6.c
> > @@ -1,5 +1,5 @@
> > /* { dg-do run } */
> > -/* { dg-options "-mips3d" } */
> > +/* { dg-options "-mips3d (REQUIRES_STDLIB)" } */
> >
> > /* Test MIPS-3D absolute compare (floats) builtin functions */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-7.c
> > b/gcc/testsuite/gcc.target/mips/mips-3d-7.c
> > index 2531ddf..0370bfb 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-3d-7.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-3d-7.c
> > @@ -1,5 +1,5 @@
> > /* { dg-do run } */
> > -/* { dg-options "-mips3d" } */
> > +/* { dg-options "-mips3d (REQUIRES_STDLIB)" } */
> >
> > /* Test MIPS-3D absolute compare (doubles) builtin functions */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-8.c
> > b/gcc/testsuite/gcc.target/mips/mips-3d-8.c
> > index 1d199d7..8780f0b 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-3d-8.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-3d-8.c
> > @@ -1,5 +1,5 @@
> > /* { dg-do run } */
> > -/* { dg-options "-mips3d" } */
> > +/* { dg-options "-mips3d (REQUIRES_STDLIB)" } */
> >
> > /* Test MIPS-3D absolute compare and conditional move builtin functions */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-9.c
> > b/gcc/testsuite/gcc.target/mips/mips-3d-9.c
> > index d697efd..021a404 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-3d-9.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-3d-9.c
> > @@ -1,5 +1,5 @@
> > /* { dg-do run } */
> > -/* { dg-options "-mips3d" } */
> > +/* { dg-options "-mips3d (REQUIRES_STDLIB)" } */
> >
> > /* Matrix Multiplications */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-1.c
> > b/gcc/testsuite/gcc.target/mips/mips-ps-1.c
> > index 73598a8..fcd9448 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-ps-1.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-ps-1.c
> > @@ -1,5 +1,5 @@
> > /* { dg-do run } */
> > -/* { dg-options "-mpaired-single" } */
> > +/* { dg-options "-mpaired-single (REQUIRES_STDLIB)" } */
> >
> > /* Test v2sf calculations */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-2.c
> > b/gcc/testsuite/gcc.target/mips/mips-ps-2.c
> > index 5264255..85cf29e 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-ps-2.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-ps-2.c
> > @@ -1,5 +1,5 @@
> > /* { dg-do run } */
> > -/* { dg-options "-mpaired-single" } */
> > +/* { dg-options "-mpaired-single (REQUIRES_STDLIB)" } */
> >
> > /* Test MIPS paired-single builtin functions */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-3.c
> > b/gcc/testsuite/gcc.target/mips/mips-ps-3.c
> > index 7e6ffd0..e498a42 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-ps-3.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-ps-3.c
> > @@ -1,5 +1,5 @@
> > /* { dg-do run } */
> > -/* { dg-options "-mpaired-single" } */
> > +/* { dg-options "-mpaired-single (REQUIRES_STDLIB)" } */
> >
> > /* Test MIPS paired-single conditional move */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-4.c
> > b/gcc/testsuite/gcc.target/mips/mips-ps-4.c
> > index 06850ad..472f382 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-ps-4.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-ps-4.c
> > @@ -1,5 +1,5 @@
> > /* { dg-do run } */
> > -/* { dg-options "-mpaired-single" } */
> > +/* { dg-options "-mpaired-single (REQUIRES_STDLIB)" } */
> >
> > /* Test MIPS paired-single comparisons */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-6.c
> > b/gcc/testsuite/gcc.target/mips/mips-ps-6.c
> > index 5bdfe43..fd82d72 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips-ps-6.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips-ps-6.c
> > @@ -1,7 +1,7 @@
> > /* mips-ps-2.c with an extra -ffinite-math-only option. This option
> > changes the way that abs.ps is handled. */
> > /* { dg-do run } */
> > -/* { dg-options "-mpaired-single -ffinite-math-only" } */
> > +/* { dg-options "-mpaired-single -ffinite-math-only (REQUIRES_STDLIB)" } */
> >
> > /* Test MIPS paired-single builtin functions */
> > #include <stdlib.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips.exp
> > b/gcc/testsuite/gcc.target/mips/mips.exp
> > index 55e4223..f086e27 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips.exp
> > +++ b/gcc/testsuite/gcc.target/mips/mips.exp
> > @@ -254,6 +254,7 @@ set mips_option_groups {
> > madd "HAS_MADD"
> > maddps "HAS_MADDPS"
> > lsa "(|!)HAS_LSA"
> > + stdlib "REQUIRES_STDLIB"
> > section_start "-Wl,--section-start=.*"
> > }
> >
> > @@ -406,14 +407,19 @@ proc mips_same_option_p { option1 option2 } {
> >
> > # Preprocess CODE using target_compile options OPTIONS. Return the
> > # compiler output.
> > -proc mips_preprocess { options code } {
> > +proc mips_preprocess { options code ignore_output } {
> > global tool
> >
> > set src dummy[pid].c
> > set f [open $src "w"]
> > puts $f $code
> > close $f
> > - set output [${tool}_target_compile $src "" preprocess $options]
> > + if { $ignore_output } {
> > + set output [${tool}_target_compile $src dummy[pid].i preprocess
> > $options]
> > + file delete dummy[pid].i
> > + } else {
> > + set output [${tool}_target_compile $src "" preprocess $options]
> > + }
> > file delete $src
> >
> > return $output
> > @@ -463,7 +469,7 @@ proc mips_arch_info { arch prop } {
> > #else
> > int isa_rev = 0;
> > #endif
> > - }]
> > + } 0]
> > foreach lhs { isa isa_rev } {
> > regsub ".*$lhs = (\[^;\]*).*" $output {\1} rhs
> > verbose -log "Architecture $arch has $lhs $rhs"
> > @@ -816,7 +822,7 @@ proc mips-dg-init {} {
> >
> > 0
> > };
> > - }]
> > + } 0]
> > foreach line [split $output "\r\n"] {
> > # Poor man's string concatenation.
> > regsub -all {" "} $line "" line
> > @@ -1390,6 +1396,22 @@ proc mips-dg-options { args } {
> > }
> > }
> >
> > + # If the test is marked as requiring standard libraries check
> > + # that the sysroot has support for the current set of test options.
> > + if { [mips_have_test_option_p options "REQUIRES_STDLIB"] } {
> > + mips_push_test_options saved_options $extra_tool_flags
> > + set output [mips_preprocess "" {
> > + #include <stdlib.h>
> > + } 1]
> > + mips_pop_test_options saved_options
> > +
> > + # If the preprocessing of the stdlib.h file produced errors mark
> > + # the test as unsupported.
> > + if { ![string equal $output ""] } {
> > + set do_what [lreplace $do_what 1 1 "N"]
> > + }
> > + }
> > +
> > # If the test is MIPS16-compatible, provide a counterpart to the
> > # NOMIPS16 convenience macro.
> > if { [mips_have_test_option_p options "-mips16"] } {
> > diff --git a/gcc/testsuite/gcc.target/mips/mips16-attributes.c
> > b/gcc/testsuite/gcc.target/mips/mips16-attributes.c
> > index 28bb9aa..421aa77 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips16-attributes.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips16-attributes.c
> > @@ -2,7 +2,7 @@
> > of calling a nomips16/mips16/default function from a
> > nomips16/mips16/default
> > function. */
> > /* { dg-do run } */
> > -/* { dg-options "(-mips16)" } */
> > +/* { dg-options "(-mips16) (REQUIRES_STDLIB)" } */
> >
> > #include <stdlib.h>
> >
> > diff --git a/gcc/testsuite/gcc.target/mips/mips32-dsp-run.c
> > b/gcc/testsuite/gcc.target/mips/mips32-dsp-run.c
> > index ccd9d38..ca12d04 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips32-dsp-run.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips32-dsp-run.c
> > @@ -1,6 +1,6 @@
> > /* Test MIPS32 DSP instructions */
> > /* { dg-do run } */
> > -/* { dg-options "-mdsp" } */
> > +/* { dg-options "-mdsp (REQUIRES_STDLIB)" } */
> >
> > #include <stdlib.h>
> > #include <stdio.h>
> > diff --git a/gcc/testsuite/gcc.target/mips/mips32-dsp.c
> > b/gcc/testsuite/gcc.target/mips/mips32-dsp.c
> > index 9aaf120..d212bcf 100644
> > --- a/gcc/testsuite/gcc.target/mips/mips32-dsp.c
> > +++ b/gcc/testsuite/gcc.target/mips/mips32-dsp.c
> > @@ -1,6 +1,6 @@
> > /* Test MIPS32 DSP instructions */
> > /* { dg-do compile } */
> > -/* { dg-options "-mgp32 -mdsp" } */
> > +/* { dg-options "-mgp32 -mdsp (REQUIRES_STDLIB)" } */
> > /* { dg-final { scan-assembler "\taddq.ph\t" } } */
> > /* { dg-final { scan-assembler "\taddq_s.ph\t" } } */
> > /* { dg-final { scan-assembler "\taddq_s.w\t" } } */
> > diff --git a/gcc/testsuite/gcc.target/mips/save-restore-1.c
> > b/gcc/testsuite/gcc.target/mips/save-restore-1.c
> > index b3ce1b1..5e1e838 100644
> > --- a/gcc/testsuite/gcc.target/mips/save-restore-1.c
> > +++ b/gcc/testsuite/gcc.target/mips/save-restore-1.c
> > @@ -1,5 +1,5 @@
> > /* Check that we can use the save instruction to save varargs. */
> > -/* { dg-options "(-mips16) isa_rev>=1 -mabi=32" } */
> > +/* { dg-options "(-mips16) isa_rev>=1 -mabi=32 (REQUIRES_STDLIB)" } */
> >
> > #include <stdarg.h>
> >
Hi,
The patch below is a rebased version of Andrew's patch plus a few more changes
to test options.
I have tested Andrew's patch by passing -msoft-float to the testsuite without
having a soft-float library available, and saw that the inline-memcpy-{1,2,3,4,5}.c
and memcpy-1.c tests were also failing to find standard library headers.
In the version below, I have added (REQUIRES_STDLIB) to them as well.
However, I believe that the memcpy-1.c test was removed from the first version
of Andrew's patch in response to Matthew's comments, but I don't think it
should be.
Tested with mips-img-linux-gnu and mips-mti-linux-gnu.
Regards,
Toma Tabacu
gcc/testsuite/ChangeLog:
* gcc.target/mips/inline-memcpy-1.c (dg-options): Add
(REQUIRES_STDLIB).
* gcc.target/mips/inline-memcpy-2.c: Ditto.
* gcc.target/mips/inline-memcpy-3.c: Ditto.
* gcc.target/mips/inline-memcpy-4.c: Ditto.
* gcc.target/mips/inline-memcpy-5.c: Ditto.
* gcc.target/mips/loongson-shift-count-truncated-1.c: Ditto.
* gcc.target/mips/loongson-simd.c: Ditto.
* gcc.target/mips/memcpy-1.c: Ditto.
* gcc.target/mips/mips-3d-1.c: Ditto.
* gcc.target/mips/mips-3d-2.c: Ditto.
* gcc.target/mips/mips-3d-3.c: Ditto.
* gcc.target/mips/mips-3d-4.c: Ditto.
* gcc.target/mips/mips-3d-5.c: Ditto.
* gcc.target/mips/mips-3d-6.c: Ditto.
* gcc.target/mips/mips-3d-7.c: Ditto.
* gcc.target/mips/mips-3d-8.c: Ditto.
* gcc.target/mips/mips-3d-9.c: Ditto.
* gcc.target/mips/mips-ps-1.c: Ditto.
* gcc.target/mips/mips-ps-2.c: Ditto.
* gcc.target/mips/mips-ps-3.c: Ditto.
* gcc.target/mips/mips-ps-4.c: Ditto.
* gcc.target/mips/mips-ps-6.c: Ditto.
* gcc.target/mips/mips16-attributes.c: Ditto.
* gcc.target/mips/mips32-dsp-run.c: Ditto.
* gcc.target/mips/mips32-dsp.c: Ditto.
* gcc.target/mips/save-restore-1.c: Ditto.
* gcc.target/mips/mips.exp (mips_option_groups): Add stdlib.
(mips_preprocess): Add ignore_output argument that when set
will not return the pre-processed output.
(mips_arch_info): Update arguments for the call to
mips_preprocess.
(mips-dg-init): Ditto.
(mips-dg-options): Check if a test having test option
(REQUIRES_STDLIB) has the required sysroot support for
the current test options.
diff --git a/gcc/testsuite/gcc.target/mips/inline-memcpy-1.c b/gcc/testsuite/gcc.target/mips/inline-memcpy-1.c
index 5a254b1..8b1ad80 100644
--- a/gcc/testsuite/gcc.target/mips/inline-memcpy-1.c
+++ b/gcc/testsuite/gcc.target/mips/inline-memcpy-1.c
@@ -1,4 +1,4 @@
-/* { dg-options "-fno-common isa_rev>=6" } */
+/* { dg-options "-fno-common isa_rev>=6 (REQUIRES_STDLIB)" } */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" "-Os" } { "" } } */
/* { dg-final { scan-assembler-not "\tmemcpy" } } */
diff --git a/gcc/testsuite/gcc.target/mips/inline-memcpy-2.c b/gcc/testsuite/gcc.target/mips/inline-memcpy-2.c
index e144e61..e9feb93 100644
--- a/gcc/testsuite/gcc.target/mips/inline-memcpy-2.c
+++ b/gcc/testsuite/gcc.target/mips/inline-memcpy-2.c
@@ -1,4 +1,4 @@
-/* { dg-options "-fno-common isa_rev>=6" } */
+/* { dg-options "-fno-common isa_rev>=6 (REQUIRES_STDLIB)" } */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" "-Os"} { "" } } */
/* { dg-final { scan-assembler-not "\tmemcpy" } } */
/* { dg-final { scan-assembler-times "\tsh\t" 16 } } */
diff --git a/gcc/testsuite/gcc.target/mips/inline-memcpy-3.c b/gcc/testsuite/gcc.target/mips/inline-memcpy-3.c
index 96a0387..3bdb28b 100644
--- a/gcc/testsuite/gcc.target/mips/inline-memcpy-3.c
+++ b/gcc/testsuite/gcc.target/mips/inline-memcpy-3.c
@@ -1,4 +1,4 @@
-/* { dg-options "-fno-common isa_rev<=5" } */
+/* { dg-options "-fno-common isa_rev<=5 (REQUIRES_STDLIB)" } */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" "-Os"} { "" } } */
/* { dg-final { scan-assembler-not "\tmemcpy" } } */
/* { dg-final { scan-assembler-times "swl" 8 } } */
diff --git a/gcc/testsuite/gcc.target/mips/inline-memcpy-4.c b/gcc/testsuite/gcc.target/mips/inline-memcpy-4.c
index 0e7a22e..d64eb5d 100644
--- a/gcc/testsuite/gcc.target/mips/inline-memcpy-4.c
+++ b/gcc/testsuite/gcc.target/mips/inline-memcpy-4.c
@@ -1,4 +1,4 @@
-/* { dg-options "-fno-common isa_rev<=5 -mabi=64" } */
+/* { dg-options "-fno-common isa_rev<=5 -mabi=64 (REQUIRES_STDLIB)" } */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" "-Os"} { "" } } */
/* { dg-final { scan-assembler-not "\tmemcpy" } } */
/* { dg-final { scan-assembler-times "sdl" 4 } } */
diff --git a/gcc/testsuite/gcc.target/mips/inline-memcpy-5.c b/gcc/testsuite/gcc.target/mips/inline-memcpy-5.c
index 1b9fa16..55ee38a 100644
--- a/gcc/testsuite/gcc.target/mips/inline-memcpy-5.c
+++ b/gcc/testsuite/gcc.target/mips/inline-memcpy-5.c
@@ -1,4 +1,4 @@
-/* { dg-options "-fno-common isa_rev<=5 -mabi=n32" } */
+/* { dg-options "-fno-common isa_rev<=5 -mabi=n32 (REQUIRES_STDLIB)" } */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" "-Os"} { "" } } */
/* { dg-final { scan-assembler-not "\tmemcpy" } } */
/* { dg-final { scan-assembler-times "sdl" 4 } } */
diff --git a/gcc/testsuite/gcc.target/mips/loongson-shift-count-truncated-1.c b/gcc/testsuite/gcc.target/mips/loongson-shift-count-truncated-1.c
index f57a18c..baed48c 100644
--- a/gcc/testsuite/gcc.target/mips/loongson-shift-count-truncated-1.c
+++ b/gcc/testsuite/gcc.target/mips/loongson-shift-count-truncated-1.c
@@ -4,7 +4,7 @@
/* loongson.h does not handle or check for MIPS16ness. There doesn't
seem any good reason for it to, given that the Loongson processors
do not support MIPS16. */
-/* { dg-options "isa=loongson -mhard-float -mno-mips16" } */
+/* { dg-options "isa=loongson -mhard-float -mno-mips16 (REQUIRES_STDLIB)" } */
/* See PR 52155. */
/* { dg-options "isa=loongson -mhard-float -mno-mips16 -mlong64" { mips*-*-elf* && ilp32 } } */
diff --git a/gcc/testsuite/gcc.target/mips/loongson-simd.c b/gcc/testsuite/gcc.target/mips/loongson-simd.c
index 6d2ceb6..f263b43 100644
--- a/gcc/testsuite/gcc.target/mips/loongson-simd.c
+++ b/gcc/testsuite/gcc.target/mips/loongson-simd.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
because inclusion of some system headers e.g. stdint.h will fail due to not
finding stubs-o32_hard.h. */
/* { dg-require-effective-target mips_nanlegacy } */
-/* { dg-options "isa=loongson -mhard-float -mno-micromips -mno-mips16 -flax-vector-conversions" } */
+/* { dg-options "isa=loongson -mhard-float -mno-micromips -mno-mips16 -flax-vector-conversions (REQUIRES_STDLIB)" } */
#include "loongson.h"
#include <stdio.h>
diff --git a/gcc/testsuite/gcc.target/mips/memcpy-1.c b/gcc/testsuite/gcc.target/mips/memcpy-1.c
index 94786a7..bd8519f 100644
--- a/gcc/testsuite/gcc.target/mips/memcpy-1.c
+++ b/gcc/testsuite/gcc.target/mips/memcpy-1.c
@@ -1,4 +1,4 @@
-/* { dg-options "-fno-common" } */
+/* { dg-options "-fno-common (REQUIRES_STDLIB)" } */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */
/* { dg-final { scan-assembler-not "\tlbu\t" } } */
diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-1.c b/gcc/testsuite/gcc.target/mips/mips-3d-1.c
index 9c67513..cb827ad 100644
--- a/gcc/testsuite/gcc.target/mips/mips-3d-1.c
+++ b/gcc/testsuite/gcc.target/mips/mips-3d-1.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
+/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D builtin functions */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-2.c b/gcc/testsuite/gcc.target/mips/mips-3d-2.c
index 4da059f..52ec3a5 100644
--- a/gcc/testsuite/gcc.target/mips/mips-3d-2.c
+++ b/gcc/testsuite/gcc.target/mips/mips-3d-2.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
+/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D branch-if-any-two builtin functions */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-3.c b/gcc/testsuite/gcc.target/mips/mips-3d-3.c
index fcdcf24..cfb9ea8 100644
--- a/gcc/testsuite/gcc.target/mips/mips-3d-3.c
+++ b/gcc/testsuite/gcc.target/mips/mips-3d-3.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
+/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D absolute compare builtin functions */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-4.c b/gcc/testsuite/gcc.target/mips/mips-3d-4.c
index 340921c..ca4923c 100644
--- a/gcc/testsuite/gcc.target/mips/mips-3d-4.c
+++ b/gcc/testsuite/gcc.target/mips/mips-3d-4.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
+/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D branch-if-any-four builtin functions */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-5.c b/gcc/testsuite/gcc.target/mips/mips-3d-5.c
index e7dbfeb..86523d2 100644
--- a/gcc/testsuite/gcc.target/mips/mips-3d-5.c
+++ b/gcc/testsuite/gcc.target/mips/mips-3d-5.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
+/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D absolute-compare & branch-if-any-four builtin functions */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-6.c b/gcc/testsuite/gcc.target/mips/mips-3d-6.c
index d75faa1..8e8fbb6 100644
--- a/gcc/testsuite/gcc.target/mips/mips-3d-6.c
+++ b/gcc/testsuite/gcc.target/mips/mips-3d-6.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
+/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D absolute compare (floats) builtin functions */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-7.c b/gcc/testsuite/gcc.target/mips/mips-3d-7.c
index 8e69d49..20f0199 100644
--- a/gcc/testsuite/gcc.target/mips/mips-3d-7.c
+++ b/gcc/testsuite/gcc.target/mips/mips-3d-7.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
+/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D absolute compare (doubles) builtin functions */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-8.c b/gcc/testsuite/gcc.target/mips/mips-3d-8.c
index 0ad8c48..c59f547 100644
--- a/gcc/testsuite/gcc.target/mips/mips-3d-8.c
+++ b/gcc/testsuite/gcc.target/mips/mips-3d-8.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
+/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D absolute compare and conditional move builtin functions */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-9.c b/gcc/testsuite/gcc.target/mips/mips-3d-9.c
index 0c30252..2815841 100644
--- a/gcc/testsuite/gcc.target/mips/mips-3d-9.c
+++ b/gcc/testsuite/gcc.target/mips/mips-3d-9.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
+/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Matrix Multiplications */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-1.c b/gcc/testsuite/gcc.target/mips/mips-ps-1.c
index 980dd05..56ba68c 100644
--- a/gcc/testsuite/gcc.target/mips/mips-ps-1.c
+++ b/gcc/testsuite/gcc.target/mips/mips-ps-1.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-mpaired-single forbid_cpu=octeon.*" } */
+/* { dg-options "-mpaired-single forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test v2sf calculations */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-2.c b/gcc/testsuite/gcc.target/mips/mips-ps-2.c
index 654aa06..e0ff4d1 100644
--- a/gcc/testsuite/gcc.target/mips/mips-ps-2.c
+++ b/gcc/testsuite/gcc.target/mips/mips-ps-2.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-mpaired-single forbid_cpu=octeon.*" } */
+/* { dg-options "-mpaired-single forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS paired-single builtin functions */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-3.c b/gcc/testsuite/gcc.target/mips/mips-ps-3.c
index fc892a8..a16bd4b 100644
--- a/gcc/testsuite/gcc.target/mips/mips-ps-3.c
+++ b/gcc/testsuite/gcc.target/mips/mips-ps-3.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-mpaired-single forbid_cpu=octeon.*" } */
+/* { dg-options "-mpaired-single forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS paired-single conditional move */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-4.c b/gcc/testsuite/gcc.target/mips/mips-ps-4.c
index 7871e56..893358d 100644
--- a/gcc/testsuite/gcc.target/mips/mips-ps-4.c
+++ b/gcc/testsuite/gcc.target/mips/mips-ps-4.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-mpaired-single forbid_cpu=octeon.*" } */
+/* { dg-options "-mpaired-single forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS paired-single comparisons */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-6.c b/gcc/testsuite/gcc.target/mips/mips-ps-6.c
index 42c1756..8aa704d 100644
--- a/gcc/testsuite/gcc.target/mips/mips-ps-6.c
+++ b/gcc/testsuite/gcc.target/mips/mips-ps-6.c
@@ -1,7 +1,7 @@
/* mips-ps-2.c with an extra -ffinite-math-only option. This option
changes the way that abs.ps is handled. */
/* { dg-do run } */
-/* { dg-options "-mpaired-single -ffinite-math-only forbid_cpu=octeon.*" } */
+/* { dg-options "-mpaired-single -ffinite-math-only forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS paired-single builtin functions */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp
index e22d782..ccd4ecb 100644
--- a/gcc/testsuite/gcc.target/mips/mips.exp
+++ b/gcc/testsuite/gcc.target/mips/mips.exp
@@ -261,6 +261,7 @@ set mips_option_groups {
section_start "-Wl,--section-start=.*"
frame-header "-mframe-header-opt|-mno-frame-header-opt"
stack-protector "-fstack-protector"
+ stdlib "REQUIRES_STDLIB"
}
for { set option 0 } { $option < 32 } { incr option } {
@@ -413,14 +414,19 @@ proc mips_same_option_p { option1 option2 } {
# Preprocess CODE using target_compile options OPTIONS. Return the
# compiler output.
-proc mips_preprocess { options code } {
+proc mips_preprocess { options code ignore_output } {
global tool
set src dummy[pid].c
set f [open $src "w"]
puts $f $code
close $f
- set output [${tool}_target_compile $src "" preprocess $options]
+ if { $ignore_output } {
+ set output [${tool}_target_compile $src dummy[pid].i preprocess $options]
+ file delete dummy[pid].i
+ } else {
+ set output [${tool}_target_compile $src "" preprocess $options]
+ }
file delete $src
return $output
@@ -470,7 +476,7 @@ proc mips_arch_info { arch prop } {
#else
int isa_rev = 0;
#endif
- }]
+ } 0]
foreach lhs { isa isa_rev } {
regsub ".*$lhs = (\[^;\]*).*" $output {\1} rhs
verbose -log "Architecture $arch has $lhs $rhs"
@@ -829,7 +835,7 @@ proc mips-dg-init {} {
0
};
- }]
+ } 0]
foreach line [split $output "\r\n"] {
# Poor man's string concatenation.
regsub -all {" "} $line "" line
@@ -1420,6 +1426,22 @@ proc mips-dg-options { args } {
}
}
+ # If the test is marked as requiring standard libraries check
+ # that the sysroot has support for the current set of test options.
+ if { [mips_have_test_option_p options "REQUIRES_STDLIB"] } {
+ mips_push_test_options saved_options $extra_tool_flags
+ set output [mips_preprocess "" {
+ #include <stdlib.h>
+ } 1]
+ mips_pop_test_options saved_options
+
+ # If the preprocessing of the stdlib.h file produced errors mark
+ # the test as unsupported.
+ if { ![string equal $output ""] } {
+ set do_what [lreplace $do_what 1 1 "N"]
+ }
+ }
+
# If the test is MIPS16-compatible, provide a counterpart to the
# NOMIPS16 convenience macro.
if { [mips_have_test_option_p options "-mips16"] } {
diff --git a/gcc/testsuite/gcc.target/mips/mips16-attributes.c b/gcc/testsuite/gcc.target/mips/mips16-attributes.c
index d90ec66..e1497c0 100644
--- a/gcc/testsuite/gcc.target/mips/mips16-attributes.c
+++ b/gcc/testsuite/gcc.target/mips/mips16-attributes.c
@@ -2,7 +2,7 @@
of calling a nomips16/mips16/default function from a nomips16/mips16/default
function. */
/* { dg-do run } */
-/* { dg-options "(-mips16)" } */
+/* { dg-options "(-mips16) (REQUIRES_STDLIB)" } */
/* { dg-skip-if "" { *-*-* } { "-mmicromips" } { "" } } */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips32-dsp-run.c b/gcc/testsuite/gcc.target/mips/mips32-dsp-run.c
index ccd9d38..ca12d04 100644
--- a/gcc/testsuite/gcc.target/mips/mips32-dsp-run.c
+++ b/gcc/testsuite/gcc.target/mips/mips32-dsp-run.c
@@ -1,6 +1,6 @@
/* Test MIPS32 DSP instructions */
/* { dg-do run } */
-/* { dg-options "-mdsp" } */
+/* { dg-options "-mdsp (REQUIRES_STDLIB)" } */
#include <stdlib.h>
#include <stdio.h>
diff --git a/gcc/testsuite/gcc.target/mips/mips32-dsp.c b/gcc/testsuite/gcc.target/mips/mips32-dsp.c
index 9aaf120..d212bcf 100644
--- a/gcc/testsuite/gcc.target/mips/mips32-dsp.c
+++ b/gcc/testsuite/gcc.target/mips/mips32-dsp.c
@@ -1,6 +1,6 @@
/* Test MIPS32 DSP instructions */
/* { dg-do compile } */
-/* { dg-options "-mgp32 -mdsp" } */
+/* { dg-options "-mgp32 -mdsp (REQUIRES_STDLIB)" } */
/* { dg-final { scan-assembler "\taddq.ph\t" } } */
/* { dg-final { scan-assembler "\taddq_s.ph\t" } } */
/* { dg-final { scan-assembler "\taddq_s.w\t" } } */
diff --git a/gcc/testsuite/gcc.target/mips/save-restore-1.c b/gcc/testsuite/gcc.target/mips/save-restore-1.c
index b3ce1b1..5e1e838 100644
--- a/gcc/testsuite/gcc.target/mips/save-restore-1.c
+++ b/gcc/testsuite/gcc.target/mips/save-restore-1.c
@@ -1,5 +1,5 @@
/* Check that we can use the save instruction to save varargs. */
-/* { dg-options "(-mips16) isa_rev>=1 -mabi=32" } */
+/* { dg-options "(-mips16) isa_rev>=1 -mabi=32 (REQUIRES_STDLIB)" } */
#include <stdarg.h>