ARM Compiler toolchain Using the Linker - ARM Information Center
ARM Compiler toolchain Using the Linker - ARM Information Center
ARM Compiler toolchain Using the Linker - ARM Information Center
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
3.5 Base Platform linking model<br />
Linking models supported by armlink<br />
Base Platform enables you to create dynamically linkable images that do not have <strong>the</strong> memory<br />
map enforced by <strong>the</strong> System V (SysV) or Base Platform Application Binary Interface (BPABI)<br />
linking models. It enables you to:<br />
• Create images with a memory map described in a scatter file.<br />
• Have dynamic relocations so <strong>the</strong> images can be dynamically linked. The dynamic<br />
relocations can also target within <strong>the</strong> same image.<br />
Note<br />
The BPABI specification places constraints on <strong>the</strong> memory model that can be violated using<br />
scatter-loading. However, because Base Platform is a superset of BPABI, it is possible to create<br />
a BPABI conformant image with Base Platform.<br />
To link with <strong>the</strong> Base Platform model, use <strong>the</strong> --base_platform command-line option.<br />
If you specify this option, <strong>the</strong> linker acts as if you specified --bpabi, with <strong>the</strong> following<br />
exceptions:<br />
• Scatter-loading is available with --scatter, in addition to <strong>the</strong> following options:<br />
— --dll<br />
— --force_so_throw, --no_force_so_throw<br />
— --pltgot=type is restricted to types none or direct<br />
— --ro_base=address<br />
— --rosplit<br />
— --rw_base=address<br />
— --rwpi.<br />
• The default value of <strong>the</strong> --pltgot option is different to that for --bpabi:<br />
— for --base_platform, <strong>the</strong> default is --pltgot=none<br />
— for --bpabi <strong>the</strong> default is --pltgot=direct.<br />
• If you do not use a scatter file, <strong>the</strong> linker can ensure that <strong>the</strong> Procedure Linkage Table<br />
(PLT) section is placed correctly, and contains entries for calls only to imported symbols.<br />
If you specify a scatter file, <strong>the</strong> linker might not be able to find a suitable location to place<br />
<strong>the</strong> PLT.<br />
Each load region containing code might require a PLT section to indirect calls from <strong>the</strong><br />
load region to functions where <strong>the</strong> address is not known at static link time. The PLT<br />
section for a load region LR must be placed in LR and be accessible at all times to code<br />
within LR.<br />
To ensure calls between relocated load regions ar run-time:<br />
— Use <strong>the</strong> --pltgot=direct option to turn on PLT generation.<br />
— Use <strong>the</strong> --pltgot_opts=crosslr option to add entries in <strong>the</strong> PLT for calls between<br />
RELOC load regions. The linker generates a PLT for each load region so that calls do<br />
not have to be extended to reach a distant PLT.<br />
Be aware of <strong>the</strong> following:<br />
• The model assumes that shared objects cannot throw a C++ exception.<br />
• Symbol versioning must be used to ensure that all <strong>the</strong> required symbols are available at<br />
load time.<br />
<strong>ARM</strong> DUI 0474C Copyright © 2010-2011 <strong>ARM</strong>. All rights reserved. 3-6<br />
ID080411 Non-Confidential