This is the mail archive of the binutils@sources.redhat.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]
Other format: [Raw text]

[patch] Dwarf3 CIE format


The patch below adds binutils support for dwarf3 fortam CIE frame debug 
entries.

Tested on i686-linux and cross to arm-none-elf.
Ok?

Paul

2004-05-12  Paul Brook  <paul@codesourcery.com>

	* bfd/eh-frame.c (_bfd_elf_discard_section_eh_frame): Handle dwarf3
	format CIE entries.
	* binutils/readelf.c (display_debug_frames): Ditto.
	* gas/dw2gencfi.c (output_cie): Ditto.
	(fde_entry): Change return_column to unsigned.
	(cie_entry): Ditto.

? bfd/doc/bfdint.html
? ld/ldint.html
Index: bfd/elf-eh-frame.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
retrieving revision 1.28
diff -u -p -r1.28 elf-eh-frame.c
--- bfd/elf-eh-frame.c	28 Feb 2004 00:35:45 -0000	1.28
+++ bfd/elf-eh-frame.c	12 May 2004 11:59:33 -0000
@@ -410,7 +410,7 @@ _bfd_elf_discard_section_eh_frame
 	  cie.version = *buf++;
 
 	  /* Cannot handle unknown versions.  */
-	  if (cie.version != 1)
+	  if (cie.version != 1 && cie.version != 3)
 	    goto free_no_table;
 	  if (strlen (buf) > sizeof (cie.augmentation) - 1)
 	    goto free_no_table;
@@ -434,7 +434,10 @@ _bfd_elf_discard_section_eh_frame
 	     ports this will not matter as the value will be less than 128.
 	     For the others (eg FRV, SH, MMIX, IA64) they need a fixed GCC
 	     which conforms to the DWARF3 standard.  */
-	  read_uleb128 (cie.ra_column, buf);
+	  if (cie.version == 1)
+	    cie.ra_column = *buf++;
+	  else
+	    read_uleb128 (cie.ra_column, buf);
 	  ENSURE_NO_RELOCS (buf);
 	  cie.lsda_encoding = DW_EH_PE_omit;
 	  cie.fde_encoding = DW_EH_PE_omit;
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.237
diff -u -p -r1.237 readelf.c
--- binutils/readelf.c	7 May 2004 15:33:36 -0000	1.237
+++ binutils/readelf.c	12 May 2004 11:59:39 -0000
@@ -8967,7 +8967,14 @@ display_debug_frames (Elf_Internal_Shdr 
 	    {
 	      fc->code_factor = LEB ();
 	      fc->data_factor = SLEB ();
-	      fc->ra = byte_get (start, 1); start += 1;
+	      if (version == 1)
+		{
+		  fc->ra = GET (1);
+		}
+	      else
+		{
+		  fc->ra = LEB ();
+		}
 	      augmentation_data_len = LEB ();
 	      augmentation_data = start;
 	      start += augmentation_data_len;
@@ -8977,13 +8984,27 @@ display_debug_frames (Elf_Internal_Shdr 
 	      start += addr_size;
 	      fc->code_factor = LEB ();
 	      fc->data_factor = SLEB ();
-	      fc->ra = byte_get (start, 1); start += 1;
+	      if (version == 1)
+		{
+		  fc->ra = GET (1);
+		}
+	      else
+		{
+		  fc->ra = LEB ();
+		}
 	    }
 	  else
 	    {
 	      fc->code_factor = LEB ();
 	      fc->data_factor = SLEB ();
-	      fc->ra = byte_get (start, 1); start += 1;
+	      if (version == 1)
+		{
+		  fc->ra = GET (1);
+		}
+	      else
+		{
+		  fc->ra = LEB ();
+		}
 	    }
 	  cie = fc;
 
Index: gas/dw2gencfi.c
===================================================================
RCS file: /cvs/src/src/gas/dw2gencfi.c,v
retrieving revision 1.16
diff -u -p -r1.16 dw2gencfi.c
--- gas/dw2gencfi.c	7 Mar 2004 08:51:20 -0000	1.16
+++ gas/dw2gencfi.c	12 May 2004 11:59:40 -0000
@@ -91,14 +91,14 @@ struct fde_entry
   symbolS *end_address;
   struct cfi_insn_data *data;
   struct cfi_insn_data **last;
-  unsigned int return_column;
+  unsigned return_column;
 };
 
 struct cie_entry
 {
   struct cie_entry *next;
   symbolS *start_address;
-  unsigned int return_column;
+  unsigned return_column;
   struct cfi_insn_data *first, *last;
 };
 
@@ -845,7 +845,10 @@ output_cie (struct cie_entry *cie)
   out_one (0);
   out_uleb128 (DWARF2_LINE_MIN_INSN_LENGTH);	/* Code alignment */
   out_sleb128 (DWARF2_CIE_DATA_ALIGNMENT);	/* Data alignment */
-  out_one (cie->return_column);			/* Return column */
+  if (DW_CIE_VERSION == 1)			/* Return column */
+    out_one (cie->return_column);
+  else
+    out_uleb128 (cie->return_column);
   out_uleb128 (1);				/* Augmentation size */
 #if defined DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr
   out_one (DW_EH_PE_pcrel | DW_EH_PE_sdata4);


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