PLD - dumping LD files.

The PLD program displays the contents of an LD object file or library in a human-readable format. For more about the LD object format, see "expl ld manual".

The output of PLD displays all the directives in the file, giving the name of the directive and any data associated with it. For example, a typical line of PLD output (on the Bull HN DPS-8 machine) might be

LD_ALIGN seg 13 to 36

This output results from an LD_ALIGN directive that aligns segment 13 to a 36-bit boundary.

At various points in the output, you will see the notation

@ NNN

where NNN is a decimal integer. This indicates that PLD has reached byte NNN in the input file. For example, you might see

LC_FILENAME myprog  @ 193

This says that the LC_FILENAME directive ended at byte 193 of the input file. If the @NNN is seen at the beginning of a directive, it means that the directive began at the given byte. These numbers make it easier to match up PLD output with an octal/hex dump of the LD file, if that becomes necessary.

Refs

If a directive implicitly assigns a reference number (SEGREF, TREF, VLREF) to something, the reference number which is taken will be shown in the left hand margin of the PLD output. For example, the LD_CRSEG directive creates a named segment and automatically assigns that segment a SEGREF. Thus you might see

10   LD_CRSEG named ..code, parent 2 (local)

in PLD output. This means that the LD_CRSEG created a local segment named "..code". The parent segment had SEGREF 2. The "..code" segment created here has been implicitly assigned a SEGREF of 10, as shown in the left hand margin.

Reference numbers of this kind are always shown as decimal integers.

LD_DATA/LD_RELOC Pairs

LD_DATA directives are displayed with the heading

LD_DATA (@  NNN) :

to show where the LD_DATA directive begins. After this, you will see one or more rows of the TWORD values that were in the LD_DATA directive. These values can be dumped in octal or hex. Octal is the default, but you can specify "+Hexadecimal" on the PLD command line to get a hex dump. There are a maximum of eight TWORDs in each row, separated by spaces.

After the dump of the LD_DATA directive comes the dump of LD_RELOC. This consists of a list of relocation triplets of the form

(tDDD wOOOsDDD)

where

tDDD
gives the relocation code. DDD is a decimal number, associated with one of the relocation codes supported for the target machine.
wOOO
says that this relocation triplet should be applied to TWORD OOO in the preceding LD_DATA directive. OOO is an octal number; following the standard C convention, this will always have a leading zero. Since there are eight TWORDs in each row of the LD_DATA dump, the octal number makes it easy to locate the appropriate TWORD. For example, "w00" is the TWORD in the first column of the first row. "w010" is the TWORD in the first column of the second row. "w037" is the TWORD in the last column of the fourth row.
sDDD
gives the SEGREF of the segment involved in the relocation.

As an example, consider the relocation

(t0 w0s13)

The relocation code is 0 (ORIGIN_RELOC). Thus this relocation triplet says that TWORD 0 of the preceding LD_DATA directive contains an offset into the segment with SEGREF 13. The loading process will begin to lay down data beginning at the given offset in the appropriate segment.

Conclusion

This has been a very quick introduction to PLD. The best way to understand PLD output is to compile a simple C program using the +Keep option, and then to run PLD on the LD file that is produced. PLD output is relatively easy to understand once you understand the LD object format.

See Also:

expl ld manual

Copyright © 1996, Thinkage Ltd.