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] Edit PowerPC64 ELFv2 function entry code


> +                 Insn* iview = reinterpret_cast<Insn*>(view - 2 * big_endian);
> +                 Insn insn1 = elfcpp::Swap<32, big_endian>::readval(iview - 1);
> +                 Insn insn2 = elfcpp::Swap<32, big_endian>::readval(iview);

I'm afraid I don't understand this logic. As I read it, you're looking
at view for little-endian, and at (view - 2) for big-endian. If that's
the case, I think you should be using Swap_unaligned here, but I don't
see why you offset the view by -2 for big-endian.

As a matter of style, since big_endian is a bool, I'd prefer to see
this written in conditional form, e.g., (view - (big_endian ? 2 : 0)).

> +             r_type = elfcpp::R_POWERPC_ADDR16_HA;
> +             addend -= 2 * big_endian;

Likewise, "if (big_endian) addend -= 2;". Easier (for me, at least), to read.

-cary


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