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]

ppc64 struct confusion


This uses the correct struct when calculating sh_size.  The existing
code gets the correct value only because sizeof Elf_Internal_Rela
happens to be the same as sizeof Elf64_External_Rela.

	* elf64-ppc.c (ppc_build_one_stub): Correct rel_hdr.sh_size.

Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.266
diff -u -p -r1.266 elf64-ppc.c
--- bfd/elf64-ppc.c	8 Sep 2007 13:46:15 -0000	1.266
+++ bfd/elf64-ppc.c	26 Sep 2007 00:59:10 -0000
@@ -8317,8 +8317,9 @@ ppc_build_one_stub (struct bfd_hash_entr
 	      if (relocs == NULL)
 		return FALSE;
 	      elfsec_data->relocs = relocs;
-	      elfsec_data->rel_hdr.sh_size = relsize;
-	      elfsec_data->rel_hdr.sh_entsize = 24;
+	      elfsec_data->rel_hdr.sh_size = (stub_entry->stub_sec->reloc_count
+					      * sizeof (Elf64_External_Rela));
+	      elfsec_data->rel_hdr.sh_entsize = sizeof (Elf64_External_Rela);
 	      stub_entry->stub_sec->reloc_count = 0;
 	    }
 	  r = relocs + stub_entry->stub_sec->reloc_count;
@@ -8415,8 +8416,9 @@ ppc_build_one_stub (struct bfd_hash_entr
 	      if (relocs == NULL)
 		return FALSE;
 	      elfsec_data->relocs = relocs;
-	      elfsec_data->rel_hdr.sh_size = relsize;
-	      elfsec_data->rel_hdr.sh_entsize = 24;
+	      elfsec_data->rel_hdr.sh_size = (stub_entry->stub_sec->reloc_count
+					      * sizeof (Elf64_External_Rela));
+	      elfsec_data->rel_hdr.sh_entsize = sizeof (Elf64_External_Rela);
 	      htab->brlt->reloc_count = 0;
 	    }
 	  r = relocs + htab->brlt->reloc_count;

-- 
Alan Modra
Australia Development Lab, IBM


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