x
authorJason Merrill <merrill@gnu.org>
Mon, 11 Nov 1996 20:12:06 +0000 (20:12 +0000)
committerJason Merrill <merrill@gnu.org>
Mon, 11 Nov 1996 20:12:06 +0000 (20:12 +0000)
From-SVN: r13121

gcc/config/mips/iris6.h
gcc/dwarf2out.c
gcc/varasm.c

index 038affa2737b9ccfba29c4a99b9ec5ba0fa0e267..03cbf5f7f93d82c60c54e4ac21b39585e383a1cd 100644 (file)
@@ -144,9 +144,10 @@ Boston, MA 02111-1307, USA.  */
 
 #undef SET_ASM_OP      /* Has no equivalent.  See ASM_OUTPUT_DEF below.  */
 
-/* This is how to equate one symbol to another symbol.  The syntax used is
-   `SYM1=SYM2'.  Note that this is different from the way equates are done
-   with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'.  */
+#if 0
+/* This is *NOT* how to equate one symbol to another symbol.  The assembler
+   '=' syntax just equates a name to a constant expression.
+   See ASM_OUTPUT_WEAK_ALIAS.  */
 
 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                             \
  do {  fprintf ((FILE), "\t");                                         \
@@ -155,6 +156,28 @@ Boston, MA 02111-1307, USA.  */
        assemble_name (FILE, LABEL2);                                   \
        fprintf (FILE, "\n");                                           \
   } while (0)
+#endif
+
+/* Define the strings used for the special svr4 .type and .size directives.  */
+
+#define TYPE_ASM_OP    ".type"
+#define SIZE_ASM_OP    ".size"
+
+/* This is how we tell the assembler that a symbol is weak.  */
+
+#define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \
+ do {                                          \
+  fputs ("\t.weakext\t", FILE);                        \
+  assemble_name (FILE, NAME);                  \
+  if (VALUE)                                   \
+    {                                          \
+      fputc (' ', FILE);                       \
+      assemble_name (FILE, VALUE);             \
+    }                                          \
+  fputc ('\n', FILE);                          \
+ } while (0)
+
+#define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0)
 
 #define POPSECTION_ASM_OP      ".popsection"
 
@@ -195,6 +218,7 @@ Boston, MA 02111-1307, USA.  */
    and dtor lists this way, so we use -init and -fini to invoke the
    do_global_* functions instead of running collect2.  */
 
+#define BSS_SECTION_ASM_OP     ".section\t.bss"
 #define CONST_SECTION_ASM_OP_32        "\t.rdata"
 #define CONST_SECTION_ASM_OP_64        ".section\t.rodata"
 #define CTORS_SECTION_ASM_OP   ".section\t.ctors,1,2,0,4"
@@ -323,22 +347,69 @@ while (0)
 
 /* ??? SGI assembler gives warning whenever .lcomm is used.  */
 #undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN)    \
-do                                                             \
-  {                                                            \
-    if (mips_abi != ABI_32)                                    \
-      {                                                                \
-       fputs ("\t.section\t.bss\n", STREAM);                   \
-       ASM_DECLARE_OBJECT_NAME (STREAM, NAME, 0);              \
-       ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT));  \
-       ASM_OUTPUT_SKIP (STREAM, SIZE);                         \
-       fprintf (STREAM, "\t%s\n", POPSECTION_ASM_OP);          \
-      }                                                                \
-    else                                                       \
+#define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN)               \
+do                                                                        \
+  {                                                                       \
+    if (mips_abi != ABI_32)                                               \
+      {                                                                           \
+       fprintf (STREAM, "%s\n", BSS_SECTION_ASM_OP);                      \
+       mips_declare_object (STREAM, NAME, "", ":\n", 0);                  \
+       ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT));     \
+       ASM_OUTPUT_SKIP (STREAM, SIZE);                                    \
+       fprintf (STREAM, "\t%s\n", POPSECTION_ASM_OP);                     \
+      }                                                                           \
+    else                                                                  \
       mips_declare_object (STREAM, NAME, "\n\t.lcomm\t", ",%u\n", (SIZE)); \
-  }                                                            \
+  }                                                                       \
 while (0)
 
+/* A C statement (sans semicolon) to output to the stdio stream
+   FILE the assembler definition of uninitialized global DECL named
+   NAME whose size is SIZE bytes and alignment is ALIGN bytes.
+   Try to use asm_output_aligned_bss to implement this macro.  */
+
+#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
+  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
+
+/* Write the extra assembler code needed to declare an object properly.  */
+
+#undef ASM_DECLARE_OBJECT_NAME
+#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)                    \
+do                                                                     \
+ {                                                                     \
+   size_directive_output = 0;                                          \
+   if (!flag_inhibit_size_directive && DECL_SIZE (DECL))       \
+     {                                                                 \
+       size_directive_output = 1;                                      \
+       fprintf (STREAM, "\t%s\t ", SIZE_ASM_OP);                       \
+       assemble_name (STREAM, NAME);                                   \
+       fprintf (STREAM, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));        \
+     }                                                                 \
+   mips_declare_object (STREAM, NAME, "", ":\n", 0);                   \
+ }                                                                     \
+while (0)
+
+/* Output the size directive for a decl in rest_of_decl_compilation
+   in the case where we did not do so before the initializer.
+   Once we find the error_mark_node, we know that the value of
+   size_directive_output was set
+   by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
+
+#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)        \
+do {                                                                    \
+     char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);                  \
+     if (!flag_inhibit_size_directive && DECL_SIZE (DECL)               \
+         && ! AT_END && TOP_LEVEL                                       \
+        && DECL_INITIAL (DECL) == error_mark_node                       \
+        && !size_directive_output)                                      \
+       {                                                                \
+        size_directive_output = 1;                                      \
+        fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
+        assemble_name (FILE, name);                                     \
+        fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
+       }                                                                \
+   } while (0)
+
 #undef LOCAL_LABEL_PREFIX
 #define LOCAL_LABEL_PREFIX (mips_abi == ABI_32 ? "$" : ".")
 
index e5e21829f35a015d720bc5571c37659ff41acb02..51c58ffaaeac1953975fb94168ab56db70a5792f 100644 (file)
@@ -252,19 +252,6 @@ pubname_entry;
 #define ASM_COMMENT_START ";#"
 #endif
 
-/* Define a macro which returns non-zero for any tagged type which is used
-   (directly or indirectly) in the specification of either some function's
-   return type or some formal parameter of some function. We use this macro
-   when we are operating in "terse" mode to help us know what tagged types
-   have to be represented in Dwarf (even in terse mode) and which ones don't.
-   A flag bit with this meaning really should be a part of the normal GCC
-   ..._TYPE nodes, but at the moment, there is no such bit defined for these
-   nodes.  For now, we have to just fake it.  It it safe for us to simply
-   return zero for all complete tagged types (which will get forced out
-   anyway if they were used in the specification of some formal or return
-   type) and non-zero for all incomplete tagged types.  */
-#define TYPE_USED_FOR_FUNCTION(tagged_type) (TYPE_SIZE (tagged_type) == 0)
-
 /* Define a macro which returns non-zero for a TYPE_DECL which was
    implicitly generated for a tagged type.
 
@@ -6089,7 +6076,8 @@ scope_die_for (t, context_die)
        {
          assert (scope_die == comp_unit_die);
          assert (TREE_CODE_CLASS (TREE_CODE (containing_scope)) == 't');
-         assert (TREE_ASM_WRITTEN (containing_scope));
+         if (debug_info_level > DINFO_LEVEL_TERSE)
+           assert (TREE_ASM_WRITTEN (containing_scope));
        }
     }
   return scope_die;
@@ -6533,7 +6521,6 @@ gen_subprogram_die (decl, context_die)
   register dw_die_ref subr_die;
   register dw_loc_descr_ref fp_loc = NULL;
   register unsigned fp_reg;
-  register tree type;
   register tree fn_arg_types;
   register tree outer_scope;
   dw_die_ref old_die = lookup_decl_die (decl);
@@ -6581,9 +6568,12 @@ gen_subprogram_die (decl, context_die)
       if (TREE_PUBLIC (decl))
        add_AT_flag (subr_die, DW_AT_external, 1);
       add_name_and_src_coords_attributes (subr_die, decl);
-      type = TREE_TYPE (decl);
-      add_prototyped_attribute (subr_die, type);
-      add_type_attribute (subr_die, TREE_TYPE (type), 0, 0, context_die);
+      if (debug_info_level > DINFO_LEVEL_TERSE)
+       {
+         register tree type = TREE_TYPE (decl);
+         add_prototyped_attribute (subr_die, type);
+         add_type_attribute (subr_die, TREE_TYPE (type), 0, 0, context_die);
+       }
       add_pure_or_virtual_attribute (subr_die, decl);
       if (DECL_ARTIFICIAL (decl))
        add_AT_flag (subr_die, DW_AT_artificial, 1);
@@ -6668,7 +6658,9 @@ gen_subprogram_die (decl, context_die)
   /* In the case where we are describing a mere function declaration, all we
      need to do here (and all we *can* do here) is to describe the *types* of 
      its formal parameters.  */
-  if (DECL_INITIAL (decl) == NULL_TREE)
+  if (debug_info_level <= DINFO_LEVEL_TERSE)
+    /* do nothing */;
+  else if (DECL_INITIAL (decl) == NULL_TREE)
     {
       gen_formal_types_die (TREE_TYPE (decl), subr_die);
     }
@@ -7009,11 +7001,8 @@ gen_compile_unit_die (main_input_filename)
      that the object file is stripped and has no debugging information.
      To get the MIPS/SGI debugger to believe that there is debugging
      information in the object file, we add a -g to the producer string.  */
-  if (write_symbols != NO_DEBUG)
-    {
-       strcat (producer, " -g");
-    }
-
+  if (debug_info_level > DINFO_LEVEL_TERSE)
+    strcat (producer, " -g");
 #endif
 
   add_AT_string (comp_unit_die, DW_AT_producer, producer);
@@ -7548,7 +7537,8 @@ gen_decl_die (decl, context_die)
 
       /* Before we describe the FUNCTION_DECL itself, make sure that we have
          described its return type.  */
-      gen_type_die (TREE_TYPE (TREE_TYPE (decl)), context_die);
+      if (debug_info_level > DINFO_LEVEL_TERSE)
+       gen_type_die (TREE_TYPE (TREE_TYPE (decl)), context_die);
 
       /* Now output a DIE to represent the function itself.  */
       gen_subprogram_die (decl, context_die);
@@ -7556,18 +7546,9 @@ gen_decl_die (decl, context_die)
 
     case TYPE_DECL:
       /* If we are in terse mode, don't generate any DIEs to represent any
-         actual typedefs.  Note that even when we are in terse mode, we must
-         still output DIEs to represent those tagged types which are used
-         (directly or indirectly) in the specification of either a return
-         type or a formal parameter type of some function.  */
+         actual typedefs.  */
       if (debug_info_level <= DINFO_LEVEL_TERSE)
-       {
-         if (! TYPE_DECL_IS_STUB (decl)
-             || !TYPE_USED_FOR_FUNCTION (TREE_TYPE (decl)))
-           {
-             break;
-           }
-       }
+       break;
 
       /* In the special case of a TYPE_DECL node representing the 
          declaration of some type tag, if the given TYPE_DECL is marked as
@@ -7752,18 +7733,9 @@ dwarfout_file_scope_decl (decl, set_finalizing)
        }
 
       /* If we are in terse mode, don't generate any DIEs to represent any
-         actual typedefs.  Note that even when we are in terse mode, we must
-         still output DIEs to represent those tagged types which are used
-         (directly or indirectly) in the specification of either a return
-         type or a formal parameter type of some function.  */
+         actual typedefs.  */
       if (debug_info_level <= DINFO_LEVEL_TERSE)
-       {
-         if (! TYPE_DECL_IS_STUB (decl)
-             || !TYPE_USED_FOR_FUNCTION (TREE_TYPE (decl)))
-           {
-             return;
-           }
-       }
+       return;
       break;
 
     default:
@@ -8204,7 +8176,8 @@ dwarfout_init (asm_out_file, main_input_filename)
   gen_compile_unit_die (main_input_filename);
 
   /* clear the association between base types and their DIE's */
-  init_base_type_table ();
+  if (debug_info_level > DINFO_LEVEL_TERSE)
+    init_base_type_table ();
 
   ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
 }
index e7a566359ad6ad957a86984490e8b5f72f3b4b2c..4659490e8483d32d30ef6ed3da166e28416cc89c 100644 (file)
@@ -4217,12 +4217,12 @@ void
 assemble_alias (decl, target)
      tree decl, target;
 {
-#ifdef ASM_OUTPUT_DEF
   char *name;
 
   make_decl_rtl (decl, (char *) 0, 1);
   name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
 
+#ifdef ASM_OUTPUT_DEF
   /* Make name accessible from other files, if appropriate.  */
 
   if (TREE_PUBLIC (decl))
@@ -4241,7 +4241,15 @@ assemble_alias (decl, target)
   ASM_OUTPUT_DEF (asm_out_file, name, IDENTIFIER_POINTER (target));
   TREE_ASM_WRITTEN (decl) = 1;
 #else
-  warning ("alias definitions not supported in this configuration");
+#ifdef ASM_OUTPUT_WEAK_ALIAS
+  if (! DECL_WEAK (decl))
+    warning ("only weak aliases are supported in this configuration");
+
+  ASM_OUTPUT_WEAK_ALIAS (asm_out_file, name, IDENTIFIER_POINTER (target));
+  TREE_ASM_WRITTEN (decl) = 1;
+#else
+  warning ("alias definitions not supported in this configuration; ignored");
+#endif
 #endif
 }