Add -Wshadow to the gcc command line options used when compiling the binutils.

Fix up all warnings generated by the addition of this switch.
This commit is contained in:
Nick Clifton 2009-12-11 13:42:17 +00:00
parent 01fe1b4183
commit 91d6fa6a03
228 changed files with 4810 additions and 4648 deletions

View File

@ -1,3 +1,66 @@
2009-12-11 Nick Clifton <nickc@redhat.com>
* warning.m4 (GCC_WARN_CFLAGS): Add -Wshadow.
* configure: Regenerate.
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
* aout-arm.c: Fix shadowed variable warnings.
* aout-tic30.c: Likewise.
* aoutx.h: Likewise.
* archive.c: Likewise.
* coff-alpha.c: Likewise.
* coff-i386.c: Likewise.
* coff-x86_64.c: Likewise.
* coffgen.c: Likewise.
* dwarf2.c: Likewise.
* ecoff.c: Likewise.
* elf-eh-frame.c: Likewise.
* elf-m10300.c: Likewise.
* elf.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-avr.c: Likewise.
* elf32-bfin.c: Likewise.
* elf32-cr16.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-ip2k.c: Likewise.
* elf32-lm32.c: Likewise.
* elf32-m68hc1x.c: Likewise.
* elf32-microblaze.c: Likewise.
* elf32-ppc.c: Likewise.
* elf32-rx.c: Likewise.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elf32-sh.c: Likewise.
* elf32-spu.c: Likewise.
* elf32-v850.c: Likewise.
* elf32-xtensa.c: Likewise.
* elf64-hppa.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-x86-64.c: Likewise.
* elflink.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* elfxx-sparc.c: Likewise.
* hash.c: Likewise.
* ieee.c: Likewise.
* libbfd.c: Likewise.
* mach-o.c: Likewise.
* merge.c: Likewise.
* nlm32-sparc.c: Likewise.
* oasys.c: Likewise.
* opncls.c: Likewise.
* pdp11.c: Likewise.
* peXXigen.c: Likewise.
* pef.c: Likewise.
* versados.c: Likewise.
* vms-gsd.c: Likewise.
* vms-hdr.c: Likewise.
* vms-tir.c: Likewise.
* vms.c: Likewise.
* xcofflink.c: Likewise.
* xsym.c: Likewise.
* xtensa-isa.c: Likewise.
2009-12-10 Maciej W. Rozycki <macro@codesourcery.com> 2009-12-10 Maciej W. Rozycki <macro@codesourcery.com>
* elfxx-mips.c (mips_elf_calculate_relocation): Correct handling * elfxx-mips.c (mips_elf_calculate_relocation): Correct handling

View File

@ -49,6 +49,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \
$(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \ $(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \ $(top_srcdir)/../config/override.m4 \
@ -59,7 +60,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \ $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \ $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
$(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \ $(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in $(top_srcdir)/acinclude.m4 $(top_srcdir)/../config/zlib.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \

View File

@ -1,6 +1,6 @@
/* BFD back-end for raw ARM a.out binaries. /* BFD back-end for raw ARM a.out binaries.
Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005,
2007 Free Software Foundation, Inc. 2007, 2009 Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -102,7 +102,7 @@ MY (reloc_howto) (bfd *abfd,
unsigned int r_length; unsigned int r_length;
unsigned int r_pcrel_done; unsigned int r_pcrel_done;
unsigned int r_neg; unsigned int r_neg;
int index; int howto_index;
*r_pcrel = 0; *r_pcrel = 0;
if (bfd_header_big_endian (abfd)) if (bfd_header_big_endian (abfd))
@ -127,11 +127,11 @@ MY (reloc_howto) (bfd *abfd,
r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE)
>> RELOC_STD_BITS_LENGTH_SH_LITTLE); >> RELOC_STD_BITS_LENGTH_SH_LITTLE);
} }
index = r_length + 4 * r_pcrel_done + 8 * r_neg; howto_index = r_length + 4 * r_pcrel_done + 8 * r_neg;
if (index == 3) if (howto_index == 3)
*r_pcrel = 1; *r_pcrel = 1;
return MY (howto_table) + index; return MY (howto_table) + howto_index;
} }
#define MY_reloc_howto(BFD, REL, IN, EX, PC) \ #define MY_reloc_howto(BFD, REL, IN, EX, PC) \

View File

@ -296,7 +296,7 @@ tic30_aout_reloc_howto (bfd *abfd,
{ {
unsigned int r_length; unsigned int r_length;
unsigned int r_pcrel_done; unsigned int r_pcrel_done;
int index; int howto_index;
*r_pcrel = 0; *r_pcrel = 0;
if (bfd_header_big_endian (abfd)) if (bfd_header_big_endian (abfd))
@ -313,8 +313,8 @@ tic30_aout_reloc_howto (bfd *abfd,
r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) >> RELOC_STD_BITS_LENGTH_SH_LITTLE); r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) >> RELOC_STD_BITS_LENGTH_SH_LITTLE);
} }
index = r_length + 4 * r_pcrel_done; howto_index = r_length + 4 * r_pcrel_done;
return tic30_aout_howto_table + index; return tic30_aout_howto_table + howto_index;
} }
/* These macros will get 24-bit values from the bfd definition. /* These macros will get 24-bit values from the bfd definition.

View File

@ -1808,7 +1808,7 @@ add_to_stringtab (bfd *abfd,
bfd_boolean copy) bfd_boolean copy)
{ {
bfd_boolean hash; bfd_boolean hash;
bfd_size_type index; bfd_size_type str_index;
/* An index of 0 always means the empty string. */ /* An index of 0 always means the empty string. */
if (str == 0 || *str == '\0') if (str == 0 || *str == '\0')
@ -1820,14 +1820,14 @@ add_to_stringtab (bfd *abfd,
if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0) if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
hash = FALSE; hash = FALSE;
index = _bfd_stringtab_add (tab, str, hash, copy); str_index = _bfd_stringtab_add (tab, str, hash, copy);
if (index != (bfd_size_type) -1) if (str_index != (bfd_size_type) -1)
/* Add BYTES_IN_WORD to the return value to account for the /* Add BYTES_IN_WORD to the return value to account for the
space taken up by the string table size. */ space taken up by the string table size. */
index += BYTES_IN_WORD; str_index += BYTES_IN_WORD;
return index; return str_index;
} }
/* Write out a strtab. ABFD is already at the right location in the /* Write out a strtab. ABFD is already at the right location in the

View File

@ -354,15 +354,15 @@ _bfd_find_nested_archive (bfd *arch_bfd, const char *filename)
static char * static char *
get_extended_arelt_filename (bfd *arch, const char *name, file_ptr *originp) get_extended_arelt_filename (bfd *arch, const char *name, file_ptr *originp)
{ {
unsigned long index = 0; unsigned long table_index = 0;
const char *endp; const char *endp;
/* Should extract string so that I can guarantee not to overflow into /* Should extract string so that I can guarantee not to overflow into
the next region, but I'm too lazy. */ the next region, but I'm too lazy. */
errno = 0; errno = 0;
/* Skip first char, which is '/' in SVR4 or ' ' in some other variants. */ /* Skip first char, which is '/' in SVR4 or ' ' in some other variants. */
index = strtol (name + 1, (char **) &endp, 10); table_index = strtol (name + 1, (char **) &endp, 10);
if (errno != 0 || index >= bfd_ardata (arch)->extended_names_size) if (errno != 0 || table_index >= bfd_ardata (arch)->extended_names_size)
{ {
bfd_set_error (bfd_error_malformed_archive); bfd_set_error (bfd_error_malformed_archive);
return NULL; return NULL;
@ -383,7 +383,7 @@ get_extended_arelt_filename (bfd *arch, const char *name, file_ptr *originp)
else else
*originp = 0; *originp = 0;
return bfd_ardata (arch)->extended_names + index; return bfd_ardata (arch)->extended_names + table_index;
} }
/* This functions reads an arch header and returns an areltdata pointer, or /* This functions reads an arch header and returns an areltdata pointer, or
@ -656,14 +656,14 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
} }
/* Return the BFD which is referenced by the symbol in ABFD indexed by /* Return the BFD which is referenced by the symbol in ABFD indexed by
INDEX. INDEX should have been returned by bfd_get_next_mapent. */ SYM_INDEX. SYM_INDEX should have been returned by bfd_get_next_mapent. */
bfd * bfd *
_bfd_generic_get_elt_at_index (bfd *abfd, symindex index) _bfd_generic_get_elt_at_index (bfd *abfd, symindex sym_index)
{ {
carsym *entry; carsym *entry;
entry = bfd_ardata (abfd)->symdefs + index; entry = bfd_ardata (abfd)->symdefs + sym_index;
return _bfd_get_elt_at_filepos (abfd, entry->file_offset); return _bfd_get_elt_at_filepos (abfd, entry->file_offset);
} }

View File

@ -2272,13 +2272,11 @@ alpha_ecoff_openr_next_archived_file (archive, last_file)
/* Open the archive file given an index into the armap. */ /* Open the archive file given an index into the armap. */
static bfd * static bfd *
alpha_ecoff_get_elt_at_index (abfd, index) alpha_ecoff_get_elt_at_index (bfd *abfd, symindex sym_index)
bfd *abfd;
symindex index;
{ {
carsym *entry; carsym *entry;
entry = bfd_ardata (abfd)->symdefs + index; entry = bfd_ardata (abfd)->symdefs + sym_index;
return alpha_ecoff_get_elt_at_filepos (abfd, entry->file_offset); return alpha_ecoff_get_elt_at_filepos (abfd, entry->file_offset);
} }

View File

@ -532,16 +532,16 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
osect_vma = h->root.u.def.section->output_section->vma; osect_vma = h->root.u.def.section->output_section->vma;
else else
{ {
asection *sec; asection *s;
int i; int i;
/* Sigh, the only way to get the section to offset against /* Sigh, the only way to get the section to offset against
is to find it the hard way. */ is to find it the hard way. */
for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++) for (s = abfd->sections, i = 1; i < sym->n_scnum; i++)
sec = sec->next; s = s->next;
osect_vma = sec->output_section->vma; osect_vma = s->output_section->vma;
} }
*addendp -= osect_vma; *addendp -= osect_vma;

View File

@ -621,15 +621,15 @@ coff_amd64_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
osect_vma = h->root.u.def.section->output_section->vma; osect_vma = h->root.u.def.section->output_section->vma;
else else
{ {
asection *sec; asection *s;
int i; int i;
/* Sigh, the only way to get the section to offset against /* Sigh, the only way to get the section to offset against
is to find it the hard way. */ is to find it the hard way. */
for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++) for (s = abfd->sections, i = 1; i < sym->n_scnum; i++)
sec = sec->next; s = s->next;
osect_vma = sec->output_section->vma; osect_vma = s->output_section->vma;
} }
*addendp -= osect_vma; *addendp -= osect_vma;

View File

@ -307,20 +307,20 @@ coff_object_p (bfd *abfd)
/* Get the BFD section from a COFF symbol section number. */ /* Get the BFD section from a COFF symbol section number. */
asection * asection *
coff_section_from_bfd_index (bfd *abfd, int index) coff_section_from_bfd_index (bfd *abfd, int section_index)
{ {
struct bfd_section *answer = abfd->sections; struct bfd_section *answer = abfd->sections;
if (index == N_ABS) if (section_index == N_ABS)
return bfd_abs_section_ptr; return bfd_abs_section_ptr;
if (index == N_UNDEF) if (section_index == N_UNDEF)
return bfd_und_section_ptr; return bfd_und_section_ptr;
if (index == N_DEBUG) if (section_index == N_DEBUG)
return bfd_abs_section_ptr; return bfd_abs_section_ptr;
while (answer) while (answer)
{ {
if (answer->target_index == index) if (answer->target_index == section_index)
return answer; return answer;
answer = answer->next; answer = answer->next;
} }

2
bfd/configure vendored
View File

@ -12013,7 +12013,7 @@ fi
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow"
# Check whether --enable-werror was given. # Check whether --enable-werror was given.
if test "${enable_werror+set}" = set; then : if test "${enable_werror+set}" = set; then :

View File

@ -46,6 +46,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \
$(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \ $(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \ $(top_srcdir)/../config/override.m4 \
@ -56,7 +57,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \ $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \ $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
$(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \ $(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in $(top_srcdir)/acinclude.m4 $(top_srcdir)/../config/zlib.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs

View File

@ -1468,16 +1468,13 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
line_ptr += 2; line_ptr += 2;
break; break;
default: default:
{ /* Unknown standard opcode, ignore it. */
int i; for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++)
{
/* Unknown standard opcode, ignore it. */ (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++) line_ptr += bytes_read;
{ }
(void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read); break;
line_ptr += bytes_read;
}
}
} }
} }
@ -2469,7 +2466,6 @@ place_sections (bfd *abfd, struct dwarf2_debug *stash)
asection *sect; asection *sect;
bfd_vma last_vma = 0, last_dwarf = 0; bfd_vma last_vma = 0, last_dwarf = 0;
bfd_size_type amt; bfd_size_type amt;
struct adjusted_section *p;
i = 0; i = 0;
for (sect = abfd->sections; sect != NULL; sect = sect->next) for (sect = abfd->sections; sect != NULL; sect = sect->next)

View File

@ -2677,7 +2677,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
else else
{ {
const char *name; const char *name;
unsigned int i; unsigned int j;
static struct static struct
{ {
const char * name; const char * name;
@ -2704,14 +2704,14 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
name = bfd_get_section_name (abfd, bfd_get_section (sym)); name = bfd_get_section_name (abfd, bfd_get_section (sym));
for (i = 0; i < ARRAY_SIZE (section_symndx); i++) for (j = 0; j < ARRAY_SIZE (section_symndx); j++)
if (streq (name, section_symndx[i].name)) if (streq (name, section_symndx[j].name))
{ {
in.r_symndx = section_symndx[i].r_symndx; in.r_symndx = section_symndx[j].r_symndx;
break; break;
} }
if (i == ARRAY_SIZE (section_symndx)) if (j == ARRAY_SIZE (section_symndx))
abort (); abort ();
in.r_extern = 0; in.r_extern = 0;
} }

View File

@ -1629,7 +1629,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
if (ent->set_loc) if (ent->set_loc)
{ {
/* Adjust DW_CFA_set_loc. */ /* Adjust DW_CFA_set_loc. */
unsigned int cnt, width; unsigned int cnt;
bfd_vma new_offset; bfd_vma new_offset;
width = get_DW_EH_PE_width (ent->fde_encoding, ptr_size); width = get_DW_EH_PE_width (ent->fde_encoding, ptr_size);
@ -1639,7 +1639,6 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
for (cnt = 1; cnt <= ent->set_loc[0]; cnt++) for (cnt = 1; cnt <= ent->set_loc[0]; cnt++)
{ {
bfd_vma value;
buf = start + ent->set_loc[cnt]; buf = start + ent->set_loc[cnt];
value = read_value (abfd, buf, width, value = read_value (abfd, buf, width,

View File

@ -1274,8 +1274,6 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
&& ELF_ST_VISIBILITY (h->other) != STV_HIDDEN && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN
&& h->plt.offset != (bfd_vma) -1) && h->plt.offset != (bfd_vma) -1)
{ {
asection * splt;
splt = bfd_get_section_by_name (dynobj, ".plt"); splt = bfd_get_section_by_name (dynobj, ".plt");
value = (splt->output_section->vma value = (splt->output_section->vma
@ -1297,8 +1295,6 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
&& ELF_ST_VISIBILITY (h->other) != STV_HIDDEN && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN
&& h->plt.offset != (bfd_vma) -1) && h->plt.offset != (bfd_vma) -1)
{ {
asection * splt;
splt = bfd_get_section_by_name (dynobj, ".plt"); splt = bfd_get_section_by_name (dynobj, ".plt");
value = (splt->output_section->vma value = (splt->output_section->vma
@ -1321,8 +1317,6 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
case R_MN10300_GOT24: case R_MN10300_GOT24:
case R_MN10300_GOT16: case R_MN10300_GOT16:
{ {
asection * sgot;
sgot = bfd_get_section_by_name (dynobj, ".got"); sgot = bfd_get_section_by_name (dynobj, ".got");
if (h != NULL) if (h != NULL)

View File

@ -734,18 +734,18 @@ _bfd_elf_setup_sections (bfd *abfd)
} }
else else
{ {
asection *link = NULL; asection *linksec = NULL;
if (elfsec < elf_numsections (abfd)) if (elfsec < elf_numsections (abfd))
{ {
this_hdr = elf_elfsections (abfd)[elfsec]; this_hdr = elf_elfsections (abfd)[elfsec];
link = this_hdr->bfd_section; linksec = this_hdr->bfd_section;
} }
/* PR 1991, 2008: /* PR 1991, 2008:
Some strip/objcopy may leave an incorrect value in Some strip/objcopy may leave an incorrect value in
sh_link. We don't want to proceed. */ sh_link. We don't want to proceed. */
if (link == NULL) if (linksec == NULL)
{ {
(*_bfd_error_handler) (*_bfd_error_handler)
(_("%B: sh_link [%d] in section `%A' is incorrect"), (_("%B: sh_link [%d] in section `%A' is incorrect"),
@ -753,7 +753,7 @@ _bfd_elf_setup_sections (bfd *abfd)
result = FALSE; result = FALSE;
} }
elf_linked_to_section (s) = link; elf_linked_to_section (s) = linksec;
} }
} }
} }
@ -1961,11 +1961,11 @@ bfd_sym_from_r_symndx (struct sym_cache *cache,
section. */ section. */
asection * asection *
bfd_section_from_elf_index (bfd *abfd, unsigned int index) bfd_section_from_elf_index (bfd *abfd, unsigned int sec_index)
{ {
if (index >= elf_numsections (abfd)) if (sec_index >= elf_numsections (abfd))
return NULL; return NULL;
return elf_elfsections (abfd)[index]->bfd_section; return elf_elfsections (abfd)[sec_index]->bfd_section;
} }
static const struct bfd_elf_special_section special_sections_b[] = static const struct bfd_elf_special_section special_sections_b[] =
@ -2266,7 +2266,7 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec)
bfd_boolean bfd_boolean
_bfd_elf_make_section_from_phdr (bfd *abfd, _bfd_elf_make_section_from_phdr (bfd *abfd,
Elf_Internal_Phdr *hdr, Elf_Internal_Phdr *hdr,
int index, int hdr_index,
const char *type_name) const char *type_name)
{ {
asection *newsect; asection *newsect;
@ -2281,7 +2281,7 @@ _bfd_elf_make_section_from_phdr (bfd *abfd,
if (hdr->p_filesz > 0) if (hdr->p_filesz > 0)
{ {
sprintf (namebuf, "%s%d%s", type_name, index, split ? "a" : ""); sprintf (namebuf, "%s%d%s", type_name, hdr_index, split ? "a" : "");
len = strlen (namebuf) + 1; len = strlen (namebuf) + 1;
name = (char *) bfd_alloc (abfd, len); name = (char *) bfd_alloc (abfd, len);
if (!name) if (!name)
@ -2317,7 +2317,7 @@ _bfd_elf_make_section_from_phdr (bfd *abfd,
{ {
bfd_vma align; bfd_vma align;
sprintf (namebuf, "%s%d%s", type_name, index, split ? "b" : ""); sprintf (namebuf, "%s%d%s", type_name, hdr_index, split ? "b" : "");
len = strlen (namebuf) + 1; len = strlen (namebuf) + 1;
name = (char *) bfd_alloc (abfd, len); name = (char *) bfd_alloc (abfd, len);
if (!name) if (!name)
@ -2356,51 +2356,51 @@ _bfd_elf_make_section_from_phdr (bfd *abfd,
} }
bfd_boolean bfd_boolean
bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index) bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int hdr_index)
{ {
const struct elf_backend_data *bed; const struct elf_backend_data *bed;
switch (hdr->p_type) switch (hdr->p_type)
{ {
case PT_NULL: case PT_NULL:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "null"); return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "null");
case PT_LOAD: case PT_LOAD:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "load"); return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "load");
case PT_DYNAMIC: case PT_DYNAMIC:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "dynamic"); return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "dynamic");
case PT_INTERP: case PT_INTERP:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "interp"); return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "interp");
case PT_NOTE: case PT_NOTE:
if (! _bfd_elf_make_section_from_phdr (abfd, hdr, index, "note")) if (! _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "note"))
return FALSE; return FALSE;
if (! elf_read_notes (abfd, hdr->p_offset, hdr->p_filesz)) if (! elf_read_notes (abfd, hdr->p_offset, hdr->p_filesz))
return FALSE; return FALSE;
return TRUE; return TRUE;
case PT_SHLIB: case PT_SHLIB:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "shlib"); return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "shlib");
case PT_PHDR: case PT_PHDR:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "phdr"); return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "phdr");
case PT_GNU_EH_FRAME: case PT_GNU_EH_FRAME:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index,
"eh_frame_hdr"); "eh_frame_hdr");
case PT_GNU_STACK: case PT_GNU_STACK:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "stack"); return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "stack");
case PT_GNU_RELRO: case PT_GNU_RELRO:
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro"); return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "relro");
default: default:
/* Check for any processor-specific program segment types. */ /* Check for any processor-specific program segment types. */
bed = get_elf_backend_data (abfd); bed = get_elf_backend_data (abfd);
return bed->elf_backend_section_from_phdr (abfd, hdr, index, "proc"); return bed->elf_backend_section_from_phdr (abfd, hdr, hdr_index, "proc");
} }
} }
@ -2894,10 +2894,11 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
for (sec = abfd->sections; sec; sec = sec->next) for (sec = abfd->sections; sec; sec = sec->next)
{ {
struct bfd_elf_section_data *d = elf_section_data (sec);
asection *s; asection *s;
const char *name; const char *name;
d = elf_section_data (sec);
i_shdrp[d->this_idx] = &d->this_hdr; i_shdrp[d->this_idx] = &d->this_hdr;
if (d->rel_idx != 0) if (d->rel_idx != 0)
i_shdrp[d->rel_idx] = &d->rel_hdr; i_shdrp[d->rel_idx] = &d->rel_hdr;
@ -3860,7 +3861,8 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
&& CONST_STRNEQ (s->name, ".note")) && CONST_STRNEQ (s->name, ".note"))
{ {
asection *s2; asection *s2;
unsigned count = 1;
count = 1;
amt = sizeof (struct elf_segment_map); amt = sizeof (struct elf_segment_map);
if (s->alignment_power == 2) if (s->alignment_power == 2)
for (s2 = s; s2->next != NULL; s2 = s2->next) for (s2 = s; s2->next != NULL; s2 = s2->next)
@ -3903,8 +3905,6 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
/* If there are any SHF_TLS output sections, add PT_TLS segment. */ /* If there are any SHF_TLS output sections, add PT_TLS segment. */
if (tls_count > 0) if (tls_count > 0)
{ {
int i;
amt = sizeof (struct elf_segment_map); amt = sizeof (struct elf_segment_map);
amt += (tls_count - 1) * sizeof (asection *); amt += (tls_count - 1) * sizeof (asection *);
m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
@ -3916,7 +3916,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
/* Mandated PF_R. */ /* Mandated PF_R. */
m->p_flags = PF_R; m->p_flags = PF_R;
m->p_flags_valid = 1; m->p_flags_valid = 1;
for (i = 0; i < tls_count; ++i) for (i = 0; i < (unsigned int) tls_count; ++i)
{ {
BFD_ASSERT (first_tls->flags & SEC_THREAD_LOCAL); BFD_ASSERT (first_tls->flags & SEC_THREAD_LOCAL);
m->sections[i] = first_tls; m->sections[i] = first_tls;
@ -5042,34 +5042,34 @@ unsigned int
_bfd_elf_section_from_bfd_section (bfd *abfd, struct bfd_section *asect) _bfd_elf_section_from_bfd_section (bfd *abfd, struct bfd_section *asect)
{ {
const struct elf_backend_data *bed; const struct elf_backend_data *bed;
unsigned int index; unsigned int sec_index;
if (elf_section_data (asect) != NULL if (elf_section_data (asect) != NULL
&& elf_section_data (asect)->this_idx != 0) && elf_section_data (asect)->this_idx != 0)
return elf_section_data (asect)->this_idx; return elf_section_data (asect)->this_idx;
if (bfd_is_abs_section (asect)) if (bfd_is_abs_section (asect))
index = SHN_ABS; sec_index = SHN_ABS;
else if (bfd_is_com_section (asect)) else if (bfd_is_com_section (asect))
index = SHN_COMMON; sec_index = SHN_COMMON;
else if (bfd_is_und_section (asect)) else if (bfd_is_und_section (asect))
index = SHN_UNDEF; sec_index = SHN_UNDEF;
else else
index = SHN_BAD; sec_index = SHN_BAD;
bed = get_elf_backend_data (abfd); bed = get_elf_backend_data (abfd);
if (bed->elf_backend_section_from_bfd_section) if (bed->elf_backend_section_from_bfd_section)
{ {
int retval = index; int retval = sec_index;
if ((*bed->elf_backend_section_from_bfd_section) (abfd, asect, &retval)) if ((*bed->elf_backend_section_from_bfd_section) (abfd, asect, &retval))
return retval; return retval;
} }
if (index == SHN_BAD) if (sec_index == SHN_BAD)
bfd_set_error (bfd_error_nonrepresentable_section); bfd_set_error (bfd_error_nonrepresentable_section);
return index; return sec_index;
} }
/* Given a BFD symbol, return the index in the ELF symbol table, or -1 /* Given a BFD symbol, return the index in the ELF symbol table, or -1
@ -9011,7 +9011,7 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd,
if (p->addend != 0) if (p->addend != 0)
{ {
char buf[30], *a; char buf[30], *a;
int len;
memcpy (names, "+0x", sizeof ("+0x") - 1); memcpy (names, "+0x", sizeof ("+0x") - 1);
names += sizeof ("+0x") - 1; names += sizeof ("+0x") - 1;
bfd_sprintf_vma (abfd, buf, p->addend); bfd_sprintf_vma (abfd, buf, p->addend);

View File

@ -5693,7 +5693,7 @@ static enum bfd_arm_vfp11_pipe
bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs, bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
int *numregs) int *numregs)
{ {
enum bfd_arm_vfp11_pipe pipe = VFP11_BAD; enum bfd_arm_vfp11_pipe vpipe = VFP11_BAD;
bfd_boolean is_double = ((insn & 0xf00) == 0xb00) ? 1 : 0; bfd_boolean is_double = ((insn & 0xf00) == 0xb00) ? 1 : 0;
if ((insn & 0x0f000e10) == 0x0e000a00) /* A data-processing insn. */ if ((insn & 0x0f000e10) == 0x0e000a00) /* A data-processing insn. */
@ -5712,7 +5712,7 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
case 1: /* fnmac[sd]. */ case 1: /* fnmac[sd]. */
case 2: /* fmsc[sd]. */ case 2: /* fmsc[sd]. */
case 3: /* fnmsc[sd]. */ case 3: /* fnmsc[sd]. */
pipe = VFP11_FMAC; vpipe = VFP11_FMAC;
bfd_arm_vfp11_write_mask (destmask, fd); bfd_arm_vfp11_write_mask (destmask, fd);
regs[0] = fd; regs[0] = fd;
regs[1] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */ regs[1] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */
@ -5724,11 +5724,11 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
case 5: /* fnmul[sd]. */ case 5: /* fnmul[sd]. */
case 6: /* fadd[sd]. */ case 6: /* fadd[sd]. */
case 7: /* fsub[sd]. */ case 7: /* fsub[sd]. */
pipe = VFP11_FMAC; vpipe = VFP11_FMAC;
goto vfp_binop; goto vfp_binop;
case 8: /* fdiv[sd]. */ case 8: /* fdiv[sd]. */
pipe = VFP11_DS; vpipe = VFP11_DS;
vfp_binop: vfp_binop:
bfd_arm_vfp11_write_mask (destmask, fd); bfd_arm_vfp11_write_mask (destmask, fd);
regs[0] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */ regs[0] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */
@ -5758,14 +5758,14 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
case 27: /* ftosiz[sd]. */ case 27: /* ftosiz[sd]. */
/* These instructions will not bounce due to underflow. */ /* These instructions will not bounce due to underflow. */
*numregs = 0; *numregs = 0;
pipe = VFP11_FMAC; vpipe = VFP11_FMAC;
break; break;
case 3: /* fsqrt[sd]. */ case 3: /* fsqrt[sd]. */
/* fsqrt cannot underflow, but it can (perhaps) overwrite /* fsqrt cannot underflow, but it can (perhaps) overwrite
registers to cause the erratum in previous instructions. */ registers to cause the erratum in previous instructions. */
bfd_arm_vfp11_write_mask (destmask, fd); bfd_arm_vfp11_write_mask (destmask, fd);
pipe = VFP11_DS; vpipe = VFP11_DS;
break; break;
case 15: /* fcvt{ds,sd}. */ case 15: /* fcvt{ds,sd}. */
@ -5780,7 +5780,7 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
*numregs = rnum; *numregs = rnum;
pipe = VFP11_FMAC; vpipe = VFP11_FMAC;
} }
break; break;
@ -5810,7 +5810,7 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
} }
} }
pipe = VFP11_LS; vpipe = VFP11_LS;
} }
else if ((insn & 0x0e100e00) == 0x0c100a00) /* A load insn. */ else if ((insn & 0x0e100e00) == 0x0c100a00) /* A load insn. */
{ {
@ -5845,7 +5845,7 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
return VFP11_BAD; return VFP11_BAD;
} }
pipe = VFP11_LS; vpipe = VFP11_LS;
} }
/* Single-register transfer. Note L==0. */ /* Single-register transfer. Note L==0. */
else if ((insn & 0x0f100e10) == 0x0e000a10) else if ((insn & 0x0f100e10) == 0x0e000a10)
@ -5867,10 +5867,10 @@ bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
break; break;
} }
pipe = VFP11_LS; vpipe = VFP11_LS;
} }
return pipe; return vpipe;
} }
@ -5990,17 +5990,17 @@ bfd_elf32_arm_vfp11_erratum_scan (bfd *abfd, struct bfd_link_info *link_info)
| (contents[i + 1] << 8) | (contents[i + 1] << 8)
| contents[i]; | contents[i];
unsigned int writemask = 0; unsigned int writemask = 0;
enum bfd_arm_vfp11_pipe pipe; enum bfd_arm_vfp11_pipe vpipe;
switch (state) switch (state)
{ {
case 0: case 0:
pipe = bfd_arm_vfp11_insn_decode (insn, &writemask, regs, vpipe = bfd_arm_vfp11_insn_decode (insn, &writemask, regs,
&numregs); &numregs);
/* I'm assuming the VFP11 erratum can trigger with denorm /* I'm assuming the VFP11 erratum can trigger with denorm
operands on either the FMAC or the DS pipeline. This might operands on either the FMAC or the DS pipeline. This might
lead to slightly overenthusiastic veneer insertion. */ lead to slightly overenthusiastic veneer insertion. */
if (pipe == VFP11_FMAC || pipe == VFP11_DS) if (vpipe == VFP11_FMAC || vpipe == VFP11_DS)
{ {
state = use_vector ? 1 : 2; state = use_vector ? 1 : 2;
first_fmac = i; first_fmac = i;
@ -6011,10 +6011,10 @@ bfd_elf32_arm_vfp11_erratum_scan (bfd *abfd, struct bfd_link_info *link_info)
case 1: case 1:
{ {
int other_regs[3], other_numregs; int other_regs[3], other_numregs;
pipe = bfd_arm_vfp11_insn_decode (insn, &writemask, vpipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
other_regs, other_regs,
&other_numregs); &other_numregs);
if (pipe != VFP11_BAD if (vpipe != VFP11_BAD
&& bfd_arm_vfp11_antidependency (writemask, regs, && bfd_arm_vfp11_antidependency (writemask, regs,
numregs)) numregs))
state = 3; state = 3;
@ -6026,10 +6026,10 @@ bfd_elf32_arm_vfp11_erratum_scan (bfd *abfd, struct bfd_link_info *link_info)
case 2: case 2:
{ {
int other_regs[3], other_numregs; int other_regs[3], other_numregs;
pipe = bfd_arm_vfp11_insn_decode (insn, &writemask, vpipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
other_regs, other_regs,
&other_numregs); &other_numregs);
if (pipe != VFP11_BAD if (vpipe != VFP11_BAD
&& bfd_arm_vfp11_antidependency (writemask, regs, && bfd_arm_vfp11_antidependency (writemask, regs,
numregs)) numregs))
state = 3; state = 3;
@ -9044,9 +9044,9 @@ elf32_arm_relocate_section (bfd * output_bfd,
return TRUE; return TRUE;
} }
/* Add a new unwind edit to the list described by HEAD, TAIL. If INDEX is zero, /* Add a new unwind edit to the list described by HEAD, TAIL. If TINDEX is zero,
adds the edit to the start of the list. (The list must be built in order of adds the edit to the start of the list. (The list must be built in order of
ascending INDEX: the function's callers are primarily responsible for ascending TINDEX: the function's callers are primarily responsible for
maintaining that condition). */ maintaining that condition). */
static void static void
@ -9054,16 +9054,16 @@ add_unwind_table_edit (arm_unwind_table_edit **head,
arm_unwind_table_edit **tail, arm_unwind_table_edit **tail,
arm_unwind_edit_type type, arm_unwind_edit_type type,
asection *linked_section, asection *linked_section,
unsigned int index) unsigned int tindex)
{ {
arm_unwind_table_edit *new_edit = (arm_unwind_table_edit *) arm_unwind_table_edit *new_edit = (arm_unwind_table_edit *)
xmalloc (sizeof (arm_unwind_table_edit)); xmalloc (sizeof (arm_unwind_table_edit));
new_edit->type = type; new_edit->type = type;
new_edit->linked_section = linked_section; new_edit->linked_section = linked_section;
new_edit->index = index; new_edit->index = tindex;
if (index > 0) if (tindex > 0)
{ {
new_edit->next = NULL; new_edit->next = NULL;
@ -9173,8 +9173,7 @@ elf32_arm_fix_exidx_coverage (asection **text_section_order,
/* Walk all text sections in order of increasing VMA. Eilminate duplicate /* Walk all text sections in order of increasing VMA. Eilminate duplicate
index table entries (EXIDX_CANTUNWIND and inlined unwind opcodes), index table entries (EXIDX_CANTUNWIND and inlined unwind opcodes),
and add EXIDX_CANTUNWIND entries for sections with no unwind table data. and add EXIDX_CANTUNWIND entries for sections with no unwind table data. */
*/
for (i = 0; i < num_text_sections; i++) for (i = 0; i < num_text_sections; i++)
{ {
@ -13166,7 +13165,7 @@ make_branch_to_a8_stub (struct bfd_hash_entry *gen_entry,
bfd_vma veneered_insn_loc, veneer_entry_loc; bfd_vma veneered_insn_loc, veneer_entry_loc;
bfd_signed_vma branch_offset; bfd_signed_vma branch_offset;
bfd *abfd; bfd *abfd;
unsigned int index; unsigned int target;
stub_entry = (struct elf32_arm_stub_hash_entry *) gen_entry; stub_entry = (struct elf32_arm_stub_hash_entry *) gen_entry;
data = (struct a8_branch_to_stub_data *) in_arg; data = (struct a8_branch_to_stub_data *) in_arg;
@ -13191,7 +13190,7 @@ make_branch_to_a8_stub (struct bfd_hash_entry *gen_entry,
branch_offset = veneer_entry_loc - veneered_insn_loc - 4; branch_offset = veneer_entry_loc - veneered_insn_loc - 4;
abfd = stub_entry->target_section->owner; abfd = stub_entry->target_section->owner;
index = stub_entry->target_value; target = stub_entry->target_value;
/* We attempt to avoid this condition by setting stubs_always_after_branch /* We attempt to avoid this condition by setting stubs_always_after_branch
in elf32_arm_size_stubs if we've enabled the Cortex-A8 erratum workaround. in elf32_arm_size_stubs if we've enabled the Cortex-A8 erratum workaround.
@ -13252,8 +13251,8 @@ make_branch_to_a8_stub (struct bfd_hash_entry *gen_entry,
return FALSE; return FALSE;
} }
bfd_put_16 (abfd, (branch_insn >> 16) & 0xffff, &contents[index]); bfd_put_16 (abfd, (branch_insn >> 16) & 0xffff, &contents[target]);
bfd_put_16 (abfd, branch_insn & 0xffff, &contents[index + 2]); bfd_put_16 (abfd, branch_insn & 0xffff, &contents[target + 2]);
return TRUE; return TRUE;
} }
@ -13295,7 +13294,7 @@ elf32_arm_write_section (bfd *output_bfd,
for (errnode = arm_data->erratumlist; errnode != 0; for (errnode = arm_data->erratumlist; errnode != 0;
errnode = errnode->next) errnode = errnode->next)
{ {
bfd_vma index = errnode->vma - offset; bfd_vma target = errnode->vma - offset;
switch (errnode->type) switch (errnode->type)
{ {
@ -13308,7 +13307,7 @@ elf32_arm_write_section (bfd *output_bfd,
| 0x0a000000; | 0x0a000000;
/* The instruction is before the label. */ /* The instruction is before the label. */
index -= 4; target -= 4;
/* Above offset included in -4 below. */ /* Above offset included in -4 below. */
branch_to_veneer = errnode->u.b.veneer->vma branch_to_veneer = errnode->u.b.veneer->vma
@ -13320,10 +13319,10 @@ elf32_arm_write_section (bfd *output_bfd,
"range"), output_bfd); "range"), output_bfd);
insn |= (branch_to_veneer >> 2) & 0xffffff; insn |= (branch_to_veneer >> 2) & 0xffffff;
contents[endianflip ^ index] = insn & 0xff; contents[endianflip ^ target] = insn & 0xff;
contents[endianflip ^ (index + 1)] = (insn >> 8) & 0xff; contents[endianflip ^ (target + 1)] = (insn >> 8) & 0xff;
contents[endianflip ^ (index + 2)] = (insn >> 16) & 0xff; contents[endianflip ^ (target + 2)] = (insn >> 16) & 0xff;
contents[endianflip ^ (index + 3)] = (insn >> 24) & 0xff; contents[endianflip ^ (target + 3)] = (insn >> 24) & 0xff;
} }
break; break;
@ -13343,17 +13342,17 @@ elf32_arm_write_section (bfd *output_bfd,
/* Original instruction. */ /* Original instruction. */
insn = errnode->u.v.branch->u.b.vfp_insn; insn = errnode->u.v.branch->u.b.vfp_insn;
contents[endianflip ^ index] = insn & 0xff; contents[endianflip ^ target] = insn & 0xff;
contents[endianflip ^ (index + 1)] = (insn >> 8) & 0xff; contents[endianflip ^ (target + 1)] = (insn >> 8) & 0xff;
contents[endianflip ^ (index + 2)] = (insn >> 16) & 0xff; contents[endianflip ^ (target + 2)] = (insn >> 16) & 0xff;
contents[endianflip ^ (index + 3)] = (insn >> 24) & 0xff; contents[endianflip ^ (target + 3)] = (insn >> 24) & 0xff;
/* Branch back to insn after original insn. */ /* Branch back to insn after original insn. */
insn = 0xea000000 | ((branch_from_veneer >> 2) & 0xffffff); insn = 0xea000000 | ((branch_from_veneer >> 2) & 0xffffff);
contents[endianflip ^ (index + 4)] = insn & 0xff; contents[endianflip ^ (target + 4)] = insn & 0xff;
contents[endianflip ^ (index + 5)] = (insn >> 8) & 0xff; contents[endianflip ^ (target + 5)] = (insn >> 8) & 0xff;
contents[endianflip ^ (index + 6)] = (insn >> 16) & 0xff; contents[endianflip ^ (target + 6)] = (insn >> 16) & 0xff;
contents[endianflip ^ (index + 7)] = (insn >> 24) & 0xff; contents[endianflip ^ (target + 7)] = (insn >> 24) & 0xff;
} }
break; break;

View File

@ -775,14 +775,14 @@ static bfd_vma
avr_get_stub_addr (bfd_vma srel, avr_get_stub_addr (bfd_vma srel,
struct elf32_avr_link_hash_table *htab) struct elf32_avr_link_hash_table *htab)
{ {
unsigned int index; unsigned int sindex;
bfd_vma stub_sec_addr = bfd_vma stub_sec_addr =
(htab->stub_sec->output_section->vma + (htab->stub_sec->output_section->vma +
htab->stub_sec->output_offset); htab->stub_sec->output_offset);
for (index = 0; index < htab->amt_max_entry_cnt; index ++) for (sindex = 0; sindex < htab->amt_max_entry_cnt; sindex ++)
if (htab->amt_destination_addr[index] == srel) if (htab->amt_destination_addr[sindex] == srel)
return htab->amt_stub_offsets[index] + stub_sec_addr; return htab->amt_stub_offsets[sindex] + stub_sec_addr;
/* Return an address that could not be reached by 16 bit relocs. */ /* Return an address that could not be reached by 16 bit relocs. */
return 0x020000; return 0x020000;
@ -1510,7 +1510,6 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{ {
/* A local symbol. */ /* A local symbol. */
Elf_Internal_Sym *isym;
asection *sym_sec; asection *sym_sec;
isym = isymbuf + ELF32_R_SYM (irel->r_info); isym = isymbuf + ELF32_R_SYM (irel->r_info);
@ -1703,8 +1702,8 @@ elf32_avr_relax_section (bfd *abfd,
bfd_vma symval; bfd_vma symval;
if ( ELF32_R_TYPE (irel->r_info) != R_AVR_13_PCREL if ( ELF32_R_TYPE (irel->r_info) != R_AVR_13_PCREL
&& ELF32_R_TYPE (irel->r_info) != R_AVR_7_PCREL && ELF32_R_TYPE (irel->r_info) != R_AVR_7_PCREL
&& ELF32_R_TYPE (irel->r_info) != R_AVR_CALL) && ELF32_R_TYPE (irel->r_info) != R_AVR_CALL)
continue; continue;
/* Get the section contents if we haven't done so already. */ /* Get the section contents if we haven't done so already. */
@ -1721,7 +1720,7 @@ elf32_avr_relax_section (bfd *abfd,
} }
} }
/* Read this BFD's local symbols if we haven't done so already. */ /* Read this BFD's local symbols if we haven't done so already. */
if (isymbuf == NULL && symtab_hdr->sh_info != 0) if (isymbuf == NULL && symtab_hdr->sh_info != 0)
{ {
isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
@ -1780,9 +1779,9 @@ elf32_avr_relax_section (bfd *abfd,
the linker is run. */ the linker is run. */
switch (ELF32_R_TYPE (irel->r_info)) switch (ELF32_R_TYPE (irel->r_info))
{ {
/* Try to turn a 22-bit absolute call/jump into an 13-bit /* Try to turn a 22-bit absolute call/jump into an 13-bit
pc-relative rcall/rjmp. */ pc-relative rcall/rjmp. */
case R_AVR_CALL: case R_AVR_CALL:
{ {
bfd_vma value = symval + irel->r_addend; bfd_vma value = symval + irel->r_addend;
bfd_vma dot, gap; bfd_vma dot, gap;
@ -1807,27 +1806,27 @@ elf32_avr_relax_section (bfd *abfd,
vaiable avr_pc_wrap_around with the appropriate value. vaiable avr_pc_wrap_around with the appropriate value.
I.e. 0x4000 for a 16k device. */ I.e. 0x4000 for a 16k device. */
{ {
/* Shrinking the code size makes the gaps larger in the /* Shrinking the code size makes the gaps larger in the
case of wrap-arounds. So we use a heuristical safety case of wrap-arounds. So we use a heuristical safety
margin to avoid that during relax the distance gets margin to avoid that during relax the distance gets
again too large for the short jumps. Let's assume again too large for the short jumps. Let's assume
a typical code-size reduction due to relax for a a typical code-size reduction due to relax for a
16k device of 600 bytes. So let's use twice the 16k device of 600 bytes. So let's use twice the
typical value as safety margin. */ typical value as safety margin. */
int rgap; int rgap;
int safety_margin; int safety_margin;
int assumed_shrink = 600; int assumed_shrink = 600;
if (avr_pc_wrap_around > 0x4000) if (avr_pc_wrap_around > 0x4000)
assumed_shrink = 900; assumed_shrink = 900;
safety_margin = 2 * assumed_shrink; safety_margin = 2 * assumed_shrink;
rgap = avr_relative_distance_considering_wrap_around (gap); rgap = avr_relative_distance_considering_wrap_around (gap);
if (rgap >= (-4092 + safety_margin) if (rgap >= (-4092 + safety_margin)
&& rgap <= (4094 - safety_margin)) && rgap <= (4094 - safety_margin))
distance_short_enough = 1; distance_short_enough = 1;
} }
if (distance_short_enough) if (distance_short_enough)
@ -1921,9 +1920,9 @@ elf32_avr_relax_section (bfd *abfd,
if (irel->r_offset + 3 < sec->size) if (irel->r_offset + 3 < sec->size)
{ {
next_insn_msb = next_insn_msb =
bfd_get_8 (abfd, contents + irel->r_offset + 3); bfd_get_8 (abfd, contents + irel->r_offset + 3);
next_insn_lsb = next_insn_lsb =
bfd_get_8 (abfd, contents + irel->r_offset + 2); bfd_get_8 (abfd, contents + irel->r_offset + 2);
} }
if ((0x95 == next_insn_msb) && (0x08 == next_insn_lsb)) if ((0x95 == next_insn_msb) && (0x08 == next_insn_lsb))
@ -1951,9 +1950,9 @@ elf32_avr_relax_section (bfd *abfd,
if (irel->r_offset + 5 < sec->size) if (irel->r_offset + 5 < sec->size)
{ {
next_insn_msb = next_insn_msb =
bfd_get_8 (abfd, contents + irel->r_offset + 5); bfd_get_8 (abfd, contents + irel->r_offset + 5);
next_insn_lsb = next_insn_lsb =
bfd_get_8 (abfd, contents + irel->r_offset + 4); bfd_get_8 (abfd, contents + irel->r_offset + 4);
} }
if ((0x95 == next_insn_msb) && (0x08 == next_insn_lsb)) if ((0x95 == next_insn_msb) && (0x08 == next_insn_lsb))
@ -1988,11 +1987,11 @@ elf32_avr_relax_section (bfd *abfd,
if (irel->r_offset + insn_size + 1 < sec->size) if (irel->r_offset + insn_size + 1 < sec->size)
{ {
next_insn_msb = next_insn_msb =
bfd_get_8 (abfd, contents + irel->r_offset bfd_get_8 (abfd, contents + irel->r_offset
+ insn_size + 1); + insn_size + 1);
next_insn_lsb = next_insn_lsb =
bfd_get_8 (abfd, contents + irel->r_offset bfd_get_8 (abfd, contents + irel->r_offset
+ insn_size); + insn_size);
} }
if ((0x95 == next_insn_msb) && (0x08 == next_insn_lsb)) if ((0x95 == next_insn_msb) && (0x08 == next_insn_lsb))
@ -2019,9 +2018,9 @@ elf32_avr_relax_section (bfd *abfd,
unsigned char preceeding_msb; unsigned char preceeding_msb;
unsigned char preceeding_lsb; unsigned char preceeding_lsb;
preceeding_msb = preceeding_msb =
bfd_get_8 (abfd, contents + irel->r_offset - 1); bfd_get_8 (abfd, contents + irel->r_offset - 1);
preceeding_lsb = preceeding_lsb =
bfd_get_8 (abfd, contents + irel->r_offset - 2); bfd_get_8 (abfd, contents + irel->r_offset - 2);
/* sbic. */ /* sbic. */
if (0x99 == preceeding_msb) if (0x99 == preceeding_msb)
@ -2033,12 +2032,12 @@ elf32_avr_relax_section (bfd *abfd,
/* sbrc */ /* sbrc */
if ((0xfc == (preceeding_msb & 0xfe) if ((0xfc == (preceeding_msb & 0xfe)
&& (0x00 == (preceeding_lsb & 0x08)))) && (0x00 == (preceeding_lsb & 0x08))))
there_is_preceeding_non_skip_insn = 0; there_is_preceeding_non_skip_insn = 0;
/* sbrs */ /* sbrs */
if ((0xfe == (preceeding_msb & 0xfe) if ((0xfe == (preceeding_msb & 0xfe)
&& (0x00 == (preceeding_lsb & 0x08)))) && (0x00 == (preceeding_lsb & 0x08))))
there_is_preceeding_non_skip_insn = 0; there_is_preceeding_non_skip_insn = 0;
/* cpse */ /* cpse */
@ -2066,7 +2065,7 @@ elf32_avr_relax_section (bfd *abfd,
int deleting_ret_is_safe = 1; int deleting_ret_is_safe = 1;
unsigned int section_offset_of_ret_insn = unsigned int section_offset_of_ret_insn =
irel->r_offset + insn_size; irel->r_offset + insn_size;
Elf_Internal_Sym *isym, *isymend; Elf_Internal_Sym *isym, *isymend;
unsigned int sec_shndx; unsigned int sec_shndx;
@ -2078,145 +2077,140 @@ elf32_avr_relax_section (bfd *abfd,
isymend = isym + symtab_hdr->sh_info; isymend = isym + symtab_hdr->sh_info;
/* PR 6019: There may not be any local symbols. */ /* PR 6019: There may not be any local symbols. */
for (; isym != NULL && isym < isymend; isym++) for (; isym != NULL && isym < isymend; isym++)
{ {
if (isym->st_value == section_offset_of_ret_insn if (isym->st_value == section_offset_of_ret_insn
&& isym->st_shndx == sec_shndx) && isym->st_shndx == sec_shndx)
{ {
deleting_ret_is_safe = 0; deleting_ret_is_safe = 0;
if (debug_relax) if (debug_relax)
printf ("local label prevents deletion of ret " printf ("local label prevents deletion of ret "
"insn at address 0x%x\n", "insn at address 0x%x\n",
(int) dot + insn_size); (int) dot + insn_size);
} }
} }
/* Now check for global symbols. */ /* Now check for global symbols. */
{ {
int symcount; int symcount;
struct elf_link_hash_entry **sym_hashes; struct elf_link_hash_entry **sym_hashes;
struct elf_link_hash_entry **end_hashes; struct elf_link_hash_entry **end_hashes;
symcount = (symtab_hdr->sh_size symcount = (symtab_hdr->sh_size
/ sizeof (Elf32_External_Sym) / sizeof (Elf32_External_Sym)
- symtab_hdr->sh_info); - symtab_hdr->sh_info);
sym_hashes = elf_sym_hashes (abfd); sym_hashes = elf_sym_hashes (abfd);
end_hashes = sym_hashes + symcount; end_hashes = sym_hashes + symcount;
for (; sym_hashes < end_hashes; sym_hashes++) for (; sym_hashes < end_hashes; sym_hashes++)
{ {
struct elf_link_hash_entry *sym_hash = struct elf_link_hash_entry *sym_hash =
*sym_hashes; *sym_hashes;
if ((sym_hash->root.type == bfd_link_hash_defined if ((sym_hash->root.type == bfd_link_hash_defined
|| sym_hash->root.type == || sym_hash->root.type ==
bfd_link_hash_defweak) bfd_link_hash_defweak)
&& sym_hash->root.u.def.section == sec && sym_hash->root.u.def.section == sec
&& sym_hash->root.u.def.value == section_offset_of_ret_insn) && sym_hash->root.u.def.value == section_offset_of_ret_insn)
{ {
deleting_ret_is_safe = 0; deleting_ret_is_safe = 0;
if (debug_relax) if (debug_relax)
printf ("global label prevents deletion of " printf ("global label prevents deletion of "
"ret insn at address 0x%x\n", "ret insn at address 0x%x\n",
(int) dot + insn_size); (int) dot + insn_size);
} }
} }
} }
/* Now we check for relocations pointing to ret. */ /* Now we check for relocations pointing to ret. */
{ {
Elf_Internal_Rela *irel; Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend; Elf_Internal_Rela *relend;
Elf_Internal_Shdr *symtab_hdr;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr; relend = elf_section_data (sec)->relocs
relend = elf_section_data (sec)->relocs + sec->reloc_count;
+ sec->reloc_count;
for (irel = elf_section_data (sec)->relocs; for (rel = elf_section_data (sec)->relocs;
irel < relend; irel++) rel < relend; rel++)
{ {
bfd_vma reloc_target = 0; bfd_vma reloc_target = 0;
bfd_vma symval;
Elf_Internal_Sym *isymbuf = NULL;
/* Read this BFD's local symbols if we haven't /* Read this BFD's local symbols if we haven't
done so already. */ done so already. */
if (isymbuf == NULL && symtab_hdr->sh_info != 0) if (isymbuf == NULL && symtab_hdr->sh_info != 0)
{ {
isymbuf = (Elf_Internal_Sym *) isymbuf = (Elf_Internal_Sym *)
symtab_hdr->contents; symtab_hdr->contents;
if (isymbuf == NULL) if (isymbuf == NULL)
isymbuf = bfd_elf_get_elf_syms isymbuf = bfd_elf_get_elf_syms
(abfd, (abfd,
symtab_hdr, symtab_hdr,
symtab_hdr->sh_info, 0, symtab_hdr->sh_info, 0,
NULL, NULL, NULL); NULL, NULL, NULL);
if (isymbuf == NULL) if (isymbuf == NULL)
break; break;
} }
/* Get the value of the symbol referred to /* Get the value of the symbol referred to
by the reloc. */ by the reloc. */
if (ELF32_R_SYM (irel->r_info) if (ELF32_R_SYM (rel->r_info)
< symtab_hdr->sh_info) < symtab_hdr->sh_info)
{ {
/* A local symbol. */ /* A local symbol. */
Elf_Internal_Sym *isym; asection *sym_sec;
asection *sym_sec;
isym = isymbuf isym = isymbuf
+ ELF32_R_SYM (irel->r_info); + ELF32_R_SYM (rel->r_info);
sym_sec = bfd_section_from_elf_index sym_sec = bfd_section_from_elf_index
(abfd, isym->st_shndx); (abfd, isym->st_shndx);
symval = isym->st_value; symval = isym->st_value;
/* If the reloc is absolute, it will not /* If the reloc is absolute, it will not
have a symbol or section associated have a symbol or section associated
with it. */ with it. */
if (sym_sec) if (sym_sec)
{ {
symval += symval +=
sym_sec->output_section->vma sym_sec->output_section->vma
+ sym_sec->output_offset; + sym_sec->output_offset;
reloc_target = symval + irel->r_addend; reloc_target = symval + rel->r_addend;
} }
else else
{ {
reloc_target = symval + irel->r_addend; reloc_target = symval + rel->r_addend;
/* Reference symbol is absolute. */ /* Reference symbol is absolute. */
} }
} }
/* else ... reference symbol is extern. */ /* else ... reference symbol is extern. */
if (address_of_ret == reloc_target) if (address_of_ret == reloc_target)
{ {
deleting_ret_is_safe = 0; deleting_ret_is_safe = 0;
if (debug_relax) if (debug_relax)
printf ("ret from " printf ("ret from "
"rjmp/jmp ret sequence at address" "rjmp/jmp ret sequence at address"
" 0x%x could not be deleted. ret" " 0x%x could not be deleted. ret"
" is target of a relocation.\n", " is target of a relocation.\n",
(int) address_of_ret); (int) address_of_ret);
} }
} }
} }
if (deleting_ret_is_safe) if (deleting_ret_is_safe)
{ {
if (debug_relax) if (debug_relax)
printf ("unreachable ret instruction " printf ("unreachable ret instruction "
"at address 0x%x deleted.\n", "at address 0x%x deleted.\n",
(int) dot + insn_size); (int) dot + insn_size);
/* Delete two bytes of data. */ /* Delete two bytes of data. */
if (!elf32_avr_relax_delete_bytes (abfd, sec, if (!elf32_avr_relax_delete_bytes (abfd, sec,
irel->r_offset + insn_size, 2)) irel->r_offset + insn_size, 2))
goto error_return; goto error_return;
/* That will change things, so, we should relax /* That will change things, so, we should relax
again. Note that this is not required, and it again. Note that this is not required, and it
may be slow. */ may be slow. */
*again = TRUE; *again = TRUE;
break; break;
} }
} }
} }

View File

@ -3481,7 +3481,6 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info)
{ {
/* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
.plt section. */ .plt section. */
struct elf_link_hash_entry *h;
struct bfd_link_hash_entry *bh = NULL; struct bfd_link_hash_entry *bh = NULL;
if (! (_bfd_generic_link_add_one_symbol if (! (_bfd_generic_link_add_one_symbol

View File

@ -889,17 +889,12 @@ cr16_elf_final_link_relocate (reloc_howto_type *howto,
unsigned short r_type = howto->type; unsigned short r_type = howto->type;
bfd_byte *hit_data = contents + offset; bfd_byte *hit_data = contents + offset;
bfd_vma reloc_bits, check, Rvalue1; bfd_vma reloc_bits, check, Rvalue1;
bfd * dynobj; bfd * dynobj;
bfd_vma * local_got_offsets; bfd_vma * local_got_offsets;
asection * sgot;
dynobj = elf_hash_table (info)->dynobj; dynobj = elf_hash_table (info)->dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd); local_got_offsets = elf_local_got_offsets (input_bfd);
sgot = NULL;
switch (r_type) switch (r_type)
{ {
case R_CR16_IMM4: case R_CR16_IMM4:

View File

@ -1669,7 +1669,6 @@ elf_i386_check_relocs (bfd *abfd,
easily. Oh well. */ easily. Oh well. */
void **vpp; void **vpp;
asection *s; asection *s;
Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->sym_cache,
abfd, r_symndx); abfd, r_symndx);
@ -2665,7 +2664,7 @@ elf_i386_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
Elf_Internal_Shdr *hdr, Elf_Internal_Shdr *hdr,
asection *sec) asection *sec)
{ {
register const char *name; const char *name;
name = bfd_get_section_name (abfd, sec); name = bfd_get_section_name (abfd, sec);
@ -3610,7 +3609,7 @@ elf_i386_relocate_section (bfd *output_bfd,
{ {
Elf_Internal_Rela outrel; Elf_Internal_Rela outrel;
bfd_byte *loc; bfd_byte *loc;
int dr_type, indx; int dr_type;
asection *sreloc; asection *sreloc;
if (htab->elf.srelgot == NULL) if (htab->elf.srelgot == NULL)
@ -3939,7 +3938,6 @@ elf_i386_relocate_section (bfd *output_bfd,
Elf_Internal_Rela outrel; Elf_Internal_Rela outrel;
asection *sreloc; asection *sreloc;
bfd_byte *loc; bfd_byte *loc;
int indx;
outrel.r_offset = rel->r_offset outrel.r_offset = rel->r_offset
+ input_section->output_section->vma + input_section->output_section->vma

View File

@ -1,5 +1,5 @@
/* Ubicom IP2xxx specific support for 32-bit ELF /* Ubicom IP2xxx specific support for 32-bit ELF
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -347,7 +347,7 @@ ip2k_is_switch_table_128 (bfd *abfd ATTRIBUTE_UNUSED,
bfd_byte *contents) bfd_byte *contents)
{ {
bfd_byte code[4]; bfd_byte code[4];
int index = 0; int table_index = 0;
/* Check current page-jmp. */ /* Check current page-jmp. */
if (addr + 4 > sec->size) if (addr + 4 > sec->size)
@ -369,13 +369,13 @@ ip2k_is_switch_table_128 (bfd *abfd ATTRIBUTE_UNUSED,
ip2k_get_mem (abfd, contents + addr - 4, 4, code); ip2k_get_mem (abfd, contents + addr - 4, 4, code);
if ((IS_ADD_W_WREG_OPCODE (code + 0)) if ((IS_ADD_W_WREG_OPCODE (code + 0))
&& (IS_ADD_PCL_W_OPCODE (code + 2))) && (IS_ADD_PCL_W_OPCODE (code + 2)))
return index; return table_index;
if ((! IS_PAGE_OPCODE (code + 0)) if ((! IS_PAGE_OPCODE (code + 0))
|| (! IS_JMP_OPCODE (code + 2))) || (! IS_JMP_OPCODE (code + 2)))
return -1; return -1;
index++; table_index++;
addr -= 4; addr -= 4;
} }
} }
@ -427,7 +427,7 @@ ip2k_is_switch_table_256 (bfd *abfd ATTRIBUTE_UNUSED,
bfd_byte *contents) bfd_byte *contents)
{ {
bfd_byte code[16]; bfd_byte code[16];
int index = 0; int table_index = 0;
/* Check current page-jmp. */ /* Check current page-jmp. */
if (addr + 4 > sec->size) if (addr + 4 > sec->size)
@ -454,7 +454,7 @@ ip2k_is_switch_table_256 (bfd *abfd ATTRIBUTE_UNUSED,
&& (IS_INC_1SP_OPCODE (code + 10)) && (IS_INC_1SP_OPCODE (code + 10))
&& (IS_PAGE_OPCODE (code + 12)) && (IS_PAGE_OPCODE (code + 12))
&& (IS_JMP_OPCODE (code + 14))) && (IS_JMP_OPCODE (code + 14)))
return index; return table_index;
if ((IS_ADD_W_WREG_OPCODE (code + 2)) if ((IS_ADD_W_WREG_OPCODE (code + 2))
&& (IS_SNC_OPCODE (code + 4)) && (IS_SNC_OPCODE (code + 4))
@ -463,13 +463,13 @@ ip2k_is_switch_table_256 (bfd *abfd ATTRIBUTE_UNUSED,
&& (IS_SNC_OPCODE (code + 10)) && (IS_SNC_OPCODE (code + 10))
&& (IS_INC_1SP_OPCODE (code + 12)) && (IS_INC_1SP_OPCODE (code + 12))
&& (IS_JMP_OPCODE (code + 14))) && (IS_JMP_OPCODE (code + 14)))
return index; return table_index;
if ((! IS_PAGE_OPCODE (code + 0)) if ((! IS_PAGE_OPCODE (code + 0))
|| (! IS_JMP_OPCODE (code + 2))) || (! IS_JMP_OPCODE (code + 2)))
return -1; return -1;
index++; table_index++;
addr -= 4; addr -= 4;
} }
} }

View File

@ -1130,10 +1130,8 @@ lm32_elf_relocate_section (bfd *output_bfd,
if (r != bfd_reloc_ok) if (r != bfd_reloc_ok)
{ {
const char *name;
const char *msg = NULL; const char *msg = NULL;
arelent bfd_reloc; arelent bfd_reloc;
reloc_howto_type *howto;
lm32_info_to_howto_rela (input_bfd, &bfd_reloc, rel); lm32_info_to_howto_rela (input_bfd, &bfd_reloc, rel);
howto = bfd_reloc.howto; howto = bfd_reloc.howto;

View File

@ -379,7 +379,6 @@ elf32_m68hc11_size_stubs (bfd *output_bfd, bfd *stub_bfd,
input_bfd = input_bfd->link_next, bfd_indx++) input_bfd = input_bfd->link_next, bfd_indx++)
{ {
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Sym *local_syms;
struct elf_link_hash_entry ** sym_hashes; struct elf_link_hash_entry ** sym_hashes;
sym_hashes = elf_sym_hashes (input_bfd); sym_hashes = elf_sym_hashes (input_bfd);

View File

@ -1284,7 +1284,7 @@ microblaze_elf_relax_section (bfd *abfd,
bfd_byte *free_contents = NULL; bfd_byte *free_contents = NULL;
int rel_count; int rel_count;
unsigned int shndx; unsigned int shndx;
int i, index; int i, sym_index;
asection *o; asection *o;
struct elf_link_hash_entry *sym_hash; struct elf_link_hash_entry *sym_hash;
Elf_Internal_Sym *isymbuf, *isymend; Elf_Internal_Sym *isymbuf, *isymend;
@ -1319,8 +1319,7 @@ microblaze_elf_relax_section (bfd *abfd,
0, NULL, NULL, NULL); 0, NULL, NULL, NULL);
BFD_ASSERT (isymbuf != NULL); BFD_ASSERT (isymbuf != NULL);
internal_relocs = _bfd_elf_link_read_relocs internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, link_info->keep_memory);
(abfd, sec, NULL, NULL, link_info->keep_memory);
if (internal_relocs == NULL) if (internal_relocs == NULL)
goto error_return; goto error_return;
if (! link_info->keep_memory) if (! link_info->keep_memory)
@ -1364,7 +1363,6 @@ microblaze_elf_relax_section (bfd *abfd,
if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{ {
/* A local symbol. */ /* A local symbol. */
Elf_Internal_Sym *isym;
asection *sym_sec; asection *sym_sec;
isym = isymbuf + ELF32_R_SYM (irel->r_info); isym = isymbuf + ELF32_R_SYM (irel->r_info);
@ -1464,7 +1462,6 @@ microblaze_elf_relax_section (bfd *abfd,
range to be adjusted, and hence must be changed. */ range to be adjusted, and hence must be changed. */
if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{ {
Elf_Internal_Sym *isym;
isym = isymbuf + ELF32_R_SYM (irel->r_info); isym = isymbuf + ELF32_R_SYM (irel->r_info);
/* Only handle relocs against .text. */ /* Only handle relocs against .text. */
if (isym->st_shndx == shndx if (isym->st_shndx == shndx
@ -1507,7 +1504,7 @@ microblaze_elf_relax_section (bfd *abfd,
/* Look through all other sections. */ /* Look through all other sections. */
for (o = abfd->sections; o != NULL; o = o->next) for (o = abfd->sections; o != NULL; o = o->next)
{ {
Elf_Internal_Rela *internal_relocs; Elf_Internal_Rela *irelocs;
Elf_Internal_Rela *irelscan, *irelscanend; Elf_Internal_Rela *irelscan, *irelscanend;
bfd_byte *ocontents; bfd_byte *ocontents;
@ -1519,13 +1516,13 @@ microblaze_elf_relax_section (bfd *abfd,
/* We always cache the relocs. Perhaps, if info->keep_memory is /* We always cache the relocs. Perhaps, if info->keep_memory is
FALSE, we should free them, if we are permitted to. */ FALSE, we should free them, if we are permitted to. */
internal_relocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, TRUE); irelocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, TRUE);
if (internal_relocs == NULL) if (irelocs == NULL)
goto error_return; goto error_return;
ocontents = NULL; ocontents = NULL;
irelscanend = internal_relocs + o->reloc_count; irelscanend = irelocs + o->reloc_count;
for (irelscan = internal_relocs; irelscan < irelscanend; irelscan++) for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
{ {
if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
{ {
@ -1745,9 +1742,9 @@ microblaze_elf_relax_section (bfd *abfd,
/* Now adjust the global symbols defined in this section. */ /* Now adjust the global symbols defined in this section. */
isym = isymbuf + symtab_hdr->sh_info; isym = isymbuf + symtab_hdr->sh_info;
isymend = isymbuf + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)); isymend = isymbuf + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym));
for (index = 0; isym < isymend; isym++, index++) for (sym_index = 0; isym < isymend; isym++, sym_index++)
{ {
sym_hash = elf_sym_hashes (abfd)[index]; sym_hash = elf_sym_hashes (abfd)[sym_index];
if (isym->st_shndx == shndx if (isym->st_shndx == shndx
&& (sym_hash->root.type == bfd_link_hash_defined && (sym_hash->root.type == bfd_link_hash_defined
|| sym_hash->root.type == bfd_link_hash_defweak) || sym_hash->root.type == bfd_link_hash_defweak)

View File

@ -3961,7 +3961,7 @@ ppc_elf_check_relocs (bfd *abfd,
|| !h->def_regular))) || !h->def_regular)))
{ {
struct ppc_elf_dyn_relocs *p; struct ppc_elf_dyn_relocs *p;
struct ppc_elf_dyn_relocs **head; struct ppc_elf_dyn_relocs **rel_head;
#ifdef DEBUG #ifdef DEBUG
fprintf (stderr, fprintf (stderr,
@ -3986,7 +3986,7 @@ ppc_elf_check_relocs (bfd *abfd,
relocations we need for this symbol. */ relocations we need for this symbol. */
if (h != NULL) if (h != NULL)
{ {
head = &ppc_elf_hash_entry (h)->dyn_relocs; rel_head = &ppc_elf_hash_entry (h)->dyn_relocs;
} }
else else
{ {
@ -4007,17 +4007,17 @@ ppc_elf_check_relocs (bfd *abfd,
s = sec; s = sec;
vpp = &elf_section_data (s)->local_dynrel; vpp = &elf_section_data (s)->local_dynrel;
head = (struct ppc_elf_dyn_relocs **) vpp; rel_head = (struct ppc_elf_dyn_relocs **) vpp;
} }
p = *head; p = *rel_head;
if (p == NULL || p->sec != sec) if (p == NULL || p->sec != sec)
{ {
p = bfd_alloc (htab->elf.dynobj, sizeof *p); p = bfd_alloc (htab->elf.dynobj, sizeof *p);
if (p == NULL) if (p == NULL)
return FALSE; return FALSE;
p->next = *head; p->next = *rel_head;
*head = p; *rel_head = p;
p->sec = sec; p->sec = sec;
p->count = 0; p->count = 0;
p->pc_count = 0; p->pc_count = 0;
@ -5619,6 +5619,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
local_plt = (struct plt_entry **) end_local_got; local_plt = (struct plt_entry **) end_local_got;
end_local_plt = local_plt + locsymcount; end_local_plt = local_plt + locsymcount;
lgot_masks = (char *) end_local_plt; lgot_masks = (char *) end_local_plt;
for (; local_got < end_local_got; ++local_got, ++lgot_masks) for (; local_got < end_local_got; ++local_got, ++lgot_masks)
if (*local_got > 0) if (*local_got > 0)
{ {
@ -5662,7 +5663,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
for (ent = *local_plt; ent != NULL; ent = ent->next) for (ent = *local_plt; ent != NULL; ent = ent->next)
if (ent->plt.refcount > 0) if (ent->plt.refcount > 0)
{ {
asection *s = htab->iplt; s = htab->iplt;
if (!doneone) if (!doneone)
{ {
@ -6018,7 +6019,7 @@ ppc_elf_relax_section (bfd *abfd,
for (irel = internal_relocs; irel < irelend; irel++) for (irel = internal_relocs; irel < irelend; irel++)
{ {
unsigned long r_type = ELF32_R_TYPE (irel->r_info); unsigned long r_type = ELF32_R_TYPE (irel->r_info);
bfd_vma reladdr, toff, roff; bfd_vma toff, roff;
asection *tsec; asection *tsec;
struct one_fixup *f; struct one_fixup *f;
size_t insn_offset = 0; size_t insn_offset = 0;
@ -6202,7 +6203,6 @@ ppc_elf_relax_section (bfd *abfd,
continue; continue;
roff = irel->r_offset; roff = irel->r_offset;
reladdr = isec->output_section->vma + isec->output_offset + roff;
/* If the branch is in range, no need to do anything. */ /* If the branch is in range, no need to do anything. */
if (tsec != bfd_und_section_ptr if (tsec != bfd_und_section_ptr
@ -6698,7 +6698,6 @@ ppc_elf_relocate_section (bfd *output_bfd,
Elf_Internal_Rela *rel; Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend; Elf_Internal_Rela *relend;
Elf_Internal_Rela outrel; Elf_Internal_Rela outrel;
bfd_byte *loc;
asection *got2, *sreloc = NULL; asection *got2, *sreloc = NULL;
bfd_vma *local_got_offsets; bfd_vma *local_got_offsets;
bfd_boolean ret = TRUE; bfd_boolean ret = TRUE;
@ -6742,7 +6741,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
reloc_howto_type *howto; reloc_howto_type *howto;
unsigned long r_symndx; unsigned long r_symndx;
bfd_vma relocation; bfd_vma relocation;
bfd_vma branch_bit, insn, from; bfd_vma branch_bit, from;
bfd_boolean unresolved_reloc; bfd_boolean unresolved_reloc;
bfd_boolean warned; bfd_boolean warned;
unsigned int tls_type, tls_mask, tls_gd; unsigned int tls_type, tls_mask, tls_gd;
@ -6840,6 +6839,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
&& (tls_mask & TLS_TPREL) == 0) && (tls_mask & TLS_TPREL) == 0)
{ {
bfd_vma insn; bfd_vma insn;
insn = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset); insn = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset);
insn &= 31 << 21; insn &= 31 << 21;
insn |= 0x3c020000; /* addis 0,2,0 */ insn |= 0x3c020000; /* addis 0,2,0 */
@ -7055,20 +7055,24 @@ ppc_elf_relocate_section (bfd *output_bfd,
/* Branch not taken prediction relocations. */ /* Branch not taken prediction relocations. */
case R_PPC_ADDR14_BRNTAKEN: case R_PPC_ADDR14_BRNTAKEN:
case R_PPC_REL14_BRNTAKEN: case R_PPC_REL14_BRNTAKEN:
insn = bfd_get_32 (output_bfd, contents + rel->r_offset); {
insn &= ~BRANCH_PREDICT_BIT; bfd_vma insn;
insn |= branch_bit;
from = (rel->r_offset insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
+ input_section->output_offset insn &= ~BRANCH_PREDICT_BIT;
+ input_section->output_section->vma); insn |= branch_bit;
/* Invert 'y' bit if not the default. */ from = (rel->r_offset
if ((bfd_signed_vma) (relocation + rel->r_addend - from) < 0) + input_section->output_offset
insn ^= BRANCH_PREDICT_BIT; + input_section->output_section->vma);
bfd_put_32 (output_bfd, insn, contents + rel->r_offset); /* Invert 'y' bit if not the default. */
break; if ((bfd_signed_vma) (relocation + rel->r_addend - from) < 0)
insn ^= BRANCH_PREDICT_BIT;
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
break;
}
} }
ifunc = NULL; ifunc = NULL;
@ -7299,6 +7303,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|| h->root.type != bfd_link_hash_undefweak)) || h->root.type != bfd_link_hash_undefweak))
{ {
asection *rsec = htab->relgot; asection *rsec = htab->relgot;
bfd_byte * loc;
outrel.r_offset = (htab->got->output_section->vma outrel.r_offset = (htab->got->output_section->vma
+ htab->got->output_offset + htab->got->output_offset
@ -7530,7 +7535,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
&& !h->def_regular)) && !h->def_regular))
{ {
int skip; int skip;
bfd_byte * loc;
#ifdef DEBUG #ifdef DEBUG
fprintf (stderr, "ppc_elf_relocate_section needs to " fprintf (stderr, "ppc_elf_relocate_section needs to "
"create relocation for %s\n", "create relocation for %s\n",
@ -7920,7 +7925,9 @@ ppc_elf_relocate_section (bfd *output_bfd,
} }
if (r_type == R_PPC_EMB_SDA21) if (r_type == R_PPC_EMB_SDA21)
{ /* fill in register field */ {
bfd_vma insn; /* Fill in register field. */
insn = bfd_get_32 (output_bfd, contents + rel->r_offset); insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
insn = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT); insn = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT);
bfd_put_32 (output_bfd, insn, contents + rel->r_offset); bfd_put_32 (output_bfd, insn, contents + rel->r_offset);

View File

@ -303,7 +303,7 @@ rx_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED,
static bfd_vma static bfd_vma
get_symbol_value (const char * name, get_symbol_value (const char * name,
bfd_reloc_status_type * stat, bfd_reloc_status_type * status,
struct bfd_link_info * info, struct bfd_link_info * info,
bfd * input_bfd, bfd * input_bfd,
asection * input_section, asection * input_section,
@ -317,7 +317,7 @@ get_symbol_value (const char * name,
if (h == NULL if (h == NULL
|| (h->type != bfd_link_hash_defined || (h->type != bfd_link_hash_defined
&& h->type != bfd_link_hash_defweak)) && h->type != bfd_link_hash_defweak))
* stat = info->callbacks->undefined_symbol * status = info->callbacks->undefined_symbol
(info, name, input_bfd, input_section, offset, TRUE); (info, name, input_bfd, input_section, offset, TRUE);
else else
value = (h->u.def.value value = (h->u.def.value
@ -328,7 +328,7 @@ get_symbol_value (const char * name,
} }
static bfd_vma static bfd_vma
get_gp (bfd_reloc_status_type * stat, get_gp (bfd_reloc_status_type * status,
struct bfd_link_info * info, struct bfd_link_info * info,
bfd * abfd, bfd * abfd,
asection * sec, asection * sec,
@ -339,14 +339,14 @@ get_gp (bfd_reloc_status_type * stat,
if (!cached) if (!cached)
{ {
cached_value = get_symbol_value ("__gp", stat, info, abfd, sec, offset); cached_value = get_symbol_value ("__gp", status, info, abfd, sec, offset);
cached = TRUE; cached = TRUE;
} }
return cached_value; return cached_value;
} }
static bfd_vma static bfd_vma
get_romstart (bfd_reloc_status_type * stat, get_romstart (bfd_reloc_status_type * status,
struct bfd_link_info * info, struct bfd_link_info * info,
bfd * abfd, bfd * abfd,
asection * sec, asection * sec,
@ -357,14 +357,14 @@ get_romstart (bfd_reloc_status_type * stat,
if (!cached) if (!cached)
{ {
cached_value = get_symbol_value ("_start", stat, info, abfd, sec, offset); cached_value = get_symbol_value ("_start", status, info, abfd, sec, offset);
cached = TRUE; cached = TRUE;
} }
return cached_value; return cached_value;
} }
static bfd_vma static bfd_vma
get_ramstart (bfd_reloc_status_type * stat, get_ramstart (bfd_reloc_status_type * status,
struct bfd_link_info * info, struct bfd_link_info * info,
bfd * abfd, bfd * abfd,
asection * sec, asection * sec,
@ -375,7 +375,7 @@ get_ramstart (bfd_reloc_status_type * stat,
if (!cached) if (!cached)
{ {
cached_value = get_symbol_value ("__datastart", stat, info, abfd, sec, offset); cached_value = get_symbol_value ("__datastart", status, info, abfd, sec, offset);
cached = TRUE; cached = TRUE;
} }
return cached_value; return cached_value;
@ -2062,9 +2062,9 @@ elf32_rx_relax_section (bfd * abfd,
else if (code == 1 && symval/scale <= 31 else if (code == 1 && symval/scale <= 31
/* Decodable bits. */ /* Decodable bits. */
&& (insn[0] & 0xcc) == 0xcc && (insn[0] & 0xcc) == 0xcc
/* width */ /* Width. */
&& (insn[0] & 0x30) != 3 && (insn[0] & 0x30) != 3
/* register MSBs */ /* Register MSBs. */
&& (insn[1] & 0x88) == 0x00) && (insn[1] & 0x88) == 0x00)
{ {
int newrel = 0; int newrel = 0;

View File

@ -1755,7 +1755,7 @@ score_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
static bfd_vma static bfd_vma
score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h) score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h)
{ {
bfd_vma index; bfd_vma got_index;
asection *sgot; asection *sgot;
struct score_got_info *g; struct score_got_info *g;
long global_got_dynindx = 0; long global_got_dynindx = 0;
@ -1769,16 +1769,19 @@ score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h)
indices into the GOT. That makes it easy to calculate the GOT indices into the GOT. That makes it easy to calculate the GOT
offset. */ offset. */
BFD_ASSERT (h->dynindx >= global_got_dynindx); BFD_ASSERT (h->dynindx >= global_got_dynindx);
index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd)); got_index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd));
BFD_ASSERT (index < sgot->size); BFD_ASSERT (got_index < sgot->size);
return index; return got_index;
} }
/* Returns the offset for the entry at the INDEXth position in the GOT. */ /* Returns the offset for the entry at the INDEXth position in the GOT. */
static bfd_vma static bfd_vma
score_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd, score_elf_got_offset_from_index (bfd *dynobj,
bfd *input_bfd ATTRIBUTE_UNUSED, bfd_vma index) bfd *output_bfd,
bfd *input_bfd ATTRIBUTE_UNUSED,
bfd_vma got_index)
{ {
asection *sgot; asection *sgot;
bfd_vma gp; bfd_vma gp;
@ -1787,7 +1790,7 @@ score_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd,
g = score_elf_got_info (dynobj, &sgot); g = score_elf_got_info (dynobj, &sgot);
gp = _bfd_get_gp_value (output_bfd); gp = _bfd_get_gp_value (output_bfd);
return sgot->output_section->vma + sgot->output_offset + index - gp; return sgot->output_section->vma + sgot->output_offset + got_index - gp;
} }
/* Follow indirect and warning hash entries so that each got entry /* Follow indirect and warning hash entries so that each got entry

View File

@ -1650,7 +1650,7 @@ score_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
static bfd_vma static bfd_vma
score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h) score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h)
{ {
bfd_vma index; bfd_vma got_index;
asection *sgot; asection *sgot;
struct score_got_info *g; struct score_got_info *g;
long global_got_dynindx = 0; long global_got_dynindx = 0;
@ -1664,17 +1664,19 @@ score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h)
indices into the GOT. That makes it easy to calculate the GOT indices into the GOT. That makes it easy to calculate the GOT
offset. */ offset. */
BFD_ASSERT (h->dynindx >= global_got_dynindx); BFD_ASSERT (h->dynindx >= global_got_dynindx);
index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd)); got_index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd));
BFD_ASSERT (index < sgot->size); BFD_ASSERT (got_index < sgot->size);
return index; return got_index;
} }
/* Returns the offset for the entry at the INDEXth position in the GOT. */ /* Returns the offset for the entry at the INDEXth position in the GOT. */
static bfd_vma static bfd_vma
score_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd, score_elf_got_offset_from_index (bfd *dynobj,
bfd *input_bfd ATTRIBUTE_UNUSED, bfd_vma index) bfd *output_bfd,
bfd *input_bfd ATTRIBUTE_UNUSED,
bfd_vma got_index)
{ {
asection *sgot; asection *sgot;
bfd_vma gp; bfd_vma gp;
@ -1683,7 +1685,7 @@ score_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd,
g = score_elf_got_info (dynobj, &sgot); g = score_elf_got_info (dynobj, &sgot);
gp = _bfd_get_gp_value (output_bfd); gp = _bfd_get_gp_value (output_bfd);
return sgot->output_section->vma + sgot->output_offset + index - gp; return sgot->output_section->vma + sgot->output_offset + got_index - gp;
} }
/* Follow indirect and warning hash entries so that each got entry /* Follow indirect and warning hash entries so that each got entry
@ -2512,7 +2514,6 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd,
if (r_type == R_SCORE_GOT15) if (r_type == R_SCORE_GOT15)
{ {
const Elf_Internal_Rela *relend;
const Elf_Internal_Rela *lo16_rel; const Elf_Internal_Rela *lo16_rel;
const struct elf_backend_data *bed; const struct elf_backend_data *bed;
bfd_vma lo_addend = 0, lo_value = 0; bfd_vma lo_addend = 0, lo_value = 0;

View File

@ -2089,9 +2089,9 @@ get_plt_index (const struct elf_sh_plt_info *info, bfd_vma offset)
/* Do the inverse operation. */ /* Do the inverse operation. */
static bfd_vma static bfd_vma
get_plt_offset (const struct elf_sh_plt_info *info, bfd_vma index) get_plt_offset (const struct elf_sh_plt_info *info, bfd_vma plt_index)
{ {
return info->plt0_entry_size + (index * info->symbol_entry_size); return info->plt0_entry_size + (plt_index * info->symbol_entry_size);
} }
/* The sh linker needs to keep track of the number of relocs that it /* The sh linker needs to keep track of the number of relocs that it
@ -2316,7 +2316,7 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{ {
struct elf_sh_link_hash_table *htab; struct elf_sh_link_hash_table *htab;
flagword flags, pltflags; flagword flags, pltflags;
register asection *s; asection *s;
const struct elf_backend_data *bed = get_elf_backend_data (abfd); const struct elf_backend_data *bed = get_elf_backend_data (abfd);
int ptralign = 0; int ptralign = 0;
@ -4043,7 +4043,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
} }
else else
{ {
int index; int target;
/* IE->LE transition: /* IE->LE transition:
mov.l 1f,r0; stc gbr,rN; mov.l @(r0,r12),rM; mov.l 1f,r0; stc gbr,rN; mov.l @(r0,r12),rM;
@ -4065,12 +4065,12 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
} }
BFD_ASSERT ((insn & 0xff00) == 0xd000); BFD_ASSERT ((insn & 0xff00) == 0xd000);
index = insn & 0x00ff; target = insn & 0x00ff;
insn = bfd_get_16 (input_bfd, contents + offset + 2); insn = bfd_get_16 (input_bfd, contents + offset + 2);
BFD_ASSERT ((insn & 0xf0ff) == 0x0012); BFD_ASSERT ((insn & 0xf0ff) == 0x0012);
insn = bfd_get_16 (input_bfd, contents + offset + 4); insn = bfd_get_16 (input_bfd, contents + offset + 4);
BFD_ASSERT ((insn & 0xf0ff) == 0x00ce); BFD_ASSERT ((insn & 0xf0ff) == 0x00ce);
insn = 0xd000 | (insn & 0x0f00) | index; insn = 0xd000 | (insn & 0x0f00) | target;
bfd_put_16 (output_bfd, insn, contents + offset + 0); bfd_put_16 (output_bfd, insn, contents + offset + 0);
bfd_put_16 (output_bfd, 0x0009, contents + offset + 4); bfd_put_16 (output_bfd, 0x0009, contents + offset + 4);
} }

View File

@ -4401,7 +4401,7 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
struct call_info *call, *pasty; struct call_info *call, *pasty;
struct _spu_elf_section_data *sec_data; struct _spu_elf_section_data *sec_data;
struct spu_elf_stack_info *sinfo; struct spu_elf_stack_info *sinfo;
int k; unsigned int k;
/* See whether we can add this section to the current /* See whether we can add this section to the current
overlay without overflowing our overlay buffer. */ overlay without overflowing our overlay buffer. */
@ -4421,7 +4421,7 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
{ {
/* Pasted sections must stay together, so add their /* Pasted sections must stay together, so add their
sizes too. */ sizes too. */
struct call_info *pasty = find_pasted_call (sec); pasty = find_pasted_call (sec);
while (pasty != NULL) while (pasty != NULL)
{ {
struct function_info *call_fun = pasty->fun; struct function_info *call_fun = pasty->fun;
@ -4448,7 +4448,7 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
pasty = NULL; pasty = NULL;
sec_data = spu_elf_section_data (sec); sec_data = spu_elf_section_data (sec);
sinfo = sec_data->u.i.stack_info; sinfo = sec_data->u.i.stack_info;
for (k = 0; k < sinfo->num_fun; ++k) for (k = 0; k < (unsigned) sinfo->num_fun; ++k)
for (call = sinfo->fun[k].call_list; call; call = call->next) for (call = sinfo->fun[k].call_list; call; call = call->next)
if (call->is_pasted) if (call->is_pasted)
{ {
@ -4478,7 +4478,6 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
num_stubs = 0; num_stubs = 0;
for (call = dummy_caller.call_list; call; call = call->next) for (call = dummy_caller.call_list; call; call = call->next)
{ {
unsigned int k;
unsigned int stub_delta = 1; unsigned int stub_delta = 1;
if (htab->params->ovly_flavour == ovly_soft_icache) if (htab->params->ovly_flavour == ovly_soft_icache)
@ -5253,7 +5252,7 @@ spu_elf_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
if ((*p)->p_type == PT_LOAD && (*p)->count == 1 if ((*p)->p_type == PT_LOAD && (*p)->count == 1
&& spu_elf_section_data ((*p)->sections[0])->u.o.ovl_index != 0) && spu_elf_section_data ((*p)->sections[0])->u.o.ovl_index != 0)
{ {
struct elf_segment_map *m = *p; m = *p;
*p = m->next; *p = m->next;
*p_overlay = m; *p_overlay = m;
p_overlay = &m->next; p_overlay = &m->next;

View File

@ -2188,7 +2188,7 @@ v850_elf_relax_delete_bytes (bfd *abfd,
Elf32_External_Sym *extsyms; Elf32_External_Sym *extsyms;
Elf32_External_Sym *esym; Elf32_External_Sym *esym;
Elf32_External_Sym *esymend; Elf32_External_Sym *esymend;
int index; int sym_index;
unsigned int sec_shndx; unsigned int sec_shndx;
bfd_byte *contents; bfd_byte *contents;
Elf_Internal_Rela *irel; Elf_Internal_Rela *irel;
@ -2336,12 +2336,12 @@ v850_elf_relax_delete_bytes (bfd *abfd,
esym = extsyms + symtab_hdr->sh_info; esym = extsyms + symtab_hdr->sh_info;
esymend = extsyms + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)); esymend = extsyms + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym));
for (index = 0; esym < esymend; esym ++, index ++) for (sym_index = 0; esym < esymend; esym ++, sym_index ++)
{ {
Elf_Internal_Sym isym; Elf_Internal_Sym isym;
bfd_elf32_swap_symbol_in (abfd, esym, shndx, & isym); bfd_elf32_swap_symbol_in (abfd, esym, shndx, & isym);
sym_hash = elf_sym_hashes (abfd) [index]; sym_hash = elf_sym_hashes (abfd) [sym_index];
if (isym.st_shndx == sec_shndx if (isym.st_shndx == sec_shndx
&& ((sym_hash)->root.type == bfd_link_hash_defined && ((sym_hash)->root.type == bfd_link_hash_defined

View File

@ -1943,9 +1943,8 @@ elf_xtensa_do_reloc (reloc_howto_type *howto,
if (!is_weak_undef) if (!is_weak_undef)
{ {
/* Check for windowed CALL across a 1GB boundary. */ /* Check for windowed CALL across a 1GB boundary. */
xtensa_opcode opcode = opcode = get_expanded_call_opcode (contents + address,
get_expanded_call_opcode (contents + address, input_size - address, 0);
input_size - address, 0);
if (is_windowed_call_opcode (opcode)) if (is_windowed_call_opcode (opcode))
{ {
if ((self_address >> CALL_SEGMENT_BITS) if ((self_address >> CALL_SEGMENT_BITS)
@ -2665,7 +2664,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
if (r_type == R_XTENSA_ASM_SIMPLIFY) if (r_type == R_XTENSA_ASM_SIMPLIFY)
{ {
char *error_message = NULL; error_message = NULL;
/* Convert ASM_SIMPLIFY into the simpler relocation /* Convert ASM_SIMPLIFY into the simpler relocation
so that they never escape a relaxing link. */ so that they never escape a relaxing link. */
r = contract_asm_expansion (contents, input_size, rel, r = contract_asm_expansion (contents, input_size, rel,
@ -3166,18 +3165,18 @@ elf_xtensa_combine_prop_entries (bfd *output_bfd,
for (n = 0; n < num; n++) for (n = 0; n < num; n++)
{ {
bfd_boolean remove = FALSE; bfd_boolean remove_entry = FALSE;
if (table[n].size == 0) if (table[n].size == 0)
remove = TRUE; remove_entry = TRUE;
else if (n > 0 && else if (n > 0
(table[n-1].address + table[n-1].size == table[n].address)) && (table[n-1].address + table[n-1].size == table[n].address))
{ {
table[n-1].size += table[n].size; table[n-1].size += table[n].size;
remove = TRUE; remove_entry = TRUE;
} }
if (remove) if (remove_entry)
{ {
for (m = n; m < num - 1; m++) for (m = n; m < num - 1; m++)
{ {

View File

@ -2740,15 +2740,16 @@ elf64_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym,
} }
/* Support HP specific sections for core files. */ /* Support HP specific sections for core files. */
static bfd_boolean static bfd_boolean
elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index, elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int sec_index,
const char *typename) const char *typename)
{ {
if (hdr->p_type == PT_HP_CORE_KERNEL) if (hdr->p_type == PT_HP_CORE_KERNEL)
{ {
asection *sect; asection *sect;
if (!_bfd_elf_make_section_from_phdr (abfd, hdr, index, typename)) if (!_bfd_elf_make_section_from_phdr (abfd, hdr, sec_index, typename))
return FALSE; return FALSE;
sect = bfd_make_section_anyway (abfd, ".kernel"); sect = bfd_make_section_anyway (abfd, ".kernel");
@ -2771,7 +2772,7 @@ elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index,
elf_tdata (abfd)->core_signal = sig; elf_tdata (abfd)->core_signal = sig;
if (!_bfd_elf_make_section_from_phdr (abfd, hdr, index, typename)) if (!_bfd_elf_make_section_from_phdr (abfd, hdr, sec_index, typename))
return FALSE; return FALSE;
/* GDB uses the ".reg" section to read register contents. */ /* GDB uses the ".reg" section to read register contents. */
@ -2784,7 +2785,7 @@ elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index,
|| hdr->p_type == PT_HP_CORE_MMF) || hdr->p_type == PT_HP_CORE_MMF)
hdr->p_type = PT_LOAD; hdr->p_type = PT_LOAD;
return _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename); return _bfd_elf_make_section_from_phdr (abfd, hdr, sec_index, typename);
} }
/* Hook called by the linker routine which adds symbols from an object /* Hook called by the linker routine which adds symbols from an object
@ -2800,9 +2801,9 @@ elf_hppa_add_symbol_hook (bfd *abfd,
asection **secp, asection **secp,
bfd_vma *valp) bfd_vma *valp)
{ {
unsigned int index = sym->st_shndx; unsigned int sec_index = sym->st_shndx;
switch (index) switch (sec_index)
{ {
case SHN_PARISC_ANSI_COMMON: case SHN_PARISC_ANSI_COMMON:
*secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common"); *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");

View File

@ -5401,8 +5401,6 @@ opd_entry_value (asection *opd_sec,
/* No relocs implies we are linking a --just-symbols object. */ /* No relocs implies we are linking a --just-symbols object. */
if (opd_sec->reloc_count == 0) if (opd_sec->reloc_count == 0)
{ {
bfd_vma val;
if (!bfd_get_section_contents (opd_bfd, opd_sec, &val, offset, 8)) if (!bfd_get_section_contents (opd_bfd, opd_sec, &val, offset, 8))
return (bfd_vma) -1; return (bfd_vma) -1;
@ -8575,8 +8573,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
for (ent = *local_plt; ent != NULL; ent = ent->next) for (ent = *local_plt; ent != NULL; ent = ent->next)
if (ent->plt.refcount > 0) if (ent->plt.refcount > 0)
{ {
asection *s = htab->iplt; s = htab->iplt;
ent->plt.offset = s->size; ent->plt.offset = s->size;
s->size += PLT_ENTRY_SIZE; s->size += PLT_ENTRY_SIZE;
@ -11920,10 +11917,8 @@ ppc64_elf_relocate_section (bfd *output_bfd,
? h->elf.type == STT_GNU_IFUNC ? h->elf.type == STT_GNU_IFUNC
: ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC))) : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)))
{ {
Elf_Internal_Rela outrel;
bfd_boolean skip, relocate; bfd_boolean skip, relocate;
asection *sreloc; asection *sreloc;
bfd_byte *loc;
bfd_vma out_off; bfd_vma out_off;
/* When generating a dynamic object, these relocations /* When generating a dynamic object, these relocations
@ -12384,9 +12379,6 @@ ppc64_elf_finish_dynamic_symbol (bfd *output_bfd,
if (h->needs_copy) if (h->needs_copy)
{ {
Elf_Internal_Rela rela;
bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */ /* This symbol needs a copy reloc. Set it up. */
if (h->dynindx == -1 if (h->dynindx == -1

View File

@ -1504,7 +1504,6 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
easily. Oh well. */ easily. Oh well. */
asection *s; asection *s;
void **vpp; void **vpp;
Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->sym_cache,
abfd, r_symndx); abfd, r_symndx);
@ -4226,11 +4225,11 @@ elf64_x86_64_add_symbol_hook (bfd *abfd,
static bfd_boolean static bfd_boolean
elf64_x86_64_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, elf64_x86_64_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED,
asection *sec, int *index) asection *sec, int *index_return)
{ {
if (sec == &_bfd_elf_large_com_section) if (sec == &_bfd_elf_large_com_section)
{ {
*index = SHN_X86_64_LCOMMON; *index_return = SHN_X86_64_LCOMMON;
return TRUE; return TRUE;
} }
return FALSE; return FALSE;

View File

@ -185,7 +185,7 @@ bfd_boolean
_bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{ {
flagword flags; flagword flags;
register asection *s; asection *s;
const struct elf_backend_data *bed; const struct elf_backend_data *bed;
if (! is_elf_hash_table (info->hash)) if (! is_elf_hash_table (info->hash))
@ -570,8 +570,7 @@ bfd_elf_record_link_assignment (bfd *output_bfd,
if (provide && hidden) if (provide && hidden)
{ {
const struct elf_backend_data *bed = get_elf_backend_data (output_bfd); bed = get_elf_backend_data (output_bfd);
h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN; h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
(*bed->elf_backend_hide_symbol) (info, h, TRUE); (*bed->elf_backend_hide_symbol) (info, h, TRUE);
} }
@ -1184,9 +1183,8 @@ _bfd_elf_merge_symbol (bfd *abfd,
was referenced before. */ was referenced before. */
if (h->ref_regular) if (h->ref_regular)
{ {
const struct elf_backend_data *bed
= get_elf_backend_data (abfd);
struct elf_link_hash_entry *vh = *sym_hash; struct elf_link_hash_entry *vh = *sym_hash;
vh->root.type = h->root.type; vh->root.type = h->root.type;
h->root.type = bfd_link_hash_indirect; h->root.type = bfd_link_hash_indirect;
(*bed->elf_backend_copy_indirect_symbol) (info, vh, h); (*bed->elf_backend_copy_indirect_symbol) (info, vh, h);
@ -1548,7 +1546,6 @@ _bfd_elf_merge_symbol (bfd *abfd,
/* Handle the case where we had a versioned symbol in a dynamic /* Handle the case where we had a versioned symbol in a dynamic
library and now find a definition in a normal object. In this library and now find a definition in a normal object. In this
case, we make the versioned symbol point to the normal one. */ case, we make the versioned symbol point to the normal one. */
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
flip->root.type = h->root.type; flip->root.type = h->root.type;
flip->root.u.undef.abfd = h->root.u.undef.abfd; flip->root.u.undef.abfd = h->root.u.undef.abfd;
h->root.type = bfd_link_hash_indirect; h->root.type = bfd_link_hash_indirect;
@ -10111,9 +10108,9 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
bfd_boolean emit_relocs; bfd_boolean emit_relocs;
bfd *dynobj; bfd *dynobj;
struct elf_final_link_info finfo; struct elf_final_link_info finfo;
register asection *o; asection *o;
register struct bfd_link_order *p; struct bfd_link_order *p;
register bfd *sub; bfd *sub;
bfd_size_type max_contents_size; bfd_size_type max_contents_size;
bfd_size_type max_external_reloc_size; bfd_size_type max_external_reloc_size;
bfd_size_type max_internal_reloc_count; bfd_size_type max_internal_reloc_count;
@ -10562,9 +10559,10 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (size == 0 if (size == 0
&& (sec->flags & SEC_HAS_CONTENTS) == 0) && (sec->flags & SEC_HAS_CONTENTS) == 0)
{ {
struct bfd_link_order *o = sec->map_tail.link_order; struct bfd_link_order *ord = sec->map_tail.link_order;
if (o != NULL)
size = o->offset + o->size; if (ord != NULL)
size = ord->offset + ord->size;
} }
end = sec->vma + size; end = sec->vma + size;
} }

View File

@ -1447,7 +1447,7 @@ static bfd_boolean
elfNN_ia64_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, elfNN_ia64_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr,
asection *sec) asection *sec)
{ {
register const char *name; const char *name;
name = bfd_get_section_name (abfd, sec); name = bfd_get_section_name (abfd, sec);
@ -2135,7 +2135,7 @@ sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info,
unsigned int count) unsigned int count)
{ {
bfd_vma curr, prev, got_offset; bfd_vma curr, prev, got_offset;
unsigned int i, kept, dup, diff, dest, src, len; unsigned int i, kept, dupes, diff, dest, src, len;
qsort (info, count, sizeof (*info), addend_compare); qsort (info, count, sizeof (*info), addend_compare);
@ -2200,35 +2200,35 @@ sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info,
/* Find the next duplicate. SRC will be kept. */ /* Find the next duplicate. SRC will be kept. */
prev = info [src].addend; prev = info [src].addend;
got_offset = info [src].got_offset; got_offset = info [src].got_offset;
for (dup = src + 1; dup < count; dup++) for (dupes = src + 1; dupes < count; dupes ++)
{ {
curr = info [dup].addend; curr = info [dupes].addend;
if (curr == prev) if (curr == prev)
{ {
/* Make sure that got_offset is valid. */ /* Make sure that got_offset is valid. */
if (got_offset == (bfd_vma) -1) if (got_offset == (bfd_vma) -1)
got_offset = info [dup].got_offset; got_offset = info [dupes].got_offset;
/* For duplicates, make sure that the kept one has /* For duplicates, make sure that the kept one has
a valid got_offset. */ a valid got_offset. */
if (got_offset != (bfd_vma) -1) if (got_offset != (bfd_vma) -1)
info [dup - 1].got_offset = got_offset; info [dupes - 1].got_offset = got_offset;
break; break;
} }
got_offset = info [dup].got_offset; got_offset = info [dupes].got_offset;
prev = curr; prev = curr;
} }
/* How much to move. */ /* How much to move. */
len = dup - src; len = dupes - src;
i = dup + 1; i = dupes + 1;
if (len == 1 && dup < count) if (len == 1 && dupes < count)
{ {
/* If we only move 1 element, we combine it with the next /* If we only move 1 element, we combine it with the next
one. There must be at least a duplicate. Find the one. There must be at least a duplicate. Find the
next different one. */ next different one. */
for (diff = dup + 1, src++; diff < count; diff++, src++) for (diff = dupes + 1, src++; diff < count; diff++, src++)
{ {
if (info [diff].addend != curr) if (info [diff].addend != curr)
break; break;
@ -2249,18 +2249,18 @@ sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info,
offset. */ offset. */
prev = info [diff].addend; prev = info [diff].addend;
got_offset = info [diff].got_offset; got_offset = info [diff].got_offset;
for (dup = diff + 1; dup < count; dup++) for (dupes = diff + 1; dupes < count; dupes ++)
{ {
curr = info [dup].addend; curr = info [dupes].addend;
if (curr == prev) if (curr == prev)
{ {
/* For duplicates, make sure that GOT_OFFSET /* For duplicates, make sure that GOT_OFFSET
is valid. */ is valid. */
if (got_offset == (bfd_vma) -1) if (got_offset == (bfd_vma) -1)
got_offset = info [dup].got_offset; got_offset = info [dupes].got_offset;
break; break;
} }
got_offset = info [dup].got_offset; got_offset = info [dupes].got_offset;
prev = curr; prev = curr;
diff++; diff++;
} }
@ -5241,18 +5241,18 @@ elfNN_ia64_finish_dynamic_symbol (bfd *output_bfd,
Elf_Internal_Rela outrel; Elf_Internal_Rela outrel;
bfd_byte *loc; bfd_byte *loc;
asection *plt_sec; asection *plt_sec;
bfd_vma plt_addr, pltoff_addr, gp_val, index; bfd_vma plt_addr, pltoff_addr, gp_val, plt_index;
gp_val = _bfd_get_gp_value (output_bfd); gp_val = _bfd_get_gp_value (output_bfd);
/* Initialize the minimal PLT entry. */ /* Initialize the minimal PLT entry. */
index = (dyn_i->plt_offset - PLT_HEADER_SIZE) / PLT_MIN_ENTRY_SIZE; plt_index = (dyn_i->plt_offset - PLT_HEADER_SIZE) / PLT_MIN_ENTRY_SIZE;
plt_sec = ia64_info->root.splt; plt_sec = ia64_info->root.splt;
loc = plt_sec->contents + dyn_i->plt_offset; loc = plt_sec->contents + dyn_i->plt_offset;
memcpy (loc, plt_min_entry, PLT_MIN_ENTRY_SIZE); memcpy (loc, plt_min_entry, PLT_MIN_ENTRY_SIZE);
elfNN_ia64_install_value (loc, index, R_IA64_IMM22); elfNN_ia64_install_value (loc, plt_index, R_IA64_IMM22);
elfNN_ia64_install_value (loc+2, -dyn_i->plt_offset, R_IA64_PCREL21B); elfNN_ia64_install_value (loc+2, -dyn_i->plt_offset, R_IA64_PCREL21B);
plt_addr = (plt_sec->output_section->vma plt_addr = (plt_sec->output_section->vma
@ -5297,7 +5297,7 @@ elfNN_ia64_finish_dynamic_symbol (bfd *output_bfd,
PLT relocations. */ PLT relocations. */
loc = ia64_info->rel_pltoff_sec->contents; loc = ia64_info->rel_pltoff_sec->contents;
loc += ((ia64_info->rel_pltoff_sec->reloc_count + index) loc += ((ia64_info->rel_pltoff_sec->reloc_count + plt_index)
* sizeof (ElfNN_External_Rela)); * sizeof (ElfNN_External_Rela));
bfd_elfNN_swap_reloca_out (output_bfd, &outrel, loc); bfd_elfNN_swap_reloca_out (output_bfd, &outrel, loc);
} }

View File

@ -177,7 +177,8 @@ struct mips_got_info
/* Map an input bfd to a got in a multi-got link. */ /* Map an input bfd to a got in a multi-got link. */
struct mips_elf_bfd2got_hash { struct mips_elf_bfd2got_hash
{
bfd *bfd; bfd *bfd;
struct mips_got_info *g; struct mips_got_info *g;
}; };
@ -3064,7 +3065,7 @@ mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h,
int r_type, struct bfd_link_info *info) int r_type, struct bfd_link_info *info)
{ {
struct mips_elf_link_hash_table *htab; struct mips_elf_link_hash_table *htab;
bfd_vma index; bfd_vma got_index;
struct mips_got_info *g, *gg; struct mips_got_info *g, *gg;
long global_got_dynindx = 0; long global_got_dynindx = 0;
@ -3122,8 +3123,8 @@ mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h,
+ h->root.u.def.section->output_offset + h->root.u.def.section->output_offset
+ h->root.u.def.section->output_section->vma); + h->root.u.def.section->output_section->vma);
index = mips_tls_got_index (abfd, hm->tls_got_offset, &hm->tls_type, got_index = mips_tls_got_index (abfd, hm->tls_got_offset, &hm->tls_type,
r_type, info, hm, value); r_type, info, hm, value);
} }
else else
{ {
@ -3132,12 +3133,12 @@ mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h,
indices into the GOT. That makes it easy to calculate the GOT indices into the GOT. That makes it easy to calculate the GOT
offset. */ offset. */
BFD_ASSERT (h->dynindx >= global_got_dynindx); BFD_ASSERT (h->dynindx >= global_got_dynindx);
index = ((h->dynindx - global_got_dynindx + g->local_gotno) got_index = ((h->dynindx - global_got_dynindx + g->local_gotno)
* MIPS_ELF_GOT_SIZE (abfd)); * MIPS_ELF_GOT_SIZE (abfd));
} }
BFD_ASSERT (index < htab->sgot->size); BFD_ASSERT (got_index < htab->sgot->size);
return index; return got_index;
} }
/* Find a GOT page entry that points to within 32KB of VALUE. These /* Find a GOT page entry that points to within 32KB of VALUE. These
@ -3150,7 +3151,7 @@ static bfd_vma
mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
bfd_vma value, bfd_vma *offsetp) bfd_vma value, bfd_vma *offsetp)
{ {
bfd_vma page, index; bfd_vma page, got_index;
struct mips_got_entry *entry; struct mips_got_entry *entry;
page = (value + 0x8000) & ~(bfd_vma) 0xffff; page = (value + 0x8000) & ~(bfd_vma) 0xffff;
@ -3160,12 +3161,12 @@ mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
if (!entry) if (!entry)
return MINUS_ONE; return MINUS_ONE;
index = entry->gotidx; got_index = entry->gotidx;
if (offsetp) if (offsetp)
*offsetp = value - entry->d.address; *offsetp = value - entry->d.address;
return index; return got_index;
} }
/* Find a local GOT entry for an R_MIPS*_GOT16 relocation against VALUE. /* Find a local GOT entry for an R_MIPS*_GOT16 relocation against VALUE.
@ -3201,7 +3202,7 @@ mips_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
static bfd_vma static bfd_vma
mips_elf_got_offset_from_index (struct bfd_link_info *info, bfd *output_bfd, mips_elf_got_offset_from_index (struct bfd_link_info *info, bfd *output_bfd,
bfd *input_bfd, bfd_vma index) bfd *input_bfd, bfd_vma got_index)
{ {
struct mips_elf_link_hash_table *htab; struct mips_elf_link_hash_table *htab;
asection *sgot; asection *sgot;
@ -3212,7 +3213,7 @@ mips_elf_got_offset_from_index (struct bfd_link_info *info, bfd *output_bfd,
gp = _bfd_get_gp_value (output_bfd) gp = _bfd_get_gp_value (output_bfd)
+ mips_elf_adjust_gp (output_bfd, htab->got_info, input_bfd); + mips_elf_adjust_gp (output_bfd, htab->got_info, input_bfd);
return sgot->output_section->vma + sgot->output_offset + index - gp; return sgot->output_section->vma + sgot->output_offset + got_index - gp;
} }
/* Create and return a local GOT entry for VALUE, which was calculated /* Create and return a local GOT entry for VALUE, which was calculated
@ -3309,7 +3310,7 @@ mips_elf_create_local_got_entry (bfd *abfd, struct bfd_link_info *info,
{ {
Elf_Internal_Rela outrel; Elf_Internal_Rela outrel;
asection *s; asection *s;
bfd_byte *loc; bfd_byte *rloc;
bfd_vma got_address; bfd_vma got_address;
s = mips_elf_rel_dyn_section (info, FALSE); s = mips_elf_rel_dyn_section (info, FALSE);
@ -3317,11 +3318,11 @@ mips_elf_create_local_got_entry (bfd *abfd, struct bfd_link_info *info,
+ htab->sgot->output_offset + htab->sgot->output_offset
+ entry.gotidx); + entry.gotidx);
loc = s->contents + (s->reloc_count++ * sizeof (Elf32_External_Rela)); rloc = s->contents + (s->reloc_count++ * sizeof (Elf32_External_Rela));
outrel.r_offset = got_address; outrel.r_offset = got_address;
outrel.r_info = ELF32_R_INFO (STN_UNDEF, R_MIPS_32); outrel.r_info = ELF32_R_INFO (STN_UNDEF, R_MIPS_32);
outrel.r_addend = value; outrel.r_addend = value;
bfd_elf32_swap_reloca_out (abfd, &outrel, loc); bfd_elf32_swap_reloca_out (abfd, &outrel, rloc);
} }
return *loc; return *loc;
@ -8975,8 +8976,6 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (!mips_elf_add_lo16_rel_addend (input_bfd, rel, relend, if (!mips_elf_add_lo16_rel_addend (input_bfd, rel, relend,
contents, &addend)) contents, &addend))
{ {
const char *name;
if (h) if (h)
name = h->root.root.string; name = h->root.root.string;
else else
@ -9122,9 +9121,8 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
&& (howto->type == R_MIPS_GPREL16 && (howto->type == R_MIPS_GPREL16
|| howto->type == R_MIPS_LITERAL)) || howto->type == R_MIPS_LITERAL))
{ {
const char *msg = msg = _("small-data section exceeds 64KB;"
_("small-data section exceeds 64KB;" " lower small-data size limit (see option -G)");
" lower small-data size limit (see option -G)");
htab->small_data_overflow_reported = TRUE; htab->small_data_overflow_reported = TRUE;
(*info->callbacks->einfo) ("%P: %s\n", msg); (*info->callbacks->einfo) ("%P: %s\n", msg);
@ -10226,22 +10224,22 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
for (g = gg->next; g->next != gg; g = g->next) for (g = gg->next; g->next != gg; g = g->next)
{ {
bfd_vma index = g->next->local_gotno + g->next->global_gotno bfd_vma got_index = g->next->local_gotno + g->next->global_gotno
+ g->next->tls_gotno; + g->next->tls_gotno;
MIPS_ELF_PUT_WORD (output_bfd, 0, sgot->contents MIPS_ELF_PUT_WORD (output_bfd, 0, sgot->contents
+ index++ * MIPS_ELF_GOT_SIZE (output_bfd)); + got_index++ * MIPS_ELF_GOT_SIZE (output_bfd));
MIPS_ELF_PUT_WORD (output_bfd, MIPS_ELF_GNU_GOT1_MASK (output_bfd), MIPS_ELF_PUT_WORD (output_bfd, MIPS_ELF_GNU_GOT1_MASK (output_bfd),
sgot->contents sgot->contents
+ index++ * MIPS_ELF_GOT_SIZE (output_bfd)); + got_index++ * MIPS_ELF_GOT_SIZE (output_bfd));
if (! info->shared) if (! info->shared)
continue; continue;
while (index < g->assigned_gotno) while (got_index < g->assigned_gotno)
{ {
rel[0].r_offset = rel[1].r_offset = rel[2].r_offset rel[0].r_offset = rel[1].r_offset = rel[2].r_offset
= index++ * MIPS_ELF_GOT_SIZE (output_bfd); = got_index++ * MIPS_ELF_GOT_SIZE (output_bfd);
if (!(mips_elf_create_dynamic_relocation if (!(mips_elf_create_dynamic_relocation
(output_bfd, info, rel, NULL, (output_bfd, info, rel, NULL,
bfd_abs_section_ptr, bfd_abs_section_ptr,

View File

@ -533,15 +533,15 @@ _bfd_sparc_elf_mkobject (bfd *abfd)
} }
static void static void
sparc_put_word_32 (bfd *bfd, bfd_vma val, void *ptr) sparc_put_word_32 (bfd *abfd, bfd_vma val, void *ptr)
{ {
bfd_put_32 (bfd, val, ptr); bfd_put_32 (abfd, val, ptr);
} }
static void static void
sparc_put_word_64 (bfd *bfd, bfd_vma val, void *ptr) sparc_put_word_64 (bfd *abfd, bfd_vma val, void *ptr)
{ {
bfd_put_64 (bfd, val, ptr); bfd_put_64 (abfd, val, ptr);
} }
static void static void
@ -557,10 +557,10 @@ sparc_elf_append_rela (bfd *abfd, asection *s, Elf_Internal_Rela *rel)
static bfd_vma static bfd_vma
sparc_elf_r_info_64 (Elf_Internal_Rela *in_rel ATTRIBUTE_UNUSED, sparc_elf_r_info_64 (Elf_Internal_Rela *in_rel ATTRIBUTE_UNUSED,
bfd_vma index ATTRIBUTE_UNUSED, bfd_vma rel_index ATTRIBUTE_UNUSED,
bfd_vma type ATTRIBUTE_UNUSED) bfd_vma type ATTRIBUTE_UNUSED)
{ {
return ELF64_R_INFO (index, return ELF64_R_INFO (rel_index,
(in_rel ? (in_rel ?
ELF64_R_TYPE_INFO (ELF64_R_TYPE_DATA (in_rel->r_info), ELF64_R_TYPE_INFO (ELF64_R_TYPE_DATA (in_rel->r_info),
type) : type)); type) : type));
@ -568,9 +568,9 @@ sparc_elf_r_info_64 (Elf_Internal_Rela *in_rel ATTRIBUTE_UNUSED,
static bfd_vma static bfd_vma
sparc_elf_r_info_32 (Elf_Internal_Rela *in_rel ATTRIBUTE_UNUSED, sparc_elf_r_info_32 (Elf_Internal_Rela *in_rel ATTRIBUTE_UNUSED,
bfd_vma index, bfd_vma type) bfd_vma rel_index, bfd_vma type)
{ {
return ELF32_R_INFO (index, type); return ELF32_R_INFO (rel_index, type);
} }
static bfd_vma static bfd_vma
@ -634,7 +634,7 @@ sparc64_plt_entry_build (bfd *output_bfd, asection *splt, bfd_vma offset,
{ {
unsigned char *entry = splt->contents + offset; unsigned char *entry = splt->contents + offset;
const unsigned int nop = SPARC_NOP; const unsigned int nop = SPARC_NOP;
int index; int plt_index;
if (offset < (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE)) if (offset < (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE))
{ {
@ -642,9 +642,9 @@ sparc64_plt_entry_build (bfd *output_bfd, asection *splt, bfd_vma offset,
*r_offset = offset; *r_offset = offset;
index = (offset / PLT64_ENTRY_SIZE); plt_index = (offset / PLT64_ENTRY_SIZE);
sethi = 0x03000000 | (index * PLT64_ENTRY_SIZE); sethi = 0x03000000 | (plt_index * PLT64_ENTRY_SIZE);
ba = 0x30680000 ba = 0x30680000
| (((splt->contents + PLT64_ENTRY_SIZE) - (entry + 4)) / 4 & 0x7ffff); | (((splt->contents + PLT64_ENTRY_SIZE) - (entry + 4)) / 4 & 0x7ffff);
@ -691,7 +691,7 @@ sparc64_plt_entry_build (bfd *output_bfd, asection *splt, bfd_vma offset,
ofs = offset % block_size; ofs = offset % block_size;
index = (PLT64_LARGE_THRESHOLD + plt_index = (PLT64_LARGE_THRESHOLD +
(block * 160) + (block * 160) +
(ofs / insn_chunk_size)); (ofs / insn_chunk_size));
@ -721,7 +721,7 @@ sparc64_plt_entry_build (bfd *output_bfd, asection *splt, bfd_vma offset,
bfd_put_64 (output_bfd, (bfd_vma) (splt->contents - (entry + 4)), ptr); bfd_put_64 (output_bfd, (bfd_vma) (splt->contents - (entry + 4)), ptr);
} }
return index - 4; return plt_index - 4;
} }
/* The format of the first PLT entry in a VxWorks executable. */ /* The format of the first PLT entry in a VxWorks executable. */

View File

@ -425,7 +425,7 @@ bfd_hash_lookup (struct bfd_hash_table *table,
unsigned int c; unsigned int c;
struct bfd_hash_entry *hashp; struct bfd_hash_entry *hashp;
unsigned int len; unsigned int len;
unsigned int index; unsigned int _index;
hash = 0; hash = 0;
len = 0; len = 0;
@ -439,8 +439,8 @@ bfd_hash_lookup (struct bfd_hash_table *table,
hash += len + (len << 17); hash += len + (len << 17);
hash ^= hash >> 2; hash ^= hash >> 2;
index = hash % table->size; _index = hash % table->size;
for (hashp = table->table[index]; for (hashp = table->table[_index];
hashp != NULL; hashp != NULL;
hashp = hashp->next) hashp = hashp->next)
{ {
@ -478,16 +478,16 @@ bfd_hash_insert (struct bfd_hash_table *table,
unsigned long hash) unsigned long hash)
{ {
struct bfd_hash_entry *hashp; struct bfd_hash_entry *hashp;
unsigned int index; unsigned int _index;
hashp = (*table->newfunc) (NULL, table, string); hashp = (*table->newfunc) (NULL, table, string);
if (hashp == NULL) if (hashp == NULL)
return NULL; return NULL;
hashp->string = string; hashp->string = string;
hashp->hash = hash; hashp->hash = hash;
index = hash % table->size; _index = hash % table->size;
hashp->next = table->table[index]; hashp->next = table->table[_index];
table->table[index] = hashp; table->table[_index] = hashp;
table->count++; table->count++;
if (!table->frozen && table->count > table->size * 3 / 4) if (!table->frozen && table->count > table->size * 3 / 4)
@ -524,9 +524,9 @@ bfd_hash_insert (struct bfd_hash_table *table,
chain_end = chain_end->next; chain_end = chain_end->next;
table->table[hi] = chain_end->next; table->table[hi] = chain_end->next;
index = chain->hash % newsize; _index = chain->hash % newsize;
chain_end->next = newtable[index]; chain_end->next = newtable[_index];
newtable[index] = chain; newtable[_index] = chain;
} }
table->table = newtable; table->table = newtable;
table->size = newsize; table->size = newsize;
@ -542,11 +542,11 @@ bfd_hash_replace (struct bfd_hash_table *table,
struct bfd_hash_entry *old, struct bfd_hash_entry *old,
struct bfd_hash_entry *nw) struct bfd_hash_entry *nw)
{ {
unsigned int index; unsigned int _index;
struct bfd_hash_entry **pph; struct bfd_hash_entry **pph;
index = old->hash % table->size; _index = old->hash % table->size;
for (pph = &table->table[index]; for (pph = &table->table[_index];
(*pph) != NULL; (*pph) != NULL;
pph = &(*pph)->next) pph = &(*pph)->next)
{ {
@ -617,14 +617,14 @@ bfd_hash_set_default_size (bfd_size_type hash_size)
{ {
251, 509, 1021, 2039, 4051, 8599, 16699, 32749 251, 509, 1021, 2039, 4051, 8599, 16699, 32749
}; };
size_t index; size_t _index;
/* Work out best prime number near the hash_size. */ /* Work out best prime number near the hash_size. */
for (index = 0; index < ARRAY_SIZE (hash_size_primes) - 1; ++index) for (_index = 0; _index < ARRAY_SIZE (hash_size_primes) - 1; ++_index)
if (hash_size <= hash_size_primes[index]) if (hash_size <= hash_size_primes[_index])
break; break;
bfd_default_hash_table_size = hash_size_primes[index]; bfd_default_hash_table_size = hash_size_primes[_index];
} }
/* A few different object file formats (a.out, COFF, ELF) use a string /* A few different object file formats (a.out, COFF, ELF) use a string

View File

@ -228,7 +228,7 @@ ieee_write_expression (bfd *abfd,
bfd_vma value, bfd_vma value,
asymbol *symbol, asymbol *symbol,
bfd_boolean pcrel, bfd_boolean pcrel,
unsigned int index) unsigned int sindex)
{ {
unsigned int term_count = 0; unsigned int term_count = 0;
@ -297,7 +297,7 @@ ieee_write_expression (bfd *abfd,
/* Subtract the pc from here by asking for PC of this section. */ /* Subtract the pc from here by asking for PC of this section. */
if (! ieee_write_byte (abfd, ieee_variable_P_enum) if (! ieee_write_byte (abfd, ieee_variable_P_enum)
|| ! ieee_write_byte (abfd, || ! ieee_write_byte (abfd,
(bfd_byte) (index + IEEE_SECTION_NUMBER_BASE)) (bfd_byte) (sindex + IEEE_SECTION_NUMBER_BASE))
|| ! ieee_write_byte (abfd, ieee_function_minus_enum)) || ! ieee_write_byte (abfd, ieee_function_minus_enum))
return FALSE; return FALSE;
} }
@ -1045,9 +1045,9 @@ ieee_canonicalize_symtab (bfd *abfd, asymbol **location)
} }
static asection * static asection *
get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int index) get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int sindex)
{ {
if (index >= ieee->section_table_size) if (sindex >= ieee->section_table_size)
{ {
unsigned int c, i; unsigned int c, i;
asection **n; asection **n;
@ -1056,7 +1056,7 @@ get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int index)
c = ieee->section_table_size; c = ieee->section_table_size;
if (c == 0) if (c == 0)
c = 20; c = 20;
while (c <= index) while (c <= sindex)
c *= 2; c *= 2;
amt = c; amt = c;
@ -1072,20 +1072,20 @@ get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int index)
ieee->section_table_size = c; ieee->section_table_size = c;
} }
if (ieee->section_table[index] == (asection *) NULL) if (ieee->section_table[sindex] == (asection *) NULL)
{ {
char *tmp = bfd_alloc (abfd, (bfd_size_type) 11); char *tmp = bfd_alloc (abfd, (bfd_size_type) 11);
asection *section; asection *section;
if (!tmp) if (!tmp)
return NULL; return NULL;
sprintf (tmp, " fsec%4d", index); sprintf (tmp, " fsec%4d", sindex);
section = bfd_make_section (abfd, tmp); section = bfd_make_section (abfd, tmp);
ieee->section_table[index] = section; ieee->section_table[sindex] = section;
section->target_index = index; section->target_index = sindex;
ieee->section_table[index] = section; ieee->section_table[sindex] = section;
} }
return ieee->section_table[index]; return ieee->section_table[sindex];
} }
static void static void

View File

@ -1,6 +1,6 @@
/* Assorted BFD support routines, only used internally. /* Assorted BFD support routines, only used internally.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by Cygnus Support. Written by Cygnus Support.
@ -804,9 +804,9 @@ bfd_put_bits (bfd_uint64_t data, void *p, int bits, bfd_boolean big_p)
bytes = bits / 8; bytes = bits / 8;
for (i = 0; i < bytes; i++) for (i = 0; i < bytes; i++)
{ {
int index = big_p ? bytes - i - 1 : i; int addr_index = big_p ? bytes - i - 1 : i;
addr[index] = data & 0xff; addr[addr_index] = data & 0xff;
data >>= 8; data >>= 8;
} }
} }
@ -826,9 +826,9 @@ bfd_get_bits (const void *p, int bits, bfd_boolean big_p)
bytes = bits / 8; bytes = bits / 8;
for (i = 0; i < bytes; i++) for (i = 0; i < bytes; i++)
{ {
int index = big_p ? i : bytes - i - 1; int addr_index = big_p ? i : bytes - i - 1;
data = (data << 8) | addr[index]; data = (data << 8) | addr[addr_index];
} }
return data; return data;

View File

@ -428,8 +428,7 @@ bfd_mach_o_get_synthetic_symtab (bfd *abfd,
for (i = 0; i < mdata->nsects; i++) for (i = 0; i < mdata->nsects; i++)
{ {
bfd_mach_o_section *sec = mdata->sections[i]; bfd_mach_o_section *sec = mdata->sections[i];
unsigned int j, first, last; unsigned int first, last;
bfd_mach_o_symtab_command *symtab = mdata->symtab;
bfd_vma addr; bfd_vma addr;
bfd_vma entry_size; bfd_vma entry_size;
@ -490,7 +489,7 @@ bfd_mach_o_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
void void
bfd_mach_o_print_symbol (bfd *abfd, bfd_mach_o_print_symbol (bfd *abfd,
PTR afile, void * afile,
asymbol *symbol, asymbol *symbol,
bfd_print_symbol_type how) bfd_print_symbol_type how)
{ {
@ -504,7 +503,7 @@ bfd_mach_o_print_symbol (bfd *abfd,
fprintf (file, "%s", symbol->name); fprintf (file, "%s", symbol->name);
break; break;
default: default:
bfd_print_symbol_vandf (abfd, (PTR) file, symbol); bfd_print_symbol_vandf (abfd, (void *) file, symbol);
if (asym->n_type & BFD_MACH_O_N_STAB) if (asym->n_type & BFD_MACH_O_N_STAB)
name = bfd_get_stab_name (asym->n_type); name = bfd_get_stab_name (asym->n_type);
else else
@ -606,7 +605,7 @@ bfd_mach_o_write_header (bfd *abfd, bfd_mach_o_header *header)
bfd_h_put_32 (abfd, header->reserved, buf + 28); bfd_h_put_32 (abfd, header->reserved, buf + 28);
if (bfd_seek (abfd, 0, SEEK_SET) != 0 if (bfd_seek (abfd, 0, SEEK_SET) != 0
|| bfd_bwrite ((PTR) buf, size, abfd) != size) || bfd_bwrite ((void *) buf, size, abfd) != size)
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -635,7 +634,7 @@ bfd_mach_o_write_thread (bfd *abfd, bfd_mach_o_load_command *command)
bfd_h_put_32 (abfd, (cmd->flavours[i].size / 4), buf + 4); bfd_h_put_32 (abfd, (cmd->flavours[i].size / 4), buf + 4);
if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0
|| bfd_bwrite ((PTR) buf, 8, abfd) != 8) || bfd_bwrite ((void *) buf, 8, abfd) != 8)
return -1; return -1;
offset += cmd->flavours[i].size + 8; offset += cmd->flavours[i].size + 8;
@ -900,7 +899,7 @@ bfd_mach_o_write_relocs (bfd *abfd, bfd_mach_o_section *section)
bfd_put_32 (abfd, v, buf + 4); bfd_put_32 (abfd, v, buf + 4);
} }
if (bfd_bwrite ((PTR) buf, BFD_MACH_O_RELENT_SIZE, abfd) if (bfd_bwrite ((void *) buf, BFD_MACH_O_RELENT_SIZE, abfd)
!= BFD_MACH_O_RELENT_SIZE) != BFD_MACH_O_RELENT_SIZE)
return FALSE; return FALSE;
} }
@ -924,7 +923,7 @@ bfd_mach_o_write_section_32 (bfd *abfd, bfd_mach_o_section *section)
bfd_h_put_32 (abfd, section->reserved1, buf + 60); bfd_h_put_32 (abfd, section->reserved1, buf + 60);
bfd_h_put_32 (abfd, section->reserved2, buf + 64); bfd_h_put_32 (abfd, section->reserved2, buf + 64);
if (bfd_bwrite ((PTR) buf, BFD_MACH_O_SECTION_SIZE, abfd) if (bfd_bwrite ((void *) buf, BFD_MACH_O_SECTION_SIZE, abfd)
!= BFD_MACH_O_SECTION_SIZE) != BFD_MACH_O_SECTION_SIZE)
return -1; return -1;
@ -949,7 +948,7 @@ bfd_mach_o_write_section_64 (bfd *abfd, bfd_mach_o_section *section)
bfd_h_put_32 (abfd, section->reserved2, buf + 72); bfd_h_put_32 (abfd, section->reserved2, buf + 72);
bfd_h_put_32 (abfd, section->reserved3, buf + 76); bfd_h_put_32 (abfd, section->reserved3, buf + 76);
if (bfd_bwrite ((PTR) buf, BFD_MACH_O_SECTION_64_SIZE, abfd) if (bfd_bwrite ((void *) buf, BFD_MACH_O_SECTION_64_SIZE, abfd)
!= BFD_MACH_O_SECTION_64_SIZE) != BFD_MACH_O_SECTION_64_SIZE)
return -1; return -1;
@ -980,7 +979,7 @@ bfd_mach_o_write_segment_32 (bfd *abfd, bfd_mach_o_load_command *command)
bfd_h_put_32 (abfd, seg->flags, buf + 44); bfd_h_put_32 (abfd, seg->flags, buf + 44);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
|| (bfd_bwrite ((PTR) buf, BFD_MACH_O_LC_SEGMENT_SIZE - 8, abfd) || (bfd_bwrite ((void *) buf, BFD_MACH_O_LC_SEGMENT_SIZE - 8, abfd)
!= BFD_MACH_O_LC_SEGMENT_SIZE - 8)) != BFD_MACH_O_LC_SEGMENT_SIZE - 8))
return -1; return -1;
@ -1015,7 +1014,7 @@ bfd_mach_o_write_segment_64 (bfd *abfd, bfd_mach_o_load_command *command)
bfd_h_put_32 (abfd, seg->flags, buf + 60); bfd_h_put_32 (abfd, seg->flags, buf + 60);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
|| (bfd_bwrite ((PTR) buf, BFD_MACH_O_LC_SEGMENT_64_SIZE - 8, abfd) || (bfd_bwrite ((void *) buf, BFD_MACH_O_LC_SEGMENT_64_SIZE - 8, abfd)
!= BFD_MACH_O_LC_SEGMENT_64_SIZE - 8)) != BFD_MACH_O_LC_SEGMENT_64_SIZE - 8))
return -1; return -1;
@ -1055,21 +1054,20 @@ bfd_mach_o_write_symtab (bfd *abfd, bfd_mach_o_load_command *command)
for (i = 0; i < sym->nsyms; i++) for (i = 0; i < sym->nsyms; i++)
{ {
unsigned char buf[16]; bfd_size_type str_index;
bfd_size_type index;
bfd_mach_o_asymbol *s = (bfd_mach_o_asymbol *)symbols[i]; bfd_mach_o_asymbol *s = (bfd_mach_o_asymbol *)symbols[i];
/* Compute name index. */ /* Compute name index. */
/* An index of 0 always means the empty string. */ /* An index of 0 always means the empty string. */
if (s->symbol.name == 0 || s->symbol.name[0] == '\0') if (s->symbol.name == 0 || s->symbol.name[0] == '\0')
index = 0; str_index = 0;
else else
{ {
index = _bfd_stringtab_add (strtab, s->symbol.name, TRUE, FALSE); str_index = _bfd_stringtab_add (strtab, s->symbol.name, TRUE, FALSE);
if (index == (bfd_size_type) -1) if (str_index == (bfd_size_type) -1)
goto err; goto err;
} }
bfd_h_put_32 (abfd, index, buf); bfd_h_put_32 (abfd, str_index, buf);
bfd_h_put_8 (abfd, s->n_type, buf + 4); bfd_h_put_8 (abfd, s->n_type, buf + 4);
bfd_h_put_8 (abfd, s->n_sect, buf + 5); bfd_h_put_8 (abfd, s->n_sect, buf + 5);
bfd_h_put_16 (abfd, s->n_desc, buf + 6); bfd_h_put_16 (abfd, s->n_desc, buf + 6);
@ -1078,7 +1076,7 @@ bfd_mach_o_write_symtab (bfd *abfd, bfd_mach_o_load_command *command)
else else
bfd_h_put_32 (abfd, s->symbol.section->vma + s->symbol.value, buf + 8); bfd_h_put_32 (abfd, s->symbol.section->vma + s->symbol.value, buf + 8);
if (bfd_bwrite ((PTR) buf, symlen, abfd) != symlen) if (bfd_bwrite ((void *) buf, symlen, abfd) != symlen)
goto err; goto err;
} }
sym->strsize = _bfd_stringtab_size (strtab); sym->strsize = _bfd_stringtab_size (strtab);
@ -1096,7 +1094,7 @@ bfd_mach_o_write_symtab (bfd *abfd, bfd_mach_o_load_command *command)
bfd_h_put_32 (abfd, sym->strsize, buf + 12); bfd_h_put_32 (abfd, sym->strsize, buf + 12);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
|| bfd_bwrite ((PTR) buf, 16, abfd) != 16) || bfd_bwrite ((void *) buf, 16, abfd) != 16)
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -1192,7 +1190,7 @@ bfd_mach_o_write_contents (bfd *abfd)
bfd_h_put_32 (abfd, cur->len, buf + 4); bfd_h_put_32 (abfd, cur->len, buf + 4);
if (bfd_seek (abfd, cur->offset, SEEK_SET) != 0 if (bfd_seek (abfd, cur->offset, SEEK_SET) != 0
|| bfd_bwrite ((PTR) buf, 8, abfd) != 8) || bfd_bwrite ((void *) buf, 8, abfd) != 8)
return FALSE; return FALSE;
switch (cur->type) switch (cur->type)
@ -1410,7 +1408,7 @@ bfd_mach_o_read_header (bfd *abfd, bfd_mach_o_header *header)
/* Just read the magic number. */ /* Just read the magic number. */
if (bfd_seek (abfd, 0, SEEK_SET) != 0 if (bfd_seek (abfd, 0, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 4, abfd) != 4) || bfd_bread ((void *) buf, 4, abfd) != 4)
return FALSE; return FALSE;
if (bfd_getb32 (buf) == BFD_MACH_O_MH_MAGIC) if (bfd_getb32 (buf) == BFD_MACH_O_MH_MAGIC)
@ -1452,7 +1450,7 @@ bfd_mach_o_read_header (bfd *abfd, bfd_mach_o_header *header)
BFD_MACH_O_HEADER_64_SIZE : BFD_MACH_O_HEADER_SIZE; BFD_MACH_O_HEADER_64_SIZE : BFD_MACH_O_HEADER_SIZE;
if (bfd_seek (abfd, 0, SEEK_SET) != 0 if (bfd_seek (abfd, 0, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, size, abfd) != size) || bfd_bread ((void *) buf, size, abfd) != size)
return FALSE; return FALSE;
header->cputype = (*get32) (buf + 4); header->cputype = (*get32) (buf + 4);
@ -1530,7 +1528,7 @@ bfd_mach_o_read_section_32 (bfd *abfd,
unsigned char buf[BFD_MACH_O_SECTION_SIZE]; unsigned char buf[BFD_MACH_O_SECTION_SIZE];
if (bfd_seek (abfd, offset, SEEK_SET) != 0 if (bfd_seek (abfd, offset, SEEK_SET) != 0
|| (bfd_bread ((PTR) buf, BFD_MACH_O_SECTION_SIZE, abfd) || (bfd_bread ((void *) buf, BFD_MACH_O_SECTION_SIZE, abfd)
!= BFD_MACH_O_SECTION_SIZE)) != BFD_MACH_O_SECTION_SIZE))
return -1; return -1;
@ -1565,7 +1563,7 @@ bfd_mach_o_read_section_64 (bfd *abfd,
unsigned char buf[BFD_MACH_O_SECTION_64_SIZE]; unsigned char buf[BFD_MACH_O_SECTION_64_SIZE];
if (bfd_seek (abfd, offset, SEEK_SET) != 0 if (bfd_seek (abfd, offset, SEEK_SET) != 0
|| (bfd_bread ((PTR) buf, BFD_MACH_O_SECTION_64_SIZE, abfd) || (bfd_bread ((void *) buf, BFD_MACH_O_SECTION_64_SIZE, abfd)
!= BFD_MACH_O_SECTION_64_SIZE)) != BFD_MACH_O_SECTION_64_SIZE))
return -1; return -1;
@ -1626,7 +1624,7 @@ bfd_mach_o_read_symtab_symbol (bfd *abfd,
BFD_ASSERT (sym->strtab != NULL); BFD_ASSERT (sym->strtab != NULL);
if (bfd_seek (abfd, symoff, SEEK_SET) != 0 if (bfd_seek (abfd, symoff, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, symwidth, abfd) != symwidth) || bfd_bread ((void *) buf, symwidth, abfd) != symwidth)
{ {
fprintf (stderr, "bfd_mach_o_read_symtab_symbol: unable to read %d bytes at %lu\n", fprintf (stderr, "bfd_mach_o_read_symtab_symbol: unable to read %d bytes at %lu\n",
symwidth, (unsigned long) symoff); symwidth, (unsigned long) symoff);
@ -1788,7 +1786,7 @@ bfd_mach_o_read_symtab_strtab (bfd *abfd)
return -1; return -1;
if (bfd_seek (abfd, sym->stroff, SEEK_SET) != 0 if (bfd_seek (abfd, sym->stroff, SEEK_SET) != 0
|| bfd_bread ((PTR) sym->strtab, sym->strsize, abfd) != sym->strsize) || bfd_bread ((void *) sym->strtab, sym->strsize, abfd) != sym->strsize)
{ {
bfd_set_error (bfd_error_file_truncated); bfd_set_error (bfd_error_file_truncated);
return -1; return -1;
@ -1839,21 +1837,21 @@ bfd_mach_o_read_dysymtab_symbol (bfd *abfd,
unsigned long i) unsigned long i)
{ {
unsigned long isymoff = dysym->indirectsymoff + (i * 4); unsigned long isymoff = dysym->indirectsymoff + (i * 4);
unsigned long symindex; unsigned long sym_index;
unsigned char buf[4]; unsigned char buf[4];
BFD_ASSERT (i < dysym->nindirectsyms); BFD_ASSERT (i < dysym->nindirectsyms);
if (bfd_seek (abfd, isymoff, SEEK_SET) != 0 if (bfd_seek (abfd, isymoff, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 4, abfd) != 4) || bfd_bread ((void *) buf, 4, abfd) != 4)
{ {
fprintf (stderr, "bfd_mach_o_read_dysymtab_symbol: unable to read %lu bytes at %lu\n", fprintf (stderr, "bfd_mach_o_read_dysymtab_symbol: unable to read %lu bytes at %lu\n",
(unsigned long) 4, isymoff); (unsigned long) 4, isymoff);
return -1; return -1;
} }
symindex = bfd_h_get_32 (abfd, buf); sym_index = bfd_h_get_32 (abfd, buf);
return bfd_mach_o_read_symtab_symbol (abfd, sym, s, symindex); return bfd_mach_o_read_symtab_symbol (abfd, sym, s, sym_index);
} }
static const char * static const char *
@ -1904,7 +1902,7 @@ bfd_mach_o_read_dylinker (bfd *abfd, bfd_mach_o_load_command *command)
|| (command->type == BFD_MACH_O_LC_LOAD_DYLINKER)); || (command->type == BFD_MACH_O_LC_LOAD_DYLINKER));
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 4, abfd) != 4) || bfd_bread ((void *) buf, 4, abfd) != 4)
return -1; return -1;
nameoff = bfd_h_get_32 (abfd, buf + 0); nameoff = bfd_h_get_32 (abfd, buf + 0);
@ -1940,7 +1938,7 @@ bfd_mach_o_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
} }
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 16, abfd) != 16) || bfd_bread ((void *) buf, 16, abfd) != 16)
return -1; return -1;
nameoff = bfd_h_get_32 (abfd, buf + 0); nameoff = bfd_h_get_32 (abfd, buf + 0);
@ -1991,7 +1989,7 @@ bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
return -1; return -1;
if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 8, abfd) != 8) || bfd_bread ((void *) buf, 8, abfd) != 8)
return -1; return -1;
offset += 8 + bfd_h_get_32 (abfd, buf + 4) * 4; offset += 8 + bfd_h_get_32 (abfd, buf + 4) * 4;
@ -2016,7 +2014,7 @@ bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
return -1; return -1;
if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 8, abfd) != 8) || bfd_bread ((void *) buf, 8, abfd) != 8)
return -1; return -1;
cmd->flavours[nflavours].flavour = bfd_h_get_32 (abfd, buf); cmd->flavours[nflavours].flavour = bfd_h_get_32 (abfd, buf);
@ -2087,7 +2085,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
BFD_ASSERT (command->type == BFD_MACH_O_LC_DYSYMTAB); BFD_ASSERT (command->type == BFD_MACH_O_LC_DYSYMTAB);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 72, abfd) != 72) || bfd_bread ((void *) buf, 72, abfd) != 72)
return -1; return -1;
cmd->ilocalsym = bfd_h_get_32 (abfd, buf + 0); cmd->ilocalsym = bfd_h_get_32 (abfd, buf + 0);
@ -2111,7 +2109,6 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
if (cmd->nmodtab != 0) if (cmd->nmodtab != 0)
{ {
char buf[56];
unsigned int i; unsigned int i;
int wide = bfd_mach_o_wide_p (abfd); int wide = bfd_mach_o_wide_p (abfd);
unsigned int module_len = wide ? 56 : 52; unsigned int module_len = wide ? 56 : 52;
@ -2129,7 +2126,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
bfd_mach_o_dylib_module *module = &cmd->dylib_module[i]; bfd_mach_o_dylib_module *module = &cmd->dylib_module[i];
unsigned long v; unsigned long v;
if (bfd_bread ((PTR) buf, module_len, abfd) != module_len) if (bfd_bread ((void *) buf, module_len, abfd) != module_len)
return -1; return -1;
module->module_name_idx = bfd_h_get_32 (abfd, buf + 0); module->module_name_idx = bfd_h_get_32 (abfd, buf + 0);
@ -2162,7 +2159,6 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
if (cmd->ntoc != 0) if (cmd->ntoc != 0)
{ {
char buf[8];
unsigned int i; unsigned int i;
cmd->dylib_toc = bfd_alloc cmd->dylib_toc = bfd_alloc
@ -2177,7 +2173,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
{ {
bfd_mach_o_dylib_table_of_content *toc = &cmd->dylib_toc[i]; bfd_mach_o_dylib_table_of_content *toc = &cmd->dylib_toc[i];
if (bfd_bread ((PTR) buf, 8, abfd) != 8) if (bfd_bread ((void *) buf, 8, abfd) != 8)
return -1; return -1;
toc->symbol_index = bfd_h_get_32 (abfd, buf + 0); toc->symbol_index = bfd_h_get_32 (abfd, buf + 0);
@ -2187,7 +2183,6 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
if (cmd->nindirectsyms != 0) if (cmd->nindirectsyms != 0)
{ {
char buf[4];
unsigned int i; unsigned int i;
cmd->indirect_syms = bfd_alloc cmd->indirect_syms = bfd_alloc
@ -2202,7 +2197,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
{ {
unsigned int *is = &cmd->indirect_syms[i]; unsigned int *is = &cmd->indirect_syms[i];
if (bfd_bread ((PTR) buf, 4, abfd) != 4) if (bfd_bread ((void *) buf, 4, abfd) != 4)
return -1; return -1;
*is = bfd_h_get_32 (abfd, buf + 0); *is = bfd_h_get_32 (abfd, buf + 0);
@ -2211,7 +2206,6 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
if (cmd->nextrefsyms != 0) if (cmd->nextrefsyms != 0)
{ {
char buf[4];
unsigned long v; unsigned long v;
unsigned int i; unsigned int i;
@ -2227,7 +2221,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command)
{ {
bfd_mach_o_dylib_reference *ref = &cmd->ext_refs[i]; bfd_mach_o_dylib_reference *ref = &cmd->ext_refs[i];
if (bfd_bread ((PTR) buf, 4, abfd) != 4) if (bfd_bread ((void *) buf, 4, abfd) != 4)
return -1; return -1;
/* Fields isym and flags are written as bit-fields, thus we need /* Fields isym and flags are written as bit-fields, thus we need
@ -2263,7 +2257,7 @@ bfd_mach_o_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
BFD_ASSERT (command->type == BFD_MACH_O_LC_SYMTAB); BFD_ASSERT (command->type == BFD_MACH_O_LC_SYMTAB);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 16, abfd) != 16) || bfd_bread ((void *) buf, 16, abfd) != 16)
return -1; return -1;
symtab->symoff = bfd_h_get_32 (abfd, buf); symtab->symoff = bfd_h_get_32 (abfd, buf);
@ -2293,7 +2287,7 @@ bfd_mach_o_read_uuid (bfd *abfd, bfd_mach_o_load_command *command)
BFD_ASSERT (command->type == BFD_MACH_O_LC_UUID); BFD_ASSERT (command->type == BFD_MACH_O_LC_UUID);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
|| bfd_bread ((PTR) cmd->uuid, 16, abfd) != 16) || bfd_bread ((void *) cmd->uuid, 16, abfd) != 16)
return -1; return -1;
sname = bfd_alloc (abfd, strlen (prefix) + 1); sname = bfd_alloc (abfd, strlen (prefix) + 1);
@ -2323,7 +2317,7 @@ bfd_mach_o_read_linkedit (bfd *abfd, bfd_mach_o_load_command *command)
char buf[8]; char buf[8];
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 8, abfd) != 8) || bfd_bread ((void *) buf, 8, abfd) != 8)
return -1; return -1;
cmd->dataoff = bfd_get_32 (abfd, buf + 0); cmd->dataoff = bfd_get_32 (abfd, buf + 0);
@ -2339,7 +2333,7 @@ bfd_mach_o_read_str (bfd *abfd, bfd_mach_o_load_command *command)
unsigned long off; unsigned long off;
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 4, abfd) != 4) || bfd_bread ((void *) buf, 4, abfd) != 4)
return -1; return -1;
off = bfd_get_32 (abfd, buf + 0); off = bfd_get_32 (abfd, buf + 0);
@ -2349,7 +2343,7 @@ bfd_mach_o_read_str (bfd *abfd, bfd_mach_o_load_command *command)
if (cmd->str == NULL) if (cmd->str == NULL)
return -1; return -1;
if (bfd_seek (abfd, cmd->stroff, SEEK_SET) != 0 if (bfd_seek (abfd, cmd->stroff, SEEK_SET) != 0
|| bfd_bread ((PTR) cmd->str, cmd->str_len, abfd) != cmd->str_len) || bfd_bread ((void *) cmd->str, cmd->str_len, abfd) != cmd->str_len)
return -1; return -1;
return 0; return 0;
} }
@ -2361,7 +2355,7 @@ bfd_mach_o_read_dyld_info (bfd *abfd, bfd_mach_o_load_command *command)
char buf[40]; char buf[40];
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, sizeof (buf), abfd) != sizeof (buf)) || bfd_bread ((void *) buf, sizeof (buf), abfd) != sizeof (buf))
return -1; return -1;
cmd->rebase_off = bfd_get_32 (abfd, buf + 0); cmd->rebase_off = bfd_get_32 (abfd, buf + 0);
@ -2391,7 +2385,7 @@ bfd_mach_o_read_segment (bfd *abfd,
BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT_64); BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT_64);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 64, abfd) != 64) || bfd_bread ((void *) buf, 64, abfd) != 64)
return -1; return -1;
memcpy (seg->segname, buf, 16); memcpy (seg->segname, buf, 16);
@ -2411,7 +2405,7 @@ bfd_mach_o_read_segment (bfd *abfd,
BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT); BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT);
if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset + 8, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 48, abfd) != 48) || bfd_bread ((void *) buf, 48, abfd) != 48)
return -1; return -1;
memcpy (seg->segname, buf, 16); memcpy (seg->segname, buf, 16);
@ -2472,7 +2466,7 @@ bfd_mach_o_read_command (bfd *abfd, bfd_mach_o_load_command *command)
/* Read command type and length. */ /* Read command type and length. */
if (bfd_seek (abfd, command->offset, SEEK_SET) != 0 if (bfd_seek (abfd, command->offset, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 8, abfd) != 8) || bfd_bread ((void *) buf, 8, abfd) != 8)
return -1; return -1;
command->type = bfd_h_get_32 (abfd, buf) & ~BFD_MACH_O_LC_REQ_DYLD; command->type = bfd_h_get_32 (abfd, buf) & ~BFD_MACH_O_LC_REQ_DYLD;
@ -2900,7 +2894,7 @@ bfd_mach_o_archive_p (bfd *abfd)
unsigned long i; unsigned long i;
if (bfd_seek (abfd, 0, SEEK_SET) != 0 if (bfd_seek (abfd, 0, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 8, abfd) != 8) || bfd_bread ((void *) buf, 8, abfd) != 8)
goto error; goto error;
adata = bfd_alloc (abfd, sizeof (mach_o_fat_data_struct)); adata = bfd_alloc (abfd, sizeof (mach_o_fat_data_struct));
@ -2925,7 +2919,7 @@ bfd_mach_o_archive_p (bfd *abfd)
for (i = 0; i < adata->nfat_arch; i++) for (i = 0; i < adata->nfat_arch; i++)
{ {
if (bfd_seek (abfd, 8 + 20 * i, SEEK_SET) != 0 if (bfd_seek (abfd, 8 + 20 * i, SEEK_SET) != 0
|| bfd_bread ((PTR) buf, 20, abfd) != 20) || bfd_bread ((void *) buf, 20, abfd) != 20)
goto error; goto error;
adata->archentries[i].cputype = bfd_getb32 (buf); adata->archentries[i].cputype = bfd_getb32 (buf);
adata->archentries[i].cpusubtype = bfd_getb32 (buf + 4); adata->archentries[i].cpusubtype = bfd_getb32 (buf + 4);
@ -3709,7 +3703,7 @@ bfd_mach_o_print_dyld_info (bfd *abfd ATTRIBUTE_UNUSED,
} }
bfd_boolean bfd_boolean
bfd_mach_o_bfd_print_private_bfd_data (bfd *abfd, PTR ptr) bfd_mach_o_bfd_print_private_bfd_data (bfd *abfd, void * ptr)
{ {
bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd); bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
FILE *file = (FILE *) ptr; FILE *file = (FILE *) ptr;
@ -3733,10 +3727,10 @@ bfd_mach_o_bfd_print_private_bfd_data (bfd *abfd, PTR ptr)
case BFD_MACH_O_LC_UUID: case BFD_MACH_O_LC_UUID:
{ {
bfd_mach_o_uuid_command *uuid = &cmd->command.uuid; bfd_mach_o_uuid_command *uuid = &cmd->command.uuid;
unsigned int i; unsigned int j;
for (i = 0; i < sizeof (uuid->uuid); i++) for (j = 0; j < sizeof (uuid->uuid); j ++)
fprintf (file, " %02x", uuid->uuid[i]); fprintf (file, " %02x", uuid->uuid[j]);
fputc ('\n', file); fputc ('\n', file);
} }
break; break;

View File

@ -136,12 +136,12 @@ static struct sec_merge_hash_entry *
sec_merge_hash_lookup (struct sec_merge_hash *table, const char *string, sec_merge_hash_lookup (struct sec_merge_hash *table, const char *string,
unsigned int alignment, bfd_boolean create) unsigned int alignment, bfd_boolean create)
{ {
register const unsigned char *s; const unsigned char *s;
register unsigned long hash; unsigned long hash;
register unsigned int c; unsigned int c;
struct sec_merge_hash_entry *hashp; struct sec_merge_hash_entry *hashp;
unsigned int len, i; unsigned int len, i;
unsigned int index; unsigned int _index;
hash = 0; hash = 0;
len = 0; len = 0;
@ -192,8 +192,8 @@ sec_merge_hash_lookup (struct sec_merge_hash *table, const char *string,
len = table->entsize; len = table->entsize;
} }
index = hash % table->table.size; _index = hash % table->table.size;
for (hashp = (struct sec_merge_hash_entry *) table->table.table[index]; for (hashp = (struct sec_merge_hash_entry *) table->table.table[_index];
hashp != NULL; hashp != NULL;
hashp = (struct sec_merge_hash_entry *) hashp->root.next) hashp = (struct sec_merge_hash_entry *) hashp->root.next)
{ {
@ -263,7 +263,7 @@ static struct sec_merge_hash_entry *
sec_merge_add (struct sec_merge_hash *tab, const char *str, sec_merge_add (struct sec_merge_hash *tab, const char *str,
unsigned int alignment, struct sec_merge_sec_info *secinfo) unsigned int alignment, struct sec_merge_sec_info *secinfo)
{ {
register struct sec_merge_hash_entry *entry; struct sec_merge_hash_entry *entry;
entry = sec_merge_hash_lookup (tab, str, alignment, TRUE); entry = sec_merge_hash_lookup (tab, str, alignment, TRUE);
if (entry == NULL) if (entry == NULL)

View File

@ -1,6 +1,6 @@
/* Support for 32-bit SPARC NLM (NetWare Loadable Module) /* Support for 32-bit SPARC NLM (NetWare Loadable Module)
Copyright 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, Copyright 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007 Free Software Foundation, Inc. 2007, 2009 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -93,7 +93,7 @@ nlm_sparc_read_reloc (bfd *abfd,
arelent *rel) arelent *rel)
{ {
bfd_vma val, addend; bfd_vma val, addend;
unsigned int index; unsigned int howto_index;
unsigned int type; unsigned int type;
struct nlm32_sparc_reloc_ext tmp_reloc; struct nlm32_sparc_reloc_ext tmp_reloc;
asection *code_sec, *data_sec; asection *code_sec, *data_sec;
@ -114,12 +114,12 @@ nlm_sparc_read_reloc (bfd *abfd,
rel->addend = addend; rel->addend = addend;
rel->howto = NULL; rel->howto = NULL;
for (index = 0; for (howto_index = 0;
index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type); howto_index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
index++) howto_index++)
if (nlm32_sparc_howto_table[index].type == type) if (nlm32_sparc_howto_table[howto_index].type == type)
{ {
rel->howto = &nlm32_sparc_howto_table[index]; rel->howto = &nlm32_sparc_howto_table[howto_index];
break; break;
} }
@ -139,15 +139,15 @@ nlm_sparc_write_reloc (bfd * abfd, asection * sec, arelent * rel)
{ {
bfd_vma val; bfd_vma val;
struct nlm32_sparc_reloc_ext tmp_reloc; struct nlm32_sparc_reloc_ext tmp_reloc;
unsigned int index; unsigned int howto_index;
int type = -1; int type = -1;
reloc_howto_type *tmp; reloc_howto_type *tmp;
for (index = 0; for (howto_index = 0;
index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type); howto_index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
index++) howto_index++)
{ {
tmp = &nlm32_sparc_howto_table[index]; tmp = &nlm32_sparc_howto_table[howto_index];
if (tmp->rightshift == rel->howto->rightshift if (tmp->rightshift == rel->howto->rightshift
&& tmp->size == rel->howto->size && tmp->size == rel->howto->size

View File

@ -786,7 +786,7 @@ oasys_write_syms (bfd *abfd)
{ {
unsigned int count; unsigned int count;
asymbol **generic = bfd_get_outsymbols (abfd); asymbol **generic = bfd_get_outsymbols (abfd);
unsigned int index = 0; unsigned int sym_index = 0;
for (count = 0; count < bfd_get_symcount (abfd); count++) for (count = 0; count < bfd_get_symcount (abfd); count++)
{ {
@ -799,8 +799,8 @@ oasys_write_syms (bfd *abfd)
if (bfd_is_com_section (g->section)) if (bfd_is_com_section (g->section))
{ {
symbol.relb = RELOCATION_TYPE_COM; symbol.relb = RELOCATION_TYPE_COM;
H_PUT_16 (abfd, index, symbol.refno); H_PUT_16 (abfd, sym_index, symbol.refno);
index++; sym_index++;
} }
else if (bfd_is_abs_section (g->section)) else if (bfd_is_abs_section (g->section))
{ {
@ -810,9 +810,9 @@ oasys_write_syms (bfd *abfd)
else if (bfd_is_und_section (g->section)) else if (bfd_is_und_section (g->section))
{ {
symbol.relb = RELOCATION_TYPE_UND; symbol.relb = RELOCATION_TYPE_UND;
H_PUT_16 (abfd, index, symbol.refno); H_PUT_16 (abfd, sym_index, symbol.refno);
/* Overload the value field with the output index number */ /* Overload the value field with the output sym_index number */
index++; sym_index++;
} }
else if (g->flags & BSF_DEBUGGING) else if (g->flags & BSF_DEBUGGING)
/* Throw it away. */ /* Throw it away. */
@ -859,7 +859,7 @@ oasys_write_syms (bfd *abfd)
name[0]) + l)) name[0]) + l))
return FALSE; return FALSE;
} }
g->value = index - 1; g->value = sym_index - 1;
} }
return TRUE; return TRUE;

View File

@ -523,19 +523,12 @@ static const struct bfd_iovec opncls_iovec = {
bfd * bfd *
bfd_openr_iovec (const char *filename, const char *target, bfd_openr_iovec (const char *filename, const char *target,
void *(*open) (struct bfd *nbfd, void *(*_open) (struct bfd *, void *),
void *open_closure),
void *open_closure, void *open_closure,
file_ptr (*pread) (struct bfd *abfd, file_ptr (*_pread) (struct bfd *, void *, void *, file_ptr,
void *stream, file_ptr),
void *buf, int (*_close) (struct bfd *, void *),
file_ptr nbytes, int (*_stat) (struct bfd *, void *, struct stat *))
file_ptr offset),
int (*close) (struct bfd *nbfd,
void *stream),
int (*stat) (struct bfd *abfd,
void *stream,
struct stat *sb))
{ {
bfd *nbfd; bfd *nbfd;
const bfd_target *target_vec; const bfd_target *target_vec;
@ -557,7 +550,7 @@ bfd_openr_iovec (const char *filename, const char *target,
nbfd->direction = read_direction; nbfd->direction = read_direction;
/* `open (...)' would get expanded by an the open(2) syscall macro. */ /* `open (...)' would get expanded by an the open(2) syscall macro. */
stream = (*open) (nbfd, open_closure); stream = (*_open) (nbfd, open_closure);
if (stream == NULL) if (stream == NULL)
{ {
_bfd_delete_bfd (nbfd); _bfd_delete_bfd (nbfd);
@ -566,9 +559,9 @@ bfd_openr_iovec (const char *filename, const char *target,
vec = (struct opncls *) bfd_zalloc (nbfd, sizeof (struct opncls)); vec = (struct opncls *) bfd_zalloc (nbfd, sizeof (struct opncls));
vec->stream = stream; vec->stream = stream;
vec->pread = pread; vec->pread = _pread;
vec->close = close; vec->close = _close;
vec->stat = stat; vec->stat = _stat;
nbfd->iovec = &opncls_iovec; nbfd->iovec = &opncls_iovec;
nbfd->iostream = vec; nbfd->iostream = vec;
@ -1234,7 +1227,7 @@ DESCRIPTION
static char * static char *
find_separate_debug_file (bfd *abfd, const char *debug_file_directory) find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
{ {
char *basename; char *base;
char *dir; char *dir;
char *debugfile; char *debugfile;
char *canon_dir; char *canon_dir;
@ -1253,13 +1246,13 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
return NULL; return NULL;
} }
basename = get_debug_link_info (abfd, & crc32); base = get_debug_link_info (abfd, & crc32);
if (basename == NULL) if (base == NULL)
return NULL; return NULL;
if (basename[0] == '\0') if (base[0] == '\0')
{ {
free (basename); free (base);
bfd_set_error (bfd_error_no_debug_section); bfd_set_error (bfd_error_no_debug_section);
return NULL; return NULL;
} }
@ -1271,7 +1264,7 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
dir = (char *) bfd_malloc (dirlen + 1); dir = (char *) bfd_malloc (dirlen + 1);
if (dir == NULL) if (dir == NULL)
{ {
free (basename); free (base);
return NULL; return NULL;
} }
memcpy (dir, abfd->filename, dirlen); memcpy (dir, abfd->filename, dirlen);
@ -1289,11 +1282,11 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
bfd_malloc (strlen (debug_file_directory) + 1 bfd_malloc (strlen (debug_file_directory) + 1
+ (canon_dirlen > dirlen ? canon_dirlen : dirlen) + (canon_dirlen > dirlen ? canon_dirlen : dirlen)
+ strlen (".debug/") + strlen (".debug/")
+ strlen (basename) + strlen (base)
+ 1); + 1);
if (debugfile == NULL) if (debugfile == NULL)
{ {
free (basename); free (base);
free (dir); free (dir);
free (canon_dir); free (canon_dir);
return NULL; return NULL;
@ -1301,11 +1294,11 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
/* First try in the same directory as the original file: */ /* First try in the same directory as the original file: */
strcpy (debugfile, dir); strcpy (debugfile, dir);
strcat (debugfile, basename); strcat (debugfile, base);
if (separate_debug_file_exists (debugfile, crc32)) if (separate_debug_file_exists (debugfile, crc32))
{ {
free (basename); free (base);
free (dir); free (dir);
free (canon_dir); free (canon_dir);
return debugfile; return debugfile;
@ -1314,11 +1307,11 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
/* Then try in a subdirectory called .debug. */ /* Then try in a subdirectory called .debug. */
strcpy (debugfile, dir); strcpy (debugfile, dir);
strcat (debugfile, ".debug/"); strcat (debugfile, ".debug/");
strcat (debugfile, basename); strcat (debugfile, base);
if (separate_debug_file_exists (debugfile, crc32)) if (separate_debug_file_exists (debugfile, crc32))
{ {
free (basename); free (base);
free (dir); free (dir);
free (canon_dir); free (canon_dir);
return debugfile; return debugfile;
@ -1332,18 +1325,18 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
&& canon_dir[0] != '/') && canon_dir[0] != '/')
strcat (debugfile, "/"); strcat (debugfile, "/");
strcat (debugfile, canon_dir); strcat (debugfile, canon_dir);
strcat (debugfile, basename); strcat (debugfile, base);
if (separate_debug_file_exists (debugfile, crc32)) if (separate_debug_file_exists (debugfile, crc32))
{ {
free (basename); free (base);
free (dir); free (dir);
free (canon_dir); free (canon_dir);
return debugfile; return debugfile;
} }
free (debugfile); free (debugfile);
free (basename); free (base);
free (dir); free (dir);
free (canon_dir); free (canon_dir);
return NULL; return NULL;

View File

@ -1569,7 +1569,7 @@ add_to_stringtab (bfd *abfd,
bfd_boolean copy) bfd_boolean copy)
{ {
bfd_boolean hash; bfd_boolean hash;
bfd_size_type index; bfd_size_type str_index;
/* An index of 0 always means the empty string. */ /* An index of 0 always means the empty string. */
if (str == 0 || *str == '\0') if (str == 0 || *str == '\0')
@ -1581,14 +1581,14 @@ add_to_stringtab (bfd *abfd,
if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0) if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
hash = FALSE; hash = FALSE;
index = _bfd_stringtab_add (tab, str, hash, copy); str_index = _bfd_stringtab_add (tab, str, hash, copy);
if (index != (bfd_size_type) -1) if (str_index != (bfd_size_type) -1)
/* Add BYTES_IN_LONG to the return value to account for the /* Add BYTES_IN_LONG to the return value to account for the
space taken up by the string table size. */ space taken up by the string table size. */
index += BYTES_IN_LONG; str_index += BYTES_IN_LONG;
return index; return str_index;
} }
/* Write out a strtab. ABFD is already at the right location in the /* Write out a strtab. ABFD is already at the right location in the

View File

@ -1784,7 +1784,7 @@ _bfd_XX_print_ce_compressed_pdata (bfd * abfd, void * vfile)
bfd_size_type i; bfd_size_type i;
bfd_size_type start, stop; bfd_size_type start, stop;
int onaline = PDATA_ROW_SIZE; int onaline = PDATA_ROW_SIZE;
struct sym_cache sym_cache = {0, 0} ; struct sym_cache cache = {0, 0} ;
if (section == NULL if (section == NULL
|| coff_section_data (abfd, section) == NULL || coff_section_data (abfd, section) == NULL
@ -1870,7 +1870,7 @@ _bfd_XX_print_ce_compressed_pdata (bfd * abfd, void * vfile)
fprintf (file, "%08x", (unsigned int) eh_data); fprintf (file, "%08x", (unsigned int) eh_data);
if (eh != 0) if (eh != 0)
{ {
const char *s = my_symbol_for_address (abfd, eh, &sym_cache); const char *s = my_symbol_for_address (abfd, eh, &cache);
if (s) if (s)
fprintf (file, " (%s) ", s); fprintf (file, " (%s) ", s);
@ -1890,7 +1890,7 @@ _bfd_XX_print_ce_compressed_pdata (bfd * abfd, void * vfile)
free (data); free (data);
cleanup_syms (& sym_cache); cleanup_syms (& cache);
return TRUE; return TRUE;
#undef PDATA_ROW_SIZE #undef PDATA_ROW_SIZE

View File

@ -730,14 +730,11 @@ bfd_pef_parse_function_stubs (bfd *abfd,
asymbol **csym) asymbol **csym)
{ {
const char *const sprefix = "__stub_"; const char *const sprefix = "__stub_";
size_t codepos = 0; size_t codepos = 0;
unsigned long count = 0; unsigned long count = 0;
bfd_pef_loader_header header; bfd_pef_loader_header header;
bfd_pef_imported_library *libraries = NULL; bfd_pef_imported_library *libraries = NULL;
bfd_pef_imported_symbol *imports = NULL; bfd_pef_imported_symbol *imports = NULL;
unsigned long i; unsigned long i;
int ret; int ret;
@ -783,8 +780,7 @@ bfd_pef_parse_function_stubs (bfd *abfd,
asymbol sym; asymbol sym;
const char *symname; const char *symname;
char *name; char *name;
unsigned long index; unsigned long sym_index;
int ret;
if (csym && (csym[count] == NULL)) if (csym && (csym[count] == NULL))
break; break;
@ -802,14 +798,14 @@ bfd_pef_parse_function_stubs (bfd *abfd,
if ((codepos + 4) > codelen) if ((codepos + 4) > codelen)
break; break;
ret = bfd_pef_parse_function_stub (abfd, codebuf + codepos, 24, &index); ret = bfd_pef_parse_function_stub (abfd, codebuf + codepos, 24, &sym_index);
if (ret < 0) if (ret < 0)
{ {
codepos += 24; codepos += 24;
continue; continue;
} }
if (index >= header.total_imported_symbol_count) if (sym_index >= header.total_imported_symbol_count)
{ {
codepos += 24; codepos += 24;
continue; continue;
@ -819,12 +815,12 @@ bfd_pef_parse_function_stubs (bfd *abfd,
size_t max, namelen; size_t max, namelen;
const char *s; const char *s;
if (loaderlen < (header.loader_strings_offset + imports[index].name)) if (loaderlen < (header.loader_strings_offset + imports[sym_index].name))
goto error; goto error;
max = loaderlen - (header.loader_strings_offset + imports[index].name); max = loaderlen - (header.loader_strings_offset + imports[sym_index].name);
symname = (char *) loaderbuf; symname = (char *) loaderbuf;
symname += header.loader_strings_offset + imports[index].name; symname += header.loader_strings_offset + imports[sym_index].name;
namelen = 0; namelen = 0;
for (s = symname; s < (symname + max); s++) for (s = symname; s < (symname + max); s++)
{ {

View File

@ -399,9 +399,9 @@ process_otr (bfd *abfd, struct ext_otr *otr, int pass)
for (j = 0; j < esdids; j++) for (j = 0; j < esdids; j++)
{ {
int esdid = *srcp++; int id = *srcp++;
if (esdid) if (id)
{ {
int rn = EDATA (abfd, otr->esdid - 1).relocs++; int rn = EDATA (abfd, otr->esdid - 1).relocs++;
@ -416,7 +416,7 @@ process_otr (bfd *abfd, struct ext_otr *otr, int pass)
EDATA (abfd, otr->esdid - 1).section->relocation + rn; EDATA (abfd, otr->esdid - 1).section->relocation + rn;
n->address = dst_idx; n->address = dst_idx;
n->sym_ptr_ptr = (asymbol **) (size_t) esdid; n->sym_ptr_ptr = (asymbol **) (size_t) id;
n->addend = 0; n->addend = 0;
n->howto = versados_howto_table + ((j & 1) * 2) + (sizeinwords - 1); n->howto = versados_howto_table + ((j & 1) * 2) + (sizeinwords - 1);
} }

View File

@ -729,7 +729,8 @@ _bfd_vms_slurp_gsd (bfd * abfd, int objtype)
if (symbol->flags & BSF_FUNCTION) if (symbol->flags & BSF_FUNCTION)
{ {
asymbol *en_sym; asymbol *en_sym;
char *name = bfd_alloc (abfd, strlen (symbol->name) + 5);
name = bfd_alloc (abfd, strlen (symbol->name) + 5);
en_sym = bfd_make_empty_symbol (abfd); en_sym = bfd_make_empty_symbol (abfd);
if (en_sym == 0) if (en_sym == 0)

View File

@ -1179,13 +1179,13 @@ build_module_list (bfd *abfd)
of debug info in the DST section, as well as the count of of debug info in the DST section, as well as the count of
program sections (i.e. address spans) it contains. */ program sections (i.e. address spans) it contains. */
int modbeg = bfd_getl32 (ptr + DBG_S_L_DMT_MODBEG); int modbeg = bfd_getl32 (ptr + DBG_S_L_DMT_MODBEG);
int size = bfd_getl32 (ptr + DBG_S_L_DST_SIZE); int msize = bfd_getl32 (ptr + DBG_S_L_DST_SIZE);
int count = bfd_getl16 (ptr + DBG_S_W_DMT_PSECT_COUNT); int count = bfd_getl16 (ptr + DBG_S_W_DMT_PSECT_COUNT);
ptr += DBG_S_C_DMT_HEADER_SIZE; ptr += DBG_S_C_DMT_HEADER_SIZE;
#if VMS_DEBUG #if VMS_DEBUG
_bfd_vms_debug (3, "module: modbeg = %d, size = %d, count = %d\n", _bfd_vms_debug (3, "module: modbeg = %d, size = %d, count = %d\n",
modbeg, size, count); modbeg, msize, count);
#endif #endif
/* We create a 'module' structure for each program section since /* We create a 'module' structure for each program section since
@ -1199,7 +1199,7 @@ build_module_list (bfd *abfd)
int length = bfd_getl32 (ptr + DBG_S_L_DMT_PSECT_LENGTH); int length = bfd_getl32 (ptr + DBG_S_L_DMT_PSECT_LENGTH);
module = new_module (abfd); module = new_module (abfd);
module->modbeg = modbeg; module->modbeg = modbeg;
module->size = size; module->size = msize;
module->low = start; module->low = start;
module->high = start + length; module->high = start + length;
module->next = list; module->next = list;

View File

@ -2318,7 +2318,7 @@ static void etir_output_check (bfd *abfd, asection *section, bfd_vma vaddr,
/* Start ETIR record for section #index at virtual addr offset. */ /* Start ETIR record for section #index at virtual addr offset. */
static void static void
start_etir_record (bfd * abfd, int index, uquad offset, bfd_boolean justoffset) start_etir_record (bfd * abfd, int sec_index, uquad offset, bfd_boolean justoffset)
{ {
if (!justoffset) if (!justoffset)
{ {
@ -2329,7 +2329,7 @@ start_etir_record (bfd * abfd, int index, uquad offset, bfd_boolean justoffset)
/* Push start offset. */ /* Push start offset. */
_bfd_vms_output_begin (abfd, ETIR_S_C_STA_PQ, -1); _bfd_vms_output_begin (abfd, ETIR_S_C_STA_PQ, -1);
_bfd_vms_output_long (abfd, (unsigned long) index); _bfd_vms_output_long (abfd, (unsigned long) sec_index);
_bfd_vms_output_quad (abfd, (uquad) offset); _bfd_vms_output_quad (abfd, (uquad) offset);
_bfd_vms_output_flush (abfd); _bfd_vms_output_flush (abfd);
@ -2346,11 +2346,11 @@ end_etir_record (bfd * abfd)
} }
/* Output a STO_IMM command for SSIZE bytes of data from CPR at virtual /* Output a STO_IMM command for SSIZE bytes of data from CPR at virtual
address VADDR in section specified by INDEX and NAME. */ address VADDR in section specified by SEC_INDEX and NAME. */
static void static void
sto_imm (bfd *abfd, bfd_size_type ssize, unsigned char *cptr, bfd_vma vaddr, sto_imm (bfd *abfd, bfd_size_type ssize, unsigned char *cptr, bfd_vma vaddr,
int index, const char *name) int sec_index, const char *name)
{ {
bfd_size_type size; bfd_size_type size;
@ -2372,7 +2372,7 @@ sto_imm (bfd *abfd, bfd_size_type ssize, unsigned char *cptr, bfd_vma vaddr,
if (name [0] && name[1] == 'v' && !strcmp (name, ".vmsdebug")) if (name [0] && name[1] == 'v' && !strcmp (name, ".vmsdebug"))
start_another_etbt_record (abfd); start_another_etbt_record (abfd);
else else
start_etir_record (abfd, index, vaddr, FALSE); start_etir_record (abfd, sec_index, vaddr, FALSE);
size = _bfd_vms_output_check (abfd, 0); /* get max size */ size = _bfd_vms_output_check (abfd, 0); /* get max size */
if (size > ssize) /* more than what's left ? */ if (size > ssize) /* more than what's left ? */

View File

@ -603,7 +603,7 @@ vms_new_section_hook (bfd * abfd, asection *section)
if (section_count > PRIV (section_count)) if (section_count > PRIV (section_count))
{ {
bfd_size_type amt = section_count; amt = section_count;
amt *= sizeof (asection *); amt *= sizeof (asection *);
PRIV (sections) = bfd_realloc_or_free (PRIV (sections), amt); PRIV (sections) = bfd_realloc_or_free (PRIV (sections), amt);
if (PRIV (sections) == NULL) if (PRIV (sections) == NULL)

View File

@ -1,7 +1,7 @@
dnl Common configure.in fragment dnl Common configure.in fragment
AC_DEFUN([AM_BINUTILS_WARNINGS],[ AC_DEFUN([AM_BINUTILS_WARNINGS],[
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow"
AC_ARG_ENABLE(werror, AC_ARG_ENABLE(werror,
[ --enable-werror treat compile warnings as errors], [ --enable-werror treat compile warnings as errors],

View File

@ -687,12 +687,12 @@ bfd_boolean
bfd_xcoff_split_import_path (bfd *abfd, const char *filename, bfd_xcoff_split_import_path (bfd *abfd, const char *filename,
const char **imppath, const char **impfile) const char **imppath, const char **impfile)
{ {
const char *basename; const char *base;
size_t length; size_t length;
char *path; char *path;
basename = lbasename (filename); base = lbasename (filename);
length = basename - filename; length = base - filename;
if (length == 0) if (length == 0)
/* The filename has no directory component, so use an empty path. */ /* The filename has no directory component, so use an empty path. */
*imppath = ""; *imppath = "";
@ -711,7 +711,7 @@ bfd_xcoff_split_import_path (bfd *abfd, const char *filename,
path[length - 1] = 0; path[length - 1] = 0;
*imppath = path; *imppath = path;
} }
*impfile = basename; *impfile = base;
return TRUE; return TRUE;
} }

View File

@ -84,11 +84,11 @@ static unsigned long
compute_offset (unsigned long first_page, compute_offset (unsigned long first_page,
unsigned long page_size, unsigned long page_size,
unsigned long entry_size, unsigned long entry_size,
unsigned long index) unsigned long sym_index)
{ {
unsigned long entries_per_page = page_size / entry_size; unsigned long entries_per_page = page_size / entry_size;
unsigned long page_number = first_page + (index / entries_per_page); unsigned long page_number = first_page + (sym_index / entries_per_page);
unsigned long page_offset = (index % entries_per_page) * entry_size; unsigned long page_offset = (sym_index % entries_per_page) * entry_size;
return (page_number * page_size) + page_offset; return (page_number * page_size) + page_offset;
} }
@ -530,7 +530,7 @@ bfd_sym_parse_type_table_entry_v32 (unsigned char *buf,
int int
bfd_sym_fetch_resources_table_entry (bfd *abfd, bfd_sym_fetch_resources_table_entry (bfd *abfd,
bfd_sym_resources_table_entry *entry, bfd_sym_resources_table_entry *entry,
unsigned long index) unsigned long sym_index)
{ {
void (*parser) (unsigned char *, size_t, bfd_sym_resources_table_entry *); void (*parser) (unsigned char *, size_t, bfd_sym_resources_table_entry *);
unsigned long offset; unsigned long offset;
@ -542,7 +542,7 @@ bfd_sym_fetch_resources_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd)); BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data; sdata = abfd->tdata.sym_data;
if (index == 0) if (sym_index == 0)
return -1; return -1;
switch (sdata->version) switch (sdata->version)
@ -566,7 +566,7 @@ bfd_sym_fetch_resources_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_rte.dti_first_page, offset = compute_offset (sdata->header.dshb_rte.dti_first_page,
sdata->header.dshb_page_size, sdata->header.dshb_page_size,
entry_size, index); entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0) if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1; return -1;
@ -581,7 +581,7 @@ bfd_sym_fetch_resources_table_entry (bfd *abfd,
int int
bfd_sym_fetch_modules_table_entry (bfd *abfd, bfd_sym_fetch_modules_table_entry (bfd *abfd,
bfd_sym_modules_table_entry *entry, bfd_sym_modules_table_entry *entry,
unsigned long index) unsigned long sym_index)
{ {
void (*parser) (unsigned char *, size_t, bfd_sym_modules_table_entry *); void (*parser) (unsigned char *, size_t, bfd_sym_modules_table_entry *);
unsigned long offset; unsigned long offset;
@ -593,7 +593,7 @@ bfd_sym_fetch_modules_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd)); BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data; sdata = abfd->tdata.sym_data;
if (index == 0) if (sym_index == 0)
return -1; return -1;
switch (sdata->version) switch (sdata->version)
@ -617,7 +617,7 @@ bfd_sym_fetch_modules_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_mte.dti_first_page, offset = compute_offset (sdata->header.dshb_mte.dti_first_page,
sdata->header.dshb_page_size, sdata->header.dshb_page_size,
entry_size, index); entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0) if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1; return -1;
@ -632,7 +632,7 @@ bfd_sym_fetch_modules_table_entry (bfd *abfd,
int int
bfd_sym_fetch_file_references_table_entry (bfd *abfd, bfd_sym_fetch_file_references_table_entry (bfd *abfd,
bfd_sym_file_references_table_entry *entry, bfd_sym_file_references_table_entry *entry,
unsigned long index) unsigned long sym_index)
{ {
void (*parser) (unsigned char *, size_t, bfd_sym_file_references_table_entry *); void (*parser) (unsigned char *, size_t, bfd_sym_file_references_table_entry *);
unsigned long offset; unsigned long offset;
@ -644,7 +644,7 @@ bfd_sym_fetch_file_references_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd)); BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data; sdata = abfd->tdata.sym_data;
if (index == 0) if (sym_index == 0)
return -1; return -1;
switch (sdata->version) switch (sdata->version)
@ -667,7 +667,7 @@ bfd_sym_fetch_file_references_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_frte.dti_first_page, offset = compute_offset (sdata->header.dshb_frte.dti_first_page,
sdata->header.dshb_page_size, sdata->header.dshb_page_size,
entry_size, index); entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0) if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1; return -1;
@ -682,7 +682,7 @@ bfd_sym_fetch_file_references_table_entry (bfd *abfd,
int int
bfd_sym_fetch_contained_modules_table_entry (bfd *abfd, bfd_sym_fetch_contained_modules_table_entry (bfd *abfd,
bfd_sym_contained_modules_table_entry *entry, bfd_sym_contained_modules_table_entry *entry,
unsigned long index) unsigned long sym_index)
{ {
void (*parser) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry *); void (*parser) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry *);
unsigned long offset; unsigned long offset;
@ -694,7 +694,7 @@ bfd_sym_fetch_contained_modules_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd)); BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data; sdata = abfd->tdata.sym_data;
if (index == 0) if (sym_index == 0)
return -1; return -1;
switch (sdata->version) switch (sdata->version)
@ -717,7 +717,7 @@ bfd_sym_fetch_contained_modules_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_cmte.dti_first_page, offset = compute_offset (sdata->header.dshb_cmte.dti_first_page,
sdata->header.dshb_page_size, sdata->header.dshb_page_size,
entry_size, index); entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0) if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1; return -1;
@ -732,7 +732,7 @@ bfd_sym_fetch_contained_modules_table_entry (bfd *abfd,
int int
bfd_sym_fetch_contained_variables_table_entry (bfd *abfd, bfd_sym_fetch_contained_variables_table_entry (bfd *abfd,
bfd_sym_contained_variables_table_entry *entry, bfd_sym_contained_variables_table_entry *entry,
unsigned long index) unsigned long sym_index)
{ {
void (*parser) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry *); void (*parser) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry *);
unsigned long offset; unsigned long offset;
@ -744,7 +744,7 @@ bfd_sym_fetch_contained_variables_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd)); BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data; sdata = abfd->tdata.sym_data;
if (index == 0) if (sym_index == 0)
return -1; return -1;
switch (sdata->version) switch (sdata->version)
@ -767,7 +767,7 @@ bfd_sym_fetch_contained_variables_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_cvte.dti_first_page, offset = compute_offset (sdata->header.dshb_cvte.dti_first_page,
sdata->header.dshb_page_size, sdata->header.dshb_page_size,
entry_size, index); entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0) if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1; return -1;
@ -782,7 +782,7 @@ bfd_sym_fetch_contained_variables_table_entry (bfd *abfd,
int int
bfd_sym_fetch_contained_statements_table_entry (bfd *abfd, bfd_sym_fetch_contained_statements_table_entry (bfd *abfd,
bfd_sym_contained_statements_table_entry *entry, bfd_sym_contained_statements_table_entry *entry,
unsigned long index) unsigned long sym_index)
{ {
void (*parser) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry *); void (*parser) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry *);
unsigned long offset; unsigned long offset;
@ -794,7 +794,7 @@ bfd_sym_fetch_contained_statements_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd)); BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data; sdata = abfd->tdata.sym_data;
if (index == 0) if (sym_index == 0)
return -1; return -1;
switch (sdata->version) switch (sdata->version)
@ -817,7 +817,7 @@ bfd_sym_fetch_contained_statements_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_csnte.dti_first_page, offset = compute_offset (sdata->header.dshb_csnte.dti_first_page,
sdata->header.dshb_page_size, sdata->header.dshb_page_size,
entry_size, index); entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0) if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1; return -1;
@ -832,7 +832,7 @@ bfd_sym_fetch_contained_statements_table_entry (bfd *abfd,
int int
bfd_sym_fetch_contained_labels_table_entry (bfd *abfd, bfd_sym_fetch_contained_labels_table_entry (bfd *abfd,
bfd_sym_contained_labels_table_entry *entry, bfd_sym_contained_labels_table_entry *entry,
unsigned long index) unsigned long sym_index)
{ {
void (*parser) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry *); void (*parser) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry *);
unsigned long offset; unsigned long offset;
@ -844,7 +844,7 @@ bfd_sym_fetch_contained_labels_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd)); BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data; sdata = abfd->tdata.sym_data;
if (index == 0) if (sym_index == 0)
return -1; return -1;
switch (sdata->version) switch (sdata->version)
@ -867,7 +867,7 @@ bfd_sym_fetch_contained_labels_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_clte.dti_first_page, offset = compute_offset (sdata->header.dshb_clte.dti_first_page,
sdata->header.dshb_page_size, sdata->header.dshb_page_size,
entry_size, index); entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0) if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1; return -1;
@ -882,7 +882,7 @@ bfd_sym_fetch_contained_labels_table_entry (bfd *abfd,
int int
bfd_sym_fetch_contained_types_table_entry (bfd *abfd, bfd_sym_fetch_contained_types_table_entry (bfd *abfd,
bfd_sym_contained_types_table_entry *entry, bfd_sym_contained_types_table_entry *entry,
unsigned long index) unsigned long sym_index)
{ {
void (*parser) (unsigned char *, size_t, bfd_sym_contained_types_table_entry *); void (*parser) (unsigned char *, size_t, bfd_sym_contained_types_table_entry *);
unsigned long offset; unsigned long offset;
@ -894,7 +894,7 @@ bfd_sym_fetch_contained_types_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd)); BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data; sdata = abfd->tdata.sym_data;
if (index == 0) if (sym_index == 0)
return -1; return -1;
switch (sdata->version) switch (sdata->version)
@ -917,7 +917,7 @@ bfd_sym_fetch_contained_types_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_ctte.dti_first_page, offset = compute_offset (sdata->header.dshb_ctte.dti_first_page,
sdata->header.dshb_page_size, sdata->header.dshb_page_size,
entry_size, index); entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0) if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1; return -1;
@ -932,7 +932,7 @@ bfd_sym_fetch_contained_types_table_entry (bfd *abfd,
int int
bfd_sym_fetch_file_references_index_table_entry (bfd *abfd, bfd_sym_fetch_file_references_index_table_entry (bfd *abfd,
bfd_sym_file_references_index_table_entry *entry, bfd_sym_file_references_index_table_entry *entry,
unsigned long index) unsigned long sym_index)
{ {
void (*parser) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry *); void (*parser) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry *);
unsigned long offset; unsigned long offset;
@ -944,7 +944,7 @@ bfd_sym_fetch_file_references_index_table_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd)); BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data; sdata = abfd->tdata.sym_data;
if (index == 0) if (sym_index == 0)
return -1; return -1;
switch (sdata->version) switch (sdata->version)
@ -967,7 +967,7 @@ bfd_sym_fetch_file_references_index_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_fite.dti_first_page, offset = compute_offset (sdata->header.dshb_fite.dti_first_page,
sdata->header.dshb_page_size, sdata->header.dshb_page_size,
entry_size, index); entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0) if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1; return -1;
@ -982,7 +982,7 @@ bfd_sym_fetch_file_references_index_table_entry (bfd *abfd,
int int
bfd_sym_fetch_constant_pool_entry (bfd *abfd, bfd_sym_fetch_constant_pool_entry (bfd *abfd,
bfd_sym_constant_pool_entry *entry, bfd_sym_constant_pool_entry *entry,
unsigned long index) unsigned long sym_index)
{ {
void (*parser) (unsigned char *, size_t, bfd_sym_constant_pool_entry *); void (*parser) (unsigned char *, size_t, bfd_sym_constant_pool_entry *);
unsigned long offset; unsigned long offset;
@ -994,7 +994,7 @@ bfd_sym_fetch_constant_pool_entry (bfd *abfd,
BFD_ASSERT (bfd_sym_valid (abfd)); BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data; sdata = abfd->tdata.sym_data;
if (index == 0) if (sym_index == 0)
return -1; return -1;
switch (sdata->version) switch (sdata->version)
@ -1017,7 +1017,7 @@ bfd_sym_fetch_constant_pool_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_fite.dti_first_page, offset = compute_offset (sdata->header.dshb_fite.dti_first_page,
sdata->header.dshb_page_size, sdata->header.dshb_page_size,
entry_size, index); entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0) if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1; return -1;
@ -1032,7 +1032,7 @@ bfd_sym_fetch_constant_pool_entry (bfd *abfd,
int int
bfd_sym_fetch_type_table_entry (bfd *abfd, bfd_sym_fetch_type_table_entry (bfd *abfd,
bfd_sym_type_table_entry *entry, bfd_sym_type_table_entry *entry,
unsigned long index) unsigned long sym_index)
{ {
void (*parser) (unsigned char *, size_t, bfd_sym_type_table_entry *); void (*parser) (unsigned char *, size_t, bfd_sym_type_table_entry *);
unsigned long offset; unsigned long offset;
@ -1064,7 +1064,7 @@ bfd_sym_fetch_type_table_entry (bfd *abfd,
offset = compute_offset (sdata->header.dshb_tte.dti_first_page, offset = compute_offset (sdata->header.dshb_tte.dti_first_page,
sdata->header.dshb_page_size, sdata->header.dshb_page_size,
entry_size, index); entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0) if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1; return -1;
@ -1124,7 +1124,7 @@ bfd_sym_fetch_type_information_table_entry (bfd *abfd,
int int
bfd_sym_fetch_type_table_information (bfd *abfd, bfd_sym_fetch_type_table_information (bfd *abfd,
bfd_sym_type_information_table_entry *entry, bfd_sym_type_information_table_entry *entry,
unsigned long index) unsigned long sym_index)
{ {
bfd_sym_type_table_entry tindex; bfd_sym_type_table_entry tindex;
bfd_sym_data_struct *sdata = NULL; bfd_sym_data_struct *sdata = NULL;
@ -1134,10 +1134,10 @@ bfd_sym_fetch_type_table_information (bfd *abfd,
if (sdata->header.dshb_tte.dti_object_count <= 99) if (sdata->header.dshb_tte.dti_object_count <= 99)
return -1; return -1;
if (index < 100) if (sym_index < 100)
return -1; return -1;
if (bfd_sym_fetch_type_table_entry (abfd, &tindex, index - 100) < 0) if (bfd_sym_fetch_type_table_entry (abfd, &tindex, sym_index - 100) < 0)
return -1; return -1;
if (bfd_sym_fetch_type_information_table_entry (abfd, entry, tindex) < 0) if (bfd_sym_fetch_type_information_table_entry (abfd, entry, tindex) < 0)
return -1; return -1;
@ -1146,30 +1146,30 @@ bfd_sym_fetch_type_table_information (bfd *abfd,
} }
const unsigned char * const unsigned char *
bfd_sym_symbol_name (bfd *abfd, unsigned long index) bfd_sym_symbol_name (bfd *abfd, unsigned long sym_index)
{ {
bfd_sym_data_struct *sdata = NULL; bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd)); BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data; sdata = abfd->tdata.sym_data;
if (index == 0) if (sym_index == 0)
return (const unsigned char *) ""; return (const unsigned char *) "";
index *= 2; sym_index *= 2;
if ((index / sdata->header.dshb_page_size) if ((sym_index / sdata->header.dshb_page_size)
> sdata->header.dshb_nte.dti_page_count) > sdata->header.dshb_nte.dti_page_count)
return (const unsigned char *) "\09[INVALID]"; return (const unsigned char *) "\09[INVALID]";
return (const unsigned char *) sdata->name_table + index; return (const unsigned char *) sdata->name_table + sym_index;
} }
const unsigned char * const unsigned char *
bfd_sym_module_name (bfd *abfd, unsigned long index) bfd_sym_module_name (bfd *abfd, unsigned long sym_index)
{ {
bfd_sym_modules_table_entry entry; bfd_sym_modules_table_entry entry;
if (bfd_sym_fetch_modules_table_entry (abfd, &entry, index) < 0) if (bfd_sym_fetch_modules_table_entry (abfd, &entry, sym_index) < 0)
return (const unsigned char *) "\09[INVALID]"; return (const unsigned char *) "\09[INVALID]";
return bfd_sym_symbol_name (abfd, entry.mte_nte_index); return bfd_sym_symbol_name (abfd, entry.mte_nte_index);
@ -1859,24 +1859,24 @@ bfd_sym_display_name_table_entry (bfd *abfd,
FILE *f, FILE *f,
unsigned char *entry) unsigned char *entry)
{ {
unsigned long index; unsigned long sym_index;
unsigned long offset; unsigned long offset;
bfd_sym_data_struct *sdata = NULL; bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd)); BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data; sdata = abfd->tdata.sym_data;
index = (entry - sdata->name_table) / 2; sym_index = (entry - sdata->name_table) / 2;
if (sdata->version >= BFD_SYM_VERSION_3_4 && entry[0] == 255 && entry[1] == 0) if (sdata->version >= BFD_SYM_VERSION_3_4 && entry[0] == 255 && entry[1] == 0)
{ {
unsigned short length = bfd_getb16 (entry + 2); unsigned short length = bfd_getb16 (entry + 2);
fprintf (f, "[%8lu] \"%.*s\"\n", index, length, entry + 4); fprintf (f, "[%8lu] \"%.*s\"\n", sym_index, length, entry + 4);
offset = 2 + length + 1; offset = 2 + length + 1;
} }
else else
{ {
if (! (entry[0] == 0 || (entry[0] == 1 && entry[1] == '\0'))) if (! (entry[0] == 0 || (entry[0] == 1 && entry[1] == '\0')))
fprintf (f, "[%8lu] \"%.*s\"\n", index, entry[0], entry + 1); fprintf (f, "[%8lu] \"%.*s\"\n", sym_index, entry[0], entry + 1);
if (sdata->version >= BFD_SYM_VERSION_3_4) if (sdata->version >= BFD_SYM_VERSION_3_4)
offset = entry[0] + 2; offset = entry[0] + 2;
@ -2178,7 +2178,7 @@ void
bfd_sym_display_type_information_table (bfd *abfd, FILE *f) bfd_sym_display_type_information_table (bfd *abfd, FILE *f)
{ {
unsigned long i; unsigned long i;
bfd_sym_type_table_entry index; bfd_sym_type_table_entry sym_index;
bfd_sym_type_information_table_entry entry; bfd_sym_type_information_table_entry entry;
bfd_sym_data_struct *sdata = NULL; bfd_sym_data_struct *sdata = NULL;
@ -2196,13 +2196,13 @@ bfd_sym_display_type_information_table (bfd *abfd, FILE *f)
for (i = 100; i <= sdata->header.dshb_tte.dti_object_count; i++) for (i = 100; i <= sdata->header.dshb_tte.dti_object_count; i++)
{ {
if (bfd_sym_fetch_type_table_entry (abfd, &index, i - 100) < 0) if (bfd_sym_fetch_type_table_entry (abfd, &sym_index, i - 100) < 0)
fprintf (f, " [%8lu] [INVALID]\n", i); fprintf (f, " [%8lu] [INVALID]\n", i);
else else
{ {
fprintf (f, " [%8lu] (TINFO %lu) ", i, index); fprintf (f, " [%8lu] (TINFO %lu) ", i, sym_index);
if (bfd_sym_fetch_type_information_table_entry (abfd, &entry, index) < 0) if (bfd_sym_fetch_type_information_table_entry (abfd, &entry, sym_index) < 0)
fprintf (f, "[INVALID]"); fprintf (f, "[INVALID]");
else else
bfd_sym_print_type_information_table_entry (abfd, f, &entry); bfd_sym_print_type_information_table_entry (abfd, f, &entry);

View File

@ -1,5 +1,5 @@
/* Configurable Xtensa ISA support. /* Configurable Xtensa ISA support.
Copyright 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc. Copyright 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -1028,15 +1028,14 @@ xtensa_operand_encode (xtensa_isa isa, xtensa_opcode opc, int opnd,
uint32 test_val, orig_val; uint32 test_val, orig_val;
intop = get_operand (intisa, opc, opnd); intop = get_operand (intisa, opc, opnd);
if (!intop) return -1; if (!intop)
return -1;
if (!intop->encode) if (!intop->encode)
{ {
/* This is a default operand for a field. How can we tell if the /* This is a default operand for a field. How can we tell if the
value fits in the field? Write the value into the field, value fits in the field? Write the value into the field,
read it back, and then make sure we get the same value. */ read it back, and then make sure we get the same value. */
xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
static xtensa_insnbuf tmpbuf = 0; static xtensa_insnbuf tmpbuf = 0;
int slot_id; int slot_id;
@ -1081,9 +1080,9 @@ xtensa_operand_encode (xtensa_isa isa, xtensa_opcode opc, int opnd,
was successfully encoded is to decode it and check if it matches was successfully encoded is to decode it and check if it matches
the original value. */ the original value. */
orig_val = *valp; orig_val = *valp;
if ((*intop->encode) (valp) || if ((*intop->encode) (valp)
(test_val = *valp, (*intop->decode) (&test_val)) || || (test_val = *valp, (*intop->decode) (&test_val))
test_val != orig_val) || test_val != orig_val)
{ {
xtisa_errno = xtensa_isa_bad_value; xtisa_errno = xtensa_isa_bad_value;
sprintf (xtisa_error_msg, "cannot encode operand value 0x%08x", *valp); sprintf (xtisa_error_msg, "cannot encode operand value 0x%08x", *valp);

View File

@ -1,3 +1,30 @@
2009-12-11 Nick Clifton <nickc@redhat.com>
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
* ar.c: Fix shadowed variable warnings.
* bucomm.c: Likewise.
* coffgrok.c: Likewise.
* configure: Likewise.
* dlltool.c: Likewise.
* dllwrap.c: Likewise.
* dwarf.c: Likewise.
* ieee.c: Likewise.
* nlmconv.c: Likewise.
* nm.c: Likewise.
* objcopy.c: Likewise.
* objdump.c: Likewise.
* prdbg.c: Likewise.
* readelf.c: Likewise.
* resbin.c: Likewise.
* resrc.c: Likewise.
* resres.c: Likewise.
* srconv.c: Likewise.
* stabs.c: Likewise.
* sysdump.c: Likewise.
* sysinfo.y: Likewise.
* wrstabs.c: Likewise.
2009-12-10 Tristan Gingold <gingold@adacore.com> 2009-12-10 Tristan Gingold <gingold@adacore.com>
* addr2line.c (pretty_print): New variable. * addr2line.c (pretty_print): New variable.

View File

@ -54,10 +54,12 @@ DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
rcparse.h rcparse.c $(srcdir)/../depcomp $(srcdir)/../ylwrap rcparse.h rcparse.c $(srcdir)/../depcomp $(srcdir)/../ylwrap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
$(top_srcdir)/../config/zlib.m4 \
$(top_srcdir)/../bfd/warning.m4 \ $(top_srcdir)/../bfd/warning.m4 \
$(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \
$(top_srcdir)/../config/iconv.m4 \ $(top_srcdir)/../config/iconv.m4 \
$(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/lib-ld.m4 \ $(top_srcdir)/../config/lib-ld.m4 \
$(top_srcdir)/../config/lib-link.m4 \ $(top_srcdir)/../config/lib-link.m4 \

View File

@ -1168,14 +1168,14 @@ move_members (bfd *arch, char **files_to_move)
{ {
/* Move this file to the end of the list - first cut from /* Move this file to the end of the list - first cut from
where it is. */ where it is. */
bfd *link; bfd *link_bfd;
*current_ptr_ptr = current_ptr->archive_next; *current_ptr_ptr = current_ptr->archive_next;
/* Now glue to end */ /* Now glue to end */
after_bfd = get_pos_bfd (&arch->archive_next, pos_end, NULL); after_bfd = get_pos_bfd (&arch->archive_next, pos_end, NULL);
link = *after_bfd; link_bfd = *after_bfd;
*after_bfd = current_ptr; *after_bfd = current_ptr;
current_ptr->archive_next = link; current_ptr->archive_next = link_bfd;
if (verbose) if (verbose)
printf ("m - %s\n", *files_to_move); printf ("m - %s\n", *files_to_move);

View File

@ -70,12 +70,12 @@ bfd_nonfatal (const char *string)
PROGRAM:file: bfd-error-message PROGRAM:file: bfd-error-message
PROGRAM:file[section]: bfd-error-message PROGRAM:file[section]: bfd-error-message
PROGRAM:file: printf-message: bfd-error-message PROGRAM:file: printf-message: bfd-error-message
PROGRAM:file[section]: printf-message: bfd-error-message PROGRAM:file[section]: printf-message: bfd-error-message. */
*/
void void
bfd_nonfatal_message (const char *filename, bfd_nonfatal_message (const char *filename,
const bfd *bfd, const asection *section, const bfd *abfd,
const asection *section,
const char *format, ...) const char *format, ...)
{ {
const char *errmsg = bfd_errmsg (bfd_get_error ()); const char *errmsg = bfd_errmsg (bfd_get_error ());
@ -85,12 +85,12 @@ bfd_nonfatal_message (const char *filename,
va_start (args, format); va_start (args, format);
fprintf (stderr, "%s", program_name); fprintf (stderr, "%s", program_name);
if (bfd) if (abfd)
{ {
if (!filename) if (!filename)
filename = bfd_get_archive_filename (bfd); filename = bfd_get_archive_filename (abfd);
if (section) if (section)
section_name = bfd_get_section_name (bfd, section); section_name = bfd_get_section_name (abfd, section);
} }
if (section_name) if (section_name)
fprintf (stderr, ":%s[%s]", filename, section_name); fprintf (stderr, ":%s[%s]", filename, section_name);

View File

@ -1,6 +1,6 @@
/* coffgrok.c /* coffgrok.c
Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
Free Software Foundation, Inc. 2007, 2009 Free Software Foundation, Inc.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -96,10 +96,11 @@ empty_symbol (void)
/*int l;*/ /*int l;*/
static void static void
push_scope (int link) push_scope (int slink)
{ {
struct coff_scope *n = empty_scope (); struct coff_scope *n = empty_scope ();
if (link)
if (slink)
{ {
if (top_scope) if (top_scope)
{ {

2
binutils/configure vendored
View File

@ -11440,7 +11440,7 @@ esac
fi fi
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow"
# Check whether --enable-werror was given. # Check whether --enable-werror was given.
if test "${enable_werror+set}" = set; then : if test "${enable_werror+set}" = set; then :

View File

@ -879,9 +879,9 @@ inform VPARAMS ((const char * message, ...))
} }
static const char * static const char *
rvaafter (int machine) rvaafter (int mach)
{ {
switch (machine) switch (mach)
{ {
case MARM: case MARM:
case M386: case M386:
@ -898,16 +898,16 @@ rvaafter (int machine)
break; break;
default: default:
/* xgettext:c-format */ /* xgettext:c-format */
fatal (_("Internal error: Unknown machine type: %d"), machine); fatal (_("Internal error: Unknown machine type: %d"), mach);
break; break;
} }
return ""; return "";
} }
static const char * static const char *
rvabefore (int machine) rvabefore (int mach)
{ {
switch (machine) switch (mach)
{ {
case MARM: case MARM:
case M386: case M386:
@ -924,16 +924,16 @@ rvabefore (int machine)
return ".rva\t"; return ".rva\t";
default: default:
/* xgettext:c-format */ /* xgettext:c-format */
fatal (_("Internal error: Unknown machine type: %d"), machine); fatal (_("Internal error: Unknown machine type: %d"), mach);
break; break;
} }
return ""; return "";
} }
static const char * static const char *
asm_prefix (int machine, const char *name) asm_prefix (int mach, const char *name)
{ {
switch (machine) switch (mach)
{ {
case MARM: case MARM:
case MPPC: case MPPC:
@ -955,7 +955,7 @@ asm_prefix (int machine, const char *name)
return "_"; return "_";
default: default:
/* xgettext:c-format */ /* xgettext:c-format */
fatal (_("Internal error: Unknown machine type: %d"), machine); fatal (_("Internal error: Unknown machine type: %d"), mach);
break; break;
} }
return ""; return "";
@ -1155,7 +1155,7 @@ def_stacksize (int reserve, int commit)
import_list. It is used by def_import. */ import_list. It is used by def_import. */
static void static void
append_import (const char *symbol_name, const char *dll_name, int func_ordinal, append_import (const char *symbol_name, const char *dllname, int func_ordinal,
const char *its_name) const char *its_name)
{ {
iheadtype **pq; iheadtype **pq;
@ -1163,7 +1163,7 @@ append_import (const char *symbol_name, const char *dll_name, int func_ordinal,
for (pq = &import_list; *pq != NULL; pq = &(*pq)->next) for (pq = &import_list; *pq != NULL; pq = &(*pq)->next)
{ {
if (strcmp ((*pq)->dllname, dll_name) == 0) if (strcmp ((*pq)->dllname, dllname) == 0)
{ {
q = *pq; q = *pq;
q->functail->next = xmalloc (sizeof (ifunctype)); q->functail->next = xmalloc (sizeof (ifunctype));
@ -1178,7 +1178,7 @@ append_import (const char *symbol_name, const char *dll_name, int func_ordinal,
} }
q = xmalloc (sizeof (iheadtype)); q = xmalloc (sizeof (iheadtype));
q->dllname = xstrdup (dll_name); q->dllname = xstrdup (dllname);
q->nfuncs = 1; q->nfuncs = 1;
q->funchead = xmalloc (sizeof (ifunctype)); q->funchead = xmalloc (sizeof (ifunctype));
q->functail = q->funchead; q->functail = q->funchead;

View File

@ -1,5 +1,5 @@
/* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs /* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009
Free Software Foundation, Inc. Free Software Foundation, Inc.
Contributed by Mumit Khan (khan@xraylith.wisc.edu). Contributed by Mumit Khan (khan@xraylith.wisc.edu).
@ -182,20 +182,20 @@ warn VPARAMS ((const char *format, ...))
appropriate. */ appropriate. */
static char * static char *
look_for_prog (const char *prog_name, const char *prefix, int end_prefix) look_for_prog (const char *progname, const char *prefix, int end_prefix)
{ {
struct stat s; struct stat s;
char *cmd; char *cmd;
cmd = xmalloc (strlen (prefix) cmd = xmalloc (strlen (prefix)
+ strlen (prog_name) + strlen (progname)
#ifdef HAVE_EXECUTABLE_SUFFIX #ifdef HAVE_EXECUTABLE_SUFFIX
+ strlen (EXECUTABLE_SUFFIX) + strlen (EXECUTABLE_SUFFIX)
#endif #endif
+ 10); + 10);
strcpy (cmd, prefix); strcpy (cmd, prefix);
sprintf (cmd + end_prefix, "%s", prog_name); sprintf (cmd + end_prefix, "%s", progname);
if (strchr (cmd, '/') != NULL) if (strchr (cmd, '/') != NULL)
{ {
@ -973,7 +973,6 @@ Creating one, but that may not be what you want"));
if (! def_file_seen) if (! def_file_seen)
{ {
int i;
dyn_string_t step_pre1; dyn_string_t step_pre1;
step_pre1 = dyn_string_new (1024); step_pre1 = dyn_string_new (1024);

View File

@ -38,10 +38,12 @@ subdir = doc
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
$(top_srcdir)/../config/zlib.m4 \
$(top_srcdir)/../bfd/warning.m4 \ $(top_srcdir)/../bfd/warning.m4 \
$(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \
$(top_srcdir)/../config/iconv.m4 \ $(top_srcdir)/../config/iconv.m4 \
$(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/lib-ld.m4 \ $(top_srcdir)/../config/lib-ld.m4 \
$(top_srcdir)/../config/lib-link.m4 \ $(top_srcdir)/../config/lib-link.m4 \

View File

@ -438,23 +438,23 @@ static abbrev_entry *last_abbrev = NULL;
static void static void
free_abbrevs (void) free_abbrevs (void)
{ {
abbrev_entry *abbrev; abbrev_entry *abbrv;
for (abbrev = first_abbrev; abbrev;) for (abbrv = first_abbrev; abbrv;)
{ {
abbrev_entry *next = abbrev->next; abbrev_entry *next_abbrev = abbrv->next;
abbrev_attr *attr; abbrev_attr *attr;
for (attr = abbrev->first_attr; attr;) for (attr = abbrv->first_attr; attr;)
{ {
abbrev_attr *next = attr->next; abbrev_attr *next_attr = attr->next;
free (attr); free (attr);
attr = next; attr = next_attr;
} }
free (abbrev); free (abbrv);
abbrev = next; abbrv = next_abbrev;
} }
last_abbrev = first_abbrev = NULL; last_abbrev = first_abbrev = NULL;
@ -1355,19 +1355,19 @@ read_and_display_attr_value (unsigned long attribute,
if (form == DW_FORM_data4 || form == DW_FORM_data8) if (form == DW_FORM_data4 || form == DW_FORM_data8)
{ {
/* Process location list. */ /* Process location list. */
unsigned int max = debug_info_p->max_loc_offsets; unsigned int lmax = debug_info_p->max_loc_offsets;
unsigned int num = debug_info_p->num_loc_offsets; unsigned int num = debug_info_p->num_loc_offsets;
if (max == 0 || num >= max) if (lmax == 0 || num >= lmax)
{ {
max += 1024; lmax += 1024;
debug_info_p->loc_offsets = (long unsigned int *) debug_info_p->loc_offsets = (long unsigned int *)
xcrealloc (debug_info_p->loc_offsets, xcrealloc (debug_info_p->loc_offsets,
max, sizeof (*debug_info_p->loc_offsets)); lmax, sizeof (*debug_info_p->loc_offsets));
debug_info_p->have_frame_base = (int *) debug_info_p->have_frame_base = (int *)
xcrealloc (debug_info_p->have_frame_base, xcrealloc (debug_info_p->have_frame_base,
max, sizeof (*debug_info_p->have_frame_base)); lmax, sizeof (*debug_info_p->have_frame_base));
debug_info_p->max_loc_offsets = max; debug_info_p->max_loc_offsets = lmax;
} }
debug_info_p->loc_offsets [num] = uvalue; debug_info_p->loc_offsets [num] = uvalue;
debug_info_p->have_frame_base [num] = have_frame_base; debug_info_p->have_frame_base [num] = have_frame_base;
@ -1384,16 +1384,16 @@ read_and_display_attr_value (unsigned long attribute,
if (form == DW_FORM_data4 || form == DW_FORM_data8) if (form == DW_FORM_data4 || form == DW_FORM_data8)
{ {
/* Process range list. */ /* Process range list. */
unsigned int max = debug_info_p->max_range_lists; unsigned int lmax = debug_info_p->max_range_lists;
unsigned int num = debug_info_p->num_range_lists; unsigned int num = debug_info_p->num_range_lists;
if (max == 0 || num >= max) if (lmax == 0 || num >= lmax)
{ {
max += 1024; lmax += 1024;
debug_info_p->range_lists = (long unsigned int *) debug_info_p->range_lists = (long unsigned int *)
xcrealloc (debug_info_p->range_lists, xcrealloc (debug_info_p->range_lists,
max, sizeof (*debug_info_p->range_lists)); lmax, sizeof (*debug_info_p->range_lists));
debug_info_p->max_range_lists = max; debug_info_p->max_range_lists = lmax;
} }
debug_info_p->range_lists [num] = uvalue; debug_info_p->range_lists [num] = uvalue;
debug_info_p->num_range_lists++; debug_info_p->num_range_lists++;
@ -2226,7 +2226,7 @@ display_debug_lines_raw (struct dwarf_section *section,
while (data < end) while (data < end)
{ {
DWARF2_Internal_LineInfo info; DWARF2_Internal_LineInfo linfo;
unsigned char *standard_opcodes; unsigned char *standard_opcodes;
unsigned char *end_of_sequence; unsigned char *end_of_sequence;
unsigned char *hdrptr; unsigned char *hdrptr;
@ -2239,13 +2239,13 @@ display_debug_lines_raw (struct dwarf_section *section,
hdroff = hdrptr - start; hdroff = hdrptr - start;
/* Check the length of the block. */ /* Check the length of the block. */
info.li_length = byte_get (hdrptr, 4); linfo.li_length = byte_get (hdrptr, 4);
hdrptr += 4; hdrptr += 4;
if (info.li_length == 0xffffffff) if (linfo.li_length == 0xffffffff)
{ {
/* This section is 64-bit DWARF 3. */ /* This section is 64-bit DWARF 3. */
info.li_length = byte_get (hdrptr, 8); linfo.li_length = byte_get (hdrptr, 8);
hdrptr += 8; hdrptr += 8;
offset_size = 8; offset_size = 8;
initial_length_size = 12; initial_length_size = 12;
@ -2256,7 +2256,7 @@ display_debug_lines_raw (struct dwarf_section *section,
initial_length_size = 4; initial_length_size = 4;
} }
if (info.li_length + initial_length_size > section->size) if (linfo.li_length + initial_length_size > section->size)
{ {
warn warn
(_("The information in section %s appears to be corrupt - the section is too small\n"), (_("The information in section %s appears to be corrupt - the section is too small\n"),
@ -2265,55 +2265,55 @@ display_debug_lines_raw (struct dwarf_section *section,
} }
/* Check its version number. */ /* Check its version number. */
info.li_version = byte_get (hdrptr, 2); linfo.li_version = byte_get (hdrptr, 2);
hdrptr += 2; hdrptr += 2;
if (info.li_version != 2 && info.li_version != 3) if (linfo.li_version != 2 && linfo.li_version != 3)
{ {
warn (_("Only DWARF version 2 and 3 line info is currently supported.\n")); warn (_("Only DWARF version 2 and 3 line info is currently supported.\n"));
return 0; return 0;
} }
info.li_prologue_length = byte_get (hdrptr, offset_size); linfo.li_prologue_length = byte_get (hdrptr, offset_size);
hdrptr += offset_size; hdrptr += offset_size;
info.li_min_insn_length = byte_get (hdrptr, 1); linfo.li_min_insn_length = byte_get (hdrptr, 1);
hdrptr++; hdrptr++;
info.li_default_is_stmt = byte_get (hdrptr, 1); linfo.li_default_is_stmt = byte_get (hdrptr, 1);
hdrptr++; hdrptr++;
info.li_line_base = byte_get (hdrptr, 1); linfo.li_line_base = byte_get (hdrptr, 1);
hdrptr++; hdrptr++;
info.li_line_range = byte_get (hdrptr, 1); linfo.li_line_range = byte_get (hdrptr, 1);
hdrptr++; hdrptr++;
info.li_opcode_base = byte_get (hdrptr, 1); linfo.li_opcode_base = byte_get (hdrptr, 1);
hdrptr++; hdrptr++;
/* Sign extend the line base field. */ /* Sign extend the line base field. */
info.li_line_base <<= 24; linfo.li_line_base <<= 24;
info.li_line_base >>= 24; linfo.li_line_base >>= 24;
printf (_(" Offset: 0x%lx\n"), hdroff); printf (_(" Offset: 0x%lx\n"), hdroff);
printf (_(" Length: %ld\n"), info.li_length); printf (_(" Length: %ld\n"), linfo.li_length);
printf (_(" DWARF Version: %d\n"), info.li_version); printf (_(" DWARF Version: %d\n"), linfo.li_version);
printf (_(" Prologue Length: %d\n"), info.li_prologue_length); printf (_(" Prologue Length: %d\n"), linfo.li_prologue_length);
printf (_(" Minimum Instruction Length: %d\n"), info.li_min_insn_length); printf (_(" Minimum Instruction Length: %d\n"), linfo.li_min_insn_length);
printf (_(" Initial value of 'is_stmt': %d\n"), info.li_default_is_stmt); printf (_(" Initial value of 'is_stmt': %d\n"), linfo.li_default_is_stmt);
printf (_(" Line Base: %d\n"), info.li_line_base); printf (_(" Line Base: %d\n"), linfo.li_line_base);
printf (_(" Line Range: %d\n"), info.li_line_range); printf (_(" Line Range: %d\n"), linfo.li_line_range);
printf (_(" Opcode Base: %d\n"), info.li_opcode_base); printf (_(" Opcode Base: %d\n"), linfo.li_opcode_base);
end_of_sequence = data + info.li_length + initial_length_size; end_of_sequence = data + linfo.li_length + initial_length_size;
reset_state_machine (info.li_default_is_stmt); reset_state_machine (linfo.li_default_is_stmt);
/* Display the contents of the Opcodes table. */ /* Display the contents of the Opcodes table. */
standard_opcodes = hdrptr; standard_opcodes = hdrptr;
printf (_("\n Opcodes:\n")); printf (_("\n Opcodes:\n"));
for (i = 1; i < info.li_opcode_base; i++) for (i = 1; i < linfo.li_opcode_base; i++)
printf (_(" Opcode %d has %d args\n"), i, standard_opcodes[i - 1]); printf (_(" Opcode %d has %d args\n"), i, standard_opcodes[i - 1]);
/* Display the contents of the Directory table. */ /* Display the contents of the Directory table. */
data = standard_opcodes + info.li_opcode_base - 1; data = standard_opcodes + linfo.li_opcode_base - 1;
if (*data == 0) if (*data == 0)
printf (_("\n The Directory Table is empty.\n")); printf (_("\n The Directory Table is empty.\n"));
@ -2375,14 +2375,14 @@ display_debug_lines_raw (struct dwarf_section *section,
op_code = *data++; op_code = *data++;
if (op_code >= info.li_opcode_base) if (op_code >= linfo.li_opcode_base)
{ {
op_code -= info.li_opcode_base; op_code -= linfo.li_opcode_base;
uladv = (op_code / info.li_line_range) * info.li_min_insn_length; uladv = (op_code / linfo.li_line_range) * linfo.li_min_insn_length;
state_machine_regs.address += uladv; state_machine_regs.address += uladv;
printf (_(" Special opcode %d: advance Address by %lu to 0x%lx"), printf (_(" Special opcode %d: advance Address by %lu to 0x%lx"),
op_code, uladv, state_machine_regs.address); op_code, uladv, state_machine_regs.address);
adv = (op_code % info.li_line_range) + info.li_line_base; adv = (op_code % linfo.li_line_range) + linfo.li_line_base;
state_machine_regs.line += adv; state_machine_regs.line += adv;
printf (_(" and Line by %d to %d\n"), printf (_(" and Line by %d to %d\n"),
adv, state_machine_regs.line); adv, state_machine_regs.line);
@ -2390,7 +2390,7 @@ display_debug_lines_raw (struct dwarf_section *section,
else switch (op_code) else switch (op_code)
{ {
case DW_LNS_extended_op: case DW_LNS_extended_op:
data += process_extended_line_op (data, info.li_default_is_stmt); data += process_extended_line_op (data, linfo.li_default_is_stmt);
break; break;
case DW_LNS_copy: case DW_LNS_copy:
@ -2399,7 +2399,7 @@ display_debug_lines_raw (struct dwarf_section *section,
case DW_LNS_advance_pc: case DW_LNS_advance_pc:
uladv = read_leb128 (data, & bytes_read, 0); uladv = read_leb128 (data, & bytes_read, 0);
uladv *= info.li_min_insn_length; uladv *= linfo.li_min_insn_length;
data += bytes_read; data += bytes_read;
state_machine_regs.address += uladv; state_machine_regs.address += uladv;
printf (_(" Advance PC by %lu to 0x%lx\n"), uladv, printf (_(" Advance PC by %lu to 0x%lx\n"), uladv,
@ -2442,8 +2442,8 @@ display_debug_lines_raw (struct dwarf_section *section,
break; break;
case DW_LNS_const_add_pc: case DW_LNS_const_add_pc:
uladv = (((255 - info.li_opcode_base) / info.li_line_range) uladv = (((255 - linfo.li_opcode_base) / linfo.li_line_range)
* info.li_min_insn_length); * linfo.li_min_insn_length);
state_machine_regs.address += uladv; state_machine_regs.address += uladv;
printf (_(" Advance PC by constant %lu to 0x%lx\n"), uladv, printf (_(" Advance PC by constant %lu to 0x%lx\n"), uladv,
state_machine_regs.address); state_machine_regs.address);
@ -2511,7 +2511,7 @@ display_debug_lines_decoded (struct dwarf_section *section,
while (data < end) while (data < end)
{ {
/* This loop amounts to one iteration per compilation unit. */ /* This loop amounts to one iteration per compilation unit. */
DWARF2_Internal_LineInfo info; DWARF2_Internal_LineInfo linfo;
unsigned char *standard_opcodes; unsigned char *standard_opcodes;
unsigned char *end_of_sequence; unsigned char *end_of_sequence;
unsigned char *hdrptr; unsigned char *hdrptr;
@ -2528,13 +2528,13 @@ display_debug_lines_decoded (struct dwarf_section *section,
(section 6.2.4 in the Dwarf3 doc). */ (section 6.2.4 in the Dwarf3 doc). */
/* Get the length of this CU's line number information block. */ /* Get the length of this CU's line number information block. */
info.li_length = byte_get (hdrptr, 4); linfo.li_length = byte_get (hdrptr, 4);
hdrptr += 4; hdrptr += 4;
if (info.li_length == 0xffffffff) if (linfo.li_length == 0xffffffff)
{ {
/* This section is 64-bit DWARF 3. */ /* This section is 64-bit DWARF 3. */
info.li_length = byte_get (hdrptr, 8); linfo.li_length = byte_get (hdrptr, 8);
hdrptr += 8; hdrptr += 8;
offset_size = 8; offset_size = 8;
initial_length_size = 12; initial_length_size = 12;
@ -2545,7 +2545,7 @@ display_debug_lines_decoded (struct dwarf_section *section,
initial_length_size = 4; initial_length_size = 4;
} }
if (info.li_length + initial_length_size > section->size) if (linfo.li_length + initial_length_size > section->size)
{ {
warn (_("The line info appears to be corrupt - " warn (_("The line info appears to be corrupt - "
"the section is too small\n")); "the section is too small\n"));
@ -2553,47 +2553,46 @@ display_debug_lines_decoded (struct dwarf_section *section,
} }
/* Get this CU's Line Number Block version number. */ /* Get this CU's Line Number Block version number. */
info.li_version = byte_get (hdrptr, 2); linfo.li_version = byte_get (hdrptr, 2);
hdrptr += 2; hdrptr += 2;
if (info.li_version != 2 && info.li_version != 3) if (linfo.li_version != 2 && linfo.li_version != 3)
{ {
warn (_("Only DWARF version 2 and 3 line info is currently " warn (_("Only DWARF version 2 and 3 line info is currently "
"supported.\n")); "supported.\n"));
return 0; return 0;
} }
info.li_prologue_length = byte_get (hdrptr, offset_size); linfo.li_prologue_length = byte_get (hdrptr, offset_size);
hdrptr += offset_size; hdrptr += offset_size;
info.li_min_insn_length = byte_get (hdrptr, 1); linfo.li_min_insn_length = byte_get (hdrptr, 1);
hdrptr++; hdrptr++;
info.li_default_is_stmt = byte_get (hdrptr, 1); linfo.li_default_is_stmt = byte_get (hdrptr, 1);
hdrptr++; hdrptr++;
info.li_line_base = byte_get (hdrptr, 1); linfo.li_line_base = byte_get (hdrptr, 1);
hdrptr++; hdrptr++;
info.li_line_range = byte_get (hdrptr, 1); linfo.li_line_range = byte_get (hdrptr, 1);
hdrptr++; hdrptr++;
info.li_opcode_base = byte_get (hdrptr, 1); linfo.li_opcode_base = byte_get (hdrptr, 1);
hdrptr++; hdrptr++;
/* Sign extend the line base field. */ /* Sign extend the line base field. */
info.li_line_base <<= 24; linfo.li_line_base <<= 24;
info.li_line_base >>= 24; linfo.li_line_base >>= 24;
/* Find the end of this CU's Line Number Information Block. */ /* Find the end of this CU's Line Number Information Block. */
end_of_sequence = data + info.li_length + initial_length_size; end_of_sequence = data + linfo.li_length + initial_length_size;
reset_state_machine (info.li_default_is_stmt); reset_state_machine (linfo.li_default_is_stmt);
/* Save a pointer to the contents of the Opcodes table. */ /* Save a pointer to the contents of the Opcodes table. */
standard_opcodes = hdrptr; standard_opcodes = hdrptr;
/* Traverse the Directory table just to count entries. */ /* Traverse the Directory table just to count entries. */
data = standard_opcodes + info.li_opcode_base - 1; data = standard_opcodes + linfo.li_opcode_base - 1;
if (*data != 0) if (*data != 0)
{ {
unsigned int n_directories = 0; unsigned int n_directories = 0;
unsigned char *ptr_directory_table = data; unsigned char *ptr_directory_table = data;
int i;
while (*data != 0) while (*data != 0)
{ {
@ -2621,7 +2620,6 @@ display_debug_lines_decoded (struct dwarf_section *section,
{ {
unsigned int n_files = 0; unsigned int n_files = 0;
unsigned char *ptr_file_name_table = data; unsigned char *ptr_file_name_table = data;
int i;
while (*data != 0) while (*data != 0)
{ {
@ -2700,13 +2698,13 @@ display_debug_lines_decoded (struct dwarf_section *section,
op_code = *data++; op_code = *data++;
prev_line = state_machine_regs.line; prev_line = state_machine_regs.line;
if (op_code >= info.li_opcode_base) if (op_code >= linfo.li_opcode_base)
{ {
op_code -= info.li_opcode_base; op_code -= linfo.li_opcode_base;
uladv = (op_code / info.li_line_range) * info.li_min_insn_length; uladv = (op_code / linfo.li_line_range) * linfo.li_min_insn_length;
state_machine_regs.address += uladv; state_machine_regs.address += uladv;
adv = (op_code % info.li_line_range) + info.li_line_base; adv = (op_code % linfo.li_line_range) + linfo.li_line_base;
state_machine_regs.line += adv; state_machine_regs.line += adv;
is_special_opcode = 1; is_special_opcode = 1;
} }
@ -2715,7 +2713,6 @@ display_debug_lines_decoded (struct dwarf_section *section,
case DW_LNS_extended_op: case DW_LNS_extended_op:
{ {
unsigned int ext_op_code_len; unsigned int ext_op_code_len;
unsigned int bytes_read;
unsigned char ext_op_code; unsigned char ext_op_code;
unsigned char *op_code_data = data; unsigned char *op_code_data = data;
@ -2733,7 +2730,7 @@ display_debug_lines_decoded (struct dwarf_section *section,
switch (ext_op_code) switch (ext_op_code)
{ {
case DW_LNE_end_sequence: case DW_LNE_end_sequence:
reset_state_machine (info.li_default_is_stmt); reset_state_machine (linfo.li_default_is_stmt);
break; break;
case DW_LNE_set_address: case DW_LNE_set_address:
state_machine_regs.address = state_machine_regs.address =
@ -2766,7 +2763,7 @@ display_debug_lines_decoded (struct dwarf_section *section,
case DW_LNS_advance_pc: case DW_LNS_advance_pc:
uladv = read_leb128 (data, & bytes_read, 0); uladv = read_leb128 (data, & bytes_read, 0);
uladv *= info.li_min_insn_length; uladv *= linfo.li_min_insn_length;
data += bytes_read; data += bytes_read;
state_machine_regs.address += uladv; state_machine_regs.address += uladv;
break; break;
@ -2813,8 +2810,8 @@ display_debug_lines_decoded (struct dwarf_section *section,
break; break;
case DW_LNS_const_add_pc: case DW_LNS_const_add_pc:
uladv = (((255 - info.li_opcode_base) / info.li_line_range) uladv = (((255 - linfo.li_opcode_base) / linfo.li_line_range)
* info.li_min_insn_length); * linfo.li_min_insn_length);
state_machine_regs.address += uladv; state_machine_regs.address += uladv;
break; break;
@ -2949,7 +2946,7 @@ static int
display_debug_pubnames (struct dwarf_section *section, display_debug_pubnames (struct dwarf_section *section,
void *file ATTRIBUTE_UNUSED) void *file ATTRIBUTE_UNUSED)
{ {
DWARF2_Internal_PubNames pubnames; DWARF2_Internal_PubNames names;
unsigned char *start = section->start; unsigned char *start = section->start;
unsigned char *end = start + section->size; unsigned char *end = start + section->size;
@ -2967,11 +2964,11 @@ display_debug_pubnames (struct dwarf_section *section,
data = start; data = start;
pubnames.pn_length = byte_get (data, 4); names.pn_length = byte_get (data, 4);
data += 4; data += 4;
if (pubnames.pn_length == 0xffffffff) if (names.pn_length == 0xffffffff)
{ {
pubnames.pn_length = byte_get (data, 8); names.pn_length = byte_get (data, 8);
data += 8; data += 8;
offset_size = 8; offset_size = 8;
initial_length_size = 12; initial_length_size = 12;
@ -2982,24 +2979,24 @@ display_debug_pubnames (struct dwarf_section *section,
initial_length_size = 4; initial_length_size = 4;
} }
pubnames.pn_version = byte_get (data, 2); names.pn_version = byte_get (data, 2);
data += 2; data += 2;
pubnames.pn_offset = byte_get (data, offset_size); names.pn_offset = byte_get (data, offset_size);
data += offset_size; data += offset_size;
if (num_debug_info_entries != DEBUG_INFO_UNAVAILABLE if (num_debug_info_entries != DEBUG_INFO_UNAVAILABLE
&& num_debug_info_entries > 0 && num_debug_info_entries > 0
&& find_debug_info_for_offset (pubnames.pn_offset) == NULL) && find_debug_info_for_offset (names.pn_offset) == NULL)
warn (_(".debug_info offset of 0x%lx in %s section does not point to a CU header.\n"), warn (_(".debug_info offset of 0x%lx in %s section does not point to a CU header.\n"),
pubnames.pn_offset, section->name); names.pn_offset, section->name);
pubnames.pn_size = byte_get (data, offset_size); names.pn_size = byte_get (data, offset_size);
data += offset_size; data += offset_size;
start += pubnames.pn_length + initial_length_size; start += names.pn_length + initial_length_size;
if (pubnames.pn_version != 2 && pubnames.pn_version != 3) if (names.pn_version != 2 && names.pn_version != 3)
{ {
static int warned = 0; static int warned = 0;
@ -3013,13 +3010,13 @@ display_debug_pubnames (struct dwarf_section *section,
} }
printf (_(" Length: %ld\n"), printf (_(" Length: %ld\n"),
pubnames.pn_length); names.pn_length);
printf (_(" Version: %d\n"), printf (_(" Version: %d\n"),
pubnames.pn_version); names.pn_version);
printf (_(" Offset into .debug_info section: 0x%lx\n"), printf (_(" Offset into .debug_info section: 0x%lx\n"),
pubnames.pn_offset); names.pn_offset);
printf (_(" Size of area in .debug_info section: %ld\n"), printf (_(" Size of area in .debug_info section: %ld\n"),
pubnames.pn_size); names.pn_size);
printf (_("\n Offset\tName\n")); printf (_("\n Offset\tName\n"));
@ -3464,7 +3461,7 @@ display_debug_aranges (struct dwarf_section *section,
{ {
unsigned char *hdrptr; unsigned char *hdrptr;
DWARF2_Internal_ARange arange; DWARF2_Internal_ARange arange;
unsigned char *ranges; unsigned char *addr_ranges;
dwarf_vma length; dwarf_vma length;
dwarf_vma address; dwarf_vma address;
unsigned char address_size; unsigned char address_size;
@ -3536,24 +3533,24 @@ display_debug_aranges (struct dwarf_section *section,
else else
printf (_("\n Address Length\n")); printf (_("\n Address Length\n"));
ranges = hdrptr; addr_ranges = hdrptr;
/* Must pad to an alignment boundary that is twice the address size. */ /* Must pad to an alignment boundary that is twice the address size. */
excess = (hdrptr - start) % (2 * address_size); excess = (hdrptr - start) % (2 * address_size);
if (excess) if (excess)
ranges += (2 * address_size) - excess; addr_ranges += (2 * address_size) - excess;
start += arange.ar_length + initial_length_size; start += arange.ar_length + initial_length_size;
while (ranges + 2 * address_size <= start) while (addr_ranges + 2 * address_size <= start)
{ {
address = byte_get (ranges, address_size); address = byte_get (addr_ranges, address_size);
ranges += address_size; addr_ranges += address_size;
length = byte_get (ranges, address_size); length = byte_get (addr_ranges, address_size);
ranges += address_size; addr_ranges += address_size;
printf (" "); printf (" ");
print_dwarf_vma (address, address_size); print_dwarf_vma (address, address_size);
@ -3880,11 +3877,11 @@ frame_display_row (Frame_Chunk *fc, int *need_col_headers, int *max_regs)
if (*need_col_headers) if (*need_col_headers)
{ {
static const char *loc = " LOC"; static const char *sloc = " LOC";
*need_col_headers = 0; *need_col_headers = 0;
printf ("%-*s CFA ", eh_addr_size * 2, loc); printf ("%-*s CFA ", eh_addr_size * 2, sloc);
for (r = 0; r < *max_regs; r++) for (r = 0; r < *max_regs; r++)
if (fc->col_type[r] != DW_CFA_unreferenced) if (fc->col_type[r] != DW_CFA_unreferenced)
@ -4218,7 +4215,7 @@ display_debug_frames (struct dwarf_section *section,
while (start < block_end) while (start < block_end)
{ {
unsigned op, opa; unsigned op, opa;
unsigned long reg, tmp; unsigned long reg, temp;
op = *start++; op = *start++;
opa = op & 0x3f; opa = op & 0x3f;
@ -4289,14 +4286,14 @@ display_debug_frames (struct dwarf_section *section,
LEB (); LEB ();
break; break;
case DW_CFA_def_cfa_expression: case DW_CFA_def_cfa_expression:
tmp = LEB (); temp = LEB ();
start += tmp; start += temp;
break; break;
case DW_CFA_expression: case DW_CFA_expression:
case DW_CFA_val_expression: case DW_CFA_val_expression:
reg = LEB (); reg = LEB ();
tmp = LEB (); temp = LEB ();
start += tmp; start += temp;
if (frame_need_space (fc, reg) >= 0) if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined; fc->col_type[reg] = DW_CFA_undefined;
break; break;
@ -4918,10 +4915,10 @@ dwarf_select_sections_by_names (const char *names)
void void
dwarf_select_sections_by_letters (const char *letters) dwarf_select_sections_by_letters (const char *letters)
{ {
unsigned int index = 0; unsigned int lindex = 0;
while (letters[index]) while (letters[lindex])
switch (letters[index++]) switch (letters[lindex++])
{ {
case 'i': case 'i':
do_debug_info = 1; do_debug_info = 1;

View File

@ -2616,7 +2616,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp,
case 'b': case 'b':
{ {
bfd_vma flags, cinline; bfd_vma flags, cinline;
const char *basename, *fieldname; const char *base, *fieldname;
unsigned long baselen, fieldlen; unsigned long baselen, fieldlen;
char *basecopy; char *basecopy;
debug_type basetype; debug_type basetype;
@ -2628,7 +2628,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp,
/* This represents a base or friend class. */ /* This represents a base or friend class. */
if (! ieee_require_asn (info, pp, &flags) if (! ieee_require_asn (info, pp, &flags)
|| ! ieee_require_atn65 (info, pp, &basename, &baselen) || ! ieee_require_atn65 (info, pp, &base, &baselen)
|| ! ieee_require_asn (info, pp, &cinline) || ! ieee_require_asn (info, pp, &cinline)
|| ! ieee_require_atn65 (info, pp, &fieldname, &fieldlen)) || ! ieee_require_atn65 (info, pp, &fieldname, &fieldlen))
return FALSE; return FALSE;
@ -2650,7 +2650,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp,
return FALSE; return FALSE;
} }
basecopy = savestring (basename, baselen); basecopy = savestring (base, baselen);
basetype = debug_find_tagged_type (dhandle, basecopy, basetype = debug_find_tagged_type (dhandle, basecopy,
DEBUG_KIND_ILLEGAL); DEBUG_KIND_ILLEGAL);
free (basecopy); free (basecopy);
@ -3113,7 +3113,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp,
case 'z': case 'z':
{ {
const char *vname, *basename; const char *vname, *base;
unsigned long vnamelen, baselen; unsigned long vnamelen, baselen;
bfd_vma vsize, control; bfd_vma vsize, control;
@ -3121,7 +3121,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp,
if (! ieee_require_atn65 (info, pp, &vname, &vnamelen) if (! ieee_require_atn65 (info, pp, &vname, &vnamelen)
|| ! ieee_require_asn (info, pp, &vsize) || ! ieee_require_asn (info, pp, &vsize)
|| ! ieee_require_atn65 (info, pp, &basename, &baselen) || ! ieee_require_atn65 (info, pp, &base, &baselen)
|| ! ieee_require_asn (info, pp, &control)) || ! ieee_require_asn (info, pp, &control))
return FALSE; return FALSE;
count -= 4; count -= 4;
@ -3138,7 +3138,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp,
{ {
char *basecopy; char *basecopy;
basecopy = savestring (basename, baselen); basecopy = savestring (base, baselen);
vptrbase = debug_find_tagged_type (dhandle, basecopy, vptrbase = debug_find_tagged_type (dhandle, basecopy,
DEBUG_KIND_ILLEGAL); DEBUG_KIND_ILLEGAL);
free (basecopy); free (basecopy);
@ -5980,8 +5980,6 @@ ieee_struct_field (void *p, const char *name, bfd_vma bitpos, bfd_vma bitsize,
if (referencep) if (referencep)
{ {
unsigned int nindx;
/* We need to output a record recording that this field is /* We need to output a record recording that this field is
really of reference type. We put this on the refs field really of reference type. We put this on the refs field
of classdef, so that it can be appended to the C++ of classdef, so that it can be appended to the C++

View File

@ -2039,7 +2039,7 @@ powerpc_mangle_relocs (bfd *outbfd, asection *insec,
file. */ file. */
static char * static char *
link_inputs (struct string_list *inputs, char *ld, char * map_file) link_inputs (struct string_list *inputs, char *ld, char * mfile)
{ {
size_t c; size_t c;
struct string_list *q; struct string_list *q;
@ -2088,12 +2088,12 @@ link_inputs (struct string_list *inputs, char *ld, char * map_file)
argv[3] = unlink_on_exit; argv[3] = unlink_on_exit;
/* If we have been given the name of a mapfile and that /* If we have been given the name of a mapfile and that
name is not 'stderr' then pass it on to the linker. */ name is not 'stderr' then pass it on to the linker. */
if (map_file if (mfile
&& * map_file && * mfile
&& strcmp (map_file, "stderr") == 0) && strcmp (mfile, "stderr") == 0)
{ {
argv[4] = (char *) "-Map"; argv[4] = (char *) "-Map";
argv[5] = map_file; argv[5] = mfile;
i = 6; i = 6;
} }
else else

View File

@ -343,11 +343,11 @@ get_symbol_type (unsigned int type)
} }
} }
/* Print symbol name NAME, read from ABFD, with printf format FORMAT, /* Print symbol name NAME, read from ABFD, with printf format FORM,
demangling it if requested. */ demangling it if requested. */
static void static void
print_symname (const char *format, const char *name, bfd *abfd) print_symname (const char *form, const char *name, bfd *abfd)
{ {
if (do_demangle && *name) if (do_demangle && *name)
{ {
@ -355,13 +355,13 @@ print_symname (const char *format, const char *name, bfd *abfd)
if (res != NULL) if (res != NULL)
{ {
printf (format, res); printf (form, res);
free (res); free (res);
return; return;
} }
} }
printf (format, name); printf (form, name);
} }
static void static void
@ -397,7 +397,7 @@ print_symdef_entry (bfd *abfd)
Return the number of symbols to be printed. */ Return the number of symbols to be printed. */
static long static long
filter_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, filter_symbols (bfd *abfd, bfd_boolean is_dynamic, void *minisyms,
long symcount, unsigned int size) long symcount, unsigned int size)
{ {
bfd_byte *from, *fromend, *to; bfd_byte *from, *fromend, *to;
@ -418,7 +418,7 @@ filter_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms,
PROGRESS (1); PROGRESS (1);
sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const void *) from, store); sym = bfd_minisymbol_to_symbol (abfd, is_dynamic, (const void *) from, store);
if (sym == NULL) if (sym == NULL)
bfd_fatal (bfd_get_filename (abfd)); bfd_fatal (bfd_get_filename (abfd));
@ -659,7 +659,7 @@ size_forward2 (const void *P_x, const void *P_y)
size. */ size. */
static long static long
sort_symbols_by_size (bfd *abfd, bfd_boolean dynamic, void *minisyms, sort_symbols_by_size (bfd *abfd, bfd_boolean is_dynamic, void *minisyms,
long symcount, unsigned int size, long symcount, unsigned int size,
struct size_sym **symsizesp) struct size_sym **symsizesp)
{ {
@ -686,7 +686,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean dynamic, void *minisyms,
if (from < fromend) if (from < fromend)
{ {
sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const void *) from, sym = bfd_minisymbol_to_symbol (abfd, is_dynamic, (const void *) from,
store_sym); store_sym);
if (sym == NULL) if (sym == NULL)
bfd_fatal (bfd_get_filename (abfd)); bfd_fatal (bfd_get_filename (abfd));
@ -702,7 +702,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean dynamic, void *minisyms,
if (from + size < fromend) if (from + size < fromend)
{ {
next = bfd_minisymbol_to_symbol (abfd, next = bfd_minisymbol_to_symbol (abfd,
dynamic, is_dynamic,
(const void *) (from + size), (const void *) (from + size),
store_next); store_next);
if (next == NULL) if (next == NULL)
@ -861,7 +861,7 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd)
if (relocs == NULL) if (relocs == NULL)
{ {
struct get_relocs_info info; struct get_relocs_info rinfo;
seccount = bfd_count_sections (abfd); seccount = bfd_count_sections (abfd);
@ -869,11 +869,11 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd)
relocs = (arelent ***) xmalloc (seccount * sizeof *relocs); relocs = (arelent ***) xmalloc (seccount * sizeof *relocs);
relcount = (long *) xmalloc (seccount * sizeof *relcount); relcount = (long *) xmalloc (seccount * sizeof *relcount);
info.secs = secs; rinfo.secs = secs;
info.relocs = relocs; rinfo.relocs = relocs;
info.relcount = relcount; rinfo.relcount = relcount;
info.syms = syms; rinfo.syms = syms;
bfd_map_over_sections (abfd, get_relocs, (void *) &info); bfd_map_over_sections (abfd, get_relocs, (void *) &rinfo);
lineno_cache_rel_bfd = abfd; lineno_cache_rel_bfd = abfd;
} }
@ -923,7 +923,7 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd)
/* Print the symbols when sorting by size. */ /* Print the symbols when sorting by size. */
static void static void
print_size_symbols (bfd *abfd, bfd_boolean dynamic, print_size_symbols (bfd *abfd, bfd_boolean is_dynamic,
struct size_sym *symsizes, long symcount, struct size_sym *symsizes, long symcount,
bfd *archive_bfd) bfd *archive_bfd)
{ {
@ -941,7 +941,7 @@ print_size_symbols (bfd *abfd, bfd_boolean dynamic,
asymbol *sym; asymbol *sym;
bfd_vma ssize; bfd_vma ssize;
sym = bfd_minisymbol_to_symbol (abfd, dynamic, from->minisym, store); sym = bfd_minisymbol_to_symbol (abfd, is_dynamic, from->minisym, store);
if (sym == NULL) if (sym == NULL)
bfd_fatal (bfd_get_filename (abfd)); bfd_fatal (bfd_get_filename (abfd));
@ -960,7 +960,7 @@ print_size_symbols (bfd *abfd, bfd_boolean dynamic,
containing ABFD. */ containing ABFD. */
static void static void
print_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, long symcount, print_symbols (bfd *abfd, bfd_boolean is_dynamic, void *minisyms, long symcount,
unsigned int size, bfd *archive_bfd) unsigned int size, bfd *archive_bfd)
{ {
asymbol *store; asymbol *store;
@ -976,7 +976,7 @@ print_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, long symcount,
{ {
asymbol *sym; asymbol *sym;
sym = bfd_minisymbol_to_symbol (abfd, dynamic, from, store); sym = bfd_minisymbol_to_symbol (abfd, is_dynamic, from, store);
if (sym == NULL) if (sym == NULL)
bfd_fatal (bfd_get_filename (abfd)); bfd_fatal (bfd_get_filename (abfd));

View File

@ -2295,28 +2295,28 @@ static void
add_section_rename (const char * old_name, const char * new_name, add_section_rename (const char * old_name, const char * new_name,
flagword flags) flagword flags)
{ {
section_rename * rename; section_rename * srename;
/* Check for conflicts first. */ /* Check for conflicts first. */
for (rename = section_rename_list; rename != NULL; rename = rename->next) for (srename = section_rename_list; srename != NULL; srename = srename->next)
if (strcmp (rename->old_name, old_name) == 0) if (strcmp (srename->old_name, old_name) == 0)
{ {
/* Silently ignore duplicate definitions. */ /* Silently ignore duplicate definitions. */
if (strcmp (rename->new_name, new_name) == 0 if (strcmp (srename->new_name, new_name) == 0
&& rename->flags == flags) && srename->flags == flags)
return; return;
fatal (_("Multiple renames of section %s"), old_name); fatal (_("Multiple renames of section %s"), old_name);
} }
rename = (section_rename *) xmalloc (sizeof (* rename)); srename = (section_rename *) xmalloc (sizeof (* srename));
rename->old_name = old_name; srename->old_name = old_name;
rename->new_name = new_name; srename->new_name = new_name;
rename->flags = flags; srename->flags = flags;
rename->next = section_rename_list; srename->next = section_rename_list;
section_rename_list = rename; section_rename_list = srename;
} }
/* Check the section rename list for a new name of the input section /* Check the section rename list for a new name of the input section
@ -2328,18 +2328,18 @@ find_section_rename (bfd * ibfd ATTRIBUTE_UNUSED, sec_ptr isection,
flagword * returned_flags) flagword * returned_flags)
{ {
const char * old_name = bfd_section_name (ibfd, isection); const char * old_name = bfd_section_name (ibfd, isection);
section_rename * rename; section_rename * srename;
/* Default to using the flags of the input section. */ /* Default to using the flags of the input section. */
* returned_flags = bfd_get_section_flags (ibfd, isection); * returned_flags = bfd_get_section_flags (ibfd, isection);
for (rename = section_rename_list; rename != NULL; rename = rename->next) for (srename = section_rename_list; srename != NULL; srename = srename->next)
if (strcmp (rename->old_name, old_name) == 0) if (strcmp (srename->old_name, old_name) == 0)
{ {
if (rename->flags != (flagword) -1) if (srename->flags != (flagword) -1)
* returned_flags = rename->flags; * returned_flags = srename->flags;
return rename->new_name; return srename->new_name;
} }
return old_name; return old_name;

View File

@ -667,14 +667,14 @@ compare_relocs (const void *ap, const void *bp)
If SKIP_ZEROES is TRUE, omit leading zeroes. */ If SKIP_ZEROES is TRUE, omit leading zeroes. */
static void static void
objdump_print_value (bfd_vma vma, struct disassemble_info *info, objdump_print_value (bfd_vma vma, struct disassemble_info *inf,
bfd_boolean skip_zeroes) bfd_boolean skip_zeroes)
{ {
char buf[30]; char buf[30];
char *p; char *p;
struct objdump_disasm_info *aux; struct objdump_disasm_info *aux;
aux = (struct objdump_disasm_info *) info->application_data; aux = (struct objdump_disasm_info *) inf->application_data;
bfd_sprintf_vma (aux->abfd, buf, vma); bfd_sprintf_vma (aux->abfd, buf, vma);
if (! skip_zeroes) if (! skip_zeroes)
p = buf; p = buf;
@ -685,13 +685,13 @@ objdump_print_value (bfd_vma vma, struct disassemble_info *info,
if (*p == '\0') if (*p == '\0')
--p; --p;
} }
(*info->fprintf_func) (info->stream, "%s", p); (*inf->fprintf_func) (inf->stream, "%s", p);
} }
/* Print the name of a symbol. */ /* Print the name of a symbol. */
static void static void
objdump_print_symname (bfd *abfd, struct disassemble_info *info, objdump_print_symname (bfd *abfd, struct disassemble_info *inf,
asymbol *sym) asymbol *sym)
{ {
char *alloc; char *alloc;
@ -707,8 +707,8 @@ objdump_print_symname (bfd *abfd, struct disassemble_info *info,
name = alloc; name = alloc;
} }
if (info != NULL) if (inf != NULL)
(*info->fprintf_func) (info->stream, "%s", name); (*inf->fprintf_func) (inf->stream, "%s", name);
else else
printf ("%s", name); printf ("%s", name);
@ -724,7 +724,7 @@ objdump_print_symname (bfd *abfd, struct disassemble_info *info,
static asymbol * static asymbol *
find_symbol_for_address (bfd_vma vma, find_symbol_for_address (bfd_vma vma,
struct disassemble_info *info, struct disassemble_info *inf,
long *place) long *place)
{ {
/* @@ Would it speed things up to cache the last two symbols returned, /* @@ Would it speed things up to cache the last two symbols returned,
@ -734,7 +734,7 @@ find_symbol_for_address (bfd_vma vma,
/* Indices in `sorted_syms'. */ /* Indices in `sorted_syms'. */
long min = 0; long min = 0;
long max = sorted_symcount; long max_count = sorted_symcount;
long thisplace; long thisplace;
struct objdump_disasm_info *aux; struct objdump_disasm_info *aux;
bfd *abfd; bfd *abfd;
@ -745,22 +745,22 @@ find_symbol_for_address (bfd_vma vma,
if (sorted_symcount < 1) if (sorted_symcount < 1)
return NULL; return NULL;
aux = (struct objdump_disasm_info *) info->application_data; aux = (struct objdump_disasm_info *) inf->application_data;
abfd = aux->abfd; abfd = aux->abfd;
sec = aux->sec; sec = aux->sec;
opb = info->octets_per_byte; opb = inf->octets_per_byte;
/* Perform a binary search looking for the closest symbol to the /* Perform a binary search looking for the closest symbol to the
required value. We are searching the range (min, max]. */ required value. We are searching the range (min, max_count]. */
while (min + 1 < max) while (min + 1 < max_count)
{ {
asymbol *sym; asymbol *sym;
thisplace = (max + min) / 2; thisplace = (max_count + min) / 2;
sym = sorted_syms[thisplace]; sym = sorted_syms[thisplace];
if (bfd_asymbol_value (sym) > vma) if (bfd_asymbol_value (sym) > vma)
max = thisplace; max_count = thisplace;
else if (bfd_asymbol_value (sym) < vma) else if (bfd_asymbol_value (sym) < vma)
min = thisplace; min = thisplace;
else else
@ -783,12 +783,12 @@ find_symbol_for_address (bfd_vma vma,
with the same value, as can occur with overlays or zero size with the same value, as can occur with overlays or zero size
sections. */ sections. */
min = thisplace; min = thisplace;
while (min < max while (min < max_count
&& (bfd_asymbol_value (sorted_syms[min]) && (bfd_asymbol_value (sorted_syms[min])
== bfd_asymbol_value (sorted_syms[thisplace]))) == bfd_asymbol_value (sorted_syms[thisplace])))
{ {
if (sorted_syms[min]->section == sec if (sorted_syms[min]->section == sec
&& info->symbol_is_valid (sorted_syms[min], info)) && inf->symbol_is_valid (sorted_syms[min], inf))
{ {
thisplace = min; thisplace = min;
@ -816,7 +816,7 @@ find_symbol_for_address (bfd_vma vma,
&& vma < (bfd_get_section_vma (abfd, sec) && vma < (bfd_get_section_vma (abfd, sec)
+ bfd_section_size (abfd, sec) / opb))); + bfd_section_size (abfd, sec) / opb)));
if ((sorted_syms[thisplace]->section != sec && want_section) if ((sorted_syms[thisplace]->section != sec && want_section)
|| !info->symbol_is_valid (sorted_syms[thisplace], info)) || ! inf->symbol_is_valid (sorted_syms[thisplace], inf))
{ {
long i; long i;
long newplace = sorted_symcount; long newplace = sorted_symcount;
@ -824,7 +824,7 @@ find_symbol_for_address (bfd_vma vma,
for (i = min - 1; i >= 0; i--) for (i = min - 1; i >= 0; i--)
{ {
if ((sorted_syms[i]->section == sec || !want_section) if ((sorted_syms[i]->section == sec || !want_section)
&& info->symbol_is_valid (sorted_syms[i], info)) && inf->symbol_is_valid (sorted_syms[i], inf))
{ {
if (newplace == sorted_symcount) if (newplace == sorted_symcount)
newplace = i; newplace = i;
@ -848,7 +848,7 @@ find_symbol_for_address (bfd_vma vma,
for (i = thisplace + 1; i < sorted_symcount; i++) for (i = thisplace + 1; i < sorted_symcount; i++)
{ {
if ((sorted_syms[i]->section == sec || !want_section) if ((sorted_syms[i]->section == sec || !want_section)
&& info->symbol_is_valid (sorted_syms[i], info)) && inf->symbol_is_valid (sorted_syms[i], inf))
{ {
thisplace = i; thisplace = i;
break; break;
@ -857,7 +857,7 @@ find_symbol_for_address (bfd_vma vma,
} }
if ((sorted_syms[thisplace]->section != sec && want_section) if ((sorted_syms[thisplace]->section != sec && want_section)
|| !info->symbol_is_valid (sorted_syms[thisplace], info)) || ! inf->symbol_is_valid (sorted_syms[thisplace], inf))
/* There is no suitable symbol. */ /* There is no suitable symbol. */
return NULL; return NULL;
} }
@ -872,49 +872,49 @@ find_symbol_for_address (bfd_vma vma,
static void static void
objdump_print_addr_with_sym (bfd *abfd, asection *sec, asymbol *sym, objdump_print_addr_with_sym (bfd *abfd, asection *sec, asymbol *sym,
bfd_vma vma, struct disassemble_info *info, bfd_vma vma, struct disassemble_info *inf,
bfd_boolean skip_zeroes) bfd_boolean skip_zeroes)
{ {
objdump_print_value (vma, info, skip_zeroes); objdump_print_value (vma, inf, skip_zeroes);
if (sym == NULL) if (sym == NULL)
{ {
bfd_vma secaddr; bfd_vma secaddr;
(*info->fprintf_func) (info->stream, " <%s", (*inf->fprintf_func) (inf->stream, " <%s",
bfd_get_section_name (abfd, sec)); bfd_get_section_name (abfd, sec));
secaddr = bfd_get_section_vma (abfd, sec); secaddr = bfd_get_section_vma (abfd, sec);
if (vma < secaddr) if (vma < secaddr)
{ {
(*info->fprintf_func) (info->stream, "-0x"); (*inf->fprintf_func) (inf->stream, "-0x");
objdump_print_value (secaddr - vma, info, TRUE); objdump_print_value (secaddr - vma, inf, TRUE);
} }
else if (vma > secaddr) else if (vma > secaddr)
{ {
(*info->fprintf_func) (info->stream, "+0x"); (*inf->fprintf_func) (inf->stream, "+0x");
objdump_print_value (vma - secaddr, info, TRUE); objdump_print_value (vma - secaddr, inf, TRUE);
} }
(*info->fprintf_func) (info->stream, ">"); (*inf->fprintf_func) (inf->stream, ">");
} }
else else
{ {
(*info->fprintf_func) (info->stream, " <"); (*inf->fprintf_func) (inf->stream, " <");
objdump_print_symname (abfd, info, sym); objdump_print_symname (abfd, inf, sym);
if (bfd_asymbol_value (sym) > vma) if (bfd_asymbol_value (sym) > vma)
{ {
(*info->fprintf_func) (info->stream, "-0x"); (*inf->fprintf_func) (inf->stream, "-0x");
objdump_print_value (bfd_asymbol_value (sym) - vma, info, TRUE); objdump_print_value (bfd_asymbol_value (sym) - vma, inf, TRUE);
} }
else if (vma > bfd_asymbol_value (sym)) else if (vma > bfd_asymbol_value (sym))
{ {
(*info->fprintf_func) (info->stream, "+0x"); (*inf->fprintf_func) (inf->stream, "+0x");
objdump_print_value (vma - bfd_asymbol_value (sym), info, TRUE); objdump_print_value (vma - bfd_asymbol_value (sym), inf, TRUE);
} }
(*info->fprintf_func) (info->stream, ">"); (*inf->fprintf_func) (inf->stream, ">");
} }
if (display_file_offsets) if (display_file_offsets)
info->fprintf_func (info->stream, _(" (File Offset: 0x%lx)"), inf->fprintf_func (inf->stream, _(" (File Offset: 0x%lx)"),
(long int)(sec->filepos + (vma - sec->vma))); (long int)(sec->filepos + (vma - sec->vma)));
} }
@ -923,23 +923,23 @@ objdump_print_addr_with_sym (bfd *abfd, asection *sec, asymbol *sym,
static void static void
objdump_print_addr (bfd_vma vma, objdump_print_addr (bfd_vma vma,
struct disassemble_info *info, struct disassemble_info *inf,
bfd_boolean skip_zeroes) bfd_boolean skip_zeroes)
{ {
struct objdump_disasm_info *aux; struct objdump_disasm_info *aux;
asymbol *sym = NULL; asymbol *sym = NULL;
bfd_boolean skip_find = FALSE; bfd_boolean skip_find = FALSE;
aux = (struct objdump_disasm_info *) info->application_data; aux = (struct objdump_disasm_info *) inf->application_data;
if (sorted_symcount < 1) if (sorted_symcount < 1)
{ {
(*info->fprintf_func) (info->stream, "0x"); (*inf->fprintf_func) (inf->stream, "0x");
objdump_print_value (vma, info, skip_zeroes); objdump_print_value (vma, inf, skip_zeroes);
if (display_file_offsets) if (display_file_offsets)
info->fprintf_func (info->stream, _(" (File Offset: 0x%lx)"), inf->fprintf_func (inf->stream, _(" (File Offset: 0x%lx)"),
(long int)(aux->sec->filepos + (vma - aux->sec->vma))); (long int)(aux->sec->filepos + (vma - aux->sec->vma)));
return; return;
} }
@ -957,9 +957,9 @@ objdump_print_addr (bfd_vma vma,
} }
if (!skip_find) if (!skip_find)
sym = find_symbol_for_address (vma, info, NULL); sym = find_symbol_for_address (vma, inf, NULL);
objdump_print_addr_with_sym (aux->abfd, aux->sec, sym, vma, info, objdump_print_addr_with_sym (aux->abfd, aux->sec, sym, vma, inf,
skip_zeroes); skip_zeroes);
} }
@ -967,19 +967,19 @@ objdump_print_addr (bfd_vma vma,
routine. */ routine. */
static void static void
objdump_print_address (bfd_vma vma, struct disassemble_info *info) objdump_print_address (bfd_vma vma, struct disassemble_info *inf)
{ {
objdump_print_addr (vma, info, ! prefix_addresses); objdump_print_addr (vma, inf, ! prefix_addresses);
} }
/* Determine if the given address has a symbol associated with it. */ /* Determine if the given address has a symbol associated with it. */
static int static int
objdump_symbol_at_address (bfd_vma vma, struct disassemble_info * info) objdump_symbol_at_address (bfd_vma vma, struct disassemble_info * inf)
{ {
asymbol * sym; asymbol * sym;
sym = find_symbol_for_address (vma, info, NULL); sym = find_symbol_for_address (vma, inf, NULL);
return (sym != NULL && (bfd_asymbol_value (sym) == vma)); return (sym != NULL && (bfd_asymbol_value (sym) == vma));
} }
@ -1191,15 +1191,15 @@ update_source_path (const char *filename)
/* Print a source file line. */ /* Print a source file line. */
static void static void
print_line (struct print_file_list *p, unsigned int line) print_line (struct print_file_list *p, unsigned int linenum)
{ {
const char *l; const char *l;
size_t len; size_t len;
--line; --linenum;
if (line >= p->maxline) if (linenum >= p->maxline)
return; return;
l = p->linemap [line]; l = p->linemap [linenum];
/* Test fwrite return value to quiet glibc warning. */ /* Test fwrite return value to quiet glibc warning. */
len = strcspn (l, "\n\r"); len = strcspn (l, "\n\r");
if (len == 0 || fwrite (l, len, 1, stdout) == 1) if (len == 0 || fwrite (l, len, 1, stdout) == 1)
@ -1228,14 +1228,14 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
{ {
const char *filename; const char *filename;
const char *functionname; const char *functionname;
unsigned int line; unsigned int linenumber;
bfd_boolean reloc; bfd_boolean reloc;
if (! with_line_numbers && ! with_source_code) if (! with_line_numbers && ! with_source_code)
return; return;
if (! bfd_find_nearest_line (abfd, section, syms, addr_offset, &filename, if (! bfd_find_nearest_line (abfd, section, syms, addr_offset, &filename,
&functionname, &line)) &functionname, &linenumber))
return; return;
if (filename != NULL && *filename == '\0') if (filename != NULL && *filename == '\0')
@ -1287,13 +1287,13 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
&& (prev_functionname == NULL && (prev_functionname == NULL
|| strcmp (functionname, prev_functionname) != 0)) || strcmp (functionname, prev_functionname) != 0))
printf ("%s():\n", functionname); printf ("%s():\n", functionname);
if (line > 0 && line != prev_line) if (linenumber > 0 && linenumber != prev_line)
printf ("%s:%u\n", filename == NULL ? "???" : filename, line); printf ("%s:%u\n", filename == NULL ? "???" : filename, linenumber);
} }
if (with_source_code if (with_source_code
&& filename != NULL && filename != NULL
&& line > 0) && linenumber > 0)
{ {
struct print_file_list **pp, *p; struct print_file_list **pp, *p;
unsigned l; unsigned l;
@ -1310,20 +1310,20 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
p = update_source_path (filename); p = update_source_path (filename);
} }
if (p != NULL && line != p->last_line) if (p != NULL && linenumber != p->last_line)
{ {
if (file_start_context && p->first) if (file_start_context && p->first)
l = 1; l = 1;
else else
{ {
l = line - SHOW_PRECEDING_CONTEXT_LINES; l = linenumber - SHOW_PRECEDING_CONTEXT_LINES;
if (l >= line) if (l >= linenumber)
l = 1; l = 1;
if (p->last_line >= l && p->last_line <= line) if (p->last_line >= l && p->last_line <= linenumber)
l = p->last_line + 1; l = p->last_line + 1;
} }
dump_lines (p, l, line); dump_lines (p, l, linenumber);
p->last_line = line; p->last_line = linenumber;
p->first = 0; p->first = 0;
} }
} }
@ -1338,8 +1338,8 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
strcpy (prev_functionname, functionname); strcpy (prev_functionname, functionname);
} }
if (line > 0 && line != prev_line) if (linenumber > 0 && linenumber != prev_line)
prev_line = line; prev_line = linenumber;
} }
/* Pseudo FILE object for strings. */ /* Pseudo FILE object for strings. */
@ -1394,7 +1394,7 @@ objdump_sprintf (SFILE *f, const char *format, ...)
/* Disassemble some data in memory between given values. */ /* Disassemble some data in memory between given values. */
static void static void
disassemble_bytes (struct disassemble_info * info, disassemble_bytes (struct disassemble_info * inf,
disassembler_ftype disassemble_fn, disassembler_ftype disassemble_fn,
bfd_boolean insns, bfd_boolean insns,
bfd_byte * data, bfd_byte * data,
@ -1410,13 +1410,13 @@ disassemble_bytes (struct disassemble_info * info,
bfd_boolean done_dot; bfd_boolean done_dot;
int skip_addr_chars; int skip_addr_chars;
bfd_vma addr_offset; bfd_vma addr_offset;
unsigned int opb = info->octets_per_byte; unsigned int opb = inf->octets_per_byte;
unsigned int skip_zeroes = info->skip_zeroes; unsigned int skip_zeroes = inf->skip_zeroes;
unsigned int skip_zeroes_at_end = info->skip_zeroes_at_end; unsigned int skip_zeroes_at_end = inf->skip_zeroes_at_end;
int octets = opb; int octets = opb;
SFILE sfile; SFILE sfile;
aux = (struct objdump_disasm_info *) info->application_data; aux = (struct objdump_disasm_info *) inf->application_data;
section = aux->sec; section = aux->sec;
sfile.alloc = 120; sfile.alloc = 120;
@ -1452,7 +1452,7 @@ disassemble_bytes (struct disassemble_info * info,
skip_addr_chars = (skip_addr_chars - 1) & -4; skip_addr_chars = (skip_addr_chars - 1) & -4;
} }
info->insn_info_valid = 0; inf->insn_info_valid = 0;
done_dot = FALSE; done_dot = FALSE;
addr_offset = start_offset; addr_offset = start_offset;
@ -1472,8 +1472,8 @@ disassemble_bytes (struct disassemble_info * info,
if (data[z] != 0) if (data[z] != 0)
break; break;
if (! disassemble_zeroes if (! disassemble_zeroes
&& (info->insn_info_valid == 0 && (inf->insn_info_valid == 0
|| info->branch_delay_insns == 0) || inf->branch_delay_insns == 0)
&& (z - addr_offset * opb >= skip_zeroes && (z - addr_offset * opb >= skip_zeroes
|| (z == stop_offset * opb && || (z == stop_offset * opb &&
z - addr_offset * opb < skip_zeroes_at_end))) z - addr_offset * opb < skip_zeroes_at_end)))
@ -1523,7 +1523,7 @@ disassemble_bytes (struct disassemble_info * info,
else else
{ {
aux->require_sec = TRUE; aux->require_sec = TRUE;
objdump_print_address (section->vma + addr_offset, info); objdump_print_address (section->vma + addr_offset, inf);
aux->require_sec = FALSE; aux->require_sec = FALSE;
putchar (' '); putchar (' ');
} }
@ -1531,15 +1531,15 @@ disassemble_bytes (struct disassemble_info * info,
if (insns) if (insns)
{ {
sfile.pos = 0; sfile.pos = 0;
info->fprintf_func = (fprintf_ftype) objdump_sprintf; inf->fprintf_func = (fprintf_ftype) objdump_sprintf;
info->stream = &sfile; inf->stream = &sfile;
info->bytes_per_line = 0; inf->bytes_per_line = 0;
info->bytes_per_chunk = 0; inf->bytes_per_chunk = 0;
info->flags = disassemble_all ? DISASSEMBLE_DATA : 0; inf->flags = disassemble_all ? DISASSEMBLE_DATA : 0;
if (machine) if (machine)
info->flags |= USER_SPECIFIED_MACHINE_TYPE; inf->flags |= USER_SPECIFIED_MACHINE_TYPE;
if (info->disassembler_needs_relocs if (inf->disassembler_needs_relocs
&& (bfd_get_file_flags (aux->abfd) & EXEC_P) == 0 && (bfd_get_file_flags (aux->abfd) & EXEC_P) == 0
&& (bfd_get_file_flags (aux->abfd) & DYNAMIC) == 0 && (bfd_get_file_flags (aux->abfd) & DYNAMIC) == 0
&& *relppp < relppend) && *relppp < relppend)
@ -1566,18 +1566,18 @@ disassemble_bytes (struct disassemble_info * info,
|| (distance_to_rel > 0 || (distance_to_rel > 0
&& distance_to_rel < (bfd_signed_vma) (previous_octets/ opb))) && distance_to_rel < (bfd_signed_vma) (previous_octets/ opb)))
{ {
info->flags |= INSN_HAS_RELOC; inf->flags |= INSN_HAS_RELOC;
aux->reloc = **relppp; aux->reloc = **relppp;
} }
else else
aux->reloc = NULL; aux->reloc = NULL;
} }
octets = (*disassemble_fn) (section->vma + addr_offset, info); octets = (*disassemble_fn) (section->vma + addr_offset, inf);
info->fprintf_func = (fprintf_ftype) fprintf; inf->fprintf_func = (fprintf_ftype) fprintf;
info->stream = stdout; inf->stream = stdout;
if (insn_width == 0 && info->bytes_per_line != 0) if (insn_width == 0 && inf->bytes_per_line != 0)
octets_per_line = info->bytes_per_line; octets_per_line = inf->bytes_per_line;
if (octets < 0) if (octets < 0)
{ {
if (sfile.pos) if (sfile.pos)
@ -1615,8 +1615,8 @@ disassemble_bytes (struct disassemble_info * info,
if (pb > octets_per_line && ! prefix_addresses && ! wide_output) if (pb > octets_per_line && ! prefix_addresses && ! wide_output)
pb = octets_per_line; pb = octets_per_line;
if (info->bytes_per_chunk) if (inf->bytes_per_chunk)
bpc = info->bytes_per_chunk; bpc = inf->bytes_per_chunk;
else else
bpc = 1; bpc = 1;
@ -1624,7 +1624,7 @@ disassemble_bytes (struct disassemble_info * info,
{ {
int k; int k;
if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE) if (bpc > 1 && inf->display_endian == BFD_ENDIAN_LITTLE)
{ {
for (k = bpc - 1; k >= 0; k--) for (k = bpc - 1; k >= 0; k--)
printf ("%02x", (unsigned) data[j + k]); printf ("%02x", (unsigned) data[j + k]);
@ -1685,7 +1685,7 @@ disassemble_bytes (struct disassemble_info * info,
{ {
int k; int k;
if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE) if (bpc > 1 && inf->display_endian == BFD_ENDIAN_LITTLE)
{ {
for (k = bpc - 1; k >= 0; k--) for (k = bpc - 1; k >= 0; k--)
printf ("%02x", (unsigned) data[j + k]); printf ("%02x", (unsigned) data[j + k]);
@ -1722,7 +1722,7 @@ disassemble_bytes (struct disassemble_info * info,
printf ("\t\t\t"); printf ("\t\t\t");
objdump_print_value (section->vma - rel_offset + q->address, objdump_print_value (section->vma - rel_offset + q->address,
info, TRUE); inf, TRUE);
if (q->howto == NULL) if (q->howto == NULL)
printf (": *unknown*\t"); printf (": *unknown*\t");
@ -1739,7 +1739,7 @@ disassemble_bytes (struct disassemble_info * info,
sym_name = bfd_asymbol_name (*q->sym_ptr_ptr); sym_name = bfd_asymbol_name (*q->sym_ptr_ptr);
if (sym_name != NULL && *sym_name != '\0') if (sym_name != NULL && *sym_name != '\0')
objdump_print_symname (aux->abfd, info, *q->sym_ptr_ptr); objdump_print_symname (aux->abfd, inf, *q->sym_ptr_ptr);
else else
{ {
asection *sym_sec; asection *sym_sec;
@ -1755,7 +1755,7 @@ disassemble_bytes (struct disassemble_info * info,
if (q->addend) if (q->addend)
{ {
printf ("+0x"); printf ("+0x");
objdump_print_value (q->addend, info, TRUE); objdump_print_value (q->addend, inf, TRUE);
} }
printf ("\n"); printf ("\n");
@ -1774,11 +1774,11 @@ disassemble_bytes (struct disassemble_info * info,
} }
static void static void
disassemble_section (bfd *abfd, asection *section, void *info) disassemble_section (bfd *abfd, asection *section, void *inf)
{ {
const struct elf_backend_data * bed; const struct elf_backend_data * bed;
bfd_vma sign_adjust = 0; bfd_vma sign_adjust = 0;
struct disassemble_info * pinfo = (struct disassemble_info *) info; struct disassemble_info * pinfo = (struct disassemble_info *) inf;
struct objdump_disasm_info * paux; struct objdump_disasm_info * paux;
unsigned int opb = pinfo->octets_per_byte; unsigned int opb = pinfo->octets_per_byte;
bfd_byte * data = NULL; bfd_byte * data = NULL;
@ -1888,7 +1888,7 @@ disassemble_section (bfd *abfd, asection *section, void *info)
/* Find the nearest symbol forwards from our current position. */ /* Find the nearest symbol forwards from our current position. */
paux->require_sec = TRUE; paux->require_sec = TRUE;
sym = (asymbol *) find_symbol_for_address (section->vma + addr_offset, sym = (asymbol *) find_symbol_for_address (section->vma + addr_offset,
(struct disassemble_info *) info, (struct disassemble_info *) inf,
&place); &place);
paux->require_sec = FALSE; paux->require_sec = FALSE;
@ -2056,12 +2056,12 @@ disassemble_data (bfd *abfd)
if (machine != NULL) if (machine != NULL)
{ {
const bfd_arch_info_type *info = bfd_scan_arch (machine); const bfd_arch_info_type *inf = bfd_scan_arch (machine);
if (info == NULL) if (inf == NULL)
fatal (_("Can't use supplied machine %s"), machine); fatal (_("Can't use supplied machine %s"), machine);
abfd->arch_info = info; abfd->arch_info = inf;
} }
if (endian != BFD_ENDIAN_UNKNOWN) if (endian != BFD_ENDIAN_UNKNOWN)
@ -2665,26 +2665,26 @@ static void
dump_symbols (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean dynamic) dump_symbols (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean dynamic)
{ {
asymbol **current; asymbol **current;
long max; long max_count;
long count; long count;
if (dynamic) if (dynamic)
{ {
current = dynsyms; current = dynsyms;
max = dynsymcount; max_count = dynsymcount;
printf ("DYNAMIC SYMBOL TABLE:\n"); printf ("DYNAMIC SYMBOL TABLE:\n");
} }
else else
{ {
current = syms; current = syms;
max = symcount; max_count = symcount;
printf ("SYMBOL TABLE:\n"); printf ("SYMBOL TABLE:\n");
} }
if (max == 0) if (max_count == 0)
printf (_("no symbols\n")); printf (_("no symbols\n"));
for (count = 0; count < max; count++) for (count = 0; count < max_count; count++)
{ {
bfd *cur_bfd; bfd *cur_bfd;
@ -2759,7 +2759,7 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount)
{ {
arelent *q = *p; arelent *q = *p;
const char *filename, *functionname; const char *filename, *functionname;
unsigned int line; unsigned int linenumber;
const char *sym_name; const char *sym_name;
const char *section_name; const char *section_name;
@ -2773,7 +2773,7 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount)
if (with_line_numbers if (with_line_numbers
&& sec != NULL && sec != NULL
&& bfd_find_nearest_line (abfd, sec, syms, q->address, && bfd_find_nearest_line (abfd, sec, syms, q->address,
&filename, &functionname, &line)) &filename, &functionname, &linenumber))
{ {
if (functionname != NULL if (functionname != NULL
&& (last_functionname == NULL && (last_functionname == NULL
@ -2785,14 +2785,14 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount)
last_functionname = xstrdup (functionname); last_functionname = xstrdup (functionname);
} }
if (line > 0 if (linenumber > 0
&& (line != last_line && (linenumber != last_line
|| (filename != NULL || (filename != NULL
&& last_filename != NULL && last_filename != NULL
&& strcmp (filename, last_filename) != 0))) && strcmp (filename, last_filename) != 0)))
{ {
printf ("%s:%u\n", filename == NULL ? "???" : filename, line); printf ("%s:%u\n", filename == NULL ? "???" : filename, linenumber);
last_line = line; last_line = linenumber;
if (last_filename != NULL) if (last_filename != NULL)
free (last_filename); free (last_filename);
if (filename == NULL) if (filename == NULL)

View File

@ -1947,13 +1947,13 @@ translate_addresses (bfd *abfd, char *addr_hex, FILE *f, asymbol **syms)
/* Start a new compilation unit. */ /* Start a new compilation unit. */
static bfd_boolean static bfd_boolean
tg_start_compilation_unit (void * p, const char *filename ATTRIBUTE_UNUSED) tg_start_compilation_unit (void * p, const char *fname ATTRIBUTE_UNUSED)
{ {
struct pr_handle *info = (struct pr_handle *) p; struct pr_handle *info = (struct pr_handle *) p;
free (info->filename); free (info->filename);
/* Should it be relative? best way to do it here?. */ /* Should it be relative? best way to do it here?. */
info->filename = strdup (filename); info->filename = strdup (fname);
return TRUE; return TRUE;
} }
@ -1961,13 +1961,13 @@ tg_start_compilation_unit (void * p, const char *filename ATTRIBUTE_UNUSED)
/* Start a source file within a compilation unit. */ /* Start a source file within a compilation unit. */
static bfd_boolean static bfd_boolean
tg_start_source (void *p, const char *filename) tg_start_source (void *p, const char *fname)
{ {
struct pr_handle *info = (struct pr_handle *) p; struct pr_handle *info = (struct pr_handle *) p;
free (info->filename); free (info->filename);
/* Should it be relative? best way to do it here?. */ /* Should it be relative? best way to do it here?. */
info->filename = strdup (filename); info->filename = strdup (fname);
return TRUE; return TRUE;
} }
@ -2744,7 +2744,7 @@ tg_start_block (void *p, bfd_vma addr)
/* Write out line number information. */ /* Write out line number information. */
static bfd_boolean static bfd_boolean
tg_lineno (void *p ATTRIBUTE_UNUSED, const char *filename ATTRIBUTE_UNUSED, tg_lineno (void *p ATTRIBUTE_UNUSED, const char *fname ATTRIBUTE_UNUSED,
unsigned long lineno ATTRIBUTE_UNUSED, unsigned long lineno ATTRIBUTE_UNUSED,
bfd_vma addr ATTRIBUTE_UNUSED) bfd_vma addr ATTRIBUTE_UNUSED)
{ {

View File

@ -729,13 +729,13 @@ slurp_rela_relocs (FILE * file,
little-endian symbol index followed by four little-endian symbol index followed by four
individual byte fields. Reorder INFO individual byte fields. Reorder INFO
accordingly. */ accordingly. */
bfd_vma info = relas[i].r_info; bfd_vma inf = relas[i].r_info;
info = (((info & 0xffffffff) << 32) inf = (((inf & 0xffffffff) << 32)
| ((info >> 56) & 0xff) | ((inf >> 56) & 0xff)
| ((info >> 40) & 0xff00) | ((inf >> 40) & 0xff00)
| ((info >> 24) & 0xff0000) | ((inf >> 24) & 0xff0000)
| ((info >> 8) & 0xff000000)); | ((inf >> 8) & 0xff000000));
relas[i].r_info = info; relas[i].r_info = inf;
} }
#endif /* BFD64 */ #endif /* BFD64 */
} }
@ -825,13 +825,13 @@ slurp_rel_relocs (FILE * file,
little-endian symbol index followed by four little-endian symbol index followed by four
individual byte fields. Reorder INFO individual byte fields. Reorder INFO
accordingly. */ accordingly. */
bfd_vma info = rels[i].r_info; bfd_vma inf = rels[i].r_info;
info = (((info & 0xffffffff) << 32) inf = (((inf & 0xffffffff) << 32)
| ((info >> 56) & 0xff) | ((inf >> 56) & 0xff)
| ((info >> 40) & 0xff00) | ((inf >> 40) & 0xff00)
| ((info >> 24) & 0xff0000) | ((inf >> 24) & 0xff0000)
| ((info >> 8) & 0xff000000)); | ((inf >> 8) & 0xff000000));
rels[i].r_info = info; rels[i].r_info = inf;
} }
#endif /* BFD64 */ #endif /* BFD64 */
} }
@ -942,21 +942,21 @@ dump_relocations (FILE * file,
{ {
const char * rtype; const char * rtype;
bfd_vma offset; bfd_vma offset;
bfd_vma info; bfd_vma inf;
bfd_vma symtab_index; bfd_vma symtab_index;
bfd_vma type; bfd_vma type;
offset = rels[i].r_offset; offset = rels[i].r_offset;
info = rels[i].r_info; inf = rels[i].r_info;
type = get_reloc_type (info); type = get_reloc_type (inf);
symtab_index = get_reloc_symindex (info); symtab_index = get_reloc_symindex (inf);
if (is_32bit_elf) if (is_32bit_elf)
{ {
printf ("%8.8lx %8.8lx ", printf ("%8.8lx %8.8lx ",
(unsigned long) offset & 0xffffffff, (unsigned long) offset & 0xffffffff,
(unsigned long) info & 0xffffffff); (unsigned long) inf & 0xffffffff);
} }
else else
{ {
@ -964,18 +964,18 @@ dump_relocations (FILE * file,
printf (do_wide printf (do_wide
? "%16.16lx %16.16lx " ? "%16.16lx %16.16lx "
: "%12.12lx %12.12lx ", : "%12.12lx %12.12lx ",
offset, info); offset, inf);
#elif BFD_HOST_64BIT_LONG_LONG #elif BFD_HOST_64BIT_LONG_LONG
#ifndef __MSVCRT__ #ifndef __MSVCRT__
printf (do_wide printf (do_wide
? "%16.16llx %16.16llx " ? "%16.16llx %16.16llx "
: "%12.12llx %12.12llx ", : "%12.12llx %12.12llx ",
offset, info); offset, inf);
#else #else
printf (do_wide printf (do_wide
? "%16.16I64x %16.16I64x " ? "%16.16I64x %16.16I64x "
: "%12.12I64x %12.12I64x ", : "%12.12I64x %12.12I64x ",
offset, info); offset, inf);
#endif #endif
#else #else
printf (do_wide printf (do_wide
@ -983,8 +983,8 @@ dump_relocations (FILE * file,
: "%4.4lx%8.8lx %4.4lx%8.8lx ", : "%4.4lx%8.8lx %4.4lx%8.8lx ",
_bfd_int64_high (offset), _bfd_int64_high (offset),
_bfd_int64_low (offset), _bfd_int64_low (offset),
_bfd_int64_high (info), _bfd_int64_high (inf),
_bfd_int64_low (info)); _bfd_int64_low (inf));
#endif #endif
} }
@ -1355,12 +1355,12 @@ dump_relocations (FILE * file,
if (is_rela) if (is_rela)
{ {
long offset = (long) (bfd_signed_vma) rels[i].r_addend; long off = (long) (bfd_signed_vma) rels[i].r_addend;
if (offset < 0) if (off < 0)
printf (" - %lx", - offset); printf (" - %lx", - off);
else else
printf (" + %lx", offset); printf (" + %lx", off);
} }
} }
} }
@ -1374,15 +1374,15 @@ dump_relocations (FILE * file,
if (elf_header.e_machine == EM_SPARCV9 if (elf_header.e_machine == EM_SPARCV9
&& rtype != NULL && rtype != NULL
&& streq (rtype, "R_SPARC_OLO10")) && streq (rtype, "R_SPARC_OLO10"))
printf (" + %lx", (unsigned long) ELF64_R_TYPE_DATA (info)); printf (" + %lx", (unsigned long) ELF64_R_TYPE_DATA (inf));
putchar ('\n'); putchar ('\n');
#ifdef BFD64 #ifdef BFD64
if (! is_32bit_elf && elf_header.e_machine == EM_MIPS) if (! is_32bit_elf && elf_header.e_machine == EM_MIPS)
{ {
bfd_vma type2 = ELF64_MIPS_R_TYPE2 (info); bfd_vma type2 = ELF64_MIPS_R_TYPE2 (inf);
bfd_vma type3 = ELF64_MIPS_R_TYPE3 (info); bfd_vma type3 = ELF64_MIPS_R_TYPE3 (inf);
const char * rtype2 = elf_mips_reloc_type (type2); const char * rtype2 = elf_mips_reloc_type (type2);
const char * rtype3 = elf_mips_reloc_type (type3); const char * rtype3 = elf_mips_reloc_type (type3);
@ -3368,7 +3368,7 @@ process_file_header (void)
static int static int
get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * pheaders)
{ {
Elf32_External_Phdr * phdrs; Elf32_External_Phdr * phdrs;
Elf32_External_Phdr * external; Elf32_External_Phdr * external;
@ -3382,7 +3382,7 @@ get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers)
if (!phdrs) if (!phdrs)
return 0; return 0;
for (i = 0, internal = program_headers, external = phdrs; for (i = 0, internal = pheaders, external = phdrs;
i < elf_header.e_phnum; i < elf_header.e_phnum;
i++, internal++, external++) i++, internal++, external++)
{ {
@ -3402,7 +3402,7 @@ get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers)
} }
static int static int
get_64bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) get_64bit_program_headers (FILE * file, Elf_Internal_Phdr * pheaders)
{ {
Elf64_External_Phdr * phdrs; Elf64_External_Phdr * phdrs;
Elf64_External_Phdr * external; Elf64_External_Phdr * external;
@ -3416,7 +3416,7 @@ get_64bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers)
if (!phdrs) if (!phdrs)
return 0; return 0;
for (i = 0, internal = program_headers, external = phdrs; for (i = 0, internal = pheaders, external = phdrs;
i < elf_header.e_phnum; i < elf_header.e_phnum;
i++, internal++, external++) i++, internal++, external++)
{ {
@ -3959,7 +3959,8 @@ get_elf_section_flags (bfd_vma sh_flags)
static char buff[1024]; static char buff[1024];
char * p = buff; char * p = buff;
int field_size = is_32bit_elf ? 8 : 16; int field_size = is_32bit_elf ? 8 : 16;
int index, size = sizeof (buff) - (field_size + 4 + 1); int sindex;
int size = sizeof (buff) - (field_size + 4 + 1);
bfd_vma os_flags = 0; bfd_vma os_flags = 0;
bfd_vma proc_flags = 0; bfd_vma proc_flags = 0;
bfd_vma unknown_flags = 0; bfd_vma unknown_flags = 0;
@ -4013,36 +4014,36 @@ get_elf_section_flags (bfd_vma sh_flags)
{ {
switch (flag) switch (flag)
{ {
case SHF_WRITE: index = 0; break; case SHF_WRITE: sindex = 0; break;
case SHF_ALLOC: index = 1; break; case SHF_ALLOC: sindex = 1; break;
case SHF_EXECINSTR: index = 2; break; case SHF_EXECINSTR: sindex = 2; break;
case SHF_MERGE: index = 3; break; case SHF_MERGE: sindex = 3; break;
case SHF_STRINGS: index = 4; break; case SHF_STRINGS: sindex = 4; break;
case SHF_INFO_LINK: index = 5; break; case SHF_INFO_LINK: sindex = 5; break;
case SHF_LINK_ORDER: index = 6; break; case SHF_LINK_ORDER: sindex = 6; break;
case SHF_OS_NONCONFORMING: index = 7; break; case SHF_OS_NONCONFORMING: sindex = 7; break;
case SHF_GROUP: index = 8; break; case SHF_GROUP: sindex = 8; break;
case SHF_TLS: index = 9; break; case SHF_TLS: sindex = 9; break;
default: default:
index = -1; sindex = -1;
switch (elf_header.e_machine) switch (elf_header.e_machine)
{ {
case EM_IA_64: case EM_IA_64:
if (flag == SHF_IA_64_SHORT) if (flag == SHF_IA_64_SHORT)
index = 10; sindex = 10;
else if (flag == SHF_IA_64_NORECOV) else if (flag == SHF_IA_64_NORECOV)
index = 11; sindex = 11;
#ifdef BFD64 #ifdef BFD64
else if (elf_header.e_ident[EI_OSABI] == ELFOSABI_OPENVMS) else if (elf_header.e_ident[EI_OSABI] == ELFOSABI_OPENVMS)
switch (flag) switch (flag)
{ {
case SHF_IA_64_VMS_GLOBAL: index = 12; break; case SHF_IA_64_VMS_GLOBAL: sindex = 12; break;
case SHF_IA_64_VMS_OVERLAID: index = 13; break; case SHF_IA_64_VMS_OVERLAID: sindex = 13; break;
case SHF_IA_64_VMS_SHARED: index = 14; break; case SHF_IA_64_VMS_SHARED: sindex = 14; break;
case SHF_IA_64_VMS_VECTOR: index = 15; break; case SHF_IA_64_VMS_VECTOR: sindex = 15; break;
case SHF_IA_64_VMS_ALLOC_64BIT: index = 16; break; case SHF_IA_64_VMS_ALLOC_64BIT: sindex = 16; break;
case SHF_IA_64_VMS_PROTECTED: index = 17; break; case SHF_IA_64_VMS_PROTECTED: sindex = 17; break;
default: break; default: break;
} }
#endif #endif
@ -4056,16 +4057,16 @@ get_elf_section_flags (bfd_vma sh_flags)
case EM_SPARCV9: case EM_SPARCV9:
case EM_SPARC: case EM_SPARC:
if (flag == SHF_EXCLUDE) if (flag == SHF_EXCLUDE)
index = 18; sindex = 18;
else if (flag == SHF_ORDERED) else if (flag == SHF_ORDERED)
index = 19; sindex = 19;
break; break;
default: default:
break; break;
} }
} }
if (index != -1) if (sindex != -1)
{ {
if (p != buff + field_size + 4) if (p != buff + field_size + 4)
{ {
@ -4076,8 +4077,8 @@ get_elf_section_flags (bfd_vma sh_flags)
*p++ = ' '; *p++ = ' ';
} }
size -= flags [index].len; size -= flags [sindex].len;
p = stpcpy (p, flags [index].str); p = stpcpy (p, flags [sindex].str);
} }
else if (flag & SHF_MASKOS) else if (flag & SHF_MASKOS)
os_flags |= flag; os_flags |= flag;
@ -5804,8 +5805,8 @@ dynamic_section_mips_val (Elf_Internal_Dyn * entry)
char timebuf[20]; char timebuf[20];
struct tm * tmp; struct tm * tmp;
time_t time = entry->d_un.d_val; time_t atime = entry->d_un.d_val;
tmp = gmtime (&time); tmp = gmtime (&atime);
snprintf (timebuf, sizeof (timebuf), "%04u-%02u-%02uT%02u:%02u:%02u", snprintf (timebuf, sizeof (timebuf), "%04u-%02u-%02uT%02u:%02u:%02u",
tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
tmp->tm_hour, tmp->tm_min, tmp->tm_sec); tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
@ -6559,9 +6560,9 @@ process_dynamic_section (FILE * file)
if (do_dynamic) if (do_dynamic)
{ {
struct tm * tmp; struct tm * tmp;
time_t time = entry->d_un.d_val; time_t atime = entry->d_un.d_val;
tmp = gmtime (&time); tmp = gmtime (&atime);
printf ("%04u-%02u-%02uT%02u:%02u:%02u\n", printf ("%04u-%02u-%02uT%02u:%02u:%02u\n",
tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
tmp->tm_hour, tmp->tm_min, tmp->tm_sec); tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
@ -7722,9 +7723,9 @@ process_symbol_table (FILE * file)
Elf_Internal_Verdef ivd; Elf_Internal_Verdef ivd;
Elf_Internal_Verdaux ivda; Elf_Internal_Verdaux ivda;
Elf_External_Verdaux evda; Elf_External_Verdaux evda;
unsigned long offset; unsigned long off;
offset = offset_from_vma off = offset_from_vma
(file, (file,
version_info[DT_VERSIONTAGIDX (DT_VERDEF)], version_info[DT_VERSIONTAGIDX (DT_VERDEF)],
sizeof (Elf_External_Verdef)); sizeof (Elf_External_Verdef));
@ -7733,22 +7734,22 @@ process_symbol_table (FILE * file)
{ {
Elf_External_Verdef evd; Elf_External_Verdef evd;
get_data (&evd, file, offset, sizeof (evd), get_data (&evd, file, off, sizeof (evd),
1, _("version def")); 1, _("version def"));
ivd.vd_ndx = BYTE_GET (evd.vd_ndx); ivd.vd_ndx = BYTE_GET (evd.vd_ndx);
ivd.vd_aux = BYTE_GET (evd.vd_aux); ivd.vd_aux = BYTE_GET (evd.vd_aux);
ivd.vd_next = BYTE_GET (evd.vd_next); ivd.vd_next = BYTE_GET (evd.vd_next);
offset += ivd.vd_next; off += ivd.vd_next;
} }
while (ivd.vd_ndx != (vers_data & VERSYM_VERSION) while (ivd.vd_ndx != (vers_data & VERSYM_VERSION)
&& ivd.vd_next != 0); && ivd.vd_next != 0);
offset -= ivd.vd_next; off -= ivd.vd_next;
offset += ivd.vd_aux; off += ivd.vd_aux;
get_data (&evda, file, offset, sizeof (evda), get_data (&evda, file, off, sizeof (evda),
1, _("version def aux")); 1, _("version def aux"));
ivda.vda_name = BYTE_GET (evda.vda_name); ivda.vda_name = BYTE_GET (evda.vda_name);
@ -8445,7 +8446,7 @@ apply_relocations (void * file,
bfd_vma addend; bfd_vma addend;
unsigned int reloc_type; unsigned int reloc_type;
unsigned int reloc_size; unsigned int reloc_size;
unsigned char * loc; unsigned char * rloc;
reloc_type = get_reloc_type (rp->r_info); reloc_type = get_reloc_type (rp->r_info);
@ -8470,8 +8471,8 @@ apply_relocations (void * file,
continue; continue;
} }
loc = start + rp->r_offset; rloc = start + rp->r_offset;
if ((loc + reloc_size) > end) if ((rloc + reloc_size) > end)
{ {
warn (_("skipping invalid relocation offset 0x%lx in section %s\n"), warn (_("skipping invalid relocation offset 0x%lx in section %s\n"),
(unsigned long) rp->r_offset, (unsigned long) rp->r_offset,
@ -8514,7 +8515,7 @@ apply_relocations (void * file,
|| ((elf_header.e_machine == EM_PJ || ((elf_header.e_machine == EM_PJ
|| elf_header.e_machine == EM_PJ_OLD) || elf_header.e_machine == EM_PJ_OLD)
&& reloc_type == 1)) && reloc_type == 1))
addend += byte_get (loc, reloc_size); addend += byte_get (rloc, reloc_size);
if (is_32bit_pcrel_reloc (reloc_type) if (is_32bit_pcrel_reloc (reloc_type)
|| is_64bit_pcrel_reloc (reloc_type)) || is_64bit_pcrel_reloc (reloc_type))
@ -8522,11 +8523,11 @@ apply_relocations (void * file,
/* On HPPA, all pc-relative relocations are biased by 8. */ /* On HPPA, all pc-relative relocations are biased by 8. */
if (elf_header.e_machine == EM_PARISC) if (elf_header.e_machine == EM_PARISC)
addend -= 8; addend -= 8;
byte_put (loc, (addend + sym->st_value) - rp->r_offset, byte_put (rloc, (addend + sym->st_value) - rp->r_offset,
reloc_size); reloc_size);
} }
else else
byte_put (loc, addend + sym->st_value, reloc_size); byte_put (rloc, addend + sym->st_value, reloc_size);
} }
free (symtab); free (symtab);
@ -9585,10 +9586,10 @@ process_attributes (FILE * file,
do_numlist: do_numlist:
for (;;) for (;;)
{ {
unsigned int i; unsigned int j;
val = read_uleb128 (p, &i); val = read_uleb128 (p, &j);
p += i; p += j;
if (val == 0) if (val == 0)
break; break;
printf (" %d", val); printf (" %d", val);
@ -9787,17 +9788,17 @@ process_mips_specific (FILE * file)
for (cnt = 0; cnt < liblistno; ++cnt) for (cnt = 0; cnt < liblistno; ++cnt)
{ {
Elf32_Lib liblist; Elf32_Lib liblist;
time_t time; time_t atime;
char timebuf[20]; char timebuf[20];
struct tm * tmp; struct tm * tmp;
liblist.l_name = BYTE_GET (elib[cnt].l_name); liblist.l_name = BYTE_GET (elib[cnt].l_name);
time = BYTE_GET (elib[cnt].l_time_stamp); atime = BYTE_GET (elib[cnt].l_time_stamp);
liblist.l_checksum = BYTE_GET (elib[cnt].l_checksum); liblist.l_checksum = BYTE_GET (elib[cnt].l_checksum);
liblist.l_version = BYTE_GET (elib[cnt].l_version); liblist.l_version = BYTE_GET (elib[cnt].l_version);
liblist.l_flags = BYTE_GET (elib[cnt].l_flags); liblist.l_flags = BYTE_GET (elib[cnt].l_flags);
tmp = gmtime (&time); tmp = gmtime (&atime);
snprintf (timebuf, sizeof (timebuf), snprintf (timebuf, sizeof (timebuf),
"%04u-%02u-%02uT%02u:%02u:%02u", "%04u-%02u-%02uT%02u:%02u:%02u",
tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
@ -10120,12 +10121,12 @@ process_mips_specific (FILE * file)
if (pltgot != 0 && local_gotno != 0) if (pltgot != 0 && local_gotno != 0)
{ {
bfd_vma entry, local_end, global_end; bfd_vma ent, local_end, global_end;
size_t i, offset; size_t i, offset;
unsigned char * data; unsigned char * data;
int addr_size; int addr_size;
entry = pltgot; ent = pltgot;
addr_size = (is_32bit_elf ? 4 : 8); addr_size = (is_32bit_elf ? 4 : 8);
local_end = pltgot + local_gotno * addr_size; local_end = pltgot + local_gotno * addr_size;
global_end = local_end + (symtabno - gotsym) * addr_size; global_end = local_end + (symtabno - gotsym) * addr_size;
@ -10142,26 +10143,26 @@ process_mips_specific (FILE * file)
printf (_(" %*s %10s %*s Purpose\n"), printf (_(" %*s %10s %*s Purpose\n"),
addr_size * 2, "Address", "Access", addr_size * 2, "Address", "Access",
addr_size * 2, "Initial"); addr_size * 2, "Initial");
entry = print_mips_got_entry (data, pltgot, entry); ent = print_mips_got_entry (data, pltgot, ent);
printf (" Lazy resolver\n"); printf (" Lazy resolver\n");
if (data if (data
&& (byte_get (data + entry - pltgot, addr_size) && (byte_get (data + ent - pltgot, addr_size)
>> (addr_size * 8 - 1)) != 0) >> (addr_size * 8 - 1)) != 0)
{ {
entry = print_mips_got_entry (data, pltgot, entry); ent = print_mips_got_entry (data, pltgot, ent);
printf (" Module pointer (GNU extension)\n"); printf (" Module pointer (GNU extension)\n");
} }
printf ("\n"); printf ("\n");
if (entry < local_end) if (ent < local_end)
{ {
printf (_(" Local entries:\n")); printf (_(" Local entries:\n"));
printf (_(" %*s %10s %*s\n"), printf (_(" %*s %10s %*s\n"),
addr_size * 2, "Address", "Access", addr_size * 2, "Address", "Access",
addr_size * 2, "Initial"); addr_size * 2, "Initial");
while (entry < local_end) while (ent < local_end)
{ {
entry = print_mips_got_entry (data, pltgot, entry); ent = print_mips_got_entry (data, pltgot, ent);
printf ("\n"); printf ("\n");
} }
printf ("\n"); printf ("\n");
@ -10182,7 +10183,7 @@ process_mips_specific (FILE * file)
Elf_Internal_Sym * psym; Elf_Internal_Sym * psym;
psym = dynamic_symbols + i; psym = dynamic_symbols + i;
entry = print_mips_got_entry (data, pltgot, entry); ent = print_mips_got_entry (data, pltgot, ent);
printf (" "); printf (" ");
print_vma (psym->st_value, LONG_HEX); print_vma (psym->st_value, LONG_HEX);
printf (" %-7s %3s ", printf (" %-7s %3s ",
@ -10203,7 +10204,7 @@ process_mips_specific (FILE * file)
if (mips_pltgot != 0 && jmprel != 0 && pltrel != 0 && pltrelsz != 0) if (mips_pltgot != 0 && jmprel != 0 && pltrel != 0 && pltrelsz != 0)
{ {
bfd_vma entry, end; bfd_vma ent, end;
size_t offset, rel_offset; size_t offset, rel_offset;
unsigned long count, i; unsigned long count, i;
unsigned char * data; unsigned char * data;
@ -10222,7 +10223,7 @@ process_mips_specific (FILE * file)
return 0; return 0;
} }
entry = mips_pltgot; ent = mips_pltgot;
addr_size = (is_32bit_elf ? 4 : 8); addr_size = (is_32bit_elf ? 4 : 8);
end = mips_pltgot + (2 + count) * addr_size; end = mips_pltgot + (2 + count) * addr_size;
@ -10233,9 +10234,9 @@ process_mips_specific (FILE * file)
printf (_(" Reserved entries:\n")); printf (_(" Reserved entries:\n"));
printf (_(" %*s %*s Purpose\n"), printf (_(" %*s %*s Purpose\n"),
addr_size * 2, "Address", addr_size * 2, "Initial"); addr_size * 2, "Address", addr_size * 2, "Initial");
entry = print_mips_pltgot_entry (data, mips_pltgot, entry); ent = print_mips_pltgot_entry (data, mips_pltgot, ent);
printf (" PLT lazy resolver\n"); printf (" PLT lazy resolver\n");
entry = print_mips_pltgot_entry (data, mips_pltgot, entry); ent = print_mips_pltgot_entry (data, mips_pltgot, ent);
printf (" Module pointer\n"); printf (" Module pointer\n");
printf ("\n"); printf ("\n");
@ -10250,7 +10251,7 @@ process_mips_specific (FILE * file)
Elf_Internal_Sym * psym; Elf_Internal_Sym * psym;
psym = dynamic_symbols + get_reloc_symindex (rels[i].r_info); psym = dynamic_symbols + get_reloc_symindex (rels[i].r_info);
entry = print_mips_pltgot_entry (data, mips_pltgot, entry); ent = print_mips_pltgot_entry (data, mips_pltgot, ent);
printf (" "); printf (" ");
print_vma (psym->st_value, LONG_HEX); print_vma (psym->st_value, LONG_HEX);
printf (" %-7s %3s ", printf (" %-7s %3s ",
@ -10326,17 +10327,17 @@ process_gnu_liblist (FILE * file)
++cnt) ++cnt)
{ {
Elf32_Lib liblist; Elf32_Lib liblist;
time_t time; time_t atime;
char timebuf[20]; char timebuf[20];
struct tm * tmp; struct tm * tmp;
liblist.l_name = BYTE_GET (elib[cnt].l_name); liblist.l_name = BYTE_GET (elib[cnt].l_name);
time = BYTE_GET (elib[cnt].l_time_stamp); atime = BYTE_GET (elib[cnt].l_time_stamp);
liblist.l_checksum = BYTE_GET (elib[cnt].l_checksum); liblist.l_checksum = BYTE_GET (elib[cnt].l_checksum);
liblist.l_version = BYTE_GET (elib[cnt].l_version); liblist.l_version = BYTE_GET (elib[cnt].l_version);
liblist.l_flags = BYTE_GET (elib[cnt].l_flags); liblist.l_flags = BYTE_GET (elib[cnt].l_flags);
tmp = gmtime (&time); tmp = gmtime (&atime);
snprintf (timebuf, sizeof (timebuf), snprintf (timebuf, sizeof (timebuf),
"%04u-%02u-%02uT%02u:%02u:%02u", "%04u-%02u-%02uT%02u:%02u:%02u",
tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,

View File

@ -1,5 +1,5 @@
/* resbin.c -- manipulate the Windows binary resource format. /* resbin.c -- manipulate the Windows binary resource format.
Copyright 1997, 1998, 1999, 2002, 2003, 2005, 2006, 2007 Copyright 1997, 1998, 1999, 2002, 2003, 2005, 2006, 2007, 2009
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support. Written by Ian Lance Taylor, Cygnus Support.
Rewritten by Kai Tietz, Onevision. Rewritten by Kai Tietz, Onevision.
@ -227,7 +227,7 @@ bin_to_res_menu (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length)
{ {
rc_res_resource *r; rc_res_resource *r;
rc_menu *m; rc_menu *m;
rc_uint_type version, read; rc_uint_type version, got;
r = (rc_res_resource *) res_alloc (sizeof *r); r = (rc_res_resource *) res_alloc (sizeof *r);
r->type = RES_TYPE_MENU; r->type = RES_TYPE_MENU;
@ -245,7 +245,7 @@ bin_to_res_menu (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length)
if (length < 4) if (length < 4)
toosmall (_("menu header")); toosmall (_("menu header"));
m->help = 0; m->help = 0;
m->items = bin_to_res_menuitems (wrbfd, data + 4, length - 4, &read); m->items = bin_to_res_menuitems (wrbfd, data + 4, length - 4, &got);
} }
else if (version == 1) else if (version == 1)
{ {
@ -258,7 +258,7 @@ bin_to_res_menu (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length)
if (offset + 4 >= length) if (offset + 4 >= length)
toosmall (_("menuex offset")); toosmall (_("menuex offset"));
m->items = bin_to_res_menuexitems (wrbfd, data + 4 + offset, m->items = bin_to_res_menuexitems (wrbfd, data + 4 + offset,
length - (4 + offset), &read); length - (4 + offset), &got);
} }
else else
fatal (_("unsupported menu version %d"), (int) version); fatal (_("unsupported menu version %d"), (int) version);
@ -270,14 +270,14 @@ bin_to_res_menu (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length)
static rc_menuitem * static rc_menuitem *
bin_to_res_menuitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length, bin_to_res_menuitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length,
rc_uint_type *read) rc_uint_type *got)
{ {
rc_menuitem *first, **pp; rc_menuitem *first, **pp;
first = NULL; first = NULL;
pp = &first; pp = &first;
*read = 0; *got = 0;
while (length > 0) while (length > 0)
{ {
@ -334,7 +334,7 @@ bin_to_res_menuitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type len
data += itemlen; data += itemlen;
length -= itemlen; length -= itemlen;
*read += itemlen; *got += itemlen;
if ((flags & MENUITEM_ENDMENU) != 0) if ((flags & MENUITEM_ENDMENU) != 0)
return first; return first;
@ -347,14 +347,14 @@ bin_to_res_menuitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type len
static rc_menuitem * static rc_menuitem *
bin_to_res_menuexitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length, bin_to_res_menuexitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length,
rc_uint_type *read) rc_uint_type *got)
{ {
rc_menuitem *first, **pp; rc_menuitem *first, **pp;
first = NULL; first = NULL;
pp = &first; pp = &first;
*read = 0; *got = 0;
while (length > 0) while (length > 0)
{ {
@ -408,7 +408,7 @@ bin_to_res_menuexitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type l
data += itemlen; data += itemlen;
length -= itemlen; length -= itemlen;
*read += itemlen; *got += itemlen;
if ((flags & 0x80) != 0) if ((flags & 0x80) != 0)
return first; return first;

View File

@ -1926,7 +1926,7 @@ indent (FILE *e, int c)
without the need to store it somewhere externally. */ without the need to store it somewhere externally. */
void void
write_rc_file (const char *filename, const rc_res_directory *resources) write_rc_file (const char *filename, const rc_res_directory *res_dir)
{ {
FILE *e; FILE *e;
rc_uint_type language; rc_uint_type language;
@ -1941,7 +1941,7 @@ write_rc_file (const char *filename, const rc_res_directory *resources)
} }
language = (rc_uint_type) ((bfd_signed_vma) -1); language = (rc_uint_type) ((bfd_signed_vma) -1);
write_rc_directory (e, resources, (const rc_res_id *) NULL, write_rc_directory (e, res_dir, (const rc_res_id *) NULL,
(const rc_res_id *) NULL, &language, 1); (const rc_res_id *) NULL, &language, 1);
} }

View File

@ -647,7 +647,7 @@ res_add_resource (rc_res_resource *r, const rc_res_id *type, const rc_res_id *id
and modified to add an existing resource. and modified to add an existing resource.
*/ */
static void static void
res_append_resource (rc_res_directory **resources, rc_res_resource *resource, res_append_resource (rc_res_directory **res_dirs, rc_res_resource *resource,
int cids, const rc_res_id *ids, int dupok) int cids, const rc_res_id *ids, int dupok)
{ {
rc_res_entry *re = NULL; rc_res_entry *re = NULL;
@ -658,7 +658,7 @@ res_append_resource (rc_res_directory **resources, rc_res_resource *resource,
{ {
rc_res_entry **pp; rc_res_entry **pp;
if (*resources == NULL) if (*res_dirs == NULL)
{ {
static unsigned long timeval; static unsigned long timeval;
@ -667,16 +667,16 @@ res_append_resource (rc_res_directory **resources, rc_res_resource *resource,
if (timeval == 0) if (timeval == 0)
timeval = time (NULL); timeval = time (NULL);
*resources = ((rc_res_directory *) *res_dirs = ((rc_res_directory *)
res_alloc (sizeof (rc_res_directory))); res_alloc (sizeof (rc_res_directory)));
(*resources)->characteristics = 0; (*res_dirs)->characteristics = 0;
(*resources)->time = timeval; (*res_dirs)->time = timeval;
(*resources)->major = 0; (*res_dirs)->major = 0;
(*resources)->minor = 0; (*res_dirs)->minor = 0;
(*resources)->entries = NULL; (*res_dirs)->entries = NULL;
} }
for (pp = &(*resources)->entries; *pp != NULL; pp = &(*pp)->next) for (pp = &(*res_dirs)->entries; *pp != NULL; pp = &(*pp)->next)
if (res_id_cmp ((*pp)->id, ids[i]) == 0) if (res_id_cmp ((*pp)->id, ids[i]) == 0)
break; break;
@ -711,7 +711,7 @@ res_append_resource (rc_res_directory **resources, rc_res_resource *resource,
xexit (1); xexit (1);
} }
resources = &re->u.dir; res_dirs = &re->u.dir;
} }
} }

View File

@ -1,6 +1,6 @@
/* srconv.c -- Sysroff conversion program /* srconv.c -- Sysroff conversion program
Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2007, 2008 Free Software Foundation, Inc. 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Binutils. This file is part of GNU Binutils.
@ -158,17 +158,17 @@ strip_suffix (const char *name)
/* IT LEN stuff CS */ /* IT LEN stuff CS */
static void static void
checksum (FILE *file, unsigned char *ptr, int size, int code) checksum (FILE *ffile, unsigned char *ptr, int size, int ccode)
{ {
int j; int j;
int last; int last;
int sum = 0; int sum = 0;
int bytes = size / 8; int bytes = size / 8;
last = !(code & 0xff00); last = !(ccode & 0xff00);
if (size & 0x7) if (size & 0x7)
abort (); abort ();
ptr[0] = code | (last ? 0x80 : 0); ptr[0] = ccode | (last ? 0x80 : 0);
ptr[1] = bytes + 1; ptr[1] = bytes + 1;
for (j = 0; j < bytes; j++) for (j = 0; j < bytes; j++)
@ -176,14 +176,14 @@ checksum (FILE *file, unsigned char *ptr, int size, int code)
/* Glue on a checksum too. */ /* Glue on a checksum too. */
ptr[bytes] = ~sum; ptr[bytes] = ~sum;
if (fwrite (ptr, bytes + 1, 1, file) != 1) if (fwrite (ptr, bytes + 1, 1, ffile) != 1)
/* FIXME: Return error status. */ /* FIXME: Return error status. */
abort (); abort ();
} }
static void static void
writeINT (int n, unsigned char *ptr, int *idx, int size, FILE *file) writeINT (int n, unsigned char *ptr, int *idx, int size, FILE *ffile)
{ {
int byte = *idx / 8; int byte = *idx / 8;
@ -195,7 +195,7 @@ writeINT (int n, unsigned char *ptr, int *idx, int size, FILE *file)
if (byte > 240) if (byte > 240)
{ {
/* Lets write out that record and do another one. */ /* Lets write out that record and do another one. */
checksum (file, ptr, *idx, code | 0x1000); checksum (ffile, ptr, *idx, code | 0x1000);
*idx = 16; *idx = 16;
byte = *idx / 8; byte = *idx / 8;
} }
@ -242,24 +242,24 @@ writeBITS (int val, unsigned char *ptr, int *idx, int size)
static void static void
writeBARRAY (barray data, unsigned char *ptr, int *idx, writeBARRAY (barray data, unsigned char *ptr, int *idx,
int size ATTRIBUTE_UNUSED, FILE *file) int size ATTRIBUTE_UNUSED, FILE *ffile)
{ {
int i; int i;
writeINT (data.len, ptr, idx, 1, file); writeINT (data.len, ptr, idx, 1, ffile);
for (i = 0; i < data.len; i++) for (i = 0; i < data.len; i++)
writeINT (data.data[i], ptr, idx, 1, file); writeINT (data.data[i], ptr, idx, 1, ffile);
} }
static void static void
writeCHARS (char *string, unsigned char *ptr, int *idx, int size, FILE *file) writeCHARS (char *string, unsigned char *ptr, int *idx, int size, FILE *ffile)
{ {
int i = *idx / 8; int i = *idx / 8;
if (i > 240) if (i > 240)
{ {
/* Lets write out that record and do another one. */ /* Lets write out that record and do another one. */
checksum (file, ptr, *idx, code | 0x1000); checksum (ffile, ptr, *idx, code | 0x1000);
*idx = 16; *idx = 16;
i = *idx / 8; i = *idx / 8;
} }
@ -1697,21 +1697,22 @@ align (int x)
ordinary defs - dunno why, but thats what hitachi does with 'em. */ ordinary defs - dunno why, but thats what hitachi does with 'em. */
static void static void
prescan (struct coff_ofile *tree) prescan (struct coff_ofile *otree)
{ {
struct coff_symbol *s; struct coff_symbol *s;
struct coff_section *common_section; struct coff_section *common_section;
/* Find the common section - always section 3. */ /* Find the common section - always section 3. */
common_section = tree->sections + 3; common_section = otree->sections + 3;
for (s = tree->symbol_list_head; for (s = otree->symbol_list_head;
s; s;
s = s->next_in_ofile_list) s = s->next_in_ofile_list)
{ {
if (s->visible->type == coff_vis_common) if (s->visible->type == coff_vis_common)
{ {
struct coff_where *w = s->where; struct coff_where *w = s->where;
/* s->visible->type = coff_vis_ext_def; leave it as common */ /* s->visible->type = coff_vis_ext_def; leave it as common */
common_section->size = align (common_section->size); common_section->size = align (common_section->size);
w->offset = common_section->size + common_section->address; w->offset = common_section->size + common_section->address;
@ -1725,11 +1726,11 @@ prescan (struct coff_ofile *tree)
char *program_name; char *program_name;
static void static void
show_usage (FILE *file, int status) show_usage (FILE *ffile, int status)
{ {
fprintf (file, _("Usage: %s [option(s)] in-file [out-file]\n"), program_name); fprintf (ffile, _("Usage: %s [option(s)] in-file [out-file]\n"), program_name);
fprintf (file, _("Convert a COFF object file into a SYSROFF object file\n")); fprintf (ffile, _("Convert a COFF object file into a SYSROFF object file\n"));
fprintf (file, _(" The options are:\n\ fprintf (ffile, _(" The options are:\n\
-q --quick (Obsolete - ignored)\n\ -q --quick (Obsolete - ignored)\n\
-n --noprescan Do not perform a scan to convert commons into defs\n\ -n --noprescan Do not perform a scan to convert commons into defs\n\
-d --debug Display information about what is being done\n\ -d --debug Display information about what is being done\n\
@ -1738,7 +1739,7 @@ show_usage (FILE *file, int status)
-v --version Print the program's version number\n")); -v --version Print the program's version number\n"));
if (REPORT_BUGS_TO[0] && status == 0) if (REPORT_BUGS_TO[0] && status == 0)
fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO); fprintf (ffile, _("Report bugs to %s\n"), REPORT_BUGS_TO);
exit (status); exit (status);
} }

View File

@ -3277,26 +3277,26 @@ static debug_type *
stab_find_slot (struct stab_handle *info, const int *typenums) stab_find_slot (struct stab_handle *info, const int *typenums)
{ {
int filenum; int filenum;
int index; int tindex;
struct stab_types **ps; struct stab_types **ps;
filenum = typenums[0]; filenum = typenums[0];
index = typenums[1]; tindex = typenums[1];
if (filenum < 0 || (unsigned int) filenum >= info->files) if (filenum < 0 || (unsigned int) filenum >= info->files)
{ {
fprintf (stderr, _("Type file number %d out of range\n"), filenum); fprintf (stderr, _("Type file number %d out of range\n"), filenum);
return NULL; return NULL;
} }
if (index < 0) if (tindex < 0)
{ {
fprintf (stderr, _("Type index number %d out of range\n"), index); fprintf (stderr, _("Type index number %d out of range\n"), tindex);
return NULL; return NULL;
} }
ps = info->file_types + filenum; ps = info->file_types + filenum;
while (index >= STAB_TYPES_SLOTS) while (tindex >= STAB_TYPES_SLOTS)
{ {
if (*ps == NULL) if (*ps == NULL)
{ {
@ -3304,7 +3304,7 @@ stab_find_slot (struct stab_handle *info, const int *typenums)
memset (*ps, 0, sizeof **ps); memset (*ps, 0, sizeof **ps);
} }
ps = &(*ps)->next; ps = &(*ps)->next;
index -= STAB_TYPES_SLOTS; tindex -= STAB_TYPES_SLOTS;
} }
if (*ps == NULL) if (*ps == NULL)
{ {
@ -3312,7 +3312,7 @@ stab_find_slot (struct stab_handle *info, const int *typenums)
memset (*ps, 0, sizeof **ps); memset (*ps, 0, sizeof **ps);
} }
return (*ps)->types + index; return (*ps)->types + tindex;
} }
/* Find a type given a type number. If the type has not been /* Find a type given a type number. If the type has not been

View File

@ -211,9 +211,9 @@ getBITS (unsigned char *ptr, int *idx, int size, int max)
} }
static void static void
itheader (char *name, int code) itheader (char *name, int icode)
{ {
printf ("\n%s 0x%02x\n", name, code); printf ("\n%s 0x%02x\n", name, icode);
} }
static int indent; static int indent;
@ -641,16 +641,16 @@ module (void)
char *program_name; char *program_name;
static void static void
show_usage (FILE *file, int status) show_usage (FILE *ffile, int status)
{ {
fprintf (file, _("Usage: %s [option(s)] in-file\n"), program_name); fprintf (ffile, _("Usage: %s [option(s)] in-file\n"), program_name);
fprintf (file, _("Print a human readable interpretation of a SYSROFF object file\n")); fprintf (ffile, _("Print a human readable interpretation of a SYSROFF object file\n"));
fprintf (file, _(" The options are:\n\ fprintf (ffile, _(" The options are:\n\
-h --help Display this information\n\ -h --help Display this information\n\
-v --version Print the program's version number\n")); -v --version Print the program's version number\n"));
if (REPORT_BUGS_TO[0] && status == 0) if (REPORT_BUGS_TO[0] && status == 0)
fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO); fprintf (ffile, _("Report bugs to %s\n"), REPORT_BUGS_TO);
exit (status); exit (status);
} }
@ -658,7 +658,7 @@ int
main (int ac, char **av) main (int ac, char **av)
{ {
char *input_file = NULL; char *input_file = NULL;
int opt; int option;
static struct option long_options[] = static struct option long_options[] =
{ {
{"help", no_argument, 0, 'h'}, {"help", no_argument, 0, 'h'},
@ -680,9 +680,9 @@ main (int ac, char **av)
expandargv (&ac, &av); expandargv (&ac, &av);
while ((opt = getopt_long (ac, av, "HhVv", long_options, (int *) NULL)) != EOF) while ((option = getopt_long (ac, av, "HhVv", long_options, (int *) NULL)) != EOF)
{ {
switch (opt) switch (option)
{ {
case 'H': case 'H':
case 'h': case 'h':

View File

@ -1,4 +1,4 @@
/* Copyright 2001, 2003, 2005, 2007 Free Software Foundation, Inc. /* Copyright 2001, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com). Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
This file is part of GNU binutils. This file is part of GNU binutils.
@ -102,45 +102,39 @@ it:
case 'd': case 'd':
printf("\n\n\n#define IT_%s_CODE 0x%x\n", it,code); printf("\n\n\n#define IT_%s_CODE 0x%x\n", it,code);
printf("struct IT_%s;\n", it); printf("struct IT_%s;\n", it);
printf("extern void sysroff_swap_%s_in PARAMS ((struct IT_%s *));\n", printf("extern void sysroff_swap_%s_in (struct IT_%s *);\n",
$2, it); $2, it);
printf("extern void sysroff_swap_%s_out PARAMS ((FILE *, struct IT_%s *));\n", printf("extern void sysroff_swap_%s_out (FILE *, struct IT_%s *);\n",
$2, it); $2, it);
printf("extern void sysroff_print_%s_out PARAMS ((struct IT_%s *));\n", printf("extern void sysroff_print_%s_out (struct IT_%s *);\n",
$2, it); $2, it);
printf("struct IT_%s { \n", it); printf("struct IT_%s { \n", it);
break; break;
case 'i': case 'i':
printf("void sysroff_swap_%s_in(ptr)\n",$2); printf("void sysroff_swap_%s_in (struct IT_%s * ptr)\n",$2,it);
printf("struct IT_%s *ptr;\n", it);
printf("{\n");
printf("unsigned char raw[255];\n");
printf("\tint idx = 0 ;\n");
printf("\tint size;\n");
printf("memset(raw,0,255);\n");
printf("memset(ptr,0,sizeof(*ptr));\n");
printf("size = fillup(raw);\n");
break;
case 'g':
printf("void sysroff_swap_%s_out(file,ptr)\n",$2);
printf("FILE * file;\n");
printf("struct IT_%s *ptr;\n", it);
printf("{\n"); printf("{\n");
printf("\tunsigned char raw[255];\n"); printf("\tunsigned char raw[255];\n");
printf("\tint idx = 16 ;\n"); printf("\tint idx = 0;\n");
printf("\tint size;\n");
printf("\tmemset(raw,0,255);\n");
printf("\tmemset(ptr,0,sizeof(*ptr));\n");
printf("\tsize = fillup(raw);\n");
break;
case 'g':
printf("void sysroff_swap_%s_out (FILE * ffile, struct IT_%s * ptr)\n",$2,it);
printf("{\n");
printf("\tunsigned char raw[255];\n");
printf("\tint idx = 16;\n");
printf("\tmemset (raw, 0, 255);\n"); printf("\tmemset (raw, 0, 255);\n");
printf("\tcode = IT_%s_CODE;\n", it); printf("\tcode = IT_%s_CODE;\n", it);
break; break;
case 'o': case 'o':
printf("void sysroff_swap_%s_out(abfd,ptr)\n",$2); printf("void sysroff_swap_%s_out (bfd * abfd, struct IT_%s * ptr)\n",$2, it);
printf("bfd * abfd;\n");
printf("struct IT_%s *ptr;\n",it);
printf("{\n"); printf("{\n");
printf("int idx = 0 ;\n"); printf("\tint idx = 0;\n");
break; break;
case 'c': case 'c':
printf("void sysroff_print_%s_out(ptr)\n",$2); printf("void sysroff_print_%s_out (struct IT_%s *ptr)\n",$2,it);
printf("struct IT_%s *ptr;\n", it);
printf("{\n"); printf("{\n");
printf("itheader(\"%s\", IT_%s_CODE);\n",$2,$2); printf("itheader(\"%s\", IT_%s_CODE);\n",$2,$2);
break; break;
@ -158,7 +152,7 @@ it:
printf("};\n"); printf("};\n");
break; break;
case 'g': case 'g':
printf("\tchecksum(file,raw, idx, IT_%s_CODE);\n", it); printf("\tchecksum(ffile,raw, idx, IT_%s_CODE);\n", it);
case 'i': case 'i':
@ -274,7 +268,7 @@ char *ptr = pnames[rdepth];
} }
else { else {
printf("\twrite%s(ptr->%s%s,raw,&idx,%d,file);\n", printf("\twrite%s(ptr->%s%s,raw,&idx,%d,ffile);\n",
type, type,
id, id,
names[rdepth],size/8); names[rdepth],size/8);

View File

@ -394,13 +394,13 @@ stab_write_symbol (struct stab_write_handle *info, int type, int desc,
static bfd_boolean static bfd_boolean
stab_push_string (struct stab_write_handle *info, const char *string, stab_push_string (struct stab_write_handle *info, const char *string,
long index, bfd_boolean definition, unsigned int size) long tindex, bfd_boolean definition, unsigned int size)
{ {
struct stab_type_stack *s; struct stab_type_stack *s;
s = (struct stab_type_stack *) xmalloc (sizeof *s); s = (struct stab_type_stack *) xmalloc (sizeof *s);
s->string = xstrdup (string); s->string = xstrdup (string);
s->index = index; s->index = tindex;
s->definition = definition; s->definition = definition;
s->size = size; s->size = size;
@ -418,13 +418,13 @@ stab_push_string (struct stab_write_handle *info, const char *string,
/* Push a type index which has already been defined. */ /* Push a type index which has already been defined. */
static bfd_boolean static bfd_boolean
stab_push_defined_type (struct stab_write_handle *info, long index, stab_push_defined_type (struct stab_write_handle *info, long tindex,
unsigned int size) unsigned int size)
{ {
char buf[20]; char buf[20];
sprintf (buf, "%ld", index); sprintf (buf, "%ld", tindex);
return stab_push_string (info, buf, index, FALSE, size); return stab_push_string (info, buf, tindex, FALSE, size);
} }
/* Pop a type off the type stack. The caller is responsible for /* Pop a type off the type stack. The caller is responsible for
@ -586,15 +586,15 @@ stab_empty_type (void *p)
return stab_push_defined_type (info, info->type_cache.void_type, 0); return stab_push_defined_type (info, info->type_cache.void_type, 0);
else else
{ {
long index; long tindex;
char buf[40]; char buf[40];
index = info->type_index; tindex = info->type_index;
++info->type_index; ++info->type_index;
sprintf (buf, "%ld=%ld", index, index); sprintf (buf, "%ld=%ld", tindex, tindex);
return stab_push_string (info, buf, index, FALSE, 0); return stab_push_string (info, buf, tindex, FALSE, 0);
} }
} }
@ -609,17 +609,17 @@ stab_void_type (void *p)
return stab_push_defined_type (info, info->type_cache.void_type, 0); return stab_push_defined_type (info, info->type_cache.void_type, 0);
else else
{ {
long index; long tindex;
char buf[40]; char buf[40];
index = info->type_index; tindex = info->type_index;
++info->type_index; ++info->type_index;
info->type_cache.void_type = index; info->type_cache.void_type = tindex;
sprintf (buf, "%ld=%ld", index, index); sprintf (buf, "%ld=%ld", tindex, tindex);
return stab_push_string (info, buf, index, TRUE, 0); return stab_push_string (info, buf, tindex, TRUE, 0);
} }
} }
@ -646,15 +646,15 @@ stab_int_type (void *p, unsigned int size, bfd_boolean unsignedp)
return stab_push_defined_type (info, cache[size - 1], size); return stab_push_defined_type (info, cache[size - 1], size);
else else
{ {
long index; long tindex;
char buf[100]; char buf[100];
index = info->type_index; tindex = info->type_index;
++info->type_index; ++info->type_index;
cache[size - 1] = index; cache[size - 1] = tindex;
sprintf (buf, "%ld=r%ld;", index, index); sprintf (buf, "%ld=r%ld;", tindex, tindex);
if (unsignedp) if (unsignedp)
{ {
strcat (buf, "0;"); strcat (buf, "0;");
@ -679,7 +679,7 @@ stab_int_type (void *p, unsigned int size, bfd_boolean unsignedp)
abort (); abort ();
} }
return stab_push_string (info, buf, index, TRUE, size); return stab_push_string (info, buf, tindex, TRUE, size);
} }
} }
@ -699,7 +699,7 @@ stab_float_type (void *p, unsigned int size)
size); size);
else else
{ {
long index; long tindex;
char *int_type; char *int_type;
char buf[50]; char buf[50];
@ -708,19 +708,19 @@ stab_float_type (void *p, unsigned int size)
return FALSE; return FALSE;
int_type = stab_pop_type (info); int_type = stab_pop_type (info);
index = info->type_index; tindex = info->type_index;
++info->type_index; ++info->type_index;
if (size > 0 if (size > 0
&& size - 1 < (sizeof info->type_cache.float_types && size - 1 < (sizeof info->type_cache.float_types
/ sizeof info->type_cache.float_types[0])) / sizeof info->type_cache.float_types[0]))
info->type_cache.float_types[size - 1] = index; info->type_cache.float_types[size - 1] = tindex;
sprintf (buf, "%ld=r%s;%u;0;", index, int_type, size); sprintf (buf, "%ld=r%s;%u;0;", tindex, int_type, size);
free (int_type); free (int_type);
return stab_push_string (info, buf, index, TRUE, size); return stab_push_string (info, buf, tindex, TRUE, size);
} }
} }
@ -731,14 +731,14 @@ stab_complex_type (void *p, unsigned int size)
{ {
struct stab_write_handle *info = (struct stab_write_handle *) p; struct stab_write_handle *info = (struct stab_write_handle *) p;
char buf[50]; char buf[50];
long index; long tindex;
index = info->type_index; tindex = info->type_index;
++info->type_index; ++info->type_index;
sprintf (buf, "%ld=r%ld;%u;0;", index, index, size); sprintf (buf, "%ld=r%ld;%u;0;", tindex, tindex, size);
return stab_push_string (info, buf, index, TRUE, size * 2); return stab_push_string (info, buf, tindex, TRUE, size * 2);
} }
/* Push a bfd_boolean type. We use an XCOFF predefined type, since gdb /* Push a bfd_boolean type. We use an XCOFF predefined type, since gdb
@ -748,29 +748,29 @@ static bfd_boolean
stab_bool_type (void *p, unsigned int size) stab_bool_type (void *p, unsigned int size)
{ {
struct stab_write_handle *info = (struct stab_write_handle *) p; struct stab_write_handle *info = (struct stab_write_handle *) p;
long index; long tindex;
switch (size) switch (size)
{ {
case 1: case 1:
index = -21; tindex = -21;
break; break;
case 2: case 2:
index = -22; tindex = -22;
break; break;
default: default:
case 4: case 4:
index = -16; tindex = -16;
break; break;
case 8: case 8:
index = -33; tindex = -33;
break; break;
} }
return stab_push_defined_type (info, index, size); return stab_push_defined_type (info, tindex, size);
} }
/* Push an enum type. */ /* Push an enum type. */
@ -783,7 +783,7 @@ stab_enum_type (void *p, const char *tag, const char **names,
size_t len; size_t len;
const char **pn; const char **pn;
char *buf; char *buf;
long index = 0; long tindex = 0;
bfd_signed_vma *pv; bfd_signed_vma *pv;
if (names == NULL) if (names == NULL)
@ -811,9 +811,9 @@ stab_enum_type (void *p, const char *tag, const char **names,
strcpy (buf, "e"); strcpy (buf, "e");
else else
{ {
index = info->type_index; tindex = info->type_index;
++info->type_index; ++info->type_index;
sprintf (buf, "%s:T%ld=e", tag, index); sprintf (buf, "%s:T%ld=e", tag, tindex);
} }
for (pn = names, pv = vals; *pn != NULL; pn++, pv++) for (pn = names, pv = vals; *pn != NULL; pn++, pv++)
@ -830,7 +830,7 @@ stab_enum_type (void *p, const char *tag, const char **names,
{ {
/* FIXME: The size is just a guess. */ /* FIXME: The size is just a guess. */
if (! stab_write_symbol (info, N_LSYM, 0, 0, buf) if (! stab_write_symbol (info, N_LSYM, 0, 0, buf)
|| ! stab_push_defined_type (info, index, 4)) || ! stab_push_defined_type (info, tindex, 4))
return FALSE; return FALSE;
} }
@ -847,7 +847,7 @@ stab_modify_type (struct stab_write_handle *info, int mod,
unsigned int size, long **cache, size_t *cache_alloc) unsigned int size, long **cache, size_t *cache_alloc)
{ {
long targindex; long targindex;
long index; long tindex;
char *s, *buf; char *s, *buf;
assert (info->type_stack != NULL); assert (info->type_stack != NULL);
@ -887,8 +887,8 @@ stab_modify_type (struct stab_write_handle *info, int mod,
*cache_alloc = alloc; *cache_alloc = alloc;
} }
index = (*cache)[targindex]; tindex = (*cache)[targindex];
if (index != 0 && ! info->type_stack->definition) if (tindex != 0 && ! info->type_stack->definition)
{ {
/* We have already defined a modification of this type, and /* We have already defined a modification of this type, and
the entry on the type stack is not a definition, so we the entry on the type stack is not a definition, so we
@ -897,22 +897,22 @@ stab_modify_type (struct stab_write_handle *info, int mod,
is a struct which we did not define at the time it was is a struct which we did not define at the time it was
referenced). */ referenced). */
free (stab_pop_type (info)); free (stab_pop_type (info));
if (! stab_push_defined_type (info, index, size)) if (! stab_push_defined_type (info, tindex, size))
return FALSE; return FALSE;
} }
else else
{ {
index = info->type_index; tindex = info->type_index;
++info->type_index; ++info->type_index;
s = stab_pop_type (info); s = stab_pop_type (info);
buf = (char *) xmalloc (strlen (s) + 20); buf = (char *) xmalloc (strlen (s) + 20);
sprintf (buf, "%ld=%c%s", index, mod, s); sprintf (buf, "%ld=%c%s", tindex, mod, s);
free (s); free (s);
(*cache)[targindex] = index; (*cache)[targindex] = tindex;
if (! stab_push_string (info, buf, index, TRUE, size)) if (! stab_push_string (info, buf, tindex, TRUE, size))
return FALSE; return FALSE;
free (buf); free (buf);
@ -1019,7 +1019,7 @@ stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high,
bfd_boolean definition; bfd_boolean definition;
unsigned int element_size; unsigned int element_size;
char *range, *element, *buf; char *range, *element, *buf;
long index; long tindex;
unsigned int size; unsigned int size;
definition = info->type_stack->definition; definition = info->type_stack->definition;
@ -1033,17 +1033,17 @@ stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high,
if (! stringp) if (! stringp)
{ {
index = 0; tindex = 0;
*buf = '\0'; *buf = '\0';
} }
else else
{ {
/* We need to define a type in order to include the string /* We need to define a type in order to include the string
attribute. */ attribute. */
index = info->type_index; tindex = info->type_index;
++info->type_index; ++info->type_index;
definition = TRUE; definition = TRUE;
sprintf (buf, "%ld=@S;", index); sprintf (buf, "%ld=@S;", tindex);
} }
sprintf (buf + strlen (buf), "ar%s;%ld;%ld;%s", sprintf (buf + strlen (buf), "ar%s;%ld;%ld;%s",
@ -1055,7 +1055,7 @@ stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high,
size = 0; size = 0;
else else
size = element_size * ((high - low) + 1); size = element_size * ((high - low) + 1);
if (! stab_push_string (info, buf, index, definition, size)) if (! stab_push_string (info, buf, tindex, definition, size))
return FALSE; return FALSE;
free (buf); free (buf);
@ -1071,7 +1071,7 @@ stab_set_type (void *p, bfd_boolean bitstringp)
struct stab_write_handle *info = (struct stab_write_handle *) p; struct stab_write_handle *info = (struct stab_write_handle *) p;
bfd_boolean definition; bfd_boolean definition;
char *s, *buf; char *s, *buf;
long index; long tindex;
definition = info->type_stack->definition; definition = info->type_stack->definition;
@ -1081,22 +1081,22 @@ stab_set_type (void *p, bfd_boolean bitstringp)
if (! bitstringp) if (! bitstringp)
{ {
*buf = '\0'; *buf = '\0';
index = 0; tindex = 0;
} }
else else
{ {
/* We need to define a type in order to include the string /* We need to define a type in order to include the string
attribute. */ attribute. */
index = info->type_index; tindex = info->type_index;
++info->type_index; ++info->type_index;
definition = TRUE; definition = TRUE;
sprintf (buf, "%ld=@S;", index); sprintf (buf, "%ld=@S;", tindex);
} }
sprintf (buf + strlen (buf), "S%s", s); sprintf (buf + strlen (buf), "S%s", s);
free (s); free (s);
if (! stab_push_string (info, buf, index, definition, 0)) if (! stab_push_string (info, buf, tindex, definition, 0))
return FALSE; return FALSE;
free (buf); free (buf);
@ -1309,7 +1309,7 @@ stab_start_struct_type (void *p, const char *tag, unsigned int id,
bfd_boolean structp, unsigned int size) bfd_boolean structp, unsigned int size)
{ {
struct stab_write_handle *info = (struct stab_write_handle *) p; struct stab_write_handle *info = (struct stab_write_handle *) p;
long index; long tindex;
bfd_boolean definition; bfd_boolean definition;
char *buf; char *buf;
@ -1317,17 +1317,17 @@ stab_start_struct_type (void *p, const char *tag, unsigned int id,
if (id == 0) if (id == 0)
{ {
index = 0; tindex = 0;
*buf = '\0'; *buf = '\0';
definition = FALSE; definition = FALSE;
} }
else else
{ {
index = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL, tindex = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL,
&size); &size);
if (index < 0) if (tindex < 0)
return FALSE; return FALSE;
sprintf (buf, "%ld=", index); sprintf (buf, "%ld=", tindex);
definition = TRUE; definition = TRUE;
} }
@ -1335,7 +1335,7 @@ stab_start_struct_type (void *p, const char *tag, unsigned int id,
structp ? 's' : 'u', structp ? 's' : 'u',
size); size);
if (! stab_push_string (info, buf, index, definition, size)) if (! stab_push_string (info, buf, tindex, definition, size))
return FALSE; return FALSE;
info->type_stack->fields = (char *) xmalloc (1); info->type_stack->fields = (char *) xmalloc (1);
@ -1414,14 +1414,14 @@ stab_end_struct_type (void *p)
{ {
struct stab_write_handle *info = (struct stab_write_handle *) p; struct stab_write_handle *info = (struct stab_write_handle *) p;
bfd_boolean definition; bfd_boolean definition;
long index; long tindex;
unsigned int size; unsigned int size;
char *fields, *first, *buf; char *fields, *first, *buf;
assert (info->type_stack != NULL && info->type_stack->fields != NULL); assert (info->type_stack != NULL && info->type_stack->fields != NULL);
definition = info->type_stack->definition; definition = info->type_stack->definition;
index = info->type_stack->index; tindex = info->type_stack->index;
size = info->type_stack->size; size = info->type_stack->size;
fields = info->type_stack->fields; fields = info->type_stack->fields;
first = stab_pop_type (info); first = stab_pop_type (info);
@ -1431,7 +1431,7 @@ stab_end_struct_type (void *p)
free (first); free (first);
free (fields); free (fields);
if (! stab_push_string (info, buf, index, definition, size)) if (! stab_push_string (info, buf, tindex, definition, size))
return FALSE; return FALSE;
free (buf); free (buf);
@ -1867,14 +1867,14 @@ stab_tag_type (void *p, const char *name, unsigned int id,
enum debug_type_kind kind) enum debug_type_kind kind)
{ {
struct stab_write_handle *info = (struct stab_write_handle *) p; struct stab_write_handle *info = (struct stab_write_handle *) p;
long index; long tindex;
unsigned int size = 0; unsigned int size = 0;
index = stab_get_struct_index (info, name, id, kind, &size); tindex = stab_get_struct_index (info, name, id, kind, &size);
if (index < 0) if (tindex < 0)
return FALSE; return FALSE;
return stab_push_defined_type (info, index, size); return stab_push_defined_type (info, tindex, size);
} }
/* Define a typedef. */ /* Define a typedef. */
@ -1883,24 +1883,24 @@ static bfd_boolean
stab_typdef (void *p, const char *name) stab_typdef (void *p, const char *name)
{ {
struct stab_write_handle *info = (struct stab_write_handle *) p; struct stab_write_handle *info = (struct stab_write_handle *) p;
long index; long tindex;
unsigned int size; unsigned int size;
char *s, *buf; char *s, *buf;
struct string_hash_entry *h; struct string_hash_entry *h;
index = info->type_stack->index; tindex = info->type_stack->index;
size = info->type_stack->size; size = info->type_stack->size;
s = stab_pop_type (info); s = stab_pop_type (info);
buf = (char *) xmalloc (strlen (name) + strlen (s) + 20); buf = (char *) xmalloc (strlen (name) + strlen (s) + 20);
if (index > 0) if (tindex > 0)
sprintf (buf, "%s:t%s", name, s); sprintf (buf, "%s:t%s", name, s);
else else
{ {
index = info->type_index; tindex = info->type_index;
++info->type_index; ++info->type_index;
sprintf (buf, "%s:t%ld=%s", name, index, s); sprintf (buf, "%s:t%ld=%s", name, tindex, s);
} }
free (s); free (s);
@ -1920,7 +1920,7 @@ stab_typdef (void *p, const char *name)
/* I don't think we care about redefinitions. */ /* I don't think we care about redefinitions. */
h->index = index; h->index = tindex;
h->size = size; h->size = size;
return TRUE; return TRUE;
@ -2050,12 +2050,12 @@ stab_variable (void *p, const char *name, enum debug_var_kind kind,
if (! ISDIGIT (*s)) if (! ISDIGIT (*s))
{ {
char *n; char *n;
long index; long tindex;
index = info->type_index; tindex = info->type_index;
++info->type_index; ++info->type_index;
n = (char *) xmalloc (strlen (s) + 20); n = (char *) xmalloc (strlen (s) + 20);
sprintf (n, "%ld=%s", index, s); sprintf (n, "%ld=%s", tindex, s);
free (s); free (s);
s = n; s = n;
} }

View File

@ -1,3 +1,8 @@
2009-12-11 Nick Clifton <nickc@redhat.com>
* frv.opc: Fix shadowed variable warnings.
* m32c.opc: Fix shadowed variable warnings.
2009-11-14 Doug Evans <dje@sebabeach.org> 2009-11-14 Doug Evans <dje@sebabeach.org>
Must use VOID expression in VOID context. Must use VOID expression in VOID context.

View File

@ -842,7 +842,7 @@ check_insn_major_constraints (FRV_VLIW *vliw,
int int
frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn)
{ {
int index; int slot_index;
CGEN_ATTR_VALUE_ENUM_TYPE major; CGEN_ATTR_VALUE_ENUM_TYPE major;
CGEN_ATTR_VALUE_ENUM_TYPE unit; CGEN_ATTR_VALUE_ENUM_TYPE unit;
VLIW_COMBO *new_vliw; VLIW_COMBO *new_vliw;
@ -850,8 +850,8 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn)
if (vliw->constraint_violation || CGEN_INSN_INVALID_P (insn)) if (vliw->constraint_violation || CGEN_INSN_INVALID_P (insn))
return 1; return 1;
index = vliw->next_slot; slot_index = vliw->next_slot;
if (index >= FRV_VLIW_SIZE) if (slot_index >= FRV_VLIW_SIZE)
return 1; return 1;
unit = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_UNIT); unit = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_UNIT);
@ -878,7 +878,7 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn)
break; break;
} }
if (index <= 0) if (slot_index <= 0)
{ {
/* Any insn can be added to slot 0. */ /* Any insn can be added to slot 0. */
while (! match_unit (vliw, unit, (*vliw->current_vliw)[0])) while (! match_unit (vliw, unit, (*vliw->current_vliw)[0]))
@ -898,8 +898,8 @@ frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn)
if (new_vliw && check_insn_major_constraints (vliw, major, insn)) if (new_vliw && check_insn_major_constraints (vliw, major, insn))
{ {
vliw->current_vliw = new_vliw; vliw->current_vliw = new_vliw;
vliw->major[index] = major; vliw->major[slot_index] = major;
vliw->insn[index] = insn; vliw->insn[slot_index] = insn;
vliw->next_slot++; vliw->next_slot++;
return 0; return 0;
} }

View File

@ -156,27 +156,26 @@ parse_unsigned8 (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep) int opindex, unsigned long *valuep)
{ {
const char *errmsg = 0; const char *errmsg = 0;
unsigned long value; unsigned long value = 0;
long have_zero = 0; long have_zero = 0;
if (strncasecmp (*strp, "%dsp8(", 6) == 0) if (strncasecmp (*strp, "%dsp8(", 6) == 0)
{ {
enum cgen_parse_operand_result result_type; enum cgen_parse_operand_result result_type;
bfd_vma value; bfd_vma val;
const char *errmsg;
*strp += 6; *strp += 6;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_8, errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_8,
& result_type, & value); & result_type, & val);
if (**strp != ')') if (**strp != ')')
return _("missing `)'"); return _("missing `)'");
(*strp) ++; (*strp) ++;
if (errmsg == NULL if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
{ return _("%dsp8() takes a symbolic address, not a number");
return _("%dsp8() takes a symbolic address, not a number");
} value = val;
*valuep = value; *valuep = value;
return errmsg; return errmsg;
} }
@ -253,26 +252,25 @@ parse_signed8 (CGEN_CPU_DESC cd, const char **strp,
int opindex, signed long *valuep) int opindex, signed long *valuep)
{ {
const char *errmsg = 0; const char *errmsg = 0;
signed long value; signed long value = 0;
if (strncasecmp (*strp, "%hi8(", 5) == 0) if (strncasecmp (*strp, "%hi8(", 5) == 0)
{ {
enum cgen_parse_operand_result result_type; enum cgen_parse_operand_result result_type;
bfd_vma value; bfd_vma val;
const char *errmsg;
*strp += 5; *strp += 5;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_M32C_HI8, errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_M32C_HI8,
& result_type, & value); & result_type, & val);
if (**strp != ')') if (**strp != ')')
return _("missing `)'"); return _("missing `)'");
(*strp) ++; (*strp) ++;
if (errmsg == NULL if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
{ val >>= 16;
value >>= 16;
} value = val;
*valuep = value; *valuep = value;
return errmsg; return errmsg;
} }
@ -294,27 +292,26 @@ parse_unsigned16 (CGEN_CPU_DESC cd, const char **strp,
int opindex, unsigned long *valuep) int opindex, unsigned long *valuep)
{ {
const char *errmsg = 0; const char *errmsg = 0;
unsigned long value; unsigned long value = 0;
long have_zero = 0; long have_zero = 0;
if (strncasecmp (*strp, "%dsp16(", 7) == 0) if (strncasecmp (*strp, "%dsp16(", 7) == 0)
{ {
enum cgen_parse_operand_result result_type; enum cgen_parse_operand_result result_type;
bfd_vma value; bfd_vma val;
const char *errmsg;
*strp += 7; *strp += 7;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_16, errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_16,
& result_type, & value); & result_type, & val);
if (**strp != ')') if (**strp != ')')
return _("missing `)'"); return _("missing `)'");
(*strp) ++; (*strp) ++;
if (errmsg == NULL if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
{ return _("%dsp16() takes a symbolic address, not a number");
return _("%dsp16() takes a symbolic address, not a number");
} value = val;
*valuep = value; *valuep = value;
return errmsg; return errmsg;
} }
@ -354,26 +351,25 @@ parse_signed16 (CGEN_CPU_DESC cd, const char **strp,
int opindex, signed long *valuep) int opindex, signed long *valuep)
{ {
const char *errmsg = 0; const char *errmsg = 0;
signed long value; signed long value = 0;
if (strncasecmp (*strp, "%lo16(", 6) == 0) if (strncasecmp (*strp, "%lo16(", 6) == 0)
{ {
enum cgen_parse_operand_result result_type; enum cgen_parse_operand_result result_type;
bfd_vma value; bfd_vma val;
const char *errmsg;
*strp += 6; *strp += 6;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16, errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16,
& result_type, & value); & result_type, & val);
if (**strp != ')') if (**strp != ')')
return _("missing `)'"); return _("missing `)'");
(*strp) ++; (*strp) ++;
if (errmsg == NULL if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
{ value &= 0xffff;
value &= 0xffff;
} value = val;
*valuep = value; *valuep = value;
return errmsg; return errmsg;
} }
@ -381,21 +377,20 @@ parse_signed16 (CGEN_CPU_DESC cd, const char **strp,
if (strncasecmp (*strp, "%hi16(", 6) == 0) if (strncasecmp (*strp, "%hi16(", 6) == 0)
{ {
enum cgen_parse_operand_result result_type; enum cgen_parse_operand_result result_type;
bfd_vma value; bfd_vma val;
const char *errmsg;
*strp += 6; *strp += 6;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16, errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16,
& result_type, & value); & result_type, & val);
if (**strp != ')') if (**strp != ')')
return _("missing `)'"); return _("missing `)'");
(*strp) ++; (*strp) ++;
if (errmsg == NULL if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
{ val >>= 16;
value >>= 16;
} value = val;
*valuep = value; *valuep = value;
return errmsg; return errmsg;
} }
@ -1121,7 +1116,7 @@ print_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
}; };
disassemble_info *info = dis_info; disassemble_info *info = dis_info;
int mask; int mask;
int index = 0; int reg_index = 0;
char* comma = ""; char* comma = "";
if (push) if (push)
@ -1135,7 +1130,7 @@ print_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
comma = ","; comma = ",";
} }
for (index = 1; index <= 7; ++index) for (reg_index = 1; reg_index <= 7; ++reg_index)
{ {
if (push) if (push)
mask >>= 1; mask >>= 1;
@ -1145,7 +1140,7 @@ print_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
if (value & mask) if (value & mask)
{ {
(*info->fprintf_func) (info->stream, "%s%s", comma, (*info->fprintf_func) (info->stream, "%s%s", comma,
m16c_register_names [index]); m16c_register_names [reg_index]);
comma = ","; comma = ",";
} }
} }

View File

@ -1,3 +1,7 @@
2009-12-11 Nick Clifton <nickc@redhat.com>
* elfcpp_file.h: Fix shadowed variable warnings.
2009-12-10 Doug Kwan <dougkwan@google.com> 2009-12-10 Doug Kwan <dougkwan@google.com>
* arm.h: New enums for EABI object attribute tags and values. * arm.h: New enums for EABI object attribute tags and values.

View File

@ -449,10 +449,10 @@ template<int size, bool big_endian, typename File>
unsigned int unsigned int
Elf_file<size, big_endian, File>::find_section_by_type(unsigned int type) Elf_file<size, big_endian, File>::find_section_by_type(unsigned int type)
{ {
unsigned int shnum = this->shnum(); unsigned int tshnum = this->shnum();
typename File::View v(this->file_->view(this->shoff_, typename File::View v(this->file_->view(this->shoff_,
This::shdr_size * shnum)); This::shdr_size * tshnum));
for (unsigned int i = 0; i < shnum; i++) for (unsigned int i = 0; i < tshnum; i++)
{ {
Ef_shdr shdr(v.data() + This::shdr_size * i); Ef_shdr shdr(v.data() + This::shdr_size * i);
if (shdr.get_sh_type() == type) if (shdr.get_sh_type() == type)
@ -494,8 +494,8 @@ Elf_file<size, big_endian, File>::section_name(unsigned int shndx)
off_t shstr_off; off_t shstr_off;
typename Elf_types<size>::Elf_WXword shstr_size; typename Elf_types<size>::Elf_WXword shstr_size;
{ {
const unsigned int shstrndx = this->shstrndx_; const unsigned int fshstrndx = this->shstrndx_;
typename File::View v(file->view(this->section_header_offset(shstrndx), typename File::View v(file->view(this->section_header_offset(fshstrndx),
This::shdr_size)); This::shdr_size));
Ef_shdr shstr_shdr(v.data()); Ef_shdr shstr_shdr(v.data());
shstr_off = shstr_shdr.get_sh_offset(); shstr_off = shstr_shdr.get_sh_offset();

View File

@ -1,3 +1,49 @@
2009-12-11 Nick Clifton <nickc@redhat.com>
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
* configure: Regenerate.
* dw2gencfi.c: Fix shadowed variable warnings.
* dwarf2dbg.c: Likewise.
* expr.c: Likewise.
* hash.c: Likewise.
* listing.c: Likewise.
* macro.c: Likewise.
* read.c: Likewise.
* stabs.c: Likewise.
* symbols.c: Likewise.
* write.c: Likewise.
* config/bfin-parse.y: Likewise.
* config/obj-coff.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-bfin.c: Likewise.
* config/tc-cr16.c: Likewise.
* config/tc-crx.c: Likewise.
* config/tc-d10v.c: Likewise.
* config/tc-d30v.c: Likewise.
* config/tc-frv.c: Likewise.
* config/tc-i370.c: Likewise.
* config/tc-i386-intel.c: Likewise.
* config/tc-i386.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-m32r.c: Likewise.
* config/tc-m68hc11.c: Likewise.
* config/tc-mips.c: Likewise.
* config/tc-mn10200.c: Likewise.
* config/tc-mn10300.c: Likewise.
* config/tc-ns32k.c: Likewise.
* config/tc-ppc.c: Likewise.
* config/tc-score.c: Likewise.
* config/tc-score7.c: Likewise.
* config/tc-sh.c: Likewise.
* config/tc-sh64.c: Likewise.
* config/tc-sparc.c: Likewise.
* config/tc-tic30.c: Likewise.
* config/tc-tic4x.c: Likewise.
* config/tc-tic54x.c: Likewise.
* config/tc-xtensa.c: Likewise.
* config/tc-z8k.c: Likewise.
2009-12-09 H.J. Lu <hongjiu.lu@intel.com> 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.c (arch_entry): Add len and skip. * config/tc-i386.c (arch_entry): Add len and skip.

View File

@ -48,12 +48,15 @@ DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
$(srcdir)/../ylwrap $(srcdir)/../ylwrap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
$(top_srcdir)/../config/zlib.m4 \
$(top_srcdir)/../bfd/warning.m4 \ $(top_srcdir)/../bfd/warning.m4 \
$(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \
$(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \ $(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \ $(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/plugins.m4 \
$(top_srcdir)/../config/po.m4 \ $(top_srcdir)/../config/po.m4 \
$(top_srcdir)/../config/progtest.m4 \ $(top_srcdir)/../config/progtest.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \

View File

@ -193,10 +193,10 @@ yyerror (char *msg)
} }
static int static int
in_range_p (Expr_Node *expr, int from, int to, unsigned int mask) in_range_p (Expr_Node *exp, int from, int to, unsigned int mask)
{ {
int val = EXPR_VALUE (expr); int val = EXPR_VALUE (exp);
if (expr->type != Expr_Node_Constant) if (exp->type != Expr_Node_Constant)
return 0; return 0;
if (val < from || val > to) if (val < from || val > to)
return 0; return 0;
@ -4411,13 +4411,13 @@ mkexpr (int x, SYMBOL_T s)
} }
static int static int
value_match (Expr_Node *expr, int sz, int sign, int mul, int issigned) value_match (Expr_Node *exp, int sz, int sign, int mul, int issigned)
{ {
int umax = (1 << sz) - 1; int umax = (1 << sz) - 1;
int min = -1 << (sz - 1); int min = -1 << (sz - 1);
int max = (1 << (sz - 1)) - 1; int max = (1 << (sz - 1)) - 1;
int v = (EXPR_VALUE (expr)) & 0xffffffff; int v = (EXPR_VALUE (exp)) & 0xffffffff;
if ((v % mul) != 0) if ((v % mul) != 0)
{ {

View File

@ -621,14 +621,11 @@ obj_coff_def (int what ATTRIBUTE_UNUSED)
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
unsigned int dim_index;
static void static void
obj_coff_endef (int ignore ATTRIBUTE_UNUSED) obj_coff_endef (int ignore ATTRIBUTE_UNUSED)
{ {
symbolS *symbolP = NULL; symbolS *symbolP = NULL;
dim_index = 0;
if (def_symbol_in_progress == NULL) if (def_symbol_in_progress == NULL)
{ {
as_warn (_(".endef pseudo-op used outside of .def/.endef: ignored.")); as_warn (_(".endef pseudo-op used outside of .def/.endef: ignored."));
@ -861,7 +858,7 @@ obj_coff_endef (int ignore ATTRIBUTE_UNUSED)
static void static void
obj_coff_dim (int ignore ATTRIBUTE_UNUSED) obj_coff_dim (int ignore ATTRIBUTE_UNUSED)
{ {
int dim_index; int d_index;
if (def_symbol_in_progress == NULL) if (def_symbol_in_progress == NULL)
{ {
@ -872,10 +869,10 @@ obj_coff_dim (int ignore ATTRIBUTE_UNUSED)
S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1);
for (dim_index = 0; dim_index < DIMNUM; dim_index++) for (d_index = 0; d_index < DIMNUM; d_index++)
{ {
SKIP_WHITESPACES (); SKIP_WHITESPACES ();
SA_SET_SYM_DIMEN (def_symbol_in_progress, dim_index, SA_SET_SYM_DIMEN (def_symbol_in_progress, d_index,
get_absolute_expression ()); get_absolute_expression ());
switch (*input_line_pointer) switch (*input_line_pointer)
@ -889,7 +886,7 @@ obj_coff_dim (int ignore ATTRIBUTE_UNUSED)
/* Fall through. */ /* Fall through. */
case '\n': case '\n':
case ';': case ';':
dim_index = DIMNUM; d_index = DIMNUM;
break; break;
} }
} }

View File

@ -1052,10 +1052,10 @@ md_atof (int type, char * litP, int * sizeP)
/* We handle all bad expressions here, so that we can report the faulty /* We handle all bad expressions here, so that we can report the faulty
instruction in the error message. */ instruction in the error message. */
void void
md_operand (expressionS * expr) md_operand (expressionS * exp)
{ {
if (in_my_get_expression) if (in_my_get_expression)
expr->X_op = O_illegal; exp->X_op = O_illegal;
} }
/* Immediate values. */ /* Immediate values. */
@ -1583,23 +1583,23 @@ parse_reg_list (char ** strp)
} }
else else
{ {
expressionS expr; expressionS exp;
if (my_get_expression (&expr, &str, GE_NO_PREFIX)) if (my_get_expression (&exp, &str, GE_NO_PREFIX))
return FAIL; return FAIL;
if (expr.X_op == O_constant) if (exp.X_op == O_constant)
{ {
if (expr.X_add_number if (exp.X_add_number
!= (expr.X_add_number & 0x0000ffff)) != (exp.X_add_number & 0x0000ffff))
{ {
inst.error = _("invalid register mask"); inst.error = _("invalid register mask");
return FAIL; return FAIL;
} }
if ((range & expr.X_add_number) != 0) if ((range & exp.X_add_number) != 0)
{ {
int regno = range & expr.X_add_number; int regno = range & exp.X_add_number;
regno &= -regno; regno &= -regno;
regno = (1 << regno) - 1; regno = (1 << regno) - 1;
@ -1608,7 +1608,7 @@ parse_reg_list (char ** strp)
regno); regno);
} }
range |= expr.X_add_number; range |= exp.X_add_number;
} }
else else
{ {
@ -1618,7 +1618,7 @@ parse_reg_list (char ** strp)
return FAIL; return FAIL;
} }
memcpy (&inst.reloc.exp, &expr, sizeof (expressionS)); memcpy (&inst.reloc.exp, &exp, sizeof (expressionS));
inst.reloc.type = BFD_RELOC_ARM_MULTI; inst.reloc.type = BFD_RELOC_ARM_MULTI;
inst.reloc.pc_rel = 0; inst.reloc.pc_rel = 0;
} }
@ -4711,7 +4711,7 @@ static int
parse_shifter_operand (char **str, int i) parse_shifter_operand (char **str, int i)
{ {
int value; int value;
expressionS expr; expressionS exp;
if ((value = arm_reg_parse (str, REG_TYPE_RN)) != FAIL) if ((value = arm_reg_parse (str, REG_TYPE_RN)) != FAIL)
{ {
@ -4735,16 +4735,16 @@ parse_shifter_operand (char **str, int i)
if (skip_past_comma (str) == SUCCESS) if (skip_past_comma (str) == SUCCESS)
{ {
/* #x, y -- ie explicit rotation by Y. */ /* #x, y -- ie explicit rotation by Y. */
if (my_get_expression (&expr, str, GE_NO_PREFIX)) if (my_get_expression (&exp, str, GE_NO_PREFIX))
return FAIL; return FAIL;
if (expr.X_op != O_constant || inst.reloc.exp.X_op != O_constant) if (exp.X_op != O_constant || inst.reloc.exp.X_op != O_constant)
{ {
inst.error = _("constant expression expected"); inst.error = _("constant expression expected");
return FAIL; return FAIL;
} }
value = expr.X_add_number; value = exp.X_add_number;
if (value < 0 || value > 30 || value % 2 != 0) if (value < 0 || value > 30 || value % 2 != 0)
{ {
inst.error = _("invalid rotation"); inst.error = _("invalid rotation");
@ -14163,12 +14163,13 @@ do_neon_mov (void)
case NS_SR: /* case 4. */ case NS_SR: /* case 4. */
{ {
unsigned bcdebits = 0; unsigned bcdebits = 0;
struct neon_type_el et = neon_check_type (2, NS_NULL, int logsize;
N_8 | N_16 | N_32 | N_KEY, N_EQK);
int logsize = neon_logbits (et.size);
unsigned dn = NEON_SCALAR_REG (inst.operands[0].reg); unsigned dn = NEON_SCALAR_REG (inst.operands[0].reg);
unsigned x = NEON_SCALAR_INDEX (inst.operands[0].reg); unsigned x = NEON_SCALAR_INDEX (inst.operands[0].reg);
et = neon_check_type (2, NS_NULL, N_8 | N_16 | N_32 | N_KEY, N_EQK);
logsize = neon_logbits (et.size);
constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_vfp_ext_v1), constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_vfp_ext_v1),
_(BAD_FPU)); _(BAD_FPU));
constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_neon_ext_v1) constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_neon_ext_v1)
@ -14210,13 +14211,15 @@ do_neon_mov (void)
case NS_RS: /* case 6. */ case NS_RS: /* case 6. */
{ {
struct neon_type_el et = neon_check_type (2, NS_NULL, unsigned logsize;
N_EQK, N_S8 | N_S16 | N_U8 | N_U16 | N_32 | N_KEY);
unsigned logsize = neon_logbits (et.size);
unsigned dn = NEON_SCALAR_REG (inst.operands[1].reg); unsigned dn = NEON_SCALAR_REG (inst.operands[1].reg);
unsigned x = NEON_SCALAR_INDEX (inst.operands[1].reg); unsigned x = NEON_SCALAR_INDEX (inst.operands[1].reg);
unsigned abcdebits = 0; unsigned abcdebits = 0;
et = neon_check_type (2, NS_NULL,
N_EQK, N_S8 | N_S16 | N_U8 | N_U16 | N_32 | N_KEY);
logsize = neon_logbits (et.size);
constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_vfp_ext_v1), constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_vfp_ext_v1),
_(BAD_FPU)); _(BAD_FPU));
constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_neon_ext_v1) constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_neon_ext_v1)
@ -19126,12 +19129,12 @@ tc_arm_regname_to_dw2regnum (char *regname)
void void
tc_pe_dwarf2_emit_offset (symbolS *symbol, unsigned int size) tc_pe_dwarf2_emit_offset (symbolS *symbol, unsigned int size)
{ {
expressionS expr; expressionS exp;
expr.X_op = O_secrel; exp.X_op = O_secrel;
expr.X_add_symbol = symbol; exp.X_add_symbol = symbol;
expr.X_add_number = 0; exp.X_add_number = 0;
emit_expr (&expr, size); emit_expr (&exp, size);
} }
#endif #endif
@ -22602,18 +22605,18 @@ aeabi_set_public_attributes (void)
/* Tag_CPU_name. */ /* Tag_CPU_name. */
if (selected_cpu_name[0]) if (selected_cpu_name[0])
{ {
char *p; char *q;
p = selected_cpu_name; q = selected_cpu_name;
if (strncmp (p, "armv", 4) == 0) if (strncmp (q, "armv", 4) == 0)
{ {
int i; int i;
p += 4; q += 4;
for (i = 0; p[i]; i++) for (i = 0; q[i]; i++)
p[i] = TOUPPER (p[i]); q[i] = TOUPPER (q[i]);
} }
aeabi_set_attribute_string (Tag_CPU_name, p); aeabi_set_attribute_string (Tag_CPU_name, q);
} }
/* Tag_CPU_arch. */ /* Tag_CPU_arch. */

View File

@ -1134,6 +1134,7 @@ Expr_Node_Gen_Reloc_R (Expr_Node * head)
#define INIT(t) t c_code = init_##t #define INIT(t) t c_code = init_##t
#define ASSIGN(x) c_code.opcode |= ((x & c_code.mask_##x)<<c_code.bits_##x) #define ASSIGN(x) c_code.opcode |= ((x & c_code.mask_##x)<<c_code.bits_##x)
#define ASSIGNF(x,f) c_code.opcode |= ((x & c_code.mask_##f)<<c_code.bits_##f)
#define ASSIGN_R(x) c_code.opcode |= (((x ? (x->regno & CODE_MASK) : 0) & c_code.mask_##x)<<c_code.bits_##x) #define ASSIGN_R(x) c_code.opcode |= (((x ? (x->regno & CODE_MASK) : 0) & c_code.mask_##x)<<c_code.bits_##x)
#define HI(x) ((x >> 16) & 0xffff) #define HI(x) ((x >> 16) & 0xffff)
@ -1302,13 +1303,13 @@ bfin_gen_calla (Expr_Node * addr, int S)
{ {
int val; int val;
int high_val; int high_val;
int reloc = 0; int rel = 0;
INIT (CALLa); INIT (CALLa);
switch(S){ switch(S){
case 0 : reloc = BFD_RELOC_BFIN_24_PCREL_JUMP_L; break; case 0 : rel = BFD_RELOC_BFIN_24_PCREL_JUMP_L; break;
case 1 : reloc = BFD_RELOC_24_PCREL; break; case 1 : rel = BFD_RELOC_24_PCREL; break;
case 2 : reloc = BFD_RELOC_BFIN_PLTPC; break; case 2 : rel = BFD_RELOC_BFIN_PLTPC; break;
default : break; default : break;
} }
@ -1318,7 +1319,7 @@ bfin_gen_calla (Expr_Node * addr, int S)
high_val = val >> 16; high_val = val >> 16;
return conscode (gencode (HI (c_code.opcode) | (high_val & 0xff)), return conscode (gencode (HI (c_code.opcode) | (high_val & 0xff)),
Expr_Node_Gen_Reloc (addr, reloc)); Expr_Node_Gen_Reloc (addr, rel));
} }
INSTR_T INSTR_T
@ -1336,7 +1337,7 @@ bfin_gen_linkage (int R, int framesize)
/* Load and Store. */ /* Load and Store. */
INSTR_T INSTR_T
bfin_gen_ldimmhalf (REG_T reg, int H, int S, int Z, Expr_Node * phword, int reloc) bfin_gen_ldimmhalf (REG_T reg, int H, int S, int Z, Expr_Node * phword, int rel)
{ {
int grp, hword; int grp, hword;
unsigned val = EXPR_VALUE (phword); unsigned val = EXPR_VALUE (phword);
@ -1349,11 +1350,11 @@ bfin_gen_ldimmhalf (REG_T reg, int H, int S, int Z, Expr_Node * phword, int relo
ASSIGN_R (reg); ASSIGN_R (reg);
grp = (GROUP (reg)); grp = (GROUP (reg));
ASSIGN (grp); ASSIGN (grp);
if (reloc == 2) if (rel == 2)
{ {
return conscode (gencode (HI (c_code.opcode)), Expr_Node_Gen_Reloc (phword, BFD_RELOC_BFIN_16_IMM)); return conscode (gencode (HI (c_code.opcode)), Expr_Node_Gen_Reloc (phword, BFD_RELOC_BFIN_16_IMM));
} }
else if (reloc == 1) else if (rel == 1)
{ {
return conscode (gencode (HI (c_code.opcode)), Expr_Node_Gen_Reloc (phword, IS_H (*reg) ? BFD_RELOC_BFIN_16_HIGH : BFD_RELOC_BFIN_16_LOW)); return conscode (gencode (HI (c_code.opcode)), Expr_Node_Gen_Reloc (phword, IS_H (*reg) ? BFD_RELOC_BFIN_16_HIGH : BFD_RELOC_BFIN_16_LOW));
} }
@ -1450,20 +1451,19 @@ bfin_gen_ldst (REG_T ptr, REG_T reg, int aop, int sz, int Z, int W)
} }
INSTR_T INSTR_T
bfin_gen_ldstii (REG_T ptr, REG_T reg, Expr_Node * poffset, int W, int op) bfin_gen_ldstii (REG_T ptr, REG_T reg, Expr_Node * poffset, int W, int opc)
{ {
int offset; int offset;
int value = 0; int value = 0;
INIT (LDSTii); INIT (LDSTii);
if (!IS_PREG (*ptr)) if (!IS_PREG (*ptr))
{ {
fprintf (stderr, "Warning: possible mixup of Preg/Dreg\n"); fprintf (stderr, "Warning: possible mixup of Preg/Dreg\n");
return 0; return 0;
} }
switch (op) switch (opc)
{ {
case 1: case 1:
case 2: case 2:
@ -1481,7 +1481,7 @@ bfin_gen_ldstii (REG_T ptr, REG_T reg, Expr_Node * poffset, int W, int op)
offset = value; offset = value;
ASSIGN (offset); ASSIGN (offset);
ASSIGN (W); ASSIGN (W);
ASSIGN (op); ASSIGNF (opc, op);
return GEN_OPCODE16 (); return GEN_OPCODE16 ();
} }
@ -1580,48 +1580,48 @@ bfin_gen_alu2op (REG_T dst, REG_T src, int opc)
} }
INSTR_T INSTR_T
bfin_gen_compi2opd (REG_T dst, int src, int op) bfin_gen_compi2opd (REG_T dst, int src, int opc)
{ {
INIT (COMPI2opD); INIT (COMPI2opD);
ASSIGN_R (dst); ASSIGN_R (dst);
ASSIGN (src); ASSIGN (src);
ASSIGN (op); ASSIGNF (opc, op);
return GEN_OPCODE16 (); return GEN_OPCODE16 ();
} }
INSTR_T INSTR_T
bfin_gen_compi2opp (REG_T dst, int src, int op) bfin_gen_compi2opp (REG_T dst, int src, int opc)
{ {
INIT (COMPI2opP); INIT (COMPI2opP);
ASSIGN_R (dst); ASSIGN_R (dst);
ASSIGN (src); ASSIGN (src);
ASSIGN (op); ASSIGNF (opc, op);
return GEN_OPCODE16 (); return GEN_OPCODE16 ();
} }
INSTR_T INSTR_T
bfin_gen_dagmodik (REG_T i, int op) bfin_gen_dagmodik (REG_T i, int opc)
{ {
INIT (DagMODik); INIT (DagMODik);
ASSIGN_R (i); ASSIGN_R (i);
ASSIGN (op); ASSIGNF (opc, op);
return GEN_OPCODE16 (); return GEN_OPCODE16 ();
} }
INSTR_T INSTR_T
bfin_gen_dagmodim (REG_T i, REG_T m, int op, int br) bfin_gen_dagmodim (REG_T i, REG_T m, int opc, int br)
{ {
INIT (DagMODim); INIT (DagMODim);
ASSIGN_R (i); ASSIGN_R (i);
ASSIGN_R (m); ASSIGN_R (m);
ASSIGN (op); ASSIGNF (opc, op);
ASSIGN (br); ASSIGN (br);
return GEN_OPCODE16 (); return GEN_OPCODE16 ();
@ -1684,12 +1684,12 @@ bfin_gen_ccmv (REG_T src, REG_T dst, int T)
} }
INSTR_T INSTR_T
bfin_gen_cc2stat (int cbit, int op, int D) bfin_gen_cc2stat (int cbit, int opc, int D)
{ {
INIT (CC2stat); INIT (CC2stat);
ASSIGN (cbit); ASSIGN (cbit);
ASSIGN (op); ASSIGNF (opc, op);
ASSIGN (D); ASSIGN (D);
return GEN_OPCODE16 (); return GEN_OPCODE16 ();
@ -1713,11 +1713,11 @@ bfin_gen_regmv (REG_T src, REG_T dst)
} }
INSTR_T INSTR_T
bfin_gen_cc2dreg (int op, REG_T reg) bfin_gen_cc2dreg (int opc, REG_T reg)
{ {
INIT (CC2dreg); INIT (CC2dreg);
ASSIGN (op); ASSIGNF (opc, op);
ASSIGN_R (reg); ASSIGN_R (reg);
return GEN_OPCODE16 (); return GEN_OPCODE16 ();
@ -1735,13 +1735,13 @@ bfin_gen_progctrl (int prgfunc, int poprnd)
} }
INSTR_T INSTR_T
bfin_gen_cactrl (REG_T reg, int a, int op) bfin_gen_cactrl (REG_T reg, int a, int opc)
{ {
INIT (CaCTRL); INIT (CaCTRL);
ASSIGN_R (reg); ASSIGN_R (reg);
ASSIGN (a); ASSIGN (a);
ASSIGN (op); ASSIGNF (opc, op);
return GEN_OPCODE16 (); return GEN_OPCODE16 ();
} }
@ -1841,14 +1841,14 @@ bfin_gen_multi_instr (INSTR_T dsp32, INSTR_T dsp16_grp1, INSTR_T dsp16_grp2)
} }
INSTR_T INSTR_T
bfin_gen_loop (Expr_Node *expr, REG_T reg, int rop, REG_T preg) bfin_gen_loop (Expr_Node *exp, REG_T reg, int rop, REG_T preg)
{ {
const char *loopsym; const char *loopsym;
char *lbeginsym, *lendsym; char *lbeginsym, *lendsym;
Expr_Node_Value lbeginval, lendval; Expr_Node_Value lbeginval, lendval;
Expr_Node *lbegin, *lend; Expr_Node *lbegin, *lend;
loopsym = expr->value.s_value; loopsym = exp->value.s_value;
lbeginsym = (char *) xmalloc (strlen (loopsym) + strlen ("__BEGIN") + 5); lbeginsym = (char *) xmalloc (strlen (loopsym) + strlen ("__BEGIN") + 5);
lendsym = (char *) xmalloc (strlen (loopsym) + strlen ("__END") + 5); lendsym = (char *) xmalloc (strlen (loopsym) + strlen ("__END") + 5);
@ -1875,14 +1875,14 @@ bfin_gen_loop (Expr_Node *expr, REG_T reg, int rop, REG_T preg)
} }
void void
bfin_loop_beginend (Expr_Node *expr, int begin) bfin_loop_beginend (Expr_Node *exp, int begin)
{ {
const char *loopsym; const char *loopsym;
char *label_name; char *label_name;
symbolS *line_label; symbolS *linelabel;
const char *suffix = begin ? "__BEGIN" : "__END"; const char *suffix = begin ? "__BEGIN" : "__END";
loopsym = expr->value.s_value; loopsym = exp->value.s_value;
label_name = (char *) xmalloc (strlen (loopsym) + strlen (suffix) + 5); label_name = (char *) xmalloc (strlen (loopsym) + strlen (suffix) + 5);
label_name[0] = 0; label_name[0] = 0;
@ -1891,12 +1891,12 @@ bfin_loop_beginend (Expr_Node *expr, int begin)
strcat (label_name, loopsym); strcat (label_name, loopsym);
strcat (label_name, suffix); strcat (label_name, suffix);
line_label = colon (label_name); linelabel = colon (label_name);
/* LOOP_END follows the last instruction in the loop. /* LOOP_END follows the last instruction in the loop.
Adjust label address. */ Adjust label address. */
if (!begin) if (!begin)
((struct local_symbol *) line_label)->lsy_value -= last_insn_size; ((struct local_symbol *) linelabel)->lsy_value -= last_insn_size;
} }
bfd_boolean bfd_boolean
@ -2018,9 +2018,9 @@ decode_dagMODim_0 (int iw0)
| 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 |.br| 1 | 1 |.op|.m.....|.i.....| | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 |.br| 1 | 1 |.op|.m.....|.i.....|
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */ +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
int i = ((iw0 >> DagMODim_i_bits) & DagMODim_i_mask); int i = ((iw0 >> DagMODim_i_bits) & DagMODim_i_mask);
int op = ((iw0 >> DagMODim_op_bits) & DagMODim_op_mask); int opc = ((iw0 >> DagMODim_op_bits) & DagMODim_op_mask);
if (op == 0 || op == 1) if (opc == 0 || opc == 1)
return IREG_MASK (i); return IREG_MASK (i);
else else
return 0; return 0;
@ -2199,18 +2199,18 @@ decode_LDSTii_0 (int iw0)
| 1 | 0 | 1 |.W.|.op....|.offset........|.ptr.......|.reg.......| | 1 | 0 | 1 |.W.|.op....|.offset........|.ptr.......|.reg.......|
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */ +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
int reg = ((iw0 >> LDSTii_reg_bit) & LDSTii_reg_mask); int reg = ((iw0 >> LDSTii_reg_bit) & LDSTii_reg_mask);
int op = ((iw0 >> LDSTii_op_bit) & LDSTii_op_mask); int opc = ((iw0 >> LDSTii_op_bit) & LDSTii_op_mask);
int W = ((iw0 >> LDSTii_W_bit) & LDSTii_W_mask); int W = ((iw0 >> LDSTii_W_bit) & LDSTii_W_mask);
if (W == 0 && op != 3) if (W == 0 && opc != 3)
return DREG_MASK (reg); return DREG_MASK (reg);
else if (W == 0 && op == 3) else if (W == 0 && opc == 3)
return 0; return 0;
else if (W == 1 && op == 0) else if (W == 1 && opc == 0)
return 0; return 0;
else if (W == 1 && op == 1) else if (W == 1 && opc == 1)
return 0; return 0;
else if (W == 1 && op == 3) else if (W == 1 && opc == 3)
return 0; return 0;
abort (); abort ();

View File

@ -317,12 +317,12 @@ get_cc (char *cc_name)
static reg static reg
get_register (char *reg_name) get_register (char *reg_name)
{ {
const reg_entry *reg; const reg_entry *rreg;
reg = (const reg_entry *) hash_find (reg_hash, reg_name); rreg = (const reg_entry *) hash_find (reg_hash, reg_name);
if (reg != NULL) if (rreg != NULL)
return reg->value.reg_val; return rreg->value.reg_val;
return nullregister; return nullregister;
} }
@ -331,7 +331,7 @@ get_register (char *reg_name)
static reg static reg
get_register_pair (char *reg_name) get_register_pair (char *reg_name)
{ {
const reg_entry *reg; const reg_entry *rreg;
char tmp_rp[16]="\0"; char tmp_rp[16]="\0";
/* Add '(' and ')' to the reg pair, if its not present. */ /* Add '(' and ')' to the reg pair, if its not present. */
@ -340,13 +340,13 @@ get_register_pair (char *reg_name)
tmp_rp[0] = '('; tmp_rp[0] = '(';
strcat (tmp_rp, reg_name); strcat (tmp_rp, reg_name);
strcat (tmp_rp,")"); strcat (tmp_rp,")");
reg = (const reg_entry *) hash_find (regp_hash, tmp_rp); rreg = (const reg_entry *) hash_find (regp_hash, tmp_rp);
} }
else else
reg = (const reg_entry *) hash_find (regp_hash, reg_name); rreg = (const reg_entry *) hash_find (regp_hash, reg_name);
if (reg != NULL) if (rreg != NULL)
return reg->value.reg_val; return rreg->value.reg_val;
return nullregister; return nullregister;
} }
@ -356,13 +356,13 @@ get_register_pair (char *reg_name)
static reg static reg
get_index_register (char *reg_name) get_index_register (char *reg_name)
{ {
const reg_entry *reg; const reg_entry *rreg;
reg = (const reg_entry *) hash_find (reg_hash, reg_name); rreg = (const reg_entry *) hash_find (reg_hash, reg_name);
if ((reg != NULL) if ((rreg != NULL)
&& ((reg->value.reg_val == 12) || (reg->value.reg_val == 13))) && ((rreg->value.reg_val == 12) || (rreg->value.reg_val == 13)))
return reg->value.reg_val; return rreg->value.reg_val;
return nullregister; return nullregister;
} }
@ -371,17 +371,17 @@ get_index_register (char *reg_name)
static reg static reg
get_index_register_pair (char *reg_name) get_index_register_pair (char *reg_name)
{ {
const reg_entry *reg; const reg_entry *rreg;
reg = (const reg_entry *) hash_find (regp_hash, reg_name); rreg = (const reg_entry *) hash_find (regp_hash, reg_name);
if (reg != NULL) if (rreg != NULL)
{ {
if ((reg->value.reg_val != 1) || (reg->value.reg_val != 7) if ((rreg->value.reg_val != 1) || (rreg->value.reg_val != 7)
|| (reg->value.reg_val != 9) || (reg->value.reg_val > 10)) || (rreg->value.reg_val != 9) || (rreg->value.reg_val > 10))
return reg->value.reg_val; return rreg->value.reg_val;
as_bad (_("Unknown register pair - index relative mode: `%d'"), reg->value.reg_val); as_bad (_("Unknown register pair - index relative mode: `%d'"), rreg->value.reg_val);
} }
return nullregister; return nullregister;
@ -392,12 +392,12 @@ get_index_register_pair (char *reg_name)
static preg static preg
get_pregister (char *preg_name) get_pregister (char *preg_name)
{ {
const reg_entry *preg; const reg_entry *prreg;
preg = (const reg_entry *) hash_find (preg_hash, preg_name); prreg = (const reg_entry *) hash_find (preg_hash, preg_name);
if (preg != NULL) if (prreg != NULL)
return preg->value.preg_val; return prreg->value.preg_val;
return nullpregister; return nullpregister;
} }
@ -407,12 +407,12 @@ get_pregister (char *preg_name)
static preg static preg
get_pregisterp (char *preg_name) get_pregisterp (char *preg_name)
{ {
const reg_entry *preg; const reg_entry *prreg;
preg = (const reg_entry *) hash_find (pregp_hash, preg_name); prreg = (const reg_entry *) hash_find (pregp_hash, preg_name);
if (preg != NULL) if (prreg != NULL)
return preg->value.preg_val; return prreg->value.preg_val;
return nullpregister; return nullpregister;
} }
@ -797,20 +797,20 @@ initialise_reg_hash_table (struct hash_control ** hash_table,
const reg_entry * register_table, const reg_entry * register_table,
const unsigned int num_entries) const unsigned int num_entries)
{ {
const reg_entry * reg; const reg_entry * rreg;
const char *hashret; const char *hashret;
if ((* hash_table = hash_new ()) == NULL) if ((* hash_table = hash_new ()) == NULL)
as_fatal (_("Virtual memory exhausted")); as_fatal (_("Virtual memory exhausted"));
for (reg = register_table; for (rreg = register_table;
reg < (register_table + num_entries); rreg < (register_table + num_entries);
reg++) rreg++)
{ {
hashret = hash_insert (* hash_table, reg->name, (char *) reg); hashret = hash_insert (* hash_table, rreg->name, (char *) rreg);
if (hashret) if (hashret)
as_fatal (_("Internal Error: Can't hash %s: %s"), as_fatal (_("Internal Error: Can't hash %s: %s"),
reg->name, hashret); rreg->name, hashret);
} }
} }
@ -1105,20 +1105,20 @@ process_label_constant (char *str, ins * cr16_ins)
static int static int
getreg_image (reg r) getreg_image (reg r)
{ {
const reg_entry *reg; const reg_entry *rreg;
char *reg_name; char *reg_name;
int is_procreg = 0; /* Nonzero means argument should be processor reg. */ int is_procreg = 0; /* Nonzero means argument should be processor reg. */
/* Check whether the register is in registers table. */ /* Check whether the register is in registers table. */
if (r < MAX_REG) if (r < MAX_REG)
reg = cr16_regtab + r; rreg = cr16_regtab + r;
else /* Register not found. */ else /* Register not found. */
{ {
as_bad (_("Unknown register: `%d'"), r); as_bad (_("Unknown register: `%d'"), r);
return 0; return 0;
} }
reg_name = reg->name; reg_name = rreg->name;
/* Issue a error message when register is illegal. */ /* Issue a error message when register is illegal. */
#define IMAGE_ERR \ #define IMAGE_ERR \
@ -1126,16 +1126,16 @@ getreg_image (reg r)
reg_name, ins_parse); \ reg_name, ins_parse); \
break; break;
switch (reg->type) switch (rreg->type)
{ {
case CR16_R_REGTYPE: case CR16_R_REGTYPE:
if (! is_procreg) if (! is_procreg)
return reg->image; return rreg->image;
else else
IMAGE_ERR; IMAGE_ERR;
case CR16_P_REGTYPE: case CR16_P_REGTYPE:
return reg->image; return rreg->image;
break; break;
default: default:
@ -1579,12 +1579,12 @@ check_cinv_options (char * operand)
static int static int
getregp_image (reg r) getregp_image (reg r)
{ {
const reg_entry *reg; const reg_entry *rreg;
char *reg_name; char *reg_name;
/* Check whether the register is in registers table. */ /* Check whether the register is in registers table. */
if (r < MAX_REG) if (r < MAX_REG)
reg = cr16_regptab + r; rreg = cr16_regptab + r;
/* Register not found. */ /* Register not found. */
else else
{ {
@ -1592,7 +1592,7 @@ getregp_image (reg r)
return 0; return 0;
} }
reg_name = reg->name; reg_name = rreg->name;
/* Issue a error message when register pair is illegal. */ /* Issue a error message when register pair is illegal. */
#define RPAIR_IMAGE_ERR \ #define RPAIR_IMAGE_ERR \
@ -1600,10 +1600,10 @@ getregp_image (reg r)
reg_name, ins_parse); \ reg_name, ins_parse); \
break; break;
switch (reg->type) switch (rreg->type)
{ {
case CR16_RP_REGTYPE: case CR16_RP_REGTYPE:
return reg->image; return rreg->image;
default: default:
RPAIR_IMAGE_ERR; RPAIR_IMAGE_ERR;
} }
@ -1618,12 +1618,12 @@ getregp_image (reg r)
static int static int
getidxregp_image (reg r) getidxregp_image (reg r)
{ {
const reg_entry *reg; const reg_entry *rreg;
char *reg_name; char *reg_name;
/* Check whether the register is in registers table. */ /* Check whether the register is in registers table. */
if (r < MAX_REG) if (r < MAX_REG)
reg = cr16_regptab + r; rreg = cr16_regptab + r;
/* Register not found. */ /* Register not found. */
else else
{ {
@ -1631,16 +1631,16 @@ getidxregp_image (reg r)
return 0; return 0;
} }
reg_name = reg->name; reg_name = rreg->name;
/* Issue a error message when register pair is illegal. */ /* Issue a error message when register pair is illegal. */
#define IDX_RPAIR_IMAGE_ERR \ #define IDX_RPAIR_IMAGE_ERR \
as_bad (_("Illegal index register pair (`%s') in Instruction: `%s'"), \ as_bad (_("Illegal index register pair (`%s') in Instruction: `%s'"), \
reg_name, ins_parse); \ reg_name, ins_parse); \
if (reg->type == CR16_RP_REGTYPE) if (rreg->type == CR16_RP_REGTYPE)
{ {
switch (reg->image) switch (rreg->image)
{ {
case 0: return 0; break; case 0: return 0; break;
case 2: return 1; break; case 2: return 1; break;
@ -1665,12 +1665,12 @@ getidxregp_image (reg r)
static int static int
getprocreg_image (reg r) getprocreg_image (reg r)
{ {
const reg_entry *reg; const reg_entry *rreg;
char *reg_name; char *reg_name;
/* Check whether the register is in registers table. */ /* Check whether the register is in registers table. */
if (r < MAX_PREG) if (r < MAX_PREG)
reg = &cr16_pregtab[r - MAX_REG]; rreg = &cr16_pregtab[r - MAX_REG];
/* Register not found. */ /* Register not found. */
else else
{ {
@ -1678,7 +1678,7 @@ getprocreg_image (reg r)
return 0; return 0;
} }
reg_name = reg->name; reg_name = rreg->name;
/* Issue a error message when register pair is illegal. */ /* Issue a error message when register pair is illegal. */
#define PROCREG_IMAGE_ERR \ #define PROCREG_IMAGE_ERR \
@ -1686,10 +1686,10 @@ getprocreg_image (reg r)
reg_name, ins_parse); \ reg_name, ins_parse); \
break; break;
switch (reg->type) switch (rreg->type)
{ {
case CR16_P_REGTYPE: case CR16_P_REGTYPE:
return reg->image; return rreg->image;
default: default:
PROCREG_IMAGE_ERR; PROCREG_IMAGE_ERR;
} }
@ -1703,7 +1703,7 @@ getprocreg_image (reg r)
static int static int
getprocregp_image (reg r) getprocregp_image (reg r)
{ {
const reg_entry *reg; const reg_entry *rreg;
char *reg_name; char *reg_name;
int pregptab_disp = 0; int pregptab_disp = 0;
@ -1725,7 +1725,7 @@ getprocregp_image (reg r)
pregptab_disp = 5; break; pregptab_disp = 5; break;
default: break; default: break;
} }
reg = &cr16_pregptab[r - pregptab_disp]; rreg = &cr16_pregptab[r - pregptab_disp];
} }
/* Register not found. */ /* Register not found. */
else else
@ -1734,7 +1734,7 @@ getprocregp_image (reg r)
return 0; return 0;
} }
reg_name = reg->name; reg_name = rreg->name;
/* Issue a error message when register pair is illegal. */ /* Issue a error message when register pair is illegal. */
#define PROCREGP_IMAGE_ERR \ #define PROCREGP_IMAGE_ERR \
@ -1742,10 +1742,10 @@ getprocregp_image (reg r)
reg_name, ins_parse); \ reg_name, ins_parse); \
break; break;
switch (reg->type) switch (rreg->type)
{ {
case CR16_P_REGTYPE: case CR16_P_REGTYPE:
return reg->image; return rreg->image;
default: default:
PROCREGP_IMAGE_ERR; PROCREGP_IMAGE_ERR;
} }

View File

@ -205,12 +205,12 @@ get_opflags (operand_type op)
static reg static reg
get_register (char *reg_name) get_register (char *reg_name)
{ {
const reg_entry *reg; const reg_entry *rreg;
reg = (const reg_entry *) hash_find (reg_hash, reg_name); rreg = (const reg_entry *) hash_find (reg_hash, reg_name);
if (reg != NULL) if (rreg != NULL)
return reg->value.reg_val; return rreg->value.reg_val;
else else
return nullregister; return nullregister;
} }
@ -220,12 +220,12 @@ get_register (char *reg_name)
static copreg static copreg
get_copregister (char *copreg_name) get_copregister (char *copreg_name)
{ {
const reg_entry *copreg; const reg_entry *coreg;
copreg = (const reg_entry *) hash_find (copreg_hash, copreg_name); coreg = (const reg_entry *) hash_find (copreg_hash, copreg_name);
if (copreg != NULL) if (coreg != NULL)
return copreg->value.copreg_val; return coreg->value.copreg_val;
else else
return nullcopregister; return nullcopregister;
} }
@ -1106,7 +1106,7 @@ get_cinv_parameters (char * operand)
static int static int
getreg_image (reg r) getreg_image (reg r)
{ {
const reg_entry *reg; const reg_entry *rreg;
char *reg_name; char *reg_name;
int is_procreg = 0; /* Nonzero means argument should be processor reg. */ int is_procreg = 0; /* Nonzero means argument should be processor reg. */
@ -1116,10 +1116,10 @@ getreg_image (reg r)
/* Check whether the register is in registers table. */ /* Check whether the register is in registers table. */
if (r < MAX_REG) if (r < MAX_REG)
reg = &crx_regtab[r]; rreg = &crx_regtab[r];
/* Check whether the register is in coprocessor registers table. */ /* Check whether the register is in coprocessor registers table. */
else if (r < MAX_COPREG) else if (r < MAX_COPREG)
reg = &crx_copregtab[r-MAX_REG]; rreg = &crx_copregtab[r-MAX_REG];
/* Register not found. */ /* Register not found. */
else else
{ {
@ -1127,7 +1127,7 @@ getreg_image (reg r)
return 0; return 0;
} }
reg_name = reg->name; reg_name = rreg->name;
/* Issue a error message when register is illegal. */ /* Issue a error message when register is illegal. */
#define IMAGE_ERR \ #define IMAGE_ERR \
@ -1135,29 +1135,29 @@ getreg_image (reg r)
reg_name, ins_parse); \ reg_name, ins_parse); \
break; break;
switch (reg->type) switch (rreg->type)
{ {
case CRX_U_REGTYPE: case CRX_U_REGTYPE:
if (is_procreg || (instruction->flags & USER_REG)) if (is_procreg || (instruction->flags & USER_REG))
return reg->image; return rreg->image;
else else
IMAGE_ERR; IMAGE_ERR;
case CRX_CFG_REGTYPE: case CRX_CFG_REGTYPE:
if (is_procreg) if (is_procreg)
return reg->image; return rreg->image;
else else
IMAGE_ERR; IMAGE_ERR;
case CRX_R_REGTYPE: case CRX_R_REGTYPE:
if (! is_procreg) if (! is_procreg)
return reg->image; return rreg->image;
else else
IMAGE_ERR; IMAGE_ERR;
case CRX_C_REGTYPE: case CRX_C_REGTYPE:
case CRX_CS_REGTYPE: case CRX_CS_REGTYPE:
return reg->image; return rreg->image;
break; break;
default: default:

View File

@ -1201,7 +1201,9 @@ find_opcode (struct d10v_opcode *opcode, expressionS myops[])
for (i = 0; opcode->operands[i + 1]; i++) for (i = 0; opcode->operands[i + 1]; i++)
{ {
int bits = d10v_operands[next_opcode->operands[opnum]].bits; int bits = d10v_operands[next_opcode->operands[opnum]].bits;
int flags = d10v_operands[next_opcode->operands[opnum]].flags;
flags = d10v_operands[next_opcode->operands[opnum]].flags;
if (flags & OPERAND_ADDR) if (flags & OPERAND_ADDR)
bits += 2; bits += 2;

Some files were not shown because too many files have changed in this diff Show More