]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
This fixes PR gcov-profile/54487 where the gcda files were not locked by the profile...
authorTeresa Johnson <tejohnson@google.com>
Thu, 13 Sep 2012 04:59:14 +0000 (04:59 +0000)
committerTeresa Johnson <tejohnson@gcc.gnu.org>
Thu, 13 Sep 2012 04:59:14 +0000 (04:59 +0000)
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.

2012-09-12  Teresa Johnson  <tejohnson@google.com>

PR gcov-profile/54487
* configure.ac (HOST_HAS_F_SETLKW): Set based on compile
test using F_SETLKW with fcntl.
* configure, config.in: Regenerate.

From-SVN: r191238

gcc/ChangeLog
gcc/config.in
gcc/configure
gcc/configure.ac

index ff6dd5746b54169e98c0e048823138062c06fffa..860c81bc613aeb7fbdddfad3be9664457e5e9302 100644 (file)
@@ -1,3 +1,10 @@
+2012-09-12  Teresa Johnson  <tejohnson@google.com>
+
+       PR gcov-profile/54487
+       * configure.ac (HOST_HAS_F_SETLKW): Set based on compile
+       test using F_SETLKW with fcntl.
+       * configure, config.in: Regenerate.
+
 2012-09-12  Jan Hubicka  <jh@suse.cz>
 
        PR fortran/48636
index 7fe6485c3af3da06597be939176590257ea6c6e5..b13805d98ce9efdd14ec721cf051aea2e7dfc859 100644 (file)
 #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 5bb409a3b4d2fe1dcdcb87f66f049b6d342a6a96..86fa82543e0a34bb68ec62ac5be5d5f094f7c124 100755 (executable)
@@ -10731,6 +10731,46 @@ $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 +17782,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 17785 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17848,7 +17888,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 17891 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index 699c7904f7ccf8a05a5af5f6fb1cd3d0ad37c68b..9f200c7a9912be6169aa6949c2814aee3f085201 100644 (file)
@@ -1159,6 +1159,22 @@ if test $gcc_cv_type_clock_t = yes; then
   [Define if <time.h> 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"