LX51 User's Guide
A segment is a code or data block created by the compiler or
assembler from your source code. There are two basic types of
segments: absolute and relocatable.
An absolute segment resides at a fixed memory location
and may not be relocated or moved by the linker. Absolute segments
do not have names and are not combined with other segments. They
are copied directly to the output file.
A relocatable segment has a name and a type (as well as
other attributes shown in the table below). Two or more relocatable
segments with that have the same name are called partial segments.
They are considered to be part of the same segment and are combined
by the linker (even if they are created in separate source
While processing program modules, the linker produces a table of
all segments. The linker stores the segment name, type, location
method, length, and base address and uses this information to combine
partial relocatable segments. Partial relocateable segments have the
same segment name, but occur in more than one input module. The
linker combines such segments in the order of the input modules and
adds their lenght to create one segment. When combining segments, the
following rules are observed:
All partial segments that share a common name must have the
same memory class. An error occurs if the types do not
The length of the combined segments must not exceed the length
of the physical memory area.
The location method for each of the combined partial segments
must correspond. When the partial segments have different
alignment types the final segment gets the maximum alignment
requirement and the linker inserts gaps to achieve the alignment
The following segment attributes are used to determine how to
link, combine, and locate code or data in a segment.
||Each relocatable segment has a name that is used
when combining segments from different program modules.
Absolute segments do not have names.
||The memory class identifies the address space to
which the segment belongs. The class may be BIT,
CODE, CONST, DATA, EBIT,
ECONST, EDATA, IDATA, HCODE,
HCONST, HDATA, XDATA, or a user-defined
||The relocation type specifies the relocation
operations that may be performed by the linker. Valid
relocation types are AT address,
BITADDRESSABLE, INBLOCK, INPAGE,
INSEG, OFFS offset, and
||The alignment type specifies the alignment
operations that are performed by the linker. Valid alignment
types are BIT, BYTE, WORD, DWORD,
PAGE, BLOCK, and SEG.
||The length attribute specifies the length of the
||The base address specifies the first assigned
address of the segment. For absolute segments, the address is
assigned by the assembler or compiler. For relocatable
segments, the address is assigned by the linker.