This is the mail archive of the 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: arm backend crash when handling incompatible input file

On Thu, Dec 13, 2012 at 04:06:28PM -0800, Roland McGrath wrote:
> When the user makes the error of throwing an incompatible object (in my
> case, and i386 ELF file) into an ARM ELF link, ld generates the
> "architecture of input file is incompatible with arm output" error as it
> should.  But then it also crashes.
> The call chain is:
> 	main
> 	lang_process
> 	ldemul_after_allocation
> 	gldarmelf_after_allocation
> 	elf32_arm_size_stubs
> 	cortex_a8_erratum_scan
> It crashes because it's using elf32_arm_section_data on an input bfd that
> is not arm-flavored and so doesn't use that data structure.  Clearly it
> should be either bailing out entirely or skipping the nonmatching input bfd
> before it gets to this point.  But it's not entirely clear to me where that
> check should be made, nor what the proper method is to check for such
> mismatch.
> Suggestions?

Index: bfd/elf32-arm.c
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.303
diff -u -p -r1.303 elf32-arm.c
--- bfd/elf32-arm.c	16 Nov 2012 18:33:00 -0000	1.303
+++ bfd/elf32-arm.c	14 Dec 2012 01:08:31 -0000
@@ -4987,6 +4987,9 @@ elf32_arm_size_stubs (bfd *output_bfd,
 	  asection *section;
 	  Elf_Internal_Sym *local_syms = NULL;
+	  if (!is_arm_elf (input_bfd))
+	    continue;
 	  num_a8_relocs = 0;
 	  /* We'll need the symbol table in a second.  */

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]