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]

Fix for PR4454, no .eh_frame_hdr table on hppa


Applying.

	PR 4454
	* elf-eh-frame.c (struct cie): Make "personality" a bfd_vma.
	(_bfd_elf_discard_section_eh_frame): Handle local syms on
	personality relocation.

Index: bfd/elf-eh-frame.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
retrieving revision 1.56
diff -u -p -r1.56 elf-eh-frame.c
--- bfd/elf-eh-frame.c	26 Apr 2007 14:46:56 -0000	1.56
+++ bfd/elf-eh-frame.c	8 May 2007 01:33:45 -0000
@@ -37,7 +37,7 @@ struct cie
   bfd_signed_vma data_align;
   bfd_vma ra_column;
   bfd_vma augmentation_size;
-  struct elf_link_hash_entry *personality;
+  bfd_vma personality;
   asection *output_sec;
   struct eh_cie_fde *cie_inf;
   unsigned char per_encoding;
@@ -675,6 +675,7 @@ _bfd_elf_discard_section_eh_frame
 		      if (GET_RELOC (buf) != NULL)
 			{
 			  unsigned long r_symndx;
+			  asection *sym_sec = NULL;
 
 #ifdef BFD64
 			  if (ptr_size == 8)
@@ -694,8 +695,34 @@ _bfd_elf_discard_section_eh_frame
 				h = (struct elf_link_hash_entry *)
 				    h->root.u.i.link;
 
-			      cie->personality = h;
+			      if (h->root.type == bfd_link_hash_defined
+				  || h->root.type == bfd_link_hash_defweak)
+				{
+				  cie->personality = h->root.u.def.value;
+				  sym_sec = h->root.u.def.section;
+				}
 			    }
+			  else
+			    {
+			      Elf_Internal_Shdr *symtab_hdr;
+			      Elf_Internal_Sym *sym;
+
+			      symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+			      sym = bfd_elf_get_elf_syms (abfd, symtab_hdr,
+							  1, r_symndx,
+							  NULL, NULL, NULL);
+			      if (sym != NULL)
+				{
+				  cie->personality = sym->st_value;
+				  sym_sec = (bfd_section_from_elf_index
+					     (abfd, sym->st_shndx));
+				  free (sym);
+				}
+			    }
+			  if (sym_sec != NULL)
+			    cie->personality += (sym_sec->output_section->vma
+						 + sym_sec->output_offset);
+
 			  /* Cope with MIPS-style composite relocations.  */
 			  do
 			    cookie->rel++;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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