12.6 RESOLVE steering file command
Matches specific undefined references to a defined global symbol.
Syntax
RESOLVE
pattern
AS
defined_pattern
where:
pattern
is a string, optionally including wildcard characters (either
*
or?
), that matches zero or more undefined global symbols. If
does not match any undefined global symbol, the linker ignores the command. The operand can match only undefined global symbols.pattern
defined_pattern
is a string, optionally including wildcard characters, that matches zero or more defined global symbols. If
does not match any defined global symbol, the linker ignores the command. You cannot match an undefined reference to an undefined symbol.defined_pattern
Usage
RESOLVE
is an extension of the existing armlink
--unresolved
command-line option. The difference is that
--unresolved
enables all undefined references to match one single
definition, whereas RESOLVE
enables more specific matching of references to
symbols.
The undefined references are removed from the output symbol table.
RESOLVE
works when performing partial-linking and when linking
normally.
Example
You might have two files file1.c and file2.c, as shown in the following example:
file1.c extern int foo; extern void MP3_Init(void); extern void MP3_Play(void); int main(void) { int x = foo + 1; MP3_Init(); MP3_Play(); return x; } file2.c: int foobar; void MyMP3_Init() { } void MyMP3_Play() { }
Create a steering file, ed.txt, containing the line:
RESOLVE MP3* AS MyMP3*
.
Enter the following command:
armlink file1.o file2.o --edit ed.txt --unresolved foobar
This command has the following effects:
-
The references from file1.o (
foo
,MP3_Init()
andMP3_Play()
) are matched to the definitions in file2.o (foobar
,MyMP3_Init()
andMyMP3_Play()
respectively), as specified by the steering file ed.txt. The
RESOLVE
command in ed.txt matches theMP3
functions and the--unresolved
option matches any other remaining references, in this case,foo
tofoobar
.The output symbol table, whether it is an image or a partial object, does not contain the symbols
foo
,MP3_Init
orMP3_Play
.