From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30065 invoked by alias); 24 Oct 2014 15:19:58 -0000 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 Received: (qmail 30053 invoked by uid 89); 24 Oct 2014 15:19:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ig0-f181.google.com Received: from mail-ig0-f181.google.com (HELO mail-ig0-f181.google.com) (209.85.213.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 24 Oct 2014 15:19:56 +0000 Received: by mail-ig0-f181.google.com with SMTP id l13so599917iga.14 for ; Fri, 24 Oct 2014 08:19:54 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.42.224.3 with SMTP id im3mr2678775icb.49.1414163993928; Fri, 24 Oct 2014 08:19:53 -0700 (PDT) Received: by 10.107.6.95 with HTTP; Fri, 24 Oct 2014 08:19:53 -0700 (PDT) In-Reply-To: <20141024142941.GE10376@tucnak.redhat.com> References: <20141017143800.GB10376@tucnak.redhat.com> <20141024142941.GE10376@tucnak.redhat.com> Date: Fri, 24 Oct 2014 15:22:00 -0000 Message-ID: Subject: Re: [PATCH, x86, 63534] Fix '-p' profile for 32 bit PIC mode From: Evgeny Stupachenko To: Jakub Jelinek Cc: GCC Patches , Jeff Law , Uros Bizjak , vmakarov Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg02570.txt.bz2 >What is wrong in emitting the set_got right before the PROLOGUE_END >note and that way sharing a single load from both? Can you please explain the idea? Now set_got emitted right after PROLOGUE_END, what is the advantage in emitting it right before? Which load is going to be shared? >This looks just as a hack. Isn't it similar to what was before but just adding additional "prints"? On Fri, Oct 24, 2014 at 6:29 PM, Jakub Jelinek wrote: > On Fri, Oct 24, 2014 at 06:12:15PM +0400, Evgeny Stupachenko wrote: >> The following patch align stack for mcount and there should be no >> problems with unwind as ix86_frame_pointer_required is true when >> crtl->profile is true and flag_fentry is false (we call mcount after >> function prolog). >> When flag_fentry is true it is set to false in 32bit PIC mode: >> if (!TARGET_64BIT_P (opts->x_ix86_isa_flags) && opts->x_flag_pic) >> { >> if (opts->x_flag_fentry > 0) >> sorry ("-mfentry isn%'t supported for 32-bit in combination " >> "with -fpic"); >> opts->x_flag_fentry = 0; >> } > > What is wrong in emitting the set_got right before the PROLOGUE_END > note and that way sharing a single load from both? > This looks just as a hack. > >> 2014-10-24 Evgeny Stupachenko >> >> PR target/63534 >> * config/i386/i386.c (x86_function_profiler): Add GOT register init >> for mcount call. >> >> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c >> index 6235c4f..2dff29c 100644 >> --- a/gcc/config/i386/i386.c >> +++ b/gcc/config/i386/i386.c >> @@ -39124,13 +39124,22 @@ x86_function_profiler (FILE *file, int >> labelno ATTRIBUTE_UNUSED) >> else >> x86_print_call_or_nop (file, mcount_name); >> } >> + /* At this stage we can't detrmine where GOT register is, as RA can allocate >> + it to any hard register. Therefore we need to set it once again. */ >> else if (flag_pic) >> { >> + pic_labels_used |= 1 << BX_REG; >> + fprintf (file,"\tsub\t$16, %%esp\n"); >> + fprintf (file,"\tmovl\t%%ebx, (%%esp)\n"); >> + fprintf (file,"\tcall\t__x86.get_pc_thunk.bx\n"); >> + fprintf (file,"\taddl\t$_GLOBAL_OFFSET_TABLE_, %%ebx\n"); >> #ifndef NO_PROFILE_COUNTERS >> fprintf (file, "\tleal\t%sP%d@GOTOFF(%%ebx),%%" >> PROFILE_COUNT_REGISTER "\n", >> LPREFIX, labelno); >> #endif >> fprintf (file, "1:\tcall\t*%s@GOT(%%ebx)\n", mcount_name); >> + fprintf (file,"\tmovl\t(%%esp), %%ebx\n"); >> + fprintf (file,"\tadd\t$16, %%esp\n"); >> } >> else >> { >> > > Jakub