This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: gold: addend issues in icf.cc:get_section_contents
- From: Cary Coutant <ccoutant at gmail dot com>
- To: Roland McGrath <mcgrathr at google dot com>
- Cc: Sriraman Tallam <tmsriram at google dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>, Yunlian Jiang <yunlian at google dot com>
- Date: Thu, 4 Feb 2016 10:10:59 -0800
- Subject: Re: gold: addend issues in icf.cc:get_section_contents
- Authentication-results: sourceware.org; auth=none
- References: <CAB=4xhqOr+4Vr3hgekQvuzJ0Ky5nn3s6Yjt_t59whKwxCoBWkA at mail dot gmail dot com> <CAAs8HmzgsQpWjt3S=wEwvNkmgtvpKOoYZuOpq6uFOQiUG0ONCQ at mail dot gmail dot com> <CAJimCsE7mAfKZ5hohAJzLi-vAri__xfwmtF6GKgKHRoXLtvqBw at mail dot gmail dot com> <CAB=4xhqiLK9EXNVCubahH8ma-qsY+NBCFcGeRonRQgDUgQ3-jw at mail dot gmail dot com>
> I asked him to handle REL and RELA together so that the "ignore addend
> when negative" logic would live in only one place and not be copied.
> If the subroutine handles only REL, then that logic should be outside
> it. The existing logic doesn't explicitly have "RELA or REL" logic,
> it kind of does both; but I think it's a true invariant that
> it_a->second != 0 implies *it_addend_size == 0 and *it_addend_size !=
> 0 implies it_a->second == 0 (that is, it_a->second is always 0 for
> REL, and *it_addend_size is always 0 for RELA). So a single function
> get_reloc_addend that takes it_a->second (the RELA addend) as an
> argument that it returns in the *it_addend_size == 0 case would do it
> nicely (or just don't bother breaking it out as a subroutine and just
> make addend and reloc_addend_value a single variable set from
> it_a->second in case 0, with the negative-value logic coming
> afterwards.
Sorry, Roland, I'm not sure what point you're trying to make. I don't
see how any of what you wrote contradicts my review comments. The
logic to handle "ignore added when negative" is in fact outside the
routine to fetch the addend from section contents (with or without my
suggested changes).
-cary