From patchwork Thu May 26 10:30:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 97520 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 A44EDB6FA0 for ; Thu, 26 May 2011 20:31:07 +1000 (EST) Received: (qmail 18070 invoked by alias); 26 May 2011 10:31:05 -0000 Received: (qmail 18059 invoked by uid 22791); 26 May 2011 10:31:04 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_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; Thu, 26 May 2011 10:30:46 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 3390CBE for ; Thu, 26 May 2011 12:30:45 +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 Qv-OpEP-UaIy for ; Thu, 26 May 2011 12:30:40 +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 13610BD for ; Thu, 26 May 2011 12:30:40 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id p4QAUXEG017575; Thu, 26 May 2011 12:30:33 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Subject: [testsuite] Require TLS support with tree profiling (PR gcov-profile/48845) Date: Thu, 26 May 2011 12:30:33 +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 Prompted by the recent tree profiling testsuite failures on platforms that require special handling for TLS runtime support, I looked at the testsuite side of things. While Solaris now works again thanks to Eric's patch http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01719.html there should be some testsuite handling/cleanup as well: * check_profiling_available and thus dg-require-profiling needs to check that TLS runtime support is available if tree profiling is required. * To trigger this, the various callers need to pass an -fprofile-generate option to check_profiling_available. These are mostly the individual testsuite drivers, but also the new gcc.dg/pr47793.c test. * Initially, this didn't work: dg-require-profiling passed its arguments to check_profiling_available unchanged, but the first arg to the dg-* procs is the line number in the testcase. Instead of artificially passing a bogus line number from the direct callers of check_profiling_available, I drop that arg instead, resulting in a couple of simplifications. * profopt-execute eventually adds necessary TLS options. Tested without regressions on i386-pc-solaris2.8 and i386-pc-solaris2.10 (among others) without Eric's patch included. Installed on mainline. Rainer 2011-05-21 Rainer Orth PR gcov-profile/48845 * g++.dg/tree-prof/tree-prof.exp: Check for -fprofile-generate support. * gcc.dg/matrix/matrix.exp: Likewise. * gcc.dg/tree-prof/tree-prof.exp: Likewise. * lib/target-supports-dg.exp (dg-require-profiling): Don't pass line number to check_profiling_available. * lib/target-supports.exp (check_profiling_available): Account for this. Require TLS runtime support with -fprofile-generate. * lib/profopt.exp (profopt-execute): Add TLS options for -fprofile-generate. * gcc.dg/pr47793.c: Add dg-require-profiling "-fprofile-generate". diff --git a/gcc/testsuite/g++.dg/tree-prof/tree-prof.exp b/gcc/testsuite/g++.dg/tree-prof/tree-prof.exp --- a/gcc/testsuite/g++.dg/tree-prof/tree-prof.exp +++ b/gcc/testsuite/g++.dg/tree-prof/tree-prof.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2001, 2002, 2004, 2005, 2007, 2008 +# Copyright (C) 2001, 2002, 2004, 2005, 2007, 2008, 2011 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -21,7 +21,7 @@ load_lib target-supports.exp # Some targets don't support tree profiling. -if { ![check_profiling_available ""] } { +if { ![check_profiling_available "-fprofile-generate"] } { return } diff --git a/gcc/testsuite/gcc.dg/matrix/matrix.exp b/gcc/testsuite/gcc.dg/matrix/matrix.exp --- a/gcc/testsuite/gcc.dg/matrix/matrix.exp +++ b/gcc/testsuite/gcc.dg/matrix/matrix.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2001, 2002, 2004, 2005, 2007, 2010 +# Copyright (C) 2001, 2002, 2004, 2005, 2007, 2010, 2011 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -31,7 +31,7 @@ dg-runtest [lsort [glob -nocomplain $src dg-final # Some targets don't support tree profiling. -if { ![check_profiling_available ""] } { +if { ![check_profiling_available "-fprofile-generate"] } { return } diff --git a/gcc/testsuite/gcc.dg/pr47793.c b/gcc/testsuite/gcc.dg/pr47793.c --- a/gcc/testsuite/gcc.dg/pr47793.c +++ b/gcc/testsuite/gcc.dg/pr47793.c @@ -1,6 +1,7 @@ /* Bug pr47793: Allow relative paths in profile-generate. */ /* { dg-do run } */ /* { dg-options "-O -fprofile-generate=./" } */ +/* { dg-require-profiling "-fprofile-generate" } */ /* { dg-final { scan-file pr47793.gcda "."} } */ int diff --git a/gcc/testsuite/gcc.dg/tree-prof/tree-prof.exp b/gcc/testsuite/gcc.dg/tree-prof/tree-prof.exp --- a/gcc/testsuite/gcc.dg/tree-prof/tree-prof.exp +++ b/gcc/testsuite/gcc.dg/tree-prof/tree-prof.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2001, 2002, 2004, 2005, 2007, 2008 +# Copyright (C) 2001, 2002, 2004, 2005, 2007, 2008, 2011 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -21,7 +21,7 @@ load_lib target-supports.exp # Some targets don't support tree profiling. -if { ![check_profiling_available ""] } { +if { ![check_profiling_available "-fprofile-generate"] } { return } diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp --- a/gcc/testsuite/lib/profopt.exp +++ b/gcc/testsuite/lib/profopt.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2001, 2004, 2005, 2007, 2008, 2010 +# Copyright (C) 2001, 2004, 2005, 2007, 2008, 2010, 2011 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -274,6 +274,12 @@ proc profopt-execute { src } { set extra_options [dg-additional-files-options "" "$src"] + # Tree profiling requires TLS runtime support, which may need + # additional flags. + if { [string first "-fprofile-generate" $profile_option] >= 0 } { + set extra_flags [add_options_for_tls $extra_flags] + } + # Compile for profiling. set options "$extra_options" diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -113,7 +113,7 @@ proc dg-require-gc-sections { args } { # If this target does not support profiling, skip this test. proc dg-require-profiling { args } { - if { ![ check_profiling_available ${args} ] } { + if { ![ check_profiling_available [lindex $args 1] ] } { upvar dg-do-what dg-do-what set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] } 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 @@ -495,11 +495,16 @@ proc check_profiling_available { test_wh # These conditions depend on the argument so examine them before # looking at the cache variable. + # Tree profiling requires TLS runtime support. + if { $test_what == "-fprofile-generate" } { + return [check_effective_target_tls_runtime] + } + # Support for -p on solaris2 relies on mcrt1.o which comes with the # vendor compiler. We cannot reliably predict the directory where the # vendor compiler (and thus mcrt1.o) is installed so we can't # necessarily find mcrt1.o even if we have it. - if { [istarget *-*-solaris2*] && [lindex $test_what 1] == "-p" } { + if { [istarget *-*-solaris2*] && $test_what == "-p" } { return 0 } @@ -508,32 +513,30 @@ proc check_profiling_available { test_wh # Support for -pg on irix relies on gcrt1.o which doesn't exist yet. # See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html if { [istarget mips*-*-irix*] - && ([lindex $test_what 1] == "-p" || [lindex $test_what 1] == "-pg") } { + && ($test_what == "-p" || $test_what == "-pg") } { return 0 } # We don't yet support profiling for MIPS16. if { [istarget mips*-*-*] && ![check_effective_target_nomips16] - && ([lindex $test_what 1] == "-p" - || [lindex $test_what 1] == "-pg") } { + && ($test_what == "-p" || $test_what == "-pg") } { return 0 } # MinGW does not support -p. - if { [istarget *-*-mingw*] && [lindex $test_what 1] == "-p" } { + if { [istarget *-*-mingw*] && $test_what == "-p" } { return 0 } # cygwin does not support -p. - if { [istarget *-*-cygwin*] && [lindex $test_what 1] == "-p" } { + if { [istarget *-*-cygwin*] && $test_what == "-p" } { return 0 } # uClibc does not have gcrt1.o. if { [check_effective_target_uclibc] - && ([lindex $test_what 1] == "-p" - || [lindex $test_what 1] == "-pg") } { + && ($test_what == "-p" || $test_what == "-pg") } { return 0 }