[Info-vax] Updated VMS Roadmap

John Reagan johnrreagan at earthlink.net
Fri Jan 8 23:13:23 EST 2010


"Arne Vajhøj" <arne at vajhoej.dk> wrote in message 
news:4b47fb6f$0$282$14726298 at news.sunsite.dk...

>
> Let me reveal my I64 ignorance - what code is the linker
> generating?
>

The linker generates something called a PLT to help with a call into another 
image.

Some background,

- On OpenVMS I64, the GP register (aka R1) contains a pointer to all of the 
address constants/short data on a per-image basis.

- The 'br.call' instruction has a bundled-relative offset for a forward or 
backwards call.

So when the compiler sees a call to a routine outside the module, it doesn't 
know if the target routine will eventually be in the same image or if it 
might be in a sharable image, system service, etc.  The compiler is hopeful 
and generates a simple 'br.call' instruction with a relocation for the 
target routine for the offset.  If the target routine is in the same image, 
the linker can compute the actual relative bundle offset and update the 
'br.call' instruction.  If the target routine is not in the final image, the 
linker generates a 6 instruction sequence that fetches the 64-bit address of 
the target routine as well as establishing a new GP/R1 for the target 
routine.  The linker then sets the 'br.call' to jump to this 
linker-generated routine.  The image activator will then do a fixup on the 
function descriptor used by the linker-generated routine.  The function 
descriptor contains the code address as well as the GP address (it also 
contains some TIE information but that isn't important here).  The Calling 
Standard gives some overview of this process.

The linker can also generate a trampoline routine if the target routine is 
in the final image but is farther away than the 25-bit bundle offset in the 
'br.call' instruction.

The linker can also generate a 'undefined symbol' sequence if the target 
routine is undefined.  It cannot just leave the offset in the 'br.call' as a 
0 since that will just infinite loop doing call after call after call.

It is these sequences that the latest linker will cache and reuse.  Older 
linkers would generate multiple versions of the same 6-instruction sequence. 
The newer linker is also smarter about where this code is placed to reduce 
address space holes.

You can see this code in the debugger if you STEP/INTO at the right places. 
You can also see them with ANAL/IMAGE/SEGMENT=CODE.

Clearer?

John 





More information about the Info-vax mailing list