This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

powerpc64 traceback tables


>From the PowerPC64 ABI:

"To support debuggers and exception handlers, the 64-bit PowerPC ELF
ABI defines traceback tables.  Compilers must support generation of at
least the mandatory part of traceback tables, and system libraries
should contain the mandatory part.  Compilers should provide an option
to turn off traceback table generation to save space when the
information is not needed."

Adds control of traceback table output.  Default is unchanged from
current behaviour.

	* config/rs6000/rs6000.c (rs6000_traceback_name): New var.
	(rs6000_traceback): New var.
	(rs6000_override_options): Set rs6000_traceback.
	(rs6000_output_function_epilogue): Implement traceback options.
	* config/rs6000/rs6000.h (TARGET_OPTIONS): Add "traceback=".
	(rs6000_traceback_name): Declare.

OK mainline?

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: gcc/config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.348
diff -u -p -r1.348 rs6000.c
--- gcc/config/rs6000/rs6000.c	25 Jul 2002 21:00:10 -0000	1.348
+++ gcc/config/rs6000/rs6000.c	26 Jul 2002 06:07:32 -0000
@@ -129,6 +129,14 @@ const char *rs6000_debug_name;
 int rs6000_debug_stack;		/* debug stack applications */
 int rs6000_debug_arg;		/* debug argument handling */
 
+const char *rs6000_traceback_name;
+static enum {
+  traceback_default = 0,
+  traceback_none,
+  traceback_part,
+  traceback_full
+} rs6000_traceback;
+
 /* Flag to say the TOC is initialized */
 int toc_initialized;
 char toc_label_name[10];
@@ -600,6 +608,19 @@ rs6000_override_options (default_cpu)
 	error ("unknown -mdebug-%s switch", rs6000_debug_name);
     }
 
+  if (rs6000_traceback_name)
+    {
+      if (! strcmp (rs6000_traceback_name, "full"))
+	rs6000_traceback = traceback_full;
+      else if (! strncmp (rs6000_traceback_name, "part", 4))
+	rs6000_traceback = traceback_part;
+      else if (! strncmp (rs6000_traceback_name, "no", 2))
+	rs6000_traceback = traceback_none;
+      else
+	error ("unknown -mtraceback arg `%s'; expecting `full', `partial' or `none'",
+	       rs6000_traceback_name);
+    }
+
   /* Set size of long double */
   rs6000_long_double_type_size = 64;
   if (rs6000_long_double_size_string)
@@ -10818,7 +10839,6 @@ rs6000_output_function_epilogue (file, s
      HOST_WIDE_INT size ATTRIBUTE_UNUSED;
 {
   rs6000_stack_t *info = rs6000_stack_info ();
-  int optional_tbtab = (optimize_size || TARGET_ELF) ? 0 : 1;
 
   if (! HAVE_epilogue)
     {
@@ -10871,12 +10891,21 @@ rs6000_output_function_epilogue (file, s
 
      System V.4 Powerpc's (and the embedded ABI derived from it) use a
      different traceback table.  */
-  if (DEFAULT_ABI == ABI_AIX && ! flag_inhibit_size_directive)
+  if (DEFAULT_ABI == ABI_AIX && ! flag_inhibit_size_directive
+      && rs6000_traceback != traceback_none)
     {
       const char *fname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
       const char *language_string = lang_hooks.name;
       int fixed_parms = 0, float_parms = 0, parm_info = 0;
       int i;
+      int optional_tbtab;
+
+      if (rs6000_traceback == traceback_full)
+	optional_tbtab = 1;
+      else if (rs6000_traceback == traceback_part)
+	optional_tbtab = 0;
+      else
+	optional_tbtab = !optimize_size && !TARGET_ELF;
 
       while (*fname == '.')	/* V.4 encodes . in the name */
 	fname++;
@@ -11070,7 +11099,6 @@ rs6000_output_function_epilogue (file, s
 
       fputs ("\t.align 2\n", file);
     }
-  return;
 }
 
 /* A C compound statement that outputs the assembler code for a thunk
Index: gcc/config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.214
diff -u -p -r1.214 rs6000.h
--- gcc/config/rs6000/rs6000.h	25 Jul 2002 02:22:47 -0000	1.214
+++ gcc/config/rs6000/rs6000.h	26 Jul 2002 06:17:42 -0000
@@ -392,6 +392,8 @@ extern enum processor_type rs6000_cpu;
    {"tune=", &rs6000_select[2].string,					\
     N_("Schedule code for given CPU") },				\
    {"debug=", &rs6000_debug_name, N_("Enable debug output") },		\
+   {"traceback=", &rs6000_traceback_name,				\
+    N_("Select full, part, or no traceback table") },			\
    {"abi=", &rs6000_abi_string, N_("Specify ABI to use") },		\
    {"long-double-", &rs6000_long_double_size_string,			\
     N_("Specify size of long double (64 or 128 bits)") },		\
@@ -424,6 +426,8 @@ extern int rs6000_debug_arg;		/* debug a
 
 #define	TARGET_DEBUG_STACK	rs6000_debug_stack
 #define	TARGET_DEBUG_ARG	rs6000_debug_arg
+
+extern const char *rs6000_traceback_name; /* Type of traceback table.  */
 
 /* These are separate from target_flags because we've run out of bits
    there.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]