Updating Linker Command Files for Use With tiarmclang¶
To a large extent, linker command files that are written for ARM applications that help the user to manage the placement of code and data that is generated by the armcl compiler will also work with object that is generated by the tiarmclang compiler. However, there are a few adjustments that may be needed to make your linker command file tiarmclang-friendly.
Explicit Specification of Compiler Generated Object Files and Libraries¶
If your linker command file refers to specific object files, you may need to adjust how those files are referenced. There are two significant differences that you are likely to run into:
- When compiling and linking in a single step, the tiarmclang compiler will create temporary names for compiler generated object files. For example, given a C source file named xyz.c, the tiarmclang compiler will generate a temporary object file called xyz-<auto generated number sequence>.o that you might want to reference from your linker command file. You should reference such an object file using a wild-card, ‘xyz*.o’.
- The tiarmclang compiler generates object files with a ‘.o’ file extension, whereas the default file extension for an armcl-generated object file is ‘.obj’. You will need to update references to specific object files in your linker command file to use the ‘.o’ file extension instead of the ‘.obj’ file extension.
The armcl compiler normally produces object files with a ‘.obj’ file extension, but the tiarmclang compiler will produce object files that have a ‘.o’ file extension. If your linker command file refers to specific object files, you may need to adjust the file extensions on those references.
Compiler Generated Section Names¶
Both the tiarmclang and armcl compilers generate code and data into object file sections. However, there are some differences to be aware of:
Compiler Generated Section Names:
Section Description | armcl Generated Section | tiarmclang Generated Section |
---|---|---|
function definitions / code | .text | .text |
const data | .const | .const, .rodata |
initialization tables | .cinit | .cinit |
initiaialized data | .data | .data |
uninitiaialized data | .bss | .bss |
As you will notice, the major difference is that the tiarmclang compiler generated string constants and some other constants into the .rodata section. In the linker command file, you may need to account for the placement of .rodata sections.
Other sections that you will typically find in an ARM application are typically defined in the C/C++ runtime libraries and underlying runtime operating system layer.
RTS or RTOS Defined Section Names:
Section Description | armcl Generated Section | tiarmclang Generated Section |
---|---|---|
arguments (argc/argv) | .args | .args |
stack space | .stack | .stack |
heap space | .sysmem | .sysmem |