aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2005-03-21 11:22:37 +0000
committerAlan Modra <amodra@gmail.com>2005-03-21 11:22:37 +0000
commit7fb4ace8672af1ce9765ebbc2c21762bec30221d (patch)
tree97b6c954c163cb6d14a600b66cd7307befd2cc5c
parent6601f5430ddf2a27153851735735321049b0f429 (diff)
downloadgdb-7fb4ace8672af1ce9765ebbc2c21762bec30221d.zip
gdb-7fb4ace8672af1ce9765ebbc2c21762bec30221d.tar.gz
gdb-7fb4ace8672af1ce9765ebbc2c21762bec30221d.tar.bz2
* elf32-ppc.c (is_ppc_elf_target): New function.
(ppc_elf_merge_private_bfd_data): Use it rather than just testing for bfd_target_elf_flavour. Do this test before endian check. (ppc_elf_add_symbol_hook): Use is_pcc_elf_target. (ppc_elf_size_dynamic_sections): Likewise.
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf32-ppc.c24
2 files changed, 25 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 3bbd61f..c123f10 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2005-03-21 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (is_ppc_elf_target): New function.
+ (ppc_elf_merge_private_bfd_data): Use it rather than just testing
+ for bfd_target_elf_flavour. Do this test before endian check.
+ (ppc_elf_add_symbol_hook): Use is_pcc_elf_target.
+ (ppc_elf_size_dynamic_sections): Likewise.
+
2005-03-17 Paul Brook <paul@codesourcery.com>
Dan Jacobowitz <dan@codesourcery.com>
Mark Mitchell <mark@codesourcery.com>
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 0866e46..b4c56e6 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2218,6 +2218,17 @@ ppc_elf_set_private_flags (bfd *abfd, flagword flags)
return TRUE;
}
+/* Return 1 if target is one of ours. */
+
+static bfd_boolean
+is_ppc_elf_target (const struct bfd_target *targ)
+{
+ extern const bfd_target bfd_elf32_powerpc_vec;
+ extern const bfd_target bfd_elf32_powerpcle_vec;
+
+ return targ == &bfd_elf32_powerpc_vec || targ == &bfd_elf32_powerpcle_vec;
+}
+
/* Merge backend specific data from an object file to the output
object file when linking. */
@@ -2228,14 +2239,14 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
flagword new_flags;
bfd_boolean error;
+ if (!is_ppc_elf_target (ibfd->xvec)
+ || !is_ppc_elf_target (obfd->xvec))
+ return TRUE;
+
/* Check if we have the same endianess. */
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
return FALSE;
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return TRUE;
-
new_flags = elf_elfheader (ibfd)->e_flags;
old_flags = elf_elfheader (obfd)->e_flags;
if (!elf_flags_init (obfd))
@@ -3296,7 +3307,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
Elf_Internal_Shdr *symtab_hdr;
asection *srel;
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
+ if (!is_ppc_elf_target (ibfd->xvec))
continue;
for (s = ibfd->sections; s != NULL; s = s->next)
@@ -4368,8 +4379,7 @@ ppc_elf_add_symbol_hook (bfd *abfd,
if (sym->st_shndx == SHN_COMMON
&& !info->relocatable
&& sym->st_size <= elf_gp_size (abfd)
- && (info->hash->creator == abfd->xvec
- || info->hash->creator == abfd->xvec->alternative_target))
+ && is_ppc_elf_target (info->hash->creator))
{
/* Common symbols less than or equal to -G nn bytes are automatically
put into .sbss. */