- To: msnyder at cygnus dot com
- Subject: arch_diff
- From: msnyder at cygnus dot com
- Date: Thu, 4 May 2000 13:43:05 -0700 (PDT)
Index: elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.29
diff -p -r1.29 elf.c
*** elf.c 2000/05/02 17:51:36 1.29
--- elf.c 2000/05/04 20:42:14
*************** elf_fake_sections (abfd, asect, failedpt
*** 1752,1757 ****
--- 1752,1773 ----
*failedptr = true;
}
+ /* Get elf arch size (32 / 64).
+ Returns -1 if not elf. */
+
+ int
+ bfd_elf_get_arch_size (abfd)
+ bfd *abfd;
+ {
+ if (abfd->xvec->flavour != bfd_target_elf_flavour)
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return -1;
+ }
+
+ return (get_elf_backend_data (abfd))->s->arch_size;
+ }
+
/* Assign all ELF section numbers. The dummy first section is handled here
too. The link/info pointers for the standard section types are filled
in here too, while we're at it. */
*************** assign_section_numbers (abfd)
*** 1764,1770 ****
asection *sec;
unsigned int section_number;
Elf_Internal_Shdr **i_shdrp;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
section_number = 1;
--- 1780,1785 ----
*************** assign_section_numbers (abfd)
*** 1899,1905 ****
/* This is a .stab section. */
elf_section_data (s)->this_hdr.sh_entsize =
! 4 + 2 * (bed->s->arch_size / 8);
}
}
break;
--- 1914,1920 ----
/* This is a .stab section. */
elf_section_data (s)->this_hdr.sh_entsize =
! 4 + 2 * bfd_elf_get_arch_size (abfd) / 8;
}
}
break;
*************** prep_headers (abfd)
*** 3226,3232 ****
i_ehdrp->e_machine = EM_NONE;
break;
case bfd_arch_sparc:
! if (bed->s->arch_size == 64)
i_ehdrp->e_machine = EM_SPARCV9;
else
i_ehdrp->e_machine = EM_SPARC;
--- 3241,3247 ----
i_ehdrp->e_machine = EM_NONE;
break;
case bfd_arch_sparc:
! if (bfd_elf_get_arch_size (abfd) == 64)
i_ehdrp->e_machine = EM_SPARCV9;
else
i_ehdrp->e_machine = EM_SPARC;
Index: bfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in.h,v
retrieving revision 1.10
diff -p -r1.10 bfd-in.h
*** bfd-in.h 2000/04/29 00:56:29 1.10
--- bfd-in.h 2000/05/04 20:42:14
*************** extern long bfd_get_elf_phdr_upper_bound
*** 640,645 ****
--- 640,648 ----
error occurs; bfd_get_error will return an appropriate code. */
extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
+ /* Return the arch_size field of an elf bfd, or -1 if not elf. */
+ extern int bfd_elf_get_arch_size PARAMS ((bfd *));
+
/* SunOS shared library support routines for the linker. */
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
Index: bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.44
diff -p -r1.44 bfd-in2.h
*** bfd-in2.h 2000/04/29 00:56:29 1.44
--- bfd-in2.h 2000/05/04 20:42:15
*************** extern long bfd_get_elf_phdr_upper_bound
*** 640,645 ****
--- 640,648 ----
error occurs; bfd_get_error will return an appropriate code. */
extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
+ /* Return the arch_size field of an elf bfd, or -1 if not elf. */
+ extern int bfd_elf_get_arch_size PARAMS ((bfd *));
+
/* SunOS shared library support routines for the linker. */
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list