This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Difference between --oformat binary, and objcopy -O binary of --oformat elf32-i386


On Wed, Jul 20, 2016 at 08:08:22AM -0700, H.J. Lu wrote:
> On Tue, Jul 19, 2016 at 5:33 PM, Alan Modra <amodra@gmail.com> wrote:
> > On Tue, Jul 19, 2016 at 07:22:36AM -0700, H.J. Lu wrote:
> >> > HJ, it would be nice if x86 implemented something like elf32-ppc.c
> >> > ppc_elf_unhandled_reloc to give an error at link time for all the
> >> > relocs that the generic linker can't handle.
> >> >
> >>
> >> I see:
> >>
> >>  HOWTO (R_PPC_TLSLD,
> >>          0,                     /* rightshift */
> >>          2,                     /* size (0 = byte, 1 = short, 2 = long) */
> >>          32,                    /* bitsize */
> >>          FALSE,                 /* pc_relative */
> >>          0,                     /* bitpos */
> >>          complain_overflow_dont, /* complain_on_overflow */
> >>          bfd_elf_generic_reloc, /* special_function */
> >>          "R_PPC_TLSLD",         /* name */
> >>          FALSE,                 /* partial_inplace */
> >>          0,                     /* src_mask */
> >>          0,                     /* dst_mask */
> >>          FALSE),                /* pcrel_offset */
> >>
> >>
> >> Can generic linker handle R_PPC_TLSLD?
> >
> > Nope.  However, this one is a marker reloc (src_mask and dst_mask both
> > 0 result in no relocation) so it is OK to ignore.
> >
> 
> Can bfd_perform_relocation handle ELF relocations which aren't
> one of
> 
>   BFD_RELOC_64,
>   BFD_RELOC_32,
>   BFD_RELOC_26,
>   BFD_RELOC_24,
>   BFD_RELOC_16,
>   BFD_RELOC_14,
>   BFD_RELOC_8,
>   BFD_RELOC_64_PCREL,
>   BFD_RELOC_32_PCREL,
>   BFD_RELOC_24_PCREL,
>   BFD_RELOC_16_PCREL,
>   BFD_RELOC_12_PCREL,
>   BFD_RELOC_8_PCREL,

I assume you meant to ask "Can bfd_elf_generic_reloc handle ..".
The answer is, yes, it can handle a lot more, but it's true that only
simple relocs like the above are supported.  Relocs with an implicit
symbol reference (eg. GOT relocs implicitly subtract
_GLOBAL_OFFSET_TABLE_) or are section relative (eg. SECTOFF relocs),
or build tables (eg. GOT, PLT relocs) or have split fields or
otherwise modify the insn in odd ways, are not supported.

Theoretically, I suppose you could even support GOT relocs with a
complex special_function but the effort isn't worth it.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]