9.3.1. Building SysV executables

To link a SysV executable --sysv must be used on the linker command line. Also a subset of the GNU ld script language was added in ARM Compiler toolchain 4.1 to give finer control over the layout of sections in the SysV output of the linker.

It is possible to build a SysV executable with position independence by compiling with the --apcs=/fpic option. This is not required by some SysV systems, for example, ARM Linux executables always execute from a fixed address of 0x8000. However, other operating systems based on the SysV model might decide to have position independent executables.

Executables being statically linked at fixed addresses have an interesting side effect when they try to access variables from shared libraries. That is, if the application is built without position independence, the extra level of indirection required to access the variables in a dynamic linked system is not generated. Therefore the variable must be accessed within the executables address space. However, because the variable is in a shared library it is not in the address space of the executable. To overcome this problem the linker allocates space in the data section of the executable and generates a copy relocation.

The copy relocation instructs the dynamic linker to copy the value of the variable from the shared library to the location in the application. References from the shared library to the variable are re-targeted to the copy in the executable.

Copyright © 2010 ARM. All rights reserved.ARM DAI 0242A