This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] coff: add casts for _bfd_error_handler


Hi,

while debugging an ill-formed xcoff object file, I got incomplete errors from bfd because of a missing cast.
On the host (ppc/aix) bfd_signed_vma is 64 bits while long in 32 bits and ppc is big endian.
Therefore, the symbol index was always 0 in:
           (*_bfd_error_handler)
                (_("%B: warning: illegal symbol index %ld in line numbers"),

No testcase as this can only be triggered by ill-formed binaries.

(I suppose this issue is present at other places, but I haven't reviewed all the code ;-)

Ok for mainline ?

Tristan.

bfd/
2010-08-30  Tristan Gingold  <gingold@adacore.com>

	* coffcode.h (coff_slurp_line_table): Add a cast.
	(coff_slurp_reloc_table): Ditto.


diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index ad35e32..19bc870 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -4487,7 +4487,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
            {
              (*_bfd_error_handler)
                (_("%B: warning: illegal symbol index %ld in line numbers"),
-                abfd, dst.l_addr.l_symndx);
+                abfd, (long)symndx);
              symndx = 0;
              warned = TRUE;
            }
@@ -5123,7 +5123,7 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol
            {
              (*_bfd_error_handler)
                (_("%B: warning: illegal symbol index %ld in relocs"),
-                abfd, dst.r_symndx);
+                abfd, (long)dst.r_symndx);
              cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
              ptr = NULL;
            }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]