From 46928a8fda6ed2673ab4eb598060f03278d87af4 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 19 Apr 2017 10:08:44 +0200 Subject: [PATCH] Introduce gcov.h header file (PR gcov-profile/80435). 2017-04-19 Martin Liska PR gcov-profile/80435 * Makefile.in: Install gcov.h. * gcov.h: New file. * libgcov.h: Use the header and make __gcov_flush publicly visible. From-SVN: r246990 --- libgcc/ChangeLog | 8 ++++++++ libgcc/Makefile.in | 15 ++++++++++----- libgcc/gcov.h | 41 +++++++++++++++++++++++++++++++++++++++++ libgcc/libgcov.h | 6 +----- 4 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 libgcc/gcov.h diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 593cd09db8b..272c8299c72 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,11 @@ +2017-04-19 Martin Liska + + PR gcov-profile/80435 + * Makefile.in: Install gcov.h. + * gcov.h: New file. + * libgcov.h: Use the header and make __gcov_flush publicly + visible. + 2017-04-18 Martin Liska PR gcov-profile/78783 diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index 6f58fd451a6..a1a392de88d 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -907,14 +907,14 @@ libgcov-driver-objects = $(patsubst %,%$(objext),$(LIBGCOV_DRIVER)) libgcov-objects = $(libgcov-merge-objects) $(libgcov-profiler-objects) \ $(libgcov-interface-objects) $(libgcov-driver-objects) -$(libgcov-merge-objects): %$(objext): $(srcdir)/libgcov-merge.c $(srcdir)/libgcov.h +$(libgcov-merge-objects): %$(objext): $(srcdir)/libgcov-merge.c $(srcdir)/gcov.h $(srcdir)/libgcov.h $(gcc_compile) -DL$* -c $(srcdir)/libgcov-merge.c -$(libgcov-profiler-objects): %$(objext): $(srcdir)/libgcov-profiler.c $(srcdir)/libgcov.h +$(libgcov-profiler-objects): %$(objext): $(srcdir)/libgcov-profiler.c $(srcdir)/gcov.h $(srcdir)/libgcov.h $(gcc_compile) -DL$* -c $(srcdir)/libgcov-profiler.c -$(libgcov-interface-objects): %$(objext): $(srcdir)/libgcov-interface.c $(srcdir)/libgcov.h +$(libgcov-interface-objects): %$(objext): $(srcdir)/libgcov-interface.c $(srcdir)/gcov.h $(srcdir)/libgcov.h $(gcc_compile) -DL$* -c $(srcdir)/libgcov-interface.c $(libgcov-driver-objects): %$(objext): $(srcdir)/libgcov-driver.c \ - $(srcdir)/libgcov-driver-system.c $(srcdir)/libgcov.h + $(srcdir)/libgcov-driver-system.c $(srcdir)/gcov.h $(srcdir)/libgcov.h $(gcc_compile) -DL$* -c $(srcdir)/libgcov-driver.c @@ -1114,6 +1114,10 @@ install-unwind_h: all: install-unwind_h-forbuild +install-gcov_h: + $(mkinstalldirs) $(DESTDIR)$(libsubdir)/include + $(INSTALL_DATA) $(srcdir)/gcov.h $(DESTDIR)$(libsubdir)/include + # Documentation targets (empty). .PHONY: info html dvi pdf install-info install-html install-pdf @@ -1171,13 +1175,14 @@ install-leaf: $(install-shared) $(install-libunwind) esac; \ done -install: install-leaf install-unwind_h +install: install-leaf install-unwind_h install-gcov_h @: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install install-strip: install .PHONY: install install-shared install-libunwind install-strip .PHONY: install-unwind_h install-unwind_h-forbuild +.PHONY: install-gcov_h # Don't export variables to the environment, in order to not confuse # configure. diff --git a/libgcc/gcov.h b/libgcc/gcov.h new file mode 100644 index 00000000000..0333ecca837 --- /dev/null +++ b/libgcc/gcov.h @@ -0,0 +1,41 @@ +/* GCOV interface routines. + Copyright (C) 2017 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3, or (at your option) any later + version. + + GCC is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#ifndef GCC_GCOV_H +#define GCC_GCOV_H + +/* Set all counters to zero. */ + +extern void __gcov_reset (void); + +/* Write profile information to a file. */ + +extern void __gcov_dump (void); + +/* Write profile information to a file and reset counters to zero. + The function does operations under a mutex. */ + +extern void __gcov_flush (void); + +#endif /* GCC_GCOV_H */ diff --git a/libgcc/libgcov.h b/libgcc/libgcov.h index 6118fe9621a..4c1204ca83c 100644 --- a/libgcc/libgcov.h +++ b/libgcc/libgcov.h @@ -42,6 +42,7 @@ #include "coretypes.h" #include "tm.h" #include "libgcc_tm.h" +#include "gcov.h" #if __CHAR_BIT__ == 8 typedef unsigned gcov_unsigned_t __attribute__ ((mode (SI))); @@ -237,16 +238,11 @@ extern void __gcov_init (struct gcov_info *) ATTRIBUTE_HIDDEN; /* GCOV exit function registered via a static destructor. */ extern void __gcov_exit (void) ATTRIBUTE_HIDDEN; -/* Called before fork, to avoid double counting. */ -extern void __gcov_flush (void) ATTRIBUTE_HIDDEN; - /* Function to reset all counters to 0. Both externally visible (and overridable) and internal version. */ -extern void __gcov_reset (void); extern void __gcov_reset_int (void) ATTRIBUTE_HIDDEN; /* User function to enable early write of profile information so far. */ -extern void __gcov_dump (void); extern void __gcov_dump_int (void) ATTRIBUTE_HIDDEN; /* The merge function that just sums the counters. */ -- 2.30.2