10.1.3. Linker (armlink)

Symbol visibility is particularly important in the linker. This is where the visibility of symbol definitions and references are checked to ensure that they are suitable. For example, the linker ensures a hidden visibility symbol is not attempting to be used dynamically. There is an armlink diagnostic option --info visibility which when used with --verbose shows the transitions in visibility that a symbol goes through. The linker is also responsible for populating the dynamic symbol table and creating the .dynamic ELF section.

The ELF specification provides some rules on how the linker must handle symbol visibility when there is a difference between symbol definition and reference visibility. The ELF specification says that the linker must use the most restrictive visibility of any of the symbol definitions or references. The ELF specification classes STV_INTERNAL as the most restrictive and STV_DEFAULT as the least restrictive.

In practice this means an STV_HIDDEN visibility reference to an STV_DEFAULT visibility definition results in an STV_HIDDEN visibility definition. armlink allows this to be overridden by specifically importing or exporting a symbol in a steering file or by selecting to always use the definition visibility for the output visibility.

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