This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: bfd_get_relocated_section_contents on hppa and ia64
- From: Nick Clifton <nickc at redhat dot com>
- To: Camm Maguire <camm at maguirefamily dot org>
- Cc: binutils at sourceware dot org, gcl-devel at gnu dot org
- Date: Tue, 26 Oct 2010 11:36:36 +0100
- Subject: Re: bfd_get_relocated_section_contents on hppa and ia64
- References: <E1NaaJq-0006Ia-OP@localhost.m.enhanced.com> <4B62BD4E.50208@redhat.com> <871vh4lg2m.fsf@maguirefamily.org> <4B67F17B.5080703@redhat.com> <87eiiim2ux.fsf@maguirefamily.org> <4BC742A8.70602@redhat.com> <878w8fpo0b.fsf@maguirefamily.org> <4BD06453.2020204@redhat.com> <87bpdacm43.fsf@maguirefamily.org> <4BD6D662.6070306@redhat.com> <87r5lzr7dt.fsf@maguirefamily.org> <4BD84FA8.20509@redhat.com> <877hnql12l.fsf@maguirefamily.org> <4BDADE6A.9010802@redhat.com> <877hharx9n.fsf@maguirefamily.org>
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