diff options
author | Jeff Law <law@redhat.com> | 1994-02-26 00:39:03 +0000 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 1994-02-26 00:39:03 +0000 |
commit | d643978558037f6c74cb1180732283994fe83504 (patch) | |
tree | 71d8f8f87ae394f133e5071a9e066fbe676ebba3 /bfd/elfcode.h | |
parent | 531a5bd1896a9dff68428dc252cb4602ab1bdc02 (diff) | |
download | gdb-d643978558037f6c74cb1180732283994fe83504.zip gdb-d643978558037f6c74cb1180732283994fe83504.tar.gz gdb-d643978558037f6c74cb1180732283994fe83504.tar.bz2 |
* som.c (som_get_symtab_upper_bound): Use "sizeof (asymbol *)"
not "sizeof (som_symbol_type *)".
* elfcode.h (elf_get_symtab_upper_bound): Use "sizeof (asymbol *)"
not "sizeof (asymbol"). Opps.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r-- | bfd/elfcode.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h index b515853..b298763 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -2742,7 +2742,7 @@ DEFUN (elf_get_symtab_upper_bound, (abfd), bfd * abfd) Elf_Internal_Shdr *hdr = &elf_tdata(abfd)->symtab_hdr; symcount = hdr->sh_size / sizeof (Elf_External_Sym); - symtab_size = (symcount - 1 + 1) * (sizeof (asymbol)); + symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *)); return symtab_size; } @@ -3549,6 +3549,7 @@ DEFUN (elf_core_file_p, (abfd), bfd * abfd) Elf_External_Phdr x_phdr; /* Program header table entry, external form */ Elf_Internal_Phdr *i_phdrp; /* Program header table, internal form */ unsigned int phindex; + struct elf_backend_data *ebd; /* Read in the ELF header in external format. */ @@ -3621,6 +3622,35 @@ DEFUN (elf_core_file_p, (abfd), bfd * abfd) elf_debug_file (i_ehdrp); #endif + ebd = get_elf_backend_data (abfd); + + /* Check that the ELF e_machine field matches what this particular + BFD format expects. */ + if (ebd->elf_machine_code != i_ehdrp->e_machine) + { + bfd_target **target_ptr; + + if (ebd->elf_machine_code != EM_NONE) + goto wrong; + + /* This is the generic ELF target. Let it match any ELF target + for which we do not have a specific backend. */ + for (target_ptr = bfd_target_vector; *target_ptr != NULL; target_ptr++) + { + struct elf_backend_data *back; + + if ((*target_ptr)->flavour != bfd_target_elf_flavour) + continue; + back = (struct elf_backend_data *) (*target_ptr)->backend_data; + if (back->elf_machine_code == i_ehdrp->e_machine) + { + /* target_ptr is an ELF backend which matches this + object file, so reject the generic ELF target. */ + goto wrong; + } + } + } + /* If there is no program header, or the type is not a core file, then we are hosed. */ if (i_ehdrp->e_phoff == 0 || i_ehdrp->e_type != ET_CORE) |