From patchwork Wed Apr 19 08:08:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 752125 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w7F4Q520zz9s4s for ; Wed, 19 Apr 2017 18:08:22 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="cZZP5rD4"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=C4/EIqId1IyFigZ8jiXtKA5V0mdv0sxYClSMoV2MWd+FOy5OGb UsfhyVHWusRtnIKVSMTmKcpn7foiidd88EIM2dUX1YV/AogAKHkTtFF8xieK/tCz cfmkV2vqRVtGtuXytaMWxjT4XkZioFeZ1lzZ3xeYbY2cS6HqFP2OlKVoU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=Gtcu7m86jJWMJnmTVXMH+H8BROg=; b=cZZP5rD459igrgl58ont Ou8ce+eKCDZGYWCrkiFW4RFMcOeMH5dfBhUAXgWtcBe+gIXxkYzZf2NzbTReTwkf MgOBsCn67x70S/eZojvhoyxXi/iSxeftWs7KvUGPxfh2Go9uUAydtPeyL4FaD94Y 6W89gUf0xgA3mJLoRbboJKk= Received: (qmail 99812 invoked by alias); 19 Apr 2017 08:08:11 -0000 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 Received: (qmail 99760 invoked by uid 89); 19 Apr 2017 08:08:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=granted, Install, 3.1 X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Apr 2017 08:08:06 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 611B8AAB4; Wed, 19 Apr 2017 08:08:06 +0000 (UTC) To: GCC Patches Cc: Jakub Jelinek From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] Introduce gcov.h header file (PR gcov-profile/80435). Message-ID: <3a74fd60-42e3-1d5f-e4cf-ee24fd185662@suse.cz> Date: Wed, 19 Apr 2017 10:08:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 X-IsSubscribed: yes 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 From 1aebc17525a0e6b263212bca8f592cf2be5f923c Mon Sep 17 00:00:00 2001 From: marxin 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 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 + . */ + +#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