lllllllllllll
lllllllllllll

Reputation: 9110

How to get the information of "how many and which symbols are resolved by linker"?

The test is on 32-bit Linux, x86. With gcc 4.6.3 and GNU ld 2.22.

So I am trying to get the information of "how many symbols are resolved by linker" during link time? And how can I list the information of all the resolved symbols? say, the symbol name, memory address.

I am thinking I should manipulate the linker to do so, but I have no idea how to do it. I have some experiences to fed linker with a link-script, but I didn't find anything related to resolved symbol information in the link-scripts..

Could anyone give me some help? I really appreciate that! Thank you!

Upvotes: 0

Views: 181

Answers (1)

user3710044
user3710044

Reputation: 2334

Sounds like you want a "linker map".

The ld(1) option is "--print-map". But calling through GCC you'll probably have to do something like:

gcc -Wl,--print-map -o a.out c.c

It comes out the standard output and looks pretty complete.

Upvotes: 1

Related Questions