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: [GOLD][PATCH] Addend reader struct for stubs.


"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


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