define block directive
Syntax
define [ movable ] blockname[ withparam,param... ] {extended-selectors} [ except {section-selectors} ];
where param can be one of:
size =exprminimum size =exprmaximum size =exprexpanding size alignment = {expr|input} end alignment =exprfixed order alphabetical order static base [basename]
and where the rest of the directive selects sections to include in the block, see Section selection.
Parameters
| The name of the block to be defined. |
| Customizes the size of the block. By default, the size of a block is the sum of its parts dependent of its contents. |
| Specifies a lower limit for the size of the block. The block is at least this large, even if its contents would otherwise not require it. |
| Specifies an upper limit for the size of the block. An error is generated if the sections in the block do not fit. |
| The block will expand to use all available space in the memory range where it is placed. |
|
|
| Specifies a minimum alignment for the end of the block. Normally, the end address of a block is determined by its start address and its size (which can depend on its contents), but if this parameter is used, the end address is increased to comply with the specified alignment if needed. |
| Places sections in the specified order. Each |
| Places sections in alphabetical order by section name. Only |
| 32-bit mode only:Specifies that the static base with the name When linking for |
Description
The define block directive defines a contiguous area of memory that contains a possibly empty set of sections or other blocks. Blocks with no content are useful for allocating space for stacks or heaps. Blocks with content are usually used to group together sections that must to be consecutive.
You can access the start, end, and size of a block from an application by using the __section_begin, __section_end, or __section_size operators. If there is no block with the specified name, but there are sections with that name, a block will be created by the linker, containing all such sections.
movable blocks are for use with read-only and read-write position independence. Making blocks movable enables the linker to validate the application’s use of addresses. Movable blocks are located in exactly the same way as other blocks, but the linker will check that the appropriate relocations are used when referring to symbols in movable blocks.
Blocks with expanding size are most often used for heaps or stacks.
Note
You cannot place a block with expanding size inside another block with expanding size, inside a block with a maximum size, or inside an overlay.
Example
/* Create a block with a minimum size for the heap that will use
all remaining space in its memory range */
define block HEAP with minimum size = 4K, expanding size, alignment = 8 { };See also
Interaction between the tools and your application. For an accessing example, see define overlay directive.