Table of Contents

Advertisement

TNS/E Native Object Files
exported from its loadfile, it might also be found in the ELF symbol table of a linkfile, or
the dynamic symbol table of a loadfile or import library.

User Data

The .data (and .sdata) sections are for initialized data, while .bss (and .sbss) are for
uninitialized data. However, if a data item is initialized to all zeros, the compiler may
treat it as uninitialized data. That is possible, because all uninitialized data is
automatically initialized to zeroes by the HP NonStop operating system.
When the linker combines a set of linkfiles into a new file it usually concatenates each
of the user's data sections from the various input files into a section of the same name
in the output file. For example, some of the input files may have a section named
.data, and then the output file would also have a section named .data, and it would be
the concatenation of the .data sections that existed in the input files. The names of
typical user data sections, and what each one means, were listed near the beginning of
this document. Like text sections, sizes of data sections must be multiples of 16 bytes.
The exception to the general rule given in the previous paragraph is that, if an input
section has the name .rdata, but doesn't contain any relocation sites, then the linker
changes its name to .rconst for the output file. Note that a similar optimization is not
done for .srdata because that is GP-addressable.
The sections named .sdata, .srdata, and .sbss are called small data sections with the
meaning that the compiler might choose to put "small" data items into them (i.e., data
items whose sizes are no larger than 8 bytes). However, these sections actually have
no such requirement. The real meaning of these sections is that the items placed here
can be referenced directly by 22-bit GP-relative addressing, rather than getting their
addresses out of the .got section. That is only correct to do if the compiler or
assembler programmer can guarantee that the symbol cannot be preempted.
Linkfiles also have common data, which has not been allocated to any section. When
the linker builds a loadfile it allocates common data in the .bss section.
The following is how the C compiler works:
Data that is global or large, and initialized to a non-zero value, is placed into .data.
Data that is global or large, and initialized to a zero value, is placed into .bss.
Data that is local and small, and initialized to a non-zero value, is placed into
.sdata.
Data that is local and small, and initialized to a zero value, is placed into .sbss.
Data that is uninitialized is called common data.
Character strings are called local data items and placed into .rdata.
eld Manual—527255-009
A-13
User Data

Advertisement

Table of Contents
loading

Table of Contents