| |||
| Home > GNU ld script support in armlink > Typical use cases for using ld scripts with armlink | |||
The following are typical use cases for using ld scripts with armlink:
Some libraries have a dynamic and static part. An ld script loads both libraries in the correct order with the INPUT command, for example:
INPUT(libstatic.a) INPUT(libdynamic.so)
This script instructs the linker to load libstatic.a then libdynamic.so
--ldpartial optionAn ld script can be given to control how the linker combines sections, for example:
SECTIONS
{
.text :0
{
*(.text)
*(mysection)
}
}
This script instructs the linker to combine mysection and
all the .text sections into a single .text output
section.
You might want to combine sections together in a different order to that given by the default linker script. Also, you might want the linker to define symbols at specific addresses. This information can be given by a custom linker script.
To successfully produce a file that can be run on ARM Linux your image must include some output sections to contain the meta-data that the dynamic loader can use to load the file. It is recommended that you start with one of the example scripts and modify it to suit your purpose.