]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000: Don't forget to initialize the TOC (PR77957)
authorSegher Boessenkool <segher@kernel.crashing.org>
Wed, 7 Dec 2016 23:11:23 +0000 (00:11 +0100)
committerSegher Boessenkool <segher@gcc.gnu.org>
Wed, 7 Dec 2016 23:11:23 +0000 (00:11 +0100)
The code generating traceback tables mistakenly does an early return
if !optional_tbtab, which causes it to miss the code generating the TOC
section.  This only matters if the TOC will be empty since otherwise
the section is created elsewhere.

This patch fixes it.

PR target/77957
* config/rs6000/rs6000.c (rs6000_output_function_epilogue): Don't
return early if !optional_tbtab.

From-SVN: r243416

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

index 340a755bbc0c5eab18e3b952ee6dd9ace5b2afcd..f47615b4225c8562b8c0311743f75743c0f2b63d 100644 (file)
@@ -1,3 +1,12 @@
+2016-12-07  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       Backport from mainline
+       2016-11-12  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR target/77957
+       * config/rs6000/rs6000.c (rs6000_output_function_epilogue): Don't
+       return early if !optional_tbtab.
+
 2016-12-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        Backport from mainline
index cbcb94a7ed95c7aa7bb88dd6859ec42fff6e103e..c66bfb0b5e5e99734764f5c71fd2eaa8987443cf 100644 (file)
@@ -25859,53 +25859,54 @@ rs6000_output_function_epilogue (FILE *file,
         seems to set the bit when not optimizing.  */
       fprintf (file, "%d\n", ((float_parms << 1) | (! optimize)));
 
-      if (optional_tbtab)
-       return;
-
-      /* Optional fields follow.  Some are variable length.  */
-
-      /* Parameter types, left adjusted bit fields: 0 fixed, 10 single float,
-        11 double float.  */
-      /* There is an entry for each parameter in a register, in the order that
-        they occur in the parameter list.  Any intervening arguments on the
-        stack are ignored.  If the list overflows a long (max possible length
-        34 bits) then completely leave off all elements that don't fit.  */
-      /* Only emit this long if there was at least one parameter.  */
-      if (fixed_parms || float_parms)
-       fprintf (file, "\t.long %d\n", parm_info);
-
-      /* Offset from start of code to tb table.  */
-      fputs ("\t.long ", file);
-      ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "LT");
-      RS6000_OUTPUT_BASENAME (file, fname);
-      putc ('-', file);
-      rs6000_output_function_entry (file, fname);
-      putc ('\n', file);
+      if (optional_tbtab)
+       {
+         /* Optional fields follow.  Some are variable length.  */
+
+         /* Parameter types, left adjusted bit fields: 0 fixed, 10 single
+            float, 11 double float.  */
+         /* There is an entry for each parameter in a register, in the order
+            that they occur in the parameter list.  Any intervening arguments
+            on the stack are ignored.  If the list overflows a long (max
+            possible length 34 bits) then completely leave off all elements
+            that don't fit.  */
+         /* Only emit this long if there was at least one parameter.  */
+         if (fixed_parms || float_parms)
+           fprintf (file, "\t.long %d\n", parm_info);
+
+         /* Offset from start of code to tb table.  */
+         fputs ("\t.long ", file);
+         ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "LT");
+         RS6000_OUTPUT_BASENAME (file, fname);
+         putc ('-', file);
+         rs6000_output_function_entry (file, fname);
+         putc ('\n', file);
 
-      /* Interrupt handler mask.  */
-      /* Omit this long, since we never set the interrupt handler bit
-        above.  */
+         /* Interrupt handler mask.  */
+         /* Omit this long, since we never set the interrupt handler bit
+            above.  */
 
-      /* Number of CTL (controlled storage) anchors.  */
-      /* Omit this long, since the has_ctl bit is never set above.  */
+         /* Number of CTL (controlled storage) anchors.  */
+         /* Omit this long, since the has_ctl bit is never set above.  */
 
-      /* Displacement into stack of each CTL anchor.  */
-      /* Omit this list of longs, because there are no CTL anchors.  */
+         /* Displacement into stack of each CTL anchor.  */
+         /* Omit this list of longs, because there are no CTL anchors.  */
 
-      /* Length of function name.  */
-      if (*fname == '*')
-       ++fname;
-      fprintf (file, "\t.short %d\n", (int) strlen (fname));
+         /* Length of function name.  */
+         if (*fname == '*')
+           ++fname;
+         fprintf (file, "\t.short %d\n", (int) strlen (fname));
 
-      /* Function name.  */
-      assemble_string (fname, strlen (fname));
+         /* Function name.  */
+         assemble_string (fname, strlen (fname));
 
-      /* Register for alloca automatic storage; this is always reg 31.
-        Only emit this if the alloca bit was set above.  */
-      if (frame_pointer_needed)
-       fputs ("\t.byte 31\n", file);
+         /* Register for alloca automatic storage; this is always reg 31.
+            Only emit this if the alloca bit was set above.  */
+         if (frame_pointer_needed)
+           fputs ("\t.byte 31\n", file);
 
-      fputs ("\t.align 2\n", file);
+         fputs ("\t.align 2\n", file);
+       }
     }
 }
 \f