home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
d09xx
/
d0906.lha
/
PhxAss
/
PhxLnk.doc
< prev
next >
Wrap
Text File
|
1993-08-28
|
5KB
|
143 lines
P h x L n k
AMIGA-DOS Module Linker
Contents
--------
I. Introduction
II. Usage
III. Bugs
I. Introduction
===============
This program was written, because I had no Linker which can process object-
modules using the small-code and small-data model in a good time. I have got
the LN-Linker from Manx (Aztec-C), which is too slow, and the public-domain
linker BLink V6.7 which is unable to process small-data modules.
PhxLnk is only 7 kB large, in most cases faster than BLink (31 kB) and many
times faster than LN.
PhxLnk was written in pure assembler-code, assembled with PhxAss and linked
with BLink (first version) and PhxLnk itself.
PhxLnk is FREEWARE and copyright ⌐ 1992,93 by Frank Wille.
Commercial usage of this program is strictly forbidden!
II. Usage
=========
The linker can be used from CLI only. You may copy it to the C-directory of
your workdisk, then type :
PhxLnk [<-options>] <object- or library-module names ...>
to start PhxLnk. Starting PhxLnk with no argument or with a single '?' will
display a short instruction.
There are two types of modules which can be linked:
o Object modules with extension ".o" or ".obj" which normally consist of one
unit. PhxLnk also links object modules with several units.
o Library modules with extension ".lib" which can consist of any number of
units. PhxLnk will only include units, if at least one ext_def-symbol is
referenced in an object module unit or in an already included library unit.
The module names can appear in any order, provided the first is an object
module which contains the startup code.
Options:
-o<Name> Sets the name of the output file. If not specified, the output
name is the name of the first module without extension,
e.g. "phxlnk prog1.o prog2.o c.lib m.lib" will produce a load-
file with the name "prog1".
-a This option forces all sections to be loaded to Chip-Memory.
-c Normally only the sections of the same type and name will be
linked together. -c ignores the names of the Code sections,
they will be linked to one large Code section. Usually -c is set
when using small-code model.
-d As with -c the section names are ignored, but now for the Data and
Bss sections. Data and Bss will not be mixed! This large section
will contain first all the Data and then all the Bss.
Important! When PhxLnk writes the load-file, only the Data-part of
this section will be saved. The Bss-part, which is zero in any
case, must be recreated by the startup code of the program (see
Linker-Symbols for more information). Nevertheless all pointers
and references to, or symbols of this section will be calculated
as if the Bss section were directly behind the Data. -d will be
needed when using small-data model for both Data and Bss sections.
-s The hunk_symbol($3f0) and hunk_debug($3f1) blocks which contain
information for a debugger will not be written to the load-file.
-b<num> Sets the maximum number of sections per unit to <num>. The default
value is 16 (which should be enough for most cases).
Linker-Symbols:
The linker itself creates one ext_def($01xxxxxx) and two ext_abs($02xxxxxx)
symbols which will be needed by the startup code of a program using the small-
data model.
_DATA_BAS_ (ext_def) Base address of the Data section.
_DATA_LEN_ (ext_abs) Length of the Data section in Bytes.
_BSS_LEN_ (ext_abs) Length of the (not existing) Bss section in Bytes.
The startup code should allocate _DATA_LEN_ + _BSS_LEN_ + 8 Bytes of cleared
memory. Then copy the Data section from _DATA_BAS_ to this new memory space.
As a last step, the new Data/Bss section must be inserted in the segment-list
instead of the old one.
Small-Data:
Small-data symbols can be accessed in a range of 65534 ($fffe) bytes. When a
symbol is outside of this range, the linker will display an error.
The small-data model must be initialized by the startup code. When you're
using A4 as small-data pointer, the initialization would look like this:
lea SmallDataBase,a4
lea 32766(a4),a4
Don't write "lea SmallDataBase+32766,a4". Some assemblers could change this
address during optimization.
I chose 32766 instead of 32768, because this is the way most assemblers and
linkers do it (e.g. DICE).
III. Bugs
=========
The linker does not support overlay-hunks, something which could be added in
future updates.
If any errors or questions occur, please write to :
Frank Wille
Auf dem Dreische 45
32049 Herford
GERMANY
__
///
///
///
__ ///
\\\ ///
\\\ ///
\\\///
\XX/ A M I G A F O R E V E R !