Fix up all warnings generated by the addition of this switch.
+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>
* elfxx-mips.c (mips_elf_calculate_relocation): Correct handling
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
+ $(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.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) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
/* BFD back-end for raw ARM a.out binaries.
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)
This file is part of BFD, the Binary File Descriptor library.
unsigned int r_length;
unsigned int r_pcrel_done;
unsigned int r_neg;
- int index;
+ int howto_index;
*r_pcrel = 0;
if (bfd_header_big_endian (abfd))
r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE)
>> RELOC_STD_BITS_LENGTH_SH_LITTLE);
}
- index = r_length + 4 * r_pcrel_done + 8 * r_neg;
- if (index == 3)
+ howto_index = r_length + 4 * r_pcrel_done + 8 * r_neg;
+ if (howto_index == 3)
*r_pcrel = 1;
- return MY (howto_table) + index;
+ return MY (howto_table) + howto_index;
}
#define MY_reloc_howto(BFD, REL, IN, EX, PC) \
{
unsigned int r_length;
unsigned int r_pcrel_done;
- int index;
+ int howto_index;
*r_pcrel = 0;
if (bfd_header_big_endian (abfd))
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);
}
- index = r_length + 4 * r_pcrel_done;
- return tic30_aout_howto_table + index;
+ howto_index = r_length + 4 * r_pcrel_done;
+ return tic30_aout_howto_table + howto_index;
}
/* These macros will get 24-bit values from the bfd definition.
bfd_boolean copy)
{
bfd_boolean hash;
- bfd_size_type index;
+ bfd_size_type str_index;
/* An index of 0 always means the empty string. */
if (str == 0 || *str == '\0')
if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
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
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
static char *
get_extended_arelt_filename (bfd *arch, const char *name, file_ptr *originp)
{
- unsigned long index = 0;
+ unsigned long table_index = 0;
const char *endp;
/* Should extract string so that I can guarantee not to overflow into
the next region, but I'm too lazy. */
errno = 0;
/* Skip first char, which is '/' in SVR4 or ' ' in some other variants. */
- index = strtol (name + 1, (char **) &endp, 10);
- if (errno != 0 || index >= bfd_ardata (arch)->extended_names_size)
+ table_index = strtol (name + 1, (char **) &endp, 10);
+ if (errno != 0 || table_index >= bfd_ardata (arch)->extended_names_size)
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
else
*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
}
/* 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_generic_get_elt_at_index (bfd *abfd, symindex index)
+_bfd_generic_get_elt_at_index (bfd *abfd, symindex sym_index)
{
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);
}
/* Open the archive file given an index into the armap. */
static bfd *
-alpha_ecoff_get_elt_at_index (abfd, index)
- bfd *abfd;
- symindex index;
+alpha_ecoff_get_elt_at_index (bfd *abfd, symindex sym_index)
{
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);
}
\f
osect_vma = h->root.u.def.section->output_section->vma;
else
{
- asection *sec;
+ asection *s;
int i;
/* Sigh, the only way to get the section to offset against
is to find it the hard way. */
- for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++)
- sec = sec->next;
+ for (s = abfd->sections, i = 1; i < sym->n_scnum; i++)
+ s = s->next;
- osect_vma = sec->output_section->vma;
+ osect_vma = s->output_section->vma;
}
*addendp -= osect_vma;
osect_vma = h->root.u.def.section->output_section->vma;
else
{
- asection *sec;
+ asection *s;
int i;
/* Sigh, the only way to get the section to offset against
is to find it the hard way. */
- for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++)
- sec = sec->next;
+ for (s = abfd->sections, i = 1; i < sym->n_scnum; i++)
+ s = s->next;
- osect_vma = sec->output_section->vma;
+ osect_vma = s->output_section->vma;
}
*addendp -= osect_vma;
/* Get the BFD section from a COFF symbol section number. */
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;
- if (index == N_ABS)
+ if (section_index == N_ABS)
return bfd_abs_section_ptr;
- if (index == N_UNDEF)
+ if (section_index == N_UNDEF)
return bfd_und_section_ptr;
- if (index == N_DEBUG)
+ if (section_index == N_DEBUG)
return bfd_abs_section_ptr;
while (answer)
{
- if (answer->target_index == index)
+ if (answer->target_index == section_index)
return answer;
answer = answer->next;
}
-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.
if test "${enable_werror+set}" = set; then :
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
+ $(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.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) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
line_ptr += 2;
break;
default:
- {
- int i;
-
- /* Unknown standard opcode, ignore it. */
- for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++)
- {
- (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- }
- }
+ /* Unknown standard opcode, ignore it. */
+ for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++)
+ {
+ (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ }
+ break;
}
}
asection *sect;
bfd_vma last_vma = 0, last_dwarf = 0;
bfd_size_type amt;
- struct adjusted_section *p;
i = 0;
for (sect = abfd->sections; sect != NULL; sect = sect->next)
else
{
const char *name;
- unsigned int i;
+ unsigned int j;
static struct
{
const char * name;
name = bfd_get_section_name (abfd, bfd_get_section (sym));
- for (i = 0; i < ARRAY_SIZE (section_symndx); i++)
- if (streq (name, section_symndx[i].name))
+ for (j = 0; j < ARRAY_SIZE (section_symndx); j++)
+ if (streq (name, section_symndx[j].name))
{
- in.r_symndx = section_symndx[i].r_symndx;
+ in.r_symndx = section_symndx[j].r_symndx;
break;
}
- if (i == ARRAY_SIZE (section_symndx))
+ if (j == ARRAY_SIZE (section_symndx))
abort ();
in.r_extern = 0;
}
if (ent->set_loc)
{
/* Adjust DW_CFA_set_loc. */
- unsigned int cnt, width;
+ unsigned int cnt;
bfd_vma new_offset;
width = get_DW_EH_PE_width (ent->fde_encoding, ptr_size);
for (cnt = 1; cnt <= ent->set_loc[0]; cnt++)
{
- bfd_vma value;
buf = start + ent->set_loc[cnt];
value = read_value (abfd, buf, width,
&& ELF_ST_VISIBILITY (h->other) != STV_HIDDEN
&& h->plt.offset != (bfd_vma) -1)
{
- asection * splt;
-
splt = bfd_get_section_by_name (dynobj, ".plt");
value = (splt->output_section->vma
&& ELF_ST_VISIBILITY (h->other) != STV_HIDDEN
&& h->plt.offset != (bfd_vma) -1)
{
- asection * splt;
-
splt = bfd_get_section_by_name (dynobj, ".plt");
value = (splt->output_section->vma
case R_MN10300_GOT24:
case R_MN10300_GOT16:
{
- asection * sgot;
-
sgot = bfd_get_section_by_name (dynobj, ".got");
if (h != NULL)
}
else
{
- asection *link = NULL;
+ asection *linksec = NULL;
if (elfsec < elf_numsections (abfd))
{
this_hdr = elf_elfsections (abfd)[elfsec];
- link = this_hdr->bfd_section;
+ linksec = this_hdr->bfd_section;
}
/* PR 1991, 2008:
Some strip/objcopy may leave an incorrect value in
sh_link. We don't want to proceed. */
- if (link == NULL)
+ if (linksec == NULL)
{
(*_bfd_error_handler)
(_("%B: sh_link [%d] in section `%A' is incorrect"),
result = FALSE;
}
- elf_linked_to_section (s) = link;
+ elf_linked_to_section (s) = linksec;
}
}
}
section. */
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 elf_elfsections (abfd)[index]->bfd_section;
+ return elf_elfsections (abfd)[sec_index]->bfd_section;
}
static const struct bfd_elf_special_section special_sections_b[] =
bfd_boolean
_bfd_elf_make_section_from_phdr (bfd *abfd,
Elf_Internal_Phdr *hdr,
- int index,
+ int hdr_index,
const char *type_name)
{
asection *newsect;
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;
name = (char *) bfd_alloc (abfd, len);
if (!name)
{
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;
name = (char *) bfd_alloc (abfd, len);
if (!name)
}
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;
switch (hdr->p_type)
{
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:
- 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:
- 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:
- 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:
- 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;
if (! elf_read_notes (abfd, hdr->p_offset, hdr->p_filesz))
return FALSE;
return TRUE;
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:
- 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:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index,
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index,
"eh_frame_hdr");
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:
- return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro");
+ return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "relro");
default:
/* Check for any processor-specific program segment types. */
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");
}
}
for (sec = abfd->sections; sec; sec = sec->next)
{
- struct bfd_elf_section_data *d = elf_section_data (sec);
asection *s;
const char *name;
+ d = elf_section_data (sec);
+
i_shdrp[d->this_idx] = &d->this_hdr;
if (d->rel_idx != 0)
i_shdrp[d->rel_idx] = &d->rel_hdr;
&& CONST_STRNEQ (s->name, ".note"))
{
asection *s2;
- unsigned count = 1;
+
+ count = 1;
amt = sizeof (struct elf_segment_map);
if (s->alignment_power == 2)
for (s2 = s; s2->next != NULL; s2 = s2->next)
/* If there are any SHF_TLS output sections, add PT_TLS segment. */
if (tls_count > 0)
{
- int i;
-
amt = sizeof (struct elf_segment_map);
amt += (tls_count - 1) * sizeof (asection *);
m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
/* Mandated PF_R. */
m->p_flags = PF_R;
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);
m->sections[i] = first_tls;
_bfd_elf_section_from_bfd_section (bfd *abfd, struct bfd_section *asect)
{
const struct elf_backend_data *bed;
- unsigned int index;
+ unsigned int sec_index;
if (elf_section_data (asect) != NULL
&& elf_section_data (asect)->this_idx != 0)
return elf_section_data (asect)->this_idx;
if (bfd_is_abs_section (asect))
- index = SHN_ABS;
+ sec_index = SHN_ABS;
else if (bfd_is_com_section (asect))
- index = SHN_COMMON;
+ sec_index = SHN_COMMON;
else if (bfd_is_und_section (asect))
- index = SHN_UNDEF;
+ sec_index = SHN_UNDEF;
else
- index = SHN_BAD;
+ sec_index = SHN_BAD;
bed = get_elf_backend_data (abfd);
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))
return retval;
}
- if (index == SHN_BAD)
+ if (sec_index == SHN_BAD)
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
if (p->addend != 0)
{
char buf[30], *a;
- int len;
+
memcpy (names, "+0x", sizeof ("+0x") - 1);
names += sizeof ("+0x") - 1;
bfd_sprintf_vma (abfd, buf, p->addend);
bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
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;
if ((insn & 0x0f000e10) == 0x0e000a00) /* A data-processing insn. */
case 1: /* fnmac[sd]. */
case 2: /* fmsc[sd]. */
case 3: /* fnmsc[sd]. */
- pipe = VFP11_FMAC;
+ vpipe = VFP11_FMAC;
bfd_arm_vfp11_write_mask (destmask, fd);
regs[0] = fd;
regs[1] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */
case 5: /* fnmul[sd]. */
case 6: /* fadd[sd]. */
case 7: /* fsub[sd]. */
- pipe = VFP11_FMAC;
+ vpipe = VFP11_FMAC;
goto vfp_binop;
case 8: /* fdiv[sd]. */
- pipe = VFP11_DS;
+ vpipe = VFP11_DS;
vfp_binop:
bfd_arm_vfp11_write_mask (destmask, fd);
regs[0] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */
case 27: /* ftosiz[sd]. */
/* These instructions will not bounce due to underflow. */
*numregs = 0;
- pipe = VFP11_FMAC;
+ vpipe = VFP11_FMAC;
break;
case 3: /* fsqrt[sd]. */
/* fsqrt cannot underflow, but it can (perhaps) overwrite
registers to cause the erratum in previous instructions. */
bfd_arm_vfp11_write_mask (destmask, fd);
- pipe = VFP11_DS;
+ vpipe = VFP11_DS;
break;
case 15: /* fcvt{ds,sd}. */
*numregs = rnum;
- pipe = VFP11_FMAC;
+ vpipe = VFP11_FMAC;
}
break;
}
}
- pipe = VFP11_LS;
+ vpipe = VFP11_LS;
}
else if ((insn & 0x0e100e00) == 0x0c100a00) /* A load insn. */
{
return VFP11_BAD;
}
- pipe = VFP11_LS;
+ vpipe = VFP11_LS;
}
/* Single-register transfer. Note L==0. */
else if ((insn & 0x0f100e10) == 0x0e000a10)
break;
}
- pipe = VFP11_LS;
+ vpipe = VFP11_LS;
}
- return pipe;
+ return vpipe;
}
| (contents[i + 1] << 8)
| contents[i];
unsigned int writemask = 0;
- enum bfd_arm_vfp11_pipe pipe;
+ enum bfd_arm_vfp11_pipe vpipe;
switch (state)
{
case 0:
- pipe = bfd_arm_vfp11_insn_decode (insn, &writemask, regs,
+ vpipe = bfd_arm_vfp11_insn_decode (insn, &writemask, regs,
&numregs);
/* I'm assuming the VFP11 erratum can trigger with denorm
operands on either the FMAC or the DS pipeline. This might
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;
first_fmac = i;
case 1:
{
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_numregs);
- if (pipe != VFP11_BAD
+ if (vpipe != VFP11_BAD
&& bfd_arm_vfp11_antidependency (writemask, regs,
numregs))
state = 3;
case 2:
{
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_numregs);
- if (pipe != VFP11_BAD
+ if (vpipe != VFP11_BAD
&& bfd_arm_vfp11_antidependency (writemask, regs,
numregs))
state = 3;
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
- ascending INDEX: the function's callers are primarily responsible for
+ ascending TINDEX: the function's callers are primarily responsible for
maintaining that condition). */
static void
arm_unwind_table_edit **tail,
arm_unwind_edit_type type,
asection *linked_section,
- unsigned int index)
+ unsigned int tindex)
{
arm_unwind_table_edit *new_edit = (arm_unwind_table_edit *)
xmalloc (sizeof (arm_unwind_table_edit));
new_edit->type = type;
new_edit->linked_section = linked_section;
- new_edit->index = index;
+ new_edit->index = tindex;
- if (index > 0)
+ if (tindex > 0)
{
new_edit->next = NULL;
/* Walk all text sections in order of increasing VMA. Eilminate duplicate
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++)
{
bfd_vma veneered_insn_loc, veneer_entry_loc;
bfd_signed_vma branch_offset;
bfd *abfd;
- unsigned int index;
+ unsigned int target;
stub_entry = (struct elf32_arm_stub_hash_entry *) gen_entry;
data = (struct a8_branch_to_stub_data *) in_arg;
branch_offset = veneer_entry_loc - veneered_insn_loc - 4;
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
in elf32_arm_size_stubs if we've enabled the Cortex-A8 erratum workaround.
return FALSE;
}
- bfd_put_16 (abfd, (branch_insn >> 16) & 0xffff, &contents[index]);
- bfd_put_16 (abfd, branch_insn & 0xffff, &contents[index + 2]);
+ bfd_put_16 (abfd, (branch_insn >> 16) & 0xffff, &contents[target]);
+ bfd_put_16 (abfd, branch_insn & 0xffff, &contents[target + 2]);
return TRUE;
}
for (errnode = arm_data->erratumlist; errnode != 0;
errnode = errnode->next)
{
- bfd_vma index = errnode->vma - offset;
+ bfd_vma target = errnode->vma - offset;
switch (errnode->type)
{
| 0x0a000000;
/* The instruction is before the label. */
- index -= 4;
+ target -= 4;
/* Above offset included in -4 below. */
branch_to_veneer = errnode->u.b.veneer->vma
"range"), output_bfd);
insn |= (branch_to_veneer >> 2) & 0xffffff;
- contents[endianflip ^ index] = insn & 0xff;
- contents[endianflip ^ (index + 1)] = (insn >> 8) & 0xff;
- contents[endianflip ^ (index + 2)] = (insn >> 16) & 0xff;
- contents[endianflip ^ (index + 3)] = (insn >> 24) & 0xff;
+ contents[endianflip ^ target] = insn & 0xff;
+ contents[endianflip ^ (target + 1)] = (insn >> 8) & 0xff;
+ contents[endianflip ^ (target + 2)] = (insn >> 16) & 0xff;
+ contents[endianflip ^ (target + 3)] = (insn >> 24) & 0xff;
}
break;
/* Original instruction. */
insn = errnode->u.v.branch->u.b.vfp_insn;
- contents[endianflip ^ index] = insn & 0xff;
- contents[endianflip ^ (index + 1)] = (insn >> 8) & 0xff;
- contents[endianflip ^ (index + 2)] = (insn >> 16) & 0xff;
- contents[endianflip ^ (index + 3)] = (insn >> 24) & 0xff;
+ contents[endianflip ^ target] = insn & 0xff;
+ contents[endianflip ^ (target + 1)] = (insn >> 8) & 0xff;
+ contents[endianflip ^ (target + 2)] = (insn >> 16) & 0xff;
+ contents[endianflip ^ (target + 3)] = (insn >> 24) & 0xff;
/* Branch back to insn after original insn. */
insn = 0xea000000 | ((branch_from_veneer >> 2) & 0xffffff);
- contents[endianflip ^ (index + 4)] = insn & 0xff;
- contents[endianflip ^ (index + 5)] = (insn >> 8) & 0xff;
- contents[endianflip ^ (index + 6)] = (insn >> 16) & 0xff;
- contents[endianflip ^ (index + 7)] = (insn >> 24) & 0xff;
+ contents[endianflip ^ (target + 4)] = insn & 0xff;
+ contents[endianflip ^ (target + 5)] = (insn >> 8) & 0xff;
+ contents[endianflip ^ (target + 6)] = (insn >> 16) & 0xff;
+ contents[endianflip ^ (target + 7)] = (insn >> 24) & 0xff;
}
break;
avr_get_stub_addr (bfd_vma srel,
struct elf32_avr_link_hash_table *htab)
{
- unsigned int index;
+ unsigned int sindex;
bfd_vma stub_sec_addr =
(htab->stub_sec->output_section->vma +
htab->stub_sec->output_offset);
- for (index = 0; index < htab->amt_max_entry_cnt; index ++)
- if (htab->amt_destination_addr[index] == srel)
- return htab->amt_stub_offsets[index] + stub_sec_addr;
+ for (sindex = 0; sindex < htab->amt_max_entry_cnt; sindex ++)
+ if (htab->amt_destination_addr[sindex] == srel)
+ return htab->amt_stub_offsets[sindex] + stub_sec_addr;
/* Return an address that could not be reached by 16 bit relocs. */
return 0x020000;
if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{
/* A local symbol. */
- Elf_Internal_Sym *isym;
asection *sym_sec;
isym = isymbuf + ELF32_R_SYM (irel->r_info);
bfd_vma symval;
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_CALL)
+ && ELF32_R_TYPE (irel->r_info) != R_AVR_7_PCREL
+ && ELF32_R_TYPE (irel->r_info) != R_AVR_CALL)
continue;
/* Get the section contents if we haven't done so already. */
}
}
- /* 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)
{
isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
the linker is run. */
switch (ELF32_R_TYPE (irel->r_info))
{
- /* Try to turn a 22-bit absolute call/jump into an 13-bit
- pc-relative rcall/rjmp. */
- case R_AVR_CALL:
+ /* Try to turn a 22-bit absolute call/jump into an 13-bit
+ pc-relative rcall/rjmp. */
+ case R_AVR_CALL:
{
bfd_vma value = symval + irel->r_addend;
bfd_vma dot, gap;
vaiable avr_pc_wrap_around with the appropriate value.
I.e. 0x4000 for a 16k device. */
{
- /* Shrinking the code size makes the gaps larger in the
- case of wrap-arounds. So we use a heuristical safety
- margin to avoid that during relax the distance gets
- again too large for the short jumps. Let's assume
- a typical code-size reduction due to relax for a
- 16k device of 600 bytes. So let's use twice the
- typical value as safety margin. */
- int rgap;
- int safety_margin;
-
- int assumed_shrink = 600;
- if (avr_pc_wrap_around > 0x4000)
- assumed_shrink = 900;
-
- safety_margin = 2 * assumed_shrink;
-
- rgap = avr_relative_distance_considering_wrap_around (gap);
-
- if (rgap >= (-4092 + safety_margin)
- && rgap <= (4094 - safety_margin))
- distance_short_enough = 1;
+ /* Shrinking the code size makes the gaps larger in the
+ case of wrap-arounds. So we use a heuristical safety
+ margin to avoid that during relax the distance gets
+ again too large for the short jumps. Let's assume
+ a typical code-size reduction due to relax for a
+ 16k device of 600 bytes. So let's use twice the
+ typical value as safety margin. */
+ int rgap;
+ int safety_margin;
+
+ int assumed_shrink = 600;
+ if (avr_pc_wrap_around > 0x4000)
+ assumed_shrink = 900;
+
+ safety_margin = 2 * assumed_shrink;
+
+ rgap = avr_relative_distance_considering_wrap_around (gap);
+
+ if (rgap >= (-4092 + safety_margin)
+ && rgap <= (4094 - safety_margin))
+ distance_short_enough = 1;
}
if (distance_short_enough)
if (irel->r_offset + 3 < sec->size)
{
next_insn_msb =
- bfd_get_8 (abfd, contents + irel->r_offset + 3);
+ bfd_get_8 (abfd, contents + irel->r_offset + 3);
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 (irel->r_offset + 5 < sec->size)
{
next_insn_msb =
- bfd_get_8 (abfd, contents + irel->r_offset + 5);
+ bfd_get_8 (abfd, contents + irel->r_offset + 5);
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 (irel->r_offset + insn_size + 1 < sec->size)
{
next_insn_msb =
- bfd_get_8 (abfd, contents + irel->r_offset
- + insn_size + 1);
+ bfd_get_8 (abfd, contents + irel->r_offset
+ + insn_size + 1);
next_insn_lsb =
- bfd_get_8 (abfd, contents + irel->r_offset
- + insn_size);
+ bfd_get_8 (abfd, contents + irel->r_offset
+ + insn_size);
}
if ((0x95 == next_insn_msb) && (0x08 == next_insn_lsb))
unsigned char preceeding_msb;
unsigned char preceeding_lsb;
preceeding_msb =
- bfd_get_8 (abfd, contents + irel->r_offset - 1);
+ bfd_get_8 (abfd, contents + irel->r_offset - 1);
preceeding_lsb =
- bfd_get_8 (abfd, contents + irel->r_offset - 2);
+ bfd_get_8 (abfd, contents + irel->r_offset - 2);
/* sbic. */
if (0x99 == preceeding_msb)
/* sbrc */
if ((0xfc == (preceeding_msb & 0xfe)
- && (0x00 == (preceeding_lsb & 0x08))))
+ && (0x00 == (preceeding_lsb & 0x08))))
there_is_preceeding_non_skip_insn = 0;
/* sbrs */
if ((0xfe == (preceeding_msb & 0xfe)
- && (0x00 == (preceeding_lsb & 0x08))))
+ && (0x00 == (preceeding_lsb & 0x08))))
there_is_preceeding_non_skip_insn = 0;
/* cpse */
int deleting_ret_is_safe = 1;
unsigned int section_offset_of_ret_insn =
- irel->r_offset + insn_size;
+ irel->r_offset + insn_size;
Elf_Internal_Sym *isym, *isymend;
unsigned int sec_shndx;
isymend = isym + symtab_hdr->sh_info;
/* PR 6019: There may not be any local symbols. */
for (; isym != NULL && isym < isymend; isym++)
- {
- if (isym->st_value == section_offset_of_ret_insn
- && isym->st_shndx == sec_shndx)
- {
- deleting_ret_is_safe = 0;
- if (debug_relax)
- printf ("local label prevents deletion of ret "
- "insn at address 0x%x\n",
- (int) dot + insn_size);
- }
- }
-
- /* Now check for global symbols. */
- {
- int symcount;
- struct elf_link_hash_entry **sym_hashes;
- struct elf_link_hash_entry **end_hashes;
-
- symcount = (symtab_hdr->sh_size
- / sizeof (Elf32_External_Sym)
- - symtab_hdr->sh_info);
- sym_hashes = elf_sym_hashes (abfd);
- end_hashes = sym_hashes + symcount;
- for (; sym_hashes < end_hashes; sym_hashes++)
- {
- struct elf_link_hash_entry *sym_hash =
- *sym_hashes;
- if ((sym_hash->root.type == bfd_link_hash_defined
- || sym_hash->root.type ==
+ {
+ if (isym->st_value == section_offset_of_ret_insn
+ && isym->st_shndx == sec_shndx)
+ {
+ deleting_ret_is_safe = 0;
+ if (debug_relax)
+ printf ("local label prevents deletion of ret "
+ "insn at address 0x%x\n",
+ (int) dot + insn_size);
+ }
+ }
+
+ /* Now check for global symbols. */
+ {
+ int symcount;
+ struct elf_link_hash_entry **sym_hashes;
+ struct elf_link_hash_entry **end_hashes;
+
+ symcount = (symtab_hdr->sh_size
+ / sizeof (Elf32_External_Sym)
+ - symtab_hdr->sh_info);
+ sym_hashes = elf_sym_hashes (abfd);
+ end_hashes = sym_hashes + symcount;
+ for (; sym_hashes < end_hashes; sym_hashes++)
+ {
+ struct elf_link_hash_entry *sym_hash =
+ *sym_hashes;
+ if ((sym_hash->root.type == bfd_link_hash_defined
+ || sym_hash->root.type ==
bfd_link_hash_defweak)
- && sym_hash->root.u.def.section == sec
- && sym_hash->root.u.def.value == section_offset_of_ret_insn)
- {
- deleting_ret_is_safe = 0;
- if (debug_relax)
- printf ("global label prevents deletion of "
- "ret insn at address 0x%x\n",
- (int) dot + insn_size);
- }
- }
- }
- /* Now we check for relocations pointing to ret. */
- {
- Elf_Internal_Rela *irel;
- Elf_Internal_Rela *relend;
- Elf_Internal_Shdr *symtab_hdr;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- relend = elf_section_data (sec)->relocs
- + sec->reloc_count;
-
- for (irel = elf_section_data (sec)->relocs;
- irel < relend; irel++)
- {
- bfd_vma reloc_target = 0;
- bfd_vma symval;
- Elf_Internal_Sym *isymbuf = NULL;
-
- /* Read this BFD's local symbols if we haven't
- done so already. */
- if (isymbuf == NULL && symtab_hdr->sh_info != 0)
- {
- isymbuf = (Elf_Internal_Sym *)
- symtab_hdr->contents;
- if (isymbuf == NULL)
- isymbuf = bfd_elf_get_elf_syms
- (abfd,
- symtab_hdr,
- symtab_hdr->sh_info, 0,
- NULL, NULL, NULL);
- if (isymbuf == NULL)
- break;
- }
-
- /* Get the value of the symbol referred to
- by the reloc. */
- if (ELF32_R_SYM (irel->r_info)
- < symtab_hdr->sh_info)
- {
- /* A local symbol. */
- Elf_Internal_Sym *isym;
- asection *sym_sec;
-
- isym = isymbuf
- + ELF32_R_SYM (irel->r_info);
- sym_sec = bfd_section_from_elf_index
- (abfd, isym->st_shndx);
- symval = isym->st_value;
-
- /* If the reloc is absolute, it will not
- have a symbol or section associated
- with it. */
-
- if (sym_sec)
- {
- symval +=
- sym_sec->output_section->vma
- + sym_sec->output_offset;
- reloc_target = symval + irel->r_addend;
- }
- else
- {
- reloc_target = symval + irel->r_addend;
- /* Reference symbol is absolute. */
- }
- }
- /* else ... reference symbol is extern. */
-
- if (address_of_ret == reloc_target)
- {
- deleting_ret_is_safe = 0;
- if (debug_relax)
- printf ("ret from "
- "rjmp/jmp ret sequence at address"
- " 0x%x could not be deleted. ret"
- " is target of a relocation.\n",
- (int) address_of_ret);
- }
- }
- }
-
- if (deleting_ret_is_safe)
- {
- if (debug_relax)
- printf ("unreachable ret instruction "
- "at address 0x%x deleted.\n",
- (int) dot + insn_size);
-
- /* Delete two bytes of data. */
- if (!elf32_avr_relax_delete_bytes (abfd, sec,
- irel->r_offset + insn_size, 2))
- goto error_return;
-
- /* That will change things, so, we should relax
- again. Note that this is not required, and it
- may be slow. */
- *again = TRUE;
- break;
- }
+ && sym_hash->root.u.def.section == sec
+ && sym_hash->root.u.def.value == section_offset_of_ret_insn)
+ {
+ deleting_ret_is_safe = 0;
+ if (debug_relax)
+ printf ("global label prevents deletion of "
+ "ret insn at address 0x%x\n",
+ (int) dot + insn_size);
+ }
+ }
+ }
+ /* Now we check for relocations pointing to ret. */
+ {
+ Elf_Internal_Rela *rel;
+ Elf_Internal_Rela *relend;
+
+ relend = elf_section_data (sec)->relocs
+ + sec->reloc_count;
+
+ for (rel = elf_section_data (sec)->relocs;
+ rel < relend; rel++)
+ {
+ bfd_vma reloc_target = 0;
+
+ /* Read this BFD's local symbols if we haven't
+ done so already. */
+ if (isymbuf == NULL && symtab_hdr->sh_info != 0)
+ {
+ isymbuf = (Elf_Internal_Sym *)
+ symtab_hdr->contents;
+ if (isymbuf == NULL)
+ isymbuf = bfd_elf_get_elf_syms
+ (abfd,
+ symtab_hdr,
+ symtab_hdr->sh_info, 0,
+ NULL, NULL, NULL);
+ if (isymbuf == NULL)
+ break;
+ }
+
+ /* Get the value of the symbol referred to
+ by the reloc. */
+ if (ELF32_R_SYM (rel->r_info)
+ < symtab_hdr->sh_info)
+ {
+ /* A local symbol. */
+ asection *sym_sec;
+
+ isym = isymbuf
+ + ELF32_R_SYM (rel->r_info);
+ sym_sec = bfd_section_from_elf_index
+ (abfd, isym->st_shndx);
+ symval = isym->st_value;
+
+ /* If the reloc is absolute, it will not
+ have a symbol or section associated
+ with it. */
+
+ if (sym_sec)
+ {
+ symval +=
+ sym_sec->output_section->vma
+ + sym_sec->output_offset;
+ reloc_target = symval + rel->r_addend;
+ }
+ else
+ {
+ reloc_target = symval + rel->r_addend;
+ /* Reference symbol is absolute. */
+ }
+ }
+ /* else ... reference symbol is extern. */
+
+ if (address_of_ret == reloc_target)
+ {
+ deleting_ret_is_safe = 0;
+ if (debug_relax)
+ printf ("ret from "
+ "rjmp/jmp ret sequence at address"
+ " 0x%x could not be deleted. ret"
+ " is target of a relocation.\n",
+ (int) address_of_ret);
+ }
+ }
+ }
+
+ if (deleting_ret_is_safe)
+ {
+ if (debug_relax)
+ printf ("unreachable ret instruction "
+ "at address 0x%x deleted.\n",
+ (int) dot + insn_size);
+
+ /* Delete two bytes of data. */
+ if (!elf32_avr_relax_delete_bytes (abfd, sec,
+ irel->r_offset + insn_size, 2))
+ goto error_return;
+
+ /* That will change things, so, we should relax
+ again. Note that this is not required, and it
+ may be slow. */
+ *again = TRUE;
+ break;
+ }
}
}
{
/* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
.plt section. */
- struct elf_link_hash_entry *h;
struct bfd_link_hash_entry *bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
unsigned short r_type = howto->type;
bfd_byte *hit_data = contents + offset;
bfd_vma reloc_bits, check, Rvalue1;
-
bfd * dynobj;
bfd_vma * local_got_offsets;
- asection * sgot;
dynobj = elf_hash_table (info)->dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
- sgot = NULL;
-
-
switch (r_type)
{
case R_CR16_IMM4:
easily. Oh well. */
void **vpp;
asection *s;
- Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache,
abfd, r_symndx);
Elf_Internal_Shdr *hdr,
asection *sec)
{
- register const char *name;
+ const char *name;
name = bfd_get_section_name (abfd, sec);
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
- int dr_type, indx;
+ int dr_type;
asection *sreloc;
if (htab->elf.srelgot == NULL)
Elf_Internal_Rela outrel;
asection *sreloc;
bfd_byte *loc;
- int indx;
outrel.r_offset = rel->r_offset
+ input_section->output_section->vma
/* 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.
This file is part of BFD, the Binary File Descriptor library.
bfd_byte *contents)
{
bfd_byte code[4];
- int index = 0;
+ int table_index = 0;
/* Check current page-jmp. */
if (addr + 4 > sec->size)
ip2k_get_mem (abfd, contents + addr - 4, 4, code);
if ((IS_ADD_W_WREG_OPCODE (code + 0))
&& (IS_ADD_PCL_W_OPCODE (code + 2)))
- return index;
+ return table_index;
if ((! IS_PAGE_OPCODE (code + 0))
|| (! IS_JMP_OPCODE (code + 2)))
return -1;
- index++;
+ table_index++;
addr -= 4;
}
}
bfd_byte *contents)
{
bfd_byte code[16];
- int index = 0;
+ int table_index = 0;
/* Check current page-jmp. */
if (addr + 4 > sec->size)
&& (IS_INC_1SP_OPCODE (code + 10))
&& (IS_PAGE_OPCODE (code + 12))
&& (IS_JMP_OPCODE (code + 14)))
- return index;
+ return table_index;
if ((IS_ADD_W_WREG_OPCODE (code + 2))
&& (IS_SNC_OPCODE (code + 4))
&& (IS_SNC_OPCODE (code + 10))
&& (IS_INC_1SP_OPCODE (code + 12))
&& (IS_JMP_OPCODE (code + 14)))
- return index;
+ return table_index;
if ((! IS_PAGE_OPCODE (code + 0))
|| (! IS_JMP_OPCODE (code + 2)))
return -1;
- index++;
+ table_index++;
addr -= 4;
}
}
if (r != bfd_reloc_ok)
{
- const char *name;
const char *msg = NULL;
arelent bfd_reloc;
- reloc_howto_type *howto;
lm32_info_to_howto_rela (input_bfd, &bfd_reloc, rel);
howto = bfd_reloc.howto;
input_bfd = input_bfd->link_next, bfd_indx++)
{
Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Sym *local_syms;
struct elf_link_hash_entry ** sym_hashes;
sym_hashes = elf_sym_hashes (input_bfd);
bfd_byte *free_contents = NULL;
int rel_count;
unsigned int shndx;
- int i, index;
+ int i, sym_index;
asection *o;
struct elf_link_hash_entry *sym_hash;
Elf_Internal_Sym *isymbuf, *isymend;
0, NULL, NULL, NULL);
BFD_ASSERT (isymbuf != NULL);
- internal_relocs = _bfd_elf_link_read_relocs
- (abfd, sec, NULL, NULL, link_info->keep_memory);
+ internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, link_info->keep_memory);
if (internal_relocs == NULL)
goto error_return;
if (! link_info->keep_memory)
if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{
/* A local symbol. */
- Elf_Internal_Sym *isym;
asection *sym_sec;
isym = isymbuf + ELF32_R_SYM (irel->r_info);
range to be adjusted, and hence must be changed. */
if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{
- Elf_Internal_Sym *isym;
isym = isymbuf + ELF32_R_SYM (irel->r_info);
/* Only handle relocs against .text. */
if (isym->st_shndx == shndx
/* Look through all other sections. */
for (o = abfd->sections; o != NULL; o = o->next)
{
- Elf_Internal_Rela *internal_relocs;
+ Elf_Internal_Rela *irelocs;
Elf_Internal_Rela *irelscan, *irelscanend;
bfd_byte *ocontents;
/* We always cache the relocs. Perhaps, if info->keep_memory is
FALSE, we should free them, if we are permitted to. */
- internal_relocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, TRUE);
- if (internal_relocs == NULL)
+ irelocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, TRUE);
+ if (irelocs == NULL)
goto error_return;
ocontents = NULL;
- irelscanend = internal_relocs + o->reloc_count;
- for (irelscan = internal_relocs; irelscan < irelscanend; irelscan++)
+ irelscanend = irelocs + o->reloc_count;
+ for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
{
if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
{
/* Now adjust the global symbols defined in this section. */
isym = isymbuf + symtab_hdr->sh_info;
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
&& (sym_hash->root.type == bfd_link_hash_defined
|| sym_hash->root.type == bfd_link_hash_defweak)
|| !h->def_regular)))
{
struct ppc_elf_dyn_relocs *p;
- struct ppc_elf_dyn_relocs **head;
+ struct ppc_elf_dyn_relocs **rel_head;
#ifdef DEBUG
fprintf (stderr,
relocations we need for this symbol. */
if (h != NULL)
{
- head = &ppc_elf_hash_entry (h)->dyn_relocs;
+ rel_head = &ppc_elf_hash_entry (h)->dyn_relocs;
}
else
{
s = sec;
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)
{
p = bfd_alloc (htab->elf.dynobj, sizeof *p);
if (p == NULL)
return FALSE;
- p->next = *head;
- *head = p;
+ p->next = *rel_head;
+ *rel_head = p;
p->sec = sec;
p->count = 0;
p->pc_count = 0;
local_plt = (struct plt_entry **) end_local_got;
end_local_plt = local_plt + locsymcount;
lgot_masks = (char *) end_local_plt;
+
for (; local_got < end_local_got; ++local_got, ++lgot_masks)
if (*local_got > 0)
{
for (ent = *local_plt; ent != NULL; ent = ent->next)
if (ent->plt.refcount > 0)
{
- asection *s = htab->iplt;
+ s = htab->iplt;
if (!doneone)
{
for (irel = internal_relocs; irel < irelend; irel++)
{
unsigned long r_type = ELF32_R_TYPE (irel->r_info);
- bfd_vma reladdr, toff, roff;
+ bfd_vma toff, roff;
asection *tsec;
struct one_fixup *f;
size_t insn_offset = 0;
continue;
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 (tsec != bfd_und_section_ptr
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
Elf_Internal_Rela outrel;
- bfd_byte *loc;
asection *got2, *sreloc = NULL;
bfd_vma *local_got_offsets;
bfd_boolean ret = TRUE;
reloc_howto_type *howto;
unsigned long r_symndx;
bfd_vma relocation;
- bfd_vma branch_bit, insn, from;
+ bfd_vma branch_bit, from;
bfd_boolean unresolved_reloc;
bfd_boolean warned;
unsigned int tls_type, tls_mask, tls_gd;
&& (tls_mask & TLS_TPREL) == 0)
{
bfd_vma insn;
+
insn = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset);
insn &= 31 << 21;
insn |= 0x3c020000; /* addis 0,2,0 */
/* Branch not taken prediction relocations. */
case R_PPC_ADDR14_BRNTAKEN:
case R_PPC_REL14_BRNTAKEN:
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
- insn &= ~BRANCH_PREDICT_BIT;
- insn |= branch_bit;
+ {
+ bfd_vma insn;
- from = (rel->r_offset
- + input_section->output_offset
- + input_section->output_section->vma);
+ insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
+ insn &= ~BRANCH_PREDICT_BIT;
+ insn |= branch_bit;
- /* Invert 'y' bit if not the default. */
- if ((bfd_signed_vma) (relocation + rel->r_addend - from) < 0)
- insn ^= BRANCH_PREDICT_BIT;
+ from = (rel->r_offset
+ + input_section->output_offset
+ + input_section->output_section->vma);
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
- break;
+ /* Invert 'y' bit if not the default. */
+ 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;
|| h->root.type != bfd_link_hash_undefweak))
{
asection *rsec = htab->relgot;
+ bfd_byte * loc;
outrel.r_offset = (htab->got->output_section->vma
+ htab->got->output_offset
&& !h->def_regular))
{
int skip;
-
+ bfd_byte * loc;
#ifdef DEBUG
fprintf (stderr, "ppc_elf_relocate_section needs to "
"create relocation for %s\n",
}
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 = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT);
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
\f
static bfd_vma
get_symbol_value (const char * name,
- bfd_reloc_status_type * stat,
+ bfd_reloc_status_type * status,
struct bfd_link_info * info,
bfd * input_bfd,
asection * input_section,
if (h == NULL
|| (h->type != bfd_link_hash_defined
&& h->type != bfd_link_hash_defweak))
- * stat = info->callbacks->undefined_symbol
+ * status = info->callbacks->undefined_symbol
(info, name, input_bfd, input_section, offset, TRUE);
else
value = (h->u.def.value
}
static bfd_vma
-get_gp (bfd_reloc_status_type * stat,
+get_gp (bfd_reloc_status_type * status,
struct bfd_link_info * info,
bfd * abfd,
asection * sec,
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;
}
return cached_value;
}
static bfd_vma
-get_romstart (bfd_reloc_status_type * stat,
+get_romstart (bfd_reloc_status_type * status,
struct bfd_link_info * info,
bfd * abfd,
asection * sec,
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;
}
return cached_value;
}
static bfd_vma
-get_ramstart (bfd_reloc_status_type * stat,
+get_ramstart (bfd_reloc_status_type * status,
struct bfd_link_info * info,
bfd * abfd,
asection * sec,
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;
}
return cached_value;
else if (code == 1 && symval/scale <= 31
/* Decodable bits. */
&& (insn[0] & 0xcc) == 0xcc
- /* width */
+ /* Width. */
&& (insn[0] & 0x30) != 3
- /* register MSBs */
+ /* Register MSBs. */
&& (insn[1] & 0x88) == 0x00)
{
int newrel = 0;
static bfd_vma
score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h)
{
- bfd_vma index;
+ bfd_vma got_index;
asection *sgot;
struct score_got_info *g;
long global_got_dynindx = 0;
indices into the GOT. That makes it easy to calculate the GOT
offset. */
BFD_ASSERT (h->dynindx >= global_got_dynindx);
- index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd));
- BFD_ASSERT (index < sgot->size);
+ got_index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd));
+ BFD_ASSERT (got_index < sgot->size);
- return index;
+ return got_index;
}
/* Returns the offset for the entry at the INDEXth position in the GOT. */
+
static bfd_vma
-score_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd,
- bfd *input_bfd ATTRIBUTE_UNUSED, bfd_vma index)
+score_elf_got_offset_from_index (bfd *dynobj,
+ bfd *output_bfd,
+ bfd *input_bfd ATTRIBUTE_UNUSED,
+ bfd_vma got_index)
{
asection *sgot;
bfd_vma gp;
g = score_elf_got_info (dynobj, &sgot);
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
static bfd_vma
score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h)
{
- bfd_vma index;
+ bfd_vma got_index;
asection *sgot;
struct score_got_info *g;
long global_got_dynindx = 0;
indices into the GOT. That makes it easy to calculate the GOT
offset. */
BFD_ASSERT (h->dynindx >= global_got_dynindx);
- index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd));
- BFD_ASSERT (index < sgot->size);
+ got_index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd));
+ BFD_ASSERT (got_index < sgot->size);
- return index;
+ return got_index;
}
/* Returns the offset for the entry at the INDEXth position in the GOT. */
static bfd_vma
-score_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd,
- bfd *input_bfd ATTRIBUTE_UNUSED, bfd_vma index)
+score_elf_got_offset_from_index (bfd *dynobj,
+ bfd *output_bfd,
+ bfd *input_bfd ATTRIBUTE_UNUSED,
+ bfd_vma got_index)
{
asection *sgot;
bfd_vma gp;
g = score_elf_got_info (dynobj, &sgot);
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
if (r_type == R_SCORE_GOT15)
{
- const Elf_Internal_Rela *relend;
const Elf_Internal_Rela *lo16_rel;
const struct elf_backend_data *bed;
bfd_vma lo_addend = 0, lo_value = 0;
/* Do the inverse operation. */
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
{
struct elf_sh_link_hash_table *htab;
flagword flags, pltflags;
- register asection *s;
+ asection *s;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
int ptralign = 0;
}
else
{
- int index;
+ int target;
/* IE->LE transition:
mov.l 1f,r0; stc gbr,rN; mov.l @(r0,r12),rM;
}
BFD_ASSERT ((insn & 0xff00) == 0xd000);
- index = insn & 0x00ff;
+ target = insn & 0x00ff;
insn = bfd_get_16 (input_bfd, contents + offset + 2);
BFD_ASSERT ((insn & 0xf0ff) == 0x0012);
insn = bfd_get_16 (input_bfd, contents + offset + 4);
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, 0x0009, contents + offset + 4);
}
struct call_info *call, *pasty;
struct _spu_elf_section_data *sec_data;
struct spu_elf_stack_info *sinfo;
- int k;
+ unsigned int k;
/* See whether we can add this section to the current
overlay without overflowing our overlay buffer. */
{
/* Pasted sections must stay together, so add their
sizes too. */
- struct call_info *pasty = find_pasted_call (sec);
+ pasty = find_pasted_call (sec);
while (pasty != NULL)
{
struct function_info *call_fun = pasty->fun;
pasty = NULL;
sec_data = spu_elf_section_data (sec);
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)
if (call->is_pasted)
{
num_stubs = 0;
for (call = dummy_caller.call_list; call; call = call->next)
{
- unsigned int k;
unsigned int stub_delta = 1;
if (htab->params->ovly_flavour == ovly_soft_icache)
if ((*p)->p_type == PT_LOAD && (*p)->count == 1
&& spu_elf_section_data ((*p)->sections[0])->u.o.ovl_index != 0)
{
- struct elf_segment_map *m = *p;
+ m = *p;
*p = m->next;
*p_overlay = m;
p_overlay = &m->next;
Elf32_External_Sym *extsyms;
Elf32_External_Sym *esym;
Elf32_External_Sym *esymend;
- int index;
+ int sym_index;
unsigned int sec_shndx;
bfd_byte *contents;
Elf_Internal_Rela *irel;
esym = extsyms + symtab_hdr->sh_info;
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;
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
&& ((sym_hash)->root.type == bfd_link_hash_defined
if (!is_weak_undef)
{
/* Check for windowed CALL across a 1GB boundary. */
- xtensa_opcode opcode =
- get_expanded_call_opcode (contents + address,
- input_size - address, 0);
+ opcode = get_expanded_call_opcode (contents + address,
+ input_size - address, 0);
if (is_windowed_call_opcode (opcode))
{
if ((self_address >> CALL_SEGMENT_BITS)
if (r_type == R_XTENSA_ASM_SIMPLIFY)
{
- char *error_message = NULL;
+ error_message = NULL;
/* Convert ASM_SIMPLIFY into the simpler relocation
so that they never escape a relaxing link. */
r = contract_asm_expansion (contents, input_size, rel,
for (n = 0; n < num; n++)
{
- bfd_boolean remove = FALSE;
+ bfd_boolean remove_entry = FALSE;
if (table[n].size == 0)
- remove = TRUE;
- else if (n > 0 &&
- (table[n-1].address + table[n-1].size == table[n].address))
+ remove_entry = TRUE;
+ else if (n > 0
+ && (table[n-1].address + table[n-1].size == table[n].address))
{
table[n-1].size += table[n].size;
- remove = TRUE;
+ remove_entry = TRUE;
}
- if (remove)
+ if (remove_entry)
{
for (m = n; m < num - 1; m++)
{
}
/* Support HP specific sections for core files. */
+
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)
{
if (hdr->p_type == PT_HP_CORE_KERNEL)
{
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;
sect = bfd_make_section_anyway (abfd, ".kernel");
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;
/* GDB uses the ".reg" section to read register contents. */
|| hdr->p_type == PT_HP_CORE_MMF)
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
asection **secp,
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:
*secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");
/* No relocs implies we are linking a --just-symbols object. */
if (opd_sec->reloc_count == 0)
{
- bfd_vma val;
-
if (!bfd_get_section_contents (opd_bfd, opd_sec, &val, offset, 8))
return (bfd_vma) -1;
for (ent = *local_plt; ent != NULL; ent = ent->next)
if (ent->plt.refcount > 0)
{
- asection *s = htab->iplt;
-
+ s = htab->iplt;
ent->plt.offset = s->size;
s->size += PLT_ENTRY_SIZE;
? h->elf.type == STT_GNU_IFUNC
: ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)))
{
- Elf_Internal_Rela outrel;
bfd_boolean skip, relocate;
asection *sreloc;
- bfd_byte *loc;
bfd_vma out_off;
/* When generating a dynamic object, these relocations
if (h->needs_copy)
{
- Elf_Internal_Rela rela;
- bfd_byte *loc;
-
/* This symbol needs a copy reloc. Set it up. */
if (h->dynindx == -1
easily. Oh well. */
asection *s;
void **vpp;
- Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache,
abfd, r_symndx);
static bfd_boolean
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)
{
- *index = SHN_X86_64_LCOMMON;
+ *index_return = SHN_X86_64_LCOMMON;
return TRUE;
}
return FALSE;
_bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{
flagword flags;
- register asection *s;
+ asection *s;
const struct elf_backend_data *bed;
if (! is_elf_hash_table (info->hash))
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;
(*bed->elf_backend_hide_symbol) (info, h, TRUE);
}
was referenced before. */
if (h->ref_regular)
{
- const struct elf_backend_data *bed
- = get_elf_backend_data (abfd);
struct elf_link_hash_entry *vh = *sym_hash;
+
vh->root.type = h->root.type;
h->root.type = bfd_link_hash_indirect;
(*bed->elf_backend_copy_indirect_symbol) (info, vh, h);
/* Handle the case where we had a versioned symbol in a dynamic
library and now find a definition in a normal object. In this
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.u.undef.abfd = h->root.u.undef.abfd;
h->root.type = bfd_link_hash_indirect;
bfd_boolean emit_relocs;
bfd *dynobj;
struct elf_final_link_info finfo;
- register asection *o;
- register struct bfd_link_order *p;
- register bfd *sub;
+ asection *o;
+ struct bfd_link_order *p;
+ bfd *sub;
bfd_size_type max_contents_size;
bfd_size_type max_external_reloc_size;
bfd_size_type max_internal_reloc_count;
if (size == 0
&& (sec->flags & SEC_HAS_CONTENTS) == 0)
{
- struct bfd_link_order *o = sec->map_tail.link_order;
- if (o != NULL)
- size = o->offset + o->size;
+ struct bfd_link_order *ord = sec->map_tail.link_order;
+
+ if (ord != NULL)
+ size = ord->offset + ord->size;
}
end = sec->vma + size;
}
elfNN_ia64_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr,
asection *sec)
{
- register const char *name;
+ const char *name;
name = bfd_get_section_name (abfd, sec);
unsigned int count)
{
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);
/* Find the next duplicate. SRC will be kept. */
prev = info [src].addend;
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)
{
/* Make sure that got_offset is valid. */
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
a valid got_offset. */
if (got_offset != (bfd_vma) -1)
- info [dup - 1].got_offset = got_offset;
+ info [dupes - 1].got_offset = got_offset;
break;
}
- got_offset = info [dup].got_offset;
+ got_offset = info [dupes].got_offset;
prev = curr;
}
/* How much to move. */
- len = dup - src;
- i = dup + 1;
+ len = dupes - src;
+ 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
one. There must be at least a duplicate. Find the
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)
break;
offset. */
prev = info [diff].addend;
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)
{
/* For duplicates, make sure that GOT_OFFSET
is valid. */
if (got_offset == (bfd_vma) -1)
- got_offset = info [dup].got_offset;
+ got_offset = info [dupes].got_offset;
break;
}
- got_offset = info [dup].got_offset;
+ got_offset = info [dupes].got_offset;
prev = curr;
diff++;
}
Elf_Internal_Rela outrel;
bfd_byte *loc;
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);
/* 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;
loc = plt_sec->contents + dyn_i->plt_offset;
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);
plt_addr = (plt_sec->output_section->vma
PLT relocations. */
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));
bfd_elfNN_swap_reloca_out (output_bfd, &outrel, loc);
}
/* Map an input bfd to a got in a multi-got link. */
-struct mips_elf_bfd2got_hash {
+struct mips_elf_bfd2got_hash
+{
bfd *bfd;
struct mips_got_info *g;
};
int r_type, struct bfd_link_info *info)
{
struct mips_elf_link_hash_table *htab;
- bfd_vma index;
+ bfd_vma got_index;
struct mips_got_info *g, *gg;
long global_got_dynindx = 0;
+ h->root.u.def.section->output_offset
+ h->root.u.def.section->output_section->vma);
- index = mips_tls_got_index (abfd, hm->tls_got_offset, &hm->tls_type,
- r_type, info, hm, value);
+ got_index = mips_tls_got_index (abfd, hm->tls_got_offset, &hm->tls_type,
+ r_type, info, hm, value);
}
else
{
indices into the GOT. That makes it easy to calculate the GOT
offset. */
BFD_ASSERT (h->dynindx >= global_got_dynindx);
- index = ((h->dynindx - global_got_dynindx + g->local_gotno)
- * MIPS_ELF_GOT_SIZE (abfd));
+ got_index = ((h->dynindx - global_got_dynindx + g->local_gotno)
+ * 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
mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
bfd_vma value, bfd_vma *offsetp)
{
- bfd_vma page, index;
+ bfd_vma page, got_index;
struct mips_got_entry *entry;
page = (value + 0x8000) & ~(bfd_vma) 0xffff;
if (!entry)
return MINUS_ONE;
- index = entry->gotidx;
+ got_index = entry->gotidx;
if (offsetp)
*offsetp = value - entry->d.address;
- return index;
+ return got_index;
}
/* Find a local GOT entry for an R_MIPS*_GOT16 relocation against VALUE.
static bfd_vma
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;
asection *sgot;
gp = _bfd_get_gp_value (output_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
{
Elf_Internal_Rela outrel;
asection *s;
- bfd_byte *loc;
+ bfd_byte *rloc;
bfd_vma got_address;
s = mips_elf_rel_dyn_section (info, FALSE);
+ htab->sgot->output_offset
+ 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_info = ELF32_R_INFO (STN_UNDEF, R_MIPS_32);
outrel.r_addend = value;
- bfd_elf32_swap_reloca_out (abfd, &outrel, loc);
+ bfd_elf32_swap_reloca_out (abfd, &outrel, rloc);
}
return *loc;
if (!mips_elf_add_lo16_rel_addend (input_bfd, rel, relend,
contents, &addend))
{
- const char *name;
-
if (h)
name = h->root.root.string;
else
&& (howto->type == R_MIPS_GPREL16
|| howto->type == R_MIPS_LITERAL))
{
- const char *msg =
- _("small-data section exceeds 64KB;"
- " lower small-data size limit (see option -G)");
+ msg = _("small-data section exceeds 64KB;"
+ " lower small-data size limit (see option -G)");
htab->small_data_overflow_reported = TRUE;
(*info->callbacks->einfo) ("%P: %s\n", msg);
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;
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),
sgot->contents
- + index++ * MIPS_ELF_GOT_SIZE (output_bfd));
+ + got_index++ * MIPS_ELF_GOT_SIZE (output_bfd));
if (! info->shared)
continue;
- while (index < g->assigned_gotno)
+ while (got_index < g->assigned_gotno)
{
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
(output_bfd, info, rel, NULL,
bfd_abs_section_ptr,
}
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
-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 bfd_vma
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)
{
- return ELF64_R_INFO (index,
+ return ELF64_R_INFO (rel_index,
(in_rel ?
ELF64_R_TYPE_INFO (ELF64_R_TYPE_DATA (in_rel->r_info),
type) : type));
static bfd_vma
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
{
unsigned char *entry = splt->contents + offset;
const unsigned int nop = SPARC_NOP;
- int index;
+ int plt_index;
if (offset < (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE))
{
*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
| (((splt->contents + PLT64_ENTRY_SIZE) - (entry + 4)) / 4 & 0x7ffff);
ofs = offset % block_size;
- index = (PLT64_LARGE_THRESHOLD +
+ plt_index = (PLT64_LARGE_THRESHOLD +
(block * 160) +
(ofs / insn_chunk_size));
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. */
unsigned int c;
struct bfd_hash_entry *hashp;
unsigned int len;
- unsigned int index;
+ unsigned int _index;
hash = 0;
len = 0;
hash += len + (len << 17);
hash ^= hash >> 2;
- index = hash % table->size;
- for (hashp = table->table[index];
+ _index = hash % table->size;
+ for (hashp = table->table[_index];
hashp != NULL;
hashp = hashp->next)
{
unsigned long hash)
{
struct bfd_hash_entry *hashp;
- unsigned int index;
+ unsigned int _index;
hashp = (*table->newfunc) (NULL, table, string);
if (hashp == NULL)
return NULL;
hashp->string = string;
hashp->hash = hash;
- index = hash % table->size;
- hashp->next = table->table[index];
- table->table[index] = hashp;
+ _index = hash % table->size;
+ hashp->next = table->table[_index];
+ table->table[_index] = hashp;
table->count++;
if (!table->frozen && table->count > table->size * 3 / 4)
chain_end = chain_end->next;
table->table[hi] = chain_end->next;
- index = chain->hash % newsize;
- chain_end->next = newtable[index];
- newtable[index] = chain;
+ _index = chain->hash % newsize;
+ chain_end->next = newtable[_index];
+ newtable[_index] = chain;
}
table->table = newtable;
table->size = newsize;
struct bfd_hash_entry *old,
struct bfd_hash_entry *nw)
{
- unsigned int index;
+ unsigned int _index;
struct bfd_hash_entry **pph;
- index = old->hash % table->size;
- for (pph = &table->table[index];
+ _index = old->hash % table->size;
+ for (pph = &table->table[_index];
(*pph) != NULL;
pph = &(*pph)->next)
{
{
251, 509, 1021, 2039, 4051, 8599, 16699, 32749
};
- size_t index;
+ size_t _index;
/* Work out best prime number near the hash_size. */
- for (index = 0; index < ARRAY_SIZE (hash_size_primes) - 1; ++index)
- if (hash_size <= hash_size_primes[index])
+ for (_index = 0; _index < ARRAY_SIZE (hash_size_primes) - 1; ++_index)
+ if (hash_size <= hash_size_primes[_index])
break;
- bfd_default_hash_table_size = hash_size_primes[index];
+ bfd_default_hash_table_size = hash_size_primes[_index];
}
\f
/* A few different object file formats (a.out, COFF, ELF) use a string
bfd_vma value,
asymbol *symbol,
bfd_boolean pcrel,
- unsigned int index)
+ unsigned int sindex)
{
unsigned int term_count = 0;
/* Subtract the pc from here by asking for PC of this section. */
if (! ieee_write_byte (abfd, ieee_variable_P_enum)
|| ! 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))
return FALSE;
}
}
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;
asection **n;
c = ieee->section_table_size;
if (c == 0)
c = 20;
- while (c <= index)
+ while (c <= sindex)
c *= 2;
amt = 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);
asection *section;
if (!tmp)
return NULL;
- sprintf (tmp, " fsec%4d", index);
+ sprintf (tmp, " fsec%4d", sindex);
section = bfd_make_section (abfd, tmp);
- ieee->section_table[index] = section;
- section->target_index = index;
- ieee->section_table[index] = section;
+ ieee->section_table[sindex] = section;
+ section->target_index = sindex;
+ ieee->section_table[sindex] = section;
}
- return ieee->section_table[index];
+ return ieee->section_table[sindex];
}
static void
/* Assorted BFD support routines, only used internally.
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.
Written by Cygnus Support.
bytes = bits / 8;
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;
}
}
bytes = bits / 8;
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;
for (i = 0; i < mdata->nsects; i++)
{
bfd_mach_o_section *sec = mdata->sections[i];
- unsigned int j, first, last;
- bfd_mach_o_symtab_command *symtab = mdata->symtab;
+ unsigned int first, last;
bfd_vma addr;
bfd_vma entry_size;
void
bfd_mach_o_print_symbol (bfd *abfd,
- PTR afile,
+ void * afile,
asymbol *symbol,
bfd_print_symbol_type how)
{
fprintf (file, "%s", symbol->name);
break;
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)
name = bfd_get_stab_name (asym->n_type);
else
bfd_h_put_32 (abfd, header->reserved, buf + 28);
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 TRUE;
bfd_h_put_32 (abfd, (cmd->flavours[i].size / 4), buf + 4);
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;
offset += cmd->flavours[i].size + 8;
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)
return FALSE;
}
bfd_h_put_32 (abfd, section->reserved1, buf + 60);
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)
return -1;
bfd_h_put_32 (abfd, section->reserved2, buf + 72);
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)
return -1;
bfd_h_put_32 (abfd, seg->flags, buf + 44);
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))
return -1;
bfd_h_put_32 (abfd, seg->flags, buf + 60);
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))
return -1;
for (i = 0; i < sym->nsyms; i++)
{
- unsigned char buf[16];
- bfd_size_type index;
+ bfd_size_type str_index;
bfd_mach_o_asymbol *s = (bfd_mach_o_asymbol *)symbols[i];
/* Compute name index. */
/* An index of 0 always means the empty string. */
if (s->symbol.name == 0 || s->symbol.name[0] == '\0')
- index = 0;
+ str_index = 0;
else
{
- index = _bfd_stringtab_add (strtab, s->symbol.name, TRUE, FALSE);
- if (index == (bfd_size_type) -1)
+ str_index = _bfd_stringtab_add (strtab, s->symbol.name, TRUE, FALSE);
+ if (str_index == (bfd_size_type) -1)
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_sect, buf + 5);
bfd_h_put_16 (abfd, s->n_desc, buf + 6);
else
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;
}
sym->strsize = _bfd_stringtab_size (strtab);
bfd_h_put_32 (abfd, sym->strsize, buf + 12);
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 TRUE;
bfd_h_put_32 (abfd, cur->len, buf + 4);
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;
switch (cur->type)
/* Just read the magic number. */
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 4, abfd) != 4)
+ || bfd_bread ((void *) buf, 4, abfd) != 4)
return FALSE;
if (bfd_getb32 (buf) == BFD_MACH_O_MH_MAGIC)
BFD_MACH_O_HEADER_64_SIZE : BFD_MACH_O_HEADER_SIZE;
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, size, abfd) != size)
+ || bfd_bread ((void *) buf, size, abfd) != size)
return FALSE;
header->cputype = (*get32) (buf + 4);
unsigned char buf[BFD_MACH_O_SECTION_SIZE];
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))
return -1;
unsigned char buf[BFD_MACH_O_SECTION_64_SIZE];
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))
return -1;
BFD_ASSERT (sym->strtab != NULL);
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",
symwidth, (unsigned long) symoff);
return -1;
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);
return -1;
unsigned long i)
{
unsigned long isymoff = dysym->indirectsymoff + (i * 4);
- unsigned long symindex;
+ unsigned long sym_index;
unsigned char buf[4];
BFD_ASSERT (i < dysym->nindirectsyms);
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",
(unsigned long) 4, isymoff);
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 *
|| (command->type == BFD_MACH_O_LC_LOAD_DYLINKER));
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;
nameoff = bfd_h_get_32 (abfd, buf + 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;
nameoff = bfd_h_get_32 (abfd, buf + 0);
return -1;
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;
offset += 8 + bfd_h_get_32 (abfd, buf + 4) * 4;
return -1;
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;
cmd->flavours[nflavours].flavour = bfd_h_get_32 (abfd, buf);
BFD_ASSERT (command->type == BFD_MACH_O_LC_DYSYMTAB);
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;
cmd->ilocalsym = bfd_h_get_32 (abfd, buf + 0);
if (cmd->nmodtab != 0)
{
- char buf[56];
unsigned int i;
int wide = bfd_mach_o_wide_p (abfd);
unsigned int module_len = wide ? 56 : 52;
bfd_mach_o_dylib_module *module = &cmd->dylib_module[i];
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;
module->module_name_idx = bfd_h_get_32 (abfd, buf + 0);
if (cmd->ntoc != 0)
{
- char buf[8];
unsigned int i;
cmd->dylib_toc = bfd_alloc
{
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;
toc->symbol_index = bfd_h_get_32 (abfd, buf + 0);
if (cmd->nindirectsyms != 0)
{
- char buf[4];
unsigned int i;
cmd->indirect_syms = bfd_alloc
{
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;
*is = bfd_h_get_32 (abfd, buf + 0);
if (cmd->nextrefsyms != 0)
{
- char buf[4];
unsigned long v;
unsigned int 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;
/* Fields isym and flags are written as bit-fields, thus we need
BFD_ASSERT (command->type == BFD_MACH_O_LC_SYMTAB);
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;
symtab->symoff = bfd_h_get_32 (abfd, buf);
BFD_ASSERT (command->type == BFD_MACH_O_LC_UUID);
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;
sname = bfd_alloc (abfd, strlen (prefix) + 1);
char buf[8];
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;
cmd->dataoff = bfd_get_32 (abfd, buf + 0);
unsigned long off;
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;
off = bfd_get_32 (abfd, buf + 0);
if (cmd->str == NULL)
return -1;
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 0;
}
char buf[40];
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;
cmd->rebase_off = bfd_get_32 (abfd, buf + 0);
BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT_64);
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;
memcpy (seg->segname, buf, 16);
BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT);
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;
memcpy (seg->segname, buf, 16);
/* Read command type and length. */
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;
command->type = bfd_h_get_32 (abfd, buf) & ~BFD_MACH_O_LC_REQ_DYLD;
unsigned long i;
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bread ((PTR) buf, 8, abfd) != 8)
+ || bfd_bread ((void *) buf, 8, abfd) != 8)
goto error;
adata = bfd_alloc (abfd, sizeof (mach_o_fat_data_struct));
for (i = 0; i < adata->nfat_arch; i++)
{
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;
adata->archentries[i].cputype = bfd_getb32 (buf);
adata->archentries[i].cpusubtype = bfd_getb32 (buf + 4);
}
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);
FILE *file = (FILE *) ptr;
case BFD_MACH_O_LC_UUID:
{
bfd_mach_o_uuid_command *uuid = &cmd->command.uuid;
- unsigned int i;
+ unsigned int j;
- for (i = 0; i < sizeof (uuid->uuid); i++)
- fprintf (file, " %02x", uuid->uuid[i]);
+ for (j = 0; j < sizeof (uuid->uuid); j ++)
+ fprintf (file, " %02x", uuid->uuid[j]);
fputc ('\n', file);
}
break;
sec_merge_hash_lookup (struct sec_merge_hash *table, const char *string,
unsigned int alignment, bfd_boolean create)
{
- register const unsigned char *s;
- register unsigned long hash;
- register unsigned int c;
+ const unsigned char *s;
+ unsigned long hash;
+ unsigned int c;
struct sec_merge_hash_entry *hashp;
unsigned int len, i;
- unsigned int index;
+ unsigned int _index;
hash = 0;
len = 0;
len = table->entsize;
}
- index = hash % table->table.size;
- for (hashp = (struct sec_merge_hash_entry *) table->table.table[index];
+ _index = hash % table->table.size;
+ for (hashp = (struct sec_merge_hash_entry *) table->table.table[_index];
hashp != NULL;
hashp = (struct sec_merge_hash_entry *) hashp->root.next)
{
sec_merge_add (struct sec_merge_hash *tab, const char *str,
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);
if (entry == NULL)
/* Support for 32-bit SPARC NLM (NetWare Loadable Module)
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.
arelent *rel)
{
bfd_vma val, addend;
- unsigned int index;
+ unsigned int howto_index;
unsigned int type;
struct nlm32_sparc_reloc_ext tmp_reloc;
asection *code_sec, *data_sec;
rel->addend = addend;
rel->howto = NULL;
- for (index = 0;
- index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
- index++)
- if (nlm32_sparc_howto_table[index].type == type)
+ for (howto_index = 0;
+ howto_index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
+ howto_index++)
+ 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;
}
{
bfd_vma val;
struct nlm32_sparc_reloc_ext tmp_reloc;
- unsigned int index;
+ unsigned int howto_index;
int type = -1;
reloc_howto_type *tmp;
- for (index = 0;
- index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
- index++)
+ for (howto_index = 0;
+ howto_index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
+ howto_index++)
{
- tmp = &nlm32_sparc_howto_table[index];
+ tmp = &nlm32_sparc_howto_table[howto_index];
if (tmp->rightshift == rel->howto->rightshift
&& tmp->size == rel->howto->size
{
unsigned int count;
asymbol **generic = bfd_get_outsymbols (abfd);
- unsigned int index = 0;
+ unsigned int sym_index = 0;
for (count = 0; count < bfd_get_symcount (abfd); count++)
{
if (bfd_is_com_section (g->section))
{
symbol.relb = RELOCATION_TYPE_COM;
- H_PUT_16 (abfd, index, symbol.refno);
- index++;
+ H_PUT_16 (abfd, sym_index, symbol.refno);
+ sym_index++;
}
else if (bfd_is_abs_section (g->section))
{
else if (bfd_is_und_section (g->section))
{
symbol.relb = RELOCATION_TYPE_UND;
- H_PUT_16 (abfd, index, symbol.refno);
- /* Overload the value field with the output index number */
- index++;
+ H_PUT_16 (abfd, sym_index, symbol.refno);
+ /* Overload the value field with the output sym_index number */
+ sym_index++;
}
else if (g->flags & BSF_DEBUGGING)
/* Throw it away. */
name[0]) + l))
return FALSE;
}
- g->value = index - 1;
+ g->value = sym_index - 1;
}
return TRUE;
bfd *
bfd_openr_iovec (const char *filename, const char *target,
- void *(*open) (struct bfd *nbfd,
- void *open_closure),
+ void *(*_open) (struct bfd *, void *),
void *open_closure,
- file_ptr (*pread) (struct bfd *abfd,
- void *stream,
- void *buf,
- file_ptr nbytes,
- file_ptr offset),
- int (*close) (struct bfd *nbfd,
- void *stream),
- int (*stat) (struct bfd *abfd,
- void *stream,
- struct stat *sb))
+ file_ptr (*_pread) (struct bfd *, void *, void *, file_ptr,
+ file_ptr),
+ int (*_close) (struct bfd *, void *),
+ int (*_stat) (struct bfd *, void *, struct stat *))
{
bfd *nbfd;
const bfd_target *target_vec;
nbfd->direction = read_direction;
/* `open (...)' would get expanded by an the open(2) syscall macro. */
- stream = (*open) (nbfd, open_closure);
+ stream = (*_open) (nbfd, open_closure);
if (stream == NULL)
{
_bfd_delete_bfd (nbfd);
vec = (struct opncls *) bfd_zalloc (nbfd, sizeof (struct opncls));
vec->stream = stream;
- vec->pread = pread;
- vec->close = close;
- vec->stat = stat;
+ vec->pread = _pread;
+ vec->close = _close;
+ vec->stat = _stat;
nbfd->iovec = &opncls_iovec;
nbfd->iostream = vec;
static char *
find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
{
- char *basename;
+ char *base;
char *dir;
char *debugfile;
char *canon_dir;
return NULL;
}
- basename = get_debug_link_info (abfd, & crc32);
- if (basename == NULL)
+ base = get_debug_link_info (abfd, & crc32);
+ if (base == NULL)
return NULL;
- if (basename[0] == '\0')
+ if (base[0] == '\0')
{
- free (basename);
+ free (base);
bfd_set_error (bfd_error_no_debug_section);
return NULL;
}
dir = (char *) bfd_malloc (dirlen + 1);
if (dir == NULL)
{
- free (basename);
+ free (base);
return NULL;
}
memcpy (dir, abfd->filename, dirlen);
bfd_malloc (strlen (debug_file_directory) + 1
+ (canon_dirlen > dirlen ? canon_dirlen : dirlen)
+ strlen (".debug/")
- + strlen (basename)
+ + strlen (base)
+ 1);
if (debugfile == NULL)
{
- free (basename);
+ free (base);
free (dir);
free (canon_dir);
return NULL;
/* First try in the same directory as the original file: */
strcpy (debugfile, dir);
- strcat (debugfile, basename);
+ strcat (debugfile, base);
if (separate_debug_file_exists (debugfile, crc32))
{
- free (basename);
+ free (base);
free (dir);
free (canon_dir);
return debugfile;
/* Then try in a subdirectory called .debug. */
strcpy (debugfile, dir);
strcat (debugfile, ".debug/");
- strcat (debugfile, basename);
+ strcat (debugfile, base);
if (separate_debug_file_exists (debugfile, crc32))
{
- free (basename);
+ free (base);
free (dir);
free (canon_dir);
return debugfile;
&& canon_dir[0] != '/')
strcat (debugfile, "/");
strcat (debugfile, canon_dir);
- strcat (debugfile, basename);
+ strcat (debugfile, base);
if (separate_debug_file_exists (debugfile, crc32))
{
- free (basename);
+ free (base);
free (dir);
free (canon_dir);
return debugfile;
}
free (debugfile);
- free (basename);
+ free (base);
free (dir);
free (canon_dir);
return NULL;
bfd_boolean copy)
{
bfd_boolean hash;
- bfd_size_type index;
+ bfd_size_type str_index;
/* An index of 0 always means the empty string. */
if (str == 0 || *str == '\0')
if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
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
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
bfd_size_type i;
bfd_size_type start, stop;
int onaline = PDATA_ROW_SIZE;
- struct sym_cache sym_cache = {0, 0} ;
+ struct sym_cache cache = {0, 0} ;
if (section == NULL
|| coff_section_data (abfd, section) == NULL
fprintf (file, "%08x", (unsigned int) eh_data);
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)
fprintf (file, " (%s) ", s);
free (data);
- cleanup_syms (& sym_cache);
+ cleanup_syms (& cache);
return TRUE;
#undef PDATA_ROW_SIZE
asymbol **csym)
{
const char *const sprefix = "__stub_";
-
size_t codepos = 0;
unsigned long count = 0;
-
bfd_pef_loader_header header;
bfd_pef_imported_library *libraries = NULL;
bfd_pef_imported_symbol *imports = NULL;
-
unsigned long i;
int ret;
asymbol sym;
const char *symname;
char *name;
- unsigned long index;
- int ret;
+ unsigned long sym_index;
if (csym && (csym[count] == NULL))
break;
if ((codepos + 4) > codelen)
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)
{
codepos += 24;
continue;
}
- if (index >= header.total_imported_symbol_count)
+ if (sym_index >= header.total_imported_symbol_count)
{
codepos += 24;
continue;
size_t max, namelen;
const char *s;
- if (loaderlen < (header.loader_strings_offset + imports[index].name))
+ if (loaderlen < (header.loader_strings_offset + imports[sym_index].name))
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 += header.loader_strings_offset + imports[index].name;
+ symname += header.loader_strings_offset + imports[sym_index].name;
namelen = 0;
for (s = symname; s < (symname + max); s++)
{
for (j = 0; j < esdids; j++)
{
- int esdid = *srcp++;
+ int id = *srcp++;
- if (esdid)
+ if (id)
{
int rn = EDATA (abfd, otr->esdid - 1).relocs++;
EDATA (abfd, otr->esdid - 1).section->relocation + rn;
n->address = dst_idx;
- n->sym_ptr_ptr = (asymbol **) (size_t) esdid;
+ n->sym_ptr_ptr = (asymbol **) (size_t) id;
n->addend = 0;
n->howto = versados_howto_table + ((j & 1) * 2) + (sizeinwords - 1);
}
if (symbol->flags & BSF_FUNCTION)
{
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);
if (en_sym == 0)
of debug info in the DST section, as well as the count of
program sections (i.e. address spans) it contains. */
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);
ptr += DBG_S_C_DMT_HEADER_SIZE;
#if VMS_DEBUG
_bfd_vms_debug (3, "module: modbeg = %d, size = %d, count = %d\n",
- modbeg, size, count);
+ modbeg, msize, count);
#endif
/* We create a 'module' structure for each program section since
int length = bfd_getl32 (ptr + DBG_S_L_DMT_PSECT_LENGTH);
module = new_module (abfd);
module->modbeg = modbeg;
- module->size = size;
+ module->size = msize;
module->low = start;
module->high = start + length;
module->next = list;
/* Start ETIR record for section #index at virtual addr offset. */
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)
{
/* Push start offset. */
_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_flush (abfd);
}
/* 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
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;
if (name [0] && name[1] == 'v' && !strcmp (name, ".vmsdebug"))
start_another_etbt_record (abfd);
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 */
if (size > ssize) /* more than what's left ? */
if (section_count > PRIV (section_count))
{
- bfd_size_type amt = section_count;
+ amt = section_count;
amt *= sizeof (asection *);
PRIV (sections) = bfd_realloc_or_free (PRIV (sections), amt);
if (PRIV (sections) == NULL)
dnl Common configure.in fragment
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,
[ --enable-werror treat compile warnings as errors],
bfd_xcoff_split_import_path (bfd *abfd, const char *filename,
const char **imppath, const char **impfile)
{
- const char *basename;
+ const char *base;
size_t length;
char *path;
- basename = lbasename (filename);
- length = basename - filename;
+ base = lbasename (filename);
+ length = base - filename;
if (length == 0)
/* The filename has no directory component, so use an empty path. */
*imppath = "";
path[length - 1] = 0;
*imppath = path;
}
- *impfile = basename;
+ *impfile = base;
return TRUE;
}
compute_offset (unsigned long first_page,
unsigned long page_size,
unsigned long entry_size,
- unsigned long index)
+ unsigned long sym_index)
{
unsigned long entries_per_page = page_size / entry_size;
- unsigned long page_number = first_page + (index / entries_per_page);
- unsigned long page_offset = (index % entries_per_page) * entry_size;
+ unsigned long page_number = first_page + (sym_index / entries_per_page);
+ unsigned long page_offset = (sym_index % entries_per_page) * entry_size;
return (page_number * page_size) + page_offset;
}
int
bfd_sym_fetch_resources_table_entry (bfd *abfd,
bfd_sym_resources_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_resources_table_entry *);
unsigned long offset;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
offset = compute_offset (sdata->header.dshb_rte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
int
bfd_sym_fetch_modules_table_entry (bfd *abfd,
bfd_sym_modules_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_modules_table_entry *);
unsigned long offset;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
offset = compute_offset (sdata->header.dshb_mte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
int
bfd_sym_fetch_file_references_table_entry (bfd *abfd,
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 *);
unsigned long offset;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
offset = compute_offset (sdata->header.dshb_frte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
int
bfd_sym_fetch_contained_modules_table_entry (bfd *abfd,
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 *);
unsigned long offset;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
offset = compute_offset (sdata->header.dshb_cmte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
int
bfd_sym_fetch_contained_variables_table_entry (bfd *abfd,
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 *);
unsigned long offset;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
offset = compute_offset (sdata->header.dshb_cvte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
int
bfd_sym_fetch_contained_statements_table_entry (bfd *abfd,
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 *);
unsigned long offset;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
offset = compute_offset (sdata->header.dshb_csnte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
int
bfd_sym_fetch_contained_labels_table_entry (bfd *abfd,
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 *);
unsigned long offset;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
offset = compute_offset (sdata->header.dshb_clte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
int
bfd_sym_fetch_contained_types_table_entry (bfd *abfd,
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 *);
unsigned long offset;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
offset = compute_offset (sdata->header.dshb_ctte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
int
bfd_sym_fetch_file_references_index_table_entry (bfd *abfd,
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 *);
unsigned long offset;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
offset = compute_offset (sdata->header.dshb_fite.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
int
bfd_sym_fetch_constant_pool_entry (bfd *abfd,
bfd_sym_constant_pool_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_constant_pool_entry *);
unsigned long offset;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return -1;
switch (sdata->version)
offset = compute_offset (sdata->header.dshb_fite.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
int
bfd_sym_fetch_type_table_entry (bfd *abfd,
bfd_sym_type_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
void (*parser) (unsigned char *, size_t, bfd_sym_type_table_entry *);
unsigned long offset;
offset = compute_offset (sdata->header.dshb_tte.dti_first_page,
sdata->header.dshb_page_size,
- entry_size, index);
+ entry_size, sym_index);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
int
bfd_sym_fetch_type_table_information (bfd *abfd,
bfd_sym_type_information_table_entry *entry,
- unsigned long index)
+ unsigned long sym_index)
{
bfd_sym_type_table_entry tindex;
bfd_sym_data_struct *sdata = NULL;
if (sdata->header.dshb_tte.dti_object_count <= 99)
return -1;
- if (index < 100)
+ if (sym_index < 100)
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;
if (bfd_sym_fetch_type_information_table_entry (abfd, entry, tindex) < 0)
return -1;
}
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_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
- if (index == 0)
+ if (sym_index == 0)
return (const unsigned char *) "";
- index *= 2;
- if ((index / sdata->header.dshb_page_size)
+ sym_index *= 2;
+ if ((sym_index / sdata->header.dshb_page_size)
> sdata->header.dshb_nte.dti_page_count)
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 *
-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;
- 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 bfd_sym_symbol_name (abfd, entry.mte_nte_index);
FILE *f,
unsigned char *entry)
{
- unsigned long index;
+ unsigned long sym_index;
unsigned long offset;
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
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)
{
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;
}
else
{
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)
offset = entry[0] + 2;
bfd_sym_display_type_information_table (bfd *abfd, FILE *f)
{
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_data_struct *sdata = NULL;
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);
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]");
else
bfd_sym_print_type_information_table_entry (abfd, f, &entry);
/* 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.
uint32 test_val, orig_val;
intop = get_operand (intisa, opc, opnd);
- if (!intop) return -1;
+ if (!intop)
+ return -1;
if (!intop->encode)
{
/* 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,
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;
int slot_id;
was successfully encoded is to decode it and check if it matches
the original value. */
orig_val = *valp;
- if ((*intop->encode) (valp) ||
- (test_val = *valp, (*intop->decode) (&test_val)) ||
- test_val != orig_val)
+ if ((*intop->encode) (valp)
+ || (test_val = *valp, (*intop->decode) (&test_val))
+ || test_val != orig_val)
{
xtisa_errno = xtensa_isa_bad_value;
sprintf (xtisa_error_msg, "cannot encode operand value 0x%08x", *valp);
+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>
* addr2line.c (pretty_print): New variable.
rcparse.h rcparse.c $(srcdir)/../depcomp $(srcdir)/../ylwrap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
+ $(top_srcdir)/../config/zlib.m4 \
$(top_srcdir)/../bfd/warning.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
$(top_srcdir)/../config/iconv.m4 \
+ $(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/lib-ld.m4 \
$(top_srcdir)/../config/lib-link.m4 \
{
/* Move this file to the end of the list - first cut from
where it is. */
- bfd *link;
+ bfd *link_bfd;
*current_ptr_ptr = current_ptr->archive_next;
/* Now glue to end */
after_bfd = get_pos_bfd (&arch->archive_next, pos_end, NULL);
- link = *after_bfd;
+ link_bfd = *after_bfd;
*after_bfd = current_ptr;
- current_ptr->archive_next = link;
+ current_ptr->archive_next = link_bfd;
if (verbose)
printf ("m - %s\n", *files_to_move);
PROGRAM:file: bfd-error-message
PROGRAM:file[section]: 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
bfd_nonfatal_message (const char *filename,
- const bfd *bfd, const asection *section,
+ const bfd *abfd,
+ const asection *section,
const char *format, ...)
{
const char *errmsg = bfd_errmsg (bfd_get_error ());
va_start (args, format);
fprintf (stderr, "%s", program_name);
- if (bfd)
+ if (abfd)
{
if (!filename)
- filename = bfd_get_archive_filename (bfd);
+ filename = bfd_get_archive_filename (abfd);
if (section)
- section_name = bfd_get_section_name (bfd, section);
+ section_name = bfd_get_section_name (abfd, section);
}
if (section_name)
fprintf (stderr, ":%s[%s]", filename, section_name);
/* coffgrok.c
- Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2007
- Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2007, 2009 Free Software Foundation, Inc.
This file is part of GNU Binutils.
/*int l;*/
static void
-push_scope (int link)
+push_scope (int slink)
{
struct coff_scope *n = empty_scope ();
- if (link)
+
+ if (slink)
{
if (top_scope)
{
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.
if test "${enable_werror+set}" = set; then :
}
static const char *
-rvaafter (int machine)
+rvaafter (int mach)
{
- switch (machine)
+ switch (mach)
{
case MARM:
case M386:
break;
default:
/* xgettext:c-format */
- fatal (_("Internal error: Unknown machine type: %d"), machine);
+ fatal (_("Internal error: Unknown machine type: %d"), mach);
break;
}
return "";
}
static const char *
-rvabefore (int machine)
+rvabefore (int mach)
{
- switch (machine)
+ switch (mach)
{
case MARM:
case M386:
return ".rva\t";
default:
/* xgettext:c-format */
- fatal (_("Internal error: Unknown machine type: %d"), machine);
+ fatal (_("Internal error: Unknown machine type: %d"), mach);
break;
}
return "";
}
static const char *
-asm_prefix (int machine, const char *name)
+asm_prefix (int mach, const char *name)
{
- switch (machine)
+ switch (mach)
{
case MARM:
case MPPC:
return "_";
default:
/* xgettext:c-format */
- fatal (_("Internal error: Unknown machine type: %d"), machine);
+ fatal (_("Internal error: Unknown machine type: %d"), mach);
break;
}
return "";
import_list. It is used by def_import. */
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)
{
iheadtype **pq;
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->functail->next = xmalloc (sizeof (ifunctype));
}
q = xmalloc (sizeof (iheadtype));
- q->dllname = xstrdup (dll_name);
+ q->dllname = xstrdup (dllname);
q->nfuncs = 1;
q->funchead = xmalloc (sizeof (ifunctype));
q->functail = q->funchead;
/* 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.
Contributed by Mumit Khan (khan@xraylith.wisc.edu).
appropriate. */
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;
char *cmd;
cmd = xmalloc (strlen (prefix)
- + strlen (prog_name)
+ + strlen (progname)
#ifdef HAVE_EXECUTABLE_SUFFIX
+ strlen (EXECUTABLE_SUFFIX)
#endif
+ 10);
strcpy (cmd, prefix);
- sprintf (cmd + end_prefix, "%s", prog_name);
+ sprintf (cmd + end_prefix, "%s", progname);
if (strchr (cmd, '/') != NULL)
{
if (! def_file_seen)
{
- int i;
dyn_string_t step_pre1;
step_pre1 = dyn_string_new (1024);
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
+ $(top_srcdir)/../config/zlib.m4 \
$(top_srcdir)/../bfd/warning.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
$(top_srcdir)/../config/iconv.m4 \
+ $(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/lib-ld.m4 \
$(top_srcdir)/../config/lib-link.m4 \
static 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;
- 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);
- attr = next;
+ attr = next_attr;
}
- free (abbrev);
- abbrev = next;
+ free (abbrv);
+ abbrv = next_abbrev;
}
last_abbrev = first_abbrev = NULL;
if (form == DW_FORM_data4 || form == DW_FORM_data8)
{
/* 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;
- if (max == 0 || num >= max)
+ if (lmax == 0 || num >= lmax)
{
- max += 1024;
+ lmax += 1024;
debug_info_p->loc_offsets = (long unsigned int *)
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 *)
xcrealloc (debug_info_p->have_frame_base,
- max, sizeof (*debug_info_p->have_frame_base));
- debug_info_p->max_loc_offsets = max;
+ lmax, sizeof (*debug_info_p->have_frame_base));
+ debug_info_p->max_loc_offsets = lmax;
}
debug_info_p->loc_offsets [num] = uvalue;
debug_info_p->have_frame_base [num] = have_frame_base;
if (form == DW_FORM_data4 || form == DW_FORM_data8)
{
/* 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;
- if (max == 0 || num >= max)
+ if (lmax == 0 || num >= lmax)
{
- max += 1024;
+ lmax += 1024;
debug_info_p->range_lists = (long unsigned int *)
xcrealloc (debug_info_p->range_lists,
- max, sizeof (*debug_info_p->range_lists));
- debug_info_p->max_range_lists = max;
+ lmax, sizeof (*debug_info_p->range_lists));
+ debug_info_p->max_range_lists = lmax;
}
debug_info_p->range_lists [num] = uvalue;
debug_info_p->num_range_lists++;
while (data < end)
{
- DWARF2_Internal_LineInfo info;
+ DWARF2_Internal_LineInfo linfo;
unsigned char *standard_opcodes;
unsigned char *end_of_sequence;
unsigned char *hdrptr;
hdroff = hdrptr - start;
/* Check the length of the block. */
- info.li_length = byte_get (hdrptr, 4);
+ linfo.li_length = byte_get (hdrptr, 4);
hdrptr += 4;
- if (info.li_length == 0xffffffff)
+ if (linfo.li_length == 0xffffffff)
{
/* This section is 64-bit DWARF 3. */
- info.li_length = byte_get (hdrptr, 8);
+ linfo.li_length = byte_get (hdrptr, 8);
hdrptr += 8;
offset_size = 8;
initial_length_size = 12;
initial_length_size = 4;
}
- if (info.li_length + initial_length_size > section->size)
+ if (linfo.li_length + initial_length_size > section->size)
{
warn
(_("The information in section %s appears to be corrupt - the section is too small\n"),
}
/* Check its version number. */
- info.li_version = byte_get (hdrptr, 2);
+ linfo.li_version = byte_get (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"));
return 0;
}
- info.li_prologue_length = byte_get (hdrptr, offset_size);
+ linfo.li_prologue_length = byte_get (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++;
- info.li_default_is_stmt = byte_get (hdrptr, 1);
+ linfo.li_default_is_stmt = byte_get (hdrptr, 1);
hdrptr++;
- info.li_line_base = byte_get (hdrptr, 1);
+ linfo.li_line_base = byte_get (hdrptr, 1);
hdrptr++;
- info.li_line_range = byte_get (hdrptr, 1);
+ linfo.li_line_range = byte_get (hdrptr, 1);
hdrptr++;
- info.li_opcode_base = byte_get (hdrptr, 1);
+ linfo.li_opcode_base = byte_get (hdrptr, 1);
hdrptr++;
/* Sign extend the line base field. */
- info.li_line_base <<= 24;
- info.li_line_base >>= 24;
+ linfo.li_line_base <<= 24;
+ linfo.li_line_base >>= 24;
printf (_(" Offset: 0x%lx\n"), hdroff);
- printf (_(" Length: %ld\n"), info.li_length);
- printf (_(" DWARF Version: %d\n"), info.li_version);
- printf (_(" Prologue Length: %d\n"), info.li_prologue_length);
- printf (_(" Minimum Instruction Length: %d\n"), info.li_min_insn_length);
- printf (_(" Initial value of 'is_stmt': %d\n"), info.li_default_is_stmt);
- printf (_(" Line Base: %d\n"), info.li_line_base);
- printf (_(" Line Range: %d\n"), info.li_line_range);
- printf (_(" Opcode Base: %d\n"), info.li_opcode_base);
+ printf (_(" Length: %ld\n"), linfo.li_length);
+ printf (_(" DWARF Version: %d\n"), linfo.li_version);
+ printf (_(" Prologue Length: %d\n"), linfo.li_prologue_length);
+ printf (_(" Minimum Instruction Length: %d\n"), linfo.li_min_insn_length);
+ printf (_(" Initial value of 'is_stmt': %d\n"), linfo.li_default_is_stmt);
+ printf (_(" Line Base: %d\n"), linfo.li_line_base);
+ printf (_(" Line Range: %d\n"), linfo.li_line_range);
+ 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. */
standard_opcodes = hdrptr;
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]);
/* 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)
printf (_("\n The Directory Table is empty.\n"));
op_code = *data++;
- if (op_code >= info.li_opcode_base)
+ if (op_code >= linfo.li_opcode_base)
{
- op_code -= info.li_opcode_base;
- uladv = (op_code / info.li_line_range) * info.li_min_insn_length;
+ op_code -= linfo.li_opcode_base;
+ uladv = (op_code / linfo.li_line_range) * linfo.li_min_insn_length;
state_machine_regs.address += uladv;
printf (_(" Special opcode %d: advance Address by %lu to 0x%lx"),
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;
printf (_(" and Line by %d to %d\n"),
adv, state_machine_regs.line);
else switch (op_code)
{
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;
case DW_LNS_copy:
case DW_LNS_advance_pc:
uladv = read_leb128 (data, & bytes_read, 0);
- uladv *= info.li_min_insn_length;
+ uladv *= linfo.li_min_insn_length;
data += bytes_read;
state_machine_regs.address += uladv;
printf (_(" Advance PC by %lu to 0x%lx\n"), uladv,
break;
case DW_LNS_const_add_pc:
- uladv = (((255 - info.li_opcode_base) / info.li_line_range)
- * info.li_min_insn_length);
+ uladv = (((255 - linfo.li_opcode_base) / linfo.li_line_range)
+ * linfo.li_min_insn_length);
state_machine_regs.address += uladv;
printf (_(" Advance PC by constant %lu to 0x%lx\n"), uladv,
state_machine_regs.address);
while (data < end)
{
/* This loop amounts to one iteration per compilation unit. */
- DWARF2_Internal_LineInfo info;
+ DWARF2_Internal_LineInfo linfo;
unsigned char *standard_opcodes;
unsigned char *end_of_sequence;
unsigned char *hdrptr;
(section 6.2.4 in the Dwarf3 doc). */
/* 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;
- if (info.li_length == 0xffffffff)
+ if (linfo.li_length == 0xffffffff)
{
/* This section is 64-bit DWARF 3. */
- info.li_length = byte_get (hdrptr, 8);
+ linfo.li_length = byte_get (hdrptr, 8);
hdrptr += 8;
offset_size = 8;
initial_length_size = 12;
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 - "
"the section is too small\n"));
}
/* 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;
- 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"));
return 0;
}
- info.li_prologue_length = byte_get (hdrptr, offset_size);
+ linfo.li_prologue_length = byte_get (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++;
- info.li_default_is_stmt = byte_get (hdrptr, 1);
+ linfo.li_default_is_stmt = byte_get (hdrptr, 1);
hdrptr++;
- info.li_line_base = byte_get (hdrptr, 1);
+ linfo.li_line_base = byte_get (hdrptr, 1);
hdrptr++;
- info.li_line_range = byte_get (hdrptr, 1);
+ linfo.li_line_range = byte_get (hdrptr, 1);
hdrptr++;
- info.li_opcode_base = byte_get (hdrptr, 1);
+ linfo.li_opcode_base = byte_get (hdrptr, 1);
hdrptr++;
/* Sign extend the line base field. */
- info.li_line_base <<= 24;
- info.li_line_base >>= 24;
+ linfo.li_line_base <<= 24;
+ linfo.li_line_base >>= 24;
/* 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. */
standard_opcodes = hdrptr;
/* 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)
{
unsigned int n_directories = 0;
unsigned char *ptr_directory_table = data;
- int i;
while (*data != 0)
{
{
unsigned int n_files = 0;
unsigned char *ptr_file_name_table = data;
- int i;
while (*data != 0)
{
op_code = *data++;
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;
- uladv = (op_code / info.li_line_range) * info.li_min_insn_length;
+ op_code -= linfo.li_opcode_base;
+ uladv = (op_code / linfo.li_line_range) * linfo.li_min_insn_length;
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;
is_special_opcode = 1;
}
case DW_LNS_extended_op:
{
unsigned int ext_op_code_len;
- unsigned int bytes_read;
unsigned char ext_op_code;
unsigned char *op_code_data = data;
switch (ext_op_code)
{
case DW_LNE_end_sequence:
- reset_state_machine (info.li_default_is_stmt);
+ reset_state_machine (linfo.li_default_is_stmt);
break;
case DW_LNE_set_address:
state_machine_regs.address =
case DW_LNS_advance_pc:
uladv = read_leb128 (data, & bytes_read, 0);
- uladv *= info.li_min_insn_length;
+ uladv *= linfo.li_min_insn_length;
data += bytes_read;
state_machine_regs.address += uladv;
break;
break;
case DW_LNS_const_add_pc:
- uladv = (((255 - info.li_opcode_base) / info.li_line_range)
- * info.li_min_insn_length);
+ uladv = (((255 - linfo.li_opcode_base) / linfo.li_line_range)
+ * linfo.li_min_insn_length);
state_machine_regs.address += uladv;
break;
display_debug_pubnames (struct dwarf_section *section,
void *file ATTRIBUTE_UNUSED)
{
- DWARF2_Internal_PubNames pubnames;
+ DWARF2_Internal_PubNames names;
unsigned char *start = section->start;
unsigned char *end = start + section->size;
data = start;
- pubnames.pn_length = byte_get (data, 4);
+ names.pn_length = byte_get (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;
offset_size = 8;
initial_length_size = 12;
initial_length_size = 4;
}
- pubnames.pn_version = byte_get (data, 2);
+ names.pn_version = byte_get (data, 2);
data += 2;
- pubnames.pn_offset = byte_get (data, offset_size);
+ names.pn_offset = byte_get (data, offset_size);
data += offset_size;
if (num_debug_info_entries != DEBUG_INFO_UNAVAILABLE
&& 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"),
- 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;
- 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;
}
printf (_(" Length: %ld\n"),
- pubnames.pn_length);
+ names.pn_length);
printf (_(" Version: %d\n"),
- pubnames.pn_version);
+ names.pn_version);
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"),
- pubnames.pn_size);
+ names.pn_size);
printf (_("\n Offset\tName\n"));
{
unsigned char *hdrptr;
DWARF2_Internal_ARange arange;
- unsigned char *ranges;
+ unsigned char *addr_ranges;
dwarf_vma length;
dwarf_vma address;
unsigned char address_size;
else
printf (_("\n Address Length\n"));
- ranges = hdrptr;
+ addr_ranges = hdrptr;
/* Must pad to an alignment boundary that is twice the address size. */
excess = (hdrptr - start) % (2 * address_size);
if (excess)
- ranges += (2 * address_size) - excess;
+ addr_ranges += (2 * address_size) - excess;
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 (" ");
print_dwarf_vma (address, address_size);
if (*need_col_headers)
{
- static const char *loc = " LOC";
+ static const char *sloc = " LOC";
*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++)
if (fc->col_type[r] != DW_CFA_unreferenced)
while (start < block_end)
{
unsigned op, opa;
- unsigned long reg, tmp;
+ unsigned long reg, temp;
op = *start++;
opa = op & 0x3f;
LEB ();
break;
case DW_CFA_def_cfa_expression:
- tmp = LEB ();
- start += tmp;
+ temp = LEB ();
+ start += temp;
break;
case DW_CFA_expression:
case DW_CFA_val_expression:
reg = LEB ();
- tmp = LEB ();
- start += tmp;
+ temp = LEB ();
+ start += temp;
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
void
dwarf_select_sections_by_letters (const char *letters)
{
- unsigned int index = 0;
+ unsigned int lindex = 0;
- while (letters[index])
- switch (letters[index++])
+ while (letters[lindex])
+ switch (letters[lindex++])
{
case 'i':
do_debug_info = 1;
case 'b':
{
bfd_vma flags, cinline;
- const char *basename, *fieldname;
+ const char *base, *fieldname;
unsigned long baselen, fieldlen;
char *basecopy;
debug_type basetype;
/* This represents a base or friend class. */
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_atn65 (info, pp, &fieldname, &fieldlen))
return FALSE;
return FALSE;
}
- basecopy = savestring (basename, baselen);
+ basecopy = savestring (base, baselen);
basetype = debug_find_tagged_type (dhandle, basecopy,
DEBUG_KIND_ILLEGAL);
free (basecopy);
case 'z':
{
- const char *vname, *basename;
+ const char *vname, *base;
unsigned long vnamelen, baselen;
bfd_vma vsize, control;
if (! ieee_require_atn65 (info, pp, &vname, &vnamelen)
|| ! 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))
return FALSE;
count -= 4;
{
char *basecopy;
- basecopy = savestring (basename, baselen);
+ basecopy = savestring (base, baselen);
vptrbase = debug_find_tagged_type (dhandle, basecopy,
DEBUG_KIND_ILLEGAL);
free (basecopy);
if (referencep)
{
- unsigned int nindx;
-
/* We need to output a record recording that this field is
really of reference type. We put this on the refs field
of classdef, so that it can be appended to the C++
file. */
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;
struct string_list *q;
argv[3] = unlink_on_exit;
/* If we have been given the name of a mapfile and that
name is not 'stderr' then pass it on to the linker. */
- if (map_file
- && * map_file
- && strcmp (map_file, "stderr") == 0)
+ if (mfile
+ && * mfile
+ && strcmp (mfile, "stderr") == 0)
{
argv[4] = (char *) "-Map";
- argv[5] = map_file;
+ argv[5] = mfile;
i = 6;
}
else
}
}
\f
-/* 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. */
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 (res != NULL)
{
- printf (format, res);
+ printf (form, res);
free (res);
return;
}
}
- printf (format, name);
+ printf (form, name);
}
static void
Return the number of symbols to be printed. */
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)
{
bfd_byte *from, *fromend, *to;
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)
bfd_fatal (bfd_get_filename (abfd));
size. */
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,
struct size_sym **symsizesp)
{
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);
if (sym == NULL)
bfd_fatal (bfd_get_filename (abfd));
if (from + size < fromend)
{
next = bfd_minisymbol_to_symbol (abfd,
- dynamic,
+ is_dynamic,
(const void *) (from + size),
store_next);
if (next == NULL)
if (relocs == NULL)
{
- struct get_relocs_info info;
+ struct get_relocs_info rinfo;
seccount = bfd_count_sections (abfd);
relocs = (arelent ***) xmalloc (seccount * sizeof *relocs);
relcount = (long *) xmalloc (seccount * sizeof *relcount);
- info.secs = secs;
- info.relocs = relocs;
- info.relcount = relcount;
- info.syms = syms;
- bfd_map_over_sections (abfd, get_relocs, (void *) &info);
+ rinfo.secs = secs;
+ rinfo.relocs = relocs;
+ rinfo.relcount = relcount;
+ rinfo.syms = syms;
+ bfd_map_over_sections (abfd, get_relocs, (void *) &rinfo);
lineno_cache_rel_bfd = abfd;
}
/* Print the symbols when sorting by size. */
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,
bfd *archive_bfd)
{
asymbol *sym;
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)
bfd_fatal (bfd_get_filename (abfd));
containing ABFD. */
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)
{
asymbol *store;
{
asymbol *sym;
- sym = bfd_minisymbol_to_symbol (abfd, dynamic, from, store);
+ sym = bfd_minisymbol_to_symbol (abfd, is_dynamic, from, store);
if (sym == NULL)
bfd_fatal (bfd_get_filename (abfd));
add_section_rename (const char * old_name, const char * new_name,
flagword flags)
{
- section_rename * rename;
+ section_rename * srename;
/* Check for conflicts first. */
- for (rename = section_rename_list; rename != NULL; rename = rename->next)
- if (strcmp (rename->old_name, old_name) == 0)
+ for (srename = section_rename_list; srename != NULL; srename = srename->next)
+ if (strcmp (srename->old_name, old_name) == 0)
{
/* Silently ignore duplicate definitions. */
- if (strcmp (rename->new_name, new_name) == 0
- && rename->flags == flags)
+ if (strcmp (srename->new_name, new_name) == 0
+ && srename->flags == flags)
return;
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;
- rename->new_name = new_name;
- rename->flags = flags;
- rename->next = section_rename_list;
+ srename->old_name = old_name;
+ srename->new_name = new_name;
+ srename->flags = flags;
+ 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
flagword * returned_flags)
{
const char * old_name = bfd_section_name (ibfd, isection);
- section_rename * rename;
+ section_rename * srename;
/* Default to using the flags of the input section. */
* returned_flags = bfd_get_section_flags (ibfd, isection);
- for (rename = section_rename_list; rename != NULL; rename = rename->next)
- if (strcmp (rename->old_name, old_name) == 0)
+ for (srename = section_rename_list; srename != NULL; srename = srename->next)
+ if (strcmp (srename->old_name, old_name) == 0)
{
- if (rename->flags != (flagword) -1)
- * returned_flags = rename->flags;
+ if (srename->flags != (flagword) -1)
+ * returned_flags = srename->flags;
- return rename->new_name;
+ return srename->new_name;
}
return old_name;
If SKIP_ZEROES is TRUE, omit leading zeroes. */
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)
{
char buf[30];
char *p;
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);
if (! skip_zeroes)
p = buf;
if (*p == '\0')
--p;
}
- (*info->fprintf_func) (info->stream, "%s", p);
+ (*inf->fprintf_func) (inf->stream, "%s", p);
}
/* Print the name of a symbol. */
static void
-objdump_print_symname (bfd *abfd, struct disassemble_info *info,
+objdump_print_symname (bfd *abfd, struct disassemble_info *inf,
asymbol *sym)
{
char *alloc;
name = alloc;
}
- if (info != NULL)
- (*info->fprintf_func) (info->stream, "%s", name);
+ if (inf != NULL)
+ (*inf->fprintf_func) (inf->stream, "%s", name);
else
printf ("%s", name);
static asymbol *
find_symbol_for_address (bfd_vma vma,
- struct disassemble_info *info,
+ struct disassemble_info *inf,
long *place)
{
/* @@ Would it speed things up to cache the last two symbols returned,
/* Indices in `sorted_syms'. */
long min = 0;
- long max = sorted_symcount;
+ long max_count = sorted_symcount;
long thisplace;
struct objdump_disasm_info *aux;
bfd *abfd;
if (sorted_symcount < 1)
return NULL;
- aux = (struct objdump_disasm_info *) info->application_data;
+ aux = (struct objdump_disasm_info *) inf->application_data;
abfd = aux->abfd;
sec = aux->sec;
- opb = info->octets_per_byte;
+ opb = inf->octets_per_byte;
/* Perform a binary search looking for the closest symbol to the
- required value. We are searching the range (min, max]. */
- while (min + 1 < max)
+ required value. We are searching the range (min, max_count]. */
+ while (min + 1 < max_count)
{
asymbol *sym;
- thisplace = (max + min) / 2;
+ thisplace = (max_count + min) / 2;
sym = sorted_syms[thisplace];
if (bfd_asymbol_value (sym) > vma)
- max = thisplace;
+ max_count = thisplace;
else if (bfd_asymbol_value (sym) < vma)
min = thisplace;
else
with the same value, as can occur with overlays or zero size
sections. */
min = thisplace;
- while (min < max
+ while (min < max_count
&& (bfd_asymbol_value (sorted_syms[min])
== bfd_asymbol_value (sorted_syms[thisplace])))
{
if (sorted_syms[min]->section == sec
- && info->symbol_is_valid (sorted_syms[min], info))
+ && inf->symbol_is_valid (sorted_syms[min], inf))
{
thisplace = min;
&& vma < (bfd_get_section_vma (abfd, sec)
+ bfd_section_size (abfd, sec) / opb)));
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 newplace = sorted_symcount;
for (i = min - 1; i >= 0; i--)
{
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)
newplace = i;
for (i = thisplace + 1; i < sorted_symcount; i++)
{
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;
break;
}
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. */
return NULL;
}
static void
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)
{
- objdump_print_value (vma, info, skip_zeroes);
+ objdump_print_value (vma, inf, skip_zeroes);
if (sym == NULL)
{
bfd_vma secaddr;
- (*info->fprintf_func) (info->stream, " <%s",
- bfd_get_section_name (abfd, sec));
+ (*inf->fprintf_func) (inf->stream, " <%s",
+ bfd_get_section_name (abfd, sec));
secaddr = bfd_get_section_vma (abfd, sec);
if (vma < secaddr)
{
- (*info->fprintf_func) (info->stream, "-0x");
- objdump_print_value (secaddr - vma, info, TRUE);
+ (*inf->fprintf_func) (inf->stream, "-0x");
+ objdump_print_value (secaddr - vma, inf, TRUE);
}
else if (vma > secaddr)
{
- (*info->fprintf_func) (info->stream, "+0x");
- objdump_print_value (vma - secaddr, info, TRUE);
+ (*inf->fprintf_func) (inf->stream, "+0x");
+ objdump_print_value (vma - secaddr, inf, TRUE);
}
- (*info->fprintf_func) (info->stream, ">");
+ (*inf->fprintf_func) (inf->stream, ">");
}
else
{
- (*info->fprintf_func) (info->stream, " <");
- objdump_print_symname (abfd, info, sym);
+ (*inf->fprintf_func) (inf->stream, " <");
+ objdump_print_symname (abfd, inf, sym);
if (bfd_asymbol_value (sym) > vma)
{
- (*info->fprintf_func) (info->stream, "-0x");
- objdump_print_value (bfd_asymbol_value (sym) - vma, info, TRUE);
+ (*inf->fprintf_func) (inf->stream, "-0x");
+ objdump_print_value (bfd_asymbol_value (sym) - vma, inf, TRUE);
}
else if (vma > bfd_asymbol_value (sym))
{
- (*info->fprintf_func) (info->stream, "+0x");
- objdump_print_value (vma - bfd_asymbol_value (sym), info, TRUE);
+ (*inf->fprintf_func) (inf->stream, "+0x");
+ objdump_print_value (vma - bfd_asymbol_value (sym), inf, TRUE);
}
- (*info->fprintf_func) (info->stream, ">");
+ (*inf->fprintf_func) (inf->stream, ">");
}
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)));
}
static void
objdump_print_addr (bfd_vma vma,
- struct disassemble_info *info,
+ struct disassemble_info *inf,
bfd_boolean skip_zeroes)
{
struct objdump_disasm_info *aux;
asymbol *sym = NULL;
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)
{
- (*info->fprintf_func) (info->stream, "0x");
- objdump_print_value (vma, info, skip_zeroes);
+ (*inf->fprintf_func) (inf->stream, "0x");
+ objdump_print_value (vma, inf, skip_zeroes);
if (display_file_offsets)
- info->fprintf_func (info->stream, _(" (File Offset: 0x%lx)"),
- (long int)(aux->sec->filepos + (vma - aux->sec->vma)));
+ inf->fprintf_func (inf->stream, _(" (File Offset: 0x%lx)"),
+ (long int)(aux->sec->filepos + (vma - aux->sec->vma)));
return;
}
}
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);
}
routine. */
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. */
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;
- sym = find_symbol_for_address (vma, info, NULL);
+ sym = find_symbol_for_address (vma, inf, NULL);
return (sym != NULL && (bfd_asymbol_value (sym) == vma));
}
/* Print a source file line. */
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;
size_t len;
- --line;
- if (line >= p->maxline)
+ --linenum;
+ if (linenum >= p->maxline)
return;
- l = p->linemap [line];
+ l = p->linemap [linenum];
/* Test fwrite return value to quiet glibc warning. */
len = strcspn (l, "\n\r");
if (len == 0 || fwrite (l, len, 1, stdout) == 1)
{
const char *filename;
const char *functionname;
- unsigned int line;
+ unsigned int linenumber;
bfd_boolean reloc;
if (! with_line_numbers && ! with_source_code)
return;
if (! bfd_find_nearest_line (abfd, section, syms, addr_offset, &filename,
- &functionname, &line))
+ &functionname, &linenumber))
return;
if (filename != NULL && *filename == '\0')
&& (prev_functionname == NULL
|| strcmp (functionname, prev_functionname) != 0))
printf ("%s():\n", functionname);
- if (line > 0 && line != prev_line)
- printf ("%s:%u\n", filename == NULL ? "???" : filename, line);
+ if (linenumber > 0 && linenumber != prev_line)
+ printf ("%s:%u\n", filename == NULL ? "???" : filename, linenumber);
}
if (with_source_code
&& filename != NULL
- && line > 0)
+ && linenumber > 0)
{
struct print_file_list **pp, *p;
unsigned l;
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)
l = 1;
else
{
- l = line - SHOW_PRECEDING_CONTEXT_LINES;
- if (l >= line)
+ l = linenumber - SHOW_PRECEDING_CONTEXT_LINES;
+ if (l >= linenumber)
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;
}
- dump_lines (p, l, line);
- p->last_line = line;
+ dump_lines (p, l, linenumber);
+ p->last_line = linenumber;
p->first = 0;
}
}
strcpy (prev_functionname, functionname);
}
- if (line > 0 && line != prev_line)
- prev_line = line;
+ if (linenumber > 0 && linenumber != prev_line)
+ prev_line = linenumber;
}
/* Pseudo FILE object for strings. */
/* Disassemble some data in memory between given values. */
static void
-disassemble_bytes (struct disassemble_info * info,
+disassemble_bytes (struct disassemble_info * inf,
disassembler_ftype disassemble_fn,
bfd_boolean insns,
bfd_byte * data,
bfd_boolean done_dot;
int skip_addr_chars;
bfd_vma addr_offset;
- unsigned int opb = info->octets_per_byte;
- unsigned int skip_zeroes = info->skip_zeroes;
- unsigned int skip_zeroes_at_end = info->skip_zeroes_at_end;
+ unsigned int opb = inf->octets_per_byte;
+ unsigned int skip_zeroes = inf->skip_zeroes;
+ unsigned int skip_zeroes_at_end = inf->skip_zeroes_at_end;
int octets = opb;
SFILE sfile;
- aux = (struct objdump_disasm_info *) info->application_data;
+ aux = (struct objdump_disasm_info *) inf->application_data;
section = aux->sec;
sfile.alloc = 120;
skip_addr_chars = (skip_addr_chars - 1) & -4;
}
- info->insn_info_valid = 0;
+ inf->insn_info_valid = 0;
done_dot = FALSE;
addr_offset = start_offset;
if (data[z] != 0)
break;
if (! disassemble_zeroes
- && (info->insn_info_valid == 0
- || info->branch_delay_insns == 0)
+ && (inf->insn_info_valid == 0
+ || inf->branch_delay_insns == 0)
&& (z - addr_offset * opb >= skip_zeroes
|| (z == stop_offset * opb &&
z - addr_offset * opb < skip_zeroes_at_end)))
else
{
aux->require_sec = TRUE;
- objdump_print_address (section->vma + addr_offset, info);
+ objdump_print_address (section->vma + addr_offset, inf);
aux->require_sec = FALSE;
putchar (' ');
}
if (insns)
{
sfile.pos = 0;
- info->fprintf_func = (fprintf_ftype) objdump_sprintf;
- info->stream = &sfile;
- info->bytes_per_line = 0;
- info->bytes_per_chunk = 0;
- info->flags = disassemble_all ? DISASSEMBLE_DATA : 0;
+ inf->fprintf_func = (fprintf_ftype) objdump_sprintf;
+ inf->stream = &sfile;
+ inf->bytes_per_line = 0;
+ inf->bytes_per_chunk = 0;
+ inf->flags = disassemble_all ? DISASSEMBLE_DATA : 0;
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) & DYNAMIC) == 0
&& *relppp < relppend)
|| (distance_to_rel > 0
&& distance_to_rel < (bfd_signed_vma) (previous_octets/ opb)))
{
- info->flags |= INSN_HAS_RELOC;
+ inf->flags |= INSN_HAS_RELOC;
aux->reloc = **relppp;
}
else
aux->reloc = NULL;
}
- octets = (*disassemble_fn) (section->vma + addr_offset, info);
- info->fprintf_func = (fprintf_ftype) fprintf;
- info->stream = stdout;
- if (insn_width == 0 && info->bytes_per_line != 0)
- octets_per_line = info->bytes_per_line;
+ octets = (*disassemble_fn) (section->vma + addr_offset, inf);
+ inf->fprintf_func = (fprintf_ftype) fprintf;
+ inf->stream = stdout;
+ if (insn_width == 0 && inf->bytes_per_line != 0)
+ octets_per_line = inf->bytes_per_line;
if (octets < 0)
{
if (sfile.pos)
if (pb > octets_per_line && ! prefix_addresses && ! wide_output)
pb = octets_per_line;
- if (info->bytes_per_chunk)
- bpc = info->bytes_per_chunk;
+ if (inf->bytes_per_chunk)
+ bpc = inf->bytes_per_chunk;
else
bpc = 1;
{
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--)
printf ("%02x", (unsigned) data[j + 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--)
printf ("%02x", (unsigned) data[j + k]);
printf ("\t\t\t");
objdump_print_value (section->vma - rel_offset + q->address,
- info, TRUE);
+ inf, TRUE);
if (q->howto == NULL)
printf (": *unknown*\t");
sym_name = bfd_asymbol_name (*q->sym_ptr_ptr);
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
{
asection *sym_sec;
if (q->addend)
{
printf ("+0x");
- objdump_print_value (q->addend, info, TRUE);
+ objdump_print_value (q->addend, inf, TRUE);
}
printf ("\n");
}
static void
-disassemble_section (bfd *abfd, asection *section, void *info)
+disassemble_section (bfd *abfd, asection *section, void *inf)
{
const struct elf_backend_data * bed;
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;
unsigned int opb = pinfo->octets_per_byte;
bfd_byte * data = NULL;
/* Find the nearest symbol forwards from our current position. */
paux->require_sec = TRUE;
sym = (asymbol *) find_symbol_for_address (section->vma + addr_offset,
- (struct disassemble_info *) info,
+ (struct disassemble_info *) inf,
&place);
paux->require_sec = FALSE;
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);
- abfd->arch_info = info;
+ abfd->arch_info = inf;
}
if (endian != BFD_ENDIAN_UNKNOWN)
dump_symbols (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean dynamic)
{
asymbol **current;
- long max;
+ long max_count;
long count;
if (dynamic)
{
current = dynsyms;
- max = dynsymcount;
+ max_count = dynsymcount;
printf ("DYNAMIC SYMBOL TABLE:\n");
}
else
{
current = syms;
- max = symcount;
+ max_count = symcount;
printf ("SYMBOL TABLE:\n");
}
- if (max == 0)
+ if (max_count == 0)
printf (_("no symbols\n"));
- for (count = 0; count < max; count++)
+ for (count = 0; count < max_count; count++)
{
bfd *cur_bfd;
{
arelent *q = *p;
const char *filename, *functionname;
- unsigned int line;
+ unsigned int linenumber;
const char *sym_name;
const char *section_name;
if (with_line_numbers
&& sec != NULL
&& bfd_find_nearest_line (abfd, sec, syms, q->address,
- &filename, &functionname, &line))
+ &filename, &functionname, &linenumber))
{
if (functionname != NULL
&& (last_functionname == NULL
last_functionname = xstrdup (functionname);
}
- if (line > 0
- && (line != last_line
+ if (linenumber > 0
+ && (linenumber != last_line
|| (filename != NULL
&& last_filename != NULL
&& strcmp (filename, last_filename) != 0)))
{
- printf ("%s:%u\n", filename == NULL ? "???" : filename, line);
- last_line = line;
+ printf ("%s:%u\n", filename == NULL ? "???" : filename, linenumber);
+ last_line = linenumber;
if (last_filename != NULL)
free (last_filename);
if (filename == NULL)
/* Start a new compilation unit. */
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;
free (info->filename);
/* Should it be relative? best way to do it here?. */
- info->filename = strdup (filename);
+ info->filename = strdup (fname);
return TRUE;
}
/* Start a source file within a compilation unit. */
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;
free (info->filename);
/* Should it be relative? best way to do it here?. */
- info->filename = strdup (filename);
+ info->filename = strdup (fname);
return TRUE;
}
/* Write out line number information. */
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,
bfd_vma addr ATTRIBUTE_UNUSED)
{
little-endian symbol index followed by four
individual byte fields. Reorder INFO
accordingly. */
- bfd_vma info = relas[i].r_info;
- info = (((info & 0xffffffff) << 32)
- | ((info >> 56) & 0xff)
- | ((info >> 40) & 0xff00)
- | ((info >> 24) & 0xff0000)
- | ((info >> 8) & 0xff000000));
- relas[i].r_info = info;
+ bfd_vma inf = relas[i].r_info;
+ inf = (((inf & 0xffffffff) << 32)
+ | ((inf >> 56) & 0xff)
+ | ((inf >> 40) & 0xff00)
+ | ((inf >> 24) & 0xff0000)
+ | ((inf >> 8) & 0xff000000));
+ relas[i].r_info = inf;
}
#endif /* BFD64 */
}
little-endian symbol index followed by four
individual byte fields. Reorder INFO
accordingly. */
- bfd_vma info = rels[i].r_info;
- info = (((info & 0xffffffff) << 32)
- | ((info >> 56) & 0xff)
- | ((info >> 40) & 0xff00)
- | ((info >> 24) & 0xff0000)
- | ((info >> 8) & 0xff000000));
- rels[i].r_info = info;
+ bfd_vma inf = rels[i].r_info;
+ inf = (((inf & 0xffffffff) << 32)
+ | ((inf >> 56) & 0xff)
+ | ((inf >> 40) & 0xff00)
+ | ((inf >> 24) & 0xff0000)
+ | ((inf >> 8) & 0xff000000));
+ rels[i].r_info = inf;
}
#endif /* BFD64 */
}
{
const char * rtype;
bfd_vma offset;
- bfd_vma info;
+ bfd_vma inf;
bfd_vma symtab_index;
bfd_vma type;
offset = rels[i].r_offset;
- info = rels[i].r_info;
+ inf = rels[i].r_info;
- type = get_reloc_type (info);
- symtab_index = get_reloc_symindex (info);
+ type = get_reloc_type (inf);
+ symtab_index = get_reloc_symindex (inf);
if (is_32bit_elf)
{
printf ("%8.8lx %8.8lx ",
(unsigned long) offset & 0xffffffff,
- (unsigned long) info & 0xffffffff);
+ (unsigned long) inf & 0xffffffff);
}
else
{
printf (do_wide
? "%16.16lx %16.16lx "
: "%12.12lx %12.12lx ",
- offset, info);
+ offset, inf);
#elif BFD_HOST_64BIT_LONG_LONG
#ifndef __MSVCRT__
printf (do_wide
? "%16.16llx %16.16llx "
: "%12.12llx %12.12llx ",
- offset, info);
+ offset, inf);
#else
printf (do_wide
? "%16.16I64x %16.16I64x "
: "%12.12I64x %12.12I64x ",
- offset, info);
+ offset, inf);
#endif
#else
printf (do_wide
: "%4.4lx%8.8lx %4.4lx%8.8lx ",
_bfd_int64_high (offset),
_bfd_int64_low (offset),
- _bfd_int64_high (info),
- _bfd_int64_low (info));
+ _bfd_int64_high (inf),
+ _bfd_int64_low (inf));
#endif
}
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)
- printf (" - %lx", - offset);
+ if (off < 0)
+ printf (" - %lx", - off);
else
- printf (" + %lx", offset);
+ printf (" + %lx", off);
}
}
}
if (elf_header.e_machine == EM_SPARCV9
&& rtype != NULL
&& 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');
#ifdef BFD64
if (! is_32bit_elf && elf_header.e_machine == EM_MIPS)
{
- bfd_vma type2 = ELF64_MIPS_R_TYPE2 (info);
- bfd_vma type3 = ELF64_MIPS_R_TYPE3 (info);
+ bfd_vma type2 = ELF64_MIPS_R_TYPE2 (inf);
+ bfd_vma type3 = ELF64_MIPS_R_TYPE3 (inf);
const char * rtype2 = elf_mips_reloc_type (type2);
const char * rtype3 = elf_mips_reloc_type (type3);
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 * external;
if (!phdrs)
return 0;
- for (i = 0, internal = program_headers, external = phdrs;
+ for (i = 0, internal = pheaders, external = phdrs;
i < elf_header.e_phnum;
i++, internal++, external++)
{
}
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 * external;
if (!phdrs)
return 0;
- for (i = 0, internal = program_headers, external = phdrs;
+ for (i = 0, internal = pheaders, external = phdrs;
i < elf_header.e_phnum;
i++, internal++, external++)
{
static char buff[1024];
char * p = buff;
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 proc_flags = 0;
bfd_vma unknown_flags = 0;
{
switch (flag)
{
- case SHF_WRITE: index = 0; break;
- case SHF_ALLOC: index = 1; break;
- case SHF_EXECINSTR: index = 2; break;
- case SHF_MERGE: index = 3; break;
- case SHF_STRINGS: index = 4; break;
- case SHF_INFO_LINK: index = 5; break;
- case SHF_LINK_ORDER: index = 6; break;
- case SHF_OS_NONCONFORMING: index = 7; break;
- case SHF_GROUP: index = 8; break;
- case SHF_TLS: index = 9; break;
+ case SHF_WRITE: sindex = 0; break;
+ case SHF_ALLOC: sindex = 1; break;
+ case SHF_EXECINSTR: sindex = 2; break;
+ case SHF_MERGE: sindex = 3; break;
+ case SHF_STRINGS: sindex = 4; break;
+ case SHF_INFO_LINK: sindex = 5; break;
+ case SHF_LINK_ORDER: sindex = 6; break;
+ case SHF_OS_NONCONFORMING: sindex = 7; break;
+ case SHF_GROUP: sindex = 8; break;
+ case SHF_TLS: sindex = 9; break;
default:
- index = -1;
+ sindex = -1;
switch (elf_header.e_machine)
{
case EM_IA_64:
if (flag == SHF_IA_64_SHORT)
- index = 10;
+ sindex = 10;
else if (flag == SHF_IA_64_NORECOV)
- index = 11;
+ sindex = 11;
#ifdef BFD64
else if (elf_header.e_ident[EI_OSABI] == ELFOSABI_OPENVMS)
switch (flag)
{
- case SHF_IA_64_VMS_GLOBAL: index = 12; break;
- case SHF_IA_64_VMS_OVERLAID: index = 13; break;
- case SHF_IA_64_VMS_SHARED: index = 14; break;
- case SHF_IA_64_VMS_VECTOR: index = 15; break;
- case SHF_IA_64_VMS_ALLOC_64BIT: index = 16; break;
- case SHF_IA_64_VMS_PROTECTED: index = 17; break;
+ case SHF_IA_64_VMS_GLOBAL: sindex = 12; break;
+ case SHF_IA_64_VMS_OVERLAID: sindex = 13; break;
+ case SHF_IA_64_VMS_SHARED: sindex = 14; break;
+ case SHF_IA_64_VMS_VECTOR: sindex = 15; break;
+ case SHF_IA_64_VMS_ALLOC_64BIT: sindex = 16; break;
+ case SHF_IA_64_VMS_PROTECTED: sindex = 17; break;
default: break;
}
#endif
case EM_SPARCV9:
case EM_SPARC:
if (flag == SHF_EXCLUDE)
- index = 18;
+ sindex = 18;
else if (flag == SHF_ORDERED)
- index = 19;
+ sindex = 19;
break;
default:
break;
}
}
- if (index != -1)
+ if (sindex != -1)
{
if (p != buff + field_size + 4)
{
*p++ = ' ';
}
- size -= flags [index].len;
- p = stpcpy (p, flags [index].str);
+ size -= flags [sindex].len;
+ p = stpcpy (p, flags [sindex].str);
}
else if (flag & SHF_MASKOS)
os_flags |= flag;
char timebuf[20];
struct tm * tmp;
- time_t time = entry->d_un.d_val;
- tmp = gmtime (&time);
+ time_t atime = entry->d_un.d_val;
+ tmp = gmtime (&atime);
snprintf (timebuf, sizeof (timebuf), "%04u-%02u-%02uT%02u:%02u:%02u",
tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
if (do_dynamic)
{
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",
tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
Elf_Internal_Verdef ivd;
Elf_Internal_Verdaux ivda;
Elf_External_Verdaux evda;
- unsigned long offset;
+ unsigned long off;
- offset = offset_from_vma
+ off = offset_from_vma
(file,
version_info[DT_VERSIONTAGIDX (DT_VERDEF)],
sizeof (Elf_External_Verdef));
{
Elf_External_Verdef evd;
- get_data (&evd, file, offset, sizeof (evd),
+ get_data (&evd, file, off, sizeof (evd),
1, _("version def"));
ivd.vd_ndx = BYTE_GET (evd.vd_ndx);
ivd.vd_aux = BYTE_GET (evd.vd_aux);
ivd.vd_next = BYTE_GET (evd.vd_next);
- offset += ivd.vd_next;
+ off += ivd.vd_next;
}
while (ivd.vd_ndx != (vers_data & VERSYM_VERSION)
&& ivd.vd_next != 0);
- offset -= ivd.vd_next;
- offset += ivd.vd_aux;
+ off -= ivd.vd_next;
+ off += ivd.vd_aux;
- get_data (&evda, file, offset, sizeof (evda),
+ get_data (&evda, file, off, sizeof (evda),
1, _("version def aux"));
ivda.vda_name = BYTE_GET (evda.vda_name);
bfd_vma addend;
unsigned int reloc_type;
unsigned int reloc_size;
- unsigned char * loc;
+ unsigned char * rloc;
reloc_type = get_reloc_type (rp->r_info);
continue;
}
- loc = start + rp->r_offset;
- if ((loc + reloc_size) > end)
+ rloc = start + rp->r_offset;
+ if ((rloc + reloc_size) > end)
{
warn (_("skipping invalid relocation offset 0x%lx in section %s\n"),
(unsigned long) rp->r_offset,
|| ((elf_header.e_machine == EM_PJ
|| elf_header.e_machine == EM_PJ_OLD)
&& reloc_type == 1))
- addend += byte_get (loc, reloc_size);
+ addend += byte_get (rloc, reloc_size);
if (is_32bit_pcrel_reloc (reloc_type)
|| is_64bit_pcrel_reloc (reloc_type))
/* On HPPA, all pc-relative relocations are biased by 8. */
if (elf_header.e_machine == EM_PARISC)
addend -= 8;
- byte_put (loc, (addend + sym->st_value) - rp->r_offset,
+ byte_put (rloc, (addend + sym->st_value) - rp->r_offset,
reloc_size);
}
else
- byte_put (loc, addend + sym->st_value, reloc_size);
+ byte_put (rloc, addend + sym->st_value, reloc_size);
}
free (symtab);
do_numlist:
for (;;)
{
- unsigned int i;
+ unsigned int j;
- val = read_uleb128 (p, &i);
- p += i;
+ val = read_uleb128 (p, &j);
+ p += j;
if (val == 0)
break;
printf (" %d", val);
for (cnt = 0; cnt < liblistno; ++cnt)
{
Elf32_Lib liblist;
- time_t time;
+ time_t atime;
char timebuf[20];
struct tm * tmp;
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_version = BYTE_GET (elib[cnt].l_version);
liblist.l_flags = BYTE_GET (elib[cnt].l_flags);
- tmp = gmtime (&time);
+ tmp = gmtime (&atime);
snprintf (timebuf, sizeof (timebuf),
"%04u-%02u-%02uT%02u:%02u:%02u",
tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
if (pltgot != 0 && local_gotno != 0)
{
- bfd_vma entry, local_end, global_end;
+ bfd_vma ent, local_end, global_end;
size_t i, offset;
unsigned char * data;
int addr_size;
- entry = pltgot;
+ ent = pltgot;
addr_size = (is_32bit_elf ? 4 : 8);
local_end = pltgot + local_gotno * addr_size;
global_end = local_end + (symtabno - gotsym) * addr_size;
printf (_(" %*s %10s %*s Purpose\n"),
addr_size * 2, "Address", "Access",
addr_size * 2, "Initial");
- entry = print_mips_got_entry (data, pltgot, entry);
+ ent = print_mips_got_entry (data, pltgot, ent);
printf (" Lazy resolver\n");
if (data
- && (byte_get (data + entry - pltgot, addr_size)
+ && (byte_get (data + ent - pltgot, addr_size)
>> (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 ("\n");
- if (entry < local_end)
+ if (ent < local_end)
{
printf (_(" Local entries:\n"));
printf (_(" %*s %10s %*s\n"),
addr_size * 2, "Address", "Access",
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");
Elf_Internal_Sym * psym;
psym = dynamic_symbols + i;
- entry = print_mips_got_entry (data, pltgot, entry);
+ ent = print_mips_got_entry (data, pltgot, ent);
printf (" ");
print_vma (psym->st_value, LONG_HEX);
printf (" %-7s %3s ",
if (mips_pltgot != 0 && jmprel != 0 && pltrel != 0 && pltrelsz != 0)
{
- bfd_vma entry, end;
+ bfd_vma ent, end;
size_t offset, rel_offset;
unsigned long count, i;
unsigned char * data;
return 0;
}
- entry = mips_pltgot;
+ ent = mips_pltgot;
addr_size = (is_32bit_elf ? 4 : 8);
end = mips_pltgot + (2 + count) * addr_size;
printf (_(" Reserved entries:\n"));
printf (_(" %*s %*s Purpose\n"),
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");
- entry = print_mips_pltgot_entry (data, mips_pltgot, entry);
+ ent = print_mips_pltgot_entry (data, mips_pltgot, ent);
printf (" Module pointer\n");
printf ("\n");
Elf_Internal_Sym * psym;
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 (" ");
print_vma (psym->st_value, LONG_HEX);
printf (" %-7s %3s ",
++cnt)
{
Elf32_Lib liblist;
- time_t time;
+ time_t atime;
char timebuf[20];
struct tm * tmp;
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_version = BYTE_GET (elib[cnt].l_version);
liblist.l_flags = BYTE_GET (elib[cnt].l_flags);
- tmp = gmtime (&time);
+ tmp = gmtime (&atime);
snprintf (timebuf, sizeof (timebuf),
"%04u-%02u-%02uT%02u:%02u:%02u",
tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
/* 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.
Written by Ian Lance Taylor, Cygnus Support.
Rewritten by Kai Tietz, Onevision.
{
rc_res_resource *r;
rc_menu *m;
- rc_uint_type version, read;
+ rc_uint_type version, got;
r = (rc_res_resource *) res_alloc (sizeof *r);
r->type = RES_TYPE_MENU;
if (length < 4)
toosmall (_("menu header"));
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)
{
if (offset + 4 >= length)
toosmall (_("menuex offset"));
m->items = bin_to_res_menuexitems (wrbfd, data + 4 + offset,
- length - (4 + offset), &read);
+ length - (4 + offset), &got);
}
else
fatal (_("unsupported menu version %d"), (int) version);
static rc_menuitem *
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;
first = NULL;
pp = &first;
- *read = 0;
+ *got = 0;
while (length > 0)
{
data += itemlen;
length -= itemlen;
- *read += itemlen;
+ *got += itemlen;
if ((flags & MENUITEM_ENDMENU) != 0)
return first;
static rc_menuitem *
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;
first = NULL;
pp = &first;
- *read = 0;
+ *got = 0;
while (length > 0)
{
data += itemlen;
length -= itemlen;
- *read += itemlen;
+ *got += itemlen;
if ((flags & 0x80) != 0)
return first;
without the need to store it somewhere externally. */
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;
rc_uint_type language;
}
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);
}
and modified to add an existing resource.
*/
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)
{
rc_res_entry *re = NULL;
{
rc_res_entry **pp;
- if (*resources == NULL)
+ if (*res_dirs == NULL)
{
static unsigned long timeval;
if (timeval == 0)
timeval = time (NULL);
- *resources = ((rc_res_directory *)
+ *res_dirs = ((rc_res_directory *)
res_alloc (sizeof (rc_res_directory)));
- (*resources)->characteristics = 0;
- (*resources)->time = timeval;
- (*resources)->major = 0;
- (*resources)->minor = 0;
- (*resources)->entries = NULL;
+ (*res_dirs)->characteristics = 0;
+ (*res_dirs)->time = timeval;
+ (*res_dirs)->major = 0;
+ (*res_dirs)->minor = 0;
+ (*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)
break;
xexit (1);
}
- resources = &re->u.dir;
+ res_dirs = &re->u.dir;
}
}
/* srconv.c -- Sysroff conversion program
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.
/* IT LEN stuff CS */
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 last;
int sum = 0;
int bytes = size / 8;
- last = !(code & 0xff00);
+ last = !(ccode & 0xff00);
if (size & 0x7)
abort ();
- ptr[0] = code | (last ? 0x80 : 0);
+ ptr[0] = ccode | (last ? 0x80 : 0);
ptr[1] = bytes + 1;
for (j = 0; j < bytes; j++)
/* Glue on a checksum too. */
ptr[bytes] = ~sum;
- if (fwrite (ptr, bytes + 1, 1, file) != 1)
+ if (fwrite (ptr, bytes + 1, 1, ffile) != 1)
/* FIXME: Return error status. */
abort ();
}
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;
if (byte > 240)
{
/* Lets write out that record and do another one. */
- checksum (file, ptr, *idx, code | 0x1000);
+ checksum (ffile, ptr, *idx, code | 0x1000);
*idx = 16;
byte = *idx / 8;
}
static void
writeBARRAY (barray data, unsigned char *ptr, int *idx,
- int size ATTRIBUTE_UNUSED, FILE *file)
+ int size ATTRIBUTE_UNUSED, FILE *ffile)
{
int i;
- writeINT (data.len, ptr, idx, 1, file);
+ writeINT (data.len, ptr, idx, 1, ffile);
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
-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;
if (i > 240)
{
/* Lets write out that record and do another one. */
- checksum (file, ptr, *idx, code | 0x1000);
+ checksum (ffile, ptr, *idx, code | 0x1000);
*idx = 16;
i = *idx / 8;
}
ordinary defs - dunno why, but thats what hitachi does with 'em. */
static void
-prescan (struct coff_ofile *tree)
+prescan (struct coff_ofile *otree)
{
struct coff_symbol *s;
struct coff_section *common_section;
/* 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->next_in_ofile_list)
{
if (s->visible->type == coff_vis_common)
{
struct coff_where *w = s->where;
+
/* s->visible->type = coff_vis_ext_def; leave it as common */
common_section->size = align (common_section->size);
w->offset = common_section->size + common_section->address;
char *program_name;
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 (file, _("Convert a COFF object file into a SYSROFF object file\n"));
- fprintf (file, _(" The options are:\n\
+ fprintf (ffile, _("Usage: %s [option(s)] in-file [out-file]\n"), program_name);
+ fprintf (ffile, _("Convert a COFF object file into a SYSROFF object file\n"));
+ fprintf (ffile, _(" The options are:\n\
-q --quick (Obsolete - ignored)\n\
-n --noprescan Do not perform a scan to convert commons into defs\n\
-d --debug Display information about what is being done\n\
-v --version Print the program's version number\n"));
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);
}
stab_find_slot (struct stab_handle *info, const int *typenums)
{
int filenum;
- int index;
+ int tindex;
struct stab_types **ps;
filenum = typenums[0];
- index = typenums[1];
+ tindex = typenums[1];
if (filenum < 0 || (unsigned int) filenum >= info->files)
{
fprintf (stderr, _("Type file number %d out of range\n"), filenum);
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;
}
ps = info->file_types + filenum;
- while (index >= STAB_TYPES_SLOTS)
+ while (tindex >= STAB_TYPES_SLOTS)
{
if (*ps == NULL)
{
memset (*ps, 0, sizeof **ps);
}
ps = &(*ps)->next;
- index -= STAB_TYPES_SLOTS;
+ tindex -= STAB_TYPES_SLOTS;
}
if (*ps == NULL)
{
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
}
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;
char *program_name;
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 (file, _("Print a human readable interpretation of a SYSROFF object file\n"));
- fprintf (file, _(" The options are:\n\
+ fprintf (ffile, _("Usage: %s [option(s)] in-file\n"), program_name);
+ fprintf (ffile, _("Print a human readable interpretation of a SYSROFF object file\n"));
+ fprintf (ffile, _(" The options are:\n\
-h --help Display this information\n\
-v --version Print the program's version number\n"));
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);
}
main (int ac, char **av)
{
char *input_file = NULL;
- int opt;
+ int option;
static struct option long_options[] =
{
{"help", no_argument, 0, 'h'},
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':
-/* 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).
This file is part of GNU binutils.
case 'd':
printf("\n\n\n#define IT_%s_CODE 0x%x\n", it,code);
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);
- 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);
- 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);
printf("struct IT_%s { \n", it);
break;
case 'i':
- printf("void sysroff_swap_%s_in(ptr)\n",$2);
- printf("struct IT_%s *ptr;\n", it);
+ printf("void sysroff_swap_%s_in (struct IT_%s * ptr)\n",$2,it);
printf("{\n");
- printf("unsigned char raw[255];\n");
- printf("\tint idx = 0 ;\n");
+ printf("\tunsigned 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");
+ 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,ptr)\n",$2);
- printf("FILE * file;\n");
- printf("struct IT_%s *ptr;\n", it);
+ 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("\tint idx = 16;\n");
printf("\tmemset (raw, 0, 255);\n");
printf("\tcode = IT_%s_CODE;\n", it);
break;
case 'o':
- printf("void sysroff_swap_%s_out(abfd,ptr)\n",$2);
- printf("bfd * abfd;\n");
- printf("struct IT_%s *ptr;\n",it);
+ printf("void sysroff_swap_%s_out (bfd * abfd, struct IT_%s * ptr)\n",$2, it);
printf("{\n");
- printf("int idx = 0 ;\n");
+ printf("\tint idx = 0;\n");
break;
case 'c':
- printf("void sysroff_print_%s_out(ptr)\n",$2);
- printf("struct IT_%s *ptr;\n", it);
+ printf("void sysroff_print_%s_out (struct IT_%s *ptr)\n",$2,it);
printf("{\n");
printf("itheader(\"%s\", IT_%s_CODE);\n",$2,$2);
break;
printf("};\n");
break;
case 'g':
- printf("\tchecksum(file,raw, idx, IT_%s_CODE);\n", it);
+ printf("\tchecksum(ffile,raw, idx, IT_%s_CODE);\n", it);
case 'i':
}
else {
- printf("\twrite%s(ptr->%s%s,raw,&idx,%d,file);\n",
+ printf("\twrite%s(ptr->%s%s,raw,&idx,%d,ffile);\n",
type,
id,
names[rdepth],size/8);
static bfd_boolean
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;
s = (struct stab_type_stack *) xmalloc (sizeof *s);
s->string = xstrdup (string);
- s->index = index;
+ s->index = tindex;
s->definition = definition;
s->size = size;
/* Push a type index which has already been defined. */
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)
{
char buf[20];
- sprintf (buf, "%ld", index);
- return stab_push_string (info, buf, index, FALSE, size);
+ sprintf (buf, "%ld", tindex);
+ return stab_push_string (info, buf, tindex, FALSE, size);
}
/* Pop a type off the type stack. The caller is responsible for
return stab_push_defined_type (info, info->type_cache.void_type, 0);
else
{
- long index;
+ long tindex;
char buf[40];
- index = info->type_index;
+ tindex = 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);
}
}
return stab_push_defined_type (info, info->type_cache.void_type, 0);
else
{
- long index;
+ long tindex;
char buf[40];
- index = info->type_index;
+ tindex = 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);
}
}
return stab_push_defined_type (info, cache[size - 1], size);
else
{
- long index;
+ long tindex;
char buf[100];
- index = info->type_index;
+ tindex = 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)
{
strcat (buf, "0;");
abort ();
}
- return stab_push_string (info, buf, index, TRUE, size);
+ return stab_push_string (info, buf, tindex, TRUE, size);
}
}
size);
else
{
- long index;
+ long tindex;
char *int_type;
char buf[50];
return FALSE;
int_type = stab_pop_type (info);
- index = info->type_index;
+ tindex = info->type_index;
++info->type_index;
if (size > 0
&& size - 1 < (sizeof info->type_cache.float_types
/ 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);
- return stab_push_string (info, buf, index, TRUE, size);
+ return stab_push_string (info, buf, tindex, TRUE, size);
}
}
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
char buf[50];
- long index;
+ long tindex;
- index = info->type_index;
+ tindex = 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
stab_bool_type (void *p, unsigned int size)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- long index;
+ long tindex;
switch (size)
{
case 1:
- index = -21;
+ tindex = -21;
break;
case 2:
- index = -22;
+ tindex = -22;
break;
default:
case 4:
- index = -16;
+ tindex = -16;
break;
case 8:
- index = -33;
+ tindex = -33;
break;
}
- return stab_push_defined_type (info, index, size);
+ return stab_push_defined_type (info, tindex, size);
}
/* Push an enum type. */
size_t len;
const char **pn;
char *buf;
- long index = 0;
+ long tindex = 0;
bfd_signed_vma *pv;
if (names == NULL)
strcpy (buf, "e");
else
{
- index = info->type_index;
+ tindex = 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++)
{
/* FIXME: The size is just a guess. */
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;
}
unsigned int size, long **cache, size_t *cache_alloc)
{
long targindex;
- long index;
+ long tindex;
char *s, *buf;
assert (info->type_stack != NULL);
*cache_alloc = alloc;
}
- index = (*cache)[targindex];
- if (index != 0 && ! info->type_stack->definition)
+ tindex = (*cache)[targindex];
+ if (tindex != 0 && ! info->type_stack->definition)
{
/* We have already defined a modification of this type, and
the entry on the type stack is not a definition, so we
is a struct which we did not define at the time it was
referenced). */
free (stab_pop_type (info));
- if (! stab_push_defined_type (info, index, size))
+ if (! stab_push_defined_type (info, tindex, size))
return FALSE;
}
else
{
- index = info->type_index;
+ tindex = info->type_index;
++info->type_index;
s = stab_pop_type (info);
buf = (char *) xmalloc (strlen (s) + 20);
- sprintf (buf, "%ld=%c%s", index, mod, s);
+ sprintf (buf, "%ld=%c%s", tindex, mod, 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;
free (buf);
bfd_boolean definition;
unsigned int element_size;
char *range, *element, *buf;
- long index;
+ long tindex;
unsigned int size;
definition = info->type_stack->definition;
if (! stringp)
{
- index = 0;
+ tindex = 0;
*buf = '\0';
}
else
{
/* We need to define a type in order to include the string
attribute. */
- index = info->type_index;
+ tindex = info->type_index;
++info->type_index;
definition = TRUE;
- sprintf (buf, "%ld=@S;", index);
+ sprintf (buf, "%ld=@S;", tindex);
}
sprintf (buf + strlen (buf), "ar%s;%ld;%ld;%s",
size = 0;
else
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;
free (buf);
struct stab_write_handle *info = (struct stab_write_handle *) p;
bfd_boolean definition;
char *s, *buf;
- long index;
+ long tindex;
definition = info->type_stack->definition;
if (! bitstringp)
{
*buf = '\0';
- index = 0;
+ tindex = 0;
}
else
{
/* We need to define a type in order to include the string
attribute. */
- index = info->type_index;
+ tindex = info->type_index;
++info->type_index;
definition = TRUE;
- sprintf (buf, "%ld=@S;", index);
+ sprintf (buf, "%ld=@S;", tindex);
}
sprintf (buf + strlen (buf), "S%s", s);
free (s);
- if (! stab_push_string (info, buf, index, definition, 0))
+ if (! stab_push_string (info, buf, tindex, definition, 0))
return FALSE;
free (buf);
bfd_boolean structp, unsigned int size)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- long index;
+ long tindex;
bfd_boolean definition;
char *buf;
if (id == 0)
{
- index = 0;
+ tindex = 0;
*buf = '\0';
definition = FALSE;
}
else
{
- index = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL,
+ tindex = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL,
&size);
- if (index < 0)
+ if (tindex < 0)
return FALSE;
- sprintf (buf, "%ld=", index);
+ sprintf (buf, "%ld=", tindex);
definition = TRUE;
}
structp ? 's' : 'u',
size);
- if (! stab_push_string (info, buf, index, definition, size))
+ if (! stab_push_string (info, buf, tindex, definition, size))
return FALSE;
info->type_stack->fields = (char *) xmalloc (1);
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
bfd_boolean definition;
- long index;
+ long tindex;
unsigned int size;
char *fields, *first, *buf;
assert (info->type_stack != NULL && info->type_stack->fields != NULL);
definition = info->type_stack->definition;
- index = info->type_stack->index;
+ tindex = info->type_stack->index;
size = info->type_stack->size;
fields = info->type_stack->fields;
first = stab_pop_type (info);
free (first);
free (fields);
- if (! stab_push_string (info, buf, index, definition, size))
+ if (! stab_push_string (info, buf, tindex, definition, size))
return FALSE;
free (buf);
enum debug_type_kind kind)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- long index;
+ long tindex;
unsigned int size = 0;
- index = stab_get_struct_index (info, name, id, kind, &size);
- if (index < 0)
+ tindex = stab_get_struct_index (info, name, id, kind, &size);
+ if (tindex < 0)
return FALSE;
- return stab_push_defined_type (info, index, size);
+ return stab_push_defined_type (info, tindex, size);
}
/* Define a typedef. */
stab_typdef (void *p, const char *name)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- long index;
+ long tindex;
unsigned int size;
char *s, *buf;
struct string_hash_entry *h;
- index = info->type_stack->index;
+ tindex = info->type_stack->index;
size = info->type_stack->size;
s = stab_pop_type (info);
buf = (char *) xmalloc (strlen (name) + strlen (s) + 20);
- if (index > 0)
+ if (tindex > 0)
sprintf (buf, "%s:t%s", name, s);
else
{
- index = info->type_index;
+ tindex = 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);
/* I don't think we care about redefinitions. */
- h->index = index;
+ h->index = tindex;
h->size = size;
return TRUE;
if (! ISDIGIT (*s))
{
char *n;
- long index;
+ long tindex;
- index = info->type_index;
+ tindex = info->type_index;
++info->type_index;
n = (char *) xmalloc (strlen (s) + 20);
- sprintf (n, "%ld=%s", index, s);
+ sprintf (n, "%ld=%s", tindex, s);
free (s);
s = n;
}
+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>
Must use VOID expression in VOID context.
int
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 unit;
VLIW_COMBO *new_vliw;
if (vliw->constraint_violation || CGEN_INSN_INVALID_P (insn))
return 1;
- index = vliw->next_slot;
- if (index >= FRV_VLIW_SIZE)
+ slot_index = vliw->next_slot;
+ if (slot_index >= FRV_VLIW_SIZE)
return 1;
unit = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_UNIT);
break;
}
- if (index <= 0)
+ if (slot_index <= 0)
{
/* Any insn can be added to slot 0. */
while (! match_unit (vliw, unit, (*vliw->current_vliw)[0]))
if (new_vliw && check_insn_major_constraints (vliw, major, insn))
{
vliw->current_vliw = new_vliw;
- vliw->major[index] = major;
- vliw->insn[index] = insn;
+ vliw->major[slot_index] = major;
+ vliw->insn[slot_index] = insn;
vliw->next_slot++;
return 0;
}
int opindex, unsigned long *valuep)
{
const char *errmsg = 0;
- unsigned long value;
+ unsigned long value = 0;
long have_zero = 0;
if (strncasecmp (*strp, "%dsp8(", 6) == 0)
{
enum cgen_parse_operand_result result_type;
- bfd_vma value;
- const char *errmsg;
+ bfd_vma val;
*strp += 6;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_8,
- & result_type, & value);
+ & result_type, & val);
if (**strp != ')')
return _("missing `)'");
(*strp) ++;
if (errmsg == NULL
&& 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;
return errmsg;
}
int opindex, signed long *valuep)
{
const char *errmsg = 0;
- signed long value;
+ signed long value = 0;
if (strncasecmp (*strp, "%hi8(", 5) == 0)
{
enum cgen_parse_operand_result result_type;
- bfd_vma value;
- const char *errmsg;
+ bfd_vma val;
*strp += 5;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_M32C_HI8,
- & result_type, & value);
+ & result_type, & val);
if (**strp != ')')
return _("missing `)'");
(*strp) ++;
if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
- {
- value >>= 16;
- }
+ val >>= 16;
+
+ value = val;
*valuep = value;
return errmsg;
}
int opindex, unsigned long *valuep)
{
const char *errmsg = 0;
- unsigned long value;
+ unsigned long value = 0;
long have_zero = 0;
if (strncasecmp (*strp, "%dsp16(", 7) == 0)
{
enum cgen_parse_operand_result result_type;
- bfd_vma value;
- const char *errmsg;
+ bfd_vma val;
*strp += 7;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_16,
- & result_type, & value);
+ & result_type, & val);
if (**strp != ')')
return _("missing `)'");
(*strp) ++;
if (errmsg == NULL
&& 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;
return errmsg;
}
int opindex, signed long *valuep)
{
const char *errmsg = 0;
- signed long value;
+ signed long value = 0;
if (strncasecmp (*strp, "%lo16(", 6) == 0)
{
enum cgen_parse_operand_result result_type;
- bfd_vma value;
- const char *errmsg;
+ bfd_vma val;
*strp += 6;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16,
- & result_type, & value);
+ & result_type, & val);
if (**strp != ')')
return _("missing `)'");
(*strp) ++;
if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
- {
- value &= 0xffff;
- }
+ value &= 0xffff;
+
+ value = val;
*valuep = value;
return errmsg;
}
if (strncasecmp (*strp, "%hi16(", 6) == 0)
{
enum cgen_parse_operand_result result_type;
- bfd_vma value;
- const char *errmsg;
+ bfd_vma val;
*strp += 6;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16,
- & result_type, & value);
+ & result_type, & val);
if (**strp != ')')
return _("missing `)'");
(*strp) ++;
if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
- {
- value >>= 16;
- }
+ val >>= 16;
+
+ value = val;
*valuep = value;
return errmsg;
}
};
disassemble_info *info = dis_info;
int mask;
- int index = 0;
+ int reg_index = 0;
char* comma = "";
if (push)
comma = ",";
}
- for (index = 1; index <= 7; ++index)
+ for (reg_index = 1; reg_index <= 7; ++reg_index)
{
if (push)
mask >>= 1;
if (value & mask)
{
(*info->fprintf_func) (info->stream, "%s%s", comma,
- m16c_register_names [index]);
+ m16c_register_names [reg_index]);
comma = ",";
}
}
+2009-12-11 Nick Clifton <nickc@redhat.com>
+
+ * elfcpp_file.h: Fix shadowed variable warnings.
+
2009-12-10 Doug Kwan <dougkwan@google.com>
* arm.h: New enums for EABI object attribute tags and values.
unsigned int
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_,
- This::shdr_size * shnum));
- for (unsigned int i = 0; i < shnum; i++)
+ This::shdr_size * tshnum));
+ for (unsigned int i = 0; i < tshnum; i++)
{
Ef_shdr shdr(v.data() + This::shdr_size * i);
if (shdr.get_sh_type() == type)
off_t shstr_off;
typename Elf_types<size>::Elf_WXword shstr_size;
{
- const unsigned int shstrndx = this->shstrndx_;
- typename File::View v(file->view(this->section_header_offset(shstrndx),
+ const unsigned int fshstrndx = this->shstrndx_;
+ typename File::View v(file->view(this->section_header_offset(fshstrndx),
This::shdr_size));
Ef_shdr shstr_shdr(v.data());
shstr_off = shstr_shdr.get_sh_offset();
+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>
* config/tc-i386.c (arch_entry): Add len and skip.
$(srcdir)/../ylwrap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
+ $(top_srcdir)/../config/zlib.m4 \
$(top_srcdir)/../bfd/warning.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
+ $(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../config/plugins.m4 \
$(top_srcdir)/../config/po.m4 \
$(top_srcdir)/../config/progtest.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
}
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);
- if (expr->type != Expr_Node_Constant)
+ int val = EXPR_VALUE (exp);
+ if (exp->type != Expr_Node_Constant)
return 0;
if (val < from || val > to)
return 0;
}
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 min = -1 << (sz - 1);
int max = (1 << (sz - 1)) - 1;
- int v = (EXPR_VALUE (expr)) & 0xffffffff;
+ int v = (EXPR_VALUE (exp)) & 0xffffffff;
if ((v % mul) != 0)
{
demand_empty_rest_of_line ();
}
-unsigned int dim_index;
-
static void
obj_coff_endef (int ignore ATTRIBUTE_UNUSED)
{
symbolS *symbolP = NULL;
- dim_index = 0;
if (def_symbol_in_progress == NULL)
{
as_warn (_(".endef pseudo-op used outside of .def/.endef: ignored."));
static void
obj_coff_dim (int ignore ATTRIBUTE_UNUSED)
{
- int dim_index;
+ int d_index;
if (def_symbol_in_progress == NULL)
{
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 ();
- SA_SET_SYM_DIMEN (def_symbol_in_progress, dim_index,
+ SA_SET_SYM_DIMEN (def_symbol_in_progress, d_index,
get_absolute_expression ());
switch (*input_line_pointer)
/* Fall through. */
case '\n':
case ';':
- dim_index = DIMNUM;
+ d_index = DIMNUM;
break;
}
}
/* We handle all bad expressions here, so that we can report the faulty
instruction in the error message. */
void
-md_operand (expressionS * expr)
+md_operand (expressionS * exp)
{
if (in_my_get_expression)
- expr->X_op = O_illegal;
+ exp->X_op = O_illegal;
}
/* Immediate values. */
}
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;
- if (expr.X_op == O_constant)
+ if (exp.X_op == O_constant)
{
- if (expr.X_add_number
- != (expr.X_add_number & 0x0000ffff))
+ if (exp.X_add_number
+ != (exp.X_add_number & 0x0000ffff))
{
inst.error = _("invalid register mask");
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 = (1 << regno) - 1;
regno);
}
- range |= expr.X_add_number;
+ range |= exp.X_add_number;
}
else
{
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.pc_rel = 0;
}
parse_shifter_operand (char **str, int i)
{
int value;
- expressionS expr;
+ expressionS exp;
if ((value = arm_reg_parse (str, REG_TYPE_RN)) != FAIL)
{
if (skip_past_comma (str) == SUCCESS)
{
/* #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;
- 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");
return FAIL;
}
- value = expr.X_add_number;
+ value = exp.X_add_number;
if (value < 0 || value > 30 || value % 2 != 0)
{
inst.error = _("invalid rotation");
case NS_SR: /* case 4. */
{
unsigned bcdebits = 0;
- struct neon_type_el et = neon_check_type (2, NS_NULL,
- N_8 | N_16 | N_32 | N_KEY, N_EQK);
- int logsize = neon_logbits (et.size);
+ int logsize;
unsigned dn = NEON_SCALAR_REG (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),
_(BAD_FPU));
constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_neon_ext_v1)
case NS_RS: /* case 6. */
{
- struct neon_type_el et = neon_check_type (2, NS_NULL,
- N_EQK, N_S8 | N_S16 | N_U8 | N_U16 | N_32 | N_KEY);
- unsigned logsize = neon_logbits (et.size);
+ unsigned logsize;
unsigned dn = NEON_SCALAR_REG (inst.operands[1].reg);
unsigned x = NEON_SCALAR_INDEX (inst.operands[1].reg);
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),
_(BAD_FPU));
constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_neon_ext_v1)
void
tc_pe_dwarf2_emit_offset (symbolS *symbol, unsigned int size)
{
- expressionS expr;
+ expressionS exp;
- expr.X_op = O_secrel;
- expr.X_add_symbol = symbol;
- expr.X_add_number = 0;
- emit_expr (&expr, size);
+ exp.X_op = O_secrel;
+ exp.X_add_symbol = symbol;
+ exp.X_add_number = 0;
+ emit_expr (&exp, size);
}
#endif
/* Tag_CPU_name. */
if (selected_cpu_name[0])
{
- char *p;
+ char *q;
- p = selected_cpu_name;
- if (strncmp (p, "armv", 4) == 0)
+ q = selected_cpu_name;
+ if (strncmp (q, "armv", 4) == 0)
{
int i;
- p += 4;
- for (i = 0; p[i]; i++)
- p[i] = TOUPPER (p[i]);
+ q += 4;
+ for (i = 0; q[i]; 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. */
#define INIT(t) t c_code = init_##t
#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 HI(x) ((x >> 16) & 0xffff)
{
int val;
int high_val;
- int reloc = 0;
+ int rel = 0;
INIT (CALLa);
switch(S){
- case 0 : reloc = BFD_RELOC_BFIN_24_PCREL_JUMP_L; break;
- case 1 : reloc = BFD_RELOC_24_PCREL; break;
- case 2 : reloc = BFD_RELOC_BFIN_PLTPC; break;
+ case 0 : rel = BFD_RELOC_BFIN_24_PCREL_JUMP_L; break;
+ case 1 : rel = BFD_RELOC_24_PCREL; break;
+ case 2 : rel = BFD_RELOC_BFIN_PLTPC; break;
default : break;
}
high_val = val >> 16;
return conscode (gencode (HI (c_code.opcode) | (high_val & 0xff)),
- Expr_Node_Gen_Reloc (addr, reloc));
+ Expr_Node_Gen_Reloc (addr, rel));
}
INSTR_T
/* Load and Store. */
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;
unsigned val = EXPR_VALUE (phword);
ASSIGN_R (reg);
grp = (GROUP (reg));
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));
}
- 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));
}
}
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 value = 0;
INIT (LDSTii);
-
if (!IS_PREG (*ptr))
{
fprintf (stderr, "Warning: possible mixup of Preg/Dreg\n");
return 0;
}
- switch (op)
+ switch (opc)
{
case 1:
case 2:
offset = value;
ASSIGN (offset);
ASSIGN (W);
- ASSIGN (op);
+ ASSIGNF (opc, op);
return GEN_OPCODE16 ();
}
}
INSTR_T
-bfin_gen_compi2opd (REG_T dst, int src, int op)
+bfin_gen_compi2opd (REG_T dst, int src, int opc)
{
INIT (COMPI2opD);
ASSIGN_R (dst);
ASSIGN (src);
- ASSIGN (op);
+ ASSIGNF (opc, op);
return GEN_OPCODE16 ();
}
INSTR_T
-bfin_gen_compi2opp (REG_T dst, int src, int op)
+bfin_gen_compi2opp (REG_T dst, int src, int opc)
{
INIT (COMPI2opP);
ASSIGN_R (dst);
ASSIGN (src);
- ASSIGN (op);
+ ASSIGNF (opc, op);
return GEN_OPCODE16 ();
}
INSTR_T
-bfin_gen_dagmodik (REG_T i, int op)
+bfin_gen_dagmodik (REG_T i, int opc)
{
INIT (DagMODik);
ASSIGN_R (i);
- ASSIGN (op);
+ ASSIGNF (opc, op);
return GEN_OPCODE16 ();
}
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);
ASSIGN_R (i);
ASSIGN_R (m);
- ASSIGN (op);
+ ASSIGNF (opc, op);
ASSIGN (br);
return GEN_OPCODE16 ();
}
INSTR_T
-bfin_gen_cc2stat (int cbit, int op, int D)
+bfin_gen_cc2stat (int cbit, int opc, int D)
{
INIT (CC2stat);
ASSIGN (cbit);
- ASSIGN (op);
+ ASSIGNF (opc, op);
ASSIGN (D);
return GEN_OPCODE16 ();
}
INSTR_T
-bfin_gen_cc2dreg (int op, REG_T reg)
+bfin_gen_cc2dreg (int opc, REG_T reg)
{
INIT (CC2dreg);
- ASSIGN (op);
+ ASSIGNF (opc, op);
ASSIGN_R (reg);
return GEN_OPCODE16 ();
}
INSTR_T
-bfin_gen_cactrl (REG_T reg, int a, int op)
+bfin_gen_cactrl (REG_T reg, int a, int opc)
{
INIT (CaCTRL);
ASSIGN_R (reg);
ASSIGN (a);
- ASSIGN (op);
+ ASSIGNF (opc, op);
return GEN_OPCODE16 ();
}
}
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;
char *lbeginsym, *lendsym;
Expr_Node_Value lbeginval, lendval;
Expr_Node *lbegin, *lend;
- loopsym = expr->value.s_value;
+ loopsym = exp->value.s_value;
lbeginsym = (char *) xmalloc (strlen (loopsym) + strlen ("__BEGIN") + 5);
lendsym = (char *) xmalloc (strlen (loopsym) + strlen ("__END") + 5);
}
void
-bfin_loop_beginend (Expr_Node *expr, int begin)
+bfin_loop_beginend (Expr_Node *exp, int begin)
{
const char *loopsym;
char *label_name;
- symbolS *line_label;
+ symbolS *linelabel;
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[0] = 0;
strcat (label_name, loopsym);
strcat (label_name, suffix);
- line_label = colon (label_name);
+ linelabel = colon (label_name);
/* LOOP_END follows the last instruction in the loop.
Adjust label address. */
if (!begin)
- ((struct local_symbol *) line_label)->lsy_value -= last_insn_size;
+ ((struct local_symbol *) linelabel)->lsy_value -= last_insn_size;
}
bfd_boolean
| 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 |.br| 1 | 1 |.op|.m.....|.i.....|
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
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);
else
return 0;
| 1 | 0 | 1 |.W.|.op....|.offset........|.ptr.......|.reg.......|
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
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);
- if (W == 0 && op != 3)
+ if (W == 0 && opc != 3)
return DREG_MASK (reg);
- else if (W == 0 && op == 3)
+ else if (W == 0 && opc == 3)
return 0;
- else if (W == 1 && op == 0)
+ else if (W == 1 && opc == 0)
return 0;
- else if (W == 1 && op == 1)
+ else if (W == 1 && opc == 1)
return 0;
- else if (W == 1 && op == 3)
+ else if (W == 1 && opc == 3)
return 0;
abort ();
static reg
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)
- return reg->value.reg_val;
+ if (rreg != NULL)
+ return rreg->value.reg_val;
return nullregister;
}
static reg
get_register_pair (char *reg_name)
{
- const reg_entry *reg;
+ const reg_entry *rreg;
char tmp_rp[16]="\0";
/* Add '(' and ')' to the reg pair, if its not present. */
tmp_rp[0] = '(';
strcat (tmp_rp, reg_name);
strcat (tmp_rp,")");
- reg = (const reg_entry *) hash_find (regp_hash, tmp_rp);
+ rreg = (const reg_entry *) hash_find (regp_hash, tmp_rp);
}
else
- reg = (const reg_entry *) hash_find (regp_hash, reg_name);
+ rreg = (const reg_entry *) hash_find (regp_hash, reg_name);
- if (reg != NULL)
- return reg->value.reg_val;
+ if (rreg != NULL)
+ return rreg->value.reg_val;
return nullregister;
}
static reg
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)
- && ((reg->value.reg_val == 12) || (reg->value.reg_val == 13)))
- return reg->value.reg_val;
+ if ((rreg != NULL)
+ && ((rreg->value.reg_val == 12) || (rreg->value.reg_val == 13)))
+ return rreg->value.reg_val;
return nullregister;
}
static reg
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)
- || (reg->value.reg_val != 9) || (reg->value.reg_val > 10))
- return reg->value.reg_val;
+ if ((rreg->value.reg_val != 1) || (rreg->value.reg_val != 7)
+ || (rreg->value.reg_val != 9) || (rreg->value.reg_val > 10))
+ 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;
static preg
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)
- return preg->value.preg_val;
+ if (prreg != NULL)
+ return prreg->value.preg_val;
return nullpregister;
}
static preg
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)
- return preg->value.preg_val;
+ if (prreg != NULL)
+ return prreg->value.preg_val;
return nullpregister;
}
const reg_entry * register_table,
const unsigned int num_entries)
{
- const reg_entry * reg;
+ const reg_entry * rreg;
const char *hashret;
if ((* hash_table = hash_new ()) == NULL)
as_fatal (_("Virtual memory exhausted"));
- for (reg = register_table;
- reg < (register_table + num_entries);
- reg++)
+ for (rreg = register_table;
+ rreg < (register_table + num_entries);
+ rreg++)
{
- hashret = hash_insert (* hash_table, reg->name, (char *) reg);
+ hashret = hash_insert (* hash_table, rreg->name, (char *) rreg);
if (hashret)
as_fatal (_("Internal Error: Can't hash %s: %s"),
- reg->name, hashret);
+ rreg->name, hashret);
}
}
static int
getreg_image (reg r)
{
- const reg_entry *reg;
+ const reg_entry *rreg;
char *reg_name;
int is_procreg = 0; /* Nonzero means argument should be processor reg. */
/* Check whether the register is in registers table. */
if (r < MAX_REG)
- reg = cr16_regtab + r;
+ rreg = cr16_regtab + r;
else /* Register not found. */
{
as_bad (_("Unknown register: `%d'"), r);
return 0;
}
- reg_name = reg->name;
+ reg_name = rreg->name;
/* Issue a error message when register is illegal. */
#define IMAGE_ERR \
reg_name, ins_parse); \
break;
- switch (reg->type)
+ switch (rreg->type)
{
case CR16_R_REGTYPE:
if (! is_procreg)
- return reg->image;
+ return rreg->image;
else
IMAGE_ERR;
case CR16_P_REGTYPE:
- return reg->image;
+ return rreg->image;
break;
default:
static int
getregp_image (reg r)
{
- const reg_entry *reg;
+ const reg_entry *rreg;
char *reg_name;
/* Check whether the register is in registers table. */
if (r < MAX_REG)
- reg = cr16_regptab + r;
+ rreg = cr16_regptab + r;
/* Register not found. */
else
{
return 0;
}
- reg_name = reg->name;
+ reg_name = rreg->name;
/* Issue a error message when register pair is illegal. */
#define RPAIR_IMAGE_ERR \
reg_name, ins_parse); \
break;
- switch (reg->type)
+ switch (rreg->type)
{
case CR16_RP_REGTYPE:
- return reg->image;
+ return rreg->image;
default:
RPAIR_IMAGE_ERR;
}
static int
getidxregp_image (reg r)
{
- const reg_entry *reg;
+ const reg_entry *rreg;
char *reg_name;
/* Check whether the register is in registers table. */
if (r < MAX_REG)
- reg = cr16_regptab + r;
+ rreg = cr16_regptab + r;
/* Register not found. */
else
{
return 0;
}
- reg_name = reg->name;
+ reg_name = rreg->name;
/* Issue a error message when register pair is illegal. */
#define IDX_RPAIR_IMAGE_ERR \
as_bad (_("Illegal index register pair (`%s') in Instruction: `%s'"), \
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 2: return 1; break;
static int
getprocreg_image (reg r)
{
- const reg_entry *reg;
+ const reg_entry *rreg;
char *reg_name;
/* Check whether the register is in registers table. */
if (r < MAX_PREG)
- reg = &cr16_pregtab[r - MAX_REG];
+ rreg = &cr16_pregtab[r - MAX_REG];
/* Register not found. */
else
{
return 0;
}
- reg_name = reg->name;
+ reg_name = rreg->name;
/* Issue a error message when register pair is illegal. */
#define PROCREG_IMAGE_ERR \
reg_name, ins_parse); \
break;
- switch (reg->type)
+ switch (rreg->type)
{
case CR16_P_REGTYPE:
- return reg->image;
+ return rreg->image;
default:
PROCREG_IMAGE_ERR;
}
static int
getprocregp_image (reg r)
{
- const reg_entry *reg;
+ const reg_entry *rreg;
char *reg_name;
int pregptab_disp = 0;
pregptab_disp = 5; break;
default: break;
}
- reg = &cr16_pregptab[r - pregptab_disp];
+ rreg = &cr16_pregptab[r - pregptab_disp];
}
/* Register not found. */
else
return 0;
}
- reg_name = reg->name;
+ reg_name = rreg->name;
/* Issue a error message when register pair is illegal. */
#define PROCREGP_IMAGE_ERR \
reg_name, ins_parse); \
break;
- switch (reg->type)
+ switch (rreg->type)
{
case CR16_P_REGTYPE:
- return reg->image;
+ return rreg->image;
default:
PROCREGP_IMAGE_ERR;
}
static reg
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)
- return reg->value.reg_val;
+ if (rreg != NULL)
+ return rreg->value.reg_val;
else
return nullregister;
}
static copreg
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)
- return copreg->value.copreg_val;
+ if (coreg != NULL)
+ return coreg->value.copreg_val;
else
return nullcopregister;
}
static int
getreg_image (reg r)
{
- const reg_entry *reg;
+ const reg_entry *rreg;
char *reg_name;
int is_procreg = 0; /* Nonzero means argument should be processor reg. */
/* Check whether the register is in registers table. */
if (r < MAX_REG)
- reg = &crx_regtab[r];
+ rreg = &crx_regtab[r];
/* Check whether the register is in coprocessor registers table. */
else if (r < MAX_COPREG)
- reg = &crx_copregtab[r-MAX_REG];
+ rreg = &crx_copregtab[r-MAX_REG];
/* Register not found. */
else
{
return 0;
}
- reg_name = reg->name;
+ reg_name = rreg->name;
/* Issue a error message when register is illegal. */
#define IMAGE_ERR \
reg_name, ins_parse); \
break;
- switch (reg->type)
+ switch (rreg->type)
{
case CRX_U_REGTYPE:
if (is_procreg || (instruction->flags & USER_REG))
- return reg->image;
+ return rreg->image;
else
IMAGE_ERR;
case CRX_CFG_REGTYPE:
if (is_procreg)
- return reg->image;
+ return rreg->image;
else
IMAGE_ERR;
case CRX_R_REGTYPE:
if (! is_procreg)
- return reg->image;
+ return rreg->image;
else
IMAGE_ERR;
case CRX_C_REGTYPE:
case CRX_CS_REGTYPE:
- return reg->image;
+ return rreg->image;
break;
default:
for (i = 0; opcode->operands[i + 1]; i++)
{
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)
bits += 2;
int fsize,
int cmp_hack)
{
- int numops, match, index, i = 0, j, k;
+ int numops, match, opcode_index, i = 0, j, k;
struct d30v_format *fm;
if (opcode == NULL)
/* Get all the operands and save them as expressions. */
numops = get_operands (myops, cmp_hack);
- while ((index = opcode->format[i++]) != 0)
+ while ((opcode_index = opcode->format[i++]) != 0)
{
- if (fsize == FORCE_SHORT && index >= LONG)
+ if (fsize == FORCE_SHORT && opcode_index >= LONG)
continue;
- if (fsize == FORCE_LONG && index < LONG)
+ if (fsize == FORCE_LONG && opcode_index < LONG)
continue;
- fm = (struct d30v_format *) &d30v_format_table[index];
- k = index;
- while (fm->form == index)
+ fm = (struct d30v_format *) &d30v_format_table[opcode_index];
+ k = opcode_index;
+ while (fm->form == opcode_index)
{
match = 1;
/* Now check the operands for compatibility. */
if (!strncmp (name, "cmp", 3))
{
int p, i;
- char **str = (char **) d30v_cc_names;
+ char **d30v_str = (char **) d30v_cc_names;
+
if (name[3] == 'u')
p = 4;
else
p = 3;
- for (i = 1; *str && strncmp (*str, &name[p], 2); i++, str++)
+ for (i = 1; *d30v_str && strncmp (*d30v_str, &name[p], 2); i++, d30v_str++)
;
/* cmpu only supports some condition codes. */
}
}
- if (!*str)
+ if (!*d30v_str)
{
name[p + 2] = 0;
as_bad (_("unknown condition code: %s"), &name[p]);
if (vliw1->insn_count == 2)
{
- struct vliw_insn_list *this_insn;
-
- /* check vliw1 for a label. */
+ /* Check vliw1 for a label. */
for (this_insn = vliw1->insn_list; this_insn; this_insn = this_insn->next)
{
if (this_insn->type == VLIW_LABEL_TYPE)
}
static int
-fr550_check_acc_range (FRV_VLIW *vliw, frv_insn *insn)
+fr550_check_acc_range (FRV_VLIW *vlw, frv_insn *insn)
{
- switch ((*vliw->current_vliw)[vliw->next_slot - 1])
+ switch ((*vlw->current_vliw)[vlw->next_slot - 1])
{
case UNIT_FM0:
case UNIT_FM2:
int nbytes=0;
expressionS exp;
char type=0;
+ char * clse;
if (is_it_end_of_statement ())
{
/* Get rid of pesky quotes. */
if ('\'' == *input_line_pointer)
{
- char * close;
-
++input_line_pointer;
- close = strchr (input_line_pointer, '\'');
- if (close)
- *close= ' ';
+ clse = strchr (input_line_pointer, '\'');
+ if (clse)
+ *clse= ' ';
else
as_bad (_("missing end-quote"));
}
if ('\"' == *input_line_pointer)
{
- char * close;
-
++input_line_pointer;
- close = strchr (input_line_pointer, '\"');
- if (close)
- *close= ' ';
+ clse = strchr (input_line_pointer, '\"');
+ if (clse)
+ *clse= ' ';
else
as_bad (_("missing end-quote"));
}
/* Get rid of pesky quotes. */
if ('\'' == *input_line_pointer)
{
- char * close;
+ char * clse;
+
++input_line_pointer;
- close = strchr (input_line_pointer, '\'');
- if (close)
- *close= ' ';
+ clse = strchr (input_line_pointer, '\'');
+ if (clse)
+ *clse= ' ';
else
as_bad (_("missing end-quote"));
}
if ('\"' == *input_line_pointer)
{
- char * close;
+ char * clse;
+
++input_line_pointer;
- close = strchr (input_line_pointer, '\"');
- if (close)
- *close= ' ';
+ clse = strchr (input_line_pointer, '\"');
+ if (clse)
+ *clse= ' ';
else
as_bad (_("missing end-quote"));
}
}
for (j = 0; i386_operators[j].name; ++j)
- if (strcasecmp(i386_operators[j].name, name) == 0)
+ if (strcasecmp (i386_operators[j].name, name) == 0)
{
if (i386_operators[j].operands
&& i386_operators[j].operands != operands)
}
for (j = 0; i386_types[j].name; ++j)
- if (strcasecmp(i386_types[j].name, name) == 0)
+ if (strcasecmp (i386_types[j].name, name) == 0)
break;
if (i386_types[j].name && *pc == ' ')
{
- char *name = ++input_line_pointer;
+ char *pname = ++input_line_pointer;
char c = get_symbol_end ();
- if (strcasecmp (name, "ptr") == 0)
+ if (strcasecmp (pname, "ptr") == 0)
{
- name[-1] = *pc;
+ pname[-1] = *pc;
*pc = c;
if (intel_syntax > 0 || operands != 1)
return O_illegal;
}
*input_line_pointer = c;
- input_line_pointer = name - 1;
+ input_line_pointer = pname - 1;
}
return O_absent;
static int i386_intel_parse_name (const char *name, expressionS *e)
{
- unsigned int i;
+ unsigned int j;
- for (i = 0; i386_types[i].name; ++i)
- if (strcasecmp(i386_types[i].name, name) == 0)
+ for (j = 0; i386_types[j].name; ++j)
+ if (strcasecmp(i386_types[j].name, name) == 0)
{
e->X_op = O_constant;
- e->X_add_number = i386_types[i].sz[flag_code];
+ e->X_add_number = i386_types[j].sz[flag_code];
e->X_add_symbol = NULL;
e->X_op_symbol = NULL;
return 1;
return 0;
}
-static INLINE int i386_intel_check (const reg_entry *reg,
+static INLINE int i386_intel_check (const reg_entry *rreg,
const reg_entry *base,
- const reg_entry *index)
+ const reg_entry *iindex)
{
- if ((this_operand >= 0 && reg != i.op[this_operand].regs)
- || base != intel_state.base || index != intel_state.index)
+ if ((this_operand >= 0 && rreg != i.op[this_operand].regs)
+ || base != intel_state.base || iindex != intel_state.index)
{
as_bad (_("invalid use of register"));
return 0;
static int i386_intel_simplify (expressionS *e)
{
- const reg_entry *reg = this_operand >= 0 ? i.op[this_operand].regs : NULL;
+ const reg_entry *the_reg = this_operand >= 0 ? i.op[this_operand].regs : NULL;
const reg_entry *base = intel_state.base;
- const reg_entry *index = intel_state.index;
+ const reg_entry *state_index = intel_state.index;
int ret;
if (!intel_syntax)
if (e->X_add_symbol)
{
if (!i386_intel_simplify_symbol (e->X_add_symbol)
- || !i386_intel_check(reg, intel_state.base, intel_state.index))
+ || !i386_intel_check(the_reg, intel_state.base, intel_state.index))
return 0;;
}
if (!intel_state.in_offset)
++intel_state.in_offset;
ret = i386_intel_simplify_symbol (e->X_add_symbol);
--intel_state.in_offset;
- if (!ret || !i386_intel_check(reg, base, index))
+ if (!ret || !i386_intel_check(the_reg, base, state_index))
return 0;
i386_intel_fold (e, e->X_add_symbol);
return ret;
return 0;
}
if (!i386_intel_simplify_symbol (e->X_op_symbol)
- || !i386_intel_check(reg, intel_state.base, intel_state.index))
+ || !i386_intel_check(the_reg, intel_state.base, intel_state.index))
return 0;
if (!intel_state.in_offset)
intel_state.seg = e->X_add_symbol;
if (e->X_op == O_add || e->X_op == O_subtract)
{
base = intel_state.base;
- index = intel_state.index;
+ state_index = intel_state.index;
}
- if (!i386_intel_check (reg, base, index)
+ if (!i386_intel_check (the_reg, base, state_index)
|| (e->X_op_symbol && !i386_intel_simplify_symbol (e->X_op_symbol))
- || !i386_intel_check (reg,
+ || !i386_intel_check (the_reg,
e->X_op != O_add ? base : intel_state.base,
- e->X_op != O_add ? index : intel_state.index))
+ e->X_op != O_add ? state_index : intel_state.index))
return 0;
break;
}
{
char *string = input_line_pointer;
int e = get_symbol_end ();
- unsigned int i;
+ unsigned int j;
i386_cpu_flags flags;
- for (i = 0; i < ARRAY_SIZE (cpu_arch); i++)
+ for (j = 0; j < ARRAY_SIZE (cpu_arch); j++)
{
- if (strcmp (string, cpu_arch[i].name) == 0)
+ if (strcmp (string, cpu_arch[j].name) == 0)
{
- check_cpu_arch_compatible (string, cpu_arch[i].flags);
+ check_cpu_arch_compatible (string, cpu_arch[j].flags);
if (*string != '.')
{
- cpu_arch_name = cpu_arch[i].name;
+ cpu_arch_name = cpu_arch[j].name;
cpu_sub_arch_name = NULL;
- cpu_arch_flags = cpu_arch[i].flags;
+ cpu_arch_flags = cpu_arch[j].flags;
if (flag_code == CODE_64BIT)
{
cpu_arch_flags.bitfield.cpu64 = 1;
cpu_arch_flags.bitfield.cpu64 = 0;
cpu_arch_flags.bitfield.cpuno64 = 1;
}
- cpu_arch_isa = cpu_arch[i].type;
- cpu_arch_isa_flags = cpu_arch[i].flags;
+ cpu_arch_isa = cpu_arch[j].type;
+ cpu_arch_isa_flags = cpu_arch[j].flags;
if (!cpu_arch_tune_set)
{
cpu_arch_tune = cpu_arch_isa;
if (strncmp (string + 1, "no", 2))
flags = cpu_flags_or (cpu_arch_flags,
- cpu_arch[i].flags);
+ cpu_arch[j].flags);
else
flags = cpu_flags_and_not (cpu_arch_flags,
- cpu_arch[i].flags);
+ cpu_arch[j].flags);
if (!cpu_flags_equal (&flags, &cpu_arch_flags))
{
if (cpu_sub_arch_name)
{
char *name = cpu_sub_arch_name;
cpu_sub_arch_name = concat (name,
- cpu_arch[i].name,
+ cpu_arch[j].name,
(const char *) NULL);
free (name);
}
else
- cpu_sub_arch_name = xstrdup (cpu_arch[i].name);
+ cpu_sub_arch_name = xstrdup (cpu_arch[j].name);
cpu_arch_flags = flags;
}
*input_line_pointer = e;
return;
}
}
- if (i >= ARRAY_SIZE (cpu_arch))
+ if (j >= ARRAY_SIZE (cpu_arch))
as_bad (_("no such architecture: `%s'"), string);
*input_line_pointer = e;
{
if (other != NO_RELOC)
{
- reloc_howto_type *reloc;
+ reloc_howto_type *rel;
if (size == 8)
switch (other)
if (size == 4 && flag_code != CODE_64BIT)
sign = -1;
- reloc = bfd_reloc_type_lookup (stdoutput, other);
- if (!reloc)
+ rel = bfd_reloc_type_lookup (stdoutput, other);
+ if (!rel)
as_bad (_("unknown relocation (%u)"), other);
- else if (size != bfd_get_reloc_size (reloc))
+ else if (size != bfd_get_reloc_size (rel))
as_bad (_("%u-byte relocation cannot be applied to %u-byte field"),
- bfd_get_reloc_size (reloc),
+ bfd_get_reloc_size (rel),
size);
- else if (pcrel && !reloc->pc_relative)
+ else if (pcrel && !rel->pc_relative)
as_bad (_("non-pc-relative relocation for pc-relative field"));
- else if ((reloc->complain_on_overflow == complain_overflow_signed
+ else if ((rel->complain_on_overflow == complain_overflow_signed
&& !sign)
- || (reloc->complain_on_overflow == complain_overflow_unsigned
+ || (rel->complain_on_overflow == complain_overflow_unsigned
&& sign > 0))
as_bad (_("relocated field and relocation type differ in signedness"));
else
{
if (i.op[op].disps->X_op == O_constant)
{
- offsetT disp = i.op[op].disps->X_add_number;
+ offsetT op_disp = i.op[op].disps->X_add_number;
if (i.types[op].bitfield.disp16
- && (disp & ~(offsetT) 0xffff) == 0)
+ && (op_disp & ~(offsetT) 0xffff) == 0)
{
/* If this operand is at most 16 bits, convert
to a signed 16 bit number and don't use 64bit
displacement. */
- disp = (((disp & 0xffff) ^ 0x8000) - 0x8000);
+ op_disp = (((op_disp & 0xffff) ^ 0x8000) - 0x8000);
i.types[op].bitfield.disp64 = 0;
}
if (i.types[op].bitfield.disp32
- && (disp & ~(((offsetT) 2 << 31) - 1)) == 0)
+ && (op_disp & ~(((offsetT) 2 << 31) - 1)) == 0)
{
/* If this operand is at most 32 bits, convert
to a signed 32 bit number and don't use 64bit
displacement. */
- disp &= (((offsetT) 2 << 31) - 1);
- disp = (disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31);
+ op_disp &= (((offsetT) 2 << 31) - 1);
+ op_disp = (op_disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31);
i.types[op].bitfield.disp64 = 0;
}
- if (!disp && i.types[op].bitfield.baseindex)
+ if (!op_disp && i.types[op].bitfield.baseindex)
{
i.types[op].bitfield.disp8 = 0;
i.types[op].bitfield.disp16 = 0;
}
else if (flag_code == CODE_64BIT)
{
- if (fits_in_signed_long (disp))
+ if (fits_in_signed_long (op_disp))
{
i.types[op].bitfield.disp64 = 0;
i.types[op].bitfield.disp32s = 1;
}
if (i.prefix[ADDR_PREFIX]
- && fits_in_unsigned_long (disp))
+ && fits_in_unsigned_long (op_disp))
i.types[op].bitfield.disp32 = 1;
}
if ((i.types[op].bitfield.disp32
|| i.types[op].bitfield.disp32s
|| i.types[op].bitfield.disp16)
- && fits_in_signed_byte (disp))
+ && fits_in_signed_byte (op_disp))
i.types[op].bitfield.disp8 = 1;
}
else if (i.reloc[op] == BFD_RELOC_386_TLS_DESC_CALL
static int
bad_implicit_operand (int xmm)
{
- const char *reg = xmm ? "xmm0" : "ymm0";
+ const char *ireg = xmm ? "xmm0" : "ymm0";
+
if (intel_syntax)
as_bad (_("the last operand of `%s' must be `%s%s'"),
- i.tm.name, register_prefix, reg);
+ i.tm.name, register_prefix, ireg);
else
as_bad (_("the first operand of `%s' must be `%s%s'"),
- i.tm.name, register_prefix, reg);
+ i.tm.name, register_prefix, ireg);
return 0;
}
&& (i.tm.opcode_modifier.vexnds
|| i.tm.opcode_modifier.vexndd))
{
- unsigned int dup = i.operands;
- unsigned int dest = dup - 1;
+ unsigned int dupl = i.operands;
+ unsigned int dest = dupl - 1;
unsigned int j;
/* The destination must be an xmm register. */
gas_assert (i.reg_operands
- && MAX_OPERANDS > dup
+ && MAX_OPERANDS > dupl
&& operand_type_equal (&i.types[dest], ®xmm));
if (i.tm.opcode_modifier.firstxmm0)
}
else if (i.tm.opcode_modifier.implicit1stxmm0)
{
- gas_assert ((MAX_OPERANDS - 1) > dup
+ gas_assert ((MAX_OPERANDS - 1) > dupl
&& i.tm.opcode_modifier.vex3sources);
/* Add the implicit xmm0 for instructions with VEX prefix
i.reg_operands += 2;
i.tm.operands += 2;
- dup++;
+ dupl++;
dest++;
- i.op[dup] = i.op[dest];
- i.types[dup] = i.types[dest];
- i.tm.operand_types[dup] = i.tm.operand_types[dest];
+ i.op[dupl] = i.op[dest];
+ i.types[dupl] = i.types[dest];
+ i.tm.operand_types[dupl] = i.tm.operand_types[dest];
}
else
{
i.reg_operands++;
i.tm.operands++;
- i.op[dup] = i.op[dest];
- i.types[dup] = i.types[dest];
- i.tm.operand_types[dup] = i.tm.operand_types[dest];
+ i.op[dupl] = i.op[dest];
+ i.types[dupl] = i.types[dest];
+ i.tm.operand_types[dupl] = i.tm.operand_types[dest];
}
if (i.tm.opcode_modifier.immext)
vex_2_sources = i.tm.opcode_modifier.vex2sources;
if (vex_3_sources)
{
- unsigned int nds, reg;
+ unsigned int nds, reg_slot;
expressionS *exp;
if (i.tm.opcode_modifier.veximmext
gas_assert (dest == 3);
}
else
- dest = i.operands - 1;
+ dest = i.operands - 1;
nds = dest - 1;
/* This instruction must have 4 register operands
if (i.tm.opcode_modifier.vexw1)
{
source = 0;
- reg = 1;
+ reg_slot = 1;
}
else
{
source = 1;
- reg = 0;
+ reg_slot = 0;
}
- gas_assert ((operand_type_equal (&i.tm.operand_types[reg], ®xmm)
- || operand_type_equal (&i.tm.operand_types[reg],
+ gas_assert ((operand_type_equal (&i.tm.operand_types[reg_slot], ®xmm)
+ || operand_type_equal (&i.tm.operand_types[reg_slot],
®ymm))
&& (operand_type_equal (&i.tm.operand_types[nds], ®xmm)
|| operand_type_equal (&i.tm.operand_types[nds],
®ymm)));
exp->X_op = O_constant;
exp->X_add_number
- = ((i.op[reg].regs->reg_num
- + ((i.op[reg].regs->reg_flags & RegRex) ? 8 : 0)) << 4);
+ = ((i.op[reg_slot].regs->reg_num
+ + ((i.op[reg_slot].regs->reg_flags & RegRex) ? 8 : 0)) << 4);
i.vex.register_specifier = i.op[nds].regs;
}
else
is non-null set it to the length of the string we removed from the
input line. Otherwise return NULL. */
static char *
-lex_got (enum bfd_reloc_code_real *reloc,
+lex_got (enum bfd_reloc_code_real *rel,
int *adjust,
i386_operand_type *types)
{
int first, second;
char *tmpbuf, *past_reloc;
- *reloc = gotrel[j].rel[object_64bit];
+ *rel = gotrel[j].rel[object_64bit];
if (adjust)
*adjust = len;
int
md_parse_option (int c, char *arg)
{
- unsigned int i;
+ unsigned int j;
char *arch, *next;
switch (c)
next = strchr (arch, '+');
if (next)
*next++ = '\0';
- for (i = 0; i < ARRAY_SIZE (cpu_arch); i++)
+ for (j = 0; j < ARRAY_SIZE (cpu_arch); j++)
{
- if (strcmp (arch, cpu_arch [i].name) == 0)
+ if (strcmp (arch, cpu_arch [j].name) == 0)
{
/* Processor. */
- cpu_arch_name = cpu_arch[i].name;
+ cpu_arch_name = cpu_arch[j].name;
cpu_sub_arch_name = NULL;
- cpu_arch_flags = cpu_arch[i].flags;
- cpu_arch_isa = cpu_arch[i].type;
- cpu_arch_isa_flags = cpu_arch[i].flags;
+ cpu_arch_flags = cpu_arch[j].flags;
+ cpu_arch_isa = cpu_arch[j].type;
+ cpu_arch_isa_flags = cpu_arch[j].flags;
if (!cpu_arch_tune_set)
{
cpu_arch_tune = cpu_arch_isa;
}
break;
}
- else if (*cpu_arch [i].name == '.'
- && strcmp (arch, cpu_arch [i].name + 1) == 0)
+ else if (*cpu_arch [j].name == '.'
+ && strcmp (arch, cpu_arch [j].name + 1) == 0)
{
/* ISA entension. */
i386_cpu_flags flags;
if (strncmp (arch, "no", 2))
flags = cpu_flags_or (cpu_arch_flags,
- cpu_arch[i].flags);
+ cpu_arch[j].flags);
else
flags = cpu_flags_and_not (cpu_arch_flags,
- cpu_arch[i].flags);
+ cpu_arch[j].flags);
if (!cpu_flags_equal (&flags, &cpu_arch_flags))
{
if (cpu_sub_arch_name)
{
char *name = cpu_sub_arch_name;
cpu_sub_arch_name = concat (name,
- cpu_arch[i].name,
+ cpu_arch[j].name,
(const char *) NULL);
free (name);
}
else
- cpu_sub_arch_name = xstrdup (cpu_arch[i].name);
+ cpu_sub_arch_name = xstrdup (cpu_arch[j].name);
cpu_arch_flags = flags;
}
break;
}
}
- if (i >= ARRAY_SIZE (cpu_arch))
+ if (j >= ARRAY_SIZE (cpu_arch))
as_fatal (_("Invalid -march= option: `%s'"), arg);
arch = next;
case OPTION_MTUNE:
if (*arg == '.')
as_fatal (_("Invalid -mtune= option: `%s'"), arg);
- for (i = 0; i < ARRAY_SIZE (cpu_arch); i++)
+ for (j = 0; j < ARRAY_SIZE (cpu_arch); j++)
{
- if (strcmp (arg, cpu_arch [i].name) == 0)
+ if (strcmp (arg, cpu_arch [j].name) == 0)
{
cpu_arch_tune_set = 1;
- cpu_arch_tune = cpu_arch [i].type;
- cpu_arch_tune_flags = cpu_arch[i].flags;
+ cpu_arch_tune = cpu_arch [j].type;
+ cpu_arch_tune_flags = cpu_arch[j].flags;
break;
}
}
- if (i >= ARRAY_SIZE (cpu_arch))
+ if (j >= ARRAY_SIZE (cpu_arch))
as_fatal (_("Invalid -mtune= option: `%s'"), arg);
break;
void
tc_pe_dwarf2_emit_offset (symbolS *symbol, unsigned int size)
{
- expressionS expr;
+ expressionS exp;
- expr.X_op = O_secrel;
- expr.X_add_symbol = symbol;
- expr.X_add_number = 0;
- emit_expr (&expr, size);
+ exp.X_op = O_secrel;
+ exp.X_add_symbol = symbol;
+ exp.X_add_number = 0;
+ emit_expr (&exp, size);
}
#endif
fragS *first_frag,
int before_relax)
{
- unsigned long index = 0;
+ unsigned long s_index = 0;
/* First time we are called, the initial address and frag are invalid. */
if (first_addr == 0)
/* We can get the final addresses only during and after
relaxation. */
if (first_frag->fr_next && first_frag->fr_next->fr_address)
- index += 3 * ((first_frag->fr_next->fr_address
+ s_index += 3 * ((first_frag->fr_next->fr_address
- first_frag->fr_address
- first_frag->fr_fix) >> 4);
}
case rs_align_test:
/* Take alignment into account. Assume the worst case
before relaxation. */
- index += 3 * ((1 << first_frag->fr_offset) >> 4);
+ s_index += 3 * ((1 << first_frag->fr_offset) >> 4);
break;
case rs_org:
break;
}
case rs_fill:
- index += 3 * (first_frag->fr_offset >> 4);
+ s_index += 3 * (first_frag->fr_offset >> 4);
break;
}
/* Add in the full size of the frag converted to instruction slots. */
- index += 3 * (first_frag->fr_fix >> 4);
+ s_index += 3 * (first_frag->fr_fix >> 4);
/* Subtract away the initial part before first_addr. */
- index -= (3 * ((first_addr >> 4) - (start_addr >> 4))
+ s_index -= (3 * ((first_addr >> 4) - (start_addr >> 4))
+ ((first_addr & 0x3) - (start_addr & 0x3)));
/* Move to the beginning of the next frag. */
}
/* Add in the used part of the last frag. */
- index += (3 * ((slot_addr >> 4) - (first_addr >> 4))
+ s_index += (3 * ((slot_addr >> 4) - (first_addr >> 4))
+ ((slot_addr & 0x3) - (first_addr & 0x3)));
- return index;
+ return s_index;
}
/* Optimize unwind record directives. */
}
static void
-cross_section (int ref, void (*cons) (int), int ua)
+cross_section (int ref, void (*builder) (int), int ua)
{
char *start, *end;
int saved_auto_align;
end = input_line_pointer + 1; /* skip comma */
input_line_pointer = start;
md.keep_pending_output = 1;
- section_count = bfd_count_sections(stdoutput);
+ section_count = bfd_count_sections (stdoutput);
obj_elf_section (0);
- if (section_count != bfd_count_sections(stdoutput))
+ if (section_count != bfd_count_sections (stdoutput))
as_warn (_("Creating sections with .xdataN/.xrealN/.xstringZ is deprecated."));
input_line_pointer = end;
saved_auto_align = md.auto_align;
if (ua)
md.auto_align = 0;
- (*cons) (ref);
+ (*builder) (ref);
if (ua)
md.auto_align = saved_auto_align;
obj_elf_previous (0);
}
static enum operand_match_result
-operand_match (const struct ia64_opcode *idesc, int index, expressionS *e)
+operand_match (const struct ia64_opcode *idesc, int res_index, expressionS *e)
{
- enum ia64_opnd opnd = idesc->operands[index];
+ enum ia64_opnd opnd = idesc->operands[res_index];
int bits, relocatable = 0;
struct insn_fix *fix;
bfd_signed_vma val;
case IA64_OPND_CNT2a:
case IA64_OPND_LEN4:
case IA64_OPND_LEN6:
- bits = operand_width (idesc->operands[index]);
+ bits = operand_width (idesc->operands[res_index]);
if (e->X_op == O_constant)
{
if ((bfd_vma) (e->X_add_number - 1) < ((bfd_vma) 1 << bits))
e->X_op = O_symbol;
}
- fix->opnd = idesc->operands[index];
+ fix->opnd = idesc->operands[res_index];
fix->expr = *e;
fix->is_pcrel = 0;
++CURR_SLOT.num_fixups;
case IA64_OPND_MBTYPE4:
case IA64_OPND_MHTYPE8:
case IA64_OPND_POS6:
- bits = operand_width (idesc->operands[index]);
+ bits = operand_width (idesc->operands[res_index]);
if (e->X_op == O_constant)
{
if ((bfd_vma) e->X_add_number < ((bfd_vma) 1 << bits))
break;
case IA64_OPND_IMMU9:
- bits = operand_width (idesc->operands[index]);
+ bits = operand_width (idesc->operands[res_index]);
if (e->X_op == O_constant)
{
if ((bfd_vma) e->X_add_number < ((bfd_vma) 1 << bits))
case IA64_OPND_IMM8M1U8:
case IA64_OPND_IMM9a:
case IA64_OPND_IMM9b:
- bits = operand_width (idesc->operands[index]);
+ bits = operand_width (idesc->operands[res_index]);
if (relocatable && (e->X_op == O_symbol
|| e->X_op == O_subtract
|| e->X_op == O_pseudo_fixup))
{
fix = CURR_SLOT.fixup + CURR_SLOT.num_fixups;
- if (idesc->operands[index] == IA64_OPND_IMM14)
+ if (idesc->operands[res_index] == IA64_OPND_IMM14)
fix->code = BFD_RELOC_IA64_IMM14;
else
fix->code = BFD_RELOC_IA64_IMM22;
e->X_op = O_symbol;
}
- fix->opnd = idesc->operands[index];
+ fix->opnd = idesc->operands[res_index];
fix->expr = *e;
fix->is_pcrel = 0;
++CURR_SLOT.num_fixups;
abort ();
fix->code = ia64_gen_real_reloc_type (e->X_op_symbol, fix->code);
- fix->opnd = idesc->operands[index];
+ fix->opnd = idesc->operands[res_index];
fix->expr = *e;
fix->is_pcrel = 1;
++CURR_SLOT.num_fixups;
create a dummy reloc. This will not live past md_apply_fix. */
fix->code = BFD_RELOC_UNUSED;
fix->code = ia64_gen_real_reloc_type (e->X_op_symbol, fix->code);
- fix->opnd = idesc->operands[index];
+ fix->opnd = idesc->operands[res_index];
fix->expr = *e;
fix->is_pcrel = 1;
++CURR_SLOT.num_fixups;
case IA64_OPND_LDXMOV:
fix = CURR_SLOT.fixup + CURR_SLOT.num_fixups;
fix->code = BFD_RELOC_IA64_LDXMOV;
- fix->opnd = idesc->operands[index];
+ fix->opnd = idesc->operands[res_index];
fix->expr = *e;
fix->is_pcrel = 0;
++CURR_SLOT.num_fixups;
|| (!rsrc_write && idesc->operands[1] == IA64_OPND_PMD_R3))
{
- int index = ((idesc->operands[1] == IA64_OPND_R3 && !rsrc_write)
- ? 1 : !rsrc_write);
- int regno = CURR_SLOT.opnd[index].X_add_number - REG_GR;
+ int reg_index = ((idesc->operands[1] == IA64_OPND_R3 && !rsrc_write)
+ ? 1 : !rsrc_write);
+ int regno = CURR_SLOT.opnd[reg_index].X_add_number - REG_GR;
if (regno >= 0 && regno < NELEMS (gr_values)
&& KNOWN (regno))
{
if (idesc->operands[0] == IA64_OPND_CR3
|| idesc->operands[1] == IA64_OPND_CR3)
{
- int index =
+ int reg_index =
((idesc->operands[0] == IA64_OPND_CR3)
? 0 : 1);
int regno =
- CURR_SLOT.opnd[index].X_add_number - REG_CR;
+ CURR_SLOT.opnd[reg_index].X_add_number - REG_CR;
switch (regno)
{
if (idesc->operands[0] == IA64_OPND_AR3
|| idesc->operands[1] == IA64_OPND_AR3)
{
- int index =
+ int reg_index =
((idesc->operands[0] == IA64_OPND_AR3)
? 0 : 1);
int regno =
- CURR_SLOT.opnd[index].X_add_number - REG_AR;
+ CURR_SLOT.opnd[reg_index].X_add_number - REG_AR;
if (regno == AR_ITC
|| regno == AR_RUC
- || (index == 0
+ || (reg_index == 0
&& (regno == AR_RSC
|| (regno >= AR_K0
&& regno <= AR_K7))))
void
ia64_dwarf2_emit_offset (symbolS *symbol, unsigned int size)
{
- expressionS expr;
+ expressionS exp;
- expr.X_op = O_pseudo_fixup;
- expr.X_op_symbol = pseudo_func[FUNC_SEC_RELATIVE].u.sym;
- expr.X_add_number = 0;
- expr.X_add_symbol = symbol;
- emit_expr (&expr, size);
+ exp.X_op = O_pseudo_fixup;
+ exp.X_op_symbol = pseudo_func[FUNC_SEC_RELATIVE].u.sym;
+ exp.X_add_number = 0;
+ exp.X_add_symbol = symbol;
+ emit_expr (&exp, size);
}
/* This is called whenever some data item (not an instruction) needs a
{
int bytes;
char *p;
- const unsigned char *nop;
+ const unsigned char *nop_type;
if (fragp->fr_type != rs_align_code)
return;
/* Check if this frag has to end with a stop bit. */
- nop = fragp->tc_frag_data ? le_nop_stop : le_nop;
+ nop_type = fragp->tc_frag_data ? le_nop_stop : le_nop;
bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
p = fragp->fr_literal + fragp->fr_fix;
}
/* Instruction bundles are always little-endian. */
- memcpy (p, nop, 16);
+ memcpy (p, nop_type, 16);
fragp->fr_var = 16;
}
char delim;
char *end_name;
symbolS *symbolP;
- sym_linkS *link;
+ sym_linkS *lnk;
name = input_line_pointer;
delim = get_symbol_end ();
else
{
- link = (sym_linkS *) xmalloc (sizeof (sym_linkS));
- link->symbol = symbolP;
- link->next = debug_sym_link;
- debug_sym_link = link;
+ lnk = (sym_linkS *) xmalloc (sizeof (sym_linkS));
+ lnk->symbol = symbolP;
+ lnk->next = debug_sym_link;
+ debug_sym_link = lnk;
symbol_get_obj (symbolP)->local = 1;
}
}
else
{
- char *opcode;
+ char *op;
frag = frag_now;
where = frag_now_fix ();
/* Branch offset must fit in 8-bits, don't do some relax. */
if (jmp_mode == 0 && flag_fixed_branches)
{
- opcode = m68hc11_new_insn (1);
- number_to_chars_bigendian (opcode, code, 1);
+ op = m68hc11_new_insn (1);
+ number_to_chars_bigendian (op, code, 1);
fixup8 (&operands[0].exp, M6811_OP_JUMP_REL, M6811_OP_JUMP_REL);
}
else if (code == M6811_BSR || code == M6811_BRA || code == M6812_BSR)
{
/* Allocate worst case storage. */
- opcode = m68hc11_new_insn (3);
- number_to_chars_bigendian (opcode, code, 1);
- number_to_chars_bigendian (opcode + 1, 0, 1);
+ op = m68hc11_new_insn (3);
+ number_to_chars_bigendian (op, code, 1);
+ number_to_chars_bigendian (op + 1, 0, 1);
frag_variant (rs_machine_dependent, 1, 1,
ENCODE_RELAX (STATE_PC_RELATIVE, STATE_UNDF),
operands[0].exp.X_add_symbol, (offsetT) n,
- opcode);
+ op);
}
else if (current_architecture & cpu6812)
{
- opcode = m68hc11_new_insn (2);
- number_to_chars_bigendian (opcode, code, 1);
- number_to_chars_bigendian (opcode + 1, 0, 1);
+ op = m68hc11_new_insn (2);
+ number_to_chars_bigendian (op, code, 1);
+ number_to_chars_bigendian (op + 1, 0, 1);
frag_var (rs_machine_dependent, 2, 2,
ENCODE_RELAX (STATE_CONDITIONAL_BRANCH_6812, STATE_UNDF),
- operands[0].exp.X_add_symbol, (offsetT) n, opcode);
+ operands[0].exp.X_add_symbol, (offsetT) n, op);
}
else
{
- opcode = m68hc11_new_insn (2);
- number_to_chars_bigendian (opcode, code, 1);
- number_to_chars_bigendian (opcode + 1, 0, 1);
+ op = m68hc11_new_insn (2);
+ number_to_chars_bigendian (op, code, 1);
+ number_to_chars_bigendian (op + 1, 0, 1);
frag_var (rs_machine_dependent, 3, 3,
ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_UNDF),
- operands[0].exp.X_add_symbol, (offsetT) n, opcode);
+ operands[0].exp.X_add_symbol, (offsetT) n, op);
}
}
}
/* Return the number of nops that would be needed to work around the
VR4130 mflo/mfhi errata if instruction INSN immediately followed
- the MAX_VR4130_NOPS instructions described by HISTORY. */
+ the MAX_VR4130_NOPS instructions described by HIST. */
static int
-nops_for_vr4130 (const struct mips_cl_insn *history,
+nops_for_vr4130 (const struct mips_cl_insn *hist,
const struct mips_cl_insn *insn)
{
int i, j, reg;
/* Search for the first MFLO or MFHI. */
for (i = 0; i < MAX_VR4130_NOPS; i++)
- if (MF_HILO_INSN (history[i].insn_mo->pinfo))
+ if (MF_HILO_INSN (hist[i].insn_mo->pinfo))
{
/* Extract the destination register. */
if (mips_opts.mips16)
- reg = mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RX, history[i])];
+ reg = mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RX, hist[i])];
else
- reg = EXTRACT_OPERAND (RD, history[i]);
+ reg = EXTRACT_OPERAND (RD, hist[i]);
/* No nops are needed if INSN reads that register. */
if (insn != NULL && insn_uses_reg (insn, reg, MIPS_GR_REG))
/* ...or if any of the intervening instructions do. */
for (j = 0; j < i; j++)
- if (insn_uses_reg (&history[j], reg, MIPS_GR_REG))
+ if (insn_uses_reg (&hist[j], reg, MIPS_GR_REG))
return 0;
return MAX_VR4130_NOPS - i;
}
/* Return the number of nops that would be needed if instruction INSN
- immediately followed the MAX_NOPS instructions given by HISTORY,
- where HISTORY[0] is the most recent instruction. If INSN is null,
+ immediately followed the MAX_NOPS instructions given by HIST,
+ where HIST[0] is the most recent instruction. If INSN is null,
return the worse-case number of nops for any instruction. */
static int
-nops_for_insn (const struct mips_cl_insn *history,
+nops_for_insn (const struct mips_cl_insn *hist,
const struct mips_cl_insn *insn)
{
int i, nops, tmp_nops;
nops = 0;
for (i = 0; i < MAX_DELAY_NOPS; i++)
{
- tmp_nops = insns_between (history + i, insn) - i;
+ tmp_nops = insns_between (hist + i, insn) - i;
if (tmp_nops > nops)
nops = tmp_nops;
}
if (mips_fix_vr4130)
{
- tmp_nops = nops_for_vr4130 (history, insn);
+ tmp_nops = nops_for_vr4130 (hist, insn);
if (tmp_nops > nops)
nops = tmp_nops;
}
}
/* The variable arguments provide NUM_INSNS extra instructions that
- might be added to HISTORY. Return the largest number of nops that
+ might be added to HIST. Return the largest number of nops that
would be needed after the extended sequence. */
static int
-nops_for_sequence (int num_insns, const struct mips_cl_insn *history, ...)
+nops_for_sequence (int num_insns, const struct mips_cl_insn *hist, ...)
{
va_list args;
struct mips_cl_insn buffer[MAX_NOPS];
struct mips_cl_insn *cursor;
int nops;
- va_start (args, history);
+ va_start (args, hist);
cursor = buffer + num_insns;
- memcpy (cursor, history, (MAX_NOPS - num_insns) * sizeof (*cursor));
+ memcpy (cursor, hist, (MAX_NOPS - num_insns) * sizeof (*cursor));
while (cursor > buffer)
*--cursor = *va_arg (args, const struct mips_cl_insn *);
worst-case delay for the branch target. */
static int
-nops_for_insn_or_target (const struct mips_cl_insn *history,
+nops_for_insn_or_target (const struct mips_cl_insn *hist,
const struct mips_cl_insn *insn)
{
int nops, tmp_nops;
- nops = nops_for_insn (history, insn);
+ nops = nops_for_insn (hist, insn);
if (insn->insn_mo->pinfo & (INSN_UNCOND_BRANCH_DELAY
| INSN_COND_BRANCH_DELAY
| INSN_COND_BRANCH_LIKELY))
{
- tmp_nops = nops_for_sequence (2, history, insn, NOP_INSN);
+ tmp_nops = nops_for_sequence (2, hist, insn, NOP_INSN);
if (tmp_nops > nops)
nops = tmp_nops;
}
else if (mips_opts.mips16 && (insn->insn_mo->pinfo & MIPS16_INSN_BRANCH))
{
- tmp_nops = nops_for_sequence (1, history, insn);
+ tmp_nops = nops_for_sequence (1, hist, insn);
if (tmp_nops > nops)
nops = tmp_nops;
}
}
else if (IS_SEXT_32BIT_NUM (expr1.X_add_number + 0x8000))
{
- int dreg;
-
/* If we are going to add in a base register, and the
target register and the base register are the same,
then we are using AT as a temporary register. Since
}
else
{
- int dreg;
-
/* If we are going to add in a base register, and the
target register and the base register are the same,
then we are using AT as a temporary register. Since
}
else if (IS_SEXT_32BIT_NUM (expr1.X_add_number + 0x8000))
{
- int dreg;
-
/* If we are going to add in a base register, and the
target register and the base register are the same,
then we are using AT as a temporary register. Since
case M_DROL_I:
{
unsigned int rot;
- char *l, *r;
+ char *l;
+ char *rr;
if (imm_expr.X_op != O_constant)
as_bad (_("Improper rotate count"));
break;
}
l = (rot < 0x20) ? "dsll" : "dsll32";
- r = ((0x40 - rot) < 0x20) ? "dsrl" : "dsrl32";
+ rr = ((0x40 - rot) < 0x20) ? "dsrl" : "dsrl32";
rot &= 0x1f;
used_at = 1;
macro_build (NULL, l, "d,w,<", AT, sreg, rot);
- macro_build (NULL, r, "d,w,<", dreg, sreg, (0x20 - rot) & 0x1f);
+ macro_build (NULL, rr, "d,w,<", dreg, sreg, (0x20 - rot) & 0x1f);
macro_build (NULL, "or", "d,v,t", dreg, dreg, AT);
}
break;
case M_DROR_I:
{
unsigned int rot;
- char *l, *r;
+ char *l;
+ char *rr;
if (imm_expr.X_op != O_constant)
as_bad (_("Improper rotate count"));
macro_build (NULL, "dsrl", "d,w,<", dreg, sreg, 0);
break;
}
- r = (rot < 0x20) ? "dsrl" : "dsrl32";
+ rr = (rot < 0x20) ? "dsrl" : "dsrl32";
l = ((0x40 - rot) < 0x20) ? "dsll" : "dsll32";
rot &= 0x1f;
used_at = 1;
- macro_build (NULL, r, "d,w,<", AT, sreg, rot);
+ macro_build (NULL, rr, "d,w,<", AT, sreg, rot);
macro_build (NULL, l, "d,w,<", dreg, sreg, (0x20 - rot) & 0x1f);
macro_build (NULL, "or", "d,v,t", dreg, dreg, AT);
}
{
int opcode = 0;
int framesz = 0, seen_framesz = 0;
- int args = 0, statics = 0, sregs = 0;
+ int nargs = 0, statics = 0, sregs = 0;
while (*s != '\0')
{
{
if (!seen_framesz)
/* args $a0-$a3 */
- args |= 1 << (reg1 - 4);
+ nargs |= 1 << (reg1 - 4);
else
/* statics $a0-$a3 */
statics |= 1 << (reg1 - 4);
}
/* Encode args/statics combination. */
- if (args & statics)
+ if (nargs & statics)
as_bad (_("arg/static registers overlap"));
- else if (args == 0xf)
+ else if (nargs == 0xf)
/* All $a0-$a3 are args. */
opcode |= MIPS16_ALL_ARGS << 16;
else if (statics == 0xf)
int narg = 0, nstat = 0;
/* Count arg registers. */
- while (args & 0x1)
+ while (nargs & 0x1)
{
- args >>= 1;
+ nargs >>= 1;
narg++;
}
- if (args != 0)
+ if (nargs != 0)
as_bad (_("invalid arg register list"));
/* Count static registers. */
for (i = 0; i < fc; i++)
{
const struct mn10200_operand *operand;
+ int reloc_size;
operand = &mn10200_operands[fixups[i].opindex];
if (fixups[i].reloc != BFD_RELOC_UNUSED)
{
reloc_howto_type *reloc_howto;
- int size;
int offset;
fixS *fixP;
if (!reloc_howto)
abort ();
- size = bfd_get_reloc_size (reloc_howto);
+ reloc_size = bfd_get_reloc_size (reloc_howto);
- if (size < 1 || size > 4)
+ if (reloc_size < 1 || reloc_size > 4)
abort ();
- offset = 4 - size;
+ offset = 4 - reloc_size;
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset,
- size,
+ reloc_size,
&fixups[i].exp,
reloc_howto->pc_relative,
fixups[i].reloc);
next instruction, not from the start of the current
instruction. */
if (reloc_howto->pc_relative)
- fixP->fx_offset += size;
+ fixP->fx_offset += reloc_size;
}
else
{
- int reloc, pcrel, reloc_size, offset;
+ int reloc, pcrel, offset;
fixS *fixP;
reloc = BFD_RELOC_NONE;
that they do indeed not match. */
if (opcode->no_match_operands)
{
- int i;
-
/* Look at each operand to see if it's marked. */
for (i = 0; i < MN10300_MAX_OPERANDS; i++)
{
for (i = 0; i < fc; i++)
{
const struct mn10300_operand *operand;
+ int reloc_size;
operand = &mn10300_operands[fixups[i].opindex];
if (fixups[i].reloc != BFD_RELOC_UNUSED
&& fixups[i].reloc != BFD_RELOC_MN10300_GOT32)
{
reloc_howto_type *reloc_howto;
- int size;
int offset;
fixS *fixP;
if (!reloc_howto)
abort ();
- size = bfd_get_reloc_size (reloc_howto);
+ reloc_size = bfd_get_reloc_size (reloc_howto);
- if (size < 1 || size > 4)
+ if (reloc_size < 1 || reloc_size > 4)
abort ();
offset = 4 - size;
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset,
- size, &fixups[i].exp,
+ reloc_size, &fixups[i].exp,
reloc_howto->pc_relative,
fixups[i].reloc);
}
else
{
- int reloc, pcrel, reloc_size, offset;
+ int reloc, pcrel, offset;
fixS *fixP;
reloc = BFD_RELOC_NONE;
static int
addr_mode (char *operand,
- addr_modeS *addr_modeP,
+ addr_modeS *addrmodeP,
int recursive_level)
{
char *str;
int j;
mode = DEFAULT; /* Default. */
- addr_modeP->scaled_mode = 0; /* Why not. */
- addr_modeP->scaled_reg = 0; /* If 0, not scaled index. */
- addr_modeP->float_flag = 0;
- addr_modeP->am_size = 0;
- addr_modeP->im_disp = 0;
- addr_modeP->pcrel = 0; /* Not set in this function. */
- addr_modeP->disp_suffix[0] = 0;
- addr_modeP->disp_suffix[1] = 0;
- addr_modeP->disp[0] = NULL;
- addr_modeP->disp[1] = NULL;
+ addrmodeP->scaled_mode = 0; /* Why not. */
+ addrmodeP->scaled_reg = 0; /* If 0, not scaled index. */
+ addrmodeP->float_flag = 0;
+ addrmodeP->am_size = 0;
+ addrmodeP->im_disp = 0;
+ addrmodeP->pcrel = 0; /* Not set in this function. */
+ addrmodeP->disp_suffix[0] = 0;
+ addrmodeP->disp_suffix[1] = 0;
+ addrmodeP->disp[0] = NULL;
+ addrmodeP->disp[1] = NULL;
str = operand;
if (str[0] == 0)
case ABSOLUTE_PREFIX:
if (str[strl - 1] == ']')
break;
- addr_modeP->mode = 21; /* absolute */
- addr_modeP->disp[0] = str + 1;
+ addrmodeP->mode = 21; /* absolute */
+ addrmodeP->disp[0] = str + 1;
return -1;
#endif
#ifdef IMMEDIATE_PREFIX
case IMMEDIATE_PREFIX:
if (str[strl - 1] == ']')
break;
- addr_modeP->mode = 20; /* immediate */
- addr_modeP->disp[0] = str + 1;
+ addrmodeP->mode = 20; /* immediate */
+ addrmodeP->disp[0] = str + 1;
return -1;
#endif
case '.':
case '+':
if (str[2] != '\000')
{
- addr_modeP->mode = 27; /* pc-relative */
- addr_modeP->disp[0] = str + 2;
+ addrmodeP->mode = 27; /* pc-relative */
+ addrmodeP->disp[0] = str + 2;
return -1;
}
default:
{
if ((!strncmp (str, "ext(", 4)) && strl > 7)
{ /* external */
- addr_modeP->disp[0] = str + 4;
+ addrmodeP->disp[0] = str + 4;
i = 0;
j = 2;
do
return (0);
}
str[j] = '\000'; /* null terminate disp[0] */
- addr_modeP->disp[1] = str + j + 2;
- addr_modeP->mode = 22;
+ addrmodeP->disp[1] = str + j + 2;
+ addrmodeP->mode = 22;
return -1;
}
}
switch (str[0])
{
case 'f':
- addr_modeP->float_flag = 1;
+ addrmodeP->float_flag = 1;
/* Drop through. */
case 'r':
if (str[1] >= '0' && str[1] < '8')
{
- addr_modeP->mode = str[1] - '0';
+ addrmodeP->mode = str[1] - '0';
return -1;
}
break;
case 3:
if (!strncmp (str, "tos", 3))
{
- addr_modeP->mode = 23; /* TopOfStack */
+ addrmodeP->mode = 23; /* TopOfStack */
return -1;
}
break;
if (mode != DEFAULT)
{
/* Memory relative. */
- addr_modeP->mode = mode;
+ addrmodeP->mode = mode;
j = strl - 5; /* Temp for end of disp[0]. */
i = 0;
return (0);
}
- addr_modeP->disp[1] = str;
- addr_modeP->disp[0] = str + strl + 1;
+ addrmodeP->disp[1] = str;
+ addrmodeP->disp[0] = str + strl + 1;
str[j] = '\000'; /* Null terminate disp[0] . */
str[strl] = '\000'; /* Null terminate disp[1]. */
&& str[strl - 2] < '8'
&& str[strl - 4] == '(')
{
- addr_modeP->mode = str[strl - 2] - '0' + 8;
- addr_modeP->disp[0] = str;
+ addrmodeP->mode = str[strl - 2] - '0' + 8;
+ addrmodeP->disp[0] = str;
str[strl - 4] = 0;
return -1; /* reg rel */
}
if (mode != DEFAULT)
{
- addr_modeP->mode = mode;
- addr_modeP->disp[0] = str;
+ addrmodeP->mode = mode;
+ addrmodeP->disp[0] = str;
str[strl - 4] = '\0';
return -1; /* Memory space. */
return 0;
}
- addr_modeP->am_size += 1; /* scaled index byte. */
+ addrmodeP->am_size += 1; /* scaled index byte. */
j = str[strl - 4] - '0'; /* store temporary. */
str[strl - 6] = '\000'; /* nullterminate for recursive call. */
- i = addr_mode (str, addr_modeP, 1);
+ i = addr_mode (str, addrmodeP, 1);
- if (!i || addr_modeP->mode == 20)
+ if (!i || addrmodeP->mode == 20)
{
as_bad (_("Invalid or illegal addressing mode combined with scaled-index"));
return 0;
}
- addr_modeP->scaled_mode = addr_modeP->mode; /* Store the inferior mode. */
- addr_modeP->mode = mode;
- addr_modeP->scaled_reg = j + 1;
+ addrmodeP->scaled_mode = addrmodeP->mode; /* Store the inferior mode. */
+ addrmodeP->mode = mode;
+ addrmodeP->scaled_reg = j + 1;
return -1;
}
}
- addr_modeP->mode = DEFAULT; /* Default to whatever. */
- addr_modeP->disp[0] = str;
+ addrmodeP->mode = DEFAULT; /* Default to whatever. */
+ addrmodeP->disp[0] = str;
return -1;
}
ns32k-opcode. Also builds index bytes if needed. */
static int
-get_addr_mode (char *ptr, addr_modeS *addr_modeP)
+get_addr_mode (char *ptr, addr_modeS *addrmodeP)
{
int tmp;
- addr_mode (ptr, addr_modeP, 0);
+ addr_mode (ptr, addrmodeP, 0);
- if (addr_modeP->mode == DEFAULT || addr_modeP->scaled_mode == -1)
+ if (addrmodeP->mode == DEFAULT || addrmodeP->scaled_mode == -1)
{
/* Resolve ambiguous operands, this shouldn't be necessary if
one uses standard NSC operand syntax. But the sequent
if it is implicitly stated. See ns32k-opcode.h. */
(void) evaluate_expr (&exprP, ptr); /* This call takes time Sigh! */
- if (addr_modeP->mode == DEFAULT)
+ if (addrmodeP->mode == DEFAULT)
{
if (exprP.X_add_symbol || exprP.X_op_symbol)
- addr_modeP->mode = desc->default_model; /* We have a label. */
+ addrmodeP->mode = desc->default_model; /* We have a label. */
else
- addr_modeP->mode = desc->default_modec; /* We have a constant. */
+ addrmodeP->mode = desc->default_modec; /* We have a constant. */
}
else
{
if (exprP.X_add_symbol || exprP.X_op_symbol)
- addr_modeP->scaled_mode = desc->default_model;
+ addrmodeP->scaled_mode = desc->default_model;
else
- addr_modeP->scaled_mode = desc->default_modec;
+ addrmodeP->scaled_mode = desc->default_modec;
}
/* Must put this mess down in addr_mode to handle the scaled
case. Think it does so with local labels too, not optimum, pcrel
is better. When I have time I will make gas check this and
select pcrel when possible Actually that is trivial. */
- if ((tmp = addr_modeP->scaled_reg))
+ if ((tmp = addrmodeP->scaled_reg))
{ /* Build indexbyte. */
tmp--; /* Remember regnumber comes incremented for
flagpurpose. */
- tmp |= addr_modeP->scaled_mode << 3;
- addr_modeP->index_byte = (char) tmp;
- addr_modeP->am_size += 1;
+ tmp |= addrmodeP->scaled_mode << 3;
+ addrmodeP->index_byte = (char) tmp;
+ addrmodeP->am_size += 1;
}
- gas_assert (addr_modeP->mode >= 0);
- if (disp_test[(unsigned int) addr_modeP->mode])
+ gas_assert (addrmodeP->mode >= 0);
+ if (disp_test[(unsigned int) addrmodeP->mode])
{
char c;
char suffix;
char *fromP;
/* There was a displacement, probe for length specifying suffix. */
- addr_modeP->pcrel = 0;
+ addrmodeP->pcrel = 0;
- gas_assert (addr_modeP->mode >= 0);
- if (disp_test[(unsigned int) addr_modeP->mode])
+ gas_assert (addrmodeP->mode >= 0);
+ if (disp_test[(unsigned int) addrmodeP->mode])
{
/* There is a displacement. */
- if (addr_modeP->mode == 27 || addr_modeP->scaled_mode == 27)
+ if (addrmodeP->mode == 27 || addrmodeP->scaled_mode == 27)
/* Do we have pcrel. mode. */
- addr_modeP->pcrel = 1;
+ addrmodeP->pcrel = 1;
- addr_modeP->im_disp = 1;
+ addrmodeP->im_disp = 1;
for (i = 0; i < 2; i++)
{
suffix_sub = suffix = 0;
- if ((toP = addr_modeP->disp[i]))
+ if ((toP = addrmodeP->disp[i]))
{
/* Suffix of expression, the largest size rules. */
fromP = toP;
}
*toP = '\0'; /* Terminate properly. */
- addr_modeP->disp_suffix[i] = suffix;
- addr_modeP->am_size += suffix ? suffix : 4;
+ addrmodeP->disp_suffix[i] = suffix;
+ addrmodeP->am_size += suffix ? suffix : 4;
}
}
}
}
else
{
- if (addr_modeP->mode == 20)
+ if (addrmodeP->mode == 20)
{
/* Look in ns32k_opcode for size. */
- addr_modeP->disp_suffix[0] = addr_modeP->am_size = desc->im_size;
- addr_modeP->im_disp = 0;
+ addrmodeP->disp_suffix[0] = addrmodeP->am_size = desc->im_size;
+ addrmodeP->im_disp = 0;
}
}
- return addr_modeP->mode;
+ return addrmodeP->mode;
}
/* Read an optionlist. */
static bfd_reloc_code_real_type
reloc (int size, int pcrel, int type)
{
- int length, index;
+ int length, rel_index;
bfd_reloc_code_real_type relocs[] =
{
BFD_RELOC_NS32K_IMM_8,
break;
}
- index = length + 3 * pcrel + 6 * type;
+ rel_index = length + 3 * pcrel + 6 * type;
- if (index >= 0 && (unsigned int) index < sizeof (relocs) / sizeof (relocs[0]))
- return relocs[index];
+ if (rel_index >= 0 && (unsigned int) rel_index < sizeof (relocs) / sizeof (relocs[0]))
+ return relocs[rel_index];
if (pcrel)
as_bad (_("Can not do %d byte pc-relative relocation for storage type %d"),
expression. */
int
-ppc_parse_name (const char *name, expressionS *expr)
+ppc_parse_name (const char *name, expressionS *exp)
{
int val;
if (val < 0)
return 0;
- expr->X_op = O_constant;
- expr->X_add_number = val;
+ exp->X_op = O_constant;
+ exp->X_add_number = val;
return 1;
}
ppc_insert_operand (unsigned long insn,
const struct powerpc_operand *operand,
offsetT val,
- ppc_cpu_t ppc_cpu,
+ ppc_cpu_t cpu,
char *file,
unsigned int line)
{
const char *errmsg;
errmsg = NULL;
- insn = (*operand->insert) (insn, (long) val, ppc_cpu, &errmsg);
+ insn = (*operand->insert) (insn, (long) val, cpu, &errmsg);
if (errmsg != (const char *) NULL)
as_bad_where (file, line, "%s", errmsg);
}
{
unsigned int opcount;
unsigned int num_operands_expected;
- unsigned int i;
/* There is an optional operand. Count the number of
commas in the input line. */
if (*input_line_pointer == ',')
{
- expressionS ignore;
+ expressionS exp;
/* Ignore the third argument. */
++input_line_pointer;
- expression (&ignore);
+ expression (& exp);
if (*input_line_pointer == ',')
{
/* Ignore the fourth argument. */
++input_line_pointer;
- expression (&ignore);
+ expression (& exp);
if (*input_line_pointer == ',')
{
/* The fifth argument is the function size. */
static void s3_md_number_to_chars (char *buf, valueT val, int n);
static valueT s3_md_chars_to_number (char *buf, int n);
static void s3_assemble (char *str);
-static void s3_operand (expressionS * expr);
+static void s3_operand (expressionS *);
static void s3_begin (void);
static void s3_number_to_chars (char *buf, valueT val, int n);
static char *s3_atof (int type, char *litP, int *sizeP);
if (s3_inst.reloc.exp.X_op == O_constant)
{
- int value;
unsigned int data_type;
if (pre_inc == 1)
}
static void
-s3_operand (expressionS * expr)
+s3_operand (expressionS * exp)
{
if (s3_in_my_get_expression)
{
- expr->X_op = O_illegal;
+ exp->X_op = O_illegal;
if (s3_inst.error == NULL)
{
s3_inst.error = _("bad expression");
/* We handle all bad expressions here, so that we can report the faulty
instruction in the error message. */
void
-md_operand (expressionS * expr)
+md_operand (expressionS * exp)
{
if (score3)
- s3_operand (expr);
+ s3_operand (exp);
else
- s7_operand (expr);
+ s7_operand (exp);
}
/* Turn an integer of n bytes (in val) into a stream of bytes appropriate
if (s7_inst.reloc.exp.X_op == O_constant)
{
- int value;
unsigned int data_type;
if (pre_inc == 1)
instruction in the error message. */
static void
-s7_operand (expressionS * expr)
+s7_operand (expressionS * exp)
{
if (s7_in_my_get_expression)
{
- expr->X_op = O_illegal;
+ exp->X_op = O_illegal;
if (s7_inst.error == NULL)
{
s7_inst.error = _("bad expression");
static unsigned int
build_Mytes (sh_opcode_info *opcode, sh_operand_info *operand)
{
- int index;
+ int indx;
char nbuf[8];
char *output;
unsigned int size = 2;
else
output = frag_more (2);
- for (index = 0; index < max_index; index++)
+ for (indx = 0; indx < max_index; indx++)
{
- sh_nibble_type i = opcode->nibbles[index];
+ sh_nibble_type i = opcode->nibbles[indx];
if (i < 16)
{
- nbuf[index] = i;
+ nbuf[indx] = i;
}
else
{
{
case REG_N:
case REG_N_D:
- nbuf[index] = reg_n;
+ nbuf[indx] = reg_n;
break;
case REG_M:
- nbuf[index] = reg_m;
+ nbuf[indx] = reg_m;
break;
case SDT_REG_N:
if (reg_n < 2 || reg_n > 5)
as_bad (_("Invalid register: 'r%d'"), reg_n);
- nbuf[index] = (reg_n & 3) | 4;
+ nbuf[indx] = (reg_n & 3) | 4;
break;
case REG_NM:
- nbuf[index] = reg_n | (reg_m >> 2);
+ nbuf[indx] = reg_n | (reg_m >> 2);
break;
case REG_B:
- nbuf[index] = reg_b | 0x08;
+ nbuf[indx] = reg_b | 0x08;
break;
case REG_N_B01:
- nbuf[index] = reg_n | 0x01;
+ nbuf[indx] = reg_n | 0x01;
break;
case IMM0_3s:
- nbuf[index] |= 0x08;
+ nbuf[indx] |= 0x08;
case IMM0_3c:
insert (output + low_byte, BFD_RELOC_SH_IMM3, 0, operand);
break;
case IMM0_3Us:
- nbuf[index] |= 0x80;
+ nbuf[indx] |= 0x80;
case IMM0_3Uc:
insert (output + low_byte, BFD_RELOC_SH_IMM3U, 0, operand);
break;
break;
case REPEAT:
output = insert_loop_bounds (output, operand);
- nbuf[index] = opcode->nibbles[3];
+ nbuf[indx] = opcode->nibbles[3];
operand += 2;
break;
default:
else
{
symbolS *dl_symp;
- const char *name = S_GET_NAME (symp);
+ const char * sname = S_GET_NAME (symp);
char *dl_name
- = xmalloc (strlen (name) + sizeof (DATALABEL_SUFFIX));
+ = xmalloc (strlen (sname) + sizeof (DATALABEL_SUFFIX));
/* Now we copy the datalabel-qualified symbol into a symbol
with the same name, but with " DL" appended. We mark the
the main symbol, so we don't have to inspect all symbol
names. Note that use of "datalabel" is not expected to
be a common case. */
- strcpy (dl_name, name);
+ strcpy (dl_name, sname);
strcat (dl_name, DATALABEL_SUFFIX);
/* A FAKE_LABEL_NAME marks "$" or ".". There can be any
number of them and all have the same (faked) name; we
must make a new one each time. */
- if (strcmp (name, FAKE_LABEL_NAME) == 0)
+ if (strcmp (sname, FAKE_LABEL_NAME) == 0)
dl_symp = symbol_make (dl_name);
else
dl_symp = symbol_find_or_make (dl_name);
{
while (*s == '#')
{
- int mask;
+ int jmask;
if (! parse_keyword_arg (sparc_encode_membar, &s,
- &mask))
+ &jmask))
{
error_message = _(": invalid membar mask name");
goto error;
}
- kmask |= mask;
+ kmask |= jmask;
while (*s == ' ')
++s;
if (*s == '|' || *s == '+')
/* Subroutine of md_assemble to output one insn. */
static void
-output_insn (const struct sparc_opcode *insn, struct sparc_it *the_insn)
+output_insn (const struct sparc_opcode *insn, struct sparc_it *theinsn)
{
char *toP = frag_more (4);
/* Put out the opcode. */
if (INSN_BIG_ENDIAN)
- number_to_chars_bigendian (toP, (valueT) the_insn->opcode, 4);
+ number_to_chars_bigendian (toP, (valueT) theinsn->opcode, 4);
else
- number_to_chars_littleendian (toP, (valueT) the_insn->opcode, 4);
+ number_to_chars_littleendian (toP, (valueT) theinsn->opcode, 4);
/* Put out the symbol-dependent stuff. */
- if (the_insn->reloc != BFD_RELOC_NONE)
+ if (theinsn->reloc != BFD_RELOC_NONE)
{
fixS *fixP = fix_new_exp (frag_now, /* Which frag. */
(toP - frag_now->fr_literal), /* Where. */
4, /* Size. */
- &the_insn->exp,
- the_insn->pcrel,
- the_insn->reloc);
+ &theinsn->exp,
+ theinsn->pcrel,
+ theinsn->reloc);
/* Turn off overflow checking in fixup_segment. We'll do our
own overflow checking in md_apply_fix. This is necessary because
the insn size is 4 and fixup_segment will signal an overflow for
large 8 byte quantities. */
fixP->fx_no_overflow = 1;
- if (the_insn->reloc == BFD_RELOC_SPARC_OLO10)
- fixP->tc_fix_data = the_insn->exp2.X_add_number;
+ if (theinsn->reloc == BFD_RELOC_SPARC_OLO10)
+ fixP->tc_fix_data = theinsn->exp2.X_add_number;
}
last_insn = insn;
- last_opcode = the_insn->opcode;
+ last_opcode = theinsn->opcode;
#ifdef OBJ_ELF
dwarf2_emit_insn (4);
{
segT old_sec;
int old_subsec;
- char *p;
int align;
old_sec = now_seg;
{
int i;
- char *opcode, *operands, *line;
+ char *op, *operands, *line;
for (i = 0; i < 2; i++)
{
if (i == 0)
{
- opcode = &first_opcode[0];
+ op = &first_opcode[0];
operands = &first_operands[0];
line = current_line;
}
else
{
- opcode = &second_opcode[0];
+ op = &second_opcode[0];
operands = &second_operands[0];
line = next_line;
}
{
if (is_opcode_char (c) && search_status == NONE)
{
- opcode[char_ptr++] = TOLOWER (c);
+ op[char_ptr++] = TOLOWER (c);
search_status = START_OPCODE;
}
else if (is_opcode_char (c) && search_status == START_OPCODE)
- opcode[char_ptr++] = TOLOWER (c);
+ op[char_ptr++] = TOLOWER (c);
else if (!is_opcode_char (c) && search_status == START_OPCODE)
{
- opcode[char_ptr] = '\0';
+ op[char_ptr] = '\0';
char_ptr = 0;
search_status = END_OPCODE;
}
}
else
{
- unsigned count;
-
debug ("Found a number or displacement\n");
for (count = 0; count < strlen (token); count++)
if (*(token + count) == '.')
}
if (prec == 2)
{
- long exp, mant;
+ long expon, mantis;
if (tmsfloat == 0x80000000)
value = 0x8000;
else
{
value = 0;
- exp = (tmsfloat & 0xFF000000);
- exp >>= 24;
- mant = tmsfloat & 0x007FFFFF;
+ expon = (tmsfloat & 0xFF000000);
+ expon >>= 24;
+ mantis = tmsfloat & 0x007FFFFF;
if (tmsfloat & 0x00800000)
{
- mant |= 0xFF000000;
- mant += 0x00000800;
- mant >>= 12;
- mant |= 0x00000800;
- mant &= 0x0FFF;
- if (exp > 7)
+ mantis |= 0xFF000000;
+ mantis += 0x00000800;
+ mantis >>= 12;
+ mantis |= 0x00000800;
+ mantis &= 0x0FFF;
+ if (expon > 7)
value = 0x7800;
}
else
{
- mant |= 0x00800000;
- mant += 0x00000800;
- exp += (mant >> 24);
- mant >>= 12;
- mant &= 0x07FF;
- if (exp > 7)
+ mantis |= 0x00800000;
+ mantis += 0x00000800;
+ expon += (mantis >> 24);
+ mantis >>= 12;
+ mantis &= 0x07FF;
+ if (expon > 7)
value = 0x77FF;
}
- if (exp < -8)
+ if (expon < -8)
value = 0x8000;
if (value == 0)
{
- mant = (exp << 12) | mant;
- value = mant & 0xFFFF;
+ mantis = (expon << 12) | mantis;
+ value = mantis & 0xFFFF;
}
}
}
void
md_assemble (char *line)
{
- insn_template *opcode;
+ insn_template *op;
char *current_posn;
char *token_start;
char save_char;
/* Find instruction. */
save_char = *current_posn;
*current_posn = '\0';
- opcode = (insn_template *) hash_find (op_hash, token_start);
- if (opcode)
+ op = (insn_template *) hash_find (op_hash, token_start);
+ if (op)
{
- debug ("Found instruction %s\n", opcode->name);
- insn.tm = opcode;
+ debug ("Found instruction %s\n", op->name);
+ insn.tm = op;
}
else
{
{
static tic4x_inst_t *insts = NULL;
static char *names = NULL;
- static int index = 0;
+ static int iindex = 0;
if (insts == NULL)
{
insts = (tic4x_inst_t *)
xmalloc (sizeof (tic4x_inst_t) * 1024);
}
- insts[index].name = names;
- insts[index].opcode = opcode;
- insts[index].opmask = 0xffffffff;
- insts[index].args = args;
- index++;
+ insts[iindex].name = names;
+ insts[iindex].opcode = opcode;
+ insts[iindex].opmask = 0xffffffff;
+ insts[iindex].args = args;
+ iindex++;
do
*names++ = *name++;
while (*name);
*names++ = '\0';
- return &insts[index - 1];
+ return &insts[iindex - 1];
}
/* Add instruction template, creating dynamic templates as required. */
}
static int
-tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *insn, int check)
+tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *tinsn, int check)
{
const char *args = inst->args;
unsigned long opcode = inst->opcode;
- int num_operands = insn->num_operands;
- tic4x_operand_t *operand = insn->operands;
+ int num_operands = tinsn->num_operands;
+ tic4x_operand_t *operand = tinsn->operands;
expressionS *exp = &operand->expr;
int ret = 1;
int reg;
If an operand matches, we modify insn or opcode appropriately,
and do a "continue". If an operand fails to match, we "break". */
- insn->nchars = 4; /* Instructions always 4 bytes. */
- insn->reloc = NO_RELOC;
- insn->pcrel = 0;
+ tinsn->nchars = 4; /* Instructions always 4 bytes. */
+ tinsn->reloc = NO_RELOC;
+ tinsn->pcrel = 0;
if (*args == '\0')
{
- insn->opcode = opcode;
+ tinsn->opcode = opcode;
return num_operands == 0;
}
case '\0': /* End of args. */
if (num_operands == 1)
{
- insn->opcode = opcode;
+ tinsn->opcode = opcode;
return ret;
}
break; /* Too many operands. */
}
else if (exp->X_op == O_symbol)
{
- insn->reloc = BFD_RELOC_HI16;
- insn->exp = *exp;
+ tinsn->reloc = BFD_RELOC_HI16;
+ tinsn->exp = *exp;
continue;
}
break; /* Not direct (dp) addressing. */
}
else if (exp->X_op == O_symbol)
{
- insn->reloc = BFD_RELOC_LO16;
- insn->exp = *exp;
+ tinsn->reloc = BFD_RELOC_LO16;
+ tinsn->exp = *exp;
continue;
}
break; /* Not direct addressing. */
}
if (IS_CPU_TIC4X (tic4x_cpu))
{
- insn->reloc = BFD_RELOC_24_PCREL;
- insn->pcrel = 1;
+ tinsn->reloc = BFD_RELOC_24_PCREL;
+ tinsn->pcrel = 1;
}
else
{
- insn->reloc = BFD_RELOC_24;
- insn->pcrel = 0;
+ tinsn->reloc = BFD_RELOC_24;
+ tinsn->pcrel = 0;
}
- insn->exp = *exp;
+ tinsn->exp = *exp;
continue;
case 'C':
continue;
}
}
- insn->reloc = BFD_RELOC_16_PCREL;
- insn->pcrel = 1;
- insn->exp = *exp;
+ tinsn->reloc = BFD_RELOC_16_PCREL;
+ tinsn->pcrel = 1;
+ tinsn->exp = *exp;
continue;
case 'Q':
{
if (operand->mode == M_HI)
{
- insn->reloc = BFD_RELOC_HI16;
+ tinsn->reloc = BFD_RELOC_HI16;
}
else
{
- insn->reloc = BFD_RELOC_LO16;
+ tinsn->reloc = BFD_RELOC_LO16;
}
- insn->exp = *exp;
+ tinsn->exp = *exp;
continue;
}
/* Handle cases like ldi foo - $, ar0 where foo
is a forward reference. Perhaps we should check
for X_op == O_symbol and disallow things like
ldi foo, ar0. */
- insn->reloc = BFD_RELOC_16;
- insn->exp = *exp;
+ tinsn->reloc = BFD_RELOC_16;
+ tinsn->exp = *exp;
continue;
case 'T': /* 5-bit immediate value for tic4x stik. */
else if (exp->X_op == O_symbol)
{
if (operand->mode == M_HI)
- insn->reloc = BFD_RELOC_HI16;
+ tinsn->reloc = BFD_RELOC_HI16;
else
- insn->reloc = BFD_RELOC_LO16;
+ tinsn->reloc = BFD_RELOC_LO16;
- insn->exp = *exp;
+ tinsn->exp = *exp;
continue;
}
- insn->reloc = BFD_RELOC_16;
- insn->exp = *exp;
+ tinsn->reloc = BFD_RELOC_16;
+ tinsn->exp = *exp;
continue;
case 'V': /* Trap numbers (immediate field). */
continue;
}
}
- insn->reloc = BFD_RELOC_16;
- insn->exp = *exp;
+ tinsn->reloc = BFD_RELOC_16;
+ tinsn->exp = *exp;
continue;
case 'X': /* Expansion register for tic4x. */
continue;
case '|': /* treat as `,' if have ldi_ldi form. */
- if (insn->parallel)
+ if (tinsn->parallel)
{
if (--num_operands < 0)
break; /* Too few operands. */
}
static void
-tic4x_insn_check (tic4x_insn_t *insn)
+tic4x_insn_check (tic4x_insn_t *tinsn)
{
- if (!strcmp(insn->name, "lda"))
+ if (!strcmp (tinsn->name, "lda"))
{
- if (insn->num_operands < 2 || insn->num_operands > 2)
+ if (tinsn->num_operands < 2 || tinsn->num_operands > 2)
as_fatal ("Illegal internal LDA insn definition");
- if ( insn->operands[0].mode == M_REGISTER
- && insn->operands[1].mode == M_REGISTER
- && insn->operands[0].expr.X_add_number == insn->operands[1].expr.X_add_number )
+ if (tinsn->operands[0].mode == M_REGISTER
+ && tinsn->operands[1].mode == M_REGISTER
+ && tinsn->operands[0].expr.X_add_number == tinsn->operands[1].expr.X_add_number )
as_bad (_("Source and destination register should not be equal"));
}
- else if( !strcmp(insn->name, "ldi_ldi")
- || !strcmp(insn->name, "ldi1_ldi2")
- || !strcmp(insn->name, "ldi2_ldi1")
- || !strcmp(insn->name, "ldf_ldf")
- || !strcmp(insn->name, "ldf1_ldf2")
- || !strcmp(insn->name, "ldf2_ldf1") )
+ else if (!strcmp (tinsn->name, "ldi_ldi")
+ || !strcmp (tinsn->name, "ldi1_ldi2")
+ || !strcmp (tinsn->name, "ldi2_ldi1")
+ || !strcmp (tinsn->name, "ldf_ldf")
+ || !strcmp (tinsn->name, "ldf1_ldf2")
+ || !strcmp (tinsn->name, "ldf2_ldf1") )
{
- if ( insn->num_operands < 4 && insn->num_operands > 5 )
- as_fatal ("Illegal internal %s insn definition", insn->name);
+ if (tinsn->num_operands < 4 && tinsn->num_operands > 5 )
+ as_fatal ("Illegal internal %s insn definition", tinsn->name);
- if ( insn->operands[1].mode == M_REGISTER
- && insn->operands[insn->num_operands-1].mode == M_REGISTER
- && insn->operands[1].expr.X_add_number == insn->operands[insn->num_operands-1].expr.X_add_number )
+ if (tinsn->operands[1].mode == M_REGISTER
+ && tinsn->operands[tinsn->num_operands-1].mode == M_REGISTER
+ && tinsn->operands[1].expr.X_add_number == tinsn->operands[tinsn->num_operands-1].expr.X_add_number )
as_warn (_("Equal parallell destination registers, one result will be discarded"));
}
}
static void
-tic4x_insn_output (tic4x_insn_t *insn)
+tic4x_insn_output (tic4x_insn_t *tinsn)
{
char *dst;
/* Grab another fragment for opcode. */
- dst = frag_more (insn->nchars);
+ dst = frag_more (tinsn->nchars);
/* Put out opcode word as a series of bytes in little endian order. */
- md_number_to_chars (dst, insn->opcode, insn->nchars);
+ md_number_to_chars (dst, tinsn->opcode, tinsn->nchars);
/* Put out the symbol-dependent stuff. */
- if (insn->reloc != NO_RELOC)
+ if (tinsn->reloc != NO_RELOC)
{
/* Where is the offset into the fragment for this instruction. */
fix_new_exp (frag_now,
dst - frag_now->fr_literal, /* where */
- insn->nchars, /* size */
- &insn->exp,
- insn->pcrel,
- insn->reloc);
+ tinsn->nchars, /* size */
+ &tinsn->exp,
+ tinsn->pcrel,
+ tinsn->reloc);
}
}
static void
tic54x_emit_char (char c)
{
- expressionS exp;
+ expressionS expn;
- exp.X_op = O_constant;
- exp.X_add_number = c;
- emit_expr (&exp, 2);
+ expn.X_op = O_constant;
+ expn.X_add_number = c;
+ emit_expr (&expn, 2);
}
/* Walk backwards in the frag chain. */
expression. */
static char *
-parse_expression (char *str, expressionS *exp)
+parse_expression (char *str, expressionS *expn)
{
char *s;
char *tmp;
tmp = input_line_pointer; /* Save line pointer. */
input_line_pointer = str;
- expression (exp);
+ expression (expn);
s = input_line_pointer;
input_line_pointer = tmp; /* Restore line pointer. */
return s; /* Return pointer to where parsing stopped. */
}
else
{
- expressionS exp;
+ expressionS expn;
- input_line_pointer = parse_expression (input_line_pointer, &exp);
- if (exp.X_op == O_constant)
+ input_line_pointer = parse_expression (input_line_pointer, &expn);
+ if (expn.X_op == O_constant)
{
- offsetT value = exp.X_add_number;
+ offsetT value = expn.X_add_number;
/* Truncate overflows. */
switch (octets)
{
break;
}
}
- if (exp.X_op != O_constant && octets < 2)
+ if (expn.X_op != O_constant && octets < 2)
{
/* Disallow .byte with a non constant expression that will
require relocation. */
return;
}
- if (exp.X_op != O_constant
+ if (expn.X_op != O_constant
&& amode == c_mode
&& octets == 4)
{
totally ignored in the latest tools). */
amode = far_mode;
emitting_long = 1;
- emit_expr (&exp, 4);
+ emit_expr (&expn, 4);
emitting_long = 0;
amode = c_mode;
}
else
{
emitting_long = octets == 4;
- emit_expr (&exp, (octets == 1) ? 2 : octets);
+ emit_expr (&expn, (octets == 1) ? 2 : octets);
emitting_long = 0;
}
}
static void
tic54x_space (int arg)
{
- expressionS exp;
+ expressionS expn;
char *p = 0;
int octets = 0;
long words;
#endif
/* Read the bit count. */
- expression (&exp);
+ expression (&expn);
/* Some expressions are unresolvable until later in the assembly pass;
postpone until relaxation/fixup. we also have to postpone if a previous
partial allocation has not been completed yet. */
- if (exp.X_op != O_constant || frag_bit_offset (frag_now, now_seg) == -1)
+ if (expn.X_op != O_constant || frag_bit_offset (frag_now, now_seg) == -1)
{
struct bit_info *bi = xmalloc (sizeof (struct bit_info));
- char *p;
bi->seg = now_seg;
bi->type = bes;
bi->sym = label;
p = frag_var (rs_machine_dependent,
65536 * 2, 1, (relax_substateT) 0,
- make_expr_symbol (&exp), (offsetT) 0,
+ make_expr_symbol (&expn), (offsetT) 0,
(char *) bi);
if (p)
*p = 0;
{
int spare_bits = bits_per_byte - bit_offset;
- if (spare_bits >= exp.X_add_number)
+ if (spare_bits >= expn.X_add_number)
{
/* Don't have to do anything; sufficient bits have already been
allocated; just point the label to the right place. */
S_SET_VALUE (label, frag_now_fix () - 1);
label = NULL;
}
- frag_now->tc_frag_data += exp.X_add_number;
+ frag_now->tc_frag_data += expn.X_add_number;
goto getout;
}
- exp.X_add_number -= spare_bits;
+ expn.X_add_number -= spare_bits;
/* Set the label to point to the first word allocated, which in this
case is the previous word, which was only partially filled. */
if (!bes && label != NULL)
}
}
/* Convert bits to bytes/words and octets, rounding up. */
- words = ((exp.X_add_number + bits_per_byte - 1) / bits_per_byte);
+ words = ((expn.X_add_number + bits_per_byte - 1) / bits_per_byte);
/* How many do we have left over? */
- bit_offset = exp.X_add_number % bits_per_byte;
+ bit_offset = expn.X_add_number % bits_per_byte;
octets = words * OCTETS_PER_BYTE;
if (octets < 0)
{
static void
tic54x_field (int ignore ATTRIBUTE_UNUSED)
{
- expressionS exp;
+ expressionS expn;
int size = 16;
char *p;
valueT value;
return;
}
- input_line_pointer = parse_expression (input_line_pointer, &exp);
+ input_line_pointer = parse_expression (input_line_pointer, &expn);
if (*input_line_pointer == ',')
{
}
/* Truncate values to the field width. */
- if (exp.X_op != O_constant)
+ if (expn.X_op != O_constant)
{
/* If the expression value is relocatable, the field size *must*
be 16. */
}
frag_now->tc_frag_data = 0;
- emit_expr (&exp, 2);
+ emit_expr (&expn, 2);
}
else
{
unsigned long fmask = (size == 32) ? 0xFFFFFFFF : (1ul << size) - 1;
- value = exp.X_add_number;
- exp.X_add_number &= fmask;
- if (value != (valueT) exp.X_add_number)
+ value = expn.X_add_number;
+ expn.X_add_number &= fmask;
+ if (value != (valueT) expn.X_add_number)
as_warn (_("field value truncated"));
- value = exp.X_add_number;
+ value = expn.X_add_number;
/* Bits are stored MS first. */
while (size >= 16)
{
static int
subsym_iscons (char *a, char *ignore ATTRIBUTE_UNUSED)
{
- expressionS exp;
+ expressionS expn;
- parse_expression (a, &exp);
+ parse_expression (a, &expn);
- if (exp.X_op == O_constant)
+ if (expn.X_op == O_constant)
{
int len = strlen (a);
++ptr;
if (math_entry != NULL)
{
- float arg1, arg2 = 0;
+ float farg1, farg2 = 0;
volatile float fresult;
- arg1 = (float) strtod (ptr, &ptr);
+ farg1 = (float) strtod (ptr, &ptr);
if (math_entry->nargs == 2)
{
if (*ptr++ != ',')
as_bad (_("Expecting second argument"));
break;
}
- arg2 = (float) strtod (ptr, &ptr);
+ farg2 = (float) strtod (ptr, &ptr);
}
- fresult = (*math_entry->proc) (arg1, arg2);
+ fresult = (*math_entry->proc) (farg1, farg2);
value = xmalloc (128);
if (math_entry->int_return)
sprintf (value, "%d", (int) fresult);
int
tic54x_parse_name (char *name ATTRIBUTE_UNUSED,
- expressionS *exp ATTRIBUTE_UNUSED)
+ expressionS *expn ATTRIBUTE_UNUSED)
{
return 0;
}
/* Handle cons expressions. */
void
-tic54x_cons_fix_new (fragS *frag, int where, int octets, expressionS *exp)
+tic54x_cons_fix_new (fragS *frag, int where, int octets, expressionS *expn)
{
bfd_reloc_code_real_type r;
r = BFD_RELOC_32;
break;
}
- fix_new_exp (frag, where, octets, exp, 0, r);
+ fix_new_exp (frag, where, octets, expn, 0, r);
}
/* Attempt to simplify or even eliminate a fixup.
{
bfd_reloc_code_real_type reloc;
segT t = expression (tok);
+
if (t == absolute_section
&& xtensa_operand_is_PCrelative (isa, opc, opnd) == 1)
{
gas_assert (insn->insn_type == ITYPE_INSN);
for (i = 0; i < n; ++i)
{
- const expressionS *expr = &insn->tok[i];
+ const expressionS *exp = &insn->tok[i];
+
if (xtensa_operand_is_register (isa, insn->opcode, i) == 1)
continue;
- switch (expr->X_op)
+ switch (exp->X_op)
{
case O_register:
case O_constant:
- if (xg_check_operand (expr->X_add_number, insn->opcode, i))
+ if (xg_check_operand (exp->X_add_number, insn->opcode, i))
return FALSE;
break;
for (i = 0; i < n; ++i)
{
- const expressionS *expr = &insn->tok[i];
+ const expressionS *exp = &insn->tok[i];
+
if (xtensa_operand_is_register (isa, insn->opcode, i) == 1)
continue;
- switch (expr->X_op)
+ switch (exp->X_op)
{
case O_register:
case O_constant:
- if (xg_check_operand (expr->X_add_number, insn->opcode, i))
+ if (xg_check_operand (exp->X_add_number, insn->opcode, i))
return FALSE;
break;
/* If it is a weak symbol or a symbol in a different section,
it cannot be known to fit at assembly time. */
- if (S_IS_WEAK (expr->X_add_symbol)
- || S_GET_SEGMENT (expr->X_add_symbol) != pc_seg)
+ if (S_IS_WEAK (exp->X_add_symbol)
+ || S_GET_SEGMENT (exp->X_add_symbol) != pc_seg)
{
/* For a direct call with --no-longcalls, be optimistic and
assume it will be in range. If the symbol is weak and
symbols even if longcalls is not enabled. */
if (is_direct_call_opcode (insn->opcode)
&& ! pc_frag->tc_frag_data.use_longcalls
- && (! S_IS_WEAK (expr->X_add_symbol)
- || S_IS_DEFINED (expr->X_add_symbol)))
+ && (! S_IS_WEAK (exp->X_add_symbol)
+ || S_IS_DEFINED (exp->X_add_symbol)))
return TRUE;
return FALSE;
}
- symbolP = expr->X_add_symbol;
+ symbolP = exp->X_add_symbol;
sym_frag = symbol_get_frag (symbolP);
- target = S_GET_VALUE (symbolP) + expr->X_add_number;
+ target = S_GET_VALUE (symbolP) + exp->X_add_number;
pc = pc_frag->fr_address + pc_offset;
/* If frag has yet to be reached on this pass, assume it
/* Check to see if it fits. */
for (i = stack_size; i < istack->ninsn; i++)
{
- TInsn *insn = &istack->insn[i];
+ TInsn *tinsn = &istack->insn[i];
- if (insn->insn_type == ITYPE_INSN
- && !tinsn_has_symbolic_operands (insn)
- && !xg_immeds_fit (insn))
+ if (tinsn->insn_type == ITYPE_INSN
+ && !tinsn_has_symbolic_operands (tinsn)
+ && !xg_immeds_fit (tinsn))
{
istack->ninsn = stack_size;
return FALSE;
int opnum,
xtensa_format fmt,
int slot,
- expressionS *expr,
+ expressionS *exp,
fragS *fragP,
offsetT offset)
{
}
else if (opcode == xtensa_const16_opcode)
{
- if (expr->X_op == O_lo16)
+ if (exp->X_op == O_lo16)
{
reloc = encode_reloc (slot);
- expr->X_op = O_symbol;
+ exp->X_op = O_symbol;
}
- else if (expr->X_op == O_hi16)
+ else if (exp->X_op == O_hi16)
{
reloc = encode_alt_reloc (slot);
- expr->X_op = O_symbol;
+ exp->X_op = O_symbol;
}
}
/* Handle erroneous "@h" and "@l" expressions here before they propagate
into the symbol table where the generic portions of the assembler
won't know what to do with them. */
- if (expr->X_op == O_lo16 || expr->X_op == O_hi16)
+ if (exp->X_op == O_lo16 || exp->X_op == O_hi16)
{
as_bad (_("invalid expression for operand %i of '%s'"),
opnum + 1, xtensa_opcode_name (xtensa_default_isa, opcode));
}
fmt_length = xtensa_format_length (xtensa_default_isa, fmt);
- the_fix = fix_new_exp (fragP, offset, fmt_length, expr,
+ the_fix = fix_new_exp (fragP, offset, fmt_length, exp,
howto->pc_relative, reloc);
the_fix->fx_no_overflow = 1;
- the_fix->tc_fix_data.X_add_symbol = expr->X_add_symbol;
- the_fix->tc_fix_data.X_add_number = expr->X_add_number;
+ the_fix->tc_fix_data.X_add_symbol = exp->X_add_symbol;
+ the_fix->tc_fix_data.X_add_number = exp->X_add_number;
the_fix->tc_fix_data.slot = slot;
return TRUE;
static bfd_boolean
is_narrow_branch_guaranteed_in_range (fragS *fragP, TInsn *tinsn)
{
- const expressionS *expr = &tinsn->tok[1];
- symbolS *symbolP = expr->X_add_symbol;
- offsetT max_distance = expr->X_add_number;
+ const expressionS *exp = &tinsn->tok[1];
+ symbolS *symbolP = exp->X_add_symbol;
+ offsetT max_distance = exp->X_add_number;
fragS *target_frag;
- if (expr->X_op != O_symbol)
+ if (exp->X_op != O_symbol)
return FALSE;
target_frag = symbol_get_frag (symbolP);
for (expr_sym = expr_symbols; expr_sym;
expr_sym = symbol_get_tc (expr_sym)->next_expr_symbol)
{
- expressionS *expr = symbol_get_value_expression (expr_sym);
+ expressionS *exp = symbol_get_value_expression (expr_sym);
- if (expr->X_op == O_subtract)
+ if (exp->X_op == O_subtract)
{
- symbolS *left = expr->X_add_symbol;
- symbolS *right = expr->X_op_symbol;
+ symbolS *left = exp->X_add_symbol;
+ symbolS *right = exp->X_op_symbol;
/* Difference of two symbols not in the same section
are handled with relocations in the linker. */
static bfd_boolean
is_empty_loop (const TInsn *insn, fragS *fragP)
{
- const expressionS *expr;
+ const expressionS *exp;
symbolS *symbolP;
fragS *next_fragP;
if (insn->ntok <= LOOP_IMMED_OPN)
return FALSE;
- expr = &insn->tok[LOOP_IMMED_OPN];
+ exp = &insn->tok[LOOP_IMMED_OPN];
- if (expr->X_op != O_symbol)
+ if (exp->X_op != O_symbol)
return FALSE;
- symbolP = expr->X_add_symbol;
+ symbolP = exp->X_add_symbol;
if (!symbolP)
return FALSE;
static bfd_boolean
is_local_forward_loop (const TInsn *insn, fragS *fragP)
{
- const expressionS *expr;
+ const expressionS *exp;
symbolS *symbolP;
fragS *next_fragP;
if (insn->ntok <= LOOP_IMMED_OPN)
return FALSE;
- expr = &insn->tok[LOOP_IMMED_OPN];
+ exp = &insn->tok[LOOP_IMMED_OPN];
- if (expr->X_op != O_symbol)
+ if (exp->X_op != O_symbol)
return FALSE;
- symbolP = expr->X_add_symbol;
+ symbolP = exp->X_add_symbol;
if (!symbolP)
return FALSE;
for (lit = literal_syms; lit; lit = lit->next)
{
symbolS *lit_sym = lit->sym;
- segT dest_seg = symbol_get_frag (lit_sym)->tc_frag_data.lit_seg;
- if (dest_seg)
- S_SET_SEGMENT (lit_sym, dest_seg);
+ segT dseg = symbol_get_frag (lit_sym)->tc_frag_data.lit_seg;
+ if (dseg)
+ S_SET_SEGMENT (lit_sym, dseg);
}
}
for (i = 0; i < noperands; i++)
{
- expressionS *expr = &tinsn->tok[i];
+ expressionS *exp = &tinsn->tok[i];
int rc;
unsigned line;
char *file_name;
uint32 opnd_value;
- switch (expr->X_op)
+ switch (exp->X_op)
{
case O_register:
if (xtensa_operand_is_visible (isa, opcode, i) == 0)
break;
/* The register number has already been checked in
expression_maybe_register, so we don't need to check here. */
- opnd_value = expr->X_add_number;
+ opnd_value = exp->X_add_number;
(void) xtensa_operand_encode (isa, opcode, i, &opnd_value);
rc = xtensa_operand_set_field (isa, opcode, i, fmt, slot, slotbuf,
opnd_value);
/* It is a constant and we called this function
then we have to try to fit it. */
xtensa_insnbuf_set_operand (slotbuf, fmt, slot, opcode, i,
- expr->X_add_number, file_name, line);
+ exp->X_add_number, file_name, line);
break;
default:
for (i = 0; i < noperands; i++)
{
- expressionS* expr = &tinsn->tok[i];
- switch (expr->X_op)
+ expressionS* exp = &tinsn->tok[i];
+ switch (exp->X_op)
{
case O_symbol:
case O_lo16:
|| tinsn->is_specific_opcode
|| !xg_is_relaxable_insn (tinsn, 0))
{
- xg_add_opcode_fix (tinsn, i, fmt, slot, expr, fragP,
+ xg_add_opcode_fix (tinsn, i, fmt, slot, exp, fragP,
frag_offset - fragP->fr_literal);
}
else
{
- if (expr->X_op != O_symbol)
+ if (exp->X_op != O_symbol)
as_bad (_("invalid operand"));
- tinsn->symbol = expr->X_add_symbol;
- tinsn->offset = expr->X_add_number;
+ tinsn->symbol = exp->X_add_symbol;
+ tinsn->offset = exp->X_add_number;
}
}
else
number. */
static char *
-whatreg (unsigned int *reg, char *src)
+whatreg (unsigned int *preg, char *src)
{
unsigned int new_reg;
if (src[0] != 0 && src[0] != ',' && src[0] != '(' && src[0] != ')')
return NULL;
- *reg = new_reg;
+ *preg = new_reg;
return src;
}
in SRC after the reg name. */
static char *
-parse_reg (char *src, int *mode, unsigned int *reg)
+parse_reg (char *src, int *mode, unsigned int *preg)
{
char *res = NULL;
char regno;
if (segmented_mode)
{
*mode = CLASS_REG_LONG;
- *reg = 14;
+ *preg = 14;
}
else
{
*mode = CLASS_REG_WORD;
- *reg = 15;
+ *preg = 15;
}
return src + 2;
}
if (src[2] < '0' || src[2] > '9')
return NULL; /* Assume no register name but a label starting with 'rr'. */
*mode = CLASS_REG_LONG;
- res = whatreg (reg, src + 2);
+ res = whatreg (preg, src + 2);
if (res == NULL)
return NULL; /* Not a valid register name. */
- regno = *reg;
+ regno = *preg;
if (regno > 14)
as_bad (_("register rr%d out of range"), regno);
if (regno & 1)
if (src[2] < '0' || src[2] > '9')
return NULL; /* Assume no register name but a label starting with 'rh'. */
*mode = CLASS_REG_BYTE;
- res = whatreg (reg, src + 2);
+ res = whatreg (preg, src + 2);
if (res == NULL)
return NULL; /* Not a valid register name. */
- regno = *reg;
+ regno = *preg;
if (regno > 7)
as_bad (_("register rh%d out of range"), regno);
}
if (src[2] < '0' || src[2] > '9')
return NULL; /* Assume no register name but a label starting with 'rl'. */
*mode = CLASS_REG_BYTE;
- res = whatreg (reg, src + 2);
+ res = whatreg (preg, src + 2);
if (res == NULL)
return NULL; /* Not a valid register name. */
- regno = *reg;
+ regno = *preg;
if (regno > 7)
as_bad (_("register rl%d out of range"), regno);
- *reg += 8;
+ *preg += 8;
}
else if (src[1] == 'q' || src[1] == 'Q')
{
if (src[2] < '0' || src[2] > '9')
return NULL; /* Assume no register name but a label starting with 'rq'. */
*mode = CLASS_REG_QUAD;
- res = whatreg (reg, src + 2);
+ res = whatreg (preg, src + 2);
if (res == NULL)
return NULL; /* Not a valid register name. */
- regno = *reg;
+ regno = *preg;
if (regno > 12)
as_bad (_("register rq%d out of range"), regno);
if (regno & 3)
if (src[1] < '0' || src[1] > '9')
return NULL; /* Assume no register name but a label starting with 'r'. */
*mode = CLASS_REG_WORD;
- res = whatreg (reg, src + 1);
+ res = whatreg (preg, src + 1);
if (res == NULL)
return NULL; /* Not a valid register name. */
- regno = *reg;
+ regno = *preg;
if (regno > 15)
as_bad (_("register r%d out of range"), regno);
}
using_cgen=no
-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.
if test "${enable_werror+set}" = set; then :
$(as_TEXINFOS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
+ $(top_srcdir)/../config/zlib.m4 \
$(top_srcdir)/../bfd/warning.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
+ $(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../config/plugins.m4 \
$(top_srcdir)/../config/po.m4 \
$(top_srcdir)/../config/progtest.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
for (fde = all_fde_data; fde ; fde = fde->next)
{
struct cfi_insn_data *first;
- struct cie_entry *cie;
if (fde->end_address == NULL)
{
static void
generic_dwarf2_emit_offset (symbolS *symbol, unsigned int size)
{
- expressionS expr;
+ expressionS exp;
- expr.X_op = O_symbol;
- expr.X_add_symbol = symbol;
- expr.X_add_number = 0;
- emit_expr (&expr, size);
+ exp.X_op = O_symbol;
+ exp.X_add_symbol = symbol;
+ exp.X_add_number = 0;
+ emit_expr (&exp, size);
}
#endif
static struct line_subseg *last_line_subseg;
struct line_seg *s;
- struct line_subseg **pss, *ss;
+ struct line_subseg **pss, *lss;
if (seg == last_seg && subseg == last_subseg)
return last_line_subseg;
}
gas_assert (seg == s->seg);
- for (pss = &s->head; (ss = *pss) != NULL ; pss = &ss->next)
+ for (pss = &s->head; (lss = *pss) != NULL ; pss = &lss->next)
{
- if (ss->subseg == subseg)
+ if (lss->subseg == subseg)
goto found_subseg;
- if (ss->subseg > subseg)
+ if (lss->subseg > subseg)
break;
}
- ss = (struct line_subseg *) xmalloc (sizeof (*ss));
- ss->next = *pss;
- ss->subseg = subseg;
- ss->head = NULL;
- ss->ptail = &ss->head;
- *pss = ss;
+ lss = (struct line_subseg *) xmalloc (sizeof (*lss));
+ lss->next = *pss;
+ lss->subseg = subseg;
+ lss->head = NULL;
+ lss->ptail = &lss->head;
+ *pss = lss;
found_subseg:
last_seg = seg;
last_subseg = subseg;
- last_line_subseg = ss;
+ last_line_subseg = lss;
- return ss;
+ return lss;
}
/* Record an entry for LOC occurring at LABEL. */
static void
dwarf2_gen_line_info_1 (symbolS *label, struct dwarf2_line_info *loc)
{
- struct line_subseg *ss;
+ struct line_subseg *lss;
struct line_entry *e;
e = (struct line_entry *) xmalloc (sizeof (*e));
e->label = label;
e->loc = *loc;
- ss = get_line_subseg (now_seg, now_subseg);
- *ss->ptail = e;
- ss->ptail = &e->next;
+ lss = get_line_subseg (now_seg, now_subseg);
+ *lss->ptail = e;
+ lss->ptail = &e->next;
}
/* Record an entry for LOC occurring at OFS within the current fragment. */
static void
out_set_addr (symbolS *sym)
{
- expressionS expr;
+ expressionS exp;
out_opcode (DW_LNS_extended_op);
out_uleb128 (sizeof_address + 1);
out_opcode (DW_LNE_set_address);
- expr.X_op = O_symbol;
- expr.X_add_symbol = sym;
- expr.X_add_number = 0;
- emit_expr (&expr, sizeof_address);
+ exp.X_op = O_symbol;
+ exp.X_add_symbol = sym;
+ exp.X_add_number = 0;
+ emit_expr (&exp, sizeof_address);
}
#if DWARF2_LINE_MIN_INSN_LENGTH > 1
emit_fixed_inc_line_addr (int line_delta, addressT addr_delta, fragS *frag,
char *p, int len)
{
- expressionS *exp;
+ expressionS *pexp;
segT line_seg;
char *end = p + len;
p += output_leb128 (p, line_delta, 1);
}
- exp = symbol_get_value_expression (frag->fr_symbol);
+ pexp = symbol_get_value_expression (frag->fr_symbol);
line_seg = subseg_get (".debug_line", 0);
/* The DW_LNS_fixed_advance_pc opcode has a 2-byte operand so it can
if (addr_delta > 50000)
{
symbolS *to_sym;
- expressionS expr;
+ expressionS exp;
- gas_assert (exp->X_op = O_subtract);
- to_sym = exp->X_add_symbol;
+ gas_assert (pexp->X_op = O_subtract);
+ to_sym = pexp->X_add_symbol;
*p++ = DW_LNS_extended_op;
p += output_leb128 (p, sizeof_address + 1, 0);
*p++ = DW_LNE_set_address;
- expr.X_op = O_symbol;
- expr.X_add_symbol = to_sym;
- expr.X_add_number = 0;
+ exp.X_op = O_symbol;
+ exp.X_add_symbol = to_sym;
+ exp.X_add_number = 0;
subseg_change (line_seg, 0);
- emit_expr_fix (&expr, sizeof_address, frag, p);
+ emit_expr_fix (&exp, sizeof_address, frag, p);
p += sizeof_address;
}
else
{
*p++ = DW_LNS_fixed_advance_pc;
subseg_change (line_seg, 0);
- emit_expr_fix (exp, 2, frag, p);
+ emit_expr_fix (pexp, 2, frag, p);
p += 2;
}
static void
relax_inc_line_addr (int line_delta, symbolS *to_sym, symbolS *from_sym)
{
- expressionS expr;
+ expressionS exp;
int max_chars;
- expr.X_op = O_subtract;
- expr.X_add_symbol = to_sym;
- expr.X_op_symbol = from_sym;
- expr.X_add_number = 0;
+ exp.X_op = O_subtract;
+ exp.X_add_symbol = to_sym;
+ exp.X_op_symbol = from_sym;
+ exp.X_add_number = 0;
/* The maximum size of the frag is the line delta with a maximum
sized address delta. */
max_chars = size_inc_line_addr (line_delta, -DWARF2_LINE_MIN_INSN_LENGTH);
frag_var (rs_dwarf2dbg, max_chars, max_chars, 1,
- make_expr_symbol (&expr), line_delta, NULL);
+ make_expr_symbol (&exp), line_delta, NULL);
}
/* The function estimates the size of a rs_dwarf2dbg variant frag
to the end of the section. */
static int
-out_header (asection *sec, expressionS *expr)
+out_header (asection *sec, expressionS *exp)
{
symbolS *start_sym;
symbolS *end_sym;
end_sym = symbol_temp_make ();
/* Total length of the information. */
- expr->X_op = O_subtract;
- expr->X_add_symbol = end_sym;
- expr->X_op_symbol = start_sym;
+ exp->X_op = O_subtract;
+ exp->X_add_symbol = end_sym;
+ exp->X_op_symbol = start_sym;
switch (DWARF2_FORMAT (sec))
{
case dwarf2_format_32bit:
- expr->X_add_number = -4;
- emit_expr (expr, 4);
+ exp->X_add_number = -4;
+ emit_expr (exp, 4);
return 4;
case dwarf2_format_64bit:
- expr->X_add_number = -12;
+ exp->X_add_number = -12;
out_four (-1);
- emit_expr (expr, 8);
+ emit_expr (exp, 8);
return 8;
case dwarf2_format_64bit_irix:
- expr->X_add_number = -8;
- emit_expr (expr, 8);
+ exp->X_add_number = -8;
+ emit_expr (exp, 8);
return 8;
}
static void
out_debug_line (segT line_seg)
{
- expressionS expr;
+ expressionS exp;
symbolS *prologue_end;
symbolS *line_end;
struct line_seg *s;
int sizeof_offset;
- sizeof_offset = out_header (line_seg, &expr);
- line_end = expr.X_add_symbol;
+ sizeof_offset = out_header (line_seg, &exp);
+ line_end = exp.X_add_symbol;
/* Version. */
out_two (2);
/* Length of the prologue following this length. */
prologue_end = symbol_temp_make ();
- expr.X_add_symbol = prologue_end;
- expr.X_add_number = - (4 + 2 + 4);
- emit_expr (&expr, sizeof_offset);
+ exp.X_add_symbol = prologue_end;
+ exp.X_add_number = - (4 + 2 + 4);
+ emit_expr (&exp, sizeof_offset);
/* Parameters of the state machine. */
out_byte (DWARF2_LINE_MIN_INSN_LENGTH);
{
unsigned int addr_size = sizeof_address;
struct line_seg *s;
- expressionS expr;
+ expressionS exp;
unsigned int i;
subseg_set (ranges_seg, 0);
end = symbol_temp_new (s->seg, get_frag_fix (frag, s->seg), frag);
s->text_end = end;
- expr.X_op = O_symbol;
- expr.X_add_symbol = beg;
- expr.X_add_number = 0;
- emit_expr (&expr, addr_size);
+ exp.X_op = O_symbol;
+ exp.X_add_symbol = beg;
+ exp.X_add_number = 0;
+ emit_expr (&exp, addr_size);
- expr.X_op = O_symbol;
- expr.X_add_symbol = end;
- expr.X_add_number = 0;
- emit_expr (&expr, addr_size);
+ exp.X_op = O_symbol;
+ exp.X_add_symbol = end;
+ exp.X_add_number = 0;
+ emit_expr (&exp, addr_size);
}
/* End of Range Entry. */
{
unsigned int addr_size = sizeof_address;
struct line_seg *s;
- expressionS expr;
+ expressionS exp;
symbolS *aranges_end;
char *p;
int sizeof_offset;
- sizeof_offset = out_header (aranges_seg, &expr);
- aranges_end = expr.X_add_symbol;
+ sizeof_offset = out_header (aranges_seg, &exp);
+ aranges_end = exp.X_add_symbol;
/* Version. */
out_two (2);
end = symbol_temp_new (s->seg, get_frag_fix (frag, s->seg), frag);
s->text_end = end;
- expr.X_op = O_symbol;
- expr.X_add_symbol = beg;
- expr.X_add_number = 0;
- emit_expr (&expr, addr_size);
+ exp.X_op = O_symbol;
+ exp.X_add_symbol = beg;
+ exp.X_add_number = 0;
+ emit_expr (&exp, addr_size);
- expr.X_op = O_subtract;
- expr.X_add_symbol = end;
- expr.X_op_symbol = beg;
- expr.X_add_number = 0;
- emit_expr (&expr, addr_size);
+ exp.X_op = O_subtract;
+ exp.X_add_symbol = end;
+ exp.X_op_symbol = beg;
+ exp.X_add_number = 0;
+ emit_expr (&exp, addr_size);
}
p = frag_more (2 * addr_size);
char producer[128];
const char *comp_dir;
const char *dirname;
- expressionS expr;
+ expressionS exp;
symbolS *info_end;
char *p;
int len;
int sizeof_offset;
- sizeof_offset = out_header (info_seg, &expr);
- info_end = expr.X_add_symbol;
+ sizeof_offset = out_header (info_seg, &exp);
+ info_end = exp.X_add_symbol;
/* DWARF version. */
out_two (2);
if (all_segs->next == NULL)
{
/* DW_AT_low_pc */
- expr.X_op = O_symbol;
- expr.X_add_symbol = all_segs->text_start;
- expr.X_add_number = 0;
- emit_expr (&expr, sizeof_address);
+ exp.X_op = O_symbol;
+ exp.X_add_symbol = all_segs->text_start;
+ exp.X_add_number = 0;
+ emit_expr (&exp, sizeof_address);
/* DW_AT_high_pc */
- expr.X_op = O_symbol;
- expr.X_add_symbol = all_segs->text_end;
- expr.X_add_number = 0;
- emit_expr (&expr, sizeof_address);
+ exp.X_op = O_symbol;
+ exp.X_add_symbol = all_segs->text_end;
+ exp.X_add_number = 0;
+ emit_expr (&exp, sizeof_address);
}
else
{
/* For each subsection, chain the debug entries together. */
for (s = all_segs; s; s = s->next)
{
- struct line_subseg *ss = s->head;
- struct line_entry **ptail = ss->ptail;
+ struct line_subseg *lss = s->head;
+ struct line_entry **ptail = lss->ptail;
- while ((ss = ss->next) != NULL)
+ while ((lss = lss->next) != NULL)
{
- *ptail = ss->head;
- ptail = ss->ptail;
+ *ptail = lss->head;
+ ptail = lss->ptail;
}
}
if (is_name_beginner (c))
{
char *name = input_line_pointer;
- char c = get_symbol_end ();
+ char ec = get_symbol_end ();
- ret = md_operator (name, 2, &c);
+ ret = md_operator (name, 2, &ec);
switch (ret)
{
case O_absent:
- *input_line_pointer = c;
+ *input_line_pointer = ec;
input_line_pointer = name;
break;
case O_uminus:
ret = O_illegal;
/* FALLTHROUGH */
default:
- *input_line_pointer = c;
+ *input_line_pointer = ec;
*num_chars = input_line_pointer - name;
input_line_pointer = name;
return ret;
/* hash.c -- gas hash table code
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000, 2001, 2002, 2003, 2005, 2007, 2008
+ 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
{
1021, 4051, 8599, 16699, 65537
};
- unsigned int index;
+ unsigned int hindex;
/* Work out the best prime number near the hash_size.
FIXME: This could be a more sophisticated algorithm,
but is it really worth implementing it ? */
- for (index = 0; index < ARRAY_SIZE (hash_size_primes) - 1; ++index)
- if (gas_hash_table_size <= hash_size_primes[index])
+ for (hindex = 0; hindex < ARRAY_SIZE (hash_size_primes) - 1; ++ hindex)
+ if (gas_hash_table_size <= hash_size_primes[hindex])
break;
- return hash_size_primes[index];
+ return hash_size_primes[hindex];
}
/* Create a hash table. This return a control block. */
unsigned long hash;
size_t n;
unsigned int c;
- unsigned int index;
+ unsigned int hindex;
struct hash_entry **list;
struct hash_entry *p;
struct hash_entry *prev;
if (phash != NULL)
*phash = hash;
- index = hash % table->size;
- list = table->table + index;
+ hindex = hash % table->size;
+ list = table->table + hindex;
if (plist != NULL)
*plist = list;
hash table. */
const char *
-hash_insert (struct hash_control *table, const char *key, void *value)
+hash_insert (struct hash_control *table, const char *key, void *val)
{
struct hash_entry *p;
struct hash_entry **list;
p = (struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p));
p->string = key;
p->hash = hash;
- p->data = value;
+ p->data = val;
p->next = *list;
*list = p;
error. If an entry already exists, its value is replaced. */
const char *
-hash_jam (struct hash_control *table, const char *key, void *value)
+hash_jam (struct hash_control *table, const char *key, void *val)
{
struct hash_entry *p;
struct hash_entry **list;
++table->replacements;
#endif
- p->data = value;
+ p->data = val;
}
else
{
p = (struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p));
p->string = key;
p->hash = hash;
- p->data = value;
+ p->data = val;
p->next = *list;
*list = p;
while (current_file->linenum < list->hll_line
&& !current_file->at_end)
{
- cached_line * cache = cached_lines + next_free_line;
char *p;
+ cache = cached_lines + next_free_line;
cache->file = current_file;
cache->line = current_file->linenum;
cache->buffer[0] = 0;
void
macro_init (int alternate, int mri, int strip_at,
- int (*expr) (const char *, int, sb *, int *))
+ int (*exp) (const char *, int, sb *, int *))
{
macro_hash = hash_new ();
macro_defined = 0;
macro_alternate = alternate;
macro_mri = mri;
macro_strip_at = strip_at;
- macro_expr = expr;
+ macro_expr = exp;
}
/* Switch in and out of alternate mode on the fly. */
const char **error, macro_entry **info)
{
const char *s;
- char *copy, *cs;
+ char *copy, *cls;
macro_entry *macro;
sb line_sb;
copy = (char *) alloca (s - line + 1);
memcpy (copy, line, s - line);
copy[s - line] = '\0';
- for (cs = copy; *cs != '\0'; cs++)
- *cs = TOLOWER (*cs);
+ for (cls = copy; *cls != '\0'; cls ++)
+ *cls = TOLOWER (*cls);
macro = (macro_entry *) hash_find (macro_hash, copy);
void
read_a_source_file (char *name)
{
- register char c;
- register char *s; /* String of symbol, '\0' appended. */
- register int temp;
+ char c;
+ char *s; /* String of symbol, '\0' appended. */
+ int temp;
pseudo_typeS *pop;
#ifdef WARN_COMMENTS
if (is_name_beginner (*input_line_pointer))
{
char *line_start = input_line_pointer;
- char c;
int mri_line_macro;
HANDLE_CONDITIONAL_ASSEMBLY ();
}
else if (mri_common_symbol != NULL)
{
- valueT val;
+ valueT mri_val;
- val = S_GET_VALUE (mri_common_symbol);
- if ((val & 1) != 0)
+ mri_val = S_GET_VALUE (mri_common_symbol);
+ if ((mri_val & 1) != 0)
{
- S_SET_VALUE (mri_common_symbol, val + 1);
+ S_SET_VALUE (mri_common_symbol, mri_val + 1);
if (line_label != NULL)
{
expressionS *symexp;
/* Generic stabs parsing for gas.
Copyright 1989, 1990, 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2001
- 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
char sym[30];
char *buf;
char *tmp = file;
- char *endp = file + strlen (file);
+ char *file_endp = file + strlen (file);
char *bufp;
if (last_file != NULL
*bufp++ = '"';
- while (tmp < endp)
+ while (tmp < file_endp)
{
char *bslash = strchr (tmp, '\\');
size_t len = (bslash) ? (size_t) (bslash - tmp + 1) : strlen (tmp);
/* Create a local symbol and insert it into the local hash table. */
static struct local_symbol *
-local_symbol_make (const char *name, segT section, valueT value, fragS *frag)
+local_symbol_make (const char *name, segT section, valueT val, fragS *frag)
{
char *name_copy;
struct local_symbol *ret;
ret->lsy_name = name_copy;
ret->lsy_section = section;
local_symbol_set_frag (ret, frag);
- ret->lsy_value = value;
+ ret->lsy_value = val;
hash_jam (local_hash, name_copy, (void *) ret);
}
else
{
- expressionS expr = symbolP->sy_value;
+ expressionS exp = symbolP->sy_value;
- if (!symbolP->sy_resolved && expr.X_op != O_illegal)
+ if (!symbolP->sy_resolved && exp.X_op != O_illegal)
{
int resolved;
if (symbolP->sy_resolving)
return 0;
symbolP->sy_resolving = 1;
- resolved = resolve_expression (&expr);
+ resolved = resolve_expression (&exp);
symbolP->sy_resolving = 0;
if (!resolved)
return 0;
- switch (expr.X_op)
+ switch (exp.X_op)
{
case O_constant:
case O_register:
/* Fall thru. */
case O_symbol:
case O_symbol_rva:
- symbolP = expr.X_add_symbol;
+ symbolP = exp.X_add_symbol;
break;
default:
return 0;
}
*symbolPP = symbolP;
- *valueP = expr.X_add_number;
+ *valueP = exp.X_add_number;
*segP = symbolP->bsym->section;
*fragPP = symbolP->sy_frag;
if (*segP == expr_section)
- switch (expr.X_op)
+ switch (exp.X_op)
{
case O_constant: *segP = absolute_section; break;
case O_register: *segP = reg_section; break;
int instance_number;
char *type;
const char *message_format;
- int index = 0;
+ int lindex = 0;
#ifdef LOCAL_LABEL_PREFIX
- if (s[index] == LOCAL_LABEL_PREFIX)
- ++index;
+ if (s[lindex] == LOCAL_LABEL_PREFIX)
+ ++lindex;
#endif
- if (s[index] != 'L')
+ if (s[lindex] != 'L')
return s;
- for (label_number = 0, p = s + index + 1; ISDIGIT (*p); ++p)
+ for (label_number = 0, p = s + lindex + 1; ISDIGIT (*p); ++p)
label_number = (10 * label_number) + *p - '0';
if (*p == DOLLAR_LABEL_CHAR)
if (symbol_equated_reloc_p (symp)
|| S_IS_WEAKREFR (symp))
{
- const char *name = S_GET_NAME (symp);
+ const char *sname = S_GET_NAME (symp);
+
if (S_IS_COMMON (symp)
- && !TC_FAKE_LABEL (name)
+ && !TC_FAKE_LABEL (sname)
&& !S_IS_WEAKREFR (symp)
&& (!S_IS_EXTERNAL (symp) || S_IS_LOCAL (symp)))
{
expressionS *e = symbol_get_value_expression (symp);
+
as_bad (_("Local symbol `%s' can't be equated to common symbol `%s'"),
- name, S_GET_NAME (e->X_add_symbol));
+ sname, S_GET_NAME (e->X_add_symbol));
}
if (S_GET_SEGMENT (symp) == reg_section)
{
/* Report error only if we know the symbol name. */
if (S_GET_NAME (symp) != reg_section->name)
as_bad (_("can't make global register symbol `%s'"),
- name);
+ sname);
}
symbol_remove (symp, &symbol_rootP, &symbol_lastP);
continue;
+2009-12-11 Nick Clifton <nickc@redhat.com>
+
+ * archive.cc: Fix shadowed variable warnings.
+ * arm.cc: Likewise.
+ * compressed_output.cc: Likewise.
+ * compressed_output.h: Likewise.
+ * configure: Likewise.
+ * dwarf_reader.cc: Likewise.
+ * dynobj.cc: Likewise.
+ * dynobj.h: Likewise.
+ * ehframe.cc: Likewise.
+ * ehframe.h: Likewise.
+ * errors.cc: Likewise.
+ * expression.cc: Likewise.
+ * fileread.cc: Likewise.
+ * fileread.h: Likewise.
+ * freebsd.h: Likewise.
+ * i386.cc: Likewise.
+ * icf.cc: Likewise.
+ * incremental.h: Likewise.
+ * layout.cc: Likewise.
+ * layout.h: Likewise.
+ * mapfile.cc: Likewise.
+ * merge.cc: Likewise.
+ * merge.h: Likewise.
+ * object.cc: Likewise.
+ * object.h: Likewise.
+ * options.h: Likewise.
+ * output.cc: Likewise.
+ * output.h: Likewise.
+ * parameters.cc: Likewise.
+ * plugin.cc: Likewise.
+ * powerpc.cc: Likewise.
+ * reduced_debug_output.cc: Likewise.
+ * reduced_debug_output.h: Likewise.
+ * reloc.cc: Likewise.
+ * reloc.h: Likewise.
+ * resolve.cc: Likewise.
+ * script-sections.cc: Likewise.
+ * script.cc: Likewise.
+ * script.h: Likewise.
+ * sparc.cc: Likewise.
+ * symtab.cc: Likewise.
+ * symtab.h: Likewise.
+ * target-select.cc: Likewise.
+ * target-select.h: Likewise.
+ * token.h: Likewise.
+ * workqueue.cc: Likewise.
+ * workqueue.h: Likewise.
+ * x86_64.cc: Likewise.
+
2009-12-10 Doug Kwan <dougkwan@google.com>
* arm.cc (attributes.h): New include.
const char Archive::arfmag[2] = { '`', '\n' };
-Archive::Archive(const std::string& name, Input_file* input_file,
- bool is_thin_archive, Dirsearch* dirpath, Task* task)
- : name_(name), input_file_(input_file), armap_(), armap_names_(),
+Archive::Archive(const std::string& aname, Input_file* ainput_file,
+ bool is_a_thin_archive, Dirsearch* dirpath, Task* task)
+ : name_(aname), input_file_(ainput_file), armap_(), armap_names_(),
extended_names_(), armap_checked_(), seen_offsets_(), members_(),
- is_thin_archive_(is_thin_archive), included_member_(false),
+ is_thin_archive_(is_a_thin_archive), included_member_(false),
nested_archives_(), dirpath_(dirpath), task_(task), num_members_(0)
{
this->no_export_ =
- parameters->options().check_excluded_libs(input_file->found_name());
+ parameters->options().check_excluded_libs(ainput_file->found_name());
}
// Set up the archive: read the symbol map and the extended name
*ps = '\0';
errno = 0;
- char* end;
- off_t member_size = strtol(size_string, &end, 10);
- if (*end != '\0'
+ char* hend;
+ off_t member_size = strtol(size_string, &hend, 10);
+ if (*hend != '\0'
|| member_size < 0
|| (member_size == LONG_MAX && errno == ERANGE))
{
else
{
errno = 0;
- long x = strtol(hdr->ar_name + 1, &end, 10);
+ long x = strtol(hdr->ar_name + 1, &hend, 10);
long y = 0;
- if (*end == ':')
- y = strtol(end + 1, &end, 10);
- if (*end != ' '
+ if (*hend == ':')
+ y = strtol(hend + 1, &hend, 10);
+ if (*hend != ' '
|| x < 0
|| (x == LONG_MAX && errno == ERANGE)
|| static_cast<size_t>(x) >= this->extended_names_.size())
return this->input_file_->file().filesize() - off;
}
- const char* name = this->extended_names_.data() + x;
- const char* name_end = strchr(name, '\n');
- if (static_cast<size_t>(name_end - name) > this->extended_names_.size()
+ const char* name_start = this->extended_names_.data() + x;
+ const char* name_end = strchr(name_start, '\n');
+ if (static_cast<size_t>(name_end - name_start) > this->extended_names_.size()
|| name_end[-1] != '/')
{
gold_error(_("%s: bad extended name entry at header %zu"),
this->name().c_str(), static_cast<size_t>(off));
return this->input_file_->file().filesize() - off;
}
- pname->assign(name, name_end - 1 - name);
+ pname->assign(name_start, name_end - 1 - name_start);
if (nested_off != NULL)
*nested_off = y;
}
// to the name of the archive member. Return TRUE on success.
bool
-Archive::get_file_and_offset(off_t off, Input_file** input_file, off_t* memoff,
+Archive::get_file_and_offset(off_t off, Input_file** in_file, off_t* memoff,
off_t* memsize, std::string* member_name)
{
off_t nested_off;
*memsize = this->read_header(off, false, member_name, &nested_off);
- *input_file = this->input_file_;
+ *in_file = this->input_file_;
*memoff = off + static_cast<off_t>(sizeof(Archive_header));
if (!this->is_thin_archive_)
new Input_file_argument(member_name->c_str(),
Input_file_argument::INPUT_FILE_TYPE_FILE,
"", false, parameters->options());
- *input_file = new Input_file(input_file_arg);
+ *in_file = new Input_file(input_file_arg);
int dummy = 0;
- if (!(*input_file)->open(*this->dirpath_, this->task_, &dummy))
+ if (!(*in_file)->open(*this->dirpath_, this->task_, &dummy))
return false;
- arch = new Archive(*member_name, *input_file, false, this->dirpath_,
+ arch = new Archive(*member_name, *in_file, false, this->dirpath_,
this->task_);
arch->setup();
std::pair<Nested_archive_table::iterator, bool> ins =
this->nested_archives_.insert(std::make_pair(*member_name, arch));
gold_assert(ins.second);
}
- return arch->get_file_and_offset(nested_off, input_file, memoff,
+ return arch->get_file_and_offset(nested_off, in_file, memoff,
memsize, member_name);
}
new Input_file_argument(member_name->c_str(),
Input_file_argument::INPUT_FILE_TYPE_FILE,
"", false, this->input_file_->options());
- *input_file = new Input_file(input_file_arg);
+ *in_file = new Input_file(input_file_arg);
int dummy = 0;
- if (!(*input_file)->open(*this->dirpath_, this->task_, &dummy))
+ if (!(*in_file)->open(*this->dirpath_, this->task_, &dummy))
return false;
*memoff = 0;
- *memsize = (*input_file)->file().filesize();
+ *memsize = (*in_file)->file().filesize();
return true;
}
{
*punconfigured = false;
- Input_file* input_file;
+ Input_file* in_file;
off_t memoff;
off_t memsize;
std::string member_name;
- if (!this->get_file_and_offset(off, &input_file, &memoff, &memsize,
+ if (!this->get_file_and_offset(off, &in_file, &memoff, &memsize,
&member_name))
return NULL;
if (parameters->options().has_plugins())
{
- Object* obj = parameters->options().plugins()->claim_file(input_file,
+ Object* obj = parameters->options().plugins()->claim_file(in_file,
memoff,
memsize);
if (obj != NULL)
const unsigned char* ehdr;
int read_size;
- if (!is_elf_object(input_file, memoff, &ehdr, &read_size))
+ if (!is_elf_object(in_file, memoff, &ehdr, &read_size))
{
gold_error(_("%s: member at %zu is not an ELF object"),
this->name().c_str(), static_cast<size_t>(off));
Object *obj = make_elf_object((std::string(this->input_file_->filename())
+ "(" + member_name + ")"),
- input_file, memoff, ehdr, read_size,
+ in_file, memoff, ehdr, read_size,
punconfigured);
if (obj == NULL)
return NULL;
// We make the constructor private to ensure that only the factory
// methods are used.
inline
- Insn_template(unsigned data, Type type, unsigned int r_type, int reloc_addend)
- : data_(data), type_(type), r_type_(r_type), reloc_addend_(reloc_addend)
+ Insn_template(unsigned adata, Type atype, unsigned int rtype, int relocaddend)
+ : data_(adata), type_(atype), r_type_(rtype), reloc_addend_(relocaddend)
{ }
// Instruction specific data. This is used to store information like
static_cast<section_offset_type>(-1);
public:
- Stub(const Stub_template* stub_template)
- : stub_template_(stub_template), offset_(invalid_offset)
+ Stub(const Stub_template* stubtemplate)
+ : stub_template_(stubtemplate), offset_(invalid_offset)
{ }
virtual
// Set offset of code stub from beginning of its containing stub table.
void
- set_offset(section_offset_type offset)
- { this->offset_ = offset; }
+ set_offset(section_offset_type off)
+ { this->offset_ = off; }
// Return the relocation target address of the i-th relocation in the
// stub. This must be defined in a child class.
// If SYMBOL is not null, this is a global symbol, we ignore RELOBJ and
// R_SYM. Otherwise, this is a local symbol and RELOBJ must non-NULL
// and R_SYM must not be invalid_index.
- Key(Stub_type stub_type, const Symbol* symbol, const Relobj* relobj,
- unsigned int r_sym, int32_t addend)
- : stub_type_(stub_type), addend_(addend)
+ Key(Stub_type stubtype, const Symbol* sym, const Relobj* rel_obj,
+ unsigned int rsym, int32_t addend)
+ : stub_type_(stubtype), addend_(addend)
{
- if (symbol != NULL)
+ if (sym != NULL)
{
this->r_sym_ = Reloc_stub::invalid_index;
- this->u_.symbol = symbol;
+ this->u_.symbol = sym;
}
else
{
- gold_assert(relobj != NULL && r_sym != invalid_index);
- this->r_sym_ = r_sym;
- this->u_.relobj = relobj;
+ gold_assert(rel_obj != NULL && rsym != invalid_index);
+ this->r_sym_ = rsym;
+ this->u_.relobj = rel_obj;
}
}
protected:
// Reloc_stubs are created via a stub factory. So these are protected.
- Reloc_stub(const Stub_template* stub_template)
- : Stub(stub_template), destination_address_(invalid_address)
+ Reloc_stub(const Stub_template* stubtemplate)
+ : Stub(stubtemplate), destination_address_(invalid_address)
{ }
~Reloc_stub()
class Stub_table : public Output_data
{
public:
- Stub_table(Arm_input_section<big_endian>* owner)
- : Output_data(), addralign_(1), owner_(owner), has_been_changed_(false),
+ Stub_table(Arm_input_section<big_endian>* own)
+ : Output_data(), addralign_(1), owner_(own), has_been_changed_(false),
reloc_stubs_()
{ }
class Arm_input_section : public Output_relaxed_input_section
{
public:
- Arm_input_section(Relobj* relobj, unsigned int shndx)
- : Output_relaxed_input_section(relobj, shndx, 1),
+ Arm_input_section(Relobj* rel_obj, unsigned int sec_shndx)
+ : Output_relaxed_input_section(rel_obj, sec_shndx, 1),
original_addralign_(1), original_size_(0), stub_table_(NULL)
{ }
// Set the stub_table.
void
- set_stub_table(Stub_table<big_endian>* stub_table)
- { this->stub_table_ = stub_table; }
+ set_stub_table(Stub_table<big_endian>* stubtable)
+ { this->stub_table_ = stubtable; }
// Downcast a base pointer to an Arm_input_section pointer. This is
// not type-safe but we only use Arm_input_section not the base class.
// Output offset.
bool
- do_output_offset(const Relobj* object, unsigned int shndx,
- section_offset_type offset,
+ do_output_offset(const Relobj* object, unsigned int sec_shndx,
+ section_offset_type off,
section_offset_type* poutput) const
{
if ((object == this->relobj())
- && (shndx == this->shndx())
- && (offset >= 0)
- && (convert_types<uint64_t, section_offset_type>(offset)
+ && (sec_shndx == this->shndx())
+ && (off >= 0)
+ && (convert_types<uint64_t, section_offset_type>(off)
<= this->original_size_))
{
- *poutput = offset;
+ *poutput = off;
return true;
}
else
class Arm_output_section : public Output_section
{
public:
- Arm_output_section(const char* name, elfcpp::Elf_Word type,
- elfcpp::Elf_Xword flags)
- : Output_section(name, type, flags)
+ Arm_output_section(const char* aname, elfcpp::Elf_Word atype,
+ elfcpp::Elf_Xword xflags)
+ : Output_section(aname, atype, xflags)
{ }
~Arm_output_section()
public:
static const Arm_address invalid_address = static_cast<Arm_address>(-1);
- Arm_relobj(const std::string& name, Input_file* input_file, off_t offset,
+ Arm_relobj(const std::string& aname, Input_file* inputfile, off_t off,
const typename elfcpp::Ehdr<32, big_endian>& ehdr)
- : Sized_relobj<32, big_endian>(name, input_file, offset, ehdr),
+ : Sized_relobj<32, big_endian>(aname, inputfile, off, ehdr),
stub_tables_(), local_symbol_is_thumb_function_(),
attributes_section_data_(NULL)
{ }
// Return the stub table of the SHNDX-th section if there is one.
Stub_table<big_endian>*
- stub_table(unsigned int shndx) const
+ stub_table(unsigned int sec_shndx) const
{
- gold_assert(shndx < this->stub_tables_.size());
- return this->stub_tables_[shndx];
+ gold_assert(sec_shndx < this->stub_tables_.size());
+ return this->stub_tables_[sec_shndx];
}
// Set STUB_TABLE to be the stub_table of the SHNDX-th section.
void
- set_stub_table(unsigned int shndx, Stub_table<big_endian>* stub_table)
+ set_stub_table(unsigned int sec_shndx, Stub_table<big_endian>* stubtable)
{
- gold_assert(shndx < this->stub_tables_.size());
- this->stub_tables_[shndx] = stub_table;
+ gold_assert(sec_shndx < this->stub_tables_.size());
+ this->stub_tables_[sec_shndx] = stubtable;
}
// Whether a local symbol is a THUMB function. R_SYM is the symbol table
// Convert regular input section with index SHNDX to a relaxed section.
void
- convert_input_section_to_relaxed_section(unsigned shndx)
+ convert_input_section_to_relaxed_section(unsigned sec_shndx)
{
// The stubs have relocations and we need to process them after writing
// out the stubs. So relocation now must follow section write.
- this->invalidate_section_offset(shndx);
+ this->invalidate_section_offset(sec_shndx);
this->set_relocs_must_follow_section_writes();
}
// Downcast a base pointer to an Arm_relobj pointer. This is
// not type-safe but we only use Arm_relobj not the base class.
static Arm_relobj<big_endian>*
- as_arm_relobj(Relobj* relobj)
- { return static_cast<Arm_relobj<big_endian>*>(relobj); }
+ as_arm_relobj(Relobj* rel_obj)
+ { return static_cast<Arm_relobj<big_endian>*>(rel_obj); }
// Processor-specific flags in ELF file header. This is valid only after
// reading symbols.
class Arm_dynobj : public Sized_dynobj<32, big_endian>
{
public:
- Arm_dynobj(const std::string& name, Input_file* input_file, off_t offset,
+ Arm_dynobj(const std::string& aname, Input_file* inputfile, off_t off,
const elfcpp::Ehdr<32, big_endian>& ehdr)
- : Sized_dynobj<32, big_endian>(name, input_file, offset, ehdr),
- processor_specific_flags_(0), attributes_section_data_(NULL)
+ : Sized_dynobj<32, big_endian>(aname, inputfile, off, ehdr),
+ processor_specific_flags_(0)
{ }
~Arm_dynobj()
// Find the Arm_input_section object corresponding to the SHNDX-th input
// section of RELOBJ.
Arm_input_section<big_endian>*
- find_arm_input_section(Relobj* relobj, unsigned int shndx) const;
+ find_arm_input_section(Relobj* rel_obj, unsigned int sec_shndx) const;
// Make a new Stub_table
Stub_table<big_endian>*
void
copy_reloc(Symbol_table* symtab, Layout* layout,
Sized_relobj<32, big_endian>* object,
- unsigned int shndx, Output_section* output_section,
+ unsigned int sec_shndx, Output_section* output_section,
Symbol* sym, const elfcpp::Rel<32, big_endian>& reloc)
{
this->copy_relocs_.copy_reloc(symtab, layout,
symtab->get_sized_symbol<32>(sym),
- object, shndx, output_section, reloc,
+ object, sec_shndx, output_section, reloc,
this->rel_dyn_section(layout));
}
(thumb_bit != 0));
if (stub_type != arm_stub_none)
{
- Stub_table<big_endian>* stub_table =
+ Stub_table<big_endian>* stubtable =
object->stub_table(relinfo->data_shndx);
- gold_assert(stub_table != NULL);
+ gold_assert(stubtable != NULL);
Reloc_stub::Key stub_key(stub_type, gsym, object, r_sym, addend);
- stub = stub_table->find_reloc_stub(stub_key);
+ stub = stubtable->find_reloc_stub(stub_key);
gold_assert(stub != NULL);
thumb_bit = stub->stub_template()->entry_in_thumb_mode() ? 1 : 0;
- branch_target = stub_table->address() + stub->offset() + addend;
+ branch_target = stubtable->address() + stub->offset() + addend;
branch_offset = branch_target - address;
gold_assert((branch_offset <= ARM_MAX_FWD_BRANCH_OFFSET)
&& (branch_offset >= ARM_MAX_BWD_BRANCH_OFFSET));
(thumb_bit != 0));
if (stub_type != arm_stub_none)
{
- Stub_table<big_endian>* stub_table =
+ Stub_table<big_endian>* stubtable =
object->stub_table(relinfo->data_shndx);
- gold_assert(stub_table != NULL);
+ gold_assert(stubtable != NULL);
Reloc_stub::Key stub_key(stub_type, gsym, object, r_sym, addend);
- Reloc_stub* stub = stub_table->find_reloc_stub(stub_key);
+ Reloc_stub* stub = stubtable->find_reloc_stub(stub_key);
gold_assert(stub != NULL);
thumb_bit = stub->stub_template()->entry_in_thumb_mode() ? 1 : 0;
- branch_target = stub_table->address() + stub->offset() + addend;
+ branch_target = stubtable->address() + stub->offset() + addend;
branch_offset = branch_target - address;
}
}
// Stub_template methods.
Stub_template::Stub_template(
- Stub_type type, const Insn_template* insns,
- size_t insn_count)
- : type_(type), insns_(insns), insn_count_(insn_count), alignment_(1),
+ Stub_type atype, const Insn_template* iinsns,
+ size_t insncount)
+ : type_(atype), insns_(iinsns), insn_count_(insncount), alignment_(1),
entry_in_thumb_mode_(false), relocs_()
{
- off_t offset = 0;
+ off_t off = 0;
// Compute byte size and alignment of stub template.
- for (size_t i = 0; i < insn_count; i++)
+ for (size_t i = 0; i < insncount; i++)
{
- unsigned insn_alignment = insns[i].alignment();
- size_t insn_size = insns[i].size();
- gold_assert((offset & (insn_alignment - 1)) == 0);
+ unsigned insn_alignment = iinsns[i].alignment();
+ size_t insn_size = iinsns[i].size();
+ gold_assert((off & (insn_alignment - 1)) == 0);
this->alignment_ = std::max(this->alignment_, insn_alignment);
- switch (insns[i].type())
+ switch (iinsns[i].type())
{
case Insn_template::THUMB16_TYPE:
if (i == 0)
break;
case Insn_template::THUMB32_TYPE:
- if (insns[i].r_type() != elfcpp::R_ARM_NONE)
- this->relocs_.push_back(Reloc(i, offset));
+ if (iinsns[i].r_type() != elfcpp::R_ARM_NONE)
+ this->relocs_.push_back(Reloc(i, off));
if (i == 0)
this->entry_in_thumb_mode_ = true;
break;
case Insn_template::ARM_TYPE:
// Handle cases where the target is encoded within the
// instruction.
- if (insns[i].r_type() == elfcpp::R_ARM_JUMP24)
- this->relocs_.push_back(Reloc(i, offset));
+ if (iinsns[i].r_type() == elfcpp::R_ARM_JUMP24)
+ this->relocs_.push_back(Reloc(i, off));
break;
case Insn_template::DATA_TYPE:
// Entry point cannot be data.
gold_assert(i != 0);
- this->relocs_.push_back(Reloc(i, offset));
+ this->relocs_.push_back(Reloc(i, off));
break;
default:
gold_unreachable();
}
- offset += insn_size;
+ off += insn_size;
}
- this->size_ = offset;
+ this->size_ = off;
}
// Reloc_stub::Key methods.
Reloc_stub::do_fixed_endian_write(unsigned char* view,
section_size_type view_size)
{
- const Stub_template* stub_template = this->stub_template();
- const Insn_template* insns = stub_template->insns();
+ const Stub_template* stubtemplate = this->stub_template();
+ const Insn_template* insns = stubtemplate->insns();
// FIXME: We do not handle BE8 encoding yet.
unsigned char* pov = view;
- for (size_t i = 0; i < stub_template->insn_count(); i++)
+ for (size_t i = 0; i < stubtemplate->insn_count(); i++)
{
switch (insns[i].type())
{
Reloc_stub* stub,
const Reloc_stub::Key& key)
{
- const Stub_template* stub_template = stub->stub_template();
- gold_assert(stub_template->type() == key.stub_type());
+ const Stub_template* stubtemplate = stub->stub_template();
+ gold_assert(stubtemplate->type() == key.stub_type());
this->reloc_stubs_[key] = stub;
- if (this->addralign_ < stub_template->alignment())
- this->addralign_ = stub_template->alignment();
+ if (this->addralign_ < stubtemplate->alignment())
+ this->addralign_ = stubtemplate->alignment();
this->has_been_changed_ = true;
}
Stub_table<big_endian>::relocate_stubs(
const Relocate_info<32, big_endian>* relinfo,
Target_arm<big_endian>* arm_target,
- Output_section* output_section,
+ Output_section* out_section,
unsigned char* view,
- Arm_address address,
+ Arm_address addr,
section_size_type view_size)
{
// If we are passed a view bigger than the stub table's. we need to
// adjust the view.
- gold_assert(address == this->address()
+ gold_assert(addr == this->address()
&& (view_size
== static_cast<section_size_type>(this->data_size())));
++p)
{
Reloc_stub* stub = p->second;
- const Stub_template* stub_template = stub->stub_template();
- if (stub_template->reloc_count() != 0)
+ const Stub_template* stubtemplate = stub->stub_template();
+ if (stubtemplate->reloc_count() != 0)
{
// Adjust view to cover the stub only.
- section_size_type offset = stub->offset();
- section_size_type stub_size = stub_template->size();
- gold_assert(offset + stub_size <= view_size);
+ section_size_type off = stub->offset();
+ section_size_type stub_size = stubtemplate->size();
+ gold_assert(off + stub_size <= view_size);
- arm_target->relocate_stub(stub, relinfo, output_section,
- view + offset, address + offset,
+ arm_target->relocate_stub(stub, relinfo, out_section,
+ view + off, addr + off,
stub_size);
}
}
++p)
{
Reloc_stub* stub = p->second;
- const Stub_template* stub_template = stub->stub_template();
- uint64_t stub_addralign = stub_template->alignment();
+ const Stub_template* stubtemplate = stub->stub_template();
+ uint64_t stub_addralign = stubtemplate->alignment();
max_addralign = std::max(max_addralign, stub_addralign);
off = align_address(off, stub_addralign);
stub->set_offset(off);
stub->reset_destination_address();
- off += stub_template->size();
+ off += stubtemplate->size();
}
this->addralign_ = max_addralign;
void
Stub_table<big_endian>::do_write(Output_file* of)
{
- off_t offset = this->offset();
+ off_t off = this->offset();
const section_size_type oview_size =
convert_to_section_size_type(this->data_size());
- unsigned char* const oview = of->get_output_view(offset, oview_size);
+ unsigned char* const oview = of->get_output_view(off, oview_size);
for (typename Reloc_stub_map::const_iterator p = this->reloc_stubs_.begin();
p != this->reloc_stubs_.end();
++p)
{
Reloc_stub* stub = p->second;
- Arm_address address = this->address() + stub->offset();
- gold_assert(address
- == align_address(address,
+ Arm_address addr = this->address() + stub->offset();
+ gold_assert(addr
+ == align_address(addr,
stub->stub_template()->alignment()));
stub->write(oview + stub->offset(), stub->stub_template()->size(),
big_endian);
void
Arm_input_section<big_endian>::init()
{
- Relobj* relobj = this->relobj();
- unsigned int shndx = this->shndx();
+ Relobj* rel_obj = this->relobj();
+ unsigned int sec_shndx = this->shndx();
// Cache these to speed up size and alignment queries. It is too slow
// to call section_addraglin and section_size every time.
- this->original_addralign_ = relobj->section_addralign(shndx);
- this->original_size_ = relobj->section_size(shndx);
+ this->original_addralign_ = rel_obj->section_addralign(sec_shndx);
+ this->original_size_ = rel_obj->section_size(sec_shndx);
// We want to make this look like the original input section after
// output sections are finalized.
- Output_section* os = relobj->output_section(shndx);
- off_t offset = relobj->output_section_offset(shndx);
- gold_assert(os != NULL && !relobj->is_output_section_offset_invalid(shndx));
- this->set_address(os->address() + offset);
- this->set_file_offset(os->offset() + offset);
+ Output_section* os = rel_obj->output_section(sec_shndx);
+ off_t off = rel_obj->output_section_offset(sec_shndx);
+ gold_assert(os != NULL && !rel_obj->is_output_section_offset_invalid(sec_shndx));
+ this->set_address(os->address() + off);
+ this->set_file_offset(os->offset() + off);
this->set_current_data_size(this->original_size_);
this->finalize_data_size();
// If this owns a stub table, finalize its data size as well.
if (this->is_stub_table_owner())
{
- uint64_t address = this->address();
+ uint64_t addr = this->address();
// The stub table comes after the original section contents.
- address += this->original_size_;
- address = align_address(address, this->stub_table_->addralign());
- off_t offset = this->offset() + (address - this->address());
- this->stub_table_->set_address_and_file_offset(address, offset);
- address += this->stub_table_->data_size();
- gold_assert(address == this->address() + this->current_data_size());
+ addr += this->original_size_;
+ addr = align_address(addr, this->stub_table_->addralign());
+ off_t off = this->offset() + (addr - this->address());
+ this->stub_table_->set_address_and_file_offset(addr, off);
+ addr += this->stub_table_->data_size();
+ gold_assert(addr == this->address() + this->current_data_size());
}
this->set_data_size(this->current_data_size());
// If this is a stub table owner, account for the stub table size.
if (this->is_stub_table_owner())
{
- Stub_table<big_endian>* stub_table = this->stub_table_;
+ Stub_table<big_endian>* stubtable = this->stub_table_;
// Reset the stub table's address and file offset. The
// current data size for child will be updated after that.
stub_table_->reset_address_and_file_offset();
off = align_address(off, stub_table_->addralign());
- off += stub_table->current_data_size();
+ off += stubtable->current_data_size();
}
this->set_current_data_size(off);
}
// Create a stub table.
- Stub_table<big_endian>* stub_table =
+ Stub_table<big_endian>* stubtable =
target->new_stub_table(arm_input_section);
- arm_input_section->set_stub_table(stub_table);
+ arm_input_section->set_stub_table(stubtable);
Input_section_list::const_iterator p = begin;
Input_section_list::const_iterator prev_p;
// in their objects.
Arm_relobj<big_endian>* arm_relobj =
Arm_relobj<big_endian>::as_arm_relobj(p->relobj());
- arm_relobj->set_stub_table(p->shndx(), stub_table);
+ arm_relobj->set_stub_table(p->shndx(), stubtable);
}
prev_p = p++;
}
section_size_type stub_table_end_offset = 0;
Input_section_list::const_iterator group_begin =
this->input_sections().end();
- Input_section_list::const_iterator stub_table =
+ Input_section_list::const_iterator stubtable =
this->input_sections().end();
Input_section_list::const_iterator group_end = this->input_sections().end();
for (Input_section_list::const_iterator p = this->input_sections().begin();
// stub_group_size bytes after the stub table can be
// handled by it too.
state = HAS_STUB_SECTION;
- stub_table = group_end;
+ stubtable = group_end;
stub_table_end_offset = group_end_offset;
}
}
if (section_end_offset - stub_table_end_offset >= group_size)
{
gold_assert(group_end != this->input_sections().end());
- this->create_stub_group(group_begin, group_end, stub_table,
+ this->create_stub_group(group_begin, group_end, stubtable,
target, &new_relaxed_sections);
state = NO_GROUP;
}
this->create_stub_group(group_begin, group_end,
(state == FINDING_STUB_SECTION
? group_end
- : stub_table),
+ : stubtable),
target, &new_relaxed_sections);
}
Arm_relobj<big_endian>* arm_relobj =
Arm_relobj<big_endian>::as_arm_relobj(
new_relaxed_sections[i]->relobj());
- unsigned int shndx = new_relaxed_sections[i]->shndx();
+ unsigned int sec_shndx = new_relaxed_sections[i]->shndx();
// Tell Arm_relobj that this input section is converted.
- arm_relobj->convert_input_section_to_relaxed_section(shndx);
+ arm_relobj->convert_input_section_to_relaxed_section(sec_shndx);
}
}
Arm_relobj<big_endian>::scan_sections_for_stubs(
Target_arm<big_endian>* arm_target,
const Symbol_table* symtab,
- const Layout* layout)
+ const Layout* alayout)
{
- unsigned int shnum = this->shnum();
- const unsigned int shdr_size = elfcpp::Elf_sizes<32>::shdr_size;
+ unsigned int sec_shnum = this->shnum();
+ const unsigned int shdrsize = elfcpp::Elf_sizes<32>::shdr_size;
// Read the section headers.
const unsigned char* pshdrs = this->get_view(this->elf_file()->shoff(),
- shnum * shdr_size,
+ sec_shnum * shdrsize,
true, true);
// To speed up processing, we set up hash tables for fast lookup of
Relocate_info<32, big_endian> relinfo;
relinfo.symtab = symtab;
- relinfo.layout = layout;
+ relinfo.layout = alayout;
relinfo.object = this;
- const unsigned char* p = pshdrs + shdr_size;
- for (unsigned int i = 1; i < shnum; ++i, p += shdr_size)
+ const unsigned char* p = pshdrs + shdrsize;
+ for (unsigned int i = 1; i < sec_shnum; ++i, p += shdrsize)
{
typename elfcpp::Shdr<32, big_endian> shdr(p);
this->local_symbol_is_thumb_function_.swap(empty_vector);
// Read the symbol table section header.
- const unsigned int symtab_shndx = this->symtab_shndx();
+ const unsigned int sym_tab_shndx = this->symtab_shndx();
elfcpp::Shdr<32, big_endian>
- symtabshdr(this, this->elf_file()->section_header(symtab_shndx));
+ symtabshdr(this, this->elf_file()->section_header(sym_tab_shndx));
gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB);
// Read the local symbols.
- const int sym_size =elfcpp::Elf_sizes<32>::sym_size;
+ const int symsize =elfcpp::Elf_sizes<32>::sym_size;
gold_assert(loccount == symtabshdr.get_sh_info());
- off_t locsize = loccount * sym_size;
+ off_t locsize = loccount * symsize;
const unsigned char* psyms = this->get_view(symtabshdr.get_sh_offset(),
locsize, true, true);
// to THUMB functions.
// Skip the first dummy symbol.
- psyms += sym_size;
+ psyms += symsize;
typename Sized_relobj<32, big_endian>::Local_values* plocal_values =
this->local_values();
- for (unsigned int i = 1; i < loccount; ++i, psyms += sym_size)
+ for (unsigned int i = 1; i < loccount; ++i, psyms += symsize)
{
elfcpp::Sym<32, big_endian> sym(psyms);
elfcpp::STT st_type = sym.get_st_type();
void
Arm_relobj<big_endian>::do_relocate_sections(
const Symbol_table* symtab,
- const Layout* layout,
+ const Layout* alayout,
const unsigned char* pshdrs,
typename Sized_relobj<32, big_endian>::Views* pviews)
{
// Call parent to relocate sections.
- Sized_relobj<32, big_endian>::do_relocate_sections(symtab, layout, pshdrs,
+ Sized_relobj<32, big_endian>::do_relocate_sections(symtab, alayout, pshdrs,
pviews);
// We do not generate stubs if doing a relocatable link.
return;
// Relocate stub tables.
- unsigned int shnum = this->shnum();
+ unsigned int sec_shnum = this->shnum();
Target_arm<big_endian>* arm_target =
Target_arm<big_endian>::default_target();
Relocate_info<32, big_endian> relinfo;
relinfo.symtab = symtab;
- relinfo.layout = layout;
+ relinfo.layout = alayout;
relinfo.object = this;
- for (unsigned int i = 1; i < shnum; ++i)
+ for (unsigned int i = 1; i < sec_shnum; ++i)
{
Arm_input_section<big_endian>* arm_input_section =
arm_target->find_arm_input_section(this, i);
// We are passed the output section view. Adjust it to cover the
// stub table only.
- Stub_table<big_endian>* stub_table = arm_input_section->stub_table();
- gold_assert((stub_table->address() >= (*pviews)[i].address)
- && ((stub_table->address() + stub_table->data_size())
+ Stub_table<big_endian>* stubtable = arm_input_section->stub_table();
+ gold_assert((stubtable->address() >= (*pviews)[i].address)
+ && ((stubtable->address() + stubtable->data_size())
<= (*pviews)[i].address + (*pviews)[i].view_size));
- off_t offset = stub_table->address() - (*pviews)[i].address;
- unsigned char* view = (*pviews)[i].view + offset;
- Arm_address address = stub_table->address();
- section_size_type view_size = stub_table->data_size();
+ off_t off = stubtable->address() - (*pviews)[i].address;
+ unsigned char* pview = (*pviews)[i].view + off;
+ Arm_address address = stubtable->address();
+ section_size_type view_size = stubtable->data_size();
- stub_table->relocate_stubs(&relinfo, arm_target, os, view, address,
- view_size);
+ stubtable->relocate_stubs(&relinfo, arm_target, os, pview, address,
+ view_size);
}
}
// section just for PLT entries.
template<bool big_endian>
-Output_data_plt_arm<big_endian>::Output_data_plt_arm(Layout* layout,
+Output_data_plt_arm<big_endian>::Output_data_plt_arm(Layout* alayout,
Output_data_space* got_plt)
: Output_section_data(4), got_plt_(got_plt), count_(0)
{
this->rel_ = new Reloc_section(false);
- layout->add_output_section_data(".rel.plt", elfcpp::SHT_REL,
- elfcpp::SHF_ALLOC, this->rel_, true);
+ alayout->add_output_section_data(".rel.plt", elfcpp::SHT_REL,
+ elfcpp::SHF_ALLOC, this->rel_, true);
}
template<bool big_endian>
void
Output_data_plt_arm<big_endian>::do_write(Output_file* of)
{
- const off_t offset = this->offset();
+ const off_t off = this->offset();
const section_size_type oview_size =
convert_to_section_size_type(this->data_size());
- unsigned char* const oview = of->get_output_view(offset, oview_size);
+ unsigned char* const oview = of->get_output_view(off, oview_size);
const off_t got_file_offset = this->got_plt_->offset();
const section_size_type got_size =
got_offset += 4)
{
// Set and adjust the PLT entry itself.
- int32_t offset = ((got_address + got_offset)
- - (plt_address + plt_offset + 8));
+ int32_t offst = ((got_address + got_offset)
+ - (plt_address + plt_offset + 8));
- gold_assert(offset >= 0 && offset < 0x0fffffff);
- uint32_t plt_insn0 = plt_entry[0] | ((offset >> 20) & 0xff);
+ gold_assert(offst >= 0 && offst < 0x0fffffff);
+ uint32_t plt_insn0 = plt_entry[0] | ((offst >> 20) & 0xff);
elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
- uint32_t plt_insn1 = plt_entry[1] | ((offset >> 12) & 0xff);
+ uint32_t plt_insn1 = plt_entry[1] | ((offst >> 12) & 0xff);
elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
- uint32_t plt_insn2 = plt_entry[2] | (offset & 0xfff);
+ uint32_t plt_insn2 = plt_entry[2] | (offst & 0xfff);
elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
// Set the entry in the GOT.
gold_assert(static_cast<section_size_type>(pov - oview) == oview_size);
gold_assert(static_cast<section_size_type>(got_pov - got_view) == got_size);
- of->write_output_view(offset, oview_size, oview);
+ of->write_output_view(off, oview_size, oview);
of->write_output_view(got_file_offset, got_size, got_view);
}
template<bool big_endian>
void
-Target_arm<big_endian>::make_plt_entry(Symbol_table* symtab, Layout* layout,
+Target_arm<big_endian>::make_plt_entry(Symbol_table* symtab, Layout* alayout,
Symbol* gsym)
{
if (gsym->has_plt_offset())
if (this->plt_ == NULL)
{
// Create the GOT sections first.
- this->got_section(symtab, layout);
+ this->got_section(symtab, alayout);
- this->plt_ = new Output_data_plt_arm<big_endian>(layout, this->got_plt_);
- layout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS,
- (elfcpp::SHF_ALLOC
- | elfcpp::SHF_EXECINSTR),
- this->plt_, false);
+ this->plt_ = new Output_data_plt_arm<big_endian>(alayout, this->got_plt_);
+ alayout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS,
+ (elfcpp::SHF_ALLOC
+ | elfcpp::SHF_EXECINSTR),
+ this->plt_, false);
}
this->plt_->add_entry(gsym);
}
template<bool big_endian>
inline void
Target_arm<big_endian>::Scan::local(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Target_arm* target,
Sized_relobj<32, big_endian>* object,
unsigned int data_shndx,
// relocate it easily.
if (parameters->options().output_is_position_independent())
{
- Reloc_section* rel_dyn = target->rel_dyn_section(layout);
+ Reloc_section* rel_dyn = target->rel_dyn_section(alayout);
unsigned int r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info());
// If we are to add more other reloc types than R_ARM_ABS32,
// we need to add check_non_pic(object, r_type) here.
case elfcpp::R_ARM_GOTOFF32:
// We need a GOT section:
- target->got_section(symtab, layout);
+ target->got_section(symtab, alayout);
break;
case elfcpp::R_ARM_BASE_PREL:
{
// The symbol requires a GOT entry.
Output_data_got<32, big_endian>* got =
- target->got_section(symtab, layout);
+ target->got_section(symtab, alayout);
unsigned int r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info());
if (got->add_local(object, r_sym, GOT_TYPE_STANDARD))
{
// dynamic RELATIVE relocation for this symbol's GOT entry.
if (parameters->options().output_is_position_independent())
{
- Reloc_section* rel_dyn = target->rel_dyn_section(layout);
- unsigned int r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info());
+ Reloc_section* rel_dyn = target->rel_dyn_section(alayout);
+ unsigned int rsym = elfcpp::elf_r_sym<32>(reloc.get_r_info());
rel_dyn->add_local_relative(
- object, r_sym, elfcpp::R_ARM_RELATIVE, got,
- object->local_got_offset(r_sym, GOT_TYPE_STANDARD));
+ object, rsym, elfcpp::R_ARM_RELATIVE, got,
+ object->local_got_offset(rsym, GOT_TYPE_STANDARD));
}
}
}
template<bool big_endian>
inline void
Target_arm<big_endian>::Scan::global(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Target_arm* target,
Sized_relobj<32, big_endian>* object,
unsigned int data_shndx,
{
if (target->may_need_copy_reloc(gsym))
{
- target->copy_reloc(symtab, layout, object,
+ target->copy_reloc(symtab, alayout, object,
data_shndx, output_section, gsym, reloc);
}
else if (gsym->can_use_relative_reloc(false))
{
// If we are to add more other reloc types than R_ARM_ABS32,
// we need to add check_non_pic(object, r_type) here.
- Reloc_section* rel_dyn = target->rel_dyn_section(layout);
+ Reloc_section* rel_dyn = target->rel_dyn_section(alayout);
rel_dyn->add_global_relative(gsym, elfcpp::R_ARM_RELATIVE,
output_section, object,
data_shndx, reloc.get_r_offset());
{
// If we are to add more other reloc types than R_ARM_ABS32,
// we need to add check_non_pic(object, r_type) here.
- Reloc_section* rel_dyn = target->rel_dyn_section(layout);
+ Reloc_section* rel_dyn = target->rel_dyn_section(alayout);
rel_dyn->add_global(gsym, r_type, output_section, object,
data_shndx, reloc.get_r_offset());
}
{
if (target->may_need_copy_reloc(gsym))
{
- target->copy_reloc(symtab, layout, object,
+ target->copy_reloc(symtab, alayout, object,
data_shndx, output_section, gsym, reloc);
}
else
{
check_non_pic(object, r_type);
- Reloc_section* rel_dyn = target->rel_dyn_section(layout);
+ Reloc_section* rel_dyn = target->rel_dyn_section(alayout);
rel_dyn->add_global(gsym, r_type, output_section, object,
data_shndx, reloc.get_r_offset());
}
case elfcpp::R_ARM_THM_CALL:
if (Target_arm<big_endian>::Scan::symbol_needs_plt_entry(gsym))
- target->make_plt_entry(symtab, layout, gsym);
+ target->make_plt_entry(symtab, alayout, gsym);
else
{
// Check to see if this is a function that would need a PLT
&& !gsym->is_from_dynobj()
&& !gsym->is_preemptible())
break;
- target->make_plt_entry(symtab, layout, gsym);
+ target->make_plt_entry(symtab, alayout, gsym);
break;
case elfcpp::R_ARM_GOTOFF32:
// We need a GOT section.
- target->got_section(symtab, layout);
+ target->got_section(symtab, alayout);
break;
case elfcpp::R_ARM_BASE_PREL:
{
// The symbol requires a GOT entry.
Output_data_got<32, big_endian>* got =
- target->got_section(symtab, layout);
+ target->got_section(symtab, alayout);
if (gsym->final_value_is_known())
got->add_global(gsym, GOT_TYPE_STANDARD);
else
{
// If this symbol is not fully resolved, we need to add a
// GOT entry with a dynamic relocation.
- Reloc_section* rel_dyn = target->rel_dyn_section(layout);
+ Reloc_section* rel_dyn = target->rel_dyn_section(alayout);
if (gsym->is_from_dynobj()
|| gsym->is_undefined()
|| gsym->is_preemptible())
template<bool big_endian>
void
Target_arm<big_endian>::gc_process_relocs(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Sized_relobj<32, big_endian>* object,
unsigned int data_shndx,
unsigned int,
const unsigned char* plocal_symbols)
{
typedef Target_arm<big_endian> Arm;
- typedef typename Target_arm<big_endian>::Scan Scan;
+ typedef typename Target_arm<big_endian>::Scan scan;
- gold::gc_process_relocs<32, big_endian, Arm, elfcpp::SHT_REL, Scan>(
+ gold::gc_process_relocs<32, big_endian, Arm, elfcpp::SHT_REL, scan>(
symtab,
- layout,
+ alayout,
this,
object,
data_shndx,
template<bool big_endian>
void
Target_arm<big_endian>::scan_relocs(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Sized_relobj<32, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
size_t local_symbol_count,
const unsigned char* plocal_symbols)
{
- typedef typename Target_arm<big_endian>::Scan Scan;
+ typedef typename Target_arm<big_endian>::Scan scan;
if (sh_type == elfcpp::SHT_RELA)
{
gold_error(_("%s: unsupported RELA reloc section"),
return;
}
- gold::scan_relocs<32, big_endian, Target_arm, elfcpp::SHT_REL, Scan>(
+ gold::scan_relocs<32, big_endian, Target_arm, elfcpp::SHT_REL, scan>(
symtab,
- layout,
+ alayout,
this,
object,
data_shndx,
template<bool big_endian>
void
Target_arm<big_endian>::do_finalize_sections(
- Layout* layout,
+ Layout* alayout,
const Input_objects* input_objects,
Symbol_table* symtab)
{
this->set_may_use_blx(true);
// Fill in some more dynamic tags.
- Output_data_dynamic* const odyn = layout->dynamic_data();
+ Output_data_dynamic* const odyn = alayout->dynamic_data();
if (odyn != NULL)
{
if (this->got_plt_ != NULL
// Emit any relocs we saved in an attempt to avoid generating COPY
// relocs.
if (this->copy_relocs_.any_saved_relocs())
- this->copy_relocs_.emit(this->rel_dyn_section(layout));
+ this->copy_relocs_.emit(this->rel_dyn_section(alayout));
// Handle the .ARM.exidx section.
- Output_section* exidx_section = layout->find_output_section(".ARM.exidx");
+ Output_section* exidx_section = alayout->find_output_section(".ARM.exidx");
if (exidx_section != NULL
&& exidx_section->type() == elfcpp::SHT_ARM_EXIDX
&& !parameters->options().relocatable())
// For the ARM target, we need to add a PT_ARM_EXIDX segment for
// the .ARM.exidx section.
- if (!layout->script_options()->saw_phdrs_clause())
+ if (!alayout->script_options()->saw_phdrs_clause())
{
- gold_assert(layout->find_output_segment(elfcpp::PT_ARM_EXIDX, 0, 0)
+ gold_assert(alayout->find_output_segment(elfcpp::PT_ARM_EXIDX, 0, 0)
== NULL);
Output_segment* exidx_segment =
- layout->make_output_segment(elfcpp::PT_ARM_EXIDX, elfcpp::PF_R);
+ alayout->make_output_segment(elfcpp::PT_ARM_EXIDX, elfcpp::PF_R);
exidx_segment->add_output_section(exidx_section, elfcpp::PF_R,
false);
}
+ arm_input_section->data_size())
<= (address + view_size)));
- off_t offset = section_address - address;
- view += offset;
- address += offset;
+ off_t off = section_address - address;
+ view += off;
+ address += off;
view_size = section_size;
}
void
Target_arm<big_endian>::scan_relocatable_relocs(
Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Sized_relobj<32, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
gold::scan_relocatable_relocs<32, big_endian, elfcpp::SHT_REL,
Scan_relocatable_relocs>(
symtab,
- layout,
+ alayout,
object,
data_shndx,
prelocs,
Target_arm<big_endian>::do_make_elf_object(
const std::string& name,
Input_file* input_file,
- off_t offset, const elfcpp::Ehdr<32, big_endian>& ehdr)
+ off_t off, const elfcpp::Ehdr<32, big_endian>& ehdr)
{
int et = ehdr.get_e_type();
if (et == elfcpp::ET_REL)
{
Arm_relobj<big_endian>* obj =
- new Arm_relobj<big_endian>(name, input_file, offset, ehdr);
+ new Arm_relobj<big_endian>(name, input_file, off, ehdr);
obj->setup();
return obj;
}
else if (et == elfcpp::ET_DYN)
{
Sized_dynobj<32, big_endian>* obj =
- new Arm_dynobj<big_endian>(name, input_file, offset, ehdr);
+ new Arm_dynobj<big_endian>(name, input_file, off, ehdr);
obj->setup();
return obj;
}
template<bool big_endian>
Arm_input_section<big_endian>*
Target_arm<big_endian>::new_arm_input_section(
- Relobj* relobj,
- unsigned int shndx)
+ Relobj* rel_obj,
+ unsigned int sec_shndx)
{
- Input_section_specifier iss(relobj, shndx);
+ Input_section_specifier iss(rel_obj, sec_shndx);
Arm_input_section<big_endian>* arm_input_section =
- new Arm_input_section<big_endian>(relobj, shndx);
+ new Arm_input_section<big_endian>(rel_obj, sec_shndx);
arm_input_section->init();
// Register new Arm_input_section in map for look-up.
template<bool big_endian>
Arm_input_section<big_endian>*
Target_arm<big_endian>::find_arm_input_section(
- Relobj* relobj,
- unsigned int shndx) const
+ Relobj* rel_obj,
+ unsigned int sec_shndx) const
{
- Input_section_specifier iss(relobj, shndx);
+ Input_section_specifier iss(rel_obj, sec_shndx);
typename Arm_input_section_map::const_iterator p =
this->arm_input_section_map_.find(iss);
return (p != this->arm_input_section_map_.end()) ? p->second : NULL;
Stub_table<big_endian>*
Target_arm<big_endian>::new_stub_table(Arm_input_section<big_endian>* owner)
{
- Stub_table<big_endian>* stub_table =
+ Stub_table<big_endian>* stubtable =
new Stub_table<big_endian>(owner);
- this->stub_tables_.push_back(stub_table);
+ this->stub_tables_.push_back(stubtable);
- stub_table->set_address(owner->address() + owner->data_size());
- stub_table->set_file_offset(owner->offset() + owner->data_size());
- stub_table->finalize_data_size();
+ stubtable->set_address(owner->address() + owner->data_size());
+ stubtable->set_file_offset(owner->offset() + owner->data_size());
+ stubtable->finalize_data_size();
- return stub_table;
+ return stubtable;
}
// Scan a relocation for stub generation.
elfcpp::Elf_types<32>::Elf_Swxword addend,
Arm_address address)
{
- typedef typename Target_arm<big_endian>::Relocate Relocate;
+ typedef typename Target_arm<big_endian>::Relocate relocate;
const Arm_relobj<big_endian>* arm_relobj =
Arm_relobj<big_endian>::as_arm_relobj(relinfo->object);
{
// This is a global symbol. Determine if we use PLT and if the
// final target is THUMB.
- if (gsym->use_plt_offset(Relocate::reloc_is_non_pic(r_type)))
+ if (gsym->use_plt_offset(relocate::reloc_is_non_pic(r_type)))
{
// This uses a PLT, change the symbol value.
symval.set_output_value(this->plt_section()->address()
return;
// Try looking up an existing stub from a stub table.
- Stub_table<big_endian>* stub_table =
+ Stub_table<big_endian>* stubtable =
arm_relobj->stub_table(relinfo->data_shndx);
- gold_assert(stub_table != NULL);
+ gold_assert(stubtable != NULL);
// Locate stub by destination.
Reloc_stub::Key stub_key(stub_type, gsym, arm_relobj, r_sym, addend);
// Create a stub if there is not one already
- Reloc_stub* stub = stub_table->find_reloc_stub(stub_key);
+ Reloc_stub* stub = stubtable->find_reloc_stub(stub_key);
if (stub == NULL)
{
// create a new stub and add it to stub table.
stub = this->stub_factory().make_reloc_stub(stub_type);
- stub_table->add_reloc_stub(stub, stub_key);
+ stubtable->add_reloc_stub(stub, stub_key);
}
// Record the destination address.
&& (r_type != elfcpp::R_ARM_THM_JUMP19))
continue;
- section_offset_type offset =
+ section_offset_type off =
convert_to_section_size_type(reloc.get_r_offset());
if (needs_special_offset_handling)
{
- offset = output_section->output_offset(relinfo->object,
- relinfo->data_shndx,
- offset);
- if (offset == -1)
+ off = output_section->output_offset(relinfo->object,
+ relinfo->data_shndx,
+ off);
+ if (off == -1)
continue;
}
// Get the addend.
Stub_addend_reader<sh_type, big_endian> stub_addend_reader;
elfcpp::Elf_types<32>::Elf_Swxword addend =
- stub_addend_reader(r_type, view + offset, reloc);
+ stub_addend_reader(r_type, view + off, reloc);
const Sized_symbol<32>* sym;
// counterpart in the kept section. The symbol must not
// correspond to a section we are folding.
bool is_ordinary;
- unsigned int shndx = psymval->input_shndx(&is_ordinary);
+ unsigned int sec_shndx = psymval->input_shndx(&is_ordinary);
if (is_ordinary
- && shndx != elfcpp::SHN_UNDEF
- && !arm_object->is_section_included(shndx)
- && !(relinfo->symtab->is_section_folded(arm_object, shndx)))
+ && sec_shndx != elfcpp::SHN_UNDEF
+ && !arm_object->is_section_included(sec_shndx)
+ && !(relinfo->symtab->is_section_folded(arm_object, sec_shndx)))
{
if (comdat_behavior == CB_UNDETERMINED)
{
{
bool found;
typename elfcpp::Elf_types<32>::Elf_Addr value =
- arm_object->map_to_kept_section(shndx, &found);
+ arm_object->map_to_kept_section(sec_shndx, &found);
if (found)
symval.set_output_value(value + psymval->input_value());
else
continue;
this->scan_reloc_for_stub(relinfo, r_type, sym, r_sym, psymval,
- addend, view_address + offset);
+ addend, view_address + off);
}
}
template<bool big_endian>
void
Target_arm<big_endian>::group_sections(
- Layout* layout,
+ Layout* alayout,
section_size_type group_size,
bool stubs_always_after_branch)
{
// Group input sections and insert stub table
Layout::Section_list section_list;
- layout->get_allocated_sections(§ion_list);
+ alayout->get_allocated_sections(§ion_list);
for (Layout::Section_list::const_iterator p = section_list.begin();
p != section_list.end();
++p)
int pass,
const Input_objects* input_objects,
Symbol_table* symtab,
- Layout* layout)
+ Layout* alayout)
{
// No need to generate stubs if this is a relocatable link.
gold_assert(!parameters->options().relocatable());
stub_group_size = 4170000;
}
- group_sections(layout, stub_group_size, stubs_always_after_branch);
+ group_sections(alayout, stub_group_size, stubs_always_after_branch);
}
// clear changed flags for all stub_tables
{
Arm_relobj<big_endian>* arm_relobj =
Arm_relobj<big_endian>::as_arm_relobj(*op);
- arm_relobj->scan_sections_for_stubs(this, symtab, layout);
+ arm_relobj->scan_sections_for_stubs(this, symtab, alayout);
}
bool any_stub_table_changed = false;
section_size_type view_size)
{
Relocate relocate;
- const Stub_template* stub_template = stub->stub_template();
- for (size_t i = 0; i < stub_template->reloc_count(); i++)
+ const Stub_template* stubtemplate = stub->stub_template();
+ for (size_t i = 0; i < stubtemplate->reloc_count(); i++)
{
- size_t reloc_insn_index = stub_template->reloc_insn_index(i);
- const Insn_template* insn = &stub_template->insns()[reloc_insn_index];
+ size_t reloc_insn_index = stubtemplate->reloc_insn_index(i);
+ const Insn_template* insn = &stubtemplate->insns()[reloc_insn_index];
unsigned int r_type = insn->r_type();
- section_size_type reloc_offset = stub_template->reloc_offset(i);
+ section_size_type reloc_offset = stubtemplate->reloc_offset(i);
section_size_type reloc_size = insn->size();
gold_assert(reloc_offset + reloc_size <= view_size);
// compressed_output.cc -- manage compressed output sections for gold
-// Copyright 2007, 2008 Free Software Foundation, Inc.
+// Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
void
Output_compressed_section::do_write(Output_file* of)
{
- off_t offset = this->offset();
- off_t data_size = this->data_size();
- unsigned char* view = of->get_output_view(offset, data_size);
+ off_t off = this->offset();
+ off_t datasize = this->data_size();
+ unsigned char* view = of->get_output_view(off, datasize);
if (this->data_ == NULL)
- memcpy(view, this->postprocessing_buffer(), data_size);
+ memcpy(view, this->postprocessing_buffer(), datasize);
else
- memcpy(view, this->data_, data_size);
- of->write_output_view(offset, data_size, view);
+ memcpy(view, this->data_, datasize);
+ of->write_output_view(off, datasize, view);
}
} // End namespace gold.
// compressed_output.h -- compressed output sections for gold -*- C++ -*-
-// Copyright 2007, 2008 Free Software Foundation, Inc.
+// Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
{
public:
Output_compressed_section(const General_options* options,
- const char* name, elfcpp::Elf_Word flags,
- elfcpp::Elf_Xword type)
- : Output_section(name, flags, type),
+ const char* cname, elfcpp::Elf_Word cflags,
+ elfcpp::Elf_Xword ctype)
+ : Output_section(cname, cflags, ctype),
options_(options)
{ this->set_requires_postprocessing(); }
-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.
if test "${enable_werror+set}" = set; then :
case elfcpp::DW_LNS_advance_pc:
{
const uint64_t advance_address
- = read_unsigned_LEB_128(start, &templen);
+ = read_unsigned_LEB_128(start, &templen);
oplen += templen;
lsm->address += header_.min_insn_length * advance_address;
}
case elfcpp::DW_LNS_extended_op:
{
const uint64_t extended_op_len
- = read_unsigned_LEB_128(start, &templen);
+ = read_unsigned_LEB_128(start, &templen);
start += templen;
oplen += templen + extended_op_len;
{
lsm->address = elfcpp::Swap_unaligned<size, big_endian>::readval(start);
typename Reloc_map::const_iterator it
- = reloc_map_.find(start - this->buffer_);
+ = reloc_map_.find(start - this->buffer_);
if (it != reloc_map_.end())
{
// value + addend.
default:
{
- // Ignore unknown opcode silently
+ // Ignore unknown opcode silently.
for (int i = 0; i < header_.std_opcode_lengths[opcode]; i++)
{
- size_t templen;
read_unsigned_LEB_128(start, &templen);
start += templen;
oplen += templen;
}
}
break;
- }
+ }
*len = oplen;
return false;
}
// Sets up the default soname_ to use, in the (rare) cases we never
// see a DT_SONAME entry.
-Dynobj::Dynobj(const std::string& name, Input_file* input_file, off_t offset)
- : Object(name, input_file, true, offset),
+Dynobj::Dynobj(const std::string& aname, Input_file* ainput_file, off_t aoffset)
+ : Object(aname, ainput_file, true, aoffset),
needed_(),
unknown_needed_(UNKNOWN_NEEDED_UNSET)
{
template<int size, bool big_endian>
Sized_dynobj<size, big_endian>::Sized_dynobj(
- const std::string& name,
- Input_file* input_file,
- off_t offset,
+ const std::string& aname,
+ Input_file* ainput_file,
+ off_t aoffset,
const elfcpp::Ehdr<size, big_endian>& ehdr)
- : Dynobj(name, input_file, offset),
+ : Dynobj(aname, ainput_file, aoffset),
elf_file_(this, ehdr),
dynsym_shndx_(-1U),
symbols_(NULL),
void
Sized_dynobj<size, big_endian>::setup()
{
- const unsigned int shnum = this->elf_file_.shnum();
- this->set_shnum(shnum);
+ const unsigned int sec_shnum = this->elf_file_.shnum();
+ this->set_shnum(sec_shnum);
}
// Find the SHT_DYNSYM section and the various version sections, and
unsigned int xindex_shndx = 0;
unsigned int xindex_link = 0;
- const unsigned int shnum = this->shnum();
+ const unsigned int sec_shnum = this->shnum();
const unsigned char* p = pshdrs;
- for (unsigned int i = 0; i < shnum; ++i, p += This::shdr_size)
+ for (unsigned int i = 0; i < sec_shnum; ++i, p += This::shdr_size)
{
typename This::Shdr shdr(p);
unsigned int shndx,
elfcpp::SHT type,
unsigned int link,
- File_view** view,
+ File_view** aview,
section_size_type* view_size,
unsigned int* view_info)
{
if (shndx == -1U)
{
- *view = NULL;
+ *aview = NULL;
*view_size = 0;
*view_info = 0;
return;
this->error(_("unexpected link in section %u header: %u != %u"),
shndx, this->adjust_shndx(shdr.get_sh_link()), link);
- *view = this->get_lasting_view(shdr.get_sh_offset(), shdr.get_sh_size(),
- true, false);
+ *aview = this->get_lasting_view(shdr.get_sh_offset(), shdr.get_sh_size(),
+ true, false);
*view_size = convert_to_section_size_type(shdr.get_sh_size());
*view_info = shdr.get_sh_info();
}
Layout*,
Read_symbols_data* sd)
{
- const unsigned int shnum = this->shnum();
- if (shnum == 0)
+ const unsigned int sec_shnum = this->shnum();
+ if (sec_shnum == 0)
return;
// Get the section headers.
// Skip the first, dummy, section.
pshdrs += This::shdr_size;
- for (unsigned int i = 1; i < shnum; ++i, pshdrs += This::shdr_size)
+ for (unsigned int i = 1; i < sec_shnum; ++i, pshdrs += This::shdr_size)
{
typename This::Shdr shdr(pshdrs);
return;
}
- const char* name = pnames + shdr.get_sh_name();
+ const char* aname = pnames + shdr.get_sh_name();
- this->handle_gnu_warning_section(name, i, symtab);
- this->handle_split_stack_section(name);
+ this->handle_gnu_warning_section(aname, i, symtab);
+ this->handle_split_stack_section(aname);
}
delete sd->section_headers;
Sized_dynobj<size, big_endian>::set_version_map(
Version_map* version_map,
unsigned int ndx,
- const char* name) const
+ const char* aname) const
{
if (ndx >= version_map->size())
version_map->resize(ndx + 1);
if ((*version_map)[ndx] != NULL)
this->error(_("duplicate definition for version %u"), ndx);
- (*version_map)[ndx] = name;
+ (*version_map)[ndx] = aname;
}
// Add mappings for the version definitions to VERSION_MAP.
return;
}
- const int sym_size = This::sym_size;
- const size_t symcount = sd->symbols_size / sym_size;
+ const int symsize = This::sym_size;
+ const size_t symcount = sd->symbols_size / symsize;
gold_assert(sd->external_symbols_offset == 0);
- if (symcount * sym_size != sd->symbols_size)
+ if (symcount * symsize != sd->symbols_size)
{
this->error(_("size of dynamic symbols is not multiple of symbol size"));
return;
p != this->deps_.end();
++p, ++i)
{
- elfcpp::Verdaux_write<size, big_endian> vda(pb);
- vda.set_vda_name(dynpool->get_offset(*p));
- vda.set_vda_next(i + 1 >= this->deps_.size() ? 0 : verdaux_size);
+ elfcpp::Verdaux_write<size, big_endian> avda(pb);
+ avda.set_vda_name(dynpool->get_offset(*p));
+ avda.set_vda_next(i + 1 >= this->deps_.size() ? 0 : verdaux_size);
pb += verdaux_size;
}
// Versions methods.
-Versions::Versions(const Version_script_info& version_script,
+Versions::Versions(const Version_script_info& vscript,
Stringpool* dynpool)
: defs_(), needs_(), version_table_(),
- is_finalized_(false), version_script_(version_script),
+ is_finalized_(false), version_script_(vscript),
needs_base_version_(parameters->options().shared())
{
if (!this->version_script_.empty())
p != syms.end();
++p)
{
- unsigned int version_index;
+ unsigned int vindex;
const char* version = (*p)->version();
if (version == NULL)
- version_index = elfcpp::VER_NDX_GLOBAL;
+ vindex = elfcpp::VER_NDX_GLOBAL;
else
- version_index = this->version_index(symtab, dynpool, *p);
+ vindex = this->version_index(symtab, dynpool, *p);
// If the symbol was defined as foo@V1 instead of foo@@V1, add
// the hidden bit.
if ((*p)->version() != NULL && !(*p)->is_default())
- version_index |= elfcpp::VERSYM_HIDDEN;
+ vindex |= elfcpp::VERSYM_HIDDEN;
elfcpp::Swap<16, big_endian>::writeval(pbuf + (*p)->dynsym_index() * 2,
- version_index);
+ vindex);
}
*pp = pbuf;
// Set the version index.
void
- set_index(unsigned int index)
+ set_index(unsigned int vindex)
{
gold_assert(this->index_ == -1U);
- this->index_ = index;
+ this->index_ = vindex;
}
// Clear the weak flag in a version definition.
class Verdef : public Version_base
{
public:
- Verdef(const char* name, const std::vector<std::string>& deps,
- bool is_base, bool is_weak, bool is_symbol_created)
- : name_(name), deps_(deps), is_base_(is_base), is_weak_(is_weak),
- is_symbol_created_(is_symbol_created)
+ Verdef(const char* vname, const std::vector<std::string>& deps,
+ bool is_base, bool vis_weak, bool vis_symbol_created)
+ : name_(vname), deps_(deps), is_base_(is_base), is_weak_(vis_weak),
+ is_symbol_created_(vis_symbol_created)
{ }
// Return the version name.
// Add a dependency to this version. The NAME should be
// canonicalized in the dynamic Stringpool.
void
- add_dependency(const char* name)
- { this->deps_.push_back(name); }
+ add_dependency(const char* dname)
+ { this->deps_.push_back(dname); }
// Return whether this definition is weak.
bool
class Verneed_version : public Version_base
{
public:
- Verneed_version(const char* version)
- : version_(version)
+ Verneed_version(const char* ver)
+ : version_(ver)
{ }
// Return the version name.
class Verneed
{
public:
- Verneed(const char* filename)
- : filename_(filename), need_versions_()
+ Verneed(const char* fname)
+ : filename_(fname), need_versions_()
{ }
~Verneed();
void
Eh_frame_hdr::set_final_data_size()
{
- unsigned int data_size = eh_frame_hdr_size + 4;
+ unsigned int datasize = eh_frame_hdr_size + 4;
if (!this->any_unrecognized_eh_frame_sections_)
{
unsigned int fde_count = this->eh_frame_data_->fde_count();
if (fde_count != 0)
- data_size += 4 + 8 * fde_count;
+ datasize += 4 + 8 * fde_count;
this->fde_offsets_.reserve(fde_count);
}
- this->set_data_size(data_size);
+ this->set_data_size(datasize);
}
// Write the data to the flie.
{
gold_assert((offset & (addralign - 1)) == 0);
- size_t length = this->contents_.length();
+ size_t len = this->contents_.length();
// We add 8 when getting the aligned length to account for the
// length word and the CIE offset.
- size_t aligned_full_length = align_address(length + 8, addralign);
+ size_t aligned_full_length = align_address(len + 8, addralign);
// Write the length of the FDE as a 32-bit word. The length word
// does not include the four bytes of the length word itself, but it
// Copy the rest of the FDE. Note that this is run before
// relocation processing is done on this section, so the relocations
// will later be applied to the FDE data.
- memcpy(oview + offset + 8, this->contents_.data(), length);
+ memcpy(oview + offset + 8, this->contents_.data(), len);
- if (aligned_full_length > length + 8)
- memset(oview + offset + length + 8, 0, aligned_full_length - (length + 8));
+ if (aligned_full_length > len + 8)
+ memset(oview + offset + len + 8, 0, aligned_full_length - (len + 8));
// Tell the exception frame header about this FDE.
if (eh_frame_hdr != NULL)
const unsigned char* symbols,
section_size_type symbols_size,
const unsigned char* pcontents,
- unsigned int offset,
+ unsigned int fde_offset,
const unsigned char* pfde,
const unsigned char *pfdeend,
Track_relocs<size, big_endian>* relocs,
Offsets_to_cie* cies)
{
- // OFFSET is the distance between the 4 bytes before PFDE to the
+ // FDE_OFFSET is the distance between the 4 bytes before PFDE to the
// start of the CIE. The offset we recorded for the CIE is 8 bytes
// after the start of the CIE--after the length and the zero tag.
- unsigned int cie_offset = (pfde - 4 - pcontents) - offset + 8;
+ unsigned int cie_offset = (pfde - 4 - pcontents) - fde_offset + 8;
Offsets_to_cie::const_iterator pcie = cies->find(cie_offset);
if (pcie == cies->end())
return false;
return;
}
- section_offset_type output_offset = 0;
+ section_offset_type out_offset = 0;
for (Unmergeable_cie_offsets::iterator p =
this->unmergeable_cie_offsets_.begin();
p != this->unmergeable_cie_offsets_.end();
++p)
- output_offset = (*p)->set_output_offset(output_offset,
- this->addralign(),
- &this->merge_map_);
+ out_offset = (*p)->set_output_offset(out_offset,
+ this->addralign(),
+ &this->merge_map_);
for (Cie_offsets::iterator p = this->cie_offsets_.begin();
p != this->cie_offsets_.end();
++p)
- output_offset = (*p)->set_output_offset(output_offset,
- this->addralign(),
- &this->merge_map_);
+ out_offset = (*p)->set_output_offset(out_offset,
+ this->addralign(),
+ &this->merge_map_);
this->mappings_are_done_ = true;
- this->final_data_size_ = output_offset;
+ this->final_data_size_ = out_offset;
- gold_assert((output_offset & (this->addralign() - 1)) == 0);
- this->set_data_size(output_offset);
+ gold_assert((out_offset & (this->addralign() - 1)) == 0);
+ this->set_data_size(out_offset);
}
// Return an output offset for an input offset.
bool
Eh_frame::do_output_offset(const Relobj* object, unsigned int shndx,
- section_offset_type offset,
+ section_offset_type foffset,
section_offset_type* poutput) const
{
- return this->merge_map_.get_output_offset(object, shndx, offset, poutput);
+ return this->merge_map_.get_output_offset(object, shndx, foffset, poutput);
}
// Return whether this is the merge section for an input section.
void
Eh_frame::do_write(Output_file* of)
{
- const off_t offset = this->offset();
+ const off_t foffset = this->offset();
const off_t oview_size = this->data_size();
- unsigned char* const oview = of->get_output_view(offset, oview_size);
+ unsigned char* const oview = of->get_output_view(foffset, oview_size);
switch (parameters->size_and_endianness())
{
gold_unreachable();
}
- of->write_output_view(offset, oview_size, oview);
+ of->write_output_view(foffset, oview_size, oview);
}
// Write the data to the output file--template version.
void
Eh_frame::do_sized_write(unsigned char* oview)
{
- unsigned int addralign = this->addralign();
+ unsigned int addr_align = this->addralign();
section_offset_type o = 0;
for (Unmergeable_cie_offsets::iterator p =
this->unmergeable_cie_offsets_.begin();
p != this->unmergeable_cie_offsets_.end();
++p)
- o = (*p)->write<size, big_endian>(oview, o, addralign,
+ o = (*p)->write<size, big_endian>(oview, o, addr_align,
this->eh_frame_hdr_);
for (Cie_offsets::iterator p = this->cie_offsets_.begin();
p != this->cie_offsets_.end();
++p)
- o = (*p)->write<size, big_endian>(oview, o, addralign,
+ o = (*p)->write<size, big_endian>(oview, o, addr_align,
this->eh_frame_hdr_);
}
// ehframe.h -- handle exception frame sections for gold -*- C++ -*-
-// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
{
public:
Fde(Relobj* object, unsigned int shndx, section_offset_type input_offset,
- const unsigned char* contents, size_t length)
+ const unsigned char* contents, size_t len)
: object_(object), shndx_(shndx), input_offset_(input_offset),
- contents_(reinterpret_cast<const char*>(contents), length)
+ contents_(reinterpret_cast<const char*>(contents), len)
{ }
// Return the length of this FDE. Add 4 for the length and 4 for
// errors.cc -- handle errors for gold
-// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
const int Errors::max_undefined_error_report;
-Errors::Errors(const char* program_name)
- : program_name_(program_name), lock_(NULL), initialize_lock_(&this->lock_),
+Errors::Errors(const char* prog_name)
+ : program_name_(prog_name), lock_(NULL), initialize_lock_(&this->lock_),
error_count_(0), warning_count_(0), undefined_symbols_()
{
}
// expression.cc -- expressions in linker scripts for gold
-// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
&& parameters->options().relocatable())
gold_warning(_("aligning to section relative value"));
- uint64_t value = this->left_value(eei, eei->result_section_pointer);
+ uint64_t val = this->left_value(eei, eei->result_section_pointer);
if (align <= 1)
- return value;
- return ((value + align - 1) / align) * align;
+ return val;
+ return ((val + align - 1) / align) * align;
}
void
uint64_t
value(const Expression_eval_info* eei)
{
- uint64_t value = this->arg_value(eei, eei->result_section_pointer);
- if (!value && eei->check_assertions)
+ uint64_t val = this->arg_value(eei, eei->result_section_pointer);
+ if (!val && eei->check_assertions)
gold_error("%s", this->message_.c_str());
- return value;
+ return val;
}
void
// Create a file for testing.
-Input_file::Input_file(const Task* task, const char* name,
+Input_file::Input_file(const Task* task, const char* iname,
const unsigned char* contents, off_t size)
: file_()
{
this->input_argument_ =
- new Input_file_argument(name, Input_file_argument::INPUT_FILE_TYPE_FILE,
+ new Input_file_argument(iname, Input_file_argument::INPUT_FILE_TYPE_FILE,
"", false, Position_dependent_options());
- bool ok = this->file_.open(task, name, contents, size);
+ bool ok = this->file_.open(task, iname, contents, size);
gold_assert(ok);
}
bool
Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex)
{
- std::string name;
+ std::string iname;
// Case 1: name is an absolute file, just try to open it
// Case 2: name is relative but is_lib is false, is_searched_file is false,
&& !this->input_argument_->is_searched_file()
&& this->input_argument_->extra_search_path() == NULL))
{
- name = this->input_argument_->name();
- this->found_name_ = name;
+ iname = this->input_argument_->name();
+ this->found_name_ = iname;
}
// Case 3: is_lib is true or is_searched_file is true
else if (this->input_argument_->is_lib()
}
else
n1 = this->input_argument_->name();
- name = dirpath.find(n1, n2, &this->is_in_sysroot_, pindex);
- if (name.empty())
+ iname = dirpath.find(n1, n2, &this->is_in_sysroot_, pindex);
+ if (iname.empty())
{
gold_error(_("cannot find %s%s"),
this->input_argument_->is_lib() ? "-l" : "",
this->input_argument_->name());
return false;
}
- if (n2.empty() || name[name.length() - 1] == 'o')
+ if (n2.empty() || iname[iname.length() - 1] == 'o')
this->found_name_ = n1;
else
this->found_name_ = n2;
gold_assert(this->input_argument_->extra_search_path() != NULL);
// First, check extra_search_path.
- name = this->input_argument_->extra_search_path();
- if (!IS_DIR_SEPARATOR (name[name.length() - 1]))
- name += '/';
- name += this->input_argument_->name();
+ iname = this->input_argument_->extra_search_path();
+ if (!IS_DIR_SEPARATOR (iname[iname.length() - 1]))
+ iname += '/';
+ iname += this->input_argument_->name();
struct stat dummy_stat;
- if (*pindex > 0 || ::stat(name.c_str(), &dummy_stat) < 0)
+ if (*pindex > 0 || ::stat(iname.c_str(), &dummy_stat) < 0)
{
// extra_search_path failed, so check the normal search-path.
int index = *pindex;
if (index > 0)
--index;
- name = dirpath.find(this->input_argument_->name(), "",
- &this->is_in_sysroot_, &index);
- if (name.empty())
+ iname = dirpath.find(this->input_argument_->name(), "",
+ &this->is_in_sysroot_, &index);
+ if (iname.empty())
{
gold_error(_("cannot find %s"),
this->input_argument_->name());
this->input_argument_->options().format_enum();
bool ok;
if (format == General_options::OBJECT_FORMAT_ELF)
- ok = this->file_.open(task, name);
+ ok = this->file_.open(task, iname);
else
{
gold_assert(format == General_options::OBJECT_FORMAT_BINARY);
- ok = this->open_binary(task, name);
+ ok = this->open_binary(task, iname);
}
if (!ok)
{
gold_error(_("cannot open %s: %s"),
- name.c_str(), strerror(errno));
+ iname.c_str(), strerror(errno));
return false;
}
// Open a file for --format binary.
bool
-Input_file::open_binary(const Task* task, const std::string& name)
+Input_file::open_binary(const Task* task, const std::string& iname)
{
// In order to open a binary file, we need machine code, size, and
// endianness. We may not have a valid target at this point, in
Binary_to_elf binary_to_elf(target.machine_code(),
target.get_size(),
target.is_big_endian(),
- name);
+ iname);
if (!binary_to_elf.convert(task))
return false;
- return this->file_.open(task, name, binary_to_elf.converted_data_leak(),
+ return this->file_.open(task, iname, binary_to_elf.converted_data_leak(),
binary_to_elf.converted_size());
}
DATA_MMAPPED
};
- View(off_t start, section_size_type size, const unsigned char* data,
- unsigned int byteshift, bool cache, Data_ownership data_ownership)
- : start_(start), size_(size), data_(data), lock_count_(0),
- byteshift_(byteshift), cache_(cache), data_ownership_(data_ownership),
+ View(off_t vstart, section_size_type vsize, const unsigned char* vdata,
+ unsigned int vbyteshift, bool cache, Data_ownership data_ownership)
+ : start_(vstart), size_(vsize), data_(vdata), lock_count_(0),
+ byteshift_(vbyteshift), cache_(cache), data_ownership_(data_ownership),
accessed_(true)
{ }
friend class File_read;
// Callers have to get these via File_read::get_lasting_view.
- File_view(File_read& file, File_read::View* view, const unsigned char* data)
- : file_(file), view_(view), data_(data)
+ File_view(File_read& file, File_read::View* view, const unsigned char* vdata)
+ : file_(file), view_(view), data_(vdata)
{ }
File_read& file_;
class Target_selector_freebsd : public Target_selector
{
public:
- Target_selector_freebsd(int machine, int size, bool is_big_endian,
- const char* bfd_name,
+ Target_selector_freebsd(int amachine, int size, bool is_big_end,
+ const char* bfdname,
const char* freebsd_bfd_name)
- : Target_selector(machine, size, is_big_endian, NULL),
- bfd_name_(bfd_name), freebsd_bfd_name_(freebsd_bfd_name)
+ : Target_selector(amachine, size, is_big_end, NULL),
+ bfd_name_(bfdname), freebsd_bfd_name_(freebsd_bfd_name)
{ }
protected:
void
Output_data_plt_i386::do_write(Output_file* of)
{
- const off_t offset = this->offset();
+ const off_t off = this->offset();
const section_size_type oview_size =
convert_to_section_size_type(this->data_size());
- unsigned char* const oview = of->get_output_view(offset, oview_size);
+ unsigned char* const oview = of->get_output_view(off, oview_size);
const off_t got_file_offset = this->got_plt_->offset();
const section_size_type got_size =
gold_assert(static_cast<section_size_type>(pov - oview) == oview_size);
gold_assert(static_cast<section_size_type>(got_pov - got_view) == got_size);
- of->write_output_view(offset, oview_size, oview);
+ of->write_output_view(off, oview_size, oview);
of->write_output_view(got_file_offset, got_size, got_view);
}
if (parameters->options().output_is_position_independent())
{
Reloc_section* rel_dyn = target->rel_dyn_section(layout);
- unsigned int r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info());
+ r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info());
rel_dyn->add_local_relative(
object, r_sym, elfcpp::R_386_RELATIVE, got,
object->local_got_offset(r_sym, GOT_TYPE_STANDARD));
Symbol_table* symtab)
{
unsigned int section_num = 0;
- std::vector<unsigned int> num_tracked_relocs;
+ std::vector<unsigned int> num_tracked_rels;
std::vector<bool> is_secn_or_group_unique;
std::vector<std::string> section_contents;
this->id_section_.push_back(Section_id(*p, i));
this->section_id_[Section_id(*p, i)] = section_num;
this->kept_section_id_.push_back(section_num);
- num_tracked_relocs.push_back(0);
+ num_tracked_rels.push_back(0);
is_secn_or_group_unique.push_back(false);
section_contents.push_back("");
section_num++;
{
num_iterations++;
converged = match_sections(num_iterations, symtab,
- &num_tracked_relocs, &this->kept_section_id_,
+ &num_tracked_rels, &this->kept_section_id_,
this->id_section_, &is_secn_or_group_unique,
§ion_contents);
}
// Record the input arguments obtained from parsing the command line.
void
- report_inputs(const Input_arguments& inputs)
- { this->inputs_ = &inputs; }
+ report_inputs(const Input_arguments& ins)
+ { this->inputs_ = &ins; }
// Record that the input argument INPUT is an archive ARCHIVE.
void
// Layout methods.
-Layout::Layout(int number_of_input_files, Script_options* script_options)
+Layout::Layout(int number_of_input_files, Script_options* script_opts)
: number_of_input_files_(number_of_input_files),
- script_options_(script_options),
+ script_options_(script_opts),
namepool_(),
sympool_(),
dynpool_(),
// inconvenient to check.
if (this->allocated_output_section_count() >= elfcpp::SHN_LORESERVE)
{
- Output_section* dynsym_xindex =
+ Output_section* dyn_sym_xindex =
this->choose_output_section(NULL, ".dynsym_shndx",
elfcpp::SHT_SYMTAB_SHNDX,
elfcpp::SHF_ALLOC,
this->dynsym_xindex_ = new Output_symtab_xindex(index);
- dynsym_xindex->add_output_section_data(this->dynsym_xindex_);
+ dyn_sym_xindex->add_output_section_data(this->dynsym_xindex_);
- dynsym_xindex->set_link_section(dynsym);
- dynsym_xindex->set_addralign(4);
- dynsym_xindex->set_entsize(4);
+ dyn_sym_xindex->set_link_section(dynsym);
+ dyn_sym_xindex->set_addralign(4);
+ dyn_sym_xindex->set_entsize(4);
- dynsym_xindex->set_after_input_sections();
+ dyn_sym_xindex->set_after_input_sections();
// This tells the driver code to wait until the symbol table has
// written out before writing out the postprocessing sections,
// Store the allocated sections into the section list.
void
-Layout::get_allocated_sections(Section_list* section_list) const
+Layout::get_allocated_sections(Section_list* sec_list) const
{
for (Section_list::const_iterator p = this->section_list_.begin();
p != this->section_list_.end();
++p)
if (((*p)->flags() & elfcpp::SHF_ALLOC) != 0)
- section_list->push_back(*p);
+ sec_list->push_back(*p);
}
// Create an output segment.
{
if (!parameters->options().strip_all())
{
- const Output_section* symtab_section = this->symtab_section_;
+ const Output_section* sym_tab_section = this->symtab_section_;
for (Section_list::const_iterator p = this->section_list_.begin();
p != this->section_list_.end();
++p)
{
if ((*p)->needs_symtab_index())
{
- gold_assert(symtab_section != NULL);
+ gold_assert(sym_tab_section != NULL);
unsigned int index = (*p)->symtab_index();
gold_assert(index > 0 && index != -1U);
- off_t off = (symtab_section->offset()
- + index * symtab_section->entsize());
+ off_t off = (sym_tab_section->offset()
+ + index * sym_tab_section->entsize());
symtab->write_section_symbol(*p, this->symtab_xindex_, of, off);
}
}
}
- const Output_section* dynsym_section = this->dynsym_section_;
+ const Output_section* dyn_sym_section = this->dynsym_section_;
for (Section_list::const_iterator p = this->section_list_.begin();
p != this->section_list_.end();
++p)
{
if ((*p)->needs_dynsym_index())
{
- gold_assert(dynsym_section != NULL);
+ gold_assert(dyn_sym_section != NULL);
unsigned int index = (*p)->dynsym_index();
gold_assert(index > 0 && index != -1U);
- off_t off = (dynsym_section->offset()
- + index * dynsym_section->entsize());
+ off_t off = (dyn_sym_section->offset()
+ + index * dyn_sym_section->entsize());
symtab->write_section_symbol(*p, this->dynsym_xindex_, of, off);
}
}
// Set the object.
void
- set_object(Relobj* object)
+ set_object(Relobj* obj)
{
gold_assert(this->object_ == NULL);
- this->object_ = object;
+ this->object_ = obj;
}
// The section index.
// Set the section index.
void
- set_shndx(unsigned int shndx)
+ set_shndx(unsigned int sec_shndx)
{
gold_assert(this->shndx_ == 0);
- this->shndx_ = shndx;
+ this->shndx_ = sec_shndx;
}
// Whether this is a comdat group.
// Add a section to the group list.
void
- add_comdat_section(const std::string& name, unsigned int shndx,
+ add_comdat_section(const std::string& name, unsigned int sec_shndx,
uint64_t size)
{
gold_assert(this->is_comdat_);
- Comdat_section_info sinfo(shndx, size);
+ Comdat_section_info sinfo(sec_shndx, size);
this->u_.group_sections->insert(std::make_pair(name, sinfo));
}
&& is_ordinary
&& sym->is_defined())
{
- for (size_t i = 0; i < Mapfile::section_name_map_length; ++i)
+ for (size_t j = 0; j < Mapfile::section_name_map_length; ++j)
putc(' ', this->map_file_);
const Sized_symbol<size>* ssym =
static_cast<const Sized_symbol<size>*>(sym);
bool
Output_merge_base::do_output_offset(const Relobj* object,
unsigned int shndx,
- section_offset_type offset,
+ section_offset_type off,
section_offset_type* poutput) const
{
- return this->merge_map_.get_output_offset(object, shndx, offset, poutput);
+ return this->merge_map_.get_output_offset(object, shndx, off, poutput);
}
// Return whether this is the merge section for SHNDX in OBJECT.
void
Output_merge_data::add_constant(const unsigned char* p)
{
- section_size_type entsize = convert_to_section_size_type(this->entsize());
- section_size_type addralign =
+ section_size_type ent_size = convert_to_section_size_type(this->entsize());
+ section_size_type addr_align =
convert_to_section_size_type(this->addralign());
- section_size_type addsize = std::max(entsize, addralign);
+ section_size_type addsize = std::max(ent_size, addr_align);
if (this->len_ + addsize > this->alc_)
{
if (this->alc_ == 0)
gold_nomem();
}
- memcpy(this->p_ + this->len_, p, entsize);
- if (addsize > entsize)
- memset(this->p_ + this->len_ + entsize, 0, addsize - entsize);
+ memcpy(this->p_ + this->len_, p, ent_size);
+ if (addsize > ent_size)
+ memset(this->p_ + this->len_ + ent_size, 0, addsize - ent_size);
this->len_ += addsize;
}
section_size_type len;
const unsigned char* p = object->section_contents(shndx, &len, false);
- section_size_type entsize = convert_to_section_size_type(this->entsize());
+ section_size_type ent_size = convert_to_section_size_type(this->entsize());
- if (len % entsize != 0)
+ if (len % ent_size != 0)
return false;
- this->input_count_ += len / entsize;
+ this->input_count_ += len / ent_size;
- for (section_size_type i = 0; i < len; i += entsize, p += entsize)
+ for (section_size_type i = 0; i < len; i += ent_size, p += ent_size)
{
// Add the constant to the section contents. If we find that it
// is already in the hash table, we will remove it again.
if (!ins.second)
{
// Key was already present. Remove the copy we just added.
- this->len_ -= entsize;
+ this->len_ -= ent_size;
k = *ins.first;
}
// Record the offset of this constant in the output section.
- this->add_mapping(object, shndx, i, entsize, k);
+ this->add_mapping(object, shndx, i, ent_size, k);
}
return true;
p != this->merged_strings_.end();
++p)
{
- section_offset_type offset =
+ section_offset_type soffset =
this->stringpool_.get_offset_from_key(p->stringpool_key);
- this->add_mapping(p->object, p->shndx, p->offset, p->length, offset);
+ this->add_mapping(p->object, p->shndx, p->offset, p->length, soffset);
}
// Save some memory. This also ensures that this function will work
// merge.h -- handle section merging for gold -*- C++ -*-
-// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
class Output_merge_base : public Output_section_data
{
public:
- Output_merge_base(uint64_t entsize, uint64_t addralign)
- : Output_section_data(addralign), merge_map_(), entsize_(entsize)
+ Output_merge_base(uint64_t ent_size, uint64_t addr_align)
+ : Output_section_data(addr_align), merge_map_(), entsize_(ent_size)
{ }
// Return the entry size.
bool
do_is_merge_section_for(const Relobj*, unsigned int shndx) const;
- // Add a mapping from an OFFSET in input section SHNDX in object
- // OBJECT to an OUTPUT_OFFSET in the output section. OUTPUT_OFFSET
+ // Add a mapping from an IN_OFFSET in input section SHNDX in object
+ // OBJECT to an OUT_OFFSET in the output section. OUT_OFFSET
// is the offset from the start of the merged data in the output
// section.
void
- add_mapping(Relobj* object, unsigned int shndx, section_offset_type offset,
- section_size_type length, section_offset_type output_offset)
+ add_mapping(Relobj* object, unsigned int shndx, section_offset_type in_offset,
+ section_size_type length, section_offset_type out_offset)
{
- this->merge_map_.add_mapping(object, shndx, offset, length, output_offset);
+ this->merge_map_.add_mapping(object, shndx, in_offset, length, out_offset);
}
// This may be overriden by the child class.
class Output_merge_data : public Output_merge_base
{
public:
- Output_merge_data(uint64_t entsize, uint64_t addralign)
- : Output_merge_base(entsize, addralign), p_(NULL), len_(0), alc_(0),
+ Output_merge_data(uint64_t ent_size, uint64_t addr_align)
+ : Output_merge_base(ent_size, addr_align), p_(NULL), len_(0), alc_(0),
input_count_(0),
hashtable_(128, Merge_data_hash(this), Merge_data_eq(this))
{ }
class Output_merge_string : public Output_merge_base
{
public:
- Output_merge_string(uint64_t addralign)
- : Output_merge_base(sizeof(Char_type), addralign), stringpool_(),
+ Output_merge_string(uint64_t addr_align)
+ : Output_merge_base(sizeof(Char_type), addr_align), stringpool_(),
merged_strings_(), input_count_(0)
{
- gold_assert(addralign <= sizeof(Char_type));
+ gold_assert(addr_align <= sizeof(Char_type));
this->stringpool_.set_no_zero_null();
}
template<int size, bool big_endian>
void
-Xindex::initialize_symtab_xindex(Object* object, unsigned int symtab_shndx)
+Xindex::initialize_symtab_xindex(Object* object, unsigned int sym_tab_shndx)
{
if (!this->symtab_xindex_.empty())
return;
- gold_assert(symtab_shndx != 0);
+ gold_assert(sym_tab_shndx != 0);
// Look through the sections in reverse order, on the theory that it
// is more likely to be near the end than the beginning.
{
--i;
if (object->section_type(i) == elfcpp::SHT_SYMTAB_SHNDX
- && this->adjust_shndx(object->section_link(i)) == symtab_shndx)
+ && this->adjust_shndx(object->section_link(i)) == sym_tab_shndx)
{
this->read_symtab_xindex<size, big_endian>(object, i, NULL);
return;
// Read the section headers.
const off_t shoff = elf_file->shoff();
- const unsigned int shnum = this->shnum();
- sd->section_headers = this->get_lasting_view(shoff, shnum * shdr_size,
+ const unsigned int sec_shnum = this->shnum();
+ sd->section_headers = this->get_lasting_view(shoff, sec_shnum * shdr_size,
true, true);
// Read the section names.
false);
}
-// If NAME is the name of a special .gnu.warning section, arrange for
+// If SNAME is the name of a special .gnu.warning section, arrange for
// the warning to be issued. SHNDX is the section index. Return
// whether it is a warning section.
bool
-Object::handle_gnu_warning_section(const char* name, unsigned int shndx,
+Object::handle_gnu_warning_section(const char* sname, unsigned int shndx,
Symbol_table* symtab)
{
const char warn_prefix[] = ".gnu.warning.";
const int warn_prefix_len = sizeof warn_prefix - 1;
- if (strncmp(name, warn_prefix, warn_prefix_len) == 0)
+ if (strncmp(sname, warn_prefix, warn_prefix_len) == 0)
{
// Read the section contents to get the warning text. It would
// be nicer if we only did this if we have to actually issue a
false);
if (len == 0)
{
- const char* warning = name + warn_prefix_len;
+ const char* warning = sname + warn_prefix_len;
contents = reinterpret_cast<const unsigned char*>(warning);
len = strlen(warning);
}
std::string warning(reinterpret_cast<const char*>(contents), len);
- symtab->add_warning(name + warn_prefix_len, this, warning);
+ symtab->add_warning(sname + warn_prefix_len, this, warning);
return true;
}
return false;
}
-// If NAME is the name of the special section which indicates that
+// If SNAME is the name of the special section which indicates that
// this object was compiled with -fstack-split, mark it accordingly.
bool
-Object::handle_split_stack_section(const char* name)
+Object::handle_split_stack_section(const char* sname)
{
- if (strcmp(name, ".note.GNU-split-stack") == 0)
+ if (strcmp(sname, ".note.GNU-split-stack") == 0)
{
this->uses_split_stack_ = true;
return true;
}
- if (strcmp(name, ".note.GNU-no-split-stack") == 0)
+ if (strcmp(sname, ".note.GNU-no-split-stack") == 0)
{
this->has_no_split_stack_ = true;
return true;
// roots of the worklist.
bool
-Relobj::is_section_name_included(const char* name)
+Relobj::is_section_name_included(const char* sname)
{
- if (is_prefix_of(".ctors", name)
- || is_prefix_of(".dtors", name)
- || is_prefix_of(".note", name)
- || is_prefix_of(".init", name)
- || is_prefix_of(".fini", name)
- || is_prefix_of(".gcc_except_table", name)
- || is_prefix_of(".jcr", name)
- || is_prefix_of(".preinit_array", name)
- || (is_prefix_of(".text", name)
- && strstr(name, "personality"))
- || (is_prefix_of(".data", name)
- && strstr(name, "personality"))
- || (is_prefix_of(".gnu.linkonce.d", name) &&
- strstr(name, "personality")))
+ if (is_prefix_of(".ctors", sname)
+ || is_prefix_of(".dtors", sname)
+ || is_prefix_of(".note", sname)
+ || is_prefix_of(".init", sname)
+ || is_prefix_of(".fini", sname)
+ || is_prefix_of(".gcc_except_table", sname)
+ || is_prefix_of(".jcr", sname)
+ || is_prefix_of(".preinit_array", sname)
+ || (is_prefix_of(".text", sname)
+ && strstr(sname, "personality"))
+ || (is_prefix_of(".data", sname)
+ && strstr(sname, "personality"))
+ || (is_prefix_of(".gnu.linkonce.d", sname)
+ && strstr(sname, "personality")))
{
return true;
}
template<int size, bool big_endian>
Sized_relobj<size, big_endian>::Sized_relobj(
- const std::string& name,
- Input_file* input_file,
- off_t offset,
+ const std::string& aname,
+ Input_file* ainput_file,
+ off_t aoffset,
const elfcpp::Ehdr<size, big_endian>& ehdr)
- : Relobj(name, input_file, offset),
+ : Relobj(aname, ainput_file, aoffset),
elf_file_(this, ehdr),
symtab_shndx_(-1U),
local_symbol_count_(0),
void
Sized_relobj<size, big_endian>::do_setup()
{
- const unsigned int shnum = this->elf_file_.shnum();
- this->set_shnum(shnum);
+ const unsigned int sec_shnum = this->elf_file_.shnum();
+ this->set_shnum(sec_shnum);
}
// Find the SHT_SYMTAB section, given the section headers. The ELF
void
Sized_relobj<size, big_endian>::find_symtab(const unsigned char* pshdrs)
{
- const unsigned int shnum = this->shnum();
+ const unsigned int sec_shnum = this->shnum();
this->symtab_shndx_ = 0;
- if (shnum > 0)
+ if (sec_shnum > 0)
{
// Look through the sections in reverse order, since gas tends
// to put the symbol table at the end.
- const unsigned char* p = pshdrs + shnum * This::shdr_size;
- unsigned int i = shnum;
+ const unsigned char* p = pshdrs + sec_shnum * This::shdr_size;
+ unsigned int i = sec_shnum;
unsigned int xindex_shndx = 0;
unsigned int xindex_link = 0;
while (i > 0)
const char* names,
section_size_type names_size) const
{
- const unsigned int shnum = this->shnum();
+ const unsigned int sec_shnum = this->shnum();
const unsigned char* p = pshdrs + This::shdr_size;
- for (unsigned int i = 1; i < shnum; ++i, p += This::shdr_size)
+ for (unsigned int i = 1; i < sec_shnum; ++i, p += This::shdr_size)
{
typename This::Shdr shdr(p);
if (this->check_eh_frame_flags(&shdr))
continue;
}
- const char* name = names + shdr.get_sh_name();
- if (strcmp(name, ".eh_frame") == 0)
+ const char* aname = names + shdr.get_sh_name();
+ if (strcmp(aname, ".eh_frame") == 0)
return true;
}
}
// object file format is over 5 pages that we don't need to read
// now.
- const int sym_size = This::sym_size;
+ const int symsize = This::sym_size;
const unsigned int loccount = symtabshdr.get_sh_info();
this->local_symbol_count_ = loccount;
this->local_values_.resize(loccount);
- section_offset_type locsize = loccount * sym_size;
+ section_offset_type locsize = loccount * symsize;
off_t dataoff = symtabshdr.get_sh_offset();
section_size_type datasize =
convert_to_section_size_type(symtabshdr.get_sh_size());
bool
Sized_relobj<size, big_endian>::include_section_group(
Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
unsigned int index,
- const char* name,
+ const char* aname,
const unsigned char* shdrs,
const char* section_names,
section_size_type section_names_size,
}
else
{
- include_group = layout->find_or_add_kept_section(signature,
- this, index, true,
- true, &kept_section);
+ include_group = alayout->find_or_add_kept_section(signature,
+ this, index, true,
+ true, &kept_section);
is_comdat = true;
}
}
if (relocate_group)
- layout->layout_group(symtab, this, index, name, signature.c_str(),
- shdr, flags, &shndxes);
+ alayout->layout_group(symtab, this, index, aname, signature.c_str(),
+ shdr, flags, &shndxes);
return include_group;
}
template<int size, bool big_endian>
bool
Sized_relobj<size, big_endian>::include_linkonce_section(
- Layout* layout,
+ Layout* alayout,
unsigned int index,
- const char* name,
+ const char* aname,
const elfcpp::Shdr<size, big_endian>& shdr)
{
typename elfcpp::Elf_types<size>::Elf_WXword sh_size = shdr.get_sh_size();
// ".gnu.linkonce.d.rel.ro.local".
const char* const linkonce_t = ".gnu.linkonce.t.";
const char* symname;
- if (strncmp(name, linkonce_t, strlen(linkonce_t)) == 0)
- symname = name + strlen(linkonce_t);
+ if (strncmp(aname, linkonce_t, strlen(linkonce_t)) == 0)
+ symname = aname + strlen(linkonce_t);
else
- symname = strrchr(name, '.') + 1;
+ symname = strrchr(aname, '.') + 1;
std::string sig1(symname);
- std::string sig2(name);
+ std::string sig2(aname);
Kept_section* kept1;
Kept_section* kept2;
- bool include1 = layout->find_or_add_kept_section(sig1, this, index, false,
- false, &kept1);
- bool include2 = layout->find_or_add_kept_section(sig2, this, index, false,
- true, &kept2);
+ bool include1 = alayout->find_or_add_kept_section(sig1, this, index, false,
+ false, &kept1);
+ bool include2 = alayout->find_or_add_kept_section(sig2, this, index, false,
+ true, &kept2);
if (!include2)
{
template<int size, bool big_endian>
inline void
-Sized_relobj<size, big_endian>::layout_section(Layout* layout,
+Sized_relobj<size, big_endian>::layout_section(Layout* alayout,
unsigned int shndx,
- const char* name,
+ const char* aname,
typename This::Shdr& shdr,
unsigned int reloc_shndx,
unsigned int reloc_type)
{
- off_t offset;
- Output_section* os = layout->layout(this, shndx, name, shdr,
- reloc_shndx, reloc_type, &offset);
+ off_t aoffset;
+ Output_section* os = alayout->layout(this, shndx, aname, shdr,
+ reloc_shndx, reloc_type, &aoffset);
this->output_sections()[shndx] = os;
- if (offset == -1)
+ if (aoffset == -1)
this->section_offsets_[shndx] = invalid_address;
else
- this->section_offsets_[shndx] = convert_types<Address, off_t>(offset);
+ this->section_offsets_[shndx] = convert_types<Address, off_t>(aoffset);
// If this section requires special handling, and if there are
// relocs that apply to it, then we must do the special handling
// before we apply the relocs.
- if (offset == -1 && reloc_shndx != 0)
+ if (aoffset == -1 && reloc_shndx != 0)
this->set_relocs_must_follow_section_writes();
}
template<int size, bool big_endian>
void
Sized_relobj<size, big_endian>::do_layout(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Read_symbols_data* sd)
{
- const unsigned int shnum = this->shnum();
+ const unsigned int sec_shnum = this->shnum();
bool is_gc_pass_one = ((parameters->options().gc_sections()
&& !symtab->gc()->is_worklist_ready())
|| (parameters->options().icf_enabled()
// Both is_gc_pass_one and is_gc_pass_two should not be true.
gold_assert(!(is_gc_pass_one && is_gc_pass_two));
- if (shnum == 0)
+ if (sec_shnum == 0)
return;
Symbols_data* gc_sd = NULL;
if (is_gc_pass_one)
// During garbage collection save the symbols data to use it when
// re-entering this function.
gc_sd = new Symbols_data;
- this->copy_symbols_data(gc_sd, sd, This::shdr_size * shnum);
+ this->copy_symbols_data(gc_sd, sd, This::shdr_size * sec_shnum);
this->set_symbols_data(gc_sd);
}
else if (is_gc_pass_two)
// For each section, record the index of the reloc section if any.
// Use 0 to mean that there is no reloc section, -1U to mean that
// there is more than one.
- std::vector<unsigned int> reloc_shndx(shnum, 0);
- std::vector<unsigned int> reloc_type(shnum, elfcpp::SHT_NULL);
+ std::vector<unsigned int> reloc_shndx(sec_shnum, 0);
+ std::vector<unsigned int> reloc_type(sec_shnum, elfcpp::SHT_NULL);
// Skip the first, dummy, section.
pshdrs = shdrs + This::shdr_size;
- for (unsigned int i = 1; i < shnum; ++i, pshdrs += This::shdr_size)
+ for (unsigned int i = 1; i < sec_shnum; ++i, pshdrs += This::shdr_size)
{
typename This::Shdr shdr(pshdrs);
if (sh_type == elfcpp::SHT_REL || sh_type == elfcpp::SHT_RELA)
{
unsigned int target_shndx = this->adjust_shndx(shdr.get_sh_info());
- if (target_shndx == 0 || target_shndx >= shnum)
+ if (target_shndx == 0 || target_shndx >= sec_shnum)
{
this->error(_("relocation section %u has bad info %u"),
i, target_shndx);
if (!is_gc_pass_two)
{
- out_sections.resize(shnum);
- out_section_offsets.resize(shnum);
+ out_sections.resize(sec_shnum);
+ out_section_offsets.resize(sec_shnum);
}
// If we are only linking for symbols, then there is nothing else to
uint64_t gnu_stack_flags = 0;
// Keep track of which sections to omit.
- std::vector<bool> omit(shnum, false);
+ std::vector<bool> omit(sec_shnum, false);
// Keep track of reloc sections when emitting relocations.
const bool relocatable = parameters->options().relocatable();
- const bool emit_relocs = (relocatable
- || parameters->options().emit_relocs());
+ const bool emit_rels = (relocatable
+ || parameters->options().emit_relocs());
std::vector<unsigned int> reloc_sections;
// Keep track of .eh_frame sections.
// Skip the first, dummy, section.
pshdrs = shdrs + This::shdr_size;
- for (unsigned int i = 1; i < shnum; ++i, pshdrs += This::shdr_size)
+ for (unsigned int i = 1; i < sec_shnum; ++i, pshdrs += This::shdr_size)
{
typename This::Shdr shdr(pshdrs);
return;
}
- const char* name = pnames + shdr.get_sh_name();
+ const char* sname = pnames + shdr.get_sh_name();
if (!is_gc_pass_two)
{
- if (this->handle_gnu_warning_section(name, i, symtab))
+ if (this->handle_gnu_warning_section(sname, i, symtab))
{
if (!relocatable)
omit[i] = true;
// The .note.GNU-stack section is special. It gives the
// protection flags that this object file requires for the stack
// in memory.
- if (strcmp(name, ".note.GNU-stack") == 0)
+ if (strcmp(sname, ".note.GNU-stack") == 0)
{
seen_gnu_stack = true;
gnu_stack_flags |= shdr.get_sh_flags();
// The .note.GNU-split-stack section is also special. It
// indicates that the object was compiled with
// -fsplit-stack.
- if (this->handle_split_stack_section(name))
+ if (this->handle_split_stack_section(sname))
{
if (!parameters->options().relocatable()
&& !parameters->options().shared())
}
// Skip attributes section.
- if (parameters->target().is_attributes_section(name))
+ if (parameters->target().is_attributes_section(sname))
{
omit[i] = true;
}
{
if (shdr.get_sh_type() == elfcpp::SHT_GROUP)
{
- if (!this->include_section_group(symtab, layout, i, name,
+ if (!this->include_section_group(symtab, alayout, i, sname,
shdrs, pnames,
section_names_size,
&omit))
discard = true;
}
else if ((shdr.get_sh_flags() & elfcpp::SHF_GROUP) == 0
- && Layout::is_linkonce(name))
+ && Layout::is_linkonce(sname))
{
- if (!this->include_linkonce_section(layout, i, name, shdr))
+ if (!this->include_linkonce_section(alayout, i, sname, shdr))
discard = true;
}
}
if (is_gc_pass_one && parameters->options().gc_sections())
{
- if (is_section_name_included(name)
+ if (is_section_name_included(sname)
|| shdr.get_sh_type() == elfcpp::SHT_INIT_ARRAY
|| shdr.get_sh_type() == elfcpp::SHT_FINI_ARRAY)
{
// However, we don't know that yet for all sections. So save
// reloc sections and process them later. Garbage collection is
// not triggered when relocatable code is desired.
- if (emit_relocs
+ if (emit_rels
&& (shdr.get_sh_type() == elfcpp::SHT_REL
|| shdr.get_sh_type() == elfcpp::SHT_RELA))
{
// determine which sections are being discarded, and discard the
// corresponding information.
if (!relocatable
- && strcmp(name, ".eh_frame") == 0
+ && strcmp(sname, ".eh_frame") == 0
&& this->check_eh_frame_flags(&shdr))
{
if (is_gc_pass_one)
if (should_defer_layout && (shdr.get_sh_flags() & elfcpp::SHF_ALLOC))
{
gold_assert(!is_gc_pass_two);
- this->deferred_layout_.push_back(Deferred_layout(i, name,
+ this->deferred_layout_.push_back(Deferred_layout(i, sname,
pshdrs,
reloc_shndx[i],
reloc_type[i]));
{
// When garbage collection is switched on the actual layout
// only happens in the second call.
- this->layout_section(layout, i, name, shdr, reloc_shndx[i],
+ this->layout_section(alayout, i, sname, shdr, reloc_shndx[i],
reloc_type[i]);
}
}
if (!is_gc_pass_one)
- layout->layout_gnu_stack(seen_gnu_stack, gnu_stack_flags);
+ alayout->layout_gnu_stack(seen_gnu_stack, gnu_stack_flags);
// When doing a relocatable link handle the reloc sections at the
// end. Garbage collection and Identical Code Folding is not
// turned on for relocatable code.
- if (emit_relocs)
+ if (emit_rels)
this->size_relocatable_relocs();
gold_assert(!(is_gc_or_icf) || reloc_sections.empty());
typename This::Shdr shdr(pshdr);
unsigned int data_shndx = this->adjust_shndx(shdr.get_sh_info());
- if (data_shndx >= shnum)
+ if (data_shndx >= sec_shnum)
{
// We already warned about this above.
continue;
Relocatable_relocs* rr = new Relocatable_relocs();
this->set_relocatable_relocs(i, rr);
- Output_section* os = layout->layout_reloc(this, i, shdr, data_section,
- rr);
+ Output_section* os = alayout->layout_reloc(this, i, shdr, data_section,
+ rr);
out_sections[i] = os;
out_section_offsets[i] = invalid_address;
}
pshdr = section_headers_data + i * This::shdr_size;
typename This::Shdr shdr(pshdr);
- off_t offset;
- Output_section* os = layout->layout_eh_frame(this,
- symbols_data,
- symbols_size,
- symbol_names_data,
- symbol_names_size,
- i, shdr,
- reloc_shndx[i],
- reloc_type[i],
- &offset);
+ off_t off;
+ Output_section* os = alayout->layout_eh_frame(this,
+ symbols_data,
+ symbols_size,
+ symbol_names_data,
+ symbol_names_size,
+ i, shdr,
+ reloc_shndx[i],
+ reloc_type[i],
+ &off);
out_sections[i] = os;
- if (offset == -1)
+ if (off == -1)
{
// An object can contain at most one section holding exception
// frame information.
out_section_offsets[i] = invalid_address;
}
else
- out_section_offsets[i] = convert_types<Address, off_t>(offset);
+ out_section_offsets[i] = convert_types<Address, off_t>(off);
// If this section requires special handling, and if there are
// relocs that apply to it, then we must do the special handling
// before we apply the relocs.
- if (offset == -1 && reloc_shndx[i] != 0)
+ if (off == -1 && reloc_shndx[i] != 0)
this->set_relocs_must_follow_section_writes();
}
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_layout_deferred_sections(Layout* layout)
+Sized_relobj<size, big_endian>::do_layout_deferred_sections(Layout* alayout)
{
typename std::vector<Deferred_layout>::iterator deferred;
++deferred)
{
typename This::Shdr shdr(deferred->shdr_data_);
- this->layout_section(layout, deferred->shndx_, deferred->name_.c_str(),
+ this->layout_section(alayout, deferred->shndx_, deferred->name_.c_str(),
shdr, deferred->reloc_shndx_, deferred->reloc_type_);
}
return;
}
- const int sym_size = This::sym_size;
+ const int symsize = This::sym_size;
size_t symcount = ((sd->symbols_size - sd->external_symbols_offset)
- / sym_size);
- if (symcount * sym_size != sd->symbols_size - sd->external_symbols_offset)
+ / symsize);
+ if (symcount * symsize != sd->symbols_size - sd->external_symbols_offset)
{
this->error(_("size of symbols is not multiple of symbol size"));
return;
}
// Read the symbol table section header.
- const unsigned int symtab_shndx = this->symtab_shndx_;
+ const unsigned int sym_tab_shndx = this->symtab_shndx_;
typename This::Shdr symtabshdr(this,
- this->elf_file_.section_header(symtab_shndx));
+ this->elf_file_.section_header(sym_tab_shndx));
gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB);
// Read the local symbols.
- const int sym_size = This::sym_size;
+ const int symsize = This::sym_size;
const unsigned int loccount = this->local_symbol_count_;
gold_assert(loccount == symtabshdr.get_sh_info());
- off_t locsize = loccount * sym_size;
+ off_t locsize = loccount * symsize;
const unsigned char* psyms = this->get_view(symtabshdr.get_sh_offset(),
locsize, true, true);
// Loop over the local symbols.
const Output_sections& out_sections(this->output_sections());
- unsigned int shnum = this->shnum();
+ unsigned int sec_shnum = this->shnum();
unsigned int count = 0;
unsigned int dyncount = 0;
// Skip the first, dummy, symbol.
- psyms += sym_size;
+ psyms += symsize;
bool discard_locals = parameters->options().discard_locals();
- for (unsigned int i = 1; i < loccount; ++i, psyms += sym_size)
+ for (unsigned int i = 1; i < loccount; ++i, psyms += symsize)
{
elfcpp::Sym<size, big_endian> sym(psyms);
// Decide whether this symbol should go into the output file.
- if ((shndx < shnum && out_sections[shndx] == NULL)
+ if ((shndx < sec_shnum && out_sections[shndx] == NULL)
|| (shndx == this->discarded_eh_frame_shndx_))
{
lv.set_no_output_symtab_entry();
// - the symbol has a name.
//
// We do not discard a symbol if it needs a dynamic symbol entry.
- const char* name = pnames + sym.get_st_name();
+ const char* sname = pnames + sym.get_st_name();
if (discard_locals
&& sym.get_st_type() != elfcpp::STT_FILE
&& !lv.needs_output_dynsym_entry()
- && parameters->target().is_local_label_name(name))
+ && parameters->target().is_local_label_name(sname))
{
lv.set_no_output_symtab_entry();
continue;
// Discard the local symbol if -retain_symbols_file is specified
// and the local symbol is not in that file.
- if (!parameters->options().should_retain_symbol(name))
+ if (!parameters->options().should_retain_symbol(sname))
{
lv.set_no_output_symtab_entry();
continue;
}
// Add the symbol to the symbol table string pool.
- pool->add(name, true, NULL);
+ pool->add(sname, true, NULL);
++count;
// If needed, add the symbol to the dynamic symbol table string pool.
if (lv.needs_output_dynsym_entry())
{
- dynpool->add(name, true, NULL);
+ dynpool->add(sname, true, NULL);
++dyncount;
}
}
const bool relocatable = parameters->options().relocatable();
const Output_sections& out_sections(this->output_sections());
const std::vector<Address>& out_offsets(this->section_offsets_);
- unsigned int shnum = this->shnum();
+ unsigned int sec_shnum = this->shnum();
for (unsigned int i = 1; i < loccount; ++i)
{
}
else
{
- if (shndx >= shnum)
+ if (shndx >= sec_shnum)
{
this->error(_("local symbol %u section index %u out of range"),
i, shndx);
}
// Read the symbol table section header.
- const unsigned int symtab_shndx = this->symtab_shndx_;
+ const unsigned int sym_tab_shndx = this->symtab_shndx_;
typename This::Shdr symtabshdr(this,
- this->elf_file_.section_header(symtab_shndx));
+ this->elf_file_.section_header(sym_tab_shndx));
gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB);
const unsigned int loccount = this->local_symbol_count_;
gold_assert(loccount == symtabshdr.get_sh_info());
// Read the local symbols.
- const int sym_size = This::sym_size;
- off_t locsize = loccount * sym_size;
+ const int symsize = This::sym_size;
+ off_t locsize = loccount * symsize;
const unsigned char* psyms = this->get_view(symtabshdr.get_sh_offset(),
locsize, true, false);
// Get views into the output file for the portions of the symbol table
// and the dynamic symbol table that we will be writing.
- off_t output_size = this->output_local_symbol_count_ * sym_size;
+ off_t output_size = this->output_local_symbol_count_ * symsize;
unsigned char* oview = NULL;
if (output_size > 0)
oview = of->get_output_view(this->local_symbol_offset_, output_size);
- off_t dyn_output_size = this->output_local_dynsym_count_ * sym_size;
+ off_t dyn_output_size = this->output_local_dynsym_count_ * symsize;
unsigned char* dyn_oview = NULL;
if (dyn_output_size > 0)
dyn_oview = of->get_output_view(this->local_dynsym_offset_,
unsigned char* ov = oview;
unsigned char* dyn_ov = dyn_oview;
- psyms += sym_size;
- for (unsigned int i = 1; i < loccount; ++i, psyms += sym_size)
+ psyms += symsize;
+ for (unsigned int i = 1; i < loccount; ++i, psyms += symsize)
{
elfcpp::Sym<size, big_endian> isym(psyms);
elfcpp::Sym_write<size, big_endian> osym(ov);
gold_assert(isym.get_st_name() < strtab_size);
- const char* name = pnames + isym.get_st_name();
- osym.put_st_name(sympool->get_offset(name));
+ const char* sname = pnames + isym.get_st_name();
+ osym.put_st_name(sympool->get_offset(sname));
osym.put_st_value(this->local_values_[i].value(this, 0));
osym.put_st_size(isym.get_st_size());
osym.put_st_info(isym.get_st_info());
osym.put_st_other(isym.get_st_other());
osym.put_st_shndx(st_shndx);
- ov += sym_size;
+ ov += symsize;
}
// Write the symbol to the output dynamic symbol table.
elfcpp::Sym_write<size, big_endian> osym(dyn_ov);
gold_assert(isym.get_st_name() < strtab_size);
- const char* name = pnames + isym.get_st_name();
- osym.put_st_name(dynpool->get_offset(name));
+ const char* sname = pnames + isym.get_st_name();
+ osym.put_st_name(dynpool->get_offset(sname));
osym.put_st_value(this->local_values_[i].value(this, 0));
osym.put_st_size(isym.get_st_size());
osym.put_st_info(isym.get_st_info());
osym.put_st_other(isym.get_st_other());
osym.put_st_shndx(st_shndx);
- dyn_ov += sym_size;
+ dyn_ov += symsize;
}
}
bool
Sized_relobj<size, big_endian>::get_symbol_location_info(
unsigned int shndx,
- off_t offset,
+ off_t sym_offset,
Symbol_location_info* info)
{
if (this->symtab_shndx_ == 0)
this->section_contents(symbol_names_shndx, &names_size, false);
const char* symbol_names = reinterpret_cast<const char*>(symbol_names_u);
- const int sym_size = This::sym_size;
- const size_t count = symbols_size / sym_size;
+ const int symsize = This::sym_size;
+ const size_t count = symbols_size / symsize;
const unsigned char* p = symbols;
- for (size_t i = 0; i < count; ++i, p += sym_size)
+ for (size_t i = 0; i < count; ++i, p += symsize)
{
elfcpp::Sym<size, big_endian> sym(p);
&is_ordinary);
if (is_ordinary
&& st_shndx == shndx
- && static_cast<off_t>(sym.get_st_value()) <= offset
+ && static_cast<off_t>(sym.get_st_value()) <= sym_offset
&& (static_cast<off_t>(sym.get_st_value() + sym.get_st_size())
- > offset))
+ > sym_offset))
{
if (sym.get_st_name() > names_size)
info->enclosing_symbol_name = "(invalid)";
Sized_relobj<size, big_endian>* kept_relobj =
static_cast<Sized_relobj<size, big_endian>*>(kept_object);
Output_section* os = kept_relobj->output_section(kept_shndx);
- Address offset = kept_relobj->get_output_section_offset(kept_shndx);
- if (os != NULL && offset != invalid_address)
+ Address addr_offset = kept_relobj->get_output_section_offset(kept_shndx);
+ if (os != NULL && addr_offset != invalid_address)
{
*found = true;
- return os->address() + offset;
+ return os->address() + addr_offset;
}
}
*found = false;
// (e.g., libfoo.a(bar.o) if this is in an archive. INPUT_FILE is
// used to read the file. OFFSET is the offset within the input
// file--0 for a .o or .so file, something else for a .a file.
- Object(const std::string& name, Input_file* input_file, bool is_dynamic,
- off_t offset = 0)
- : name_(name), input_file_(input_file), offset_(offset), shnum_(-1U),
- is_dynamic_(is_dynamic), is_needed_(false), uses_split_stack_(false),
+ Object(const std::string& oname, Input_file* oinput_file, bool ois_dynamic,
+ off_t ooffset = 0)
+ : name_(oname), input_file_(oinput_file), offset_(ooffset), shnum_(-1U),
+ is_dynamic_(ois_dynamic), is_needed_(false), uses_split_stack_(false),
has_no_split_stack_(false), no_export_(false), xindex_(NULL)
- { input_file->file().add_object(); }
+ { oinput_file->file().add_object(); }
virtual ~Object()
{ this->input_file_->file().remove_object(); }
// Pass sections which should be included in the link to the Layout
// object, and record where the sections go in the output file.
void
- layout(Symbol_table* symtab, Layout* layout, Read_symbols_data* sd)
- { this->do_layout(symtab, layout, sd); }
+ layout(Symbol_table* symtab, Layout* olayout, Read_symbols_data* sd)
+ { this->do_layout(symtab, olayout, sd); }
// Add symbol information to the global symbol table.
void
- add_symbols(Symbol_table* symtab, Read_symbols_data* sd, Layout *layout)
- { this->do_add_symbols(symtab, sd, layout); }
+ add_symbols(Symbol_table* symtab, Read_symbols_data* sd, Layout *olayout)
+ { this->do_add_symbols(symtab, sd, olayout); }
// Functions and types for the elfcpp::Elf_file interface. This
// permit us to use Object as the File template parameter for
// Set the number of sections.
void
- set_shnum(int shnum)
- { this->shnum_ = shnum; }
+ set_shnum(int sec_shnum)
+ { this->shnum_ = sec_shnum; }
// Functions used by both Sized_relobj and Sized_dynobj.
class Relobj : public Object
{
public:
- Relobj(const std::string& name, Input_file* input_file, off_t offset = 0)
- : Object(name, input_file, false, offset),
+ Relobj(const std::string& rname, Input_file* rinput_file, off_t roffset = 0)
+ : Object(rname, rinput_file, false, roffset),
output_sections_(),
map_to_relocatable_relocs_(NULL),
object_merge_map_(NULL),
// Process the relocs, during garbage collection only.
void
- gc_process_relocs(Symbol_table* symtab, Layout* layout, Read_relocs_data* rd)
- { return this->do_gc_process_relocs(symtab, layout, rd); }
+ gc_process_relocs(Symbol_table* symtab, Layout* olayout, Read_relocs_data* rd)
+ { return this->do_gc_process_relocs(symtab, olayout, rd); }
// Scan the relocs and adjust the symbol table.
void
- scan_relocs(Symbol_table* symtab, Layout* layout, Read_relocs_data* rd)
- { return this->do_scan_relocs(symtab, layout, rd); }
+ scan_relocs(Symbol_table* symtab, Layout* olayout, Read_relocs_data* rd)
+ { return this->do_scan_relocs(symtab, olayout, rd); }
// The number of local symbols in the input symbol table.
virtual unsigned int
// Relocate the input sections and write out the local symbols.
void
- relocate(const Symbol_table* symtab, const Layout* layout, Output_file* of)
- { return this->do_relocate(symtab, layout, of); }
+ relocate(const Symbol_table* symtab, const Layout* olayout, Output_file* of)
+ { return this->do_relocate(symtab, olayout, of); }
// Return whether an input section is being included in the link.
bool
// Layout sections whose layout was deferred while waiting for
// input files from a plugin.
void
- layout_deferred_sections(Layout* layout)
- { this->do_layout_deferred_sections(layout); }
+ layout_deferred_sections(Layout* olayout)
+ { this->do_layout_deferred_sections(olayout); }
protected:
// The output section to be used for each input section, indexed by
// Set the value of this symbol in the output symbol table.
void
- set_output_value(Value value)
- { this->u_.value = value; }
+ set_output_value(Value val)
+ { this->u_.value = val; }
// For a section symbol in a merged section, we need more
// information.
// called by count_local_symbols, to communicate the value to
// finalize_local_symbols.
void
- set_input_value(Value value)
- { this->u_.value = value; }
+ set_input_value(Value val)
+ { this->u_.value = val; }
// Return the input value. This is only called by
// finalize_local_symbols and (in special cases) relocate_section.
// Relocate the sections in the output file.
void
- relocate_sections(const Symbol_table* symtab, const Layout* layout,
+ relocate_sections(const Symbol_table* symtab, const Layout* olayout,
const unsigned char* pshdrs, Views* pviews)
- { this->do_relocate_sections(symtab, layout, pshdrs, pviews); }
+ { this->do_relocate_sections(symtab, olayout, pshdrs, pviews); }
// Scan the input relocations for --emit-relocs.
void
parse(parse_function)
{ }
- void parse_to_value(const char* option, const char* arg,
+ void parse_to_value(const char* opt, const char* arg,
Command_line* cmdline, General_options* options)
- { (options->*(this->parse))(option, arg, cmdline); }
+ { (options->*(this->parse))(opt, arg, cmdline); }
One_option option;
Parse_function parse;
{ }
// This is the usual constructor.
- Search_directory(const char* name, bool put_in_sysroot)
- : name_(name), put_in_sysroot_(put_in_sysroot), is_in_sysroot_(false)
+ Search_directory(const char* cname, bool put_in_sysroot)
+ : name_(cname), put_in_sysroot_(put_in_sysroot), is_in_sysroot_(false)
{
if (this->name_.empty())
this->name_ = ".";
just_symbols_(false), options_()
{ }
- Input_file_argument(const char* name, Input_file_type type,
- const char* extra_search_path,
- bool just_symbols,
- const Position_dependent_options& options)
- : name_(name), type_(type), extra_search_path_(extra_search_path),
- just_symbols_(just_symbols), options_(options)
+ Input_file_argument(const char* aname, Input_file_type type,
+ const char* aextra_search_path,
+ bool ajust_symbols,
+ const Position_dependent_options& aoptions)
+ : name_(aname), type_(type), extra_search_path_(aextra_search_path),
+ just_symbols_(ajust_symbols), options_(aoptions)
{ }
// You can also pass in a General_options instance instead of a
// Position_dependent_options. In that case, we extract the
// position-independent vars from the General_options and only store
// those.
- Input_file_argument(const char* name, Input_file_type type,
- const char* extra_search_path,
- bool just_symbols,
- const General_options& options)
- : name_(name), type_(type), extra_search_path_(extra_search_path),
- just_symbols_(just_symbols), options_(options)
+ Input_file_argument(const char* aname, Input_file_type type,
+ const char* aextra_search_path,
+ bool ajust_symbols,
+ const General_options& aoptions)
+ : name_(aname), type_(type), extra_search_path_(aextra_search_path),
+ just_symbols_(ajust_symbols), options_(aoptions)
{ }
const char*
{
public:
// Create a file or library argument.
- explicit Input_argument(Input_file_argument file)
- : is_file_(true), file_(file), group_(NULL)
+ explicit Input_argument(Input_file_argument afile)
+ : is_file_(true), file_(afile), group_(NULL)
{ }
// Create a group argument.
- explicit Input_argument(Input_file_group* group)
- : is_file_(false), group_(group)
+ explicit Input_argument(Input_file_group* agroup)
+ : is_file_(false), group_(agroup)
{ }
// Return whether this is a file.
Output_file_header::Output_file_header(const Target* target,
const Symbol_table* symtab,
const Output_segment_headers* osh,
- const char* entry)
+ const char* aentry)
: target_(target),
symtab_(symtab),
segment_header_(osh),
section_header_(NULL),
shstrtab_(NULL),
- entry_(entry)
+ entry_(aentry)
{
this->set_data_size(this->do_size());
}
&& !parameters->options().shared());
// FIXME: Need to support target specific entry symbol.
- const char* entry = this->entry_;
- if (entry == NULL)
- entry = "_start";
+ const char* entry_sym = this->entry_;
+ if (entry_sym == NULL)
+ entry_sym = "_start";
- Symbol* sym = this->symtab_->lookup(entry);
+ Symbol* sym = this->symtab_->lookup(entry_sym);
typename Sized_symbol<size>::Value_type v;
if (sym != NULL)
Sized_symbol<size>* ssym;
ssym = this->symtab_->get_sized_symbol<size>(sym);
if (!ssym->is_defined() && should_issue_warning)
- gold_warning("entry symbol '%s' exists but is not defined", entry);
+ gold_warning("entry symbol '%s' exists but is not defined", entry_sym);
v = ssym->value();
}
else
// We couldn't find the entry symbol. See if we can parse it as
// a number. This supports, e.g., -e 0x1000.
char* endptr;
- v = strtoull(entry, &endptr, 0);
+ v = strtoull(entry_sym, &endptr, 0);
if (*endptr != '\0')
{
if (should_issue_warning)
- gold_warning("cannot find entry symbol '%s'", entry);
+ gold_warning("cannot find entry symbol '%s'", entry_sym);
v = 0;
}
}
// of the output section.
void
-Output_section_data::set_addralign(uint64_t addralign)
+Output_section_data::set_addralign(uint64_t addr_align)
{
- this->addralign_ = addralign;
+ this->addralign_ = addr_align;
if (this->output_section_ != NULL
- && this->output_section_->addralign() < addralign)
- this->output_section_->set_addralign(addralign);
+ && this->output_section_->addralign() < addr_align)
+ this->output_section_->set_addralign(addr_align);
}
// Output_data_strtab methods.
unsigned int type,
Output_data* od,
Address address,
- bool is_relative)
+ bool is_rel)
: address_(address), local_sym_index_(GSYM_CODE), type_(type),
- is_relative_(is_relative), is_section_symbol_(false), shndx_(INVALID_CODE)
+ is_relative_(is_rel), is_section_symbol_(false), shndx_(INVALID_CODE)
{
// this->type_ is a bitfield; make sure TYPE fits.
gold_assert(this->type_ == type);
Sized_relobj<size, big_endian>* relobj,
unsigned int shndx,
Address address,
- bool is_relative)
+ bool is_rel)
: address_(address), local_sym_index_(GSYM_CODE), type_(type),
- is_relative_(is_relative), is_section_symbol_(false), shndx_(shndx)
+ is_relative_(is_rel), is_section_symbol_(false), shndx_(shndx)
{
gold_assert(shndx != INVALID_CODE);
// this->type_ is a bitfield; make sure TYPE fits.
unsigned int type,
Output_data* od,
Address address,
- bool is_relative,
+ bool is_rel,
bool is_section_symbol)
: address_(address), local_sym_index_(local_sym_index), type_(type),
- is_relative_(is_relative), is_section_symbol_(is_section_symbol),
+ is_relative_(is_rel), is_section_symbol_(is_section_symbol),
shndx_(INVALID_CODE)
{
gold_assert(local_sym_index != GSYM_CODE
unsigned int type,
unsigned int shndx,
Address address,
- bool is_relative,
+ bool is_rel,
bool is_section_symbol)
: address_(address), local_sym_index_(local_sym_index), type_(type),
- is_relative_(is_relative), is_section_symbol_(is_section_symbol),
+ is_relative_(is_rel), is_section_symbol_(is_section_symbol),
shndx_(shndx)
{
gold_assert(local_sym_index != GSYM_CODE
this->entries_.push_back(Got_entry());
this->set_got_size();
- unsigned int got_offset = this->last_got_offset();
- gsym->set_got_offset(got_type, got_offset);
- rel_dyn->add_global(gsym, r_type, this, got_offset);
+ unsigned int g_offset = this->last_got_offset();
+ gsym->set_got_offset(got_type, g_offset);
+ rel_dyn->add_global(gsym, r_type, this, g_offset);
}
template<int size, bool big_endian>
this->entries_.push_back(Got_entry());
this->set_got_size();
- unsigned int got_offset = this->last_got_offset();
- gsym->set_got_offset(got_type, got_offset);
- rela_dyn->add_global(gsym, r_type, this, got_offset, 0);
+ unsigned int g_offset = this->last_got_offset();
+ gsym->set_got_offset(got_type, g_offset);
+ rela_dyn->add_global(gsym, r_type, this, g_offset, 0);
}
// Add a pair of entries for a global symbol to the GOT, and add
return;
this->entries_.push_back(Got_entry());
- unsigned int got_offset = this->last_got_offset();
- gsym->set_got_offset(got_type, got_offset);
- rel_dyn->add_global(gsym, r_type_1, this, got_offset);
+ unsigned int g_offset = this->last_got_offset();
+ gsym->set_got_offset(got_type, g_offset);
+ rel_dyn->add_global(gsym, r_type_1, this, g_offset);
this->entries_.push_back(Got_entry());
if (r_type_2 != 0)
{
- got_offset = this->last_got_offset();
- rel_dyn->add_global(gsym, r_type_2, this, got_offset);
+ g_offset = this->last_got_offset();
+ rel_dyn->add_global(gsym, r_type_2, this, g_offset);
}
this->set_got_size();
return;
this->entries_.push_back(Got_entry());
- unsigned int got_offset = this->last_got_offset();
- gsym->set_got_offset(got_type, got_offset);
- rela_dyn->add_global(gsym, r_type_1, this, got_offset, 0);
+ unsigned int g_offset = this->last_got_offset();
+ gsym->set_got_offset(got_type, g_offset);
+ rela_dyn->add_global(gsym, r_type_1, this, g_offset, 0);
this->entries_.push_back(Got_entry());
if (r_type_2 != 0)
{
- got_offset = this->last_got_offset();
- rela_dyn->add_global(gsym, r_type_2, this, got_offset, 0);
+ g_offset = this->last_got_offset();
+ rela_dyn->add_global(gsym, r_type_2, this, g_offset, 0);
}
this->set_got_size();
this->entries_.push_back(Got_entry());
this->set_got_size();
- unsigned int got_offset = this->last_got_offset();
- object->set_local_got_offset(symndx, got_type, got_offset);
- rel_dyn->add_local(object, symndx, r_type, this, got_offset);
+ unsigned int g_offset = this->last_got_offset();
+ object->set_local_got_offset(symndx, got_type, g_offset);
+ rel_dyn->add_local(object, symndx, r_type, this, g_offset);
}
template<int size, bool big_endian>
this->entries_.push_back(Got_entry());
this->set_got_size();
- unsigned int got_offset = this->last_got_offset();
- object->set_local_got_offset(symndx, got_type, got_offset);
- rela_dyn->add_local(object, symndx, r_type, this, got_offset, 0);
+ unsigned int g_offset = this->last_got_offset();
+ object->set_local_got_offset(symndx, got_type, g_offset);
+ rela_dyn->add_local(object, symndx, r_type, this, g_offset, 0);
}
// Add a pair of entries for a local symbol to the GOT, and add
return;
this->entries_.push_back(Got_entry());
- unsigned int got_offset = this->last_got_offset();
- object->set_local_got_offset(symndx, got_type, got_offset);
+ unsigned int g_offset = this->last_got_offset();
+ object->set_local_got_offset(symndx, got_type, g_offset);
Output_section* os = object->output_section(shndx);
- rel_dyn->add_output_section(os, r_type_1, this, got_offset);
+ rel_dyn->add_output_section(os, r_type_1, this, g_offset);
this->entries_.push_back(Got_entry(object, symndx));
if (r_type_2 != 0)
{
- got_offset = this->last_got_offset();
- rel_dyn->add_output_section(os, r_type_2, this, got_offset);
+ g_offset = this->last_got_offset();
+ rel_dyn->add_output_section(os, r_type_2, this, g_offset);
}
this->set_got_size();
return;
this->entries_.push_back(Got_entry());
- unsigned int got_offset = this->last_got_offset();
- object->set_local_got_offset(symndx, got_type, got_offset);
+ unsigned int g_offset = this->last_got_offset();
+ object->set_local_got_offset(symndx, got_type, g_offset);
Output_section* os = object->output_section(shndx);
- rela_dyn->add_output_section(os, r_type_1, this, got_offset, 0);
+ rela_dyn->add_output_section(os, r_type_1, this, g_offset, 0);
this->entries_.push_back(Got_entry(object, symndx));
if (r_type_2 != 0)
{
- got_offset = this->last_got_offset();
- rela_dyn->add_output_section(os, r_type_2, this, got_offset, 0);
+ g_offset = this->last_got_offset();
+ rela_dyn->add_output_section(os, r_type_2, this, g_offset, 0);
}
this->set_got_size();
{
const int dyn_size = elfcpp::Elf_sizes<size>::dyn_size;
- const off_t offset = this->offset();
+ const off_t off = this->offset();
const off_t oview_size = this->data_size();
- unsigned char* const oview = of->get_output_view(offset, oview_size);
+ unsigned char* const oview = of->get_output_view(off, oview_size);
unsigned char* pov = oview;
for (typename Dynamic_entries::const_iterator p = this->entries_.begin();
gold_assert(pov - oview == oview_size);
- of->write_output_view(offset, oview_size, oview);
+ of->write_output_view(off, oview_size, oview);
// We no longer need the dynamic entries.
this->entries_.clear();
void
Output_symtab_xindex::do_write(Output_file* of)
{
- const off_t offset = this->offset();
+ const off_t off = this->offset();
const off_t oview_size = this->data_size();
- unsigned char* const oview = of->get_output_view(offset, oview_size);
+ unsigned char* const oview = of->get_output_view(off, oview_size);
memset(oview, 0, oview_size);
else
this->endian_do_write<false>(oview);
- of->write_output_view(offset, oview_size, oview);
+ of->write_output_view(off, oview_size, oview);
// We no longer need the data.
this->entries_.clear();
inline bool
Output_section::Input_section::output_offset(
const Relobj* object,
- unsigned int shndx,
- section_offset_type offset,
+ unsigned int sec_shndx,
+ section_offset_type off,
section_offset_type *poutput) const
{
if (!this->is_input_section())
- return this->u2_.posd->output_offset(object, shndx, offset, poutput);
+ return this->u2_.posd->output_offset(object, sec_shndx, off, poutput);
else
{
- if (this->shndx_ != shndx || this->u2_.object != object)
+ if (this->shndx_ != sec_shndx || this->u2_.object != object)
return false;
- *poutput = offset;
+ *poutput = off;
return true;
}
}
inline bool
Output_section::Input_section::is_merge_section_for(const Relobj* object,
- unsigned int shndx) const
+ unsigned int sec_shndx) const
{
if (this->is_input_section())
return false;
- return this->u2_.posd->is_merge_section_for(object, shndx);
+ return this->u2_.posd->is_merge_section_for(object, sec_shndx);
}
// Write out the data. We don't have to do anything for an input
// Construct an Output_section. NAME will point into a Stringpool.
-Output_section::Output_section(const char* name, elfcpp::Elf_Word type,
- elfcpp::Elf_Xword flags)
- : name_(name),
+Output_section::Output_section(const char* aname, elfcpp::Elf_Word atype,
+ elfcpp::Elf_Xword aflags)
+ : name_(aname),
addralign_(0),
entsize_(0),
load_address_(0),
info_section_(NULL),
info_symndx_(NULL),
info_(0),
- type_(type),
- flags_(flags),
+ type_(atype),
+ flags_(aflags),
out_shndx_(-1U),
symtab_index_(0),
dynsym_index_(0),
// An unallocated section has no address. Forcing this means that
// we don't need special treatment for symbols defined in debug
// sections.
- if ((flags & elfcpp::SHF_ALLOC) == 0)
+ if ((aflags & elfcpp::SHF_ALLOC) == 0)
this->set_address(0);
}
template<int size, bool big_endian>
off_t
Output_section::add_input_section(Sized_relobj<size, big_endian>* object,
- unsigned int shndx,
+ unsigned int sec_shndx,
const char* secname,
const elfcpp::Shdr<size, big_endian>& shdr,
unsigned int reloc_shndx,
bool have_sections_script)
{
- elfcpp::Elf_Xword addralign = shdr.get_sh_addralign();
- if ((addralign & (addralign - 1)) != 0)
+ elfcpp::Elf_Xword addr_align = shdr.get_sh_addralign();
+ if ((addr_align & (addr_align - 1)) != 0)
{
object->error(_("invalid alignment %lu for section \"%s\""),
- static_cast<unsigned long>(addralign), secname);
- addralign = 1;
+ static_cast<unsigned long>(addr_align), secname);
+ addr_align = 1;
}
- if (addralign > this->addralign_)
- this->addralign_ = addralign;
+ if (addr_align > this->addralign_)
+ this->addralign_ = addr_align;
typename elfcpp::Elf_types<size>::Elf_WXword sh_flags = shdr.get_sh_flags();
this->update_flags_for_input_section(sh_flags);
- uint64_t entsize = shdr.get_sh_entsize();
+ uint64_t ent_size = shdr.get_sh_entsize();
// .debug_str is a mergeable string section, but is not always so
// marked by compilers. Mark manually here so we can optimize.
if (strcmp(secname, ".debug_str") == 0)
{
sh_flags |= (elfcpp::SHF_MERGE | elfcpp::SHF_STRINGS);
- entsize = 1;
+ ent_size = 1;
}
// If this is a SHF_MERGE section, we pass all the input sections to
&& reloc_shndx == 0
&& shdr.get_sh_size() > 0)
{
- if (this->add_merge_input_section(object, shndx, sh_flags,
- entsize, addralign))
+ if (this->add_merge_input_section(object, sec_shndx, sh_flags,
+ ent_size, addr_align))
{
// Tell the relocation routines that they need to call the
// output_offset method to determine the final address.
off_t offset_in_section = this->current_data_size_for_child();
off_t aligned_offset_in_section = align_address(offset_in_section,
- addralign);
+ addr_align);
// Determine if we want to delay code-fill generation until the output
// section is written. When the target is relaxing, we want to delay fill
|| this->must_sort_attached_input_sections()
|| parameters->options().user_set_Map()
|| parameters->target().may_relax())
- this->input_sections_.push_back(Input_section(object, shndx,
+ this->input_sections_.push_back(Input_section(object, sec_shndx,
shdr.get_sh_size(),
- addralign));
+ addr_align));
return aligned_offset_in_section;
}
this->input_sections_.push_back(*inp);
- uint64_t addralign = inp->addralign();
- if (addralign > this->addralign_)
- this->addralign_ = addralign;
+ uint64_t addr_align = inp->addralign();
+ if (addr_align > this->addralign_)
+ this->addralign_ = addr_align;
inp->set_output_section(this);
}
void
Output_section::add_output_merge_section(Output_section_data* posd,
- bool is_string, uint64_t entsize)
+ bool is_string, uint64_t ent_size)
{
- Input_section inp(posd, is_string, entsize);
+ Input_section inp(posd, is_string, ent_size);
this->add_output_section_data(&inp);
}
// Add an input section to a SHF_MERGE section.
bool
-Output_section::add_merge_input_section(Relobj* object, unsigned int shndx,
- uint64_t flags, uint64_t entsize,
- uint64_t addralign)
+Output_section::add_merge_input_section(Relobj* object, unsigned int sec_shndx,
+ uint64_t aflags, uint64_t ent_size,
+ uint64_t addr_align)
{
- bool is_string = (flags & elfcpp::SHF_STRINGS) != 0;
+ bool is_string = (aflags & elfcpp::SHF_STRINGS) != 0;
// We only merge strings if the alignment is not more than the
// character size. This could be handled, but it's unusual.
- if (is_string && addralign > entsize)
+ if (is_string && addr_align > ent_size)
return false;
// We cannot restore merged input section states.
gold_assert(this->checkpoint_ == NULL);
// Look up merge sections by required properties.
- Merge_section_properties msp(is_string, entsize, addralign);
+ Merge_section_properties msp(is_string, ent_size, addr_align);
Merge_section_by_properties_map::const_iterator p =
this->merge_section_by_properties_map_.find(msp);
if (p != this->merge_section_by_properties_map_.end())
{
Output_merge_base* merge_section = p->second;
- merge_section->add_input_section(object, shndx);
+ merge_section->add_input_section(object, sec_shndx);
gold_assert(merge_section->is_string() == is_string
- && merge_section->entsize() == entsize
- && merge_section->addralign() == addralign);
+ && merge_section->entsize() == ent_size
+ && merge_section->addralign() == addr_align);
// Link input section to found merge section.
- Input_section_specifier iss(object, shndx);
+ Input_section_specifier iss(object, sec_shndx);
this->merge_section_map_[iss] = merge_section;
return true;
}
// Output_merge_string_data.
Output_merge_base* pomb;
if (!is_string)
- pomb = new Output_merge_data(entsize, addralign);
+ pomb = new Output_merge_data(ent_size, addr_align);
else
{
- switch (entsize)
+ switch (ent_size)
{
case 1:
- pomb = new Output_merge_string<char>(addralign);
+ pomb = new Output_merge_string<char>(addr_align);
break;
case 2:
- pomb = new Output_merge_string<uint16_t>(addralign);
+ pomb = new Output_merge_string<uint16_t>(addr_align);
break;
case 4:
- pomb = new Output_merge_string<uint32_t>(addralign);
+ pomb = new Output_merge_string<uint32_t>(addr_align);
break;
default:
return false;
// Add new merge section to this output section and link merge section
// properties to new merge section in map.
- this->add_output_merge_section(pomb, is_string, entsize);
+ this->add_output_merge_section(pomb, is_string, ent_size);
this->merge_section_by_properties_map_[msp] = pomb;
// Add input section to new merge section and link input section to new
// merge section in map.
- pomb->add_input_section(object, shndx);
- Input_section_specifier iss(object, shndx);
+ pomb->add_input_section(object, sec_shndx);
+ Input_section_specifier iss(object, sec_shndx);
this->merge_section_map_[iss] = pomb;
return true;
}
// Build a relaxation map to speed up relaxation of existing input sections.
-// Look up to the first LIMIT elements in INPUT_SECTIONS.
+// Look up to the first LIMIT elements in INPUTSECTIONS.
void
Output_section::build_relaxation_map(
- const Input_section_list& input_sections,
+ const Input_section_list& inputsections,
size_t limit,
Relaxation_map* relaxation_map) const
{
for (size_t i = 0; i < limit; ++i)
{
- const Input_section& is(input_sections[i]);
+ const Input_section& is(inputsections[i]);
if (is.is_input_section() || is.is_relaxed_input_section())
{
Input_section_specifier iss(is.relobj(), is.shndx());
// Convert regular input sections in INPUT_SECTIONS into relaxed input
// sections in RELAXED_SECTIONS. MAP is a prebuilt map from input section
-// specifier to indices of INPUT_SECTIONS.
+// specifier to indices of INPUTSECTIONS.
void
Output_section::convert_input_sections_in_list_to_relaxed_sections(
const std::vector<Output_relaxed_input_section*>& relaxed_sections,
const Relaxation_map& map,
- Input_section_list* input_sections)
+ Input_section_list* inputsections)
{
for (size_t i = 0; i < relaxed_sections.size(); ++i)
{
Input_section_specifier iss(poris->relobj(), poris->shndx());
Relaxation_map::const_iterator p = map.find(iss);
gold_assert(p != map.end());
- gold_assert((*input_sections)[p->second].is_input_section());
- (*input_sections)[p->second] = Input_section(poris);
+ gold_assert((*inputsections)[p->second].is_input_section());
+ (*inputsections)[p->second] = Input_section(poris);
}
}
// Update the output section flags based on input section flags.
void
-Output_section::update_flags_for_input_section(elfcpp::Elf_Xword flags)
+Output_section::update_flags_for_input_section(elfcpp::Elf_Xword aflags)
{
// If we created the section with SHF_ALLOC clear, we set the
// address. If we are now setting the SHF_ALLOC flag, we need to
// undo that.
if ((this->flags_ & elfcpp::SHF_ALLOC) == 0
- && (flags & elfcpp::SHF_ALLOC) != 0)
+ && (aflags & elfcpp::SHF_ALLOC) != 0)
this->mark_address_invalid();
- this->flags_ |= (flags
+ this->flags_ |= (aflags
& (elfcpp::SHF_WRITE
| elfcpp::SHF_ALLOC
| elfcpp::SHF_EXECINSTR));
}
-// Find the merge section into which an input section with index SHNDX in
+// Find the merge section into which an input section with index SEC_SHNDX in
// OBJECT has been added. Return NULL if none found.
Output_section_data*
Output_section::find_merge_section(const Relobj* object,
- unsigned int shndx) const
+ unsigned int sec_shndx) const
{
- Input_section_specifier iss(object, shndx);
+ Input_section_specifier iss(object, sec_shndx);
Output_section_data_by_input_section_map::const_iterator p =
this->merge_section_map_.find(iss);
if (p != this->merge_section_map_.end())
{
Output_section_data* posd = p->second;
- gold_assert(posd->is_merge_section_for(object, shndx));
+ gold_assert(posd->is_merge_section_for(object, sec_shndx));
return posd;
}
else
}
// Find an relaxed input section corresponding to an input section
-// in OBJECT with index SHNDX.
+// in OBJECT with index SEC_SHNDX.
const Output_section_data*
Output_section::find_relaxed_input_section(const Relobj* object,
- unsigned int shndx) const
+ unsigned int sec_shndx) const
{
// Be careful that the map may not be valid due to input section export
// to scripts or a check-point restore.
this->is_relaxed_input_section_map_valid_ = true;
}
- Input_section_specifier iss(object, shndx);
+ Input_section_specifier iss(object, sec_shndx);
Output_section_data_by_input_section_map::const_iterator p =
this->relaxed_input_section_map_.find(iss);
if (p != this->relaxed_input_section_map_.end())
return NULL;
}
-// Given an address OFFSET relative to the start of input section
-// SHNDX in OBJECT, return whether this address is being included in
-// the final link. This should only be called if SHNDX in OBJECT has
+// Given an address OFF relative to the start of input section
+// SEC_SHNDX in OBJECT, return whether this address is being included in
+// the final link. This should only be called if SEC_SHNDX in OBJECT has
// a special mapping.
bool
Output_section::is_input_address_mapped(const Relobj* object,
- unsigned int shndx,
- off_t offset) const
+ unsigned int sec_shndx,
+ off_t off) const
{
// Look at the Output_section_data_maps first.
- const Output_section_data* posd = this->find_merge_section(object, shndx);
+ const Output_section_data* posd = this->find_merge_section(object, sec_shndx);
if (posd == NULL)
- posd = this->find_relaxed_input_section(object, shndx);
+ posd = this->find_relaxed_input_section(object, sec_shndx);
if (posd != NULL)
{
- section_offset_type output_offset;
- bool found = posd->output_offset(object, shndx, offset, &output_offset);
+ section_offset_type outputoffset;
+ bool found = posd->output_offset(object, sec_shndx, off, &outputoffset);
gold_assert(found);
- return output_offset != -1;
+ return outputoffset != -1;
}
// Fall back to the slow look-up.
p != this->input_sections_.end();
++p)
{
- section_offset_type output_offset;
- if (p->output_offset(object, shndx, offset, &output_offset))
- return output_offset != -1;
+ section_offset_type outputoffset;
+ if (p->output_offset(object, sec_shndx, off, &outputoffset))
+ return outputoffset != -1;
}
// By default we assume that the address is mapped. This should
return true;
}
-// Given an address OFFSET relative to the start of input section
-// SHNDX in object OBJECT, return the output offset relative to the
+// Given an address OFF relative to the start of input section
+// SEC_SHNDX in object OBJECT, return the output offset relative to the
// start of the input section in the output section. This should only
-// be called if SHNDX in OBJECT has a special mapping.
+// be called if SEC_SHNDX in OBJECT has a special mapping.
section_offset_type
-Output_section::output_offset(const Relobj* object, unsigned int shndx,
- section_offset_type offset) const
+Output_section::output_offset(const Relobj* object, unsigned int sec_shndx,
+ section_offset_type off) const
{
// This can only be called meaningfully when we know the data size
// of this.
gold_assert(this->is_data_size_valid());
// Look at the Output_section_data_maps first.
- const Output_section_data* posd = this->find_merge_section(object, shndx);
+ const Output_section_data* posd = this->find_merge_section(object, sec_shndx);
if (posd == NULL)
- posd = this->find_relaxed_input_section(object, shndx);
+ posd = this->find_relaxed_input_section(object, sec_shndx);
if (posd != NULL)
{
- section_offset_type output_offset;
- bool found = posd->output_offset(object, shndx, offset, &output_offset);
+ section_offset_type outputoffset;
+ bool found = posd->output_offset(object, sec_shndx, off, &outputoffset);
gold_assert(found);
- return output_offset;
+ return outputoffset;
}
// Fall back to the slow look-up.
p != this->input_sections_.end();
++p)
{
- section_offset_type output_offset;
- if (p->output_offset(object, shndx, offset, &output_offset))
- return output_offset;
+ section_offset_type outputoffset;
+ if (p->output_offset(object, sec_shndx, off, &outputoffset))
+ return outputoffset;
}
gold_unreachable();
}
-// Return the output virtual address of OFFSET relative to the start
-// of input section SHNDX in object OBJECT.
+// Return the output virtual address of OFF relative to the start
+// of input section SEC_SHNDX in object OBJECT.
uint64_t
-Output_section::output_address(const Relobj* object, unsigned int shndx,
- off_t offset) const
+Output_section::output_address(const Relobj* object, unsigned int sec_shndx,
+ off_t off) const
{
uint64_t addr = this->address() + this->first_input_offset_;
// Look at the Output_section_data_maps first.
- const Output_section_data* posd = this->find_merge_section(object, shndx);
+ const Output_section_data* posd = this->find_merge_section(object, sec_shndx);
if (posd == NULL)
- posd = this->find_relaxed_input_section(object, shndx);
+ posd = this->find_relaxed_input_section(object, sec_shndx);
if (posd != NULL && posd->is_address_valid())
{
- section_offset_type output_offset;
- bool found = posd->output_offset(object, shndx, offset, &output_offset);
+ section_offset_type outputoffset;
+ bool found = posd->output_offset(object, sec_shndx, off, &outputoffset);
gold_assert(found);
- return posd->address() + output_offset;
+ return posd->address() + outputoffset;
}
// Fall back to the slow look-up.
++p)
{
addr = align_address(addr, p->addralign());
- section_offset_type output_offset;
- if (p->output_offset(object, shndx, offset, &output_offset))
+ section_offset_type outputoffset;
+ if (p->output_offset(object, sec_shndx, off, &outputoffset))
{
- if (output_offset == -1)
+ if (outputoffset == -1)
return -1ULL;
- return addr + output_offset;
+ return addr + outputoffset;
}
addr += p->data_size();
}
}
// Find the output address of the start of the merged section for
-// input section SHNDX in object OBJECT.
+// input section SEC_SHNDX in object OBJECT.
bool
Output_section::find_starting_output_address(const Relobj* object,
- unsigned int shndx,
+ unsigned int sec_shndx,
uint64_t* paddr) const
{
// FIXME: This becomes a bottle-neck if we have many relaxed sections.
// method to get the output offset of input offset 0.
// Unfortunately we don't know for sure that input offset 0 is
// mapped at all.
- if (p->is_merge_section_for(object, shndx))
+ if (p->is_merge_section_for(object, sec_shndx))
{
*paddr = addr;
return true;
if (this->must_sort_attached_input_sections())
this->sort_attached_input_sections();
- uint64_t address = this->address();
+ uint64_t addr = this->address();
off_t startoff = this->offset();
off_t off = startoff + this->first_input_offset_;
for (Input_section_list::iterator p = this->input_sections_.begin();
++p)
{
off = align_address(off, p->addralign());
- p->set_address_and_file_offset(address + (off - startoff), off,
+ p->set_address_and_file_offset(addr + (off - startoff), off,
startoff);
off += p->data_size();
}
section_name_()
{ }
- Input_section_sort_entry(const Input_section& input_section,
- unsigned int index)
- : input_section_(input_section), index_(index),
- section_has_name_(input_section.is_input_section()
- || input_section.is_relaxed_input_section())
+ Input_section_sort_entry(const Input_section& inputsection,
+ unsigned int indx)
+ : input_section_(inputsection), index_(indx),
+ section_has_name_(inputsection.is_input_section()
+ || inputsection.is_relaxed_input_section())
{
if (this->section_has_name_)
{
// so it is OK to lock. Unfortunately we have no way to pass
// in a Task token.
const Task* dummy_task = reinterpret_cast<const Task*>(-1);
- Object* obj = (input_section.is_input_section()
- ? input_section.relobj()
- : input_section.relaxed_input_section()->relobj());
+ Object* obj = (inputsection.is_input_section()
+ ? inputsection.relobj()
+ : inputsection.relaxed_input_section()->relobj());
Task_lock_obj<Object> tl(dummy_task, obj);
// This is a slow operation, which should be cached in
// Layout::layout if this becomes a speed problem.
- this->section_name_ = obj->section_name(input_section.shndx());
+ this->section_name_ = obj->section_name(inputsection.shndx());
}
}
// file name this way is a dreadful hack, but the GNU linker does it
// in order to better support gcc, and we need to be compatible.
bool
- match_file_name(const char* match_file_name) const
+ match_file_name(const char* match_filename) const
{
const std::string& file_name(this->input_section_.relobj()->name());
const char* base_name = lbasename(file_name.c_str());
- size_t match_len = strlen(match_file_name);
- if (strncmp(base_name, match_file_name, match_len) != 0)
+ size_t match_len = strlen(match_filename);
+ if (strncmp(base_name, match_filename, match_len) != 0)
return false;
size_t base_len = strlen(base_name);
if (base_len != match_len + 2 && base_len != match_len + 3)
oshdr->put_sh_name(secnamepool->get_offset(this->name_));
oshdr->put_sh_type(this->type_);
- elfcpp::Elf_Xword flags = this->flags_;
+ elfcpp::Elf_Xword xflags = this->flags_;
if (this->info_section_ != NULL && this->info_uses_section_index_)
- flags |= elfcpp::SHF_INFO_LINK;
- oshdr->put_sh_flags(flags);
+ xflags |= elfcpp::SHF_INFO_LINK;
+ oshdr->put_sh_flags(xflags);
oshdr->put_sh_addr(this->address());
oshdr->put_sh_offset(this->offset());
else
oshdr->put_sh_link(this->link_);
- elfcpp::Elf_Word info;
+ elfcpp::Elf_Word inf;
if (this->info_section_ != NULL)
{
if (this->info_uses_section_index_)
- info = this->info_section_->out_shndx();
+ inf = this->info_section_->out_shndx();
else
- info = this->info_section_->symtab_index();
+ inf = this->info_section_->symtab_index();
}
else if (this->info_symndx_ != NULL)
- info = this->info_symndx_->symtab_index();
+ inf = this->info_symndx_->symtab_index();
else
- info = this->info_;
- oshdr->put_sh_info(info);
+ inf = this->info_;
+ oshdr->put_sh_info(inf);
oshdr->put_sh_addralign(this->addralign_);
oshdr->put_sh_entsize(this->entsize_);
uint64_t
Output_section::get_input_sections(
- uint64_t address,
+ uint64_t addr,
const std::string& fill,
- std::list<Simple_input_section>* input_sections)
+ std::list<Simple_input_section>* inputsections)
{
if (this->checkpoint_ != NULL
&& !this->checkpoint_->input_sections_saved())
// Invalidate the relaxed input section map.
this->is_relaxed_input_section_map_valid_ = false;
- uint64_t orig_address = address;
+ uint64_t orig_address = addr;
- address = align_address(address, this->addralign());
+ addr = align_address(addr, this->addralign());
Input_section_list remaining;
for (Input_section_list::iterator p = this->input_sections_.begin();
++p)
{
if (p->is_input_section())
- input_sections->push_back(Simple_input_section(p->relobj(),
+ inputsections->push_back(Simple_input_section(p->relobj(),
p->shndx()));
else if (p->is_relaxed_input_section())
- input_sections->push_back(
+ inputsections->push_back(
Simple_input_section(p->relaxed_input_section()));
else
{
- uint64_t aligned_address = align_address(address, p->addralign());
- if (aligned_address != address && !fill.empty())
+ uint64_t aligned_address = align_address(addr, p->addralign());
+ if (aligned_address != addr && !fill.empty())
{
section_size_type length =
- convert_to_section_size_type(aligned_address - address);
+ convert_to_section_size_type(aligned_address - addr);
std::string this_fill;
this_fill.reserve(length);
while (this_fill.length() + fill.length() <= length)
Output_section_data* posd = new Output_data_const(this_fill, 0);
remaining.push_back(Input_section(posd));
}
- address = aligned_address;
+ addr = aligned_address;
remaining.push_back(*p);
p->finalize_data_size();
- address += p->data_size();
+ addr += p->data_size();
}
}
this->input_sections_.swap(remaining);
this->first_input_offset_ = 0;
- uint64_t data_size = address - orig_address;
- this->set_current_data_size_for_child(data_size);
- return data_size;
+ uint64_t datasize = addr - orig_address;
+ this->set_current_data_size_for_child(datasize);
+ return datasize;
}
// Add an input section from a script.
void
Output_section::add_input_section_for_script(const Simple_input_section& sis,
- off_t data_size,
- uint64_t addralign)
+ off_t datasize,
+ uint64_t addr_align)
{
- if (addralign > this->addralign_)
- this->addralign_ = addralign;
+ if (addr_align > this->addralign_)
+ this->addralign_ = addr_align;
off_t offset_in_section = this->current_data_size_for_child();
off_t aligned_offset_in_section = align_address(offset_in_section,
- addralign);
+ addr_align);
this->set_current_data_size_for_child(aligned_offset_in_section
- + data_size);
+ + datasize);
Input_section is =
(sis.is_relaxed_input_section()
? Input_section(sis.relaxed_input_section())
- : Input_section(sis.relobj(), sis.shndx(), data_size, addralign));
+ : Input_section(sis.relobj(), sis.shndx(), datasize, addr_align));
this->input_sections_.push_back(is);
}
// Output segment methods.
-Output_segment::Output_segment(elfcpp::Elf_Word type, elfcpp::Elf_Word flags)
+Output_segment::Output_segment(elfcpp::Elf_Word atype, elfcpp::Elf_Word aflags)
: output_data_(),
output_bss_(),
vaddr_(0),
min_p_align_(0),
offset_(0),
filesz_(0),
- type_(type),
- flags_(flags),
+ type_(atype),
+ flags_(aflags),
is_max_align_known_(false),
are_addresses_set_(false),
is_large_data_segment_(false)
{
if (!this->is_max_align_known_)
{
- uint64_t addralign;
+ uint64_t addr_align;
- addralign = Output_segment::maximum_alignment_list(&this->output_data_);
- if (addralign > this->max_align_)
- this->max_align_ = addralign;
+ addr_align = Output_segment::maximum_alignment_list(&this->output_data_);
+ if (addr_align > this->max_align_)
+ this->max_align_ = addr_align;
- addralign = Output_segment::maximum_alignment_list(&this->output_bss_);
- if (addralign > this->max_align_)
- this->max_align_ = addralign;
+ addr_align = Output_segment::maximum_alignment_list(&this->output_bss_);
+ if (addr_align > this->max_align_)
+ this->max_align_ = addr_align;
// If -z relro is in effect, and the first section in this
// segment is a relro section, then the segment must be aligned
&& parameters->options().relro()
&& this->is_first_section_relro())
{
- addralign = parameters->target().common_pagesize();
- if (addralign > this->max_align_)
- this->max_align_ = addralign;
+ addr_align = parameters->target().common_pagesize();
+ if (addr_align > this->max_align_)
+ this->max_align_ = addr_align;
}
this->is_max_align_known_ = true;
p != pdl->end();
++p)
{
- uint64_t addralign = (*p)->addralign();
- if (addralign > ret)
- ret = addralign;
+ uint64_t addr_align = (*p)->addralign();
+ if (addr_align > ret)
+ ret = addr_align;
}
return ret;
}
off_t
Output_section::add_input_section<32, false>(
Sized_relobj<32, false>* object,
- unsigned int shndx,
+ unsigned int sec_shndx,
const char* secname,
const elfcpp::Shdr<32, false>& shdr,
unsigned int reloc_shndx,
off_t
Output_section::add_input_section<32, true>(
Sized_relobj<32, true>* object,
- unsigned int shndx,
+ unsigned int sec_shndx,
const char* secname,
const elfcpp::Shdr<32, true>& shdr,
unsigned int reloc_shndx,
off_t
Output_section::add_input_section<64, false>(
Sized_relobj<64, false>* object,
- unsigned int shndx,
+ unsigned int sec_shndx,
const char* secname,
const elfcpp::Shdr<64, false>& shdr,
unsigned int reloc_shndx,
off_t
Output_section::add_input_section<64, true>(
Sized_relobj<64, true>* object,
- unsigned int shndx,
+ unsigned int sec_shndx,
const char* secname,
const elfcpp::Shdr<64, true>& shdr,
unsigned int reloc_shndx,
class Input_section_specifier
{
public:
- Input_section_specifier(const Relobj* relobj, unsigned int shndx)
- : relobj_(relobj), shndx_(shndx)
+ Input_section_specifier(const Relobj* robj, unsigned int sec_shndx)
+ : relobj_(robj), shndx_(sec_shndx)
{ }
// Return Relobj of this.
// Set the size of the data.
void
- set_data_size(off_t data_size)
+ set_data_size(off_t datasize)
{
gold_assert(!this->is_data_size_valid_
&& !this->is_data_size_fixed_);
- this->data_size_ = data_size;
+ this->data_size_ = datasize;
this->is_data_size_valid_ = true;
}
// Set the current data size--this is for the convenience of
// sections which build up their size over time.
void
- set_current_data_size_for_child(off_t data_size)
+ set_current_data_size_for_child(off_t datasize)
{
gold_assert(!this->is_data_size_valid_);
- this->data_size_ = data_size;
+ this->data_size_ = datasize;
}
// Return default alignment for the target size.
class Output_section_data : public Output_data
{
public:
- Output_section_data(off_t data_size, uint64_t addralign,
- bool is_data_size_fixed)
- : Output_data(), output_section_(NULL), addralign_(addralign)
+ Output_section_data(off_t datasize, uint64_t addr_align,
+ bool is_datasize_fixed)
+ : Output_data(), output_section_(NULL), addralign_(addr_align)
{
- this->set_data_size(data_size);
- if (is_data_size_fixed)
+ this->set_data_size(datasize);
+ if (is_datasize_fixed)
this->fix_data_size();
}
- Output_section_data(uint64_t addralign)
- : Output_data(), output_section_(NULL), addralign_(addralign)
+ Output_section_data(uint64_t addr_align)
+ : Output_data(), output_section_(NULL), addralign_(addr_align)
{ }
// Return the output section.
// this input offset is being discarded.
bool
output_offset(const Relobj* object, unsigned int shndx,
- section_offset_type offset,
+ section_offset_type sec_offset,
section_offset_type *poutput) const
- { return this->do_output_offset(object, shndx, offset, poutput); }
+ { return this->do_output_offset(object, shndx, sec_offset, poutput); }
// Return whether this is the merge section for the input section
// SHNDX in OBJECT. This should return true when output_offset
class Output_section_data_build : public Output_section_data
{
public:
- Output_section_data_build(uint64_t addralign)
- : Output_section_data(addralign)
+ Output_section_data_build(uint64_t addr_align)
+ : Output_section_data(addr_align)
{ }
// Get the current data size.
// Set the current data size.
void
- set_current_data_size(off_t data_size)
- { this->set_current_data_size_for_child(data_size); }
+ set_current_data_size(off_t datasize)
+ { this->set_current_data_size_for_child(datasize); }
protected:
// Set the final data size.
class Output_data_const : public Output_section_data
{
public:
- Output_data_const(const std::string& data, uint64_t addralign)
- : Output_section_data(data.size(), addralign, true), data_(data)
+ Output_data_const(const std::string& data, uint64_t addr_align)
+ : Output_section_data(data.size(), addr_align, true), data_(data)
{ }
- Output_data_const(const char* p, off_t len, uint64_t addralign)
- : Output_section_data(len, addralign, true), data_(p, len)
+ Output_data_const(const char* p, off_t len, uint64_t addr_align)
+ : Output_section_data(len, addr_align, true), data_(p, len)
{ }
- Output_data_const(const unsigned char* p, off_t len, uint64_t addralign)
- : Output_section_data(len, addralign, true),
+ Output_data_const(const unsigned char* p, off_t len, uint64_t addr_align)
+ : Output_section_data(len, addr_align, true),
data_(reinterpret_cast<const char*>(p), len)
{ }
{
public:
Output_data_const_buffer(const unsigned char* p, off_t len,
- uint64_t addralign, const char* map_name)
- : Output_section_data(len, addralign, true),
+ uint64_t addr_align, const char* map_name)
+ : Output_section_data(len, addr_align, true),
p_(p), map_name_(map_name)
{ }
class Output_data_fixed_space : public Output_section_data
{
public:
- Output_data_fixed_space(off_t data_size, uint64_t addralign,
+ Output_data_fixed_space(off_t datasize, uint64_t addr_align,
const char* map_name)
- : Output_section_data(data_size, addralign, true),
+ : Output_section_data(datasize, addr_align, true),
map_name_(map_name)
{ }
class Output_data_space : public Output_section_data_build
{
public:
- explicit Output_data_space(uint64_t addralign, const char* map_name)
- : Output_section_data_build(addralign),
+ explicit Output_data_space(uint64_t addr_align, const char* map_name)
+ : Output_section_data_build(addr_align),
map_name_(map_name)
{ }
class Output_data_zero_fill : public Output_section_data
{
public:
- Output_data_zero_fill(off_t data_size, uint64_t addralign)
- : Output_section_data(data_size, addralign, true)
+ Output_data_zero_fill(off_t datasize, uint64_t addr_align)
+ : Output_section_data(datasize, addr_align, true)
{ }
protected:
// A reloc against a global symbol.
Output_reloc(Symbol* gsym, unsigned int type, Output_data* od,
- Address address, Addend addend, bool is_relative)
- : rel_(gsym, type, od, address, is_relative), addend_(addend)
+ Address addr, Addend addend, bool is_relative)
+ : rel_(gsym, type, od, addr, is_relative), addend_(addend)
{ }
Output_reloc(Symbol* gsym, unsigned int type,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address address, Addend addend,
+ unsigned int shndx, Address addr, Addend addend,
bool is_relative)
- : rel_(gsym, type, relobj, shndx, address, is_relative), addend_(addend)
+ : rel_(gsym, type, relobj, shndx, addr, is_relative), addend_(addend)
{ }
// A reloc against a local symbol.
Output_reloc(Sized_relobj<size, big_endian>* relobj,
unsigned int local_sym_index, unsigned int type,
- Output_data* od, Address address,
+ Output_data* od, Address addr,
Addend addend, bool is_relative, bool is_section_symbol)
- : rel_(relobj, local_sym_index, type, od, address, is_relative,
+ : rel_(relobj, local_sym_index, type, od, addr, is_relative,
is_section_symbol),
addend_(addend)
{ }
Output_reloc(Sized_relobj<size, big_endian>* relobj,
unsigned int local_sym_index, unsigned int type,
- unsigned int shndx, Address address,
+ unsigned int shndx, Address addr,
Addend addend, bool is_relative, bool is_section_symbol)
- : rel_(relobj, local_sym_index, type, shndx, address, is_relative,
+ : rel_(relobj, local_sym_index, type, shndx, addr, is_relative,
is_section_symbol),
addend_(addend)
{ }
// A reloc against the STT_SECTION symbol of an output section.
Output_reloc(Output_section* os, unsigned int type, Output_data* od,
- Address address, Addend addend)
- : rel_(os, type, od, address), addend_(addend)
+ Address addr, Addend addend)
+ : rel_(os, type, od, addr), addend_(addend)
{ }
Output_reloc(Output_section* os, unsigned int type,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address address, Addend addend)
- : rel_(os, type, relobj, shndx, address), addend_(addend)
+ unsigned int shndx, Address addr, Addend addend)
+ : rel_(os, type, relobj, shndx, addr), addend_(addend)
{ }
// Write the reloc entry to an output view.
// Add a reloc against a global symbol.
void
- add_global(Symbol* gsym, unsigned int type, Output_data* od, Address address)
- { this->add(od, Output_reloc_type(gsym, type, od, address, false)); }
+ add_global(Symbol* gsym, unsigned int type, Output_data* od, Address addr)
+ { this->add(od, Output_reloc_type(gsym, type, od, addr, false)); }
void
add_global(Symbol* gsym, unsigned int type, Output_data* od,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address address)
- { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, address,
+ unsigned int shndx, Address addr)
+ { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, addr,
false)); }
// These are to simplify the Copy_relocs class.
void
- add_global(Symbol* gsym, unsigned int type, Output_data* od, Address address,
+ add_global(Symbol* gsym, unsigned int type, Output_data* od, Address addr,
Address addend)
{
gold_assert(addend == 0);
- this->add_global(gsym, type, od, address);
+ this->add_global(gsym, type, od, addr);
}
void
add_global(Symbol* gsym, unsigned int type, Output_data* od,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address address, Address addend)
+ unsigned int shndx, Address addr, Address addend)
{
gold_assert(addend == 0);
- this->add_global(gsym, type, od, relobj, shndx, address);
+ this->add_global(gsym, type, od, relobj, shndx, addr);
}
// Add a RELATIVE reloc against a global symbol. The final relocation
void
add_global_relative(Symbol* gsym, unsigned int type, Output_data* od,
- Address address)
- { this->add(od, Output_reloc_type(gsym, type, od, address, true)); }
+ Address addr)
+ { this->add(od, Output_reloc_type(gsym, type, od, addr, true)); }
void
add_global_relative(Symbol* gsym, unsigned int type, Output_data* od,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address address)
+ unsigned int shndx, Address addr)
{
- this->add(od, Output_reloc_type(gsym, type, relobj, shndx, address,
+ this->add(od, Output_reloc_type(gsym, type, relobj, shndx, addr,
true));
}
void
add_local(Sized_relobj<size, big_endian>* relobj,
unsigned int local_sym_index, unsigned int type,
- Output_data* od, Address address)
+ Output_data* od, Address addr)
{
this->add(od, Output_reloc_type(relobj, local_sym_index, type, od,
- address, false, false));
+ addr, false, false));
}
void
add_local(Sized_relobj<size, big_endian>* relobj,
unsigned int local_sym_index, unsigned int type,
- Output_data* od, unsigned int shndx, Address address)
+ Output_data* od, unsigned int shndx, Address addr)
{
this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx,
- address, false, false));
+ addr, false, false));
}
// Add a RELATIVE reloc against a local symbol.
void
add_local_relative(Sized_relobj<size, big_endian>* relobj,
unsigned int local_sym_index, unsigned int type,
- Output_data* od, Address address)
+ Output_data* od, Address addr)
{
this->add(od, Output_reloc_type(relobj, local_sym_index, type, od,
- address, true, false));
+ addr, true, false));
}
void
add_local_relative(Sized_relobj<size, big_endian>* relobj,
unsigned int local_sym_index, unsigned int type,
- Output_data* od, unsigned int shndx, Address address)
+ Output_data* od, unsigned int shndx, Address addr)
{
this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx,
- address, true, false));
+ addr, true, false));
}
// Add a reloc against a local section symbol. This will be
void
add_local_section(Sized_relobj<size, big_endian>* relobj,
unsigned int input_shndx, unsigned int type,
- Output_data* od, Address address)
+ Output_data* od, Address addr)
{
this->add(od, Output_reloc_type(relobj, input_shndx, type, od,
- address, false, true));
+ addr, false, true));
}
void
add_local_section(Sized_relobj<size, big_endian>* relobj,
unsigned int input_shndx, unsigned int type,
- Output_data* od, unsigned int shndx, Address address)
+ Output_data* od, unsigned int shndx, Address addr)
{
this->add(od, Output_reloc_type(relobj, input_shndx, type, shndx,
- address, false, true));
+ addr, false, true));
}
// A reloc against the STT_SECTION symbol of an output section.
void
add_output_section(Output_section* os, unsigned int type,
- Output_data* od, Address address)
- { this->add(od, Output_reloc_type(os, type, od, address)); }
+ Output_data* od, Address addr)
+ { this->add(od, Output_reloc_type(os, type, od, addr)); }
void
add_output_section(Output_section* os, unsigned int type, Output_data* od,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address address)
- { this->add(od, Output_reloc_type(os, type, relobj, shndx, address)); }
+ unsigned int shndx, Address addr)
+ { this->add(od, Output_reloc_type(os, type, relobj, shndx, addr)); }
};
// The SHT_RELA version of Output_data_reloc.
void
add_global(Symbol* gsym, unsigned int type, Output_data* od,
- Address address, Addend addend)
- { this->add(od, Output_reloc_type(gsym, type, od, address, addend,
+ Address addr, Addend addend)
+ { this->add(od, Output_reloc_type(gsym, type, od, addr, addend,
false)); }
void
add_global(Symbol* gsym, unsigned int type, Output_data* od,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address address,
+ unsigned int shndx, Address addr,
Addend addend)
- { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, address,
+ { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, addr,
addend, false)); }
// Add a RELATIVE reloc against a global symbol. The final output
void
add_global_relative(Symbol* gsym, unsigned int type, Output_data* od,
- Address address, Addend addend)
- { this->add(od, Output_reloc_type(gsym, type, od, address, addend, true)); }
+ Address addr, Addend addend)
+ { this->add(od, Output_reloc_type(gsym, type, od, addr, addend, true)); }
void
add_global_relative(Symbol* gsym, unsigned int type, Output_data* od,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address address, Addend addend)
- { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, address,
+ unsigned int shndx, Address addr, Addend addend)
+ { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, addr,
addend, true)); }
// Add a reloc against a local symbol.
void
add_local(Sized_relobj<size, big_endian>* relobj,
unsigned int local_sym_index, unsigned int type,
- Output_data* od, Address address, Addend addend)
+ Output_data* od, Address addr, Addend addend)
{
- this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, address,
+ this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, addr,
addend, false, false));
}
void
add_local(Sized_relobj<size, big_endian>* relobj,
unsigned int local_sym_index, unsigned int type,
- Output_data* od, unsigned int shndx, Address address,
+ Output_data* od, unsigned int shndx, Address addr,
Addend addend)
{
this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx,
- address, addend, false, false));
+ addr, addend, false, false));
}
// Add a RELATIVE reloc against a local symbol.
void
add_local_relative(Sized_relobj<size, big_endian>* relobj,
unsigned int local_sym_index, unsigned int type,
- Output_data* od, Address address, Addend addend)
+ Output_data* od, Address addr, Addend addend)
{
- this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, address,
+ this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, addr,
addend, true, false));
}
void
add_local_relative(Sized_relobj<size, big_endian>* relobj,
unsigned int local_sym_index, unsigned int type,
- Output_data* od, unsigned int shndx, Address address,
+ Output_data* od, unsigned int shndx, Address addr,
Addend addend)
{
this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx,
- address, addend, true, false));
+ addr, addend, true, false));
}
// Add a reloc against a local section symbol. This will be
void
add_local_section(Sized_relobj<size, big_endian>* relobj,
unsigned int input_shndx, unsigned int type,
- Output_data* od, Address address, Addend addend)
+ Output_data* od, Address addr, Addend addend)
{
- this->add(od, Output_reloc_type(relobj, input_shndx, type, od, address,
+ this->add(od, Output_reloc_type(relobj, input_shndx, type, od, addr,
addend, false, true));
}
void
add_local_section(Sized_relobj<size, big_endian>* relobj,
unsigned int input_shndx, unsigned int type,
- Output_data* od, unsigned int shndx, Address address,
+ Output_data* od, unsigned int shndx, Address addr,
Addend addend)
{
this->add(od, Output_reloc_type(relobj, input_shndx, type, shndx,
- address, addend, false, true));
+ addr, addend, false, true));
}
// A reloc against the STT_SECTION symbol of an output section.
void
add_output_section(Output_section* os, unsigned int type, Output_data* od,
- Address address, Addend addend)
- { this->add(os, Output_reloc_type(os, type, od, address, addend)); }
+ Address addr, Addend addend)
+ { this->add(os, Output_reloc_type(os, type, od, addr, addend)); }
void
add_output_section(Output_section* os, unsigned int type,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address address, Addend addend)
- { this->add(os, Output_reloc_type(os, type, relobj, shndx, address,
+ unsigned int shndx, Address addr, Addend addend)
+ { this->add(os, Output_reloc_type(os, type, relobj, shndx, addr,
addend)); }
};
// plus a constant offset.
void
add_section_plus_offset(elfcpp::DT tag, const Output_data* od,
- unsigned int offset)
- { this->add_entry(Dynamic_entry(tag, od, offset)); }
+ unsigned int sec_offset)
+ { this->add_entry(Dynamic_entry(tag, od, sec_offset)); }
// Add a new dynamic entry with the size of output data.
void
{
public:
// Create an entry with a fixed numeric value.
- Dynamic_entry(elfcpp::DT tag, unsigned int val)
- : tag_(tag), offset_(DYNAMIC_NUMBER)
+ Dynamic_entry(elfcpp::DT etag, unsigned int val)
+ : tag_(etag), offset_(DYNAMIC_NUMBER)
{ this->u_.val = val; }
// Create an entry with the size or address of a section.
- Dynamic_entry(elfcpp::DT tag, const Output_data* od, bool section_size)
- : tag_(tag),
+ Dynamic_entry(elfcpp::DT etag, const Output_data* od, bool section_size)
+ : tag_(etag),
offset_(section_size
? DYNAMIC_SECTION_SIZE
: DYNAMIC_SECTION_ADDRESS)
{ this->u_.od = od; }
// Create an entry with the address of a section plus a constant offset.
- Dynamic_entry(elfcpp::DT tag, const Output_data* od, unsigned int offset)
- : tag_(tag),
+ Dynamic_entry(elfcpp::DT etag, const Output_data* od, unsigned int offset)
+ : tag_(etag),
offset_(offset)
{ this->u_.od = od; }
// Create an entry with the address of a symbol.
- Dynamic_entry(elfcpp::DT tag, const Symbol* sym)
- : tag_(tag), offset_(DYNAMIC_SYMBOL)
+ Dynamic_entry(elfcpp::DT etag, const Symbol* sym)
+ : tag_(etag), offset_(DYNAMIC_SYMBOL)
{ this->u_.sym = sym; }
// Create an entry with a string.
- Dynamic_entry(elfcpp::DT tag, const char* str)
- : tag_(tag), offset_(DYNAMIC_STRING)
+ Dynamic_entry(elfcpp::DT etag, const char* str)
+ : tag_(etag), offset_(DYNAMIC_STRING)
{ this->u_.str = str; }
// Return the tag of this entry.
// We would like to call relobj->section_addralign(shndx) to get the
// alignment but we do not want the constructor to fail. So callers
// are repsonsible for ensuring that.
- Output_relaxed_input_section(Relobj* relobj, unsigned int shndx,
- uint64_t addralign)
- : Output_section_data_build(addralign), relobj_(relobj), shndx_(shndx)
+ Output_relaxed_input_section(Relobj* rel_obj, unsigned int sec_shndx,
+ uint64_t addr_align)
+ : Output_section_data_build(addr_align), relobj_(rel_obj), shndx_(sec_shndx)
{ }
// Return the Relobj of this relaxed input section.
// Set the load address.
void
- set_load_address(uint64_t load_address)
+ set_load_address(uint64_t load_addr)
{
- this->load_address_ = load_address;
+ this->load_address_ = load_addr;
this->has_load_address_ = true;
}
static const unsigned int invalid_shndx = static_cast<unsigned int>(-1);
public:
- Simple_input_section(Relobj *relobj, unsigned int shndx)
- : shndx_(shndx)
+ Simple_input_section(Relobj *rel_obj, unsigned int sec_shndx)
+ : shndx_(sec_shndx)
{
- gold_assert(shndx != invalid_shndx);
- this->u_.relobj = relobj;
+ gold_assert(sec_shndx != invalid_shndx);
+ this->u_.relobj = rel_obj;
}
Simple_input_section(Output_relaxed_input_section* section)
// Return whether this is a section of the specified type.
bool
- do_is_section_type(elfcpp::Elf_Word type) const
- { return this->type_ == type; }
+ do_is_section_type(elfcpp::Elf_Word sec_type) const
+ { return this->type_ == sec_type; }
// Return whether the specified section flag is set.
bool
}
// For an ordinary input section.
- Input_section(Relobj* object, unsigned int shndx, off_t data_size,
- uint64_t addralign)
- : shndx_(shndx),
- p2align_(ffsll(static_cast<long long>(addralign)))
+ Input_section(Relobj* object, unsigned int sec_shndx, off_t datasize,
+ uint64_t addr_align)
+ : shndx_(sec_shndx),
+ p2align_(ffsll(static_cast<long long>(addr_align)))
{
- gold_assert(shndx != OUTPUT_SECTION_CODE
- && shndx != MERGE_DATA_SECTION_CODE
- && shndx != MERGE_STRING_SECTION_CODE
- && shndx != RELAXED_INPUT_SECTION_CODE);
- this->u1_.data_size = data_size;
+ gold_assert(sec_shndx != OUTPUT_SECTION_CODE
+ && sec_shndx != MERGE_DATA_SECTION_CODE
+ && sec_shndx != MERGE_STRING_SECTION_CODE
+ && sec_shndx != RELAXED_INPUT_SECTION_CODE);
+ this->u1_.data_size = datasize;
this->u2_.object = object;
}
// parameters.
bool
is_merge_section(bool is_string, uint64_t entsize,
- uint64_t addralign) const
+ uint64_t addr_align) const
{
return (this->shndx_ == (is_string
? MERGE_STRING_SECTION_CODE
: MERGE_DATA_SECTION_CODE)
&& this->u1_.entsize == entsize
- && this->addralign() == addralign);
+ && this->addralign() == addr_align);
}
// Return whether this is a relaxed input section.
// Add an input section, for SHF_MERGE sections.
bool
- add_input_section(Relobj* object, unsigned int shndx)
+ add_input_section(Relobj* object, unsigned int sec_shndx)
{
gold_assert(this->shndx_ == MERGE_DATA_SECTION_CODE
|| this->shndx_ == MERGE_STRING_SECTION_CODE);
- return this->u2_.posd->add_input_section(object, shndx);
+ return this->u2_.posd->add_input_section(object, sec_shndx);
}
// Given an input OBJECT, an input section index SHNDX within that
class Checkpoint_output_section
{
public:
- Checkpoint_output_section(uint64_t addralign, elfcpp::Elf_Xword flags,
- const Input_section_list& input_sections,
- off_t first_input_offset,
- bool attached_input_sections_are_sorted)
- : addralign_(addralign), flags_(flags),
- input_sections_(input_sections),
+ Checkpoint_output_section(uint64_t addr_align, elfcpp::Elf_Xword sflags,
+ const Input_section_list& sinput_sections,
+ off_t first_input_off,
+ bool attached_input_sections_sorted)
+ : addralign_(addr_align), flags_(sflags),
+ input_sections_(sinput_sections),
input_sections_size_(input_sections_.size()),
- input_sections_copy_(), first_input_offset_(first_input_offset),
- attached_input_sections_are_sorted_(attached_input_sections_are_sorted)
+ input_sections_copy_(), first_input_offset_(first_input_off),
+ attached_input_sections_are_sorted_(attached_input_sections_sorted)
{ }
virtual
class Fill
{
public:
- Fill(off_t section_offset, off_t length)
- : section_offset_(section_offset),
- length_(convert_to_section_size_type(length))
+ Fill(off_t section_off, off_t len)
+ : section_offset_(section_off),
+ length_(convert_to_section_size_type(len))
{ }
// Return section offset.
// Set the addresses.
void
- set_addresses(uint64_t vaddr, uint64_t paddr)
+ set_addresses(uint64_t v_addr, uint64_t p_addr)
{
- this->vaddr_ = vaddr;
- this->paddr_ = paddr;
+ this->vaddr_ = v_addr;
+ this->paddr_ = p_addr;
this->are_addresses_set_ = true;
}
// Set the segment flags. This is only used if we have a PHDRS
// clause which explicitly specifies the flags.
void
- set_flags(elfcpp::Elf_Word flags)
- { this->flags_ = flags; }
+ set_flags(elfcpp::Elf_Word seg_flags)
+ { this->flags_ = seg_flags; }
// Set the address of the segment to ADDR and the offset to *POFF
// and set the addresses and offsets of all contained output
// parameters.cc -- general parameters for a link using gold
-// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
{
void
-Parameters::set_errors(Errors* errors)
+Parameters::set_errors(Errors* errs)
{
gold_assert(this->errors_ == NULL);
- this->errors_ = errors;
+ this->errors_ = errs;
}
void
-Parameters::set_options(const General_options* options)
+Parameters::set_options(const General_options* opts)
{
gold_assert(!this->options_valid());
- this->options_ = options;
+ this->options_ = opts;
// For speed, we convert the options() debug var from a string to an
// enum (from debug.h).
this->debug_ = debug_string_to_enum(this->options().debug());
// If --verbose is set, it acts as "--debug=files".
- if (options->verbose())
+ if (opts->verbose())
this->debug_ |= DEBUG_FILES;
}
void
-Parameters::set_doing_static_link(bool doing_static_link)
+Parameters::set_doing_static_link(bool doing_staticlink)
{
gold_assert(!this->doing_static_link_valid_);
- this->doing_static_link_ = doing_static_link;
+ this->doing_static_link_ = doing_staticlink;
this->doing_static_link_valid_ = true;
}
void
-Parameters::set_target(Target* target)
+Parameters::set_target(Target* targ)
{
if (!this->target_valid())
- this->target_ = target;
+ this->target_ = targ;
else
- gold_assert(target == this->target_);
+ gold_assert(targ == this->target_);
}
// Return whether TARGET is compatible with the target we are using.
bool
-Parameters::is_compatible_target(const Target* target) const
+Parameters::is_compatible_target(const Target* targ) const
{
if (this->target_ == NULL)
return true;
- return target == this->target_;
+ return targ == this->target_;
}
Parameters::Target_size_endianness
void
Plugin_manager::all_symbols_read(Workqueue* workqueue, Task* task,
Input_objects* input_objects,
- Symbol_table* symtab, Layout* layout,
+ Symbol_table* symtab, Layout* alayout,
Dirsearch* dirpath, Mapfile* mapfile,
Task_token** last_blocker)
{
this->task_ = task;
this->input_objects_ = input_objects;
this->symtab_ = symtab;
- this->layout_ = layout;
+ this->layout_ = alayout;
this->dirpath_ = dirpath;
this->mapfile_ = mapfile;
this->this_blocker_ = NULL;
// Class Pluginobj.
-Pluginobj::Pluginobj(const std::string& name, Input_file* input_file,
- off_t offset, off_t filesize)
- : Object(name, input_file, false, offset),
- nsyms_(0), syms_(NULL), symbols_(), filesize_(filesize), comdat_map_()
+Pluginobj::Pluginobj(const std::string& aname, Input_file* ainput_file,
+ off_t aoffset, off_t afilesize)
+ : Object(aname, ainput_file, false, aoffset),
+ nsyms_(0), syms_(NULL), symbols_(), filesize_(afilesize), comdat_map_()
{
}
// should be kept.
bool
-Pluginobj::include_comdat_group(std::string comdat_key, Layout* layout)
+Pluginobj::include_comdat_group(std::string comdat_key, Layout* alayout)
{
std::pair<Comdat_map::iterator, bool> ins =
this->comdat_map_.insert(std::make_pair(comdat_key, false));
// If this is the first time we've seen this comdat key, ask the
// layout object whether it should be included.
if (ins.second)
- ins.first->second = layout->find_or_add_kept_section(comdat_key,
- NULL, 0, true,
- true, NULL);
+ ins.first->second = alayout->find_or_add_kept_section(comdat_key,
+ NULL, 0, true,
+ true, NULL);
return ins.first->second;
}
template<int size, bool big_endian>
Sized_pluginobj<size, big_endian>::Sized_pluginobj(
- const std::string& name,
- Input_file* input_file,
- off_t offset,
- off_t filesize)
- : Pluginobj(name, input_file, offset, filesize)
+ const std::string& aname,
+ Input_file* ainput_file,
+ off_t aoffset,
+ off_t afilesize)
+ : Pluginobj(aname, ainput_file, aoffset, afilesize)
{
}
void
Sized_pluginobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
Read_symbols_data*,
- Layout* layout)
+ Layout* alayout)
{
const int sym_size = elfcpp::Elf_sizes<size>::sym_size;
unsigned char symbuf[sym_size];
for (int i = 0; i < this->nsyms_; ++i)
{
const struct ld_plugin_symbol *isym = &this->syms_[i];
- const char* name = isym->name;
+ const char* aname = isym->name;
const char* ver = isym->version;
elfcpp::Elf_Half shndx;
elfcpp::STB bind;
elfcpp::STV vis;
- if (name != NULL && name[0] == '\0')
- name = NULL;
+ if (aname != NULL && aname[0] == '\0')
+ aname = NULL;
if (ver != NULL && ver[0] == '\0')
ver = NULL;
if (isym->comdat_key != NULL
&& isym->comdat_key[0] != '\0'
- && !this->include_comdat_group(isym->comdat_key, layout))
+ && !this->include_comdat_group(isym->comdat_key, alayout))
shndx = elfcpp::SHN_UNDEF;
osym.put_st_name(0);
osym.put_st_shndx(shndx);
this->symbols_[i] =
- symtab->add_from_pluginobj<size, big_endian>(this, name, ver, &sym);
+ symtab->add_from_pluginobj<size, big_endian>(this, aname, ver, &sym);
}
}
void
Output_data_plt_powerpc<size, big_endian>::do_write(Output_file* of)
{
- const off_t offset = this->offset();
+ const off_t off = this->offset();
const section_size_type oview_size =
convert_to_section_size_type(this->data_size());
- unsigned char* const oview = of->get_output_view(offset, oview_size);
+ unsigned char* const oview = of->get_output_view(off, oview_size);
unsigned char* pov = oview;
memset(pov, 0, base_plt_entry_size * 4);
gold_assert(static_cast<section_size_type>(pov - oview) == oview_size);
- of->write_output_view(offset, oview_size, oview);
+ of->write_output_view(off, oview_size, oview);
}
// Create a PLT entry for a global symbol.
const unsigned char* plocal_symbols)
{
typedef Target_powerpc<size, big_endian> Powerpc;
- typedef typename Target_powerpc<size, big_endian>::Scan Scan;
+ typedef typename Target_powerpc<size, big_endian>::Scan scan;
- gold::gc_process_relocs<size, big_endian, Powerpc, elfcpp::SHT_RELA, Scan>(
+ gold::gc_process_relocs<size, big_endian, Powerpc, elfcpp::SHT_RELA, scan>(
symtab,
layout,
this,
const unsigned char* plocal_symbols)
{
typedef Target_powerpc<size, big_endian> Powerpc;
- typedef typename Target_powerpc<size, big_endian>::Scan Scan;
+ typedef typename Target_powerpc<size, big_endian>::Scan scan;
static Output_data_space* sdata;
if (sh_type == elfcpp::SHT_REL)
false, false);
}
- gold::scan_relocs<size, big_endian, Powerpc, elfcpp::SHT_RELA, Scan>(
+ gold::scan_relocs<size, big_endian, Powerpc, elfcpp::SHT_RELA, scan>(
symtab,
layout,
this,
(big_endian ? "elf32-powerpc" : "elf32-powerpcle")))
{ }
- Target* do_recognize(int machine, int, int)
+ Target* do_recognize(int amachine, int, int)
{
switch (size)
{
case 64:
- if (machine != elfcpp::EM_PPC64)
+ if (amachine != elfcpp::EM_PPC64)
return NULL;
break;
case 32:
- if (machine != elfcpp::EM_PPC)
+ if (amachine != elfcpp::EM_PPC)
return NULL;
break;
// reduced_debug_output.cc -- output reduced debugging information to save space
-// Copyright 2008 Free Software Foundation, Inc.
+// Copyright 2008, 2009 Free Software Foundation, Inc.
// Written by Caleb Howe <cshowe@google.com>.
// This file is part of gold.
void
Output_reduced_debug_abbrev_section::do_write(Output_file* of)
{
- off_t offset = this->offset();
- off_t data_size = this->data_size();
- unsigned char* view = of->get_output_view(offset, data_size);
+ off_t off = this->offset();
+ off_t datasize = this->data_size();
+ unsigned char* view = of->get_output_view(off, datasize);
if (this->failed_)
memcpy(view, this->postprocessing_buffer(),
this->postprocessing_buffer_size());
else
- memcpy(view, &this->data_.front(), data_size);
- of->write_output_view(offset, data_size, view);
+ memcpy(view, &this->data_.front(), datasize);
+ of->write_output_view(off, datasize, view);
}
// Locates the abbreviation with abbreviation_number abbrev_number in the
void Output_reduced_debug_info_section::do_write(Output_file* of)
{
- off_t offset = this->offset();
- off_t data_size = this->data_size();
- unsigned char* view = of->get_output_view(offset, data_size);
+ off_t off = this->offset();
+ off_t datasize = this->data_size();
+ unsigned char* view = of->get_output_view(off, datasize);
if (this->failed_)
memcpy(view, this->postprocessing_buffer(),
this->postprocessing_buffer_size());
else
- memcpy(view, &this->data_.front(), data_size);
- of->write_output_view(offset, data_size, view);
+ memcpy(view, &this->data_.front(), datasize);
+ of->write_output_view(off, datasize, view);
}
} // End namespace gold.
// reduced_debug_output.h -- reduce debugging information -*- C++ -*-
-// Copyright 2008 Free Software Foundation, Inc.
+// Copyright 2008, 2009 Free Software Foundation, Inc.
// Written by Caleb Howe <cshowe@google.com>.
// This file is part of gold.
class Output_reduced_debug_abbrev_section : public Output_section
{
public:
- Output_reduced_debug_abbrev_section(const char* name, elfcpp::Elf_Word flags,
- elfcpp::Elf_Xword type)
- : Output_section(name, flags, type), sized_(false),
+ Output_reduced_debug_abbrev_section(const char* aname, elfcpp::Elf_Word aflags,
+ elfcpp::Elf_Xword atype)
+ : Output_section(aname, aflags, atype), sized_(false),
abbrev_count_(0), failed_(false)
{ this->set_requires_postprocessing(); }
class Output_reduced_debug_info_section : public Output_section
{
public:
- Output_reduced_debug_info_section(const char* name, elfcpp::Elf_Word flags,
- elfcpp::Elf_Xword type)
- : Output_section(name, flags, type), failed_(false)
+ Output_reduced_debug_info_section(const char* aname, elfcpp::Elf_Word aflags,
+ elfcpp::Elf_Xword atype)
+ : Output_section(aname, aflags, atype), failed_(false)
{ this->set_requires_postprocessing(); }
void
{
rd->relocs.clear();
- unsigned int shnum = this->shnum();
- if (shnum == 0)
+ unsigned int sec_shnum = this->shnum();
+ if (sec_shnum == 0)
return;
- rd->relocs.reserve(shnum / 2);
+ rd->relocs.reserve(sec_shnum / 2);
const Output_sections& out_sections(this->output_sections());
const std::vector<Address>& out_offsets(this->section_offsets_);
const unsigned char *pshdrs = this->get_view(this->elf_file_.shoff(),
- shnum * This::shdr_size,
+ sec_shnum * This::shdr_size,
true, true);
// Skip the first, dummy, section.
const unsigned char *ps = pshdrs + This::shdr_size;
- for (unsigned int i = 1; i < shnum; ++i, ps += This::shdr_size)
+ for (unsigned int i = 1; i < sec_shnum; ++i, ps += This::shdr_size)
{
typename This::Shdr shdr(ps);
continue;
unsigned int shndx = this->adjust_shndx(shdr.get_sh_info());
- if (shndx >= shnum)
+ if (shndx >= sec_shnum)
{
this->error(_("relocation section %u has bad info %u"),
i, shndx);
typename This::Shdr symtabshdr(pshdrs
+ this->symtab_shndx_ * This::shdr_size);
gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB);
- const int sym_size = This::sym_size;
+ const int symsize = This::sym_size;
const unsigned int loccount = this->local_symbol_count_;
gold_assert(loccount == symtabshdr.get_sh_info());
- off_t locsize = loccount * sym_size;
+ off_t locsize = loccount * symsize;
rd->local_symbols = this->get_lasting_view(symtabshdr.get_sh_offset(),
locsize, true, true);
}
template<int size, bool big_endian>
void
Sized_relobj<size, big_endian>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Read_relocs_data* rd)
{
Sized_target<size, big_endian>* target =
// only scan allocated sections. We may see a non-allocated
// section here if we are emitting relocs.
if (p->is_data_section_allocated)
- target->gc_process_relocs(symtab, layout, this,
+ target->gc_process_relocs(symtab, alayout, this,
p->data_shndx, p->sh_type,
p->contents->data(), p->reloc_count,
p->output_section,
template<int size, bool big_endian>
void
Sized_relobj<size, big_endian>::do_scan_relocs(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Read_relocs_data* rd)
{
Sized_target<size, big_endian>* target =
// only scan allocated sections. We may see a non-allocated
// section here if we are emitting relocs.
if (p->is_data_section_allocated)
- target->scan_relocs(symtab, layout, this, p->data_shndx,
+ target->scan_relocs(symtab, alayout, this, p->data_shndx,
p->sh_type, p->contents->data(),
p->reloc_count, p->output_section,
p->needs_special_offset_handling,
this->local_symbol_count_,
local_symbols);
if (parameters->options().emit_relocs())
- this->emit_relocs_scan(symtab, layout, local_symbols, p);
+ this->emit_relocs_scan(symtab, alayout, local_symbols, p);
}
else
{
Relocatable_relocs* rr = this->relocatable_relocs(p->reloc_shndx);
gold_assert(rr != NULL);
rr->set_reloc_count(p->reloc_count);
- target->scan_relocatable_relocs(symtab, layout, this,
+ target->scan_relocatable_relocs(symtab, alayout, this,
p->data_shndx, p->sh_type,
p->contents->data(),
p->reloc_count,
void
Sized_relobj<size, big_endian>::emit_relocs_scan(
Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
const unsigned char* plocal_syms,
const Read_relocs_data::Relocs_list::iterator& p)
{
rr->set_reloc_count(p->reloc_count);
if (p->sh_type == elfcpp::SHT_REL)
- this->emit_relocs_scan_reltype<elfcpp::SHT_REL>(symtab, layout,
+ this->emit_relocs_scan_reltype<elfcpp::SHT_REL>(symtab, alayout,
plocal_syms, p, rr);
else
{
gold_assert(p->sh_type == elfcpp::SHT_RELA);
- this->emit_relocs_scan_reltype<elfcpp::SHT_RELA>(symtab, layout,
+ this->emit_relocs_scan_reltype<elfcpp::SHT_RELA>(symtab, alayout,
plocal_syms, p, rr);
}
}
void
Sized_relobj<size, big_endian>::emit_relocs_scan_reltype(
Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
const unsigned char* plocal_syms,
const Read_relocs_data::Relocs_list::iterator& p,
Relocatable_relocs* rr)
scan_relocatable_relocs<size, big_endian, sh_type,
Emit_relocs_strategy<sh_type> >(
symtab,
- layout,
+ alayout,
this,
p->data_shndx,
p->contents->data(),
template<int size, bool big_endian>
void
Sized_relobj<size, big_endian>::do_relocate(const Symbol_table* symtab,
- const Layout* layout,
+ const Layout* alayout,
Output_file* of)
{
- unsigned int shnum = this->shnum();
+ unsigned int sec_shnum = this->shnum();
// Read the section headers.
const unsigned char* pshdrs = this->get_view(this->elf_file_.shoff(),
- shnum * This::shdr_size,
+ sec_shnum * This::shdr_size,
true, true);
Views views;
- views.resize(shnum);
+ views.resize(sec_shnum);
// Make two passes over the sections. The first one copies the
// section data to the output file. The second one applies
// Apply relocations.
- this->relocate_sections(symtab, layout, pshdrs, &views);
+ this->relocate_sections(symtab, alayout, pshdrs, &views);
// After we've done the relocations, we release the hash tables,
// since we no longer need them.
this->free_input_to_output_maps();
// Write out the accumulated views.
- for (unsigned int i = 1; i < shnum; ++i)
+ for (unsigned int i = 1; i < sec_shnum; ++i)
{
if (views[i].view != NULL)
{
}
// Write out the local symbols.
- this->write_local_symbols(of, layout->sympool(), layout->dynpool(),
- layout->symtab_xindex(), layout->dynsym_xindex());
+ this->write_local_symbols(of, alayout->sympool(), alayout->dynpool(),
+ alayout->symtab_xindex(), alayout->dynsym_xindex());
// We should no longer need the local symbol values.
this->clear_local_symbols();
Output_file* of,
Views* pviews)
{
- unsigned int shnum = this->shnum();
+ unsigned int sec_shnum = this->shnum();
const Output_sections& out_sections(this->output_sections());
const std::vector<Address>& out_offsets(this->section_offsets_);
bool is_sorted = true;
const unsigned char* p = pshdrs + This::shdr_size;
- for (unsigned int i = 1; i < shnum; ++i, p += This::shdr_size)
+ for (unsigned int i = 1; i < sec_shnum; ++i, p += This::shdr_size)
{
View_size* pvs = &(*pviews)[i];
// buffer, and the output section is responsible for writing the
// final data to the output file.
- off_t output_section_offset;
+ off_t out_section_offset;
Address output_section_size;
if (!os->requires_postprocessing())
{
- output_section_offset = os->offset();
+ out_section_offset = os->offset();
output_section_size = convert_types<Address, off_t>(os->data_size());
}
else
{
- output_section_offset = 0;
+ out_section_offset = 0;
output_section_size =
convert_types<Address, off_t>(os->postprocessing_buffer_size());
}
section_size_type view_size;
if (output_offset != invalid_address)
{
- view_start = output_section_offset + output_offset;
+ view_start = out_section_offset + output_offset;
view_size = convert_to_section_size_type(shdr.get_sh_size());
}
else
{
- view_start = output_section_offset;
+ view_start = out_section_offset;
view_size = convert_to_section_size_type(output_section_size);
}
gold_assert(output_offset == invalid_address
|| output_offset + view_size <= output_section_size);
- unsigned char* view;
+ unsigned char* aview;
if (os->requires_postprocessing())
{
unsigned char* buffer = os->postprocessing_buffer();
- view = buffer + view_start;
+ aview = buffer + view_start;
if (output_offset != invalid_address)
{
off_t sh_offset = shdr.get_sh_offset();
if (!rm.empty() && rm.back().file_offset > sh_offset)
is_sorted = false;
rm.push_back(File_read::Read_multiple_entry(sh_offset,
- view_size, view));
+ view_size, aview));
}
}
else
{
if (output_offset == invalid_address)
- view = of->get_input_output_view(view_start, view_size);
+ aview = of->get_input_output_view(view_start, view_size);
else
{
- view = of->get_output_view(view_start, view_size);
+ aview = of->get_output_view(view_start, view_size);
off_t sh_offset = shdr.get_sh_offset();
if (!rm.empty() && rm.back().file_offset > sh_offset)
is_sorted = false;
rm.push_back(File_read::Read_multiple_entry(sh_offset,
- view_size, view));
+ view_size, aview));
}
}
- pvs->view = view;
+ pvs->view = aview;
pvs->address = os->address();
if (output_offset != invalid_address)
pvs->address += output_offset;
void
Sized_relobj<size, big_endian>::do_relocate_sections(
const Symbol_table* symtab,
- const Layout* layout,
+ const Layout* alayout,
const unsigned char* pshdrs,
Views* pviews)
{
- unsigned int shnum = this->shnum();
+ unsigned int sec_shnum = this->shnum();
Sized_target<size, big_endian>* target =
parameters->sized_target<size, big_endian>();
Relocate_info<size, big_endian> relinfo;
relinfo.symtab = symtab;
- relinfo.layout = layout;
+ relinfo.layout = alayout;
relinfo.object = this;
const unsigned char* p = pshdrs + This::shdr_size;
- for (unsigned int i = 1; i < shnum; ++i, p += This::shdr_size)
+ for (unsigned int i = 1; i < sec_shnum; ++i, p += This::shdr_size)
{
typename This::Shdr shdr(p);
relinfo.reloc_shdr = p;
relinfo.data_shndx = index;
relinfo.data_shdr = pshdrs + index * This::shdr_size;
- unsigned char* view = (*pviews)[index].view;
+ unsigned char* aview = (*pviews)[index].view;
Address address = (*pviews)[index].address;
section_size_type view_size = (*pviews)[index].view_size;
typename This::Shdr data_shdr(pshdrs + index * This::shdr_size);
if ((data_shdr.get_sh_flags() & elfcpp::SHF_EXECINSTR) != 0)
this->split_stack_adjust(symtab, pshdrs, sh_type, index,
- prelocs, reloc_count, view, view_size,
+ prelocs, reloc_count, aview, view_size,
&reloc_map);
}
{
target->relocate_section(&relinfo, sh_type, prelocs, reloc_count, os,
output_offset == invalid_address,
- view, address, view_size, reloc_map);
+ aview, address, view_size, reloc_map);
if (parameters->options().emit_relocs())
this->emit_relocs(&relinfo, i, sh_type, prelocs, reloc_count,
- os, output_offset, view, address, view_size,
+ os, output_offset, aview, address, view_size,
(*pviews)[i].view, (*pviews)[i].view_size);
}
else
Relocatable_relocs* rr = this->relocatable_relocs(i);
target->relocate_for_relocatable(&relinfo, sh_type, prelocs,
reloc_count, os, output_offset, rr,
- view, address, view_size,
+ aview, address, view_size,
(*pviews)[i].view,
(*pviews)[i].view_size);
}
unsigned int sh_type,
const unsigned char* prelocs,
size_t reloc_count,
- Output_section* output_section,
+ Output_section* aoutput_section,
typename elfcpp::Elf_types<size>::Elf_Addr offset_in_output_section,
- unsigned char* view,
+ unsigned char* aview,
typename elfcpp::Elf_types<size>::Elf_Addr address,
section_size_type view_size,
unsigned char* reloc_view,
{
if (sh_type == elfcpp::SHT_REL)
this->emit_relocs_reltype<elfcpp::SHT_REL>(relinfo, i, prelocs,
- reloc_count, output_section,
+ reloc_count, aoutput_section,
offset_in_output_section,
- view, address, view_size,
+ aview, address, view_size,
reloc_view, reloc_view_size);
else
{
gold_assert(sh_type == elfcpp::SHT_RELA);
this->emit_relocs_reltype<elfcpp::SHT_RELA>(relinfo, i, prelocs,
- reloc_count, output_section,
+ reloc_count, aoutput_section,
offset_in_output_section,
- view, address, view_size,
+ aview, address, view_size,
reloc_view, reloc_view_size);
}
}
unsigned int i,
const unsigned char* prelocs,
size_t reloc_count,
- Output_section* output_section,
+ Output_section* aoutput_section,
typename elfcpp::Elf_types<size>::Elf_Addr offset_in_output_section,
- unsigned char* view,
+ unsigned char* aview,
typename elfcpp::Elf_types<size>::Elf_Addr address,
section_size_type view_size,
unsigned char* reloc_view,
relinfo,
prelocs,
reloc_count,
- output_section,
+ aoutput_section,
offset_in_output_section,
rr,
- view,
+ aview,
address,
view_size,
reloc_view,
unsigned int shndx,
const unsigned char* prelocs,
size_t reloc_count,
- unsigned char* view,
+ unsigned char* aview,
section_size_type view_size,
Reloc_symbol_changes** reloc_map)
{
if (sh_type == elfcpp::SHT_REL)
this->split_stack_adjust_reltype<elfcpp::SHT_REL>(symtab, pshdrs, shndx,
prelocs, reloc_count,
- view, view_size,
+ aview, view_size,
reloc_map);
else
{
gold_assert(sh_type == elfcpp::SHT_RELA);
this->split_stack_adjust_reltype<elfcpp::SHT_RELA>(symtab, pshdrs, shndx,
prelocs, reloc_count,
- view, view_size,
+ aview, view_size,
reloc_map);
}
}
unsigned int shndx,
const unsigned char* prelocs,
size_t reloc_count,
- unsigned char* view,
+ unsigned char* aview,
section_size_type view_size,
Reloc_symbol_changes** reloc_map)
{
&& gsym->source() == Symbol::FROM_OBJECT
&& !gsym->object()->uses_split_stack())
{
- section_offset_type offset =
+ section_offset_type off =
convert_to_section_size_type(reloc.get_r_offset());
- non_split_refs.push_back(offset);
+ non_split_refs.push_back(off);
}
}
std::string from;
std::string to;
parameters->target().calls_non_split(this, shndx, p->first, p->second,
- view, view_size, &from, &to);
+ aview, view_size, &from, &to);
if (!from.empty())
{
gold_assert(!to.empty());
if (r_sym < local_count)
continue;
- section_offset_type offset =
+ section_offset_type off =
convert_to_section_size_type(reloc.get_r_offset());
- if (offset < p->first
- || (offset
+ if (off < p->first
+ || (off
>= (p->first
+ static_cast<section_offset_type>(p->second))))
continue;
// We need to read the symbols to find the functions. If we wanted
// to, we could cache reading the symbols across all sections in the
// object.
- const unsigned int symtab_shndx = this->symtab_shndx_;
- typename This::Shdr symtabshdr(pshdrs + symtab_shndx * This::shdr_size);
+ const unsigned int sym_tab_shndx = this->symtab_shndx_;
+ typename This::Shdr symtabshdr(pshdrs + sym_tab_shndx * This::shdr_size);
gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB);
typename elfcpp::Elf_types<size>::Elf_WXword sh_size =
const unsigned char* psyms = this->get_view(symtabshdr.get_sh_offset(),
sh_size, true, true);
- const int sym_size = This::sym_size;
- const unsigned int symcount = sh_size / sym_size;
- for (unsigned int i = 0; i < symcount; ++i, psyms += sym_size)
+ const int symsize = This::sym_size;
+ const unsigned int symcount = sh_size / symsize;
+ for (unsigned int i = 0; i < symcount; ++i, psyms += symsize)
{
typename elfcpp::Sym<size, big_endian> isym(psyms);
template
void
Sized_relobj<32, false>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<32, true>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<64, false>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<64, true>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<32, false>::do_scan_relocs(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<32, true>::do_scan_relocs(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<64, false>::do_scan_relocs(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<64, true>::do_scan_relocs(Symbol_table* symtab,
- Layout* layout,
+ Layout* alayout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<32, false>::do_relocate(const Symbol_table* symtab,
- const Layout* layout,
+ const Layout* alayout,
Output_file* of);
#endif
template
void
Sized_relobj<32, true>::do_relocate(const Symbol_table* symtab,
- const Layout* layout,
+ const Layout* alayout,
Output_file* of);
#endif
template
void
Sized_relobj<64, false>::do_relocate(const Symbol_table* symtab,
- const Layout* layout,
+ const Layout* alayout,
Output_file* of);
#endif
template
void
Sized_relobj<64, true>::do_relocate(const Symbol_table* symtab,
- const Layout* layout,
+ const Layout* alayout,
Output_file* of);
#endif
void
Sized_relobj<32, false>::do_relocate_sections(
const Symbol_table* symtab,
- const Layout* layout,
+ const Layout* alayout,
const unsigned char* pshdrs,
Views* pviews);
#endif
void
Sized_relobj<32, true>::do_relocate_sections(
const Symbol_table* symtab,
- const Layout* layout,
+ const Layout* alayout,
const unsigned char* pshdrs,
Views* pviews);
#endif
void
Sized_relobj<64, false>::do_relocate_sections(
const Symbol_table* symtab,
- const Layout* layout,
+ const Layout* alayout,
const unsigned char* pshdrs,
Views* pviews);
#endif
// Record what to do for the next reloc.
void
- set_next_reloc_strategy(Reloc_strategy strategy)
+ set_next_reloc_strategy(Reloc_strategy astrategy)
{
- this->reloc_strategies_.push_back(static_cast<unsigned char>(strategy));
- if (strategy != RELOC_DISCARD)
+ this->reloc_strategies_.push_back(static_cast<unsigned char>(astrategy));
+ if (astrategy != RELOC_DISCARD)
++this->output_reloc_count_;
}
// VERSION. Update the VERSION_ field accordingly.
inline void
-Symbol::override_version(const char* version)
+Symbol::override_version(const char* aversion)
{
- if (version == NULL)
+ if (aversion == NULL)
{
// This is the case where this symbol is NAME/VERSION, and the
// version was not marked as hidden. That makes it the default
// override NAME/VERSION as well. They are already the same
// Symbol structure. Setting the VERSION_ field to NULL ensures
// that it will be output with the correct, empty, version.
- this->version_ = version;
+ this->version_ = aversion;
}
else
{
// overriding NAME. If VERSION_ONE and VERSION_TWO are
// different, then this can only happen when VERSION_ONE is NULL
// and VERSION_TWO is not hidden.
- gold_assert(this->version_ == version || this->version_ == NULL);
- this->version_ = version;
+ gold_assert(this->version_ == aversion || this->version_ == NULL);
+ this->version_ = aversion;
}
}
// is VISIBILITY. Updated the VISIBILITY_ field accordingly.
inline void
-Symbol::override_visibility(elfcpp::STV visibility)
+Symbol::override_visibility(elfcpp::STV avisibility)
{
// The rule for combining visibility is that we always choose the
// most constrained visibility. In order of increasing constraint,
// visibility goes PROTECTED, HIDDEN, INTERNAL. This is the reverse
// of the numeric values, so the effect is that we always want the
// smallest non-zero value.
- if (visibility != elfcpp::STV_DEFAULT)
+ if (avisibility != elfcpp::STV_DEFAULT)
{
if (this->visibility_ == elfcpp::STV_DEFAULT)
- this->visibility_ = visibility;
- else if (this->visibility_ > visibility)
- this->visibility_ = visibility;
+ this->visibility_ = avisibility;
+ else if (this->visibility_ > avisibility)
+ this->visibility_ = avisibility;
}
}
void
Symbol::override_base(const elfcpp::Sym<size, big_endian>& sym,
unsigned int st_shndx, bool is_ordinary,
- Object* object, const char* version)
+ Object* aobject, const char* aversion)
{
gold_assert(this->source_ == FROM_OBJECT);
- this->u_.from_object.object = object;
- this->override_version(version);
+ this->u_.from_object.object = aobject;
+ this->override_version(aversion);
this->u_.from_object.shndx = st_shndx;
this->is_ordinary_shndx_ = is_ordinary;
this->type_ = sym.get_st_type();
this->binding_ = sym.get_st_bind();
this->override_visibility(sym.get_st_visibility());
this->nonvis_ = sym.get_st_nonvis();
- if (object->is_dynamic())
+ if (aobject->is_dynamic())
this->in_dyn_ = true;
else
this->in_reg_ = true;
void
Sized_symbol<size>::override(const elfcpp::Sym<size, big_endian>& sym,
unsigned st_shndx, bool is_ordinary,
- Object* object, const char* version)
+ Object* aobject, const char* aversion)
{
- this->override_base(sym, st_shndx, is_ordinary, object, version);
+ this->override_base(sym, st_shndx, is_ordinary, aobject, aversion);
this->value_ = sym.get_st_value();
this->symsize_ = sym.get_st_size();
}
Symbol_table::override(Sized_symbol<size>* tosym,
const elfcpp::Sym<size, big_endian>& fromsym,
unsigned int st_shndx, bool is_ordinary,
- Object* object, const char* version)
+ Object* aobject, const char* aversion)
{
- tosym->override(fromsym, st_shndx, is_ordinary, object, version);
+ tosym->override(fromsym, st_shndx, is_ordinary, aobject, aversion);
if (tosym->has_alias())
{
Symbol* sym = this->weak_aliases_[tosym];
Sized_symbol<size>* ssym = this->get_sized_symbol<size>(sym);
do
{
- ssym->override(fromsym, st_shndx, is_ordinary, object, version);
+ ssym->override(fromsym, st_shndx, is_ordinary, aobject, aversion);
sym = this->weak_aliases_[ssym];
gold_assert(sym != NULL);
ssym = this->get_sized_symbol<size>(sym);
class Input_section_info
{
public:
- Input_section_info(const Output_section::Simple_input_section& input_section)
- : input_section_(input_section), section_name_(),
+ Input_section_info(const Output_section::Simple_input_section& inputsection)
+ : input_section_(inputsection), section_name_(),
size_(0), addralign_(1)
{ }
// Set the section name.
void
- set_section_name(const std::string name)
- { this->section_name_ = name; }
+ set_section_name(const std::string aname)
+ { this->section_name_ = aname; }
// Return the section size.
uint64_t
// Set the section size.
void
- set_size(uint64_t size)
- { this->size_ = size; }
+ set_size(uint64_t sec_size)
+ { this->size_ = sec_size; }
// Return the address alignment.
uint64_t
// Set the address alignment.
void
- set_addralign(uint64_t addralign)
- { this->addralign_ = addralign; }
+ set_addralign(uint64_t addr_align)
+ { this->addralign_ = addr_align; }
private:
// Input section, can be a relaxed section.
Input_section_sorter(this->filename_sort_,
isp.sort));
- for (std::vector<Input_section_info>::const_iterator p =
+ for (std::vector<Input_section_info>::const_iterator q =
matching_sections[i].begin();
- p != matching_sections[i].end();
- ++p)
+ q != matching_sections[i].end();
+ ++q)
{
- uint64_t this_subalign = p->addralign();
+ uint64_t this_subalign = q->addralign();
if (this_subalign < subalign)
this_subalign = subalign;
layout->new_output_section_data_from_script(posd);
}
- output_section->add_input_section_for_script(p->input_section(),
- p->size(),
+ output_section->add_input_section_for_script(q->input_section(),
+ q->size(),
this_subalign);
- dot = address + p->size();
+ dot = address + q->size();
}
}
Output_section_definition::get_output_section_info(const char* name,
uint64_t* address,
uint64_t* load_address,
- uint64_t* addralign,
+ uint64_t* addr_align,
uint64_t* size) const
{
if (this->name_ != name)
*load_address = this->output_section_->load_address();
else
*load_address = *address;
- *addralign = this->output_section_->addralign();
+ *addr_align = this->output_section_->addralign();
*size = this->output_section_->current_data_size();
}
else
{
*address = this->evaluated_address_;
*load_address = this->evaluated_load_address_;
- *addralign = this->evaluated_addralign_;
+ *addr_align = this->evaluated_addralign_;
*size = 0;
}
p != input_sections.end();
++p)
{
- uint64_t addralign;
+ uint64_t addr_align;
uint64_t size;
// We know what are single-threaded, so it is OK to lock the
{
const Task* task = reinterpret_cast<const Task*>(-1);
Task_lock_obj<Object> tl(task, p->relobj());
- addralign = p->relobj()->section_addralign(p->shndx());
+ addr_align = p->relobj()->section_addralign(p->shndx());
if (p->is_relaxed_input_section())
// We use current data size because relxed section sizes may not
// have finalized yet.
size = p->relobj()->section_size(p->shndx());
}
- address = align_address(address, addralign);
- this->os_->add_input_section_for_script(*p, size, addralign);
+ address = align_address(address, addr_align);
+ this->os_->add_input_section_for_script(*p, size, addr_align);
address += size;
}
class Phdrs_element
{
public:
- Phdrs_element(const char* name, size_t namelen, unsigned int type,
- bool includes_filehdr, bool includes_phdrs,
+ Phdrs_element(const char* aname, size_t namelen, unsigned int atype,
+ bool include_filehdr, bool include_phdrs,
bool is_flags_valid, unsigned int flags,
- Expression* load_address)
- : name_(name, namelen), type_(type), includes_filehdr_(includes_filehdr),
- includes_phdrs_(includes_phdrs), is_flags_valid_(is_flags_valid),
- flags_(flags), load_address_(load_address), load_address_value_(0),
+ Expression* aload_address)
+ : name_(aname, namelen), type_(atype), includes_filehdr_(include_filehdr),
+ includes_phdrs_(include_phdrs), is_flags_valid_(is_flags_valid),
+ flags_(flags), load_address_(aload_address), load_address_value_(0),
segment_(NULL)
{ }
// Evaluate the load address expression if there is one.
void
- eval_load_address(Symbol_table* symtab, Layout* layout)
+ eval_load_address(Symbol_table* symtab, Layout* alayout)
{
if (this->load_address_ != NULL)
- this->load_address_value_ = this->load_address_->eval(symtab, layout,
+ this->load_address_value_ = this->load_address_->eval(symtab, alayout,
true);
}
bool
Script_sections::get_output_section_info(const char* name, uint64_t* address,
uint64_t* load_address,
- uint64_t* addralign,
+ uint64_t* addr_align,
uint64_t* size) const
{
if (!this->saw_sections_clause_)
for (Sections_elements::const_iterator p = this->sections_elements_->begin();
p != this->sections_elements_->end();
++p)
- if ((*p)->get_output_section_info(name, address, load_address, addralign,
+ if ((*p)->get_output_section_info(name, address, load_address, addr_align,
size))
return true;
return false;
{ }
// A general token with no value.
- Token(Classification classification, int lineno, int charpos)
- : classification_(classification), value_(NULL), value_length_(0),
- opcode_(0), lineno_(lineno), charpos_(charpos)
+ Token(Classification aclassification, int linenum, int char_pos)
+ : classification_(aclassification), value_(NULL), value_length_(0),
+ opcode_(0), lineno_(linenum), charpos_(char_pos)
{
- gold_assert(classification == TOKEN_INVALID
- || classification == TOKEN_EOF);
+ gold_assert(aclassification == TOKEN_INVALID
+ || aclassification == TOKEN_EOF);
}
// A general token with a value.
- Token(Classification classification, const char* value, size_t length,
- int lineno, int charpos)
- : classification_(classification), value_(value), value_length_(length),
- opcode_(0), lineno_(lineno), charpos_(charpos)
+ Token(Classification aclassification, const char* value, size_t length,
+ int linenum, int char_pos)
+ : classification_(aclassification), value_(value), value_length_(length),
+ opcode_(0), lineno_(linenum), charpos_(char_pos)
{
- gold_assert(classification != TOKEN_INVALID
- && classification != TOKEN_EOF);
+ gold_assert(aclassification != TOKEN_INVALID
+ && aclassification != TOKEN_EOF);
}
// A token representing an operator.
- Token(int opcode, int lineno, int charpos)
+ Token(int opcode, int linenum, int char_pos)
: classification_(TOKEN_OPERATOR), value_(NULL), value_length_(0),
- opcode_(opcode), lineno_(lineno), charpos_(charpos)
+ opcode_(opcode), lineno_(linenum), charpos_(char_pos)
{ }
// Return whether the token is invalid.
// Set the lexing mode.
void
- set_mode(Mode mode)
- { this->mode_ = mode; }
+ set_mode(Mode mde)
+ { this->mode_ = mde; }
private:
Lex(const Lex&);
class Parser_closure
{
public:
- Parser_closure(const char* filename,
+ Parser_closure(const char* afilename,
const Position_dependent_options& posdep_options,
- bool in_group, bool is_in_sysroot,
- Command_line* command_line,
- Script_options* script_options,
+ bool in_a_group, bool is_in_a_sysroot,
+ Command_line* acommand_line,
+ Script_options* script_opts,
Lex* lex,
- bool skip_on_incompatible_target)
- : filename_(filename), posdep_options_(posdep_options),
- in_group_(in_group), is_in_sysroot_(is_in_sysroot),
- skip_on_incompatible_target_(skip_on_incompatible_target),
+ bool skip_on_a_incompatible_target)
+ : filename_(afilename), posdep_options_(posdep_options),
+ in_group_(in_a_group), is_in_sysroot_(is_in_a_sysroot),
+ skip_on_incompatible_target_(skip_on_a_incompatible_target),
found_incompatible_target_(false),
- command_line_(command_line), script_options_(script_options),
- version_script_info_(script_options->version_script_info()),
+ command_line_(acommand_line), script_options_(script_opts),
+ version_script_info_(script_opts->version_script_info()),
lex_(lex), lineno_(0), charpos_(0), lex_mode_stack_(), inputs_(NULL)
{
// We start out processing C symbols in the default lex mode.
// For example, pattern="std::map*" and language="C++".
// pattern and language should be from the stringpool
struct Version_expression {
- Version_expression(const std::string& pattern,
- const std::string& language,
- bool exact_match)
- : pattern(pattern), language(language), exact_match(exact_match) {}
+ Version_expression(const std::string& apattern,
+ const std::string& alanguage,
+ bool is_exact_match)
+ : pattern(apattern), language(alanguage), exact_match(is_exact_match) {}
std::string pattern;
std::string language;
class Script_assertion
{
public:
- Script_assertion(Expression* check, const char* message,
+ Script_assertion(Expression* echeck, const char* message,
size_t messagelen)
- : check_(check), message_(message, messagelen)
+ : check_(echeck), message_(message, messagelen)
{ }
// Check the assertion.
class Script_info
{
public:
- Script_info(Input_arguments* inputs)
- : inputs_(inputs)
+ Script_info(Input_arguments* arg_inputs)
+ : inputs_(arg_inputs)
{ }
// Returns the input files included because of this script.
rela(unsigned char* view,
unsigned int right_shift,
typename elfcpp::Elf_types<valsize>::Elf_Addr dst_mask,
- typename elfcpp::Swap<size, big_endian>::Valtype value,
+ typename elfcpp::Swap<size, big_endian>::Valtype avalue,
typename elfcpp::Swap<size, big_endian>::Valtype addend)
{
typedef typename elfcpp::Swap<valsize, big_endian>::Valtype Valtype;
Valtype* wv = reinterpret_cast<Valtype*>(view);
Valtype val = elfcpp::Swap<valsize, big_endian>::readval(wv);
- Valtype reloc = ((value + addend) >> right_shift);
+ Valtype reloc = ((avalue + addend) >> right_shift);
val &= ~dst_mask;
reloc &= dst_mask;
// R_SPARC_HI22: (Symbol + Addend) >> 10
static inline void
hi22(unsigned char* view,
- typename elfcpp::Elf_types<size>::Elf_Addr value,
+ typename elfcpp::Elf_types<size>::Elf_Addr avalue,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
- This_insn::template rela<32>(view, 10, 0x003fffff, value, addend);
+ This_insn::template rela<32>(view, 10, 0x003fffff, avalue, addend);
}
// R_SPARC_HI22: (Symbol + Addend) >> 10
// R_SPARC_LO10: (Symbol + Addend) & 0x3ff
static inline void
lo10(unsigned char* view,
- typename elfcpp::Elf_types<size>::Elf_Addr value,
+ typename elfcpp::Elf_types<size>::Elf_Addr avalue,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
- This_insn::template rela<32>(view, 0, 0x000003ff, value, addend);
+ This_insn::template rela<32>(view, 0, 0x000003ff, avalue, addend);
}
// R_SPARC_LO10: (Symbol + Addend) & 0x3ff
// R_SPARC_13: (Symbol + Addend)
static inline void
rela32_13(unsigned char* view,
- typename elfcpp::Elf_types<size>::Elf_Addr value,
+ typename elfcpp::Elf_types<size>::Elf_Addr avalue,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
- This_insn::template rela<32>(view, 0, 0x00001fff, value, addend);
+ This_insn::template rela<32>(view, 0, 0x00001fff, avalue, addend);
}
// R_SPARC_13: (Symbol + Addend)
// R_SPARC_TLS_LDO_HIX22: @dtpoff(Symbol + Addend) >> 10
static inline void
ldo_hix22(unsigned char* view,
- typename elfcpp::Elf_types<size>::Elf_Addr value,
+ typename elfcpp::Elf_types<size>::Elf_Addr avalue,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
- This_insn::hi22(view, value, addend);
+ This_insn::hi22(view, avalue, addend);
}
// R_SPARC_TLS_LDO_LOX10: @dtpoff(Symbol + Addend) & 0x3ff
static inline void
ldo_lox10(unsigned char* view,
- typename elfcpp::Elf_types<size>::Elf_Addr value,
+ typename elfcpp::Elf_types<size>::Elf_Addr avalue,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
typedef typename elfcpp::Swap<32, true>::Valtype Valtype;
Valtype* wv = reinterpret_cast<Valtype*>(view);
Valtype val = elfcpp::Swap<32, true>::readval(wv);
- Valtype reloc = (value + addend);
+ Valtype reloc = (avalue + addend);
val &= ~0x1fff;
reloc &= 0x3ff;
// R_SPARC_TLS_LE_HIX22: (@tpoff(Symbol + Addend) ^ 0xffffffffffffffff) >> 10
static inline void
hix22(unsigned char* view,
- typename elfcpp::Elf_types<size>::Elf_Addr value,
+ typename elfcpp::Elf_types<size>::Elf_Addr avalue,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
typedef typename elfcpp::Swap<32, true>::Valtype Valtype;
Valtype* wv = reinterpret_cast<Valtype*>(view);
Valtype val = elfcpp::Swap<32, true>::readval(wv);
- Valtype reloc = (value + addend);
+ Valtype reloc = (avalue + addend);
val &= ~0x3fffff;
// R_SPARC_TLS_LE_LOX10: (@tpoff(Symbol + Addend) & 0x3ff) | 0x1c00
static inline void
lox10(unsigned char* view,
- typename elfcpp::Elf_types<size>::Elf_Addr value,
+ typename elfcpp::Elf_types<size>::Elf_Addr avalue,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
typedef typename elfcpp::Swap<32, true>::Valtype Valtype;
Valtype* wv = reinterpret_cast<Valtype*>(view);
Valtype val = elfcpp::Swap<32, true>::readval(wv);
- Valtype reloc = (value + addend);
+ Valtype reloc = (avalue + addend);
val &= ~0x1fff;
reloc &= 0x3ff;
void
Output_data_plt_sparc<size, big_endian>::do_write(Output_file* of)
{
- const off_t offset = this->offset();
+ const off_t off = this->offset();
const section_size_type oview_size =
convert_to_section_size_type(this->data_size());
- unsigned char* const oview = of->get_output_view(offset, oview_size);
+ unsigned char* const oview = of->get_output_view(off, oview_size);
unsigned char* pov = oview;
memset(pov, 0, base_plt_entry_size * 4);
gold_assert(static_cast<section_size_type>(pov - oview) == oview_size);
- of->write_output_view(offset, oview_size, oview);
+ of->write_output_view(off, oview_size, oview);
}
// Create a PLT entry for a global symbol.
const unsigned char* plocal_symbols)
{
typedef Target_sparc<size, big_endian> Sparc;
- typedef typename Target_sparc<size, big_endian>::Scan Scan;
+ typedef typename Target_sparc<size, big_endian>::Scan scan;
- gold::gc_process_relocs<size, big_endian, Sparc, elfcpp::SHT_RELA, Scan>(
+ gold::gc_process_relocs<size, big_endian, Sparc, elfcpp::SHT_RELA, scan>(
symtab,
layout,
this,
const unsigned char* plocal_symbols)
{
typedef Target_sparc<size, big_endian> Sparc;
- typedef typename Target_sparc<size, big_endian>::Scan Scan;
+ typedef typename Target_sparc<size, big_endian>::Scan scan;
if (sh_type == elfcpp::SHT_REL)
{
return;
}
- gold::scan_relocs<size, big_endian, Sparc, elfcpp::SHT_RELA, Scan>(
+ gold::scan_relocs<size, big_endian, Sparc, elfcpp::SHT_RELA, scan>(
symtab,
layout,
this,
|| r_type == elfcpp::R_SPARC_WDISP19
|| r_type == elfcpp::R_SPARC_WDISP16))
{
- elfcpp::Elf_Xword value;
+ elfcpp::Elf_Xword avalue;
- value = target->plt_section()->address() + gsym->plt_offset();
+ avalue = target->plt_section()->address() + gsym->plt_offset();
- symval.set_output_value(value);
+ symval.set_output_value(avalue);
psymval = &symval;
}
typedef typename elfcpp::Swap<32, true>::Valtype Insntype;
const elfcpp::Elf_Xword addend = rela.get_r_addend();
- typename elfcpp::Elf_types<size>::Elf_Addr value = psymval->value(object, 0);
+ typename elfcpp::Elf_types<size>::Elf_Addr avalue = psymval->value(object, 0);
const bool is_final =
(gsym == NULL
Insntype* wv = reinterpret_cast<Insntype*>(view);
Insntype val;
- value -= tls_segment->memsz();
+ avalue -= tls_segment->memsz();
switch (r_type)
{
case elfcpp::R_SPARC_TLS_GD_HI22:
// TLS_GD_HI22 --> TLS_LE_HIX22
- Reloc::hix22(view, value, addend);
+ Reloc::hix22(view, avalue, addend);
break;
case elfcpp::R_SPARC_TLS_GD_LO10:
// TLS_GD_LO10 --> TLS_LE_LOX10
- Reloc::lox10(view, value, addend);
+ Reloc::lox10(view, avalue, addend);
break;
case elfcpp::R_SPARC_TLS_GD_ADD:
if (gsym != NULL)
{
gold_assert(gsym->has_got_offset(got_type));
- value = gsym->got_offset(got_type);
+ avalue = gsym->got_offset(got_type);
}
else
{
unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
gold_assert(object->local_has_got_offset(r_sym, got_type));
- value = object->local_got_offset(r_sym, got_type);
+ avalue = object->local_got_offset(r_sym, got_type);
}
if (optimized_type == tls::TLSOPT_TO_IE)
{
{
case elfcpp::R_SPARC_TLS_GD_HI22:
// TLS_GD_HI22 --> TLS_IE_HI22
- Reloc::hi22(view, value, addend);
+ Reloc::hi22(view, avalue, addend);
break;
case elfcpp::R_SPARC_TLS_GD_LO10:
// TLS_GD_LO10 --> TLS_IE_LO10
- Reloc::lo10(view, value, addend);
+ Reloc::lo10(view, avalue, addend);
break;
case elfcpp::R_SPARC_TLS_GD_ADD:
switch (r_type)
{
case elfcpp::R_SPARC_TLS_GD_HI22:
- Reloc::hi22(view, value, addend);
+ Reloc::hi22(view, avalue, addend);
break;
case elfcpp::R_SPARC_TLS_GD_LO10:
- Reloc::lo10(view, value, addend);
+ Reloc::lo10(view, avalue, addend);
break;
case elfcpp::R_SPARC_TLS_GD_ADD:
break;
case elfcpp::R_SPARC_TLS_GD_CALL:
{
Symbol_value<size> symval;
- elfcpp::Elf_Xword value;
+ elfcpp::Elf_Xword xvalue;
Symbol* tsym;
tsym = target->tls_get_addr_sym_;
gold_assert(tsym);
- value = (target->plt_section()->address() +
- tsym->plt_offset());
- symval.set_output_value(value);
+ xvalue = (target->plt_section()->address() +
+ tsym->plt_offset());
+ symval.set_output_value(xvalue);
Reloc::wdisp30(view, object, &symval, addend, address);
}
break;
case elfcpp::R_SPARC_TLS_LDM_CALL:
{
Symbol_value<size> symval;
- elfcpp::Elf_Xword value;
+ elfcpp::Elf_Xword xvalue;
Symbol* tsym;
tsym = target->tls_get_addr_sym_;
gold_assert(tsym);
- value = (target->plt_section()->address() +
- tsym->plt_offset());
- symval.set_output_value(value);
+ xvalue = (target->plt_section()->address() +
+ tsym->plt_offset());
+ symval.set_output_value(xvalue);
Reloc::wdisp30(view, object, &symval, addend, address);
}
break;
case elfcpp::R_SPARC_TLS_LDO_HIX22:
if (optimized_type == tls::TLSOPT_TO_LE)
{
- value -= tls_segment->memsz();
- Reloc::hix22(view, value, addend);
+ avalue -= tls_segment->memsz();
+ Reloc::hix22(view, avalue, addend);
}
else
- Reloc::ldo_hix22(view, value, addend);
+ Reloc::ldo_hix22(view, avalue, addend);
break;
case elfcpp::R_SPARC_TLS_LDO_LOX10:
if (optimized_type == tls::TLSOPT_TO_LE)
{
- value -= tls_segment->memsz();
- Reloc::lox10(view, value, addend);
+ avalue -= tls_segment->memsz();
+ Reloc::lox10(view, avalue, addend);
}
else
- Reloc::ldo_lox10(view, value, addend);
+ Reloc::ldo_lox10(view, avalue, addend);
break;
case elfcpp::R_SPARC_TLS_LDO_ADD:
if (optimized_type == tls::TLSOPT_TO_LE)
case elfcpp::R_SPARC_TLS_IE_LO10:
if (optimized_type == tls::TLSOPT_TO_LE)
{
- value -= tls_segment->memsz();
+ avalue -= tls_segment->memsz();
switch (r_type)
{
case elfcpp::R_SPARC_TLS_IE_HI22:
// IE_HI22 --> LE_HIX22
- Reloc::hix22(view, value, addend);
+ Reloc::hix22(view, avalue, addend);
break;
case elfcpp::R_SPARC_TLS_IE_LO10:
// IE_LO10 --> LE_LOX10
- Reloc::lox10(view, value, addend);
+ Reloc::lox10(view, avalue, addend);
break;
}
break;
if (gsym != NULL)
{
gold_assert(gsym->has_got_offset(GOT_TYPE_TLS_OFFSET));
- value = gsym->got_offset(GOT_TYPE_TLS_OFFSET);
+ avalue = gsym->got_offset(GOT_TYPE_TLS_OFFSET);
}
else
{
unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
gold_assert(object->local_has_got_offset(r_sym,
GOT_TYPE_TLS_OFFSET));
- value = object->local_got_offset(r_sym,
- GOT_TYPE_TLS_OFFSET);
+ avalue = object->local_got_offset(r_sym,
+ GOT_TYPE_TLS_OFFSET);
}
switch (r_type)
{
case elfcpp::R_SPARC_TLS_IE_HI22:
- Reloc::hi22(view, value, addend);
+ Reloc::hi22(view, avalue, addend);
break;
case elfcpp::R_SPARC_TLS_IE_LO10:
- Reloc::lo10(view, value, addend);
+ Reloc::lo10(view, avalue, addend);
break;
}
break;
// have been created for this location, so do not apply it now.
if (!parameters->options().shared())
{
- value -= tls_segment->memsz();
- Reloc::hix22(view, value, addend);
+ avalue -= tls_segment->memsz();
+ Reloc::hix22(view, avalue, addend);
}
break;
// have been created for this location, so do not apply it now.
if (!parameters->options().shared())
{
- value -= tls_segment->memsz();
- Reloc::lox10(view, value, addend);
+ avalue -= tls_segment->memsz();
+ Reloc::lox10(view, avalue, addend);
}
break;
}
(size == 64 ? "elf64-sparc" : "elf32-sparc"))
{ }
- Target* do_recognize(int machine, int, int)
+ Target* do_recognize(int amachine, int, int)
{
switch (size)
{
case 64:
- if (machine != elfcpp::EM_SPARCV9)
+ if (amachine != elfcpp::EM_SPARCV9)
return NULL;
break;
case 32:
- if (machine != elfcpp::EM_SPARC
- && machine != elfcpp::EM_SPARC32PLUS)
+ if (amachine != elfcpp::EM_SPARC
+ && amachine != elfcpp::EM_SPARC32PLUS)
return NULL;
break;
// and source_.
void
-Symbol::init_fields(const char* name, const char* version,
- elfcpp::STT type, elfcpp::STB binding,
- elfcpp::STV visibility, unsigned char nonvis)
+Symbol::init_fields(const char* aname, const char* aversion,
+ elfcpp::STT atype, elfcpp::STB abinding,
+ elfcpp::STV avisibility, unsigned char non_vis)
{
- this->name_ = name;
- this->version_ = version;
+ this->name_ = aname;
+ this->version_ = aversion;
this->symtab_index_ = 0;
this->dynsym_index_ = 0;
this->got_offsets_.init();
this->plt_offset_ = 0;
- this->type_ = type;
- this->binding_ = binding;
- this->visibility_ = visibility;
- this->nonvis_ = nonvis;
+ this->type_ = atype;
+ this->binding_ = abinding;
+ this->visibility_ = avisibility;
+ this->nonvis_ = non_vis;
this->is_target_special_ = false;
this->is_def_ = false;
this->is_forwarder_ = false;
// if the --demangle flag was set.
static std::string
-demangle(const char* name)
+demangle(const char* aname)
{
if (!parameters->options().do_demangle())
- return name;
+ return aname;
// cplus_demangle allocates memory for the result it returns,
// and returns NULL if the name is already demangled.
- char* demangled_name = cplus_demangle(name, DMGL_ANSI | DMGL_PARAMS);
+ char* demangled_name = cplus_demangle(aname, DMGL_ANSI | DMGL_PARAMS);
if (demangled_name == NULL)
- return name;
+ return aname;
std::string retval(demangled_name);
free(demangled_name);
template<int size, bool big_endian>
void
-Symbol::init_base_object(const char* name, const char* version, Object* object,
+Symbol::init_base_object(const char* aname, const char* aversion, Object* aobject,
const elfcpp::Sym<size, big_endian>& sym,
unsigned int st_shndx, bool is_ordinary)
{
- this->init_fields(name, version, sym.get_st_type(), sym.get_st_bind(),
+ this->init_fields(aname, aversion, sym.get_st_type(), sym.get_st_bind(),
sym.get_st_visibility(), sym.get_st_nonvis());
- this->u_.from_object.object = object;
+ this->u_.from_object.object = aobject;
this->u_.from_object.shndx = st_shndx;
this->is_ordinary_shndx_ = is_ordinary;
this->source_ = FROM_OBJECT;
- this->in_reg_ = !object->is_dynamic();
- this->in_dyn_ = object->is_dynamic();
- this->in_real_elf_ = object->pluginobj() == NULL;
+ this->in_reg_ = !aobject->is_dynamic();
+ this->in_dyn_ = aobject->is_dynamic();
+ this->in_real_elf_ = aobject->pluginobj() == NULL;
}
// Initialize the fields in the base class Symbol for a symbol defined
// in an Output_data.
void
-Symbol::init_base_output_data(const char* name, const char* version,
- Output_data* od, elfcpp::STT type,
- elfcpp::STB binding, elfcpp::STV visibility,
- unsigned char nonvis, bool offset_is_from_end)
+Symbol::init_base_output_data(const char* aname, const char* aversion,
+ Output_data* od, elfcpp::STT atype,
+ elfcpp::STB abinding, elfcpp::STV avisibility,
+ unsigned char non_vis, bool offset_is_from_the_end)
{
- this->init_fields(name, version, type, binding, visibility, nonvis);
+ this->init_fields(aname, aversion, atype, abinding, avisibility, non_vis);
this->u_.in_output_data.output_data = od;
- this->u_.in_output_data.offset_is_from_end = offset_is_from_end;
+ this->u_.in_output_data.offset_is_from_end = offset_is_from_the_end;
this->source_ = IN_OUTPUT_DATA;
this->in_reg_ = true;
this->in_real_elf_ = true;
// in an Output_segment.
void
-Symbol::init_base_output_segment(const char* name, const char* version,
- Output_segment* os, elfcpp::STT type,
- elfcpp::STB binding, elfcpp::STV visibility,
- unsigned char nonvis,
- Segment_offset_base offset_base)
+Symbol::init_base_output_segment(const char* aname, const char* aversion,
+ Output_segment* os, elfcpp::STT atype,
+ elfcpp::STB abinding, elfcpp::STV avisibility,
+ unsigned char non_vis,
+ Segment_offset_base offsetbase)
{
- this->init_fields(name, version, type, binding, visibility, nonvis);
+ this->init_fields(aname, aversion, atype, abinding, avisibility, non_vis);
this->u_.in_output_segment.output_segment = os;
- this->u_.in_output_segment.offset_base = offset_base;
+ this->u_.in_output_segment.offset_base = offsetbase;
this->source_ = IN_OUTPUT_SEGMENT;
this->in_reg_ = true;
this->in_real_elf_ = true;
// as a constant.
void
-Symbol::init_base_constant(const char* name, const char* version,
- elfcpp::STT type, elfcpp::STB binding,
- elfcpp::STV visibility, unsigned char nonvis)
+Symbol::init_base_constant(const char* aname, const char* aversion,
+ elfcpp::STT atype, elfcpp::STB abinding,
+ elfcpp::STV avisibility, unsigned char non_vis)
{
- this->init_fields(name, version, type, binding, visibility, nonvis);
+ this->init_fields(aname, aversion, atype, abinding, avisibility, non_vis);
this->source_ = IS_CONSTANT;
this->in_reg_ = true;
this->in_real_elf_ = true;
// symbol.
void
-Symbol::init_base_undefined(const char* name, const char* version,
- elfcpp::STT type, elfcpp::STB binding,
- elfcpp::STV visibility, unsigned char nonvis)
+Symbol::init_base_undefined(const char* aname, const char* aversion,
+ elfcpp::STT atype, elfcpp::STB abinding,
+ elfcpp::STV avisibility, unsigned char non_vis)
{
- this->init_fields(name, version, type, binding, visibility, nonvis);
+ this->init_fields(aname, aversion, atype, abinding, avisibility, non_vis);
this->dynsym_index_ = -1U;
this->source_ = IS_UNDEFINED;
this->in_reg_ = true;
template<int size>
template<bool big_endian>
void
-Sized_symbol<size>::init_object(const char* name, const char* version,
- Object* object,
+Sized_symbol<size>::init_object(const char* aname, const char* aversion,
+ Object* aobject,
const elfcpp::Sym<size, big_endian>& sym,
unsigned int st_shndx, bool is_ordinary)
{
- this->init_base_object(name, version, object, sym, st_shndx, is_ordinary);
+ this->init_base_object(aname, aversion, aobject, sym, st_shndx, is_ordinary);
this->value_ = sym.get_st_value();
this->symsize_ = sym.get_st_size();
}
template<int size>
void
-Sized_symbol<size>::init_output_data(const char* name, const char* version,
- Output_data* od, Value_type value,
- Size_type symsize, elfcpp::STT type,
- elfcpp::STB binding,
- elfcpp::STV visibility,
- unsigned char nonvis,
- bool offset_is_from_end)
+Sized_symbol<size>::init_output_data(const char* aname, const char* aversion,
+ Output_data* od, Value_type avalue,
+ Size_type sym_size, elfcpp::STT atype,
+ elfcpp::STB abinding,
+ elfcpp::STV avisibility,
+ unsigned char non_vis,
+ bool offset_is_from_the_end)
{
- this->init_base_output_data(name, version, od, type, binding, visibility,
- nonvis, offset_is_from_end);
- this->value_ = value;
- this->symsize_ = symsize;
+ this->init_base_output_data(aname, aversion, od, atype, abinding, avisibility,
+ non_vis, offset_is_from_the_end);
+ this->value_ = avalue;
+ this->symsize_ = sym_size;
}
// Initialize the fields in Sized_symbol for a symbol defined in an
template<int size>
void
-Sized_symbol<size>::init_output_segment(const char* name, const char* version,
- Output_segment* os, Value_type value,
- Size_type symsize, elfcpp::STT type,
- elfcpp::STB binding,
- elfcpp::STV visibility,
- unsigned char nonvis,
- Segment_offset_base offset_base)
+Sized_symbol<size>::init_output_segment(const char* aname, const char* aversion,
+ Output_segment* os, Value_type avalue,
+ Size_type sym_size, elfcpp::STT atype,
+ elfcpp::STB abinding,
+ elfcpp::STV avisibility,
+ unsigned char non_vis,
+ Segment_offset_base offsetbase)
{
- this->init_base_output_segment(name, version, os, type, binding, visibility,
- nonvis, offset_base);
- this->value_ = value;
- this->symsize_ = symsize;
+ this->init_base_output_segment(aname, aversion, os, atype, abinding, avisibility,
+ non_vis, offsetbase);
+ this->value_ = avalue;
+ this->symsize_ = sym_size;
}
// Initialize the fields in Sized_symbol for a symbol defined as a
template<int size>
void
-Sized_symbol<size>::init_constant(const char* name, const char* version,
- Value_type value, Size_type symsize,
- elfcpp::STT type, elfcpp::STB binding,
- elfcpp::STV visibility, unsigned char nonvis)
+Sized_symbol<size>::init_constant(const char* aname, const char* aversion,
+ Value_type avalue, Size_type sym_size,
+ elfcpp::STT atype, elfcpp::STB abinding,
+ elfcpp::STV avisibility, unsigned char non_vis)
{
- this->init_base_constant(name, version, type, binding, visibility, nonvis);
- this->value_ = value;
- this->symsize_ = symsize;
+ this->init_base_constant(aname, aversion, atype, abinding, avisibility, non_vis);
+ this->value_ = avalue;
+ this->symsize_ = sym_size;
}
// Initialize the fields in Sized_symbol for an undefined symbol.
template<int size>
void
-Sized_symbol<size>::init_undefined(const char* name, const char* version,
- elfcpp::STT type, elfcpp::STB binding,
- elfcpp::STV visibility, unsigned char nonvis)
+Sized_symbol<size>::init_undefined(const char* aname, const char* aversion,
+ elfcpp::STT atype, elfcpp::STB abinding,
+ elfcpp::STV avisibility, unsigned char non_vis)
{
- this->init_base_undefined(name, version, type, binding, visibility, nonvis);
+ this->init_base_undefined(aname, aversion, atype, abinding, avisibility, non_vis);
this->value_ = 0;
this->symsize_ = 0;
}
// Return true if SHNDX represents a common symbol.
bool
-Symbol::is_common_shndx(unsigned int shndx)
+Symbol::is_common_shndx(unsigned int sec_shndx)
{
- return (shndx == elfcpp::SHN_COMMON
- || shndx == parameters->target().small_common_shndx()
- || shndx == parameters->target().large_common_shndx());
+ return (sec_shndx == elfcpp::SHN_COMMON
+ || sec_shndx == parameters->target().small_common_shndx()
+ || sec_shndx == parameters->target().large_common_shndx());
}
// Allocate a common symbol.
template<int size>
void
-Sized_symbol<size>::allocate_common(Output_data* od, Value_type value)
+Sized_symbol<size>::allocate_common(Output_data* od, Value_type avalue)
{
this->allocate_base_common(od);
- this->value_ = value;
+ this->value_ = avalue;
}
// The ""'s around str ensure str is a string literal, so sizeof works.
{
Relobj* relobj = static_cast<Relobj*>(this->object());
bool is_ordinary;
- unsigned int shndx = this->shndx(&is_ordinary);
- if (is_ordinary && shndx != elfcpp::SHN_UNDEF
- && !relobj->is_section_included(shndx))
+ unsigned int sec_shndx = this->shndx(&is_ordinary);
+ if (is_ordinary && sec_shndx != elfcpp::SHN_UNDEF
+ && !relobj->is_section_included(sec_shndx))
return false;
}
{
// TODO(csilvers): We could probably figure out if we're an operator
// new/delete or typeinfo without the need to demangle.
- char* demangled_name = cplus_demangle(this->name(),
- DMGL_ANSI | DMGL_PARAMS);
- if (demangled_name == NULL)
+ char* ademangled_name = cplus_demangle(this->name(),
+ DMGL_ANSI | DMGL_PARAMS);
+ if (ademangled_name == NULL)
{
// Not a C++ symbol, so it can't satisfy these flags
}
else if (parameters->options().dynamic_list_cpp_new()
- && (strprefix(demangled_name, "operator new")
- || strprefix(demangled_name, "operator delete")))
+ && (strprefix(ademangled_name, "operator new")
+ || strprefix(ademangled_name, "operator delete")))
{
- free(demangled_name);
+ free(ademangled_name);
return true;
}
else if (parameters->options().dynamic_list_cpp_typeinfo()
- && (strprefix(demangled_name, "typeinfo name for")
- || strprefix(demangled_name, "typeinfo for")))
+ && (strprefix(ademangled_name, "typeinfo name for")
+ || strprefix(ademangled_name, "typeinfo for")))
{
- free(demangled_name);
+ free(ademangled_name);
return true;
}
else
- free(demangled_name);
+ free(ademangled_name);
}
// If exporting all symbols or building a shared library,
{
case FROM_OBJECT:
{
- unsigned int shndx = this->u_.from_object.shndx;
- if (shndx != elfcpp::SHN_UNDEF && this->is_ordinary_shndx_)
+ unsigned int sec_shndx = this->u_.from_object.shndx;
+ if (sec_shndx != elfcpp::SHN_UNDEF && this->is_ordinary_shndx_)
{
gold_assert(!this->u_.from_object.object->is_dynamic());
gold_assert(this->u_.from_object.object->pluginobj() == NULL);
Relobj* relobj = static_cast<Relobj*>(this->u_.from_object.object);
- return relobj->output_section(shndx);
+ return relobj->output_section(sec_shndx);
}
return NULL;
}
// Class Symbol_table.
Symbol_table::Symbol_table(unsigned int count,
- const Version_script_info& version_script)
+ const Version_script_info& aversion_script)
: saw_undefined_(0), offset_(0), table_(count), namepool_(),
forwarders_(), commons_(), tls_commons_(), small_commons_(),
large_commons_(), forced_locals_(), warnings_(),
- version_script_(version_script), gc_(NULL), icf_(NULL)
+ version_script_(aversion_script), gc_(NULL), icf_(NULL)
{
namepool_.reserve(count);
}
}
bool
-Symbol_table::is_section_folded(Object* obj, unsigned int shndx) const
+Symbol_table::is_section_folded(Object* obj, unsigned int sec_shndx) const
{
return (parameters->options().icf_enabled()
- && this->icf_->is_section_folded(obj, shndx));
+ && this->icf_->is_section_folded(obj, sec_shndx));
}
// For symbols that have been listed with -u option, add them to the
p != parameters->options().undefined_end();
++p)
{
- const char* name = p->c_str();
- Symbol* sym = this->lookup(name);
+ const char* aname = p->c_str();
+ Symbol* sym = this->lookup(aname);
gold_assert (sym != NULL);
if (sym->source() == Symbol::FROM_OBJECT
&& !sym->object()->is_dynamic())
{
Relobj* obj = static_cast<Relobj*>(sym->object());
bool is_ordinary;
- unsigned int shndx = sym->shndx(&is_ordinary);
+ unsigned int sec_shndx = sym->shndx(&is_ordinary);
if (is_ordinary)
{
gold_assert(this->gc_ != NULL);
- this->gc_->worklist().push(Section_id(obj, shndx));
+ this->gc_->worklist().push(Section_id(obj, sec_shndx));
}
}
}
//Add the object and section to the work list.
Relobj* obj = static_cast<Relobj*>(sym->object());
bool is_ordinary;
- unsigned int shndx = sym->shndx(&is_ordinary);
- if (is_ordinary && shndx != elfcpp::SHN_UNDEF)
+ unsigned int sec_shndx = sym->shndx(&is_ordinary);
+ if (is_ordinary && sec_shndx != elfcpp::SHN_UNDEF)
{
gold_assert(this->gc_!= NULL);
- this->gc_->worklist().push(Section_id(obj, shndx));
+ this->gc_->worklist().push(Section_id(obj, sec_shndx));
}
}
}
{
Relobj *obj = static_cast<Relobj*>(sym->object());
bool is_ordinary;
- unsigned int shndx = sym->shndx(&is_ordinary);
- if (is_ordinary && shndx != elfcpp::SHN_UNDEF)
+ unsigned int sec_shndx = sym->shndx(&is_ordinary);
+ if (is_ordinary && sec_shndx != elfcpp::SHN_UNDEF)
{
gold_assert(this->gc_ != NULL);
- this->gc_->worklist().push(Section_id(obj, shndx));
+ this->gc_->worklist().push(Section_id(obj, sec_shndx));
}
}
}
// Look up a symbol by name.
Symbol*
-Symbol_table::lookup(const char* name, const char* version) const
+Symbol_table::lookup(const char* aname, const char* aversion) const
{
Stringpool::Key name_key;
- name = this->namepool_.find(name, &name_key);
- if (name == NULL)
+ aname = this->namepool_.find(aname, &name_key);
+ if (aname == NULL)
return NULL;
Stringpool::Key version_key = 0;
- if (version != NULL)
+ if (aversion != NULL)
{
- version = this->namepool_.find(version, &version_key);
- if (version == NULL)
+ aversion = this->namepool_.find(aversion, &version_key);
+ if (aversion == NULL)
return NULL;
}
esym.put_st_info(from->binding(), from->type());
esym.put_st_other(from->visibility(), from->nonvis());
bool is_ordinary;
- unsigned int shndx = from->shndx(&is_ordinary);
- this->resolve(to, esym.sym(), shndx, is_ordinary, shndx, from->object(),
+ unsigned int sec_shndx = from->shndx(&is_ordinary);
+ this->resolve(to, esym.sym(), sec_shndx, is_ordinary, sec_shndx, from->object(),
from->version());
if (from->in_reg())
to->set_in_reg();
// option was used.
const char*
-Symbol_table::wrap_symbol(const char* name, Stringpool::Key* name_key)
+Symbol_table::wrap_symbol(const char* aname, Stringpool::Key* name_key)
{
// For some targets, we need to ignore a specific character when
// wrapping, and add it back later.
char prefix = '\0';
- if (name[0] == parameters->target().wrap_char())
+ if (aname[0] == parameters->target().wrap_char())
{
- prefix = name[0];
- ++name;
+ prefix = aname[0];
+ ++aname;
}
- if (parameters->options().is_wrap(name))
+ if (parameters->options().is_wrap(aname))
{
// Turn NAME into __wrap_NAME.
std::string s;
if (prefix != '\0')
s += prefix;
s += "__wrap_";
- s += name;
+ s += aname;
// This will give us both the old and new name in NAMEPOOL_, but
// that is OK. Only the versions we need will wind up in the
const char* const real_prefix = "__real_";
const size_t real_prefix_length = strlen(real_prefix);
- if (strncmp(name, real_prefix, real_prefix_length) == 0
- && parameters->options().is_wrap(name + real_prefix_length))
+ if (strncmp(aname, real_prefix, real_prefix_length) == 0
+ && parameters->options().is_wrap(aname + real_prefix_length))
{
// Turn __real_NAME into NAME.
std::string s;
if (prefix != '\0')
s += prefix;
- s += name + real_prefix_length;
+ s += aname + real_prefix_length;
return this->namepool_.add(s.c_str(), true, name_key);
}
- return name;
+ return aname;
}
// This is called when we see a symbol NAME/VERSION, and the symbol
template<int size, bool big_endian>
Sized_symbol<size>*
-Symbol_table::add_from_object(Object* object,
- const char *name,
+Symbol_table::add_from_object(Object* aobject,
+ const char *aname,
Stringpool::Key name_key,
- const char *version,
+ const char *aversion,
Stringpool::Key version_key,
bool def,
const elfcpp::Sym<size, big_endian>& sym,
unsigned int orig_st_shndx)
{
// Print a message if this symbol is being traced.
- if (parameters->options().is_trace_symbol(name))
+ if (parameters->options().is_trace_symbol(aname))
{
if (orig_st_shndx == elfcpp::SHN_UNDEF)
- gold_info(_("%s: reference to %s"), object->name().c_str(), name);
+ gold_info(_("%s: reference to %s"), aobject->name().c_str(), aname);
else
- gold_info(_("%s: definition of %s"), object->name().c_str(), name);
+ gold_info(_("%s: definition of %s"), aobject->name().c_str(), aname);
}
// For an undefined symbol, we may need to adjust the name using
if (orig_st_shndx == elfcpp::SHN_UNDEF
&& parameters->options().any_wrap())
{
- const char* wrap_name = this->wrap_symbol(name, &name_key);
- if (wrap_name != name)
+ const char* wrap_name = this->wrap_symbol(aname, &name_key);
+ if (wrap_name != aname)
{
// If we see a reference to malloc with version GLIBC_2.0,
// and we turn it into a reference to __wrap_malloc, then we
// discard the version number. Otherwise the user would be
// required to specify the correct version for
// __wrap_malloc.
- version = NULL;
+ aversion = NULL;
version_key = 0;
- name = wrap_name;
+ aname = wrap_name;
}
}
was_undefined = ret->is_undefined();
was_common = ret->is_common();
- this->resolve(ret, sym, st_shndx, is_ordinary, orig_st_shndx, object,
- version);
+ this->resolve(ret, sym, st_shndx, is_ordinary, orig_st_shndx, aobject,
+ aversion);
if (parameters->options().gc_sections())
this->gc_mark_dyn_syms(ret);
was_undefined = ret->is_undefined();
was_common = ret->is_common();
- this->resolve(ret, sym, st_shndx, is_ordinary, orig_st_shndx, object,
- version);
+ this->resolve(ret, sym, st_shndx, is_ordinary, orig_st_shndx, aobject,
+ aversion);
if (parameters->options().gc_sections())
this->gc_mark_dyn_syms(ret);
ins.first->second = ret;
}
}
- ret->init_object(name, version, object, sym, st_shndx, is_ordinary);
+ ret->init_object(aname, aversion, aobject, sym, st_shndx, is_ordinary);
ins.first->second = ret;
if (def)
continue;
}
- const char* name = sym_names + st_name;
+ const char* aname = sym_names + st_name;
bool is_ordinary;
unsigned int st_shndx = relobj->adjust_sym_shndx(i + symndx_offset,
// In an object file, an '@' in the name separates the symbol
// name from the version name. If there are two '@' characters,
// this is the default version.
- const char* ver = strchr(name, '@');
+ const char* ver = strchr(aname, '@');
Stringpool::Key ver_key = 0;
int namelen = 0;
// DEF: is the version default? LOCAL: is the symbol forced local?
if (ver != NULL)
{
// The symbol name is of the form foo@VERSION or foo@@VERSION
- namelen = ver - name;
+ namelen = ver - aname;
++ver;
if (*ver == '@')
{
// about a common symbol?
else
{
- namelen = strlen(name);
+ namelen = strlen(aname);
if (!this->version_script_.empty()
&& st_shndx != elfcpp::SHN_UNDEF)
{
// The symbol name did not have a version, but the
// version script may assign a version anyway.
- std::string version;
- if (this->version_script_.get_symbol_version(name, &version))
+ std::string aversion;
+ if (this->version_script_.get_symbol_version(aname, &aversion))
{
// The version can be empty if the version script is
// only used to force some symbols to be local.
- if (!version.empty())
+ if (!aversion.empty())
{
- ver = this->namepool_.add_with_length(version.c_str(),
- version.length(),
+ ver = this->namepool_.add_with_length(aversion.c_str(),
+ aversion.length(),
true,
&ver_key);
def = true;
}
}
- else if (this->version_script_.symbol_is_local(name))
+ else if (this->version_script_.symbol_is_local(aname))
local = true;
}
}
}
Stringpool::Key name_key;
- name = this->namepool_.add_with_length(name, namelen, true,
+ aname = this->namepool_.add_with_length(aname, namelen, true,
&name_key);
Sized_symbol<size>* res;
- res = this->add_from_object(relobj, name, name_key, ver, ver_key,
+ res = this->add_from_object(relobj, aname, name_key, ver, ver_key,
def, *psym, st_shndx, is_ordinary,
orig_st_shndx);
Symbol*
Symbol_table::add_from_pluginobj(
Sized_pluginobj<size, big_endian>* obj,
- const char* name,
+ const char* aname,
const char* ver,
elfcpp::Sym<size, big_endian>* sym)
{
{
// The symbol name did not have a version, but the
// version script may assign a version anyway.
- std::string version;
- if (this->version_script_.get_symbol_version(name, &version))
+ std::string aversion;
+ if (this->version_script_.get_symbol_version(aname, &aversion))
{
// The version can be empty if the version script is
// only used to force some symbols to be local.
- if (!version.empty())
+ if (!aversion.empty())
{
- ver = this->namepool_.add_with_length(version.c_str(),
- version.length(),
+ ver = this->namepool_.add_with_length(aversion.c_str(),
+ aversion.length(),
true,
&ver_key);
def = true;
}
}
- else if (this->version_script_.symbol_is_local(name))
+ else if (this->version_script_.symbol_is_local(aname))
local = true;
}
}
Stringpool::Key name_key;
- name = this->namepool_.add(name, true, &name_key);
+ aname = this->namepool_.add(aname, true, &name_key);
Sized_symbol<size>* res;
- res = this->add_from_object(obj, name, name_key, ver, ver_key,
+ res = this->add_from_object(obj, aname, name_key, ver, ver_key,
def, *sym, st_shndx, is_ordinary, st_shndx);
if (local)
continue;
}
- const char* name = sym_names + st_name;
+ const char* aname = sym_names + st_name;
bool is_ordinary;
unsigned int st_shndx = dynobj->adjust_sym_shndx(i, psym->get_st_shndx(),
if (versym == NULL)
{
Stringpool::Key name_key;
- name = this->namepool_.add(name, true, &name_key);
- res = this->add_from_object(dynobj, name, name_key, NULL, 0,
+ aname = this->namepool_.add(aname, true, &name_key);
+ res = this->add_from_object(dynobj, aname, name_key, NULL, 0,
false, *psym, st_shndx, is_ordinary,
st_shndx);
}
// At this point we are definitely going to add this symbol.
Stringpool::Key name_key;
- name = this->namepool_.add(name, true, &name_key);
+ aname = this->namepool_.add(aname, true, &name_key);
if (v == static_cast<unsigned int>(elfcpp::VER_NDX_LOCAL)
|| v == static_cast<unsigned int>(elfcpp::VER_NDX_GLOBAL))
{
// This symbol does not have a version.
- res = this->add_from_object(dynobj, name, name_key, NULL, 0,
+ res = this->add_from_object(dynobj, aname, name_key, NULL, 0,
false, *psym, st_shndx, is_ordinary,
st_shndx);
}
continue;
}
- const char* version = (*version_map)[v];
- if (version == NULL)
+ const char* aversion = (*version_map)[v];
+ if (aversion == NULL)
{
dynobj->error(_("versym for symbol %zu has no name: %u"),
i, v);
}
Stringpool::Key version_key;
- version = this->namepool_.add(version, true, &version_key);
+ aversion = this->namepool_.add(aversion, true, &version_key);
// If this is an absolute symbol, and the version name
// and symbol name are the same, then this is the
if (st_shndx == elfcpp::SHN_ABS
&& !is_ordinary
&& name_key == version_key)
- res = this->add_from_object(dynobj, name, name_key, NULL, 0,
+ res = this->add_from_object(dynobj, aname, name_key, NULL, 0,
false, *psym, st_shndx, is_ordinary,
st_shndx);
else
{
const bool def = (!hidden
&& st_shndx != elfcpp::SHN_UNDEF);
- res = this->add_from_object(dynobj, name, name_key, version,
+ res = this->add_from_object(dynobj, aname, name_key, aversion,
version_key, def, *psym, st_shndx,
is_ordinary, st_shndx);
}
// Define a symbol based on an Output_data.
Symbol*
-Symbol_table::define_in_output_data(const char* name,
- const char* version,
+Symbol_table::define_in_output_data(const char* aname,
+ const char* aversion,
Output_data* od,
- uint64_t value,
- uint64_t symsize,
+ uint64_t avalue,
+ uint64_t sym_size,
elfcpp::STT type,
elfcpp::STB binding,
elfcpp::STV visibility,
unsigned char nonvis,
- bool offset_is_from_end,
+ bool offset_is_from_the_end,
bool only_if_ref)
{
if (parameters->target().get_size() == 32)
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
- return this->do_define_in_output_data<32>(name, version, od,
- value, symsize, type, binding,
+ return this->do_define_in_output_data<32>(aname, aversion, od,
+ avalue, sym_size, type, binding,
visibility, nonvis,
- offset_is_from_end,
+ offset_is_from_the_end,
only_if_ref);
#else
gold_unreachable();
else if (parameters->target().get_size() == 64)
{
#if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
- return this->do_define_in_output_data<64>(name, version, od,
- value, symsize, type, binding,
+ return this->do_define_in_output_data<64>(aname, aversion, od,
+ avalue, sym_size, type, binding,
visibility, nonvis,
- offset_is_from_end,
+ offset_is_from_the_end,
only_if_ref);
#else
gold_unreachable();
template<int size>
Sized_symbol<size>*
Symbol_table::do_define_in_output_data(
- const char* name,
- const char* version,
+ const char* aname,
+ const char* aversion,
Output_data* od,
- typename elfcpp::Elf_types<size>::Elf_Addr value,
- typename elfcpp::Elf_types<size>::Elf_WXword symsize,
+ typename elfcpp::Elf_types<size>::Elf_Addr avalue,
+ typename elfcpp::Elf_types<size>::Elf_WXword sym_size,
elfcpp::STT type,
elfcpp::STB binding,
elfcpp::STV visibility,
unsigned char nonvis,
- bool offset_is_from_end,
+ bool offset_is_from_the_end,
bool only_if_ref)
{
Sized_symbol<size>* sym;
if (parameters->target().is_big_endian())
{
#if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
- sym = this->define_special_symbol<size, true>(&name, &version,
+ sym = this->define_special_symbol<size, true>(&aname, &aversion,
only_if_ref, &oldsym,
&resolve_oldsym);
#else
else
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
- sym = this->define_special_symbol<size, false>(&name, &version,
+ sym = this->define_special_symbol<size, false>(&aname, &aversion,
only_if_ref, &oldsym,
&resolve_oldsym);
#else
if (sym == NULL)
return NULL;
- sym->init_output_data(name, version, od, value, symsize, type, binding,
- visibility, nonvis, offset_is_from_end);
+ sym->init_output_data(aname, aversion, od, avalue, sym_size, type, binding,
+ visibility, nonvis, offset_is_from_the_end);
if (oldsym == NULL)
{
if (binding == elfcpp::STB_LOCAL
- || this->version_script_.symbol_is_local(name))
+ || this->version_script_.symbol_is_local(aname))
this->force_local(sym);
- else if (version != NULL)
+ else if (aversion != NULL)
sym->set_is_default();
return sym;
}
// Define a symbol based on an Output_segment.
Symbol*
-Symbol_table::define_in_output_segment(const char* name,
- const char* version, Output_segment* os,
- uint64_t value,
- uint64_t symsize,
+Symbol_table::define_in_output_segment(const char* aname,
+ const char* aversion, Output_segment* os,
+ uint64_t avalue,
+ uint64_t sym_size,
elfcpp::STT type,
elfcpp::STB binding,
elfcpp::STV visibility,
unsigned char nonvis,
- Symbol::Segment_offset_base offset_base,
+ Symbol::Segment_offset_base offsetbase,
bool only_if_ref)
{
if (parameters->target().get_size() == 32)
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
- return this->do_define_in_output_segment<32>(name, version, os,
- value, symsize, type,
+ return this->do_define_in_output_segment<32>(aname, aversion, os,
+ avalue, sym_size, type,
binding, visibility, nonvis,
- offset_base, only_if_ref);
+ offsetbase, only_if_ref);
#else
gold_unreachable();
#endif
else if (parameters->target().get_size() == 64)
{
#if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
- return this->do_define_in_output_segment<64>(name, version, os,
- value, symsize, type,
+ return this->do_define_in_output_segment<64>(aname, aversion, os,
+ avalue, sym_size, type,
binding, visibility, nonvis,
- offset_base, only_if_ref);
+ offsetbase, only_if_ref);
#else
gold_unreachable();
#endif
template<int size>
Sized_symbol<size>*
Symbol_table::do_define_in_output_segment(
- const char* name,
- const char* version,
+ const char* aname,
+ const char* aversion,
Output_segment* os,
- typename elfcpp::Elf_types<size>::Elf_Addr value,
- typename elfcpp::Elf_types<size>::Elf_WXword symsize,
+ typename elfcpp::Elf_types<size>::Elf_Addr avalue,
+ typename elfcpp::Elf_types<size>::Elf_WXword sym_size,
elfcpp::STT type,
elfcpp::STB binding,
elfcpp::STV visibility,
unsigned char nonvis,
- Symbol::Segment_offset_base offset_base,
+ Symbol::Segment_offset_base offsetbase,
bool only_if_ref)
{
Sized_symbol<size>* sym;
if (parameters->target().is_big_endian())
{
#if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
- sym = this->define_special_symbol<size, true>(&name, &version,
+ sym = this->define_special_symbol<size, true>(&aname, &aversion,
only_if_ref, &oldsym,
&resolve_oldsym);
#else
else
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
- sym = this->define_special_symbol<size, false>(&name, &version,
+ sym = this->define_special_symbol<size, false>(&aname, &aversion,
only_if_ref, &oldsym,
&resolve_oldsym);
#else
if (sym == NULL)
return NULL;
- sym->init_output_segment(name, version, os, value, symsize, type, binding,
- visibility, nonvis, offset_base);
+ sym->init_output_segment(aname, aversion, os, avalue, sym_size, type, binding,
+ visibility, nonvis, offsetbase);
if (oldsym == NULL)
{
if (binding == elfcpp::STB_LOCAL
- || this->version_script_.symbol_is_local(name))
+ || this->version_script_.symbol_is_local(aname))
this->force_local(sym);
- else if (version != NULL)
+ else if (aversion != NULL)
sym->set_is_default();
return sym;
}
// definition error if this symbol is already defined.
Symbol*
-Symbol_table::define_as_constant(const char* name,
- const char* version,
- uint64_t value,
- uint64_t symsize,
+Symbol_table::define_as_constant(const char* aname,
+ const char* aversion,
+ uint64_t avalue,
+ uint64_t sym_size,
elfcpp::STT type,
elfcpp::STB binding,
elfcpp::STV visibility,
if (parameters->target().get_size() == 32)
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
- return this->do_define_as_constant<32>(name, version, value,
- symsize, type, binding,
+ return this->do_define_as_constant<32>(aname, aversion, avalue,
+ sym_size, type, binding,
visibility, nonvis, only_if_ref,
force_override);
#else
else if (parameters->target().get_size() == 64)
{
#if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
- return this->do_define_as_constant<64>(name, version, value,
- symsize, type, binding,
+ return this->do_define_as_constant<64>(aname, aversion, avalue,
+ sym_size, type, binding,
visibility, nonvis, only_if_ref,
force_override);
#else
template<int size>
Sized_symbol<size>*
Symbol_table::do_define_as_constant(
- const char* name,
- const char* version,
- typename elfcpp::Elf_types<size>::Elf_Addr value,
- typename elfcpp::Elf_types<size>::Elf_WXword symsize,
+ const char* aname,
+ const char* aversion,
+ typename elfcpp::Elf_types<size>::Elf_Addr avalue,
+ typename elfcpp::Elf_types<size>::Elf_WXword sym_size,
elfcpp::STT type,
elfcpp::STB binding,
elfcpp::STV visibility,
if (parameters->target().is_big_endian())
{
#if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
- sym = this->define_special_symbol<size, true>(&name, &version,
+ sym = this->define_special_symbol<size, true>(&aname, &aversion,
only_if_ref, &oldsym,
&resolve_oldsym);
#else
else
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
- sym = this->define_special_symbol<size, false>(&name, &version,
+ sym = this->define_special_symbol<size, false>(&aname, &aversion,
only_if_ref, &oldsym,
&resolve_oldsym);
#else
if (sym == NULL)
return NULL;
- sym->init_constant(name, version, value, symsize, type, binding, visibility,
+ sym->init_constant(aname, aversion, avalue, sym_size, type, binding, visibility,
nonvis);
if (oldsym == NULL)
{
// Version symbols are absolute symbols with name == version.
// We don't want to force them to be local.
- if ((version == NULL
- || name != version
- || value != 0)
+ if ((aversion == NULL
+ || aname != aversion
+ || avalue != 0)
&& (binding == elfcpp::STB_LOCAL
- || this->version_script_.symbol_is_local(name)))
+ || this->version_script_.symbol_is_local(aname)))
this->force_local(sym);
- else if (version != NULL
- && (name != version || value != 0))
+ else if (aversion != NULL
+ && (aname != aversion || avalue != 0))
sym->set_is_default();
return sym;
}
Symbol_table::define_with_copy_reloc(
Sized_symbol<size>* csym,
Output_data* posd,
- typename elfcpp::Elf_types<size>::Elf_Addr value)
+ typename elfcpp::Elf_types<size>::Elf_Addr avalue)
{
gold_assert(csym->is_from_dynobj());
gold_assert(!csym->is_copied_from_dynobj());
- Object* object = csym->object();
- gold_assert(object->is_dynamic());
- Dynobj* dynobj = static_cast<Dynobj*>(object);
+ Object* aobject = csym->object();
+ gold_assert(aobject->is_dynamic());
+ Dynobj* dynobj = static_cast<Dynobj*>(aobject);
// Our copied variable has to override any variable in a shared
// library.
binding = elfcpp::STB_GLOBAL;
this->define_in_output_data(csym->name(), csym->version(),
- posd, value, csym->symsize(),
+ posd, avalue, csym->symsize(),
csym->type(), binding,
csym->visibility(), csym->nonvis(),
false, false);
p != parameters->options().undefined_end();
++p)
{
- const char* name = p->c_str();
+ const char* aname = p->c_str();
- if (this->lookup(name) != NULL)
+ if (this->lookup(aname) != NULL)
continue;
- const char* version = NULL;
+ const char* aversion = NULL;
Sized_symbol<size>* sym;
Sized_symbol<size>* oldsym;
if (parameters->target().is_big_endian())
{
#if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
- sym = this->define_special_symbol<size, true>(&name, &version,
+ sym = this->define_special_symbol<size, true>(&aname, &aversion,
false, &oldsym,
&resolve_oldsym);
#else
else
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
- sym = this->define_special_symbol<size, false>(&name, &version,
+ sym = this->define_special_symbol<size, false>(&aname, &aversion,
false, &oldsym,
&resolve_oldsym);
#else
gold_assert(oldsym == NULL);
- sym->init_undefined(name, version, elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL,
+ sym->init_undefined(aname, aversion, elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL,
elfcpp::STV_DEFAULT, 0);
++this->saw_undefined_;
}
Compute_final_value_status* pstatus) const
{
typedef typename Sized_symbol<size>::Value_type Value_type;
- Value_type value;
+ Value_type avalue;
switch (sym->source())
{
case Symbol::FROM_OBJECT:
{
bool is_ordinary;
- unsigned int shndx = sym->shndx(&is_ordinary);
+ unsigned int sec_shndx = sym->shndx(&is_ordinary);
if (!is_ordinary
- && shndx != elfcpp::SHN_ABS
- && !Symbol::is_common_shndx(shndx))
+ && sec_shndx != elfcpp::SHN_ABS
+ && !Symbol::is_common_shndx(sec_shndx))
{
*pstatus = CFVS_UNSUPPORTED_SYMBOL_SECTION;
return 0;
Object* symobj = sym->object();
if (symobj->is_dynamic())
{
- value = 0;
- shndx = elfcpp::SHN_UNDEF;
+ avalue = 0;
+ sec_shndx = elfcpp::SHN_UNDEF;
}
else if (symobj->pluginobj() != NULL)
{
- value = 0;
- shndx = elfcpp::SHN_UNDEF;
+ avalue = 0;
+ sec_shndx = elfcpp::SHN_UNDEF;
}
- else if (shndx == elfcpp::SHN_UNDEF)
- value = 0;
+ else if (sec_shndx == elfcpp::SHN_UNDEF)
+ avalue = 0;
else if (!is_ordinary
- && (shndx == elfcpp::SHN_ABS
- || Symbol::is_common_shndx(shndx)))
- value = sym->value();
+ && (sec_shndx == elfcpp::SHN_ABS
+ || Symbol::is_common_shndx(sec_shndx)))
+ avalue = sym->value();
else
{
Relobj* relobj = static_cast<Relobj*>(symobj);
- Output_section* os = relobj->output_section(shndx);
- uint64_t secoff64 = relobj->output_section_offset(shndx);
+ Output_section* os = relobj->output_section(sec_shndx);
+ uint64_t secoff64 = relobj->output_section_offset(sec_shndx);
- if (this->is_section_folded(relobj, shndx))
+ if (this->is_section_folded(relobj, sec_shndx))
{
gold_assert(os == NULL);
// Get the os of the section it is folded onto.
Section_id folded = this->icf_->get_folded_section(relobj,
- shndx);
+ sec_shndx);
gold_assert(folded.first != NULL);
Relobj* folded_obj = reinterpret_cast<Relobj*>(folded.first);
os = folded_obj->output_section(folded.second);
{
// The section needs special handling (e.g., a merge section).
- value = os->output_address(relobj, shndx, sym->value());
+ avalue = os->output_address(relobj, sec_shndx, sym->value());
}
else
{
Value_type secoff =
convert_types<Value_type, uint64_t>(secoff64);
if (sym->type() == elfcpp::STT_TLS)
- value = sym->value() + os->tls_offset() + secoff;
+ avalue = sym->value() + os->tls_offset() + secoff;
else
- value = sym->value() + os->address() + secoff;
+ avalue = sym->value() + os->address() + secoff;
}
}
}
case Symbol::IN_OUTPUT_DATA:
{
Output_data* od = sym->output_data();
- value = sym->value();
+ avalue = sym->value();
if (sym->type() != elfcpp::STT_TLS)
- value += od->address();
+ avalue += od->address();
else
{
Output_section* os = od->output_section();
gold_assert(os != NULL);
- value += os->tls_offset() + (od->address() - os->address());
+ avalue += os->tls_offset() + (od->address() - os->address());
}
if (sym->offset_is_from_end())
- value += od->data_size();
+ avalue += od->data_size();
}
break;
case Symbol::IN_OUTPUT_SEGMENT:
{
Output_segment* os = sym->output_segment();
- value = sym->value();
+ avalue = sym->value();
if (sym->type() != elfcpp::STT_TLS)
- value += os->vaddr();
+ avalue += os->vaddr();
switch (sym->offset_base())
{
case Symbol::SEGMENT_START:
break;
case Symbol::SEGMENT_END:
- value += os->memsz();
+ avalue += os->memsz();
break;
case Symbol::SEGMENT_BSS:
- value += os->filesz();
+ avalue += os->filesz();
break;
default:
gold_unreachable();
break;
case Symbol::IS_CONSTANT:
- value = sym->value();
+ avalue = sym->value();
break;
case Symbol::IS_UNDEFINED:
- value = 0;
+ avalue = 0;
break;
default:
}
*pstatus = CFVS_OK;
- return value;
+ return avalue;
}
// Finalize the symbol SYM. This returns true if the symbol should be
// Compute final symbol value.
Compute_final_value_status status;
- Value_type value = this->compute_final_value(sym, &status);
+ Value_type avalue = this->compute_final_value(sym, &status);
switch (status)
{
case CFVS_UNSUPPORTED_SYMBOL_SECTION:
{
bool is_ordinary;
- unsigned int shndx = sym->shndx(&is_ordinary);
+ unsigned int sec_shndx = sym->shndx(&is_ordinary);
gold_error(_("%s: unsupported symbol section 0x%x"),
- sym->demangled_name().c_str(), shndx);
+ sym->demangled_name().c_str(), sec_shndx);
}
break;
case CFVS_NO_OUTPUT_SECTION:
gold_unreachable();
}
- sym->set_value(value);
+ sym->set_value(avalue);
if (parameters->options().strip_all()
|| !parameters->options().should_retain_symbol(sym->name()))
continue;
}
- unsigned int shndx;
+ unsigned int sec_shndx;
typename elfcpp::Elf_types<size>::Elf_Addr sym_value = sym->value();
typename elfcpp::Elf_types<size>::Elf_Addr dynsym_value = sym_value;
switch (sym->source())
{
gold_error(_("%s: unsupported symbol section 0x%x"),
sym->demangled_name().c_str(), in_shndx);
- shndx = in_shndx;
+ sec_shndx = in_shndx;
}
else
{
{
if (sym->needs_dynsym_value())
dynsym_value = target.dynsym_value(sym);
- shndx = elfcpp::SHN_UNDEF;
+ sec_shndx = elfcpp::SHN_UNDEF;
}
else if (symobj->pluginobj() != NULL)
- shndx = elfcpp::SHN_UNDEF;
+ sec_shndx = elfcpp::SHN_UNDEF;
else if (in_shndx == elfcpp::SHN_UNDEF
|| (!is_ordinary
&& (in_shndx == elfcpp::SHN_ABS
|| Symbol::is_common_shndx(in_shndx))))
- shndx = in_shndx;
+ sec_shndx = in_shndx;
else
{
Relobj* relobj = static_cast<Relobj*>(symobj);
gold_assert(os != NULL);
}
gold_assert(os != NULL);
- shndx = os->out_shndx();
+ sec_shndx = os->out_shndx();
- if (shndx >= elfcpp::SHN_LORESERVE)
+ if (sec_shndx >= elfcpp::SHN_LORESERVE)
{
if (sym_index != -1U)
- symtab_xindex->add(sym_index, shndx);
+ symtab_xindex->add(sym_index, sec_shndx);
if (dynsym_index != -1U)
- dynsym_xindex->add(dynsym_index, shndx);
- shndx = elfcpp::SHN_XINDEX;
+ dynsym_xindex->add(dynsym_index, sec_shndx);
+ sec_shndx = elfcpp::SHN_XINDEX;
}
// In object files symbol values are section
break;
case Symbol::IN_OUTPUT_DATA:
- shndx = sym->output_data()->out_shndx();
- if (shndx >= elfcpp::SHN_LORESERVE)
+ sec_shndx = sym->output_data()->out_shndx();
+ if (sec_shndx >= elfcpp::SHN_LORESERVE)
{
if (sym_index != -1U)
- symtab_xindex->add(sym_index, shndx);
+ symtab_xindex->add(sym_index, sec_shndx);
if (dynsym_index != -1U)
- dynsym_xindex->add(dynsym_index, shndx);
- shndx = elfcpp::SHN_XINDEX;
+ dynsym_xindex->add(dynsym_index, sec_shndx);
+ sec_shndx = elfcpp::SHN_XINDEX;
}
break;
case Symbol::IN_OUTPUT_SEGMENT:
- shndx = elfcpp::SHN_ABS;
+ sec_shndx = elfcpp::SHN_ABS;
break;
case Symbol::IS_CONSTANT:
- shndx = elfcpp::SHN_ABS;
+ sec_shndx = elfcpp::SHN_ABS;
break;
case Symbol::IS_UNDEFINED:
- shndx = elfcpp::SHN_UNDEF;
+ sec_shndx = elfcpp::SHN_UNDEF;
break;
default:
sym_index -= first_global_index;
gold_assert(sym_index < output_count);
unsigned char* ps = psyms + (sym_index * sym_size);
- this->sized_write_symbol<size, big_endian>(sym, sym_value, shndx,
+ this->sized_write_symbol<size, big_endian>(sym, sym_value, sec_shndx,
sympool, ps);
}
dynsym_index -= first_dynamic_global_index;
gold_assert(dynsym_index < dynamic_count);
unsigned char* pd = dynamic_view + (dynsym_index * sym_size);
- this->sized_write_symbol<size, big_endian>(sym, dynsym_value, shndx,
+ this->sized_write_symbol<size, big_endian>(sym, dynsym_value, sec_shndx,
dynpool, pd);
}
}
void
Symbol_table::sized_write_symbol(
Sized_symbol<size>* sym,
- typename elfcpp::Elf_types<size>::Elf_Addr value,
- unsigned int shndx,
+ typename elfcpp::Elf_types<size>::Elf_Addr avalue,
+ unsigned int sec_shndx,
const Stringpool* pool,
unsigned char* p) const
{
elfcpp::Sym_write<size, big_endian> osym(p);
osym.put_st_name(pool->get_offset(sym->name()));
- osym.put_st_value(value);
+ osym.put_st_value(avalue);
// Use a symbol size of zero for undefined symbols from shared libraries.
- if (shndx == elfcpp::SHN_UNDEF && sym->is_from_dynobj())
+ if (sec_shndx == elfcpp::SHN_UNDEF && sym->is_from_dynobj())
osym.put_st_size(0);
else
osym.put_st_size(sym->symsize());
else
osym.put_st_info(elfcpp::elf_st_info(sym->binding(), type));
osym.put_st_other(elfcpp::elf_st_other(sym->visibility(), sym->nonvis()));
- osym.put_st_shndx(shndx);
+ osym.put_st_shndx(sec_shndx);
}
// Check for unresolved symbols in shared libraries. This is
elfcpp::STT_SECTION));
osym.put_st_other(elfcpp::elf_st_other(elfcpp::STV_DEFAULT, 0));
- unsigned int shndx = os->out_shndx();
- if (shndx >= elfcpp::SHN_LORESERVE)
+ unsigned int sec_shndx = os->out_shndx();
+ if (sec_shndx >= elfcpp::SHN_LORESERVE)
{
- symtab_xindex->add(os->symtab_index(), shndx);
- shndx = elfcpp::SHN_XINDEX;
+ symtab_xindex->add(os->symtab_index(), sec_shndx);
+ sec_shndx = elfcpp::SHN_XINDEX;
}
- osym.put_st_shndx(shndx);
+ osym.put_st_shndx(sec_shndx);
of->write_output_view(offset, sym_size, pov);
}
// Add a new warning.
void
-Warnings::add_warning(Symbol_table* symtab, const char* name, Object* obj,
+Warnings::add_warning(Symbol_table* symtab, const char* aname, Object* obj,
const std::string& warning)
{
- name = symtab->canonicalize_name(name);
- this->warnings_[name].set(obj, warning);
+ aname = symtab->canonicalize_name(aname);
+ this->warnings_[aname].set(obj, warning);
}
// Look through the warnings and mark the symbols for which we should
Symbol_table::define_with_copy_reloc<32>(
Sized_symbol<32>* sym,
Output_data* posd,
- elfcpp::Elf_types<32>::Elf_Addr value);
+ elfcpp::Elf_types<32>::Elf_Addr avalue);
#endif
#if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
Symbol_table::define_with_copy_reloc<64>(
Sized_symbol<64>* sym,
Output_data* posd,
- elfcpp::Elf_types<64>::Elf_Addr value);
+ elfcpp::Elf_types<64>::Elf_Addr avalue);
#endif
#ifdef HAVE_TARGET_32_LITTLE
// Set the visibility.
void
- set_visibility(elfcpp::STV visibility)
- { this->visibility_ = visibility; }
+ set_visibility(elfcpp::STV vis)
+ { this->visibility_ = vis; }
// Override symbol visibility.
void
unsigned int
got_offset(unsigned int got_type) const
{
- unsigned int got_offset = this->got_offsets_.get_offset(got_type);
- gold_assert(got_offset != -1U);
- return got_offset;
+ unsigned int got_off = this->got_offsets_.get_offset(got_type);
+ gold_assert(got_off != -1U);
+ return got_off;
}
// Set the GOT offset of this symbol.
void
- set_got_offset(unsigned int got_type, unsigned int got_offset)
- { this->got_offsets_.set_offset(got_type, got_offset); }
+ set_got_offset(unsigned int got_type, unsigned int got_off)
+ { this->got_offsets_.set_offset(got_type, got_off); }
// Return whether this symbol has an entry in the PLT section.
bool
// Set the PLT offset of this symbol.
void
- set_plt_offset(unsigned int plt_offset)
+ set_plt_offset(unsigned int plt_off)
{
this->has_plt_offset_ = true;
- this->plt_offset_ = plt_offset;
+ this->plt_offset_ = plt_off;
}
// Return whether this dynamic symbol needs a special value in the
bool is_ordinary;
if (this->source_ != FROM_OBJECT)
return this->source_ != IS_UNDEFINED;
- unsigned int shndx = this->shndx(&is_ordinary);
+ unsigned int sec_shndx = this->shndx(&is_ordinary);
return (is_ordinary
- ? shndx != elfcpp::SHN_UNDEF
- : !Symbol::is_common_shndx(shndx));
+ ? sec_shndx != elfcpp::SHN_UNDEF
+ : !Symbol::is_common_shndx(sec_shndx));
}
// Return true if this symbol is from a dynamic object.
if (this->source_ != FROM_OBJECT)
return false;
bool is_ordinary;
- unsigned int shndx = this->shndx(&is_ordinary);
- return !is_ordinary && Symbol::is_common_shndx(shndx);
+ unsigned int sec_shndx = this->shndx(&is_ordinary);
+ return !is_ordinary && Symbol::is_common_shndx(sec_shndx);
}
// Return whether this symbol can be seen outside this object.
// Set the symbol size. This is used when resolving common symbols.
void
- set_symsize(Size_type symsize)
- { this->symsize_ = symsize; }
+ set_symsize(Size_type symsz)
+ { this->symsize_ = symsz; }
// Set the symbol value. This is called when we store the final
// values of the symbols into the symbol table.
void
- set_value(Value_type value)
- { this->value_ = value; }
+ set_value(Value_type val)
+ { this->value_ = val; }
// Allocate a common symbol by giving it a location in the output
// file.
~Symbol_table();
void
- set_icf(Icf* icf)
- { this->icf_ = icf;}
+ set_icf(Icf* _icf)
+ { this->icf_ = _icf;}
Icf*
icf() const
is_section_folded(Object* obj, unsigned int shndx) const;
void
- set_gc(Garbage_collection* gc)
- { this->gc_ = gc; }
+ set_gc(Garbage_collection* garbage)
+ { this->gc_ = garbage; }
Garbage_collection*
gc() const
// target-select.cc -- select a target for an object file
-// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
// list. This runs at global constructor time, so we want it to be
// fast.
-Target_selector::Target_selector(int machine, int size, bool is_big_endian,
- const char* bfd_name)
- : machine_(machine), size_(size), is_big_endian_(is_big_endian),
- bfd_name_(bfd_name), instantiated_target_(NULL), lock_(NULL),
+Target_selector::Target_selector(int amachine, int size, bool is_big_end,
+ const char* bfdname)
+ : machine_(amachine), size_(size), is_big_endian_(is_big_end),
+ bfd_name_(bfdname), instantiated_target_(NULL), lock_(NULL),
initialize_lock_(&this->lock_)
{
// target-select.h -- select a target for an object file -*- C++ -*-
-// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
// If we can handle this target, return a pointer to a target
// structure. The size and endianness are known.
Target*
- recognize(int machine, int osabi, int abiversion)
- { return this->do_recognize(machine, osabi, abiversion); }
+ recognize(int mach, int osabi, int abiversion)
+ { return this->do_recognize(mach, osabi, abiversion); }
// If NAME matches the target, return a pointer to a target
// structure.
class Task_token
{
public:
- Task_token(bool is_blocker)
- : is_blocker_(is_blocker), blockers_(0), writer_(NULL), waiting_()
+ Task_token(bool tis_blocker)
+ : is_blocker_(tis_blocker), blockers_(0), writer_(NULL), waiting_()
{ }
~Task_token()
// workqueue.cc -- the workqueue for gold
-// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
// waiting for a Token.
void
-Workqueue::add_to_queue(Task_list* queue, Task* t, bool front)
+Workqueue::add_to_queue(Task_list* que, Task* t, bool front)
{
Hold_lock hl(this->lock_);
else
{
if (front)
- queue->push_front(t);
+ que->push_front(t);
else
- queue->push_back(t);
+ que->push_back(t);
// Tell any waiting thread that there is work to do.
this->condvar_.signal();
}
{
// The token has been unblocked. Every waiting Task may
// now be runnable.
- Task* t;
- while ((t = token->remove_first_waiting()) != NULL)
+ Task* tok;
+ while ((tok = token->remove_first_waiting()) != NULL)
{
--this->waiting_;
- this->return_or_queue(t, true, &ret);
+ this->return_or_queue(tok, true, &ret);
}
}
}
// move all the Tasks to the runnable queue, to avoid a
// potential deadlock if the locking status changes before
// we run the next thread.
- Task* t;
- while ((t = token->remove_first_waiting()) != NULL)
+ Task* tok;
+ while ((tok = token->remove_first_waiting()) != NULL)
{
--this->waiting_;
- if (this->return_or_queue(t, false, &ret))
+ if (this->return_or_queue(tok, false, &ret))
break;
}
}
// RUNNER and BLOCKER should be allocated using new, and will be
// deleted after the task runs.
Task_function(Task_function_runner* runner, Task_token* blocker,
- const char* name)
- : runner_(runner), blocker_(blocker), name_(name)
+ const char* tname)
+ : runner_(runner), blocker_(blocker), name_(tname)
{ }
~Task_function()
void
Output_data_plt_x86_64::do_write(Output_file* of)
{
- const off_t offset = this->offset();
+ const off_t off = this->offset();
const section_size_type oview_size =
convert_to_section_size_type(this->data_size());
- unsigned char* const oview = of->get_output_view(offset, oview_size);
+ unsigned char* const oview = of->get_output_view(off, oview_size);
const off_t got_file_offset = this->got_plt_->offset();
const section_size_type got_size =
gold_assert(static_cast<section_size_type>(pov - oview) == oview_size);
gold_assert(static_cast<section_size_type>(got_pov - got_view) == got_size);
- of->write_output_view(offset, oview_size, oview);
+ of->write_output_view(off, oview_size, oview);
of->write_output_view(got_file_offset, got_size, got_view);
}
+2009-12-11 Nick Clifton <nickc@redhat.com>
+
+ * Makefile.in: Regenerate.
+ * cg_arcs.c: Fix shadowed variable warnings.
+ * cg_dfn.c: Likewise.
+ * cg_print.c: Likewise.
+ * configure: Likewise.
+ * hist.c: Likewise.
+
2009-11-30 Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
am__aclocal_m4_deps = $(top_srcdir)/../bfd/warning.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
+ $(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../config/plugins.m4 \
$(top_srcdir)/../config/po.m4 \
$(top_srcdir)/../config/progtest.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
static void
propagate_flags (Sym **symbols)
{
- int index;
+ int sym_index;
Sym *old_head, *child;
old_head = 0;
- for (index = symtab.len - 1; index >= 0; --index)
+ for (sym_index = symtab.len - 1; sym_index >= 0; --sym_index)
{
- child = symbols[index];
+ child = symbols[sym_index];
/*
* If we haven't done this function or cycle, inherit things
* from parent. This way, we are linear in the number of arcs
}
-/*
- * Topologically sort the graph (collapsing cycles), and propagates
- * time bottom up and flags top down.
- */
+/* Topologically sort the graph (collapsing cycles), and propagates
+ time bottom up and flags top down. */
+
Sym **
-cg_assemble ()
+cg_assemble (void)
{
Sym *parent, **time_sorted_syms, **top_sorted_syms;
- unsigned int index;
+ unsigned int sym_index;
Arc *arc;
- /*
- * initialize various things:
- * zero out child times.
- * count self-recursive calls.
- * indicate that nothing is on cycles.
- */
+ /* Initialize various things:
+ Zero out child times.
+ Count self-recursive calls.
+ Indicate that nothing is on cycles. */
for (parent = symtab.base; parent < symtab.limit; parent++)
{
parent->cg.child_time = 0.0;
parent->cg.cyc.head = parent;
parent->cg.cyc.next = 0;
if (ignore_direct_calls)
- {
- find_call (parent, parent->addr, (parent + 1)->addr);
- }
+ find_call (parent, parent->addr, (parent + 1)->addr);
}
- /*
- * Topologically order things. If any node is unnumbered, number
- * it and any of its descendents.
- */
+
+ /* Topologically order things. If any node is unnumbered, number
+ it and any of its descendents. */
for (parent = symtab.base; parent < symtab.limit; parent++)
{
if (parent->cg.top_order == DFN_NAN)
- {
- cg_dfn (parent);
- }
+ cg_dfn (parent);
}
- /* link together nodes on the same cycle: */
+ /* Link together nodes on the same cycle. */
cycle_link ();
- /* sort the symbol table in reverse topological order: */
+ /* Sort the symbol table in reverse topological order. */
top_sorted_syms = (Sym **) xmalloc (symtab.len * sizeof (Sym *));
- for (index = 0; index < symtab.len; ++index)
- {
- top_sorted_syms[index] = &symtab.base[index];
- }
+ for (sym_index = 0; sym_index < symtab.len; ++sym_index)
+ top_sorted_syms[sym_index] = &symtab.base[sym_index];
+
qsort (top_sorted_syms, symtab.len, sizeof (Sym *), cmp_topo);
DBG (DFNDEBUG,
printf ("[cg_assemble] topological sort listing\n");
- for (index = 0; index < symtab.len; ++index)
- {
- printf ("[cg_assemble] ");
- printf ("%d:", top_sorted_syms[index]->cg.top_order);
- print_name (top_sorted_syms[index]);
- printf ("\n");
- }
+ for (sym_index = 0; sym_index < symtab.len; ++sym_index)
+ {
+ printf ("[cg_assemble] ");
+ printf ("%d:", top_sorted_syms[sym_index]->cg.top_order);
+ print_name (top_sorted_syms[sym_index]);
+ printf ("\n");
+ }
);
- /*
- * Starting from the topological top, propagate print flags to
- * children. also, calculate propagation fractions. this happens
- * before time propagation since time propagation uses the
- * fractions.
- */
+
+ /* Starting from the topological top, propagate print flags to
+ children. also, calculate propagation fractions. this happens
+ before time propagation since time propagation uses the
+ fractions. */
propagate_flags (top_sorted_syms);
- /*
- * Starting from the topological bottom, propogate children times
- * up to parents.
- */
+ /* Starting from the topological bottom, propogate children times
+ up to parents. */
cycle_time ();
- for (index = 0; index < symtab.len; ++index)
- {
- propagate_time (top_sorted_syms[index]);
- }
+ for (sym_index = 0; sym_index < symtab.len; ++sym_index)
+ propagate_time (top_sorted_syms[sym_index]);
free (top_sorted_syms);
- /*
- * Now, sort by CG.PROP.SELF + CG.PROP.CHILD. Sorting both the regular
- * function names and cycle headers.
- */
+ /* Now, sort by CG.PROP.SELF + CG.PROP.CHILD. Sorting both the regular
+ function names and cycle headers. */
time_sorted_syms = (Sym **) xmalloc ((symtab.len + num_cycles) * sizeof (Sym *));
- for (index = 0; index < symtab.len; index++)
- {
- time_sorted_syms[index] = &symtab.base[index];
- }
- for (index = 1; index <= num_cycles; index++)
- {
- time_sorted_syms[symtab.len + index - 1] = &cycle_header[index];
- }
+ for (sym_index = 0; sym_index < symtab.len; sym_index++)
+ time_sorted_syms[sym_index] = &symtab.base[sym_index];
+
+ for (sym_index = 1; sym_index <= num_cycles; sym_index++)
+ time_sorted_syms[symtab.len + sym_index - 1] = &cycle_header[sym_index];
+
qsort (time_sorted_syms, symtab.len + num_cycles, sizeof (Sym *),
cmp_total);
- for (index = 0; index < symtab.len + num_cycles; index++)
- {
- time_sorted_syms[index]->cg.index = index + 1;
- }
+
+ for (sym_index = 0; sym_index < symtab.len + num_cycles; sym_index++)
+ time_sorted_syms[sym_index]->cg.index = sym_index + 1;
+
return time_sorted_syms;
}
Sym *head = 0;
Sym *tail;
int cycle_top;
- int index;
+ int cycle_index;
for (cycle_top = dfn_depth; cycle_top > 0; --cycle_top)
{
print_name (head);
printf ("\n"));
}
- for (index = cycle_top + 1; index <= dfn_depth; ++index)
+ for (cycle_index = cycle_top + 1; cycle_index <= dfn_depth; ++cycle_index)
{
- child = dfn_stack[index].sym;
+ child = dfn_stack[cycle_index].sym;
if (child->cg.cyc.head == child)
{
/*
void
cg_print (Sym ** timesortsym)
{
- unsigned int index;
+ unsigned int sym_index;
Sym *parent;
if (print_descriptions && bsd_style_output)
print_header ();
- for (index = 0; index < symtab.len + num_cycles; ++index)
+ for (sym_index = 0; sym_index < symtab.len + num_cycles; ++sym_index)
{
- parent = timesortsym[index];
+ parent = timesortsym[sym_index];
if ((ignore_zeros && parent->ncalls == 0
&& parent->cg.self_calls == 0 && parent->cg.prop.self == 0
void
cg_print_index ()
{
- unsigned int index;
+ unsigned int sym_index;
unsigned int nnames, todo, i, j;
int col, starting_col;
Sym **name_sorted_syms, *sym;
alphabetically to create an index. */
name_sorted_syms = (Sym **) xmalloc ((symtab.len + num_cycles) * sizeof (Sym *));
- for (index = 0, nnames = 0; index < symtab.len; index++)
+ for (sym_index = 0, nnames = 0; sym_index < symtab.len; sym_index++)
{
- if (ignore_zeros && symtab.base[index].ncalls == 0
- && symtab.base[index].hist.time == 0)
+ if (ignore_zeros && symtab.base[sym_index].ncalls == 0
+ && symtab.base[sym_index].hist.time == 0)
continue;
- name_sorted_syms[nnames++] = &symtab.base[index];
+ name_sorted_syms[nnames++] = &symtab.base[sym_index];
}
qsort (name_sorted_syms, nnames, sizeof (Sym *), cmp_name);
- for (index = 1, todo = nnames; index <= num_cycles; index++)
- name_sorted_syms[todo++] = &cycle_header[index];
+ for (sym_index = 1, todo = nnames; sym_index <= num_cycles; sym_index++)
+ name_sorted_syms[todo++] = &cycle_header[sym_index];
printf ("\f\n");
printf (_("Index by function name\n\n"));
- index = (todo + 2) / 3;
+ sym_index = (todo + 2) / 3;
- for (i = 0; i < index; i++)
+ for (i = 0; i < sym_index; i++)
{
col = 0;
starting_col = 0;
- for (j = i; j < todo; j += index)
+ for (j = i; j < todo; j += sym_index)
{
sym = name_sorted_syms[j];
of function ordering). */
void
-cg_print_function_ordering ()
+cg_print_function_ordering (void)
{
- unsigned long index, used, unused, scratch_index;
+ unsigned long sym_index;
+ unsigned long arc_index;
+ unsigned long used, unused, scratch_index;
unsigned long unplaced_arc_count, high_arc_count, scratch_arc_count;
#ifdef __GNUC__
unsigned long long total_arcs, tmp_arcs_count;
Sym **unused_syms, **used_syms, **scratch_syms;
Arc **unplaced_arcs, **high_arcs, **scratch_arcs;
- index = 0;
+ sym_index = 0;
used = 0;
unused = 0;
scratch_index = 0;
/* Walk through all the functions; mark those which are never
called as placed (we'll emit them as a group later). */
- for (index = 0, used = 0, unused = 0; index < symtab.len; index++)
+ for (sym_index = 0, used = 0, unused = 0; sym_index < symtab.len; sym_index++)
{
- if (symtab.base[index].ncalls == 0)
+ if (symtab.base[sym_index].ncalls == 0)
{
- unused_syms[unused++] = &symtab.base[index];
- symtab.base[index].has_been_placed = 1;
+ unused_syms[unused++] = &symtab.base[sym_index];
+ symtab.base[sym_index].has_been_placed = 1;
}
else
{
- used_syms[used++] = &symtab.base[index];
- symtab.base[index].has_been_placed = 0;
- symtab.base[index].next = 0;
- symtab.base[index].prev = 0;
- symtab.base[index].nuses = 0;
+ used_syms[used++] = &symtab.base[sym_index];
+ symtab.base[sym_index].has_been_placed = 0;
+ symtab.base[sym_index].next = 0;
+ symtab.base[sym_index].prev = 0;
+ symtab.base[sym_index].nuses = 0;
}
}
Overflow is much less likely when this file is compiled
with GCC as it can double-wide integers via long long. */
total_arcs = 0;
- for (index = 0; index < numarcs; index++)
+ for (arc_index = 0; arc_index < numarcs; arc_index++)
{
- total_arcs += arcs[index]->count;
- arcs[index]->has_been_placed = 0;
+ total_arcs += arcs[arc_index]->count;
+ arcs[arc_index]->has_been_placed = 0;
}
/* We want to pull out those functions which are referenced
by many highly used arcs and emit them as a group. This
could probably use some tuning. */
tmp_arcs_count = 0;
- for (index = 0; index < numarcs; index++)
+ for (arc_index = 0; arc_index < numarcs; arc_index++)
{
- tmp_arcs_count += arcs[index]->count;
+ tmp_arcs_count += arcs[arc_index]->count;
/* Count how many times each parent and child are used up
to our threshhold of arcs (90%). */
if ((double)tmp_arcs_count / (double)total_arcs > 0.90)
break;
- arcs[index]->child->nuses++;
+ arcs[arc_index]->child->nuses++;
}
/* Now sort a temporary symbol table based on the number of
/* Now pick out those symbols we're going to emit as
a group. We take up to 1.25% of the used symbols. */
- for (index = 0; index < used / 80; index++)
+ for (sym_index = 0; sym_index < used / 80; sym_index++)
{
- Sym *sym = scratch_syms[index];
+ Sym *sym = scratch_syms[sym_index];
Arc *arc;
/* If we hit symbols that aren't used from many call sites,
}
/* Keep track of how many symbols we're going to place. */
- scratch_index = index;
+ scratch_index = sym_index;
/* A lie, but it makes identifying
these functions easier later. */
/* Now walk through the temporary arcs and copy
those we care about into the high arcs array. */
- for (index = 0; index < scratch_arc_count; index++)
+ for (arc_index = 0; arc_index < scratch_arc_count; arc_index++)
{
- Arc *arc = scratch_arcs[index];
+ Arc *arc = scratch_arcs[arc_index];
/* If this arc refers to highly used functions, then
then we want to keep it. */
if (arc->child->has_been_placed
&& arc->parent->has_been_placed)
{
- high_arcs[high_arc_count++] = scratch_arcs[index];
+ high_arcs[high_arc_count++] = scratch_arcs[arc_index];
/* We need to turn of has_been_placed since we're going to
use the main arc placement algorithm on these arcs. */
/* Dump the multi-site high usage functions which are not
going to be ordered by the main ordering algorithm. */
- for (index = 0; index < scratch_index; index++)
+ for (sym_index = 0; sym_index < scratch_index; sym_index++)
{
- if (scratch_syms[index]->has_been_placed)
- printf ("%s\n", scratch_syms[index]->name);
+ if (scratch_syms[sym_index]->has_been_placed)
+ printf ("%s\n", scratch_syms[sym_index]->name);
}
/* Now we can order the multi-site high use
scratch_arcs, &scratch_arc_count);
/* Output any functions not emitted by the order_and_dump calls. */
- for (index = 0; index < used; index++)
- if (used_syms[index]->has_been_placed == 0)
- printf("%s\n", used_syms[index]->name);
+ for (sym_index = 0; sym_index < used; sym_index++)
+ if (used_syms[sym_index]->has_been_placed == 0)
+ printf("%s\n", used_syms[sym_index]->name);
/* Output the unused functions. */
- for (index = 0; index < unused; index++)
- printf("%s\n", unused_syms[index]->name);
+ for (sym_index = 0; sym_index < unused; sym_index++)
+ printf("%s\n", unused_syms[sym_index]->name);
unused_syms = (Sym **) xmalloc (symtab.len * sizeof (Sym *));
used_syms = (Sym **) xmalloc (symtab.len * sizeof (Sym *));
#else
unsigned long tmp_arcs, total_arcs;
#endif
- unsigned int index;
+ unsigned int arc_index;
/* If needed, compute the total arc count.
if (! all)
{
total_arcs = 0;
- for (index = 0; index < arc_count; index++)
- total_arcs += the_arcs[index]->count;
+ for (arc_index = 0; arc_index < arc_count; arc_index++)
+ total_arcs += the_arcs[arc_index]->count;
}
else
total_arcs = 0;
tmp_arcs = 0;
- for (index = 0; index < arc_count; index++)
+ for (arc_index = 0; arc_index < arc_count; arc_index++)
{
Sym *sym1, *sym2;
Sym *child, *parent;
- tmp_arcs += the_arcs[index]->count;
+ tmp_arcs += the_arcs[arc_index]->count;
/* Ignore this arc if it's already been placed. */
- if (the_arcs[index]->has_been_placed)
+ if (the_arcs[arc_index]->has_been_placed)
continue;
- child = the_arcs[index]->child;
- parent = the_arcs[index]->parent;
+ child = the_arcs[arc_index]->child;
+ parent = the_arcs[arc_index]->parent;
/* If we're not using all arcs, and this is a rarely used
arc, then put it on the unplaced_arc list. Similarly
if ((! all && (double)tmp_arcs / (double)total_arcs > MOST)
|| child->has_been_placed || parent->has_been_placed)
{
- unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
+ unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[arc_index];
continue;
}
algorithm can use it to place function chains. */
if (parent->next && parent->prev && child->next && child->prev)
{
- unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
+ unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[arc_index];
continue;
}
{
/* Couldn't find anywhere to attach the functions,
put the arc on the unplaced arc list. */
- unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
+ unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[arc_index];
continue;
}
&& sym2 == parent)
{
/* This would tie two ends together. */
- unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
+ unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[arc_index];
continue;
}
/* parent-prev and child-next */
parent->prev = child;
child->next = parent;
- the_arcs[index]->has_been_placed = 1;
+ the_arcs[arc_index]->has_been_placed = 1;
}
}
else if (parent->prev)
/* parent-next and child-prev */
parent->next = child;
child->prev = parent;
- the_arcs[index]->has_been_placed = 1;
+ the_arcs[arc_index]->has_been_placed = 1;
}
}
else
/* parent-prev and child-next. */
parent->prev = child;
child->next = parent;
- the_arcs[index]->has_been_placed = 1;
+ the_arcs[arc_index]->has_been_placed = 1;
}
else
{
/* parent-next and child-prev. */
parent->next = child;
child->prev = parent;
- the_arcs[index]->has_been_placed = 1;
+ the_arcs[arc_index]->has_been_placed = 1;
}
}
}
/* Dump the chains of functions we've made. */
- for (index = 0; index < arc_count; index++)
+ for (arc_index = 0; arc_index < arc_count; arc_index++)
{
Sym *sym;
- if (the_arcs[index]->parent->has_been_placed
- || the_arcs[index]->child->has_been_placed)
+ if (the_arcs[arc_index]->parent->has_been_placed
+ || the_arcs[arc_index]->child->has_been_placed)
continue;
- sym = the_arcs[index]->parent;
+ sym = the_arcs[arc_index]->parent;
/* If this symbol isn't attached to any other
symbols, then we've got a rarely used arc.
/* If we want to place all the arcs, then output
those which weren't placed by the main algorithm. */
if (all)
- for (index = 0; index < arc_count; index++)
+ for (arc_index = 0; arc_index < arc_count; arc_index++)
{
Sym *sym;
- if (the_arcs[index]->parent->has_been_placed
- || the_arcs[index]->child->has_been_placed)
+ if (the_arcs[arc_index]->parent->has_been_placed
+ || the_arcs[arc_index]->child->has_been_placed)
continue;
- sym = the_arcs[index]->parent;
+ sym = the_arcs[arc_index]->parent;
sym->has_been_placed = 1;
printf ("%s\n", sym->name);
void
cg_print_file_ordering (void)
{
- unsigned long scratch_arc_count, index;
+ unsigned long scratch_arc_count;
+ unsigned long arc_index;
+ unsigned long sym_index;
Arc **scratch_arcs;
char *last;
scratch_arc_count = 0;
scratch_arcs = (Arc **) xmalloc (numarcs * sizeof (Arc *));
- for (index = 0; index < numarcs; index++)
+ for (arc_index = 0; arc_index < numarcs; arc_index++)
{
- if (! arcs[index]->parent->mapped
- || ! arcs[index]->child->mapped)
- arcs[index]->has_been_placed = 1;
+ if (! arcs[arc_index]->parent->mapped
+ || ! arcs[arc_index]->child->mapped)
+ arcs[arc_index]->has_been_placed = 1;
}
order_and_dump_functions_by_arcs (arcs, numarcs, 0,
scratch_arcs, &scratch_arc_count);
/* Output .o's not handled by the main placement algorithm. */
- for (index = 0; index < symtab.len; index++)
+ for (sym_index = 0; sym_index < symtab.len; sym_index++)
{
- if (symtab.base[index].mapped
- && ! symtab.base[index].has_been_placed)
- printf ("%s\n", symtab.base[index].name);
+ if (symtab.base[sym_index].mapped
+ && ! symtab.base[sym_index].has_been_placed)
+ printf ("%s\n", symtab.base[sym_index].name);
}
qsort (symbol_map, symbol_map_count, sizeof (struct function_map), cmp_symbol_map);
/* Now output any .o's that didn't have any text symbols. */
last = NULL;
- for (index = 0; index < symbol_map_count; index++)
+ for (sym_index = 0; sym_index < symbol_map_count; sym_index++)
{
unsigned int index2;
/* Don't bother searching if this symbol
is the same as the previous one. */
- if (last && !strcmp (last, symbol_map[index].file_name))
+ if (last && !strcmp (last, symbol_map[sym_index].file_name))
continue;
for (index2 = 0; index2 < symtab.len; index2++)
if (! symtab.base[index2].mapped)
continue;
- if (!strcmp (symtab.base[index2].name, symbol_map[index].file_name))
+ if (!strcmp (symtab.base[index2].name, symbol_map[sym_index].file_name))
break;
}
/* If we didn't find it in the symbol table, then it must
be a .o with no text symbols. Output it last. */
if (index2 == symtab.len)
- printf ("%s\n", symbol_map[index].file_name);
- last = symbol_map[index].file_name;
+ printf ("%s\n", symbol_map[sym_index].file_name);
+ last = symbol_map[sym_index].file_name;
}
}
-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.
if test "${enable_werror+set}" = set; then :
bfd_vma overlap, addr;
unsigned int bin_count;
unsigned int i, j;
- double time, credit;
+ double count_time, credit;
bfd_vma lowpc = r->lowpc / sizeof (UNIT);
bin_low_pc = lowpc + (bfd_vma) (hist_scale * i);
bin_high_pc = lowpc + (bfd_vma) (hist_scale * (i + 1));
- time = bin_count;
+ count_time = bin_count;
DBG (SAMPLEDEBUG,
printf (
(unsigned long) (sizeof (UNIT) * bin_low_pc),
(unsigned long) (sizeof (UNIT) * bin_high_pc),
bin_count));
- total_time += time;
+ total_time += count_time;
/* Credit all symbols that are covered by bin I. */
for (j = j - 1; j < symtab.len; ++j)
"[assign_samples] [0x%lx,0x%lx) %s gets %f ticks %ld overlap\n",
(unsigned long) symtab.base[j].addr,
(unsigned long) (sizeof (UNIT) * sym_high_pc),
- symtab.base[j].name, overlap * time / hist_scale,
+ symtab.base[j].name, overlap * count_time / hist_scale,
(long) overlap));
addr = symtab.base[j].addr;
- credit = overlap * time / hist_scale;
+ credit = overlap * count_time / hist_scale;
/* Credit symbol if it appears in INCL_FLAT or that
table is empty and it does not appear it in
hist_print ()
{
Sym **time_sorted_syms, *top_dog, *sym;
- unsigned int index;
+ unsigned int sym_index;
unsigned log_scale;
- double top_time, time;
+ double top_time;
bfd_vma addr;
if (first_output)
and tertiary keys). */
time_sorted_syms = (Sym **) xmalloc (symtab.len * sizeof (Sym *));
- for (index = 0; index < symtab.len; ++index)
- time_sorted_syms[index] = &symtab.base[index];
+ for (sym_index = 0; sym_index < symtab.len; ++sym_index)
+ time_sorted_syms[sym_index] = &symtab.base[sym_index];
qsort (time_sorted_syms, symtab.len, sizeof (Sym *), cmp_time);
top_dog = 0;
top_time = 0.0;
- for (index = 0; index < symtab.len; ++index)
+ for (sym_index = 0; sym_index < symtab.len; ++sym_index)
{
- sym = time_sorted_syms[index];
+ sym = time_sorted_syms[sym_index];
if (sym->ncalls != 0)
{
- time = (sym->hist.time + sym->cg.child_time) / sym->ncalls;
+ double call_time;
- if (time > top_time)
+ call_time = (sym->hist.time + sym->cg.child_time) / sym->ncalls;
+
+ if (call_time > top_time)
{
top_dog = sym;
- top_time = time;
+ top_time = call_time;
}
}
}
I-cache misses etc.). */
print_header (SItab[log_scale].prefix);
- for (index = 0; index < symtab.len; ++index)
+ for (sym_index = 0; sym_index < symtab.len; ++sym_index)
{
- addr = time_sorted_syms[index]->addr;
+ addr = time_sorted_syms[sym_index]->addr;
/* Print symbol if its in INCL_FLAT table or that table
is empty and the symbol is not in EXCL_FLAT. */
if (sym_lookup (&syms[INCL_FLAT], addr)
|| (syms[INCL_FLAT].len == 0
&& !sym_lookup (&syms[EXCL_FLAT], addr)))
- print_line (time_sorted_syms[index], SItab[log_scale].scale);
+ print_line (time_sorted_syms[sym_index], SItab[log_scale].scale);
}
free (time_sorted_syms);
+2009-12-11 Nick Clifton <nickc@redhat.com>
+
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * deffilep.y: Fix shadowed variable warnings.
+ * ldlang.c: Likewise.
+ * ldmain.c: Likewise.
+ * pe-dll.c: Likewise.
+ * emultempl/elf32.em: Likewise.
+
2009-12-09 Alan Modra <amodra@bigpond.net.au>
PR ld/11012
$(srcdir)/../ylwrap $(ld_TEXINFOS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
+ $(top_srcdir)/../config/zlib.m4 \
$(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
+ $(top_srcdir)/../config/largefile.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../config/plugins.m4 \
$(top_srcdir)/../config/po.m4 \
$(top_srcdir)/../config/progtest.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
esac
-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.
if test "${enable_werror+set}" = set; then :
}
void
-def_file_free (def_file *def)
+def_file_free (def_file *fdef)
{
int i;
- if (!def)
+ if (!fdef)
return;
- if (def->name)
- free (def->name);
- if (def->description)
- free (def->description);
+ if (fdef->name)
+ free (fdef->name);
+ if (fdef->description)
+ free (fdef->description);
- if (def->section_defs)
+ if (fdef->section_defs)
{
- for (i = 0; i < def->num_section_defs; i++)
+ for (i = 0; i < fdef->num_section_defs; i++)
{
- if (def->section_defs[i].name)
- free (def->section_defs[i].name);
- if (def->section_defs[i].class)
- free (def->section_defs[i].class);
+ if (fdef->section_defs[i].name)
+ free (fdef->section_defs[i].name);
+ if (fdef->section_defs[i].class)
+ free (fdef->section_defs[i].class);
}
- free (def->section_defs);
+ free (fdef->section_defs);
}
- if (def->exports)
+ if (fdef->exports)
{
for (i = 0; i < def->num_exports; i++)
{
- if (def->exports[i].internal_name
- && def->exports[i].internal_name != def->exports[i].name)
- free (def->exports[i].internal_name);
- if (def->exports[i].name)
- free (def->exports[i].name);
- if (def->exports[i].its_name)
- free (def->exports[i].its_name);
+ if (fdef->exports[i].internal_name
+ && fdef->exports[i].internal_name != fdef->exports[i].name)
+ free (fdef->exports[i].internal_name);
+ if (fdef->exports[i].name)
+ free (fdef->exports[i].name);
+ if (fdef->exports[i].its_name)
+ free (fdef->exports[i].its_name);
}
- free (def->exports);
+ free (fdef->exports);
}
- if (def->imports)
+ if (fdef->imports)
{
- for (i = 0; i < def->num_imports; i++)
+ for (i = 0; i < fdef->num_imports; i++)
{
- if (def->imports[i].internal_name
- && def->imports[i].internal_name != def->imports[i].name)
- free (def->imports[i].internal_name);
- if (def->imports[i].name)
- free (def->imports[i].name);
- if (def->imports[i].its_name)
- free (def->imports[i].its_name);
+ if (fdef->imports[i].internal_name
+ && fdef->imports[i].internal_name != fdef->imports[i].name)
+ free (fdef->imports[i].internal_name);
+ if (fdef->imports[i].name)
+ free (fdef->imports[i].name);
+ if (fdef->imports[i].its_name)
+ free (fdef->imports[i].its_name);
}
- free (def->imports);
+ free (fdef->imports);
}
- while (def->modules)
+ while (fdef->modules)
{
- def_file_module *m = def->modules;
- def->modules = def->modules->next;
+ def_file_module *m = fdef->modules;
+
+ fdef->modules = fdef->modules->next;
free (m);
}
- while (def->aligncomms)
+ while (fdef->aligncomms)
{
- def_file_aligncomm *c = def->aligncomms;
- def->aligncomms = def->aligncomms->next;
+ def_file_aligncomm *c = fdef->aligncomms;
+
+ fdef->aligncomms = fdef->aligncomms->next;
free (c->symbol_name);
free (c);
}
- free (def);
+ free (fdef);
}
#ifdef DEF_FILE_PRINT
void
-def_file_print (FILE *file, def_file *def)
+def_file_print (FILE *file, def_file *fdef)
{
int i;
- fprintf (file, ">>>> def_file at 0x%08x\n", def);
- if (def->name)
- fprintf (file, " name: %s\n", def->name ? def->name : "(unspecified)");
- if (def->is_dll != -1)
- fprintf (file, " is dll: %s\n", def->is_dll ? "yes" : "no");
- if (def->base_address != (bfd_vma) -1)
- fprintf (file, " base address: 0x%08x\n", def->base_address);
- if (def->description)
- fprintf (file, " description: `%s'\n", def->description);
- if (def->stack_reserve != -1)
- fprintf (file, " stack reserve: 0x%08x\n", def->stack_reserve);
- if (def->stack_commit != -1)
- fprintf (file, " stack commit: 0x%08x\n", def->stack_commit);
- if (def->heap_reserve != -1)
- fprintf (file, " heap reserve: 0x%08x\n", def->heap_reserve);
- if (def->heap_commit != -1)
- fprintf (file, " heap commit: 0x%08x\n", def->heap_commit);
-
- if (def->num_section_defs > 0)
+ fprintf (file, ">>>> def_file at 0x%08x\n", fdef);
+ if (fdef->name)
+ fprintf (file, " name: %s\n", fdef->name ? fdef->name : "(unspecified)");
+ if (fdef->is_dll != -1)
+ fprintf (file, " is dll: %s\n", fdef->is_dll ? "yes" : "no");
+ if (fdef->base_address != (bfd_vma) -1)
+ fprintf (file, " base address: 0x%08x\n", fdef->base_address);
+ if (fdef->description)
+ fprintf (file, " description: `%s'\n", fdef->description);
+ if (fdef->stack_reserve != -1)
+ fprintf (file, " stack reserve: 0x%08x\n", fdef->stack_reserve);
+ if (fdef->stack_commit != -1)
+ fprintf (file, " stack commit: 0x%08x\n", fdef->stack_commit);
+ if (fdef->heap_reserve != -1)
+ fprintf (file, " heap reserve: 0x%08x\n", fdef->heap_reserve);
+ if (fdef->heap_commit != -1)
+ fprintf (file, " heap commit: 0x%08x\n", fdef->heap_commit);
+
+ if (fdef->num_section_defs > 0)
{
fprintf (file, " section defs:\n");
- for (i = 0; i < def->num_section_defs; i++)
+ for (i = 0; i < fdef->num_section_defs; i++)
{
fprintf (file, " name: `%s', class: `%s', flags:",
- def->section_defs[i].name, def->section_defs[i].class);
- if (def->section_defs[i].flag_read)
+ fdef->section_defs[i].name, fdef->section_defs[i].class);
+ if (fdef->section_defs[i].flag_read)
fprintf (file, " R");
- if (def->section_defs[i].flag_write)
+ if (fdef->section_defs[i].flag_write)
fprintf (file, " W");
- if (def->section_defs[i].flag_execute)
+ if (fdef->section_defs[i].flag_execute)
fprintf (file, " X");
- if (def->section_defs[i].flag_shared)
+ if (fdef->section_defs[i].flag_shared)
fprintf (file, " S");
fprintf (file, "\n");
}
}
- if (def->num_exports > 0)
+ if (fdef->num_exports > 0)
{
fprintf (file, " exports:\n");
- for (i = 0; i < def->num_exports; i++)
+ for (i = 0; i < fdef->num_exports; i++)
{
fprintf (file, " name: `%s', int: `%s', ordinal: %d, flags:",
- def->exports[i].name, def->exports[i].internal_name,
- def->exports[i].ordinal);
- if (def->exports[i].flag_private)
+ fdef->exports[i].name, fdef->exports[i].internal_name,
+ fdef->exports[i].ordinal);
+ if (fdef->exports[i].flag_private)
fprintf (file, " P");
- if (def->exports[i].flag_constant)
+ if (fdef->exports[i].flag_constant)
fprintf (file, " C");
- if (def->exports[i].flag_noname)
+ if (fdef->exports[i].flag_noname)
fprintf (file, " N");
- if (def->exports[i].flag_data)
+ if (fdef->exports[i].flag_data)
fprintf (file, " D");
fprintf (file, "\n");
}
}
- if (def->num_imports > 0)
+ if (fdef->num_imports > 0)
{
fprintf (file, " imports:\n");
- for (i = 0; i < def->num_imports; i++)
+ for (i = 0; i < fdef->num_imports; i++)
{
fprintf (file, " int: %s, from: `%s', name: `%s', ordinal: %d\n",
- def->imports[i].internal_name,
- def->imports[i].module,
- def->imports[i].name,
- def->imports[i].ordinal);
+ fdef->imports[i].internal_name,
+ fdef->imports[i].module,
+ fdef->imports[i].name,
+ fdef->imports[i].ordinal);
}
}
- if (def->version_major != -1)
- fprintf (file, " version: %d.%d\n", def->version_major, def->version_minor);
+ if (fdef->version_major != -1)
+ fprintf (file, " version: %d.%d\n", fdef->version_major, fdef->version_minor);
fprintf (file, "<<<< def_file at 0x%08x\n", def);
}
#endif
def_file_export *
-def_file_add_export (def_file *def,
+def_file_add_export (def_file *fdef,
const char *external_name,
const char *internal_name,
int ordinal,
const char *its_name)
{
def_file_export *e;
- int max_exports = ROUND_UP(def->num_exports, 32);
+ int max_exports = ROUND_UP(fdef->num_exports, 32);
- if (def->num_exports >= max_exports)
+ if (fdef->num_exports >= max_exports)
{
- max_exports = ROUND_UP(def->num_exports + 1, 32);
- if (def->exports)
- def->exports = xrealloc (def->exports,
+ max_exports = ROUND_UP(fdef->num_exports + 1, 32);
+ if (fdef->exports)
+ fdef->exports = xrealloc (fdef->exports,
max_exports * sizeof (def_file_export));
else
- def->exports = xmalloc (max_exports * sizeof (def_file_export));
+ fdef->exports = xmalloc (max_exports * sizeof (def_file_export));
}
- e = def->exports + def->num_exports;
+ e = fdef->exports + fdef->num_exports;
memset (e, 0, sizeof (def_file_export));
if (internal_name && !external_name)
external_name = internal_name;
e->internal_name = xstrdup (internal_name);
e->its_name = (its_name ? xstrdup (its_name) : NULL);
e->ordinal = ordinal;
- def->num_exports++;
+ fdef->num_exports++;
return e;
}
def_file_module *
-def_get_module (def_file *def, const char *name)
+def_get_module (def_file *fdef, const char *name)
{
def_file_module *s;
- for (s = def->modules; s; s = s->next)
+ for (s = fdef->modules; s; s = s->next)
if (strcmp (s->name, name) == 0)
return s;
}
static def_file_module *
-def_stash_module (def_file *def, const char *name)
+def_stash_module (def_file *fdef, const char *name)
{
def_file_module *s;
- if ((s = def_get_module (def, name)) != NULL)
+ if ((s = def_get_module (fdef, name)) != NULL)
return s;
s = xmalloc (sizeof (def_file_module) + strlen (name));
s->next = def->modules;
- def->modules = s;
+ fdef->modules = s;
s->user_data = 0;
strcpy (s->name, name);
return s;
}
def_file_import *
-def_file_add_import (def_file *def,
+def_file_add_import (def_file *fdef,
const char *name,
const char *module,
int ordinal,
const char *its_name)
{
def_file_import *i;
- int max_imports = ROUND_UP (def->num_imports, 16);
+ int max_imports = ROUND_UP (fdef->num_imports, 16);
- if (def->num_imports >= max_imports)
+ if (fdef->num_imports >= max_imports)
{
- max_imports = ROUND_UP (def->num_imports+1, 16);
+ max_imports = ROUND_UP (fdef->num_imports+1, 16);
- if (def->imports)
- def->imports = xrealloc (def->imports,
+ if (fdef->imports)
+ fdef->imports = xrealloc (fdef->imports,
max_imports * sizeof (def_file_import));
else
- def->imports = xmalloc (max_imports * sizeof (def_file_import));
+ fdef->imports = xmalloc (max_imports * sizeof (def_file_import));
}
- i = def->imports + def->num_imports;
+ i = fdef->imports + fdef->num_imports;
memset (i, 0, sizeof (def_file_import));
if (name)
i->name = xstrdup (name);
else
i->internal_name = i->name;
i->its_name = (its_name ? xstrdup (its_name) : NULL);
- def->num_imports++;
+ fdef->num_imports++;
return i;
}
for (i = 0; diropts[i].param; i++)
{
- int len = strlen (diropts[i].param);
+ len = strlen (diropts[i].param);
if (tend - param >= len
&& strncmp (param, diropts[i].param, len) == 0
if (*name)
{
const char* image_name = lbasename (name);
+
if (image_name != name)
einfo ("%s:%d: Warning: path components stripped from %s, '%s'\n",
def_filename, linenumber, is_dll ? "LIBRARY" : "NAME",
if (! force)
{
- struct bfd_link_needed_list *needed;
+ struct bfd_link_needed_list *needs;
- if (! bfd_elf_get_bfd_needed_list (abfd, &needed))
+ if (! bfd_elf_get_bfd_needed_list (abfd, &needs))
einfo ("%F%P:%B: bfd_elf_get_bfd_needed_list failed: %E\n", abfd);
- if (needed != NULL)
+ if (needs != NULL)
{
- global_vercheck_needed = needed;
+ global_vercheck_needed = needs;
global_vercheck_failed = FALSE;
lang_for_each_input_file (gld${EMULATION_NAME}_vercheck);
if (global_vercheck_failed)
{
struct bfd_link_needed_list *l;
- for (l = needed; l != NULL; l = l->next)
+ for (l = needs; l != NULL; l = l->next)
if (CONST_STRNEQ (l->name, "libc.so"))
break;
if (l == NULL)
static bfd_size_type
gld${EMULATION_NAME}_id_note_section_size (bfd *abfd,
- struct bfd_link_info *link_info)
+ struct bfd_link_info *linfo)
{
- const char *style = link_info->emit_note_gnu_build_id;
+ const char *style = linfo->emit_note_gnu_build_id;
bfd_size_type size;
abfd = abfd;
/* used by before_allocation and handle_option. */
static void
-gld${EMULATION_NAME}_append_to_separated_string (char **to, char *optarg)
+gld${EMULATION_NAME}_append_to_separated_string (char **to, char *op_arg)
{
if (*to == NULL)
- *to = xstrdup (optarg);
+ *to = xstrdup (op_arg);
else
{
size_t to_len = strlen (*to);
- size_t optarg_len = strlen (optarg);
+ size_t op_arg_len = strlen (op_arg);
char *buf;
char *cp = *to;
/* First see whether OPTARG is already in the path. */
do
{
- if (strncmp (optarg, cp, optarg_len) == 0
- && (cp[optarg_len] == 0
- || cp[optarg_len] == config.rpath_separator))
+ if (strncmp (op_arg, cp, op_arg_len) == 0
+ && (cp[op_arg_len] == 0
+ || cp[op_arg_len] == config.rpath_separator))
/* We found it. */
break;
if (cp == NULL)
{
- buf = xmalloc (to_len + optarg_len + 2);
+ buf = xmalloc (to_len + op_arg_len + 2);
sprintf (buf, "%s%c%s", *to,
- config.rpath_separator, optarg);
+ config.rpath_separator, op_arg);
free (*to);
*to = buf;
}
} section_iterator_callback_data;
static bfd_boolean
-section_iterator_callback (bfd *bfd ATTRIBUTE_UNUSED, asection *s, void *data)
+section_iterator_callback (bfd *abfd ATTRIBUTE_UNUSED, asection *s, void *data)
{
section_iterator_callback_data *d = (section_iterator_callback_data *) data;
{
bfd_boolean first;
lang_input_section_type *new_section;
- flagword flags;
-
- flags = section->flags;
/* We don't copy the SEC_NEVER_LOAD flag from an input section
to an output section, because we want to be able to include a
section (I don't know why we want to do this, but we do).
build_link_order in ldwrite.c handles this case by turning
the embedded SEC_NEVER_LOAD section into a fill. */
-
flags &= ~ SEC_NEVER_LOAD;
switch (output->sectype)
os_region_check (lang_output_section_statement_type *os,
lang_memory_region_type *region,
etree_type *tree,
- bfd_vma base)
+ bfd_vma rbase)
{
if ((region->current < region->origin
|| (region->current - region->origin > region->length))
&& ((region->current != region->origin + region->length)
- || base == 0))
+ || rbase == 0))
{
if (tree != NULL)
{
einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
else
{
- struct warning_callback_info info;
+ struct warning_callback_info cinfo;
/* Look through the relocs to see if we can find a plausible
address. */
if (!bfd_generic_link_read_symbols (abfd))
einfo (_("%B%F: could not read symbols: %E\n"), abfd);
- info.found = FALSE;
- info.warning = warning;
- info.symbol = symbol;
- info.asymbols = bfd_get_outsymbols (abfd);
- bfd_map_over_sections (abfd, warning_find_reloc, &info);
+ cinfo.found = FALSE;
+ cinfo.warning = warning;
+ cinfo.symbol = symbol;
+ cinfo.asymbols = bfd_get_outsymbols (abfd);
+ bfd_map_over_sections (abfd, warning_find_reloc, &cinfo);
- if (! info.found)
+ if (! cinfo.found)
einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
}
for (bi = 0, b = info->input_bfds; b; bi++, b = b->link_next)
{
arelent **relocs;
- int relsize, nrelocs, i;
+ int relsize, nrelocs;
for (s = b->sections; s; s = s->next)
{
static bfd *
make_import_fixup_entry (const char *name,
const char *fixup_name,
- const char *dll_symname,
+ const char *symname,
bfd *parent)
{
asection *id2;
id2 = quick_section (abfd, ".idata$2", SEC_HAS_CONTENTS, 2);
quick_symbol (abfd, U ("_nm_thnk_"), name, "", UNDSEC, BSF_GLOBAL, 0);
- quick_symbol (abfd, U (""), dll_symname, "_iname", UNDSEC, BSF_GLOBAL, 0);
+ quick_symbol (abfd, U (""), symname, "_iname", UNDSEC, BSF_GLOBAL, 0);
/* For relocator v2 we have to use the .idata$5 element and not
fixup_name. */
if (link_info.pei386_runtime_pseudo_reloc == 2)
if (need_import_table == 1
&& (!name_thunk_sym || name_thunk_sym->type != bfd_link_hash_defined))
{
- bfd *b = make_singleton_name_thunk (name, link_info.output_bfd);
+ b = make_singleton_name_thunk (name, link_info.output_bfd);
add_bfd_to_link (b, b->filename, &link_info);
/* If we ever use autoimport, we have to cast text section writable.
&& need_import_table == 1)
{
extern char * pe_data_import_dll;
- char * dll_symname = pe_data_import_dll ? pe_data_import_dll : "unknown";
+ char * symname = pe_data_import_dll ? pe_data_import_dll : "unknown";
- b = make_import_fixup_entry (name, fixup_name, dll_symname,
+ b = make_import_fixup_entry (name, fixup_name, symname,
link_info.output_bfd);
add_bfd_to_link (b, b->filename, &link_info);
}
}
static void
-add_bfd_to_link (bfd *abfd, const char *name, struct bfd_link_info *link_info)
+add_bfd_to_link (bfd *abfd, const char *name, struct bfd_link_info *linfo)
{
lang_input_statement_type *fake_file;
fake_file->the_bfd = abfd;
ldlang_add_file (fake_file);
- if (!bfd_link_add_symbols (abfd, link_info))
+ if (!bfd_link_add_symbols (abfd, linfo))
einfo ("%Xaddsym %s: %E\n", name);
}
void
-pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *link_info)
+pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *linfo)
{
def_file_module *module;
sprintf (name, "%s%s",U (""),
pe_def_file->imports[i].internal_name);
- blhe = bfd_link_hash_lookup (link_info->hash, name,
+ blhe = bfd_link_hash_lookup (linfo->hash, name,
FALSE, FALSE, FALSE);
/* Include the jump stub for <sym> only if the <sym>
sprintf (name, "%s%s%s", "__imp_", U (""),
pe_def_file->imports[i].internal_name);
- blhe = bfd_link_hash_lookup (link_info->hash, name,
+ blhe = bfd_link_hash_lookup (linfo->hash, name,
FALSE, FALSE, FALSE);
}
else
if (!do_this_dll)
{
bfd *ar_head = make_head (output_bfd);
- add_bfd_to_link (ar_head, ar_head->filename, link_info);
+ add_bfd_to_link (ar_head, ar_head->filename, linfo);
do_this_dll = 1;
}
exp.internal_name = pe_def_file->imports[i].internal_name;
exp.flag_data = pe_def_file->imports[i].data;
exp.flag_noname = exp.name ? 0 : 1;
one = make_one (&exp, output_bfd, (! exp.flag_data) && include_jmp_stub);
- add_bfd_to_link (one, one->filename, link_info);
+ add_bfd_to_link (one, one->filename, linfo);
}
}
if (do_this_dll)
{
bfd *ar_tail = make_tail (output_bfd);
- add_bfd_to_link (ar_tail, ar_tail->filename, link_info);
+ add_bfd_to_link (ar_tail, ar_tail->filename, linfo);
}
free (dll_symname);
unsigned char *expdata;
char *erva;
bfd_vma name_rvas, ordinals, nexp, ordbase;
- const char *dll_name;
+ const char *dllname;
/* Initialization with start > end guarantees that is_data
will not be set by mistake, and avoids compiler warning. */
bfd_vma data_start = 1;
/* Use internal dll name instead of filename
to enable symbolic dll linking. */
- dll_name = erva + pe_as32 (expdata + 12);
+ dllname = erva + pe_as32 (expdata + 12);
/* Check to see if the dll has already been added to
the definition list and if so return without error.
This avoids multiple symbol definitions. */
- if (def_get_module (pe_def_file, dll_name))
+ if (def_get_module (pe_def_file, dllname))
{
if (pe_dll_extra_pe_debug)
- printf ("%s is already loaded\n", dll_name);
+ printf ("%s is already loaded\n", dllname);
return TRUE;
}
|| (func_rva >= bss_start && func_rva < bss_end);
imp = def_file_add_import (pe_def_file, erva + name_rva,
- dll_name, i, 0, NULL);
+ dllname, i, 0, NULL);
/* Mark symbol type. */
imp->data = is_data;
if (pe_dll_extra_pe_debug)
printf ("%s dll-name: %s sym: %s addr: 0x%lx %s\n",
- __FUNCTION__, dll_name, erva + name_rva,
+ __FUNCTION__, dllname, erva + name_rva,
(unsigned long) func_rva, is_data ? "(data)" : "");
}
}
+2009-12-11 Nick Clifton <nickc@redhat.com>
+
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * arm-dis.c: Fix shadowed variable warnings.
+ * cgen-opc.c: Likewise.
+ * cr16-dis.c: Likewise.
+ * crx-dis.c: Likewise.
+ * d30v-dis.c: Likewise.
+ * fr30-dis.c: Likewise.
+ * frv-opc.c: Likewise.
+ * h8500-dis.c: Likewise.
+ * i386-dis.c: Likewise.
+ * i960-dis.c: Likewise.
+ * ia64-gen.c: Likewise.
+ * ia64-opc.c: Likewise.
+ * m32c-asm.c: Likewise.
+ * m32c-dis.c: Likewise.
+ * m68k-dis.c: Likewise.
+ * maxq-dis.c: Likewise.
+ * mcore-dis.c: Likewise.
+ * mep-asm.c: Likewise.
+ * microblaze-dis.c: Likewise.
+ * mmix-dis.c: Likewise.
+ * ns32k-dis.c: Likewise.
+ * or32-opc.c: Likewise.
+ * s390-dis.c: Likewise.
+ * sh64-dis.c: Likewise.
+ * spu-dis.c: Likewise.
+ * tic30-dis.c: Likewise.
+
2009-12-09 Nick Clifton <nickc@redhat.com>
PR 10924
$(top_srcdir)/po/Make-in $(srcdir)/../depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
+ $(top_srcdir)/../config/zlib.m4 \
$(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
case '5': case '6': case '7': case '8': case '9':
{
int width;
- unsigned long value;
c = arm_decode_bitfield (c, given, &value, &width);
case 'Z':
{
- int value;
/* given (20, 23) | given (0, 3) */
value = ((given >> 16) & 0xf0) | (given & 0xf);
func (stream, "%d", value);
func (stream, "}, [%s", arm_regnames[rn]);
if (align)
{
- int align = (8 * (type + 1)) << size;
+ align = (8 * (type + 1)) << size;
if (type == 3)
align = (size > 1) ? align >> 1 : align;
if (type == 2 || (type == 0 && !size))
{
long msb = (given & 0x001f0000) >> 16;
long lsb = (given & 0x00000f80) >> 7;
- long width = msb - lsb + 1;
+ long w = msb - lsb + 1;
- if (width > 0)
- func (stream, "#%lu, #%lu", lsb, width);
+ if (w > 0)
+ func (stream, "#%lu, #%lu", lsb, w);
else
func (stream, "(invalid: %lu:%lu)", lsb, msb);
}
for (i = 0; i < length; i += insn_chunk_bitsize) /* NB: i == bits */
{
- int index;
+ int bit_index;
bfd_vma this_value;
- index = i; /* NB: not dependent on endianness; opposite of cgen_put_insn_value! */
- this_value = bfd_get_bits (& buf[index / 8], insn_chunk_bitsize, big_p);
+
+ bit_index = i; /* NB: not dependent on endianness; opposite of cgen_put_insn_value! */
+ this_value = bfd_get_bits (& buf[bit_index / 8], insn_chunk_bitsize, big_p);
value = (value << insn_chunk_bitsize) | this_value;
}
}
for (i = 0; i < length; i += insn_chunk_bitsize) /* NB: i == bits */
{
- int index;
- index = (length - insn_chunk_bitsize - i); /* NB: not dependent on endianness! */
- bfd_put_bits ((bfd_vma) value, & buf[index / 8], insn_chunk_bitsize, big_p);
+ int bit_index;
+
+ bit_index = (length - insn_chunk_bitsize - i); /* NB: not dependent on endianness! */
+ bfd_put_bits ((bfd_vma) value, & buf[bit_index / 8], insn_chunk_bitsize, big_p);
value >>= insn_chunk_bitsize;
}
}
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.
if test "${enable_werror+set}" = set; then :
string. This routine is used when disassembling the 'CC' instruction. */
static char *
-getccstring (unsigned cc)
+getccstring (unsigned cc_insn)
{
- return (char *) cr16_b_cond_tab[cc];
+ return (char *) cr16_b_cond_tab[cc_insn];
}
This routine is used when disassembling the 'excp' instruction. */
static char *
-gettrapstring (unsigned int index)
+gettrapstring (unsigned int trap_index)
{
const trap_entry *trap;
for (trap = cr16_traps; trap < cr16_traps + NUMTRAPS; trap++)
- if (trap->entry == index)
+ if (trap->entry == trap_index)
return trap->name;
return ILLEGAL;
static char *
getregname (reg r)
{
- const reg_entry *reg = cr16_regtab + r;
+ const reg_entry * regentry = cr16_regtab + r;
- if (reg->type != CR16_R_REGTYPE)
+ if (regentry->type != CR16_R_REGTYPE)
return ILLEGAL;
- return reg->name;
+ return regentry->name;
}
/* Given a register pair enum value, retrieve its name. */
static char *
getregpname (reg r)
{
- const reg_entry *reg = cr16_regptab + r;
+ const reg_entry * regentry = cr16_regptab + r;
- if (reg->type != CR16_RP_REGTYPE)
+ if (regentry->type != CR16_RP_REGTYPE)
return ILLEGAL;
- return reg->name;
+ return regentry->name;
}
/* Given a index register pair enum value, retrieve its name. */
static char *
getidxregpname (reg r)
{
- const reg_entry *reg;
+ const reg_entry * regentry;
switch (r)
{
break;
}
- reg = cr16_regptab + r;
+ regentry = cr16_regptab + r;
- if (reg->type != CR16_RP_REGTYPE)
+ if (regentry->type != CR16_RP_REGTYPE)
return ILLEGAL;
- return reg->name;
+ return regentry->name;
}
/* Getting a processor register name. */
static char *
-getprocregname (int index)
+getprocregname (int reg_index)
{
const reg_entry *r;
for (r = cr16_pregtab; r < cr16_pregtab + NUMPREGS; r++)
- if (r->image == index)
+ if (r->image == reg_index)
return r->name;
return "ILLEGAL REGISTER";
/* Getting a processor register name - 32 bit size. */
static char *
-getprocpregname (int index)
+getprocpregname (int reg_index)
{
const reg_entry *r;
for (r = cr16_pregptab; r < cr16_pregptab + NUMPREGPS; r++)
- if (r->image == index)
+ if (r->image == reg_index)
return r->name;
return "ILLEGAL REGISTER";
/* Print all the arguments of CURRINSN instruction. */
static void
-print_arguments (ins *currInsn, bfd_vma memaddr, struct disassemble_info *info)
+print_arguments (ins *currentInsn, bfd_vma memaddr, struct disassemble_info *info)
{
int i;
if ((IS_INSN_MNEMONIC ("pop")
|| (IS_INSN_MNEMONIC ("popret")
|| (IS_INSN_MNEMONIC ("push"))))
- && currInsn->nargs == 1)
+ && currentInsn->nargs == 1)
{
info->fprintf_func (info->stream, "RA");
return;
}
- for (i = 0; i < currInsn->nargs; i++)
+ for (i = 0; i < currentInsn->nargs; i++)
{
processing_argument_number = i;
if ((INST_HAS_REG_LIST) && (i == 2))
info->fprintf_func (info->stream, "RA");
else
- print_arg (&currInsn->arg[i], memaddr, info);
+ print_arg (¤tInsn->arg[i], memaddr, info);
- if ((i != currInsn->nargs - 1) && (!IS_INSN_MNEMONIC ("b")))
+ if ((i != currentInsn->nargs - 1) && (!IS_INSN_MNEMONIC ("b")))
info->fprintf_func (info->stream, ",");
}
}
This routine is used when disassembling the 'excp' instruction. */
static char *
-gettrapstring (unsigned int index)
+gettrapstring (unsigned int trap_index)
{
const trap_entry *trap;
for (trap = crx_traps; trap < crx_traps + NUMTRAPS; trap++)
- if (trap->entry == index)
+ if (trap->entry == trap_index)
return trap->name;
return ILLEGAL;
char *
getregname (reg r)
{
- const reg_entry *reg = &crx_regtab[r];
+ const reg_entry * regentry = &crx_regtab[r];
- if (reg->type != CRX_R_REGTYPE)
+ if (regentry->type != CRX_R_REGTYPE)
return ILLEGAL;
else
- return reg->name;
+ return regentry->name;
}
/* Given a coprocessor register enum value, retrieve its name. */
char *
getcopregname (copreg r, reg_type type)
{
- const reg_entry *reg;
+ const reg_entry * regentry;
if (type == CRX_C_REGTYPE)
- reg = &crx_copregtab[r];
+ regentry = &crx_copregtab[r];
else if (type == CRX_CS_REGTYPE)
- reg = &crx_copregtab[r+(cs0-c0)];
+ regentry = &crx_copregtab[r+(cs0-c0)];
else
return ILLEGAL;
- return reg->name;
+ return regentry->name;
}
/* Getting a processor register name. */
static char *
-getprocregname (int index)
+getprocregname (int reg_index)
{
const reg_entry *r;
for (r = crx_regtab; r < crx_regtab + NUMREGS; r++)
- if (r->image == index)
+ if (r->image == reg_index)
return r->name;
return "ILLEGAL REGISTER";
/* Print all the arguments of CURRINSN instruction. */
static void
-print_arguments (ins *currInsn, bfd_vma memaddr, struct disassemble_info *info)
+print_arguments (ins *currentInsn, bfd_vma memaddr, struct disassemble_info *info)
{
int i;
- for (i = 0; i < currInsn->nargs; i++)
+ for (i = 0; i < currentInsn->nargs; i++)
{
processing_argument_number = i;
- print_arg (&currInsn->arg[i], memaddr, info);
+ print_arg (¤tInsn->arg[i], memaddr, info);
- if (i != currInsn->nargs - 1)
+ if (i != currentInsn->nargs - 1)
info->fprintf_func (info->stream, ", ");
}
}
static int
lookup_opcode (struct d30v_insn *insn, long num, int is_long)
{
- int i = 0, index;
+ int i = 0, op_index;
struct d30v_format *f;
struct d30v_opcode *op = (struct d30v_opcode *) d30v_opcode_table;
int op1 = (num >> 25) & 0x7;
while (op->op1 == op1 && op->op2 == op2)
{
/* Scan through all the formats for the opcode. */
- index = op->format[i++];
+ op_index = op->format[i++];
do
{
- f = (struct d30v_format *) &d30v_format_table[index];
- while (f->form == index)
+ f = (struct d30v_format *) &d30v_format_table[op_index];
+ while (f->form == op_index)
{
if ((!is_long || f->form >= LONG) && (f->modifier == mod))
{
if (insn->form)
break;
}
- while ((index = op->format[i++]) != 0);
+ while ((op_index = op->format[i++]) != 0);
if (insn->form)
break;
op++;
{
disassemble_info *info = dis_info;
int mask;
- int index = 0;
+ int reg_index = 0;
char * comma = "";
if (load_store)
if (value & mask)
{
- (*info->fprintf_func) (info->stream, "r%li", index + offset);
+ (*info->fprintf_func) (info->stream, "r%li", reg_index + offset);
comma = ",";
}
- for (index = 1; index <= 7; ++index)
+ for (reg_index = 1; reg_index <= 7; ++reg_index)
{
if (load_store)
mask >>= 1;
if (value & mask)
{
- (*info->fprintf_func) (info->stream, "%sr%li", comma, index + offset);
+ (*info->fprintf_func) (info->stream, "%sr%li", comma, reg_index + offset);
comma = ",";
}
}
int
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 unit;
VLIW_COMBO *new_vliw;
if (vliw->constraint_violation || CGEN_INSN_INVALID_P (insn))
return 1;
- index = vliw->next_slot;
- if (index >= FRV_VLIW_SIZE)
+ slot_index = vliw->next_slot;
+ if (slot_index >= FRV_VLIW_SIZE)
return 1;
unit = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_UNIT);
break;
}
- if (index <= 0)
+ if (slot_index <= 0)
{
/* Any insn can be added to slot 0. */
while (! match_unit (vliw, unit, (*vliw->current_vliw)[0]))
if (new_vliw && check_insn_major_constraints (vliw, major, insn))
{
vliw->current_vliw = new_vliw;
- vliw->major[index] = major;
- vliw->insn[index] = insn;
+ vliw->major[slot_index] = major;
+ vliw->insn[slot_index] = insn;
vliw->next_slot++;
return 0;
}
int rd = 0;
int rs = 0;
int disp = 0;
- int abs = 0;
+ int abs_val = 0;
int imm = 0;
int pcrel = 0;
int qim = 0;
break;
case ABS24:
FETCH_DATA (info, buffer + byte + 3);
- abs =
+ abs_val =
(buffer[byte] << 16)
| (buffer[byte + 1] << 8)
| (buffer[byte + 2]);
break;
case ABS16:
FETCH_DATA (info, buffer + byte + 2);
- abs = (buffer[byte] << 8) | (buffer[byte + 1]);
+ abs_val = (buffer[byte] << 8) | (buffer[byte + 1]);
break;
case ABS8:
- abs = (buffer[byte]);
+ abs_val = (buffer[byte]);
break;
case IMM16:
FETCH_DATA (info, buffer + byte + 2);
func (stream, "@-sp");
break;
case ABS24:
- func (stream, "@0x%0x:24", abs);
+ func (stream, "@0x%0x:24", abs_val);
break;
case ABS16:
- func (stream, "@0x%0x:16", abs & 0xffff);
+ func (stream, "@0x%0x:16", abs_val & 0xffff);
break;
case ABS8:
- func (stream, "@0x%0x:8", abs & 0xff);
+ func (stream, "@0x%0x:8", abs_val & 0xff);
break;
case IMM16:
func (stream, "#0x%0x:16", imm & 0xffff);
break;
case RLIST:
{
- int i;
+ int j;
int nc = 0;
func (stream, "(");
- for (i = 0; i < 8; i++)
+ for (j = 0; j < 8; j++)
{
- if (imm & (1 << i))
+ if (imm & (1 << j))
{
- func (stream, "r%d", i);
+ func (stream, "r%d", j);
if (nc)
func (stream, ",");
nc = 1;
static const struct dis386 *
get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
{
- int index, vex_table_index;
+ int vindex, vex_table_index;
if (dp->name != NULL)
return dp;
break;
case USE_MOD_TABLE:
- index = modrm.mod == 0x3 ? 1 : 0;
- dp = &mod_table[dp->op[1].bytemode][index];
+ vindex = modrm.mod == 0x3 ? 1 : 0;
+ dp = &mod_table[dp->op[1].bytemode][vindex];
break;
case USE_RM_TABLE:
switch (vex.prefix)
{
case 0:
- index = 0;
+ vindex = 0;
break;
case REPE_PREFIX_OPCODE:
- index = 1;
+ vindex = 1;
break;
case DATA_PREFIX_OPCODE:
- index = 2;
+ vindex = 2;
break;
case REPNE_PREFIX_OPCODE:
- index = 3;
+ vindex = 3;
break;
default:
abort ();
}
else
{
- index = 0;
+ vindex = 0;
used_prefixes |= (prefixes & PREFIX_REPZ);
if (prefixes & PREFIX_REPZ)
{
- index = 1;
+ vindex = 1;
all_prefixes[last_repz_prefix] = 0;
}
else
used_prefixes |= (prefixes & PREFIX_REPNZ);
if (prefixes & PREFIX_REPNZ)
{
- index = 3;
+ vindex = 3;
all_prefixes[last_repnz_prefix] = 0;
}
else
used_prefixes |= (prefixes & PREFIX_DATA);
if (prefixes & PREFIX_DATA)
{
- index = 2;
+ vindex = 2;
all_prefixes[last_data_prefix] = 0;
}
}
}
}
- dp = &prefix_table[dp->op[1].bytemode][index];
+ dp = &prefix_table[dp->op[1].bytemode][vindex];
break;
case USE_X86_64_TABLE:
- index = address_mode == mode_64bit ? 1 : 0;
- dp = &x86_64_table[dp->op[1].bytemode][index];
+ vindex = address_mode == mode_64bit ? 1 : 0;
+ dp = &x86_64_table[dp->op[1].bytemode][vindex];
break;
case USE_3BYTE_TABLE:
FETCH_DATA (info, codep + 2);
- index = *codep++;
- dp = &three_byte_table[dp->op[1].bytemode][index];
+ vindex = *codep++;
+ dp = &three_byte_table[dp->op[1].bytemode][vindex];
modrm.mod = (*codep >> 6) & 3;
modrm.reg = (*codep >> 3) & 7;
modrm.rm = *codep & 7;
switch (vex.length)
{
case 128:
- index = 0;
+ vindex = 0;
break;
case 256:
- index = 1;
+ vindex = 1;
break;
default:
abort ();
break;
}
- dp = &vex_len_table[dp->op[1].bytemode][index];
+ dp = &vex_len_table[dp->op[1].bytemode][vindex];
break;
case USE_XOP_8F_TABLE:
need_vex = 1;
need_vex_reg = 1;
codep++;
- index = *codep++;
- dp = &xop_table[vex_table_index][index];
+ vindex = *codep++;
+ dp = &xop_table[vex_table_index][vindex];
FETCH_DATA (info, codep + 1);
modrm.mod = (*codep >> 6) & 3;
need_vex = 1;
need_vex_reg = 1;
codep++;
- index = *codep++;
- dp = &vex_table[vex_table_index][index];
+ vindex = *codep++;
+ dp = &vex_table[vex_table_index][vindex];
/* There is no MODRM byte for VEX [82|77]. */
- if (index != 0x77 && index != 0x82)
+ if (vindex != 0x77 && vindex != 0x82)
{
FETCH_DATA (info, codep + 1);
modrm.mod = (*codep >> 6) & 3;
need_vex = 1;
need_vex_reg = 1;
codep++;
- index = *codep++;
- dp = &vex_table[dp->op[1].bytemode][index];
+ vindex = *codep++;
+ dp = &vex_table[dp->op[1].bytemode][vindex];
/* There is no MODRM byte for VEX [82|77]. */
- if (index != 0x77 && index != 0x82)
+ if (vindex != 0x77 && vindex != 0x82)
{
FETCH_DATA (info, codep + 1);
modrm.mod = (*codep >> 6) & 3;
int haveindex;
int needindex;
int base, rbase;
- int index = 0;
+ int vindex = 0;
int scale = 0;
havesib = 0;
{
havesib = 1;
FETCH_DATA (the_info, codep + 1);
- index = (*codep >> 3) & 7;
+ vindex = (*codep >> 3) & 7;
scale = (*codep >> 6) & 3;
base = *codep & 7;
USED_REX (REX_X);
if (rex & REX_X)
- index += 8;
- haveindex = index != 4;
+ vindex += 8;
+ haveindex = vindex != 4;
codep++;
}
rbase = base + add;
if (haveindex)
oappend (address_mode == mode_64bit
&& (sizeflag & AFLAG)
- ? names64[index] : names32[index]);
+ ? names64[vindex] : names32[vindex]);
else
oappend (address_mode == mode_64bit
&& (sizeflag & AFLAG)
/* Register Instruction Operand. */
static void
-regop (int mode, int spec, int reg, int fp)
+regop (int mode, int spec, int fp_reg, int fp)
{
if (fp)
{
if (mode == 1)
{
/* FP operand. */
- switch (reg)
+ switch (fp_reg)
{
case 0: (*info->fprintf_func) (stream, "fp0");
break;
else
{
/* Non-FP register. */
- (*info->fprintf_func) (stream, reg_names[reg]);
+ (*info->fprintf_func) (stream, reg_names[fp_reg]);
}
}
else
if (mode == 1)
{
/* Literal. */
- (*info->fprintf_func) (stream, "%d", reg);
+ (*info->fprintf_func) (stream, "%d", fp_reg);
}
else
{
/* Register. */
if (spec == 0)
- (*info->fprintf_func) (stream, reg_names[reg]);
+ (*info->fprintf_func) (stream, reg_names[fp_reg]);
else
- (*info->fprintf_func) (stream, "sf%d", reg);
+ (*info->fprintf_func) (stream, "sf%d", fp_reg);
}
}
}
/* Register Instruction Destination Operand. */
static void
-dstop (int mode, int reg, int fp)
+dstop (int mode, int dest_reg, int fp)
{
/* 'dst' operand can't be a literal. On non-FP instructions, register
mode is assumed and "m3" acts as if were "s3"; on FP-instructions,
sf registers are not allowed so m3 acts normally. */
if (fp)
- regop (mode, 0, reg, fp);
+ regop (mode, 0, dest_reg, fp);
else
- regop (0, mode, reg, fp);
+ regop (0, mode, dest_reg, fp);
}
static void
print_main_table (void)
{
struct main_entry *ptr = maintable;
- int index = 0;
+ int tindex = 0;
printf ("static const struct ia64_main_table\nmain_table[] = {\n");
while (ptr != NULL)
ptr->opcode->flags,
ptr->completers->num);
- ptr->main_index = index++;
+ ptr->main_index = tindex++;
ptr = ptr->next;
}
/* ia64-opc.c -- Functions to access the compacted opcode table
- Copyright 1999, 2000, 2001, 2003, 2005, 2007 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
Written by Bob Manson of Cygnus Solutions, <manson@cygnus.com>
This file is part of the GNU opcodes library.
}
const struct ia64_dependency *
-ia64_find_dependency (int index)
+ia64_find_dependency (int dep_index)
{
- index = DEP(index);
+ dep_index = DEP(dep_index);
- if (index < 0
- || index >= (int)(sizeof(dependencies) / sizeof(dependencies[0])))
+ if (dep_index < 0
+ || dep_index >= (int) ARRAY_SIZE (dependencies))
return NULL;
- return &dependencies[index];
+ return &dependencies[dep_index];
}
THIS FILE IS MACHINE GENERATED WITH CGEN.
- the resultant file is machine generated, cgen-asm.in isn't
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2007, 2008
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of libopcodes.
int opindex, unsigned long *valuep)
{
const char *errmsg = 0;
- unsigned long value;
+ unsigned long value = 0;
long have_zero = 0;
if (strncasecmp (*strp, "%dsp8(", 6) == 0)
{
enum cgen_parse_operand_result result_type;
- bfd_vma value;
- const char *errmsg;
+ bfd_vma val;
*strp += 6;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_8,
- & result_type, & value);
+ & result_type, & val);
if (**strp != ')')
return _("missing `)'");
(*strp) ++;
if (errmsg == NULL
&& 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;
return errmsg;
}
int opindex, signed long *valuep)
{
const char *errmsg = 0;
- signed long value;
+ signed long value = 0;
if (strncasecmp (*strp, "%hi8(", 5) == 0)
{
enum cgen_parse_operand_result result_type;
- bfd_vma value;
- const char *errmsg;
+ bfd_vma val;
*strp += 5;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_M32C_HI8,
- & result_type, & value);
+ & result_type, & val);
if (**strp != ')')
return _("missing `)'");
(*strp) ++;
if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
- {
- value >>= 16;
- }
+ val >>= 16;
+
+ value = val;
*valuep = value;
return errmsg;
}
int opindex, unsigned long *valuep)
{
const char *errmsg = 0;
- unsigned long value;
+ unsigned long value = 0;
long have_zero = 0;
if (strncasecmp (*strp, "%dsp16(", 7) == 0)
{
enum cgen_parse_operand_result result_type;
- bfd_vma value;
- const char *errmsg;
+ bfd_vma val;
*strp += 7;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_16,
- & result_type, & value);
+ & result_type, & val);
if (**strp != ')')
return _("missing `)'");
(*strp) ++;
if (errmsg == NULL
&& 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;
return errmsg;
}
int opindex, signed long *valuep)
{
const char *errmsg = 0;
- signed long value;
+ signed long value = 0;
if (strncasecmp (*strp, "%lo16(", 6) == 0)
{
enum cgen_parse_operand_result result_type;
- bfd_vma value;
- const char *errmsg;
+ bfd_vma val;
*strp += 6;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16,
- & result_type, & value);
+ & result_type, & val);
if (**strp != ')')
return _("missing `)'");
(*strp) ++;
if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
- {
- value &= 0xffff;
- }
+ val &= 0xffff;
+
+ value = val;
*valuep = value;
return errmsg;
}
if (strncasecmp (*strp, "%hi16(", 6) == 0)
{
enum cgen_parse_operand_result result_type;
- bfd_vma value;
- const char *errmsg;
+ bfd_vma val;
*strp += 6;
errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16,
- & result_type, & value);
+ & result_type, & val);
if (**strp != ')')
return _("missing `)'");
(*strp) ++;
if (errmsg == NULL
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
- {
- value >>= 16;
- }
+ val >>= 16;
+
+ value = val;
*valuep = value;
return errmsg;
}
};
disassemble_info *info = dis_info;
int mask;
- int index = 0;
+ int reg_index = 0;
char* comma = "";
if (push)
comma = ",";
}
- for (index = 1; index <= 7; ++index)
+ for (reg_index = 1; reg_index <= 7; ++reg_index)
{
if (push)
mask >>= 1;
if (value & mask)
{
(*info->fprintf_func) (info->stream, "%s%s", comma,
- m16c_register_names [index]);
+ m16c_register_names [reg_index]);
comma = ",";
}
}
case '2':
case '3':
{
- int val;
char *name = 0;
FETCH_ARG (5, val);
/* Instruction printing code for the MAXQ
- Copyright 2004, 2005, 2007 Free Software Foundation, Inc.
+ Copyright 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
Written by Vineet Sharma(vineets@noida.hcltech.com) Inderpreet
S.(inderpreetb@noida.hcltech.com)
get_reg_name (unsigned char reg_code, type1 arg_pos)
{
unsigned char module;
- unsigned char index;
+ unsigned char r_index;
int ix = 0;
reg_entry const *reg_x;
mem_access_syntax const *syntax;
mem_access *mem_acc;
module = 0;
- index = 0;
+ r_index = 0;
module = (reg_code & MASK_LOW_BYTE);
- index = (reg_code & MASK_HIGH_BYTE);
- index = index >> 4;
+ r_index = (reg_code & MASK_HIGH_BYTE);
+ r_index = r_index >> 4;
/* Search the system register table. */
for (reg_x = &system_reg_table[0]; reg_x->reg_name != NULL; ++reg_x)
- if ((reg_x->Mod_name == module) && (reg_x->Mod_index == index))
+ if ((reg_x->Mod_name == module) && (reg_x->Mod_index == r_index))
return reg_x->reg_name;
/* Serch pheripheral table. */
{
reg_x = &new_reg_table[ix];
- if ((reg_x->Mod_name == module) && (reg_x->Mod_index == index))
+ if ((reg_x->Mod_name == module) && (reg_x->Mod_index == r_index))
return reg_x->reg_name;
}
}
memset (unres_reg_name, 0, 20);
- sprintf (unres_reg_name, "%01x%01xh", index, module);
+ sprintf (unres_reg_name, "%01x%01xh", r_index, module);
return unres_reg_name;
}
/* Disassemble Motorola M*Core instructions.
- Copyright 1993, 1999, 2000, 2001, 2002, 2005, 2007
+ Copyright 1993, 1999, 2000, 2001, 2002, 2005, 2007, 2009
Free Software Foundation, Inc.
This file is part of the GNU opcodes library.
struct disassemble_info *info;
{
unsigned char ibytes[4];
- fprintf_ftype fprintf = info->fprintf_func;
+ fprintf_ftype print_func = info->fprintf_func;
void *stream = info->stream;
unsigned short inst;
const mcore_opcode_info *op;
break;
if (op->name == 0)
- (*fprintf) (stream, ".short 0x%04x", inst);
+ (*print_func) (stream, ".short 0x%04x", inst);
else
{
const char *name = grname[inst & 0x0F];
- (*fprintf) (stream, "%s", op->name);
+ (*print_func) (stream, "%s", op->name);
switch (op->opclass)
{
break;
case OT:
- (*fprintf) (stream, "\t%d", inst & 0x3);
+ (*print_func) (stream, "\t%d", inst & 0x3);
break;
case O1:
case JMP:
case JSR:
- (*fprintf) (stream, "\t%s", name);
+ (*print_func) (stream, "\t%s", name);
break;
case OC:
- (*fprintf) (stream, "\t%s, %s", name, crname[(inst >> 4) & 0x1F]);
+ (*print_func) (stream, "\t%s, %s", name, crname[(inst >> 4) & 0x1F]);
break;
case O1R1:
- (*fprintf) (stream, "\t%s, r1", name);
+ (*print_func) (stream, "\t%s, r1", name);
break;
case MULSH:
case O2:
- (*fprintf) (stream, "\t%s, %s", name, grname[(inst >> 4) & 0xF]);
+ (*print_func) (stream, "\t%s, %s", name, grname[(inst >> 4) & 0xF]);
break;
case X1:
- (*fprintf) (stream, "\tr1, %s", name);
+ (*print_func) (stream, "\tr1, %s", name);
break;
case OI:
- (*fprintf) (stream, "\t%s, %d", name, ((inst >> 4) & 0x1F) + 1);
+ (*print_func) (stream, "\t%s, %d", name, ((inst >> 4) & 0x1F) + 1);
break;
case RM:
- (*fprintf) (stream, "\t%s-r15, (r0)", name);
+ (*print_func) (stream, "\t%s-r15, (r0)", name);
break;
case RQ:
- (*fprintf) (stream, "\tr4-r7, (%s)", name);
+ (*print_func) (stream, "\tr4-r7, (%s)", name);
break;
case OB:
case OMa:
case OMb:
case OMc:
- (*fprintf) (stream, "\t%s, %d", name, (inst >> 4) & 0x1F);
+ (*print_func) (stream, "\t%s, %d", name, (inst >> 4) & 0x1F);
break;
case I7:
- (*fprintf) (stream, "\t%s, %d", name, (inst >> 4) & 0x7F);
+ (*print_func) (stream, "\t%s, %d", name, (inst >> 4) & 0x7F);
break;
case LS:
- (*fprintf) (stream, "\t%s, (%s, %d)", grname[(inst >> 8) & 0xF],
- name, ((inst >> 4) & 0xF) << isiz[(inst >> 13) & 3]);
+ (*print_func) (stream, "\t%s, (%s, %d)", grname[(inst >> 8) & 0xF],
+ name, ((inst >> 4) & 0xF) << isiz[(inst >> 13) & 3]);
break;
case BR:
if (inst & 0x400)
val |= 0xFFFFFC00;
- (*fprintf) (stream, "\t0x%lx", (long)(memaddr + 2 + (val << 1)));
+ (*print_func) (stream, "\t0x%lx", (long)(memaddr + 2 + (val << 1)));
if (strcmp (op->name, "bsr") == 0)
{
if (info->print_address_func && val != 0)
{
- (*fprintf) (stream, "\t// ");
+ (*print_func) (stream, "\t// ");
info->print_address_func (val, info);
}
}
{
long val;
val = (inst & 0x000F);
- (*fprintf) (stream, "\t%s, 0x%lx",
- grname[(inst >> 4) & 0xF],
- (long) (memaddr - (val << 1)));
+ (*print_func) (stream, "\t%s, 0x%lx",
+ grname[(inst >> 4) & 0xF],
+ (long) (memaddr - (val << 1)));
}
break;
| (ibytes[2] << 8) | (ibytes[3]);
/* Removed [] around literal value to match ABI syntax 12/95. */
- (*fprintf) (stream, "\t%s, 0x%lX", grname[(inst >> 8) & 0xF], val);
+ (*print_func) (stream, "\t%s, 0x%lX", grname[(inst >> 8) & 0xF], val);
if (val == 0)
- (*fprintf) (stream, "\t// from address pool at 0x%lx",
- (long) (memaddr + 2
- + ((inst & 0xFF) << 2)) & 0xFFFFFFFC);
+ (*print_func) (stream, "\t// from address pool at 0x%lx",
+ (long) (memaddr + 2
+ + ((inst & 0xFF) << 2)) & 0xFFFFFFFC);
}
break;
| (ibytes[2] << 8) | (ibytes[3]);
/* Removed [] around literal value to match ABI syntax 12/95. */
- (*fprintf) (stream, "\t0x%lX", val);
+ (*print_func) (stream, "\t0x%lX", val);
/* For jmpi/jsri, we'll try to get a symbol for the target. */
if (info->print_address_func && val != 0)
{
- (*fprintf) (stream, "\t// ");
+ (*print_func) (stream, "\t// ");
info->print_address_func (val, info);
}
else
{
- (*fprintf) (stream, "\t// from address pool at 0x%lx",
- (long) (memaddr + 2
- + ((inst & 0xFF) << 2)) & 0xFFFFFFFC);
+ (*print_func) (stream, "\t// from address pool at 0x%lx",
+ (long) (memaddr + 2
+ + ((inst & 0xFF) << 2)) & 0xFFFFFFFC);
}
}
break;
"ee", "ee,ie", "ee,fe", "ee,fe,ie"
};
- (*fprintf) (stream, "\t%s", fields[inst & 0x7]);
+ (*print_func) (stream, "\t%s", fields[inst & 0x7]);
}
break;
default:
/* If the disassembler lags the instruction set. */
- (*fprintf) (stream, "\tundecoded operands, inst is 0x%04x", inst);
+ (*print_func) (stream, "\tundecoded operands, inst is 0x%04x", inst);
break;
}
}
char *result = 0, *rescanned_result = 0;
char *e = mac->expansion;
char *mark = e;
- int arg = 0;
+ int mac_arg = 0;
/* printf("expanding macro %s with %d args\n", mac->name, narg + 1); */
while (*e)
((*(e + 1) - '1') <= narg))
{
result = str_append (result, mark, e - mark);
- arg = (*(e + 1) - '1');
- /* printf("replacing `%d with %s\n", arg+1, args[arg].start); */
- result = str_append (result, args[arg].start, args[arg].len);
+ mac_arg = (*(e + 1) - '1');
+ /* printf("replacing `%d with %s\n", mac_arg+1, args[mac_arg].start); */
+ result = str_append (result, args[mac_arg].start, args[mac_arg].len);
++e;
mark = e+1;
}
arg args[MAXARGS];
int state = IN_TEXT;
const char *mark = in;
- macro *macro = 0;
-
+ macro *pmacro = NULL;
char *expansion = 0;
char *result = 0;
case IN_TEXT:
if (*in == '%' && *(in + 1) && (!first_only || num_expansions == 0))
{
- macro = lookup_macro (in + 1);
- if (macro)
+ pmacro = lookup_macro (in + 1);
+ if (pmacro)
{
/* printf("entering state %d at '%s'...\n", state, in); */
result = str_append (result, mark, in - mark);
mark = in;
- in += 1 + strlen (macro->name);
+ in += 1 + strlen (pmacro->name);
while (*in == ' ') ++in;
if (*in != '(')
{
state = IN_TEXT;
- macro = 0;
+ pmacro = NULL;
}
else
{
case ')':
state = IN_TEXT;
/* printf("entering state %d at '%s'...\n", state, in); */
- if (macro)
+ if (pmacro)
{
expansion = 0;
- expansion = expand_macro (args, narg, macro);
+ expansion = expand_macro (args, narg, pmacro);
num_expansions++;
if (expansion)
{
{
result = str_append (result, mark, in - mark);
}
- macro = 0;
+ pmacro = NULL;
mark = in + 1;
break;
case '(':
int
print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
{
- fprintf_ftype fprintf = info->fprintf_func;
+ fprintf_ftype print_func = info->fprintf_func;
void * stream = info->stream;
unsigned long inst, prev_inst;
struct op_code_struct * op, *pop;
prev_insn_vma = curr_insn_vma;
if (op->name == NULL)
- fprintf (stream, ".short 0x%04x", inst);
+ print_func (stream, ".short 0x%04x", inst);
else
{
- fprintf (stream, "%s", op->name);
+ print_func (stream, "%s", op->name);
switch (op->inst_type)
{
case INST_TYPE_RD_R1_R2:
- fprintf (stream, "\t%s, %s, %s", get_field_rd (inst),
+ print_func (stream, "\t%s, %s, %s", get_field_rd (inst),
get_field_r1(inst), get_field_r2 (inst));
break;
case INST_TYPE_RD_R1_IMM:
- fprintf (stream, "\t%s, %s, %s", get_field_rd (inst),
+ print_func (stream, "\t%s, %s, %s", get_field_rd (inst),
get_field_r1(inst), get_field_imm (inst));
if (info->print_address_func && get_int_field_r1 (inst) == 0
&& info->symbol_at_address_func)
}
if (immval > 0 && info->symbol_at_address_func (immval, info))
{
- fprintf (stream, "\t// ");
+ print_func (stream, "\t// ");
info->print_address_func (immval, info);
}
}
break;
case INST_TYPE_RD_R1_IMM5:
- fprintf (stream, "\t%s, %s, %s", get_field_rd (inst),
+ print_func (stream, "\t%s, %s, %s", get_field_rd (inst),
get_field_r1(inst), get_field_imm5 (inst));
break;
case INST_TYPE_RD_RFSL:
- fprintf (stream, "\t%s, %s", get_field_rd (inst), get_field_rfsl (inst));
+ print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_rfsl (inst));
break;
case INST_TYPE_R1_RFSL:
- fprintf (stream, "\t%s, %s", get_field_r1 (inst), get_field_rfsl (inst));
+ print_func (stream, "\t%s, %s", get_field_r1 (inst), get_field_rfsl (inst));
break;
case INST_TYPE_RD_SPECIAL:
- fprintf (stream, "\t%s, %s", get_field_rd (inst),
+ print_func (stream, "\t%s, %s", get_field_rd (inst),
get_field_special (inst, op));
break;
case INST_TYPE_SPECIAL_R1:
- fprintf (stream, "\t%s, %s", get_field_special (inst, op),
+ print_func (stream, "\t%s, %s", get_field_special (inst, op),
get_field_r1(inst));
break;
case INST_TYPE_RD_R1:
- fprintf (stream, "\t%s, %s", get_field_rd (inst), get_field_r1 (inst));
+ print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_r1 (inst));
break;
case INST_TYPE_R1_R2:
- fprintf (stream, "\t%s, %s", get_field_r1 (inst), get_field_r2 (inst));
+ print_func (stream, "\t%s, %s", get_field_r1 (inst), get_field_r2 (inst));
break;
case INST_TYPE_R1_IMM:
- fprintf (stream, "\t%s, %s", get_field_r1 (inst), get_field_imm (inst));
+ print_func (stream, "\t%s, %s", get_field_r1 (inst), get_field_imm (inst));
/* The non-pc relative instructions are returns, which shouldn't
have a label printed. */
if (info->print_address_func && op->inst_offset_type == INST_PC_OFFSET
immval += memaddr;
if (immval > 0 && info->symbol_at_address_func (immval, info))
{
- fprintf (stream, "\t// ");
+ print_func (stream, "\t// ");
info->print_address_func (immval, info);
}
else
{
- fprintf (stream, "\t\t// ");
- fprintf (stream, "%x", immval);
+ print_func (stream, "\t\t// ");
+ print_func (stream, "%x", immval);
}
}
break;
case INST_TYPE_RD_IMM:
- fprintf (stream, "\t%s, %s", get_field_rd (inst), get_field_imm (inst));
+ print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_imm (inst));
if (info->print_address_func && info->symbol_at_address_func)
{
if (immfound)
immval += (int) memaddr;
if (info->symbol_at_address_func (immval, info))
{
- fprintf (stream, "\t// ");
+ print_func (stream, "\t// ");
info->print_address_func (immval, info);
}
}
break;
case INST_TYPE_IMM:
- fprintf (stream, "\t%s", get_field_imm (inst));
+ print_func (stream, "\t%s", get_field_imm (inst));
if (info->print_address_func && info->symbol_at_address_func
&& op->instr != imm)
{
immval += (int) memaddr;
if (immval > 0 && info->symbol_at_address_func (immval, info))
{
- fprintf (stream, "\t// ");
+ print_func (stream, "\t// ");
info->print_address_func (immval, info);
}
else if (op->inst_offset_type == INST_PC_OFFSET)
{
- fprintf (stream, "\t\t// ");
- fprintf (stream, "%x", immval);
+ print_func (stream, "\t\t// ");
+ print_func (stream, "%x", immval);
}
}
break;
case INST_TYPE_RD_R2:
- fprintf (stream, "\t%s, %s", get_field_rd (inst), get_field_r2 (inst));
+ print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_r2 (inst));
break;
case INST_TYPE_R2:
- fprintf (stream, "\t%s", get_field_r2 (inst));
+ print_func (stream, "\t%s", get_field_r2 (inst));
break;
case INST_TYPE_R1:
- fprintf (stream, "\t%s", get_field_r1 (inst));
+ print_func (stream, "\t%s", get_field_r1 (inst));
break;
case INST_TYPE_RD_R1_SPECIAL:
- fprintf (stream, "\t%s, %s", get_field_rd (inst), get_field_r2 (inst));
+ print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_r2 (inst));
break;
case INST_TYPE_RD_IMM15:
- fprintf (stream, "\t%s, %s", get_field_rd (inst), get_field_imm15 (inst));
+ print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_imm15 (inst));
break;
/* For tuqula instruction */
case INST_TYPE_RD:
- fprintf (stream, "\t%s", get_field_rd (inst));
+ print_func (stream, "\t%s", get_field_rd (inst));
break;
case INST_TYPE_RFSL:
- fprintf (stream, "\t%s", get_field_rfsl (inst));
+ print_func (stream, "\t%s", get_field_rfsl (inst));
break;
default:
/* If the disassembler lags the instruction set. */
- fprintf (stream, "\tundecoded operands, inst is 0x%04x", inst);
+ print_func (stream, "\tundecoded operands, inst is 0x%04x", inst);
break;
}
}
}
enum microblaze_instr
-microblaze_decode_insn (long insn, int *rd, int *ra, int *rb, int *imm)
+microblaze_decode_insn (long insn, int *rd, int *ra, int *rb, int *immed)
{
enum microblaze_instr op;
bfd_boolean t1;
*ra = (insn & RA_MASK) >> RA_LOW;
*rb = (insn & RB_MASK) >> RB_LOW;
t3 = (insn & IMM_MASK) >> IMM_LOW;
- *imm = (int) t3;
+ *immed = (int) t3;
return (op);
}
initialize_mmix_dis_info (struct disassemble_info *info)
{
struct mmix_dis_info *minfop = malloc (sizeof (struct mmix_dis_info));
- int i;
+ long i;
if (minfop == NULL)
return FALSE;
long symsize = bfd_get_symtab_upper_bound (abfd);
asymbol **syms = malloc (symsize);
long nsyms;
- long i;
if (syms == NULL)
{
for (i = 0; i < 256; i++)
if (minfop->reg_name[i] == NULL)
{
- sprintf (minfop->basic_reg_name[i], "$%d", i);
+ sprintf (minfop->basic_reg_name[i], "$%ld", i);
minfop->reg_name[i] = minfop->basic_reg_name[i];
}
/* Print National Semiconductor 32000 instructions.
- Copyright 1986, 1988, 1991, 1992, 1994, 1998, 2001, 2002, 2005, 2007
- Free Software Foundation, Inc.
+ Copyright 1986, 1988, 1991, 1992, 1994, 1998, 2001, 2002, 2005, 2007,
+ 2009 Free Software Foundation, Inc.
This file is part of the GNU opcodes library.
int Ivalue;
int addr_mode;
int disp1, disp2;
- int index;
int size;
switch (d)
case 0x1d:
case 0x1e:
case 0x1f:
- /* Scaled index basemode[R0 -- R7:B,W,D,Q]. */
- index = bit_extract (buffer, index_offset - 8, 3);
- print_insn_arg (d, index_offset, aoffsetp, buffer, addr,
- result, 0);
{
+ int bit_index;
static const char *ind = "bwdq";
char *off;
-
+
+ /* Scaled index basemode[R0 -- R7:B,W,D,Q]. */
+ bit_index = bit_extract (buffer, index_offset - 8, 3);
+ print_insn_arg (d, index_offset, aoffsetp, buffer, addr,
+ result, 0);
off = result + strlen (result);
- sprintf (off, "[r%d:%c]", index,
- ind[addr_mode & 3]);
+ sprintf (off, "[r%d:%c]", bit_index, ind[addr_mode & 3]);
}
break;
}
/* Calculates instruction length in bytes. Always 4 for OR32. */
int
-insn_len (int insn_index ATTRIBUTE_UNUSED)
+insn_len (int i_index ATTRIBUTE_UNUSED)
{
return 4;
}
}
const char *
-insn_name (int index)
+insn_name (int op_index)
{
- if (index >= 0 && index < (int) or32_num_opcodes)
- return or32_opcodes[index].name;
+ if (op_index >= 0 && op_index < (int) or32_num_opcodes)
+ return or32_opcodes[op_index].name;
else
return "???";
}
int
disassemble_insn (unsigned long insn)
{
- int index;
- index = insn_decode (insn);
+ int op_index;
+ op_index = insn_decode (insn);
- if (index >= 0)
+ if (op_index >= 0)
{
- struct or32_opcode const *opcode = &or32_opcodes[index];
+ struct or32_opcode const *opcode = &or32_opcodes[op_index];
char *s;
sprintf (disassembled, "%s ", opcode->name);
separator = 0;
for (opindex = opcode->operands; *opindex != 0; opindex++)
{
- unsigned int value;
-
operand = s390_operands + *opindex;
value = s390_extract_operand (buffer, operand);
can get as .byte:s. */
if (status != 0)
{
- int i;
-
for (i = 0; i < 3; i++)
{
status = info->read_memory_func (memaddr + i, insn, 1, info);
static const struct spu_opcode *
get_index_for_opcode (unsigned int insn)
{
- const struct spu_opcode *index;
+ const struct spu_opcode *op_index;
unsigned int opcode = insn >> (32-11);
/* Init the table. This assumes that element 0/opcode 0 (currently
if (spu_disassemble_table[0] == 0)
init_spu_disassemble ();
- if ((index = spu_disassemble_table[opcode & 0x780]) != 0
- && index->insn_type == RRR)
- return index;
+ if ((op_index = spu_disassemble_table[opcode & 0x780]) != 0
+ && op_index->insn_type == RRR)
+ return op_index;
- if ((index = spu_disassemble_table[opcode & 0x7f0]) != 0
- && (index->insn_type == RI18 || index->insn_type == LBT))
- return index;
+ if ((op_index = spu_disassemble_table[opcode & 0x7f0]) != 0
+ && (op_index->insn_type == RI18 || op_index->insn_type == LBT))
+ return op_index;
- if ((index = spu_disassemble_table[opcode & 0x7f8]) != 0
- && index->insn_type == RI10)
- return index;
+ if ((op_index = spu_disassemble_table[opcode & 0x7f8]) != 0
+ && op_index->insn_type == RI10)
+ return op_index;
- if ((index = spu_disassemble_table[opcode & 0x7fc]) != 0
- && (index->insn_type == RI16))
- return index;
+ if ((op_index = spu_disassemble_table[opcode & 0x7fc]) != 0
+ && (op_index->insn_type == RI16))
+ return op_index;
- if ((index = spu_disassemble_table[opcode & 0x7fe]) != 0
- && (index->insn_type == RI8))
- return index;
+ if ((op_index = spu_disassemble_table[opcode & 0x7fe]) != 0
+ && (op_index->insn_type == RI8))
+ return op_index;
- if ((index = spu_disassemble_table[opcode & 0x7ff]) != 0)
- return index;
+ if ((op_index = spu_disassemble_table[opcode & 0x7ff]) != 0)
+ return op_index;
return 0;
}
int hex_value;
int status;
unsigned int insn;
- const struct spu_opcode *index;
+ const struct spu_opcode *op_index;
enum spu_insns tag;
status = (*info->read_memory_func) (memaddr, buffer, 4, info);
insn = bfd_getb32 (buffer);
- index = get_index_for_opcode (insn);
+ op_index = get_index_for_opcode (insn);
- if (index == 0)
+ if (op_index == 0)
{
(*info->fprintf_func) (info->stream, ".long 0x%x", insn);
}
{
int i;
int paren = 0;
- tag = (enum spu_insns)(index - spu_opcodes);
- (*info->fprintf_func) (info->stream, "%s", index->mnemonic);
+ tag = (enum spu_insns)(op_index - spu_opcodes);
+ (*info->fprintf_func) (info->stream, "%s", op_index->mnemonic);
if (tag == M_BI || tag == M_BISL || tag == M_IRET || tag == M_BISLED
|| tag == M_BIHNZ || tag == M_BIHZ || tag == M_BINZ || tag == M_BIZ
|| tag == M_SYNC || tag == M_HBR)
if (fb & 0x10)
(*info->fprintf_func) (info->stream, "e");
}
- if (index->arg[0] != 0)
+ if (op_index->arg[0] != 0)
(*info->fprintf_func) (info->stream, "\t");
hex_value = 0;
- for (i = 1; i <= index->arg[0]; i++)
+ for (i = 1; i <= op_index->arg[0]; i++)
{
- int arg = index->arg[i];
+ int arg = op_index->arg[i];
if (arg != A_P && !paren && i > 1)
(*info->fprintf_func) (info->stream, ",");
static int
cnvt_tmsfloat_ieee (unsigned long tmsfloat, int size, float *ieeefloat)
{
- unsigned long exp, sign, mant;
+ unsigned long exponent, sign, mant;
union
{
unsigned long l;
tmsfloat = (long) tmsfloat >> 4;
}
}
- exp = tmsfloat & 0xFF000000;
- if (exp == 0x80000000)
+ exponent = tmsfloat & 0xFF000000;
+ if (exponent == 0x80000000)
{
*ieeefloat = 0.0;
return 1;
}
- exp += 0x7F000000;
+ exponent += 0x7F000000;
sign = (tmsfloat & 0x00800000) << 8;
mant = tmsfloat & 0x007FFFFF;
- if (exp == 0xFF000000)
+ if (exponent == 0xFF000000)
{
if (mant == 0)
*ieeefloat = ERANGE;
#endif
return 1;
}
- exp >>= 1;
+ exponent >>= 1;
if (sign)
{
mant = (~mant) & 0x007FFFFF;
mant += 1;
- exp += mant & 0x00800000;
- exp &= 0x7F800000;
+ exponent += mant & 0x00800000;
+ exponent &= 0x7F800000;
mant &= 0x007FFFFF;
}
if (tmsfloat == 0x80000000)
- sign = mant = exp = 0;
- tmsfloat = sign | exp | mant;
+ sign = mant = exponent = 0;
+ tmsfloat = sign | exponent | mant;
val.l = tmsfloat;
*ieeefloat = val.f;
return 1;