[RFA] elfcore.h: Set arch before processing phdrs

Jason R Thorpe thorpej@wasabisystems.com
Sun Jan 27 13:45:00 GMT 2002


The following change fixes a problem reading NetBSD ELF core files
on Alpha and SPARC systems.

OK to commit?

	* elfcore.h (elf_core_file_p): Set the machine architecture
	before processing the program headers.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>
-------------- next part --------------
Index: elfcore.h
===================================================================
RCS file: /cvs/src/src/bfd/elfcore.h,v
retrieving revision 1.11
diff -c -r1.11 elfcore.h
*** elfcore.h	2001/12/18 07:12:19	1.11
--- elfcore.h	2002/01/27 20:17:58
***************
*** 220,237 ****
        elf_swap_phdr_in (abfd, &x_phdr, i_phdrp + phindex);
      }
  
-   /* Process each program header.  */
-   for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
-     {
-       if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, (int) phindex))
- 	goto fail;
-     }
- 
    /* Set the machine architecture.  */
    if (! bfd_default_set_arch_mach (abfd, ebd->arch, 0))
      {
        /* It's OK if this fails for the generic target.  */
        if (ebd->elf_machine_code != EM_NONE)
  	goto fail;
      }
  
--- 220,237 ----
        elf_swap_phdr_in (abfd, &x_phdr, i_phdrp + phindex);
      }
  
    /* Set the machine architecture.  */
    if (! bfd_default_set_arch_mach (abfd, ebd->arch, 0))
      {
        /* It's OK if this fails for the generic target.  */
        if (ebd->elf_machine_code != EM_NONE)
+ 	goto fail;
+     }
+ 
+   /* Process each program header.  */
+   for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
+     {
+       if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, (int) phindex))
  	goto fail;
      }
  


More information about the Binutils mailing list