From: cuz Date: Sun, 3 Dec 2000 10:46:01 +0000 (+0000) Subject: Add docs for the FEATURES section X-Git-Tag: V2.12.0~3012 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c26903e30244807cf705b3bd8e315bcdb09a5202;p=cc65 Add docs for the FEATURES section git-svn-id: svn://svn.cc65.org/cc65/trunk@528 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/doc/ld65.sgml b/doc/ld65.sgml index 112ee06fd..5e725d645 100644 --- a/doc/ld65.sgml +++ b/doc/ld65.sgml @@ -5,7 +5,7 @@ Ullrich von Bassewitz, 02.12.2000 - + The ld65 linker combines object files into an executable file. ld65 is highly configurable and uses configuration files for high flexibility. @@ -259,7 +259,7 @@ Case is ignored for keywords, that is, section or attribute names, but it is -Introduction

+Memory areas

Memory areas are specified in a Segments

+ Let's assume you have written a program for your trusty old C64, and you would like to run it. For testing purposes, it should run in the __NAME_LOAD__ This is set to the address where the - segment is loaded. + segment is loaded. __NAME_RUN__ This is set to the run address of the - segment. We will cover run addresses - later. + segment. We will cover run addresses + later. __NAME_SIZE__ This is set to the segment size. @@ -380,6 +383,8 @@ create symbols for the last one, there's only one question left: Where does the linker put the data? It would be very convenient to have the data in a file, wouldn't it? +Output files

+ We don't have any files specified above, and indeed, this is not needed in a simple configuration like the one above. There is an additional attribute "file" that may be specified for a memory area, that gives a file name to @@ -418,6 +423,9 @@ names here. Segments that go into LOAD and RUN addresses (ROMable code)

+ Let us look now at a more complex example. Say, you've successfully tested your new "Super Operating System" (SOS for short) for the C64, and you will now go and replace the ROMs by your own code. When doing that, you @@ -474,7 +482,7 @@ external symbols for the data segment that may be accessed from your code: __DATA_LOAD__ This is set to the address where the segment is loaded, in this case, it is an address in - ROM2. + ROM2. __DATA_RUN__ This is set to the run address of the segment, in this case, it is an address in RAM2. __DATA_SIZE__ This is set to the segment size. @@ -485,6 +493,9 @@ So, what your startup code must do, is to copy Other MEMORY area attributes

+ There are some other attributes not covered above. Before starting the reference section, I will discuss the remaining things here. @@ -500,21 +511,21 @@ useful for things like a software stack, or an i/o area. This will define three external symbols that may be used in your code: - __STACK_START__ This is set to the start of the memory - area, $C000 in this example. - __STACK_SIZE__ The size of the area, here $1000. + __STACK_START__ This is set to the start of the memory + area, $C000 in this example. + __STACK_SIZE__ The size of the area, here $1000. __STACK_LAST__ This is NOT the same as START+SIZE. - Instead, it it defined as the first - address that is not used by data. If we - don't define any segments for this area, - the value will be the same as START. + Instead, it it defined as the first + address that is not used by data. If we + don't define any segments for this area, + the value will be the same as START. A memory section may also have a type. Valid types are - ro for readonly memory - rw for read/write memory. + ro for readonly memory + rw for read/write memory. The linker will assure, that no segment marked as read/write or bss is put @@ -526,6 +537,9 @@ you don't like this, you may specify a byte value that is used to fill these areas with the "Other SEGMENT attributes

+ Segments may be aligned to some memory boundary. Specify " @@ -587,7 +601,72 @@ name="-S"> option). -Reference

+Features

+ +In addition to the + FEATURES { + CONDES: segment = RODATA, + type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__; + } + + +The + + segment + + This attribute tells the linker into which segment the table should be + placed. If the segment does not exist, it is created. + + + type + + Describes the type of the routines to place in the table. Type may be + one of the predefined types label + + This specifies the label to use for the table. The label points to the + start of the table in memory and may be used from within user written + code. + + + count + + This is an optional attribute. If specified, an additional symbol is + defined by the linker using the given name. The value of this symbol + is the number of entries (order + + Optional attribute that takes one of the keywords + +Without specifying the .