Directives Reference
7-62 Copyright © 2000, 2001 ARM Limited. A ll rights reserved. ARM DUI 0068B
7.7.11 GLOBAL
See EXPORT or GLOBAL on page7-58.
7.7.12 IMPORT
The
IMPORT
directive provides the assembler with a name that is not defined in the
current assembly.
IMPORT
is very similar to
EXTERN
, except that the name is imported whether or not it is
referred to in the current assembly (see EXTERN on page7-60, and EXPORT or
GLOBAL on page7-58).
Syntax
IMPORT symbol{[WEAK]}
where:
symbol
is a symbol name defined in a separately assembled source file, object
file, or library. The sym bol name is case-s ensitive.
WEAK
prevents the linker generating an error message if the symbol is not
defined elsewhere. It also prevents the linker searching libraries that are
not already included.
Usage
The name is resolved at link time to a symbol defined in a separate object file. The
symbol is treated as a program address. If
[WEAK]
is not specified, the linker generates
an error if no corresponding symbol is found at link time.
If
[WEAK]
is specified and no corresponding symbol is found at link time:
If the reference is the destination of a
B
or
BL
instruction, the value of the symbol
is taken as the address of the following instruction. This makes the
B
or
BL
instruction effectively a
NOP
.
Otherwise, the va lue of the sym bol is taken as z ero.
To avoid trying to access symbols that are not found at link time, use code like the
example in EXTERN on page 7-60.