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]

[lto] PATCH: misc bug fixes


Here's a group of mostly minor bug fixes to fix assorted problems that Kenny has run into. OK to commit?

-Sandra

2006-10-05  Sandra Loosemore <sandra@codesourcery.com>

	* gcc/dwarf2out.c (lto_void_type_die): New.
	(AT_string_form): Always use DW_FORM_string when emitting LTO
	information, because the LTO front end doesn't (yet) understand
	DW_FORM_strp.
	(dwarf2out_init): Initialize lto_void_type_die.
	(lto_init_ref): Use debug_info_section_label instead of section name.
	(lto_type_ref): Make it work.

	* gcc/lto/lto.c (lto_read_unspecified_type_DIE): New.
	(lto_read_DIE): Add entry for lto_read_unspecified_type_DIE.
	(lto_resolve_type_ref): Make sure new_context gets initialized.
Index: gcc/dwarf2out.c
===================================================================
*** gcc/dwarf2out.c	(revision 117374)
--- gcc/dwarf2out.c	(working copy)
*************** static GTY(()) int label_num;
*** 3987,3992 ****
--- 3987,3998 ----
     within the current function.  */
  static HOST_WIDE_INT frame_pointer_fb_offset;
  
+ /* Cached DIE used to represent the void type for LTO processing.  Normally
+    the void type is represented as the absence of a type attribute, but LTO
+    needs an explicit cookie.  See lto_type_ref.  */
+ 
+ static GTY(()) dw_die_ref lto_void_type_die;
+ 
  /* Forward declarations for functions defined in this file.  */
  
  static int is_pseudo_reg (rtx);
*************** AT_string_form (dw_attr_ref a)
*** 5036,5041 ****
--- 5042,5052 ----
    if (node->form)
      return node->form;
  
+   /* The LTO front end DWARF reader doesn't yet support DW_FORM_strp, so
+      if we're emitting LTO information, always use DW_FORM_string.  */
+   if (flag_unit_at_a_time)
+     return node->form = DW_FORM_string;
+ 
    len = strlen (node->str) + 1;
  
    /* If the string is shorter or equal to the size of the reference, it is
*************** dwarf2out_init (const char *filename ATT
*** 13845,13850 ****
--- 13856,13863 ----
        switch_to_section (unlikely_text_section ());
        ASM_OUTPUT_LABEL (asm_out_file, cold_text_section_label);
      }
+ 
+   lto_void_type_die = NULL;
  }
  
  /* A helper function for dwarf2out_finish called through
*************** lto_init_ref (tree scope ATTRIBUTE_UNUSE
*** 14331,14337 ****
       multiple sections, SCOPE will be used to figure out the section
       and corresponding BASE_LABEL.  */
    ref->section = 0;
!   ref->base_label = ".debug_info";
    ref->label = NULL;
  }
  
--- 14344,14350 ----
       multiple sections, SCOPE will be used to figure out the section
       and corresponding BASE_LABEL.  */
    ref->section = 0;
!   ref->base_label = debug_info_section_label;
    ref->label = NULL;
  }
  
*************** lto_type_ref (tree type, lto_out_ref *re
*** 14344,14367 ****
  
    gcc_assert (TYPE_P (type));
  
!   /* Check to see if we already have a DIE.  */
!   die = lookup_type_die (type);
!   /* Create the DIE, if it does not already exist.  */
!   if (!die)
      {
!       scope = TYPE_CONTEXT (type);
!       if (scope)
  	{
! 	  /* We do not yet support lexically scoped types.  */
! 	  sorry ("nested types are not supported by LTO");
! 	  scope_die = NULL;
  	}
!       else
! 	scope_die = comp_unit_die;
!       gen_type_die (type, scope_die);
!       die = lookup_type_die (type);
      }
    gcc_assert (die);
    /* Make sure the DIE has a label.  */
    assign_symbol_name (die);
    /* Construct the reference.  */
--- 14357,14395 ----
  
    gcc_assert (TYPE_P (type));
  
!   scope = TYPE_CONTEXT (type);
!   if (scope)
      {
!       /* We do not yet support lexically scoped types.  */
!       sorry ("nested types are not supported by LTO");
!       scope_die = NULL;
!     }
!   else
!     scope_die = comp_unit_die;
! 
!   /* The void type is normally treated as the absence of a DWARF
!      type attribute when emitting normal debugging information, but for
!      LTO purposes we need to emit an explicit DIE for it.  The DWARF spec
!      suggests using DW_TAG_unspecified_type for this purpose, so that's
!      what we'll do.  */
! 
!   if (TREE_CODE (type) == VOID_TYPE)
!     {
!       if (!lto_void_type_die)
  	{
! 	  lto_void_type_die =
! 	    new_die (DW_TAG_unspecified_type, scope_die, type);
! 	  add_name_attribute (lto_void_type_die, "void");
  	}
!       die = lto_void_type_die;
      }
+   else
+     die = modified_type_die (type,
+ 			     TYPE_READONLY (type),
+ 			     TYPE_VOLATILE (type),
+ 			     scope_die);
    gcc_assert (die);
+ 
    /* Make sure the DIE has a label.  */
    assign_symbol_name (die);
    /* Construct the reference.  */
Index: gcc/lto/lto.c
===================================================================
*** gcc/lto/lto.c	(revision 117374)
--- gcc/lto/lto.c	(working copy)
*************** lto_read_const_volatile_restrict_type_DI
*** 2734,2739 ****
--- 2734,2761 ----
    return type;
  }
  
+ static tree
+ lto_read_unspecified_type_DIE (lto_info_fd *fd,
+ 			       const DWARF2_abbrev *abbrev,
+ 			       lto_context *context)
+ {
+   tree type = NULL_TREE;
+ 
+   LTO_BEGIN_READ_ATTRS ()
+     {
+     case DW_AT_name:
+       gcc_assert (attr_data.cl == DW_cl_string);
+       if (strcmp (attr_data.u.string, "void") == 0)
+ 	type = void_type_node;
+       break;
+     }
+   LTO_END_READ_ATTRS ();
+ 
+   if (!type)
+     sorry ("unsupported use of DW_TAG_unspecified_type");
+   lto_read_child_DIEs (fd, abbrev, context);
+   return type;
+ }
  
  /* Read the next DIE from FD.  CONTEXT provides information about the
     current state of the compilation unit.  Returns a (possibly null) TREE
*************** lto_read_DIE (lto_info_fd *fd, lto_conte
*** 2808,2814 ****
        NULL, /* interface_type */
        NULL, /* namespace */
        NULL, /* imported_module */
!       NULL, /* unspecified_type */
        NULL, /* partial_unit */
        NULL, /* imported_unit */
        NULL, /* padding */
--- 2830,2836 ----
        NULL, /* interface_type */
        NULL, /* namespace */
        NULL, /* imported_module */
!       lto_read_unspecified_type_DIE, 
        NULL, /* partial_unit */
        NULL, /* imported_unit */
        NULL, /* padding */
*************** lto_resolve_type_ref (lto_info_fd *info_
*** 3041,3047 ****
  		      const lto_ref *ref)
  {
    const char *reference;
!   lto_context *new_context;
    tree type;
  
    /* At present, we only support a single DWARF section.  */
--- 3063,3069 ----
  		      const lto_ref *ref)
  {
    const char *reference;
!   lto_context *new_context = context;
    tree type;
  
    /* At present, we only support a single DWARF section.  */

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