static library unresolved symbols

Ian Lance Taylor iant@google.com
Tue Jun 18 13:40:00 GMT 2013


On Tue, Jun 18, 2013 at 3:40 AM, Riccardo Manfrin
<riccardomanfrin@gmail.com> wrote:
> I'm inspecting a static library with nm, and I see that the tool provides me
> with the unresolved symbols of a file foo.o even though those symbols are
> defined in file zoo.o and both are included in the static library (ar rcs
> libmy.a zoo.o foo.o).
>
> How can I ask nm to resolve these symbols if they can be found within the
> files of the archive and just report me about the other not resolved?

As far as I know there is no way to do that directly.

You can do it indirectly by doing

ld -r -o foo.o --whole-archive foo.a
nm -u foo.o

Ian



More information about the Gcc-help mailing list