9.5 Recommendations for using ld scripts with armlink

There are recommendations when producing ld scripts for use with armlink.

Follow these recommendations when producing ld scripts for use with armlink:

Recommendations for producing ld scripts for ARM Linux

The dynamic loader requires some output sections with a specific type to work properly. These are:

  • Hash Table.

  • String Table.

  • Dynamic Symbol Table.

  • Dynamic Section.

  • Version Sections.

  • Thread Local Storage Sections.

General recommendations

The following are general recommendations:

  • Make sure each output section has a homogenous type. For example:

       .text : { *(.text) }
       .data : { *(.data) }
       .bss :  { *(.bss) }
    

    This is preferred to the following:

       .stuff
       {
           *(.text)
           *(.data)
           *(.bss)
       }
    
  • If you are running the ELF file on ARM Linux do not modify the location of the metadata used by the dynamic linker.

  • Sections not matched by the SECTIONS command are marked as orphans. The linker places orphan sections in appropriate locations. The linker attempts to match the placement of orphans used by ld although this is not always possible. Use explicit placement if you do not like how armlink places orphans.

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