diff options
author | Michael Snyder <msnyder@vmware.com> | 2000-05-05 18:12:53 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2000-05-05 18:12:53 +0000 |
commit | 3425c182982bf3458d0bc152c89117a6393a5196 (patch) | |
tree | a379f1682851ce6964e342c5feda3b7b03d1ebb2 /bfd | |
parent | 318b21ef35b29746252ca0b6e998b305471ae01f (diff) | |
download | gdb-3425c182982bf3458d0bc152c89117a6393a5196.zip gdb-3425c182982bf3458d0bc152c89117a6393a5196.tar.gz gdb-3425c182982bf3458d0bc152c89117a6393a5196.tar.bz2 |
2000-05-04 Michael Snyder <msnyder@seadog.cygnus.com>
* elf.c (bfd_elf_get_arch_size): New function, return 32 | 64 | -1.
* bfd-in.h: Prototype bfd_elf_get_arch_size.
* bfd-in2.h: Prototype bfd_elf_get_arch_size.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/bfd-in.h | 3 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 3 | ||||
-rw-r--r-- | bfd/elf.c | 21 |
4 files changed, 30 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4eb0fee..a5b3fc6 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2000-05-04 Michael Snyder <msnyder@seadog.cygnus.com> + + * elf.c (bfd_elf_get_arch_size): New function, return 32 | 64 | -1. + * bfd-in.h: Prototype bfd_elf_get_arch_size. + * bfd-in2.h: Prototype bfd_elf_get_arch_size. + 2000-05-04 Alan Modra <alan@linuxcare.com.au> * libhppa.h (HPPA_R_CONSTANT): Cast argument to bfd_signed_vma. diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 127d961..dc172bf 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -640,6 +640,9 @@ extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd)); 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 diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 8d89199..01d735f 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -640,6 +640,9 @@ extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd)); 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 @@ -1752,6 +1752,22 @@ elf_fake_sections (abfd, asect, failedptrarg) *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. */ @@ -1764,7 +1780,6 @@ assign_section_numbers (abfd) asection *sec; unsigned int section_number; Elf_Internal_Shdr **i_shdrp; - struct elf_backend_data *bed = get_elf_backend_data (abfd); section_number = 1; @@ -1899,7 +1914,7 @@ assign_section_numbers (abfd) /* This is a .stab section. */ elf_section_data (s)->this_hdr.sh_entsize = - 4 + 2 * (bed->s->arch_size / 8); + 4 + 2 * bfd_elf_get_arch_size (abfd) / 8; } } break; @@ -3226,7 +3241,7 @@ prep_headers (abfd) i_ehdrp->e_machine = EM_NONE; break; case bfd_arch_sparc: - if (bed->s->arch_size == 64) + if (bfd_elf_get_arch_size (abfd) == 64) i_ehdrp->e_machine = EM_SPARCV9; else i_ehdrp->e_machine = EM_SPARC; |