This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [GOLD][PATCH] Addend reader struct for stubs.
- 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: Fri, 30 Oct 2009 16:42:33 -0700
- Subject: Re: [GOLD][PATCH] Addend reader struct for stubs.
- References: <498552560910301309h433b74b1y686f41ebc6e59e86@mail.gmail.com>
"Doug Kwan (éæå)" <dougkwan@google.com> writes:
> +// Functor to read reloc addends during stub generation.
> +
> +template<int sh_type, bool big_endian>
> +struct Stub_addend_reader
> +{
> + // Return the addend for a relocation of a particular type. Depending
> + // on whether this is a REL or RELA relocation, read the addend from a
> + // view or from a Reloc object.
> + elfcpp::Elf_types<32>::Elf_Swxword
> + operator()(
> + unsigned int /* r_type */,
> + const unsigned char* /* view */,
> + const typename Reloc_types<sh_type,
> + 32, big_endian>::Reloc& /* reloc */) const
> + { gold_unreachable(); }
> +};
You don't have to define this operator() -- nothing will call it. It
should suffice to do
template<int sh_type, bool big_endian>
struct Stub_addend_reader;
All the actual uses will use the specializations.
> +// Stub_addend_reader methods.
> +
> +// Read the addend of a REL relocation of type R_TYPE at VIEW.
> +
> +template<bool big_endian>
> +elfcpp::Elf_types<32>::Elf_Swxword
> +Stub_addend_reader<elfcpp::SHT_REL, big_endian>::operator()(
> + unsigned int r_type,
> + const unsigned char* view,
> + const typename Reloc_types<elfcpp::SHT_REL, 32, big_endian>::Reloc&) const
> +{
> + switch(r_type)
s/switch(/switch (/
This is OK with those changes.
Thanks.
Ian