This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH][GOLD] Add a few methods and data members for stub-generation.
- From: Ian Lance Taylor <iant at google dot com>
- To: Doug Kwan (éæå) <dougkwan at google dot com>
- Cc: binutils <binutils at sourceware dot org>
- Date: Tue, 03 Nov 2009 07:08:05 -0800
- Subject: Re: [PATCH][GOLD] Add a few methods and data members for stub-generation.
- References: <498552560911021347t1471a3efj1a768f5d2f89602e@mail.gmail.com>
"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