From 2ea97941102380c28117882600265c1187c6fc8b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 14 Dec 2009 19:53:05 +0000 Subject: Revert -Wshadow changes, all changes from: 2009-12-11 Doug Kwan 2009-12-11 Nick Clifton * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS. --- gold/ChangeLog | 7 + gold/archive.cc | 60 ++-- gold/arm.cc | 515 ++++++++++++++++---------------- gold/attributes.cc | 25 +- gold/attributes.h | 4 +- gold/compressed_output.cc | 14 +- gold/compressed_output.h | 8 +- gold/configure | 2 +- gold/configure.ac | 2 +- gold/dwarf_reader.cc | 11 +- gold/dynobj.cc | 70 ++--- gold/dynobj.h | 24 +- gold/ehframe.cc | 58 ++-- gold/ehframe.h | 6 +- gold/errors.cc | 6 +- gold/expression.cc | 14 +- gold/fileread.cc | 46 +-- gold/fileread.h | 12 +- gold/freebsd.h | 8 +- gold/i386.cc | 8 +- gold/icf.cc | 6 +- gold/incremental.h | 4 +- gold/layout.cc | 36 +-- gold/layout.h | 12 +- gold/mapfile.cc | 2 +- gold/merge.cc | 32 +- gold/merge.h | 26 +- gold/object.cc | 316 ++++++++++---------- gold/object.h | 54 ++-- gold/options.h | 40 +-- gold/output.cc | 464 ++++++++++++++--------------- gold/output.h | 298 +++++++++---------- gold/parameters.cc | 26 +- gold/plugin.cc | 42 +-- gold/powerpc.cc | 20 +- gold/reduced_debug_output.cc | 22 +- gold/reduced_debug_output.h | 14 +- gold/reloc.cc | 180 +++++------ gold/reloc.h | 6 +- gold/resolve.cc | 38 +-- gold/script-sections.cc | 64 ++-- gold/script.cc | 58 ++-- gold/script.h | 8 +- gold/sparc.cc | 132 ++++---- gold/symtab.cc | 644 ++++++++++++++++++++-------------------- gold/symtab.h | 44 +-- gold/target-select.cc | 10 +- gold/target-select.h | 6 +- gold/testsuite/tls_test_main.cc | 8 +- gold/token.h | 4 +- gold/workqueue.cc | 20 +- gold/workqueue.h | 4 +- gold/x86_64.cc | 6 +- 53 files changed, 1778 insertions(+), 1768 deletions(-) (limited to 'gold') diff --git a/gold/ChangeLog b/gold/ChangeLog index a4ed9e8..03e03ae 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,10 @@ +2009-12-14 Ian Lance Taylor + + Revert -Wshadow changes, all changes from: + 2009-12-11 Doug Kwan + 2009-12-11 Nick Clifton + * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS. + 2009-12-11 Doug Kwan * arm.cc (Target_arm::do_finalize_sections): Fix build breakage diff --git a/gold/archive.cc b/gold/archive.cc index 7c82ca0..569a491 100644 --- a/gold/archive.cc +++ b/gold/archive.cc @@ -83,15 +83,15 @@ const char Archive::armagt[sarmag] = 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 @@ -247,9 +247,9 @@ Archive::interpret_header(const Archive_header* hdr, off_t off, *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)) { @@ -285,11 +285,11 @@ Archive::interpret_header(const Archive_header* hdr, off_t off, 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(x) >= this->extended_names_.size()) @@ -299,16 +299,16 @@ Archive::interpret_header(const Archive_header* hdr, off_t off, 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(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(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(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; } @@ -452,14 +452,14 @@ Archive::end() // 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(sizeof(Archive_header)); if (!this->is_thin_archive_) @@ -492,18 +492,18 @@ Archive::get_file_and_offset(off_t off, Input_file** in_file, off_t* memoff, 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 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); } @@ -513,13 +513,13 @@ Archive::get_file_and_offset(off_t off, Input_file** in_file, off_t* memoff, 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; } @@ -532,17 +532,17 @@ Archive::get_elf_object_for_member(off_t off, bool* punconfigured) { *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) @@ -555,7 +555,7 @@ Archive::get_elf_object_for_member(off_t off, bool* punconfigured) 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(off)); @@ -564,7 +564,7 @@ Archive::get_elf_object_for_member(off_t off, bool* punconfigured) 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; diff --git a/gold/arm.cc b/gold/arm.cc index 5faaf3c..03cc697 100644 --- a/gold/arm.cc +++ b/gold/arm.cc @@ -210,8 +210,8 @@ class Insn_template // 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 @@ -373,8 +373,8 @@ class Stub static_cast(-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 @@ -396,8 +396,8 @@ class Stub // 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. @@ -475,20 +475,20 @@ class Reloc_stub : public Stub // 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; } } @@ -585,8 +585,8 @@ class Reloc_stub : public Stub 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() @@ -660,8 +660,8 @@ template class Stub_table : public Output_data { public: - Stub_table(Arm_input_section* own) - : Output_data(), addralign_(1), owner_(own), has_been_changed_(false), + Stub_table(Arm_input_section* owner) + : Output_data(), addralign_(1), owner_(owner), has_been_changed_(false), reloc_stubs_() { } @@ -755,8 +755,8 @@ template 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) { } @@ -779,8 +779,8 @@ class Arm_input_section : public Output_relaxed_input_section // Set the stub_table. void - set_stub_table(Stub_table* stubtable) - { this->stub_table_ = stubtable; } + set_stub_table(Stub_table* 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. @@ -814,17 +814,17 @@ class Arm_input_section : public Output_relaxed_input_section // 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(off) + && (shndx == this->shndx()) + && (offset >= 0) + && (convert_types(offset) <= this->original_size_)) { - *poutput = off; + *poutput = offset; return true; } else @@ -851,9 +851,9 @@ template 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() @@ -890,9 +890,9 @@ class Arm_relobj : public Sized_relobj<32, big_endian> public: static const Arm_address invalid_address = static_cast(-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) { } @@ -902,18 +902,18 @@ class Arm_relobj : public Sized_relobj<32, big_endian> // Return the stub table of the SHNDX-th section if there is one. Stub_table* - 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* stubtable) + set_stub_table(unsigned int shndx, Stub_table* 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 @@ -932,19 +932,19 @@ class Arm_relobj : public Sized_relobj<32, big_endian> // 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* - as_arm_relobj(Relobj* rel_obj) - { return static_cast*>(rel_obj); } + as_arm_relobj(Relobj* relobj) + { return static_cast*>(relobj); } // Processor-specific flags in ELF file header. This is valid only after // reading symbols. @@ -1004,10 +1004,10 @@ template 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() @@ -1347,7 +1347,7 @@ class Target_arm : public Sized_target<32, big_endian> // Find the Arm_input_section object corresponding to the SHNDX-th input // section of RELOBJ. Arm_input_section* - 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* @@ -1600,12 +1600,12 @@ class Target_arm : public Sized_target<32, 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)); } @@ -2369,15 +2369,15 @@ Arm_relocate_functions::arm_branch_common( (thumb_bit != 0)); if (stub_type != arm_stub_none) { - Stub_table* stubtable = + Stub_table* 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)); @@ -2516,15 +2516,15 @@ Arm_relocate_functions::thumb_branch_common( (thumb_bit != 0)); if (stub_type != arm_stub_none) { - Stub_table* stubtable = + Stub_table* 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; } } @@ -2677,21 +2677,21 @@ Insn_template::alignment() const // 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) @@ -2699,8 +2699,8 @@ Stub_template::Stub_template( 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; @@ -2708,22 +2708,22 @@ Stub_template::Stub_template( 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. @@ -2939,12 +2939,12 @@ void inline 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()) { @@ -3198,11 +3198,11 @@ Stub_table::add_reloc_stub( 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; } @@ -3211,14 +3211,14 @@ void Stub_table::relocate_stubs( const Relocate_info<32, big_endian>* relinfo, Target_arm* 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(this->data_size()))); @@ -3227,16 +3227,16 @@ Stub_table::relocate_stubs( ++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); } } @@ -3255,13 +3255,13 @@ Stub_table::do_reset_address_and_file_offset() ++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; @@ -3274,19 +3274,19 @@ template void Stub_table::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); @@ -3302,21 +3302,21 @@ template void Arm_input_section::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(); @@ -3346,15 +3346,15 @@ Arm_input_section::set_final_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()); @@ -3372,13 +3372,13 @@ Arm_input_section::do_reset_address_and_file_offset() // If this is a stub table owner, account for the stub table size. if (this->is_stub_table_owner()) { - Stub_table* stubtable = this->stub_table_; + Stub_table* 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); @@ -3420,10 +3420,10 @@ Arm_output_section::create_stub_group( } // Create a stub table. - Stub_table* stubtable = + Stub_table* 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; @@ -3437,7 +3437,7 @@ Arm_output_section::create_stub_group( // in their objects. Arm_relobj* arm_relobj = Arm_relobj::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++; } @@ -3489,7 +3489,7 @@ Arm_output_section::group_sections( 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(); @@ -3524,7 +3524,7 @@ Arm_output_section::group_sections( // 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; } } @@ -3536,7 +3536,7 @@ Arm_output_section::group_sections( 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; } @@ -3573,7 +3573,7 @@ Arm_output_section::group_sections( this->create_stub_group(group_begin, group_end, (state == FINDING_STUB_SECTION ? group_end - : stubtable), + : stub_table), target, &new_relaxed_sections); } @@ -3587,9 +3587,9 @@ Arm_output_section::group_sections( Arm_relobj* arm_relobj = Arm_relobj::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); } } @@ -3602,14 +3602,14 @@ void Arm_relobj::scan_sections_for_stubs( Target_arm* 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 @@ -3620,11 +3620,11 @@ Arm_relobj::scan_sections_for_stubs( 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); @@ -3738,15 +3738,15 @@ Arm_relobj::do_count_local_symbols( 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); @@ -3754,10 +3754,10 @@ Arm_relobj::do_count_local_symbols( // 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(); @@ -3781,12 +3781,12 @@ template void Arm_relobj::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. @@ -3794,17 +3794,17 @@ Arm_relobj::do_relocate_sections( return; // Relocate stub tables. - unsigned int sec_shnum = this->shnum(); + unsigned int shnum = this->shnum(); Target_arm* arm_target = Target_arm::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* arm_input_section = arm_target->find_arm_input_section(this, i); @@ -3827,18 +3827,18 @@ Arm_relobj::do_relocate_sections( // We are passed the output section view. Adjust it to cover the // stub table only. - Stub_table* stubtable = arm_input_section->stub_table(); - gold_assert((stubtable->address() >= (*pviews)[i].address) - && ((stubtable->address() + stubtable->data_size()) + Stub_table* 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); } } @@ -4043,13 +4043,13 @@ class Output_data_plt_arm : public Output_section_data // section just for PLT entries. template -Output_data_plt_arm::Output_data_plt_arm(Layout* alayout, +Output_data_plt_arm::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 @@ -4125,10 +4125,10 @@ template void Output_data_plt_arm::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 = @@ -4170,15 +4170,15 @@ Output_data_plt_arm::do_write(Output_file* of) 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. @@ -4188,7 +4188,7 @@ Output_data_plt_arm::do_write(Output_file* of) gold_assert(static_cast(pov - oview) == oview_size); gold_assert(static_cast(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); } @@ -4196,7 +4196,7 @@ Output_data_plt_arm::do_write(Output_file* of) template void -Target_arm::make_plt_entry(Symbol_table* symtab, Layout* alayout, +Target_arm::make_plt_entry(Symbol_table* symtab, Layout* layout, Symbol* gsym) { if (gsym->has_plt_offset()) @@ -4205,13 +4205,13 @@ Target_arm::make_plt_entry(Symbol_table* symtab, Layout* alayout, 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(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(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); } @@ -4281,7 +4281,7 @@ Target_arm::Scan::check_non_pic(Relobj* object, template inline void Target_arm::Scan::local(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Target_arm* target, Sized_relobj<32, big_endian>* object, unsigned int data_shndx, @@ -4306,7 +4306,7 @@ Target_arm::Scan::local(Symbol_table* symtab, // 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. @@ -4339,7 +4339,7 @@ Target_arm::Scan::local(Symbol_table* symtab, 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: @@ -4351,7 +4351,7 @@ Target_arm::Scan::local(Symbol_table* symtab, { // 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)) { @@ -4359,11 +4359,11 @@ Target_arm::Scan::local(Symbol_table* symtab, // 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)); } } } @@ -4408,7 +4408,7 @@ Target_arm::Scan::unsupported_reloc_global( template inline void Target_arm::Scan::global(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Target_arm* target, Sized_relobj<32, big_endian>* object, unsigned int data_shndx, @@ -4431,14 +4431,14 @@ Target_arm::Scan::global(Symbol_table* symtab, { 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()); @@ -4447,7 +4447,7 @@ Target_arm::Scan::global(Symbol_table* symtab, { // 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()); } @@ -4491,13 +4491,13 @@ Target_arm::Scan::global(Symbol_table* symtab, { 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()); } @@ -4511,7 +4511,7 @@ Target_arm::Scan::global(Symbol_table* symtab, case elfcpp::R_ARM_THM_CALL: if (Target_arm::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 @@ -4540,12 +4540,12 @@ Target_arm::Scan::global(Symbol_table* symtab, && !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: @@ -4557,14 +4557,14 @@ Target_arm::Scan::global(Symbol_table* symtab, { // 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()) @@ -4605,7 +4605,7 @@ Target_arm::Scan::global(Symbol_table* symtab, template void Target_arm::gc_process_relocs(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Sized_relobj<32, big_endian>* object, unsigned int data_shndx, unsigned int, @@ -4617,11 +4617,11 @@ Target_arm::gc_process_relocs(Symbol_table* symtab, const unsigned char* plocal_symbols) { typedef Target_arm Arm; - typedef typename Target_arm::Scan scan; + typedef typename Target_arm::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, @@ -4638,7 +4638,7 @@ Target_arm::gc_process_relocs(Symbol_table* symtab, template void Target_arm::scan_relocs(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Sized_relobj<32, big_endian>* object, unsigned int data_shndx, unsigned int sh_type, @@ -4649,7 +4649,7 @@ Target_arm::scan_relocs(Symbol_table* symtab, size_t local_symbol_count, const unsigned char* plocal_symbols) { - typedef typename Target_arm::Scan scan; + typedef typename Target_arm::Scan Scan; if (sh_type == elfcpp::SHT_RELA) { gold_error(_("%s: unsupported RELA reloc section"), @@ -4657,9 +4657,9 @@ Target_arm::scan_relocs(Symbol_table* symtab, 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, @@ -4676,7 +4676,7 @@ Target_arm::scan_relocs(Symbol_table* symtab, template void Target_arm::do_finalize_sections( - Layout* alayout, + Layout* layout, const Input_objects* input_objects, Symbol_table* symtab) { @@ -4715,7 +4715,7 @@ Target_arm::do_finalize_sections( 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 @@ -4752,10 +4752,10 @@ Target_arm::do_finalize_sections( // 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()) @@ -4772,22 +4772,23 @@ Target_arm::do_finalize_sections( // 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. @@ -5285,9 +5286,9 @@ Target_arm::relocate_section( + 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; } @@ -5376,7 +5377,7 @@ template void Target_arm::scan_relocatable_relocs( Symbol_table* symtab, - Layout* alayout, + Layout* layout, Sized_relobj<32, big_endian>* object, unsigned int data_shndx, unsigned int sh_type, @@ -5396,7 +5397,7 @@ Target_arm::scan_relocatable_relocs( gold::scan_relocatable_relocs<32, big_endian, elfcpp::SHT_REL, Scan_relocatable_relocs>( symtab, - alayout, + layout, object, data_shndx, prelocs, @@ -5575,20 +5576,20 @@ Object* Target_arm::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* obj = - new Arm_relobj(name, input_file, off, ehdr); + new Arm_relobj(name, input_file, offset, ehdr); obj->setup(); return obj; } else if (et == elfcpp::ET_DYN) { Sized_dynobj<32, big_endian>* obj = - new Arm_dynobj(name, input_file, off, ehdr); + new Arm_dynobj(name, input_file, offset, ehdr); obj->setup(); return obj; } @@ -6423,13 +6424,13 @@ Target_arm::reloc_uses_thumb_bit(unsigned int r_type) template Arm_input_section* Target_arm::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* arm_input_section = - new Arm_input_section(rel_obj, sec_shndx); + new Arm_input_section(relobj, shndx); arm_input_section->init(); // Register new Arm_input_section in map for look-up. @@ -6449,10 +6450,10 @@ Target_arm::new_arm_input_section( template Arm_input_section* Target_arm::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; @@ -6464,15 +6465,15 @@ template Stub_table* Target_arm::new_stub_table(Arm_input_section* owner) { - Stub_table* stubtable = + Stub_table* stub_table = new Stub_table(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. @@ -6488,7 +6489,7 @@ Target_arm::scan_reloc_for_stub( elfcpp::Elf_types<32>::Elf_Swxword addend, Arm_address address) { - typedef typename Target_arm::Relocate relocate; + typedef typename Target_arm::Relocate Relocate; const Arm_relobj* arm_relobj = Arm_relobj::as_arm_relobj(relinfo->object); @@ -6499,7 +6500,7 @@ Target_arm::scan_reloc_for_stub( { // 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() @@ -6570,20 +6571,20 @@ Target_arm::scan_reloc_for_stub( return; // Try looking up an existing stub from a stub table. - Stub_table* stubtable = + Stub_table* 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. @@ -6652,22 +6653,22 @@ Target_arm::scan_reloc_section_for_stubs( && (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 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; @@ -6684,11 +6685,11 @@ Target_arm::scan_reloc_section_for_stubs( // 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) { @@ -6700,7 +6701,7 @@ Target_arm::scan_reloc_section_for_stubs( { 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 @@ -6750,7 +6751,7 @@ Target_arm::scan_reloc_section_for_stubs( continue; this->scan_reloc_for_stub(relinfo, r_type, sym, r_sym, psymval, - addend, view_address + off); + addend, view_address + offset); } } @@ -6808,13 +6809,13 @@ Target_arm::scan_section_for_stubs( template void Target_arm::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) @@ -6834,7 +6835,7 @@ Target_arm::do_relax( 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()); @@ -6866,7 +6867,7 @@ Target_arm::do_relax( 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 @@ -6883,7 +6884,7 @@ Target_arm::do_relax( { Arm_relobj* arm_relobj = Arm_relobj::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; @@ -6911,14 +6912,14 @@ Target_arm::relocate_stub( 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); diff --git a/gold/attributes.cc b/gold/attributes.cc index 7d82979..6b2260d 100644 --- a/gold/attributes.cc +++ b/gold/attributes.cc @@ -45,12 +45,12 @@ Object_attribute::size(int tag) const 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/""). @@ -266,11 +266,11 @@ Attributes_section_data::size() const } // 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] = @@ -280,16 +280,16 @@ Attributes_section_data::Attributes_section_data( 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(p); section_size_type section_name_size = strlen(section_name) + 1; @@ -443,9 +443,10 @@ Attributes_section_data::write(std::vector* buffer) const 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 buffer; this->attributes_section_data_.write(&buffer); diff --git a/gold/attributes.h b/gold/attributes.h index dbfba84..7c4baf4 100644 --- a/gold/attributes.h +++ b/gold/attributes.h @@ -103,8 +103,8 @@ class Object_attribute // Set attribute type. void - set_type(int at) - { this->type_ = at; } + set_type(int type) + { this->type_ = type; } // Return integer value. unsigned int diff --git a/gold/compressed_output.cc b/gold/compressed_output.cc index 814bd25..a0f8ed1 100644 --- a/gold/compressed_output.cc +++ b/gold/compressed_output.cc @@ -1,6 +1,6 @@ // 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 . // This file is part of gold. @@ -137,14 +137,14 @@ Output_compressed_section::set_final_data_size() 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. diff --git a/gold/compressed_output.h b/gold/compressed_output.h index 86e3c01..11b2762 100644 --- a/gold/compressed_output.h +++ b/gold/compressed_output.h @@ -1,6 +1,6 @@ // 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 . // This file is part of gold. @@ -45,9 +45,9 @@ class Output_compressed_section : public Output_section { 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(); } diff --git a/gold/configure b/gold/configure index 3f67d29..30bd132 100755 --- a/gold/configure +++ b/gold/configure @@ -6331,7 +6331,7 @@ fi -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" diff --git a/gold/configure.ac b/gold/configure.ac index 4307732..2f9cc43 100644 --- a/gold/configure.ac +++ b/gold/configure.ac @@ -312,7 +312,7 @@ AC_SUBST(RANDOM_SEED_CFLAGS) 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 diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc index c8d29cd..4062fe6 100644 --- a/gold/dwarf_reader.cc +++ b/gold/dwarf_reader.cc @@ -294,7 +294,7 @@ Sized_dwarf_line_info::process_one_opcode( 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; } @@ -353,7 +353,7 @@ Sized_dwarf_line_info::process_one_opcode( 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; @@ -375,7 +375,7 @@ Sized_dwarf_line_info::process_one_opcode( { lsm->address = elfcpp::Swap_unaligned::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. @@ -420,16 +420,17 @@ Sized_dwarf_line_info::process_one_opcode( 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; } diff --git a/gold/dynobj.cc b/gold/dynobj.cc index 80d4a43..1b0dad9 100644 --- a/gold/dynobj.cc +++ b/gold/dynobj.cc @@ -39,8 +39,8 @@ namespace gold // 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) { @@ -67,11 +67,11 @@ Dynobj::Dynobj(const std::string& aname, Input_file* ainput_file, off_t aoffset) template Sized_dynobj::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& ehdr) - : Dynobj(aname, ainput_file, aoffset), + : Dynobj(name, input_file, offset), elf_file_(this, ehdr), dynsym_shndx_(-1U), symbols_(NULL), @@ -85,8 +85,8 @@ template void Sized_dynobj::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 @@ -108,9 +108,9 @@ Sized_dynobj::find_dynsym_sections( 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); @@ -180,13 +180,13 @@ Sized_dynobj::read_dynsym_section( 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; @@ -200,8 +200,8 @@ Sized_dynobj::read_dynsym_section( 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(); } @@ -424,8 +424,8 @@ Sized_dynobj::do_layout(Symbol_table* symtab, 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. @@ -437,7 +437,7 @@ Sized_dynobj::do_layout(Symbol_table* symtab, // 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); @@ -448,10 +448,10 @@ Sized_dynobj::do_layout(Symbol_table* symtab, 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; @@ -468,13 +468,13 @@ void Sized_dynobj::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. @@ -670,10 +670,10 @@ Sized_dynobj::do_add_symbols(Symbol_table* symtab, 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; @@ -1217,9 +1217,9 @@ Verdef::write(const Stringpool* dynpool, bool is_last, unsigned char* pb) const p != this->deps_.end(); ++p, ++i) { - elfcpp::Verdaux_write 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 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; } @@ -1305,10 +1305,10 @@ Verneed::write(const Stringpool* dynpool, bool is_last, // 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()) @@ -1620,18 +1620,18 @@ Versions::symbol_section_contents(const Symbol_table* symtab, 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; diff --git a/gold/dynobj.h b/gold/dynobj.h index be0d975..66d2bff 100644 --- a/gold/dynobj.h +++ b/gold/dynobj.h @@ -330,10 +330,10 @@ class Version_base // 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. @@ -354,10 +354,10 @@ class Version_base class Verdef : public Version_base { public: - Verdef(const char* vname, const std::vector& 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& 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. @@ -373,8 +373,8 @@ class Verdef : public Version_base // 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 @@ -424,8 +424,8 @@ class Verdef : public Version_base 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. @@ -450,8 +450,8 @@ class Verneed_version : public Version_base class Verneed { public: - Verneed(const char* fname) - : filename_(fname), need_versions_() + Verneed(const char* filename) + : filename_(filename), need_versions_() { } ~Verneed(); diff --git a/gold/ehframe.cc b/gold/ehframe.cc index a9afa1d..333e665 100644 --- a/gold/ehframe.cc +++ b/gold/ehframe.cc @@ -93,15 +93,15 @@ Eh_frame_hdr::Eh_frame_hdr(Output_section* eh_frame_section, 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. @@ -332,11 +332,11 @@ Fde::write(unsigned char* oview, section_offset_type offset, { 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 @@ -353,10 +353,10 @@ Fde::write(unsigned char* oview, section_offset_type offset, // 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) @@ -934,16 +934,16 @@ Eh_frame::read_fde(Sized_relobj* object, 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* 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; @@ -1026,38 +1026,38 @@ Eh_frame::set_final_data_size() 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. @@ -1074,9 +1074,9 @@ Eh_frame::do_is_merge_section_for(const Relobj* object, 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()) { @@ -1104,7 +1104,7 @@ Eh_frame::do_write(Output_file* of) 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. @@ -1113,18 +1113,18 @@ template 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(oview, o, addr_align, + o = (*p)->write(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(oview, o, addr_align, + o = (*p)->write(oview, o, addralign, this->eh_frame_hdr_); } diff --git a/gold/ehframe.h b/gold/ehframe.h index 06d0fdc..4726ffc 100644 --- a/gold/ehframe.h +++ b/gold/ehframe.h @@ -1,6 +1,6 @@ // 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 . // This file is part of gold. @@ -169,9 +169,9 @@ class Fde { 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(contents), len) + contents_(reinterpret_cast(contents), length) { } // Return the length of this FDE. Add 4 for the length and 4 for diff --git a/gold/errors.cc b/gold/errors.cc index a7c3ad2..618f9cd 100644 --- a/gold/errors.cc +++ b/gold/errors.cc @@ -1,6 +1,6 @@ // 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 . // This file is part of gold. @@ -38,8 +38,8 @@ namespace 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_() { } diff --git a/gold/expression.cc b/gold/expression.cc index 8bbcfaa..853a698 100644 --- a/gold/expression.cc +++ b/gold/expression.cc @@ -1,6 +1,6 @@ // 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 . // This file is part of gold. @@ -739,10 +739,10 @@ class Align_expression : public Binary_expression && 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 @@ -768,10 +768,10 @@ class Assert_expression : public Unary_expression 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 diff --git a/gold/fileread.cc b/gold/fileread.cc index ebc6e23..ac30769 100644 --- a/gold/fileread.cc +++ b/gold/fileread.cc @@ -754,14 +754,14 @@ File_view::~File_view() // 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); } @@ -843,7 +843,7 @@ File_read::get_mtime() 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, @@ -853,8 +853,8 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) && !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() @@ -878,15 +878,15 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) } 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; @@ -897,20 +897,20 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) 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()); @@ -927,17 +927,17 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) 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; } @@ -947,7 +947,7 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) // 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 @@ -958,10 +958,10 @@ Input_file::open_binary(const Task* task, const std::string& iname) 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()); } diff --git a/gold/fileread.h b/gold/fileread.h index 2e27d2f..47c8e0f 100644 --- a/gold/fileread.h +++ b/gold/fileread.h @@ -246,10 +246,10 @@ class File_read 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) { } @@ -450,8 +450,8 @@ class File_view 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_; diff --git a/gold/freebsd.h b/gold/freebsd.h index 9dbebe7..de69735 100644 --- a/gold/freebsd.h +++ b/gold/freebsd.h @@ -87,11 +87,11 @@ Target_freebsd::do_adjust_elf_header(unsigned char* view, 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: diff --git a/gold/i386.cc b/gold/i386.cc index cadffba..4820f15 100644 --- a/gold/i386.cc +++ b/gold/i386.cc @@ -667,10 +667,10 @@ unsigned char Output_data_plt_i386::dyn_plt_entry[plt_entry_size] = 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 = @@ -739,7 +739,7 @@ Output_data_plt_i386::do_write(Output_file* of) gold_assert(static_cast(pov - oview) == oview_size); gold_assert(static_cast(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); } @@ -975,7 +975,7 @@ Target_i386::Scan::local(Symbol_table* symtab, 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)); diff --git a/gold/icf.cc b/gold/icf.cc index 39334a5..03b927a 100644 --- a/gold/icf.cc +++ b/gold/icf.cc @@ -557,7 +557,7 @@ Icf::find_identical_sections(const Input_objects* input_objects, Symbol_table* symtab) { unsigned int section_num = 0; - std::vector num_tracked_rels; + std::vector num_tracked_relocs; std::vector is_secn_or_group_unique; std::vector section_contents; @@ -585,7 +585,7 @@ Icf::find_identical_sections(const Input_objects* input_objects, 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++; @@ -605,7 +605,7 @@ Icf::find_identical_sections(const Input_objects* input_objects, { 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); } diff --git a/gold/incremental.h b/gold/incremental.h index 58b5895..a94f397 100644 --- a/gold/incremental.h +++ b/gold/incremental.h @@ -432,8 +432,8 @@ class Incremental_inputs // 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 diff --git a/gold/layout.cc b/gold/layout.cc index 8655e7c..a7f8185 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -160,9 +160,9 @@ Layout_task_runner::run(Workqueue* workqueue, const Task* task) // 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_(), @@ -2831,7 +2831,7 @@ Layout::create_dynamic_symtab(const Input_objects* input_objects, // 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, @@ -2839,13 +2839,13 @@ Layout::create_dynamic_symtab(const Input_objects* input_objects, 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, @@ -3489,13 +3489,13 @@ Layout::find_or_add_kept_section(const std::string& name, // 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. @@ -3538,35 +3538,35 @@ Layout::write_data(const Symbol_table* symtab, Output_file* of) const { 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); } } diff --git a/gold/layout.h b/gold/layout.h index 79785bf..71afa96 100644 --- a/gold/layout.h +++ b/gold/layout.h @@ -151,10 +151,10 @@ class Kept_section // 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. @@ -164,10 +164,10 @@ class Kept_section // 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. @@ -198,11 +198,11 @@ class Kept_section // 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)); } diff --git a/gold/mapfile.cc b/gold/mapfile.cc index a9b4e72..a3ba52b 100644 --- a/gold/mapfile.cc +++ b/gold/mapfile.cc @@ -217,7 +217,7 @@ Mapfile::print_input_section_symbols( && 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* ssym = static_cast*>(sym); diff --git a/gold/merge.cc b/gold/merge.cc index 654f349..3d96921 100644 --- a/gold/merge.cc +++ b/gold/merge.cc @@ -289,10 +289,10 @@ Merge_map::is_merge_section_for(const Relobj* object, unsigned int shndx) const 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. @@ -354,10 +354,10 @@ Output_merge_data::Merge_data_eq::operator()(Merge_data_key k1, 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) @@ -369,9 +369,9 @@ Output_merge_data::add_constant(const unsigned char* p) 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; } @@ -386,14 +386,14 @@ Output_merge_data::do_add_input_section(Relobj* object, unsigned int shndx) 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. @@ -406,12 +406,12 @@ Output_merge_data::do_add_input_section(Relobj* object, unsigned int shndx) 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; @@ -531,9 +531,9 @@ Output_merge_string::finalize_merged_data() 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 diff --git a/gold/merge.h b/gold/merge.h index 62c0eca..345b115 100644 --- a/gold/merge.h +++ b/gold/merge.h @@ -1,6 +1,6 @@ // 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 . // This file is part of gold. @@ -215,8 +215,8 @@ class Merge_map 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. @@ -241,15 +241,15 @@ class Output_merge_base : public Output_section_data 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. @@ -271,8 +271,8 @@ class Output_merge_base : public Output_section_data 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)) { } @@ -386,11 +386,11 @@ template 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(); } diff --git a/gold/object.cc b/gold/object.cc index 465e99c..798e42d 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -51,12 +51,12 @@ namespace gold template 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. @@ -65,7 +65,7 @@ Xindex::initialize_symtab_xindex(Object* object, unsigned int sym_tab_shndx) { --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(object, i, NULL); return; @@ -177,8 +177,8 @@ Object::read_section_data(elfcpp::Elf_file* elf_file, // 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. @@ -197,17 +197,17 @@ Object::read_section_data(elfcpp::Elf_file* elf_file, 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 @@ -220,29 +220,29 @@ Object::handle_gnu_warning_section(const char* sname, unsigned int shndx, false); if (len == 0) { - const char* warning = sname + warn_prefix_len; + const char* warning = name + warn_prefix_len; contents = reinterpret_cast(warning); len = strlen(warning); } std::string warning(reinterpret_cast(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; @@ -301,22 +301,22 @@ Relobj::copy_symbols_data(Symbols_data* gc_sd, Read_symbols_data* sd, // 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; } @@ -327,11 +327,11 @@ Relobj::is_section_name_included(const char* sname) template Sized_relobj::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& ehdr) - : Relobj(aname, ainput_file, aoffset), + : Relobj(name, input_file, offset), elf_file_(this, ehdr), symtab_shndx_(-1U), local_symbol_count_(0), @@ -361,8 +361,8 @@ template void Sized_relobj::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 @@ -374,14 +374,14 @@ template void Sized_relobj::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) @@ -451,9 +451,9 @@ Sized_relobj::find_eh_frame( 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)) @@ -465,8 +465,8 @@ Sized_relobj::find_eh_frame( 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; } } @@ -517,11 +517,11 @@ Sized_relobj::do_read_symbols(Read_symbols_data* sd) // 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()); @@ -604,9 +604,9 @@ template bool Sized_relobj::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, @@ -697,9 +697,9 @@ Sized_relobj::include_section_group( } 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; } @@ -792,8 +792,8 @@ Sized_relobj::include_section_group( } 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; } @@ -816,9 +816,9 @@ Sized_relobj::include_section_group( template bool Sized_relobj::include_linkonce_section( - Layout* alayout, + Layout* layout, unsigned int index, - const char* aname, + const char* name, const elfcpp::Shdr& shdr) { typename elfcpp::Elf_types::Elf_WXword sh_size = shdr.get_sh_size(); @@ -832,18 +832,18 @@ Sized_relobj::include_linkonce_section( // ".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) { @@ -887,27 +887,27 @@ Sized_relobj::include_linkonce_section( template inline void -Sized_relobj::layout_section(Layout* alayout, +Sized_relobj::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(aoffset); + this->section_offsets_[shndx] = convert_types(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(); } @@ -928,10 +928,10 @@ Sized_relobj::layout_section(Layout* alayout, template void Sized_relobj::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() @@ -948,7 +948,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // 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) @@ -956,7 +956,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // 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) @@ -1016,11 +1016,11 @@ Sized_relobj::do_layout(Symbol_table* symtab, // 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 reloc_shndx(sec_shnum, 0); - std::vector reloc_type(sec_shnum, elfcpp::SHT_NULL); + std::vector reloc_shndx(shnum, 0); + std::vector 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); @@ -1032,7 +1032,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, 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); @@ -1054,8 +1054,8 @@ Sized_relobj::do_layout(Symbol_table* symtab, 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 @@ -1084,12 +1084,12 @@ Sized_relobj::do_layout(Symbol_table* symtab, uint64_t gnu_stack_flags = 0; // Keep track of which sections to omit. - std::vector omit(sec_shnum, false); + std::vector 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 reloc_sections; // Keep track of .eh_frame sections. @@ -1097,7 +1097,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // 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); @@ -1108,11 +1108,11 @@ Sized_relobj::do_layout(Symbol_table* symtab, 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; @@ -1121,7 +1121,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // 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(); @@ -1131,7 +1131,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // 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()) @@ -1139,7 +1139,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, } // Skip attributes section. - if (parameters->target().is_attributes_section(sname)) + if (parameters->target().is_attributes_section(name)) { omit[i] = true; } @@ -1149,16 +1149,16 @@ Sized_relobj::do_layout(Symbol_table* symtab, { 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; } } @@ -1174,7 +1174,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, 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) { @@ -1188,7 +1188,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // 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)) { @@ -1206,7 +1206,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, // 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) @@ -1279,7 +1279,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, 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])); @@ -1308,18 +1308,18 @@ Sized_relobj::do_layout(Symbol_table* symtab, { // 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()); @@ -1334,7 +1334,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, 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; @@ -1351,8 +1351,8 @@ Sized_relobj::do_layout(Symbol_table* symtab, 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; } @@ -1371,18 +1371,18 @@ Sized_relobj::do_layout(Symbol_table* symtab, 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. @@ -1391,12 +1391,12 @@ Sized_relobj::do_layout(Symbol_table* symtab, out_section_offsets[i] = invalid_address; } else - out_section_offsets[i] = convert_types(off); + out_section_offsets[i] = convert_types(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(); } @@ -1422,7 +1422,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, template void -Sized_relobj::do_layout_deferred_sections(Layout* alayout) +Sized_relobj::do_layout_deferred_sections(Layout* layout) { typename std::vector::iterator deferred; @@ -1431,7 +1431,7 @@ Sized_relobj::do_layout_deferred_sections(Layout* alayout) ++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_); } @@ -1452,10 +1452,10 @@ Sized_relobj::do_add_symbols(Symbol_table* symtab, 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; @@ -1497,16 +1497,16 @@ Sized_relobj::do_count_local_symbols(Stringpool* pool, } // 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); @@ -1522,13 +1522,13 @@ Sized_relobj::do_count_local_symbols(Stringpool* pool, // 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 sym(psyms); @@ -1549,7 +1549,7 @@ Sized_relobj::do_count_local_symbols(Stringpool* pool, // 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(); @@ -1585,11 +1585,11 @@ Sized_relobj::do_count_local_symbols(Stringpool* pool, // - 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; @@ -1597,20 +1597,20 @@ Sized_relobj::do_count_local_symbols(Stringpool* pool, // 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; } } @@ -1638,7 +1638,7 @@ Sized_relobj::do_finalize_local_symbols(unsigned int index, const bool relocatable = parameters->options().relocatable(); const Output_sections& out_sections(this->output_sections()); const std::vector
& out_offsets(this->section_offsets_); - unsigned int sec_shnum = this->shnum(); + unsigned int shnum = this->shnum(); for (unsigned int i = 1; i < loccount; ++i) { @@ -1662,7 +1662,7 @@ Sized_relobj::do_finalize_local_symbols(unsigned int index, } else { - if (shndx >= sec_shnum) + if (shndx >= shnum) { this->error(_("local symbol %u section index %u out of range"), i, shndx); @@ -1854,16 +1854,16 @@ Sized_relobj::write_local_symbols( } // 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); @@ -1878,12 +1878,12 @@ Sized_relobj::write_local_symbols( // 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_, @@ -1895,8 +1895,8 @@ Sized_relobj::write_local_symbols( 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 isym(psyms); @@ -1927,15 +1927,15 @@ Sized_relobj::write_local_symbols( elfcpp::Sym_write 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. @@ -1945,15 +1945,15 @@ Sized_relobj::write_local_symbols( elfcpp::Sym_write 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; } } @@ -1980,7 +1980,7 @@ template bool Sized_relobj::get_symbol_location_info( unsigned int shndx, - off_t sym_offset, + off_t offset, Symbol_location_info* info) { if (this->symtab_shndx_ == 0) @@ -1998,11 +1998,11 @@ Sized_relobj::get_symbol_location_info( this->section_contents(symbol_names_shndx, &names_size, false); const char* symbol_names = reinterpret_cast(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 sym(p); @@ -2020,9 +2020,9 @@ Sized_relobj::get_symbol_location_info( &is_ordinary); if (is_ordinary && st_shndx == shndx - && static_cast(sym.get_st_value()) <= sym_offset + && static_cast(sym.get_st_value()) <= offset && (static_cast(sym.get_st_value() + sym.get_st_size()) - > sym_offset)) + > offset)) { if (sym.get_st_name() > names_size) info->enclosing_symbol_name = "(invalid)"; @@ -2065,11 +2065,11 @@ Sized_relobj::map_to_kept_section( Sized_relobj* kept_relobj = static_cast*>(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; diff --git a/gold/object.h b/gold/object.h index c2359be..187a101 100644 --- a/gold/object.h +++ b/gold/object.h @@ -192,12 +192,12 @@ class Object // (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(); } @@ -372,13 +372,13 @@ class 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 @@ -555,8 +555,8 @@ class Object // 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. @@ -625,8 +625,8 @@ class Object 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), @@ -676,13 +676,13 @@ class Relobj : public Object // 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 @@ -716,8 +716,8 @@ class Relobj : public Object // 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 @@ -789,8 +789,8 @@ class Relobj : public Object // 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 @@ -1018,8 +1018,8 @@ class Symbol_value // 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. @@ -1058,8 +1058,8 @@ class Symbol_value // 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. @@ -1735,9 +1735,9 @@ class Sized_relobj : public Relobj // 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 diff --git a/gold/options.h b/gold/options.h index db10ee6..399c301 100644 --- a/gold/options.h +++ b/gold/options.h @@ -227,9 +227,9 @@ struct Struct_special : public Struct_var 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; @@ -517,8 +517,8 @@ class Search_directory { } // 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_ = "."; @@ -1298,24 +1298,24 @@ class Input_file_argument 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* @@ -1374,13 +1374,13 @@ class Input_argument { 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. diff --git a/gold/output.cc b/gold/output.cc index 2f9ed23..61c2ba6 100644 --- a/gold/output.cc +++ b/gold/output.cc @@ -354,13 +354,13 @@ Output_segment_headers::do_size() const 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()); } @@ -509,11 +509,11 @@ Output_file_header::entry() && !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::Value_type v; if (sym != NULL) @@ -521,7 +521,7 @@ Output_file_header::entry() Sized_symbol* ssym; ssym = this->symtab_->get_sized_symbol(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 @@ -529,11 +529,11 @@ Output_file_header::entry() // 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; } } @@ -596,12 +596,12 @@ Output_section_data::do_out_shndx() const // 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. @@ -633,9 +633,9 @@ Output_reloc::Output_reloc( 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); @@ -652,9 +652,9 @@ Output_reloc::Output_reloc( Sized_relobj* 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. @@ -674,10 +674,10 @@ Output_reloc::Output_reloc( 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 @@ -697,10 +697,10 @@ Output_reloc::Output_reloc( 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 @@ -1222,9 +1222,9 @@ Output_data_got::add_global_with_rel( 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 @@ -1240,9 +1240,9 @@ Output_data_got::add_global_with_rela( 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 @@ -1261,15 +1261,15 @@ Output_data_got::add_global_pair_with_rel( 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(); @@ -1288,15 +1288,15 @@ Output_data_got::add_global_pair_with_rela( 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(); @@ -1338,9 +1338,9 @@ Output_data_got::add_local_with_rel( 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 @@ -1357,9 +1357,9 @@ Output_data_got::add_local_with_rela( 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 @@ -1380,16 +1380,16 @@ Output_data_got::add_local_pair_with_rel( 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(); @@ -1410,16 +1410,16 @@ Output_data_got::add_local_pair_with_rela( 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(); @@ -1571,9 +1571,9 @@ Output_data_dynamic::sized_write(Output_file* of) { const int dyn_size = elfcpp::Elf_sizes::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(); @@ -1586,7 +1586,7 @@ Output_data_dynamic::sized_write(Output_file* of) 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(); @@ -1597,9 +1597,9 @@ Output_data_dynamic::sized_write(Output_file* of) 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); @@ -1608,7 +1608,7 @@ Output_symtab_xindex::do_write(Output_file* of) else this->endian_do_write(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(); @@ -1682,17 +1682,17 @@ Output_section::Input_section::finalize_data_size() 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; } } @@ -1702,11 +1702,11 @@ Output_section::Input_section::output_offset( 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 @@ -1761,9 +1761,9 @@ Output_section::Input_section::print_to_mapfile(Mapfile* mapfile) const // 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), @@ -1772,8 +1772,8 @@ Output_section::Output_section(const char* aname, elfcpp::Elf_Word atype, 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), @@ -1810,7 +1810,7 @@ Output_section::Output_section(const char* aname, elfcpp::Elf_Word atype, // 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); } @@ -1845,34 +1845,34 @@ Output_section::set_entsize(uint64_t v) template off_t Output_section::add_input_section(Sized_relobj* object, - unsigned int sec_shndx, + unsigned int shndx, const char* secname, const elfcpp::Shdr& 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(addr_align), secname); - addr_align = 1; + static_cast(addralign), secname); + addralign = 1; } - if (addr_align > this->addralign_) - this->addralign_ = addr_align; + if (addralign > this->addralign_) + this->addralign_ = addralign; typename elfcpp::Elf_types::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 @@ -1883,8 +1883,8 @@ Output_section::add_input_section(Sized_relobj* object, && 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. @@ -1894,7 +1894,7 @@ Output_section::add_input_section(Sized_relobj* object, 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 @@ -1942,9 +1942,9 @@ Output_section::add_input_section(Sized_relobj* object, || 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; } @@ -2002,9 +2002,9 @@ Output_section::add_output_section_data(Input_section* inp) 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); } @@ -2013,43 +2013,43 @@ Output_section::add_output_section_data(Input_section* inp) 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; } @@ -2058,19 +2058,19 @@ Output_section::add_merge_input_section(Relobj* object, unsigned int sec_shndx, // 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(addr_align); + pomb = new Output_merge_string(addralign); break; case 2: - pomb = new Output_merge_string(addr_align); + pomb = new Output_merge_string(addralign); break; case 4: - pomb = new Output_merge_string(addr_align); + pomb = new Output_merge_string(addralign); break; default: return false; @@ -2079,30 +2079,30 @@ Output_section::add_merge_input_section(Relobj* object, unsigned int sec_shndx, // 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()); @@ -2113,13 +2113,13 @@ Output_section::build_relaxation_map( // 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& 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) { @@ -2127,8 +2127,8 @@ Output_section::convert_input_sections_in_list_to_relaxed_sections( 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); } } @@ -2186,35 +2186,35 @@ Output_section::convert_input_sections_to_relaxed_sections( // 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 @@ -2222,11 +2222,11 @@ Output_section::find_merge_section(const Relobj* object, } // 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. @@ -2246,7 +2246,7 @@ Output_section::find_relaxed_input_section(const Relobj* object, 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()) @@ -2255,27 +2255,27 @@ Output_section::find_relaxed_input_section(const Relobj* object, 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. @@ -2283,9 +2283,9 @@ Output_section::is_input_address_mapped(const Relobj* object, 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 @@ -2294,29 +2294,29 @@ Output_section::is_input_address_mapped(const Relobj* object, 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. @@ -2324,32 +2324,32 @@ Output_section::output_offset(const Relobj* object, unsigned int sec_shndx, 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. @@ -2358,12 +2358,12 @@ Output_section::output_address(const Relobj* object, unsigned int sec_shndx, ++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(); } @@ -2377,11 +2377,11 @@ Output_section::output_address(const Relobj* object, unsigned int sec_shndx, } // 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. @@ -2398,7 +2398,7 @@ Output_section::find_starting_output_address(const Relobj* object, // 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; @@ -2426,7 +2426,7 @@ Output_section::set_final_data_size() 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(); @@ -2434,7 +2434,7 @@ Output_section::set_final_data_size() ++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(); } @@ -2498,11 +2498,11 @@ class Output_section::Input_section_sort_entry 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_) { @@ -2510,14 +2510,14 @@ class Output_section::Input_section_sort_entry // so it is OK to lock. Unfortunately we have no way to pass // in a Task token. const Task* dummy_task = reinterpret_cast(-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 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()); } } @@ -2568,12 +2568,12 @@ class Output_section::Input_section_sort_entry // 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) @@ -2706,10 +2706,10 @@ Output_section::write_header(const Layout* layout, 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()); @@ -2723,19 +2723,19 @@ Output_section::write_header(const Layout* layout, 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_); @@ -2862,9 +2862,9 @@ Output_section::write_to_postprocessing_buffer() uint64_t Output_section::get_input_sections( - uint64_t addr, + uint64_t address, const std::string& fill, - std::list* inputsections) + std::list* input_sections) { if (this->checkpoint_ != NULL && !this->checkpoint_->input_sections_saved()) @@ -2873,9 +2873,9 @@ Output_section::get_input_sections( // 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(); @@ -2883,18 +2883,18 @@ Output_section::get_input_sections( ++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) @@ -2905,44 +2905,44 @@ Output_section::get_input_sections( 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); } @@ -3022,7 +3022,7 @@ Output_section::print_merge_stats() // 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), @@ -3032,8 +3032,8 @@ Output_segment::Output_segment(elfcpp::Elf_Word atype, elfcpp::Elf_Word aflags) 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) @@ -3332,15 +3332,15 @@ Output_segment::maximum_alignment() { 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 @@ -3350,9 +3350,9 @@ Output_segment::maximum_alignment() && 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; @@ -3371,9 +3371,9 @@ Output_segment::maximum_alignment_list(const Output_data_list* pdl) 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; } @@ -4138,7 +4138,7 @@ template 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, @@ -4150,7 +4150,7 @@ template 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, @@ -4162,7 +4162,7 @@ template 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, @@ -4174,7 +4174,7 @@ template 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, diff --git a/gold/output.h b/gold/output.h index 21d80fb..6631aa1 100644 --- a/gold/output.h +++ b/gold/output.h @@ -53,8 +53,8 @@ class Sized_relobj; 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. @@ -416,11 +416,11 @@ class Output_data // 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; } @@ -442,10 +442,10 @@ class Output_data // 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. @@ -639,17 +639,17 @@ class Output_file_header : public Output_data 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. @@ -675,9 +675,9 @@ class Output_section_data : public Output_data // 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 @@ -768,8 +768,8 @@ class Output_section_data : public Output_data 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. @@ -779,8 +779,8 @@ class Output_section_data_build : public Output_section_data // 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. @@ -795,16 +795,16 @@ class Output_section_data_build : public Output_section_data 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(p), len) { } @@ -834,8 +834,8 @@ class Output_data_const_buffer : public Output_section_data { 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) { } @@ -868,9 +868,9 @@ class Output_data_const_buffer : public Output_section_data 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) { } @@ -898,8 +898,8 @@ class Output_data_fixed_space : public Output_section_data 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) { } @@ -932,8 +932,8 @@ class Output_data_space : public Output_section_data_build 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: @@ -1181,33 +1181,33 @@ class Output_reloc // 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* 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* 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* 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) { } @@ -1215,14 +1215,14 @@ class Output_reloc // 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* 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. @@ -1345,33 +1345,33 @@ class Output_data_reloc // 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* 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* 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 @@ -1379,15 +1379,15 @@ class Output_data_reloc 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* 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)); } @@ -1396,19 +1396,19 @@ class Output_data_reloc void add_local(Sized_relobj* 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* 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. @@ -1416,19 +1416,19 @@ class Output_data_reloc void add_local_relative(Sized_relobj* 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* 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 @@ -1438,19 +1438,19 @@ class Output_data_reloc void add_local_section(Sized_relobj* 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* 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. @@ -1459,14 +1459,14 @@ class Output_data_reloc 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* 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. @@ -1492,16 +1492,16 @@ class 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* 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 @@ -1511,14 +1511,14 @@ class Output_data_reloc 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* 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. @@ -1526,20 +1526,20 @@ class Output_data_reloc void add_local(Sized_relobj* 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* 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. @@ -1547,20 +1547,20 @@ class Output_data_reloc void add_local_relative(Sized_relobj* 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* 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 @@ -1570,34 +1570,34 @@ class Output_data_reloc void add_local_section(Sized_relobj* 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* 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* 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)); } }; @@ -1866,8 +1866,8 @@ class Output_data_dynamic : public Output_section_data // 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 @@ -1912,32 +1912,32 @@ class Output_data_dynamic : public Output_section_data { 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. @@ -2050,9 +2050,9 @@ class Output_relaxed_input_section : public Output_section_data_build // 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. @@ -2132,9 +2132,9 @@ class Output_section : public Output_data // 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; } @@ -2502,11 +2502,11 @@ class Output_section : public Output_data static const unsigned int invalid_shndx = static_cast(-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) @@ -2676,8 +2676,8 @@ class Output_section : public Output_data // 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 @@ -2738,16 +2738,16 @@ class Output_section : public Output_data } // 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(addr_align))) + Input_section(Relobj* object, unsigned int shndx, off_t data_size, + uint64_t addralign) + : shndx_(shndx), + p2align_(ffsll(static_cast(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; } @@ -2807,13 +2807,13 @@ class Output_section : public Output_data // 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. @@ -2896,11 +2896,11 @@ class Output_section : public Output_data // 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 @@ -3000,15 +3000,15 @@ class Output_section : public Output_data 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 @@ -3098,9 +3098,9 @@ class Output_section : public Output_data 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. @@ -3467,18 +3467,18 @@ class Output_segment // 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 diff --git a/gold/parameters.cc b/gold/parameters.cc index cd08c62..2a53998 100644 --- a/gold/parameters.cc +++ b/gold/parameters.cc @@ -1,6 +1,6 @@ // 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 . // This file is part of gold. @@ -31,50 +31,50 @@ namespace 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 diff --git a/gold/plugin.cc b/gold/plugin.cc index de676eb..ff9f98f 100644 --- a/gold/plugin.cc +++ b/gold/plugin.cc @@ -318,7 +318,7 @@ Plugin_manager::claim_file(Input_file* input_file, off_t offset, 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) { @@ -327,7 +327,7 @@ Plugin_manager::all_symbols_read(Workqueue* workqueue, Task* task, 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; @@ -446,10 +446,10 @@ Plugin_manager::add_input_file(char *pathname, bool is_lib) // 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_() { } @@ -521,7 +521,7 @@ Pluginobj::get_symbol_resolution_info(int nsyms, ld_plugin_symbol* syms) const // 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 ins = this->comdat_map_.insert(std::make_pair(comdat_key, false)); @@ -529,9 +529,9 @@ Pluginobj::include_comdat_group(std::string comdat_key, Layout* alayout) // 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; } @@ -540,11 +540,11 @@ Pluginobj::include_comdat_group(std::string comdat_key, Layout* alayout) template Sized_pluginobj::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) { } @@ -573,7 +573,7 @@ template void Sized_pluginobj::do_add_symbols(Symbol_table* symtab, Read_symbols_data*, - Layout* alayout) + Layout* layout) { const int sym_size = elfcpp::Elf_sizes::sym_size; unsigned char symbuf[sym_size]; @@ -587,14 +587,14 @@ Sized_pluginobj::do_add_symbols(Symbol_table* symtab, 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; @@ -647,7 +647,7 @@ Sized_pluginobj::do_add_symbols(Symbol_table* symtab, 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); @@ -658,7 +658,7 @@ Sized_pluginobj::do_add_symbols(Symbol_table* symtab, osym.put_st_shndx(shndx); this->symbols_[i] = - symtab->add_from_pluginobj(this, aname, ver, &sym); + symtab->add_from_pluginobj(this, name, ver, &sym); } } diff --git a/gold/powerpc.cc b/gold/powerpc.cc index 8bb633f..bd5571c 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -890,10 +890,10 @@ template void Output_data_plt_powerpc::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); @@ -924,7 +924,7 @@ Output_data_plt_powerpc::do_write(Output_file* of) gold_assert(static_cast(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. @@ -1458,9 +1458,9 @@ Target_powerpc::gc_process_relocs( const unsigned char* plocal_symbols) { typedef Target_powerpc Powerpc; - typedef typename Target_powerpc::Scan scan; + typedef typename Target_powerpc::Scan Scan; - gold::gc_process_relocs( + gold::gc_process_relocs( symtab, layout, this, @@ -1492,7 +1492,7 @@ Target_powerpc::scan_relocs( const unsigned char* plocal_symbols) { typedef Target_powerpc Powerpc; - typedef typename Target_powerpc::Scan scan; + typedef typename Target_powerpc::Scan Scan; static Output_data_space* sdata; if (sh_type == elfcpp::SHT_REL) @@ -1520,7 +1520,7 @@ Target_powerpc::scan_relocs( false, false); } - gold::scan_relocs( + gold::scan_relocs( symtab, layout, this, @@ -1992,17 +1992,17 @@ public: (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; diff --git a/gold/reduced_debug_output.cc b/gold/reduced_debug_output.cc index d2b0e3d..5bc8053 100644 --- a/gold/reduced_debug_output.cc +++ b/gold/reduced_debug_output.cc @@ -1,6 +1,6 @@ // 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 . // This file is part of gold. @@ -213,15 +213,15 @@ Output_reduced_debug_abbrev_section::set_final_data_size() 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 @@ -353,15 +353,15 @@ void Output_reduced_debug_info_section::set_final_data_size() 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. diff --git a/gold/reduced_debug_output.h b/gold/reduced_debug_output.h index e6a083c..d168228 100644 --- a/gold/reduced_debug_output.h +++ b/gold/reduced_debug_output.h @@ -1,6 +1,6 @@ // 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 . // This file is part of gold. @@ -42,9 +42,9 @@ namespace 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(); } @@ -88,9 +88,9 @@ class Output_reduced_debug_abbrev_section : public Output_section 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 diff --git a/gold/reloc.cc b/gold/reloc.cc index dfe50b3..858778e 100644 --- a/gold/reloc.cc +++ b/gold/reloc.cc @@ -239,21 +239,21 @@ Sized_relobj::do_read_relocs(Read_relocs_data* rd) { 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
& 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); @@ -262,7 +262,7 @@ Sized_relobj::do_read_relocs(Read_relocs_data* rd) 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); @@ -341,10 +341,10 @@ Sized_relobj::do_read_relocs(Read_relocs_data* rd) 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); } @@ -357,7 +357,7 @@ Sized_relobj::do_read_relocs(Read_relocs_data* rd) template void Sized_relobj::do_gc_process_relocs(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Read_relocs_data* rd) { Sized_target* target = @@ -379,7 +379,7 @@ Sized_relobj::do_gc_process_relocs(Symbol_table* symtab, // 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, @@ -397,7 +397,7 @@ Sized_relobj::do_gc_process_relocs(Symbol_table* symtab, template void Sized_relobj::do_scan_relocs(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Read_relocs_data* rd) { Sized_target* target = @@ -428,21 +428,21 @@ Sized_relobj::do_scan_relocs(Symbol_table* symtab, // 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, @@ -505,7 +505,7 @@ template void Sized_relobj::emit_relocs_scan( Symbol_table* symtab, - Layout* alayout, + Layout* layout, const unsigned char* plocal_syms, const Read_relocs_data::Relocs_list::iterator& p) { @@ -514,12 +514,12 @@ Sized_relobj::emit_relocs_scan( rr->set_reloc_count(p->reloc_count); if (p->sh_type == elfcpp::SHT_REL) - this->emit_relocs_scan_reltype(symtab, alayout, + this->emit_relocs_scan_reltype(symtab, layout, plocal_syms, p, rr); else { gold_assert(p->sh_type == elfcpp::SHT_RELA); - this->emit_relocs_scan_reltype(symtab, alayout, + this->emit_relocs_scan_reltype(symtab, layout, plocal_syms, p, rr); } } @@ -532,7 +532,7 @@ template void Sized_relobj::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) @@ -540,7 +540,7 @@ Sized_relobj::emit_relocs_scan_reltype( scan_relocatable_relocs >( symtab, - alayout, + layout, this, p->data_shndx, p->contents->data(), @@ -557,18 +557,18 @@ Sized_relobj::emit_relocs_scan_reltype( template void Sized_relobj::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 @@ -582,14 +582,14 @@ Sized_relobj::do_relocate(const Symbol_table* symtab, // 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) { @@ -607,8 +607,8 @@ Sized_relobj::do_relocate(const Symbol_table* symtab, } // 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(); @@ -633,7 +633,7 @@ Sized_relobj::write_sections(const unsigned char* pshdrs, 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
& out_offsets(this->section_offsets_); @@ -641,7 +641,7 @@ Sized_relobj::write_sections(const unsigned char* pshdrs, 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]; @@ -702,16 +702,16 @@ Sized_relobj::write_sections(const unsigned char* pshdrs, // 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(os->data_size()); } else { - out_section_offset = 0; + output_section_offset = 0; output_section_size = convert_types(os->postprocessing_buffer_size()); } @@ -720,12 +720,12 @@ Sized_relobj::write_sections(const unsigned char* pshdrs, 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); } @@ -735,36 +735,36 @@ Sized_relobj::write_sections(const unsigned char* pshdrs, 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; @@ -790,11 +790,11 @@ template void Sized_relobj::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* target = parameters->sized_target(); @@ -803,11 +803,11 @@ Sized_relobj::do_relocate_sections( Relocate_info 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); @@ -880,7 +880,7 @@ Sized_relobj::do_relocate_sections( 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; @@ -890,7 +890,7 @@ Sized_relobj::do_relocate_sections( 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); } @@ -898,10 +898,10 @@ Sized_relobj::do_relocate_sections( { 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 @@ -909,7 +909,7 @@ Sized_relobj::do_relocate_sections( 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); } @@ -926,9 +926,9 @@ Sized_relobj::emit_relocs( unsigned int sh_type, const unsigned char* prelocs, size_t reloc_count, - Output_section* aoutput_section, + Output_section* output_section, typename elfcpp::Elf_types::Elf_Addr offset_in_output_section, - unsigned char* aview, + unsigned char* view, typename elfcpp::Elf_types::Elf_Addr address, section_size_type view_size, unsigned char* reloc_view, @@ -936,17 +936,17 @@ Sized_relobj::emit_relocs( { if (sh_type == elfcpp::SHT_REL) this->emit_relocs_reltype(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(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); } } @@ -962,9 +962,9 @@ Sized_relobj::emit_relocs_reltype( unsigned int i, const unsigned char* prelocs, size_t reloc_count, - Output_section* aoutput_section, + Output_section* output_section, typename elfcpp::Elf_types::Elf_Addr offset_in_output_section, - unsigned char* aview, + unsigned char* view, typename elfcpp::Elf_types::Elf_Addr address, section_size_type view_size, unsigned char* reloc_view, @@ -975,10 +975,10 @@ Sized_relobj::emit_relocs_reltype( relinfo, prelocs, reloc_count, - aoutput_section, + output_section, offset_in_output_section, rr, - aview, + view, address, view_size, reloc_view, @@ -1029,21 +1029,21 @@ Sized_relobj::split_stack_adjust( 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(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(symtab, pshdrs, shndx, prelocs, reloc_count, - aview, view_size, + view, view_size, reloc_map); } } @@ -1060,7 +1060,7 @@ Sized_relobj::split_stack_adjust_reltype( 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) { @@ -1097,9 +1097,9 @@ Sized_relobj::split_stack_adjust_reltype( && 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); } } @@ -1152,7 +1152,7 @@ Sized_relobj::split_stack_adjust_reltype( 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()); @@ -1171,10 +1171,10 @@ Sized_relobj::split_stack_adjust_reltype( 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(p->second)))) continue; @@ -1216,8 +1216,8 @@ Sized_relobj::find_functions( // 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::Elf_WXword sh_size = @@ -1225,9 +1225,9 @@ Sized_relobj::find_functions( 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 isym(psyms); @@ -1419,7 +1419,7 @@ Sized_relobj<64, true>::do_read_relocs(Read_relocs_data* rd); template void Sized_relobj<32, false>::do_gc_process_relocs(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Read_relocs_data* rd); #endif @@ -1427,7 +1427,7 @@ Sized_relobj<32, false>::do_gc_process_relocs(Symbol_table* symtab, template void Sized_relobj<32, true>::do_gc_process_relocs(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Read_relocs_data* rd); #endif @@ -1435,7 +1435,7 @@ Sized_relobj<32, true>::do_gc_process_relocs(Symbol_table* symtab, template void Sized_relobj<64, false>::do_gc_process_relocs(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Read_relocs_data* rd); #endif @@ -1443,7 +1443,7 @@ Sized_relobj<64, false>::do_gc_process_relocs(Symbol_table* symtab, template void Sized_relobj<64, true>::do_gc_process_relocs(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Read_relocs_data* rd); #endif @@ -1451,7 +1451,7 @@ Sized_relobj<64, true>::do_gc_process_relocs(Symbol_table* symtab, template void Sized_relobj<32, false>::do_scan_relocs(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Read_relocs_data* rd); #endif @@ -1459,7 +1459,7 @@ Sized_relobj<32, false>::do_scan_relocs(Symbol_table* symtab, template void Sized_relobj<32, true>::do_scan_relocs(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Read_relocs_data* rd); #endif @@ -1467,7 +1467,7 @@ Sized_relobj<32, true>::do_scan_relocs(Symbol_table* symtab, template void Sized_relobj<64, false>::do_scan_relocs(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Read_relocs_data* rd); #endif @@ -1475,7 +1475,7 @@ Sized_relobj<64, false>::do_scan_relocs(Symbol_table* symtab, template void Sized_relobj<64, true>::do_scan_relocs(Symbol_table* symtab, - Layout* alayout, + Layout* layout, Read_relocs_data* rd); #endif @@ -1483,7 +1483,7 @@ Sized_relobj<64, true>::do_scan_relocs(Symbol_table* symtab, template void Sized_relobj<32, false>::do_relocate(const Symbol_table* symtab, - const Layout* alayout, + const Layout* layout, Output_file* of); #endif @@ -1491,7 +1491,7 @@ Sized_relobj<32, false>::do_relocate(const Symbol_table* symtab, template void Sized_relobj<32, true>::do_relocate(const Symbol_table* symtab, - const Layout* alayout, + const Layout* layout, Output_file* of); #endif @@ -1499,7 +1499,7 @@ Sized_relobj<32, true>::do_relocate(const Symbol_table* symtab, template void Sized_relobj<64, false>::do_relocate(const Symbol_table* symtab, - const Layout* alayout, + const Layout* layout, Output_file* of); #endif @@ -1507,7 +1507,7 @@ Sized_relobj<64, false>::do_relocate(const Symbol_table* symtab, template void Sized_relobj<64, true>::do_relocate(const Symbol_table* symtab, - const Layout* alayout, + const Layout* layout, Output_file* of); #endif @@ -1516,7 +1516,7 @@ template 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 @@ -1526,7 +1526,7 @@ template 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 @@ -1536,7 +1536,7 @@ template 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 diff --git a/gold/reloc.h b/gold/reloc.h index 30a55ff..5dd4c85 100644 --- a/gold/reloc.h +++ b/gold/reloc.h @@ -259,10 +259,10 @@ class Relocatable_relocs // 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(astrategy)); - if (astrategy != RELOC_DISCARD) + this->reloc_strategies_.push_back(static_cast(strategy)); + if (strategy != RELOC_DISCARD) ++this->output_reloc_count_; } diff --git a/gold/resolve.cc b/gold/resolve.cc index 1d77a92..89b10b9 100644 --- a/gold/resolve.cc +++ b/gold/resolve.cc @@ -37,9 +37,9 @@ namespace gold // 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 @@ -49,7 +49,7 @@ Symbol::override_version(const char* aversion) // 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 { @@ -58,8 +58,8 @@ Symbol::override_version(const char* aversion) // 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; } } @@ -67,19 +67,19 @@ Symbol::override_version(const char* aversion) // 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; } } @@ -89,18 +89,18 @@ template void Symbol::override_base(const elfcpp::Sym& 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; @@ -113,9 +113,9 @@ template void Sized_symbol::override(const elfcpp::Sym& 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(); } @@ -128,9 +128,9 @@ void Symbol_table::override(Sized_symbol* tosym, const elfcpp::Sym& 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]; @@ -138,7 +138,7 @@ Symbol_table::override(Sized_symbol* tosym, Sized_symbol* ssym = this->get_sized_symbol(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(sym); diff --git a/gold/script-sections.cc b/gold/script-sections.cc index b8e1cef..f38cbd0 100644 --- a/gold/script-sections.cc +++ b/gold/script-sections.cc @@ -1171,8 +1171,8 @@ Output_section_element_input::match_name(const char* file_name, 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) { } @@ -1198,8 +1198,8 @@ class Input_section_info // 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 @@ -1208,8 +1208,8 @@ class Input_section_info // 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 @@ -1218,8 +1218,8 @@ class Input_section_info // 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. @@ -1388,12 +1388,12 @@ Output_section_element_input::set_section_addresses( Input_section_sorter(this->filename_sort_, isp.sort)); - for (std::vector::const_iterator q = + for (std::vector::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; @@ -1409,11 +1409,11 @@ Output_section_element_input::set_section_addresses( 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(); } } @@ -2127,7 +2127,7 @@ bool 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) @@ -2140,14 +2140,14 @@ Output_section_definition::get_output_section_info(const char* 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; } @@ -2297,7 +2297,7 @@ Orphan_output_section::set_section_addresses(Symbol_table*, Layout*, 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 @@ -2305,7 +2305,7 @@ Orphan_output_section::set_section_addresses(Symbol_table*, Layout*, { const Task* task = reinterpret_cast(-1); Task_lock_obj 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. @@ -2314,8 +2314,8 @@ Orphan_output_section::set_section_addresses(Symbol_table*, Layout*, 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; } @@ -2351,13 +2351,13 @@ Orphan_output_section::allocate_to_segment(String_list**, bool* orphan) 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) { } @@ -2388,10 +2388,10 @@ class Phdrs_element // 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); } @@ -3496,7 +3496,7 @@ Script_sections::put_headers_in_phdrs(Output_data* file_header, 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_) @@ -3504,7 +3504,7 @@ Script_sections::get_output_section_info(const char* name, uint64_t* address, 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; diff --git a/gold/script.cc b/gold/script.cc index ec7ce07..8839213 100644 --- a/gold/script.cc +++ b/gold/script.cc @@ -78,28 +78,28 @@ class Token { } // 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. @@ -213,8 +213,8 @@ class Lex // Set the lexing mode. void - set_mode(Mode mde) - { this->mode_ = mde; } + set_mode(Mode mode) + { this->mode_ = mode; } private: Lex(const Lex&); @@ -1160,19 +1160,19 @@ Script_options::set_section_addresses(Symbol_table* symtab, Layout* layout) 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. @@ -1814,10 +1814,10 @@ Lazy_demangler::get() // 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; diff --git a/gold/script.h b/gold/script.h index 1afe44d..755bb79 100644 --- a/gold/script.h +++ b/gold/script.h @@ -261,9 +261,9 @@ class Symbol_assignment 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. @@ -390,8 +390,8 @@ class Script_options 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. diff --git a/gold/sparc.cc b/gold/sparc.cc index 43c6e34..8047a11 100644 --- a/gold/sparc.cc +++ b/gold/sparc.cc @@ -401,13 +401,13 @@ private: rela(unsigned char* view, unsigned int right_shift, typename elfcpp::Elf_types::Elf_Addr dst_mask, - typename elfcpp::Swap::Valtype avalue, + typename elfcpp::Swap::Valtype value, typename elfcpp::Swap::Valtype addend) { typedef typename elfcpp::Swap::Valtype Valtype; Valtype* wv = reinterpret_cast(view); Valtype val = elfcpp::Swap::readval(wv); - Valtype reloc = ((avalue + addend) >> right_shift); + Valtype reloc = ((value + addend) >> right_shift); val &= ~dst_mask; reloc &= dst_mask; @@ -589,10 +589,10 @@ public: // R_SPARC_HI22: (Symbol + Addend) >> 10 static inline void hi22(unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr avalue, + typename elfcpp::Elf_types::Elf_Addr value, typename elfcpp::Elf_types::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 @@ -620,10 +620,10 @@ public: // R_SPARC_LO10: (Symbol + Addend) & 0x3ff static inline void lo10(unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr avalue, + typename elfcpp::Elf_types::Elf_Addr value, typename elfcpp::Elf_types::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 @@ -682,10 +682,10 @@ public: // R_SPARC_13: (Symbol + Addend) static inline void rela32_13(unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr avalue, + typename elfcpp::Elf_types::Elf_Addr value, typename elfcpp::Elf_types::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) @@ -904,22 +904,22 @@ public: // R_SPARC_TLS_LDO_HIX22: @dtpoff(Symbol + Addend) >> 10 static inline void ldo_hix22(unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr avalue, + typename elfcpp::Elf_types::Elf_Addr value, typename elfcpp::Elf_types::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::Elf_Addr avalue, + typename elfcpp::Elf_types::Elf_Addr value, typename elfcpp::Elf_types::Elf_Addr addend) { typedef typename elfcpp::Swap<32, true>::Valtype Valtype; Valtype* wv = reinterpret_cast(view); Valtype val = elfcpp::Swap<32, true>::readval(wv); - Valtype reloc = (avalue + addend); + Valtype reloc = (value + addend); val &= ~0x1fff; reloc &= 0x3ff; @@ -930,13 +930,13 @@ public: // R_SPARC_TLS_LE_HIX22: (@tpoff(Symbol + Addend) ^ 0xffffffffffffffff) >> 10 static inline void hix22(unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr avalue, + typename elfcpp::Elf_types::Elf_Addr value, typename elfcpp::Elf_types::Elf_Addr addend) { typedef typename elfcpp::Swap<32, true>::Valtype Valtype; Valtype* wv = reinterpret_cast(view); Valtype val = elfcpp::Swap<32, true>::readval(wv); - Valtype reloc = (avalue + addend); + Valtype reloc = (value + addend); val &= ~0x3fffff; @@ -974,13 +974,13 @@ public: // R_SPARC_TLS_LE_LOX10: (@tpoff(Symbol + Addend) & 0x3ff) | 0x1c00 static inline void lox10(unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr avalue, + typename elfcpp::Elf_types::Elf_Addr value, typename elfcpp::Elf_types::Elf_Addr addend) { typedef typename elfcpp::Swap<32, true>::Valtype Valtype; Valtype* wv = reinterpret_cast(view); Valtype val = elfcpp::Swap<32, true>::readval(wv); - Valtype reloc = (avalue + addend); + Valtype reloc = (value + addend); val &= ~0x1fff; reloc &= 0x3ff; @@ -1220,10 +1220,10 @@ template void Output_data_plt_sparc::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); @@ -1347,7 +1347,7 @@ Output_data_plt_sparc::do_write(Output_file* of) gold_assert(static_cast(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. @@ -2260,9 +2260,9 @@ Target_sparc::gc_process_relocs( const unsigned char* plocal_symbols) { typedef Target_sparc Sparc; - typedef typename Target_sparc::Scan scan; + typedef typename Target_sparc::Scan Scan; - gold::gc_process_relocs( + gold::gc_process_relocs( symtab, layout, this, @@ -2294,7 +2294,7 @@ Target_sparc::scan_relocs( const unsigned char* plocal_symbols) { typedef Target_sparc Sparc; - typedef typename Target_sparc::Scan scan; + typedef typename Target_sparc::Scan Scan; if (sh_type == elfcpp::SHT_REL) { @@ -2303,7 +2303,7 @@ Target_sparc::scan_relocs( return; } - gold::scan_relocs( + gold::scan_relocs( symtab, layout, this, @@ -2415,11 +2415,11 @@ Target_sparc::Relocate::relocate( || 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; } @@ -2740,7 +2740,7 @@ Target_sparc::Relocate::relocate_tls( typedef typename elfcpp::Swap<32, true>::Valtype Insntype; const elfcpp::Elf_Xword addend = rela.get_r_addend(); - typename elfcpp::Elf_types::Elf_Addr avalue = psymval->value(object, 0); + typename elfcpp::Elf_types::Elf_Addr value = psymval->value(object, 0); const bool is_final = (gsym == NULL @@ -2760,18 +2760,18 @@ Target_sparc::Relocate::relocate_tls( Insntype* wv = reinterpret_cast(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: @@ -2795,13 +2795,13 @@ Target_sparc::Relocate::relocate_tls( 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(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) { @@ -2812,12 +2812,12 @@ Target_sparc::Relocate::relocate_tls( { 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: @@ -2867,24 +2867,24 @@ Target_sparc::Relocate::relocate_tls( 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 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; @@ -2939,14 +2939,14 @@ Target_sparc::Relocate::relocate_tls( case elfcpp::R_SPARC_TLS_LDM_CALL: { Symbol_value 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; @@ -2964,20 +2964,20 @@ Target_sparc::Relocate::relocate_tls( 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) @@ -3018,16 +3018,16 @@ Target_sparc::Relocate::relocate_tls( 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; @@ -3039,23 +3039,23 @@ Target_sparc::Relocate::relocate_tls( 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(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; @@ -3076,8 +3076,8 @@ Target_sparc::Relocate::relocate_tls( // 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; @@ -3086,8 +3086,8 @@ Target_sparc::Relocate::relocate_tls( // 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; } @@ -3238,18 +3238,18 @@ public: (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; diff --git a/gold/symtab.cc b/gold/symtab.cc index 30ed8f7..7e8a890 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -50,20 +50,20 @@ namespace gold // 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; @@ -83,16 +83,16 @@ Symbol::init_fields(const char* aname, const char* aversion, // 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); @@ -109,33 +109,33 @@ Symbol::demangled_name() const template 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& 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; @@ -145,15 +145,15 @@ Symbol::init_base_output_data(const char* aname, const char* aversion, // 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; @@ -163,11 +163,11 @@ Symbol::init_base_output_segment(const char* aname, const char* aversion, // 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; @@ -177,11 +177,11 @@ Symbol::init_base_constant(const char* aname, const char* aversion, // 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; @@ -204,12 +204,12 @@ Symbol::allocate_base_common(Output_data* od) template template void -Sized_symbol::init_object(const char* aname, const char* aversion, - Object* aobject, +Sized_symbol::init_object(const char* name, const char* version, + Object* object, const elfcpp::Sym& 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(); } @@ -219,18 +219,18 @@ Sized_symbol::init_object(const char* aname, const char* aversion, template void -Sized_symbol::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::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 @@ -238,18 +238,18 @@ Sized_symbol::init_output_data(const char* aname, const char* aversion, template void -Sized_symbol::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::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 @@ -257,25 +257,25 @@ Sized_symbol::init_output_segment(const char* aname, const char* aversion, template void -Sized_symbol::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::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 void -Sized_symbol::init_undefined(const char* aname, const char* aversion, - elfcpp::STT atype, elfcpp::STB abinding, - elfcpp::STV avisibility, unsigned char non_vis) +Sized_symbol::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; } @@ -283,21 +283,21 @@ Sized_symbol::init_undefined(const char* aname, const char* aversion, // 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 void -Sized_symbol::allocate_common(Output_data* od, Value_type avalue) +Sized_symbol::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. @@ -323,9 +323,9 @@ Symbol::should_add_dynsym_entry() const { Relobj* relobj = static_cast(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; } @@ -351,28 +351,28 @@ Symbol::should_add_dynsym_entry() const { // 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, @@ -434,13 +434,13 @@ Symbol::output_section() const { 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(this->u_.from_object.object); - return relobj->output_section(sec_shndx); + return relobj->output_section(shndx); } return NULL; } @@ -486,11 +486,11 @@ Symbol::set_output_section(Output_section* os) // 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); } @@ -518,10 +518,10 @@ Symbol_table::Symbol_table_eq::operator()(const Symbol_table_key& k1, } 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 @@ -535,19 +535,19 @@ Symbol_table::gc_mark_undef_symbols() 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(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)); } } } @@ -562,11 +562,11 @@ Symbol_table::gc_mark_symbol_for_shlib(Symbol* sym) //Add the object and section to the work list. Relobj* obj = static_cast(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)); } } } @@ -581,11 +581,11 @@ Symbol_table::gc_mark_dyn_syms(Symbol* sym) { Relobj *obj = static_cast(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)); } } } @@ -616,18 +616,18 @@ Symbol_table::resolve_forwards(const Symbol* from) const // 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; } @@ -656,8 +656,8 @@ Symbol_table::resolve(Sized_symbol* to, const Sized_symbol* from) 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(); @@ -689,25 +689,25 @@ Symbol_table::force_local(Symbol* sym) // 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 @@ -717,18 +717,18 @@ Symbol_table::wrap_symbol(const char* aname, Stringpool::Key* name_key) 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 @@ -839,10 +839,10 @@ Symbol_table::define_default_version(Sized_symbol* sym, template Sized_symbol* -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& sym, @@ -851,12 +851,12 @@ Symbol_table::add_from_object(Object* aobject, 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 @@ -864,17 +864,17 @@ Symbol_table::add_from_object(Object* aobject, 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; } } @@ -910,8 +910,8 @@ Symbol_table::add_from_object(Object* aobject, 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); @@ -933,8 +933,8 @@ Symbol_table::add_from_object(Object* aobject, 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; @@ -968,7 +968,7 @@ Symbol_table::add_from_object(Object* aobject, } } - 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) @@ -1055,7 +1055,7 @@ Symbol_table::add_from_relobj( 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, @@ -1078,7 +1078,7 @@ Symbol_table::add_from_relobj( // 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? @@ -1088,7 +1088,7 @@ Symbol_table::add_from_relobj( if (ver != NULL) { // The symbol name is of the form foo@VERSION or foo@@VERSION - namelen = ver - aname; + namelen = ver - name; ++ver; if (*ver == '@') { @@ -1102,27 +1102,27 @@ Symbol_table::add_from_relobj( // 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; } } @@ -1171,11 +1171,11 @@ Symbol_table::add_from_relobj( } 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* 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); @@ -1198,7 +1198,7 @@ template Symbol* Symbol_table::add_from_pluginobj( Sized_pluginobj* obj, - const char* aname, + const char* name, const char* ver, elfcpp::Sym* sym) { @@ -1223,30 +1223,30 @@ Symbol_table::add_from_pluginobj( { // 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* 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) @@ -1337,7 +1337,7 @@ Symbol_table::add_from_dynobj( 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(), @@ -1351,8 +1351,8 @@ Symbol_table::add_from_dynobj( 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); } @@ -1381,13 +1381,13 @@ Symbol_table::add_from_dynobj( // 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(elfcpp::VER_NDX_LOCAL) || v == static_cast(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); } @@ -1400,8 +1400,8 @@ Symbol_table::add_from_dynobj( 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); @@ -1409,7 +1409,7 @@ Symbol_table::add_from_dynobj( } 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 @@ -1419,14 +1419,14 @@ Symbol_table::add_from_dynobj( 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); } @@ -1684,25 +1684,25 @@ Symbol_table::define_special_symbol(const char** pname, const char** pversion, // 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(); @@ -1711,10 +1711,10 @@ Symbol_table::define_in_output_data(const char* aname, 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(); @@ -1729,16 +1729,16 @@ Symbol_table::define_in_output_data(const char* aname, template Sized_symbol* 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::Elf_Addr avalue, - typename elfcpp::Elf_types::Elf_WXword sym_size, + typename elfcpp::Elf_types::Elf_Addr value, + typename elfcpp::Elf_types::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* sym; @@ -1748,7 +1748,7 @@ Symbol_table::do_define_in_output_data( if (parameters->target().is_big_endian()) { #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG) - sym = this->define_special_symbol(&aname, &aversion, + sym = this->define_special_symbol(&name, &version, only_if_ref, &oldsym, &resolve_oldsym); #else @@ -1758,7 +1758,7 @@ Symbol_table::do_define_in_output_data( else { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE) - sym = this->define_special_symbol(&aname, &aversion, + sym = this->define_special_symbol(&name, &version, only_if_ref, &oldsym, &resolve_oldsym); #else @@ -1769,15 +1769,15 @@ Symbol_table::do_define_in_output_data( 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; } @@ -1797,24 +1797,24 @@ Symbol_table::do_define_in_output_data( // 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 @@ -1822,10 +1822,10 @@ Symbol_table::define_in_output_segment(const char* aname, 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 @@ -1839,16 +1839,16 @@ Symbol_table::define_in_output_segment(const char* aname, template Sized_symbol* 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::Elf_Addr avalue, - typename elfcpp::Elf_types::Elf_WXword sym_size, + typename elfcpp::Elf_types::Elf_Addr value, + typename elfcpp::Elf_types::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* sym; @@ -1858,7 +1858,7 @@ Symbol_table::do_define_in_output_segment( if (parameters->target().is_big_endian()) { #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG) - sym = this->define_special_symbol(&aname, &aversion, + sym = this->define_special_symbol(&name, &version, only_if_ref, &oldsym, &resolve_oldsym); #else @@ -1868,7 +1868,7 @@ Symbol_table::do_define_in_output_segment( else { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE) - sym = this->define_special_symbol(&aname, &aversion, + sym = this->define_special_symbol(&name, &version, only_if_ref, &oldsym, &resolve_oldsym); #else @@ -1879,15 +1879,15 @@ Symbol_table::do_define_in_output_segment( 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; } @@ -1908,10 +1908,10 @@ Symbol_table::do_define_in_output_segment( // 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, @@ -1922,8 +1922,8 @@ Symbol_table::define_as_constant(const char* aname, 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 @@ -1933,8 +1933,8 @@ Symbol_table::define_as_constant(const char* aname, 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 @@ -1950,10 +1950,10 @@ Symbol_table::define_as_constant(const char* aname, template Sized_symbol* Symbol_table::do_define_as_constant( - const char* aname, - const char* aversion, - typename elfcpp::Elf_types::Elf_Addr avalue, - typename elfcpp::Elf_types::Elf_WXword sym_size, + const char* name, + const char* version, + typename elfcpp::Elf_types::Elf_Addr value, + typename elfcpp::Elf_types::Elf_WXword symsize, elfcpp::STT type, elfcpp::STB binding, elfcpp::STV visibility, @@ -1968,7 +1968,7 @@ Symbol_table::do_define_as_constant( if (parameters->target().is_big_endian()) { #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG) - sym = this->define_special_symbol(&aname, &aversion, + sym = this->define_special_symbol(&name, &version, only_if_ref, &oldsym, &resolve_oldsym); #else @@ -1978,7 +1978,7 @@ Symbol_table::do_define_as_constant( else { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE) - sym = this->define_special_symbol(&aname, &aversion, + sym = this->define_special_symbol(&name, &version, only_if_ref, &oldsym, &resolve_oldsym); #else @@ -1989,21 +1989,21 @@ Symbol_table::do_define_as_constant( 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; } @@ -2079,13 +2079,13 @@ void Symbol_table::define_with_copy_reloc( Sized_symbol* csym, Output_data* posd, - typename elfcpp::Elf_types::Elf_Addr avalue) + typename elfcpp::Elf_types::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(aobject); + Object* object = csym->object(); + gold_assert(object->is_dynamic()); + Dynobj* dynobj = static_cast(object); // Our copied variable has to override any variable in a shared // library. @@ -2094,7 +2094,7 @@ Symbol_table::define_with_copy_reloc( 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); @@ -2172,12 +2172,12 @@ Symbol_table::do_add_undefined_symbols_from_command_line() 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* sym; Sized_symbol* oldsym; @@ -2185,7 +2185,7 @@ Symbol_table::do_add_undefined_symbols_from_command_line() if (parameters->target().is_big_endian()) { #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG) - sym = this->define_special_symbol(&aname, &aversion, + sym = this->define_special_symbol(&name, &version, false, &oldsym, &resolve_oldsym); #else @@ -2195,7 +2195,7 @@ Symbol_table::do_add_undefined_symbols_from_command_line() else { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE) - sym = this->define_special_symbol(&aname, &aversion, + sym = this->define_special_symbol(&name, &version, false, &oldsym, &resolve_oldsym); #else @@ -2205,7 +2205,7 @@ Symbol_table::do_add_undefined_symbols_from_command_line() 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_; } @@ -2375,18 +2375,18 @@ Symbol_table::compute_final_value( Compute_final_value_status* pstatus) const { typedef typename Sized_symbol::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; @@ -2395,32 +2395,32 @@ Symbol_table::compute_final_value( 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(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(folded.first); os = folded_obj->output_section(folded.second); @@ -2442,16 +2442,16 @@ Symbol_table::compute_final_value( { // 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(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; } } } @@ -2460,35 +2460,35 @@ Symbol_table::compute_final_value( 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(); @@ -2497,11 +2497,11 @@ Symbol_table::compute_final_value( break; case Symbol::IS_CONSTANT: - avalue = sym->value(); + value = sym->value(); break; case Symbol::IS_UNDEFINED: - avalue = 0; + value = 0; break; default: @@ -2509,7 +2509,7 @@ Symbol_table::compute_final_value( } *pstatus = CFVS_OK; - return avalue; + return value; } // Finalize the symbol SYM. This returns true if the symbol should be @@ -2538,7 +2538,7 @@ Symbol_table::sized_finalize_symbol(Symbol* unsized_sym) // 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) { @@ -2547,9 +2547,9 @@ Symbol_table::sized_finalize_symbol(Symbol* unsized_sym) 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: @@ -2559,7 +2559,7 @@ Symbol_table::sized_finalize_symbol(Symbol* unsized_sym) gold_unreachable(); } - sym->set_value(avalue); + sym->set_value(value); if (parameters->options().strip_all() || !parameters->options().should_retain_symbol(sym->name())) @@ -2666,7 +2666,7 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, continue; } - unsigned int sec_shndx; + unsigned int shndx; typename elfcpp::Elf_types::Elf_Addr sym_value = sym->value(); typename elfcpp::Elf_types::Elf_Addr dynsym_value = sym_value; switch (sym->source()) @@ -2682,7 +2682,7 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, { gold_error(_("%s: unsupported symbol section 0x%x"), sym->demangled_name().c_str(), in_shndx); - sec_shndx = in_shndx; + shndx = in_shndx; } else { @@ -2691,15 +2691,15 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, { 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(symobj); @@ -2718,15 +2718,15 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, 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 @@ -2739,27 +2739,27 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, 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: @@ -2771,7 +2771,7 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, sym_index -= first_global_index; gold_assert(sym_index < output_count); unsigned char* ps = psyms + (sym_index * sym_size); - this->sized_write_symbol(sym, sym_value, sec_shndx, + this->sized_write_symbol(sym, sym_value, shndx, sympool, ps); } @@ -2780,7 +2780,7 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, 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(sym, dynsym_value, sec_shndx, + this->sized_write_symbol(sym, dynsym_value, shndx, dynpool, pd); } } @@ -2797,16 +2797,16 @@ template void Symbol_table::sized_write_symbol( Sized_symbol* sym, - typename elfcpp::Elf_types::Elf_Addr avalue, - unsigned int sec_shndx, + typename elfcpp::Elf_types::Elf_Addr value, + unsigned int shndx, const Stringpool* pool, unsigned char* p) const { elfcpp::Sym_write 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()); @@ -2821,7 +2821,7 @@ Symbol_table::sized_write_symbol( 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 @@ -2920,13 +2920,13 @@ Symbol_table::sized_write_section_symbol(const Output_section* os, 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); } @@ -3029,11 +3029,11 @@ Symbol_table::detect_odr_violations(const Task* task, // 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 @@ -3253,7 +3253,7 @@ void 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) @@ -3262,7 +3262,7 @@ void 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 diff --git a/gold/symtab.h b/gold/symtab.h index 2beece8..c153150 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -220,8 +220,8 @@ class Symbol // Set the visibility. void - set_visibility(elfcpp::STV vis) - { this->visibility_ = vis; } + set_visibility(elfcpp::STV visibility) + { this->visibility_ = visibility; } // Override symbol visibility. void @@ -368,15 +368,15 @@ class Symbol 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 @@ -393,10 +393,10 @@ class Symbol // 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 @@ -432,10 +432,10 @@ class Symbol 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. @@ -481,8 +481,8 @@ class Symbol 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. @@ -1004,14 +1004,14 @@ class Sized_symbol : public Symbol // 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. @@ -1184,8 +1184,8 @@ class Symbol_table ~Symbol_table(); void - set_icf(Icf* _icf) - { this->icf_ = _icf;} + set_icf(Icf* icf) + { this->icf_ = icf;} Icf* icf() const @@ -1196,8 +1196,8 @@ class Symbol_table 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 diff --git a/gold/target-select.cc b/gold/target-select.cc index ac311fb..dcd3017 100644 --- a/gold/target-select.cc +++ b/gold/target-select.cc @@ -1,6 +1,6 @@ // 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 . // This file is part of gold. @@ -43,10 +43,10 @@ namespace 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_) { diff --git a/gold/target-select.h b/gold/target-select.h index c5f469b..d1cd44f 100644 --- a/gold/target-select.h +++ b/gold/target-select.h @@ -1,6 +1,6 @@ // 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 . // This file is part of gold. @@ -57,8 +57,8 @@ class Target_selector // 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. diff --git a/gold/testsuite/tls_test_main.cc b/gold/testsuite/tls_test_main.cc index 877889c..0ff02c6 100644 --- a/gold/testsuite/tls_test_main.cc +++ b/gold/testsuite/tls_test_main.cc @@ -33,16 +33,16 @@ #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) diff --git a/gold/token.h b/gold/token.h index d477be1..dcf00b6 100644 --- a/gold/token.h +++ b/gold/token.h @@ -91,8 +91,8 @@ class Task_list 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() diff --git a/gold/workqueue.cc b/gold/workqueue.cc index 565c7fd..18c3900 100644 --- a/gold/workqueue.cc +++ b/gold/workqueue.cc @@ -1,6 +1,6 @@ // 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 . // This file is part of gold. @@ -148,7 +148,7 @@ Workqueue::~Workqueue() // 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_); @@ -164,9 +164,9 @@ Workqueue::add_to_queue(Task_list* que, Task* t, bool front) 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(); } @@ -441,11 +441,11 @@ Workqueue::release_locks(Task* t, Task_locker* tl) { // 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); } } } @@ -458,11 +458,11 @@ Workqueue::release_locks(Task* t, Task_locker* tl) // 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; } } diff --git a/gold/workqueue.h b/gold/workqueue.h index a17ec9d..7545224 100644 --- a/gold/workqueue.h +++ b/gold/workqueue.h @@ -150,8 +150,8 @@ class Task_function : public Task // 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() diff --git a/gold/x86_64.cc b/gold/x86_64.cc index 00fbf3f..e51b4ab 100644 --- a/gold/x86_64.cc +++ b/gold/x86_64.cc @@ -702,10 +702,10 @@ unsigned char Output_data_plt_x86_64::tlsdesc_plt_entry[plt_entry_size] = 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 = @@ -785,7 +785,7 @@ Output_data_plt_x86_64::do_write(Output_file* of) gold_assert(static_cast(pov - oview) == oview_size); gold_assert(static_cast(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); } -- cgit v1.1