This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][GOLD] Add a few methods and data members for stub-generation.


"Doug Kwan (éæå)" <dougkwan@google.com> writes:

> +// Make a new Arm_input_section object.
> +
> +template<bool big_endian>
> +Arm_input_section<big_endian>*
> +Target_arm<big_endian>::new_arm_input_section(
> +    Relobj* relobj,
> +    unsigned int shndx)
> +{
> +  Input_section_specifier iss(relobj, shndx);
> +
> +  // Make sure that it we have not created another Arm_input_section
> +  // for this input section already.
> +  typename Arm_input_section_map::const_iterator p =
> +    this->arm_input_section_map_.find(iss);
> +  gold_assert(p == this->arm_input_section_map_.end());
> +
> +  Arm_input_section<big_endian>* arm_input_section =
> +    new Arm_input_section<big_endian>(relobj, shndx);
> +  arm_input_section->init();
> +
> +  // Register new Arm_input_section in map for look-up.
> +  this->arm_input_section_map_[iss] = arm_input_section;
> +  return arm_input_section; 
> +}

You can save a hash table lookup by writing:

  Arm_input_section<big_endian>* arm_input_section =
    new Arm_input_section<big_endian>(relobj, shndx);
  arm_input_section->init();

  // Register new Arm_input_section in map for look-up.
  std::pair<typename Arm_input_section_map::iterator, bool> ins =
    this->arm_input_section_map_.insert(std::make_pair(iss, arm_input_section));

  // Make sure we have not created another Arm_input_seciton for this
  // input section already.
  gold_assert(ins.second);

  return arm_input_section; 



This is OK with a change along those lines.

Thanks.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]