Port-vax archive

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

Re: PIC question

Matt Thomas wrote:
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.

Ah! Darn. I had some nagging feeling that there might have been some problem with that.
Its perfectly legal on the PDP-11 though. :-)

        jmp     .Loop[%r5]

Hmm, so deferring won't work, but indexing will? That sounds weird...
Is that some limitation on gas then?

is the right answer.

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

But the first one is simpler.



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