[GOLD] Edit PowerPC64 ELFv2 function entry code
Cary Coutant
ccoutant@gmail.com
Tue Dec 8 22:36:00 GMT 2015
> + 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
More information about the Binutils
mailing list