[RS6000] Make -msingle-pic-base remove the ELFv2 global entry code
authorAlan Modra <amodra@gmail.com>
Wed, 30 Sep 2015 22:19:18 +0000 (07:49 +0930)
committerAlan Modra <amodra@gcc.gnu.org>
Wed, 30 Sep 2015 22:19:18 +0000 (07:49 +0930)
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.

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

From-SVN: r228309

gcc/ChangeLog
gcc/config/rs6000/rs6000.c

index 6b5304819705dec6ab93e74fd0cb8987570716c8..7ecb443ed8788572e6e6d9602bd87d4bea078617 100644 (file)
@@ -1,3 +1,9 @@
+2015-10-01  Alan Modra  <amodra@gmail.com>
+
+       * config/rs6000/rs6000.c (rs6000_emit_prologue): Don't set
+       r2_setup_needed when TARGET_SINGLE_PIC_BASE.
+       (rs6000_output_mi_thunk): Likewise.
+
 2015-09-30  Nathan Sidwell  <nathan@codesourcery.com>
 
        * config/nvptx/mkoffload.c (process): Change offload data format.
index ae456ff3199240121eeb40b2d2145e38d0012f03..023f62235821fe537489fa3fa343adafbc2aab39 100644 (file)
@@ -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.