{
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