EasyManua.ls Logo

Commodore PC 10 - Page 341

Commodore PC 10
494 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
How Link Works
Link
creates
an
executable
file by concatenating a program's
code
and
data segments according
to
the
instructions in
the
original
source
files. These
concatenated
segments form
an
executable
image
that
is copied directly
into
memory
when
you
run
the
pro-
gram.
The
order
and
manner
in
which
the
linker
copies
segments
to
the
executable file defines
the
order
and
manner
in
which
it
loads
the
segments into memory.
You
can
tell
the
linker
how
to
link a program's segments by using
a SEGMENT directive
to
supply segment attributes,
or
by
using
the
GROUP directive
to
form
segment
groups.
These
directives
define
group
associations, classes, and align
and
combine
types
that
define
the
order
and
relative starting addresses
of
all seg-
ments
in a program. This information works in addition
to
any
information you supply
through
command
line options.
The
following sections explain
the
process
that
link
uses
to
con-
catenate
segments and resolve references
to
items in memory.
Alignment of Segments
The
linker uses a segment's align type
to
set
the
starting address
for
the
segment. The align types are byte, word, para,
and
page.
These
types
correspond
to
starting addresses at byte,
word,
para-
graph,
and
page boundaries, representing addresses that
are
multi-
ples
of
1,
2, 16, and 256, respectively.
The
default align type is
para.
When
the
linker
encounters
a segment, it checks
the
align type
before copying the
segment
to
the
executable
file.
If
the
align
type
is word, para,
or
page,
the
linker checks
the
executable
image
to
see
if
the last
byte
copied
ends at an appropriate boun-
dary.
If
it
doesn't,link
pads
the
image
with
extra
null bytes.
Frame Number
The
linker
computes
a starting address for
each
segment
in a pro-
gram.
The
starting address is based
on
a segment's align type and
on
the
size
of
the
segments already
copied
to
the
executable
file.
The
address consists
of
an offset and a canonical frame number,
which
specifies the address
of
the
first paragraph in
memory
that
contains
one
or
more
bytes
of
the
segment. A frame
number
is
always a mUltiple
of
16
(a
paragraph address), and
the
offset is
the
number
of
bytes from
the
start
of
the
paragraph
to
the
first
byte
in
the
segment. For byte and word align types,
the
offset may
be
nonzero,
but
the
offset is always zero for para and page align
types.
Unk: A Unker
2031
How link aligns
segments
Segment starting
addresses

Table of Contents

Related product manuals