OSDN Git Service

Add - before rms to be more portable.
[pf3gnuchains/gcc-fork.git] / gcc / dwarfout.c
index 5206ebd..e339820 100644 (file)
@@ -1,5 +1,6 @@
 /* Output Dwarf format symbol table information from the GNU C compiler.
-   Copyright (C) 1992, 1993, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998,
+   1999, 2000 Free Software Foundation, Inc.
    Contributed by Ron Guilmette (rfg@monkeys.com) of Network Computing Devices.
 
 This file is part of GNU CC.
@@ -22,7 +23,7 @@ Boston, MA 02111-1307, USA.  */
 #include "config.h"
 
 #ifdef DWARF_DEBUGGING_INFO
-#include <stdio.h>
+#include "system.h"
 #include "dwarf.h"
 #include "tree.h"
 #include "flags.h"
@@ -32,27 +33,9 @@ Boston, MA 02111-1307, USA.  */
 #include "reload.h"
 #include "output.h"
 #include "defaults.h"
-
-/* #define NDEBUG 1 */
-#include "assert.h"
-
-#if defined(DWARF_TIMESTAMPS)
-#if defined(POSIX)
-#include <time.h>
-#else /* !defined(POSIX) */
-#include <sys/types.h>
-#if defined(__STDC__)
-extern time_t time (time_t *);
-#else /* !defined(__STDC__) */
-extern time_t time ();
-#endif /* !defined(__STDC__) */
-#endif /* !defined(POSIX) */
-#endif /* defined(DWARF_TIMESTAMPS) */
-
-extern char *getpwd ();
-
-extern char *index ();
-extern char *rindex ();
+#include "dwarfout.h"
+#include "toplev.h"
+#include "tm_p.h"
 
 /* IMPORTANT NOTE: Please see the file README.DWARF for important details
    regarding the GNU implementation of Dwarf.  */
@@ -65,10 +48,6 @@ extern char *rindex ();
 /* Note that the implementation of C++ support herein is (as yet) unfinished.
    If you want to try to complete it, more power to you.  */
 
-#if !defined(__GNUC__) || (NDEBUG != 1)
-#define inline
-#endif
-
 /* How to start an assembler comment.  */
 #ifndef ASM_COMMENT_START
 #define ASM_COMMENT_START ";#"
@@ -97,64 +76,32 @@ extern char *rindex ();
 
 #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.
+
+   Note that unlike the gcc front end (which generates a NULL named
+   TYPE_DECL node for each complete tagged type, each array type, and
+   each function type node created) the g++ front end generates a
+   _named_ TYPE_DECL node for each tagged type node created.
+   These TYPE_DECLs have DECL_ARTIFICIAL set, so we know not to
+   generate a DW_TAG_typedef DIE for them.  */
+#define TYPE_DECL_IS_STUB(decl)                                \
+  (DECL_NAME (decl) == NULL                            \
+   || (DECL_ARTIFICIAL (decl)                          \
+       && is_tagged_type (TREE_TYPE (decl))            \
+       && decl == TYPE_STUB_DECL (TREE_TYPE (decl))))
+
 extern int flag_traditional;
-extern char *version_string;
-extern char *language_string;
 
 /* Maximum size (in bytes) of an artificially generated label. */
 
 #define MAX_ARTIFICIAL_LABEL_BYTES     30
 \f
-/* Make sure we know the sizes of the various types dwarf can describe.
-   These are only defaults.  If the sizes are different for your target,
-   you should override these values by defining the appropriate symbols
-   in your tm.h file.  */
-
-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
-
-#ifndef SHORT_TYPE_SIZE
-#define SHORT_TYPE_SIZE (BITS_PER_UNIT * 2)
-#endif
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_LONG_TYPE_SIZE
-#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
-#endif
-
-#ifndef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-#endif
-
-#ifndef FLOAT_TYPE_SIZE
-#define FLOAT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-\f
 /* Structure to keep track of source filenames.  */
 
 struct filename_entry {
   unsigned     number;
-  char *       name;
+  const char * name;
 };
 
 typedef struct filename_entry filename_entry;
@@ -182,21 +129,11 @@ static unsigned ft_entries;
 /* Local pointer to the name of the main input file.  Initialized in
    dwarfout_init.  */
 
-static char *primary_filename;
+static const char *primary_filename;
 
 /* Pointer to the most recent filename for which we produced some line info.  */
 
-static char *last_filename;
-
-/* For Dwarf output, we must assign lexical-blocks id numbers
-   in the order in which their beginnings are encountered.
-   We output Dwarf debugging info that refers to the beginnings
-   and ends of the ranges of code for each lexical block with
-   assembler labels ..Bn and ..Bn.e, where n is the block number.
-   The labels themselves are generated in final.c, which assigns
-   numbers to the blocks in the same way.  */
-
-static unsigned next_block_number = 2;
+static const char *last_filename;
 
 /* Counter to generate unique names for DIEs.  */
 
@@ -210,7 +147,7 @@ static unsigned current_dienum;
    represents a function or data object defined in this compilation
    unit which has "extern" linkage.  */
 
-static next_pubname_number = 0;
+static int next_pubname_number = 0;
 
 #define NEXT_DIE_NUM pending_sibling_stack[pending_siblings-1]
 
@@ -261,6 +198,22 @@ static unsigned pending_types;
 
 #define PENDING_TYPES_INCREMENT 64
 
+/* A pointer to the base of a list of incomplete types which might be
+   completed at some later time.  */
+
+static tree *incomplete_types_list;
+
+/* Number of elements currently allocated for the incomplete_types_list.  */
+static unsigned incomplete_types_allocated;
+
+/* Number of elements of incomplete_types_list currently in use.  */
+static unsigned incomplete_types;
+
+/* Size (in elements) of increments by which we may expand the incomplete
+   types list.  Actually, a single hunk of space of this size should
+   be enough for most typical programs.         */
+#define INCOMPLETE_TYPES_INCREMENT 64
+
 /* Pointer to an artificial RECORD_TYPE which we create in dwarfout_init.
    This is used in a hack to help us get the DIEs describing types of
    formal parameters to come *after* all of the DIEs describing the formal
@@ -284,120 +237,147 @@ static unsigned current_funcdef_number = 1;
 
 static tree dwarf_last_decl;
 
+/* A flag indicating that we are emitting the member declarations of a
+   class, so member functions and variables should not be entirely emitted.
+   This is a kludge to avoid passing a second argument to output_*_die.  */
+
+static int in_class;
+
 /* Forward declarations for functions defined in this file.  */
 
-static char *dwarf_tag_name            PROTO((unsigned));
-static char *dwarf_attr_name           PROTO((unsigned));
-static char *dwarf_stack_op_name       PROTO((unsigned));
-static char *dwarf_typemod_name                PROTO((unsigned));
-static char *dwarf_fmt_byte_name       PROTO((unsigned));
-static char *dwarf_fund_type_name      PROTO((unsigned));
-static tree decl_ultimate_origin       PROTO((tree));
-static tree block_ultimate_origin      PROTO((tree));
-static void output_unsigned_leb128     PROTO((unsigned long));
-static void output_signed_leb128       PROTO((long));
-static inline int is_body_block                PROTO((tree));
-static int fundamental_type_code       PROTO((tree));
-static tree root_type                  PROTO((tree));
-static void write_modifier_bytes       PROTO((tree, int, int));
-static inline int type_is_fundamental  PROTO((tree));
-static void equate_decl_number_to_die_number PROTO((tree));
-static inline void equate_type_number_to_die_number PROTO((tree));
-static void output_reg_number          PROTO((rtx));
-static void output_mem_loc_descriptor  PROTO((rtx));
-static void output_loc_descriptor      PROTO((rtx));
-static void output_bound_representation        PROTO((tree, unsigned, int));
-static void output_enumeral_list       PROTO((tree));
-static inline unsigned ceiling         PROTO((unsigned, unsigned));
-static inline tree field_type          PROTO((tree));
-static inline unsigned simple_type_align_in_bits PROTO((tree));
-static inline unsigned simple_type_size_in_bits  PROTO((tree));
-static unsigned field_byte_offset      PROTO((tree));
-static inline void sibling_attribute   PROTO((void));
-static void location_attribute         PROTO((rtx));
-static void data_member_location_attribute PROTO((tree));
-static void const_value_attribute      PROTO((rtx));
-static void location_or_const_value_attribute PROTO((tree));
-static inline void name_attribute      PROTO((char *));
-static inline void fund_type_attribute PROTO((unsigned));
-static void mod_fund_type_attribute    PROTO((tree, int, int));
-static inline void user_def_type_attribute PROTO((tree));
-static void mod_u_d_type_attribute     PROTO((tree, int, int));
-static inline void ordering_attribute  PROTO((unsigned));
-static void subscript_data_attribute   PROTO((tree));
-static void byte_size_attribute                PROTO((tree));
-static inline void bit_offset_attribute        PROTO((tree));
-static inline void bit_size_attribute  PROTO((tree));
-static inline void element_list_attribute PROTO((tree));
-static inline void stmt_list_attribute PROTO((char *));
-static inline void low_pc_attribute    PROTO((char *));
-static inline void high_pc_attribute   PROTO((char *));
-static inline void body_begin_attribute        PROTO((char *));
-static inline void body_end_attribute  PROTO((char *));
-static inline void langauge_attribute  PROTO((unsigned));
-static inline void member_attribute    PROTO((tree));
-static inline void string_length_attribute PROTO((tree));
-static inline void comp_dir_attribute  PROTO((char *));
-static inline void sf_names_attribute  PROTO((char *));
-static inline void src_info_attribute  PROTO((char *));
-static inline void mac_info_attribute  PROTO((char *));
-static inline void prototyped_attribute        PROTO((tree));
-static inline void producer_attribute  PROTO((char *));
-static inline void inline_attribute    PROTO((tree));
-static inline void containing_type_attribute PROTO((tree));
-static inline void abstract_origin_attribute PROTO((tree));
-static inline void src_coords_attribute PROTO((unsigned, unsigned));
-static inline void pure_or_virtual_attribute PROTO((tree));
-static void name_and_src_coords_attributes PROTO((tree));
-static void type_attribute             PROTO((tree, int, int));
-static char *type_tag                  PROTO((tree));
-static inline void dienum_push         PROTO((void));
-static inline void dienum_pop          PROTO((void));
-static inline tree member_declared_type PROTO((tree));
-static char *function_start_label      PROTO((tree));
-static void output_array_type_die      PROTO((void *));
-static void output_set_type_die                PROTO((void *));
-static void output_entry_point_die     PROTO((void *));
-static void output_inlined_enumeration_type_die PROTO((void *));
-static void output_inlined_structure_type_die PROTO((void *));
-static void output_inlined_union_type_die PROTO((void *));
-static void output_enumeration_type_die        PROTO((void *));
-static void output_formal_parameter_die        PROTO((void *));
-static void output_global_subroutine_die PROTO((void *));
-static void output_global_variable_die PROTO((void *));
-static void output_label_die           PROTO((void *));
-static void output_lexical_block_die   PROTO((void *));
-static void output_inlined_subroutine_die PROTO((void *));
-static void output_local_variable_die  PROTO((void *));
-static void output_member_die          PROTO((void *));
-static void output_pointer_type_die    PROTO((void *));
-static void output_reference_type_die  PROTO((void *));
-static void output_ptr_to_mbr_type_die PROTO((void *));
-static void output_compile_unit_die    PROTO((void *));
-static void output_string_type_die     PROTO((void *));
-static void output_structure_type_die  PROTO((void *));
-static void output_local_subroutine_die PROTO((void *));
-static void output_subroutine_type_die PROTO((void *));
-static void output_typedef_die         PROTO((void *));
-static void output_union_type_die      PROTO((void *));
-static void output_unspecified_parameters_die PROTO((void *));
-static void output_padded_null_die     PROTO((void *));
-static void output_die                 PROTO((void (*) (), void *));
-static void end_sibling_chain          PROTO((void));
-static void output_formal_types                PROTO((tree));
-static void pend_type                  PROTO((tree));
-static inline int type_of_for_scope    PROTO((tree, tree));
-static void output_pending_types_for_scope PROTO((tree));
-static void output_type                        PROTO((tree, tree));
-static void output_tagged_type_instantiation PROTO((tree));
-static void output_block               PROTO((tree, int));
-static void output_decls_for_scope     PROTO((tree, int));
-static void output_decl                        PROTO((tree, tree));
-static void shuffle_filename_entry     PROTO((filename_entry *));
-static void geneate_new_sfname_entry   PROTO((void));
-static unsigned lookup_filename                PROTO((char *));
-static void generate_srcinfo_entry     PROTO((unsigned, unsigned));
-static void generate_macinfo_entry     PROTO((char *, char *));
+static const char *dwarf_tag_name      PARAMS ((unsigned));
+static const char *dwarf_attr_name     PARAMS ((unsigned));
+static const char *dwarf_stack_op_name PARAMS ((unsigned));
+static const char *dwarf_typemod_name  PARAMS ((unsigned));
+static const char *dwarf_fmt_byte_name PARAMS ((unsigned));
+static const char *dwarf_fund_type_name        PARAMS ((unsigned));
+static tree decl_ultimate_origin       PARAMS ((tree));
+static tree block_ultimate_origin      PARAMS ((tree));
+static tree decl_class_context                 PARAMS ((tree));
+#if 0
+static void output_unsigned_leb128     PARAMS ((unsigned long));
+static void output_signed_leb128       PARAMS ((long));
+#endif
+static int fundamental_type_code       PARAMS ((tree));
+static tree root_type_1                        PARAMS ((tree, int));
+static tree root_type                  PARAMS ((tree));
+static void write_modifier_bytes_1     PARAMS ((tree, int, int, int));
+static void write_modifier_bytes       PARAMS ((tree, int, int));
+static inline int type_is_fundamental  PARAMS ((tree));
+static void equate_decl_number_to_die_number PARAMS ((tree));
+static inline void equate_type_number_to_die_number PARAMS ((tree));
+static void output_reg_number          PARAMS ((rtx));
+static void output_mem_loc_descriptor  PARAMS ((rtx));
+static void output_loc_descriptor      PARAMS ((rtx));
+static void output_bound_representation        PARAMS ((tree, unsigned, int));
+static void output_enumeral_list       PARAMS ((tree));
+static inline HOST_WIDE_INT ceiling    PARAMS ((HOST_WIDE_INT, unsigned int));
+static inline tree field_type          PARAMS ((tree));
+static inline unsigned int simple_type_align_in_bits PARAMS ((tree));
+static inline unsigned HOST_WIDE_INT simple_type_size_in_bits  PARAMS ((tree));
+static HOST_WIDE_INT field_byte_offset PARAMS ((tree));
+static inline void sibling_attribute   PARAMS ((void));
+static void location_attribute         PARAMS ((rtx));
+static void data_member_location_attribute PARAMS ((tree));
+static void const_value_attribute      PARAMS ((rtx));
+static void location_or_const_value_attribute PARAMS ((tree));
+static inline void name_attribute      PARAMS ((const char *));
+static inline void fund_type_attribute PARAMS ((unsigned));
+static void mod_fund_type_attribute    PARAMS ((tree, int, int));
+static inline void user_def_type_attribute PARAMS ((tree));
+static void mod_u_d_type_attribute     PARAMS ((tree, int, int));
+#ifdef USE_ORDERING_ATTRIBUTE
+static inline void ordering_attribute  PARAMS ((unsigned));
+#endif /* defined(USE_ORDERING_ATTRIBUTE) */
+static void subscript_data_attribute   PARAMS ((tree));
+static void byte_size_attribute                PARAMS ((tree));
+static inline void bit_offset_attribute        PARAMS ((tree));
+static inline void bit_size_attribute  PARAMS ((tree));
+static inline void element_list_attribute PARAMS ((tree));
+static inline void stmt_list_attribute PARAMS ((const char *));
+static inline void low_pc_attribute    PARAMS ((const char *));
+static inline void high_pc_attribute   PARAMS ((const char *));
+static inline void body_begin_attribute        PARAMS ((const char *));
+static inline void body_end_attribute  PARAMS ((const char *));
+static inline void language_attribute  PARAMS ((unsigned));
+static inline void member_attribute    PARAMS ((tree));
+#if 0
+static inline void string_length_attribute PARAMS ((tree));
+#endif
+static inline void comp_dir_attribute  PARAMS ((const char *));
+static inline void sf_names_attribute  PARAMS ((const char *));
+static inline void src_info_attribute  PARAMS ((const char *));
+static inline void mac_info_attribute  PARAMS ((const char *));
+static inline void prototyped_attribute        PARAMS ((tree));
+static inline void producer_attribute  PARAMS ((const char *));
+static inline void inline_attribute    PARAMS ((tree));
+static inline void containing_type_attribute PARAMS ((tree));
+static inline void abstract_origin_attribute PARAMS ((tree));
+#ifdef DWARF_DECL_COORDINATES
+static inline void src_coords_attribute PARAMS ((unsigned, unsigned));
+#endif /* defined(DWARF_DECL_COORDINATES) */
+static inline void pure_or_virtual_attribute PARAMS ((tree));
+static void name_and_src_coords_attributes PARAMS ((tree));
+static void type_attribute             PARAMS ((tree, int, int));
+static const char *type_tag            PARAMS ((tree));
+static inline void dienum_push         PARAMS ((void));
+static inline void dienum_pop          PARAMS ((void));
+static inline tree member_declared_type PARAMS ((tree));
+static const char *function_start_label        PARAMS ((tree));
+static void output_array_type_die      PARAMS ((void *));
+static void output_set_type_die                PARAMS ((void *));
+#if 0
+static void output_entry_point_die     PARAMS ((void *));
+#endif
+static void output_inlined_enumeration_type_die PARAMS ((void *));
+static void output_inlined_structure_type_die PARAMS ((void *));
+static void output_inlined_union_type_die PARAMS ((void *));
+static void output_enumeration_type_die        PARAMS ((void *));
+static void output_formal_parameter_die        PARAMS ((void *));
+static void output_global_subroutine_die PARAMS ((void *));
+static void output_global_variable_die PARAMS ((void *));
+static void output_label_die           PARAMS ((void *));
+static void output_lexical_block_die   PARAMS ((void *));
+static void output_inlined_subroutine_die PARAMS ((void *));
+static void output_local_variable_die  PARAMS ((void *));
+static void output_member_die          PARAMS ((void *));
+#if 0
+static void output_pointer_type_die    PARAMS ((void *));
+static void output_reference_type_die  PARAMS ((void *));
+#endif
+static void output_ptr_to_mbr_type_die PARAMS ((void *));
+static void output_compile_unit_die    PARAMS ((void *));
+static void output_string_type_die     PARAMS ((void *));
+static void output_inheritance_die     PARAMS ((void *));
+static void output_structure_type_die  PARAMS ((void *));
+static void output_local_subroutine_die PARAMS ((void *));
+static void output_subroutine_type_die PARAMS ((void *));
+static void output_typedef_die         PARAMS ((void *));
+static void output_union_type_die      PARAMS ((void *));
+static void output_unspecified_parameters_die PARAMS ((void *));
+static void output_padded_null_die     PARAMS ((void *));
+static void output_die                 PARAMS ((void (*)(void *), void *));
+static void end_sibling_chain          PARAMS ((void));
+static void output_formal_types                PARAMS ((tree));
+static void pend_type                  PARAMS ((tree));
+static int type_ok_for_scope           PARAMS ((tree, tree));
+static void output_pending_types_for_scope PARAMS ((tree));
+static void output_type                        PARAMS ((tree, tree));
+static void output_tagged_type_instantiation PARAMS ((tree));
+static void output_block               PARAMS ((tree, int));
+static void output_decls_for_scope     PARAMS ((tree, int));
+static void output_decl                        PARAMS ((tree, tree));
+static void shuffle_filename_entry     PARAMS ((filename_entry *));
+static void generate_new_sfname_entry  PARAMS ((void));
+static unsigned lookup_filename                PARAMS ((const char *));
+static void generate_srcinfo_entry     PARAMS ((unsigned, unsigned));
+static void generate_macinfo_entry     PARAMS ((const char *, const char *));
+static int is_pseudo_reg               PARAMS ((rtx));
+static tree type_main_variant          PARAMS ((tree));
+static int is_tagged_type              PARAMS ((tree));
+static int is_redundant_typedef                PARAMS ((tree));
+static void add_incomplete_type                PARAMS ((tree));
+static void retry_incomplete_types     PARAMS ((void));
 \f
 /* Definitions of defaults for assembler-dependent names of various
    pseudo-ops and section names.
@@ -407,22 +387,22 @@ static void generate_macinfo_entry        PROTO((char *, char *));
    what is expected by "standard" AT&T System V.4 assemblers.  */
 
 #ifndef FILE_ASM_OP
-#define FILE_ASM_OP            ".file"
+#define FILE_ASM_OP            "\t.file\t"
 #endif
 #ifndef VERSION_ASM_OP
-#define VERSION_ASM_OP         ".version"
+#define VERSION_ASM_OP         "\t.version\t"
 #endif
 #ifndef UNALIGNED_SHORT_ASM_OP
-#define UNALIGNED_SHORT_ASM_OP ".2byte"
+#define UNALIGNED_SHORT_ASM_OP "\t.2byte\t"
 #endif
 #ifndef UNALIGNED_INT_ASM_OP
-#define UNALIGNED_INT_ASM_OP   ".4byte"
+#define UNALIGNED_INT_ASM_OP   "\t.4byte\t"
 #endif
 #ifndef ASM_BYTE_OP
-#define ASM_BYTE_OP            ".byte"
+#define ASM_BYTE_OP            "\t.byte\t"
 #endif
 #ifndef SET_ASM_OP
-#define SET_ASM_OP             ".set"
+#define SET_ASM_OP             "\t.set\t"
 #endif
 
 /* Pseudo-ops for pushing the current section onto the section stack (and
@@ -434,10 +414,10 @@ static void generate_macinfo_entry        PROTO((char *, char *));
    OK because we only use at most one level of the section stack herein.  */
 
 #ifndef PUSHSECTION_ASM_OP
-#define PUSHSECTION_ASM_OP     ".section"
+#define PUSHSECTION_ASM_OP     "\t.section\t"
 #endif
 #ifndef POPSECTION_ASM_OP
-#define POPSECTION_ASM_OP      ".previous"
+#define POPSECTION_ASM_OP      "\t.previous"
 #endif
 
 /* The default format used by the ASM_OUTPUT_PUSH_SECTION macro (see below)
@@ -446,7 +426,7 @@ static void generate_macinfo_entry  PROTO((char *, char *));
    section name must be enclosed in double quotes.  (See sparcv4.h.)  */
 
 #ifndef PUSHSECTION_FORMAT
-#define PUSHSECTION_FORMAT     "\t%s\t%s\n"
+#define PUSHSECTION_FORMAT     "%s%s\n"
 #endif
 
 #ifndef DEBUG_SECTION
@@ -508,153 +488,150 @@ static void generate_macinfo_entry      PROTO((char *, char *));
 */
 
 #ifndef TEXT_BEGIN_LABEL
-#define TEXT_BEGIN_LABEL       ".L_text_b"
+#define TEXT_BEGIN_LABEL       "*.L_text_b"
 #endif
 #ifndef TEXT_END_LABEL
-#define TEXT_END_LABEL         ".L_text_e"
+#define TEXT_END_LABEL         "*.L_text_e"
 #endif
 
 #ifndef DATA_BEGIN_LABEL
-#define DATA_BEGIN_LABEL       ".L_data_b"
+#define DATA_BEGIN_LABEL       "*.L_data_b"
 #endif
 #ifndef DATA_END_LABEL
-#define DATA_END_LABEL         ".L_data_e"
+#define DATA_END_LABEL         "*.L_data_e"
 #endif
 
 #ifndef DATA1_BEGIN_LABEL
-#define DATA1_BEGIN_LABEL      ".L_data1_b"
+#define DATA1_BEGIN_LABEL      "*.L_data1_b"
 #endif
 #ifndef DATA1_END_LABEL
-#define DATA1_END_LABEL                ".L_data1_e"
+#define DATA1_END_LABEL                "*.L_data1_e"
 #endif
 
 #ifndef RODATA_BEGIN_LABEL
-#define RODATA_BEGIN_LABEL     ".L_rodata_b"
+#define RODATA_BEGIN_LABEL     "*.L_rodata_b"
 #endif
 #ifndef RODATA_END_LABEL
-#define RODATA_END_LABEL       ".L_rodata_e"
+#define RODATA_END_LABEL       "*.L_rodata_e"
 #endif
 
 #ifndef RODATA1_BEGIN_LABEL
-#define RODATA1_BEGIN_LABEL    ".L_rodata1_b"
+#define RODATA1_BEGIN_LABEL    "*.L_rodata1_b"
 #endif
 #ifndef RODATA1_END_LABEL
-#define RODATA1_END_LABEL      ".L_rodata1_e"
+#define RODATA1_END_LABEL      "*.L_rodata1_e"
 #endif
 
 #ifndef BSS_BEGIN_LABEL
-#define BSS_BEGIN_LABEL                ".L_bss_b"
+#define BSS_BEGIN_LABEL                "*.L_bss_b"
 #endif
 #ifndef BSS_END_LABEL
-#define BSS_END_LABEL          ".L_bss_e"
+#define BSS_END_LABEL          "*.L_bss_e"
 #endif
 
 #ifndef LINE_BEGIN_LABEL
-#define LINE_BEGIN_LABEL       ".L_line_b"
+#define LINE_BEGIN_LABEL       "*.L_line_b"
 #endif
 #ifndef LINE_LAST_ENTRY_LABEL
-#define LINE_LAST_ENTRY_LABEL  ".L_line_last"
+#define LINE_LAST_ENTRY_LABEL  "*.L_line_last"
 #endif
 #ifndef LINE_END_LABEL
-#define LINE_END_LABEL         ".L_line_e"
+#define LINE_END_LABEL         "*.L_line_e"
 #endif
 
 #ifndef DEBUG_BEGIN_LABEL
-#define DEBUG_BEGIN_LABEL      ".L_debug_b"
+#define DEBUG_BEGIN_LABEL      "*.L_debug_b"
 #endif
 #ifndef SFNAMES_BEGIN_LABEL
-#define SFNAMES_BEGIN_LABEL    ".L_sfnames_b"
+#define SFNAMES_BEGIN_LABEL    "*.L_sfnames_b"
 #endif
 #ifndef SRCINFO_BEGIN_LABEL
-#define SRCINFO_BEGIN_LABEL    ".L_srcinfo_b"
+#define SRCINFO_BEGIN_LABEL    "*.L_srcinfo_b"
 #endif
 #ifndef MACINFO_BEGIN_LABEL
-#define MACINFO_BEGIN_LABEL    ".L_macinfo_b"
+#define MACINFO_BEGIN_LABEL    "*.L_macinfo_b"
 #endif
 
 #ifndef DIE_BEGIN_LABEL_FMT
-#define DIE_BEGIN_LABEL_FMT    ".L_D%u"
+#define DIE_BEGIN_LABEL_FMT    "*.L_D%u"
 #endif
 #ifndef DIE_END_LABEL_FMT
-#define DIE_END_LABEL_FMT      ".L_D%u_e"
+#define DIE_END_LABEL_FMT      "*.L_D%u_e"
 #endif
 #ifndef PUB_DIE_LABEL_FMT
-#define PUB_DIE_LABEL_FMT      ".L_P%u"
-#endif
-#ifndef INSN_LABEL_FMT
-#define INSN_LABEL_FMT         ".L_I%u_%u"
+#define PUB_DIE_LABEL_FMT      "*.L_P%u"
 #endif
 #ifndef BLOCK_BEGIN_LABEL_FMT
-#define BLOCK_BEGIN_LABEL_FMT  ".L_B%u"
+#define BLOCK_BEGIN_LABEL_FMT  "*.L_B%u"
 #endif
 #ifndef BLOCK_END_LABEL_FMT
-#define BLOCK_END_LABEL_FMT    ".L_B%u_e"
+#define BLOCK_END_LABEL_FMT    "*.L_B%u_e"
 #endif
 #ifndef SS_BEGIN_LABEL_FMT
-#define SS_BEGIN_LABEL_FMT     ".L_s%u"
+#define SS_BEGIN_LABEL_FMT     "*.L_s%u"
 #endif
 #ifndef SS_END_LABEL_FMT
-#define SS_END_LABEL_FMT       ".L_s%u_e"
+#define SS_END_LABEL_FMT       "*.L_s%u_e"
 #endif
 #ifndef EE_BEGIN_LABEL_FMT
-#define EE_BEGIN_LABEL_FMT     ".L_e%u"
+#define EE_BEGIN_LABEL_FMT     "*.L_e%u"
 #endif
 #ifndef EE_END_LABEL_FMT
-#define EE_END_LABEL_FMT       ".L_e%u_e"
+#define EE_END_LABEL_FMT       "*.L_e%u_e"
 #endif
 #ifndef MT_BEGIN_LABEL_FMT
-#define MT_BEGIN_LABEL_FMT     ".L_t%u"
+#define MT_BEGIN_LABEL_FMT     "*.L_t%u"
 #endif
 #ifndef MT_END_LABEL_FMT
-#define MT_END_LABEL_FMT       ".L_t%u_e"
+#define MT_END_LABEL_FMT       "*.L_t%u_e"
 #endif
 #ifndef LOC_BEGIN_LABEL_FMT
-#define LOC_BEGIN_LABEL_FMT    ".L_l%u"
+#define LOC_BEGIN_LABEL_FMT    "*.L_l%u"
 #endif
 #ifndef LOC_END_LABEL_FMT
-#define LOC_END_LABEL_FMT      ".L_l%u_e"
+#define LOC_END_LABEL_FMT      "*.L_l%u_e"
 #endif
 #ifndef BOUND_BEGIN_LABEL_FMT
-#define BOUND_BEGIN_LABEL_FMT  ".L_b%u_%u_%c"
+#define BOUND_BEGIN_LABEL_FMT  "*.L_b%u_%u_%c"
 #endif
 #ifndef BOUND_END_LABEL_FMT
-#define BOUND_END_LABEL_FMT    ".L_b%u_%u_%c_e"
+#define BOUND_END_LABEL_FMT    "*.L_b%u_%u_%c_e"
 #endif
 #ifndef DERIV_BEGIN_LABEL_FMT
-#define DERIV_BEGIN_LABEL_FMT  ".L_d%u"
+#define DERIV_BEGIN_LABEL_FMT  "*.L_d%u"
 #endif
 #ifndef DERIV_END_LABEL_FMT
-#define DERIV_END_LABEL_FMT    ".L_d%u_e"
+#define DERIV_END_LABEL_FMT    "*.L_d%u_e"
 #endif
 #ifndef SL_BEGIN_LABEL_FMT
-#define SL_BEGIN_LABEL_FMT     ".L_sl%u"
+#define SL_BEGIN_LABEL_FMT     "*.L_sl%u"
 #endif
 #ifndef SL_END_LABEL_FMT
-#define SL_END_LABEL_FMT       ".L_sl%u_e"
+#define SL_END_LABEL_FMT       "*.L_sl%u_e"
 #endif
 #ifndef BODY_BEGIN_LABEL_FMT
-#define BODY_BEGIN_LABEL_FMT   ".L_b%u"
+#define BODY_BEGIN_LABEL_FMT   "*.L_b%u"
 #endif
 #ifndef BODY_END_LABEL_FMT
-#define BODY_END_LABEL_FMT     ".L_b%u_e"
+#define BODY_END_LABEL_FMT     "*.L_b%u_e"
 #endif
 #ifndef FUNC_END_LABEL_FMT
-#define FUNC_END_LABEL_FMT     ".L_f%u_e"
+#define FUNC_END_LABEL_FMT     "*.L_f%u_e"
 #endif
 #ifndef TYPE_NAME_FMT
-#define TYPE_NAME_FMT          ".L_T%u"
+#define TYPE_NAME_FMT          "*.L_T%u"
 #endif
 #ifndef DECL_NAME_FMT
-#define DECL_NAME_FMT          ".L_E%u"
+#define DECL_NAME_FMT          "*.L_E%u"
 #endif
 #ifndef LINE_CODE_LABEL_FMT
-#define LINE_CODE_LABEL_FMT    ".L_LC%u"
+#define LINE_CODE_LABEL_FMT    "*.L_LC%u"
 #endif
 #ifndef SFNAMES_ENTRY_LABEL_FMT
-#define SFNAMES_ENTRY_LABEL_FMT        ".L_F%u"
+#define SFNAMES_ENTRY_LABEL_FMT        "*.L_F%u"
 #endif
 #ifndef LINE_ENTRY_LABEL_FMT
-#define LINE_ENTRY_LABEL_FMT   ".L_LE%u"
+#define LINE_ENTRY_LABEL_FMT   "*.L_LE%u"
 #endif
 \f
 /* Definitions of defaults for various types of primitive assembly language
@@ -670,20 +647,12 @@ static void generate_macinfo_entry        PROTO((char *, char *));
 
 #ifndef ASM_OUTPUT_POP_SECTION
 #define ASM_OUTPUT_POP_SECTION(FILE) \
-  fprintf ((FILE), "\t%s\n", POPSECTION_ASM_OP)
-#endif
-
-#ifndef ASM_OUTPUT_SOURCE_FILENAME
-#define ASM_OUTPUT_SOURCE_FILENAME(FILE,NAME) \
-  do { fprintf (FILE, "\t%s\t", FILE_ASM_OP);                          \
-       output_quoted_string (FILE, NAME);                              \
-       fputc ('\n', FILE);                                             \
-  } while (0)
+  fprintf ((FILE), "%s\n", POPSECTION_ASM_OP)
 #endif
 
 #ifndef ASM_OUTPUT_DWARF_DELTA2
 #define ASM_OUTPUT_DWARF_DELTA2(FILE,LABEL1,LABEL2)                    \
- do {  fprintf ((FILE), "\t%s\t", UNALIGNED_SHORT_ASM_OP);             \
+ do {  fprintf ((FILE), "%s", UNALIGNED_SHORT_ASM_OP);                 \
        assemble_name (FILE, LABEL1);                                   \
        fprintf (FILE, "-");                                            \
        assemble_name (FILE, LABEL2);                                   \
@@ -693,7 +662,7 @@ static void generate_macinfo_entry  PROTO((char *, char *));
 
 #ifndef ASM_OUTPUT_DWARF_DELTA4
 #define ASM_OUTPUT_DWARF_DELTA4(FILE,LABEL1,LABEL2)                    \
- do {  fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP);               \
+ do {  fprintf ((FILE), "%s", UNALIGNED_INT_ASM_OP);                   \
        assemble_name (FILE, LABEL1);                                   \
        fprintf (FILE, "-");                                            \
        assemble_name (FILE, LABEL2);                                   \
@@ -704,7 +673,7 @@ static void generate_macinfo_entry  PROTO((char *, char *));
 #ifndef ASM_OUTPUT_DWARF_TAG
 #define ASM_OUTPUT_DWARF_TAG(FILE,TAG)                                 \
   do {                                                                 \
-    fprintf ((FILE), "\t%s\t0x%x",                                     \
+    fprintf ((FILE), "%s0x%x",                                         \
                     UNALIGNED_SHORT_ASM_OP, (unsigned) TAG);           \
     if (flag_debug_asm)                                                        \
       fprintf ((FILE), "\t%s %s",                                      \
@@ -716,7 +685,7 @@ static void generate_macinfo_entry  PROTO((char *, char *));
 #ifndef ASM_OUTPUT_DWARF_ATTRIBUTE
 #define ASM_OUTPUT_DWARF_ATTRIBUTE(FILE,ATTR)                          \
   do {                                                                 \
-    fprintf ((FILE), "\t%s\t0x%x",                                     \
+    fprintf ((FILE), "%s0x%x",                                         \
                     UNALIGNED_SHORT_ASM_OP, (unsigned) ATTR);          \
     if (flag_debug_asm)                                                        \
       fprintf ((FILE), "\t%s %s",                                      \
@@ -728,7 +697,7 @@ static void generate_macinfo_entry  PROTO((char *, char *));
 #ifndef ASM_OUTPUT_DWARF_STACK_OP
 #define ASM_OUTPUT_DWARF_STACK_OP(FILE,OP)                             \
   do {                                                                 \
-    fprintf ((FILE), "\t%s\t0x%x", ASM_BYTE_OP, (unsigned) OP);                \
+    fprintf ((FILE), "%s0x%x", ASM_BYTE_OP, (unsigned) OP);            \
     if (flag_debug_asm)                                                        \
       fprintf ((FILE), "\t%s %s",                                      \
                       ASM_COMMENT_START, dwarf_stack_op_name (OP));    \
@@ -739,7 +708,7 @@ static void generate_macinfo_entry  PROTO((char *, char *));
 #ifndef ASM_OUTPUT_DWARF_FUND_TYPE
 #define ASM_OUTPUT_DWARF_FUND_TYPE(FILE,FT)                            \
   do {                                                                 \
-    fprintf ((FILE), "\t%s\t0x%x",                                     \
+    fprintf ((FILE), "%s0x%x",                                         \
                     UNALIGNED_SHORT_ASM_OP, (unsigned) FT);            \
     if (flag_debug_asm)                                                        \
       fprintf ((FILE), "\t%s %s",                                      \
@@ -751,7 +720,7 @@ static void generate_macinfo_entry  PROTO((char *, char *));
 #ifndef ASM_OUTPUT_DWARF_FMT_BYTE
 #define ASM_OUTPUT_DWARF_FMT_BYTE(FILE,FMT)                            \
   do {                                                                 \
-    fprintf ((FILE), "\t%s\t0x%x", ASM_BYTE_OP, (unsigned) FMT);       \
+    fprintf ((FILE), "%s0x%x", ASM_BYTE_OP, (unsigned) FMT);           \
     if (flag_debug_asm)                                                        \
       fprintf ((FILE), "\t%s %s",                                      \
                       ASM_COMMENT_START, dwarf_fmt_byte_name (FMT));   \
@@ -762,7 +731,7 @@ static void generate_macinfo_entry  PROTO((char *, char *));
 #ifndef ASM_OUTPUT_DWARF_TYPE_MODIFIER
 #define ASM_OUTPUT_DWARF_TYPE_MODIFIER(FILE,MOD)                       \
   do {                                                                 \
-    fprintf ((FILE), "\t%s\t0x%x", ASM_BYTE_OP, (unsigned) MOD);       \
+    fprintf ((FILE), "%s0x%x", ASM_BYTE_OP, (unsigned) MOD);           \
     if (flag_debug_asm)                                                        \
       fprintf ((FILE), "\t%s %s",                                      \
                       ASM_COMMENT_START, dwarf_typemod_name (MOD));    \
@@ -772,7 +741,7 @@ static void generate_macinfo_entry  PROTO((char *, char *));
 \f
 #ifndef ASM_OUTPUT_DWARF_ADDR
 #define ASM_OUTPUT_DWARF_ADDR(FILE,LABEL)                              \
- do {  fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP);               \
+ do {  fprintf ((FILE), "%s", UNALIGNED_INT_ASM_OP);                   \
        assemble_name (FILE, LABEL);                                    \
        fprintf (FILE, "\n");                                           \
   } while (0)
@@ -781,7 +750,7 @@ static void generate_macinfo_entry  PROTO((char *, char *));
 #ifndef ASM_OUTPUT_DWARF_ADDR_CONST
 #define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX)                          \
   do {                                                                 \
-    fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP);                  \
+    fprintf ((FILE), "%s", UNALIGNED_INT_ASM_OP);                      \
     output_addr_const ((FILE), (RTX));                                 \
     fputc ('\n', (FILE));                                              \
   } while (0)
@@ -789,7 +758,7 @@ static void generate_macinfo_entry  PROTO((char *, char *));
 
 #ifndef ASM_OUTPUT_DWARF_REF
 #define ASM_OUTPUT_DWARF_REF(FILE,LABEL)                               \
- do {  fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP);               \
+ do {  fprintf ((FILE), "%s", UNALIGNED_INT_ASM_OP);                   \
        assemble_name (FILE, LABEL);                                    \
        fprintf (FILE, "\n");                                           \
   } while (0)
@@ -797,17 +766,17 @@ static void generate_macinfo_entry        PROTO((char *, char *));
 
 #ifndef ASM_OUTPUT_DWARF_DATA1
 #define ASM_OUTPUT_DWARF_DATA1(FILE,VALUE) \
-  fprintf ((FILE), "\t%s\t0x%x\n", ASM_BYTE_OP, VALUE)
+  fprintf ((FILE), "%s0x%x\n", ASM_BYTE_OP, VALUE)
 #endif
 
 #ifndef ASM_OUTPUT_DWARF_DATA2
 #define ASM_OUTPUT_DWARF_DATA2(FILE,VALUE) \
-  fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_SHORT_ASM_OP, (unsigned) VALUE)
+  fprintf ((FILE), "%s0x%x\n", UNALIGNED_SHORT_ASM_OP, (unsigned) VALUE)
 #endif
 
 #ifndef ASM_OUTPUT_DWARF_DATA4
 #define ASM_OUTPUT_DWARF_DATA4(FILE,VALUE) \
-  fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, (unsigned) VALUE)
+  fprintf ((FILE), "%s0x%x\n", UNALIGNED_INT_ASM_OP, (unsigned) VALUE)
 #endif
 
 #ifndef ASM_OUTPUT_DWARF_DATA8
@@ -815,25 +784,35 @@ static void generate_macinfo_entry        PROTO((char *, char *));
   do {                                                                 \
     if (WORDS_BIG_ENDIAN)                                              \
       {                                                                        \
-       fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \
-       fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, LOW_VALUE);\
+       fprintf ((FILE), "%s0x%x\n", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \
+       fprintf ((FILE), "%s0x%x\n", UNALIGNED_INT_ASM_OP, LOW_VALUE);  \
       }                                                                        \
     else                                                               \
       {                                                                        \
-       fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, LOW_VALUE);\
-       fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \
+       fprintf ((FILE), "%s0x%x\n", UNALIGNED_INT_ASM_OP, LOW_VALUE);  \
+       fprintf ((FILE), "%s0x%x\n", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \
       }                                                                        \
   } while (0)
 #endif
 
+/* ASM_OUTPUT_DWARF_STRING is defined to output an ascii string, but to
+   NOT issue a trailing newline. We define ASM_OUTPUT_DWARF_STRING_NEWLINE
+   based on whether ASM_OUTPUT_DWARF_STRING is defined or not. If it is
+   defined, we call it, then issue the line feed. If not, we supply a
+   default defintion of calling ASM_OUTPUT_ASCII */
+
 #ifndef ASM_OUTPUT_DWARF_STRING
-#define ASM_OUTPUT_DWARF_STRING(FILE,P) \
+#define ASM_OUTPUT_DWARF_STRING_NEWLINE(FILE,P) \
   ASM_OUTPUT_ASCII ((FILE), P, strlen (P)+1)
+#else
+#define ASM_OUTPUT_DWARF_STRING_NEWLINE(FILE,P) \
+  ASM_OUTPUT_DWARF_STRING (FILE,P), ASM_OUTPUT_DWARF_STRING (FILE,"\n") 
 #endif
+
 \f
 /************************ general utility functions **************************/
 
-inline int
+inline static int
 is_pseudo_reg (rtl)
      register rtx rtl;
 {
@@ -842,7 +821,7 @@ is_pseudo_reg (rtl)
              && (REGNO (XEXP (rtl, 0)) >= FIRST_PSEUDO_REGISTER)));
 }
 
-inline tree
+inline static tree
 type_main_variant (type)
      register tree type;
 {
@@ -864,7 +843,7 @@ type_main_variant (type)
 
 /* Return non-zero if the given type node represents a tagged type.  */
 
-inline int
+inline static int
 is_tagged_type (type)
      register tree type;
 {
@@ -874,7 +853,7 @@ is_tagged_type (type)
          || code == QUAL_UNION_TYPE || code == ENUMERAL_TYPE);
 }
 
-static char *
+static const char *
 dwarf_tag_name (tag)
      register unsigned tag;
 {
@@ -924,7 +903,7 @@ dwarf_tag_name (tag)
     }
 }
 
-static char *
+static const char *
 dwarf_attr_name (attr)
      register unsigned attr;
 {
@@ -1002,7 +981,7 @@ dwarf_attr_name (attr)
     }
 }
 
-static char *
+static const char *
 dwarf_stack_op_name (op)
      register unsigned op;
 {
@@ -1019,7 +998,7 @@ dwarf_stack_op_name (op)
     }
 }
 
-static char *
+static const char *
 dwarf_typemod_name (mod)
      register unsigned mod;
 {
@@ -1033,7 +1012,7 @@ dwarf_typemod_name (mod)
     }
 }
 
-static char *
+static const char *
 dwarf_fmt_byte_name (fmt)
      register unsigned fmt;
 {
@@ -1052,7 +1031,7 @@ dwarf_fmt_byte_name (fmt)
     }
 }
 
-static char *
+static const char *
 dwarf_fund_type_name (ft)
      register unsigned ft;
 {
@@ -1098,7 +1077,10 @@ dwarf_fund_type_name (ft)
     case FT_unsigned_int32:    return "FT_unsigned_int32";
     case FT_int64:             return "FT_int64";
     case FT_signed_int64:      return "FT_signed_int64";
-    case FT_unsigned_int64:    return "FT_signed_int64";
+    case FT_unsigned_int64:    return "FT_unsigned_int64";
+    case FT_int128:            return "FT_int128";
+    case FT_signed_int128:     return "FT_signed_int128";
+    case FT_unsigned_int128:   return "FT_unsigned_int128";
 
     case FT_real32:            return "FT_real32";
     case FT_real64:            return "FT_real64";
@@ -1119,23 +1101,14 @@ static tree
 decl_ultimate_origin (decl)
      register tree decl;
 {
-  register tree immediate_origin = DECL_ABSTRACT_ORIGIN (decl);
-
-  if (immediate_origin == NULL)
-    return NULL;
-  else
-    {
-      register tree ret_val;
-      register tree lookahead = immediate_origin;
+#ifdef ENABLE_CHECKING 
+  if (DECL_FROM_INLINE (DECL_ORIGIN (decl)))
+    /* Since the DECL_ABSTRACT_ORIGIN for a DECL is supposed to be the
+       most distant ancestor, this should never happen.  */
+    abort ();
+#endif
 
-      do
-       {
-         ret_val = lookahead;
-         lookahead = DECL_ABSTRACT_ORIGIN (ret_val);
-       }
-      while (lookahead != NULL && lookahead != ret_val);
-      return ret_val;
-    }
+  return DECL_ABSTRACT_ORIGIN (decl);
 }
 
 /* Determine the "ultimate origin" of a block.  The block may be an
@@ -1169,6 +1142,28 @@ block_ultimate_origin (block)
     }
 }
 
+/* Get the class to which DECL belongs, if any.  In g++, the DECL_CONTEXT
+   of a virtual function may refer to a base class, so we check the 'this'
+   parameter.  */
+
+static tree
+decl_class_context (decl)
+     tree decl;
+{
+  tree context = NULL_TREE;
+  if (TREE_CODE (decl) != FUNCTION_DECL || ! DECL_VINDEX (decl))
+    context = DECL_CONTEXT (decl);
+  else
+    context = TYPE_MAIN_VARIANT
+      (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)))));
+
+  if (context && !TYPE_P (context))
+    context = NULL_TREE;
+
+  return context;
+}
+
+#if 0
 static void
 output_unsigned_leb128 (value)
      register unsigned long value;
@@ -1182,9 +1177,9 @@ output_unsigned_leb128 (value)
       value >>= 7;
       if (value != 0)  /* more bytes to follow */
        byte |= 0x80;
-      fprintf (asm_out_file, "\t%s\t0x%x", ASM_BYTE_OP, (unsigned) byte);
+      fprintf (asm_out_file, "%s0x%x", ASM_BYTE_OP, (unsigned) byte);
       if (flag_debug_asm && value == 0)
-       fprintf (asm_out_file, "\t%s ULEB128 number - value = %u",
+       fprintf (asm_out_file, "\t%s ULEB128 number - value = %lu",
                 ASM_COMMENT_START, orig_value);
       fputc ('\n', asm_out_file);
     }
@@ -1214,48 +1209,18 @@ output_signed_leb128 (value)
          byte |= 0x80;
          more = 1;
        }
-      fprintf (asm_out_file, "\t%s\t0x%x", ASM_BYTE_OP, (unsigned) byte);
+      fprintf (asm_out_file, "%s0x%x", ASM_BYTE_OP, (unsigned) byte);
       if (flag_debug_asm && more == 0)
-       fprintf (asm_out_file, "\t%s SLEB128 number - value = %d",
+       fprintf (asm_out_file, "\t%s SLEB128 number - value = %ld",
                 ASM_COMMENT_START, orig_value);
       fputc ('\n', asm_out_file);
     }
   while (more);
 }
+#endif
 \f
 /**************** utility functions for attribute functions ******************/
 
-/* Given a pointer to a BLOCK node return non-zero if (and only if) the
-   node in question represents the outermost pair of curly braces (i.e.
-   the "body block") of a function or method.
-
-   For any BLOCK node representing a "body block" of a function or method,
-   the BLOCK_SUPERCONTEXT of the node will point to another BLOCK node
-   which represents the outermost (function) scope for the function or
-   method (i.e. the one which includes the formal parameters).  The
-   BLOCK_SUPERCONTEXT of *that* node in turn will point to the relevant
-   FUNCTION_DECL node.
-*/
-
-static inline int
-is_body_block (stmt)
-     register tree stmt;
-{
-  if (TREE_CODE (stmt) == BLOCK)
-    {
-      register tree parent = BLOCK_SUPERCONTEXT (stmt);
-
-      if (TREE_CODE (parent) == BLOCK)
-       {
-         register tree grandparent = BLOCK_SUPERCONTEXT (parent);
-
-         if (TREE_CODE (grandparent) == FUNCTION_DECL)
-           return 1;
-       }
-    }
-  return 0;
-}
-
 /* Given a pointer to a tree node for some type, return a Dwarf fundamental
    type code for the given type.
 
@@ -1305,7 +1270,8 @@ fundamental_type_code (type)
            && DECL_NAME (TYPE_NAME (type)) != 0
            && TREE_CODE (DECL_NAME (TYPE_NAME (type))) == IDENTIFIER_NODE)
          {
-           char *name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
+           const char *name =
+             IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
 
            if (!strcmp (name, "unsigned char"))
              return FT_unsigned_char;
@@ -1346,6 +1312,13 @@ fundamental_type_code (type)
        if (TYPE_PRECISION (type) == CHAR_TYPE_SIZE)
          return (TREE_UNSIGNED (type) ? FT_unsigned_char : FT_char);
 
+       if (TYPE_MODE (type) == TImode)
+         return (TREE_UNSIGNED (type) ? FT_unsigned_int128 : FT_int128);
+
+       /* In C++, __java_boolean is an INTEGER_TYPE with precision == 1 */
+       if (TYPE_PRECISION (type) == 1)
+         return FT_boolean;
+
        abort ();
 
       case REAL_TYPE:
@@ -1356,7 +1329,8 @@ fundamental_type_code (type)
            && DECL_NAME (TYPE_NAME (type)) != 0
            && TREE_CODE (DECL_NAME (TYPE_NAME (type))) == IDENTIFIER_NODE)
          {
-           char *name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
+           const char *name =
+             IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
 
            /* Note that here we can run afowl of a serious bug in "classic"
               svr4 SDB debuggers.  They don't seem to understand the
@@ -1367,7 +1341,16 @@ fundamental_type_code (type)
          }
 
        if (TYPE_PRECISION (type) == DOUBLE_TYPE_SIZE)
-         return FT_dbl_prec_float;
+         {
+           /* On the SH, when compiling with -m3e or -m4-single-only, both
+              float and double are 32 bits.  But since the debugger doesn't
+              know about the subtarget, it always thinks double is 64 bits.
+              So we have to tell the debugger that the type is float to
+              make the output of the 'print' command etc. readable.  */
+           if (DOUBLE_TYPE_SIZE == FLOAT_TYPE_SIZE && FLOAT_TYPE_SIZE == 32)
+             return FT_float;
+           return FT_dbl_prec_float;
+         }
        if (TYPE_PRECISION (type) == FLOAT_TYPE_SIZE)
          return FT_float;
 
@@ -1405,10 +1388,14 @@ fundamental_type_code (type)
    qualifiers.  */
 
 static tree
-root_type (type)
+root_type_1 (type, count)
      register tree type;
+     register int count;
 {
-  if (TREE_CODE (type) == ERROR_MARK)
+  /* Give up after searching 1000 levels, in case this is a recursive
+     pointer type.  Such types are possible in Ada, but it is not possible
+     to represent them in DWARF1 debug info.  */
+  if (count > 1000)
     return error_mark_node;
 
   switch (TREE_CODE (type))
@@ -1418,25 +1405,42 @@ root_type (type)
 
       case POINTER_TYPE:
       case REFERENCE_TYPE:
-       return type_main_variant (root_type (TREE_TYPE (type)));
+       return root_type_1 (TREE_TYPE (type), count+1);
 
       default:
-       return type_main_variant (type);
+       return type;
     }
 }
 
+static tree
+root_type (type)
+     register tree type;
+{
+  type = root_type_1 (type, 0);
+  if (type != error_mark_node)
+    type = type_main_variant (type);
+  return type;
+}
+
 /* Given a pointer to an arbitrary ..._TYPE tree node, write out a sequence
    of zero or more Dwarf "type-modifier" bytes applicable to the type. */
 
 static void
-write_modifier_bytes (type, decl_const, decl_volatile)
+write_modifier_bytes_1 (type, decl_const, decl_volatile, count)
      register tree type;
      register int decl_const;
      register int decl_volatile;
+     register int count;
 {
   if (TREE_CODE (type) == ERROR_MARK)
     return;
 
+  /* Give up after searching 1000 levels, in case this is a recursive
+     pointer type.  Such types are possible in Ada, but it is not possible
+     to represent them in DWARF1 debug info.  */
+  if (count > 1000)
+    return;
+
   if (TYPE_READONLY (type) || decl_const)
     ASM_OUTPUT_DWARF_TYPE_MODIFIER (asm_out_file, MOD_const);
   if (TYPE_VOLATILE (type) || decl_volatile)
@@ -1445,12 +1449,12 @@ write_modifier_bytes (type, decl_const, decl_volatile)
     {
       case POINTER_TYPE:
        ASM_OUTPUT_DWARF_TYPE_MODIFIER (asm_out_file, MOD_pointer_to);
-       write_modifier_bytes (TREE_TYPE (type), 0, 0);
+       write_modifier_bytes_1 (TREE_TYPE (type), 0, 0, count+1);
        return;
 
       case REFERENCE_TYPE:
        ASM_OUTPUT_DWARF_TYPE_MODIFIER (asm_out_file, MOD_reference_to);
-       write_modifier_bytes (TREE_TYPE (type), 0, 0);
+       write_modifier_bytes_1 (TREE_TYPE (type), 0, 0, count+1);
        return;
 
       case ERROR_MARK:
@@ -1458,6 +1462,15 @@ write_modifier_bytes (type, decl_const, decl_volatile)
        return;
     }
 }
+
+static void
+write_modifier_bytes (type, decl_const, decl_volatile)
+     register tree type;
+     register int decl_const;
+     register int decl_volatile;
+{
+  write_modifier_bytes_1 (type, decl_const, decl_volatile, 0);
+}
 \f
 /* Given a pointer to an arbitrary ..._TYPE tree node, return non-zero if the
    given input type is a Dwarf "fundamental" type.  Otherwise return zero.  */
@@ -1490,6 +1503,7 @@ type_is_fundamental (type)
       case FILE_TYPE:
       case OFFSET_TYPE:
       case LANG_TYPE:
+      case VECTOR_TYPE:
        return 0;
 
       default:
@@ -1568,13 +1582,13 @@ output_reg_number (rtl)
 {
   register unsigned regno = REGNO (rtl);
 
-  if (regno >= FIRST_PSEUDO_REGISTER)
+  if (regno >= DWARF_FRAME_REGISTERS)
     {
       warning_with_decl (dwarf_last_decl, "internal regno botch: regno = %d\n",
                         regno);
       regno = 0;
     }
-  fprintf (asm_out_file, "\t%s\t0x%x",
+  fprintf (asm_out_file, "%s0x%x",
           UNALIGNED_INT_ASM_OP, DBX_REGISTER_NUMBER (regno));
   if (flag_debug_asm)
     {
@@ -1603,6 +1617,10 @@ output_mem_loc_descriptor (rtl)
      which is actually within the array.  That's *not* necessarily the
      same as the zeroth element of the array.  */
 
+#ifdef ASM_SIMPLIFY_DWARF_ADDR
+  rtl = ASM_SIMPLIFY_DWARF_ADDR (rtl);
+#endif
+
   switch (GET_CODE (rtl))
     {
       case SUBREG:
@@ -1663,6 +1681,15 @@ output_mem_loc_descriptor (rtl)
        ASM_OUTPUT_DWARF_DATA4 (asm_out_file, INTVAL (rtl));
        break;
 
+      case MULT:
+       /* If a pseudo-reg is optimized away, it is possible for it to
+          be replaced with a MEM containing a multiply.  Use a GNU extension
+          to describe it.  */
+       output_mem_loc_descriptor (XEXP (rtl, 0));
+       output_mem_loc_descriptor (XEXP (rtl, 1));
+       ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_MULT);
+       break;
+
       default:
        abort ();
     }
@@ -1723,8 +1750,8 @@ output_bound_representation (bound, dim_num, u_or_l)
       /* All fixed-bounds are represented by INTEGER_CST nodes.         */
 
     case INTEGER_CST:
-      ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
-                             (unsigned) TREE_INT_CST_LOW (bound));
+      if (host_integerp (bound, 0))
+       ASM_OUTPUT_DWARF_DATA4 (asm_out_file, tree_low_cst (bound, 0));
       break;
 
     default:
@@ -1798,9 +1825,12 @@ output_enumeral_list (link)
   if (link)
     {
       output_enumeral_list (TREE_CHAIN (link));
-      ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
-                             (unsigned) TREE_INT_CST_LOW (TREE_VALUE (link)));
-      ASM_OUTPUT_DWARF_STRING (asm_out_file,
+
+      if (host_integerp (TREE_VALUE (link), 0))
+       ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
+                               tree_low_cst (TREE_VALUE (link), 0));
+
+      ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file,
                               IDENTIFIER_POINTER (TREE_PURPOSE (link)));
     }
 }
@@ -1808,10 +1838,10 @@ output_enumeral_list (link)
 /* Given an unsigned value, round it up to the lowest multiple of `boundary'
    which is not less than the value itself.  */
 
-static inline unsigned
+static inline HOST_WIDE_INT
 ceiling (value, boundary)
-     register unsigned value;
-     register unsigned boundary;
+     register HOST_WIDE_INT value;
+     register unsigned int boundary;
 {
   return (((value + boundary - 1) / boundary) * boundary);
 }
@@ -1839,7 +1869,7 @@ field_type (decl)
    node, return the alignment in bits for the type, or else return
    BITS_PER_WORD if the node actually turns out to be an ERROR_MARK node.  */
 
-static inline unsigned
+static inline unsigned int
 simple_type_align_in_bits (type)
      register tree type;
 {
@@ -1852,21 +1882,21 @@ simple_type_align_in_bits (type)
    constant, or else return BITS_PER_WORD if the type actually turns out
    to be an ERROR_MARK node.  */
 
-static inline unsigned
+static inline unsigned HOST_WIDE_INT
 simple_type_size_in_bits (type)
      register tree type;
 {
+  tree type_size_tree;
+
   if (TREE_CODE (type) == ERROR_MARK)
     return BITS_PER_WORD;
-  else
-    {
-      register tree type_size_tree = TYPE_SIZE (type);
-
-      if (TREE_CODE (type_size_tree) != INTEGER_CST)
-       return TYPE_ALIGN (type);
+  type_size_tree = TYPE_SIZE (type);
 
-      return (unsigned) TREE_INT_CST_LOW (type_size_tree);
-    }
+  if (type_size_tree == NULL_TREE)
+    return 0;
+  if (! host_integerp (type_size_tree, 1))
+    return TYPE_ALIGN (type);
+  return tree_low_cst (type_size_tree, 1);
 }
 
 /* Given a pointer to what is assumed to be a FIELD_DECL node, compute and
@@ -1876,22 +1906,21 @@ simple_type_size_in_bits (type)
    pointer to an ERROR_MARK node, or because the offset is actually variable.
    (We can't handle the latter case just yet.)  */
 
-static unsigned
+static HOST_WIDE_INT
 field_byte_offset (decl)
      register tree decl;
 {
-  register unsigned type_align_in_bytes;
-  register unsigned type_align_in_bits;
-  register unsigned type_size_in_bits;
-  register unsigned object_offset_in_align_units;
-  register unsigned object_offset_in_bits;
-  register unsigned object_offset_in_bytes;
-  register tree type;
-  register tree bitpos_tree;
-  register tree field_size_tree;
-  register unsigned bitpos_int;
-  register unsigned deepest_bitpos;
-  register unsigned field_size_in_bits;
+  unsigned int type_align_in_bytes;
+  unsigned int type_align_in_bits;
+  unsigned HOST_WIDE_INT type_size_in_bits;
+  HOST_WIDE_INT object_offset_in_align_units;
+  HOST_WIDE_INT object_offset_in_bits;
+  HOST_WIDE_INT object_offset_in_bytes;
+  tree type;
+  tree field_size_tree;
+  HOST_WIDE_INT bitpos_int;
+  HOST_WIDE_INT deepest_bitpos;
+  unsigned HOST_WIDE_INT field_size_in_bits;
 
   if (TREE_CODE (decl) == ERROR_MARK)
     return 0;
@@ -1900,24 +1929,25 @@ field_byte_offset (decl)
     abort ();
 
   type = field_type (decl);
-
-  bitpos_tree = DECL_FIELD_BITPOS (decl);
   field_size_tree = DECL_SIZE (decl);
 
+  /* The size could be unspecified if there was an error, or for
+     a flexible array member.  */
+  if (! field_size_tree)
+    field_size_tree = bitsize_zero_node;
+
   /* We cannot yet cope with fields whose positions or sizes are variable,
      so for now, when we see such things, we simply return 0.  Someday,
      we may be able to handle such cases, but it will be damn difficult.  */
 
-  if (TREE_CODE (bitpos_tree) != INTEGER_CST)
+  if (! host_integerp (bit_position (decl), 0)
+      || ! host_integerp (field_size_tree, 1))
     return 0;
-  bitpos_int = (unsigned) TREE_INT_CST_LOW (bitpos_tree);
 
-  if (TREE_CODE (field_size_tree) != INTEGER_CST)
-    return 0;
-  field_size_in_bits = (unsigned) TREE_INT_CST_LOW (field_size_tree);
+  bitpos_int = int_bit_position (decl);
+  field_size_in_bits = tree_low_cst (field_size_tree, 1);
 
   type_size_in_bits = simple_type_size_in_bits (type);
-
   type_align_in_bits = simple_type_align_in_bits (type);
   type_align_in_bytes = type_align_in_bits / BITS_PER_UNIT;
 
@@ -1966,8 +1996,7 @@ field_byte_offset (decl)
 
      The value we deduce is then used (by the callers of this routine) to
      generate AT_location and AT_bit_offset attributes for fields (both
-     bit-fields and, in the case of AT_location, regular fields as well).
-  */
+     bit-fields and, in the case of AT_location, regular fields as well). */
 
   /* Figure out the bit-distance from the start of the structure to the
      "deepest" bit of the bit-field.  */
@@ -1984,6 +2013,33 @@ field_byte_offset (decl)
   /* Compute the offset of the containing object in bytes.  */
   object_offset_in_bytes = object_offset_in_align_units * type_align_in_bytes;
 
+  /* The above code assumes that the field does not cross an alignment
+     boundary.  This can happen if PCC_BITFIELD_TYPE_MATTERS is not defined,
+     or if the structure is packed.  If this happens, then we get an object
+     which starts after the bitfield, which means that the bit offset is
+     negative.  Gdb fails when given negative bit offsets.  We avoid this
+     by recomputing using the first bit of the bitfield.  This will give
+     us an object which does not completely contain the bitfield, but it
+     will be aligned, and it will contain the first bit of the bitfield.
+
+     However, only do this for a BYTES_BIG_ENDIAN target.  For a
+     ! BYTES_BIG_ENDIAN target, bitpos_int + field_size_in_bits is the first
+     first bit of the bitfield.  If we recompute using bitpos_int + 1 below,
+     then we end up computing the object byte offset for the wrong word of the
+     desired bitfield, which in turn causes the field offset to be negative
+     in bit_offset_attribute.  */
+  if (BYTES_BIG_ENDIAN
+      && object_offset_in_bits > bitpos_int)
+    {
+      deepest_bitpos = bitpos_int + 1;
+      object_offset_in_bits
+       = ceiling (deepest_bitpos, type_align_in_bits) - type_size_in_bits;
+      object_offset_in_align_units = (object_offset_in_bits
+                                     / type_align_in_bits);
+      object_offset_in_bytes = (object_offset_in_align_units
+                               * type_align_in_bytes);
+    }
+
   return object_offset_in_bytes;
 }
 
@@ -2047,7 +2103,7 @@ location_attribute (rtl)
 
   if (! is_pseudo_reg (rtl)
       && (GET_CODE (rtl) != MEM || ! is_pseudo_reg (XEXP (rtl, 0))))
-    output_loc_descriptor (eliminate_regs (rtl, 0, NULL_RTX));
+    output_loc_descriptor (rtl);
 
   ASM_OUTPUT_LABEL (asm_out_file, end_label);
 }
@@ -2082,7 +2138,7 @@ data_member_location_attribute (t)
   char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
 
   if (TREE_CODE (t) == TREE_VEC)
-    object_offset_in_bytes = TREE_INT_CST_LOW (BINFO_OFFSET (t));
+    object_offset_in_bytes = tree_low_cst (BINFO_OFFSET (t), 0);
   else
     object_offset_in_bytes = field_byte_offset (t);
 
@@ -2139,12 +2195,12 @@ const_value_attribute (rtl)
           simplicity we always just output CONST_DOUBLEs using 8 bytes.  */
 
        ASM_OUTPUT_DWARF_DATA8 (asm_out_file,
-                               (unsigned HOST_WIDE_INT) CONST_DOUBLE_HIGH (rtl),
-                               (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (rtl));
+                               (unsigned int) CONST_DOUBLE_HIGH (rtl),
+                               (unsigned int) CONST_DOUBLE_LOW (rtl));
        break;
 
       case CONST_STRING:
-       ASM_OUTPUT_DWARF_STRING (asm_out_file, XSTR (rtl, 0));
+       ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, XSTR (rtl, 0));
        break;
 
       case SYMBOL_REF:
@@ -2273,7 +2329,7 @@ location_or_const_value_attribute (decl)
      shouldn't be happening.  All PARM_DECL nodes should get valid non-NULL
      DECL_INCOMING_RTL values, but integrate.c doesn't currently generate
      these values for inlined instances of inline function parameters, so
-     when we see such cases, we are just SOL (shit-out-of-luck) for the time
+     when we see such cases, we are just out-of-luck for the time
      being (until integrate.c gets fixed).
   */
 
@@ -2294,6 +2350,7 @@ location_or_const_value_attribute (decl)
          rtl = DECL_INCOMING_RTL (decl);
        else if (! BYTES_BIG_ENDIAN)
          if (TREE_CODE (declared_type) == INTEGER_TYPE)
+           /* NMS WTF? */
            if (TYPE_SIZE (declared_type) <= TYPE_SIZE (passed_type))
              rtl = DECL_INCOMING_RTL (decl);
       }
@@ -2301,8 +2358,19 @@ location_or_const_value_attribute (decl)
   if (rtl == NULL_RTX)
     return;
 
+  rtl = eliminate_regs (rtl, 0, NULL_RTX);
+#ifdef LEAF_REG_REMAP
+  if (current_function_uses_only_leaf_regs)
+    leaf_renumber_regs_insn (rtl);
+#endif
+
   switch (GET_CODE (rtl))
     {
+    case ADDRESSOF:
+      /* The address of a variable that was optimized away; don't emit
+        anything.  */
+      break;
+
     case CONST_INT:
     case CONST_DOUBLE:
     case CONST_STRING:
@@ -2319,6 +2387,15 @@ location_or_const_value_attribute (decl)
       location_attribute (rtl);
       break;
 
+    case CONCAT:
+      /* ??? CONCAT is used for complex variables, which may have the real
+        part stored in one place and the imag part stored somewhere else.
+        DWARF1 has no way to describe a variable that lives in two different
+        places, so we just describe where the first part lives, and hope that
+        the second part is stored after it.  */
+      location_attribute (XEXP (rtl, 0));
+      break;
+
     default:
       abort ();                /* Should never happen.  */
     }
@@ -2329,12 +2406,12 @@ location_or_const_value_attribute (decl)
 
 static inline void
 name_attribute (name_string)
-     register char *name_string;
+     register const char *name_string;
 {
   if (name_string && *name_string)
     {
       ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_name);
-      ASM_OUTPUT_DWARF_STRING (asm_out_file, name_string);
+      ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, name_string);
     }
 }
 
@@ -2452,29 +2529,26 @@ subscript_data_attribute (type)
          register tree upper = TYPE_MAX_VALUE (domain);
 
          /* Handle only fundamental types as index types for now.  */
-
          if (! type_is_fundamental (domain))
            abort ();
 
          /* Output the representation format byte for this dimension.  */
-
          ASM_OUTPUT_DWARF_FMT_BYTE (asm_out_file,
-                                 FMT_CODE (1,
-                                           TREE_CODE (lower) == INTEGER_CST,
-                                           TREE_CODE (upper) == INTEGER_CST));
+                 FMT_CODE (1, TREE_CODE (lower) == INTEGER_CST,
+                           upper && TREE_CODE (upper) == INTEGER_CST));
 
          /* Output the index type for this dimension.  */
-
          ASM_OUTPUT_DWARF_FUND_TYPE (asm_out_file,
                                      fundamental_type_code (domain));
 
          /* Output the representation for the lower bound.  */
-
          output_bound_representation (lower, dimension_number, 'l');
 
          /* Output the representation for the upper bound.  */
-
-         output_bound_representation (upper, dimension_number, 'u');
+         if (upper)
+           output_bound_representation (upper, dimension_number, 'u');
+         else
+           ASM_OUTPUT_DWARF_DATA2 (asm_out_file, 0);
        }
       else
        {
@@ -2530,6 +2604,7 @@ byte_size_attribute (tree_node)
       case RECORD_TYPE:
       case UNION_TYPE:
       case QUAL_UNION_TYPE:
+      case ARRAY_TYPE:
        size = int_size_in_bytes (tree_node);
        break;
 
@@ -2576,24 +2651,27 @@ static inline void
 bit_offset_attribute (decl)
     register tree decl;
 {
-  register unsigned object_offset_in_bytes = field_byte_offset (decl);
-  register tree type = DECL_BIT_FIELD_TYPE (decl);
-  register tree bitpos_tree = DECL_FIELD_BITPOS (decl);
-  register unsigned bitpos_int;
-  register unsigned highest_order_object_bit_offset;
-  register unsigned highest_order_field_bit_offset;
-  register unsigned bit_offset;
+  HOST_WIDE_INT object_offset_in_bytes = field_byte_offset (decl);
+  tree type = DECL_BIT_FIELD_TYPE (decl);
+  HOST_WIDE_INT bitpos_int;
+  HOST_WIDE_INT highest_order_object_bit_offset;
+  HOST_WIDE_INT highest_order_field_bit_offset;
+  HOST_WIDE_INT bit_offset;
 
-  assert (TREE_CODE (decl) == FIELD_DECL);     /* Must be a field.  */
-  assert (type);                               /* Must be a bit field.  */
+  /* Must be a bit field.  */
+  if (!type
+      || TREE_CODE (decl) != FIELD_DECL)
+    abort ();
 
-  /* We can't yet handle bit-fields whose offsets are variable, so if we
-     encounter such things, just return without generating any attribute
-     whatsoever.  */
+  /* We can't yet handle bit-fields whose offsets or sizes are variable, so
+     if we encounter such things, just return without generating any
+     attribute whatsoever.  */
 
-  if (TREE_CODE (bitpos_tree) != INTEGER_CST)
+  if (! host_integerp (bit_position (decl), 0)
+      || ! host_integerp (DECL_SIZE (decl), 1))
     return;
-  bitpos_int = (unsigned) TREE_INT_CST_LOW (bitpos_tree);
+
+  bitpos_int = int_bit_position (decl);
 
   /* Note that the bit offset is always the distance (in bits) from the
      highest-order bit of the "containing object" to the highest-order
@@ -2606,9 +2684,7 @@ bit_offset_attribute (decl)
 
   if (! BYTES_BIG_ENDIAN)
     {
-      highest_order_field_bit_offset
-       += (unsigned) TREE_INT_CST_LOW (DECL_SIZE (decl));
-
+      highest_order_field_bit_offset += tree_low_cst (DECL_SIZE (decl), 1);
       highest_order_object_bit_offset += simple_type_size_in_bits (type);
     }
 
@@ -2628,12 +2704,17 @@ static inline void
 bit_size_attribute (decl)
     register tree decl;
 {
-  assert (TREE_CODE (decl) == FIELD_DECL);     /* Must be a field.  */
-  assert (DECL_BIT_FIELD_TYPE (decl));         /* Must be a bit field.  */
+  /* Must be a field and a bit field.  */
+  if (TREE_CODE (decl) != FIELD_DECL
+      || ! DECL_BIT_FIELD_TYPE (decl))
+    abort ();
 
-  ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_bit_size);
-  ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
-                         (unsigned) TREE_INT_CST_LOW (DECL_SIZE (decl)));
+  if (host_integerp (DECL_SIZE (decl), 1))
+    {
+      ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_bit_size);
+      ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
+                             tree_low_cst (DECL_SIZE (decl), 1));
+    }
 }
 
 /* The following routine outputs the `element_list' attribute for enumeration
@@ -2669,7 +2750,7 @@ element_list_attribute (element)
 
 static inline void
 stmt_list_attribute (label)
-    register char *label;
+    register const char *label;
 {
   ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_stmt_list);
   /* Don't use ASM_OUTPUT_DWARF_DATA4 here.  */
@@ -2681,7 +2762,7 @@ stmt_list_attribute (label)
 
 static inline void
 low_pc_attribute (asm_low_label)
-     register char *asm_low_label;
+     register const char *asm_low_label;
 {
   ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_low_pc);
   ASM_OUTPUT_DWARF_ADDR (asm_out_file, asm_low_label);
@@ -2692,7 +2773,7 @@ low_pc_attribute (asm_low_label)
 
 static inline void
 high_pc_attribute (asm_high_label)
-    register char *asm_high_label;
+    register const char *asm_high_label;
 {
   ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_high_pc);
   ASM_OUTPUT_DWARF_ADDR (asm_out_file, asm_high_label);
@@ -2702,7 +2783,7 @@ high_pc_attribute (asm_high_label)
 
 static inline void
 body_begin_attribute (asm_begin_label)
-     register char *asm_begin_label;
+     register const char *asm_begin_label;
 {
   ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_body_begin);
   ASM_OUTPUT_DWARF_ADDR (asm_out_file, asm_begin_label);
@@ -2712,7 +2793,7 @@ body_begin_attribute (asm_begin_label)
 
 static inline void
 body_end_attribute (asm_end_label)
-     register char *asm_end_label;
+     register const char *asm_end_label;
 {
   ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_body_end);
   ASM_OUTPUT_DWARF_ADDR (asm_out_file, asm_end_label);
@@ -2745,6 +2826,7 @@ member_attribute (context)
     }
 }
 
+#if 0
 static inline void
 string_length_attribute (upper_bound)
      register tree upper_bound;
@@ -2760,18 +2842,19 @@ string_length_attribute (upper_bound)
   output_bound_representation (upper_bound, 0, 'u');
   ASM_OUTPUT_LABEL (asm_out_file, end_label);
 }
+#endif
 
 static inline void
 comp_dir_attribute (dirname)
-     register char *dirname;
+     register const char *dirname;
 {
   ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_comp_dir);
-  ASM_OUTPUT_DWARF_STRING (asm_out_file, dirname);
+  ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, dirname);
 }
 
 static inline void
 sf_names_attribute (sf_names_start_label)
-     register char *sf_names_start_label;
+     register const char *sf_names_start_label;
 {
   ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_sf_names);
   /* Don't use ASM_OUTPUT_DWARF_DATA4 here.  */
@@ -2780,7 +2863,7 @@ sf_names_attribute (sf_names_start_label)
 
 static inline void
 src_info_attribute (src_info_start_label)
-     register char *src_info_start_label;
+     register const char *src_info_start_label;
 {
   ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_src_info);
   /* Don't use ASM_OUTPUT_DWARF_DATA4 here.  */
@@ -2789,7 +2872,7 @@ src_info_attribute (src_info_start_label)
 
 static inline void
 mac_info_attribute (mac_info_start_label)
-     register char *mac_info_start_label;
+     register const char *mac_info_start_label;
 {
   ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_mac_info);
   /* Don't use ASM_OUTPUT_DWARF_DATA4 here.  */
@@ -2804,16 +2887,16 @@ prototyped_attribute (func_type)
       && (TYPE_ARG_TYPES (func_type) != NULL))
     {
       ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_prototyped);
-      ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
+      ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
     }
 }
 
 static inline void
 producer_attribute (producer)
-     register char *producer;
+     register const char *producer;
 {
   ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_producer);
-  ASM_OUTPUT_DWARF_STRING (asm_out_file, producer);
+  ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, producer);
 }
 
 static inline void
@@ -2823,7 +2906,7 @@ inline_attribute (decl)
   if (DECL_INLINE (decl))
     {
       ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_inline);
-      ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
+      ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
     }
 }
 
@@ -2886,7 +2969,7 @@ pure_or_virtual_attribute (func_decl)
       else
 #endif
         ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_virtual);
-      ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
+      ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
     }
 }
 
@@ -2913,7 +2996,7 @@ name_and_src_coords_attributes (decl)
        /* This is annoying, but we have to pop out of the .debug section
           for a moment while we call `lookup_filename' because calling it
           may cause a temporary switch into the .debug_sfnames section and
-          most svr4 assemblers are not smart enough be be able to nest
+          most svr4 assemblers are not smart enough to be able to nest
           section switches to any depth greater than one.  Note that we
           also can't skirt this issue by delaying all output to the
           .debug_sfnames section unit the end of compilation because that
@@ -2942,29 +3025,38 @@ type_attribute (type, decl_const, decl_volatile)
   register enum tree_code code = TREE_CODE (type);
   register int root_type_modified;
 
-  if (TREE_CODE (type) == ERROR_MARK)
+  if (code == ERROR_MARK)
     return;
 
   /* Handle a special case.  For functions whose return type is void,
      we generate *no* type attribute.  (Note that no object may have
      type `void', so this only applies to function return types.  */
 
-  if (TREE_CODE (type) == VOID_TYPE)
+  if (code == VOID_TYPE)
     return;
 
+  /* If this is a subtype, find the underlying type.  Eventually,
+     this should write out the appropriate subtype info.  */
+  while ((code == INTEGER_TYPE || code == REAL_TYPE)
+        && TREE_TYPE (type) != 0)
+    type = TREE_TYPE (type), code = TREE_CODE (type);
+
   root_type_modified = (code == POINTER_TYPE || code == REFERENCE_TYPE
                        || decl_const || decl_volatile
                        || TYPE_READONLY (type) || TYPE_VOLATILE (type));
 
   if (type_is_fundamental (root_type (type)))
-    if (root_type_modified)
+    {
+      if (root_type_modified)
        mod_fund_type_attribute (type, decl_const, decl_volatile);
-    else
+      else
        fund_type_attribute (fundamental_type_code (type));
+    }
   else
-    if (root_type_modified)
+    {
+      if (root_type_modified)
        mod_u_d_type_attribute (type, decl_const, decl_volatile);
-    else
+      else
        /* We have to get the type_main_variant here (and pass that to the
           `user_def_type_attribute' routine) because the ..._TYPE node we
           have might simply be a *copy* of some original type node (where
@@ -2975,17 +3067,18 @@ type_attribute (type, decl_const, decl_volatile)
           only creates labels for DIEs representing *main variants*, and it
           never even knows about non-main-variants.)  */
        user_def_type_attribute (type_main_variant (type));
+    }
 }
 
 /* Given a tree pointer to a struct, class, union, or enum type node, return
    a pointer to the (string) tag name for the given type, or zero if the
    type was declared without a tag.  */
 
-static char *
+static const char *
 type_tag (type)
      register tree type;
 {
-  register char *name = 0;
+  register const char *name = 0;
 
   if (TYPE_NAME (type) != 0)
     {
@@ -2998,8 +3091,8 @@ type_tag (type)
       /* The g++ front end makes the TYPE_NAME of *each* tagged type point to 
          a TYPE_DECL node, regardless of whether or not a `typedef' was
          involved.  */
-      else
-       if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
+      else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
+              && ! DECL_IGNORED_P (TYPE_NAME (type)))
          t = DECL_NAME (TYPE_NAME (type));
 
       /* Now get the name as a string, or invent one.  */
@@ -3050,12 +3143,12 @@ member_declared_type (member)
    This may be different from the DECL_NAME name used
    in the source file.  */
 
-static char *
+static const char *
 function_start_label (decl)
     register tree decl;
 {
   rtx x;
-  char *fnname;
+  const char *fnname;
 
   x = DECL_RTL (decl);
   if (GET_CODE (x) != MEM)
@@ -3152,7 +3245,8 @@ output_inlined_enumeration_type_die (arg)
 
   ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_enumeration_type);
   sibling_attribute ();
-  assert (TREE_ASM_WRITTEN (type));
+  if (!TREE_ASM_WRITTEN (type))
+    abort ();
   abstract_origin_attribute (type);
 }
 
@@ -3166,7 +3260,8 @@ output_inlined_structure_type_die (arg)
 
   ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_structure_type);
   sibling_attribute ();
-  assert (TREE_ASM_WRITTEN (type));
+  if (!TREE_ASM_WRITTEN (type))
+    abort ();
   abstract_origin_attribute (type);
 }
 
@@ -3180,7 +3275,8 @@ output_inlined_union_type_die (arg)
 
   ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_union_type);
   sibling_attribute ();
-  assert (TREE_ASM_WRITTEN (type));
+  if (!TREE_ASM_WRITTEN (type))
+    abort ();
   abstract_origin_attribute (type);
 }
 
@@ -3204,7 +3300,7 @@ output_enumeration_type_die (arg)
      given enum type is incomplete, do not generate the AT_byte_size
      attribute or the AT_element_list attribute.  */
 
-  if (TYPE_SIZE (type))
+  if (COMPLETE_TYPE_P (type))
     {
       byte_size_attribute (type);
       element_list_attribute (TYPE_FIELDS (type));
@@ -3293,17 +3389,21 @@ output_global_subroutine_die (arg)
     equate_decl_number_to_die_number (decl);
   else
     {
-      if (! DECL_EXTERNAL (decl))
+      if (! DECL_EXTERNAL (decl) && ! in_class
+         && decl == current_function_decl)
        {
          char label[MAX_ARTIFICIAL_LABEL_BYTES];
 
          low_pc_attribute (function_start_label (decl));
          sprintf (label, FUNC_END_LABEL_FMT, current_funcdef_number);
          high_pc_attribute (label);
-         sprintf (label, BODY_BEGIN_LABEL_FMT, current_funcdef_number);
-         body_begin_attribute (label);
-         sprintf (label, BODY_END_LABEL_FMT, current_funcdef_number);
-         body_end_attribute (label);
+         if (use_gnu_debug_info_extensions)
+           {
+             sprintf (label, BODY_BEGIN_LABEL_FMT, current_funcdef_number);
+             body_begin_attribute (label);
+             sprintf (label, BODY_END_LABEL_FMT, current_funcdef_number);
+             body_end_attribute (label);
+           }
        }
     }
 }
@@ -3333,7 +3433,8 @@ output_global_variable_die (arg)
     equate_decl_number_to_die_number (decl);
   else
     {
-      if (!DECL_EXTERNAL (decl))
+      if (! DECL_EXTERNAL (decl) && ! in_class
+         && current_function_decl == decl_function_context (decl))
        location_or_const_value_attribute (decl);
     }
 }
@@ -3357,7 +3458,12 @@ output_label_die (arg)
     {
       register rtx insn = DECL_RTL (decl);
 
-      if (GET_CODE (insn) == CODE_LABEL)
+      /* Deleted labels are programmer specified labels which have been
+        eliminated because of various optimisations.  We still emit them
+        here so that it is possible to put breakpoints on them.  */
+      if (GET_CODE (insn) == CODE_LABEL
+         || ((GET_CODE (insn) == NOTE
+              && NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL)))
        {
          char label[MAX_ARTIFICIAL_LABEL_BYTES];
 
@@ -3370,8 +3476,7 @@ output_label_die (arg)
          if (INSN_DELETED_P (insn))
            abort ();   /* Should never happen.  */
 
-         sprintf (label, INSN_LABEL_FMT, current_funcdef_number,
-                                         (unsigned) INSN_UID (insn));
+         ASM_GENERATE_INTERNAL_LABEL (label, "L", CODE_LABEL_NUMBER (insn));
          low_pc_attribute (label);
        }
     }
@@ -3391,9 +3496,9 @@ output_lexical_block_die (arg)
       char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
       char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
 
-      sprintf (begin_label, BLOCK_BEGIN_LABEL_FMT, next_block_number);
+      sprintf (begin_label, BLOCK_BEGIN_LABEL_FMT, BLOCK_NUMBER (stmt));
       low_pc_attribute (begin_label);
-      sprintf (end_label, BLOCK_END_LABEL_FMT, next_block_number);
+      sprintf (end_label, BLOCK_END_LABEL_FMT, BLOCK_NUMBER (stmt));
       high_pc_attribute (end_label);
     }
 }
@@ -3413,9 +3518,9 @@ output_inlined_subroutine_die (arg)
       char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
       char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
 
-      sprintf (begin_label, BLOCK_BEGIN_LABEL_FMT, next_block_number);
+      sprintf (begin_label, BLOCK_BEGIN_LABEL_FMT, BLOCK_NUMBER (stmt));
       low_pc_attribute (begin_label);
-      sprintf (end_label, BLOCK_END_LABEL_FMT, next_block_number);
+      sprintf (end_label, BLOCK_END_LABEL_FMT, BLOCK_NUMBER (stmt));
       high_pc_attribute (end_label);
     }
 }
@@ -3521,7 +3626,7 @@ static void
 output_compile_unit_die (arg)
      register void *arg;
 {
-  register char *main_input_filename = arg;
+  register const char *main_input_filename = arg;
 
   ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_compile_unit);
   sibling_attribute ();
@@ -3541,6 +3646,10 @@ output_compile_unit_die (arg)
     language_attribute (LANG_ADA83);
   else if (strcmp (language_string, "GNU F77") == 0)
     language_attribute (LANG_FORTRAN77);
+  else if (strcmp (language_string, "GNU Pascal") == 0)
+    language_attribute (LANG_PASCAL83);
+  else if (strcmp (language_string, "GNU Java") == 0)
+    language_attribute (LANG_JAVA);
   else if (flag_traditional)
     language_attribute (LANG_C);
   else
@@ -3552,12 +3661,12 @@ output_compile_unit_die (arg)
   last_filename = xstrdup (main_input_filename);
 
   {
-    char *wd = getpwd ();
+    const char *wd = getpwd ();
     if (wd)
       comp_dir_attribute (wd);
   }
 
-  if (debug_info_level >= DINFO_LEVEL_NORMAL)
+  if (debug_info_level >= DINFO_LEVEL_NORMAL && use_gnu_debug_info_extensions)
     {
       sf_names_attribute (SFNAMES_BEGIN_LABEL);
       src_info_attribute (SRCINFO_BEGIN_LABEL);
@@ -3574,11 +3683,10 @@ output_string_type_die (arg)
 
   ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_string_type);
   sibling_attribute ();
+  equate_type_number_to_die_number (type);
   member_attribute (TYPE_CONTEXT (type));
-
-  /* Fudge the string length attribute for now.  */
-
-  string_length_attribute (TYPE_MAX_VALUE (TYPE_DOMAIN (type)));
+  /* this is a fixed length string */
+  byte_size_attribute (type);
 }
 
 static void
@@ -3594,17 +3702,17 @@ output_inheritance_die (arg)
   if (TREE_VIA_VIRTUAL (binfo))
     {
       ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_virtual);
-      ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
+      ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
     }
   if (TREE_VIA_PUBLIC (binfo))
     {
       ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_public);
-      ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
+      ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
     }
   else if (TREE_VIA_PROTECTED (binfo))
     {
       ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_protected);
-      ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
+      ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
     }
 }  
 
@@ -3626,7 +3734,7 @@ output_structure_type_die (arg)
      of members (since we don't have any idea what they might be for an
      incomplete type). */
 
-  if (TYPE_SIZE (type))
+  if (COMPLETE_TYPE_P (type))
     {
       dienum_push ();
       byte_size_attribute (type);
@@ -3672,10 +3780,13 @@ output_local_subroutine_die (arg)
          low_pc_attribute (function_start_label (decl));
          sprintf (label, FUNC_END_LABEL_FMT, current_funcdef_number);
          high_pc_attribute (label);
-         sprintf (label, BODY_BEGIN_LABEL_FMT, current_funcdef_number);
-         body_begin_attribute (label);
-         sprintf (label, BODY_END_LABEL_FMT, current_funcdef_number);
-         body_end_attribute (label);
+         if (use_gnu_debug_info_extensions)
+           {
+             sprintf (label, BODY_BEGIN_LABEL_FMT, current_funcdef_number);
+             body_begin_attribute (label);
+             sprintf (label, BODY_END_LABEL_FMT, current_funcdef_number);
+             body_end_attribute (label);
+           }
        }
     }
 }
@@ -3736,7 +3847,7 @@ output_union_type_die (arg)
      of members (since we don't have any idea what they might be for an
      incomplete type). */
 
-  if (TYPE_SIZE (type))
+  if (COMPLETE_TYPE_P (type))
     {
       dienum_push ();
       byte_size_attribute (type);
@@ -3774,7 +3885,7 @@ output_unspecified_parameters_die (arg)
 
 static void
 output_padded_null_die (arg)
-     register void *arg;
+     register void *arg ATTRIBUTE_UNUSED;
 {
   ASM_OUTPUT_ALIGN (asm_out_file, 2);  /* 2**2 == 4 */
 }
@@ -3789,7 +3900,7 @@ output_padded_null_die (arg)
 
 static void
 output_die (die_specific_output_function, param)
-     register void (*die_specific_output_function)();
+     register void (*die_specific_output_function) PARAMS ((void *));
      register void *param;
 {
   char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
@@ -3859,6 +3970,12 @@ output_formal_types (function_or_method_type)
   register tree formal_type = NULL;
   register tree first_parm_type = TYPE_ARG_TYPES (function_or_method_type);
 
+  /* Set TREE_ASM_WRITTEN while processing the parameters, lest we
+     get bogus recursion when outputting tagged types local to a
+     function declaration.  */
+  int save_asm_written = TREE_ASM_WRITTEN (function_or_method_type);
+  TREE_ASM_WRITTEN (function_or_method_type) = 1;
+
   /* In the case where we are generating a formal types list for a C++
      non-static member function type, skip over the first thing on the
      TYPE_ARG_TYPES list because it only represents the type of the
@@ -3904,6 +4021,8 @@ output_formal_types (function_or_method_type)
 
       output_type (formal_type, function_or_method_type);
     }
+
+  TREE_ASM_WRITTEN (function_or_method_type) = save_asm_written;
 }
 \f
 /* Remember a type in the pending_types_list.  */
@@ -3981,7 +4100,12 @@ type_ok_for_scope (type, scope)
      (for C and C++ anyway) will be array types and function types.  */
 
   return is_tagged_type (type)
-        ? (TYPE_CONTEXT (type) == scope)
+        ? (TYPE_CONTEXT (type) == scope
+           /* Ignore namespaces for the moment.  */
+           || (scope == NULL_TREE
+               && TREE_CODE (TYPE_CONTEXT (type)) == NAMESPACE_DECL)
+           || (scope == NULL_TREE && is_tagged_type (TYPE_CONTEXT (type))
+               && TREE_ASM_WRITTEN (TYPE_CONTEXT (type))))
         : (scope == NULL_TREE || ! is_tagged_type (scope));
 }
 
@@ -4032,6 +4156,40 @@ output_pending_types_for_scope (containing_scope)
     }
 }
 
+/* Remember a type in the incomplete_types_list.  */
+
+static void
+add_incomplete_type (type)
+     tree type;
+{
+  if (incomplete_types == incomplete_types_allocated)
+    {
+      incomplete_types_allocated += INCOMPLETE_TYPES_INCREMENT;
+      incomplete_types_list
+       = (tree *) xrealloc (incomplete_types_list,
+                            sizeof (tree) * incomplete_types_allocated);
+    }
+
+  incomplete_types_list[incomplete_types++] = type;
+}
+
+/* Walk through the list of incomplete types again, trying once more to
+   emit full debugging info for them.  */
+
+static void
+retry_incomplete_types ()
+{
+  register tree type;
+
+  finalizing = 1;
+  while (incomplete_types)
+    {
+      --incomplete_types;
+      type = incomplete_types_list[incomplete_types];
+      output_type (type, NULL_TREE);
+    }
+}
+
 static void
 output_type (type, containing_scope)
      register tree type;
@@ -4041,13 +4199,39 @@ output_type (type, containing_scope)
     return;
 
   /* We are going to output a DIE to represent the unqualified version of
-     of this type (i.e. without any const or volatile qualifiers) so get
+     this type (i.e. without any const or volatile qualifiers) so get
      the main variant (i.e. the unqualified version) of this type now.  */
 
   type = type_main_variant (type);
 
   if (TREE_ASM_WRITTEN (type))
-    return;
+    {
+      if (finalizing && AGGREGATE_TYPE_P (type))
+       {
+         register tree member;
+
+         /* Some of our nested types might not have been defined when we
+            were written out before; force them out now.  */
+
+         for (member = TYPE_FIELDS (type); member;
+              member = TREE_CHAIN (member))
+           if (TREE_CODE (member) == TYPE_DECL
+               && ! TREE_ASM_WRITTEN (TREE_TYPE (member)))
+             output_type (TREE_TYPE (member), containing_scope);
+       }
+      return;
+    }
+
+  /* If this is a nested type whose containing class hasn't been
+     written out yet, writing it out will cover this one, too.  */
+
+  if (TYPE_CONTEXT (type)
+      && TYPE_P (TYPE_CONTEXT (type))
+      && ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
+    {
+      output_type (TYPE_CONTEXT (type), containing_scope);
+      return;
+    }
 
   /* Don't generate any DIEs for this type now unless it is OK to do so
      (based upon what `type_ok_for_scope' tells us).  */
@@ -4063,8 +4247,15 @@ output_type (type, containing_scope)
       case ERROR_MARK:
        break;
 
+      case VECTOR_TYPE:
+       output_type (TYPE_DEBUG_REPRESENTATION_TYPE (type), containing_scope);
+       break;
+
       case POINTER_TYPE:
       case REFERENCE_TYPE:
+       /* Prevent infinite recursion in cases where this is a recursive
+          type.  Recursive types are possible in Ada.  */
+       TREE_ASM_WRITTEN (type) = 1;
        /* For these types, all that is required is that we output a DIE
           (or a set of DIEs) to represent the "basis" type.  */
        output_type (TREE_TYPE (type), containing_scope);
@@ -4159,14 +4350,19 @@ output_type (type, containing_scope)
           time, we will certainly know as much about each file-scope tagged
           type as we are ever going to know, so at that point in time, we
           can safely generate correct Dwarf descriptions for these file-
-          scope tagged types.
+          scope tagged types.  */
 
-          This loses for C++ nested types that are defined after their
-          containing class, but I don't see a good way to fix it.  I doubt
-          many people will be using DWARF 1 for C++ in any case.  */
-
-       if (TYPE_SIZE (type) == 0 && TYPE_CONTEXT (type) == NULL && !finalizing)
-         return;       /* EARLY EXIT!  Avoid setting TREE_ASM_WRITTEN.  */
+       if (!COMPLETE_TYPE_P (type)
+           && (TYPE_CONTEXT (type) == NULL
+               || AGGREGATE_TYPE_P (TYPE_CONTEXT (type))
+               || TREE_CODE (TYPE_CONTEXT (type)) == NAMESPACE_DECL)
+           && !finalizing)
+         {
+           /* We don't need to do this for function-local types.  */
+           if (! decl_function_context (TYPE_STUB_DECL (type)))
+             add_incomplete_type (type);
+           return;     /* EARLY EXIT!  Avoid setting TREE_ASM_WRITTEN.  */
+         }
 
        /* Prevent infinite recursion in cases where the type of some
           member of this type is expressed in terms of this type itself.  */
@@ -4211,7 +4407,7 @@ output_type (type, containing_scope)
           appropriate (containing) type.
        */
 
-       if (TYPE_SIZE (type))
+       if (COMPLETE_TYPE_P (type))
          {
            /* First output info about the base classes.  */
            if (TYPE_BINFO (type) && TYPE_BINFO_BASETYPES (type))
@@ -4221,9 +4417,15 @@ output_type (type, containing_scope)
                register int i;
 
                for (i = 0; i < n_bases; i++)
-                 output_die (output_inheritance_die, TREE_VEC_ELT (bases, i));
+                 {
+                   tree binfo = TREE_VEC_ELT (bases, i);
+                   output_type (BINFO_TYPE (binfo), containing_scope);
+                   output_die (output_inheritance_die, binfo);
+                 }
              }
 
+           ++in_class;
+
            {
              register tree normal_member;
 
@@ -4246,6 +4448,8 @@ output_type (type, containing_scope)
                output_decl (func_member, type);
            }
 
+           --in_class;
+
            /* RECORD_TYPEs, UNION_TYPEs, and QUAL_UNION_TYPEs are themselves
               scopes (at least in C++) so we must now output any nested
               pending types which are local just to this type.  */
@@ -4283,13 +4487,15 @@ output_tagged_type_instantiation (type)
     return;
 
   /* We are going to output a DIE to represent the unqualified version of
-     of this type (i.e. without any const or volatile qualifiers) so make
+     this type (i.e. without any const or volatile qualifiers) so make
      sure that we have the main variant (i.e. the unqualified version) of
      this type now.  */
 
-  assert (type == type_main_variant (type));
+  if (type != type_main_variant (type))
+    abort ();
 
-  assert (TREE_ASM_WRITTEN (type));
+  if (!TREE_ASM_WRITTEN (type))
+    abort ();
 
   switch (TREE_CODE (type))
     {
@@ -4328,7 +4534,8 @@ output_block (stmt, depth)
 
   /* Ignore blocks never really used to make RTL.  */
 
-  if (! stmt || ! TREE_USED (stmt))
+  if (! stmt || ! TREE_USED (stmt)
+      || (!TREE_ASM_WRITTEN (stmt) && !BLOCK_ABSTRACT (stmt)))
     return;
 
   /* Determine the "ultimate origin" of this block.  This block may be an
@@ -4420,9 +4627,6 @@ output_decls_for_scope (stmt, depth)
   if (! stmt || ! TREE_USED (stmt))
     return;
 
-  if (! BLOCK_ABSTRACT (stmt) && depth > 0)
-    next_block_number++;
-
   /* Output the DIEs to represent all of the data objects, functions,
      typedefs, and tagged types declared directly within this block
      but not within any nested sub-blocks.  */
@@ -4449,6 +4653,24 @@ output_decls_for_scope (stmt, depth)
   }
 }
 
+/* Is this a typedef we can avoid emitting?  */
+
+inline static int
+is_redundant_typedef (decl)
+     register tree decl;
+{
+  if (TYPE_DECL_IS_STUB (decl))
+    return 1;
+  if (DECL_ARTIFICIAL (decl)
+      && DECL_CONTEXT (decl)
+      && is_tagged_type (DECL_CONTEXT (decl))
+      && TREE_CODE (TYPE_NAME (DECL_CONTEXT (decl))) == TYPE_DECL
+      && DECL_NAME (decl) == DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))))
+    /* Also ignore the artificial member typedef for the class name.  */
+    return 1;
+  return 0;
+}
+
 /* Output Dwarf .debug information for a decl described by DECL.  */
 
 static void
@@ -4476,13 +4698,9 @@ output_decl (decl, containing_scope)
              && (TREE_CODE (TYPE_FIELDS (TREE_TYPE (decl))) == ERROR_MARK))))
     return;
   
-  /* If this ..._DECL node is marked to be ignored, then ignore it.
-     But don't ignore a function definition, since that would screw
-     up our count of blocks, and that it turn will completely screw up the
-     the labels we will reference in subsequent AT_low_pc and AT_high_pc
-     attributes (for subsequent blocks).  */
+  /* If this ..._DECL node is marked to be ignored, then ignore it.  */
 
-  if (DECL_IGNORED_P (decl) && TREE_CODE (decl) != FUNCTION_DECL)
+  if (DECL_IGNORED_P (decl))
     return;
 
   switch (TREE_CODE (decl))
@@ -4509,6 +4727,20 @@ output_decl (decl, containing_scope)
 
       output_type (TREE_TYPE (TREE_TYPE (decl)), containing_scope);
 
+      {
+       /* And its containing type.  */
+       register tree origin = decl_class_context (decl);
+       if (origin)
+         output_type (origin, containing_scope);
+      }
+
+      /* If we're emitting an out-of-line copy of an inline function,
+        set up to refer to the abstract instance emitted from
+        note_deferral_of_defined_inline_function.  */
+      if (DECL_INLINE (decl) && ! DECL_ABSTRACT (decl)
+         && ! (containing_scope && TYPE_P (containing_scope)))
+       set_decl_origin_self (decl);
+
       /* If the following DIE will represent a function definition for a
         function with "extern" linkage, output a special "pubnames" DIE
         label just ahead of the actual DIE.  A reference to this label
@@ -4545,7 +4777,7 @@ output_decl (decl, containing_scope)
         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 (decl != current_function_decl || in_class)
        output_formal_types (TREE_TYPE (decl));
       else
        {
@@ -4635,45 +4867,45 @@ output_decl (decl, containing_scope)
                 output_die (output_unspecified_parameters_die, decl);
               }
          }
-       }
-
-      /* Output Dwarf info for all of the stuff within the body of the
-        function (if it has one - it may be just a declaration).  */
 
-      {
-       register tree outer_scope = DECL_INITIAL (decl);
+         /* Output Dwarf info for all of the stuff within the body of the
+            function (if it has one - it may be just a declaration).  */
 
-       if (outer_scope && TREE_CODE (outer_scope) != ERROR_MARK)
          {
-           /* Note that here, `outer_scope' is a pointer to the outermost
-              BLOCK node created to represent a function.
-              This outermost BLOCK actually represents the outermost
-              binding contour for the function, i.e. the contour in which
-              the function's formal parameters and labels get declared.
-
-              Curiously, it appears that the front end doesn't actually
-              put the PARM_DECL nodes for the current function onto the
-              BLOCK_VARS list for this outer scope.  (They are strung
-              off of the DECL_ARGUMENTS list for the function instead.)
-              The BLOCK_VARS list for the `outer_scope' does provide us
-              with a list of the LABEL_DECL nodes for the function however,
-              and we output DWARF info for those here.
-
-              Just within the `outer_scope' there will be a BLOCK node
-              representing the function's outermost pair of curly braces,
-              and any blocks used for the base and member initializers of
-              a C++ constructor function.  */
-
-           output_decls_for_scope (outer_scope, 0);
-
-           /* Finally, force out any pending types which are local to the
-              outermost block of this function definition.  These will
-              all have a TYPE_CONTEXT which points to the FUNCTION_DECL
-              node itself.  */
-
-           output_pending_types_for_scope (decl);
+           register tree outer_scope = DECL_INITIAL (decl);
+
+           if (outer_scope && TREE_CODE (outer_scope) != ERROR_MARK)
+             {
+               /* Note that here, `outer_scope' is a pointer to the outermost
+                  BLOCK node created to represent a function.
+                  This outermost BLOCK actually represents the outermost
+                  binding contour for the function, i.e. the contour in which
+                  the function's formal parameters and labels get declared.
+
+                  Curiously, it appears that the front end doesn't actually
+                  put the PARM_DECL nodes for the current function onto the
+                  BLOCK_VARS list for this outer scope.  (They are strung
+                  off of the DECL_ARGUMENTS list for the function instead.)
+                  The BLOCK_VARS list for the `outer_scope' does provide us
+                  with a list of the LABEL_DECL nodes for the function however,
+                  and we output DWARF info for those here.
+
+                  Just within the `outer_scope' there will be a BLOCK node
+                  representing the function's outermost pair of curly braces,
+                  and any blocks used for the base and member initializers of
+                  a C++ constructor function.  */
+
+               output_decls_for_scope (outer_scope, 0);
+
+               /* Finally, force out any pending types which are local to the
+                  outermost block of this function definition.  These will
+                  all have a TYPE_CONTEXT which points to the FUNCTION_DECL
+                  node itself.  */
+
+               output_pending_types_for_scope (decl);
+             }
          }
-      }
+       }
 
       /* Generate a terminator for the list of stuff `owned' by this
         function.  */
@@ -4690,19 +4922,19 @@ output_decl (decl, containing_scope)
         a return type or a formal parameter type of some function.  */
 
       if (debug_info_level <= DINFO_LEVEL_TERSE)
-       if (DECL_NAME (decl) != NULL
-           || ! TYPE_USED_FOR_FUNCTION (TREE_TYPE (decl)))
+       if (! TYPE_DECL_IS_STUB (decl)
+           || (! TYPE_USED_FOR_FUNCTION (TREE_TYPE (decl)) && ! in_class))
           return;
 
-      /* In the special case of a null-named TYPE_DECL node (representing
-        the declaration of some type tag), if the given TYPE_DECL is
+      /* In the special case of a TYPE_DECL node representing
+        the declaration of some type tag, if the given TYPE_DECL is
         marked as having been instantiated from some other (original)
         TYPE_DECL node (e.g. one which was generated within the original
         definition of an inline function) we have to generate a special
         (abbreviated) TAG_structure_type, TAG_union_type, or
         TAG_enumeration-type DIE here.  */
 
-      if (! DECL_NAME (decl) && DECL_ABSTRACT_ORIGIN (decl))
+      if (TYPE_DECL_IS_STUB (decl) && DECL_ABSTRACT_ORIGIN (decl))
        {
          output_tagged_type_instantiation (TREE_TYPE (decl));
          return;
@@ -4710,13 +4942,7 @@ output_decl (decl, containing_scope)
 
       output_type (TREE_TYPE (decl), containing_scope);
 
-      /* Note that unlike the gcc front end (which generates a NULL named
-        TYPE_DECL node for each complete tagged type, each array type,
-        and each function type node created) the g++ front end generates
-        a *named* TYPE_DECL node for each tagged type node created.
-        These TYPE_DECLs have DECL_ARTIFICIAL set, so we know not to
-        generate a DW_TAG_typedef DIE for them.  */
-      if (DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl))
+      if (! is_redundant_typedef (decl))
        /* Output a DIE to represent the typedef itself.  */
        output_die (output_typedef_die, decl);
       break;
@@ -4746,6 +4972,13 @@ output_decl (decl, containing_scope)
 
       output_type (TREE_TYPE (decl), containing_scope);
 
+      {
+       /* And its containing type.  */
+       register tree origin = decl_class_context (decl);
+       if (origin)
+         output_type (origin, containing_scope);
+      }
+
       /* If the following DIE will represent a data object definition for a
         data object with "extern" linkage, output a special "pubnames" DIE
         label just ahead of the actual DIE.  A reference to this label
@@ -4766,7 +4999,7 @@ output_decl (decl, containing_scope)
         function.  */
 
       {
-        register void (*func) ();
+        register void (*func) PARAMS ((void *));
        register tree origin = decl_ultimate_origin (decl);
 
        if (origin != NULL && TREE_CODE (origin) == PARM_DECL)
@@ -4801,6 +5034,10 @@ output_decl (decl, containing_scope)
       output_die (output_formal_parameter_die, decl);
       break;
 
+    case NAMESPACE_DECL:
+      /* Ignore for now.  */
+      break;
+
     default:
       abort ();
     }
@@ -4814,20 +5051,10 @@ dwarfout_file_scope_decl (decl, set_finalizing)
   if (TREE_CODE (decl) == ERROR_MARK)
     return;
 
-  /* If this ..._DECL node is marked to be ignored, then ignore it.  We
-     gotta hope that the node in question doesn't represent a function
-     definition.  If it does, then totally ignoring it is bound to screw
-     up our count of blocks, and that it turn will completely screw up the
-     the labels we will reference in subsequent AT_low_pc and AT_high_pc
-     attributes (for subsequent blocks).  (It's too bad that BLOCK nodes
-     don't carry their own sequence numbers with them!)  */
+  /* If this ..._DECL node is marked to be ignored, then ignore it.  */
 
   if (DECL_IGNORED_P (decl))
-    {
-      if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl) != NULL)
-       abort ();
-      return;
-    }
+    return;
 
   switch (TREE_CODE (decl))
     {
@@ -4886,7 +5113,7 @@ dwarfout_file_scope_decl (decl, set_finalizing)
          ASM_OUTPUT_PUSH_SECTION (asm_out_file, PUBNAMES_SECTION);
          sprintf (label, PUB_DIE_LABEL_FMT, next_pubname_number);
          ASM_OUTPUT_DWARF_ADDR (asm_out_file, label);
-         ASM_OUTPUT_DWARF_STRING (asm_out_file,
+         ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file,
                                   IDENTIFIER_POINTER (DECL_NAME (decl)));
          ASM_OUTPUT_POP_SECTION (asm_out_file);
        }
@@ -4924,7 +5151,7 @@ dwarfout_file_scope_decl (decl, set_finalizing)
              ASM_OUTPUT_PUSH_SECTION (asm_out_file, PUBNAMES_SECTION);
              sprintf (label, PUB_DIE_LABEL_FMT, next_pubname_number);
              ASM_OUTPUT_DWARF_ADDR (asm_out_file, label);
-             ASM_OUTPUT_DWARF_STRING (asm_out_file,
+             ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file,
                                       IDENTIFIER_POINTER (DECL_NAME (decl)));
              ASM_OUTPUT_POP_SECTION (asm_out_file);
            }
@@ -4963,8 +5190,18 @@ dwarfout_file_scope_decl (decl, set_finalizing)
         really need to output these (non-fundamental) types because other
         DIEs may contain references to them.  */
 
+      /* Also ignore language dependent types here, because they are probably
+        also built-in types.  If we didn't ignore them, then we would get
+        references to undefined labels because output_type doesn't support
+        them.   So, for now, we need to ignore them to avoid assembler
+        errors.  */
+
+      /* ??? This code is different than the equivalent code in dwarf2out.c.
+        The dwarf2out.c code is probably more correct.  */
+
       if (DECL_SOURCE_LINE (decl) == 0
-         && type_is_fundamental (TREE_TYPE (decl)))
+         && (type_is_fundamental (TREE_TYPE (decl))
+             || TREE_CODE (TREE_TYPE (decl)) == LANG_TYPE))
        return;
 
       /* If we are in terse mode, don't generate any DIEs to represent
@@ -4974,7 +5211,7 @@ dwarfout_file_scope_decl (decl, set_finalizing)
         a return type or a formal parameter type of some function.  */
 
       if (debug_info_level <= DINFO_LEVEL_TERSE)
-       if (DECL_NAME (decl) != NULL
+       if (! TYPE_DECL_IS_STUB (decl)
            || ! TYPE_USED_FOR_FUNCTION (TREE_TYPE (decl)))
           return;
 
@@ -5002,9 +5239,16 @@ dwarfout_file_scope_decl (decl, set_finalizing)
 
   output_pending_types_for_scope (NULL_TREE);
 
-  /* The above call should have totally emptied the pending_types_list.  */
-
-  assert (pending_types == 0);
+  /* The above call should have totally emptied the pending_types_list
+     if this is not a nested function or class.  If this is a nested type,
+     then the remaining pending_types will be emitted when the containing type
+     is handled.  */
+  
+  if (! DECL_CONTEXT (decl))
+    {
+      if (pending_types != 0)
+       abort ();
+    }
 
   ASM_OUTPUT_POP_SECTION (asm_out_file);
 
@@ -5040,24 +5284,6 @@ dwarfout_end_block (blocknum)
   ASM_OUTPUT_LABEL (asm_out_file, label);
 }
 
-/* Output a marker (i.e. a label) at a point in the assembly code which
-   corresponds to a given source level label.  */
-
-void
-dwarfout_label (insn)
-     register rtx insn;
-{
-  if (debug_info_level >= DINFO_LEVEL_NORMAL)
-    {
-      char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
-      function_section (current_function_decl);
-      sprintf (label, INSN_LABEL_FMT, current_funcdef_number,
-                                     (unsigned) INSN_UID (insn));
-      ASM_OUTPUT_LABEL (asm_out_file, label);
-    }
-}
-
 /* Output a marker (i.e. a label) for the point in the generated code where
    the real body of the function begins (after parameters have been moved
    to their home locations).  */
@@ -5067,6 +5293,8 @@ dwarfout_begin_function ()
 {
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
 
+  if (! use_gnu_debug_info_extensions)
+    return;
   function_section (current_function_decl);
   sprintf (label, BODY_BEGIN_LABEL_FMT, current_funcdef_number);
   ASM_OUTPUT_LABEL (asm_out_file, label);
@@ -5080,6 +5308,8 @@ dwarfout_end_function ()
 {
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
 
+  if (! use_gnu_debug_info_extensions)
+    return;
   function_section (current_function_decl);
   sprintf (label, BODY_END_LABEL_FMT, current_funcdef_number);
   ASM_OUTPUT_LABEL (asm_out_file, label);
@@ -5136,7 +5366,7 @@ generate_new_sfname_entry ()
   ASM_OUTPUT_PUSH_SECTION (asm_out_file, SFNAMES_SECTION);
   sprintf (label, SFNAMES_ENTRY_LABEL_FMT, filename_table[0].number);
   ASM_OUTPUT_LABEL (asm_out_file, label);
-  ASM_OUTPUT_DWARF_STRING (asm_out_file,
+  ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file,
                           filename_table[0].name
                             ? filename_table[0].name
                             : "");
@@ -5176,7 +5406,7 @@ generate_new_sfname_entry ()
 
 static unsigned
 lookup_filename (file_name)
-     char *file_name;
+     const char *file_name;
 {
   register filename_entry *search_p;
   register filename_entry *limit_p = &filename_table[ft_entries];
@@ -5243,23 +5473,31 @@ generate_srcinfo_entry (line_entry_num, files_entry_num)
 
 void
 dwarfout_line (filename, line)
-     register char *filename;
+     register const char *filename;
      register unsigned line;
 {
-  if (debug_info_level >= DINFO_LEVEL_NORMAL)
+  if (debug_info_level >= DINFO_LEVEL_NORMAL
+      /* We can't emit line number info for functions in separate sections,
+        because the assembler can't subtract labels in different sections.  */
+      && DECL_SECTION_NAME (current_function_decl) == NULL_TREE)
     {
       char label[MAX_ARTIFICIAL_LABEL_BYTES];
       static unsigned last_line_entry_num = 0;
       static unsigned prev_file_entry_num = (unsigned) -1;
-      register unsigned this_file_entry_num = lookup_filename (filename);
+      register unsigned this_file_entry_num;
 
       function_section (current_function_decl);
       sprintf (label, LINE_CODE_LABEL_FMT, ++last_line_entry_num);
       ASM_OUTPUT_LABEL (asm_out_file, label);
 
       fputc ('\n', asm_out_file);
-      ASM_OUTPUT_PUSH_SECTION (asm_out_file, LINE_SECTION);
 
+      if (use_gnu_debug_info_extensions)
+       this_file_entry_num = lookup_filename (filename);
+      else
+       this_file_entry_num = (unsigned) -1;
+
+      ASM_OUTPUT_PUSH_SECTION (asm_out_file, LINE_SECTION);
       if (this_file_entry_num != prev_file_entry_num)
         {
           char line_entry_label[MAX_ARTIFICIAL_LABEL_BYTES];
@@ -5269,13 +5507,13 @@ dwarfout_line (filename, line)
         }
 
       {
-        register char *tail = rindex (filename, '/');
+        register const char *tail = strrchr (filename, '/');
 
         if (tail != NULL)
           filename = tail;
       }
 
-      fprintf (asm_out_file, "\t%s\t%u\t%s %s:%u\n",
+      fprintf (asm_out_file, "%s%u\t%s %s:%u\n",
               UNALIGNED_INT_ASM_OP, line, ASM_COMMENT_START,
               filename, line);
       ASM_OUTPUT_DWARF_DATA2 (asm_out_file, 0xffff);
@@ -5292,26 +5530,32 @@ dwarfout_line (filename, line)
 
 static void
 generate_macinfo_entry (type_and_offset, string)
-     register char *type_and_offset;
-     register char *string;
+     register const char *type_and_offset;
+     register const char *string;
 {
+  if (! use_gnu_debug_info_extensions)
+    return;
+
   fputc ('\n', asm_out_file);
   ASM_OUTPUT_PUSH_SECTION (asm_out_file, MACINFO_SECTION);
-  fprintf (asm_out_file, "\t%s\t%s\n", UNALIGNED_INT_ASM_OP, type_and_offset);
-  ASM_OUTPUT_DWARF_STRING (asm_out_file, string);
+  fprintf (asm_out_file, "%s%s\n", UNALIGNED_INT_ASM_OP, type_and_offset);
+  ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, string);
   ASM_OUTPUT_POP_SECTION (asm_out_file);
 }
 
 void
 dwarfout_start_new_source_file (filename)
-     register char *filename;
+     register const char *filename;
 {
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
   char type_and_offset[MAX_ARTIFICIAL_LABEL_BYTES*3];
 
   sprintf (label, SFNAMES_ENTRY_LABEL_FMT, lookup_filename (filename));
   sprintf (type_and_offset, "0x%08x+%s-%s",
-          ((unsigned) MACINFO_start << 24), label, SFNAMES_BEGIN_LABEL);
+          ((unsigned) MACINFO_start << 24),
+          /* Hack: skip leading '*' .  */
+          (*label == '*') + label,
+          (*SFNAMES_BEGIN_LABEL == '*') + SFNAMES_BEGIN_LABEL);
   generate_macinfo_entry (type_and_offset, "");
 }
 
@@ -5334,7 +5578,7 @@ dwarfout_resume_previous_source_file (lineno)
 void
 dwarfout_define (lineno, buffer)
      register unsigned lineno;
-     register char *buffer;
+     register const char *buffer;
 {
   static int initialized = 0;
   char type_and_offset[MAX_ARTIFICIAL_LABEL_BYTES*2];
@@ -5357,7 +5601,7 @@ dwarfout_define (lineno, buffer)
 void
 dwarfout_undef (lineno, buffer)
      register unsigned lineno;
-     register char *buffer;
+     register const char *buffer;
 {
   char type_and_offset[MAX_ARTIFICIAL_LABEL_BYTES*2];
 
@@ -5371,7 +5615,7 @@ dwarfout_undef (lineno, buffer)
 void
 dwarfout_init (asm_out_file, main_input_filename)
      register FILE *asm_out_file;
-     register char *main_input_filename;
+     register const char *main_input_filename;
 {
   /* Remember the name of the primary input file.  */
 
@@ -5454,32 +5698,30 @@ dwarfout_init (asm_out_file, main_input_filename)
 
   if (debug_info_level >= DINFO_LEVEL_NORMAL)
     {
-      /* Output a starting label and an initial (compilation directory)
-        entry for the .debug_sfnames section.  The starting label will be
-        referenced by the initial entry in the .debug_srcinfo section.  */
-    
-      fputc ('\n', asm_out_file);
-      ASM_OUTPUT_PUSH_SECTION (asm_out_file, SFNAMES_SECTION);
-      ASM_OUTPUT_LABEL (asm_out_file, SFNAMES_BEGIN_LABEL);
-      {
-       register char *pwd;
-       register unsigned len;
-       register char *dirname;
-
-       pwd = getpwd ();
-       if (!pwd)
-         pfatal_with_name ("getpwd");
-       len = strlen (pwd);
-       dirname = (char *) xmalloc (len + 2);
+      if (use_gnu_debug_info_extensions)
+       {
+         /* Output a starting label and an initial (compilation directory)
+            entry for the .debug_sfnames section.  The starting label will be
+            referenced by the initial entry in the .debug_srcinfo section.  */
     
-       strcpy (dirname, pwd);
-       strcpy (dirname + len, "/");
-        ASM_OUTPUT_DWARF_STRING (asm_out_file, dirname);
-        free (dirname);
-      }
-      ASM_OUTPUT_POP_SECTION (asm_out_file);
+         fputc ('\n', asm_out_file);
+         ASM_OUTPUT_PUSH_SECTION (asm_out_file, SFNAMES_SECTION);
+         ASM_OUTPUT_LABEL (asm_out_file, SFNAMES_BEGIN_LABEL);
+         {
+           register const char *pwd = getpwd ();
+           register char *dirname;
+
+           if (!pwd)
+             pfatal_with_name ("getpwd");
+           dirname = concat (pwd, "/", NULL);
+           ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, dirname);
+           free (dirname);
+         }
+         ASM_OUTPUT_POP_SECTION (asm_out_file);
+       }
     
-      if (debug_info_level >= DINFO_LEVEL_VERBOSE)
+      if (debug_info_level >= DINFO_LEVEL_VERBOSE
+         && use_gnu_debug_info_extensions)
        {
           /* Output a starting label for the .debug_macinfo section.  This
             label will be referenced by the AT_mac_info attribute in the
@@ -5500,21 +5742,24 @@ dwarfout_init (asm_out_file, main_input_filename)
       ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_BEGIN_LABEL);
       ASM_OUTPUT_POP_SECTION (asm_out_file);
     
-      /* Generate the initial entry for the .debug_srcinfo section.  */
-    
-      fputc ('\n', asm_out_file);
-      ASM_OUTPUT_PUSH_SECTION (asm_out_file, SRCINFO_SECTION);
-      ASM_OUTPUT_LABEL (asm_out_file, SRCINFO_BEGIN_LABEL);
-      ASM_OUTPUT_DWARF_ADDR (asm_out_file, LINE_BEGIN_LABEL);
-      ASM_OUTPUT_DWARF_ADDR (asm_out_file, SFNAMES_BEGIN_LABEL);
-      ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_BEGIN_LABEL);
-      ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_END_LABEL);
+      if (use_gnu_debug_info_extensions)
+       {
+         /* Generate the initial entry for the .debug_srcinfo section.  */
+
+         fputc ('\n', asm_out_file);
+         ASM_OUTPUT_PUSH_SECTION (asm_out_file, SRCINFO_SECTION);
+         ASM_OUTPUT_LABEL (asm_out_file, SRCINFO_BEGIN_LABEL);
+         ASM_OUTPUT_DWARF_ADDR (asm_out_file, LINE_BEGIN_LABEL);
+         ASM_OUTPUT_DWARF_ADDR (asm_out_file, SFNAMES_BEGIN_LABEL);
+         ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_BEGIN_LABEL);
+         ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_END_LABEL);
 #ifdef DWARF_TIMESTAMPS
-      ASM_OUTPUT_DWARF_DATA4 (asm_out_file, time (NULL));
+         ASM_OUTPUT_DWARF_DATA4 (asm_out_file, time (NULL));
 #else
-      ASM_OUTPUT_DWARF_DATA4 (asm_out_file, -1);
+         ASM_OUTPUT_DWARF_DATA4 (asm_out_file, -1);
 #endif
-      ASM_OUTPUT_POP_SECTION (asm_out_file);
+         ASM_OUTPUT_POP_SECTION (asm_out_file);
+       }
     
       /* Generate the initial entry for the .debug_pubnames section.  */
     
@@ -5558,6 +5803,8 @@ dwarfout_finish ()
 
   fputc ('\n', asm_out_file);
   ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_SECTION);
+  retry_incomplete_types ();
+  fputc ('\n', asm_out_file);
 
   /* Mark the end of the chain of siblings which represent all file-scope
      declarations in this compilation unit.  */
@@ -5652,14 +5899,17 @@ dwarfout_finish ()
       ASM_OUTPUT_LABEL (asm_out_file, LINE_END_LABEL);
       ASM_OUTPUT_POP_SECTION (asm_out_file);
     
-      /* Output a terminating entry for the .debug_srcinfo section.  */
-    
-      fputc ('\n', asm_out_file);
-      ASM_OUTPUT_PUSH_SECTION (asm_out_file, SRCINFO_SECTION);
-      ASM_OUTPUT_DWARF_DELTA4 (asm_out_file,
-                              LINE_LAST_ENTRY_LABEL, LINE_BEGIN_LABEL);
-      ASM_OUTPUT_DWARF_DATA4 (asm_out_file, -1);
-      ASM_OUTPUT_POP_SECTION (asm_out_file);
+      if (use_gnu_debug_info_extensions)
+       {
+         /* Output a terminating entry for the .debug_srcinfo section.  */
+
+         fputc ('\n', asm_out_file);
+         ASM_OUTPUT_PUSH_SECTION (asm_out_file, SRCINFO_SECTION);
+         ASM_OUTPUT_DWARF_DELTA4 (asm_out_file,
+                                  LINE_LAST_ENTRY_LABEL, LINE_BEGIN_LABEL);
+         ASM_OUTPUT_DWARF_DATA4 (asm_out_file, -1);
+         ASM_OUTPUT_POP_SECTION (asm_out_file);
+       }
 
       if (debug_info_level >= DINFO_LEVEL_VERBOSE)
        {
@@ -5670,7 +5920,7 @@ dwarfout_finish ()
          fputc ('\n', asm_out_file);
          ASM_OUTPUT_PUSH_SECTION (asm_out_file, MACINFO_SECTION);
          ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
-         ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
+         ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
          ASM_OUTPUT_POP_SECTION (asm_out_file);
        }
     
@@ -5679,7 +5929,7 @@ dwarfout_finish ()
       fputc ('\n', asm_out_file);
       ASM_OUTPUT_PUSH_SECTION (asm_out_file, PUBNAMES_SECTION);
       ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
-      ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
+      ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
       ASM_OUTPUT_POP_SECTION (asm_out_file);
     
       /* Generate the terminating entries for the .debug_aranges section.
@@ -5729,6 +5979,12 @@ dwarfout_finish ()
 
       ASM_OUTPUT_POP_SECTION (asm_out_file);
     }
+
+  /* There should not be any pending types left at the end.  We need
+     this now because it may not have been checked on the last call to
+     dwarfout_file_scope_decl.  */
+  if (pending_types != 0)
+    abort ();
 }
 
 #endif /* DWARF_DEBUGGING_INFO */