35
Linking and Accelerating Linking and Accelerating Module 3

Mod03 linking and accelerating

Embed Size (px)

Citation preview

Page 1: Mod03 linking and accelerating

Linking and AcceleratingLinking and AcceleratingModule 3

Page 2: Mod03 linking and accelerating

eld Basic Operationeld Basic OperationInputs◦ Code 800 files

◦ Linkfiles

Outputs◦ Code 800 files

◦ Linkfiles◦ Loadfile◦ Dynamic-link library (DLL)

3 - Linking and Accelerating 2

Page 3: Mod03 linking and accelerating

Linking a Multi-Module C programLinking a Multi-Module C program

◦ C program Guardian environment:

eld –o outfile $system.system.ccplmain inmod1 inmod2 -lcrtl –lcre

OSS from Guardian environment: eld –o outfile –set systype oss $system.system.ccplmain

inmod1 inmod2 -l crtl –l cre

◦ C++ Version 3

eld –o outfile inmod1 inmod2 $system.system.ccplmain-lzcppcdll –lzcpp3dll

3 - Linking and Accelerating 3

Page 4: Mod03 linking and accelerating

Linking a Multi-Module COBOL ProgramLinking a Multi-Module COBOL Program

3 - Linking and Accelerating 4

1> ecobol /in callprog/callo;symbols2> ecobol /in mainprog/maino;symbols3> eld -o myexe callo maino -l cob

ecobol

ecobol

eld

mainprog

callprog callo

maino

myexe

1

2

3

zcobdll

Page 5: Mod03 linking and accelerating

eld and Symbolseld and SymbolsMissing Symbols◦ Unlike nld, eld knows which procedures exist in

system library◦ By default, eld considers it an error if you refer to

a symbol and the symbol does not exist You can change this with the -unres_symbols option: error, warn, ignore

◦ By default, your program cannot run if it refers to a symbol that does not exist. You can change this with the –set rld_unresolved option: error, warn, ignore

3 - Linking and Accelerating 5

Page 6: Mod03 linking and accelerating

Unresolved References — Default BehaviorUnresolved References — Default Behavior 60> eld -o myexe maino -l cob

eld - TNS/E Native Mode Linker - T0608H01^AAG - 26JAN2007

**** INFORMATIONAL MESSAGE **** [1019]:

Using DLL \RUBY.$SYSTEM.zdll002a.zcobdll.

**** INFORMATIONAL MESSAGE **** [1530]:

Using the zimpimp file \RUBY.$SYSTEM.SYS00.ZIMPIMP.

**** ERROR **** [1210]:

maino: In function `CONCEPTS-REQ':maino(.text_1+0x1202): unresolved reference to GET-SECOND-NUMBER.

No output file created.

1 error reported.

No warnings reported.

2 informational messages reported.

3 - Linking and Accelerating 6

Page 7: Mod03 linking and accelerating

Unresolved References — Optional BehaviorUnresolved References — Optional Behavior 61> eld -o myexe maino -l cob -unres_symbols warn

eld - TNS/E Native Mode Linker - T0608H01^AAG - 26JAN2007

**** INFORMATIONAL MESSAGE **** [1019]:

Using DLL \RUBY.$SYSTEM.zdll002a.zcobdll.

**** INFORMATIONAL MESSAGE **** [1530]:

Using the zimpimp file \RUBY.$SYSTEM.SYS00.ZIMPIMP.

**** WARNING **** [1254]:

maino: In function `CONCEPTS-REQ':maino(.text_1+0x1202): unresolved reference to GET-SECOND-NUMBER.

Output file: myexe (program file)

Output file timestamp: Aug 5 12:57:03 2008

No errors reported.

1 warning reported.

2 informational messages reported.

3 - Linking and Accelerating 7

Page 8: Mod03 linking and accelerating

Unresolved References — Optional BehaviorUnresolved References — Optional Behavior

62> run myexe

*** RLD ERROR ***: Unresolved Text Symbol GET-SECOND-NUMBER in file \RUBY.$FC1.TERRYG.MYEXE.

*ERROR* PROCESS_CREATE_ Error: 74

63>

3 - Linking and Accelerating 8

Page 9: Mod03 linking and accelerating

Unresolved References — Additional OptionUnresolved References — Additional Option 63> eld -o myexe maino -l cob -unres_symbols warn -set rld_unresolved

warn eld - TNS/E Native Mode Linker - T0608H01^AAG - 26JAN2007

**** INFORMATIONAL MESSAGE **** [1019]:

Using DLL \RUBY.$SYSTEM.zdll002a.zcobdll.

**** INFORMATIONAL MESSAGE **** [1530]:

Using the zimpimp file \RUBY.$SYSTEM.SYS00.ZIMPIMP.

**** WARNING **** [1254]:

maino: In function `CONCEPTS-REQ':maino(.text_1+0x1202): unresolved reference to GET-SECOND-NUMBER.

Output file: myexe (program file)

Output file timestamp: Aug 5 12:57:50 2008

No errors reported.

1 warning reported.

2 informational messages reported.

3 - Linking and Accelerating 9

Page 10: Mod03 linking and accelerating

Unresolved References — Additional OptionUnresolved References — Additional Option

64> run myexe *** RLD WARNING ***: Unresolved Text Symbol GET-SECOND-NUMBER in

file \RUBY.$FC1.TERRYG.MYEXE.

Undefined externals YOU HAVE JUST STARTED THE PROCESS.

ENTER FIRST NUMBER (max. 3 digits) [or 0 to stop]: ?12 \RUBY.$:1:956:4925776 - *** Run-time Error 003 *** \RUBY.$:1:956:4925776 - Instruction failure \RUBY.$:1:956:4925776 - From --- \RUBY.$:1:956:4925776 - UNRESOLVED_PROCEDURE_CALLED_ + 0x2 (SLr) \RUBY.$:1:956:4925776 - CONCEPTS-REQ + 0x1210 (UCr) ABENDED: 1,956 CPU time: 0:00:00.004 3: Premature process termination with fatal errors or diagnostics 65>

3 - Linking and Accelerating 10

Page 11: Mod03 linking and accelerating

Creating a DLLCreating a DLL

eld inmod1 inmod2 -dll -dllname dllfilename [–set floattype neutral] [-set cppdialect cppneutral] –export_all

3 - Linking and Accelerating 11

Page 12: Mod03 linking and accelerating

Changing Object AttributesChanging Object Attributes

Updates existing code 800 file: eld –change <attribute> <value> <filename>

◦ Example: eld –change inspect off myprog

3 - Linking and Accelerating 12

Page 13: Mod03 linking and accelerating

PublicPublic Libraries (from SRL to DLL)Libraries (from SRL to DLL)◦ All NonStop H-series libraries are packaged as DLLs rather

than SRLs - SRLs are not supported on TNS/E systems

◦ The TNS/E libraries have different names - Change build procedures that specifically refer to the libraries

Library TNS/R TNS/E*

COBOL run-time library COBSRL ZCOBDLLCommon Run-time Environment (CRE) ZCRESRL ZCREDLLC run-time library ZCRTSRL ZCREDLL

C++ VERSION1 ZCPLGSRL Not supported

C++ VERSION2 ZCPLSRL + ZRWSLSRL

ZCPPCDLL + ZCPP2DLL

Tools.H++ 7.0 ZTLHSRL ZTLH7DLLC++ VERSION3 (ANSI/ISO Standard)

ZSTDSRL ZCPPCDLL + ZCPP3DLL

133 - Linking and Accelerating

Page 14: Mod03 linking and accelerating

Examining an Object FileExamining an Object File◦ New tool — enoft

◦ Many commands identical to noft listproc, listsource, listcompilers, listattribute,

listoptimize, listunresolved, dumpproc, and so forth

◦ Some commands changed listsrlinfo -> liblist set out -> log

3 - Linking and Accelerating 14

Page 15: Mod03 linking and accelerating

enoft Examplesenoft Examples 34> enoft

TNS/E Native Object File Tool [T2823 - Jul 9 2008]

enoft> file cobex

Object File: \RUBY.$FC1.TGTNSE.cobex

Format Type: ELF64-bit, Big_Endian, IA64, PIC_Program (loadfile)

enoft> listproc *

******** List of Procedures

UwNdx Proc_Addr Proc_Name

-----------------------------------------------------------------

0 0x700008c0 #import_stubs

1 0x70000a40 CALCULATOR

2 0x700027c0 __INIT__0_CALCULATOR_

3 0x70002900 __INIT__1_CALCULATOR_

4 0x70002a40 GET-SECOND-NUMBER

5 0x700035c0 __INIT__0_GET-SECOND-NUMBER_

6 0x70003700 #end_of_code

3 - Linking and Accelerating 15

Page 16: Mod03 linking and accelerating

enoft Examplesenoft Examples enoft> la ******** List of Common File Attributes Name: \RUBY.$FC1.TGTNSE.cobex File Format: ELF64-bit, Big_Endian, IA64 Type: PIC_Program (loadfile) Debugging Symbols: Yes Float-Point Type: NEUTRAL_FLOAT ----------------------------------------------------------------- Float-overrule: No System Type: Guardian Creation Timestamp: 2008-11-11 08:57:35 Process Subtype: 0 Highrequestors: Yes Runnamed: No Highpin: Yes Saveabend: No PRIV or CALLABLE Main: No CALLABLE Procs: No Default Debugger: Visual Inspect Languages and Dialects: Asm Cobol Ptal C Instrumented File: No

3 - Linking and Accelerating 16

Page 17: Mod03 linking and accelerating

enoft Examplesenoft Examples enoft> ls * detail ******** List of Source Files (Compilation Units)

Source: 0 \RUBY.$FC1.TGTNSE.MAINCOB Compiler: Cobol85 Descript: HP TNS/E COBOL T0356H01_01AUG2008_20JUL2008_AAU +

T1246H01_01AUG2008_1 8JUL2008_PRODUCT_AAM_GRD_E_10_1 Compiled: 2008-11-11 08:57:29 (TimeStamp at Compile site) File: 1 \RUBY.$FC1.TGTNSE.MAINCOB Time: 2008-11-11 08:56:50 Size: 1718

Source: 1 \RUBY.$FC1.TGTNSE.CALLCOB Compiler: Cobol85 Descript: HP TNS/E COBOL T0356H01_01AUG2008_20JUL2008_AAU +

T1246H01_01AUG2008_1 8JUL2008_PRODUCT_AAM_GRD_E_10_1 Compiled: 2008-11-11 08:57:19 (TimeStamp at Compile site) File: 1 \RUBY.$FC1.TGTNSE.CALLCOB Time: 2008-11-11 08:57:11 Size: 1154

3 - Linking and Accelerating 17

Page 18: Mod03 linking and accelerating

enoft Examplesenoft Examples enoft> lu *

******** List of Unresolved (undefined) Symbols

SymNdx Symbol_Name

-----------------------------------------------------------------

30 COBLIB_ACCEPT_

31 _SharedMilli_MOVB_FWD_NOOVERLAP

32 COBLIB_INITIALIZER_

35 COBLIB_ABEND_

37 COBLIB_DISPLAY_

38 COBLIB_INITIALIZATION_COMPLETE_

43 COBLIB_ERROR_

48 _SharedMilli_CQA

49 COBLIB_INIT_PROG_

51 COBLIB_STOP_

52 COBLIB_COMP_ALL_1_

Number of symbols matching scope: 11

3 - Linking and Accelerating 18

Page 19: Mod03 linking and accelerating

Object Code Accelerator (OCA)Object Code Accelerator (OCA)

◦ Operates on Guardian-based code 100 files May already be TNS/R accelerated◦ Adds Itanium Processor Family (IPF) instructions

Adds calls to millicode routines

◦ Uses symbols region, if present Produces more efficient code Can strip after acceleration

◦ Controllable by Binder options◦ Use SQLCOMP after acceleration

3 - Linking and Accelerating 19

Page 20: Mod03 linking and accelerating

OCA Items to Watch forOCA Items to Watch for◦ Disabled overflow traps

Should test for overflow using $OVERFLOW or ONSIZE

◦ Trap handlers Register contents are not precise

◦ P-relative addresses Cannot be passed as parameters in UC

◦ References to system global data Instruction Failure exception

◦ Odd-byte references Various behaviors

◦ Single-word shift statements with dynamic shift count Shift count > 31 gives undefined result

◦ May affect debugging ability3 - Linking and Accelerating 20

Page 21: Mod03 linking and accelerating

Object Code Accelerator — ExampleObject Code Accelerator — Example

3 - Linking and Accelerating 21

6> oca OCA - T0448H01 - 01MAY05 - (May 28 2008 15:55:33)Copyright Hewlett-Packard, 1988-2005 OCA Syntax Summary oca [/run-options/] input-file [; option-list ] input-file is the name of a fully bound, runnable, type-100 TNS code file. option-list is one or more command line options: [ { SL } { UL } { OUTPUT_FILE output-file } { IGNORE_IRn proc-name } { INHERITSRn proc-name } { IGNORE_CC proc-name } { INHERITSCC proc-name } { OBEY obey-file-name } { SYNC code-seg tnsp } [ , ... ] ]

Page 22: Mod03 linking and accelerating

Object Code Accelerator — ExampleObject Code Accelerator — Example

TALEX 100 15496 11NOV2008 7:57 34,26 OOOO 14 14

26> oca talex OCA - T0448H01 - 01MAY05 - (May 28 2008 15:55:33) Copyright Hewlett-Packard, 1988-2005

Option summary: No options

262 TNS instruction words; 524 bytes 445 Itanium bundles; 7120 bytes 13.59 inline code expansion factor 1.70 Itanium bundles per TNS instruction TNS file name: talex Binder region present Symbols region present Mips region not present Accelerated as User Code segment 0 through 0 0 Errors were detected 0 Warnings were issued Accelerated file name: talex Accelerated for TNS/E on Nov 11 2008 07:58:15 Acceleration completed on Nov 11 2008 07:58:15 CPU Time 0:00:00.050

TALEX 100 30720 11NOV2008 7:58 34,26 OOOO 56 56

3 - Linking and Accelerating 22

Page 23: Mod03 linking and accelerating

Determining If Program Accelerated Determining If Program Accelerated 23> fileinfo obj*

$FC1.TERRYG

CODE EOF LAST MODIFIED OWNER RWEP

OBJC 100 12282 08AUG2008 12:32 34,26 OOOO

OBJCE 100 28672 08AUG2008 12:34 34,26 OOOO

OBJCR 100 24576 08AUG2008 12:33 34,26 OOOO

OBJCRE 100 40960 08AUG2008 12:35 34,26 OOOO

24> vproc objc VPROC - T9617H01 - (01 OCT 2004) SYSTEM \RUBY Date 08 AUG 2008, 12:37:03

$FC1.TERRYG.OBJC

Binder timestamp: 08AUG2008 12:32:44

Version procedure: >> NO T9xxx PROC <<

Target CPU: UNSPECIFIED

3 - Linking and Accelerating 23

Not accelerated

Page 24: Mod03 linking and accelerating

Determining If Program Accelerated Determining If Program Accelerated

25> vproc objce VPROC - T9617H01 - (01 OCT 2004) SYSTEM \RUBY Date 08 AUG 2008, 12:37:27

$FC1.TERRYG.OBJCE

Binder timestamp: 08AUG2008 12:32:44

Version procedure: >> NO T9xxx PROC <<

Target CPU: UNSPECIFIED

OCA timestamp: 08AUG2008 12:34:51

26> vproc objcre VPROC - T9617H01 - (01 OCT 2004) SYSTEM \RUBY Date 08 AUG 2008, 12:38:10

$FC1.TERRYG.OBJCRE

Binder timestamp: 08AUG2008 12:32:44

Version procedure: >> NO T9xxx PROC <<

Target CPU: UNSPECIFIED

AXCEL timestamp: 08AUG2008 12:33:28

OCA timestamp: 08AUG2008 12:35:15

3 - Linking and Accelerating 24

TNS/R acceleratedTNS/E accelerated

TNS/E accelerated

Page 25: Mod03 linking and accelerating

BINDER – Disabling AccelerationBINDER – Disabling Acceleration◦ Display current setting:

SHOW OCA ENABLE FROM <file-name> ◦ Control whether program can be accelerated:

CHANGE OCA ENABLE ON|OFF IN <file-name> 6> bind BINDER - OBJECT FILE BINDER - T9621H01 SYSTEM

\RUBY @change oca enable off in objc @exit 7> oca objc output_file objce OCA - T0448H01 - 01MAY05 - (Mar 19 2007 14:40:27) *** Error 9: Translation of file objc is inhibited.

◦ Strip accelerated region: STRIP <file-name>, IPF

3 - Linking and Accelerating 25

Page 26: Mod03 linking and accelerating

TNSVU TNSVU —— Accelerated Object ExaminerAccelerated Object Examiner

3 - Linking and Accelerating 26

28> tnsvu talexTNSVU - May 28 2008 16:13:21Copyright Hewlett-Packard, 2000-2005Viewing on Tue Nov 11 08:01:05 2008

Opened file talextalex>

Page 27: Mod03 linking and accelerating

TNSVU HelpTNSVU Help

3 - Linking and Accelerating 27

talex> help

TNSVU Command SummaryCommands are not case-sensitive; file and procedure names are.More information is available using "HELP command-name".

LOG - Opens a text file in which TNSVU records all textLOGAPPEND written to the screen (including typed commands).ENDLOG - Closes a log file.OPEN - Opens a type-100 TNS object file for viewing.FILEINFO - Displays general information about the open file.PROCINFO - Displays general information about a procedure.PROCS - Displays the names of procedures in the object fileLOCAL - Displays the names of local millicode routinesMILLICODE - Displays the names of emulation and shared millicode routines.EXTERNALS - Displays the names of external (system or user) library routines.ICODE - Displays Itanium and TNS instructions.HISTORY - Displays previously-issued commands.

Page 28: Mod03 linking and accelerating

TNSVU HelpTNSVU Help TNSHEADER - Displays the TNS file header. OCAHEADER - Displays the Itanium region header. AXCELHEADER - Displays the Axcel region header. DUMPPMAPS - Displays Pmaps. OPTIONS - Displays translation options. TNStoIPF - Converts TNS address to Itanium. IPFtoTNS - Converts Itanium address to TNS. XEP - Displays proc targets of XEP entries. VERSION - Displays the OCAVersion field of the OCAHeader. EXACTPTS - Displays the exact points in the given procedure. OBEY - Reads TNSVU commands from the given text file. LIMIT - Overrides limit on # of TNS instrs printed by

'ICODE procname'. COMPARE - Compare IPF code from the current file

with the given file. LINENUMTOTNS - Converts a source line number to a TNS code location. TNSTOLINENUM - Converts a TNS code location to a source line number. SOURCESUBVOL - Display source from files in the given subvol. SOURCE OFF - Turn off source code display. SOURCE ON - Turn on source code display (on by default).

3 - Linking and Accelerating 28

Page 29: Mod03 linking and accelerating

TNSVU Example — FILEINFOTNSVU Example — FILEINFO

3 - Linking and Accelerating 29

talex> fileinfo

Examining file talexOccupies code segment 0 through 0 in User Code space 0x1bd Itanium bundlesTranslated on Nov 11 2008 07:58:15 using an OCA built on May 28 2008 15:55:33

Accelerator region: 0x0 for 0x0 bytesItanium region: 0x4000 for 0x3008 bytesSymbols region: 0x2000 for 0xb12 bytesBinder region: 0x2c00 for 0x1088 bytes

talex>

Page 30: Mod03 linking and accelerating

TNSVU Example — PROCSTNSVU Example — PROCS

3 - Linking and Accelerating 30

talex> procs

Procedures: DISPLAY_INITIAL_REQ_MESSAGE CSEG 0 PEP# 02 TNS Base: 05 TNS Size: 071 TNS Entry: 05 Itanium code: 0x70420480 Itanium bundles: 0x3a Itanium entry: 0x70420480 Implemented in TAL in source file \RUBY.$FC1.TGTNSE.MAINP line 36.0 to 44.0

GET_SECOND_NUMBER CSEG 0 PEP# 04 TNS Base: 0345 TNS Size: 0154 TNS Entry: 0345 Itanium code: 0x70421500 Itanium bundles: 0x6d Itanium entry: 0x70421500 Implemented in TAL in source file \RUBY.$FC1.TGTNSE.CALLP line 10.0 to 27.0

MAIN_PROG CSEG 0 PEP# 03 TNS Base: 076 TNS Size: 0247 TNS Entry: 076 Itanium code: 0x70420820 Itanium bundles: 0xce Itanium entry: 0x70420820 Implemented in TAL in source file \RUBY.$FC1.TGTNSE.MAINP line 46.0 to 84.0

talex>

Page 31: Mod03 linking and accelerating

TNSVU Example — LOCALTNSVU Example — LOCAL

3 - Linking and Accelerating 31

talex> local

Local millicode routines: Entry: 0x70420090 NumBundles: 0x4 0 _LocalMilli_RPMispredicted Entry: 0x704200d0 NumBundles: 0x4 0 _LocalMilli_ToOCI Entry: 0x70420110 NumBundles: 0xe 0 _LocalMilli_EXIT Entry: 0x704201f0 NumBundles: 0x6 0 _LocalMilli_MapTNStoIPF_Calc Entry: 0x70420250 NumBundles: 0x8 0 _LocalMilli_MapTNStoIPF Entry: 0x704202d0 NumBundles: 0x4 0 _LocalMilli_BTST Entry: 0x70420310 NumBundles: 0x2 0 _LocalMilli_TNSArithOverflow Entry: 0x70420330 NumBundles: 0x4 0 _LocalMilli_64bitAddArithOv Entry: 0x70420370 NumBundles: 0x8 0 _LocalMilli_QMPY Entry: 0x70420000 NumBundles: 0x3 0 _LocalMilli_OCATraceEnter Entry: 0x70420030 NumBundles: 0x3 0 _LocalMilli_OCATraceExit Entry: 0x70420060 NumBundles: 0x3 0 _LocalMilli_OCATracePmapJump Entry: 0x704203f0 NumBundles: 0x9 0 _LocalMilli_CallSharedMilli

talex>

Page 32: Mod03 linking and accelerating

TNSVU Example — EXTERNALSTNSVU Example — EXTERNALS

3 - Linking and Accelerating 32

talex> externals

Library procedures external to this code space

WRITEREAD WRITE STOP PROCESS_GETINFO_ PROCESS_DEBUG_ NUMOUT NUMIN INITIALIZER FILE_OPEN_ FILE_GETINFO_ FILE_CLOSE_

talex>

Page 33: Mod03 linking and accelerating

TNSVU Example — ICODETNSVU Example — ICODE

3 - Linking and Accelerating 33

icode DISPLAY_INITIAL_REQ_MESSAGEFC>Procedure DISPLAY_INITIAL_REQ_MESSAGE (from source file \RUBY.$FC1.TGTNSE.MAINP)

Itanium virtual address 0x70420480 for 0x3a Itanium bundlesCSEG 0 TNS offset 05 for 071 TNS instructions...37.0 write_count := @p '-' @s;

016: 0x70420570: LADR G+0106,I { LADR G+0105,I + ld2 r46 = [r35] LSUB ld2 r45 = [r34] STOR G+0102 nop.i 00h ;; } { sub r45 = r45, r46 adds r46 = 01ah, r0 nop.i 00h ;; } { nop.m 00h zxt2 r45 = r45 ;; nop.i 00h }

Page 34: Mod03 linking and accelerating

Questions ?Questions ?

34

Page 35: Mod03 linking and accelerating

3 - Linking and Accelerating 35