| |||
| Home > Directives Reference > Miscellaneous directives > EXPORT or GLOBAL | |||
The EXPORT directive declares a symbol that can
be used by the linker to resolve symbol references in separate object
and library files. GLOBAL is a synonym for EXPORT.
EXPORT {[WEAK]}
EXPORTsymbol{[type]}
EXPORTsymbol[attr{,type}]
EXPORTsymbol[WEAK{,attr}{,type}]
where:
symbolis the symbol name to export. The symbol name is case-sensitive.
If is omitted,
all symbols are exported.symbol
WEAK is
only imported into other sources if no other source exports an alternative symbol.
If symbol[WEAK] is used without ,
all exported symbols are weak.symbol
attrcan be any one of:
DYNAMICsets the ELF symbol visibility to STV_DEFAULT.
PROTECTEDsets the ELF symbol visibility to STV_PROTECTED.
HIDDENsets the ELF symbol visibility to STV_HIDDEN.
INTERNALsets the ELF symbol visibility to STV_INTERNAL.
typespecifies the symbol type:
DATA is
treated as data when the source is assembled and linked.symbol
CODE is
treated as code when the source is assembled and linked.symbol
ELFTYPE=n is
treated as a particular ELF symbol, as specified by the value of symboln,
where n can be any number from 0 to 15.
If unspecified, the assembler determines the most appropriate
type.
Use EXPORT to give code in other files access
to symbols in the current file.
Use the [WEAK] attribute to inform the linker
that a different instance of takes precedence
over this one, if a different one is available from another source.
You can use the symbol[WEAK] attribute with any of the symbol
visibility attributes.
See also IMPORT and EXTERN.
See the ELF for the ARM Architecture ABI documentation on http://infocenter.arm.com for more information on symbol visibility.
AREA Example,CODE,READONLY
EXPORT DoAdd ; Export the function name
; to be used by external
; modules.
DoAdd ADD r0,r0,r1
Symbol visibility can be overridden for duplicate exports.
In the following example, the last EXPORT takes precedence
for both binding and visibility:
EXPORT SymA[WEAK] ; Export as weak-hidden
EXPORT SymA[DYNAMIC] ; SymA becomes non-weak dynamic.