This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix rs6000 sysv4 -fPIC hot/cold partitioning handling (PR target/81979)
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <rguenther at suse dot de>, David Edelsohn <dje dot gcc at gmail dot com>, gcc-patches at gcc dot gnu dot org, Andrew Jenner <andrew at codesourcery dot com>
- Date: Thu, 7 Sep 2017 06:42:29 -0500
- Subject: Re: [PATCH] Fix rs6000 sysv4 -fPIC hot/cold partitioning handling (PR target/81979)
- Authentication-results: sourceware.org; auth=none
- References: <20170905212725.GA2291@tucnak> <20170906161007.GH13471@gate.crashing.org> <20170906162610.GQ2323@tucnak> <20170906164800.GJ13471@gate.crashing.org> <20170907094609.GU2323@tucnak>
On Thu, Sep 07, 2017 at 11:46:09AM +0200, Jakub Jelinek wrote:
> On Wed, Sep 06, 2017 at 11:48:00AM -0500, Segher Boessenkool wrote:
> > On Wed, Sep 06, 2017 at 06:26:10PM +0200, Jakub Jelinek wrote:
> > > > Maybe this "switch to the other section" thing should be abstracted out?
> > > > Messing with in_cold_section_p is a bit dirty.
> > >
> > > But it reflects the reality, and is what final.c and varasm.c also do.
> >
> > Yes, but those aren't target code :-)
> >
> > I'm suggesting adding a generic switch_from_hot_to_cold_or_the_other_way_around
> > function (but with a better name ;-) ) that just does these same two lines,
> > only not in target code. Seems cleaner to me, less surprising.
>
> Richard, is this generic change ok?
Thanks Jakub. The rs6000 parts are okay, if I didn't say that yet.
Segher
> PR target/81979
> * output.h (switch_to_other_text_partition): New declaration.
> * varasm.c (switch_to_other_text_partition): New function.
> * config/rs6000/rs6000.c (uses_TOC): Return 2 if
> NOTE_INSN_SWITCH_TEXT_SECTIONS is seen before finding load_toc_* insn.
> (rs6000_elf_declare_function_name): If uses_TOC returned 2, switch
> to the other text partition before emitting LCL label and switch back
> after emitting the word after it.
>
> * gcc.dg/pr81979.c: New test.