From patchwork Mon Jul 25 16:41:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 106718 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 2223CB70B1 for ; Tue, 26 Jul 2011 02:42:01 +1000 (EST) Received: (qmail 12691 invoked by alias); 25 Jul 2011 16:41:53 -0000 Received: (qmail 12682 invoked by uid 22791); 25 Jul 2011 16:41:51 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 25 Jul 2011 16:41:35 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id E89A7BA8 for ; Mon, 25 Jul 2011 18:41:33 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9D2Fzd4hjoEH for ; Mon, 25 Jul 2011 18:41:29 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 2EC9BBA7 for ; Mon, 25 Jul 2011 18:41:29 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.5+Sun/8.14.5/Submit) id p6PGfSkh005063; Mon, 25 Jul 2011 18:41:28 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Subject: [testsuite] Provide and use mmap effective-target keyword Date: Mon, 25 Jul 2011 18:41:28 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org When last week a testcase using mmap was posted with a copy of some old (and wrong) list of targets supporting mmap, I noticed what mess we have here. To fix this, I've introduced a new effective-target keyword mmap and use it in all testcases. Two minor changes to the tests were required: * gcc.dg/20030711-1.c and gcc.dg/20050826-1.c failed to compile on IRIX which doesn't have MAP_ANON. * gcc.dg/vect/pr49038.c must not use dg-do run: on Solaris 8/x86, which cannot execute SSE insns, the vect.dg are usually demoted into compile tests on such targets, which is defeated by the explicit dg-do run. With those changes, I could successfully run the tests on i386-pc-solaris2.8, i386-pc-solaris2.11, alpha-dec-osf5.1b, mips-sgi-irix6.5, powerpc-apple-darwin9.8.0 and i386-apple-darwin9.8.0. Given this wide range of working system, I think it's reasonably safe to install this patch, thus: installed on mainline. Rainer 2011-07-23 Rainer Orth gcc: * doc/sourcebuild.texi (Effective-Target Keywords, Environment attributes): Document mmap. gcc/testsuite: * lib/target-supports.exp (check_effective_target_mmap): New proc. * gcc.c-torture/execute/loop-2f.c: Remove #ifdef __unix__. * gcc.c-torture/execute/loop-2g.c: Likewise. * gcc.c-torture/execute/loop-2f.x: Load target-supports.exp. Require mmap support. * gcc.c-torture/execute/loop-2g.x: Likewise. * gcc.dg/20030711-1.c: Replace dg-do target list by mmap. (MAP_ANON): Provide default. * gcc.dg/20050826-1.c: Likewise. * gcc.target/i386/pr36533.c: Likewise. * gcc.dg/vect/pr49038.c: Remove dg-do run. Use dg-require-effective-target mmap. diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1679,6 +1679,9 @@ Target might have errors of a few ULP in conversion functions and overflow is not always detected correctly by those functions. +@item mmap +Target supports @code{mmap}. + @item newlib Target supports Newlib. diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2f.c b/gcc/testsuite/gcc.c-torture/execute/loop-2f.c --- a/gcc/testsuite/gcc.c-torture/execute/loop-2f.c +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2f.c @@ -1,6 +1,5 @@ #include -#ifdef __unix__ /* ??? Is that good enough? */ #include #include #include @@ -18,7 +17,6 @@ #ifndef MAP_FIXED #define MAP_FIXED 0 #endif -#endif #define MAP_START (void *)0x7fff8000 #define MAP_LEN 0x10000 diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2f.x b/gcc/testsuite/gcc.c-torture/execute/loop-2f.x --- a/gcc/testsuite/gcc.c-torture/execute/loop-2f.x +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2f.x @@ -1,3 +1,9 @@ +load_lib target-supports.exp + +if { ! [check_effective_target_mmap] } { + return 1 +} + if [istarget "m68k-*-linux*"] { # the executable is at the same position the test tries to remap return 1 diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2g.c b/gcc/testsuite/gcc.c-torture/execute/loop-2g.c --- a/gcc/testsuite/gcc.c-torture/execute/loop-2g.c +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2g.c @@ -1,6 +1,5 @@ #include -#ifdef __unix__ /* ??? Is that good enough? */ #include #include #include @@ -18,7 +17,6 @@ #ifndef MAP_FIXED #define MAP_FIXED 0 #endif -#endif #define MAP_START (void *)0x7fff8000 #define MAP_LEN 0x10000 diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2g.x b/gcc/testsuite/gcc.c-torture/execute/loop-2g.x --- a/gcc/testsuite/gcc.c-torture/execute/loop-2g.x +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2g.x @@ -1,3 +1,9 @@ +load_lib target-supports.exp + +if { ! [check_effective_target_mmap] } { + return 1 +} + if [istarget "m68k-*-linux*"] { # the executable is at the same position the test tries to remap return 1 diff --git a/gcc/testsuite/gcc.dg/20030711-1.c b/gcc/testsuite/gcc.dg/20030711-1.c --- a/gcc/testsuite/gcc.dg/20030711-1.c +++ b/gcc/testsuite/gcc.dg/20030711-1.c @@ -1,6 +1,6 @@ /* Test whether strncmp has not been "optimized" into memcmp nor any code with memcmp semantics. */ -/* { dg-do run { target i?86-*-linux* x86_64-*-linux* ia64-*-linux* alpha*-*-linux* powerpc*-*-linux* s390*-*-linux* sparc*-*-linux* *-*-darwin* } } */ +/* { dg-do run { target mmap } } */ /* { dg-options "-O2" } */ #include #include @@ -8,6 +8,9 @@ #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif +#ifndef MAP_ANON +#define MAP_ANON 0 +#endif #include void __attribute__((noinline)) test (const char *p) diff --git a/gcc/testsuite/gcc.dg/20050826-1.c b/gcc/testsuite/gcc.dg/20050826-1.c --- a/gcc/testsuite/gcc.dg/20050826-1.c +++ b/gcc/testsuite/gcc.dg/20050826-1.c @@ -1,6 +1,6 @@ /* Test whether strncmp has not been "optimized" into memcmp nor any code with memcmp semantics. */ -/* { dg-do run { target i?86-*-linux* x86_64-*-linux* ia64-*-linux* alpha*-*-linux* powerpc*-*-linux* s390*-*-linux* sparc*-*-linux* *-*-darwin* } } */ +/* { dg-do run { target mmap } } */ /* { dg-options "-O2" } */ #include #include @@ -9,6 +9,9 @@ #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif +#ifndef MAP_ANON +#define MAP_ANON 0 +#endif #include struct Flags { diff --git a/gcc/testsuite/gcc.dg/vect/pr49038.c b/gcc/testsuite/gcc.dg/vect/pr49038.c --- a/gcc/testsuite/gcc.dg/vect/pr49038.c +++ b/gcc/testsuite/gcc.dg/vect/pr49038.c @@ -1,4 +1,4 @@ -/* { dg-do run { target i?86-*-linux* x86_64-*-linux* ia64-*-linux* alpha*-*-linux* powerpc*-*-linux* s390*-*-linux* sparc*-*-linux* *-*-darwin* } } */ +/* { dg-require-effective-target mmap } */ #include #include diff --git a/gcc/testsuite/gcc.target/i386/pr36533.c b/gcc/testsuite/gcc.target/i386/pr36533.c --- a/gcc/testsuite/gcc.target/i386/pr36533.c +++ b/gcc/testsuite/gcc.target/i386/pr36533.c @@ -1,5 +1,5 @@ /* PR target/36533 */ -/* { dg-do run { target { { i?86-*-linux* x86_64-*-linux* } && ilp32 } } } */ +/* { dg-do run { target { mmap && ilp32 } } } */ /* { dg-options "-Os" } */ #include #include diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -697,6 +697,14 @@ proc check_effective_target_fopenmp {} { } "-fopenmp"] } +# Return 1 if the target supports mmap, 0 otherwise. + +proc check_effective_target_mmap {} { + return [check_no_compiler_messages mmap assembly { + #include + }] +} + # Return 1 if compilation with -pthread is error-free for trivial # code, 0 otherwise.