[binutils-gdb] Remove _bfd_dwarf2_find_nearest_line addr_size parameter

Alan Modra amodra@sourceware.org
Wed Aug 14 04:16:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9defd221fe3ecffabc90eadd077326b27e898a2b

commit 9defd221fe3ecffabc90eadd077326b27e898a2b
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Aug 14 10:40:20 2019 +0930

    Remove _bfd_dwarf2_find_nearest_line addr_size parameter
    
    This parameter might appear to be used to set up offset_size, but
    since git commit 024b2372f5 offset_size is either set from the
    debug_info data or is set to 4.
    
    	* dwarf2.c (_bfd_dwarf2_find_nearest_line): Remove addr_size parameter.
    	* libbfd-in.h  (_bfd_dwarf2_find_nearest_line): Update prototype.
    	* coffgen.c (coff_find_nearest_line_with_names): Adjust
    	_bfd_dwarf2_find_nearest_line calls.
    	* elf.c (_bfd_elf_find_nearest_line, _bfd_elf_find_line): Likewise.
    	* elf32-arm.c (elf32_arm_find_nearest_line): Likewise.
    	* elf64-alpha.c (elf64_alpha_find_nearest_line): Likewise.
    	* elfnn-aarch64.c (elfNN_aarch64_find_nearest_line): Likewise.
    	* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Likewise.
    	* mach-o.c (bfd_mach_o_find_nearest_line): Likewise.
    	* libbfd.h: Regenerate.

Diff:
---
 bfd/ChangeLog       | 14 ++++++++++++++
 bfd/coffgen.c       |  4 ++--
 bfd/dwarf2.c        | 15 ++-------------
 bfd/elf.c           |  4 ++--
 bfd/elf32-arm.c     |  2 +-
 bfd/elf64-alpha.c   |  2 +-
 bfd/elfnn-aarch64.c |  2 +-
 bfd/elfxx-mips.c    |  1 -
 bfd/libbfd-in.h     |  2 +-
 bfd/libbfd.h        |  2 +-
 bfd/mach-o.c        |  2 +-
 11 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index cf2fec7..a2c2e51 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,17 @@
+2019-08-14  Alan Modra  <amodra@gmail.com>
+
+	* dwarf2.c (_bfd_dwarf2_find_nearest_line): Remove addr_size parameter.
+	* libbfd-in.h  (_bfd_dwarf2_find_nearest_line): Update prototype.
+	* coffgen.c (coff_find_nearest_line_with_names): Adjust
+	_bfd_dwarf2_find_nearest_line calls.
+	* elf.c (_bfd_elf_find_nearest_line, _bfd_elf_find_line): Likewise.
+	* elf32-arm.c (elf32_arm_find_nearest_line): Likewise.
+	* elf64-alpha.c (elf64_alpha_find_nearest_line): Likewise.
+	* elfnn-aarch64.c (elfNN_aarch64_find_nearest_line): Likewise.
+	* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Likewise.
+	* mach-o.c (bfd_mach_o_find_nearest_line): Likewise.
+	* libbfd.h: Regenerate.
+
 2019-08-09  Mihailo Stojanovic  <mihailo.stojanovic@rt-rk.com>
 
 	* elf-bfd.h (struct elf_backend_data): New members.
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 0001d9a..5d61f39 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -2290,7 +2290,7 @@ coff_find_nearest_line_with_names (bfd *abfd,
   /* Also try examining DWARF2 debugging information.  */
   if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset,
 				     filename_ptr, functionname_ptr,
-				     line_ptr, NULL, debug_sections, 0,
+				     line_ptr, NULL, debug_sections,
 				     &coff_data(abfd)->dwarf2_find_line_info))
     return TRUE;
 
@@ -2330,7 +2330,7 @@ coff_find_nearest_line_with_names (bfd *abfd,
 	  && _bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section,
 					    offset + bias,
 					    filename_ptr, functionname_ptr,
-					    line_ptr, NULL, debug_sections, 0,
+					    line_ptr, NULL, debug_sections,
 					    &coff_data(abfd)->dwarf2_find_line_info))
 	return TRUE;
     }
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 65c4161..9cbd81d 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -4531,7 +4531,6 @@ _bfd_dwarf2_find_symbol_bias (asymbol ** symbols, void ** pinfo)
    NULL the FUNCTIONNAME_PTR is also filled in.
    SYMBOLS contains the symbol table for ABFD.
    DEBUG_SECTIONS contains the name of the dwarf debug sections.
-   ADDR_SIZE is the number of bytes in the initial .debug_info length
    field and in the abbreviation offset, or zero to indicate that the
    default value should be used.  */
 
@@ -4546,7 +4545,6 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
 			       unsigned int *linenumber_ptr,
 			       unsigned int *discriminator_ptr,
 			       const struct dwarf_debug_section *debug_sections,
-			       unsigned int addr_size,
 			       void **pinfo)
 {
   /* Read each compilation unit from the section .debug_info, and check
@@ -4727,18 +4725,11 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
 	}
     }
 
-  /* The DWARF2 spec says that the initial length field, and the
-     offset of the abbreviation table, should both be 4-byte values.
-     However, some compilers do things differently.  */
-  if (addr_size == 0)
-    addr_size = 4;
-  BFD_ASSERT (addr_size == 4 || addr_size == 8);
-
   /* Read each remaining comp. units checking each as they are read.  */
   while (stash->info_ptr < stash->info_ptr_end)
     {
       bfd_vma length;
-      unsigned int offset_size = addr_size;
+      unsigned int offset_size;
       bfd_byte *info_ptr_unit = stash->info_ptr;
 
       length = read_4_bytes (stash->bfd_ptr, stash->info_ptr, stash->info_ptr_end);
@@ -4768,13 +4759,11 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
 	   b) if they do use 64-bit offsets but they are not using
 	      the size hints that are tested for above then they are
 	      not conforming to the DWARF3 standard anyway.  */
-      else if (addr_size == 8)
+      else
 	{
 	  offset_size = 4;
 	  stash->info_ptr += 4;
 	}
-      else
-	stash->info_ptr += 4;
 
       if (length > 0)
 	{
diff --git a/bfd/elf.c b/bfd/elf.c
index 6b5d12c..42ae162 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -8972,7 +8972,7 @@ _bfd_elf_find_nearest_line (bfd *abfd,
   if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset,
 				     filename_ptr, functionname_ptr,
 				     line_ptr, discriminator_ptr,
-				     dwarf_debug_sections, 0,
+				     dwarf_debug_sections,
 				     &elf_tdata (abfd)->dwarf2_find_line_info)
       || _bfd_dwarf1_find_nearest_line (abfd, symbols, section, offset,
 					filename_ptr, functionname_ptr,
@@ -9012,7 +9012,7 @@ _bfd_elf_find_line (bfd *abfd, asymbol **symbols, asymbol *symbol,
 {
   return _bfd_dwarf2_find_nearest_line (abfd, symbols, symbol, NULL, 0,
 					filename_ptr, NULL, line_ptr, NULL,
-					dwarf_debug_sections, 0,
+					dwarf_debug_sections,
 					&elf_tdata (abfd)->dwarf2_find_line_info);
 }
 
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 15591be..f1895df 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -16112,7 +16112,7 @@ elf32_arm_find_nearest_line (bfd *	    abfd,
   if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset,
 				     filename_ptr, functionname_ptr,
 				     line_ptr, discriminator_ptr,
-				     dwarf_debug_sections, 0,
+				     dwarf_debug_sections,
 				     & elf_tdata (abfd)->dwarf2_find_line_info))
     {
       if (!*functionname_ptr)
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 6810483..4908601 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -1467,7 +1467,7 @@ elf64_alpha_find_nearest_line (bfd *abfd, asymbol **symbols,
   if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset,
 				     filename_ptr, functionname_ptr,
 				     line_ptr, discriminator_ptr,
-				     dwarf_debug_sections, 0,
+				     dwarf_debug_sections,
 				     &elf_tdata (abfd)->dwarf2_find_line_info))
     return TRUE;
 
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index ba9e97c..4e6cbc9 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -8040,7 +8040,7 @@ elfNN_aarch64_find_nearest_line (bfd *abfd,
   if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset,
 				     filename_ptr, functionname_ptr,
 				     line_ptr, discriminator_ptr,
-				     dwarf_debug_sections, 0,
+				     dwarf_debug_sections,
 				     &elf_tdata (abfd)->dwarf2_find_line_info))
     {
       if (!*functionname_ptr)
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index e845c90..e305404 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -13084,7 +13084,6 @@ _bfd_mips_elf_find_nearest_line (bfd *abfd, asymbol **symbols,
 				     filename_ptr, functionname_ptr,
 				     line_ptr, discriminator_ptr,
 				     dwarf_debug_sections,
-				     ABI_64_P (abfd) ? 8 : 0,
 				     &elf_tdata (abfd)->dwarf2_find_line_info)
       || _bfd_dwarf1_find_nearest_line (abfd, symbols, section, offset,
 					filename_ptr, functionname_ptr,
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index 4d87687..7a97dfa 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -588,7 +588,7 @@ extern const struct dwarf_debug_section dwarf_debug_sections[] ATTRIBUTE_HIDDEN;
 extern bfd_boolean _bfd_dwarf2_find_nearest_line
   (bfd *, asymbol **, asymbol *, asection *, bfd_vma,
    const char **, const char **, unsigned int *, unsigned int *,
-   const struct dwarf_debug_section *, unsigned int, void **) ATTRIBUTE_HIDDEN;
+   const struct dwarf_debug_section *, void **) ATTRIBUTE_HIDDEN;
 
 /* Find the bias between DWARF addresses and real addresses.  */
 extern bfd_signed_vma _bfd_dwarf2_find_symbol_bias
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index fd45595..13f4c5b 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -593,7 +593,7 @@ extern const struct dwarf_debug_section dwarf_debug_sections[] ATTRIBUTE_HIDDEN;
 extern bfd_boolean _bfd_dwarf2_find_nearest_line
   (bfd *, asymbol **, asymbol *, asection *, bfd_vma,
    const char **, const char **, unsigned int *, unsigned int *,
-   const struct dwarf_debug_section *, unsigned int, void **) ATTRIBUTE_HIDDEN;
+   const struct dwarf_debug_section *, void **) ATTRIBUTE_HIDDEN;
 
 /* Find the bias between DWARF addresses and real addresses.  */
 extern bfd_signed_vma _bfd_dwarf2_find_symbol_bias
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 4e64086..d023980 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -5985,7 +5985,7 @@ bfd_mach_o_find_nearest_line (bfd *abfd,
   return _bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset,
 					filename_ptr, functionname_ptr,
 					line_ptr, discriminator_ptr,
-					dwarf_debug_sections, 0,
+					dwarf_debug_sections,
 					&mdata->dwarf2_find_line_info);
 }



More information about the Binutils-cvs mailing list