9.2 Typical use cases for using ld scripts with armlink

These are typical use cases for using ld scripts with armlink.

Wrapping libraries

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

Partial linking with the --ldpartial option

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

Fine control over an ARM linux link

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.

Note:

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.

Non-ConfidentialPDF file icon PDF versionARM DUI0474M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.