This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH, FT32] initial support (2nd attempt)
- From: Alan Modra <amodra at gmail dot com>
- To: James Bowman <james dot bowman at ftdichip dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Sun, 11 Jan 2015 14:20:56 +1030
- Subject: Re: [PATCH, FT32] initial support (2nd attempt)
- Authentication-results: sourceware.org; auth=none
- References: <CA9BBF0458F83C4F9051448B941B57D116541C38 at glaexch1> <20150104102416 dot GL5183 at bubble dot grove dot modra dot org> <CA9BBF0458F83C4F9051448B941B57D116541C64 at glaexch1>
On Mon, Jan 05, 2015 at 08:08:17PM +0000, James Bowman wrote:
> + HOWTO (R_FT32_32, /* type */
> + 0, /* rightshift */
> + 2, /* size (0 = byte, 1 = short, 2 = long) */
> + 32, /* bitsize */
> + FALSE, /* pc_relative */
> + 0, /* bitpos */
> + complain_overflow_bitfield, /* complain_on_overflow */
> + bfd_elf_generic_reloc, /* special_function */
> + "R_FT32_32", /* name */
> + FALSE, /* partial_inplace */
> + 0x00000000, /* src_mask */
> + 0x000fffff, /* dst_mask */
> + FALSE), /* pcrel_offset */
This problem still remains. You have a 20-bit dst_mask, where I'd
expect to see 0xffffffff for a 32-bit reloc.
> + /* This is the standard place for KLUDGEs to work around bugs in
> + bfd_install_relocation (first such note in the documentation
> + appears with binutils-2.8).
> +
> + That function bfd_install_relocation does the wrong thing with
> + putting stuff into the addend of a reloc (it should stay out) for a
> + weak symbol. The really bad thing is that it adds the
> + "segment-relative offset" of the symbol into the reloc. In this
> + case, the reloc should instead be relative to the symbol with no
> + other offset than the assembly code shows; and since the symbol is
> + weak, any local definition should be ignored until link time (or
> + thereafter).
> + To wit: weaksym+42 should be weaksym+42 in the reloc,
> + not weaksym+(offset_from_segment_of_local_weaksym_definition)
> +
> + To "work around" this, we subtract the segment-relative offset of
> + "known" weak symbols. This evens out the extra offset.
> +
> + That happens for a.out but not for ELF, since for ELF,
> + bfd_install_relocation uses the "special function" field of the
> + howto, and does not execute the code that needs to be undone. */
> +
> + if (OUTPUT_FLAVOR == bfd_target_aout_flavour
> + && fixP->fx_addsy && S_IS_WEAK (fixP->fx_addsy)
> + && ! bfd_is_und_section (S_GET_SEGMENT (fixP->fx_addsy)))
> + {
> + relP->addend -= S_GET_VALUE (fixP->fx_addsy);
> + }
This too. If you don't plan to support AOUT in the near future,
please remove the above.
--
Alan Modra
Australia Development Lab, IBM