This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: dw2gencfi.c DWARF2_FDE_RELOC_SIZE
On Mon, Mar 06, 2017 at 03:59:10AM -0700, Jan Beulich wrote:
> >>> On 06.03.17 at 11:33, <amodra@gmail.com> wrote:
> > @@ -1973,13 +1974,15 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie,
> > {
> > bfd_reloc_code_real_type code
> > = tc_cfi_reloc_for_encoding (cie->fde_encoding);
> > + addr_size = DWARF2_FDE_RELOC_SIZE;
> > if (code != BFD_RELOC_NONE)
> > {
> > reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput, code);
> > - char *p = frag_more (4);
> > - md_number_to_chars (p, 0, 4);
> > - fix_new (frag_now, p - frag_now->fr_literal, 4, fde->start_address,
> > - 0, howto->pc_relative, code);
> > + char *p = frag_more (addr_size);
> > + gas_assert (addr_size == howto->bitsize / 8);
> > + md_number_to_chars (p, 0, addr_size);
> > + fix_new (frag_now, p - frag_now->fr_literal, addr_size,
> > + fde->start_address, 0, howto->pc_relative, code);
> > }
>
> So I see you nevertheless decided to clean this up. However, is this
> a good approach? What if a target wants/needs to use different
> relocations for different encodings (which then may also be different
> size)? I would have thought that addr_size needs to be derived from
> the returned reloc type.
It would make even more sense to use
addr_size = encoding_size (cie->fde_encoding);
deriving both reloc and size from the encoding.
I thought about doing that but got tired of running the testsuite.
--
Alan Modra
Australia Development Lab, IBM