This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: dw2gencfi.c DWARF2_FDE_RELOC_SIZE
- From: "Jan Beulich" <JBeulich at suse dot com>
- To: "Alan Modra" <amodra at gmail dot com>
- Cc: <binutils at sourceware dot org>
- Date: Mon, 06 Mar 2017 03:59:10 -0700
- Subject: Re: dw2gencfi.c DWARF2_FDE_RELOC_SIZE
- Authentication-results: sourceware.org; auth=none
- References: <20170306103305.GK4895@bubble.grove.modra.org>
>>> 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.
Jan