mnabil
mnabil

Reputation: 745

Trace gcc linker linking process

How can I trace the gcc ld linker linking process? I need to see how it link with function from shared objects.

Upvotes: 4

Views: 2761

Answers (2)

hmmftg
hmmftg

Reputation: 1714

as saving a log file can help dig into later issues, I prefer this flags: -Wl,-Map,linker.log. in which you can search and we can also save it inside repository for later usage

Upvotes: 0

Florian Weimer
Florian Weimer

Reputation: 33719

Depending on what you are after, you can pass either -Wl,--trace or -Wl,--cref to gcc, instructing the linker to print additional details about the linking process:

If you are interested in a particular symbol, say SYMBOL, you could try -Wl,--trace-symbol,SYMBOL as well.

(This assumes that you are using binutils ld, of course.)

Upvotes: 9

Related Questions