Next Previous Contents

2. Usage

2.1 Command line option overview

The linker is called as follows:

---------------------------------------------------------------------------
Usage: ld65 [options] module ...
Short options:
  -h                    Help (this text)
  -m name               Create a map file
  -o name               Name the default output file
  -t sys                Set the target system
  -v                    Verbose mode
  -vm                   Verbose map file
  -C name               Use linker config file
  -Ln name              Create a VICE label file
  -Lp                   Mark write protected segments as such (VICE)
  -S addr               Set the default start address
  -V                    Print the linker version

Long options:
  --help                Help (this text)
  --mapfile name        Create a map file
  --target sys          Set the target system
  --version             Print the linker version
---------------------------------------------------------------------------

2.2 Command line options in detail

Here is a description of all the command line options:

-h, --help

Print the short option summary shown above.

-m name, --mapfile name

This option (which needs an argument that will used as a filename for the generated map file) will cause the linker to generate a map file. The map file does contain a detailed overview over the modules used, the sizes for the different segments, and a table containing exported symbols.

-o name

The -o switch is used to give the name of the default output file. Depending on your output configuration, this name may NOT be used as name for the output file. However, for the builtin configurations, this name is used for the output file name.

-t sys, --target sys

The argument for the -t switch is the name of the target system. Since this switch will activate a builtin configuration, it may not be used together with the -C option. The following target systems are currently supported:

There are a few more targets defined but neither of them is actually supported. See builtin configurations for more information.

-v, --verbose

Using the -v option, you may enable more output that may help you to locate problems. If an undefined symbol is encountered, -v causes the linker to print a detailed list of the references (that is, source file and line) for this symbol.

-vm

Must be used in conjunction with -m (generate map file). Normally the map file will not include empty segments and sections, or unreferenced symbols. Using this option, you can force the linker to include all this information into the map file.

-C

This gives the name of an output config file to use. See section 4 for more information about config files. -C may not be used together with -t.

-Ln

This option allows you to create a file that contains all global labels and may be loaded into VICE emulator using the ll (load label) command. You may use this to debug your code with VICE. Note: Older versions had some bugs in the label code. If you have problems, please get the latest VICE version.

-Lp

Deprecated option.

-S addr, --start-addr addr

Using -S you may define the default starting address. If and how this address is used depends on the config file in use. For the builtin configurations, only the "none" system honors an explicit start address, all other builtin config provide their own.

-V, --version

This option print the version number of the linker. If you send any suggestions or bugfixes, please include this number.

If one of the modules is not found in the current directory, and the module name does not have a path component, the value of the environment variable CC65_LIB is prepended to the name, and the linker tries to open the module with this new name.


Next Previous Contents