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.