rs6000: Don't forget to initialize the TOC (PR77957)

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: r242336
This commit is contained in:
Segher Boessenkool 2016-11-12 16:13:14 +01:00 committed by Segher Boessenkool
parent b93d8a3f16
commit c0d6cb1a6f
2 changed files with 45 additions and 38 deletions

View File

@ -1,3 +1,9 @@
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-11-11 Eric Botcazou <ebotcazou@adacore.com> 2016-11-11 Eric Botcazou <ebotcazou@adacore.com>
PR rtl-optimization/59461 PR rtl-optimization/59461

View File

@ -30412,53 +30412,54 @@ rs6000_output_function_epilogue (FILE *file,
seems to set the bit when not optimizing. */ seems to set the bit when not optimizing. */
fprintf (file, "%d\n", ((float_parms << 1) | (! optimize))); fprintf (file, "%d\n", ((float_parms << 1) | (! optimize)));
if (! optional_tbtab) if (optional_tbtab)
return; {
/* Optional fields follow. Some are variable length. */
/* 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);
/* Parameter types, left adjusted bit fields: 0 fixed, 10 single float, /* Offset from start of code to tb table. */
11 double float. */ fputs ("\t.long ", file);
/* There is an entry for each parameter in a register, in the order that ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "LT");
they occur in the parameter list. Any intervening arguments on the RS6000_OUTPUT_BASENAME (file, fname);
stack are ignored. If the list overflows a long (max possible length putc ('-', file);
34 bits) then completely leave off all elements that don't fit. */ rs6000_output_function_entry (file, fname);
/* Only emit this long if there was at least one parameter. */ putc ('\n', file);
if (fixed_parms || float_parms)
fprintf (file, "\t.long %d\n", parm_info);
/* Offset from start of code to tb table. */ /* Interrupt handler mask. */
fputs ("\t.long ", file); /* Omit this long, since we never set the interrupt handler bit
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "LT"); above. */
RS6000_OUTPUT_BASENAME (file, fname);
putc ('-', file);
rs6000_output_function_entry (file, fname);
putc ('\n', file);
/* Interrupt handler mask. */ /* Number of CTL (controlled storage) anchors. */
/* Omit this long, since we never set the interrupt handler bit /* Omit this long, since the has_ctl bit is never set above. */
above. */
/* Number of CTL (controlled storage) anchors. */ /* Displacement into stack of each CTL anchor. */
/* Omit this long, since the has_ctl bit is never set above. */ /* Omit this list of longs, because there are no CTL anchors. */
/* Displacement into stack of each CTL anchor. */ /* Length of function name. */
/* Omit this list of longs, because there are no CTL anchors. */ if (*fname == '*')
++fname;
fprintf (file, "\t.short %d\n", (int) strlen (fname));
/* Length of function name. */ /* Function name. */
if (*fname == '*') assemble_string (fname, strlen (fname));
++fname;
fprintf (file, "\t.short %d\n", (int) strlen (fname));
/* Function name. */ /* Register for alloca automatic storage; this is always reg 31.
assemble_string (fname, strlen (fname)); 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. fputs ("\t.align 2\n", file);
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);
} }
/* Arrange to define .LCTOC1 label, if not already done. */ /* Arrange to define .LCTOC1 label, if not already done. */