From patchwork Wed Sep 12 20:45:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teresa Johnson X-Patchwork-Id: 183432 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 9D4A92C0093 for ; Thu, 13 Sep 2012 06:45:53 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1348087553; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:To:Subject:Message-Id:Date: From:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=trVyraZ ggqABRhbYdJE8j1uB4TE=; b=A6gJ+Qg92BDEAQg8dSKWI0CNjj48/EwF/xv7iwy lGclqFHElU29qS1J/ngrcrA7k9yCj628+tOar9WBJ4a2H3u/6P6WNom9arpiPPB4 4HZh4j97cMaZw7W1jJjwBy8AfnuY1w6+zdPiiJ2CwVxYudY1/eJzp55c6FIFAL9X wIY8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:Received:Received:To:Subject:Message-Id:Date:From:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=RLMXgHbE0Tb05gYsl78BhPlvRqbWygTxLkIWipJuujmzXOniTQ+R88gnR6uCTs vE055ad8XnpmOdBRPyIy/dqCsCIgFsQk6ps2ChYNq/7eQSJEYcQbdp2bokA3r/Oa CYol7TiVN2DEZxmQ+pvEX1/cSsox5oJ3w1zDsSlZdxikE=; Received: (qmail 26931 invoked by alias); 12 Sep 2012 20:45:47 -0000 Received: (qmail 26920 invoked by uid 22791); 12 Sep 2012 20:45:46 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, TW_FC, URIBL_DBL_REDIR X-Spam-Check-By: sourceware.org Received: from mail-fa0-f73.google.com (HELO mail-fa0-f73.google.com) (209.85.161.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Sep 2012 20:45:15 +0000 Received: by fapp1 with SMTP id p1so139802fap.2 for ; Wed, 12 Sep 2012 13:45:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:message-id:date:from:x-gm-message-state; bh=0UlC5EPW5H9RWCbYf7jQX3lfHUB+khMo+2qlJJ/qoMw=; b=pxPP8G2RO2MSvx+QWifYSU83PDq+0VjC9vxCVAiYKFsyRiTUbN2QpkQugSW8WyuAzD 9J5HxJsexKc6xqws4dBHDGn+lkKbatCyidY+uu0oI3aQxfzoXy6IBOVNU5FME7EP0Vmx nFomSDEKgCJirwF4sXujYQu6/k8ruw5i3Z1de75snALEkRyNDqytXvRCle1tL10jO2ZR 1JRnGzJOE9/soaHtKGRXArK+jv+rC+sboMDk9vIerzeUD+lO6DLG/3PzDz2xFf626DLK EJrhL1igHCFWPxFhWoV1d3vg+5hZ9T2tQEd0efyDo4FRVIl+PJ8KXii0h5jjiv7EdDpb bDtQ== Received: by 10.216.0.67 with SMTP id 45mr1254679wea.4.1347482713762; Wed, 12 Sep 2012 13:45:13 -0700 (PDT) Received: by 10.216.0.67 with SMTP id 45mr1254674wea.4.1347482713689; Wed, 12 Sep 2012 13:45:13 -0700 (PDT) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id em7si1323570wib.2.2012.09.12.13.45.13 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 12 Sep 2012 13:45:13 -0700 (PDT) Received: from tjsboxrox.mtv.corp.google.com (tjsboxrox.mtv.corp.google.com [172.18.110.68]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 3DBA4200057; Wed, 12 Sep 2012 13:45:13 -0700 (PDT) Received: by tjsboxrox.mtv.corp.google.com (Postfix, from userid 147431) id 7ABC861490; Wed, 12 Sep 2012 13:45:12 -0700 (PDT) To: reply@codereview.appspotmail.com, jakub@redhat.com, gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR gcov-profile/54487 (profiledbootstrap intermittent failures) (issue6496113) Message-Id: <20120912204512.7ABC861490@tjsboxrox.mtv.corp.google.com> Date: Wed, 12 Sep 2012 13:45:12 -0700 (PDT) From: tejohnson@google.com (Teresa Johnson) X-Gm-Message-State: ALoCoQk2lrnrD/lSViYtz90GvhKdxXvP24azbcih1cLuITq7aBuhT85ryjSkhKh4N0tGc542jorolkrrmAwZDjghLJ/IbLFFfRGfBJSkZINyvvPD64WGP+JR/I7xpvW6KIT+AJH4CpAiBi5jKsL3UKX5doeGGRG7RsKUVYQsP6tDcAOx6hYSSbIy6Y0FDF7SywAkOTCUMpXs 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 This fixes PR gcov-profile/54487 where the gcda files were not locked by the profile-use read, enabling writes by other instrumented compiles to change the profile in the middle of the profile use read. The GCOV_LOCKED macro was not set because it was guarded by HOST_HAS_F_SETLKW, which was never set. The fix is to add a compile test in the configure to set it. Tested with bootstrap and profiledbootstrap on x86_64-unknown-linux-gnu. Ok for trunk? Thanks, Teresa 2012-09-12 Teresa Johnson * configure.ac(HOST_HAS_F_SETLKW): Set based on compile test using F_SETLKW with fcntl. * configure, config.in: Regenerate. --- This patch is available for review at http://codereview.appspot.com/6496113 Index: configure =================================================================== --- configure (revision 191225) +++ configure (working copy) @@ -10731,6 +10731,41 @@ $as_echo "#define HAVE_CLOCK_T 1" >>confdefs.h fi +# Check if F_SETLKW is supported by fcntl. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for F_SETLKW" >&5 +$as_echo_n "checking for F_SETLKW... " >&6; } +if test "${ac_cv_f_setlkw+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include "fcntl.h" + +int +main () +{ +struct flock fl; fl.l_whence = 0; fl.l_start = 0; fl.l_len = 0; fl.l_pid = 0; return fcntl (1, F_SETLKW, &fl); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_f_setlkw=yes +else + ac_cv_f_setlkw=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f_setlkw" >&5 +$as_echo "$ac_cv_f_setlkw" >&6; } +if test $ac_cv_f_setlkw = yes; then + +$as_echo "#define HOST_HAS_F_SETLKW 1" >>confdefs.h + +fi + # Restore CFLAGS, CXXFLAGS from before the gcc_AC_NEED_DECLARATIONS tests. CFLAGS="$saved_CFLAGS" CXXFLAGS="$saved_CXXFLAGS" @@ -17742,7 +17777,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17745 "configure" +#line 17780 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -17848,7 +17883,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17851 "configure" +#line 17886 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: config.in =================================================================== --- config.in (revision 191225) +++ config.in (working copy) @@ -1600,6 +1600,12 @@ #endif +/* Define if F_SETLKW supported by fcntl. */ +#ifndef USED_FOR_TARGET +#undef HOST_HAS_F_SETLKW +#endif + + /* Define as const if the declaration of iconv() needs const. */ #ifndef USED_FOR_TARGET #undef ICONV_CONST Index: configure.ac =================================================================== --- configure.ac (revision 191225) +++ configure.ac (working copy) @@ -1159,6 +1159,16 @@ if test $gcc_cv_type_clock_t = yes; then [Define if defines clock_t.]) fi +# Check if F_SETLKW is supported by fcntl. +AC_CACHE_CHECK(for F_SETLKW, ac_cv_f_setlkw, [ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include "fcntl.h" +]], [[struct flock fl; fl.l_whence = 0; fl.l_start = 0; fl.l_len = 0; fl.l_pid = 0; return fcntl (1, F_SETLKW, &fl);]])],[ac_cv_f_setlkw=yes],[ac_cv_f_setlkw=no])]) +if test $ac_cv_f_setlkw = yes; then + AC_DEFINE(HOST_HAS_F_SETLKW, 1, + [Define if F_SETLKW supported by fcntl.]) +fi + # Restore CFLAGS, CXXFLAGS from before the gcc_AC_NEED_DECLARATIONS tests. CFLAGS="$saved_CFLAGS" CXXFLAGS="$saved_CXXFLAGS"