10.1.1. Compiler (armcc)

The ARM compiler (armcc) supports two basic methods to control symbol visibility, command-line switches and source code annotation. Table 10.1 summarizes the compiler command-line options.

Table 10.1. Dynamic linking compiler options

OptionSupported fromDescription
--[no_]hide_allRVCT 2.2Gives all symbol definitions STV_DEFAULT visibility
--[no_]dllexport_allRVCT 2.2Marks all extern definitions as: __declspec(dllexport)
--[no_]export_defs_implicitlyRVCT 2.2Exports all functions marked as: __declspec(dllimport)
--[no_]export_all_vtblRVCT 2.2Exports all virtual table functions and RunTime Type Information (RTTI)
--[no_]dllimport_runtimeRVCT 3.1Marks run-time functions, e.g. C library functions, as: __declspec(dllimport)

Also, armcc supports a number of source code annotations to control visibility. The behaviour of some of these has changed between releases of the ARM compiler. Table 10.2 shows the annotations and behaviour in releases.

Table 10.2. Dynamic object compiler options

OptionToolchainDescription
__declspec(dllexport)RVCT 2.2Gives symbol definitions STV_DEFAULT visibility, gives symbol references STV_HIDDEN visibility, and creates a linker EXPORT directive[a]
__declspec(dllimport)RVCT 2.2Gives symbol references STV_DEFAULT visibility and creates a linker IMPORT directive[a]
__declspec(dllexport)RVCT 3.0, 3.1Gives symbol definitions STV_DEFAULT visibility and gives symbol references STV_HIDDEN visibility
__declspec(dllimport)RVCT 3.0, 3.1Gives symbol references STV_DEFAULT visibility
__declspec(dllexport)RVCT 4.0, ARM Compiler toolchain 4.1Gives symbol definitions and references STV_PROTECTED visibility.
__declspec(dllimport)RVCT 4.0, ARM Compiler toolchain 4.1Gives symbol references STV_PROTECTED visibility
__attribute__((visibility("default")))RVCT 4.0, ARM Compiler toolchain 4.1Gives the symbol definition or reference STV_DEFAULT visibility
__attribute__((visibility("protected")))RVCT 4.0, ARM Compiler toolchain 4.1Gives the symbol definition or reference STV_PROTECTED visibility
__attribute__((visibility("hidden")))RVCT 4.0, ARM Compiler toolchain 4.1Gives the symbol definition or reference STV_HIDDEN visibility
__attribute__((visibility("internal")))RVCT 4.0, ARM Compiler toolchain 4.1Gives the symbol definition or reference STV_INTERNAL visibility

[a] The RVCT 2.2 compiler also generates .directive sections. These sections embed steering file commands into an ELF object file for any symbol whose destination address was unknown. These must be processed by the linker. This requirement has been superseded by ELF-standard mechanisms. Therefore, in RVCT 3.0 and later, these sections are no longer generated by the compiler. The annotations in Table 10.3 and steering files can be used instead. For more details about steering files, see Steering files.


Further information on symbol visibility is available in the ARM Compiler toolchain Migration and Compatibility document.

Copyright © 2010 ARM. All rights reserved.ARM DAI 0242A
Non-ConfidentialID011411