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]

fill ppc476 fixup area


This quiets a scanner we use to look for possible 476 problems in
binaries.  The scanner was giving a false positive warning about the
fixup code area on a few binaries, due to filling the fixup area with
zeros.  Now it would be a little disconcerting if the fixups really
did trigger a failure (they don't!), so fill with a pattern that the
scanner knows is safe.

I've attached a tar file containing backports of the complete 476
linker workaround for various older binutils versions.

	* elf32-ppc.c (ppc_elf_relocate_section): Fill 476 fixup area
	with "ba 0" rather than zeros.

diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 8492732..ae68b5d 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -9225,8 +9225,20 @@ ppc_elf_relocate_section (bfd *output_bfd,
 
       relax_info = elf_section_data (input_section)->sec_info;
       if (relax_info->workaround_size != 0)
-	memset (contents + input_section->size - relax_info->workaround_size,
-		0, relax_info->workaround_size);
+	{
+	  bfd_byte *p;
+	  unsigned int n;
+	  bfd_byte fill[4];
+
+	  bfd_put_32 (input_bfd, BA, fill);
+	  p = contents + input_section->size - relax_info->workaround_size;
+	  n = relax_info->workaround_size >> 2;
+	  while (n--)
+	    {
+	      memcpy (p, fill, 4);
+	      p += 4;
+	    }
+	}
 
       /* The idea is: Replace the last instruction on a page with a
 	 branch to a patch area.  Put the insn there followed by a

-- 
Alan Modra
Australia Development Lab, IBM

Attachment: backport476w.tar.gz
Description: Binary data


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