From 6edfbbad08647691263c23151a75601a6c30d42f Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Thu, 6 Oct 2005 19:21:14 +0000 Subject: [PATCH] bfd/ * elf32-arm.c (elf32_arm_check_relocs): Avoid aliasing warnings from GCC. (elf32_arm_size_dynamic_sections): Likewise. * ecofflink.c (bfd_ecoff_debug_one_external): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_check_relocs): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. (elf_s390_size_dynamic_sections): Likewise. * elf32-sh.c (sh_elf_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs, dec_dynrel_count) (ppc64_elf_size_dynamic_sections): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. (elf_s390_size_dynamic_sections): Likewise. * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. * ieee.c (ieee_slurp_section_data): Likewise. * oasys.c (oasys_slurp_section_data): Likewise. opcodes/ * ppc-dis.c (struct dis_private): Remove. (powerpc_dialect): Avoid aliasing warnings. (print_insn_big_powerpc, print_insn_little_powerpc): Likewise. --- bfd/ChangeLog | 23 +++++++++++++++++++++++ bfd/ecofflink.c | 8 ++++++-- bfd/elf32-arm.c | 11 +++++------ bfd/elf32-hppa.c | 6 ++++-- bfd/elf32-m32r.c | 5 +++-- bfd/elf32-m68k.c | 6 ++++-- bfd/elf32-ppc.c | 6 ++++-- bfd/elf32-s390.c | 10 ++++------ bfd/elf32-sh.c | 5 +++-- bfd/elf64-ppc.c | 21 +++++++++++++-------- bfd/elf64-s390.c | 11 +++++------ bfd/elfxx-mips.c | 6 +++++- bfd/elfxx-sparc.c | 11 +++++------ bfd/ieee.c | 5 +++-- bfd/oasys.c | 6 ++++-- opcodes/ChangeLog | 6 ++++++ opcodes/ppc-dis.c | 11 +++-------- 17 files changed, 100 insertions(+), 57 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b46f869116b..a0a02c93ad0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,26 @@ +2005-10-06 Daniel Jacobowitz + + * elf32-arm.c (elf32_arm_check_relocs): Avoid aliasing warnings from + GCC. + (elf32_arm_size_dynamic_sections): Likewise. + * ecofflink.c (bfd_ecoff_debug_one_external): Likewise. + * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. + * elf32-m32r.c (m32r_elf_check_relocs): Likewise. + * elf32-m68k.c (elf_m68k_check_relocs): Likewise. + * elf32-ppc.c (ppc_elf_check_relocs): Likewise. + * elf32-s390.c (elf_s390_check_relocs): Likewise. + (elf_s390_size_dynamic_sections): Likewise. + * elf32-sh.c (sh_elf_check_relocs): Likewise. + * elf64-ppc.c (ppc64_elf_check_relocs, dec_dynrel_count) + (ppc64_elf_size_dynamic_sections): Likewise. + * elf64-s390.c (elf_s390_check_relocs): Likewise. + (elf_s390_size_dynamic_sections): Likewise. + * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. + (_bfd_sparc_elf_size_dynamic_sections): Likewise. + * ieee.c (ieee_slurp_section_data): Likewise. + * oasys.c (oasys_slurp_section_data): Likewise. + 2005-10-04 Bob Wilson * archive.c: Add missing SUBSECTION for documentation. diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c index c4663b72aa9..d7bb817f676 100644 --- a/bfd/ecofflink.c +++ b/bfd/ecofflink.c @@ -1338,10 +1338,14 @@ bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym) - (char *) debug->external_ext) < (symhdr->iextMax + 1) * external_ext_size) { - if (! ecoff_add_bytes ((char **) &debug->external_ext, - (char **) &debug->external_ext_end, + char *external_ext = debug->external_ext; + char *external_ext_end = debug->external_ext_end; + if (! ecoff_add_bytes ((char **) &external_ext, + (char **) &external_ext_end, (symhdr->iextMax + 1) * (size_t) external_ext_size)) return FALSE; + debug->external_ext = external_ext; + debug->external_ext_end = external_ext_end; } esym->asym.iss = symhdr->issExtMax; diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 6bace7a9c71..b9024e9f1a1 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -5118,13 +5118,15 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, easily. Oh well. */ asection *s; + void *vpp; + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (s == NULL) return FALSE; - head = ((struct elf32_arm_relocs_copied **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct elf32_arm_relocs_copied **) vpp; } p = *head; @@ -5785,10 +5787,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, { struct elf32_arm_relocs_copied *p; - for (p = *((struct elf32_arm_relocs_copied **) - &elf_section_data (s)->local_dynrel); - p != NULL; - p = p->next) + for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next) { if (!bfd_is_abs_section (p->section) && bfd_is_abs_section (p->section->output_section)) diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 7f20bd6aa23..942b376cf9f 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1446,13 +1446,15 @@ elf32_hppa_check_relocs (bfd *abfd, easily. Oh well. */ asection *sr; + void *vpp; + sr = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (sr == NULL) return FALSE; - hdh_head = ((struct elf32_hppa_dyn_reloc_entry **) - &elf_section_data (sr)->local_dynrel); + vpp = &elf_section_data (sr)->local_dynrel; + hdh_head = (struct elf32_hppa_dyn_reloc_entry **) vpp; } hdh_p = *hdh_head; diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index cb6716f3a4d..c26bebf73c4 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -3993,6 +3993,7 @@ m32r_elf_check_relocs (bfd *abfd, else { asection *s; + void *vpp; /* Track dynamic relocs needed for local syms too. */ s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, @@ -4000,8 +4001,8 @@ m32r_elf_check_relocs (bfd *abfd, if (s == NULL) return FALSE; - head = ((struct elf_m32r_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct elf_m32r_dyn_relocs **) vpp; } p = *head; diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 146a86d3120..589dccfb35d 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -745,14 +745,16 @@ elf_m68k_check_relocs (abfd, info, sec, relocs) else { asection *s; + void *vpp; + s = (bfd_section_from_r_symndx (abfd, &elf_m68k_hash_table (info)->sym_sec, sec, r_symndx)); if (s == NULL) return FALSE; - head = ((struct elf_m68k_pcrel_relocs_copied **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct elf_m68k_pcrel_relocs_copied **) vpp; } for (p = *head; p != NULL; p = p->next) diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index bfb1ee83905..2134af2c761 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -3469,13 +3469,15 @@ ppc_elf_check_relocs (bfd *abfd, easily. Oh well. */ asection *s; + void *vpp; + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (s == NULL) return FALSE; - head = ((struct ppc_elf_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct ppc_elf_dyn_relocs **) vpp; } p = *head; diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index a2433636ffc..55090c6a0c0 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1319,14 +1319,15 @@ elf_s390_check_relocs (abfd, info, sec, relocs) We really need local syms available to do this easily. Oh well. */ asection *s; + void *vpp; s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (s == NULL) return FALSE; - head = ((struct elf_s390_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct elf_s390_dyn_relocs **) vpp; } p = *head; @@ -2038,10 +2039,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) { struct elf_s390_dyn_relocs *p; - for (p = *((struct elf_s390_dyn_relocs **) - &elf_section_data (s)->local_dynrel); - p != NULL; - p = p->next) + for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next) { if (!bfd_is_abs_section (p->sec) && bfd_is_abs_section (p->sec->output_section)) diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index b2b7c6be918..abbee05c51c 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -6565,6 +6565,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, else { asection *s; + void *vpp; /* Track dynamic relocs needed for local syms too. */ s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, @@ -6572,8 +6573,8 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, if (s == NULL) return FALSE; - head = ((struct elf_sh_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct elf_sh_dyn_relocs **) vpp; } p = *head; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index f10af8b6ede..9bc2fcfbcf9 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -4767,13 +4767,15 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, easily. Oh well. */ asection *s; + void *vpp; + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (s == NULL) return FALSE; - head = ((struct ppc_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct ppc_dyn_relocs **) vpp; } p = *head; @@ -6119,9 +6121,15 @@ dec_dynrel_count (bfd_vma r_info, if (h != NULL) pp = &((struct ppc_link_hash_entry *) h)->dyn_relocs; else if (sym_sec != NULL) - pp = (struct ppc_dyn_relocs **) &elf_section_data (sym_sec)->local_dynrel; + { + void *vpp = &elf_section_data (sym_sec)->local_dynrel; + pp = (struct ppc_dyn_relocs **) vpp; + } else - pp = (struct ppc_dyn_relocs **) &elf_section_data (sec)->local_dynrel; + { + void *vpp = &elf_section_data (sec)->local_dynrel; + pp = (struct ppc_dyn_relocs **) vpp; + } while ((p = *pp) != NULL) { @@ -7638,10 +7646,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, { struct ppc_dyn_relocs *p; - for (p = *((struct ppc_dyn_relocs **) - &elf_section_data (s)->local_dynrel); - p != NULL; - p = p->next) + for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next) { if (!bfd_is_abs_section (p->sec) && bfd_is_abs_section (p->sec->output_section)) diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 1c5a5f73e9e..7808c3fd1a3 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -1285,13 +1285,15 @@ elf_s390_check_relocs (abfd, info, sec, relocs) easily. Oh well. */ asection *s; + void *vpp; + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (s == NULL) return FALSE; - head = ((struct elf_s390_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct elf_s390_dyn_relocs **) vpp; } p = *head; @@ -2009,10 +2011,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) { struct elf_s390_dyn_relocs *p; - for (p = *((struct elf_s390_dyn_relocs **) - &elf_section_data (s)->local_dynrel); - p != NULL; - p = p->next) + for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next) { if (!bfd_is_abs_section (p->sec) && bfd_is_abs_section (p->sec->output_section)) diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 28ada821c3f..27d2dc3854b 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -7638,7 +7638,11 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, break; case DT_MIPS_TIME_STAMP: - time ((time_t *) &dyn.d_un.d_val); + { + time_t t; + time (&t); + dyn.d_un.d_val = t; + } break; case DT_MIPS_ICHECKSUM: diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 264f2627af9..eff34eadf04 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -1381,13 +1381,15 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, easily. Oh well. */ asection *s; + void *vpp; + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (s == NULL) return FALSE; - head = ((struct _bfd_sparc_elf_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct _bfd_sparc_elf_dyn_relocs **) vpp; } p = *head; @@ -2071,10 +2073,7 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd, { struct _bfd_sparc_elf_dyn_relocs *p; - for (p = *((struct _bfd_sparc_elf_dyn_relocs **) - &elf_section_data (s)->local_dynrel); - p != NULL; - p = p->next) + for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next) { if (!bfd_is_abs_section (p->sec) && bfd_is_abs_section (p->sec->output_section)) diff --git a/bfd/ieee.c b/bfd/ieee.c index 3dca9b3e935..53e16e1c8e7 100644 --- a/bfd/ieee.c +++ b/bfd/ieee.c @@ -1666,14 +1666,15 @@ ieee_slurp_section_data (bfd *abfd) for (s = abfd->sections; s != (asection *) NULL; s = s->next) { ieee_per_section_type *per = ieee_per_section (s); + arelent **relpp; if ((s->flags & SEC_DEBUGGING) != 0) continue; per->data = bfd_alloc (ieee->h.abfd, s->size); if (!per->data) return FALSE; - per->reloc_tail_ptr = - (ieee_reloc_type **) & (s->relocation); + relpp = &s->relocation; + per->reloc_tail_ptr = (ieee_reloc_type **) relpp; } while (TRUE) diff --git a/bfd/oasys.c b/bfd/oasys.c index 2647f82f00c..74d2c310a03 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -384,11 +384,13 @@ oasys_slurp_section_data (bfd *const abfd) if (! per->initialized) { + arelent **relpp; + per->data = bfd_zalloc (abfd, section->size); if (!per->data) return FALSE; - per->reloc_tail_ptr - = (oasys_reloc_type **) §ion->relocation; + relpp = §ion->relocation; + per->reloc_tail_ptr = (oasys_reloc_type **) relpp; per->had_vma = FALSE; per->initialized = TRUE; section->reloc_count = 0; diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 7f20b71917f..1f8f8b55a4b 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,9 @@ +2005-10-06 Daniel Jacobowitz + + * ppc-dis.c (struct dis_private): Remove. + (powerpc_dialect): Avoid aliasing warnings. + (print_insn_big_powerpc, print_insn_little_powerpc): Likewise. + 2005-09-30 Nick Clifton * po/ga.po: New Irish translation. diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c index 19efc142188..35875d1ac33 100644 --- a/opcodes/ppc-dis.c +++ b/opcodes/ppc-dis.c @@ -32,11 +32,6 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, US static int print_insn_powerpc (bfd_vma, struct disassemble_info *, int, int); -struct dis_private { - /* Stash the result of parsing disassembler_options here. */ - int dialect; -}; - /* Determine which set of machines to disassemble for. PPC403/601 or BookE. For convenience, also disassemble instructions supported by the AltiVec vector unit. */ @@ -90,7 +85,7 @@ powerpc_dialect (struct disassemble_info *info) dialect |= PPC_OPCODE_64; } - ((struct dis_private *) &info->private_data)->dialect = dialect; + info->private_data = (char *) 0 + dialect; return dialect; } @@ -99,7 +94,7 @@ powerpc_dialect (struct disassemble_info *info) int print_insn_big_powerpc (bfd_vma memaddr, struct disassemble_info *info) { - int dialect = ((struct dis_private *) &info->private_data)->dialect; + int dialect = (char *) info->private_data - (char *) 0; return print_insn_powerpc (memaddr, info, 1, dialect); } @@ -108,7 +103,7 @@ print_insn_big_powerpc (bfd_vma memaddr, struct disassemble_info *info) int print_insn_little_powerpc (bfd_vma memaddr, struct disassemble_info *info) { - int dialect = ((struct dis_private *) &info->private_data)->dialect; + int dialect = (char *) info->private_data - (char *) 0; return print_insn_powerpc (memaddr, info, 0, dialect); } -- 2.30.2