JoshuaJ
JoshuaJ

Reputation: 979

Is there a way to see the functions inside a C/C++ archive (.a)?

We have a situation where (simplified):

  1. test() exists in source.c
  2. source.c compiles to object.o
  3. object.o gets linked into archive archive.a
  4. archive.a gets compiled into final binary

We are attempting to change the name of test() to something else. But the linking step in (4) says the new method signature does not exist. Using gobjdump we see for certain the new renamed method exists in object.o (it is in the same SECT as other methods and is not UND).

We can see for certain that the object.o exists in archive.a. However, we are not certain (because of the complicated build system) that archive.a contains the method.

TL;DR: Is there a way to see inside an archive file and list the functions of a particular binary object inside it?

Upvotes: 3

Views: 2802

Answers (1)

Andrew Henle
Andrew Henle

Reputation: 1

Use nm. Assuming Linux, here's the man page.

Upvotes: 3

Related Questions