Port-vax archive

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

Re: PIC question



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

should do the trick. :-)

        Johnny

--
Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt%softjar.se@localhost             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


Home | Main Index | Thread Index | Old Index