From patchwork Tue Jul 2 12:37:42 2019 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: 1126240 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-504178-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="HqdseHWs"; dkim-atps=neutral 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 45dP0N6gKYz9s00 for ; Tue, 2 Jul 2019 22:37:55 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:cc:message-id:date:mime-version:content-type; q=dns; s=default; b=BvNi+zUDBVqP2ByHBEGMPLU6UZ3N1pl/XHNN0vSORl/z8i1lj4 SkXkYzh+HhQqs3CqWABr+fxBEk4+eCzre3/XpdERqXEH3o2TTBzJbnp47qXqzCZR n7BEaYiSe+P0eVtlmzn/FIq8QWHl+UPfU2BqQYRCwmg//ndM5xfL9uJqg= 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:from :subject:to:cc:message-id:date:mime-version:content-type; s= default; bh=es3n/9lGMJLD1gv4Zym3DpFgXNA=; b=HqdseHWsLjzfBeYAygaK pcRdNaAmDJy5hwWNIfJvxezPrzdRo4iahl+sam7zw+RtUfIzNB6V2MnHgQqXeJ0N HxEqAwfvvupSXntYoqZqMk4HBjRPUADZ6bYHFiLROR+W21+HpGrc2k24fL2ZNN4H xI4ZLNtNthYEOuC3/dwppPg= Received: (qmail 123159 invoked by alias); 2 Jul 2019 12:37:48 -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 123014 invoked by uid 89); 2 Jul 2019 12:37:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=bbg 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; Tue, 02 Jul 2019 12:37:45 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3E7EFB82D; Tue, 2 Jul 2019 12:37:43 +0000 (UTC) From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] Add -fprofile-note option. To: gcc-patches@gcc.gnu.org Cc: David.Taylor@dell.com Message-ID: Date: Tue, 2 Jul 2019 14:37:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 X-IsSubscribed: yes Hi. The patch is about a new option that can be handy when you pipe output and you do not use an object file. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin gcc/ChangeLog: 2019-07-02 Martin Liska * common.opt: Add fprofile-note. * coverage.c (coverage_init): Append the option to bbg_file_name. * doc/invoke.texi: Document -fprofile-note. --- gcc/common.opt | 4 ++++ gcc/coverage.c | 11 ++++++++--- gcc/doc/invoke.texi | 9 +++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/gcc/common.opt b/gcc/common.opt index a1544d06824..c1b90562b9b 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -2096,6 +2096,10 @@ Common Joined RejectNegative Var(profile_data_prefix) Set the top-level directory for storing the profile data. The default is 'pwd'. +fprofile-note= +Common Joined RejectNegative Var(profile_note_location) +Select the name for storing the profile note file. + fprofile-correction Common Report Var(flag_profile_correction) Enable correction of flow inconsistent profile data input. diff --git a/gcc/coverage.c b/gcc/coverage.c index 1ffefd5f482..960ff7ee86a 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -1255,9 +1255,14 @@ coverage_init (const char *filename) /* Name of bbg file. */ if (flag_test_coverage && !flag_compare_debug) { - bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1); - memcpy (bbg_file_name, filename, len); - strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX); + if (profile_note_location) + bbg_file_name = xstrdup (profile_note_location); + else + { + bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1); + memcpy (bbg_file_name, filename, len); + strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX); + } if (!gcov_open (bbg_file_name, -1)) { diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 9c6050b574b..918987b6656 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -493,8 +493,8 @@ Objective-C and Objective-C++ Dialects}. @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol -fprofile-abs-path @gol -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol --fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol --fprofile-exclude-files=@var{regex} @gol +-fprofile-note=@var{path} -fprofile-update=@var{method} @gol +-fprofile-filter-files=@var{regex} -fprofile-exclude-files=@var{regex} @gol -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol -fsanitize-undefined-trap-on-error -fbounds-check @gol @@ -12403,6 +12403,11 @@ the profile feedback data files. See @option{-fprofile-dir}. To optimize the program based on the collected profile information, use @option{-fprofile-use}. @xref{Optimize Options}, for more information. +@item -fprofile-note=@var{path} +@opindex fprofile-note + +If @var{path} is specified, GCC saves gcno filename into @var{path} location. + @item -fprofile-update=@var{method} @opindex fprofile-update