6.2.1. Building an ARM Linux executable

Use the --sysv command-line option to generate an SVr4 formatted ELF executable file that can be used on ARM Linux.

Note

If you use --sysv, the linker ignores any scatter file that you specify on the command line.

The base of an executable is 0x8000 by default. The linker creates a dynamic executable when shared object files are given on the command line.

When the linker finds a shared object on the command line, it is included in the list of libraries to be added to the executable file (see Library searching, selection, and scanning for details).

If you are working on ARM Linux, be aware of the following:

For an example library that retargets the ARM C library to run under ARM Linux see the main examples directory, in ...\linux.

Building a shared object

A shared object is an extension of the static and dynamic scatter-loading file described in Building an ARM Linux executable. The base address of the load region is set at 0 and is then relocated by the Linux dynamic linker.

If your shared object contains any exported RW data, you are required to use position independent code and data. In this case, you must compile or assemble your files using --apcs /fpic, and link the files into a shared object using the --fpic linker option.

Use the --shared command-line option to build an SVr4 shared object.

Note

A shared object usually has no entry point. However, it is possible to set an entry point. This must be done if the object you are building is the dynamic linker.

Using the Linux ABI tag

To comply with the Linux Standard Base Specification v1.2, an executable file must contain a section named .note.ABI-tag of type SHT_NOTE, structured as a note section as documented in the ELF specification.

You can use the command-line option --linux_abitag to specify the minimum compatible kernel version for the executable file you are building, for example:


armlink ... --sysv --linux_abitag 2.2.5 main.o

This links main.o to the ARM C library for a static executable that is defined as being compatible with Linux kernel v2.2.5 or later. If you specify any shared objects on the command line that demand a newer kernel, the kernel requirements in the output file are incremented to match.

For full details on using the Linux ABI tag and Standard Base Specification, see http://www.linuxbase.org.

Copyright © 2002-2005 ARM Limited. All rights reserved.ARM DUI 0206F
Non-Confidential