<article>
<title>ld65 Users Guide
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
-<date>2014-04-20
<abstract>
The ld65 linker combines object files into an executable file. ld65 is highly
<itemize>
-<item> Accept any number of segments to form an executable module.
+<item> Accept any number of segments to form an executable module.
-<item> Resolve arbitrary expressions stored in the object files.
+<item> Resolve arbitrary expressions stored in the object files.
-<item> In case of errors, use the meta information stored in the object files
- to produce helpful error messages. In case of undefined symbols,
- expression range errors, or symbol type mismatches, ld65 is able to
- tell you the exact location in the original assembler source, where
- the symbol was referenced.
+<item> In case of errors, use the meta information stored in the object files
+ to produce helpful error messages. In case of undefined symbols,
+ expression range errors, or symbol type mismatches, ld65 is able to
+ tell you the exact location in the original assembler source, where
+ the symbol was referenced.
-<item> Flexible output. The output of ld65 is highly configurable by a config
- file. Some more-common platforms are supported by default configurations
- that may be activated by naming the target system. The output
- generation was designed with different output formats in mind, so
- adding other formats shouldn't be a great problem.
+<item> Flexible output. The output of ld65 is highly configurable by a config
+ file. Some more-common platforms are supported by default configurations
+ that may be activated by naming the target system. The output
+ generation was designed with different output formats in mind, so
+ adding other formats shouldn't be a great problem.
</itemize>
-m name Create a map file
-o name Name the default output file
-t sys Set the target system
- -u sym Force an import of symbol `sym'
+ -u sym Force an import of symbol 'sym'
-v Verbose mode
-vm Verbose map file
Long options:
- --cfg-path path Specify a config file search path
- --config name Use linker config file
- --dbgfile name Generate debug information
- --define sym=val Define a symbol
- --end-group End a library group
- --force-import sym Force an import of symbol `sym'
- --help Help (this text)
- --lib file Link this library
- --lib-path path Specify a library search path
- --mapfile name Create a map file
- --module-id id Specify a module id
- --obj file Link this object file
- --obj-path path Specify an object file search path
- --start-addr addr Set the default start address
- --start-group Start a library group
- --target sys Set the target system
- --version Print the linker version
+ --allow-multiple-definition Allow multiple definitions
+ --cfg-path path Specify a config file search path
+ --config name Use linker config file
+ --dbgfile name Generate debug information
+ --define sym=val Define a symbol
+ --end-group End a library group
+ --force-import sym Force an import of symbol 'sym'
+ --help Help (this text)
+ --lib file Link this library
+ --lib-path path Specify a library search path
+ --mapfile name Create a map file
+ --module-id id Specify a module id
+ --obj file Link this object file
+ --obj-path path Specify an object file search path
+ --start-addr addr Set the default start address
+ --start-group Start a library group
+ --target sys Set the target system
+ --version Print the linker version
---------------------------------------------------------------------------
</verb></tscreen>
<descrip>
+ <tag><tt>--allow-multiple-definition</tt></tag>
+
+ Normally when a global symbol is defined multiple times, ld65 will
+ issue an error and not create the output file. This option lets it
+ silently ignore this fact and continue. The first definition of a
+ symbol will be used.
+
+
<label id="option--start-group">
<tag><tt>-(, --start-group</tt></tag>
<item>sim6502
<item>sim65c02
<item>supervision
+ <item>telestrat
<item>vic20
</itemize>
size. Start and size are mandatory attributes, that means, each memory area
defined <em/must/ have these attributes given (the linker will check that). I
will cover other attributes later. As you may have noticed, I've used a
-comment in the example above. Comments start with a hash mark (`#'), the
+comment in the example above. Comments start with a hash mark ('#'), the
remainder of the line is ignored if this character is found.
example above. Let's have a look at it now.
The "file" attribute (the keyword may also be written as "FILE" if you like
-that better) takes a string enclosed in double quotes (`&dquot;') that specifies the
+that better) takes a string enclosed in double quotes ('&dquot;') that specifies the
file, where the data is written. You may specify the same file several times,
in that case the data for all memory areas having this file name is written
into this file, in the order of the memory areas defined in the <tt/MEMORY/
<sect1>Other SEGMENT attributes<p>
Segments may be aligned to some memory boundary. Specify "<tt/align = num/" to
-request this feature. Num must be a power of two. To align all segments on a
-page boundary, use
+request this feature. To align all segments on a page boundary, use
<tscreen><verb>
SEGMENTS {
}
</verb></tscreen>
-The only other available output format is the o65 format specified by Andre
+There are two other available formats, one is the o65 format specified by Andre
Fachat (see the <url url="http://www.6502.org/users/andre/o65/fileformat.html"
name="6502 binary relocation format specification">). It is defined like this:
}
</verb></tscreen>
-The necessary o65 attributes are defined in a special section labeled
+The other format available is the Atari (xex) segmented file format, this is
+the standard format used by Atari DOS 2.0 and upward file managers in the Atari
+8-bit computers, and it is defined like this:
+
+<tscreen><verb>
+ FILES {
+ %O: format = atari;
+ }
+</verb></tscreen>
+
+In the Atari segmented file format, the linker will write each <tt/MEMORY/ area
+as a new segment, including a header with the start and end address.
+
+The necessary o65 or Atari attributes are defined in a special section labeled
<ref id="FORMAT" name="FORMAT">.
}
</verb></tscreen>
+The Atari file format has two attributes:
+
+<descrip>
+
+ <tag><tt>RUNAD = symbol</tt></tag>
+
+ Specify a symbol as the run address of the binary, the loader will call this
+ address after all the file is loaded in memory. If the attribute is omitted,
+ no run address is included in the file.
+
+ <tag><tt>INITAD = memory_area : symbol</tt></tag>
+
+ Specify a symbol as the initialization address for the given memory area.
+ The binary loader will call this address just after the memory area is loaded
+ into memory, before continuing loading the rest of the file.
+
+</descrip>
+
+
+<tscreen><verb>
+ FORMATS {
+ atari: runad = _start;
+ }
+</verb></tscreen>
<sect1>The FEATURES section<label id="FEATURES"><p>
freely, subject to the following restrictions:
<enum>
-<item> The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-<item> Altered source versions must be plainly marked as such, and must not
- be misrepresented as being the original software.
-<item> This notice may not be removed or altered from any source
- distribution.
+<item> The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+<item> Altered source versions must be plainly marked as such, and must not
+ be misrepresented as being the original software.
+<item> This notice may not be removed or altered from any source
+ distribution.
</enum>