HP 3000 Manuals

HP Link Editor/iX Enhancements [ COMMUNICATOR 3000 MPE/iX General Release 5.0 (Core Software Release C.50.00) ] MPE/iX Communicators


COMMUNICATOR 3000 MPE/iX General Release 5.0 (Core Software Release C.50.00)

HP Link Editor/iX Enhancements 

by Doreen Kawanishi 
Computer Languages Operation 

Shared Globals 

With the release of HP Link Editor/iX A.05.00, global data is now
sharable between program files and XLs, and between XLs and other XLs.
The default behavior remains linking for shared code only.

Syntax 

     ;SHARE

or

setvar LKSHAREDATA {TRUE }
                   {FALSE}
The ;SHARE option is valid with the LINK and ADDXL commands.  If
specified, data is sharable outside its compilation unit in the resulting
program file or XL. LKSHAREDATA set to TRUE has the same behavior as if
the ;SHARE option was specified.  LKSHAREDATA set to FALSE or not set
means that all subsequent linking is for shared code only unless the
;SHARE option is used.

To link C/iX object files for shared data, you must specify one of the
following libraries:

     RL=LIBCSHR.LIB.SYS      (recommended) 

     RL=LIBCINIT.LIB.SYS     (not recommended) 

     RL=LIBC.LIB.SYS         (not recommended) 

As an C/iX user, if you do not link with one of the above libraries, you
get an unsatisfied symbol error at link time and your program will not
link.

The LIBCSHR library is the preferred library because it defines the
minimal number of symbols a C application needs to link successfully for
sharing data.  The LIBC.LIB.SYS library contains many definitions that C
applications linked for shared data do not need.  The LIBCINIT library is
the same as in previous releases; if you link with this library, you are
not taking advantage of shared global data.

Refer to the article, "HP C/iX Enhancements for MPE/iX 5.0," in Chapter 6
of this Communicator for more information on the LIBCSHR library.

POSIX Links 

c89 always links POSIX applications for shared data.  If you link with
/lib/libc.a, you must link shared.

Global Data Limit 

There is a limit on the number of data references a program file can have
and on the number of modules in an XL. This limit is set at approximately
2,000 data references.  If a program file or module in an XL exceeds this
limit, the Link Editor emits error message 3060.  (Refer to the "New
Language Subsystem Error Message" section in this article.)

You can recompile with the 3-instruction option to increase the limit.
Refer to the HP Link Editor/iX Technical Addendum (32650-09476) for
detailed information on the 3-instruction option.

To find out how many data references a program file or module in an XL
has, you can use the LISTPROG command with the ;DATA and ;VALUE options
or the LISTXL command with the ;DATA and ;VALUE options.  The number of
Data Unsats listed is the number of data references.

The compilers that support the 3-instruction option/pragma are:

----------------------------------------------------
|                       |                          |
|       Compiler        |      Option/Pragma       |
|                       |                          |
----------------------------------------------------
|                       |                          |
| HP Pascal/iX          | $MORE_GLOBALS ON$        |
|                       |                          |
----------------------------------------------------
|                       |                          |
| HP C/iX               | +k                       |
|                       |                          |
----------------------------------------------------
|                       |                          |
| HP COBOL/iX           | $CONTROL MOREGLOBALS     |
|                       |                          |
----------------------------------------------------

If an application needs to be recompiled and the compiler does not
support one of the new compiler options, the application can be
restructured to have fewer global data references or the application can
be linked without specifying the ;SHARE option.

New Options 

New options were added to various Link Editor commands to facilitate
processing shared global data.  Listed below are the commands and the new
options.

ADDXL [;DATA=data_name]      Add a module that exports the specified Data
                             Universal.  If ;REPLACE is also specified,
                             replace the module that exports the
                             specified Data Universal.

COPYXL [;DATA=data_name]     Copy a module that exports the specified
                             Data Universal.

HIDERL [;ALL_DATA]           Mark all Data and Storage Universals in the
                             RL as hidden.

[;DATA=data_name]            Mark the specified Data or Storage Universal
                             in the RL as hidden.

LISTXL                       List modules that export the specified Data
[;DATA_ITEM=data_name...]    Universal or Storage Universal.

PURGEXL [;DATA=data_name]    Purge a module that exports the specified
                             Data Universal.

REVEALRL [;ALL_DATA]         Unmark all Data and Storage Universals in
                             the RL.

[;DATA=data_name]            Unmark the Data or Storage Universal in the
                             RL.

Compatibility 

Shared global data program files and XLs are not backwards compatible and
do not run on older operating systems.  To determine if a program file or
XL has been linked for shared data, you can use the LISTPROG or LISTXL
command on a 5.0 or later system.  In the listing output, if SHARED DATA
is set to YES, the executable contains shared data.

Program files and XLs compiled with the 3-instruction load and store
sequence are not backwards compatible, even if they do not share data.

Existing program files and XLs continue to run on a system that supports
shared global data.  The exceptions are POSIX applications:  any POSIX
application that contains an indirect or direct reference to __file needs
to be recompiled.  Similarly, any POSIX application containing these two
header files needs to be recompiled:

     <stdio.h>
     <direct.h>

Shared global data is not supported with compatibility mode files.

Impact 

POSIX applications are impacted as stated in the section above.  Any
linking with the new Link Editor that links with LIBCSHR.LIB.SYS, or
/lib/libc.a for POSIX users, must link for shared data.

New User Error Message 

1167         MESSAGE    Message Expected NMXL file.  File "!" is a CM
                      file (LINKERR 1167)

           CAUSE      The Link Editor encountered a compatibility mode
                      file when linking and shared data was enabled.

           ACTION     Make sure LKSHAREDATA is unset or set to FALSE 
                      before attempting to link with compatibility mode
                      files.

New Warning Message 

The following warning messages have been added to HP Link Editor/iX.

1562         MESSAGE    SYMBOL "!" IS HIDDEN/NOT HIDDEN IN DIFFERENT
                      MODULES.  HIDING IT (LINKWARN 1562)

           CAUSE      The Link Editor encountered a hidden and non-hidden
                      version of the same symbol during the link.

           ACTION     Make sure all definitions in the object modules you
                      are linking with are hidden or make sure that all
                      definitions are not hidden.  A mismatch of hidden
                      and unhidden symbols causes the Link Editor to hide
                      all occurrences it sees.

New Language Subsystem Error Message 

3060         MESSAGE    REFERENCE TO "!" IN FILE "!" NEEDS 3-INSTRUCTION
                      SEQUENCE -- USE +k OR $MORE_GLOBALS$ TO RECOMPILE
                      (LINKERR 3060)

           CAUSE      DXRT limit of approximately 2k was hit.  There are
                      too many data imports and/or too many imports
                      requiring multiple DXRT slots.

           ACTION     Recompile with the +k option or $MORE_GLOBALS$
                      pragma to compile for 3-instruction load and store
                      sequences.  The DXRT can be bigger than 2k because
                      far away slots can be reached by using the extra
                      instruction generated.



MPE/iX Communicators