+2009-12-14 Ian Lance Taylor <iant@google.com>
+
+ Revert -Wshadow changes, all changes from:
+ 2009-12-11 Doug Kwan <dougkwan@google.com>
+ 2009-12-11 Nick Clifton <nickc@redhat.com>
+ * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
+
2009-12-11 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::do_finalize_sections): Fix build breakage
const char Archive::arfmag[2] = { '`', '\n' };
-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_(),
+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_(),
extended_names_(), armap_checked_(), seen_offsets_(), members_(),
- is_thin_archive_(is_a_thin_archive), included_member_(false),
+ is_thin_archive_(is_thin_archive), included_member_(false),
nested_archives_(), dirpath_(dirpath), task_(task), num_members_(0)
{
this->no_export_ =
- parameters->options().check_excluded_libs(ainput_file->found_name());
+ parameters->options().check_excluded_libs(input_file->found_name());
}
// Set up the archive: read the symbol map and the extended name
*ps = '\0';
errno = 0;
- char* hend;
- off_t member_size = strtol(size_string, &hend, 10);
- if (*hend != '\0'
+ char* end;
+ off_t member_size = strtol(size_string, &end, 10);
+ if (*end != '\0'
|| member_size < 0
|| (member_size == LONG_MAX && errno == ERANGE))
{
else
{
errno = 0;
- long x = strtol(hdr->ar_name + 1, &hend, 10);
+ long x = strtol(hdr->ar_name + 1, &end, 10);
long y = 0;
- if (*hend == ':')
- y = strtol(hend + 1, &hend, 10);
- if (*hend != ' '
+ if (*end == ':')
+ y = strtol(end + 1, &end, 10);
+ if (*end != ' '
|| 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_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()
+ 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()
|| 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_start, name_end - 1 - name_start);
+ pname->assign(name, name_end - 1 - name);
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** in_file, off_t* memoff,
+Archive::get_file_and_offset(off_t off, Input_file** input_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);
- *in_file = this->input_file_;
+ *input_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());
- *in_file = new Input_file(input_file_arg);
+ *input_file = new Input_file(input_file_arg);
int dummy = 0;
- if (!(*in_file)->open(*this->dirpath_, this->task_, &dummy))
+ if (!(*input_file)->open(*this->dirpath_, this->task_, &dummy))
return false;
- arch = new Archive(*member_name, *in_file, false, this->dirpath_,
+ arch = new Archive(*member_name, *input_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, in_file, memoff,
+ return arch->get_file_and_offset(nested_off, input_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());
- *in_file = new Input_file(input_file_arg);
+ *input_file = new Input_file(input_file_arg);
int dummy = 0;
- if (!(*in_file)->open(*this->dirpath_, this->task_, &dummy))
+ if (!(*input_file)->open(*this->dirpath_, this->task_, &dummy))
return false;
*memoff = 0;
- *memsize = (*in_file)->file().filesize();
+ *memsize = (*input_file)->file().filesize();
return true;
}
{
*punconfigured = false;
- Input_file* in_file;
+ Input_file* input_file;
off_t memoff;
off_t memsize;
std::string member_name;
- if (!this->get_file_and_offset(off, &in_file, &memoff, &memsize,
+ if (!this->get_file_and_offset(off, &input_file, &memoff, &memsize,
&member_name))
return NULL;
if (parameters->options().has_plugins())
{
- Object* obj = parameters->options().plugins()->claim_file(in_file,
+ Object* obj = parameters->options().plugins()->claim_file(input_file,
memoff,
memsize);
if (obj != NULL)
const unsigned char* ehdr;
int read_size;
- if (!is_elf_object(in_file, memoff, &ehdr, &read_size))
+ if (!is_elf_object(input_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 + ")"),
- in_file, memoff, ehdr, read_size,
+ input_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 adata, Type atype, unsigned int rtype, int relocaddend)
- : data_(adata), type_(atype), r_type_(rtype), reloc_addend_(relocaddend)
+ 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)
{ }
// Instruction specific data. This is used to store information like
static_cast<section_offset_type>(-1);
public:
- Stub(const Stub_template* stubtemplate)
- : stub_template_(stubtemplate), offset_(invalid_offset)
+ Stub(const Stub_template* stub_template)
+ : stub_template_(stub_template), offset_(invalid_offset)
{ }
virtual
// Set offset of code stub from beginning of its containing stub table.
void
- set_offset(section_offset_type off)
- { this->offset_ = off; }
+ set_offset(section_offset_type offset)
+ { this->offset_ = offset; }
// 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 stubtype, const Symbol* sym, const Relobj* rel_obj,
- unsigned int rsym, int32_t addend)
- : stub_type_(stubtype), addend_(addend)
+ Key(Stub_type stub_type, const Symbol* symbol, const Relobj* relobj,
+ unsigned int r_sym, int32_t addend)
+ : stub_type_(stub_type), addend_(addend)
{
- if (sym != NULL)
+ if (symbol != NULL)
{
this->r_sym_ = Reloc_stub::invalid_index;
- this->u_.symbol = sym;
+ this->u_.symbol = symbol;
}
else
{
- gold_assert(rel_obj != NULL && rsym != invalid_index);
- this->r_sym_ = rsym;
- this->u_.relobj = rel_obj;
+ gold_assert(relobj != NULL && r_sym != invalid_index);
+ this->r_sym_ = r_sym;
+ this->u_.relobj = relobj;
}
}
protected:
// Reloc_stubs are created via a stub factory. So these are protected.
- Reloc_stub(const Stub_template* stubtemplate)
- : Stub(stubtemplate), destination_address_(invalid_address)
+ Reloc_stub(const Stub_template* stub_template)
+ : Stub(stub_template), destination_address_(invalid_address)
{ }
~Reloc_stub()
class Stub_table : public Output_data
{
public:
- Stub_table(Arm_input_section<big_endian>* own)
- : Output_data(), addralign_(1), owner_(own), has_been_changed_(false),
+ Stub_table(Arm_input_section<big_endian>* owner)
+ : Output_data(), addralign_(1), owner_(owner), has_been_changed_(false),
reloc_stubs_()
{ }
class Arm_input_section : public Output_relaxed_input_section
{
public:
- Arm_input_section(Relobj* rel_obj, unsigned int sec_shndx)
- : Output_relaxed_input_section(rel_obj, sec_shndx, 1),
+ Arm_input_section(Relobj* relobj, unsigned int shndx)
+ : Output_relaxed_input_section(relobj, shndx, 1),
original_addralign_(1), original_size_(0), stub_table_(NULL)
{ }
// Set the stub_table.
void
- set_stub_table(Stub_table<big_endian>* stubtable)
- { this->stub_table_ = stubtable; }
+ set_stub_table(Stub_table<big_endian>* stub_table)
+ { this->stub_table_ = stub_table; }
// 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 sec_shndx,
- section_offset_type off,
+ do_output_offset(const Relobj* object, unsigned int shndx,
+ section_offset_type offset,
section_offset_type* poutput) const
{
if ((object == this->relobj())
- && (sec_shndx == this->shndx())
- && (off >= 0)
- && (convert_types<uint64_t, section_offset_type>(off)
+ && (shndx == this->shndx())
+ && (offset >= 0)
+ && (convert_types<uint64_t, section_offset_type>(offset)
<= this->original_size_))
{
- *poutput = off;
+ *poutput = offset;
return true;
}
else
class Arm_output_section : public Output_section
{
public:
- Arm_output_section(const char* aname, elfcpp::Elf_Word atype,
- elfcpp::Elf_Xword xflags)
- : Output_section(aname, atype, xflags)
+ Arm_output_section(const char* name, elfcpp::Elf_Word type,
+ elfcpp::Elf_Xword flags)
+ : Output_section(name, type, flags)
{ }
~Arm_output_section()
public:
static const Arm_address invalid_address = static_cast<Arm_address>(-1);
- Arm_relobj(const std::string& aname, Input_file* inputfile, off_t off,
+ Arm_relobj(const std::string& name, Input_file* input_file, off_t offset,
const typename elfcpp::Ehdr<32, big_endian>& ehdr)
- : Sized_relobj<32, big_endian>(aname, inputfile, off, ehdr),
+ : Sized_relobj<32, big_endian>(name, input_file, offset, 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 sec_shndx) const
+ stub_table(unsigned int shndx) const
{
- gold_assert(sec_shndx < this->stub_tables_.size());
- return this->stub_tables_[sec_shndx];
+ gold_assert(shndx < this->stub_tables_.size());
+ return this->stub_tables_[shndx];
}
// Set STUB_TABLE to be the stub_table of the SHNDX-th section.
void
- set_stub_table(unsigned int sec_shndx, Stub_table<big_endian>* stubtable)
+ set_stub_table(unsigned int shndx, Stub_table<big_endian>* stub_table)
{
- gold_assert(sec_shndx < this->stub_tables_.size());
- this->stub_tables_[sec_shndx] = stubtable;
+ gold_assert(shndx < this->stub_tables_.size());
+ this->stub_tables_[shndx] = stub_table;
}
// 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 sec_shndx)
+ convert_input_section_to_relaxed_section(unsigned 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(sec_shndx);
+ this->invalidate_section_offset(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* rel_obj)
- { return static_cast<Arm_relobj<big_endian>*>(rel_obj); }
+ as_arm_relobj(Relobj* relobj)
+ { return static_cast<Arm_relobj<big_endian>*>(relobj); }
// 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& aname, Input_file* inputfile, off_t off,
+ Arm_dynobj(const std::string& name, Input_file* input_file, off_t offset,
const elfcpp::Ehdr<32, big_endian>& ehdr)
- : Sized_dynobj<32, big_endian>(aname, inputfile, off, ehdr),
- processor_specific_flags_(0)
+ : Sized_dynobj<32, big_endian>(name, input_file, offset, ehdr),
+ processor_specific_flags_(0), attributes_section_data_(NULL)
{ }
~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* rel_obj, unsigned int sec_shndx) const;
+ find_arm_input_section(Relobj* relobj, unsigned int 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 sec_shndx, Output_section* output_section,
+ unsigned int 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, sec_shndx, output_section, reloc,
+ object, shndx, output_section, reloc,
this->rel_dyn_section(layout));
}
(thumb_bit != 0));
if (stub_type != arm_stub_none)
{
- Stub_table<big_endian>* stubtable =
+ Stub_table<big_endian>* stub_table =
object->stub_table(relinfo->data_shndx);
- gold_assert(stubtable != NULL);
+ gold_assert(stub_table != NULL);
Reloc_stub::Key stub_key(stub_type, gsym, object, r_sym, addend);
- stub = stubtable->find_reloc_stub(stub_key);
+ stub = stub_table->find_reloc_stub(stub_key);
gold_assert(stub != NULL);
thumb_bit = stub->stub_template()->entry_in_thumb_mode() ? 1 : 0;
- branch_target = stubtable->address() + stub->offset() + addend;
+ branch_target = stub_table->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>* stubtable =
+ Stub_table<big_endian>* stub_table =
object->stub_table(relinfo->data_shndx);
- gold_assert(stubtable != NULL);
+ gold_assert(stub_table != NULL);
Reloc_stub::Key stub_key(stub_type, gsym, object, r_sym, addend);
- Reloc_stub* stub = stubtable->find_reloc_stub(stub_key);
+ Reloc_stub* stub = stub_table->find_reloc_stub(stub_key);
gold_assert(stub != NULL);
thumb_bit = stub->stub_template()->entry_in_thumb_mode() ? 1 : 0;
- branch_target = stubtable->address() + stub->offset() + addend;
+ branch_target = stub_table->address() + stub->offset() + addend;
branch_offset = branch_target - address;
}
}
// Stub_template methods.
Stub_template::Stub_template(
- Stub_type atype, const Insn_template* iinsns,
- size_t insncount)
- : type_(atype), insns_(iinsns), insn_count_(insncount), alignment_(1),
+ Stub_type type, const Insn_template* insns,
+ size_t insn_count)
+ : type_(type), insns_(insns), insn_count_(insn_count), alignment_(1),
entry_in_thumb_mode_(false), relocs_()
{
- off_t off = 0;
+ off_t offset = 0;
// Compute byte size and alignment of stub template.
- for (size_t i = 0; i < insncount; i++)
+ for (size_t i = 0; i < insn_count; i++)
{
- unsigned insn_alignment = iinsns[i].alignment();
- size_t insn_size = iinsns[i].size();
- gold_assert((off & (insn_alignment - 1)) == 0);
+ unsigned insn_alignment = insns[i].alignment();
+ size_t insn_size = insns[i].size();
+ gold_assert((offset & (insn_alignment - 1)) == 0);
this->alignment_ = std::max(this->alignment_, insn_alignment);
- switch (iinsns[i].type())
+ switch (insns[i].type())
{
case Insn_template::THUMB16_TYPE:
if (i == 0)
break;
case Insn_template::THUMB32_TYPE:
- if (iinsns[i].r_type() != elfcpp::R_ARM_NONE)
- this->relocs_.push_back(Reloc(i, off));
+ if (insns[i].r_type() != elfcpp::R_ARM_NONE)
+ this->relocs_.push_back(Reloc(i, offset));
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 (iinsns[i].r_type() == elfcpp::R_ARM_JUMP24)
- this->relocs_.push_back(Reloc(i, off));
+ if (insns[i].r_type() == elfcpp::R_ARM_JUMP24)
+ this->relocs_.push_back(Reloc(i, offset));
break;
case Insn_template::DATA_TYPE:
// Entry point cannot be data.
gold_assert(i != 0);
- this->relocs_.push_back(Reloc(i, off));
+ this->relocs_.push_back(Reloc(i, offset));
break;
default:
gold_unreachable();
}
- off += insn_size;
+ offset += insn_size;
}
- this->size_ = off;
+ this->size_ = offset;
}
// Reloc_stub::Key methods.
Reloc_stub::do_fixed_endian_write(unsigned char* view,
section_size_type view_size)
{
- const Stub_template* stubtemplate = this->stub_template();
- const Insn_template* insns = stubtemplate->insns();
+ const Stub_template* stub_template = this->stub_template();
+ const Insn_template* insns = stub_template->insns();
// FIXME: We do not handle BE8 encoding yet.
unsigned char* pov = view;
- for (size_t i = 0; i < stubtemplate->insn_count(); i++)
+ for (size_t i = 0; i < stub_template->insn_count(); i++)
{
switch (insns[i].type())
{
Reloc_stub* stub,
const Reloc_stub::Key& key)
{
- const Stub_template* stubtemplate = stub->stub_template();
- gold_assert(stubtemplate->type() == key.stub_type());
+ const Stub_template* stub_template = stub->stub_template();
+ gold_assert(stub_template->type() == key.stub_type());
this->reloc_stubs_[key] = stub;
- if (this->addralign_ < stubtemplate->alignment())
- this->addralign_ = stubtemplate->alignment();
+ if (this->addralign_ < stub_template->alignment())
+ this->addralign_ = stub_template->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* out_section,
+ Output_section* output_section,
unsigned char* view,
- Arm_address addr,
+ Arm_address address,
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(addr == this->address()
+ gold_assert(address == this->address()
&& (view_size
== static_cast<section_size_type>(this->data_size())));
++p)
{
Reloc_stub* stub = p->second;
- const Stub_template* stubtemplate = stub->stub_template();
- if (stubtemplate->reloc_count() != 0)
+ const Stub_template* stub_template = stub->stub_template();
+ if (stub_template->reloc_count() != 0)
{
// Adjust view to cover the stub only.
- section_size_type off = stub->offset();
- section_size_type stub_size = stubtemplate->size();
- gold_assert(off + stub_size <= view_size);
+ section_size_type offset = stub->offset();
+ section_size_type stub_size = stub_template->size();
+ gold_assert(offset + stub_size <= view_size);
- arm_target->relocate_stub(stub, relinfo, out_section,
- view + off, addr + off,
+ arm_target->relocate_stub(stub, relinfo, output_section,
+ view + offset, address + offset,
stub_size);
}
}
++p)
{
Reloc_stub* stub = p->second;
- const Stub_template* stubtemplate = stub->stub_template();
- uint64_t stub_addralign = stubtemplate->alignment();
+ const Stub_template* stub_template = stub->stub_template();
+ uint64_t stub_addralign = stub_template->alignment();
max_addralign = std::max(max_addralign, stub_addralign);
off = align_address(off, stub_addralign);
stub->set_offset(off);
stub->reset_destination_address();
- off += stubtemplate->size();
+ off += stub_template->size();
}
this->addralign_ = max_addralign;
void
Stub_table<big_endian>::do_write(Output_file* of)
{
- off_t off = this->offset();
+ off_t offset = this->offset();
const section_size_type oview_size =
convert_to_section_size_type(this->data_size());
- unsigned char* const oview = of->get_output_view(off, oview_size);
+ unsigned char* const oview = of->get_output_view(offset, 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 addr = this->address() + stub->offset();
- gold_assert(addr
- == align_address(addr,
+ Arm_address address = this->address() + stub->offset();
+ gold_assert(address
+ == align_address(address,
stub->stub_template()->alignment()));
stub->write(oview + stub->offset(), stub->stub_template()->size(),
big_endian);
void
Arm_input_section<big_endian>::init()
{
- Relobj* rel_obj = this->relobj();
- unsigned int sec_shndx = this->shndx();
+ Relobj* relobj = this->relobj();
+ unsigned int 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_ = rel_obj->section_addralign(sec_shndx);
- this->original_size_ = rel_obj->section_size(sec_shndx);
+ this->original_addralign_ = relobj->section_addralign(shndx);
+ this->original_size_ = relobj->section_size(shndx);
// We want to make this look like the original input section after
// output sections are finalized.
- 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);
+ 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);
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 addr = this->address();
+ uint64_t address = this->address();
// The stub table comes after the original section contents.
- 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());
+ 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());
}
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>* stubtable = this->stub_table_;
+ Stub_table<big_endian>* stub_table = 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 += stubtable->current_data_size();
+ off += stub_table->current_data_size();
}
this->set_current_data_size(off);
}
// Create a stub table.
- Stub_table<big_endian>* stubtable =
+ Stub_table<big_endian>* stub_table =
target->new_stub_table(arm_input_section);
- arm_input_section->set_stub_table(stubtable);
+ arm_input_section->set_stub_table(stub_table);
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(), stubtable);
+ arm_relobj->set_stub_table(p->shndx(), stub_table);
}
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 stubtable =
+ Input_section_list::const_iterator stub_table =
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;
- stubtable = group_end;
+ stub_table = 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, stubtable,
+ this->create_stub_group(group_begin, group_end, stub_table,
target, &new_relaxed_sections);
state = NO_GROUP;
}
this->create_stub_group(group_begin, group_end,
(state == FINDING_STUB_SECTION
? group_end
- : stubtable),
+ : stub_table),
target, &new_relaxed_sections);
}
Arm_relobj<big_endian>* arm_relobj =
Arm_relobj<big_endian>::as_arm_relobj(
new_relaxed_sections[i]->relobj());
- unsigned int sec_shndx = new_relaxed_sections[i]->shndx();
+ unsigned int shndx = new_relaxed_sections[i]->shndx();
// Tell Arm_relobj that this input section is converted.
- arm_relobj->convert_input_section_to_relaxed_section(sec_shndx);
+ arm_relobj->convert_input_section_to_relaxed_section(shndx);
}
}
Arm_relobj<big_endian>::scan_sections_for_stubs(
Target_arm<big_endian>* arm_target,
const Symbol_table* symtab,
- const Layout* alayout)
+ const Layout* layout)
{
- unsigned int sec_shnum = this->shnum();
- const unsigned int shdrsize = elfcpp::Elf_sizes<32>::shdr_size;
+ unsigned int shnum = this->shnum();
+ const unsigned int shdr_size = elfcpp::Elf_sizes<32>::shdr_size;
// Read the section headers.
const unsigned char* pshdrs = this->get_view(this->elf_file()->shoff(),
- sec_shnum * shdrsize,
+ shnum * shdr_size,
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 = alayout;
+ relinfo.layout = layout;
relinfo.object = this;
- const unsigned char* p = pshdrs + shdrsize;
- for (unsigned int i = 1; i < sec_shnum; ++i, p += shdrsize)
+ const unsigned char* p = pshdrs + shdr_size;
+ for (unsigned int i = 1; i < shnum; ++i, p += shdr_size)
{
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 sym_tab_shndx = this->symtab_shndx();
+ const unsigned int symtab_shndx = this->symtab_shndx();
elfcpp::Shdr<32, big_endian>
- symtabshdr(this, this->elf_file()->section_header(sym_tab_shndx));
+ symtabshdr(this, this->elf_file()->section_header(symtab_shndx));
gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB);
// Read the local symbols.
- const int symsize =elfcpp::Elf_sizes<32>::sym_size;
+ const int sym_size =elfcpp::Elf_sizes<32>::sym_size;
gold_assert(loccount == symtabshdr.get_sh_info());
- off_t locsize = loccount * symsize;
+ off_t locsize = loccount * sym_size;
const unsigned char* psyms = this->get_view(symtabshdr.get_sh_offset(),
locsize, true, true);
// to THUMB functions.
// Skip the first dummy symbol.
- psyms += symsize;
+ psyms += sym_size;
typename Sized_relobj<32, big_endian>::Local_values* plocal_values =
this->local_values();
- for (unsigned int i = 1; i < loccount; ++i, psyms += symsize)
+ for (unsigned int i = 1; i < loccount; ++i, psyms += sym_size)
{
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* alayout,
+ const Layout* layout,
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, alayout, pshdrs,
+ Sized_relobj<32, big_endian>::do_relocate_sections(symtab, layout, pshdrs,
pviews);
// We do not generate stubs if doing a relocatable link.
return;
// Relocate stub tables.
- unsigned int sec_shnum = this->shnum();
+ unsigned int 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 = alayout;
+ relinfo.layout = layout;
relinfo.object = this;
- for (unsigned int i = 1; i < sec_shnum; ++i)
+ for (unsigned int i = 1; i < 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>* stubtable = arm_input_section->stub_table();
- gold_assert((stubtable->address() >= (*pviews)[i].address)
- && ((stubtable->address() + stubtable->data_size())
+ 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())
<= (*pviews)[i].address + (*pviews)[i].view_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();
+ 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();
- stubtable->relocate_stubs(&relinfo, arm_target, os, pview, address,
- view_size);
+ stub_table->relocate_stubs(&relinfo, arm_target, os, view, address,
+ view_size);
}
}
// section just for PLT entries.
template<bool big_endian>
-Output_data_plt_arm<big_endian>::Output_data_plt_arm(Layout* alayout,
+Output_data_plt_arm<big_endian>::Output_data_plt_arm(Layout* layout,
Output_data_space* got_plt)
: Output_section_data(4), got_plt_(got_plt), count_(0)
{
this->rel_ = new Reloc_section(false);
- alayout->add_output_section_data(".rel.plt", elfcpp::SHT_REL,
- elfcpp::SHF_ALLOC, this->rel_, true);
+ layout->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 off = this->offset();
+ const off_t offset = this->offset();
const section_size_type oview_size =
convert_to_section_size_type(this->data_size());
- unsigned char* const oview = of->get_output_view(off, oview_size);
+ unsigned char* const oview = of->get_output_view(offset, 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 offst = ((got_address + got_offset)
- - (plt_address + plt_offset + 8));
+ int32_t offset = ((got_address + got_offset)
+ - (plt_address + plt_offset + 8));
- gold_assert(offst >= 0 && offst < 0x0fffffff);
- uint32_t plt_insn0 = plt_entry[0] | ((offst >> 20) & 0xff);
+ gold_assert(offset >= 0 && offset < 0x0fffffff);
+ uint32_t plt_insn0 = plt_entry[0] | ((offset >> 20) & 0xff);
elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
- uint32_t plt_insn1 = plt_entry[1] | ((offst >> 12) & 0xff);
+ uint32_t plt_insn1 = plt_entry[1] | ((offset >> 12) & 0xff);
elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
- uint32_t plt_insn2 = plt_entry[2] | (offst & 0xfff);
+ uint32_t plt_insn2 = plt_entry[2] | (offset & 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(off, oview_size, oview);
+ of->write_output_view(offset, 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* alayout,
+Target_arm<big_endian>::make_plt_entry(Symbol_table* symtab, Layout* layout,
Symbol* gsym)
{
if (gsym->has_plt_offset())
if (this->plt_ == NULL)
{
// Create the GOT sections first.
- this->got_section(symtab, alayout);
+ this->got_section(symtab, layout);
- 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_ = 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_->add_entry(gsym);
}
template<bool big_endian>
inline void
Target_arm<big_endian>::Scan::local(Symbol_table* symtab,
- Layout* alayout,
+ Layout* layout,
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(alayout);
+ Reloc_section* rel_dyn = target->rel_dyn_section(layout);
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, alayout);
+ target->got_section(symtab, layout);
break;
case elfcpp::R_ARM_BASE_PREL:
{
// The symbol requires a GOT entry.
Output_data_got<32, big_endian>* got =
- target->got_section(symtab, alayout);
+ target->got_section(symtab, layout);
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(alayout);
- unsigned int rsym = elfcpp::elf_r_sym<32>(reloc.get_r_info());
+ Reloc_section* rel_dyn = target->rel_dyn_section(layout);
+ unsigned int r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info());
rel_dyn->add_local_relative(
- object, rsym, elfcpp::R_ARM_RELATIVE, got,
- object->local_got_offset(rsym, GOT_TYPE_STANDARD));
+ object, r_sym, elfcpp::R_ARM_RELATIVE, got,
+ object->local_got_offset(r_sym, GOT_TYPE_STANDARD));
}
}
}
template<bool big_endian>
inline void
Target_arm<big_endian>::Scan::global(Symbol_table* symtab,
- Layout* alayout,
+ Layout* layout,
Target_arm* target,
Sized_relobj<32, big_endian>* object,
unsigned int data_shndx,
{
if (target->may_need_copy_reloc(gsym))
{
- target->copy_reloc(symtab, alayout, object,
+ target->copy_reloc(symtab, layout, 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(alayout);
+ Reloc_section* rel_dyn = target->rel_dyn_section(layout);
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(alayout);
+ Reloc_section* rel_dyn = target->rel_dyn_section(layout);
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, alayout, object,
+ target->copy_reloc(symtab, layout, object,
data_shndx, output_section, gsym, reloc);
}
else
{
check_non_pic(object, r_type);
- Reloc_section* rel_dyn = target->rel_dyn_section(alayout);
+ Reloc_section* rel_dyn = target->rel_dyn_section(layout);
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, alayout, gsym);
+ target->make_plt_entry(symtab, layout, 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, alayout, gsym);
+ target->make_plt_entry(symtab, layout, gsym);
break;
case elfcpp::R_ARM_GOTOFF32:
// We need a GOT section.
- target->got_section(symtab, alayout);
+ target->got_section(symtab, layout);
break;
case elfcpp::R_ARM_BASE_PREL:
{
// The symbol requires a GOT entry.
Output_data_got<32, big_endian>* got =
- target->got_section(symtab, alayout);
+ target->got_section(symtab, layout);
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(alayout);
+ Reloc_section* rel_dyn = target->rel_dyn_section(layout);
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* alayout,
+ Layout* layout,
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,
- alayout,
+ layout,
this,
object,
data_shndx,
template<bool big_endian>
void
Target_arm<big_endian>::scan_relocs(Symbol_table* symtab,
- Layout* alayout,
+ Layout* layout,
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,
- alayout,
+ layout,
this,
object,
data_shndx,
template<bool big_endian>
void
Target_arm<big_endian>::do_finalize_sections(
- Layout* alayout,
+ Layout* layout,
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 = alayout->dynamic_data();
+ Output_data_dynamic* const odyn = layout->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(alayout));
+ this->copy_relocs_.emit(this->rel_dyn_section(layout));
// Handle the .ARM.exidx section.
- Output_section* exidx_section = alayout->find_output_section(".ARM.exidx");
+ Output_section* exidx_section = layout->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 (!alayout->script_options()->saw_phdrs_clause())
+ if (!layout->script_options()->saw_phdrs_clause())
{
- gold_assert(alayout->find_output_segment(elfcpp::PT_ARM_EXIDX, 0, 0)
+ gold_assert(layout->find_output_segment(elfcpp::PT_ARM_EXIDX, 0, 0)
== NULL);
Output_segment* exidx_segment =
- alayout->make_output_segment(elfcpp::PT_ARM_EXIDX, elfcpp::PF_R);
+ layout->make_output_segment(elfcpp::PT_ARM_EXIDX, elfcpp::PF_R);
exidx_segment->add_output_section(exidx_section, elfcpp::PF_R,
false);
}
}
// Create an .ARM.attributes section if there is not one already.
- Output_attributes_section_data* as =
+ Output_attributes_section_data* attributes_section =
new Output_attributes_section_data(*this->attributes_section_data_);
- alayout->add_output_section_data(".ARM.attributes",
- elfcpp::SHT_ARM_ATTRIBUTES, 0, as, false);
+ layout->add_output_section_data(".ARM.attributes",
+ elfcpp::SHT_ARM_ATTRIBUTES, 0,
+ attributes_section, false);
}
// Return whether a direct absolute static relocation needs to be applied.
+ arm_input_section->data_size())
<= (address + view_size)));
- off_t off = section_address - address;
- view += off;
- address += off;
+ off_t offset = section_address - address;
+ view += offset;
+ address += offset;
view_size = section_size;
}
void
Target_arm<big_endian>::scan_relocatable_relocs(
Symbol_table* symtab,
- Layout* alayout,
+ Layout* layout,
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,
- alayout,
+ layout,
object,
data_shndx,
prelocs,
Target_arm<big_endian>::do_make_elf_object(
const std::string& name,
Input_file* input_file,
- off_t off, const elfcpp::Ehdr<32, big_endian>& ehdr)
+ off_t offset, 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, off, ehdr);
+ new Arm_relobj<big_endian>(name, input_file, offset, 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, off, ehdr);
+ new Arm_dynobj<big_endian>(name, input_file, offset, ehdr);
obj->setup();
return obj;
}
template<bool big_endian>
Arm_input_section<big_endian>*
Target_arm<big_endian>::new_arm_input_section(
- Relobj* rel_obj,
- unsigned int sec_shndx)
+ Relobj* relobj,
+ unsigned int shndx)
{
- Input_section_specifier iss(rel_obj, sec_shndx);
+ Input_section_specifier iss(relobj, shndx);
Arm_input_section<big_endian>* arm_input_section =
- new Arm_input_section<big_endian>(rel_obj, sec_shndx);
+ new Arm_input_section<big_endian>(relobj, 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* rel_obj,
- unsigned int sec_shndx) const
+ Relobj* relobj,
+ unsigned int shndx) const
{
- Input_section_specifier iss(rel_obj, sec_shndx);
+ Input_section_specifier iss(relobj, 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>* stubtable =
+ Stub_table<big_endian>* stub_table =
new Stub_table<big_endian>(owner);
- this->stub_tables_.push_back(stubtable);
+ this->stub_tables_.push_back(stub_table);
- stubtable->set_address(owner->address() + owner->data_size());
- stubtable->set_file_offset(owner->offset() + owner->data_size());
- stubtable->finalize_data_size();
+ stub_table->set_address(owner->address() + owner->data_size());
+ stub_table->set_file_offset(owner->offset() + owner->data_size());
+ stub_table->finalize_data_size();
- return stubtable;
+ return stub_table;
}
// 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>* stubtable =
+ Stub_table<big_endian>* stub_table =
arm_relobj->stub_table(relinfo->data_shndx);
- gold_assert(stubtable != NULL);
+ gold_assert(stub_table != 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 = stubtable->find_reloc_stub(stub_key);
+ Reloc_stub* stub = stub_table->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);
- stubtable->add_reloc_stub(stub, stub_key);
+ stub_table->add_reloc_stub(stub, stub_key);
}
// Record the destination address.
&& (r_type != elfcpp::R_ARM_THM_JUMP19))
continue;
- section_offset_type off =
+ section_offset_type offset =
convert_to_section_size_type(reloc.get_r_offset());
if (needs_special_offset_handling)
{
- off = output_section->output_offset(relinfo->object,
- relinfo->data_shndx,
- off);
- if (off == -1)
+ offset = output_section->output_offset(relinfo->object,
+ relinfo->data_shndx,
+ offset);
+ if (offset == -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 + off, reloc);
+ stub_addend_reader(r_type, view + offset, 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 sec_shndx = psymval->input_shndx(&is_ordinary);
+ unsigned int shndx = psymval->input_shndx(&is_ordinary);
if (is_ordinary
- && sec_shndx != elfcpp::SHN_UNDEF
- && !arm_object->is_section_included(sec_shndx)
- && !(relinfo->symtab->is_section_folded(arm_object, sec_shndx)))
+ && shndx != elfcpp::SHN_UNDEF
+ && !arm_object->is_section_included(shndx)
+ && !(relinfo->symtab->is_section_folded(arm_object, shndx)))
{
if (comdat_behavior == CB_UNDETERMINED)
{
{
bool found;
typename elfcpp::Elf_types<32>::Elf_Addr value =
- arm_object->map_to_kept_section(sec_shndx, &found);
+ arm_object->map_to_kept_section(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 + off);
+ addend, view_address + offset);
}
}
template<bool big_endian>
void
Target_arm<big_endian>::group_sections(
- Layout* alayout,
+ Layout* layout,
section_size_type group_size,
bool stubs_always_after_branch)
{
// Group input sections and insert stub table
Layout::Section_list section_list;
- alayout->get_allocated_sections(§ion_list);
+ layout->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* alayout)
+ Layout* layout)
{
// No need to generate stubs if this is a relocatable link.
gold_assert(!parameters->options().relocatable());
stub_group_size = 4170000;
}
- group_sections(alayout, stub_group_size, stubs_always_after_branch);
+ group_sections(layout, 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, alayout);
+ arm_relobj->scan_sections_for_stubs(this, symtab, layout);
}
bool any_stub_table_changed = false;
section_size_type view_size)
{
Relocate relocate;
- const Stub_template* stubtemplate = stub->stub_template();
- for (size_t i = 0; i < stubtemplate->reloc_count(); i++)
+ const Stub_template* stub_template = stub->stub_template();
+ for (size_t i = 0; i < stub_template->reloc_count(); i++)
{
- size_t reloc_insn_index = stubtemplate->reloc_insn_index(i);
- const Insn_template* insn = &stubtemplate->insns()[reloc_insn_index];
+ size_t reloc_insn_index = stub_template->reloc_insn_index(i);
+ const Insn_template* insn = &stub_template->insns()[reloc_insn_index];
unsigned int r_type = insn->r_type();
- section_size_type reloc_offset = stubtemplate->reloc_offset(i);
+ section_size_type reloc_offset = stub_template->reloc_offset(i);
section_size_type reloc_size = insn->size();
gold_assert(reloc_offset + reloc_size <= view_size);
if (this->is_default_attribute())
return 0;
- size_t uleb128_size = get_length_as_unsigned_LEB_128(tag);
+ size_t size = get_length_as_unsigned_LEB_128(tag);
if (Object_attribute::attribute_type_has_int_value(this->type_))
- uleb128_size += get_length_as_unsigned_LEB_128(this->int_value_);
+ size += get_length_as_unsigned_LEB_128(this->int_value_);
if (Object_attribute::attribute_type_has_string_value(this->type_))
- uleb128_size += this->string_value_.size() + 1;
- return uleb128_size;
+ size += this->string_value_.size() + 1;
+ return size;
}
// Whether this has the default value (0/"").
}
// Construct an Attributes_section_data object by parsing section contents
-// specified by VIEW and VIEW_SIZE.
+// specified by VIEW and SIZE.
Attributes_section_data::Attributes_section_data(
const unsigned char* view,
- section_size_type view_size)
+ section_size_type size)
{
for (int vendor = OBJ_ATTR_FIRST; vendor <= OBJ_ATTR_LAST; ++vendor)
this->vendor_object_attributes_[vendor] =
p = view;
if (*(p++) == 'A')
{
- view_size--;
- while (view_size > 0)
+ size--;
+ while (size > 0)
{
// Size of vendor attributes section.
section_size_type section_size =
convert_to_section_size_type(read_from_pointer<32>(&p));
- if (section_size > view_size)
- section_size = view_size;
- view_size -= section_size;
+ if (section_size > size)
+ section_size = size;
+ size -= section_size;
const char* section_name = reinterpret_cast<const char*>(p);
section_size_type section_name_size = strlen(section_name) + 1;
void
Output_attributes_section_data::do_write(Output_file* of)
{
+ off_t offset = this->offset();
const section_size_type oview_size =
convert_to_section_size_type(this->data_size());
- unsigned char* const oview = of->get_output_view(this->offset(), oview_size);
+ unsigned char* const oview = of->get_output_view(offset, oview_size);
std::vector<unsigned char> buffer;
this->attributes_section_data_.write(&buffer);
// Set attribute type.
void
- set_type(int at)
- { this->type_ = at; }
+ set_type(int type)
+ { this->type_ = type; }
// Return integer value.
unsigned int
// compressed_output.cc -- manage compressed output sections for gold
-// Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2007, 2008 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 off = this->offset();
- off_t datasize = this->data_size();
- unsigned char* view = of->get_output_view(off, datasize);
+ off_t offset = this->offset();
+ off_t data_size = this->data_size();
+ unsigned char* view = of->get_output_view(offset, data_size);
if (this->data_ == NULL)
- memcpy(view, this->postprocessing_buffer(), datasize);
+ memcpy(view, this->postprocessing_buffer(), data_size);
else
- memcpy(view, this->data_, datasize);
- of->write_output_view(off, datasize, view);
+ memcpy(view, this->data_, data_size);
+ of->write_output_view(offset, data_size, view);
}
} // End namespace gold.
// compressed_output.h -- compressed output sections for gold -*- C++ -*-
-// Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2007, 2008 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* cname, elfcpp::Elf_Word cflags,
- elfcpp::Elf_Xword ctype)
- : Output_section(cname, cflags, ctype),
+ const char* name, elfcpp::Elf_Word flags,
+ elfcpp::Elf_Xword type)
+ : Output_section(name, flags, type),
options_(options)
{ this->set_requires_postprocessing(); }
-WARN_CXXFLAGS=`echo ${WARN_CFLAGS} | sed -e 's/-Wstrict-prototypes//' -e 's/-Wmissing-prototypes//'`
+WARN_CXXFLAGS=`echo ${WARN_CFLAGS} | sed -e 's/-Wstrict-prototypes//' -e 's/-Wmissing-prototypes//' -e 's/-Wshadow//'`
LFS_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
AM_BINUTILS_WARNINGS
-WARN_CXXFLAGS=`echo ${WARN_CFLAGS} | sed -e 's/-Wstrict-prototypes//' -e 's/-Wmissing-prototypes//'`
+WARN_CXXFLAGS=`echo ${WARN_CFLAGS} | sed -e 's/-Wstrict-prototypes//' -e 's/-Wmissing-prototypes//' -e 's/-Wshadow//'`
AC_SUBST(WARN_CXXFLAGS)
dnl Force support for large files by default. This may need to be
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& aname, Input_file* ainput_file, off_t aoffset)
- : Object(aname, ainput_file, true, aoffset),
+Dynobj::Dynobj(const std::string& name, Input_file* input_file, off_t offset)
+ : Object(name, input_file, true, offset),
needed_(),
unknown_needed_(UNKNOWN_NEEDED_UNSET)
{
template<int size, bool big_endian>
Sized_dynobj<size, big_endian>::Sized_dynobj(
- const std::string& aname,
- Input_file* ainput_file,
- off_t aoffset,
+ const std::string& name,
+ Input_file* input_file,
+ off_t offset,
const elfcpp::Ehdr<size, big_endian>& ehdr)
- : Dynobj(aname, ainput_file, aoffset),
+ : Dynobj(name, input_file, offset),
elf_file_(this, ehdr),
dynsym_shndx_(-1U),
symbols_(NULL),
void
Sized_dynobj<size, big_endian>::setup()
{
- const unsigned int sec_shnum = this->elf_file_.shnum();
- this->set_shnum(sec_shnum);
+ const unsigned int shnum = this->elf_file_.shnum();
+ this->set_shnum(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 sec_shnum = this->shnum();
+ const unsigned int shnum = this->shnum();
const unsigned char* p = pshdrs;
- for (unsigned int i = 0; i < sec_shnum; ++i, p += This::shdr_size)
+ for (unsigned int i = 0; i < shnum; ++i, p += This::shdr_size)
{
typename This::Shdr shdr(p);
unsigned int shndx,
elfcpp::SHT type,
unsigned int link,
- File_view** aview,
+ File_view** view,
section_size_type* view_size,
unsigned int* view_info)
{
if (shndx == -1U)
{
- *aview = NULL;
+ *view = 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);
- *aview = this->get_lasting_view(shdr.get_sh_offset(), shdr.get_sh_size(),
- true, false);
+ *view = 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 sec_shnum = this->shnum();
- if (sec_shnum == 0)
+ const unsigned int shnum = this->shnum();
+ if (shnum == 0)
return;
// Get the section headers.
// Skip the first, dummy, section.
pshdrs += This::shdr_size;
- for (unsigned int i = 1; i < sec_shnum; ++i, pshdrs += This::shdr_size)
+ for (unsigned int i = 1; i < shnum; ++i, pshdrs += This::shdr_size)
{
typename This::Shdr shdr(pshdrs);
return;
}
- const char* aname = pnames + shdr.get_sh_name();
+ const char* name = pnames + shdr.get_sh_name();
- this->handle_gnu_warning_section(aname, i, symtab);
- this->handle_split_stack_section(aname);
+ this->handle_gnu_warning_section(name, i, symtab);
+ this->handle_split_stack_section(name);
}
delete sd->section_headers;
Sized_dynobj<size, big_endian>::set_version_map(
Version_map* version_map,
unsigned int ndx,
- const char* aname) const
+ const char* name) 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] = aname;
+ (*version_map)[ndx] = name;
}
// Add mappings for the version definitions to VERSION_MAP.
return;
}
- const int symsize = This::sym_size;
- const size_t symcount = sd->symbols_size / symsize;
+ const int sym_size = This::sym_size;
+ const size_t symcount = sd->symbols_size / sym_size;
gold_assert(sd->external_symbols_offset == 0);
- if (symcount * symsize != sd->symbols_size)
+ if (symcount * sym_size != 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> avda(pb);
- avda.set_vda_name(dynpool->get_offset(*p));
- avda.set_vda_next(i + 1 >= this->deps_.size() ? 0 : verdaux_size);
+ 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);
pb += verdaux_size;
}
// Versions methods.
-Versions::Versions(const Version_script_info& vscript,
+Versions::Versions(const Version_script_info& version_script,
Stringpool* dynpool)
: defs_(), needs_(), version_table_(),
- is_finalized_(false), version_script_(vscript),
+ is_finalized_(false), version_script_(version_script),
needs_base_version_(parameters->options().shared())
{
if (!this->version_script_.empty())
p != syms.end();
++p)
{
- unsigned int vindex;
+ unsigned int version_index;
const char* version = (*p)->version();
if (version == NULL)
- vindex = elfcpp::VER_NDX_GLOBAL;
+ version_index = elfcpp::VER_NDX_GLOBAL;
else
- vindex = this->version_index(symtab, dynpool, *p);
+ version_index = 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())
- vindex |= elfcpp::VERSYM_HIDDEN;
+ version_index |= elfcpp::VERSYM_HIDDEN;
elfcpp::Swap<16, big_endian>::writeval(pbuf + (*p)->dynsym_index() * 2,
- vindex);
+ version_index);
}
*pp = pbuf;
// Set the version index.
void
- set_index(unsigned int vindex)
+ set_index(unsigned int index)
{
gold_assert(this->index_ == -1U);
- this->index_ = vindex;
+ this->index_ = index;
}
// Clear the weak flag in a version definition.
class Verdef : public Version_base
{
public:
- 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)
+ 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)
{ }
// Return the version name.
// Add a dependency to this version. The NAME should be
// canonicalized in the dynamic Stringpool.
void
- add_dependency(const char* dname)
- { this->deps_.push_back(dname); }
+ add_dependency(const char* name)
+ { this->deps_.push_back(name); }
// Return whether this definition is weak.
bool
class Verneed_version : public Version_base
{
public:
- Verneed_version(const char* ver)
- : version_(ver)
+ Verneed_version(const char* version)
+ : version_(version)
{ }
// Return the version name.
class Verneed
{
public:
- Verneed(const char* fname)
- : filename_(fname), need_versions_()
+ Verneed(const char* filename)
+ : filename_(filename), need_versions_()
{ }
~Verneed();
void
Eh_frame_hdr::set_final_data_size()
{
- unsigned int datasize = eh_frame_hdr_size + 4;
+ unsigned int data_size = 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)
- datasize += 4 + 8 * fde_count;
+ data_size += 4 + 8 * fde_count;
this->fde_offsets_.reserve(fde_count);
}
- this->set_data_size(datasize);
+ this->set_data_size(data_size);
}
// Write the data to the flie.
{
gold_assert((offset & (addralign - 1)) == 0);
- size_t len = this->contents_.length();
+ size_t length = 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(len + 8, addralign);
+ size_t aligned_full_length = align_address(length + 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(), len);
+ memcpy(oview + offset + 8, this->contents_.data(), length);
- if (aligned_full_length > len + 8)
- memset(oview + offset + len + 8, 0, aligned_full_length - (len + 8));
+ if (aligned_full_length > length + 8)
+ memset(oview + offset + length + 8, 0, aligned_full_length - (length + 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 fde_offset,
+ unsigned int offset,
const unsigned char* pfde,
const unsigned char *pfdeend,
Track_relocs<size, big_endian>* relocs,
Offsets_to_cie* cies)
{
- // FDE_OFFSET is the distance between the 4 bytes before PFDE to the
+ // 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) - fde_offset + 8;
+ unsigned int cie_offset = (pfde - 4 - pcontents) - offset + 8;
Offsets_to_cie::const_iterator pcie = cies->find(cie_offset);
if (pcie == cies->end())
return false;
return;
}
- section_offset_type out_offset = 0;
+ section_offset_type output_offset = 0;
for (Unmergeable_cie_offsets::iterator p =
this->unmergeable_cie_offsets_.begin();
p != this->unmergeable_cie_offsets_.end();
++p)
- out_offset = (*p)->set_output_offset(out_offset,
- this->addralign(),
- &this->merge_map_);
+ output_offset = (*p)->set_output_offset(output_offset,
+ this->addralign(),
+ &this->merge_map_);
for (Cie_offsets::iterator p = this->cie_offsets_.begin();
p != this->cie_offsets_.end();
++p)
- out_offset = (*p)->set_output_offset(out_offset,
- this->addralign(),
- &this->merge_map_);
+ output_offset = (*p)->set_output_offset(output_offset,
+ this->addralign(),
+ &this->merge_map_);
this->mappings_are_done_ = true;
- this->final_data_size_ = out_offset;
+ this->final_data_size_ = output_offset;
- gold_assert((out_offset & (this->addralign() - 1)) == 0);
- this->set_data_size(out_offset);
+ gold_assert((output_offset & (this->addralign() - 1)) == 0);
+ this->set_data_size(output_offset);
}
// Return an output offset for an input offset.
bool
Eh_frame::do_output_offset(const Relobj* object, unsigned int shndx,
- section_offset_type foffset,
+ section_offset_type offset,
section_offset_type* poutput) const
{
- return this->merge_map_.get_output_offset(object, shndx, foffset, poutput);
+ return this->merge_map_.get_output_offset(object, shndx, offset, poutput);
}
// Return whether this is the merge section for an input section.
void
Eh_frame::do_write(Output_file* of)
{
- const off_t foffset = this->offset();
+ const off_t offset = this->offset();
const off_t oview_size = this->data_size();
- unsigned char* const oview = of->get_output_view(foffset, oview_size);
+ unsigned char* const oview = of->get_output_view(offset, oview_size);
switch (parameters->size_and_endianness())
{
gold_unreachable();
}
- of->write_output_view(foffset, oview_size, oview);
+ of->write_output_view(offset, oview_size, oview);
}
// Write the data to the output file--template version.
void
Eh_frame::do_sized_write(unsigned char* oview)
{
- unsigned int addr_align = this->addralign();
+ unsigned int addralign = 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, addr_align,
+ o = (*p)->write<size, big_endian>(oview, o, addralign,
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, addr_align,
+ o = (*p)->write<size, big_endian>(oview, o, addralign,
this->eh_frame_hdr_);
}
// ehframe.h -- handle exception frame sections for gold -*- C++ -*-
-// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008 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 len)
+ const unsigned char* contents, size_t length)
: object_(object), shndx_(shndx), input_offset_(input_offset),
- contents_(reinterpret_cast<const char*>(contents), len)
+ contents_(reinterpret_cast<const char*>(contents), length)
{ }
// Return the length of this FDE. Add 4 for the length and 4 for
// errors.cc -- handle errors for gold
-// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008 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* prog_name)
- : program_name_(prog_name), lock_(NULL), initialize_lock_(&this->lock_),
+Errors::Errors(const char* program_name)
+ : program_name_(program_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, 2009 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008 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 val = this->left_value(eei, eei->result_section_pointer);
+ uint64_t value = this->left_value(eei, eei->result_section_pointer);
if (align <= 1)
- return val;
- return ((val + align - 1) / align) * align;
+ return value;
+ return ((value + align - 1) / align) * align;
}
void
uint64_t
value(const Expression_eval_info* eei)
{
- uint64_t val = this->arg_value(eei, eei->result_section_pointer);
- if (!val && eei->check_assertions)
+ uint64_t value = this->arg_value(eei, eei->result_section_pointer);
+ if (!value && eei->check_assertions)
gold_error("%s", this->message_.c_str());
- return val;
+ return value;
}
void
// Create a file for testing.
-Input_file::Input_file(const Task* task, const char* iname,
+Input_file::Input_file(const Task* task, const char* name,
const unsigned char* contents, off_t size)
: file_()
{
this->input_argument_ =
- new Input_file_argument(iname, Input_file_argument::INPUT_FILE_TYPE_FILE,
+ new Input_file_argument(name, Input_file_argument::INPUT_FILE_TYPE_FILE,
"", false, Position_dependent_options());
- bool ok = this->file_.open(task, iname, contents, size);
+ bool ok = this->file_.open(task, name, contents, size);
gold_assert(ok);
}
bool
Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex)
{
- std::string iname;
+ std::string name;
// 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))
{
- iname = this->input_argument_->name();
- this->found_name_ = iname;
+ name = this->input_argument_->name();
+ this->found_name_ = name;
}
// 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();
- iname = dirpath.find(n1, n2, &this->is_in_sysroot_, pindex);
- if (iname.empty())
+ name = dirpath.find(n1, n2, &this->is_in_sysroot_, pindex);
+ if (name.empty())
{
gold_error(_("cannot find %s%s"),
this->input_argument_->is_lib() ? "-l" : "",
this->input_argument_->name());
return false;
}
- if (n2.empty() || iname[iname.length() - 1] == 'o')
+ if (n2.empty() || name[name.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.
- iname = this->input_argument_->extra_search_path();
- if (!IS_DIR_SEPARATOR (iname[iname.length() - 1]))
- iname += '/';
- iname += this->input_argument_->name();
+ name = this->input_argument_->extra_search_path();
+ if (!IS_DIR_SEPARATOR (name[name.length() - 1]))
+ name += '/';
+ name += this->input_argument_->name();
struct stat dummy_stat;
- if (*pindex > 0 || ::stat(iname.c_str(), &dummy_stat) < 0)
+ if (*pindex > 0 || ::stat(name.c_str(), &dummy_stat) < 0)
{
// extra_search_path failed, so check the normal search-path.
int index = *pindex;
if (index > 0)
--index;
- iname = dirpath.find(this->input_argument_->name(), "",
- &this->is_in_sysroot_, &index);
- if (iname.empty())
+ name = dirpath.find(this->input_argument_->name(), "",
+ &this->is_in_sysroot_, &index);
+ if (name.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, iname);
+ ok = this->file_.open(task, name);
else
{
gold_assert(format == General_options::OBJECT_FORMAT_BINARY);
- ok = this->open_binary(task, iname);
+ ok = this->open_binary(task, name);
}
if (!ok)
{
gold_error(_("cannot open %s: %s"),
- iname.c_str(), strerror(errno));
+ name.c_str(), strerror(errno));
return false;
}
// Open a file for --format binary.
bool
-Input_file::open_binary(const Task* task, const std::string& iname)
+Input_file::open_binary(const Task* task, const std::string& name)
{
// 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(),
- iname);
+ name);
if (!binary_to_elf.convert(task))
return false;
- return this->file_.open(task, iname, binary_to_elf.converted_data_leak(),
+ return this->file_.open(task, name, binary_to_elf.converted_data_leak(),
binary_to_elf.converted_size());
}
DATA_MMAPPED
};
- 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),
+ 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),
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* vdata)
- : file_(file), view_(view), data_(vdata)
+ File_view(File_read& file, File_read::View* view, const unsigned char* data)
+ : file_(file), view_(view), data_(data)
{ }
File_read& file_;
class Target_selector_freebsd : public Target_selector
{
public:
- Target_selector_freebsd(int amachine, int size, bool is_big_end,
- const char* bfdname,
+ Target_selector_freebsd(int machine, int size, bool is_big_endian,
+ const char* bfd_name,
const char* freebsd_bfd_name)
- : Target_selector(amachine, size, is_big_end, NULL),
- bfd_name_(bfdname), freebsd_bfd_name_(freebsd_bfd_name)
+ : Target_selector(machine, size, is_big_endian, NULL),
+ bfd_name_(bfd_name), freebsd_bfd_name_(freebsd_bfd_name)
{ }
protected:
void
Output_data_plt_i386::do_write(Output_file* of)
{
- const off_t off = this->offset();
+ const off_t offset = this->offset();
const section_size_type oview_size =
convert_to_section_size_type(this->data_size());
- unsigned char* const oview = of->get_output_view(off, oview_size);
+ unsigned char* const oview = of->get_output_view(offset, 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(off, oview_size, oview);
+ of->write_output_view(offset, 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);
- r_sym = elfcpp::elf_r_sym<32>(reloc.get_r_info());
+ unsigned int 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_rels;
+ std::vector<unsigned int> num_tracked_relocs;
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_rels.push_back(0);
+ num_tracked_relocs.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_rels, &this->kept_section_id_,
+ &num_tracked_relocs, &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& ins)
- { this->inputs_ = &ins; }
+ report_inputs(const Input_arguments& inputs)
+ { this->inputs_ = &inputs; }
// Record that the input argument INPUT is an archive ARCHIVE.
void
// Layout methods.
-Layout::Layout(int number_of_input_files, Script_options* script_opts)
+Layout::Layout(int number_of_input_files, Script_options* script_options)
: number_of_input_files_(number_of_input_files),
- script_options_(script_opts),
+ script_options_(script_options),
namepool_(),
sympool_(),
dynpool_(),
// inconvenient to check.
if (this->allocated_output_section_count() >= elfcpp::SHN_LORESERVE)
{
- Output_section* dyn_sym_xindex =
+ Output_section* dynsym_xindex =
this->choose_output_section(NULL, ".dynsym_shndx",
elfcpp::SHT_SYMTAB_SHNDX,
elfcpp::SHF_ALLOC,
this->dynsym_xindex_ = new Output_symtab_xindex(index);
- dyn_sym_xindex->add_output_section_data(this->dynsym_xindex_);
+ dynsym_xindex->add_output_section_data(this->dynsym_xindex_);
- dyn_sym_xindex->set_link_section(dynsym);
- dyn_sym_xindex->set_addralign(4);
- dyn_sym_xindex->set_entsize(4);
+ dynsym_xindex->set_link_section(dynsym);
+ dynsym_xindex->set_addralign(4);
+ dynsym_xindex->set_entsize(4);
- dyn_sym_xindex->set_after_input_sections();
+ dynsym_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* sec_list) const
+Layout::get_allocated_sections(Section_list* section_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)
- sec_list->push_back(*p);
+ section_list->push_back(*p);
}
// Create an output segment.
{
if (!parameters->options().strip_all())
{
- const Output_section* sym_tab_section = this->symtab_section_;
+ const Output_section* symtab_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(sym_tab_section != NULL);
+ gold_assert(symtab_section != NULL);
unsigned int index = (*p)->symtab_index();
gold_assert(index > 0 && index != -1U);
- off_t off = (sym_tab_section->offset()
- + index * sym_tab_section->entsize());
+ off_t off = (symtab_section->offset()
+ + index * symtab_section->entsize());
symtab->write_section_symbol(*p, this->symtab_xindex_, of, off);
}
}
}
- const Output_section* dyn_sym_section = this->dynsym_section_;
+ const Output_section* dynsym_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(dyn_sym_section != NULL);
+ gold_assert(dynsym_section != NULL);
unsigned int index = (*p)->dynsym_index();
gold_assert(index > 0 && index != -1U);
- off_t off = (dyn_sym_section->offset()
- + index * dyn_sym_section->entsize());
+ off_t off = (dynsym_section->offset()
+ + index * dynsym_section->entsize());
symtab->write_section_symbol(*p, this->dynsym_xindex_, of, off);
}
}
// Set the object.
void
- set_object(Relobj* obj)
+ set_object(Relobj* object)
{
gold_assert(this->object_ == NULL);
- this->object_ = obj;
+ this->object_ = object;
}
// The section index.
// Set the section index.
void
- set_shndx(unsigned int sec_shndx)
+ set_shndx(unsigned int shndx)
{
gold_assert(this->shndx_ == 0);
- this->shndx_ = sec_shndx;
+ this->shndx_ = shndx;
}
// Whether this is a comdat group.
// Add a section to the group list.
void
- add_comdat_section(const std::string& name, unsigned int sec_shndx,
+ add_comdat_section(const std::string& name, unsigned int shndx,
uint64_t size)
{
gold_assert(this->is_comdat_);
- Comdat_section_info sinfo(sec_shndx, size);
+ Comdat_section_info sinfo(shndx, size);
this->u_.group_sections->insert(std::make_pair(name, sinfo));
}
&& is_ordinary
&& sym->is_defined())
{
- for (size_t j = 0; j < Mapfile::section_name_map_length; ++j)
+ for (size_t i = 0; i < Mapfile::section_name_map_length; ++i)
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 off,
+ section_offset_type offset,
section_offset_type* poutput) const
{
- return this->merge_map_.get_output_offset(object, shndx, off, poutput);
+ return this->merge_map_.get_output_offset(object, shndx, offset, 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 ent_size = convert_to_section_size_type(this->entsize());
- section_size_type addr_align =
+ section_size_type entsize = convert_to_section_size_type(this->entsize());
+ section_size_type addralign =
convert_to_section_size_type(this->addralign());
- section_size_type addsize = std::max(ent_size, addr_align);
+ section_size_type addsize = std::max(entsize, addralign);
if (this->len_ + addsize > this->alc_)
{
if (this->alc_ == 0)
gold_nomem();
}
- memcpy(this->p_ + this->len_, p, ent_size);
- if (addsize > ent_size)
- memset(this->p_ + this->len_ + ent_size, 0, addsize - ent_size);
+ memcpy(this->p_ + this->len_, p, entsize);
+ if (addsize > entsize)
+ memset(this->p_ + this->len_ + entsize, 0, addsize - entsize);
this->len_ += addsize;
}
section_size_type len;
const unsigned char* p = object->section_contents(shndx, &len, false);
- section_size_type ent_size = convert_to_section_size_type(this->entsize());
+ section_size_type entsize = convert_to_section_size_type(this->entsize());
- if (len % ent_size != 0)
+ if (len % entsize != 0)
return false;
- this->input_count_ += len / ent_size;
+ this->input_count_ += len / entsize;
- for (section_size_type i = 0; i < len; i += ent_size, p += ent_size)
+ for (section_size_type i = 0; i < len; i += entsize, p += entsize)
{
// 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_ -= ent_size;
+ this->len_ -= entsize;
k = *ins.first;
}
// Record the offset of this constant in the output section.
- this->add_mapping(object, shndx, i, ent_size, k);
+ this->add_mapping(object, shndx, i, entsize, k);
}
return true;
p != this->merged_strings_.end();
++p)
{
- section_offset_type soffset =
+ section_offset_type offset =
this->stringpool_.get_offset_from_key(p->stringpool_key);
- this->add_mapping(p->object, p->shndx, p->offset, p->length, soffset);
+ this->add_mapping(p->object, p->shndx, p->offset, p->length, offset);
}
// Save some memory. This also ensures that this function will work
// merge.h -- handle section merging for gold -*- C++ -*-
-// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008 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 ent_size, uint64_t addr_align)
- : Output_section_data(addr_align), merge_map_(), entsize_(ent_size)
+ Output_merge_base(uint64_t entsize, uint64_t addralign)
+ : Output_section_data(addralign), merge_map_(), entsize_(entsize)
{ }
// Return the entry size.
bool
do_is_merge_section_for(const Relobj*, unsigned int shndx) const;
- // Add a mapping from an IN_OFFSET in input section SHNDX in object
- // OBJECT to an OUT_OFFSET in the output section. OUT_OFFSET
+ // Add a mapping from an OFFSET in input section SHNDX in object
+ // OBJECT to an OUTPUT_OFFSET in the output section. OUTPUT_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 in_offset,
- section_size_type length, section_offset_type out_offset)
+ add_mapping(Relobj* object, unsigned int shndx, section_offset_type offset,
+ section_size_type length, section_offset_type output_offset)
{
- this->merge_map_.add_mapping(object, shndx, in_offset, length, out_offset);
+ this->merge_map_.add_mapping(object, shndx, offset, length, output_offset);
}
// This may be overriden by the child class.
class Output_merge_data : public Output_merge_base
{
public:
- Output_merge_data(uint64_t ent_size, uint64_t addr_align)
- : Output_merge_base(ent_size, addr_align), p_(NULL), len_(0), alc_(0),
+ Output_merge_data(uint64_t entsize, uint64_t addralign)
+ : Output_merge_base(entsize, addralign), 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 addr_align)
- : Output_merge_base(sizeof(Char_type), addr_align), stringpool_(),
+ Output_merge_string(uint64_t addralign)
+ : Output_merge_base(sizeof(Char_type), addralign), stringpool_(),
merged_strings_(), input_count_(0)
{
- gold_assert(addr_align <= sizeof(Char_type));
+ gold_assert(addralign <= sizeof(Char_type));
this->stringpool_.set_no_zero_null();
}
template<int size, bool big_endian>
void
-Xindex::initialize_symtab_xindex(Object* object, unsigned int sym_tab_shndx)
+Xindex::initialize_symtab_xindex(Object* object, unsigned int symtab_shndx)
{
if (!this->symtab_xindex_.empty())
return;
- gold_assert(sym_tab_shndx != 0);
+ gold_assert(symtab_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)) == sym_tab_shndx)
+ && this->adjust_shndx(object->section_link(i)) == symtab_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 sec_shnum = this->shnum();
- sd->section_headers = this->get_lasting_view(shoff, sec_shnum * shdr_size,
+ const unsigned int shnum = this->shnum();
+ sd->section_headers = this->get_lasting_view(shoff, shnum * shdr_size,
true, true);
// Read the section names.
false);
}
-// If SNAME is the name of a special .gnu.warning section, arrange for
+// If NAME 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* sname, unsigned int shndx,
+Object::handle_gnu_warning_section(const char* name, unsigned int shndx,
Symbol_table* symtab)
{
const char warn_prefix[] = ".gnu.warning.";
const int warn_prefix_len = sizeof warn_prefix - 1;
- if (strncmp(sname, warn_prefix, warn_prefix_len) == 0)
+ if (strncmp(name, 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 = sname + warn_prefix_len;
+ const char* warning = name + 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(sname + warn_prefix_len, this, warning);
+ symtab->add_warning(name + warn_prefix_len, this, warning);
return true;
}
return false;
}
-// If SNAME is the name of the special section which indicates that
+// If NAME 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* sname)
+Object::handle_split_stack_section(const char* name)
{
- if (strcmp(sname, ".note.GNU-split-stack") == 0)
+ if (strcmp(name, ".note.GNU-split-stack") == 0)
{
this->uses_split_stack_ = true;
return true;
}
- if (strcmp(sname, ".note.GNU-no-split-stack") == 0)
+ if (strcmp(name, ".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* sname)
+Relobj::is_section_name_included(const char* name)
{
- 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")))
+ 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")))
{
return true;
}
template<int size, bool big_endian>
Sized_relobj<size, big_endian>::Sized_relobj(
- const std::string& aname,
- Input_file* ainput_file,
- off_t aoffset,
+ const std::string& name,
+ Input_file* input_file,
+ off_t offset,
const elfcpp::Ehdr<size, big_endian>& ehdr)
- : Relobj(aname, ainput_file, aoffset),
+ : Relobj(name, input_file, offset),
elf_file_(this, ehdr),
symtab_shndx_(-1U),
local_symbol_count_(0),
void
Sized_relobj<size, big_endian>::do_setup()
{
- const unsigned int sec_shnum = this->elf_file_.shnum();
- this->set_shnum(sec_shnum);
+ const unsigned int shnum = this->elf_file_.shnum();
+ this->set_shnum(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 sec_shnum = this->shnum();
+ const unsigned int shnum = this->shnum();
this->symtab_shndx_ = 0;
- if (sec_shnum > 0)
+ if (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 + sec_shnum * This::shdr_size;
- unsigned int i = sec_shnum;
+ const unsigned char* p = pshdrs + shnum * This::shdr_size;
+ unsigned int i = 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 sec_shnum = this->shnum();
+ const unsigned int shnum = this->shnum();
const unsigned char* p = pshdrs + This::shdr_size;
- for (unsigned int i = 1; i < sec_shnum; ++i, p += This::shdr_size)
+ for (unsigned int i = 1; i < shnum; ++i, p += This::shdr_size)
{
typename This::Shdr shdr(p);
if (this->check_eh_frame_flags(&shdr))
continue;
}
- const char* aname = names + shdr.get_sh_name();
- if (strcmp(aname, ".eh_frame") == 0)
+ const char* name = names + shdr.get_sh_name();
+ if (strcmp(name, ".eh_frame") == 0)
return true;
}
}
// object file format is over 5 pages that we don't need to read
// now.
- const int symsize = This::sym_size;
+ const int sym_size = 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 * symsize;
+ section_offset_type locsize = loccount * sym_size;
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* alayout,
+ Layout* layout,
unsigned int index,
- const char* aname,
+ const char* name,
const unsigned char* shdrs,
const char* section_names,
section_size_type section_names_size,
}
else
{
- include_group = alayout->find_or_add_kept_section(signature,
- this, index, true,
- true, &kept_section);
+ include_group = layout->find_or_add_kept_section(signature,
+ this, index, true,
+ true, &kept_section);
is_comdat = true;
}
}
if (relocate_group)
- alayout->layout_group(symtab, this, index, aname, signature.c_str(),
- shdr, flags, &shndxes);
+ layout->layout_group(symtab, this, index, name, 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* alayout,
+ Layout* layout,
unsigned int index,
- const char* aname,
+ const char* name,
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(aname, linkonce_t, strlen(linkonce_t)) == 0)
- symname = aname + strlen(linkonce_t);
+ if (strncmp(name, linkonce_t, strlen(linkonce_t)) == 0)
+ symname = name + strlen(linkonce_t);
else
- symname = strrchr(aname, '.') + 1;
+ symname = strrchr(name, '.') + 1;
std::string sig1(symname);
- std::string sig2(aname);
+ std::string sig2(name);
Kept_section* kept1;
Kept_section* 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);
+ 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);
if (!include2)
{
template<int size, bool big_endian>
inline void
-Sized_relobj<size, big_endian>::layout_section(Layout* alayout,
+Sized_relobj<size, big_endian>::layout_section(Layout* layout,
unsigned int shndx,
- const char* aname,
+ const char* name,
typename This::Shdr& shdr,
unsigned int reloc_shndx,
unsigned int reloc_type)
{
- off_t aoffset;
- Output_section* os = alayout->layout(this, shndx, aname, shdr,
- reloc_shndx, reloc_type, &aoffset);
+ off_t offset;
+ Output_section* os = layout->layout(this, shndx, name, shdr,
+ reloc_shndx, reloc_type, &offset);
this->output_sections()[shndx] = os;
- if (aoffset == -1)
+ if (offset == -1)
this->section_offsets_[shndx] = invalid_address;
else
- this->section_offsets_[shndx] = convert_types<Address, off_t>(aoffset);
+ this->section_offsets_[shndx] = convert_types<Address, off_t>(offset);
// 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 (aoffset == -1 && reloc_shndx != 0)
+ if (offset == -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* alayout,
+ Layout* layout,
Read_symbols_data* sd)
{
- const unsigned int sec_shnum = this->shnum();
+ const unsigned int 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 (sec_shnum == 0)
+ if (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 * sec_shnum);
+ this->copy_symbols_data(gc_sd, sd, This::shdr_size * 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(sec_shnum, 0);
- std::vector<unsigned int> reloc_type(sec_shnum, elfcpp::SHT_NULL);
+ std::vector<unsigned int> reloc_shndx(shnum, 0);
+ std::vector<unsigned int> reloc_type(shnum, elfcpp::SHT_NULL);
// Skip the first, dummy, section.
pshdrs = shdrs + This::shdr_size;
- for (unsigned int i = 1; i < sec_shnum; ++i, pshdrs += This::shdr_size)
+ for (unsigned int i = 1; i < 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 >= sec_shnum)
+ if (target_shndx == 0 || target_shndx >= shnum)
{
this->error(_("relocation section %u has bad info %u"),
i, target_shndx);
if (!is_gc_pass_two)
{
- out_sections.resize(sec_shnum);
- out_section_offsets.resize(sec_shnum);
+ out_sections.resize(shnum);
+ out_section_offsets.resize(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(sec_shnum, false);
+ std::vector<bool> omit(shnum, false);
// Keep track of reloc sections when emitting relocations.
const bool relocatable = parameters->options().relocatable();
- const bool emit_rels = (relocatable
- || parameters->options().emit_relocs());
+ const bool emit_relocs = (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 < sec_shnum; ++i, pshdrs += This::shdr_size)
+ for (unsigned int i = 1; i < shnum; ++i, pshdrs += This::shdr_size)
{
typename This::Shdr shdr(pshdrs);
return;
}
- const char* sname = pnames + shdr.get_sh_name();
+ const char* name = pnames + shdr.get_sh_name();
if (!is_gc_pass_two)
{
- if (this->handle_gnu_warning_section(sname, i, symtab))
+ if (this->handle_gnu_warning_section(name, 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(sname, ".note.GNU-stack") == 0)
+ if (strcmp(name, ".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(sname))
+ if (this->handle_split_stack_section(name))
{
if (!parameters->options().relocatable()
&& !parameters->options().shared())
}
// Skip attributes section.
- if (parameters->target().is_attributes_section(sname))
+ if (parameters->target().is_attributes_section(name))
{
omit[i] = true;
}
{
if (shdr.get_sh_type() == elfcpp::SHT_GROUP)
{
- if (!this->include_section_group(symtab, alayout, i, sname,
+ if (!this->include_section_group(symtab, layout, i, name,
shdrs, pnames,
section_names_size,
&omit))
discard = true;
}
else if ((shdr.get_sh_flags() & elfcpp::SHF_GROUP) == 0
- && Layout::is_linkonce(sname))
+ && Layout::is_linkonce(name))
{
- if (!this->include_linkonce_section(alayout, i, sname, shdr))
+ if (!this->include_linkonce_section(layout, i, name, shdr))
discard = true;
}
}
if (is_gc_pass_one && parameters->options().gc_sections())
{
- if (is_section_name_included(sname)
+ if (is_section_name_included(name)
|| 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_rels
+ if (emit_relocs
&& (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(sname, ".eh_frame") == 0
+ && strcmp(name, ".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, sname,
+ this->deferred_layout_.push_back(Deferred_layout(i, name,
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(alayout, i, sname, shdr, reloc_shndx[i],
+ this->layout_section(layout, i, name, shdr, reloc_shndx[i],
reloc_type[i]);
}
}
if (!is_gc_pass_one)
- alayout->layout_gnu_stack(seen_gnu_stack, gnu_stack_flags);
+ layout->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_rels)
+ if (emit_relocs)
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 >= sec_shnum)
+ if (data_shndx >= shnum)
{
// We already warned about this above.
continue;
Relocatable_relocs* rr = new Relocatable_relocs();
this->set_relocatable_relocs(i, rr);
- Output_section* os = alayout->layout_reloc(this, i, shdr, data_section,
- rr);
+ Output_section* os = layout->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 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);
+ 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);
out_sections[i] = os;
- if (off == -1)
+ if (offset == -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>(off);
+ out_section_offsets[i] = convert_types<Address, off_t>(offset);
// 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 (off == -1 && reloc_shndx[i] != 0)
+ if (offset == -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* alayout)
+Sized_relobj<size, big_endian>::do_layout_deferred_sections(Layout* layout)
{
typename std::vector<Deferred_layout>::iterator deferred;
++deferred)
{
typename This::Shdr shdr(deferred->shdr_data_);
- this->layout_section(alayout, deferred->shndx_, deferred->name_.c_str(),
+ this->layout_section(layout, deferred->shndx_, deferred->name_.c_str(),
shdr, deferred->reloc_shndx_, deferred->reloc_type_);
}
return;
}
- const int symsize = This::sym_size;
+ const int sym_size = This::sym_size;
size_t symcount = ((sd->symbols_size - sd->external_symbols_offset)
- / symsize);
- if (symcount * symsize != sd->symbols_size - sd->external_symbols_offset)
+ / sym_size);
+ if (symcount * sym_size != 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 sym_tab_shndx = this->symtab_shndx_;
+ const unsigned int symtab_shndx = this->symtab_shndx_;
typename This::Shdr symtabshdr(this,
- this->elf_file_.section_header(sym_tab_shndx));
+ this->elf_file_.section_header(symtab_shndx));
gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB);
// Read the local symbols.
- const int symsize = This::sym_size;
+ const int sym_size = This::sym_size;
const unsigned int loccount = this->local_symbol_count_;
gold_assert(loccount == symtabshdr.get_sh_info());
- off_t locsize = loccount * symsize;
+ off_t locsize = loccount * sym_size;
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 sec_shnum = this->shnum();
+ unsigned int shnum = this->shnum();
unsigned int count = 0;
unsigned int dyncount = 0;
// Skip the first, dummy, symbol.
- psyms += symsize;
+ psyms += sym_size;
bool discard_locals = parameters->options().discard_locals();
- for (unsigned int i = 1; i < loccount; ++i, psyms += symsize)
+ for (unsigned int i = 1; i < loccount; ++i, psyms += sym_size)
{
elfcpp::Sym<size, big_endian> sym(psyms);
// Decide whether this symbol should go into the output file.
- if ((shndx < sec_shnum && out_sections[shndx] == NULL)
+ if ((shndx < 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* sname = pnames + sym.get_st_name();
+ const char* name = 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(sname))
+ && parameters->target().is_local_label_name(name))
{
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(sname))
+ if (!parameters->options().should_retain_symbol(name))
{
lv.set_no_output_symtab_entry();
continue;
}
// Add the symbol to the symbol table string pool.
- pool->add(sname, true, NULL);
+ pool->add(name, true, NULL);
++count;
// If needed, add the symbol to the dynamic symbol table string pool.
if (lv.needs_output_dynsym_entry())
{
- dynpool->add(sname, true, NULL);
+ dynpool->add(name, 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 sec_shnum = this->shnum();
+ unsigned int shnum = this->shnum();
for (unsigned int i = 1; i < loccount; ++i)
{
}
else
{
- if (shndx >= sec_shnum)
+ if (shndx >= shnum)
{
this->error(_("local symbol %u section index %u out of range"),
i, shndx);
}
// Read the symbol table section header.
- const unsigned int sym_tab_shndx = this->symtab_shndx_;
+ const unsigned int symtab_shndx = this->symtab_shndx_;
typename This::Shdr symtabshdr(this,
- this->elf_file_.section_header(sym_tab_shndx));
+ this->elf_file_.section_header(symtab_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 symsize = This::sym_size;
- off_t locsize = loccount * symsize;
+ const int sym_size = This::sym_size;
+ off_t locsize = loccount * sym_size;
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_ * symsize;
+ off_t output_size = this->output_local_symbol_count_ * sym_size;
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_ * symsize;
+ off_t dyn_output_size = this->output_local_dynsym_count_ * sym_size;
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 += symsize;
- for (unsigned int i = 1; i < loccount; ++i, psyms += symsize)
+ psyms += sym_size;
+ for (unsigned int i = 1; i < loccount; ++i, psyms += sym_size)
{
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* sname = pnames + isym.get_st_name();
- osym.put_st_name(sympool->get_offset(sname));
+ const char* name = pnames + isym.get_st_name();
+ osym.put_st_name(sympool->get_offset(name));
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 += symsize;
+ ov += sym_size;
}
// 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* sname = pnames + isym.get_st_name();
- osym.put_st_name(dynpool->get_offset(sname));
+ const char* name = pnames + isym.get_st_name();
+ osym.put_st_name(dynpool->get_offset(name));
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 += symsize;
+ dyn_ov += sym_size;
}
}
bool
Sized_relobj<size, big_endian>::get_symbol_location_info(
unsigned int shndx,
- off_t sym_offset,
+ off_t 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 symsize = This::sym_size;
- const size_t count = symbols_size / symsize;
+ const int sym_size = This::sym_size;
+ const size_t count = symbols_size / sym_size;
const unsigned char* p = symbols;
- for (size_t i = 0; i < count; ++i, p += symsize)
+ for (size_t i = 0; i < count; ++i, p += sym_size)
{
elfcpp::Sym<size, big_endian> sym(p);
&is_ordinary);
if (is_ordinary
&& st_shndx == shndx
- && static_cast<off_t>(sym.get_st_value()) <= sym_offset
+ && static_cast<off_t>(sym.get_st_value()) <= offset
&& (static_cast<off_t>(sym.get_st_value() + sym.get_st_size())
- > sym_offset))
+ > 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 addr_offset = kept_relobj->get_output_section_offset(kept_shndx);
- if (os != NULL && addr_offset != invalid_address)
+ Address offset = kept_relobj->get_output_section_offset(kept_shndx);
+ if (os != NULL && offset != invalid_address)
{
*found = true;
- return os->address() + addr_offset;
+ return os->address() + 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& 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),
+ 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),
has_no_split_stack_(false), no_export_(false), xindex_(NULL)
- { oinput_file->file().add_object(); }
+ { input_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* olayout, Read_symbols_data* sd)
- { this->do_layout(symtab, olayout, sd); }
+ layout(Symbol_table* symtab, Layout* layout, Read_symbols_data* sd)
+ { this->do_layout(symtab, layout, sd); }
// Add symbol information to the global symbol table.
void
- add_symbols(Symbol_table* symtab, Read_symbols_data* sd, Layout *olayout)
- { this->do_add_symbols(symtab, sd, olayout); }
+ add_symbols(Symbol_table* symtab, Read_symbols_data* sd, Layout *layout)
+ { this->do_add_symbols(symtab, sd, layout); }
// 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 sec_shnum)
- { this->shnum_ = sec_shnum; }
+ set_shnum(int shnum)
+ { this->shnum_ = shnum; }
// Functions used by both Sized_relobj and Sized_dynobj.
class Relobj : public Object
{
public:
- Relobj(const std::string& rname, Input_file* rinput_file, off_t roffset = 0)
- : Object(rname, rinput_file, false, roffset),
+ Relobj(const std::string& name, Input_file* input_file, off_t offset = 0)
+ : Object(name, input_file, false, offset),
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* olayout, Read_relocs_data* rd)
- { return this->do_gc_process_relocs(symtab, olayout, rd); }
+ gc_process_relocs(Symbol_table* symtab, Layout* layout, Read_relocs_data* rd)
+ { return this->do_gc_process_relocs(symtab, layout, rd); }
// Scan the relocs and adjust the symbol table.
void
- scan_relocs(Symbol_table* symtab, Layout* olayout, Read_relocs_data* rd)
- { return this->do_scan_relocs(symtab, olayout, rd); }
+ scan_relocs(Symbol_table* symtab, Layout* layout, Read_relocs_data* rd)
+ { return this->do_scan_relocs(symtab, layout, 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* olayout, Output_file* of)
- { return this->do_relocate(symtab, olayout, of); }
+ relocate(const Symbol_table* symtab, const Layout* layout, Output_file* of)
+ { return this->do_relocate(symtab, layout, 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* olayout)
- { this->do_layout_deferred_sections(olayout); }
+ layout_deferred_sections(Layout* layout)
+ { this->do_layout_deferred_sections(layout); }
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 val)
- { this->u_.value = val; }
+ set_output_value(Value value)
+ { this->u_.value = value; }
// 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 val)
- { this->u_.value = val; }
+ set_input_value(Value value)
+ { this->u_.value = value; }
// 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* olayout,
+ relocate_sections(const Symbol_table* symtab, const Layout* layout,
const unsigned char* pshdrs, Views* pviews)
- { this->do_relocate_sections(symtab, olayout, pshdrs, pviews); }
+ { this->do_relocate_sections(symtab, layout, pshdrs, pviews); }
// Scan the input relocations for --emit-relocs.
void
parse(parse_function)
{ }
- void parse_to_value(const char* opt, const char* arg,
+ void parse_to_value(const char* option, const char* arg,
Command_line* cmdline, General_options* options)
- { (options->*(this->parse))(opt, arg, cmdline); }
+ { (options->*(this->parse))(option, arg, cmdline); }
One_option option;
Parse_function parse;
{ }
// This is the usual constructor.
- Search_directory(const char* cname, bool put_in_sysroot)
- : name_(cname), put_in_sysroot_(put_in_sysroot), is_in_sysroot_(false)
+ Search_directory(const char* name, bool put_in_sysroot)
+ : name_(name), 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* 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)
+ 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)
{ }
// 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* 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)
+ 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)
{ }
const char*
{
public:
// Create a file or library argument.
- explicit Input_argument(Input_file_argument afile)
- : is_file_(true), file_(afile), group_(NULL)
+ explicit Input_argument(Input_file_argument file)
+ : is_file_(true), file_(file), group_(NULL)
{ }
// Create a group argument.
- explicit Input_argument(Input_file_group* agroup)
- : is_file_(false), group_(agroup)
+ explicit Input_argument(Input_file_group* group)
+ : is_file_(false), group_(group)
{ }
// 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* aentry)
+ const char* entry)
: target_(target),
symtab_(symtab),
segment_header_(osh),
section_header_(NULL),
shstrtab_(NULL),
- entry_(aentry)
+ entry_(entry)
{
this->set_data_size(this->do_size());
}
&& !parameters->options().shared());
// FIXME: Need to support target specific entry symbol.
- const char* entry_sym = this->entry_;
- if (entry_sym == NULL)
- entry_sym = "_start";
+ const char* entry = this->entry_;
+ if (entry == NULL)
+ entry = "_start";
- Symbol* sym = this->symtab_->lookup(entry_sym);
+ Symbol* sym = this->symtab_->lookup(entry);
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_sym);
+ gold_warning("entry symbol '%s' exists but is not defined", entry);
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_sym, &endptr, 0);
+ v = strtoull(entry, &endptr, 0);
if (*endptr != '\0')
{
if (should_issue_warning)
- gold_warning("cannot find entry symbol '%s'", entry_sym);
+ gold_warning("cannot find entry symbol '%s'", entry);
v = 0;
}
}
// of the output section.
void
-Output_section_data::set_addralign(uint64_t addr_align)
+Output_section_data::set_addralign(uint64_t addralign)
{
- this->addralign_ = addr_align;
+ this->addralign_ = addralign;
if (this->output_section_ != NULL
- && this->output_section_->addralign() < addr_align)
- this->output_section_->set_addralign(addr_align);
+ && this->output_section_->addralign() < addralign)
+ this->output_section_->set_addralign(addralign);
}
// Output_data_strtab methods.
unsigned int type,
Output_data* od,
Address address,
- bool is_rel)
+ bool is_relative)
: address_(address), local_sym_index_(GSYM_CODE), type_(type),
- is_relative_(is_rel), is_section_symbol_(false), shndx_(INVALID_CODE)
+ is_relative_(is_relative), 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_rel)
+ bool is_relative)
: address_(address), local_sym_index_(GSYM_CODE), type_(type),
- is_relative_(is_rel), is_section_symbol_(false), shndx_(shndx)
+ is_relative_(is_relative), 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_rel,
+ bool is_relative,
bool is_section_symbol)
: address_(address), local_sym_index_(local_sym_index), type_(type),
- is_relative_(is_rel), is_section_symbol_(is_section_symbol),
+ is_relative_(is_relative), 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_rel,
+ bool is_relative,
bool is_section_symbol)
: address_(address), local_sym_index_(local_sym_index), type_(type),
- is_relative_(is_rel), is_section_symbol_(is_section_symbol),
+ is_relative_(is_relative), 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 g_offset = this->last_got_offset();
- gsym->set_got_offset(got_type, g_offset);
- rel_dyn->add_global(gsym, r_type, this, g_offset);
+ 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);
}
template<int size, bool big_endian>
this->entries_.push_back(Got_entry());
this->set_got_size();
- 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);
+ 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);
}
// Add a pair of entries for a global symbol to the GOT, and add
return;
this->entries_.push_back(Got_entry());
- 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);
+ 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);
this->entries_.push_back(Got_entry());
if (r_type_2 != 0)
{
- g_offset = this->last_got_offset();
- rel_dyn->add_global(gsym, r_type_2, this, g_offset);
+ got_offset = this->last_got_offset();
+ rel_dyn->add_global(gsym, r_type_2, this, got_offset);
}
this->set_got_size();
return;
this->entries_.push_back(Got_entry());
- 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);
+ 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);
this->entries_.push_back(Got_entry());
if (r_type_2 != 0)
{
- g_offset = this->last_got_offset();
- rela_dyn->add_global(gsym, r_type_2, this, g_offset, 0);
+ got_offset = this->last_got_offset();
+ rela_dyn->add_global(gsym, r_type_2, this, got_offset, 0);
}
this->set_got_size();
this->entries_.push_back(Got_entry());
this->set_got_size();
- 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);
+ 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);
}
template<int size, bool big_endian>
this->entries_.push_back(Got_entry());
this->set_got_size();
- 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);
+ 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);
}
// Add a pair of entries for a local symbol to the GOT, and add
return;
this->entries_.push_back(Got_entry());
- unsigned int g_offset = this->last_got_offset();
- object->set_local_got_offset(symndx, got_type, g_offset);
+ unsigned int got_offset = this->last_got_offset();
+ object->set_local_got_offset(symndx, got_type, got_offset);
Output_section* os = object->output_section(shndx);
- rel_dyn->add_output_section(os, r_type_1, this, g_offset);
+ rel_dyn->add_output_section(os, r_type_1, this, got_offset);
this->entries_.push_back(Got_entry(object, symndx));
if (r_type_2 != 0)
{
- g_offset = this->last_got_offset();
- rel_dyn->add_output_section(os, r_type_2, this, g_offset);
+ got_offset = this->last_got_offset();
+ rel_dyn->add_output_section(os, r_type_2, this, got_offset);
}
this->set_got_size();
return;
this->entries_.push_back(Got_entry());
- unsigned int g_offset = this->last_got_offset();
- object->set_local_got_offset(symndx, got_type, g_offset);
+ unsigned int got_offset = this->last_got_offset();
+ object->set_local_got_offset(symndx, got_type, got_offset);
Output_section* os = object->output_section(shndx);
- rela_dyn->add_output_section(os, r_type_1, this, g_offset, 0);
+ rela_dyn->add_output_section(os, r_type_1, this, got_offset, 0);
this->entries_.push_back(Got_entry(object, symndx));
if (r_type_2 != 0)
{
- g_offset = this->last_got_offset();
- rela_dyn->add_output_section(os, r_type_2, this, g_offset, 0);
+ got_offset = this->last_got_offset();
+ rela_dyn->add_output_section(os, r_type_2, this, got_offset, 0);
}
this->set_got_size();
{
const int dyn_size = elfcpp::Elf_sizes<size>::dyn_size;
- const off_t off = this->offset();
+ const off_t offset = this->offset();
const off_t oview_size = this->data_size();
- unsigned char* const oview = of->get_output_view(off, oview_size);
+ unsigned char* const oview = of->get_output_view(offset, 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(off, oview_size, oview);
+ of->write_output_view(offset, 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 off = this->offset();
+ const off_t offset = this->offset();
const off_t oview_size = this->data_size();
- unsigned char* const oview = of->get_output_view(off, oview_size);
+ unsigned char* const oview = of->get_output_view(offset, oview_size);
memset(oview, 0, oview_size);
else
this->endian_do_write<false>(oview);
- of->write_output_view(off, oview_size, oview);
+ of->write_output_view(offset, 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 sec_shndx,
- section_offset_type off,
+ unsigned int shndx,
+ section_offset_type offset,
section_offset_type *poutput) const
{
if (!this->is_input_section())
- return this->u2_.posd->output_offset(object, sec_shndx, off, poutput);
+ return this->u2_.posd->output_offset(object, shndx, offset, poutput);
else
{
- if (this->shndx_ != sec_shndx || this->u2_.object != object)
+ if (this->shndx_ != shndx || this->u2_.object != object)
return false;
- *poutput = off;
+ *poutput = offset;
return true;
}
}
inline bool
Output_section::Input_section::is_merge_section_for(const Relobj* object,
- unsigned int sec_shndx) const
+ unsigned int shndx) const
{
if (this->is_input_section())
return false;
- return this->u2_.posd->is_merge_section_for(object, sec_shndx);
+ return this->u2_.posd->is_merge_section_for(object, 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* aname, elfcpp::Elf_Word atype,
- elfcpp::Elf_Xword aflags)
- : name_(aname),
+Output_section::Output_section(const char* name, elfcpp::Elf_Word type,
+ elfcpp::Elf_Xword flags)
+ : name_(name),
addralign_(0),
entsize_(0),
load_address_(0),
info_section_(NULL),
info_symndx_(NULL),
info_(0),
- type_(atype),
- flags_(aflags),
+ type_(type),
+ flags_(flags),
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 ((aflags & elfcpp::SHF_ALLOC) == 0)
+ if ((flags & 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 sec_shndx,
+ unsigned int shndx,
const char* secname,
const elfcpp::Shdr<size, big_endian>& shdr,
unsigned int reloc_shndx,
bool have_sections_script)
{
- elfcpp::Elf_Xword addr_align = shdr.get_sh_addralign();
- if ((addr_align & (addr_align - 1)) != 0)
+ elfcpp::Elf_Xword addralign = shdr.get_sh_addralign();
+ if ((addralign & (addralign - 1)) != 0)
{
object->error(_("invalid alignment %lu for section \"%s\""),
- static_cast<unsigned long>(addr_align), secname);
- addr_align = 1;
+ static_cast<unsigned long>(addralign), secname);
+ addralign = 1;
}
- if (addr_align > this->addralign_)
- this->addralign_ = addr_align;
+ if (addralign > this->addralign_)
+ this->addralign_ = addralign;
typename elfcpp::Elf_types<size>::Elf_WXword sh_flags = shdr.get_sh_flags();
this->update_flags_for_input_section(sh_flags);
- uint64_t ent_size = shdr.get_sh_entsize();
+ uint64_t entsize = 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);
- ent_size = 1;
+ entsize = 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, sec_shndx, sh_flags,
- ent_size, addr_align))
+ if (this->add_merge_input_section(object, shndx, sh_flags,
+ entsize, addralign))
{
// 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,
- addr_align);
+ addralign);
// 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, sec_shndx,
+ this->input_sections_.push_back(Input_section(object, shndx,
shdr.get_sh_size(),
- addr_align));
+ addralign));
return aligned_offset_in_section;
}
this->input_sections_.push_back(*inp);
- uint64_t addr_align = inp->addralign();
- if (addr_align > this->addralign_)
- this->addralign_ = addr_align;
+ uint64_t addralign = inp->addralign();
+ if (addralign > this->addralign_)
+ this->addralign_ = addralign;
inp->set_output_section(this);
}
void
Output_section::add_output_merge_section(Output_section_data* posd,
- bool is_string, uint64_t ent_size)
+ bool is_string, uint64_t entsize)
{
- Input_section inp(posd, is_string, ent_size);
+ Input_section inp(posd, is_string, entsize);
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 sec_shndx,
- uint64_t aflags, uint64_t ent_size,
- uint64_t addr_align)
+Output_section::add_merge_input_section(Relobj* object, unsigned int shndx,
+ uint64_t flags, uint64_t entsize,
+ uint64_t addralign)
{
- bool is_string = (aflags & elfcpp::SHF_STRINGS) != 0;
+ bool is_string = (flags & 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 && addr_align > ent_size)
+ if (is_string && addralign > entsize)
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, ent_size, addr_align);
+ Merge_section_properties msp(is_string, entsize, addralign);
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, sec_shndx);
+ merge_section->add_input_section(object, shndx);
gold_assert(merge_section->is_string() == is_string
- && merge_section->entsize() == ent_size
- && merge_section->addralign() == addr_align);
+ && merge_section->entsize() == entsize
+ && merge_section->addralign() == addralign);
// Link input section to found merge section.
- Input_section_specifier iss(object, sec_shndx);
+ Input_section_specifier iss(object, 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(ent_size, addr_align);
+ pomb = new Output_merge_data(entsize, addralign);
else
{
- switch (ent_size)
+ switch (entsize)
{
case 1:
- pomb = new Output_merge_string<char>(addr_align);
+ pomb = new Output_merge_string<char>(addralign);
break;
case 2:
- pomb = new Output_merge_string<uint16_t>(addr_align);
+ pomb = new Output_merge_string<uint16_t>(addralign);
break;
case 4:
- pomb = new Output_merge_string<uint32_t>(addr_align);
+ pomb = new Output_merge_string<uint32_t>(addralign);
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, ent_size);
+ this->add_output_merge_section(pomb, is_string, entsize);
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, sec_shndx);
- Input_section_specifier iss(object, sec_shndx);
+ pomb->add_input_section(object, shndx);
+ Input_section_specifier iss(object, 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 INPUTSECTIONS.
+// Look up to the first LIMIT elements in INPUT_SECTIONS.
void
Output_section::build_relaxation_map(
- const Input_section_list& inputsections,
+ const Input_section_list& input_sections,
size_t limit,
Relaxation_map* relaxation_map) const
{
for (size_t i = 0; i < limit; ++i)
{
- const Input_section& is(inputsections[i]);
+ const Input_section& is(input_sections[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 INPUTSECTIONS.
+// specifier to indices of INPUT_SECTIONS.
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* inputsections)
+ Input_section_list* input_sections)
{
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((*inputsections)[p->second].is_input_section());
- (*inputsections)[p->second] = Input_section(poris);
+ gold_assert((*input_sections)[p->second].is_input_section());
+ (*input_sections)[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 aflags)
+Output_section::update_flags_for_input_section(elfcpp::Elf_Xword flags)
{
// 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
- && (aflags & elfcpp::SHF_ALLOC) != 0)
+ && (flags & elfcpp::SHF_ALLOC) != 0)
this->mark_address_invalid();
- this->flags_ |= (aflags
+ this->flags_ |= (flags
& (elfcpp::SHF_WRITE
| elfcpp::SHF_ALLOC
| elfcpp::SHF_EXECINSTR));
}
-// Find the merge section into which an input section with index SEC_SHNDX in
+// Find the merge section into which an input section with index SHNDX in
// OBJECT has been added. Return NULL if none found.
Output_section_data*
Output_section::find_merge_section(const Relobj* object,
- unsigned int sec_shndx) const
+ unsigned int shndx) const
{
- Input_section_specifier iss(object, sec_shndx);
+ Input_section_specifier iss(object, 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, sec_shndx));
+ gold_assert(posd->is_merge_section_for(object, shndx));
return posd;
}
else
}
// Find an relaxed input section corresponding to an input section
-// in OBJECT with index SEC_SHNDX.
+// in OBJECT with index SHNDX.
const Output_section_data*
Output_section::find_relaxed_input_section(const Relobj* object,
- unsigned int sec_shndx) const
+ unsigned int 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, sec_shndx);
+ Input_section_specifier iss(object, 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 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
+// 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
// a special mapping.
bool
Output_section::is_input_address_mapped(const Relobj* object,
- unsigned int sec_shndx,
- off_t off) const
+ unsigned int shndx,
+ off_t offset) const
{
// Look at the Output_section_data_maps first.
- const Output_section_data* posd = this->find_merge_section(object, sec_shndx);
+ const Output_section_data* posd = this->find_merge_section(object, shndx);
if (posd == NULL)
- posd = this->find_relaxed_input_section(object, sec_shndx);
+ posd = this->find_relaxed_input_section(object, shndx);
if (posd != NULL)
{
- section_offset_type outputoffset;
- bool found = posd->output_offset(object, sec_shndx, off, &outputoffset);
+ section_offset_type output_offset;
+ bool found = posd->output_offset(object, shndx, offset, &output_offset);
gold_assert(found);
- return outputoffset != -1;
+ return output_offset != -1;
}
// Fall back to the slow look-up.
p != this->input_sections_.end();
++p)
{
- section_offset_type outputoffset;
- if (p->output_offset(object, sec_shndx, off, &outputoffset))
- return outputoffset != -1;
+ section_offset_type output_offset;
+ if (p->output_offset(object, shndx, offset, &output_offset))
+ return output_offset != -1;
}
// By default we assume that the address is mapped. This should
return true;
}
-// Given an address OFF relative to the start of input section
-// SEC_SHNDX in object OBJECT, return the output offset relative to the
+// Given an address OFFSET relative to the start of input section
+// 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 SEC_SHNDX in OBJECT has a special mapping.
+// be called if SHNDX in OBJECT has a special mapping.
section_offset_type
-Output_section::output_offset(const Relobj* object, unsigned int sec_shndx,
- section_offset_type off) const
+Output_section::output_offset(const Relobj* object, unsigned int shndx,
+ section_offset_type offset) 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, sec_shndx);
+ const Output_section_data* posd = this->find_merge_section(object, shndx);
if (posd == NULL)
- posd = this->find_relaxed_input_section(object, sec_shndx);
+ posd = this->find_relaxed_input_section(object, shndx);
if (posd != NULL)
{
- section_offset_type outputoffset;
- bool found = posd->output_offset(object, sec_shndx, off, &outputoffset);
+ section_offset_type output_offset;
+ bool found = posd->output_offset(object, shndx, offset, &output_offset);
gold_assert(found);
- return outputoffset;
+ return output_offset;
}
// Fall back to the slow look-up.
p != this->input_sections_.end();
++p)
{
- section_offset_type outputoffset;
- if (p->output_offset(object, sec_shndx, off, &outputoffset))
- return outputoffset;
+ section_offset_type output_offset;
+ if (p->output_offset(object, shndx, offset, &output_offset))
+ return output_offset;
}
gold_unreachable();
}
-// Return the output virtual address of OFF relative to the start
-// of input section SEC_SHNDX in object OBJECT.
+// Return the output virtual address of OFFSET relative to the start
+// of input section SHNDX in object OBJECT.
uint64_t
-Output_section::output_address(const Relobj* object, unsigned int sec_shndx,
- off_t off) const
+Output_section::output_address(const Relobj* object, unsigned int shndx,
+ off_t offset) 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, sec_shndx);
+ const Output_section_data* posd = this->find_merge_section(object, shndx);
if (posd == NULL)
- posd = this->find_relaxed_input_section(object, sec_shndx);
+ posd = this->find_relaxed_input_section(object, shndx);
if (posd != NULL && posd->is_address_valid())
{
- section_offset_type outputoffset;
- bool found = posd->output_offset(object, sec_shndx, off, &outputoffset);
+ section_offset_type output_offset;
+ bool found = posd->output_offset(object, shndx, offset, &output_offset);
gold_assert(found);
- return posd->address() + outputoffset;
+ return posd->address() + output_offset;
}
// Fall back to the slow look-up.
++p)
{
addr = align_address(addr, p->addralign());
- section_offset_type outputoffset;
- if (p->output_offset(object, sec_shndx, off, &outputoffset))
+ section_offset_type output_offset;
+ if (p->output_offset(object, shndx, offset, &output_offset))
{
- if (outputoffset == -1)
+ if (output_offset == -1)
return -1ULL;
- return addr + outputoffset;
+ return addr + output_offset;
}
addr += p->data_size();
}
}
// Find the output address of the start of the merged section for
-// input section SEC_SHNDX in object OBJECT.
+// input section SHNDX in object OBJECT.
bool
Output_section::find_starting_output_address(const Relobj* object,
- unsigned int sec_shndx,
+ unsigned int 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, sec_shndx))
+ if (p->is_merge_section_for(object, shndx))
{
*paddr = addr;
return true;
if (this->must_sort_attached_input_sections())
this->sort_attached_input_sections();
- uint64_t addr = this->address();
+ uint64_t address = 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(addr + (off - startoff), off,
+ p->set_address_and_file_offset(address + (off - startoff), off,
startoff);
off += p->data_size();
}
section_name_()
{ }
- 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())
+ 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())
{
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 = (inputsection.is_input_section()
- ? inputsection.relobj()
- : inputsection.relaxed_input_section()->relobj());
+ Object* obj = (input_section.is_input_section()
+ ? input_section.relobj()
+ : input_section.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(inputsection.shndx());
+ this->section_name_ = obj->section_name(input_section.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_filename) const
+ match_file_name(const char* match_file_name) 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_filename);
- if (strncmp(base_name, match_filename, match_len) != 0)
+ size_t match_len = strlen(match_file_name);
+ if (strncmp(base_name, match_file_name, 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 xflags = this->flags_;
+ elfcpp::Elf_Xword flags = this->flags_;
if (this->info_section_ != NULL && this->info_uses_section_index_)
- xflags |= elfcpp::SHF_INFO_LINK;
- oshdr->put_sh_flags(xflags);
+ flags |= elfcpp::SHF_INFO_LINK;
+ oshdr->put_sh_flags(flags);
oshdr->put_sh_addr(this->address());
oshdr->put_sh_offset(this->offset());
else
oshdr->put_sh_link(this->link_);
- elfcpp::Elf_Word inf;
+ elfcpp::Elf_Word info;
if (this->info_section_ != NULL)
{
if (this->info_uses_section_index_)
- inf = this->info_section_->out_shndx();
+ info = this->info_section_->out_shndx();
else
- inf = this->info_section_->symtab_index();
+ info = this->info_section_->symtab_index();
}
else if (this->info_symndx_ != NULL)
- inf = this->info_symndx_->symtab_index();
+ info = this->info_symndx_->symtab_index();
else
- inf = this->info_;
- oshdr->put_sh_info(inf);
+ info = this->info_;
+ oshdr->put_sh_info(info);
oshdr->put_sh_addralign(this->addralign_);
oshdr->put_sh_entsize(this->entsize_);
uint64_t
Output_section::get_input_sections(
- uint64_t addr,
+ uint64_t address,
const std::string& fill,
- std::list<Simple_input_section>* inputsections)
+ std::list<Simple_input_section>* input_sections)
{
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 = addr;
+ uint64_t orig_address = address;
- addr = align_address(addr, this->addralign());
+ address = align_address(address, this->addralign());
Input_section_list remaining;
for (Input_section_list::iterator p = this->input_sections_.begin();
++p)
{
if (p->is_input_section())
- inputsections->push_back(Simple_input_section(p->relobj(),
+ input_sections->push_back(Simple_input_section(p->relobj(),
p->shndx()));
else if (p->is_relaxed_input_section())
- inputsections->push_back(
+ input_sections->push_back(
Simple_input_section(p->relaxed_input_section()));
else
{
- uint64_t aligned_address = align_address(addr, p->addralign());
- if (aligned_address != addr && !fill.empty())
+ uint64_t aligned_address = align_address(address, p->addralign());
+ if (aligned_address != address && !fill.empty())
{
section_size_type length =
- convert_to_section_size_type(aligned_address - addr);
+ convert_to_section_size_type(aligned_address - address);
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));
}
- addr = aligned_address;
+ address = aligned_address;
remaining.push_back(*p);
p->finalize_data_size();
- addr += p->data_size();
+ address += p->data_size();
}
}
this->input_sections_.swap(remaining);
this->first_input_offset_ = 0;
- uint64_t datasize = addr - orig_address;
- this->set_current_data_size_for_child(datasize);
- return datasize;
+ uint64_t data_size = address - orig_address;
+ this->set_current_data_size_for_child(data_size);
+ return data_size;
}
// Add an input section from a script.
void
Output_section::add_input_section_for_script(const Simple_input_section& sis,
- off_t datasize,
- uint64_t addr_align)
+ off_t data_size,
+ uint64_t addralign)
{
- if (addr_align > this->addralign_)
- this->addralign_ = addr_align;
+ if (addralign > this->addralign_)
+ this->addralign_ = addralign;
off_t offset_in_section = this->current_data_size_for_child();
off_t aligned_offset_in_section = align_address(offset_in_section,
- addr_align);
+ addralign);
this->set_current_data_size_for_child(aligned_offset_in_section
- + datasize);
+ + data_size);
Input_section is =
(sis.is_relaxed_input_section()
? Input_section(sis.relaxed_input_section())
- : Input_section(sis.relobj(), sis.shndx(), datasize, addr_align));
+ : Input_section(sis.relobj(), sis.shndx(), data_size, addralign));
this->input_sections_.push_back(is);
}
// Output segment methods.
-Output_segment::Output_segment(elfcpp::Elf_Word atype, elfcpp::Elf_Word aflags)
+Output_segment::Output_segment(elfcpp::Elf_Word type, elfcpp::Elf_Word flags)
: output_data_(),
output_bss_(),
vaddr_(0),
min_p_align_(0),
offset_(0),
filesz_(0),
- type_(atype),
- flags_(aflags),
+ type_(type),
+ flags_(flags),
is_max_align_known_(false),
are_addresses_set_(false),
is_large_data_segment_(false)
{
if (!this->is_max_align_known_)
{
- uint64_t addr_align;
+ uint64_t 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_data_);
+ 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;
+ addralign = Output_segment::maximum_alignment_list(&this->output_bss_);
+ if (addralign > this->max_align_)
+ this->max_align_ = addralign;
// 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())
{
- addr_align = parameters->target().common_pagesize();
- if (addr_align > this->max_align_)
- this->max_align_ = addr_align;
+ addralign = parameters->target().common_pagesize();
+ if (addralign > this->max_align_)
+ this->max_align_ = addralign;
}
this->is_max_align_known_ = true;
p != pdl->end();
++p)
{
- uint64_t addr_align = (*p)->addralign();
- if (addr_align > ret)
- ret = addr_align;
+ uint64_t addralign = (*p)->addralign();
+ if (addralign > ret)
+ ret = addralign;
}
return ret;
}
off_t
Output_section::add_input_section<32, false>(
Sized_relobj<32, false>* object,
- unsigned int sec_shndx,
+ unsigned int 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 sec_shndx,
+ unsigned int 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 sec_shndx,
+ unsigned int 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 sec_shndx,
+ unsigned int shndx,
const char* secname,
const elfcpp::Shdr<64, true>& shdr,
unsigned int reloc_shndx,
class Input_section_specifier
{
public:
- Input_section_specifier(const Relobj* robj, unsigned int sec_shndx)
- : relobj_(robj), shndx_(sec_shndx)
+ Input_section_specifier(const Relobj* relobj, unsigned int shndx)
+ : relobj_(relobj), shndx_(shndx)
{ }
// Return Relobj of this.
// Set the size of the data.
void
- set_data_size(off_t datasize)
+ set_data_size(off_t data_size)
{
gold_assert(!this->is_data_size_valid_
&& !this->is_data_size_fixed_);
- this->data_size_ = datasize;
+ this->data_size_ = data_size;
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 datasize)
+ set_current_data_size_for_child(off_t data_size)
{
gold_assert(!this->is_data_size_valid_);
- this->data_size_ = datasize;
+ this->data_size_ = data_size;
}
// Return default alignment for the target size.
class Output_section_data : public Output_data
{
public:
- Output_section_data(off_t datasize, uint64_t addr_align,
- bool is_datasize_fixed)
- : Output_data(), output_section_(NULL), addralign_(addr_align)
+ Output_section_data(off_t data_size, uint64_t addralign,
+ bool is_data_size_fixed)
+ : Output_data(), output_section_(NULL), addralign_(addralign)
{
- this->set_data_size(datasize);
- if (is_datasize_fixed)
+ this->set_data_size(data_size);
+ if (is_data_size_fixed)
this->fix_data_size();
}
- Output_section_data(uint64_t addr_align)
- : Output_data(), output_section_(NULL), addralign_(addr_align)
+ Output_section_data(uint64_t addralign)
+ : Output_data(), output_section_(NULL), addralign_(addralign)
{ }
// Return the output section.
// this input offset is being discarded.
bool
output_offset(const Relobj* object, unsigned int shndx,
- section_offset_type sec_offset,
+ section_offset_type offset,
section_offset_type *poutput) const
- { return this->do_output_offset(object, shndx, sec_offset, poutput); }
+ { return this->do_output_offset(object, shndx, 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 addr_align)
- : Output_section_data(addr_align)
+ Output_section_data_build(uint64_t addralign)
+ : Output_section_data(addralign)
{ }
// Get the current data size.
// Set the current data size.
void
- set_current_data_size(off_t datasize)
- { this->set_current_data_size_for_child(datasize); }
+ set_current_data_size(off_t data_size)
+ { this->set_current_data_size_for_child(data_size); }
protected:
// Set the final data size.
class Output_data_const : public Output_section_data
{
public:
- 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 std::string& data, uint64_t addralign)
+ : Output_section_data(data.size(), addralign, true), data_(data)
{ }
- 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 char* p, off_t len, uint64_t addralign)
+ : Output_section_data(len, addralign, true), data_(p, len)
{ }
- Output_data_const(const unsigned char* p, off_t len, uint64_t addr_align)
- : Output_section_data(len, addr_align, true),
+ Output_data_const(const unsigned char* p, off_t len, uint64_t addralign)
+ : Output_section_data(len, addralign, true),
data_(reinterpret_cast<const char*>(p), len)
{ }
{
public:
Output_data_const_buffer(const unsigned char* p, off_t len,
- uint64_t addr_align, const char* map_name)
- : Output_section_data(len, addr_align, true),
+ uint64_t addralign, const char* map_name)
+ : Output_section_data(len, addralign, true),
p_(p), map_name_(map_name)
{ }
class Output_data_fixed_space : public Output_section_data
{
public:
- Output_data_fixed_space(off_t datasize, uint64_t addr_align,
+ Output_data_fixed_space(off_t data_size, uint64_t addralign,
const char* map_name)
- : Output_section_data(datasize, addr_align, true),
+ : Output_section_data(data_size, addralign, true),
map_name_(map_name)
{ }
class Output_data_space : public Output_section_data_build
{
public:
- explicit Output_data_space(uint64_t addr_align, const char* map_name)
- : Output_section_data_build(addr_align),
+ explicit Output_data_space(uint64_t addralign, const char* map_name)
+ : Output_section_data_build(addralign),
map_name_(map_name)
{ }
class Output_data_zero_fill : public Output_section_data
{
public:
- Output_data_zero_fill(off_t datasize, uint64_t addr_align)
- : Output_section_data(datasize, addr_align, true)
+ Output_data_zero_fill(off_t data_size, uint64_t addralign)
+ : Output_section_data(data_size, addralign, true)
{ }
protected:
// A reloc against a global symbol.
Output_reloc(Symbol* gsym, unsigned int type, Output_data* od,
- Address addr, Addend addend, bool is_relative)
- : rel_(gsym, type, od, addr, is_relative), addend_(addend)
+ Address address, Addend addend, bool is_relative)
+ : rel_(gsym, type, od, address, is_relative), addend_(addend)
{ }
Output_reloc(Symbol* gsym, unsigned int type,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address addr, Addend addend,
+ unsigned int shndx, Address address, Addend addend,
bool is_relative)
- : rel_(gsym, type, relobj, shndx, addr, is_relative), addend_(addend)
+ : rel_(gsym, type, relobj, shndx, address, 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 addr,
+ Output_data* od, Address address,
Addend addend, bool is_relative, bool is_section_symbol)
- : rel_(relobj, local_sym_index, type, od, addr, is_relative,
+ : rel_(relobj, local_sym_index, type, od, address, 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 addr,
+ unsigned int shndx, Address address,
Addend addend, bool is_relative, bool is_section_symbol)
- : rel_(relobj, local_sym_index, type, shndx, addr, is_relative,
+ : rel_(relobj, local_sym_index, type, shndx, address, 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 addr, Addend addend)
- : rel_(os, type, od, addr), addend_(addend)
+ Address address, Addend addend)
+ : rel_(os, type, od, address), addend_(addend)
{ }
Output_reloc(Output_section* os, unsigned int type,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address addr, Addend addend)
- : rel_(os, type, relobj, shndx, addr), addend_(addend)
+ unsigned int shndx, Address address, Addend addend)
+ : rel_(os, type, relobj, shndx, address), 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 addr)
- { this->add(od, Output_reloc_type(gsym, type, od, addr, false)); }
+ add_global(Symbol* gsym, unsigned int type, Output_data* od, Address address)
+ { this->add(od, Output_reloc_type(gsym, type, od, address, false)); }
void
add_global(Symbol* gsym, unsigned int type, Output_data* od,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address addr)
- { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, addr,
+ unsigned int shndx, Address address)
+ { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, address,
false)); }
// These are to simplify the Copy_relocs class.
void
- add_global(Symbol* gsym, unsigned int type, Output_data* od, Address addr,
+ add_global(Symbol* gsym, unsigned int type, Output_data* od, Address address,
Address addend)
{
gold_assert(addend == 0);
- this->add_global(gsym, type, od, addr);
+ this->add_global(gsym, type, od, address);
}
void
add_global(Symbol* gsym, unsigned int type, Output_data* od,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address addr, Address addend)
+ unsigned int shndx, Address address, Address addend)
{
gold_assert(addend == 0);
- this->add_global(gsym, type, od, relobj, shndx, addr);
+ this->add_global(gsym, type, od, relobj, shndx, address);
}
// Add a RELATIVE reloc against a global symbol. The final relocation
void
add_global_relative(Symbol* gsym, unsigned int type, Output_data* od,
- Address addr)
- { this->add(od, Output_reloc_type(gsym, type, od, addr, true)); }
+ Address address)
+ { this->add(od, Output_reloc_type(gsym, type, od, address, true)); }
void
add_global_relative(Symbol* gsym, unsigned int type, Output_data* od,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address addr)
+ unsigned int shndx, Address address)
{
- this->add(od, Output_reloc_type(gsym, type, relobj, shndx, addr,
+ this->add(od, Output_reloc_type(gsym, type, relobj, shndx, address,
true));
}
void
add_local(Sized_relobj<size, big_endian>* relobj,
unsigned int local_sym_index, unsigned int type,
- Output_data* od, Address addr)
+ Output_data* od, Address address)
{
this->add(od, Output_reloc_type(relobj, local_sym_index, type, od,
- addr, false, false));
+ address, 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 addr)
+ Output_data* od, unsigned int shndx, Address address)
{
this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx,
- addr, false, false));
+ address, 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 addr)
+ Output_data* od, Address address)
{
this->add(od, Output_reloc_type(relobj, local_sym_index, type, od,
- addr, true, false));
+ address, 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 addr)
+ Output_data* od, unsigned int shndx, Address address)
{
this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx,
- addr, true, false));
+ address, 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 addr)
+ Output_data* od, Address address)
{
this->add(od, Output_reloc_type(relobj, input_shndx, type, od,
- addr, false, true));
+ address, 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 addr)
+ Output_data* od, unsigned int shndx, Address address)
{
this->add(od, Output_reloc_type(relobj, input_shndx, type, shndx,
- addr, false, true));
+ address, 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 addr)
- { this->add(od, Output_reloc_type(os, type, od, addr)); }
+ Output_data* od, Address address)
+ { this->add(od, Output_reloc_type(os, type, od, address)); }
void
add_output_section(Output_section* os, unsigned int type, Output_data* od,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address addr)
- { this->add(od, Output_reloc_type(os, type, relobj, shndx, addr)); }
+ unsigned int shndx, Address address)
+ { this->add(od, Output_reloc_type(os, type, relobj, shndx, address)); }
};
// The SHT_RELA version of Output_data_reloc.
void
add_global(Symbol* gsym, unsigned int type, Output_data* od,
- Address addr, Addend addend)
- { this->add(od, Output_reloc_type(gsym, type, od, addr, addend,
+ Address address, Addend addend)
+ { this->add(od, Output_reloc_type(gsym, type, od, address, addend,
false)); }
void
add_global(Symbol* gsym, unsigned int type, Output_data* od,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address addr,
+ unsigned int shndx, Address address,
Addend addend)
- { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, addr,
+ { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, address,
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 addr, Addend addend)
- { this->add(od, Output_reloc_type(gsym, type, od, addr, addend, true)); }
+ Address address, Addend addend)
+ { this->add(od, Output_reloc_type(gsym, type, od, address, addend, true)); }
void
add_global_relative(Symbol* gsym, unsigned int type, Output_data* od,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address addr, Addend addend)
- { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, addr,
+ unsigned int shndx, Address address, Addend addend)
+ { this->add(od, Output_reloc_type(gsym, type, relobj, shndx, address,
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 addr, Addend addend)
+ Output_data* od, Address address, Addend addend)
{
- this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, addr,
+ this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, address,
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 addr,
+ Output_data* od, unsigned int shndx, Address address,
Addend addend)
{
this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx,
- addr, addend, false, false));
+ address, 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 addr, Addend addend)
+ Output_data* od, Address address, Addend addend)
{
- this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, addr,
+ this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, address,
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 addr,
+ Output_data* od, unsigned int shndx, Address address,
Addend addend)
{
this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx,
- addr, addend, true, false));
+ address, 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 addr, Addend addend)
+ Output_data* od, Address address, Addend addend)
{
- this->add(od, Output_reloc_type(relobj, input_shndx, type, od, addr,
+ this->add(od, Output_reloc_type(relobj, input_shndx, type, od, address,
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 addr,
+ Output_data* od, unsigned int shndx, Address address,
Addend addend)
{
this->add(od, Output_reloc_type(relobj, input_shndx, type, shndx,
- addr, addend, false, true));
+ address, 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 addr, Addend addend)
- { this->add(os, Output_reloc_type(os, type, od, addr, addend)); }
+ Address address, Addend addend)
+ { this->add(os, Output_reloc_type(os, type, od, address, addend)); }
void
add_output_section(Output_section* os, unsigned int type,
Sized_relobj<size, big_endian>* relobj,
- unsigned int shndx, Address addr, Addend addend)
- { this->add(os, Output_reloc_type(os, type, relobj, shndx, addr,
+ unsigned int shndx, Address address, Addend addend)
+ { this->add(os, Output_reloc_type(os, type, relobj, shndx, address,
addend)); }
};
// plus a constant offset.
void
add_section_plus_offset(elfcpp::DT tag, const Output_data* od,
- unsigned int sec_offset)
- { this->add_entry(Dynamic_entry(tag, od, sec_offset)); }
+ unsigned int offset)
+ { this->add_entry(Dynamic_entry(tag, od, 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 etag, unsigned int val)
- : tag_(etag), offset_(DYNAMIC_NUMBER)
+ Dynamic_entry(elfcpp::DT tag, unsigned int val)
+ : tag_(tag), offset_(DYNAMIC_NUMBER)
{ this->u_.val = val; }
// Create an entry with the size or address of a section.
- Dynamic_entry(elfcpp::DT etag, const Output_data* od, bool section_size)
- : tag_(etag),
+ Dynamic_entry(elfcpp::DT tag, const Output_data* od, bool section_size)
+ : tag_(tag),
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 etag, const Output_data* od, unsigned int offset)
- : tag_(etag),
+ Dynamic_entry(elfcpp::DT tag, const Output_data* od, unsigned int offset)
+ : tag_(tag),
offset_(offset)
{ this->u_.od = od; }
// Create an entry with the address of a symbol.
- Dynamic_entry(elfcpp::DT etag, const Symbol* sym)
- : tag_(etag), offset_(DYNAMIC_SYMBOL)
+ Dynamic_entry(elfcpp::DT tag, const Symbol* sym)
+ : tag_(tag), offset_(DYNAMIC_SYMBOL)
{ this->u_.sym = sym; }
// Create an entry with a string.
- Dynamic_entry(elfcpp::DT etag, const char* str)
- : tag_(etag), offset_(DYNAMIC_STRING)
+ Dynamic_entry(elfcpp::DT tag, const char* str)
+ : tag_(tag), 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* rel_obj, unsigned int sec_shndx,
- uint64_t addr_align)
- : Output_section_data_build(addr_align), relobj_(rel_obj), shndx_(sec_shndx)
+ Output_relaxed_input_section(Relobj* relobj, unsigned int shndx,
+ uint64_t addralign)
+ : Output_section_data_build(addralign), relobj_(relobj), shndx_(shndx)
{ }
// Return the Relobj of this relaxed input section.
// Set the load address.
void
- set_load_address(uint64_t load_addr)
+ set_load_address(uint64_t load_address)
{
- this->load_address_ = load_addr;
+ this->load_address_ = load_address;
this->has_load_address_ = true;
}
static const unsigned int invalid_shndx = static_cast<unsigned int>(-1);
public:
- Simple_input_section(Relobj *rel_obj, unsigned int sec_shndx)
- : shndx_(sec_shndx)
+ Simple_input_section(Relobj *relobj, unsigned int shndx)
+ : shndx_(shndx)
{
- gold_assert(sec_shndx != invalid_shndx);
- this->u_.relobj = rel_obj;
+ gold_assert(shndx != invalid_shndx);
+ this->u_.relobj = relobj;
}
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 sec_type) const
- { return this->type_ == sec_type; }
+ do_is_section_type(elfcpp::Elf_Word type) const
+ { return this->type_ == type; }
// Return whether the specified section flag is set.
bool
}
// For an ordinary input section.
- 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)))
+ Input_section(Relobj* object, unsigned int shndx, off_t data_size,
+ uint64_t addralign)
+ : shndx_(shndx),
+ p2align_(ffsll(static_cast<long long>(addralign)))
{
- 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;
+ 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;
this->u2_.object = object;
}
// parameters.
bool
is_merge_section(bool is_string, uint64_t entsize,
- uint64_t addr_align) const
+ uint64_t addralign) const
{
return (this->shndx_ == (is_string
? MERGE_STRING_SECTION_CODE
: MERGE_DATA_SECTION_CODE)
&& this->u1_.entsize == entsize
- && this->addralign() == addr_align);
+ && this->addralign() == addralign);
}
// Return whether this is a relaxed input section.
// Add an input section, for SHF_MERGE sections.
bool
- add_input_section(Relobj* object, unsigned int sec_shndx)
+ add_input_section(Relobj* object, unsigned int shndx)
{
gold_assert(this->shndx_ == MERGE_DATA_SECTION_CODE
|| this->shndx_ == MERGE_STRING_SECTION_CODE);
- return this->u2_.posd->add_input_section(object, sec_shndx);
+ return this->u2_.posd->add_input_section(object, shndx);
}
// Given an input OBJECT, an input section index SHNDX within that
class Checkpoint_output_section
{
public:
- 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),
+ 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),
input_sections_size_(input_sections_.size()),
- input_sections_copy_(), first_input_offset_(first_input_off),
- attached_input_sections_are_sorted_(attached_input_sections_sorted)
+ input_sections_copy_(), first_input_offset_(first_input_offset),
+ attached_input_sections_are_sorted_(attached_input_sections_are_sorted)
{ }
virtual
class Fill
{
public:
- Fill(off_t section_off, off_t len)
- : section_offset_(section_off),
- length_(convert_to_section_size_type(len))
+ Fill(off_t section_offset, off_t length)
+ : section_offset_(section_offset),
+ length_(convert_to_section_size_type(length))
{ }
// Return section offset.
// Set the addresses.
void
- set_addresses(uint64_t v_addr, uint64_t p_addr)
+ set_addresses(uint64_t vaddr, uint64_t paddr)
{
- this->vaddr_ = v_addr;
- this->paddr_ = p_addr;
+ this->vaddr_ = vaddr;
+ this->paddr_ = paddr;
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 seg_flags)
- { this->flags_ = seg_flags; }
+ set_flags(elfcpp::Elf_Word flags)
+ { this->flags_ = 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, 2009 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
{
void
-Parameters::set_errors(Errors* errs)
+Parameters::set_errors(Errors* errors)
{
gold_assert(this->errors_ == NULL);
- this->errors_ = errs;
+ this->errors_ = errors;
}
void
-Parameters::set_options(const General_options* opts)
+Parameters::set_options(const General_options* options)
{
gold_assert(!this->options_valid());
- this->options_ = opts;
+ this->options_ = options;
// 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 (opts->verbose())
+ if (options->verbose())
this->debug_ |= DEBUG_FILES;
}
void
-Parameters::set_doing_static_link(bool doing_staticlink)
+Parameters::set_doing_static_link(bool doing_static_link)
{
gold_assert(!this->doing_static_link_valid_);
- this->doing_static_link_ = doing_staticlink;
+ this->doing_static_link_ = doing_static_link;
this->doing_static_link_valid_ = true;
}
void
-Parameters::set_target(Target* targ)
+Parameters::set_target(Target* target)
{
if (!this->target_valid())
- this->target_ = targ;
+ this->target_ = target;
else
- gold_assert(targ == this->target_);
+ gold_assert(target == this->target_);
}
// Return whether TARGET is compatible with the target we are using.
bool
-Parameters::is_compatible_target(const Target* targ) const
+Parameters::is_compatible_target(const Target* target) const
{
if (this->target_ == NULL)
return true;
- return targ == this->target_;
+ return target == this->target_;
}
Parameters::Target_size_endianness
void
Plugin_manager::all_symbols_read(Workqueue* workqueue, Task* task,
Input_objects* input_objects,
- Symbol_table* symtab, Layout* alayout,
+ Symbol_table* symtab, Layout* layout,
Dirsearch* dirpath, Mapfile* mapfile,
Task_token** last_blocker)
{
this->task_ = task;
this->input_objects_ = input_objects;
this->symtab_ = symtab;
- this->layout_ = alayout;
+ this->layout_ = layout;
this->dirpath_ = dirpath;
this->mapfile_ = mapfile;
this->this_blocker_ = NULL;
// Class Pluginobj.
-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_()
+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_()
{
}
// should be kept.
bool
-Pluginobj::include_comdat_group(std::string comdat_key, Layout* alayout)
+Pluginobj::include_comdat_group(std::string comdat_key, Layout* layout)
{
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 = alayout->find_or_add_kept_section(comdat_key,
- NULL, 0, true,
- true, NULL);
+ ins.first->second = layout->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& aname,
- Input_file* ainput_file,
- off_t aoffset,
- off_t afilesize)
- : Pluginobj(aname, ainput_file, aoffset, afilesize)
+ const std::string& name,
+ Input_file* input_file,
+ off_t offset,
+ off_t filesize)
+ : Pluginobj(name, input_file, offset, filesize)
{
}
void
Sized_pluginobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
Read_symbols_data*,
- Layout* alayout)
+ Layout* layout)
{
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* aname = isym->name;
+ const char* name = isym->name;
const char* ver = isym->version;
elfcpp::Elf_Half shndx;
elfcpp::STB bind;
elfcpp::STV vis;
- if (aname != NULL && aname[0] == '\0')
- aname = NULL;
+ if (name != NULL && name[0] == '\0')
+ name = 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, alayout))
+ && !this->include_comdat_group(isym->comdat_key, layout))
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, aname, ver, &sym);
+ symtab->add_from_pluginobj<size, big_endian>(this, name, ver, &sym);
}
}
void
Output_data_plt_powerpc<size, big_endian>::do_write(Output_file* of)
{
- const off_t off = this->offset();
+ const off_t offset = this->offset();
const section_size_type oview_size =
convert_to_section_size_type(this->data_size());
- unsigned char* const oview = of->get_output_view(off, oview_size);
+ unsigned char* const oview = of->get_output_view(offset, 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(off, oview_size, oview);
+ of->write_output_view(offset, 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 amachine, int, int)
+ Target* do_recognize(int machine, int, int)
{
switch (size)
{
case 64:
- if (amachine != elfcpp::EM_PPC64)
+ if (machine != elfcpp::EM_PPC64)
return NULL;
break;
case 32:
- if (amachine != elfcpp::EM_PPC)
+ if (machine != elfcpp::EM_PPC)
return NULL;
break;
// reduced_debug_output.cc -- output reduced debugging information to save space
-// Copyright 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2008 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 off = this->offset();
- off_t datasize = this->data_size();
- unsigned char* view = of->get_output_view(off, datasize);
+ off_t offset = this->offset();
+ off_t data_size = this->data_size();
+ unsigned char* view = of->get_output_view(offset, data_size);
if (this->failed_)
memcpy(view, this->postprocessing_buffer(),
this->postprocessing_buffer_size());
else
- memcpy(view, &this->data_.front(), datasize);
- of->write_output_view(off, datasize, view);
+ memcpy(view, &this->data_.front(), data_size);
+ of->write_output_view(offset, data_size, view);
}
// Locates the abbreviation with abbreviation_number abbrev_number in the
void Output_reduced_debug_info_section::do_write(Output_file* of)
{
- off_t off = this->offset();
- off_t datasize = this->data_size();
- unsigned char* view = of->get_output_view(off, datasize);
+ off_t offset = this->offset();
+ off_t data_size = this->data_size();
+ unsigned char* view = of->get_output_view(offset, data_size);
if (this->failed_)
memcpy(view, this->postprocessing_buffer(),
this->postprocessing_buffer_size());
else
- memcpy(view, &this->data_.front(), datasize);
- of->write_output_view(off, datasize, view);
+ memcpy(view, &this->data_.front(), data_size);
+ of->write_output_view(offset, data_size, view);
}
} // End namespace gold.
// reduced_debug_output.h -- reduce debugging information -*- C++ -*-
-// Copyright 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2008 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* aname, elfcpp::Elf_Word aflags,
- elfcpp::Elf_Xword atype)
- : Output_section(aname, aflags, atype), sized_(false),
+ Output_reduced_debug_abbrev_section(const char* name, elfcpp::Elf_Word flags,
+ elfcpp::Elf_Xword type)
+ : Output_section(name, flags, type), 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* aname, elfcpp::Elf_Word aflags,
- elfcpp::Elf_Xword atype)
- : Output_section(aname, aflags, atype), failed_(false)
+ Output_reduced_debug_info_section(const char* name, elfcpp::Elf_Word flags,
+ elfcpp::Elf_Xword type)
+ : Output_section(name, flags, type), failed_(false)
{ this->set_requires_postprocessing(); }
void
{
rd->relocs.clear();
- unsigned int sec_shnum = this->shnum();
- if (sec_shnum == 0)
+ unsigned int shnum = this->shnum();
+ if (shnum == 0)
return;
- rd->relocs.reserve(sec_shnum / 2);
+ rd->relocs.reserve(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(),
- sec_shnum * This::shdr_size,
+ 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 < sec_shnum; ++i, ps += This::shdr_size)
+ for (unsigned int i = 1; i < shnum; ++i, ps += This::shdr_size)
{
typename This::Shdr shdr(ps);
continue;
unsigned int shndx = this->adjust_shndx(shdr.get_sh_info());
- if (shndx >= sec_shnum)
+ if (shndx >= 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 symsize = This::sym_size;
+ const int sym_size = This::sym_size;
const unsigned int loccount = this->local_symbol_count_;
gold_assert(loccount == symtabshdr.get_sh_info());
- off_t locsize = loccount * symsize;
+ off_t locsize = loccount * sym_size;
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* alayout,
+ Layout* layout,
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, alayout, this,
+ target->gc_process_relocs(symtab, layout, 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* alayout,
+ Layout* layout,
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, alayout, this, p->data_shndx,
+ target->scan_relocs(symtab, layout, 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, alayout, local_symbols, p);
+ this->emit_relocs_scan(symtab, layout, 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, alayout, this,
+ target->scan_relocatable_relocs(symtab, layout, 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* alayout,
+ Layout* layout,
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, alayout,
+ this->emit_relocs_scan_reltype<elfcpp::SHT_REL>(symtab, layout,
plocal_syms, p, rr);
else
{
gold_assert(p->sh_type == elfcpp::SHT_RELA);
- this->emit_relocs_scan_reltype<elfcpp::SHT_RELA>(symtab, alayout,
+ this->emit_relocs_scan_reltype<elfcpp::SHT_RELA>(symtab, layout,
plocal_syms, p, rr);
}
}
void
Sized_relobj<size, big_endian>::emit_relocs_scan_reltype(
Symbol_table* symtab,
- Layout* alayout,
+ Layout* layout,
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,
- alayout,
+ layout,
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* alayout,
+ const Layout* layout,
Output_file* of)
{
- unsigned int sec_shnum = this->shnum();
+ unsigned int shnum = this->shnum();
// Read the section headers.
const unsigned char* pshdrs = this->get_view(this->elf_file_.shoff(),
- sec_shnum * This::shdr_size,
+ shnum * This::shdr_size,
true, true);
Views views;
- views.resize(sec_shnum);
+ views.resize(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, alayout, pshdrs, &views);
+ this->relocate_sections(symtab, layout, 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 < sec_shnum; ++i)
+ for (unsigned int i = 1; i < shnum; ++i)
{
if (views[i].view != NULL)
{
}
// Write out the local symbols.
- this->write_local_symbols(of, alayout->sympool(), alayout->dynpool(),
- alayout->symtab_xindex(), alayout->dynsym_xindex());
+ this->write_local_symbols(of, layout->sympool(), layout->dynpool(),
+ layout->symtab_xindex(), layout->dynsym_xindex());
// We should no longer need the local symbol values.
this->clear_local_symbols();
Output_file* of,
Views* pviews)
{
- unsigned int sec_shnum = this->shnum();
+ unsigned int 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 < sec_shnum; ++i, p += This::shdr_size)
+ for (unsigned int i = 1; i < 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 out_section_offset;
+ off_t output_section_offset;
Address output_section_size;
if (!os->requires_postprocessing())
{
- out_section_offset = os->offset();
+ output_section_offset = os->offset();
output_section_size = convert_types<Address, off_t>(os->data_size());
}
else
{
- out_section_offset = 0;
+ output_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 = out_section_offset + output_offset;
+ view_start = output_section_offset + output_offset;
view_size = convert_to_section_size_type(shdr.get_sh_size());
}
else
{
- view_start = out_section_offset;
+ view_start = output_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* aview;
+ unsigned char* view;
if (os->requires_postprocessing())
{
unsigned char* buffer = os->postprocessing_buffer();
- aview = buffer + view_start;
+ view = 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, aview));
+ view_size, view));
}
}
else
{
if (output_offset == invalid_address)
- aview = of->get_input_output_view(view_start, view_size);
+ view = of->get_input_output_view(view_start, view_size);
else
{
- aview = of->get_output_view(view_start, view_size);
+ view = 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, aview));
+ view_size, view));
}
}
- pvs->view = aview;
+ pvs->view = view;
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* alayout,
+ const Layout* layout,
const unsigned char* pshdrs,
Views* pviews)
{
- unsigned int sec_shnum = this->shnum();
+ unsigned int 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 = alayout;
+ relinfo.layout = layout;
relinfo.object = this;
const unsigned char* p = pshdrs + This::shdr_size;
- for (unsigned int i = 1; i < sec_shnum; ++i, p += This::shdr_size)
+ for (unsigned int i = 1; i < 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* aview = (*pviews)[index].view;
+ unsigned char* view = (*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, aview, view_size,
+ prelocs, reloc_count, view, view_size,
&reloc_map);
}
{
target->relocate_section(&relinfo, sh_type, prelocs, reloc_count, os,
output_offset == invalid_address,
- aview, address, view_size, reloc_map);
+ view, address, view_size, reloc_map);
if (parameters->options().emit_relocs())
this->emit_relocs(&relinfo, i, sh_type, prelocs, reloc_count,
- os, output_offset, aview, address, view_size,
+ os, output_offset, view, 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,
- aview, address, view_size,
+ view, address, view_size,
(*pviews)[i].view,
(*pviews)[i].view_size);
}
unsigned int sh_type,
const unsigned char* prelocs,
size_t reloc_count,
- Output_section* aoutput_section,
+ Output_section* output_section,
typename elfcpp::Elf_types<size>::Elf_Addr offset_in_output_section,
- unsigned char* aview,
+ unsigned char* view,
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, aoutput_section,
+ reloc_count, output_section,
offset_in_output_section,
- aview, address, view_size,
+ view, 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, aoutput_section,
+ reloc_count, output_section,
offset_in_output_section,
- aview, address, view_size,
+ view, address, view_size,
reloc_view, reloc_view_size);
}
}
unsigned int i,
const unsigned char* prelocs,
size_t reloc_count,
- Output_section* aoutput_section,
+ Output_section* output_section,
typename elfcpp::Elf_types<size>::Elf_Addr offset_in_output_section,
- unsigned char* aview,
+ unsigned char* view,
typename elfcpp::Elf_types<size>::Elf_Addr address,
section_size_type view_size,
unsigned char* reloc_view,
relinfo,
prelocs,
reloc_count,
- aoutput_section,
+ output_section,
offset_in_output_section,
rr,
- aview,
+ view,
address,
view_size,
reloc_view,
unsigned int shndx,
const unsigned char* prelocs,
size_t reloc_count,
- unsigned char* aview,
+ unsigned char* view,
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,
- aview, view_size,
+ view, 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,
- aview, view_size,
+ view, view_size,
reloc_map);
}
}
unsigned int shndx,
const unsigned char* prelocs,
size_t reloc_count,
- unsigned char* aview,
+ unsigned char* view,
section_size_type view_size,
Reloc_symbol_changes** reloc_map)
{
&& gsym->source() == Symbol::FROM_OBJECT
&& !gsym->object()->uses_split_stack())
{
- section_offset_type off =
+ section_offset_type offset =
convert_to_section_size_type(reloc.get_r_offset());
- non_split_refs.push_back(off);
+ non_split_refs.push_back(offset);
}
}
std::string from;
std::string to;
parameters->target().calls_non_split(this, shndx, p->first, p->second,
- aview, view_size, &from, &to);
+ view, view_size, &from, &to);
if (!from.empty())
{
gold_assert(!to.empty());
if (r_sym < local_count)
continue;
- section_offset_type off =
+ section_offset_type offset =
convert_to_section_size_type(reloc.get_r_offset());
- if (off < p->first
- || (off
+ if (offset < p->first
+ || (offset
>= (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 sym_tab_shndx = this->symtab_shndx_;
- typename This::Shdr symtabshdr(pshdrs + sym_tab_shndx * This::shdr_size);
+ const unsigned int symtab_shndx = this->symtab_shndx_;
+ typename This::Shdr symtabshdr(pshdrs + symtab_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 symsize = This::sym_size;
- const unsigned int symcount = sh_size / symsize;
- for (unsigned int i = 0; i < symcount; ++i, psyms += symsize)
+ 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)
{
typename elfcpp::Sym<size, big_endian> isym(psyms);
template
void
Sized_relobj<32, false>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* alayout,
+ Layout* layout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<32, true>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* alayout,
+ Layout* layout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<64, false>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* alayout,
+ Layout* layout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<64, true>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* alayout,
+ Layout* layout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<32, false>::do_scan_relocs(Symbol_table* symtab,
- Layout* alayout,
+ Layout* layout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<32, true>::do_scan_relocs(Symbol_table* symtab,
- Layout* alayout,
+ Layout* layout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<64, false>::do_scan_relocs(Symbol_table* symtab,
- Layout* alayout,
+ Layout* layout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<64, true>::do_scan_relocs(Symbol_table* symtab,
- Layout* alayout,
+ Layout* layout,
Read_relocs_data* rd);
#endif
template
void
Sized_relobj<32, false>::do_relocate(const Symbol_table* symtab,
- const Layout* alayout,
+ const Layout* layout,
Output_file* of);
#endif
template
void
Sized_relobj<32, true>::do_relocate(const Symbol_table* symtab,
- const Layout* alayout,
+ const Layout* layout,
Output_file* of);
#endif
template
void
Sized_relobj<64, false>::do_relocate(const Symbol_table* symtab,
- const Layout* alayout,
+ const Layout* layout,
Output_file* of);
#endif
template
void
Sized_relobj<64, true>::do_relocate(const Symbol_table* symtab,
- const Layout* alayout,
+ const Layout* layout,
Output_file* of);
#endif
void
Sized_relobj<32, false>::do_relocate_sections(
const Symbol_table* symtab,
- const Layout* alayout,
+ const Layout* layout,
const unsigned char* pshdrs,
Views* pviews);
#endif
void
Sized_relobj<32, true>::do_relocate_sections(
const Symbol_table* symtab,
- const Layout* alayout,
+ const Layout* layout,
const unsigned char* pshdrs,
Views* pviews);
#endif
void
Sized_relobj<64, false>::do_relocate_sections(
const Symbol_table* symtab,
- const Layout* alayout,
+ const Layout* layout,
const unsigned char* pshdrs,
Views* pviews);
#endif
// Record what to do for the next reloc.
void
- set_next_reloc_strategy(Reloc_strategy astrategy)
+ set_next_reloc_strategy(Reloc_strategy strategy)
{
- this->reloc_strategies_.push_back(static_cast<unsigned char>(astrategy));
- if (astrategy != RELOC_DISCARD)
+ this->reloc_strategies_.push_back(static_cast<unsigned char>(strategy));
+ if (strategy != RELOC_DISCARD)
++this->output_reloc_count_;
}
// VERSION. Update the VERSION_ field accordingly.
inline void
-Symbol::override_version(const char* aversion)
+Symbol::override_version(const char* version)
{
- if (aversion == NULL)
+ if (version == 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_ = aversion;
+ this->version_ = version;
}
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_ == aversion || this->version_ == NULL);
- this->version_ = aversion;
+ gold_assert(this->version_ == version || this->version_ == NULL);
+ this->version_ = version;
}
}
// is VISIBILITY. Updated the VISIBILITY_ field accordingly.
inline void
-Symbol::override_visibility(elfcpp::STV avisibility)
+Symbol::override_visibility(elfcpp::STV visibility)
{
// 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 (avisibility != elfcpp::STV_DEFAULT)
+ if (visibility != elfcpp::STV_DEFAULT)
{
if (this->visibility_ == elfcpp::STV_DEFAULT)
- this->visibility_ = avisibility;
- else if (this->visibility_ > avisibility)
- this->visibility_ = avisibility;
+ this->visibility_ = visibility;
+ else if (this->visibility_ > visibility)
+ this->visibility_ = visibility;
}
}
void
Symbol::override_base(const elfcpp::Sym<size, big_endian>& sym,
unsigned int st_shndx, bool is_ordinary,
- Object* aobject, const char* aversion)
+ Object* object, const char* version)
{
gold_assert(this->source_ == FROM_OBJECT);
- this->u_.from_object.object = aobject;
- this->override_version(aversion);
+ this->u_.from_object.object = object;
+ this->override_version(version);
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 (aobject->is_dynamic())
+ if (object->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* aobject, const char* aversion)
+ Object* object, const char* version)
{
- this->override_base(sym, st_shndx, is_ordinary, aobject, aversion);
+ this->override_base(sym, st_shndx, is_ordinary, object, version);
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* aobject, const char* aversion)
+ Object* object, const char* version)
{
- tosym->override(fromsym, st_shndx, is_ordinary, aobject, aversion);
+ tosym->override(fromsym, st_shndx, is_ordinary, object, version);
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, aobject, aversion);
+ ssym->override(fromsym, st_shndx, is_ordinary, object, version);
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& inputsection)
- : input_section_(inputsection), section_name_(),
+ Input_section_info(const Output_section::Simple_input_section& input_section)
+ : input_section_(input_section), section_name_(),
size_(0), addralign_(1)
{ }
// Set the section name.
void
- set_section_name(const std::string aname)
- { this->section_name_ = aname; }
+ set_section_name(const std::string name)
+ { this->section_name_ = name; }
// Return the section size.
uint64_t
// Set the section size.
void
- set_size(uint64_t sec_size)
- { this->size_ = sec_size; }
+ set_size(uint64_t size)
+ { this->size_ = size; }
// Return the address alignment.
uint64_t
// Set the address alignment.
void
- set_addralign(uint64_t addr_align)
- { this->addralign_ = addr_align; }
+ set_addralign(uint64_t addralign)
+ { this->addralign_ = addralign; }
private:
// Input section, can be a relaxed section.
Input_section_sorter(this->filename_sort_,
isp.sort));
- for (std::vector<Input_section_info>::const_iterator q =
+ for (std::vector<Input_section_info>::const_iterator p =
matching_sections[i].begin();
- q != matching_sections[i].end();
- ++q)
+ p != matching_sections[i].end();
+ ++p)
{
- uint64_t this_subalign = q->addralign();
+ uint64_t this_subalign = p->addralign();
if (this_subalign < subalign)
this_subalign = subalign;
layout->new_output_section_data_from_script(posd);
}
- output_section->add_input_section_for_script(q->input_section(),
- q->size(),
+ output_section->add_input_section_for_script(p->input_section(),
+ p->size(),
this_subalign);
- dot = address + q->size();
+ dot = address + p->size();
}
}
Output_section_definition::get_output_section_info(const char* name,
uint64_t* address,
uint64_t* load_address,
- uint64_t* addr_align,
+ uint64_t* addralign,
uint64_t* size) const
{
if (this->name_ != name)
*load_address = this->output_section_->load_address();
else
*load_address = *address;
- *addr_align = this->output_section_->addralign();
+ *addralign = this->output_section_->addralign();
*size = this->output_section_->current_data_size();
}
else
{
*address = this->evaluated_address_;
*load_address = this->evaluated_load_address_;
- *addr_align = this->evaluated_addralign_;
+ *addralign = this->evaluated_addralign_;
*size = 0;
}
p != input_sections.end();
++p)
{
- uint64_t addr_align;
+ uint64_t addralign;
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());
- addr_align = p->relobj()->section_addralign(p->shndx());
+ addralign = 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, addr_align);
- this->os_->add_input_section_for_script(*p, size, addr_align);
+ address = align_address(address, addralign);
+ this->os_->add_input_section_for_script(*p, size, addralign);
address += size;
}
class Phdrs_element
{
public:
- Phdrs_element(const char* aname, size_t namelen, unsigned int atype,
- bool include_filehdr, bool include_phdrs,
+ Phdrs_element(const char* name, size_t namelen, unsigned int type,
+ bool includes_filehdr, bool includes_phdrs,
bool is_flags_valid, unsigned int flags,
- 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),
+ 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),
segment_(NULL)
{ }
// Evaluate the load address expression if there is one.
void
- eval_load_address(Symbol_table* symtab, Layout* alayout)
+ eval_load_address(Symbol_table* symtab, Layout* layout)
{
if (this->load_address_ != NULL)
- this->load_address_value_ = this->load_address_->eval(symtab, alayout,
+ this->load_address_value_ = this->load_address_->eval(symtab, layout,
true);
}
bool
Script_sections::get_output_section_info(const char* name, uint64_t* address,
uint64_t* load_address,
- uint64_t* addr_align,
+ uint64_t* addralign,
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, addr_align,
+ if ((*p)->get_output_section_info(name, address, load_address, addralign,
size))
return true;
return false;
{ }
// A general token with no value.
- Token(Classification aclassification, int linenum, int char_pos)
- : classification_(aclassification), value_(NULL), value_length_(0),
- opcode_(0), lineno_(linenum), charpos_(char_pos)
+ Token(Classification classification, int lineno, int charpos)
+ : classification_(classification), value_(NULL), value_length_(0),
+ opcode_(0), lineno_(lineno), charpos_(charpos)
{
- gold_assert(aclassification == TOKEN_INVALID
- || aclassification == TOKEN_EOF);
+ gold_assert(classification == TOKEN_INVALID
+ || classification == TOKEN_EOF);
}
// A general token with a value.
- 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)
+ 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)
{
- gold_assert(aclassification != TOKEN_INVALID
- && aclassification != TOKEN_EOF);
+ gold_assert(classification != TOKEN_INVALID
+ && classification != TOKEN_EOF);
}
// A token representing an operator.
- Token(int opcode, int linenum, int char_pos)
+ Token(int opcode, int lineno, int charpos)
: classification_(TOKEN_OPERATOR), value_(NULL), value_length_(0),
- opcode_(opcode), lineno_(linenum), charpos_(char_pos)
+ opcode_(opcode), lineno_(lineno), charpos_(charpos)
{ }
// Return whether the token is invalid.
// Set the lexing mode.
void
- set_mode(Mode mde)
- { this->mode_ = mde; }
+ set_mode(Mode mode)
+ { this->mode_ = mode; }
private:
Lex(const Lex&);
class Parser_closure
{
public:
- Parser_closure(const char* afilename,
+ Parser_closure(const char* filename,
const Position_dependent_options& posdep_options,
- bool in_a_group, bool is_in_a_sysroot,
- Command_line* acommand_line,
- Script_options* script_opts,
+ bool in_group, bool is_in_sysroot,
+ Command_line* command_line,
+ Script_options* script_options,
Lex* lex,
- 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),
+ 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),
found_incompatible_target_(false),
- command_line_(acommand_line), script_options_(script_opts),
- version_script_info_(script_opts->version_script_info()),
+ command_line_(command_line), script_options_(script_options),
+ version_script_info_(script_options->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& apattern,
- const std::string& alanguage,
- bool is_exact_match)
- : pattern(apattern), language(alanguage), exact_match(is_exact_match) {}
+ Version_expression(const std::string& pattern,
+ const std::string& language,
+ bool exact_match)
+ : pattern(pattern), language(language), exact_match(exact_match) {}
std::string pattern;
std::string language;
class Script_assertion
{
public:
- Script_assertion(Expression* echeck, const char* message,
+ Script_assertion(Expression* check, const char* message,
size_t messagelen)
- : check_(echeck), message_(message, messagelen)
+ : check_(check), message_(message, messagelen)
{ }
// Check the assertion.
class Script_info
{
public:
- Script_info(Input_arguments* arg_inputs)
- : inputs_(arg_inputs)
+ Script_info(Input_arguments* inputs)
+ : inputs_(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 avalue,
+ typename elfcpp::Swap<size, big_endian>::Valtype value,
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 = ((avalue + addend) >> right_shift);
+ Valtype reloc = ((value + 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 avalue,
+ typename elfcpp::Elf_types<size>::Elf_Addr value,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
- This_insn::template rela<32>(view, 10, 0x003fffff, avalue, addend);
+ This_insn::template rela<32>(view, 10, 0x003fffff, value, 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 avalue,
+ typename elfcpp::Elf_types<size>::Elf_Addr value,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
- This_insn::template rela<32>(view, 0, 0x000003ff, avalue, addend);
+ This_insn::template rela<32>(view, 0, 0x000003ff, value, 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 avalue,
+ typename elfcpp::Elf_types<size>::Elf_Addr value,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
- This_insn::template rela<32>(view, 0, 0x00001fff, avalue, addend);
+ This_insn::template rela<32>(view, 0, 0x00001fff, value, 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 avalue,
+ typename elfcpp::Elf_types<size>::Elf_Addr value,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
- This_insn::hi22(view, avalue, addend);
+ This_insn::hi22(view, value, 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 avalue,
+ typename elfcpp::Elf_types<size>::Elf_Addr value,
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 = (avalue + addend);
+ Valtype reloc = (value + 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 avalue,
+ typename elfcpp::Elf_types<size>::Elf_Addr value,
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 = (avalue + addend);
+ Valtype reloc = (value + 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 avalue,
+ typename elfcpp::Elf_types<size>::Elf_Addr value,
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 = (avalue + addend);
+ Valtype reloc = (value + addend);
val &= ~0x1fff;
reloc &= 0x3ff;
void
Output_data_plt_sparc<size, big_endian>::do_write(Output_file* of)
{
- const off_t off = this->offset();
+ const off_t offset = this->offset();
const section_size_type oview_size =
convert_to_section_size_type(this->data_size());
- unsigned char* const oview = of->get_output_view(off, oview_size);
+ unsigned char* const oview = of->get_output_view(offset, 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(off, oview_size, oview);
+ of->write_output_view(offset, 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 avalue;
+ elfcpp::Elf_Xword value;
- avalue = target->plt_section()->address() + gsym->plt_offset();
+ value = target->plt_section()->address() + gsym->plt_offset();
- symval.set_output_value(avalue);
+ symval.set_output_value(value);
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 avalue = psymval->value(object, 0);
+ typename elfcpp::Elf_types<size>::Elf_Addr value = psymval->value(object, 0);
const bool is_final =
(gsym == NULL
Insntype* wv = reinterpret_cast<Insntype*>(view);
Insntype val;
- avalue -= tls_segment->memsz();
+ value -= tls_segment->memsz();
switch (r_type)
{
case elfcpp::R_SPARC_TLS_GD_HI22:
// TLS_GD_HI22 --> TLS_LE_HIX22
- Reloc::hix22(view, avalue, addend);
+ Reloc::hix22(view, value, addend);
break;
case elfcpp::R_SPARC_TLS_GD_LO10:
// TLS_GD_LO10 --> TLS_LE_LOX10
- Reloc::lox10(view, avalue, addend);
+ Reloc::lox10(view, value, addend);
break;
case elfcpp::R_SPARC_TLS_GD_ADD:
if (gsym != NULL)
{
gold_assert(gsym->has_got_offset(got_type));
- avalue = gsym->got_offset(got_type);
+ value = 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));
- avalue = object->local_got_offset(r_sym, got_type);
+ value = 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, avalue, addend);
+ Reloc::hi22(view, value, addend);
break;
case elfcpp::R_SPARC_TLS_GD_LO10:
// TLS_GD_LO10 --> TLS_IE_LO10
- Reloc::lo10(view, avalue, addend);
+ Reloc::lo10(view, value, addend);
break;
case elfcpp::R_SPARC_TLS_GD_ADD:
switch (r_type)
{
case elfcpp::R_SPARC_TLS_GD_HI22:
- Reloc::hi22(view, avalue, addend);
+ Reloc::hi22(view, value, addend);
break;
case elfcpp::R_SPARC_TLS_GD_LO10:
- Reloc::lo10(view, avalue, addend);
+ Reloc::lo10(view, value, addend);
break;
case elfcpp::R_SPARC_TLS_GD_ADD:
break;
case elfcpp::R_SPARC_TLS_GD_CALL:
{
Symbol_value<size> symval;
- elfcpp::Elf_Xword xvalue;
+ elfcpp::Elf_Xword value;
Symbol* tsym;
tsym = target->tls_get_addr_sym_;
gold_assert(tsym);
- xvalue = (target->plt_section()->address() +
- tsym->plt_offset());
- symval.set_output_value(xvalue);
+ value = (target->plt_section()->address() +
+ tsym->plt_offset());
+ symval.set_output_value(value);
Reloc::wdisp30(view, object, &symval, addend, address);
}
break;
case elfcpp::R_SPARC_TLS_LDM_CALL:
{
Symbol_value<size> symval;
- elfcpp::Elf_Xword xvalue;
+ elfcpp::Elf_Xword value;
Symbol* tsym;
tsym = target->tls_get_addr_sym_;
gold_assert(tsym);
- xvalue = (target->plt_section()->address() +
- tsym->plt_offset());
- symval.set_output_value(xvalue);
+ value = (target->plt_section()->address() +
+ tsym->plt_offset());
+ symval.set_output_value(value);
Reloc::wdisp30(view, object, &symval, addend, address);
}
break;
case elfcpp::R_SPARC_TLS_LDO_HIX22:
if (optimized_type == tls::TLSOPT_TO_LE)
{
- avalue -= tls_segment->memsz();
- Reloc::hix22(view, avalue, addend);
+ value -= tls_segment->memsz();
+ Reloc::hix22(view, value, addend);
}
else
- Reloc::ldo_hix22(view, avalue, addend);
+ Reloc::ldo_hix22(view, value, addend);
break;
case elfcpp::R_SPARC_TLS_LDO_LOX10:
if (optimized_type == tls::TLSOPT_TO_LE)
{
- avalue -= tls_segment->memsz();
- Reloc::lox10(view, avalue, addend);
+ value -= tls_segment->memsz();
+ Reloc::lox10(view, value, addend);
}
else
- Reloc::ldo_lox10(view, avalue, addend);
+ Reloc::ldo_lox10(view, value, 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)
{
- avalue -= tls_segment->memsz();
+ value -= tls_segment->memsz();
switch (r_type)
{
case elfcpp::R_SPARC_TLS_IE_HI22:
// IE_HI22 --> LE_HIX22
- Reloc::hix22(view, avalue, addend);
+ Reloc::hix22(view, value, addend);
break;
case elfcpp::R_SPARC_TLS_IE_LO10:
// IE_LO10 --> LE_LOX10
- Reloc::lox10(view, avalue, addend);
+ Reloc::lox10(view, value, addend);
break;
}
break;
if (gsym != NULL)
{
gold_assert(gsym->has_got_offset(GOT_TYPE_TLS_OFFSET));
- avalue = gsym->got_offset(GOT_TYPE_TLS_OFFSET);
+ value = 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));
- avalue = object->local_got_offset(r_sym,
- GOT_TYPE_TLS_OFFSET);
+ value = object->local_got_offset(r_sym,
+ GOT_TYPE_TLS_OFFSET);
}
switch (r_type)
{
case elfcpp::R_SPARC_TLS_IE_HI22:
- Reloc::hi22(view, avalue, addend);
+ Reloc::hi22(view, value, addend);
break;
case elfcpp::R_SPARC_TLS_IE_LO10:
- Reloc::lo10(view, avalue, addend);
+ Reloc::lo10(view, value, addend);
break;
}
break;
// have been created for this location, so do not apply it now.
if (!parameters->options().shared())
{
- avalue -= tls_segment->memsz();
- Reloc::hix22(view, avalue, addend);
+ value -= tls_segment->memsz();
+ Reloc::hix22(view, value, addend);
}
break;
// have been created for this location, so do not apply it now.
if (!parameters->options().shared())
{
- avalue -= tls_segment->memsz();
- Reloc::lox10(view, avalue, addend);
+ value -= tls_segment->memsz();
+ Reloc::lox10(view, value, addend);
}
break;
}
(size == 64 ? "elf64-sparc" : "elf32-sparc"))
{ }
- Target* do_recognize(int amachine, int, int)
+ Target* do_recognize(int machine, int, int)
{
switch (size)
{
case 64:
- if (amachine != elfcpp::EM_SPARCV9)
+ if (machine != elfcpp::EM_SPARCV9)
return NULL;
break;
case 32:
- if (amachine != elfcpp::EM_SPARC
- && amachine != elfcpp::EM_SPARC32PLUS)
+ if (machine != elfcpp::EM_SPARC
+ && machine != elfcpp::EM_SPARC32PLUS)
return NULL;
break;
// and source_.
void
-Symbol::init_fields(const char* aname, const char* aversion,
- elfcpp::STT atype, elfcpp::STB abinding,
- elfcpp::STV avisibility, unsigned char non_vis)
+Symbol::init_fields(const char* name, const char* version,
+ elfcpp::STT type, elfcpp::STB binding,
+ elfcpp::STV visibility, unsigned char nonvis)
{
- this->name_ = aname;
- this->version_ = aversion;
+ this->name_ = name;
+ this->version_ = version;
this->symtab_index_ = 0;
this->dynsym_index_ = 0;
this->got_offsets_.init();
this->plt_offset_ = 0;
- this->type_ = atype;
- this->binding_ = abinding;
- this->visibility_ = avisibility;
- this->nonvis_ = non_vis;
+ this->type_ = type;
+ this->binding_ = binding;
+ this->visibility_ = visibility;
+ this->nonvis_ = nonvis;
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* aname)
+demangle(const char* name)
{
if (!parameters->options().do_demangle())
- return aname;
+ return name;
// cplus_demangle allocates memory for the result it returns,
// and returns NULL if the name is already demangled.
- char* demangled_name = cplus_demangle(aname, DMGL_ANSI | DMGL_PARAMS);
+ char* demangled_name = cplus_demangle(name, DMGL_ANSI | DMGL_PARAMS);
if (demangled_name == NULL)
- return aname;
+ return name;
std::string retval(demangled_name);
free(demangled_name);
template<int size, bool big_endian>
void
-Symbol::init_base_object(const char* aname, const char* aversion, Object* aobject,
+Symbol::init_base_object(const char* name, const char* version, Object* object,
const elfcpp::Sym<size, big_endian>& sym,
unsigned int st_shndx, bool is_ordinary)
{
- this->init_fields(aname, aversion, sym.get_st_type(), sym.get_st_bind(),
+ this->init_fields(name, version, sym.get_st_type(), sym.get_st_bind(),
sym.get_st_visibility(), sym.get_st_nonvis());
- this->u_.from_object.object = aobject;
+ this->u_.from_object.object = object;
this->u_.from_object.shndx = st_shndx;
this->is_ordinary_shndx_ = is_ordinary;
this->source_ = FROM_OBJECT;
- this->in_reg_ = !aobject->is_dynamic();
- this->in_dyn_ = aobject->is_dynamic();
- this->in_real_elf_ = aobject->pluginobj() == NULL;
+ this->in_reg_ = !object->is_dynamic();
+ this->in_dyn_ = object->is_dynamic();
+ this->in_real_elf_ = object->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* 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)
+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)
{
- this->init_fields(aname, aversion, atype, abinding, avisibility, non_vis);
+ this->init_fields(name, version, type, binding, visibility, nonvis);
this->u_.in_output_data.output_data = od;
- this->u_.in_output_data.offset_is_from_end = offset_is_from_the_end;
+ this->u_.in_output_data.offset_is_from_end = offset_is_from_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* aname, const char* aversion,
- Output_segment* os, elfcpp::STT atype,
- elfcpp::STB abinding, elfcpp::STV avisibility,
- unsigned char non_vis,
- Segment_offset_base offsetbase)
+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)
{
- this->init_fields(aname, aversion, atype, abinding, avisibility, non_vis);
+ this->init_fields(name, version, type, binding, visibility, nonvis);
this->u_.in_output_segment.output_segment = os;
- this->u_.in_output_segment.offset_base = offsetbase;
+ this->u_.in_output_segment.offset_base = offset_base;
this->source_ = IN_OUTPUT_SEGMENT;
this->in_reg_ = true;
this->in_real_elf_ = true;
// as a constant.
void
-Symbol::init_base_constant(const char* aname, const char* aversion,
- elfcpp::STT atype, elfcpp::STB abinding,
- elfcpp::STV avisibility, unsigned char non_vis)
+Symbol::init_base_constant(const char* name, const char* version,
+ elfcpp::STT type, elfcpp::STB binding,
+ elfcpp::STV visibility, unsigned char nonvis)
{
- this->init_fields(aname, aversion, atype, abinding, avisibility, non_vis);
+ this->init_fields(name, version, type, binding, visibility, nonvis);
this->source_ = IS_CONSTANT;
this->in_reg_ = true;
this->in_real_elf_ = true;
// symbol.
void
-Symbol::init_base_undefined(const char* aname, const char* aversion,
- elfcpp::STT atype, elfcpp::STB abinding,
- elfcpp::STV avisibility, unsigned char non_vis)
+Symbol::init_base_undefined(const char* name, const char* version,
+ elfcpp::STT type, elfcpp::STB binding,
+ elfcpp::STV visibility, unsigned char nonvis)
{
- this->init_fields(aname, aversion, atype, abinding, avisibility, non_vis);
+ this->init_fields(name, version, type, binding, visibility, nonvis);
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* aname, const char* aversion,
- Object* aobject,
+Sized_symbol<size>::init_object(const char* name, const char* version,
+ Object* object,
const elfcpp::Sym<size, big_endian>& sym,
unsigned int st_shndx, bool is_ordinary)
{
- this->init_base_object(aname, aversion, aobject, sym, st_shndx, is_ordinary);
+ this->init_base_object(name, version, object, 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* 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)
+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)
{
- 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;
+ this->init_base_output_data(name, version, od, type, binding, visibility,
+ nonvis, offset_is_from_end);
+ this->value_ = value;
+ this->symsize_ = symsize;
}
// Initialize the fields in Sized_symbol for a symbol defined in an
template<int size>
void
-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)
+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)
{
- this->init_base_output_segment(aname, aversion, os, atype, abinding, avisibility,
- non_vis, offsetbase);
- this->value_ = avalue;
- this->symsize_ = sym_size;
+ this->init_base_output_segment(name, version, os, type, binding, visibility,
+ nonvis, offset_base);
+ this->value_ = value;
+ this->symsize_ = symsize;
}
// Initialize the fields in Sized_symbol for a symbol defined as a
template<int size>
void
-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)
+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)
{
- this->init_base_constant(aname, aversion, atype, abinding, avisibility, non_vis);
- this->value_ = avalue;
- this->symsize_ = sym_size;
+ this->init_base_constant(name, version, type, binding, visibility, nonvis);
+ this->value_ = value;
+ this->symsize_ = symsize;
}
// Initialize the fields in Sized_symbol for an undefined symbol.
template<int size>
void
-Sized_symbol<size>::init_undefined(const char* aname, const char* aversion,
- elfcpp::STT atype, elfcpp::STB abinding,
- elfcpp::STV avisibility, unsigned char non_vis)
+Sized_symbol<size>::init_undefined(const char* name, const char* version,
+ elfcpp::STT type, elfcpp::STB binding,
+ elfcpp::STV visibility, unsigned char nonvis)
{
- this->init_base_undefined(aname, aversion, atype, abinding, avisibility, non_vis);
+ this->init_base_undefined(name, version, type, binding, visibility, nonvis);
this->value_ = 0;
this->symsize_ = 0;
}
// Return true if SHNDX represents a common symbol.
bool
-Symbol::is_common_shndx(unsigned int sec_shndx)
+Symbol::is_common_shndx(unsigned int shndx)
{
- return (sec_shndx == elfcpp::SHN_COMMON
- || sec_shndx == parameters->target().small_common_shndx()
- || sec_shndx == parameters->target().large_common_shndx());
+ return (shndx == elfcpp::SHN_COMMON
+ || shndx == parameters->target().small_common_shndx()
+ || shndx == parameters->target().large_common_shndx());
}
// Allocate a common symbol.
template<int size>
void
-Sized_symbol<size>::allocate_common(Output_data* od, Value_type avalue)
+Sized_symbol<size>::allocate_common(Output_data* od, Value_type value)
{
this->allocate_base_common(od);
- this->value_ = avalue;
+ this->value_ = value;
}
// 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 sec_shndx = this->shndx(&is_ordinary);
- if (is_ordinary && sec_shndx != elfcpp::SHN_UNDEF
- && !relobj->is_section_included(sec_shndx))
+ unsigned int shndx = this->shndx(&is_ordinary);
+ if (is_ordinary && shndx != elfcpp::SHN_UNDEF
+ && !relobj->is_section_included(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* ademangled_name = cplus_demangle(this->name(),
- DMGL_ANSI | DMGL_PARAMS);
- if (ademangled_name == NULL)
+ char* demangled_name = cplus_demangle(this->name(),
+ DMGL_ANSI | DMGL_PARAMS);
+ if (demangled_name == NULL)
{
// Not a C++ symbol, so it can't satisfy these flags
}
else if (parameters->options().dynamic_list_cpp_new()
- && (strprefix(ademangled_name, "operator new")
- || strprefix(ademangled_name, "operator delete")))
+ && (strprefix(demangled_name, "operator new")
+ || strprefix(demangled_name, "operator delete")))
{
- free(ademangled_name);
+ free(demangled_name);
return true;
}
else if (parameters->options().dynamic_list_cpp_typeinfo()
- && (strprefix(ademangled_name, "typeinfo name for")
- || strprefix(ademangled_name, "typeinfo for")))
+ && (strprefix(demangled_name, "typeinfo name for")
+ || strprefix(demangled_name, "typeinfo for")))
{
- free(ademangled_name);
+ free(demangled_name);
return true;
}
else
- free(ademangled_name);
+ free(demangled_name);
}
// If exporting all symbols or building a shared library,
{
case FROM_OBJECT:
{
- unsigned int sec_shndx = this->u_.from_object.shndx;
- if (sec_shndx != elfcpp::SHN_UNDEF && this->is_ordinary_shndx_)
+ unsigned int shndx = this->u_.from_object.shndx;
+ if (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(sec_shndx);
+ return relobj->output_section(shndx);
}
return NULL;
}
// Class Symbol_table.
Symbol_table::Symbol_table(unsigned int count,
- const Version_script_info& aversion_script)
+ const Version_script_info& version_script)
: saw_undefined_(0), offset_(0), table_(count), namepool_(),
forwarders_(), commons_(), tls_commons_(), small_commons_(),
large_commons_(), forced_locals_(), warnings_(),
- version_script_(aversion_script), gc_(NULL), icf_(NULL)
+ version_script_(version_script), gc_(NULL), icf_(NULL)
{
namepool_.reserve(count);
}
}
bool
-Symbol_table::is_section_folded(Object* obj, unsigned int sec_shndx) const
+Symbol_table::is_section_folded(Object* obj, unsigned int shndx) const
{
return (parameters->options().icf_enabled()
- && this->icf_->is_section_folded(obj, sec_shndx));
+ && this->icf_->is_section_folded(obj, shndx));
}
// For symbols that have been listed with -u option, add them to the
p != parameters->options().undefined_end();
++p)
{
- const char* aname = p->c_str();
- Symbol* sym = this->lookup(aname);
+ const char* name = p->c_str();
+ Symbol* sym = this->lookup(name);
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 sec_shndx = sym->shndx(&is_ordinary);
+ unsigned int shndx = sym->shndx(&is_ordinary);
if (is_ordinary)
{
gold_assert(this->gc_ != NULL);
- this->gc_->worklist().push(Section_id(obj, sec_shndx));
+ this->gc_->worklist().push(Section_id(obj, shndx));
}
}
}
//Add the object and section to the work list.
Relobj* obj = static_cast<Relobj*>(sym->object());
bool is_ordinary;
- unsigned int sec_shndx = sym->shndx(&is_ordinary);
- if (is_ordinary && sec_shndx != elfcpp::SHN_UNDEF)
+ unsigned int shndx = sym->shndx(&is_ordinary);
+ if (is_ordinary && shndx != elfcpp::SHN_UNDEF)
{
gold_assert(this->gc_!= NULL);
- this->gc_->worklist().push(Section_id(obj, sec_shndx));
+ this->gc_->worklist().push(Section_id(obj, shndx));
}
}
}
{
Relobj *obj = static_cast<Relobj*>(sym->object());
bool is_ordinary;
- unsigned int sec_shndx = sym->shndx(&is_ordinary);
- if (is_ordinary && sec_shndx != elfcpp::SHN_UNDEF)
+ unsigned int shndx = sym->shndx(&is_ordinary);
+ if (is_ordinary && shndx != elfcpp::SHN_UNDEF)
{
gold_assert(this->gc_ != NULL);
- this->gc_->worklist().push(Section_id(obj, sec_shndx));
+ this->gc_->worklist().push(Section_id(obj, shndx));
}
}
}
// Look up a symbol by name.
Symbol*
-Symbol_table::lookup(const char* aname, const char* aversion) const
+Symbol_table::lookup(const char* name, const char* version) const
{
Stringpool::Key name_key;
- aname = this->namepool_.find(aname, &name_key);
- if (aname == NULL)
+ name = this->namepool_.find(name, &name_key);
+ if (name == NULL)
return NULL;
Stringpool::Key version_key = 0;
- if (aversion != NULL)
+ if (version != NULL)
{
- aversion = this->namepool_.find(aversion, &version_key);
- if (aversion == NULL)
+ version = this->namepool_.find(version, &version_key);
+ if (version == NULL)
return NULL;
}
esym.put_st_info(from->binding(), from->type());
esym.put_st_other(from->visibility(), from->nonvis());
bool is_ordinary;
- unsigned int sec_shndx = from->shndx(&is_ordinary);
- this->resolve(to, esym.sym(), sec_shndx, is_ordinary, sec_shndx, from->object(),
+ unsigned int shndx = from->shndx(&is_ordinary);
+ this->resolve(to, esym.sym(), shndx, is_ordinary, shndx, from->object(),
from->version());
if (from->in_reg())
to->set_in_reg();
// option was used.
const char*
-Symbol_table::wrap_symbol(const char* aname, Stringpool::Key* name_key)
+Symbol_table::wrap_symbol(const char* name, 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 (aname[0] == parameters->target().wrap_char())
+ if (name[0] == parameters->target().wrap_char())
{
- prefix = aname[0];
- ++aname;
+ prefix = name[0];
+ ++name;
}
- if (parameters->options().is_wrap(aname))
+ if (parameters->options().is_wrap(name))
{
// Turn NAME into __wrap_NAME.
std::string s;
if (prefix != '\0')
s += prefix;
s += "__wrap_";
- s += aname;
+ s += name;
// 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(aname, real_prefix, real_prefix_length) == 0
- && parameters->options().is_wrap(aname + real_prefix_length))
+ if (strncmp(name, real_prefix, real_prefix_length) == 0
+ && parameters->options().is_wrap(name + real_prefix_length))
{
// Turn __real_NAME into NAME.
std::string s;
if (prefix != '\0')
s += prefix;
- s += aname + real_prefix_length;
+ s += name + real_prefix_length;
return this->namepool_.add(s.c_str(), true, name_key);
}
- return aname;
+ return name;
}
// 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* aobject,
- const char *aname,
+Symbol_table::add_from_object(Object* object,
+ const char *name,
Stringpool::Key name_key,
- const char *aversion,
+ const char *version,
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(aname))
+ if (parameters->options().is_trace_symbol(name))
{
if (orig_st_shndx == elfcpp::SHN_UNDEF)
- gold_info(_("%s: reference to %s"), aobject->name().c_str(), aname);
+ gold_info(_("%s: reference to %s"), object->name().c_str(), name);
else
- gold_info(_("%s: definition of %s"), aobject->name().c_str(), aname);
+ gold_info(_("%s: definition of %s"), object->name().c_str(), name);
}
// 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(aname, &name_key);
- if (wrap_name != aname)
+ const char* wrap_name = this->wrap_symbol(name, &name_key);
+ if (wrap_name != name)
{
// 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.
- aversion = NULL;
+ version = NULL;
version_key = 0;
- aname = wrap_name;
+ name = wrap_name;
}
}
was_undefined = ret->is_undefined();
was_common = ret->is_common();
- this->resolve(ret, sym, st_shndx, is_ordinary, orig_st_shndx, aobject,
- aversion);
+ this->resolve(ret, sym, st_shndx, is_ordinary, orig_st_shndx, object,
+ version);
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, aobject,
- aversion);
+ this->resolve(ret, sym, st_shndx, is_ordinary, orig_st_shndx, object,
+ version);
if (parameters->options().gc_sections())
this->gc_mark_dyn_syms(ret);
ins.first->second = ret;
}
}
- ret->init_object(aname, aversion, aobject, sym, st_shndx, is_ordinary);
+ ret->init_object(name, version, object, sym, st_shndx, is_ordinary);
ins.first->second = ret;
if (def)
continue;
}
- const char* aname = sym_names + st_name;
+ const char* name = 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(aname, '@');
+ const char* ver = strchr(name, '@');
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 - aname;
+ namelen = ver - name;
++ver;
if (*ver == '@')
{
// about a common symbol?
else
{
- namelen = strlen(aname);
+ namelen = strlen(name);
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 aversion;
- if (this->version_script_.get_symbol_version(aname, &aversion))
+ std::string version;
+ if (this->version_script_.get_symbol_version(name, &version))
{
// The version can be empty if the version script is
// only used to force some symbols to be local.
- if (!aversion.empty())
+ if (!version.empty())
{
- ver = this->namepool_.add_with_length(aversion.c_str(),
- aversion.length(),
+ ver = this->namepool_.add_with_length(version.c_str(),
+ version.length(),
true,
&ver_key);
def = true;
}
}
- else if (this->version_script_.symbol_is_local(aname))
+ else if (this->version_script_.symbol_is_local(name))
local = true;
}
}
}
Stringpool::Key name_key;
- aname = this->namepool_.add_with_length(aname, namelen, true,
+ name = this->namepool_.add_with_length(name, namelen, true,
&name_key);
Sized_symbol<size>* res;
- res = this->add_from_object(relobj, aname, name_key, ver, ver_key,
+ res = this->add_from_object(relobj, name, 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* aname,
+ const char* name,
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 aversion;
- if (this->version_script_.get_symbol_version(aname, &aversion))
+ std::string version;
+ if (this->version_script_.get_symbol_version(name, &version))
{
// The version can be empty if the version script is
// only used to force some symbols to be local.
- if (!aversion.empty())
+ if (!version.empty())
{
- ver = this->namepool_.add_with_length(aversion.c_str(),
- aversion.length(),
+ ver = this->namepool_.add_with_length(version.c_str(),
+ version.length(),
true,
&ver_key);
def = true;
}
}
- else if (this->version_script_.symbol_is_local(aname))
+ else if (this->version_script_.symbol_is_local(name))
local = true;
}
}
Stringpool::Key name_key;
- aname = this->namepool_.add(aname, true, &name_key);
+ name = this->namepool_.add(name, true, &name_key);
Sized_symbol<size>* res;
- res = this->add_from_object(obj, aname, name_key, ver, ver_key,
+ res = this->add_from_object(obj, name, name_key, ver, ver_key,
def, *sym, st_shndx, is_ordinary, st_shndx);
if (local)
continue;
}
- const char* aname = sym_names + st_name;
+ const char* name = 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;
- aname = this->namepool_.add(aname, true, &name_key);
- res = this->add_from_object(dynobj, aname, name_key, NULL, 0,
+ name = this->namepool_.add(name, true, &name_key);
+ res = this->add_from_object(dynobj, name, 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;
- aname = this->namepool_.add(aname, true, &name_key);
+ name = this->namepool_.add(name, 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, aname, name_key, NULL, 0,
+ res = this->add_from_object(dynobj, name, name_key, NULL, 0,
false, *psym, st_shndx, is_ordinary,
st_shndx);
}
continue;
}
- const char* aversion = (*version_map)[v];
- if (aversion == NULL)
+ const char* version = (*version_map)[v];
+ if (version == NULL)
{
dynobj->error(_("versym for symbol %zu has no name: %u"),
i, v);
}
Stringpool::Key version_key;
- aversion = this->namepool_.add(aversion, true, &version_key);
+ version = this->namepool_.add(version, 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, aname, name_key, NULL, 0,
+ res = this->add_from_object(dynobj, name, 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, aname, name_key, aversion,
+ res = this->add_from_object(dynobj, name, name_key, version,
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* aname,
- const char* aversion,
+Symbol_table::define_in_output_data(const char* name,
+ const char* version,
Output_data* od,
- uint64_t avalue,
- uint64_t sym_size,
+ uint64_t value,
+ uint64_t symsize,
elfcpp::STT type,
elfcpp::STB binding,
elfcpp::STV visibility,
unsigned char nonvis,
- bool offset_is_from_the_end,
+ bool offset_is_from_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>(aname, aversion, od,
- avalue, sym_size, type, binding,
+ return this->do_define_in_output_data<32>(name, version, od,
+ value, symsize, type, binding,
visibility, nonvis,
- offset_is_from_the_end,
+ offset_is_from_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>(aname, aversion, od,
- avalue, sym_size, type, binding,
+ return this->do_define_in_output_data<64>(name, version, od,
+ value, symsize, type, binding,
visibility, nonvis,
- offset_is_from_the_end,
+ offset_is_from_end,
only_if_ref);
#else
gold_unreachable();
template<int size>
Sized_symbol<size>*
Symbol_table::do_define_in_output_data(
- const char* aname,
- const char* aversion,
+ const char* name,
+ const char* version,
Output_data* od,
- typename elfcpp::Elf_types<size>::Elf_Addr avalue,
- typename elfcpp::Elf_types<size>::Elf_WXword sym_size,
+ typename elfcpp::Elf_types<size>::Elf_Addr value,
+ typename elfcpp::Elf_types<size>::Elf_WXword symsize,
elfcpp::STT type,
elfcpp::STB binding,
elfcpp::STV visibility,
unsigned char nonvis,
- bool offset_is_from_the_end,
+ bool offset_is_from_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>(&aname, &aversion,
+ sym = this->define_special_symbol<size, true>(&name, &version,
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>(&aname, &aversion,
+ sym = this->define_special_symbol<size, false>(&name, &version,
only_if_ref, &oldsym,
&resolve_oldsym);
#else
if (sym == NULL)
return NULL;
- sym->init_output_data(aname, aversion, od, avalue, sym_size, type, binding,
- visibility, nonvis, offset_is_from_the_end);
+ sym->init_output_data(name, version, od, value, symsize, type, binding,
+ visibility, nonvis, offset_is_from_end);
if (oldsym == NULL)
{
if (binding == elfcpp::STB_LOCAL
- || this->version_script_.symbol_is_local(aname))
+ || this->version_script_.symbol_is_local(name))
this->force_local(sym);
- else if (aversion != NULL)
+ else if (version != NULL)
sym->set_is_default();
return sym;
}
// Define a symbol based on an Output_segment.
Symbol*
-Symbol_table::define_in_output_segment(const char* aname,
- const char* aversion, Output_segment* os,
- uint64_t avalue,
- uint64_t sym_size,
+Symbol_table::define_in_output_segment(const char* name,
+ const char* version, Output_segment* os,
+ uint64_t value,
+ uint64_t symsize,
elfcpp::STT type,
elfcpp::STB binding,
elfcpp::STV visibility,
unsigned char nonvis,
- Symbol::Segment_offset_base offsetbase,
+ Symbol::Segment_offset_base offset_base,
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>(aname, aversion, os,
- avalue, sym_size, type,
+ return this->do_define_in_output_segment<32>(name, version, os,
+ value, symsize, type,
binding, visibility, nonvis,
- offsetbase, only_if_ref);
+ offset_base, 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>(aname, aversion, os,
- avalue, sym_size, type,
+ return this->do_define_in_output_segment<64>(name, version, os,
+ value, symsize, type,
binding, visibility, nonvis,
- offsetbase, only_if_ref);
+ offset_base, only_if_ref);
#else
gold_unreachable();
#endif
template<int size>
Sized_symbol<size>*
Symbol_table::do_define_in_output_segment(
- const char* aname,
- const char* aversion,
+ const char* name,
+ const char* version,
Output_segment* os,
- typename elfcpp::Elf_types<size>::Elf_Addr avalue,
- typename elfcpp::Elf_types<size>::Elf_WXword sym_size,
+ typename elfcpp::Elf_types<size>::Elf_Addr value,
+ typename elfcpp::Elf_types<size>::Elf_WXword symsize,
elfcpp::STT type,
elfcpp::STB binding,
elfcpp::STV visibility,
unsigned char nonvis,
- Symbol::Segment_offset_base offsetbase,
+ Symbol::Segment_offset_base offset_base,
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>(&aname, &aversion,
+ sym = this->define_special_symbol<size, true>(&name, &version,
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>(&aname, &aversion,
+ sym = this->define_special_symbol<size, false>(&name, &version,
only_if_ref, &oldsym,
&resolve_oldsym);
#else
if (sym == NULL)
return NULL;
- sym->init_output_segment(aname, aversion, os, avalue, sym_size, type, binding,
- visibility, nonvis, offsetbase);
+ sym->init_output_segment(name, version, os, value, symsize, type, binding,
+ visibility, nonvis, offset_base);
if (oldsym == NULL)
{
if (binding == elfcpp::STB_LOCAL
- || this->version_script_.symbol_is_local(aname))
+ || this->version_script_.symbol_is_local(name))
this->force_local(sym);
- else if (aversion != NULL)
+ else if (version != NULL)
sym->set_is_default();
return sym;
}
// definition error if this symbol is already defined.
Symbol*
-Symbol_table::define_as_constant(const char* aname,
- const char* aversion,
- uint64_t avalue,
- uint64_t sym_size,
+Symbol_table::define_as_constant(const char* name,
+ const char* version,
+ uint64_t value,
+ uint64_t symsize,
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>(aname, aversion, avalue,
- sym_size, type, binding,
+ return this->do_define_as_constant<32>(name, version, value,
+ symsize, 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>(aname, aversion, avalue,
- sym_size, type, binding,
+ return this->do_define_as_constant<64>(name, version, value,
+ symsize, type, binding,
visibility, nonvis, only_if_ref,
force_override);
#else
template<int size>
Sized_symbol<size>*
Symbol_table::do_define_as_constant(
- const char* aname,
- const char* aversion,
- typename elfcpp::Elf_types<size>::Elf_Addr avalue,
- typename elfcpp::Elf_types<size>::Elf_WXword sym_size,
+ const char* name,
+ const char* version,
+ typename elfcpp::Elf_types<size>::Elf_Addr value,
+ typename elfcpp::Elf_types<size>::Elf_WXword symsize,
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>(&aname, &aversion,
+ sym = this->define_special_symbol<size, true>(&name, &version,
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>(&aname, &aversion,
+ sym = this->define_special_symbol<size, false>(&name, &version,
only_if_ref, &oldsym,
&resolve_oldsym);
#else
if (sym == NULL)
return NULL;
- sym->init_constant(aname, aversion, avalue, sym_size, type, binding, visibility,
+ sym->init_constant(name, version, value, symsize, 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 ((aversion == NULL
- || aname != aversion
- || avalue != 0)
+ if ((version == NULL
+ || name != version
+ || value != 0)
&& (binding == elfcpp::STB_LOCAL
- || this->version_script_.symbol_is_local(aname)))
+ || this->version_script_.symbol_is_local(name)))
this->force_local(sym);
- else if (aversion != NULL
- && (aname != aversion || avalue != 0))
+ else if (version != NULL
+ && (name != version || value != 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 avalue)
+ typename elfcpp::Elf_types<size>::Elf_Addr value)
{
gold_assert(csym->is_from_dynobj());
gold_assert(!csym->is_copied_from_dynobj());
- Object* aobject = csym->object();
- gold_assert(aobject->is_dynamic());
- Dynobj* dynobj = static_cast<Dynobj*>(aobject);
+ Object* object = csym->object();
+ gold_assert(object->is_dynamic());
+ Dynobj* dynobj = static_cast<Dynobj*>(object);
// 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, avalue, csym->symsize(),
+ posd, value, csym->symsize(),
csym->type(), binding,
csym->visibility(), csym->nonvis(),
false, false);
p != parameters->options().undefined_end();
++p)
{
- const char* aname = p->c_str();
+ const char* name = p->c_str();
- if (this->lookup(aname) != NULL)
+ if (this->lookup(name) != NULL)
continue;
- const char* aversion = NULL;
+ const char* version = 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>(&aname, &aversion,
+ sym = this->define_special_symbol<size, true>(&name, &version,
false, &oldsym,
&resolve_oldsym);
#else
else
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
- sym = this->define_special_symbol<size, false>(&aname, &aversion,
+ sym = this->define_special_symbol<size, false>(&name, &version,
false, &oldsym,
&resolve_oldsym);
#else
gold_assert(oldsym == NULL);
- sym->init_undefined(aname, aversion, elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL,
+ sym->init_undefined(name, version, 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 avalue;
+ Value_type value;
switch (sym->source())
{
case Symbol::FROM_OBJECT:
{
bool is_ordinary;
- unsigned int sec_shndx = sym->shndx(&is_ordinary);
+ unsigned int shndx = sym->shndx(&is_ordinary);
if (!is_ordinary
- && sec_shndx != elfcpp::SHN_ABS
- && !Symbol::is_common_shndx(sec_shndx))
+ && shndx != elfcpp::SHN_ABS
+ && !Symbol::is_common_shndx(shndx))
{
*pstatus = CFVS_UNSUPPORTED_SYMBOL_SECTION;
return 0;
Object* symobj = sym->object();
if (symobj->is_dynamic())
{
- avalue = 0;
- sec_shndx = elfcpp::SHN_UNDEF;
+ value = 0;
+ shndx = elfcpp::SHN_UNDEF;
}
else if (symobj->pluginobj() != NULL)
{
- avalue = 0;
- sec_shndx = elfcpp::SHN_UNDEF;
+ value = 0;
+ shndx = elfcpp::SHN_UNDEF;
}
- else if (sec_shndx == elfcpp::SHN_UNDEF)
- avalue = 0;
+ else if (shndx == elfcpp::SHN_UNDEF)
+ value = 0;
else if (!is_ordinary
- && (sec_shndx == elfcpp::SHN_ABS
- || Symbol::is_common_shndx(sec_shndx)))
- avalue = sym->value();
+ && (shndx == elfcpp::SHN_ABS
+ || Symbol::is_common_shndx(shndx)))
+ value = sym->value();
else
{
Relobj* relobj = static_cast<Relobj*>(symobj);
- Output_section* os = relobj->output_section(sec_shndx);
- uint64_t secoff64 = relobj->output_section_offset(sec_shndx);
+ Output_section* os = relobj->output_section(shndx);
+ uint64_t secoff64 = relobj->output_section_offset(shndx);
- if (this->is_section_folded(relobj, sec_shndx))
+ if (this->is_section_folded(relobj, shndx))
{
gold_assert(os == NULL);
// Get the os of the section it is folded onto.
Section_id folded = this->icf_->get_folded_section(relobj,
- sec_shndx);
+ 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).
- avalue = os->output_address(relobj, sec_shndx, sym->value());
+ value = os->output_address(relobj, shndx, sym->value());
}
else
{
Value_type secoff =
convert_types<Value_type, uint64_t>(secoff64);
if (sym->type() == elfcpp::STT_TLS)
- avalue = sym->value() + os->tls_offset() + secoff;
+ value = sym->value() + os->tls_offset() + secoff;
else
- avalue = sym->value() + os->address() + secoff;
+ value = sym->value() + os->address() + secoff;
}
}
}
case Symbol::IN_OUTPUT_DATA:
{
Output_data* od = sym->output_data();
- avalue = sym->value();
+ value = sym->value();
if (sym->type() != elfcpp::STT_TLS)
- avalue += od->address();
+ value += od->address();
else
{
Output_section* os = od->output_section();
gold_assert(os != NULL);
- avalue += os->tls_offset() + (od->address() - os->address());
+ value += os->tls_offset() + (od->address() - os->address());
}
if (sym->offset_is_from_end())
- avalue += od->data_size();
+ value += od->data_size();
}
break;
case Symbol::IN_OUTPUT_SEGMENT:
{
Output_segment* os = sym->output_segment();
- avalue = sym->value();
+ value = sym->value();
if (sym->type() != elfcpp::STT_TLS)
- avalue += os->vaddr();
+ value += os->vaddr();
switch (sym->offset_base())
{
case Symbol::SEGMENT_START:
break;
case Symbol::SEGMENT_END:
- avalue += os->memsz();
+ value += os->memsz();
break;
case Symbol::SEGMENT_BSS:
- avalue += os->filesz();
+ value += os->filesz();
break;
default:
gold_unreachable();
break;
case Symbol::IS_CONSTANT:
- avalue = sym->value();
+ value = sym->value();
break;
case Symbol::IS_UNDEFINED:
- avalue = 0;
+ value = 0;
break;
default:
}
*pstatus = CFVS_OK;
- return avalue;
+ return value;
}
// Finalize the symbol SYM. This returns true if the symbol should be
// Compute final symbol value.
Compute_final_value_status status;
- Value_type avalue = this->compute_final_value(sym, &status);
+ Value_type value = this->compute_final_value(sym, &status);
switch (status)
{
case CFVS_UNSUPPORTED_SYMBOL_SECTION:
{
bool is_ordinary;
- unsigned int sec_shndx = sym->shndx(&is_ordinary);
+ unsigned int shndx = sym->shndx(&is_ordinary);
gold_error(_("%s: unsupported symbol section 0x%x"),
- sym->demangled_name().c_str(), sec_shndx);
+ sym->demangled_name().c_str(), shndx);
}
break;
case CFVS_NO_OUTPUT_SECTION:
gold_unreachable();
}
- sym->set_value(avalue);
+ sym->set_value(value);
if (parameters->options().strip_all()
|| !parameters->options().should_retain_symbol(sym->name()))
continue;
}
- unsigned int sec_shndx;
+ unsigned int 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);
- sec_shndx = in_shndx;
+ shndx = in_shndx;
}
else
{
{
if (sym->needs_dynsym_value())
dynsym_value = target.dynsym_value(sym);
- sec_shndx = elfcpp::SHN_UNDEF;
+ shndx = elfcpp::SHN_UNDEF;
}
else if (symobj->pluginobj() != NULL)
- sec_shndx = elfcpp::SHN_UNDEF;
+ shndx = elfcpp::SHN_UNDEF;
else if (in_shndx == elfcpp::SHN_UNDEF
|| (!is_ordinary
&& (in_shndx == elfcpp::SHN_ABS
|| Symbol::is_common_shndx(in_shndx))))
- sec_shndx = in_shndx;
+ shndx = in_shndx;
else
{
Relobj* relobj = static_cast<Relobj*>(symobj);
gold_assert(os != NULL);
}
gold_assert(os != NULL);
- sec_shndx = os->out_shndx();
+ shndx = os->out_shndx();
- if (sec_shndx >= elfcpp::SHN_LORESERVE)
+ if (shndx >= elfcpp::SHN_LORESERVE)
{
if (sym_index != -1U)
- symtab_xindex->add(sym_index, sec_shndx);
+ symtab_xindex->add(sym_index, shndx);
if (dynsym_index != -1U)
- dynsym_xindex->add(dynsym_index, sec_shndx);
- sec_shndx = elfcpp::SHN_XINDEX;
+ dynsym_xindex->add(dynsym_index, shndx);
+ shndx = elfcpp::SHN_XINDEX;
}
// In object files symbol values are section
break;
case Symbol::IN_OUTPUT_DATA:
- sec_shndx = sym->output_data()->out_shndx();
- if (sec_shndx >= elfcpp::SHN_LORESERVE)
+ shndx = sym->output_data()->out_shndx();
+ if (shndx >= elfcpp::SHN_LORESERVE)
{
if (sym_index != -1U)
- symtab_xindex->add(sym_index, sec_shndx);
+ symtab_xindex->add(sym_index, shndx);
if (dynsym_index != -1U)
- dynsym_xindex->add(dynsym_index, sec_shndx);
- sec_shndx = elfcpp::SHN_XINDEX;
+ dynsym_xindex->add(dynsym_index, shndx);
+ shndx = elfcpp::SHN_XINDEX;
}
break;
case Symbol::IN_OUTPUT_SEGMENT:
- sec_shndx = elfcpp::SHN_ABS;
+ shndx = elfcpp::SHN_ABS;
break;
case Symbol::IS_CONSTANT:
- sec_shndx = elfcpp::SHN_ABS;
+ shndx = elfcpp::SHN_ABS;
break;
case Symbol::IS_UNDEFINED:
- sec_shndx = elfcpp::SHN_UNDEF;
+ 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, sec_shndx,
+ this->sized_write_symbol<size, big_endian>(sym, sym_value, 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, sec_shndx,
+ this->sized_write_symbol<size, big_endian>(sym, dynsym_value, shndx,
dynpool, pd);
}
}
void
Symbol_table::sized_write_symbol(
Sized_symbol<size>* sym,
- typename elfcpp::Elf_types<size>::Elf_Addr avalue,
- unsigned int sec_shndx,
+ typename elfcpp::Elf_types<size>::Elf_Addr value,
+ unsigned int 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(avalue);
+ osym.put_st_value(value);
// Use a symbol size of zero for undefined symbols from shared libraries.
- if (sec_shndx == elfcpp::SHN_UNDEF && sym->is_from_dynobj())
+ if (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(sec_shndx);
+ osym.put_st_shndx(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 sec_shndx = os->out_shndx();
- if (sec_shndx >= elfcpp::SHN_LORESERVE)
+ unsigned int shndx = os->out_shndx();
+ if (shndx >= elfcpp::SHN_LORESERVE)
{
- symtab_xindex->add(os->symtab_index(), sec_shndx);
- sec_shndx = elfcpp::SHN_XINDEX;
+ symtab_xindex->add(os->symtab_index(), shndx);
+ shndx = elfcpp::SHN_XINDEX;
}
- osym.put_st_shndx(sec_shndx);
+ osym.put_st_shndx(shndx);
of->write_output_view(offset, sym_size, pov);
}
// Add a new warning.
void
-Warnings::add_warning(Symbol_table* symtab, const char* aname, Object* obj,
+Warnings::add_warning(Symbol_table* symtab, const char* name, Object* obj,
const std::string& warning)
{
- aname = symtab->canonicalize_name(aname);
- this->warnings_[aname].set(obj, warning);
+ name = symtab->canonicalize_name(name);
+ this->warnings_[name].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 avalue);
+ elfcpp::Elf_types<32>::Elf_Addr value);
#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 avalue);
+ elfcpp::Elf_types<64>::Elf_Addr value);
#endif
#ifdef HAVE_TARGET_32_LITTLE
// Set the visibility.
void
- set_visibility(elfcpp::STV vis)
- { this->visibility_ = vis; }
+ set_visibility(elfcpp::STV visibility)
+ { this->visibility_ = visibility; }
// Override symbol visibility.
void
unsigned int
got_offset(unsigned int got_type) const
{
- unsigned int got_off = this->got_offsets_.get_offset(got_type);
- gold_assert(got_off != -1U);
- return got_off;
+ unsigned int got_offset = this->got_offsets_.get_offset(got_type);
+ gold_assert(got_offset != -1U);
+ return got_offset;
}
// Set the GOT offset of this symbol.
void
- set_got_offset(unsigned int got_type, unsigned int got_off)
- { this->got_offsets_.set_offset(got_type, got_off); }
+ set_got_offset(unsigned int got_type, unsigned int got_offset)
+ { this->got_offsets_.set_offset(got_type, got_offset); }
// 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_off)
+ set_plt_offset(unsigned int plt_offset)
{
this->has_plt_offset_ = true;
- this->plt_offset_ = plt_off;
+ this->plt_offset_ = plt_offset;
}
// 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 sec_shndx = this->shndx(&is_ordinary);
+ unsigned int shndx = this->shndx(&is_ordinary);
return (is_ordinary
- ? sec_shndx != elfcpp::SHN_UNDEF
- : !Symbol::is_common_shndx(sec_shndx));
+ ? shndx != elfcpp::SHN_UNDEF
+ : !Symbol::is_common_shndx(shndx));
}
// Return true if this symbol is from a dynamic object.
if (this->source_ != FROM_OBJECT)
return false;
bool is_ordinary;
- unsigned int sec_shndx = this->shndx(&is_ordinary);
- return !is_ordinary && Symbol::is_common_shndx(sec_shndx);
+ unsigned int shndx = this->shndx(&is_ordinary);
+ return !is_ordinary && Symbol::is_common_shndx(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 symsz)
- { this->symsize_ = symsz; }
+ set_symsize(Size_type symsize)
+ { this->symsize_ = symsize; }
// 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 val)
- { this->value_ = val; }
+ set_value(Value_type value)
+ { this->value_ = value; }
// 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* garbage)
- { this->gc_ = garbage; }
+ set_gc(Garbage_collection* gc)
+ { this->gc_ = gc; }
Garbage_collection*
gc() const
// target-select.cc -- select a target for an object file
-// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008 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 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),
+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),
initialize_lock_(&this->lock_)
{
// target-select.h -- select a target for an object file -*- C++ -*-
-// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008 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 mach, int osabi, int abiversion)
- { return this->do_recognize(mach, osabi, abiversion); }
+ recognize(int machine, int osabi, int abiversion)
+ { return this->do_recognize(machine, osabi, abiversion); }
// If NAME matches the target, return a pointer to a target
// structure.
#define safe_lock(muptr) \
do \
{ \
- int pthread_err = pthread_mutex_lock(muptr); \
- assert(pthread_err == 0); \
+ int err = pthread_mutex_lock(muptr); \
+ assert(err == 0); \
} \
while (0)
#define safe_unlock(muptr) \
do \
{ \
- int pthread_err = pthread_mutex_unlock(muptr); \
- assert(pthread_err == 0); \
+ int err = pthread_mutex_unlock(muptr); \
+ assert(err == 0); \
} \
while (0)
class Task_token
{
public:
- Task_token(bool tis_blocker)
- : is_blocker_(tis_blocker), blockers_(0), writer_(NULL), waiting_()
+ Task_token(bool is_blocker)
+ : is_blocker_(is_blocker), blockers_(0), writer_(NULL), waiting_()
{ }
~Task_token()
// workqueue.cc -- the workqueue for gold
-// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008 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* que, Task* t, bool front)
+Workqueue::add_to_queue(Task_list* queue, Task* t, bool front)
{
Hold_lock hl(this->lock_);
else
{
if (front)
- que->push_front(t);
+ queue->push_front(t);
else
- que->push_back(t);
+ queue->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* tok;
- while ((tok = token->remove_first_waiting()) != NULL)
+ Task* t;
+ while ((t = token->remove_first_waiting()) != NULL)
{
--this->waiting_;
- this->return_or_queue(tok, true, &ret);
+ this->return_or_queue(t, 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* tok;
- while ((tok = token->remove_first_waiting()) != NULL)
+ Task* t;
+ while ((t = token->remove_first_waiting()) != NULL)
{
--this->waiting_;
- if (this->return_or_queue(tok, false, &ret))
+ if (this->return_or_queue(t, 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* tname)
- : runner_(runner), blocker_(blocker), name_(tname)
+ const char* name)
+ : runner_(runner), blocker_(blocker), name_(name)
{ }
~Task_function()
void
Output_data_plt_x86_64::do_write(Output_file* of)
{
- const off_t off = this->offset();
+ const off_t offset = this->offset();
const section_size_type oview_size =
convert_to_section_size_type(this->data_size());
- unsigned char* const oview = of->get_output_view(off, oview_size);
+ unsigned char* const oview = of->get_output_view(offset, 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(off, oview_size, oview);
+ of->write_output_view(offset, oview_size, oview);
of->write_output_view(got_file_offset, got_size, got_view);
}