
ARM
®
Compiler
Version 5.06
armlink User Guide
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.
ARM DUI0474M

ARM
®
Compiler
armlink User Guide
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.
Release Information
Document History
Issue Date Confidentiality Change
A 28 May 2010 Non-Confidential ARM Compiler v4.1 Release
B 30 September 2010 Non-Confidential Update 1 for ARM Compiler v4.1
C 28 January 2011 Non-Confidential Update 2 for ARM Compiler v4.1 Patch 3
D 30 April 2011 Non-Confidential ARM Compiler v5.0 Release
E 29 July 2011 Non-Confidential Update 1 for ARM Compiler v5.0
F 30 September 2011 Non-Confidential ARM Compiler v5.01 Release
G 29 February 2012 Non-Confidential Document update 1 for ARM Compiler v5.01 Release
H 27 July 2012 Non-Confidential ARM Compiler v5.02 Release
I 31 January 2013 Non-Confidential ARM Compiler v5.03 Release
J 27 November 2013 Non-Confidential ARM Compiler v5.04 Release
K 10 September 2014 Non-Confidential ARM Compiler v5.05 Release
L 29 July 2015 Non-Confidential ARM Compiler v5.06 Release
M 11 November 2016 Non-Confidential Update 3 for ARM Compiler v5.06 Release
Non-Confidential Proprietary Notice
This document is protected by copyright and other related rights and the practice or implementation of the information contained in
this document may be protected by one or more patents or pending patent applications. No part of this document may be
reproduced in any form by any means without the express prior written permission of ARM. No license, express or implied, by
estoppel or otherwise to any intellectual property rights is granted by this document unless specifically stated.
Your access to the information in this document is conditional upon your acceptance that you will not use or permit others to use
the information for the purposes of determining whether implementations infringe any third party patents.
THIS DOCUMENT IS PROVIDED “AS IS”. ARM PROVIDES NO REPRESENTATIONS AND NO WARRANTIES,
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, SATISFACTORY QUALITY, NON-INFRINGEMENT OR FITNESS FOR A PARTICULAR PURPOSE
WITH RESPECT TO THE DOCUMENT. For the avoidance of doubt, ARM makes no representation with respect to, and has
undertaken no analysis to identify or understand the scope and content of, third party patents, copyrights, trade secrets, or other
rights.
This document may include technical inaccuracies or typographical errors.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR ANY DAMAGES,
INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR
CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING
OUT OF ANY USE OF THIS DOCUMENT, EVEN IF ARM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
This document consists solely of commercial items. You shall be responsible for ensuring that any use, duplication or disclosure of
this document complies fully with any relevant export laws and regulations to assure that this document or any portion thereof is
not exported, directly or indirectly, in violation of such export laws. Use of the word “partner” in reference to ARM’s customers is
not intended to create or refer to any partnership relationship with any other company. ARM may make changes to this document at
any time and without notice.
ARM
®
Compiler
ARM DUI0474M Copyright © 2010-2016 ARM Limited or its affiliates. All rights
reserved.
2
Non-Confidential

If any of the provisions contained in these terms conflict with any of the provisions of any signed written agreement covering this
document with ARM, then the signed written agreement prevails over and supersedes the conflicting provisions of these terms.
This document may be translated into other languages for convenience, and you agree that if there is any conflict between the
English version of this document and any translation, the terms of the English version of the Agreement shall prevail.
Words and logos marked with
®
or ™ are registered trademarks or trademarks of ARM Limited or its affiliates in the EU and/or
elsewhere. All rights reserved. Other brands and names mentioned in this document may be the trademarks of their respective
owners. Please follow ARM’s trademark usage guidelines at http://www.arm.com/about/trademark-usage-guidelines.php
Copyright © 2010-2016, ARM Limited or its affiliates. All rights reserved.
ARM Limited. Company 02557590 registered in England.
110 Fulbourn Road, Cambridge, England CB1 9NJ.
LES-PRE-20349
Confidentiality Status
This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license restrictions in
accordance with the terms of the agreement entered into by ARM and the party that ARM delivered this document to.
Unrestricted Access is an ARM internal classification.
Product Status
The information in this document is Final, that is for a developed product.
Web Address
http://www.arm.com
ARM
®
Compiler
ARM DUI0474M Copyright © 2010-2016 ARM Limited or its affiliates. All rights
reserved.
3
Non-Confidential

Contents
ARM
®
Compiler armlink User Guide
Preface
About this book ..................................................... ..................................................... 15
Chapter 1 Overview of the Linker
1.1 About the linker ........................................................................................................ 1-18
1.2 Linker command-line syntax .................................................................................... 1-21
1.3 What the linker does when constructing an executable image ................................ 1-22
Chapter 2 Linking Models Supported by armlink
2.1 Overview of linking models ...................................................................................... 2-24
2.2 Bare-metal linking model ............................................ ............................................ 2-25
2.3 Partial linking model ................................................................................................ 2-27
2.4 Base Platform Application Binary Interface (BPABI) linking model ............ ............ 2-28
2.5 Base Platform linking model .................................................................................... 2-29
2.6 SysV linking model .................................................................................................. 2-31
2.7 Concepts common to both BPABI and SysV linking models ................. ................. 2-32
Chapter 3 Image Structure and Generation
3.1 The structure of an ARM ELF image ................................... ................................... 3-34
3.2 Simple images .................................................... .................................................... 3-42
3.3 Section placement with the linker ............................................................................ 3-49
3.4 Linker support for creating demand-paged files ...................................................... 3-52
3.5 Linker reordering of execution regions containing Thumb code .............................. 3-54
3.6 Linker-generated veneers ........................................................................................ 3-55
ARM DUI0474M Copyright © 2010-2016 ARM Limited or its affiliates. All rights
reserved.
4
Non-Confidential

3.7 Command-line options used to control the generation of C++ exception tables .. .. 3-59
3.8 Weak references and definitions ...................................... ...................................... 3-60
3.9 How the linker performs library searching, selection, and scanning ........................ 3-63
3.10 How the linker searches for the ARM standard libraries .................... .................... 3-64
3.11 Specifying user libraries when linking ...................................................................... 3-66
3.12 How the linker resolves references .................................... .................................... 3-67
3.13 The strict family of linker options ...................................... ...................................... 3-68
3.14 Avoiding the BLX (immediate) instruction issue on an ARM1176JZ-S or ARM1176JZF-
S processor ...................................................... ...................................................... 3-69
Chapter 4 Linker Optimization Features
4.1 Elimination of common debug sections ................................. ................................. 4-71
4.2 Elimination of common groups or sections .............................................................. 4-72
4.3 Elimination of unused sections ................................................................................ 4-73
4.4 Elimination of unused virtual functions .................................................................... 4-75
4.5 About linker feedback .............................................................................................. 4-76
4.6 Example of using linker feedback ............................................................................ 4-78
4.7 Optimization with RW data compression ................................ ................................ 4-80
4.8 Function inlining with the linker ................................................................................ 4-83
4.9 Factors that influence function inlining .................................................................... 4-85
4.10 About branches that optimize to a NOP .................................................................. 4-87
4.11 Linker reordering of tail calling sections .................................................................. 4-88
4.12 Restrictions on reordering of tail calling sections .......................... .......................... 4-89
4.13 Linker merging of comment sections ................................... ................................... 4-90
Chapter 5 Getting Image Details
5.1 Options for getting information about linker-generated files .................................... 5-92
5.2 Identifying the source of some link errors ................................................................ 5-93
5.3 Example of using the --info linker option ................................ ................................ 5-94
5.4 How to find where a symbol is placed when linking ................................................ 5-96
5.5 How to find the location of a symbol within the map file .......................................... 5-97
Chapter 6 Accessing and Managing Symbols with armlink
6.1 About mapping symbols .......................................................................................... 6-99
6.2 Linker-defined symbols .......................................................................................... 6-100
6.3 Region-related symbols ............................................ ............................................ 6-101
6.4 Section-related symbols ........................................................................................ 6-106
6.5 Access symbols in another image .................................... .................................... 6-108
6.6 Edit the symbol tables with a steering file .............................................................. 6-112
6.7 Use of $Super$$ and $Sub$$ to patch symbol definitions .................................... 6-115
Chapter 7 Scatter-loading Features
7.1 The scatter-loading mechanism ...................................... ...................................... 7-117
7.2 Root execution regions .......................................................................................... 7-124
7.3 Example of how to explicitly place a named section with scatter-loading ...... ...... 7-138
7.4 Placement of unassigned sections with the .ANY module selector ........... ........... 7-140
7.5 Placement of veneer input sections in a scatter file .............................................. 7-151
7.6 Placement of sections with overlays ...................................................................... 7-152
7.7 Reserving an empty region .................................................................................... 7-154
7.8 Placement of ARM C and C++ library code ............................. ............................. 7-156
7.9 Creation of regions on page boundaries ............................... ............................... 7-159
ARM DUI0474M Copyright © 2010-2016 ARM Limited or its affiliates. All rights
reserved.
5
Non-Confidential