[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[oc] Problem with pc-relative relocation!




Hi!

I have might have found a problem with pc-relative relocation. I have
a bit of code that looks like this;

        .global ___main
___main:
_L2:
        h.jalr          r11
        h.nop

        .align 8
        .global _main
_main:
        l.addi32s       r1,r1,-20
        l.stor32        -4(r1),r6       ; general register pushed on
stack
        l.stor32        0(r1),r7        ; general register pushed on
stack
        l.stor32        4(r1),r8        ; general register pushed on
stack
        l.stor32        8(r1),r11       ; general register pushed on
stack
        l.stor32        12(r1),r16      ; general register pushed on
stack
        l.jal           ___main
        h.nop                   	; nop delay slot
        ...

The assembler (with help of ld) generates this relocated code:

  ...   ...........     ...
  20:   04 00 ff f8     l.jal fff8 <__DTOR_END__+0xff60>
  ...   ...........     ...

Really, this seems very odd, since it will jump to offset 0x4 (not 0x0
as
it should). Output from 'nm':

00000000 T ___main
00000008 T _main

Have anyone seen this problem before?  Or have I just f**ked-up my
version
of the binutils?

-- 
Johan Rydberg			johan.rydberg@netinsight.net
Net Insight AB, Sweden		direct: +46-8-685 04 17
http://www.netinsight.net	phone:  +46-8-685 04 00
				fax:    +46-8-685 04 20