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: bfd_get_relocated_section_contents on hppa and ia64


Hi Camm,

Greetings!  I can't seem to find documentation anywhere on the sparc64
R_SPARC_OLO10 reloc, sometimes reported as a R_SPARC_LO10 and a
R_SPARC_13.

I think that R_SPARC_0LO10 and R_SPARC_LO10 are subtly different...


I know there is a special addend encoded in the reloc
type.  Can you explain to me or point out to me how this reloc is
supposed to work?

I am not a Sparc expert, but I will give it a go. I could not find any actual documentation on Sparc relocs, so I have resorted to looking in the sources. In gas/doc/c-sparc.texi it says:


  "When assembling for 64-bit, and a secondary constant
   addend is specified in an address expression that would
   normally generate an R_SPARC_LO10 relocation, the
   assembler will emit an R_SPARC_OLO10 instead."

So I think that R_SPARC_OLO10 is a slight variation on the R_SPARC_LO10 reloc. Looking in bfd/elfxx-sparc.c:_bfd_sparc_elf_relocate_section() I see that the reloc is implemented as:

x = (x & ~(bfd_vma) 0x1fff) | (relocation & 0x1fff);

Ie it clears the bottom 13 bits of the instruction and then inserts the value of the relocation into those bits. (I assume that this relocation is being applied to a Sparc bitwise logical instruction which has a signed immediate value in its bottom 13 bits).

This seems to be very similar to the R_SPARC_LO10 relocation, except that that one appears to affect only the bottom 10 bits of the instruction.

There is one other interesting point. In the _bfd_sparc_elf_howto_table in elfxx-sparc.c the implementation of the R_SPARC_OLO10 reloc is assigned to the sparc_elf_notsup_reloc() function. Thus it may be that it is a deprecated reloc that should no longer be used.

Cheers
  Nick



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