diff mbox

Remove DWARF_OFFSET_SIZE, DWARF_INITIAL_LENGTH_SIZE

Message ID ydd62e9kaqc.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth March 12, 2012, 5:08 p.m. UTC
With the IRIX port gone (shortly), there are no targets that define a
non-default DWARF_OFFSET_SIZE or DWARF_INITIAL_LENGTH_SIZE any longer.
I therefore propose to remove the code handling this.

The following (pretty mechanical) patch does this.  Bootstrapped without
regressions on i386-pc-solaris2.11, ok for mainline?

	Rainer


2012-03-11  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* defaults.h (DWARF_OFFSET_SIZE): Remove.
	* config/sparc/freebsd.h (DWARF_OFFSET_SIZE): Remove comment.
	* config/sparc/linux64.h : Remove comment.
	* config/sparc/linux64.h : Likewise.
	* system.h (DWARF_OFFSET_SIZE): Poison.

	* dwarf2out.c (DWARF_INITIAL_LENGTH_SIZE): Remove.
	(DWARF_CIE_ID): Remove non-default DWARF_OFFSET_SIZE,
	DWARF_INITIAL_LENGTH_SIZE handling.
	(output_fde): Likewise.
	(output_call_frame_info): Likewise.
	(DWARF_REF_SIZE): Likewise.
	(DWARF_COMPILE_UNIT_HEADER_SIZE): Likewise.
	(DWARF_COMDAT_TYPE_UNIT_HEADER_SIZE): Likeiwise.
	(DWARF_PUBNAMES_HEADER_SIZE): Likewise.
	(DWARF_ARANGES_HEADER_SIZE): Likewise.
	(DWARF_ARANGES_PAD_SIZE): Likewise.
	(AT_string_form): Likewise.
	(size_of_die): Likewise.
	(size_of_pubnames): Likewise.
	(value_format): Likewise.
	(output_die): Likewise.
	(output_compilation_unit_header): Likewise.
	(output_comdat_type_unit): Likewise.
	(output_pubnames): Likewise.
	(output_aranges): Likewise.
	(output_line_info): Likewise.
	(output_macinfo_op): Likewise.
	(optimize_macinfo_range): Likewise.
	(output_macinfo): Likewise.

	(DW_FORM_data): Remove.
	(DW_FORM_ref): Remove.
	(value_format): Replace DW_FORM_data by DW_FORM_data4.
	Replace DW_FORM_ref by DW_FORM_ref4.

Comments

Joseph Myers March 12, 2012, 5:41 p.m. UTC | #1
On Mon, 12 Mar 2012, Rainer Orth wrote:

> With the IRIX port gone (shortly), there are no targets that define a
> non-default DWARF_OFFSET_SIZE or DWARF_INITIAL_LENGTH_SIZE any longer.
> I therefore propose to remove the code handling this.

As a *target macro* it makes sense to remove it - reomve it from 
defaults.h, make it purely internal to dwarf2out.c.  But I think it makes 
sense to have it inside dwarf2out.c - to indicate that a particular "4" is 
actually the size of an offset (which could be 8 if 64-bit DWARF were 
generated) rather than some other source of the magic number "4" (in 
general I think using meaningful names is better than such magic numbers, 
especially given that in the DWARF specification this is not a constant 
4).
Jason Merrill March 12, 2012, 6:39 p.m. UTC | #2
On 03/12/2012 01:41 PM, Joseph S. Myers wrote:
> As a *target macro* it makes sense to remove it - reomve it from
> defaults.h, make it purely internal to dwarf2out.c.  But I think it makes
> sense to have it inside dwarf2out.c

Agreed.

Jason
Rainer Orth March 12, 2012, 6:45 p.m. UTC | #3
Jason Merrill <jason@redhat.com> writes:

> On 03/12/2012 01:41 PM, Joseph S. Myers wrote:
>> As a *target macro* it makes sense to remove it - reomve it from
>> defaults.h, make it purely internal to dwarf2out.c.  But I think it makes
>> sense to have it inside dwarf2out.c
>
> Agreed.

Fine with me.  I've just been following the lead of several other places
in dwarf2out.c where hardcoded numbers were used.

What about DWARF_INITIAL_LENGTH_SIZE?  Keep it as a macro inside
dwarf2out.c, too?

	Rainer
Jason Merrill March 12, 2012, 6:58 p.m. UTC | #4
On 03/12/2012 02:45 PM, Rainer Orth wrote:
> What about DWARF_INITIAL_LENGTH_SIZE?  Keep it as a macro inside
> dwarf2out.c, too?

Please.

Jason
diff mbox

Patch

# HG changeset patch
# Parent 15a86d35ec84fea1404f4ca7d5f98f602c7dd70d
Remove DWARF_OFFSET_SIZE, DWARF_INITIAL_LENGTH_SIZE

diff --git a/gcc/config/sparc/freebsd.h b/gcc/config/sparc/freebsd.h
--- a/gcc/config/sparc/freebsd.h
+++ b/gcc/config/sparc/freebsd.h
@@ -1,5 +1,5 @@ 
 /* Definitions for Sun SPARC64 running FreeBSD using the ELF format
-   Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2010, 2011
+   Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2010, 2011, 2012
    Free Software Foundation, Inc.
    Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
 
@@ -124,15 +124,6 @@  along with GCC; see the file COPYING3.  
 #undef  DBX_CONTIN_CHAR
 #define DBX_CONTIN_CHAR	'?'
 
-/* DWARF bits.  */
-
-/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets. 
-   Obviously the Dwarf2 folks havn't tried to actually build systems
-   with their spec.  On a 64-bit system, only 64-bit relocs become
-   RELATIVE relocations.  */
-
-/* #define DWARF_OFFSET_SIZE PTR_SIZE */
-
 #ifdef HAVE_AS_TLS
 #undef TARGET_SUN_TLS
 #undef TARGET_GNU_TLS
diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
--- a/gcc/config/sparc/linux64.h
+++ b/gcc/config/sparc/linux64.h
@@ -1,6 +1,6 @@ 
 /* Definitions for 64-bit SPARC running Linux-based GNU systems with ELF.
    Copyright 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-   2009, 2010, 2011 Free Software Foundation, Inc.
+   2009, 2010, 2011, 2012 Free Software Foundation, Inc.
    Contributed by David S. Miller (davem@caip.rutgers.edu)
 
 This file is part of GCC.
@@ -236,15 +236,6 @@  do {									\
 #undef  LOCAL_LABEL_PREFIX
 #define LOCAL_LABEL_PREFIX  "."
 
-/* DWARF bits.  */
-
-/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets. 
-   Obviously the Dwarf2 folks haven't tried to actually build systems
-   with their spec.  On a 64-bit system, only 64-bit relocs become
-   RELATIVE relocations.  */
-
-/* #define DWARF_OFFSET_SIZE PTR_SIZE */
-
 #undef DITF_CONVERSION_LIBFUNCS
 #define DITF_CONVERSION_LIBFUNCS 1
 
diff --git a/gcc/defaults.h b/gcc/defaults.h
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -462,14 +462,6 @@  see the files COPYING3 and COPYING.RUNTI
 #define DWARF2_ADDR_SIZE (POINTER_SIZE / BITS_PER_UNIT)
 #endif
 
-/* The size in bytes of a DWARF field indicating an offset or length
-   relative to a debug info section, specified to be 4 bytes in the
-   DWARF-2 specification.  The SGI/MIPS ABI defines it to be the same
-   as PTR_SIZE.  */
-#ifndef DWARF_OFFSET_SIZE
-#define DWARF_OFFSET_SIZE 4
-#endif
-
 /* The size in bytes of a DWARF 4 type signature.  */
 #ifndef DWARF_TYPE_SIGNATURE_SIZE
 #define DWARF_TYPE_SIGNATURE_SIZE 8
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -162,18 +162,6 @@  static GTY(()) section *debug_frame_sect
 /* Maximum size (in bytes) of an artificially generated label.  */
 #define MAX_ARTIFICIAL_LABEL_BYTES	30
 
-/* According to the (draft) DWARF 3 specification, the initial length
-   should either be 4 or 12 bytes.  When it's 12 bytes, the first 4
-   bytes are 0xffffffff, followed by the length stored in the next 8
-   bytes.
-
-   However, the SGI/MIPS ABI uses an initial length which is equal to
-   DWARF_OFFSET_SIZE.  It is defined (elsewhere) accordingly.  */
-
-#ifndef DWARF_INITIAL_LENGTH_SIZE
-#define DWARF_INITIAL_LENGTH_SIZE (DWARF_OFFSET_SIZE == 4 ? 4 : 12)
-#endif
-
 /* Round SIZE up to the nearest BOUNDARY.  */
 #define DWARF_ROUND(SIZE,BOUNDARY) \
   ((((SIZE) + (BOUNDARY) - 1) / (BOUNDARY)) * (BOUNDARY))
@@ -181,7 +169,7 @@  static GTY(()) section *debug_frame_sect
 /* CIE identifier.  */
 #if HOST_BITS_PER_WIDE_INT >= 64
 #define DWARF_CIE_ID \
-  (unsigned HOST_WIDE_INT) (DWARF_OFFSET_SIZE == 4 ? DW_CIE_ID : DW64_CIE_ID)
+  (unsigned HOST_WIDE_INT) DW_CIE_ID
 #else
 #define DWARF_CIE_ID DW_CIE_ID
 #endif
@@ -225,10 +213,6 @@  static void dwarf2out_note_section_used 
    personality CFI.  */
 static GTY(()) rtx current_unit_personality;
 
-/* Data and reference forms for relocatable data.  */
-#define DW_FORM_data (DWARF_OFFSET_SIZE == 8 ? DW_FORM_data8 : DW_FORM_data4)
-#define DW_FORM_ref (DWARF_OFFSET_SIZE == 8 ? DW_FORM_ref8 : DW_FORM_ref4)
-
 #ifndef DEBUG_FRAME_SECTION
 #define DEBUG_FRAME_SECTION	".debug_frame"
 #endif
@@ -530,17 +514,13 @@  output_fde (dw_fde_ref fde, bool for_eh,
 				  for_eh + j);
   ASM_GENERATE_INTERNAL_LABEL (l1, FDE_AFTER_SIZE_LABEL, for_eh + j);
   ASM_GENERATE_INTERNAL_LABEL (l2, FDE_END_LABEL, for_eh + j);
-  if (DWARF_INITIAL_LENGTH_SIZE - DWARF_OFFSET_SIZE == 4 && !for_eh)
-    dw2_asm_output_data (4, 0xffffffff, "Initial length escape value"
-			 " indicating 64-bit DWARF extension");
-  dw2_asm_output_delta (for_eh ? 4 : DWARF_OFFSET_SIZE, l2, l1,
-			"FDE Length");
+  dw2_asm_output_delta (4, l2, l1, "FDE Length");
   ASM_OUTPUT_LABEL (asm_out_file, l1);
 
   if (for_eh)
     dw2_asm_output_delta (4, l1, section_start_label, "FDE CIE offset");
   else
-    dw2_asm_output_offset (DWARF_OFFSET_SIZE, section_start_label,
+    dw2_asm_output_offset (4, section_start_label,
 			   debug_frame_section, "FDE CIE offset");
 
   begin = second ? fde->dw_fde_second_begin : fde->dw_fde_begin;
@@ -730,17 +710,12 @@  output_call_frame_info (int for_eh)
   /* Output the CIE.  */
   ASM_GENERATE_INTERNAL_LABEL (l1, CIE_AFTER_SIZE_LABEL, for_eh);
   ASM_GENERATE_INTERNAL_LABEL (l2, CIE_END_LABEL, for_eh);
-  if (DWARF_INITIAL_LENGTH_SIZE - DWARF_OFFSET_SIZE == 4 && !for_eh)
-    dw2_asm_output_data (4, 0xffffffff,
-      "Initial length escape value indicating 64-bit DWARF extension");
-  dw2_asm_output_delta (for_eh ? 4 : DWARF_OFFSET_SIZE, l2, l1,
-			"Length of Common Information Entry");
+  dw2_asm_output_delta (4, l2, l1, "Length of Common Information Entry");
   ASM_OUTPUT_LABEL (asm_out_file, l1);
 
   /* Now that the CIE pointer is PC-relative for EH,
      use 0 to identify the CIE.  */
-  dw2_asm_output_data ((for_eh ? 4 : DWARF_OFFSET_SIZE),
-		       (for_eh ? 0 : DWARF_CIE_ID),
+  dw2_asm_output_data (4, (for_eh ? 0 : DWARF_CIE_ID),
 		       "CIE Identifier Tag");
 
   /* Use the CIE version 3 for DWARF3; allow DWARF2 to continue to
@@ -1770,7 +1745,7 @@  loc_list_plus_const (dw_loc_list_ref lis
 }
 
 #define DWARF_REF_SIZE	\
-  (dwarf_version == 2 ? DWARF2_ADDR_SIZE : DWARF_OFFSET_SIZE)
+  (dwarf_version == 2 ? DWARF2_ADDR_SIZE : 4)
 
 static unsigned long int get_base_type_offset (dw_die_ref);
 
@@ -2915,29 +2890,23 @@  skeleton_chain_node;
    language, and compiler version.  */
 
 /* Fixed size portion of the DWARF compilation unit header.  */
-#define DWARF_COMPILE_UNIT_HEADER_SIZE \
-  (DWARF_INITIAL_LENGTH_SIZE + DWARF_OFFSET_SIZE + 3)
+#define DWARF_COMPILE_UNIT_HEADER_SIZE (4 + 4 + 3)
 
 /* Fixed size portion of the DWARF comdat type unit header.  */
 #define DWARF_COMDAT_TYPE_UNIT_HEADER_SIZE \
-  (DWARF_COMPILE_UNIT_HEADER_SIZE + DWARF_TYPE_SIGNATURE_SIZE \
-   + DWARF_OFFSET_SIZE)
+  (DWARF_COMPILE_UNIT_HEADER_SIZE + DWARF_TYPE_SIGNATURE_SIZE + 4)
 
 /* Fixed size portion of public names info.  */
-#define DWARF_PUBNAMES_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 2)
+#define DWARF_PUBNAMES_HEADER_SIZE (2 * 4 + 2)
 
 /* Fixed size portion of the address range info.  */
 #define DWARF_ARANGES_HEADER_SIZE					\
-  (DWARF_ROUND (DWARF_INITIAL_LENGTH_SIZE + DWARF_OFFSET_SIZE + 4,	\
-		DWARF2_ADDR_SIZE * 2)					\
-   - DWARF_INITIAL_LENGTH_SIZE)
+  (DWARF_ROUND (4 + 4 + 4, DWARF2_ADDR_SIZE * 2) - 4)
 
 /* Size of padding portion in the address range info.  It must be
    aligned to twice the pointer size.  */
 #define DWARF_ARANGES_PAD_SIZE \
-  (DWARF_ROUND (DWARF_INITIAL_LENGTH_SIZE + DWARF_OFFSET_SIZE + 4, \
-		DWARF2_ADDR_SIZE * 2)				   \
-   - (DWARF_INITIAL_LENGTH_SIZE + DWARF_OFFSET_SIZE + 4))
+  (DWARF_ROUND (4 + 4 + 4, DWARF2_ADDR_SIZE * 2) - (4 + 4 + 4))
 
 /* Use assembler line directives if available.  */
 #ifndef DWARF2_ASM_LINE_DEBUG_INFO
@@ -4435,7 +4404,7 @@  AT_string_form (dw_attr_ref a)
 
   /* If the string is shorter or equal to the size of the reference, it is
      always better to put it inline.  */
-  if (len <= DWARF_OFFSET_SIZE || node->refcount == 0)
+  if (len <= 4 || node->refcount == 0)
     return node->form = DW_FORM_string;
 
   /* If we cannot expect the linker to merge strings in .debug_str
@@ -4443,7 +4412,7 @@  AT_string_form (dw_attr_ref a)
      single module.  */
   if (DWARF2_INDIRECT_STRING_SUPPORT_MISSING_ON_TARGET
       || ((debug_str_section->common.flags & SECTION_MERGE) == 0
-      && (len - DWARF_OFFSET_SIZE) * node->refcount <= len))
+      && (len - 4) * node->refcount <= len))
     return node->form = DW_FORM_string;
 
   ASM_GENERATE_INTERNAL_LABEL (label, "LASF", dw2_string_counter);
@@ -7681,7 +7650,7 @@  size_of_die (dw_die_ref die)
 	  size += DWARF2_ADDR_SIZE;
 	  break;
 	case dw_val_class_offset:
-	  size += DWARF_OFFSET_SIZE;
+	  size += 4;
 	  break;
 	case dw_val_class_loc:
 	  {
@@ -7696,10 +7665,10 @@  size_of_die (dw_die_ref die)
 	  }
 	  break;
 	case dw_val_class_loc_list:
-	  size += DWARF_OFFSET_SIZE;
+	  size += 4;
 	  break;
 	case dw_val_class_range_list:
-	  size += DWARF_OFFSET_SIZE;
+	  size += 4;
 	  break;
 	case dw_val_class_const:
 	  size += size_of_sleb128 (AT_int (a));
@@ -7750,24 +7719,24 @@  size_of_die (dw_die_ref die)
 	      else if (dwarf_version == 2)
 		size += DWARF2_ADDR_SIZE;
 	      else
-		size += DWARF_OFFSET_SIZE;
-	    }
-	  else
-	    size += DWARF_OFFSET_SIZE;
+		size += 4;
+	    }
+	  else
+	    size += 4;
 	  break;
 	case dw_val_class_fde_ref:
-	  size += DWARF_OFFSET_SIZE;
+	  size += 4;
 	  break;
 	case dw_val_class_lbl_id:
 	  size += DWARF2_ADDR_SIZE;
 	  break;
 	case dw_val_class_lineptr:
 	case dw_val_class_macptr:
-	  size += DWARF_OFFSET_SIZE;
+	  size += 4;
 	  break;
 	case dw_val_class_str:
 	  if (AT_string_form (a) == DW_FORM_strp)
-	    size += DWARF_OFFSET_SIZE;
+	    size += 4;
 	  else
 	    size += strlen (a->dw_attr_val.v.val_str->str) + 1;
 	  break;
@@ -7778,7 +7747,7 @@  size_of_die (dw_die_ref die)
 	  size += 8;
 	  break;
 	case dw_val_class_vms_delta:
-	  size += DWARF_OFFSET_SIZE;
+	  size += 4;
 	  break;
 	default:
 	  gcc_unreachable ();
@@ -7905,9 +7874,9 @@  size_of_pubnames (VEC (pubname_entry, gc
     if (names != pubtype_table
 	|| p->die->die_offset != 0
 	|| !flag_eliminate_unused_debug_types)
-      size += strlen (p->name) + DWARF_OFFSET_SIZE + 1;
-
-  size += DWARF_OFFSET_SIZE;
+      size += strlen (p->name) + 4 + 1;
+
+  size += 4;
   return size;
 }
 
@@ -7983,15 +7952,7 @@  value_format (dw_attr_ref a)
       /* FALLTHRU */
     case dw_val_class_vms_delta:
     case dw_val_class_offset:
-      switch (DWARF_OFFSET_SIZE)
-	{
-	case 4:
-	  return DW_FORM_data4;
-	case 8:
-	  return DW_FORM_data8;
-	default:
-	  gcc_unreachable ();
-	}
+      return DW_FORM_data4;
     case dw_val_class_loc:
       if (dwarf_version >= 4)
 	return DW_FORM_exprloc;
@@ -8071,14 +8032,14 @@  value_format (dw_attr_ref a)
       if (AT_ref_external (a))
 	return use_debug_types ? DW_FORM_ref_sig8 : DW_FORM_ref_addr;
       else
-	return DW_FORM_ref;
+	return DW_FORM_ref4;
     case dw_val_class_fde_ref:
-      return DW_FORM_data;
+      return DW_FORM_data4;
     case dw_val_class_lbl_id:
       return DW_FORM_addr;
     case dw_val_class_lineptr:
     case dw_val_class_macptr:
-      return dwarf_version >= 4 ? DW_FORM_sec_offset : DW_FORM_data;
+      return dwarf_version >= 4 ? DW_FORM_sec_offset : DW_FORM_data4;
     case dw_val_class_str:
       return AT_string_form (a);
     case dw_val_class_file:
@@ -8300,8 +8261,7 @@  output_die (dw_die_ref die)
 	  break;
 
 	case dw_val_class_offset:
-	  dw2_asm_output_data (DWARF_OFFSET_SIZE, a->dw_attr_val.v.val_offset,
-			       "%s", name);
+	  dw2_asm_output_data (4, a->dw_attr_val.v.val_offset, "%s", name);
 	  break;
 
 	case dw_val_class_range_list:
@@ -8310,7 +8270,7 @@  output_die (dw_die_ref die)
 
 	    sprintf (p, "+" HOST_WIDE_INT_PRINT_HEX,
 		     a->dw_attr_val.v.val_offset);
-	    dw2_asm_output_offset (DWARF_OFFSET_SIZE, ranges_section_label,
+	    dw2_asm_output_offset (4, ranges_section_label,
 				   debug_ranges_section, "%s", name);
 	    *p = '\0';
 	  }
@@ -8420,8 +8380,7 @@  output_die (dw_die_ref die)
 	    char *sym = AT_loc_list (a)->ll_symbol;
 
 	    gcc_assert (sym);
-	    dw2_asm_output_offset (DWARF_OFFSET_SIZE, sym, debug_loc_section,
-				   "%s", name);
+	    dw2_asm_output_offset (4, sym, debug_loc_section, "%s", name);
 	  }
 	  break;
 
@@ -8448,7 +8407,7 @@  output_die (dw_die_ref die)
 		  if (dwarf_version == 2)
 		    size = DWARF2_ADDR_SIZE;
 		  else
-		    size = DWARF_OFFSET_SIZE;
+		    size = 4;
 		  dw2_asm_output_offset (size, sym, debug_info_section, "%s",
 					 name);
 		}
@@ -8456,8 +8415,7 @@  output_die (dw_die_ref die)
 	  else
 	    {
 	      gcc_assert (AT_ref (a)->die_offset);
-	      dw2_asm_output_data (DWARF_OFFSET_SIZE, AT_ref (a)->die_offset,
-				   "%s", name);
+	      dw2_asm_output_data (4, AT_ref (a)->die_offset, "%s", name);
 	    }
 	  break;
 
@@ -8467,14 +8425,12 @@  output_die (dw_die_ref die)
 
 	    ASM_GENERATE_INTERNAL_LABEL (l1, FDE_LABEL,
 					 a->dw_attr_val.v.val_fde_index * 2);
-	    dw2_asm_output_offset (DWARF_OFFSET_SIZE, l1, debug_frame_section,
-				   "%s", name);
+	    dw2_asm_output_offset (4, l1, debug_frame_section, "%s", name);
 	  }
 	  break;
 
 	case dw_val_class_vms_delta:
-	  dw2_asm_output_vms_delta (DWARF_OFFSET_SIZE,
-				    AT_vms_delta2 (a), AT_vms_delta1 (a),
+	  dw2_asm_output_vms_delta (4, AT_vms_delta2 (a), AT_vms_delta1 (a),
 				    "%s", name);
 	  break;
 
@@ -8483,19 +8439,17 @@  output_die (dw_die_ref die)
 	  break;
 
 	case dw_val_class_lineptr:
-	  dw2_asm_output_offset (DWARF_OFFSET_SIZE, AT_lbl (a),
-				 debug_line_section, "%s", name);
+	  dw2_asm_output_offset (4, AT_lbl (a), debug_line_section, "%s", name);
 	  break;
 
 	case dw_val_class_macptr:
-	  dw2_asm_output_offset (DWARF_OFFSET_SIZE, AT_lbl (a),
-				 debug_macinfo_section, "%s", name);
+	  dw2_asm_output_offset (4, AT_lbl (a), debug_macinfo_section,
+				 "%s", name);
 	  break;
 
 	case dw_val_class_str:
 	  if (AT_string_form (a) == DW_FORM_strp)
-	    dw2_asm_output_offset (DWARF_OFFSET_SIZE,
-				   a->dw_attr_val.v.val_str->label,
+	    dw2_asm_output_offset (4, a->dw_attr_val.v.val_str->label,
 				   debug_str_section,
 				   "%s: \"%s\"", name, AT_string (a));
 	  else
@@ -8542,15 +8496,10 @@  output_compilation_unit_header (void)
 {
   int ver = dwarf_version;
 
-  if (DWARF_INITIAL_LENGTH_SIZE - DWARF_OFFSET_SIZE == 4)
-    dw2_asm_output_data (4, 0xffffffff,
-      "Initial length escape value indicating 64-bit DWARF extension");
-  dw2_asm_output_data (DWARF_OFFSET_SIZE,
-		       next_die_offset - DWARF_INITIAL_LENGTH_SIZE,
+  dw2_asm_output_data (4, next_die_offset - 4,
 		       "Length of Compilation Unit Info");
   dw2_asm_output_data (2, ver, "DWARF version number");
-  dw2_asm_output_offset (DWARF_OFFSET_SIZE, abbrev_section_label,
-			 debug_abbrev_section,
+  dw2_asm_output_offset (4, abbrev_section_label, debug_abbrev_section,
 			 "Offset Into Abbrev. Section");
   dw2_asm_output_data (1, DWARF2_ADDR_SIZE, "Pointer Size (in bytes)");
 }
@@ -8653,8 +8602,7 @@  output_comdat_type_unit (comdat_type_nod
   /* Output debugging information.  */
   output_compilation_unit_header ();
   output_signature (node->signature, "Type Signature");
-  dw2_asm_output_data (DWARF_OFFSET_SIZE, node->type_die->die_offset,
-		       "Offset to Type DIE");
+  dw2_asm_output_data (4, node->type_die->die_offset, "Offset to Type DIE");
   output_die (node->root_die);
 
   unmark_dies (node->root_die);
@@ -8749,22 +8697,16 @@  output_pubnames (VEC (pubname_entry, gc)
   unsigned long pubnames_length = size_of_pubnames (names);
   pubname_ref pub;
 
-  if (DWARF_INITIAL_LENGTH_SIZE - DWARF_OFFSET_SIZE == 4)
-    dw2_asm_output_data (4, 0xffffffff,
-      "Initial length escape value indicating 64-bit DWARF extension");
   if (names == pubname_table)
-    dw2_asm_output_data (DWARF_OFFSET_SIZE, pubnames_length,
-			 "Length of Public Names Info");
-  else
-    dw2_asm_output_data (DWARF_OFFSET_SIZE, pubnames_length,
+    dw2_asm_output_data (4, pubnames_length, "Length of Public Names Info");
+  else
+    dw2_asm_output_data (4, pubnames_length,
 			 "Length of Public Type Names Info");
   /* Version number for pubnames/pubtypes is still 2, even in DWARF3.  */
   dw2_asm_output_data (2, 2, "DWARF Version");
-  dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label,
-			 debug_info_section,
+  dw2_asm_output_offset (4, debug_info_section_label, debug_info_section,
 			 "Offset of Compilation Unit Info");
-  dw2_asm_output_data (DWARF_OFFSET_SIZE, next_die_offset,
-		       "Compilation Unit Length");
+  dw2_asm_output_data (4, next_die_offset, "Compilation Unit Length");
 
   FOR_EACH_VEC_ELT (pubname_entry, names, i, pub)
     {
@@ -8776,14 +8718,13 @@  output_pubnames (VEC (pubname_entry, gc)
 	  || pub->die->die_offset != 0
 	  || !flag_eliminate_unused_debug_types)
 	{
-	  dw2_asm_output_data (DWARF_OFFSET_SIZE, pub->die->die_offset,
-			       "DIE offset");
+	  dw2_asm_output_data (4, pub->die->die_offset, "DIE offset");
 
 	  dw2_asm_output_nstring (pub->name, -1, "external name");
 	}
     }
 
-  dw2_asm_output_data (DWARF_OFFSET_SIZE, 0, NULL);
+  dw2_asm_output_data (4, 0, NULL);
 }
 
 /* Output the information that goes into the .debug_aranges table.
@@ -8795,15 +8736,10 @@  output_aranges (unsigned long aranges_le
 {
   unsigned i;
 
-  if (DWARF_INITIAL_LENGTH_SIZE - DWARF_OFFSET_SIZE == 4)
-    dw2_asm_output_data (4, 0xffffffff,
-      "Initial length escape value indicating 64-bit DWARF extension");
-  dw2_asm_output_data (DWARF_OFFSET_SIZE, aranges_length,
-		       "Length of Address Ranges Info");
+  dw2_asm_output_data (4, aranges_length, "Length of Address Ranges Info");
   /* Version number for aranges is still 2, even in DWARF3.  */
   dw2_asm_output_data (2, 2, "DWARF Version");
-  dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label,
-			 debug_info_section,
+  dw2_asm_output_offset (4, debug_info_section_label, debug_info_section,
 			 "Offset of Compilation Unit Info");
   dw2_asm_output_data (1, DWARF2_ADDR_SIZE, "Size of Address");
   dw2_asm_output_data (1, 0, "Size of Segment Descriptor");
@@ -9476,15 +9412,11 @@  output_line_info (void)
   ASM_GENERATE_INTERNAL_LABEL (p1, LN_PROLOG_AS_LABEL, 0);
   ASM_GENERATE_INTERNAL_LABEL (p2, LN_PROLOG_END_LABEL, 0);
 
-  if (DWARF_INITIAL_LENGTH_SIZE - DWARF_OFFSET_SIZE == 4)
-    dw2_asm_output_data (4, 0xffffffff,
-      "Initial length escape value indicating 64-bit DWARF extension");
-  dw2_asm_output_delta (DWARF_OFFSET_SIZE, l2, l1,
-			"Length of Source Line Info");
+  dw2_asm_output_delta (4, l2, l1, "Length of Source Line Info");
   ASM_OUTPUT_LABEL (asm_out_file, l1);
 
   dw2_asm_output_data (2, ver, "DWARF Version");
-  dw2_asm_output_delta (DWARF_OFFSET_SIZE, p2, p1, "Prolog Length");
+  dw2_asm_output_delta (4, p2, p1, "Prolog Length");
   ASM_OUTPUT_LABEL (asm_out_file, p1);
 
   /* Define the architecture-dependent minimum instruction length (in bytes).
@@ -20735,7 +20667,7 @@  output_macinfo_op (macinfo_entry *ref)
     case DW_MACINFO_undef:
       len = strlen (ref->info) + 1;
       if (!dwarf_strict
-	  && len > DWARF_OFFSET_SIZE
+	  && len > 4
 	  && !DWARF2_INDIRECT_STRING_SUPPORT_MISSING_ON_TARGET
 	  && (debug_str_section->common.flags & SECTION_MERGE) != 0)
 	{
@@ -20769,15 +20701,14 @@  output_macinfo_op (macinfo_entry *ref)
 			   : "Undefine macro indirect");
       dw2_asm_output_data_uleb128 (ref->lineno, "At line number %lu",
 				   (unsigned long) ref->lineno);
-      dw2_asm_output_offset (DWARF_OFFSET_SIZE, node->label,
-			     debug_str_section, "The macro: \"%s\"",
-			     ref->info);
+      dw2_asm_output_offset (4, node->label, debug_str_section,
+			     "The macro: \"%s\"", ref->info);
       break;
     case DW_MACRO_GNU_transparent_include:
       dw2_asm_output_data (1, ref->code, "Transparent include");
       ASM_GENERATE_INTERNAL_LABEL (label,
 				   DEBUG_MACRO_SECTION_LABEL, ref->lineno);
-      dw2_asm_output_offset (DWARF_OFFSET_SIZE, label, NULL, NULL);
+      dw2_asm_output_offset (4, label, NULL, NULL);
       break;
     default:
       fprintf (asm_out_file, "%s unrecognized macinfo code %lu\n",
@@ -20861,7 +20792,7 @@  optimize_macinfo_range (unsigned int idx
   /* The group name format is: wmN.[<encoded filename>.]<lineno>.<md5sum>  */
   grp_name = XALLOCAVEC (char, 4 + encoded_filename_len + linebuf_len + 1
 			 + 16 * 2 + 1);
-  memcpy (grp_name, DWARF_OFFSET_SIZE == 4 ? "wm4." : "wm8.", 4);
+  memcpy (grp_name, "wm4.", 4);
   tail = grp_name + 4;
   if (encoded_filename_len)
     {
@@ -20938,12 +20869,9 @@  output_macinfo (void)
   if (!dwarf_strict)
     {
       dw2_asm_output_data (2, 4, "DWARF macro version number");
-      if (DWARF_OFFSET_SIZE == 8)
-	dw2_asm_output_data (1, 3, "Flags: 64-bit, lineptr present");
-      else
-	dw2_asm_output_data (1, 2, "Flags: 32-bit, lineptr present");
-      dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_line_section_label,
-			     debug_line_section, NULL);
+      dw2_asm_output_data (1, 2, "Flags: 32-bit, lineptr present");
+      dw2_asm_output_offset (4, debug_line_section_label, debug_line_section,
+			     NULL);
     }
 
   /* In the first loop, it emits the primary .debug_macinfo section
@@ -21025,10 +20953,7 @@  output_macinfo (void)
 	  ref->code = 0;
 	  ref->info = NULL;
 	  dw2_asm_output_data (2, 4, "DWARF macro version number");
-	  if (DWARF_OFFSET_SIZE == 8)
-	    dw2_asm_output_data (1, 1, "Flags: 64-bit");
-	  else
-	    dw2_asm_output_data (1, 0, "Flags: 32-bit");
+	  dw2_asm_output_data (1, 0, "Flags: 32-bit");
 	}
 	break;
       case DW_MACINFO_define:
diff --git a/gcc/system.h b/gcc/system.h
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -879,7 +879,8 @@  extern void fancy_abort (const char *, i
 	SETJMP_VIA_SAVE_AREA FORBIDDEN_INC_DEC_CLASSES			   \
 	PREFERRED_OUTPUT_RELOAD_CLASS SYSTEM_INCLUDE_DIR		   \
 	STANDARD_INCLUDE_DIR STANDARD_INCLUDE_COMPONENT			   \
-	LINK_ELIMINATE_DUPLICATE_LDIRECTORIES MIPS_DEBUGGING_INFO
+	LINK_ELIMINATE_DUPLICATE_LDIRECTORIES MIPS_DEBUGGING_INFO	   \
+	DWARF_OFFSET_SIZE
 
 /* Hooks that are no longer used.  */
  #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE	\