aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-06-27 11:29:15 +0000
committerAlan Modra <amodra@gmail.com>2002-06-27 11:29:15 +0000
commitfeee612b24c47ca30fa6efc2e31ca28ff0887ce9 (patch)
tree87f700c6c287105064a523f27ce790e51f2e7341 /bfd/elf64-ppc.c
parent6aa4d13aab46b82a55e4849891f103a1743ba289 (diff)
downloadgdb-feee612b24c47ca30fa6efc2e31ca28ff0887ce9.zip
gdb-feee612b24c47ca30fa6efc2e31ca28ff0887ce9.tar.gz
gdb-feee612b24c47ca30fa6efc2e31ca28ff0887ce9.tar.bz2
* cpu-powerpc.c: Comment on ordering of arch_info.
* elf32-ppc.c (ppc_elf_object_p): New function. (elf_backend_object_p): Define. * elf64-ppc.c (ppc64_elf_object_p): New function. (elf_backend_object_p): Define.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 9d798ef..ac52ae1 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -57,6 +57,8 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static void ppc64_elf_get_symbol_info
PARAMS ((bfd *, asymbol *, symbol_info *));
+static boolean ppc64_elf_object_p
+ PARAMS ((bfd *));
static boolean ppc64_elf_set_private_flags
PARAMS ((bfd *, flagword));
static boolean ppc64_elf_merge_private_bfd_data
@@ -1649,6 +1651,27 @@ ppc64_elf_get_symbol_info (abfd, symbol, ret)
ret->type = (symbol->flags & BSF_GLOBAL) != 0 ? 'D' : 'd';
}
+/* Fix bad default arch selected for a 64 bit input bfd when the
+ default is 32 bit. */
+
+static boolean
+ppc64_elf_object_p (abfd)
+ bfd *abfd;
+{
+ if (abfd->arch_info->the_default && abfd->arch_info->bits_per_word == 32)
+ {
+ Elf_Internal_Ehdr *i_ehdr = elf_elfheader (abfd);
+
+ if (i_ehdr->e_ident[EI_CLASS] == ELFCLASS64)
+ {
+ /* Relies on arch after 32 bit default being 64 bit default. */
+ abfd->arch_info = abfd->arch_info->next;
+ BFD_ASSERT (abfd->arch_info->bits_per_word == 64);
+ }
+ }
+ return true;
+}
+
/* Function to set whether a module needs the -mrelocatable bit set. */
static boolean
@@ -6140,6 +6163,7 @@ ppc64_elf_finish_dynamic_sections (output_bfd, info)
#define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free
#define bfd_elf64_get_symbol_info ppc64_elf_get_symbol_info
+#define elf_backend_object_p ppc64_elf_object_p
#define elf_backend_section_from_shdr ppc64_elf_section_from_shdr
#define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections
#define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol