* [PATCH] Introduce gcov.h header file (PR gcov-profile/80435).
@ 2017-04-19 9:21 Martin Liška
0 siblings, 0 replies; only message in thread
From: Martin Liška @ 2017-04-19 9:21 UTC (permalink / raw)
To: GCC Patches; +Cc: Jakub Jelinek
[-- Attachment #1: Type: text/plain, Size: 208 bytes --]
Hi.
I discussed following patch with Jakub and Honza approved it in:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80435#c3
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
Martin
[-- Attachment #2: 0001-Introduce-gcov.h-header-file-PR-gcov-profile-80435.patch --]
[-- Type: text/x-patch, Size: 5512 bytes --]
From 1aebc17525a0e6b263212bca8f592cf2be5f923c Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 18 Apr 2017 10:20:52 +0200
Subject: [PATCH] Introduce gcov.h header file (PR gcov-profile/80435).
libgcc/ChangeLog:
2017-04-18 Martin Liska <mliska@suse.cz>
PR gcov-profile/80435
* Makefile.in: Install gcov.h.
* gcov.h: New file.
* libgcov.h: Use the header and make __gcov_flush publicly
visible.
---
libgcc/Makefile.in | 15 ++++++++++-----
libgcc/gcov.h | 41 +++++++++++++++++++++++++++++++++++++++++
libgcc/libgcov.h | 6 +-----
3 files changed, 52 insertions(+), 10 deletions(-)
create mode 100644 libgcc/gcov.h
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
+ <http://www.gnu.org/licenses/>. */
+
+#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.12.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-04-19 8:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19 9:21 [PATCH] Introduce gcov.h header file (PR gcov-profile/80435) Martin Liška
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).