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]

Re: report ppc32 reloc errors


On Tue, Jun 24, 2003 at 11:48:49PM +0930, Alan Modra wrote:
> 	* elf32-ppc.c (ppc_elf_check_relocs): Report plt reloc against
> 	local sym errors.

Err, didn't test the new error message very well.  ppc_elf_howto_table
full of zeros results in a segfault.

	* elf32-ppc.c (ppc_elf_howto_table): Remove unnecessary cast.
	(ppc_elf_reloc_type_lookup): Modify comment.
	(ppc_elf_info_to_howto): Ditto.
	(ppc_elf_relocate_section): Ditto.
	(ppc_elf_check_relocs): Call ppc_elf_howto_init.

Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.87
diff -u -p -r1.87 elf32-ppc.c
--- bfd/elf32-ppc.c	25 Jun 2003 06:40:19 -0000	1.87
+++ bfd/elf32-ppc.c	25 Jun 2003 08:45:57 -0000
@@ -286,7 +286,7 @@ ppc_elf_copy_indirect_symbol (struct elf
     _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
 }
 
-static reloc_howto_type *ppc_elf_howto_table[(int) R_PPC_max];
+static reloc_howto_type *ppc_elf_howto_table[R_PPC_max];
 
 static reloc_howto_type ppc_elf_howto_raw[] = {
   /* This reloc does nothing.  */
@@ -1830,8 +1830,8 @@ ppc_elf_reloc_type_lookup (bfd *abfd ATT
 {
   enum elf_ppc_reloc_type r;
 
+  /* Initialize howto table if not already done.  */
   if (!ppc_elf_howto_table[R_PPC_ADDR32])
-    /* Initialize howto table if needed.  */
     ppc_elf_howto_init ();
 
   switch (code)
@@ -1932,8 +1932,8 @@ ppc_elf_info_to_howto (bfd *abfd ATTRIBU
 		       arelent *cache_ptr,
 		       Elf_Internal_Rela *dst)
 {
+  /* Initialize howto table if not already done.  */
   if (!ppc_elf_howto_table[R_PPC_ADDR32])
-    /* Initialize howto table if needed.  */
     ppc_elf_howto_init ();
 
   BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_PPC_max);
@@ -3094,9 +3094,12 @@ ppc_elf_check_relocs (bfd *abfd,
 	   bfd_archive_filename (abfd));
 #endif
 
+  /* Initialize howto table if not already done.  */
+  if (!ppc_elf_howto_table[R_PPC_ADDR32])
+    ppc_elf_howto_init ();
+
   /* Create the linker generated sections all the time so that the
      special symbols are created.  */
-
   htab = ppc_elf_hash_table (info);
   if (htab->sdata == NULL)
     {
@@ -4201,8 +4204,8 @@ ppc_elf_relocate_section (bfd *output_bf
   if (info->relocatable)
     return TRUE;
 
+  /* Initialize howto table if not already done.  */
   if (!ppc_elf_howto_table[R_PPC_ADDR32])
-    /* Initialize howto table if needed.  */
     ppc_elf_howto_init ();
 
   htab = ppc_elf_hash_table (info);

-- 
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]