This is the mail archive of the binutils@sourceware.cygnus.com 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]

patch for bfd/dwarf2.c, support for 16-bit addresses in DWARF-2


Hi!

The following patch for bfd/dwarf2.c fixes the support of dwarf2 for 16-bit
address targets. All we have to do is accept the address size of 2 and read
it accordingly.

Can you integrate this fix ?

Thanks,
	Stephane

2000-02-22  Stephane Carrez  <stcarrez@worldnet.fr>

	* dwarf2.c (parse_comp_unit): Accept addr_size == 2.
	(read_address): Recognize addr_size == 2 for 16-bits targets.
--- /src/gnu/cygnus/binutils/bfd/dwarf2.c	Wed Jul 14 10:49:38 1999
+++ bfd/dwarf2.c	Mon Feb 21 21:02:34 2000
@@ -341,9 +341,15 @@ read_address (unit, buf)
   if (unit->addr_size == 4)
     {
       retval = bfd_get_32 (unit->abfd, (bfd_byte *) buf);
-    } else {
+    }
+  else if (unit->addr_size == 8)
+    {
       retval = bfd_get_64 (unit->abfd, (bfd_byte *) buf);
     }
+  else
+    {
+      retval = bfd_get_16 (unit->abfd, (bfd_byte *) buf);
+    }
   return retval;
 }
 
@@ -1277,9 +1283,9 @@ parse_comp_unit (abfd, info_ptr, end_ptr
       return 0;
     }
 
-  if (addr_size != 4 && addr_size != 8)
+  if (addr_size != 4 && addr_size != 8 && addr_size != 2)
     {
-      (*_bfd_error_handler) ("Dwarf Error: found address size '%u', this reader can only handle address sizes '4' and '8'.", addr_size );
+      (*_bfd_error_handler) ("Dwarf Error: found address size '%u', this reader can only handle address sizes '2' '4' and '8'.", addr_size );
       bfd_set_error (bfd_error_bad_value);
       return 0;
     }

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