home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
d
/
drlink
/
Drlink_doc
< prev
next >
Wrap
Text File
|
1996-10-12
|
51KB
|
1,137 lines
The 'Drlink' AOF Linker
~~~~~~~~~~~~~~~~~~~~~~~
Disclaimer
~~~~~~~~~~
The 'Drlink' linker is provided 'as is' and people using it do so
entirely at their own risk. No liability whatsoever will be
accepted for any loss or damage arising from the use of this
software.
Introduction
~~~~~~~~~~~~
Drlink is a linker that is intended to be a partial substitute for
the Acorn linker, 'link'. It is aimed at people with compilers
that generate object files in Acorn's AOF format but who do not
have a copy of 'link', for example, people who want to use the DDE
Pascal compiler or TLA or perhaps their own homebrew compilers.
Drlink accepts object files in Acorn's AOF format and libraries in
Acorn's ALF format and links them to produce an executable image
in either Acorn's AIF format or a plain binary image. It can also
be used to link relocatable modules or to create partially-linked
AOF files. Drlink is modelled very closely on the version of
'link' that comes with release 3 of Acorn's C compiler but it is
not really a complete replacement for it as it does not have the
same range of facilities. What is there, it is hoped, should be
adequate in most cases. Drlink is designed to link 'ordinary'
programs and cannot do some of the fancy things link can, such as
create image files that use overlays. Of course, some of these
features could be added at a later date but the current version of
Drlink, 0.30, does not support them. On the other hand, it does
contain some features found on later releases of 'link' such as
the ability to increase the size of the wimpslot if necessary when
running in a task window and support for extended command lines.
Other features include the ability to scan libraries more than
once when resolving symbols and, assuming the right compiler
options have been used when compiling programs, being able to
leave out unused functions from executable images. Hopefully
features like these will make the linker attractive to people who
use link as well.
Thanks...
~~~~~~~~~
I would like to thank the many people on Arcade who have tested
Drlink for me over the months and who made many helpful and useful
suggestions. Drlink would never have reached the state it has
today without their generous assistance.
Using Drlink
~~~~~~~~~~~~
Drlink is a command line-based program and has the same command
syntax as 'link'. It can be used in the same environments as
'link', for example, with amu. If it is renamed as 'link', then
it can be dynamically invoked from either the Acorn C or DDE
Pascal compilers as well. It accepts the same options as 'link',
although a number of them are unsupported and will be flagged as
errors. Drlink also supports extended command lines. (Further
information on this can be found in the section 'Extended Command
Line Support' below.)
The command syntax is:
drlink <list of files> <options>
where:
<list of files> is the list of object files and libraries to be
included in the linked program.
<options> is the options to be used when linking the
program.
Options and object file names can be freely intermixed. The linker
processes all the options before moving on to the link itself.
Filenames
Each filename in the list of object files should be fully
qualified, that is, Drlink makes no assumptions as to where the
object files are to be found. Wildcards are permitted, in which
case Drlink loads all the files that match the wildcard. If the
directory containing the object files is called 'o', then Drlink
will also accept 'back-to-front' filenames, for example, 'sieve.o'
instead of 'o.sieve'. If a path is used as part of a filename, for
example, 'C:', the way Drlink treats the filename depends on
whether it contains wildcards or not. If it does not, then every
directory on the path will be searched to find the file until
either the file is found or the end of the list is reached. On the
other hand, if the filename contains wildcards, only the first
directory listed on the path will be checked. (This is how link
behaves.) Examples:
o.sieve
o.dhry1 o.dhry2 c:o.stubs
o.dhry* c:o.ansilib
dhry*.o c:ansilib.o
o.* c:o.*
O.world scsi::Arc.$.programs.!Pascal.O.Plib C:O.stubs
Drlink ignores the case of object file and library names.
Options
As noted above, Drlink recognises the same options as 'link',
even if it does flag a number as unsupported, plus has a number of
its own. Options take the form of a '-' followed by the option
name. Some options are followed by an argument. One or more blanks
should be left between the option name and the argument. The case
of the option and any argument is ignored. Options that are
supported are:
-aif Create an AIF image file.
This is the standard format for programs running
under RISCOS where a small header is attached to
the start of the program containing various bits
and pieces of information. It is the default option
used for the image type when no type is explicitly
given unless the '-base' option is used when '-bin'
is the default value.
-aof Create a partially-linked AOF file.
The image file created takes the form of an AOF
file where as many references as possible between
the object files included in the link are resolved
and then the object files are merged together to
form another object file in AOF format that can be
used in a future link.
There are a couple of points to watch out for here:
a) To include debug information in the AOF file,
either '-debug' or '-keepdebug' must be used.
b) All local symbol names are lost, so they will
not appear in the low-level debug tables if
these are generated in the final image.
-base <address>
This option allows the initial load address of the
read-only part of the image file to be specified.
The read-only part normally contains code.
<address> is taken to be decimal by default but if
prefixed by '&' or '0x' it will be treated as a
hexadecimal value. It can be postfixed by 'k' or
'm' to indicate the address is in kilobytes or
megabytes. The case of the 'k', 'm', 'x' or any of
the hex digits 'a' to 'f' is ignored. The value of
<address> is rounded up to the next word boundary
if it is not already so aligned.
The initial load address can only be specified for
a binary image file.
Image files created when this option is used do not
have a filetype but have 'load' and 'excute'
addresses instead. The load address is set to
whatever was specified on '-base' and the 'execute'
address to the program's entry point address. The
files themselves contain plain binary images as
created by the option '-bin'. This behaviour is
different to that of 'link'.
-bin Create a plain binary image file.
A binary image file does not have the header that
AIF files have on them and consist of nothing but
the linked program. This has two consequences.
Firstly, and most importantly, zero-initialised
data areas will not be cleared to zeros when the
program starts running as the routine to do this is
part of the AIF header. Secondly, if debugging
tables are included in the executable image, there
is nothing to indicate where they are.
Note that when the option '-base' is used and the
image file type is not given, '-bin' is assumed to
be the image type.
-case Ignore the case of symbols when tryin