| ARM Technical Support Knowledge Articles | |
Applies to: BL51 Code-banking Linker/Locator
Information in this article applies to:
The linker is not finding some functions in my libraries.
In main.c, I have a call to foo(). foo() calls bar().
foo() is in library foo.lib.
bar() is in library bar.lib.
I run the linker from the command line:
BL51 main.obj, bar.lib, foo.lib
I get these messages:
*** WARNING 1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: BAR
MODULE: FOO.LIB (FOO)
*** WARNING 2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: BAR
MODULE: FOO.LIB (FOO)
ADDRESS: 0014H
The linker processes files in the order you specify them. From library files, it takes only those modules required to satisfy unresolved external references it has already encountered.
In this example, when the linker reads bar.lib there have been no references to bar(), so the linker does not link bar() into the program. When it reads foo.lib, it is able to resolve the reference to foo(). Since foo() calls bar(), this creates a reference to bar(). The linker does not backtrack to reprocess library files it has already read, so this reference to bar() is never resolved.
There are two ways to solve this problem:
BL51 main.obj, foo.lib, bar.lib
BL51 main.obj, bar.lib (bar), foo.lib
Article last edited on: 2005-07-09 11:22:57
Did you find this article helpful? Yes No
How can we improve this article?