This is the mail archive of the binutils@sources.redhat.com 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]

Re: ELF for PPC32


Torbjorn Granlund <tege@swox.com> writes:

> While working on implementing the 64-bit ELF ABI for PowerPC, we
> obsevered a discrepancy between the 64-bit ABI and how the 32-bit ABI
> is actually implemented in gas/config/tc-ppc.c and in bfd/elf32-ppc.c.
> 
> The discrepancy is in the relocation address of R_PPC_ADDR14,
> R_PPC_REL14.  The 64-bit ABI states:
> 
>   Relocation entries apply to halfwords, words, or doublewords.  In
>   all cases, the r_offset value designates the offset or virtual
>   address of the first byte of the affected storage unit.
> 
> The current 32-bit implementation doesn't do like that for
> R_PPC_ADDR14 and R_PPC_REL14.  It uses the address of the first byte
> of the instruction, which isn't the same thing (except for under
> little-endian mode).
> 
> We suspect this to be a bug in the implementation, since it seems
> strange that the 64-bit ABI and the 32-bit ABI should be inconsistent
> in this respect.
> 
> Can somebody please confirm this?

I think you are misreading the 64-bit ABI.  I freely admit that it is
confusing, although I think I simply followed the wording used in
other ABIs.

The Field column in the relocation table describes the type of field
to which the relocation applies.  You then have to look back at the
definitions of those fields near the start of the Relocation section.
You will see that R_PPC_ADDR14 and R_PPC_REL14 both apply to a field
of low14.  The low14 field is defined in terms of a 32-bit word--i.e.,
the first byte of the instruction.

This keeps the ADDR14 reloc consistent with the ADDR14_BRTAKEN and
ADDR14_BRNTAKEN relocs, which also affect bit 10 in the instruction.

> Is the 32-bit PPC ABI available for download?

It used to be available from ftp.cygnus.com, but I'm not sure that
that is externally accessible any longer.  I can send it to you if you
like.

Ian


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