Port-vax archive

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

Re: PIC question



On May 27, 2010, at 4:57 PM, Johnny Billquist wrote:

> Martin Husemann wrote:
>> I'm new to vax asm and have not been fully assimilated, it seems - I have
>> some asm code that is not PIC and so when compiled into a .so dies due
>> to .text relocs. (Linked static it all works)
>> It does kindof Duff's device in asm - there is an unrolled loop starting
>> at .Loop and a jump with offset into the loop is calculated in %r5, then the
>> code does:
>>      jmp     .Loop(%r5)
>> .Loop:       ...
>> This causes a 32bit relocation for the .Loop address inside the
>> indirect jump with offset instructions.
>> What is the pic way to do this? Some trick? There doesn't seem to be a br +
>> register offset instruction.
>> Or along the lines of:
>>      addl2   %pc,%r5
>>      add     .Loop - ., %r5
>>      jmp     (%r5)
>> .Loop:       ...
>> (but the .Loop-. is not accepted by gas)
>> ?
> 
> Maybe a stupid solution, and I'm sure there is a more kosher one, but...
> 
>       addl2   %r5,%pc

Bzzt.  Can't do that to the PC register.

        jmp     .Loop[%r5]

is the right answer.

or      movab   .Loop[%r5], %r5
        jmp     (%r5)

But the first one is simpler.


Home | Main Index | Thread Index | Old Index