mathk
mathk

Reputation: 8133

Using objdump/readelf and extern variable

I have library ab.so compose of 2 sources file a.m, a.h and b.m, b.h

In a.m I have define a variable foo and in b.m I have declare it extern.

Now using readelf/objdump I would like to know where and how can I see my variable foo in the a.o file, b.o and ab.so?

Thanks a lot

Upvotes: 0

Views: 946

Answers (1)

karlphillip
karlphillip

Reputation: 93410

Tricky question. You must realize that readelf/objdump will not display C code as a result, only assembly code. If you are prepared to read that, go ahead and disassembly the application with objdump -d ab.so and look for the relevant code there.

There are a bunch of readelf/objdump tutorials available on the web. Don't be afraid to look for them.

Upvotes: 1

Related Questions