From d643978558037f6c74cb1180732283994fe83504 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Sat, 26 Feb 1994 00:39:03 +0000 Subject: [PATCH] * 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. --- bfd/ChangeLog | 8 ++++++++ bfd/elfcode.h | 32 +++++++++++++++++++++++++++++++- bfd/som.c | 5 +++-- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9581f8c..e2ac849 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +Fri Feb 25 16:35:57 1994 Jeffrey A. Law (law@snake.cs.utah.edu) + + * 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. + Fri Feb 25 13:19:04 1994 Ted Lemon (mellon@pepper.ncd.com) * bfd.c (bfd_get_gp_size): Can't return gp value on an archive. 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) diff --git a/bfd/som.c b/bfd/som.c index 4a4fc01..df78f00 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -3190,7 +3190,8 @@ som_bfd_derive_misc_symbol_info (abfd, sym, info) for undefined or common symbols, but the HP linker will choke if it's not set to some "reasonable" value. We use zero as a reasonable value. */ - if (sym->section == &bfd_com_section || sym->section == &bfd_und_section) + if (sym->section == &bfd_com_section || sym->section == &bfd_und_section + || sym->section == &bfd_abs_section) info->symbol_info = 0; /* For all other symbols, the symbol_info field contains the subspace index of the space this symbol is contained in. */ @@ -3334,7 +3335,7 @@ som_get_symtab_upper_bound (abfd) if (!som_slurp_symbol_table (abfd)) return 0; - return (bfd_get_symcount (abfd) + 1) * (sizeof (som_symbol_type *)); + return (bfd_get_symcount (abfd) + 1) * (sizeof (asymbol *)); } /* Convert from a SOM subspace index to a BFD section. */ -- 2.7.4