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 ARM linker segfaults in VFP erratum fix code


This patch fixes ARM linker segfaults in the VFP erratum fix code.
This code should only process normal relocatable objects being linked,
not executables, shared libraries or objects being used with -R.  (The
original observed problem was linking klibc, which involves -R.)

Tested with no regressions with cross to arm-none-eabi.  OK to commit?

2009-01-29  Julian Brown  <julian@codesourcery.com>

	* elf32-arm.c (bfd_elf32_arm_vfp11_erratum_scan): Skip BFDs with
	EXEC_P or DYNAMIC flags, and skip sections which are being linked
	with --just-symbols (-R).

Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.169
diff -u -r1.169 elf32-arm.c
--- bfd/elf32-arm.c	28 Jan 2009 16:35:12 -0000	1.169
+++ bfd/elf32-arm.c	29 Jan 2009 13:42:14 -0000
@@ -4998,6 +4998,10 @@
   if (globals->vfp11_fix == BFD_ARM_VFP11_FIX_NONE)
     return TRUE;
 
+  /* Skip this BFD if it corresponds to an executable or dynamic object.  */
+  if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
+    return TRUE;
+
   for (sec = abfd->sections; sec != NULL; sec = sec->next)
     {
       unsigned int i, span, first_fmac = 0, veneer_of_insn = 0;
@@ -5008,6 +5012,8 @@
       if (elf_section_type (sec) != SHT_PROGBITS
           || (elf_section_flags (sec) & SHF_EXECINSTR) == 0
           || (sec->flags & SEC_EXCLUDE) != 0
+	  || sec->sec_info_type == ELF_INFO_TYPE_JUST_SYMS
+	  || sec->output_section == bfd_abs_section_ptr
           || strcmp (sec->name, VFP11_ERRATUM_VENEER_SECTION_NAME) == 0)
         continue;
 

-- 
Joseph S. Myers
joseph@codesourcery.com


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