Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Programming Guide

Linkages

On z/OS, there are two crucial facts about linkages:

For a traditional PL/I application where all parameters are byaddr, the differences between the code generated when a function has the default linkage and when it has the system linkage would usually not matter. But if the parameters are byvalue (as they usually are in C and JAVA), the differences can break your code.

In fact, there is only a small difference if the parameters are byaddr. In Figure 80, the only difference between the code generated for a function with the default linkage and for one with the system linkage is that the high-order bit is turned on for the last parameter of the system linkage call.

This difference would be transparent to most programs.

Figure 80. Code when parameters are BYADDR
      dcl dftv  ext entry( fixed bin(31) byaddr
                          ,fixed bin(31) byaddr );
      dcl sysv  ext entry( fixed bin(31) byaddr
                          ,fixed bin(31) byaddr )
                 options( linkage(system) );

      *      call dfta( n, m );
      *
                LA    r0,M(,r13,172)
                LA    r2,N(,r13,168)
                L     r15,=V(DFTV)(,r3,126)
                LA    r1,#MX_TEMP1(,r13,152)
                ST    r2,#MX_TEMP1(,r13,152)
                ST    r0,#MX_TEMP1(,r13,156)
                BALR  r14,r15
      *
      *      call sysa( n, m );
      *
                LA    r0,M(,r13,172)
                LA    r2,N(,r13,168)
                O     r0,=X'80000000'
                L     r15,=V(SYSV)(,r3,130)
                LA    r1,#MX_TEMP1(,r13,152)
                ST    r2,#MX_TEMP1(,r13,152)
                ST    r0,#MX_TEMP1(,r13,156)
                BALR  r14,r15

But, there is a big difference if the parameters are byvalue rather than byaddr. In Figure 81, for the function with the default linkage, register 1 points to the values of the integers passed, while for the function with the system linkage, register 1 points to the addresses of those values.

This difference would not be transparent to most programs.

Figure 81. Code when parameters are BYVALUE
      dcl dftv  ext entry( fixed bin(31) byvalue
                          ,fixed bin(31) byvalue );
      dcl sysv  ext entry( fixed bin(31) byvalue
                          ,fixed bin(31) byvalue )
                 options( linkage(system) );

      *      call dftv( n, m );
      *
                L     r2,N(,r13,168)
                L     r0,M(,r13,172)
                L     r15,=V(DFTV)(,r3,174)
                LA    r1,#MX_TEMP1(,r13,152)
                ST    r2,#MX_TEMP1(,r13,152)
                ST    r0,#MX_TEMP1(,r13,156)
                BALR  r14,r15
      *
      *      call sysv( n, m );
      *
                L     r1,N(,r13,168)
                L     r0,M(,r13,172)
                ST    r0,#wtemp_1(,r13,176)
                LA    r0,#wtemp_1(,r13,176)
                ST    r1,#wtemp_2(,r13,180)
                LA    r2,#wtemp_2(,r13,180)
                O     r0,=X'80000000'
                L     r15,=V(SYSV)(,r3,178)
                LA    r1,#MX_TEMP1(,r13,152)
                ST    r2,#MX_TEMP1(,r13,152)
                ST    r0,#MX_TEMP1(,r13,156)
                BALR  r14,r15

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)