This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] GAS: .reloc: Avoid lost addend in converted relocs
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: <binutils at sourceware dot org>, Richard Sandiford <rdsandiford at googlemail dot com>
- Date: Wed, 29 May 2013 01:15:08 +0100
- Subject: Re: [PATCH] GAS: .reloc: Avoid lost addend in converted relocs
- References: <alpine dot DEB dot 1 dot 10 dot 1305281410260 dot 26443 at tp dot orcam dot me dot uk> <20130528233504 dot GH6878 at bubble dot grove dot modra dot org>
On Wed, 29 May 2013, Alan Modra wrote:
> > if (S_IS_LOCAL (sym) && !symbol_section_p (sym)
> > - && !(howto->partial_inplace
> > - && howto->pc_relative
> > - && howto->src_mask != addr_mask))
> > + && (sec->use_rela_p
> > + || (howto->partial_inplace
> > + && (!howto->pc_relative
> > + || howto->src_mask == addr_mask))))
>
> This change doesn't make sense to me. Before, you excluded a specific
> set of partial_inplace relocs, now you say any partial_inplace is good?
Not really. Before, I excluded a specific set of partial_inplace relocs
(pc_relative, with a narrow relocatable field), now I exclude that set
only on !use_rela_p targets. Plus any !partial_inplace relocs on such
targets. This is because in both cases there is no room to store an
addend (on !use_rela_p targets).
My understanding is partial_inplace is meaningless on use_rela_p targets
(and should be clear in all reloc howto tables, though there may be copy &
paste bugs there), because these targets always use the reloc itself to
store the addend. Therefore the reloc can always be converted on such
targets and we don't have to check this flag on them.
> Maybe what you really want here is:
>
> && (sec->use_rela_p
> || howto->src_mask == addr_mask))
Nope, this would prevent !pc_relative relocs from being converted --
which we want to do to get a reloc overflow error elsewhere at the
assembly stage rather than at the link stage if the addend overflows the
relocatable field this early already.
Have I made my intent clear enough to you now?
Maciej