From 3f5cb2514af64e1a6114cf49767a8ea056422ee0 Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Thu, 26 May 2011 10:33:06 +0000 Subject: [PATCH] tree-prof.exp: Check for -fprofile-generate support. 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". From-SVN: r174275 --- gcc/testsuite/ChangeLog | 16 ++++++++++++++++ gcc/testsuite/g++.dg/tree-prof/tree-prof.exp | 4 ++-- gcc/testsuite/gcc.dg/matrix/matrix.exp | 4 ++-- gcc/testsuite/gcc.dg/pr47793.c | 1 + gcc/testsuite/gcc.dg/tree-prof/tree-prof.exp | 4 ++-- gcc/testsuite/lib/profopt.exp | 8 +++++++- gcc/testsuite/lib/target-supports-dg.exp | 2 +- gcc/testsuite/lib/target-supports.exp | 19 +++++++++++-------- 8 files changed, 42 insertions(+), 16 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index db7d49dbb68..5acf08e8c5c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,19 @@ +2011-05-26 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". + 2011-05-26 Jakub Jelinek PR c++/49165 diff --git a/gcc/testsuite/g++.dg/tree-prof/tree-prof.exp b/gcc/testsuite/g++.dg/tree-prof/tree-prof.exp index 92de03210ff..0f69a16c902 100644 --- 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 index aae19883143..c1bf2713acc 100644 --- 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 $srcdir/$subdir/matrix-\[1-6\].\[cS\]]] \ 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 index da6b6eab646..0ee1aaee421 100644 --- 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 index 9da5485b0d4..2d054d23366 100644 --- 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 index 0155145e786..5e0f9a28ee1 100644 --- 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 index 3a2c0dc1141..0e0252dcb4a 100644 --- 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 index 6ede07494df..53990f60631 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -495,11 +495,16 @@ proc check_profiling_available { test_what } { # 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_what } { # 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 } -- 2.30.2