From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2040 invoked by alias); 16 Jul 2010 23:57:35 -0000 Received: (qmail 2032 invoked by uid 22791); 16 Jul 2010 23:57:35 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from one.firstfloor.org (HELO one.firstfloor.org) (213.235.205.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Jul 2010 23:57:30 +0000 Received: from basil.firstfloor.org (p5B3C96F4.dip0.t-ipconnect.de [91.60.150.244]) by one.firstfloor.org (Postfix) with ESMTP id 42C0522C8069; Sat, 17 Jul 2010 01:57:26 +0200 (CEST) Received: by basil.firstfloor.org (Postfix, from userid 1000) id 3FC8AB157F; Sat, 17 Jul 2010 01:57:25 +0200 (CEST) Date: Fri, 16 Jul 2010 23:57:00 -0000 From: Andi Kleen To: Kai Tietz Cc: Richard Henderson , Andi Kleen , GCC Patches Subject: Re: [patch i386]: Add for win32 targets pre-prologue profiling feature Message-ID: <20100716235724.GK7338@basil.fritz.box> References: <4C3C942D.3010101@redhat.com> <87630is1gi.fsf@basil.nowhere.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg01396.txt.bz2 On Thu, Jul 15, 2010 at 08:08:24PM +0200, Kai Tietz wrote: > Hello Andy, > > I updated my patch in that way, that it should be trivial to add the > counter function for before prologue profiling to linux target by a > one-liner. > Just make sure that for the i386-target the macro > MCOUNT_NAME_BEFORE_PROLOGUE is defined. > > I reworked the patch so that the option is now named -mfentry and it > is available for all i386 targets, if they have defined the counter > function's name via MCOUNT_NAME_BEFORE_PROLOGUE in target. > Additionally I added some option-checks for targets, which don't > support before prologue profiling. Kai, I tried the patch on x86_64-linux but it doesn't work for me. First I added the define to linux diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h index 81dfd1e..54051ed 100644 --- a/gcc/config/i386/linux.h +++ b/gcc/config/i386/linux.h @@ -48,6 +48,10 @@ along with GCC; see the file COPYING3. If not see #define NO_PROFILE_COUNTERS 1 +/* Choose the correct profiler mcount name. */ +#undef MCOUNT_NAME_BEFORE_PROLOGUE +#define MCOUNT_NAME_BEFORE_PROLOGUE "__fentry__" + #undef MCOUNT_NAME #define MCOUNT_NAME "mcount" But when I try to set -mfentry on a simple test program I get sorry, unimplemented: -mfentry isn't supported for this target I think that's because of +#if defined(PROFILE_BEFORE_PROLOGUE) + default_profile_top_flag = 1; +#endif +#if defined(MCOUNT_NAME) && defined (MCOUNT_NAME_BEFORE_PROLOGUE) + only_default = 0; +#endif + + if (flag_fentry == -1) + flag_fentry = default_profile_top_flag; + else if (flag_fentry != default_profile_top_flag && only_default) + { + if (!default_profile_top_flag) + sorry ("-mfentry isn't supported for this target"); + else + sorry ("-mno-fentry isn't supported for this target"); and PROFILE_BEFORE_PROLOGUE is never set for i386, default_profile_flag is always 0 -Andi