This is the mail archive of the
mailing list for the binutils project.
Re: [GOLD] Edit PowerPC64 ELFv2 function entry code
- From: Cary Coutant <ccoutant at gmail dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Tue, 8 Dec 2015 14:36:12 -0800
- Subject: Re: [GOLD] Edit PowerPC64 ELFv2 function entry code
- Authentication-results: sourceware.org; auth=none
- References: <20151125014026 dot GV8120 at bubble dot grove dot modra dot org>
> + 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.