06.02.2013 Views

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

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

9.5 Recommendations for using ld scripts with armlink<br />

GNU ld script support in armlink<br />

Follow <strong>the</strong>se recommendations when producing ld scripts for use with armlink:<br />

9.5.1 Recommendations for producing ld scripts for <strong>ARM</strong> Linux<br />

9.5.2 General recommendations<br />

9.5.3 See also<br />

The dynamic loader requires some output sections with a specific type to work properly. These<br />

are:<br />

• Hash Table<br />

• String Table<br />

• Dynamic Symbol Table<br />

• Dynamic Section<br />

• Version Sections<br />

• Thread Local Storage Sections.<br />

The following are general recommendations:<br />

• Make sure each output section has a homogenous type. For example:<br />

.text : { *(.text) }<br />

.data : { *(.data) }<br />

.bss : { *(.bss) }<br />

This is preferred to <strong>the</strong> following:<br />

.stuff<br />

{<br />

*(.text)<br />

*(.data)<br />

*(.bss)<br />

}<br />

• If you are running <strong>the</strong> ELF file on <strong>ARM</strong> Linux do not modify <strong>the</strong> location of <strong>the</strong> meta-data<br />

used by <strong>the</strong> dynamic linker.<br />

• Sections not matched by <strong>the</strong> SECTIONS command are marked as orphans. The linker places<br />

orphan sections in appropriate locations. The linker attempts to match <strong>the</strong> placement of<br />

orphans used by ld although this is not always possible. Use explicit placement if you do<br />

not like how armlink places orphans.<br />

Concepts<br />

• About GNU ld script support and restrictions on page 9-2<br />

• Important ld script commands that are implemented in armlink on page 9-4<br />

• Specific restrictions for using ld scripts with armlink on page 9-6.<br />

Reference<br />

<strong>Linker</strong> Reference:<br />

• --linker_script=ld_script on page 2-100<br />

• --symver_script=file on page 2-167.<br />

<strong>ARM</strong> DUI 0474C Copyright © 2010-2011 <strong>ARM</strong>. All rights reserved. 9-7<br />

ID080411 Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!