This document provides the information necessary for those who are using the .ro format who want to create their own build system that is more advanced and surpasses the capabilities of the build system provided in the SDK.
.xrl file specification makecro tool To make .ro easy to use, the build system provided in the SDK makes some features unavailable and also has a number of limitations. Creating your own build system allows for flexible adjustments without these limitations.
Unlike the Guide to Developing a Build System (for DLLs), this document is not intended to create a particular build system. Rather, it presents information on the parts that you would combine to create your own build system.
This document assumes an understanding of the build flow with .cro that is used by the build system in the SDK. Before you proceed, please review the DLL Manual and the Build System Development Guide (for DLLs).
This document also assumes basic knowledge of CTR-SDK terminology. For a glossary of basic CTR-SDK terms, see CTR-SDK Terminology.
Finally, this document assumes some degree of familiarity with ELF. The CTR-SDK does not describe ELF. For more information about ELF, see one of the commercially available books.
In this document, the names of Windows tools contained in the tools/CommandLineTools directory are abbreviated by omitting the leading ctr_ and the ending file extension. For example, the abbreviation for ctr_makerom32.exe is makerom.
Terminology presents descriptions of the terms used in this document.
The sections XRL File Specification, SDK Build Steps and Features of the makecro Tool all describe their topics in detail.
The sections Create CRO File、Issues and Support and Strategies and Tips present descriptions of the overall build system, including important considerations for creating .cro with your own build system.
Create .crr File describes how to create the .crr file.
This section describes the terminology used in this document.
The meanings and usage of terms used in this document may differ from their general meanings and usage, as well as their meaning in other CTR-SDK documentation.
ARMCC compiler and linker.ET_EXEC type ELF file.ET_REL type ELF file.ET_DYN type ELF file.armlink..cro file, as explained in Build System Development Guide (for DLLs)..cro file and related resources..xrl File Specification.xrl is an XML format file used by makecro.
.xrl FileThe role of the .xrl file is to supplement the ELF file by storing information essential for .ro that is not stored in the ELF file. .ro requires one .xrl file for each module. The .xrl file contains information about the symbols exported by the module, and the symbols that are referenced. makero builds export and reference information based on the information in the .xrl file.
The .xrl file also contains information that helps automate referencing and exporting by tools. By using this information, makecro can realize features that are required to automate referencing and exporting.
.xrl File The following information is held in the .xrl file.
index format..xrl files.index format.index or offset format..xrl FileThe .xrl file has a simple structure, composed of the following six elements.
modulemoduleInfoimportsimportexportsexportmodule is the root element, and it contains the moduleInfo, imports, and exports elements. The imports element contains the import element, and the exports element contains the export element. This basic structure is fixed. The only differences between .xrl files are the attribute values, and the content and numbers of the import and export elements.
module
├ moduleInfo
├ imports
│ └ import └ exports
└ import
module ElementThe module element is the root element of the .xrl file. As a child element, it has at most one moduleInfo element and one imports element, and any number of exports elements. It does not have an attribute.
<module>
<moduleInfo/>
<imports> ... </imports> <exports> ... </exports> </module>
moduleInfo ElementThe moduleInfo element stores information about the overall module. It does not have any child elements. It has the following attributes.
| Attribute |
Value |
Description |
Omitted values |
|---|---|---|---|
| name |
Module name |
Specifies the name of the shader symbol. If it is a static module, it must be named as " |static|." |
(Cannot be omitted.) |
...
<moduleInfo name="SampleModule" />
...
imports ElementThe imports element is a collection of import elements. As a child element, it can hold any number of import elements. It does not have an attribute.
...
<imports>
<import> ... </import>
<import> ... </import>
<import> ... </import>
</imports>
...
import ElementThe import element specifies a symbol for which a reference is generated. As its content, the element specifies the name of the symbol for which a reference is generated. Each import element specifies one symbol. Symbol names must be mangled. It has the following attributes.
| Attribute |
Value |
Description |
Omitted values |
|---|---|---|---|
auto |
TRUE or FALSE |
Specifies whether the entry was generated automatically by the tool. TRUE indicates that it was generated automatically. |
|
type |
Either symbol, index, or offset. |
Specifies the reference type of the symbol to reference.symbol, index, and offset correspond respectively to symbol name, index, and offset. |
symbol |
module |
Module name |
Specifies the module that defines the symbol to reference. Use this attribute if the export type of the symbol to reference is either index or offset. |
(None) |
index |
A decimal number. |
Stores the index number of the symbol to reference. Use this attribute if the export type of the symbol to reference is index. |
(None) |
force |
TRUE or FALSE |
Specifies whether to force the reference. TRUE indicates that the reference is forced. |
|
...
<import auto="false" type="symbol" module="SampleModule" index="11" force="false">g_Variable</import>
...
exports ElementThe exports element is a collection of export elements. It has an arbitrary number of export child elements. It has the following attributes.
| Attribute |
Value |
Description |
Omitted values |
|---|---|---|---|
type |
Either symbol, index, or offset. |
Specifies the export type of the symbol to export.symbol, index, and offset correspond respectively to symbol name, index, and offset. |
symbol |
...
<exports type="index">
<export> ... </export>
<export> ... </export>
<export> ... </export>
</exports>
...
export Element
The export element specifies a symbol that is exported. This element specifies a symbol name to export. Each export element specifies one symbol. Symbol names must be mangled. It has the following attributes.
| Attribute |
Value |
Description |
Omitted values |
|---|---|---|---|
auto |
TRUE or FALSE |
Specifies whether the entry was generated automatically by the tool. TRUE indicates that it was generated automatically. |
|
function |
TRUE or FALSE |
Specifies whether the symbol is a function. TRUE indicates that it is a function. |
|
reference |
TRUE or FALSE |
Indicates whether the symbol is referenced from another module. TRUE indicates that it is referenced. |
|
index |
A decimal number. |
Specifies the index to use for exporting the symbol. Use this attribute if the export type of the symbol is index. |
(None) |
section |
A decimal number. |
Specifies the number of the section where the symbol is defined. Use this attribute if the export type of the symbol is offset. |
(None) |
offset |
A hexadecimal number. |
Specifies the offset of the symbol definition location. Use this attribute if the export type of the symbol is offset. |
(None) |
...
<export auto="false" function="false" reference="true" section="1" offset="00123456">g_Variable</export>
...
This section describes the purpose of each build step in the SDK-conforming build system that is described in the Build System Development Guide (for DLLs).
The SDK build system is designed for easy use of .ro. To that end, it completes the following tasks.
To complete these tasks, the SDK build system performs the following steps.
The general flow is as follows:
.cro file.
Partially link the object files that include the modules and combine them into a single ELF file that you can use in the next step to create a list of symbols.
The goal is to create a list with all of the symbols, but some symbols will be missing because of optimization and dead-code stripping of executable ELF files (such as those created by linking static modules and linking dynamic modules) and shared object ELF files. That is why partial linking is necessary.
To shorten processing time in the next step, the SDK libraries are removed from the targets of the linking.
Create an .xrl file from the partial link file that was created in the previous step.
Check for symbols defined in the partial link file, and for symbols with undefined references. Then create an .xrl file, with the defined symbols set in export elements, and the undefined elements set in import elements.
For automatic export and referencing of symbols, list the symbols that can be provided by the modules, and all necessary symbols.
Update the .xrl file of the static module so that symbols that are referenced but not defined in any module are exported in the static module.
Check the .xrl files for all modules. If there are symbols in the import elements that are not in the export elements of any of the modules, add those symbols to the export element of the static module .xrl file. The following symbols are targeted.
If the target symbols are from group 1 or 2, they can be exported in the static module, because in the later step to create a command file the symbols are incorporated into the static module. If the target symbols are from group 3, they generate a link error because they cannot be found among the symbols that are supposed to be exported when linking the static module. The generation of a link error helps to catch mistakes earlier in the process, because undefined symbols do not result in a link error when linking the dynamic module.
If CRT symbols cannot be listed when you create the list of symbols, or if you do not list SDK symbols to shorten processing time, then these symbols are undefined in the .xrl file even if they are referenced. As a result, when you resolve symbol references during the next step, an undefined symbol error occurs.
Assuming that CRT symbols are included in the static module, and that the undefined symbols are among the three groups mentioned previously, you can handle this error by updating the .xrl file of the static module so that these symbols can be provided from the static module.
This process also collects information for recognizing the CRT symbols that should be loaded by the static module when creating the command file.
For the symbols referenced by the various modules, determine the module that defines each symbol, and register these reference sources in the .xrl file. To reference a symbol you need its export type, so you should also register the export type in the .xrl file.
At the same time, register the symbols that are defined by a module that are referenced by another module. Only the symbols that are registered as referenced by a module are exported. Symbols that are not referenced by any module become the targets of dead-code stripping. If the export type is index, assign an index number to the symbol that is referenced.
To force the references, register the variable symbols that are defined in multiple modules. For variable symbols that are defined in multiple dynamic modules, delete the definitions in the export elements and add them to the import elements. In the static module, add the symbol definitions unconditionally to the export elements. This recommendation assumes that the static module holds the definitions for multiply-defined symbols.
Create a command file for the linker to load the CRT symbols into the static module.
Some CRT symbols cannot be exported in the same way as other symbols. To export these symbols, you need to specify the linker option --undefined_and_export for each symbol that you are exporting. An --undefined_and_export option is generated for each symbol and exported as a command file. The phrase "some CRT symbols" is indeterminate and could change. Further, specifying the --undefined_and_export option for normal export symbols has no adverse effect. For these reasons, set this option for all export symbols in the static module.
Create a steering file for the linker to export and reference symbols.
When symbols are exported and referenced automatically, the actual exporting and referencing occurs at link time. The steering file specifies the exporting and referencing of symbols to the linker at link time. In this step, the steering file is created for this purpose. In the steering file, EXPORT specifies a symbol for export, and IMPORT specifies a symbol for referencing.
Create the steering file based on the .xrl file after resolving symbol references. Specify EXPORT for the symbols in the export elements that were registered as referenced from a module, and specify IMPORT for the symbols in the import elements.
Link and create the ELF file for the static module. Specify the created command file and the created steering file.
This step creates an ELF file that contains the appropriate definitions for CRT symbols and SDK library symbols, and the appropriate settings for symbol exporting and referencing.
The static module is created as an executable ELF file.
Link and create an ELF file for the dynamic modules. Specify the created steering file.
This step creates an ELF file with the appropriate settings for symbol exporting and referencing.
The dynamic modules are created as a shared object ELF file.
Replace code in the static module so that references to unlinked symbols reference nnroUnresolved instead.
Create a command file for fromelf to force the reference to the static modules for variable symbols that are multiply defined.
Variables such as class member variables for the template class have a definition in every module, and they are linked so that the definition inside a module is used from inside that module. Thus, what is essentially a single variable is defined as multiple variables, and processes do not work as expected. To avoid this problem, perform the next step to force the references so that every module references the definition in the static module. In this step, a command file is created for that purpose.
To force the references, specify the --force_import option for each symbol. A --force_import option is generated for every symbol marked in the Resolve Symbol References step, and this is exported as a command file.
Update the ELF file for the static module, specifying the command file that was created in the previous step (command file 2).
This step ensures that the symbols in the static module are referenced wherever multiply defined symbols are used.
Get the offsets for exported symbols from each ELF file, and register them in the .xrl file.
To reference a symbol of export type offset, you need the symbol offset. In this step, you request cache the offset for each symbol so that it is available as needed from other modules.
This step ensures that even if symbols of export type offset are referenced, you can create the .cro file without the ELF file of the referencing module.
.crs FileCreate the .crs file from the ELF file of the static module, and also create the corresponding .xrl files and all other .xrl files.
The .xrl files that do not correspond to the static module are used to reference the offsets of the symbols that are referenced.
.cro FileCreate the .cro file from the ELF file of the dynamic modules, and also create the corresponding .xrl files and all other .xrl files. Create the .rlt file at the same time.
The .xrl files that do not correspond to the .cro file that is created are used to reference the offsets of the symbols that are referenced.
.crr FileCreate the .crr file from the .rlt file.
makecro ToolThis section provides a detailed description of the features of the makecro tool.
.cro or .crs FileCreates a .cro file or .crs file from the ELF files and the .xrl files.
The type of the ELF file determines whether the created file is a .cro or .crs file. If it is an executable ELF file, the tool creates a .crs file. If it is a shared object ELF file, a .cro file is created.
The following symbols become export symbols.
STB_GLOBAL or STB_WEAK.STV_DEFAULT.The following symbols become reference symbols.
import element of a corresponding symbol is not in the .xrl file.Note that the .xrl file has nothing to do with whether a symbol is for export or for referencing. The .xrl file is used to reference the export types of symbols and their index or offset values.
In the SDK build system, this feature is used for the Create CRO File and Create CRS File steps.
.xrl File (-l)Creates an .xrl file from the ELF files, based on the symbols that are defined and referenced in the ELF files.
The following processes are performed.
STB_LOCAL binding and are undefined.STB_LOCAL binding and are not undefined..xrl file.module element.module element contains one moduleInfo element, one imports element, and one exports element.name attribute of the moduleInfo element is set to the file name of the ELF file without the extension.imports element contains import elements that contain the names of each symbol that is listed in the second list.import element, the auto attribute is set to FALSE if the corresponding symbol is set to STV_DEFAULT in the ELF symbol table. Otherwise, the auto attribute is set to TRUE.exports element has a type attribute that is set based on the specification of a command line option, and it contains export elements that contain the names of each symbol listed in the third list.export element, the auto attribute is set to FALSE if the corresponding symbol is set to STV_PROTECTED in the ELF symbol table. Otherwise, the auto attribute is set to TRUE.export element is set to TRUE if its corresponding symbol is type STT_FUNC. Otherwise, it is set to FALSE.
In the SDK build system, this feature is used for the Create List of Symbols step.
Creates one ELF file from another ELF file, using a specified symbol address to replace parts of the code where the addresses of unresolved symbols were used.
In the SDK build system, this feature is used for the Replace References step.
Takes one .xrl file that serves as the base (the "base .xrl file") and several other .xrl files (the "reference .xrl files"), and uses them to create an .xrl file with many export elements added to the base.
The following processes are performed.
import elements in the reference .xrl files that set their auto attribute to TRUE and do not exist with the same symbol name in the export elements of the specified base .xrl file..xrl file that has the following kinds of additions to the base .xrl file.export elements. But the symbols are not added if they already exist as export elements in the base .xrl file.import elements with their auto attribute set to TRUE are deleted.In the SDK build system, this feature is used for the Merge Undefined Symbols step.
Takes one .xrl file that serves as the base (the "base .xrl file") and several other .xrl files (the "reference .xrl files"), and uses them to create an .xrl file with updated reference information and export information.
The following processes are performed.
export elements that are contained in all specified .xrl files..xrl files for symbols of the same names that are contained in the import elements.reference attribute of the export elements to FALSE.exports elements that are contained in all specified .xrl files for which the type attribute is set to index.export elements with a reference attribute set to TRUE.index attribute values for the export elements that are listed in step 1 to numeric values, starting with 0 and incrementing by one in the order that they are listed.import elements that are contained in all specified .xrl files.
.xrl files for symbols with the same names as the symbols contained in the export elements.type attribute of the original import element to the type attribute of the exports element that contains the export element found in step 1.type attribute of the exports element that contains the export element found in step 1 is index, then set the index attribute of the original import element to the index attribute of the export element.module attribute of the original import element to the value of the name attribute of the moduleInfo element in the .xrl file that contains the export element found in step 1..xrl file that results from making these changes to the base .xrl file.In the SDK build system, this feature is used for the Resolve References step.
Merges the contents of two .xrl files.
The merging uses the following rules.
name attribute of the moduleInfo element is specified on the command line, use that value. If not, use the value of the .xrl file that is specified first on the command line.-g option is specified and the same symbol is defined in both files, perform the following steps.auto attribute of the import element is TRUE in both files, set the value for the attribute of the merged file to TRUE. Otherwise, set the value to FALSE.auto attribute of the export element is TRUE in both files, set the value to TRUE. Otherwise, set the value to FALSE..xrl file that is specified first on the command line.reference attribute is set for the export element.This feature is not used in the SDK build system.
Creates an .xrl file with offsets provided from the ELF and .xrl files.
The following processes are performed.
export elements in the specified .xrl files that have the reference attribute set to TRUE..xrl file from the specified .xrl files, with the values obtained in step 2 set for the section and offset attributes of the export element for each symbol in the list.
In the SDK build system, this feature is used for the Resolve Offsets step.
Creates a steering file for armlink from the .xrl file.
Creates an EXPORT command for the export elements in the .xrl file that have the reference attribute set to TRUE, and creates an IMPORT command for all import elements.
In the SDK build system, this feature is used for the Create Steering File step.
Creates a command file for armlink from the .xrl file.
Creates an --undefined_and_export command for the export elements in the .xrl file that have the reference attribute set to TRUE.
In the SDK build system, this feature is used for the Create Command File step.
Creates a command file for fromelf from the .xrl file.
Creates a --force_import command for the import elements in the .xrl file that have the force attribute set to TRUE.
In the SDK build system, this feature is used for the Create Command File 2 step.
.xrl and makecro FeaturesThis section provides several tables of information that show how the makecro features use the attribute values of the elements in the .xrl files, and the kinds of values that are set as a result.
In these tables, Base shows how the attribute values of the base .xrl file are used. Input shows how the values of the other .xrl files are used. Output shows how the values that are inherited from Base and Input are changed in the .xrl file that is created by makecro. Added shows the values that are set for newly added elements.
A dashed line ( -- ) in a table indicates that a value is not referenced or not changed. None indicates that no explicit attribute value is set for the element.
import Elements| Feature \ Attribute |
auto |
type |
module |
index |
force |
|
|---|---|---|---|---|---|---|
| Create (-l) | Output | If STV_DEFAULT, then FALSE. |
None | |||
| Merge (-m) | Input | -- |
-- | -- | -- | -- |
| Output | If the auto attribute values are TRUE for all input elements, then TRUE. |
|||||
| Merge Undefined (-c) | Base | Not exported if TRUE. |
||||
| Input | -- | |||||
| Output | ||||||
| Added | None | |||||
| Resolve References (-f) | Base | -- |
-- | -- | -- |
|
| Input | ||||||
| Output | Sets the type for the parent exports of the corresponding export element. |
Sets the name of moduleInfo for the module contained in the corresponding export element. |
Sets the index of the corresponding export element. |
|||
| Added | None. |
TRUE |
||||
| Offsets (-p) | Input | -- | -- |
-- | -- | -- |
| Output | ||||||
| -s |
Input | |||||
| -x |
Input | |||||
| -w |
Input | Only for those set to TRUE. |
||||
.cro |
Input | Used as the export type of the reference target. | Used as information for the reference target. | -- | ||
export Elements| Feature \ Attribute | auto |
function |
reference |
index |
section |
offset |
|
|---|---|---|---|---|---|---|---|
| Create (-l) | Output | If STV_PROCETED, then FALSE.
|
If STT_FUNC, then TRUE. |
None | |||
| Merge (-m) | Input | -- | -- |
Error if the attribute exists. | -- | -- | -- |
| Output | If the auto attribute values are TRUE for all input elements, then TRUE. |
-- | |||||
| Merge Undefined (-c) | Base | -- | |||||
| Input | If FALSE, then not a merge target. |
||||||
| Output | If the auto attribute of Base is FALSE, then FALSE. |
||||||
| Added | TRUE |
None | |||||
| Resolve References (-f) | Base | If FALSE, then the reference attribute is not set to FALSE. |
If TRUE, ignore multiple definitions. |
-- | -- | -- |
-- |
| Input | If FALSE, then the reference attribute is not set to FALSE. |
If TRUE, ignore multiple definitions. |
|||||
| Output | -- |
-- | FALSE set for those not referenced. |
Serial number set for those referenced. | |||
| Added | None | ||||||
| Offsets (-p) | Input | -- | -- |
Only for those set to TRUE. |
-- |
-- |
-- |
| Output | -- | Set value obtained from ELF. | |||||
| -s |
Input | Only for those set to TRUE. |
-- | -- | |||
| -x |
Input | Only for those set to TRUE. |
|||||
| -w |
Input | -- | |||||
.cro |
Input | Used as information when exporting. | |||||
moduleInfo Elements and exports Elements| Feature \ Attribute | moduleInfo |
exports |
|
|---|---|---|---|
| name |
type |
||
| Create (-l) | Output | Set the ELF file name. |
Set the value specified by the command line. |
| Merge (-m) | Input | -- |
-- |
| Output | Set the command line specification or the value of the first input file. | ||
| Merge Undefined (-c) | Base | -- |
|
| Input | |||
| Output | |||
| Add |
Set the value specified by the command line. |
||
| Resolve References (-f) | Base | Use as the value for the module attribute of the import element. |
Use as the value for the type attribute of the import element. |
| Input | Use as the value for the module attribute of the import element. |
Use as the value for the type attribute of the import element. |
|
| Output | -- | -- |
|
| Add |
None. |
||
| Offsets (-p) | Input | -- |
|
| Output | |||
| -s |
Input | ||
| -x |
Input | ||
| -w |
Input | ||
.cro |
Input | Use as the module name. |
Use as the export type. |
import elements and the export elements (symbol names). | Feature \ Element | import |
export |
|
|---|---|---|---|
| Create (-l) | Output | Export the undefined symbols of the ELF file. |
Export the defined symbols of the ELF file. |
| Merge (-m) | Input | -- | -- |
| Output | Do not export those contained in export. |
||
| Merge Undefined (-c) | Base | -- |
Use for correspondence with import. |
| Input | Use for correspondence with export. |
Use for correspondence with import. |
|
| Output | -- |
-- |
|
| Added | Export undefined symbols. | ||
| Resolve References (-f) | Base | Use for correspondence with export. |
Use for correspondence with import. |
| Input | Use for correspondence with export. |
Use for correspondence with import. |
|
| Output | -- | -- |
|
| Added | Export multiply defined symbols. |
||
| Offsets (-p) | Input | -- |
|
| Output | |||
| -s |
Input | Use for command. |
|
| -x |
Input | Use for command. | |
| -w |
Input | Use for command. | -- |
.cro |
Input | Use as a reference. |
Use as the export element. |
.cro FileBefore reading the procedure for creating .cro files, review the following description of the structure of .cro files.
The .cro file contains the following information. Values obtained from the .xrl files are denoted by [xrl]. Other values are obtained from the ELF file.
name.index.name.index.offset.In particular, note the information for the symbols to export and the information for the symbols to reference. You must consider how to configure this particular information. Normally, you do not need to worry about the executable code and the relocation information.
The .crs file structure is similar, but without the executable code or the internal relocation information.
The .cro file is created from a shared object ELF file. Typically the only export type for shared object ELF files is name. To make up for this limitation, you create the .cro file by getting the additional information that you need for export types index and offset from the .xrl files.
From a different perspective, you can consider the .cro file as a shared object ELF file, but with some or all of the symbol export types changed to index and offset.
If you have the appropriate .xrl files and the appropriate ELF file, you can create a .cro file by simply importing these files and performing the Create CRO step. All other tasks through Create CRO in the SDK build system are performed to create the appropriate .xrl files and the appropriate ELF file.
So the minimum build system performs the following steps.
NN_DLL_INPORT and NN_DLL_EXPORT in the source code..xrl file with the symbols that are referenced listed in import elements..xrl file, perform the Create CRO step.or
.xrl file from the symbols to export and the symbols to reference.This procedure can probably be used without trouble for small modules, but for large and complicated projects it is not realistic. The following section describes issues that arise when you construct a build system to create a .cro file. It also describes the support options in the SDK.
If you are going to construct your own mechanism to create the .cro file, you must consider how to handle a number of issues.
You must deal with the following issues.
You need a way to specify which symbols are for export, and which symbols are for reference. The easiest method is to use NN_DLL_IMPORT and NN_DLL_EXPORT, but these must be managed manually.
You cannot use NN_DLL_IMPORT and NN_DLL_EXPORT for CRT symbols and SDK symbols. Another procedure is required. Also, the steering file is insufficient for CRT symbols.
nameTo use index and offset as export types, you must specify them in the .xrl file.
nnroUnresolved in the Static ModuleReferences to unresolved symbols from dynamic modules are replaced with references to nnroUnresolved when the modules are loaded. However, in the .ro format DLL mechanism, the static module is loaded in a detached state. This process of replacing references with nnroUnresolved does not occur.
C++ allows for multiply defined symbols, and you must handle them.
The SDK build system handles these issues in the following ways.
The reference relationships of the various symbols are determined, and a steering file is created for exporting and importing the necessary symbols.
The general flow of the build system is as follows:
The SDK symbols can be supported by using the previously described method to incorporate the static libraries when partially linking. However, because there are so many SDL libraries, acting to incorporate them all slow downs the process of partial linking and all subsequent steps. Moreover, this method does not support CRT symbols.
For these reasons, a different method is employed. A process is performed to update the .xrl file so that undefined symbols are set for export by the static module. This method treats undefined symbols as either SDK or CRT symbols, and presumes that the SDK libraries and CRT symbols are defined in the static module. In addition, a command line option is specified for the linker so that these symbols are actually included in the static module.
The flow in the build system is as follows:
nameInformation about export types cannot be stored in the ELF file, so everything is done with .xrl files. To use export types other than name, the types must be specified in the .xrl file. In addition, the referencing .xrl file must store the same export type and related information as the exporting side.
The flow in the build system is as follows:
.xrl file. (Create List of Symbols).xrl files. (Create CRS File, Create CRO File)The SDK build system provides only a way to batch-specify export types when creating the list of symbols. By creating the .xrl files yourself, you can individually specify the export type for each symbol.
nnroUnresolved in the Static ModuleUndefined symbols might be referenced in the static module before any calls to the .ro library API. Handle this possibility by replacing references that are unresolved in the ELF file with references to nnroUnresolved. (Replace References)
The simple way to deal with multiply defined symbols is to select one definition and use that definition for all references. However, when a symbol is defined inside a module, the ARMCC linker references that symbol inside that module and ignores the steering file, even if the steering file specifies the importing of references from inside that module. To handle this, the fromelf tool, which is included in ARMCC, is used to force import.
The flow in the build system is as follows:
fromelf to force the import of force-import targets. (Create Command File 2)With the SDK build system, the actual definitions for multiply-defined symbols are held in the static module. But the definitions can be held in another module by using the process that corresponds to Resolve Symbol References to change the module that performs the Force References step.
The table shows each SDK build step and its purpose.
| Build Step |
Purpose |
|---|---|
| Partial Linking |
Management of export symbols and reference symbols. |
| Create List of Symbols |
Management of export symbols and reference symbols. |
| Merge Undefined Symbols |
Support for CRT symbols and SDK symbols. |
| Resolve Symbol References |
Management of export symbols and reference symbols. Use of export types other than name.Support for symbols with multiple definitions. |
| Create Command File |
Support for CRT symbols and SDK symbols. |
| Create Steering Files |
Management of export symbols and reference symbols. |
| Link ELF |
(This is required.) |
| Replace References |
Support for nnroUnresolved in the static module. |
| Create Command File 2 |
Support for symbols with multiple definitions. |
| Force References |
Support for symbols with multiple definitions. |
| Resolve Offsets |
Use of export types other than name. |
Create the .cro File |
(This is required.) |
The SDK build system has a number of limitations to make it simple to use. The following table lists the main limitations of the SDK build system, and the specifications that are possible with .ro. The specifications that are possible with .ro are not supported in the SDK build system, so a number of actions must be taken to use them.
| Subject | Limitations in SDK | Possible Specifications |
Issues that Must Be Addressed |
|---|---|---|---|
| Level at which export type is specified |
Module level. |
Symbol level. |
|
| Modules that can hold CRT symbols |
Static module. |
Any module. |
|
| Build level |
All modules at once. |
Each module. |
|
| Use of the module |
Requires an environment for builds that include the source. |
All that is required is the header, .xrl, and .cro files. |
|
| Definitions for multiply-defined symbols |
Static module. |
Any module. |
|
As mentioned in Create the .cro File, the symbols to reference and the symbols to export in the .cro file are determined by the contents of the ELF file. Your responsibility is to consider how to create an ELF file that meets the objective.
The created ELF file is adjusted by using NN_DLL_EXPORT and NN_DLL_IMPORT, or by using a steering file, but you must still handle special issues such as CRT symbols. You can automate part of these processes by using .xrl files and makecro. Consider how to create the .xrl files to achieve the intended results for this part.
When you create your build system, think about how you can use .xrl files, the fromelf tool, and other methods to create an ELF file that realizes your objective.
.ro can also be used as a library.
As a library, .ro can perform the following tasks.
To use these tasks, you must satisfy the following conditions.
name. These tasks can be performed manually, or you can create a tool for automating the tasks and create the appropriate .xrl files to create the library dynamic modules.
The general process flow is as follows:
.xrl file created in the previous step. .cro File step.The following procedure is the general procedure for using a library dynamic module.
.xrl, .cro and .rlt files for the library dynamic module..xrl file of the library dynamic module..xrl file of the library dynamic module..xrl file of the library dynamic module when performing the Create the .cro File step on the modules that use the library dynamic module..crr File step, including the .rlt file of the library dynamic module..crr FileThe procedure for creating the .crr file is separated from .cro and has no flexibility. The procedure is very similar to the procedure of the SDK build system.
.crr and .croThe .crr file is created with the makecrr tool by using the .rlt file, which is created at the same time as the .cro file. The .crr is made from the .rlt file that was generated when .cro was created. The .cro file cannot be loaded at execution time if the .crr file is not loaded first.
A number of .rlt files can be combined to create a single .crr file. Normally, it is fine to have just one .crr file, as long as it is made from all of the combined .rlt files.
.crr FilesThe flexibility when creating .crr files depends on the correspondence between .rlt and .crr. As mentioned previously, it is normally fine to create just one .crr file by combining all of the .rlt files.
You can also create .crr files in a one-to-one relationship with .cro files, but this is not recommended because when you have many .crr files, it affects performance when loading .cro.
When sending .cro and .crr files to Download Play child devices when the parent device uses a different .cro file than the child devices, you can create one .crr file for the parent and a separate .crr file for the child devices, and send only the .crr file for the children from the parent to the children. Of course, in such cases the .crr file for the child devices is already included in the child ROM-FS.
CTR-06-0208-002-B
CONFIDENTIAL