public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RS6000] Make -msingle-pic-base remove the ELFv2 global entry code
@ 2015-09-30  7:51 Alan Modra
  2015-09-30 13:57 ` David Edelsohn
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Modra @ 2015-09-30  7:51 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Edelsohn

For other ABIs, -msingle-pic-base makes gcc omit loading of the PIC
register in function prologues.  This patch makes the option affect
ELFv2 too.

I wrote a patch like this during the initial ELFv2 effort, but there
were many more important patches to push and this one somehow got
dropped.  Dusted off and retested at the request of powerpc64 kernel
people who'd like an option to disable ELFv2 global entry code for
the kernel.  OK mainline?

	* config/rs6000/rs6000.c (rs6000_emit_prologue): Don't set
	r2_setup_needed when TARGET_SINGLE_PIC_BASE.
	(rs6000_output_mi_thunk): Likewise.

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index ae456ff..023f622 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -24118,13 +24118,13 @@ rs6000_emit_prologue (void)
 #define NOT_INUSE(R) do {} while (0)
 #endif
 
-  if (DEFAULT_ABI == ABI_ELFv2)
+  if (DEFAULT_ABI == ABI_ELFv2
+      && !TARGET_SINGLE_PIC_BASE)
     {
       cfun->machine->r2_setup_needed = df_regs_ever_live_p (TOC_REGNUM);
 
       /* With -mminimal-toc we may generate an extra use of r2 below.  */
-      if (!TARGET_SINGLE_PIC_BASE
-	  && TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0)
+      if (TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0)
 	cfun->machine->r2_setup_needed = true;
     }
 
@@ -26800,7 +26800,8 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
   /* Ensure we have a global entry point for the thunk.   ??? We could
      avoid that if the target routine doesn't need a global entry point,
      but we do not know whether this is the case at this point.  */
-  if (DEFAULT_ABI == ABI_ELFv2)
+  if (DEFAULT_ABI == ABI_ELFv2
+      && !TARGET_SINGLE_PIC_BASE)
     cfun->machine->r2_setup_needed = true;
 
   /* Run just enough of rest_of_compilation to get the insns emitted.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RS6000] Make -msingle-pic-base remove the ELFv2 global entry code
  2015-09-30  7:51 [RS6000] Make -msingle-pic-base remove the ELFv2 global entry code Alan Modra
@ 2015-09-30 13:57 ` David Edelsohn
  0 siblings, 0 replies; 2+ messages in thread
From: David Edelsohn @ 2015-09-30 13:57 UTC (permalink / raw)
  To: Alan Modra; +Cc: GCC Patches

On Wed, Sep 30, 2015 at 2:11 AM, Alan Modra <amodra@gmail.com> wrote:
> For other ABIs, -msingle-pic-base makes gcc omit loading of the PIC
> register in function prologues.  This patch makes the option affect
> ELFv2 too.
>
> I wrote a patch like this during the initial ELFv2 effort, but there
> were many more important patches to push and this one somehow got
> dropped.  Dusted off and retested at the request of powerpc64 kernel
> people who'd like an option to disable ELFv2 global entry code for
> the kernel.  OK mainline?
>
>         * config/rs6000/rs6000.c (rs6000_emit_prologue): Don't set
>         r2_setup_needed when TARGET_SINGLE_PIC_BASE.
>         (rs6000_output_mi_thunk): Likewise.

Okay.

Thanks, David

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-30 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-30  7:51 [RS6000] Make -msingle-pic-base remove the ELFv2 global entry code Alan Modra
2015-09-30 13:57 ` David Edelsohn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).