enoft Manual

TNS/E Native Object Files
eNOFT Manual527507-005
A-15
The MCB (Master Control Block)
The MCB (Master Control Block)
The linker adds the MCB to the .data section of a program (or creates a section of this
name if there was none before). The MCB is a data item that can be referenced by the
name _MCB within the program. The linker only creates the MCB in programs (not
DLL's), and only if the program makes a reference to the symbol named _MCB.
This is a description of the fields that are nonzero in the MCB of an object file.
The Check_quad field is an 8-byte string, where the first two and last two bytes each
contain the value 0xAA and the middle four bytes contain the ASCII string "MCB ".
The Version_item field currently contains 0, but presumably could contain a different
value in the future.
The Standard_C_streams bit is set to 1, rather than 0, to indicate that the program
should use code 180 files for C text files, rather than code 101 files. The linker sets
this bit to 1 when it creates the program if the -ansistreams option is specified or if the
target platform is OSS.
The C_std_files_open bit is set to 1, rather than 0, to indicate that this program should
automatically open the standard C/C++ I/O files. This linker sets this bit to 1 if the
program contains a main procedure that is written in C or C++ and the -nostdfiles
option is not specified.
The FP_format field is set to indicate the floating point type assumed by this program,
repeating the information also found in the file header. 0 indicates that the Tandem
floating point is required. 1 indicates that the IEEE floating point is required. 2 indicates
neutral.
Relocation Tables
It is possible that the contents of one place in the code or data of an object file need to
be filled in with the address of another place in the code or data, or in some other way
based on such an address. If the compiler or assembler knows what needs to go
there, without later modification by the linker or runtime loader, then that's the end of
the story. But, if the linker or runtime loader will need to be involved, the compiler or
assembler must indicate that location accordingly, by creating relocation tables in
linkfiles to provide such information. Similarly, the linker must put relocation tables into
loadfiles if there is still work for the runtime loader to do.
The place that needs to be filled in is called the relocation site. It would either be an
operand within an executable instruction, which come in various sizes, or a data item,
which would be a 32-bit or 64-bit integer. The place whose address needs to be
calculated is called the target of the relocation. The relocation site is also said to be a
reference to the target symbol.
The target of a relocation site is described by giving an offset relative to a symbol that
is listed either in the .symtab section (in the case of a linkfile) or the .dynsym or
.dynsym.gblzd section (in the case of a loadfile). If the symbol is of type STB_LOCAL