5. Updating Linker Command Files for Use With tiarmclang

To a large extent, linker command files for Arm applications that manage the placement of code and data generated by the armcl compiler will also work with object files that are generated by the tiarmclang compiler. However, a few adjustments may be needed to make your linker command file tiarmclang-friendly.

5.1. 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 creates temporary names for compiler-generated object files. For example, given a C source file named xyz.c, the tiarmclang compiler generates 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.

5.2. 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

initialized data

.data

.data

uninitialized data

.bss

.bss

As you will notice, the 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 typically find in an Arm application are typically defined in the C/C++ runtime libraries and underlying run-time 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

5.3. Linker Options

The --rom_model (-c) linker option, which is the default for armcl, is not set by default by the tiarmclang compiler when running the linker. Therefore, either the --rom_model (-c) or --ram_model (-cr) option must be passed to the linker using either -Xlinker or -Wl on the tiarmclang command line or must be specified in the linker command file.