Mercurial > hg > index.cgi
changeset 347:330a66a0f45a
Document the forwardrefmax pragma
Since the forwardrefmax is useful for combatting huge assembly times in many
sources, actually document it so people can find it.
author | William Astle <lost@l-w.ca> |
---|---|
date | Thu, 09 Apr 2015 12:51:02 -0600 |
parents | 9e35f7a1fca1 |
children | 379ef4e08dd2 |
files | docs/manual.docbook.sgml docs/manual/c727.html docs/manual/c734.html docs/manual/c922.html docs/manual/c929.html docs/manual/c984.html docs/manual/c991.html docs/manual/index.html docs/manual/manual.html docs/manual/manual.pdf docs/manual/x54.html docs/manual/x628.html docs/manual/x827.html docs/manual/x834.html docs/manual/x841.html docs/manual/x848.html docs/manual/x907.html docs/manual/x914.html |
diffstat | 18 files changed, 1868 insertions(+), 1771 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/manual.docbook.sgml Thu Apr 09 12:36:07 2015 -0600 +++ b/docs/manual.docbook.sgml Thu Apr 09 12:51:02 2015 -0600 @@ -1847,6 +1847,41 @@ </listitem> </varlistentry> +<varlistentry> +<term>forwardrefmax</term> +<listitem> + +<para>This pragma will disable forward reference optimization completely. +Ordinarily, LWASM will attempt to select the shortest possible addressing +mode for forward references. However, in many source files, especially +those not using the PCR relative addressing modes, this optimization is +pointless since the assembler will almost certainly settle on a 16 bit +offset or address. If all variables in the direct page are defined before +the main body of the code, the benefit of forward reference optimization +almost certainly vanishes completely. However, the cost of doing that +optimization remains and can result in a very long assembly time.</para> + +<para>Enabling this pragma will cause all forward references to use the +maximum offset or address size, much the same has EDTASM and other pure +two pass assemblers do. The side effect is that all line lengths and +symbol values are fully resolved after the initial parsing pass and the +amount of work to resolve everything becomes almost nil.</para> + +<para>While this pragma can be applied selectively to sections of source +code (use *PRAGMA if doing so and compatibility with other assemblers +is desired), it is likely more useful when provided as a command line +pragma.</para> + +<para>It should be noted that the presence or absence of this pragma +will not change the correctness of the generated code unless cycle counts +or byte counts are critical (which they usually are not). It also will +not override the operand size override prefixes (< and >). It only +applies when the assembler is left to guess what the operand size is.</para> + +</listitem> +</varlistentry> + + </variablelist> <para>As a convenience, each input file has a pragma state stack. This
--- a/docs/manual/c727.html Thu Apr 09 12:36:07 2015 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,336 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->LWLINK</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="HOME" -TITLE="LW Tool Chain" -HREF="index.html"><LINK -REL="PREVIOUS" -TITLE="Assembler Modes and Pragmas" -HREF="x628.html"><LINK -REL="NEXT" -TITLE="Linker Operation" -HREF="x827.html"></HEAD -><BODY -CLASS="CHAPTER" -BGCOLOR="#FFFFFF" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="NAVHEADER" -><TABLE -SUMMARY="Header navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TH -COLSPAN="3" -ALIGN="center" ->LW Tool Chain</TH -></TR -><TR -><TD -WIDTH="10%" -ALIGN="left" -VALIGN="bottom" -><A -HREF="x628.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="80%" -ALIGN="center" -VALIGN="bottom" -></TD -><TD -WIDTH="10%" -ALIGN="right" -VALIGN="bottom" -><A -HREF="x827.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -></TABLE -><HR -ALIGN="LEFT" -WIDTH="100%"></DIV -><DIV -CLASS="CHAPTER" -><H1 -><A -NAME="AEN727" -></A ->Chapter 4. LWLINK</H1 -><P ->The LWTOOLS linker is called LWLINK. This chapter documents the various features -of the linker.</P -><DIV -CLASS="SECTION" -><H1 -CLASS="SECTION" -><A -NAME="AEN730" ->4.1. Command Line Options</A -></H1 -><P ->The binary for LWLINK is called "lwlink". Note that the binary is in lower -case. lwlink takes the following command line arguments.</P -><P -></P -><DIV -CLASS="VARIABLELIST" -><DL -><DT -><CODE -CLASS="OPTION" ->--decb</CODE ->, <CODE -CLASS="OPTION" ->-b</CODE -></DT -><DD -><P ->Selects the DECB output format target. This is equivalent to <CODE -CLASS="OPTION" ->--format=decb</CODE -></P -></DD -><DT -><CODE -CLASS="OPTION" ->--output=FILE</CODE ->, <CODE -CLASS="OPTION" ->-o FILE</CODE -></DT -><DD -><P ->This option specifies the name of the output file. If not specified, the -default is <CODE -CLASS="OPTION" ->a.out</CODE ->.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--format=TYPE</CODE ->, <CODE -CLASS="OPTION" ->-f TYPE</CODE -></DT -><DD -><P ->This option specifies the output format. Valid values are <CODE -CLASS="OPTION" ->decb</CODE -> -and <CODE -CLASS="OPTION" ->raw</CODE -></P -></DD -><DT -><CODE -CLASS="OPTION" ->--raw</CODE ->, <CODE -CLASS="OPTION" ->-r</CODE -></DT -><DD -><P ->This option specifies the raw output format. -It is equivalent to <CODE -CLASS="OPTION" ->--format=raw</CODE -> -and <CODE -CLASS="OPTION" ->-f raw</CODE -></P -></DD -><DT -><CODE -CLASS="OPTION" ->--script=FILE</CODE ->, <CODE -CLASS="OPTION" ->-s</CODE -></DT -><DD -><P ->This option allows specifying a linking script to override the linker's -built in defaults.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--section-base=SECT=BASE</CODE -></DT -><DD -><P ->Cause section SECT to load at base address BASE. This will be prepended -to the built-in link script. It is ignored if a link script is provided.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--map=FILE</CODE ->, <CODE -CLASS="OPTION" ->-m FILE</CODE -></DT -><DD -><P ->This will output a description of the link result to FILE.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--library=LIBSPEC</CODE ->, <CODE -CLASS="OPTION" ->-l LIBSPEC</CODE -></DT -><DD -><P ->Load a library using the library search path. LIBSPEC will have "lib" prepended -and ".a" appended.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--library-path=DIR</CODE ->, <CODE -CLASS="OPTION" ->-L DIR</CODE -></DT -><DD -><P ->Add DIR to the library search path.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--debug</CODE ->, <CODE -CLASS="OPTION" ->-d</CODE -></DT -><DD -><P ->This option increases the debugging level. It is only useful for LWTOOLS -developers.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--help</CODE ->, <CODE -CLASS="OPTION" ->-?</CODE -></DT -><DD -><P ->This provides a listing of command line options and a brief description -of each.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--usage</CODE -></DT -><DD -><P ->This will display a usage summary -of each command line option.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--version</CODE ->, <CODE -CLASS="OPTION" ->-V</CODE -></DT -><DD -><P ->This will display the version of LWLINK.</P -></DD -></DL -></DIV -></DIV -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -><A -HREF="x628.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="H" ->Home</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -><A -HREF="x827.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" ->Assembler Modes and Pragmas</TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -> </TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" ->Linker Operation</TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/manual/c734.html Thu Apr 09 12:51:02 2015 -0600 @@ -0,0 +1,336 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> +<HTML +><HEAD +><TITLE +>LWLINK</TITLE +><META +NAME="GENERATOR" +CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK +REL="HOME" +TITLE="LW Tool Chain" +HREF="index.html"><LINK +REL="PREVIOUS" +TITLE="Assembler Modes and Pragmas" +HREF="x628.html"><LINK +REL="NEXT" +TITLE="Linker Operation" +HREF="x834.html"></HEAD +><BODY +CLASS="CHAPTER" +BGCOLOR="#FFFFFF" +TEXT="#000000" +LINK="#0000FF" +VLINK="#840084" +ALINK="#0000FF" +><DIV +CLASS="NAVHEADER" +><TABLE +SUMMARY="Header navigation table" +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TH +COLSPAN="3" +ALIGN="center" +>LW Tool Chain</TH +></TR +><TR +><TD +WIDTH="10%" +ALIGN="left" +VALIGN="bottom" +><A +HREF="x628.html" +ACCESSKEY="P" +>Prev</A +></TD +><TD +WIDTH="80%" +ALIGN="center" +VALIGN="bottom" +></TD +><TD +WIDTH="10%" +ALIGN="right" +VALIGN="bottom" +><A +HREF="x834.html" +ACCESSKEY="N" +>Next</A +></TD +></TR +></TABLE +><HR +ALIGN="LEFT" +WIDTH="100%"></DIV +><DIV +CLASS="CHAPTER" +><H1 +><A +NAME="AEN734" +></A +>Chapter 4. LWLINK</H1 +><P +>The LWTOOLS linker is called LWLINK. This chapter documents the various features +of the linker.</P +><DIV +CLASS="SECTION" +><H1 +CLASS="SECTION" +><A +NAME="AEN737" +>4.1. Command Line Options</A +></H1 +><P +>The binary for LWLINK is called "lwlink". Note that the binary is in lower +case. lwlink takes the following command line arguments.</P +><P +></P +><DIV +CLASS="VARIABLELIST" +><DL +><DT +><CODE +CLASS="OPTION" +>--decb</CODE +>, <CODE +CLASS="OPTION" +>-b</CODE +></DT +><DD +><P +>Selects the DECB output format target. This is equivalent to <CODE +CLASS="OPTION" +>--format=decb</CODE +></P +></DD +><DT +><CODE +CLASS="OPTION" +>--output=FILE</CODE +>, <CODE +CLASS="OPTION" +>-o FILE</CODE +></DT +><DD +><P +>This option specifies the name of the output file. If not specified, the +default is <CODE +CLASS="OPTION" +>a.out</CODE +>.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--format=TYPE</CODE +>, <CODE +CLASS="OPTION" +>-f TYPE</CODE +></DT +><DD +><P +>This option specifies the output format. Valid values are <CODE +CLASS="OPTION" +>decb</CODE +> +and <CODE +CLASS="OPTION" +>raw</CODE +></P +></DD +><DT +><CODE +CLASS="OPTION" +>--raw</CODE +>, <CODE +CLASS="OPTION" +>-r</CODE +></DT +><DD +><P +>This option specifies the raw output format. +It is equivalent to <CODE +CLASS="OPTION" +>--format=raw</CODE +> +and <CODE +CLASS="OPTION" +>-f raw</CODE +></P +></DD +><DT +><CODE +CLASS="OPTION" +>--script=FILE</CODE +>, <CODE +CLASS="OPTION" +>-s</CODE +></DT +><DD +><P +>This option allows specifying a linking script to override the linker's +built in defaults.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--section-base=SECT=BASE</CODE +></DT +><DD +><P +>Cause section SECT to load at base address BASE. This will be prepended +to the built-in link script. It is ignored if a link script is provided.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--map=FILE</CODE +>, <CODE +CLASS="OPTION" +>-m FILE</CODE +></DT +><DD +><P +>This will output a description of the link result to FILE.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--library=LIBSPEC</CODE +>, <CODE +CLASS="OPTION" +>-l LIBSPEC</CODE +></DT +><DD +><P +>Load a library using the library search path. LIBSPEC will have "lib" prepended +and ".a" appended.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--library-path=DIR</CODE +>, <CODE +CLASS="OPTION" +>-L DIR</CODE +></DT +><DD +><P +>Add DIR to the library search path.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--debug</CODE +>, <CODE +CLASS="OPTION" +>-d</CODE +></DT +><DD +><P +>This option increases the debugging level. It is only useful for LWTOOLS +developers.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--help</CODE +>, <CODE +CLASS="OPTION" +>-?</CODE +></DT +><DD +><P +>This provides a listing of command line options and a brief description +of each.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--usage</CODE +></DT +><DD +><P +>This will display a usage summary +of each command line option.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--version</CODE +>, <CODE +CLASS="OPTION" +>-V</CODE +></DT +><DD +><P +>This will display the version of LWLINK.</P +></DD +></DL +></DIV +></DIV +></DIV +><DIV +CLASS="NAVFOOTER" +><HR +ALIGN="LEFT" +WIDTH="100%"><TABLE +SUMMARY="Footer navigation table" +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +><A +HREF="x628.html" +ACCESSKEY="P" +>Prev</A +></TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +><A +HREF="index.html" +ACCESSKEY="H" +>Home</A +></TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +><A +HREF="x834.html" +ACCESSKEY="N" +>Next</A +></TD +></TR +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +>Assembler Modes and Pragmas</TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +> </TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +>Linker Operation</TD +></TR +></TABLE +></DIV +></BODY +></HTML +> \ No newline at end of file
--- a/docs/manual/c922.html Thu Apr 09 12:36:07 2015 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,270 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->Libraries and LWAR</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="HOME" -TITLE="LW Tool Chain" -HREF="index.html"><LINK -REL="PREVIOUS" -TITLE="Format Specific Linking Notes" -HREF="x907.html"><LINK -REL="NEXT" -TITLE="Object Files" -HREF="c984.html"></HEAD -><BODY -CLASS="CHAPTER" -BGCOLOR="#FFFFFF" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="NAVHEADER" -><TABLE -SUMMARY="Header navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TH -COLSPAN="3" -ALIGN="center" ->LW Tool Chain</TH -></TR -><TR -><TD -WIDTH="10%" -ALIGN="left" -VALIGN="bottom" -><A -HREF="x907.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="80%" -ALIGN="center" -VALIGN="bottom" -></TD -><TD -WIDTH="10%" -ALIGN="right" -VALIGN="bottom" -><A -HREF="c984.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -></TABLE -><HR -ALIGN="LEFT" -WIDTH="100%"></DIV -><DIV -CLASS="CHAPTER" -><H1 -><A -NAME="AEN922" -></A ->Chapter 5. Libraries and LWAR</H1 -><P ->LWTOOLS also includes a tool for managing libraries. These are analogous to -the static libraries created with the "ar" tool on POSIX systems. Each library -file contains one or more object files. The linker will treat the object -files within a library as though they had been specified individually on -the command line except when resolving external references. External references -are looked up first within the object files within the library and then, if -not found, the usual lookup based on the order the files are specified on -the command line occurs.</P -><P ->The tool for creating these libary files is called LWAR.</P -><DIV -CLASS="SECTION" -><H1 -CLASS="SECTION" -><A -NAME="AEN926" ->5.1. Command Line Options</A -></H1 -><P ->The binary for LWAR is called "lwar". Note that the binary is in lower -case. The options lwar understands are listed below. For archive manipulation -options, the first non-option argument is the name of the archive. All other -non-option arguments are the names of files to operate on.</P -><P -></P -><DIV -CLASS="VARIABLELIST" -><DL -><DT -><CODE -CLASS="OPTION" ->--add</CODE ->, <CODE -CLASS="OPTION" ->-a</CODE -></DT -><DD -><P ->This option specifies that an archive is going to have files added to it. -If the archive does not already exist, it is created. New files are added -to the end of the archive.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--create</CODE ->, <CODE -CLASS="OPTION" ->-c</CODE -></DT -><DD -><P ->This option specifies that an archive is going to be created and have files -added to it. If the archive already exists, it is truncated.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--merge</CODE ->, <CODE -CLASS="OPTION" ->-m</CODE -></DT -><DD -><P ->If specified, any files specified to be added to an archive will be checked -to see if they are archives themselves. If so, their constituent members are -added to the archive. This is useful for avoiding archives containing archives.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--list</CODE ->, <CODE -CLASS="OPTION" ->-l</CODE -></DT -><DD -><P ->This will display a list of the files contained in the archive.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--debug</CODE ->, <CODE -CLASS="OPTION" ->-d</CODE -></DT -><DD -><P ->This option increases the debugging level. It is only useful for LWTOOLS -developers.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--help</CODE ->, <CODE -CLASS="OPTION" ->-?</CODE -></DT -><DD -><P ->This provides a listing of command line options and a brief description -of each.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--usage</CODE -></DT -><DD -><P ->This will display a usage summary -of each command line option.</P -></DD -><DT -><CODE -CLASS="OPTION" ->--version</CODE ->, <CODE -CLASS="OPTION" ->-V</CODE -></DT -><DD -><P ->This will display the version of LWLINK. -of each.</P -></DD -></DL -></DIV -></DIV -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -><A -HREF="x907.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="H" ->Home</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -><A -HREF="c984.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" ->Format Specific Linking Notes</TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -> </TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" ->Object Files</TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/manual/c929.html Thu Apr 09 12:51:02 2015 -0600 @@ -0,0 +1,270 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> +<HTML +><HEAD +><TITLE +>Libraries and LWAR</TITLE +><META +NAME="GENERATOR" +CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK +REL="HOME" +TITLE="LW Tool Chain" +HREF="index.html"><LINK +REL="PREVIOUS" +TITLE="Format Specific Linking Notes" +HREF="x914.html"><LINK +REL="NEXT" +TITLE="Object Files" +HREF="c991.html"></HEAD +><BODY +CLASS="CHAPTER" +BGCOLOR="#FFFFFF" +TEXT="#000000" +LINK="#0000FF" +VLINK="#840084" +ALINK="#0000FF" +><DIV +CLASS="NAVHEADER" +><TABLE +SUMMARY="Header navigation table" +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TH +COLSPAN="3" +ALIGN="center" +>LW Tool Chain</TH +></TR +><TR +><TD +WIDTH="10%" +ALIGN="left" +VALIGN="bottom" +><A +HREF="x914.html" +ACCESSKEY="P" +>Prev</A +></TD +><TD +WIDTH="80%" +ALIGN="center" +VALIGN="bottom" +></TD +><TD +WIDTH="10%" +ALIGN="right" +VALIGN="bottom" +><A +HREF="c991.html" +ACCESSKEY="N" +>Next</A +></TD +></TR +></TABLE +><HR +ALIGN="LEFT" +WIDTH="100%"></DIV +><DIV +CLASS="CHAPTER" +><H1 +><A +NAME="AEN929" +></A +>Chapter 5. Libraries and LWAR</H1 +><P +>LWTOOLS also includes a tool for managing libraries. These are analogous to +the static libraries created with the "ar" tool on POSIX systems. Each library +file contains one or more object files. The linker will treat the object +files within a library as though they had been specified individually on +the command line except when resolving external references. External references +are looked up first within the object files within the library and then, if +not found, the usual lookup based on the order the files are specified on +the command line occurs.</P +><P +>The tool for creating these libary files is called LWAR.</P +><DIV +CLASS="SECTION" +><H1 +CLASS="SECTION" +><A +NAME="AEN933" +>5.1. Command Line Options</A +></H1 +><P +>The binary for LWAR is called "lwar". Note that the binary is in lower +case. The options lwar understands are listed below. For archive manipulation +options, the first non-option argument is the name of the archive. All other +non-option arguments are the names of files to operate on.</P +><P +></P +><DIV +CLASS="VARIABLELIST" +><DL +><DT +><CODE +CLASS="OPTION" +>--add</CODE +>, <CODE +CLASS="OPTION" +>-a</CODE +></DT +><DD +><P +>This option specifies that an archive is going to have files added to it. +If the archive does not already exist, it is created. New files are added +to the end of the archive.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--create</CODE +>, <CODE +CLASS="OPTION" +>-c</CODE +></DT +><DD +><P +>This option specifies that an archive is going to be created and have files +added to it. If the archive already exists, it is truncated.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--merge</CODE +>, <CODE +CLASS="OPTION" +>-m</CODE +></DT +><DD +><P +>If specified, any files specified to be added to an archive will be checked +to see if they are archives themselves. If so, their constituent members are +added to the archive. This is useful for avoiding archives containing archives.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--list</CODE +>, <CODE +CLASS="OPTION" +>-l</CODE +></DT +><DD +><P +>This will display a list of the files contained in the archive.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--debug</CODE +>, <CODE +CLASS="OPTION" +>-d</CODE +></DT +><DD +><P +>This option increases the debugging level. It is only useful for LWTOOLS +developers.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--help</CODE +>, <CODE +CLASS="OPTION" +>-?</CODE +></DT +><DD +><P +>This provides a listing of command line options and a brief description +of each.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--usage</CODE +></DT +><DD +><P +>This will display a usage summary +of each command line option.</P +></DD +><DT +><CODE +CLASS="OPTION" +>--version</CODE +>, <CODE +CLASS="OPTION" +>-V</CODE +></DT +><DD +><P +>This will display the version of LWLINK. +of each.</P +></DD +></DL +></DIV +></DIV +></DIV +><DIV +CLASS="NAVFOOTER" +><HR +ALIGN="LEFT" +WIDTH="100%"><TABLE +SUMMARY="Footer navigation table" +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +><A +HREF="x914.html" +ACCESSKEY="P" +>Prev</A +></TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +><A +HREF="index.html" +ACCESSKEY="H" +>Home</A +></TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +><A +HREF="c991.html" +ACCESSKEY="N" +>Next</A +></TD +></TR +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +>Format Specific Linking Notes</TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +> </TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +>Object Files</TD +></TR +></TABLE +></DIV +></BODY +></HTML +> \ No newline at end of file
--- a/docs/manual/c984.html Thu Apr 09 12:36:07 2015 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,376 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->Object Files</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="HOME" -TITLE="LW Tool Chain" -HREF="index.html"><LINK -REL="PREVIOUS" -TITLE="Libraries and LWAR" -HREF="c922.html"></HEAD -><BODY -CLASS="CHAPTER" -BGCOLOR="#FFFFFF" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="NAVHEADER" -><TABLE -SUMMARY="Header navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TH -COLSPAN="3" -ALIGN="center" ->LW Tool Chain</TH -></TR -><TR -><TD -WIDTH="10%" -ALIGN="left" -VALIGN="bottom" -><A -HREF="c922.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="80%" -ALIGN="center" -VALIGN="bottom" -></TD -><TD -WIDTH="10%" -ALIGN="right" -VALIGN="bottom" -> </TD -></TR -></TABLE -><HR -ALIGN="LEFT" -WIDTH="100%"></DIV -><DIV -CLASS="CHAPTER" -><H1 -><A -NAME="OBJCHAP" -></A ->Chapter 6. Object Files</H1 -><P ->LWTOOLS uses a proprietary object file format. It is proprietary in the sense -that it is specific to LWTOOLS, not that it is a hidden format. It would be -hard to keep it hidden in an open source tool chain anyway. This chapter -documents the object file format.</P -><P ->An object file consists of a series of sections each of which contains a -list of exported symbols, a list of incomplete references, and a list of -"local" symbols which may be used in calculating incomplete references. Each -section will obviously also contain the object code.</P -><P ->Exported symbols must be completely resolved to an address within the -section it is exported from. That is, an exported symbol must be a constant -rather than defined in terms of other symbols.</P -><P ->Each object file starts with a magic number and version number. The magic -number is the string "LWOBJ16" for this 16 bit object file format. The only -defined version number is currently 0. Thus, the first 8 bytes of the object -file are <FONT -COLOR="RED" ->4C574F424A313600</FONT -></P -><P ->Each section has the following items in order:</P -><P -></P -><UL -><LI -><P ->section name</P -></LI -><LI -><P ->flags</P -></LI -><LI -><P ->list of local symbols (and addresses within the section)</P -></LI -><LI -><P ->list of exported symbols (and addresses within the section)</P -></LI -><LI -><P ->list of incomplete references along with the expressions to calculate them</P -></LI -><LI -><P ->the actual object code (for non-BSS sections)</P -></LI -></UL -><P ->The section starts with the name of the section with a NUL termination -followed by a series of flag bytes terminated by NUL. There are only two -flag bytes defined. A NUL (0) indicates no more flags and a value of 1 -indicates the section is a BSS section. For a BSS section, no actual -code is included in the object file.</P -><P ->Either a NULL section name or end of file indicate the presence of no more -sections.</P -><P ->Each entry in the exported and local symbols table consists of the symbol -(NUL terminated) followed by two bytes which contain the value in big endian -order. The end of a symbol table is indicated by a NULL symbol name.</P -><P ->Each entry in the incomplete references table consists of an expression -followed by a 16 bit offset where the reference goes. Expressions are -defined as a series of terms up to an "end of expression" term. Each term -consists of a single byte which identifies the type of term (see below) -followed by any data required by the term. Then end of the list is flagged -by a NULL expression (only an end of expression term).</P -><DIV -CLASS="TABLE" -><A -NAME="AEN1009" -></A -><P -><B ->Table 6-1. Object File Term Types</B -></P -><TABLE -BORDER="1" -FRAME="border" -CLASS="CALSTABLE" -><COL><COL><THEAD -><TR -><TH ->TERMTYPE</TH -><TH ->Meaning</TH -></TR -></THEAD -><TBODY -><TR -><TD ->00</TD -><TD ->end of expression</TD -></TR -><TR -><TD ->01</TD -><TD ->integer (16 bit in big endian order follows)</TD -></TR -><TR -><TD ->02</TD -><TD -> external symbol reference (NUL terminated symbol name follows)</TD -></TR -><TR -><TD ->03</TD -><TD ->local symbol reference (NUL terminated symbol name follows)</TD -></TR -><TR -><TD ->04</TD -><TD ->operator (1 byte operator number)</TD -></TR -><TR -><TD ->05</TD -><TD ->section base address reference</TD -></TR -><TR -><TD ->FF</TD -><TD ->This term will set flags for the expression. Each one of these terms will set a single flag. All of them should be specified first in an expression. If they are not, the behaviour is undefined. The byte following is the flag. Flag 01 indicates an 8 bit relocation. Flag 02 indicates a zero-width relocation (see the EXTDEP pseudo op in LWASM).</TD -></TR -></TBODY -></TABLE -></DIV -><P ->External references are resolved using other object files while local -references are resolved using the local symbol table(s) from this file. This -allows local symbols that are not exported to have the same names as -exported symbols or external references.</P -><DIV -CLASS="TABLE" -><A -NAME="AEN1039" -></A -><P -><B ->Table 6-2. Object File Operator Numbers</B -></P -><TABLE -BORDER="1" -FRAME="border" -CLASS="CALSTABLE" -><COL><COL><THEAD -><TR -><TH ->Number</TH -><TH ->Operator</TH -></TR -></THEAD -><TBODY -><TR -><TD ->01</TD -><TD ->addition (+)</TD -></TR -><TR -><TD ->02</TD -><TD ->subtraction (-)</TD -></TR -><TR -><TD ->03</TD -><TD ->multiplication (*)</TD -></TR -><TR -><TD ->04</TD -><TD ->division (/)</TD -></TR -><TR -><TD ->05</TD -><TD ->modulus (%)</TD -></TR -><TR -><TD ->06</TD -><TD ->integer division (\) (same as division)</TD -></TR -><TR -><TD ->07</TD -><TD ->bitwise and</TD -></TR -><TR -><TD ->08</TD -><TD ->bitwise or</TD -></TR -><TR -><TD ->09</TD -><TD ->bitwise xor</TD -></TR -><TR -><TD ->0A</TD -><TD ->boolean and</TD -></TR -><TR -><TD ->0B</TD -><TD ->boolean or</TD -></TR -><TR -><TD ->0C</TD -><TD ->unary negation, 2's complement (-)</TD -></TR -><TR -><TD ->0D</TD -><TD ->unary 1's complement (^)</TD -></TR -></TBODY -></TABLE -></DIV -><P ->An expression is represented in a postfix manner with both operands for -binary operators preceding the operator and the single operand for unary -operators preceding the operator.</P -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -><A -HREF="c922.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="H" ->Home</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -> </TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" ->Libraries and LWAR</TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -> </TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -> </TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/manual/c991.html Thu Apr 09 12:51:02 2015 -0600 @@ -0,0 +1,376 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> +<HTML +><HEAD +><TITLE +>Object Files</TITLE +><META +NAME="GENERATOR" +CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK +REL="HOME" +TITLE="LW Tool Chain" +HREF="index.html"><LINK +REL="PREVIOUS" +TITLE="Libraries and LWAR" +HREF="c929.html"></HEAD +><BODY +CLASS="CHAPTER" +BGCOLOR="#FFFFFF" +TEXT="#000000" +LINK="#0000FF" +VLINK="#840084" +ALINK="#0000FF" +><DIV +CLASS="NAVHEADER" +><TABLE +SUMMARY="Header navigation table" +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TH +COLSPAN="3" +ALIGN="center" +>LW Tool Chain</TH +></TR +><TR +><TD +WIDTH="10%" +ALIGN="left" +VALIGN="bottom" +><A +HREF="c929.html" +ACCESSKEY="P" +>Prev</A +></TD +><TD +WIDTH="80%" +ALIGN="center" +VALIGN="bottom" +></TD +><TD +WIDTH="10%" +ALIGN="right" +VALIGN="bottom" +> </TD +></TR +></TABLE +><HR +ALIGN="LEFT" +WIDTH="100%"></DIV +><DIV +CLASS="CHAPTER" +><H1 +><A +NAME="OBJCHAP" +></A +>Chapter 6. Object Files</H1 +><P +>LWTOOLS uses a proprietary object file format. It is proprietary in the sense +that it is specific to LWTOOLS, not that it is a hidden format. It would be +hard to keep it hidden in an open source tool chain anyway. This chapter +documents the object file format.</P +><P +>An object file consists of a series of sections each of which contains a +list of exported symbols, a list of incomplete references, and a list of +"local" symbols which may be used in calculating incomplete references. Each +section will obviously also contain the object code.</P +><P +>Exported symbols must be completely resolved to an address within the +section it is exported from. That is, an exported symbol must be a constant +rather than defined in terms of other symbols.</P +><P +>Each object file starts with a magic number and version number. The magic +number is the string "LWOBJ16" for this 16 bit object file format. The only +defined version number is currently 0. Thus, the first 8 bytes of the object +file are <FONT +COLOR="RED" +>4C574F424A313600</FONT +></P +><P +>Each section has the following items in order:</P +><P +></P +><UL +><LI +><P +>section name</P +></LI +><LI +><P +>flags</P +></LI +><LI +><P +>list of local symbols (and addresses within the section)</P +></LI +><LI +><P +>list of exported symbols (and addresses within the section)</P +></LI +><LI +><P +>list of incomplete references along with the expressions to calculate them</P +></LI +><LI +><P +>the actual object code (for non-BSS sections)</P +></LI +></UL +><P +>The section starts with the name of the section with a NUL termination +followed by a series of flag bytes terminated by NUL. There are only two +flag bytes defined. A NUL (0) indicates no more flags and a value of 1 +indicates the section is a BSS section. For a BSS section, no actual +code is included in the object file.</P +><P +>Either a NULL section name or end of file indicate the presence of no more +sections.</P +><P +>Each entry in the exported and local symbols table consists of the symbol +(NUL terminated) followed by two bytes which contain the value in big endian +order. The end of a symbol table is indicated by a NULL symbol name.</P +><P +>Each entry in the incomplete references table consists of an expression +followed by a 16 bit offset where the reference goes. Expressions are +defined as a series of terms up to an "end of expression" term. Each term +consists of a single byte which identifies the type of term (see below) +followed by any data required by the term. Then end of the list is flagged +by a NULL expression (only an end of expression term).</P +><DIV +CLASS="TABLE" +><A +NAME="AEN1016" +></A +><P +><B +>Table 6-1. Object File Term Types</B +></P +><TABLE +BORDER="1" +FRAME="border" +CLASS="CALSTABLE" +><COL><COL><THEAD +><TR +><TH +>TERMTYPE</TH +><TH +>Meaning</TH +></TR +></THEAD +><TBODY +><TR +><TD +>00</TD +><TD +>end of expression</TD +></TR +><TR +><TD +>01</TD +><TD +>integer (16 bit in big endian order follows)</TD +></TR +><TR +><TD +>02</TD +><TD +> external symbol reference (NUL terminated symbol name follows)</TD +></TR +><TR +><TD +>03</TD +><TD +>local symbol reference (NUL terminated symbol name follows)</TD +></TR +><TR +><TD +>04</TD +><TD +>operator (1 byte operator number)</TD +></TR +><TR +><TD +>05</TD +><TD +>section base address reference</TD +></TR +><TR +><TD +>FF</TD +><TD +>This term will set flags for the expression. Each one of these terms will set a single flag. All of them should be specified first in an expression. If they are not, the behaviour is undefined. The byte following is the flag. Flag 01 indicates an 8 bit relocation. Flag 02 indicates a zero-width relocation (see the EXTDEP pseudo op in LWASM).</TD +></TR +></TBODY +></TABLE +></DIV +><P +>External references are resolved using other object files while local +references are resolved using the local symbol table(s) from this file. This +allows local symbols that are not exported to have the same names as +exported symbols or external references.</P +><DIV +CLASS="TABLE" +><A +NAME="AEN1046" +></A +><P +><B +>Table 6-2. Object File Operator Numbers</B +></P +><TABLE +BORDER="1" +FRAME="border" +CLASS="CALSTABLE" +><COL><COL><THEAD +><TR +><TH +>Number</TH +><TH +>Operator</TH +></TR +></THEAD +><TBODY +><TR +><TD +>01</TD +><TD +>addition (+)</TD +></TR +><TR +><TD +>02</TD +><TD +>subtraction (-)</TD +></TR +><TR +><TD +>03</TD +><TD +>multiplication (*)</TD +></TR +><TR +><TD +>04</TD +><TD +>division (/)</TD +></TR +><TR +><TD +>05</TD +><TD +>modulus (%)</TD +></TR +><TR +><TD +>06</TD +><TD +>integer division (\) (same as division)</TD +></TR +><TR +><TD +>07</TD +><TD +>bitwise and</TD +></TR +><TR +><TD +>08</TD +><TD +>bitwise or</TD +></TR +><TR +><TD +>09</TD +><TD +>bitwise xor</TD +></TR +><TR +><TD +>0A</TD +><TD +>boolean and</TD +></TR +><TR +><TD +>0B</TD +><TD +>boolean or</TD +></TR +><TR +><TD +>0C</TD +><TD +>unary negation, 2's complement (-)</TD +></TR +><TR +><TD +>0D</TD +><TD +>unary 1's complement (^)</TD +></TR +></TBODY +></TABLE +></DIV +><P +>An expression is represented in a postfix manner with both operands for +binary operators preceding the operator and the single operand for unary +operators preceding the operator.</P +></DIV +><DIV +CLASS="NAVFOOTER" +><HR +ALIGN="LEFT" +WIDTH="100%"><TABLE +SUMMARY="Footer navigation table" +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +><A +HREF="c929.html" +ACCESSKEY="P" +>Prev</A +></TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +><A +HREF="index.html" +ACCESSKEY="H" +>Home</A +></TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +> </TD +></TR +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +>Libraries and LWAR</TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +> </TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +> </TD +></TR +></TABLE +></DIV +></BODY +></HTML +> \ No newline at end of file
--- a/docs/manual/index.html Thu Apr 09 12:36:07 2015 -0600 +++ b/docs/manual/index.html Thu Apr 09 12:51:02 2015 -0600 @@ -200,36 +200,36 @@ ></DD ><DT >4. <A -HREF="c727.html" +HREF="c734.html" >LWLINK</A ></DT ><DD ><DL ><DT >4.1. <A -HREF="c727.html#AEN730" +HREF="c734.html#AEN737" >Command Line Options</A ></DT ><DT >4.2. <A -HREF="x827.html" +HREF="x834.html" >Linker Operation</A ></DT ><DT >4.3. <A -HREF="x841.html" +HREF="x848.html" >Linking Scripts</A ></DT ><DT >4.4. <A -HREF="x907.html" +HREF="x914.html" >Format Specific Linking Notes</A ></DT ><DD ><DL ><DT >4.4.1. <A -HREF="x907.html#AEN910" +HREF="x914.html#AEN917" >OS9 Modules</A ></DT ></DL @@ -238,21 +238,21 @@ ></DD ><DT >5. <A -HREF="c922.html" +HREF="c929.html" >Libraries and LWAR</A ></DT ><DD ><DL ><DT >5.1. <A -HREF="c922.html#AEN926" +HREF="c929.html#AEN933" >Command Line Options</A ></DT ></DL ></DD ><DT >6. <A -HREF="c984.html" +HREF="c991.html" >Object Files</A ></DT ></DL @@ -267,12 +267,12 @@ ></DT ><DT >6-1. <A -HREF="c984.html#AEN1009" +HREF="c991.html#AEN1016" >Object File Term Types</A ></DT ><DT >6-2. <A -HREF="c984.html#AEN1039" +HREF="c991.html#AEN1046" >Object File Operator Numbers</A ></DT ></DL
--- a/docs/manual/manual.html Thu Apr 09 12:36:07 2015 -0600 +++ b/docs/manual/manual.html Thu Apr 09 12:51:02 2015 -0600 @@ -197,36 +197,36 @@ ></DD ><DT >4. <A -HREF="#AEN727" +HREF="#AEN734" >LWLINK</A ></DT ><DD ><DL ><DT >4.1. <A -HREF="#AEN730" +HREF="#AEN737" >Command Line Options</A ></DT ><DT >4.2. <A -HREF="#AEN827" +HREF="#AEN834" >Linker Operation</A ></DT ><DT >4.3. <A -HREF="#AEN841" +HREF="#AEN848" >Linking Scripts</A ></DT ><DT >4.4. <A -HREF="#AEN907" +HREF="#AEN914" >Format Specific Linking Notes</A ></DT ><DD ><DL ><DT >4.4.1. <A -HREF="#AEN910" +HREF="#AEN917" >OS9 Modules</A ></DT ></DL @@ -235,14 +235,14 @@ ></DD ><DT >5. <A -HREF="#AEN922" +HREF="#AEN929" >Libraries and LWAR</A ></DT ><DD ><DL ><DT >5.1. <A -HREF="#AEN926" +HREF="#AEN933" >Command Line Options</A ></DT ></DL @@ -264,12 +264,12 @@ ></DT ><DT >6-1. <A -HREF="#AEN1009" +HREF="#AEN1016" >Object File Term Types</A ></DT ><DT >6-2. <A -HREF="#AEN1039" +HREF="#AEN1046" >Object File Operator Numbers</A ></DT ></DL @@ -2379,6 +2379,37 @@ yet evaluate to a constant value at the point where the conditional appears, the assembler will still complain about a non constant condition.</P ></DD +><DT +>forwardrefmax</DT +><DD +><P +>This pragma will disable forward reference optimization completely. +Ordinarily, LWASM will attempt to select the shortest possible addressing +mode for forward references. However, in many source files, especially +those not using the PCR relative addressing modes, this optimization is +pointless since the assembler will almost certainly settle on a 16 bit +offset or address. If all variables in the direct page are defined before +the main body of the code, the benefit of forward reference optimization +almost certainly vanishes completely. However, the cost of doing that +optimization remains and can result in a very long assembly time.</P +><P +>Enabling this pragma will cause all forward references to use the +maximum offset or address size, much the same has EDTASM and other pure +two pass assemblers do. The side effect is that all line lengths and +symbol values are fully resolved after the initial parsing pass and the +amount of work to resolve everything becomes almost nil.</P +><P +>While this pragma can be applied selectively to sections of source +code (use *PRAGMA if doing so and compatibility with other assemblers +is desired), it is likely more useful when provided as a command line +pragma.</P +><P +>It should be noted that the presence or absence of this pragma +will not change the correctness of the generated code unless cycle counts +or byte counts are critical (which they usually are not). It also will +not override the operand size override prefixes (< and >). It only +applies when the assembler is left to guess what the operand size is.</P +></DD ></DL ></DIV ><P @@ -2403,7 +2434,7 @@ CLASS="CHAPTER" ><HR><H1 ><A -NAME="AEN727" +NAME="AEN734" ></A >Chapter 4. LWLINK</H1 ><P @@ -2414,7 +2445,7 @@ ><HR><H2 CLASS="SECTION" ><A -NAME="AEN730" +NAME="AEN737" >4.1. Command Line Options</A ></H2 ><P @@ -2611,7 +2642,7 @@ ><HR><H2 CLASS="SECTION" ><A -NAME="AEN827" +NAME="AEN834" >4.2. Linker Operation</A ></H2 ><P @@ -2667,7 +2698,7 @@ ><HR><H2 CLASS="SECTION" ><A -NAME="AEN841" +NAME="AEN848" >4.3. Linking Scripts</A ></H2 ><P @@ -2871,7 +2902,7 @@ ><HR><H2 CLASS="SECTION" ><A -NAME="AEN907" +NAME="AEN914" >4.4. Format Specific Linking Notes</A ></H2 ><P @@ -2884,7 +2915,7 @@ ><HR><H3 CLASS="SECTION" ><A -NAME="AEN910" +NAME="AEN917" >4.4.1. OS9 Modules</A ></H3 ><P @@ -2960,7 +2991,7 @@ CLASS="CHAPTER" ><HR><H1 ><A -NAME="AEN922" +NAME="AEN929" ></A >Chapter 5. Libraries and LWAR</H1 ><P @@ -2979,7 +3010,7 @@ ><HR><H2 CLASS="SECTION" ><A -NAME="AEN926" +NAME="AEN933" >5.1. Command Line Options</A ></H2 ><P @@ -3180,7 +3211,7 @@ ><DIV CLASS="TABLE" ><A -NAME="AEN1009" +NAME="AEN1016" ></A ><P ><B @@ -3252,7 +3283,7 @@ ><DIV CLASS="TABLE" ><A -NAME="AEN1039" +NAME="AEN1046" ></A ><P ><B
--- a/docs/manual/x54.html Thu Apr 09 12:36:07 2015 -0600 +++ b/docs/manual/x54.html Thu Apr 09 12:51:02 2015 -0600 @@ -79,7 +79,7 @@ ><P >LWASM supports generating a proprietary object file format which is described in <A -HREF="c984.html" +HREF="c991.html" >Chapter 6</A >. LWLINK is then used to link these object files into a final binary in any of LWLINK's supported binary
--- a/docs/manual/x628.html Thu Apr 09 12:36:07 2015 -0600 +++ b/docs/manual/x628.html Thu Apr 09 12:51:02 2015 -0600 @@ -17,7 +17,7 @@ HREF="x564.html"><LINK REL="NEXT" TITLE="LWLINK" -HREF="c727.html"></HEAD +HREF="c734.html"></HEAD ><BODY CLASS="SECTION" BGCOLOR="#FFFFFF" @@ -59,7 +59,7 @@ ALIGN="right" VALIGN="bottom" ><A -HREF="c727.html" +HREF="c734.html" ACCESSKEY="N" >Next</A ></TD @@ -341,6 +341,37 @@ yet evaluate to a constant value at the point where the conditional appears, the assembler will still complain about a non constant condition.</P ></DD +><DT +>forwardrefmax</DT +><DD +><P +>This pragma will disable forward reference optimization completely. +Ordinarily, LWASM will attempt to select the shortest possible addressing +mode for forward references. However, in many source files, especially +those not using the PCR relative addressing modes, this optimization is +pointless since the assembler will almost certainly settle on a 16 bit +offset or address. If all variables in the direct page are defined before +the main body of the code, the benefit of forward reference optimization +almost certainly vanishes completely. However, the cost of doing that +optimization remains and can result in a very long assembly time.</P +><P +>Enabling this pragma will cause all forward references to use the +maximum offset or address size, much the same has EDTASM and other pure +two pass assemblers do. The side effect is that all line lengths and +symbol values are fully resolved after the initial parsing pass and the +amount of work to resolve everything becomes almost nil.</P +><P +>While this pragma can be applied selectively to sections of source +code (use *PRAGMA if doing so and compatibility with other assemblers +is desired), it is likely more useful when provided as a command line +pragma.</P +><P +>It should be noted that the presence or absence of this pragma +will not change the correctness of the generated code unless cycle counts +or byte counts are critical (which they usually are not). It also will +not override the operand size override prefixes (< and >). It only +applies when the assembler is left to guess what the operand size is.</P +></DD ></DL ></DIV ><P @@ -394,7 +425,7 @@ ALIGN="right" VALIGN="top" ><A -HREF="c727.html" +HREF="c734.html" ACCESSKEY="N" >Next</A ></TD
--- a/docs/manual/x827.html Thu Apr 09 12:36:07 2015 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->Linker Operation</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="HOME" -TITLE="LW Tool Chain" -HREF="index.html"><LINK -REL="UP" -TITLE="LWLINK" -HREF="c727.html"><LINK -REL="PREVIOUS" -TITLE="LWLINK" -HREF="c727.html"><LINK -REL="NEXT" -TITLE="Linking Scripts" -HREF="x841.html"></HEAD -><BODY -CLASS="SECTION" -BGCOLOR="#FFFFFF" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="NAVHEADER" -><TABLE -SUMMARY="Header navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TH -COLSPAN="3" -ALIGN="center" ->LW Tool Chain</TH -></TR -><TR -><TD -WIDTH="10%" -ALIGN="left" -VALIGN="bottom" -><A -HREF="c727.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="80%" -ALIGN="center" -VALIGN="bottom" ->Chapter 4. LWLINK</TD -><TD -WIDTH="10%" -ALIGN="right" -VALIGN="bottom" -><A -HREF="x841.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -></TABLE -><HR -ALIGN="LEFT" -WIDTH="100%"></DIV -><DIV -CLASS="SECTION" -><H1 -CLASS="SECTION" -><A -NAME="AEN827" ->4.2. Linker Operation</A -></H1 -><P -> LWLINK takes one or more files in supported input formats and links them -into a single binary. Currently supported formats are the LWTOOLS object -file format and the archive format used by LWAR. While the precise method is -slightly different, linking can be conceptualized as the following steps. </P -><P -></P -><OL -TYPE="1" -><LI -><P ->First, the linker loads a linking script. If no script is specified, it -loads a built-in default script based on the output format selected. This -script tells the linker how to lay out the various sections in the final -binary.</P -></LI -><LI -><P ->Next, the linker reads all the input files into memory. At this time, it -flags any format errors in those files. It constructs a table of symbols -for each object at this time.</P -></LI -><LI -><P ->The linker then proceeds with organizing the sections loaded from each file -according to the linking script. As it does so, it is able to assign addresses -to each symbol defined in each object file. At this time, the linker may -also collapse different instances of the same section name into a single -section by appending the data from each subsequent instance of the section -to the first instance of the section.</P -></LI -><LI -><P ->Next, the linker looks through every object file for every incomplete reference. -It then attempts to fully resolve that reference. If it cannot do so, it -throws an error. Once a reference is resolved, the value is placed into -the binary code at the specified section. It should be noted that an -incomplete reference can reference either a symbol internal to the object -file or an external symbol which is in the export list of another object -file.</P -></LI -><LI -><P ->If all of the above steps are successful, the linker opens the output file -and actually constructs the binary.</P -></LI -></OL -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -><A -HREF="c727.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="H" ->Home</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -><A -HREF="x841.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" ->LWLINK</TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="c727.html" -ACCESSKEY="U" ->Up</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" ->Linking Scripts</TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/manual/x834.html Thu Apr 09 12:51:02 2015 -0600 @@ -0,0 +1,191 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> +<HTML +><HEAD +><TITLE +>Linker Operation</TITLE +><META +NAME="GENERATOR" +CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK +REL="HOME" +TITLE="LW Tool Chain" +HREF="index.html"><LINK +REL="UP" +TITLE="LWLINK" +HREF="c734.html"><LINK +REL="PREVIOUS" +TITLE="LWLINK" +HREF="c734.html"><LINK +REL="NEXT" +TITLE="Linking Scripts" +HREF="x848.html"></HEAD +><BODY +CLASS="SECTION" +BGCOLOR="#FFFFFF" +TEXT="#000000" +LINK="#0000FF" +VLINK="#840084" +ALINK="#0000FF" +><DIV +CLASS="NAVHEADER" +><TABLE +SUMMARY="Header navigation table" +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TH +COLSPAN="3" +ALIGN="center" +>LW Tool Chain</TH +></TR +><TR +><TD +WIDTH="10%" +ALIGN="left" +VALIGN="bottom" +><A +HREF="c734.html" +ACCESSKEY="P" +>Prev</A +></TD +><TD +WIDTH="80%" +ALIGN="center" +VALIGN="bottom" +>Chapter 4. LWLINK</TD +><TD +WIDTH="10%" +ALIGN="right" +VALIGN="bottom" +><A +HREF="x848.html" +ACCESSKEY="N" +>Next</A +></TD +></TR +></TABLE +><HR +ALIGN="LEFT" +WIDTH="100%"></DIV +><DIV +CLASS="SECTION" +><H1 +CLASS="SECTION" +><A +NAME="AEN834" +>4.2. Linker Operation</A +></H1 +><P +> LWLINK takes one or more files in supported input formats and links them +into a single binary. Currently supported formats are the LWTOOLS object +file format and the archive format used by LWAR. While the precise method is +slightly different, linking can be conceptualized as the following steps. </P +><P +></P +><OL +TYPE="1" +><LI +><P +>First, the linker loads a linking script. If no script is specified, it +loads a built-in default script based on the output format selected. This +script tells the linker how to lay out the various sections in the final +binary.</P +></LI +><LI +><P +>Next, the linker reads all the input files into memory. At this time, it +flags any format errors in those files. It constructs a table of symbols +for each object at this time.</P +></LI +><LI +><P +>The linker then proceeds with organizing the sections loaded from each file +according to the linking script. As it does so, it is able to assign addresses +to each symbol defined in each object file. At this time, the linker may +also collapse different instances of the same section name into a single +section by appending the data from each subsequent instance of the section +to the first instance of the section.</P +></LI +><LI +><P +>Next, the linker looks through every object file for every incomplete reference. +It then attempts to fully resolve that reference. If it cannot do so, it +throws an error. Once a reference is resolved, the value is placed into +the binary code at the specified section. It should be noted that an +incomplete reference can reference either a symbol internal to the object +file or an external symbol which is in the export list of another object +file.</P +></LI +><LI +><P +>If all of the above steps are successful, the linker opens the output file +and actually constructs the binary.</P +></LI +></OL +></DIV +><DIV +CLASS="NAVFOOTER" +><HR +ALIGN="LEFT" +WIDTH="100%"><TABLE +SUMMARY="Footer navigation table" +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +><A +HREF="c734.html" +ACCESSKEY="P" +>Prev</A +></TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +><A +HREF="index.html" +ACCESSKEY="H" +>Home</A +></TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +><A +HREF="x848.html" +ACCESSKEY="N" +>Next</A +></TD +></TR +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +>LWLINK</TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +><A +HREF="c734.html" +ACCESSKEY="U" +>Up</A +></TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +>Linking Scripts</TD +></TR +></TABLE +></DIV +></BODY +></HTML +> \ No newline at end of file
--- a/docs/manual/x841.html Thu Apr 09 12:36:07 2015 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,339 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->Linking Scripts</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="HOME" -TITLE="LW Tool Chain" -HREF="index.html"><LINK -REL="UP" -TITLE="LWLINK" -HREF="c727.html"><LINK -REL="PREVIOUS" -TITLE="Linker Operation" -HREF="x827.html"><LINK -REL="NEXT" -TITLE="Format Specific Linking Notes" -HREF="x907.html"></HEAD -><BODY -CLASS="SECTION" -BGCOLOR="#FFFFFF" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="NAVHEADER" -><TABLE -SUMMARY="Header navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TH -COLSPAN="3" -ALIGN="center" ->LW Tool Chain</TH -></TR -><TR -><TD -WIDTH="10%" -ALIGN="left" -VALIGN="bottom" -><A -HREF="x827.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="80%" -ALIGN="center" -VALIGN="bottom" ->Chapter 4. LWLINK</TD -><TD -WIDTH="10%" -ALIGN="right" -VALIGN="bottom" -><A -HREF="x907.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -></TABLE -><HR -ALIGN="LEFT" -WIDTH="100%"></DIV -><DIV -CLASS="SECTION" -><H1 -CLASS="SECTION" -><A -NAME="AEN841" ->4.3. Linking Scripts</A -></H1 -><P ->A linker script is used to instruct the linker about how to assemble the -various sections into a completed binary. It consists of a series of -directives which are considered in the order they are encountered.</P -><P ->The sections will appear in the resulting binary in the order they are -specified in the script file. If a referenced section is not found, the linker will behave as though the -section did exist but had a zero size, no relocations, and no exports. -A section should only be referenced once. Any subsequent references will have -an undefined effect.</P -><P ->All numbers are in linking scripts are specified in hexadecimal. All directives -are case sensitive although the hexadecimal numbers are not.</P -><P ->A section name can be specified as a "*", then any section not -already matched by the script will be matched. The "*" can be followed -by a comma and a flag to narrow the section down slightly, also. -If the flag is "!bss", then any section that is not flagged as a bss section -will be matched. If the flag is "bss", then any section that is flagged as -bss will be matched.</P -><P ->The following directives are understood in a linker script.</P -><P -></P -><DIV -CLASS="VARIABLELIST" -><DL -><DT ->sectopt <CODE -CLASS="PARAMETER" ->section</CODE -> padafter <CODE -CLASS="PARAMETER" ->byte,...</CODE -></DT -><DD -><P -> This will cause the linker to append the specified list of byte values -(specified in hexadecimal separated by commas) to the end of the named -section. This is done once all instances of the specified section are -collected together. This has no effect if the specified section does not -appear anywhere in any of the objects specified for linking. </P -><P -> If code depends on the presence of this padding somewhere, it is sufficient -to include an empty section of the specified name in the object that depends -on it. </P -></DD -><DT ->define basesympat <CODE -CLASS="PARAMETER" ->string</CODE -></DT -><DD -><P -> This causes the linker to define a symbol for the ultimate base address of -each section using the pattern specified by <CODE -CLASS="PARAMETER" ->string</CODE ->. -In the string, %s can appear exactly once and will be replaced with the -section name. The base address is calculated after all instances of each -section have been collapsed together. </P -><P -> It should be noted that if none of the objects to be linked contains a -particular section name, there will be no base symbol defined for it, even -if it is listed explicitly in the link script. If code depends on the -presence of these symbols, it is sufficient to include an empty section of -the specified name in the object that depends on it. </P -><P -> If the pattern resolves to the same string for multiple -sections, the results are undefined. </P -></DD -><DT ->define lensympat <CODE -CLASS="PARAMETER" ->string</CODE -></DT -><DD -><P -> This causes the linker to define a symbol for the ultimate length of each -section using the pattern specified by <CODE -CLASS="PARAMETER" ->string</CODE ->. In -the string, %s can appear exactly once and will be replaced with the section -name. The length is calculated after all instances of a section have been -collapsed together. </P -><P -> It should be noted that if none of the objects to be linked contains a -particular section name, there will be no length symbol defined for it, even -if it is listed explicitly in the link script. If code depends on the -presence of these symbols, it is sufficient to include an empty section of -the specified name in the object that depends on it. </P -><P ->If the pattern resolves to the same string for multiple -sections, the results are undefined. </P -></DD -><DT ->section <CODE -CLASS="PARAMETER" ->name</CODE -> load <CODE -CLASS="PARAMETER" ->addr</CODE -></DT -><DD -><P -> This causes the section <CODE -CLASS="PARAMETER" ->name</CODE -> to load at -<CODE -CLASS="PARAMETER" ->addr</CODE ->. For the raw target, only one "load at" entry is -allowed for non-bss sections and it must be the first one. For raw targets, -it affects the addresses the linker assigns to symbols but has no other -affect on the output. bss sections may all have separate load addresses but -since they will not appear in the binary anyway, this is okay.</P -><P ->For the decb target, each "load" entry will cause a new "block" to be -output to the binary which will contain the load address. It is legal for -sections to overlap in this manner - the linker assumes the loader will sort -everything out.</P -></DD -><DT ->section <CODE -CLASS="PARAMETER" ->name</CODE -> high <CODE -CLASS="PARAMETER" ->addr</CODE -></DT -><DD -><P -> This causes the section <CODE -CLASS="PARAMETER" ->name</CODE -> to load with its end -address just below <CODE -CLASS="PARAMETER" ->addr</CODE ->. Subsequent sections are -loaded at progressively lower addresses. This may lead to inefficient file -encoding for some targets. As of this writing, it will also almost -certainly do the wrong thing for a raw target. </P -><P -> This is useful for aligning a block of code with high memory. As an -example, if the total size of a section is $100 bytes and a high address of -$FE00 is specified, the section will actually load at $FD00. </P -></DD -><DT ->section <CODE -CLASS="PARAMETER" ->name</CODE -></DT -><DD -><P -> This will cause the section <CODE -CLASS="PARAMETER" ->name</CODE -> to load after the previously listed -section.</P -></DD -><DT ->entry <CODE -CLASS="PARAMETER" ->addr or sym</CODE -></DT -><DD -><P ->This will cause the execution address (entry point) to be the address -specified (in hex) or the specified symbol name. The symbol name must -match a symbol that is exported by one of the object files being linked. -This has no effect for targets that do not encode the entry point into the -resulting file. If not specified, the entry point is assumed to be address 0 -which is probably not what you want. The default link scripts for targets -that support this directive automatically starts at the beginning of the -first section (usually "init" or "code") that is emitted in the binary.</P -></DD -><DT ->pad <CODE -CLASS="PARAMETER" ->size</CODE -></DT -><DD -><P ->This will cause the output file to be padded with NUL bytes to be exactly -<CODE -CLASS="PARAMETER" ->size</CODE -> bytes in length. This only makes sense for a raw target.</P -></DD -></DL -></DIV -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -><A -HREF="x827.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="H" ->Home</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -><A -HREF="x907.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" ->Linker Operation</TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="c727.html" -ACCESSKEY="U" ->Up</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" ->Format Specific Linking Notes</TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/manual/x848.html Thu Apr 09 12:51:02 2015 -0600 @@ -0,0 +1,339 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> +<HTML +><HEAD +><TITLE +>Linking Scripts</TITLE +><META +NAME="GENERATOR" +CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK +REL="HOME" +TITLE="LW Tool Chain" +HREF="index.html"><LINK +REL="UP" +TITLE="LWLINK" +HREF="c734.html"><LINK +REL="PREVIOUS" +TITLE="Linker Operation" +HREF="x834.html"><LINK +REL="NEXT" +TITLE="Format Specific Linking Notes" +HREF="x914.html"></HEAD +><BODY +CLASS="SECTION" +BGCOLOR="#FFFFFF" +TEXT="#000000" +LINK="#0000FF" +VLINK="#840084" +ALINK="#0000FF" +><DIV +CLASS="NAVHEADER" +><TABLE +SUMMARY="Header navigation table" +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TH +COLSPAN="3" +ALIGN="center" +>LW Tool Chain</TH +></TR +><TR +><TD +WIDTH="10%" +ALIGN="left" +VALIGN="bottom" +><A +HREF="x834.html" +ACCESSKEY="P" +>Prev</A +></TD +><TD +WIDTH="80%" +ALIGN="center" +VALIGN="bottom" +>Chapter 4. LWLINK</TD +><TD +WIDTH="10%" +ALIGN="right" +VALIGN="bottom" +><A +HREF="x914.html" +ACCESSKEY="N" +>Next</A +></TD +></TR +></TABLE +><HR +ALIGN="LEFT" +WIDTH="100%"></DIV +><DIV +CLASS="SECTION" +><H1 +CLASS="SECTION" +><A +NAME="AEN848" +>4.3. Linking Scripts</A +></H1 +><P +>A linker script is used to instruct the linker about how to assemble the +various sections into a completed binary. It consists of a series of +directives which are considered in the order they are encountered.</P +><P +>The sections will appear in the resulting binary in the order they are +specified in the script file. If a referenced section is not found, the linker will behave as though the +section did exist but had a zero size, no relocations, and no exports. +A section should only be referenced once. Any subsequent references will have +an undefined effect.</P +><P +>All numbers are in linking scripts are specified in hexadecimal. All directives +are case sensitive although the hexadecimal numbers are not.</P +><P +>A section name can be specified as a "*", then any section not +already matched by the script will be matched. The "*" can be followed +by a comma and a flag to narrow the section down slightly, also. +If the flag is "!bss", then any section that is not flagged as a bss section +will be matched. If the flag is "bss", then any section that is flagged as +bss will be matched.</P +><P +>The following directives are understood in a linker script.</P +><P +></P +><DIV +CLASS="VARIABLELIST" +><DL +><DT +>sectopt <CODE +CLASS="PARAMETER" +>section</CODE +> padafter <CODE +CLASS="PARAMETER" +>byte,...</CODE +></DT +><DD +><P +> This will cause the linker to append the specified list of byte values +(specified in hexadecimal separated by commas) to the end of the named +section. This is done once all instances of the specified section are +collected together. This has no effect if the specified section does not +appear anywhere in any of the objects specified for linking. </P +><P +> If code depends on the presence of this padding somewhere, it is sufficient +to include an empty section of the specified name in the object that depends +on it. </P +></DD +><DT +>define basesympat <CODE +CLASS="PARAMETER" +>string</CODE +></DT +><DD +><P +> This causes the linker to define a symbol for the ultimate base address of +each section using the pattern specified by <CODE +CLASS="PARAMETER" +>string</CODE +>. +In the string, %s can appear exactly once and will be replaced with the +section name. The base address is calculated after all instances of each +section have been collapsed together. </P +><P +> It should be noted that if none of the objects to be linked contains a +particular section name, there will be no base symbol defined for it, even +if it is listed explicitly in the link script. If code depends on the +presence of these symbols, it is sufficient to include an empty section of +the specified name in the object that depends on it. </P +><P +> If the pattern resolves to the same string for multiple +sections, the results are undefined. </P +></DD +><DT +>define lensympat <CODE +CLASS="PARAMETER" +>string</CODE +></DT +><DD +><P +> This causes the linker to define a symbol for the ultimate length of each +section using the pattern specified by <CODE +CLASS="PARAMETER" +>string</CODE +>. In +the string, %s can appear exactly once and will be replaced with the section +name. The length is calculated after all instances of a section have been +collapsed together. </P +><P +> It should be noted that if none of the objects to be linked contains a +particular section name, there will be no length symbol defined for it, even +if it is listed explicitly in the link script. If code depends on the +presence of these symbols, it is sufficient to include an empty section of +the specified name in the object that depends on it. </P +><P +>If the pattern resolves to the same string for multiple +sections, the results are undefined. </P +></DD +><DT +>section <CODE +CLASS="PARAMETER" +>name</CODE +> load <CODE +CLASS="PARAMETER" +>addr</CODE +></DT +><DD +><P +> This causes the section <CODE +CLASS="PARAMETER" +>name</CODE +> to load at +<CODE +CLASS="PARAMETER" +>addr</CODE +>. For the raw target, only one "load at" entry is +allowed for non-bss sections and it must be the first one. For raw targets, +it affects the addresses the linker assigns to symbols but has no other +affect on the output. bss sections may all have separate load addresses but +since they will not appear in the binary anyway, this is okay.</P +><P +>For the decb target, each "load" entry will cause a new "block" to be +output to the binary which will contain the load address. It is legal for +sections to overlap in this manner - the linker assumes the loader will sort +everything out.</P +></DD +><DT +>section <CODE +CLASS="PARAMETER" +>name</CODE +> high <CODE +CLASS="PARAMETER" +>addr</CODE +></DT +><DD +><P +> This causes the section <CODE +CLASS="PARAMETER" +>name</CODE +> to load with its end +address just below <CODE +CLASS="PARAMETER" +>addr</CODE +>. Subsequent sections are +loaded at progressively lower addresses. This may lead to inefficient file +encoding for some targets. As of this writing, it will also almost +certainly do the wrong thing for a raw target. </P +><P +> This is useful for aligning a block of code with high memory. As an +example, if the total size of a section is $100 bytes and a high address of +$FE00 is specified, the section will actually load at $FD00. </P +></DD +><DT +>section <CODE +CLASS="PARAMETER" +>name</CODE +></DT +><DD +><P +> This will cause the section <CODE +CLASS="PARAMETER" +>name</CODE +> to load after the previously listed +section.</P +></DD +><DT +>entry <CODE +CLASS="PARAMETER" +>addr or sym</CODE +></DT +><DD +><P +>This will cause the execution address (entry point) to be the address +specified (in hex) or the specified symbol name. The symbol name must +match a symbol that is exported by one of the object files being linked. +This has no effect for targets that do not encode the entry point into the +resulting file. If not specified, the entry point is assumed to be address 0 +which is probably not what you want. The default link scripts for targets +that support this directive automatically starts at the beginning of the +first section (usually "init" or "code") that is emitted in the binary.</P +></DD +><DT +>pad <CODE +CLASS="PARAMETER" +>size</CODE +></DT +><DD +><P +>This will cause the output file to be padded with NUL bytes to be exactly +<CODE +CLASS="PARAMETER" +>size</CODE +> bytes in length. This only makes sense for a raw target.</P +></DD +></DL +></DIV +></DIV +><DIV +CLASS="NAVFOOTER" +><HR +ALIGN="LEFT" +WIDTH="100%"><TABLE +SUMMARY="Footer navigation table" +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +><A +HREF="x834.html" +ACCESSKEY="P" +>Prev</A +></TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +><A +HREF="index.html" +ACCESSKEY="H" +>Home</A +></TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +><A +HREF="x914.html" +ACCESSKEY="N" +>Next</A +></TD +></TR +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +>Linker Operation</TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +><A +HREF="c734.html" +ACCESSKEY="U" +>Up</A +></TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +>Format Specific Linking Notes</TD +></TR +></TABLE +></DIV +></BODY +></HTML +> \ No newline at end of file
--- a/docs/manual/x907.html Thu Apr 09 12:36:07 2015 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->Format Specific Linking Notes</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="HOME" -TITLE="LW Tool Chain" -HREF="index.html"><LINK -REL="UP" -TITLE="LWLINK" -HREF="c727.html"><LINK -REL="PREVIOUS" -TITLE="Linking Scripts" -HREF="x841.html"><LINK -REL="NEXT" -TITLE="Libraries and LWAR" -HREF="c922.html"></HEAD -><BODY -CLASS="SECTION" -BGCOLOR="#FFFFFF" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="NAVHEADER" -><TABLE -SUMMARY="Header navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TH -COLSPAN="3" -ALIGN="center" ->LW Tool Chain</TH -></TR -><TR -><TD -WIDTH="10%" -ALIGN="left" -VALIGN="bottom" -><A -HREF="x841.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="80%" -ALIGN="center" -VALIGN="bottom" ->Chapter 4. LWLINK</TD -><TD -WIDTH="10%" -ALIGN="right" -VALIGN="bottom" -><A -HREF="c922.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -></TABLE -><HR -ALIGN="LEFT" -WIDTH="100%"></DIV -><DIV -CLASS="SECTION" -><H1 -CLASS="SECTION" -><A -NAME="AEN907" ->4.4. Format Specific Linking Notes</A -></H1 -><P ->Some formats require special information to be able to generate actual -binaries. If the specific format you are interested in is not listed in -this section, then there is nothing special you need to know about to create -a final binary.</P -><DIV -CLASS="SECTION" -><H2 -CLASS="SECTION" -><A -NAME="AEN910" ->4.4.1. OS9 Modules</A -></H2 -><P ->OS9 modules need to embed several items into the module header. These -items are the type of module, the langauge of the module, the module -attributes, the module revision number, the data size (bss), and the -execution offset. These are all either calculated or default to reasonable -values.</P -><P ->The data size is calcuated as the sum of all sections named "bss" or -".bss" in all object files that are linked together.</P -><P ->The execution offset is calculated from the address of the special -symbol "__start" which must be an exported (external) symbol in one of the -objects to be linked.</P -><P ->The type defaults to "Prgrm" or "Program module". The language -defaults to "Objct" or "6809 object code". Attributes default to enabling -the re-entrant flag. And finally, the revision defaults to zero.</P -><P ->The embedded module name is the output filename. If the output -filename includes more than just the filename, this will probably not be -what you want.</P -><P ->The type, language, attributes, revision, and module name can all be -overridden by providing a special section in exactly one of the object files -to be linked. This section is called "__os9" (note the two underscores). -To override the type, language, attributes, or revision values, define a -non-exported symbol in this section called "type", "lang", "attr", or "rev" -respectively. Any other symbols defined are ignored. To override the -module name, include as the only actual code in the section a NUL terminated -string (the FCN directive is useful for this). If there is no code in the -section or it beings with a NUL, the default name will be used. Any of the -preceeding that are not defined in the special section will retain their -default values.</P -><P ->The built-in link script for OS9 modules will place the following -sections, in order, in the module: "code", ".text", "data", ".data". It -will merge all sections with the name "bss" or ".bss" into the "data" -section. All other section names are ignored. What this means is that you -must define your data variables in the a section called "bss" or ".bss" even -though you will be refencing them all as offsets from U. This does have the -unpleasant side effect that all BSS references will end up being 16 bit -offsets because the assembler cannot know what the offset will be once the -linker is finished its work. Thus, if the tightest possible code is -required, having LWASM directly output the module is a better choice.</P -><P ->While the built-in link script is probably sufficient for most -purposes, you can provide your own script. If you provide a custom link -script, you must start your code and data sections at location 000D to -accommodate the module header. Otherwise, you will have an incorrect -location for the execution offset. You must use the ENTRY directive in the -script to define the entry point for the module.</P -><P ->It should also be obvious from the above that you cannot mix the bss -(rmb) definitions with the module code when linking separately. Those -familiar with typical module creation will probably find this an unpleasant -difference but it is unavoidable.</P -><P ->It should also be noted that direct page references should also be -avoided because you cannot know ahead of time whether the linker is going to -end up putting a particular variable in the first 256 bytes of the module's -data space. If, however, you know for certain you will have less than 256 -bytes of defined data space across all of the object files that will be -linked, you can instead use forced DP addressing for your data addresses -instead of the ,u notation. When linking with 3rd party libraries, this -practice should be avoided. Also, when creating libraries, always use the -offset from U technique.</P -></DIV -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -><A -HREF="x841.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="H" ->Home</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -><A -HREF="c922.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" ->Linking Scripts</TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="c727.html" -ACCESSKEY="U" ->Up</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" ->Libraries and LWAR</TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/manual/x914.html Thu Apr 09 12:51:02 2015 -0600 @@ -0,0 +1,224 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> +<HTML +><HEAD +><TITLE +>Format Specific Linking Notes</TITLE +><META +NAME="GENERATOR" +CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK +REL="HOME" +TITLE="LW Tool Chain" +HREF="index.html"><LINK +REL="UP" +TITLE="LWLINK" +HREF="c734.html"><LINK +REL="PREVIOUS" +TITLE="Linking Scripts" +HREF="x848.html"><LINK +REL="NEXT" +TITLE="Libraries and LWAR" +HREF="c929.html"></HEAD +><BODY +CLASS="SECTION" +BGCOLOR="#FFFFFF" +TEXT="#000000" +LINK="#0000FF" +VLINK="#840084" +ALINK="#0000FF" +><DIV +CLASS="NAVHEADER" +><TABLE +SUMMARY="Header navigation table" +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TH +COLSPAN="3" +ALIGN="center" +>LW Tool Chain</TH +></TR +><TR +><TD +WIDTH="10%" +ALIGN="left" +VALIGN="bottom" +><A +HREF="x848.html" +ACCESSKEY="P" +>Prev</A +></TD +><TD +WIDTH="80%" +ALIGN="center" +VALIGN="bottom" +>Chapter 4. LWLINK</TD +><TD +WIDTH="10%" +ALIGN="right" +VALIGN="bottom" +><A +HREF="c929.html" +ACCESSKEY="N" +>Next</A +></TD +></TR +></TABLE +><HR +ALIGN="LEFT" +WIDTH="100%"></DIV +><DIV +CLASS="SECTION" +><H1 +CLASS="SECTION" +><A +NAME="AEN914" +>4.4. Format Specific Linking Notes</A +></H1 +><P +>Some formats require special information to be able to generate actual +binaries. If the specific format you are interested in is not listed in +this section, then there is nothing special you need to know about to create +a final binary.</P +><DIV +CLASS="SECTION" +><H2 +CLASS="SECTION" +><A +NAME="AEN917" +>4.4.1. OS9 Modules</A +></H2 +><P +>OS9 modules need to embed several items into the module header. These +items are the type of module, the langauge of the module, the module +attributes, the module revision number, the data size (bss), and the +execution offset. These are all either calculated or default to reasonable +values.</P +><P +>The data size is calcuated as the sum of all sections named "bss" or +".bss" in all object files that are linked together.</P +><P +>The execution offset is calculated from the address of the special +symbol "__start" which must be an exported (external) symbol in one of the +objects to be linked.</P +><P +>The type defaults to "Prgrm" or "Program module". The language +defaults to "Objct" or "6809 object code". Attributes default to enabling +the re-entrant flag. And finally, the revision defaults to zero.</P +><P +>The embedded module name is the output filename. If the output +filename includes more than just the filename, this will probably not be +what you want.</P +><P +>The type, language, attributes, revision, and module name can all be +overridden by providing a special section in exactly one of the object files +to be linked. This section is called "__os9" (note the two underscores). +To override the type, language, attributes, or revision values, define a +non-exported symbol in this section called "type", "lang", "attr", or "rev" +respectively. Any other symbols defined are ignored. To override the +module name, include as the only actual code in the section a NUL terminated +string (the FCN directive is useful for this). If there is no code in the +section or it beings with a NUL, the default name will be used. Any of the +preceeding that are not defined in the special section will retain their +default values.</P +><P +>The built-in link script for OS9 modules will place the following +sections, in order, in the module: "code", ".text", "data", ".data". It +will merge all sections with the name "bss" or ".bss" into the "data" +section. All other section names are ignored. What this means is that you +must define your data variables in the a section called "bss" or ".bss" even +though you will be refencing them all as offsets from U. This does have the +unpleasant side effect that all BSS references will end up being 16 bit +offsets because the assembler cannot know what the offset will be once the +linker is finished its work. Thus, if the tightest possible code is +required, having LWASM directly output the module is a better choice.</P +><P +>While the built-in link script is probably sufficient for most +purposes, you can provide your own script. If you provide a custom link +script, you must start your code and data sections at location 000D to +accommodate the module header. Otherwise, you will have an incorrect +location for the execution offset. You must use the ENTRY directive in the +script to define the entry point for the module.</P +><P +>It should also be obvious from the above that you cannot mix the bss +(rmb) definitions with the module code when linking separately. Those +familiar with typical module creation will probably find this an unpleasant +difference but it is unavoidable.</P +><P +>It should also be noted that direct page references should also be +avoided because you cannot know ahead of time whether the linker is going to +end up putting a particular variable in the first 256 bytes of the module's +data space. If, however, you know for certain you will have less than 256 +bytes of defined data space across all of the object files that will be +linked, you can instead use forced DP addressing for your data addresses +instead of the ,u notation. When linking with 3rd party libraries, this +practice should be avoided. Also, when creating libraries, always use the +offset from U technique.</P +></DIV +></DIV +><DIV +CLASS="NAVFOOTER" +><HR +ALIGN="LEFT" +WIDTH="100%"><TABLE +SUMMARY="Footer navigation table" +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +><A +HREF="x848.html" +ACCESSKEY="P" +>Prev</A +></TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +><A +HREF="index.html" +ACCESSKEY="H" +>Home</A +></TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +><A +HREF="c929.html" +ACCESSKEY="N" +>Next</A +></TD +></TR +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +>Linking Scripts</TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +><A +HREF="c734.html" +ACCESSKEY="U" +>Up</A +></TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +>Libraries and LWAR</TD +></TR +></TABLE +></DIV +></BODY +></HTML +> \ No newline at end of file