diff --git a/gdb/dwarf2/comp-unit.c b/gdb/dwarf2/comp-unit.c
index 847a148cbd2..0b6629f14ce 100644
--- a/gdb/dwarf2/comp-unit.c
+++ b/gdb/dwarf2/comp-unit.c
@@ -221,3 +221,53 @@ read_and_check_comp_unit_head (struct dwarf2_per_objfile *dwarf2_per_objfile,
 
   return info_ptr;
 }
+
+CORE_ADDR
+comp_unit_head::read_address (bfd *abfd, const gdb_byte *buf,
+			      unsigned int *bytes_read) const
+{
+  CORE_ADDR retval = 0;
+
+  if (signed_addr_p)
+    {
+      switch (addr_size)
+	{
+	case 2:
+	  retval = bfd_get_signed_16 (abfd, buf);
+	  break;
+	case 4:
+	  retval = bfd_get_signed_32 (abfd, buf);
+	  break;
+	case 8:
+	  retval = bfd_get_signed_64 (abfd, buf);
+	  break;
+	default:
+	  internal_error (__FILE__, __LINE__,
+			  _("read_address: bad switch, signed [in module %s]"),
+			  bfd_get_filename (abfd));
+	}
+    }
+  else
+    {
+      switch (addr_size)
+	{
+	case 2:
+	  retval = bfd_get_16 (abfd, buf);
+	  break;
+	case 4:
+	  retval = bfd_get_32 (abfd, buf);
+	  break;
+	case 8:
+	  retval = bfd_get_64 (abfd, buf);
+	  break;
+	default:
+	  internal_error (__FILE__, __LINE__,
+			  _("read_address: bad switch, "
+			    "unsigned [in module %s]"),
+			  bfd_get_filename (abfd));
+	}
+    }
+
+  *bytes_read = addr_size;
+  return retval;
+}
diff --git a/gdb/dwarf2/comp-unit.h b/gdb/dwarf2/comp-unit.h
index e61b1000b9e..2dd80901b8f 100644
--- a/gdb/dwarf2/comp-unit.h
+++ b/gdb/dwarf2/comp-unit.h
@@ -89,6 +89,10 @@ struct comp_unit_head
     *bytes_read = offset_size;
     return offset;
   }
+
+  /* Read an address from BUF.  BYTES_READ is updated.  */
+  CORE_ADDR read_address (bfd *abfd, const gdb_byte *buf,
+			  unsigned int *bytes_read) const;
 };
 
 /* Expected enum dwarf_unit_type for read_comp_unit_head.  */
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 7c0d1d21cb6..e47f7443a58 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1243,9 +1243,6 @@ static void read_attribute_reprocess (const struct die_reader_specs *reader,
 
 static CORE_ADDR read_addr_index (struct dwarf2_cu *cu, unsigned int addr_index);
 
-static CORE_ADDR read_address (bfd *, const gdb_byte *ptr, struct dwarf2_cu *,
-			       unsigned int *);
-
 static LONGEST read_checked_initial_length_and_offset
   (bfd *, const gdb_byte *, const struct comp_unit_head *,
    unsigned int *, unsigned int *);
@@ -13559,7 +13556,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
 	      overflow = true;
 	      break;
 	    }
-	  base = read_address (obfd, buffer, cu, &bytes_read);
+	  base = cu->header.read_address (obfd, buffer, &bytes_read);
 	  found_base = 1;
 	  buffer += bytes_read;
 	  break;
@@ -13569,7 +13566,8 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
 	      overflow = true;
 	      break;
 	    }
-	  range_beginning = read_address (obfd, buffer, cu, &bytes_read);
+	  range_beginning = cu->header.read_address (obfd, buffer,
+						     &bytes_read);
 	  buffer += bytes_read;
 	  range_end = (range_beginning
 		       + read_unsigned_leb128 (obfd, buffer, &bytes_read));
@@ -13602,9 +13600,10 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
 	      overflow = true;
 	      break;
 	    }
-	  range_beginning = read_address (obfd, buffer, cu, &bytes_read);
+	  range_beginning = cu->header.read_address (obfd, buffer,
+						     &bytes_read);
 	  buffer += bytes_read;
-	  range_end = read_address (obfd, buffer, cu, &bytes_read);
+	  range_end = cu->header.read_address (obfd, buffer, &bytes_read);
 	  buffer += bytes_read;
 	  break;
 	default:
@@ -13707,9 +13706,9 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
     {
       CORE_ADDR range_beginning, range_end;
 
-      range_beginning = read_address (obfd, buffer, cu, &dummy);
+      range_beginning = cu->header.read_address (obfd, buffer, &dummy);
       buffer += addr_size;
-      range_end = read_address (obfd, buffer, cu, &dummy);
+      range_end = cu->header.read_address (obfd, buffer, &dummy);
       buffer += addr_size;
       offset += 2 * addr_size;
 
@@ -18491,7 +18490,8 @@ read_attribute_value (const struct die_reader_specs *reader,
     {
     case DW_FORM_ref_addr:
       if (cu->header.version == 2)
-	DW_UNSND (attr) = read_address (abfd, info_ptr, cu, &bytes_read);
+	DW_UNSND (attr) = cu->header.read_address (abfd, info_ptr,
+						   &bytes_read);
       else
 	DW_UNSND (attr) = cu->header.read_offset (abfd, info_ptr,
 						  &bytes_read);
@@ -18502,7 +18502,7 @@ read_attribute_value (const struct die_reader_specs *reader,
       info_ptr += bytes_read;
       break;
     case DW_FORM_addr:
-      DW_ADDR (attr) = read_address (abfd, info_ptr, cu, &bytes_read);
+      DW_ADDR (attr) = cu->header.read_address (abfd, info_ptr, &bytes_read);
       DW_ADDR (attr) = gdbarch_adjust_dwarf2_addr (gdbarch, DW_ADDR (attr));
       info_ptr += bytes_read;
       break;
@@ -18749,57 +18749,6 @@ read_attribute (const struct die_reader_specs *reader,
 			       need_reprocess);
 }
 
-static CORE_ADDR
-read_address (bfd *abfd, const gdb_byte *buf, struct dwarf2_cu *cu,
-	      unsigned int *bytes_read)
-{
-  struct comp_unit_head *cu_header = &cu->header;
-  CORE_ADDR retval = 0;
-
-  if (cu_header->signed_addr_p)
-    {
-      switch (cu_header->addr_size)
-	{
-	case 2:
-	  retval = bfd_get_signed_16 (abfd, buf);
-	  break;
-	case 4:
-	  retval = bfd_get_signed_32 (abfd, buf);
-	  break;
-	case 8:
-	  retval = bfd_get_signed_64 (abfd, buf);
-	  break;
-	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("read_address: bad switch, signed [in module %s]"),
-			  bfd_get_filename (abfd));
-	}
-    }
-  else
-    {
-      switch (cu_header->addr_size)
-	{
-	case 2:
-	  retval = bfd_get_16 (abfd, buf);
-	  break;
-	case 4:
-	  retval = bfd_get_32 (abfd, buf);
-	  break;
-	case 8:
-	  retval = bfd_get_64 (abfd, buf);
-	  break;
-	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("read_address: bad switch, "
-			    "unsigned [in module %s]"),
-			  bfd_get_filename (abfd));
-	}
-    }
-
-  *bytes_read = cu_header->addr_size;
-  return retval;
-}
-
 /* Cover function for read_initial_length.
    Returns the length of the object at BUF, and stores the size of the
    initial length in *BYTES_READ and stores the size that offsets will be in
@@ -20247,7 +20196,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
 		case DW_LNE_set_address:
 		  {
 		    CORE_ADDR address
-		      = read_address (abfd, line_ptr, cu, &bytes_read);
+		      = cu->header.read_address (abfd, line_ptr, &bytes_read);
 		    line_ptr += bytes_read;
 
 		    state_machine.check_line_address (cu, line_ptr,
@@ -20568,10 +20517,10 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
       unsigned int dummy;
 
       if (DW_BLOCK (attr)->data[0] == DW_OP_addr)
-	SET_SYMBOL_VALUE_ADDRESS (sym,
-				  read_address (objfile->obfd,
-						DW_BLOCK (attr)->data + 1,
-						cu, &dummy));
+	SET_SYMBOL_VALUE_ADDRESS
+	  (sym, cu->header.read_address (objfile->obfd,
+					 DW_BLOCK (attr)->data + 1,
+					 &dummy));
       else
 	SET_SYMBOL_VALUE_ADDRESS
 	  (sym, read_addr_index_from_leb128 (cu, DW_BLOCK (attr)->data + 1,
@@ -23037,8 +22986,8 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu)
 	  break;
 
 	case DW_OP_addr:
-	  stack[++stacki] = read_address (objfile->obfd, &data[i],
-					  cu, &bytes_read);
+	  stack[++stacki] = cu->header.read_address (objfile->obfd, &data[i],
+						     &bytes_read);
 	  i += bytes_read;
 	  break;
 
