On Wed, Oct 13, 2010 at 11:54 PM, Joe Buck <joe.b...@synopsys.com> wrote:
> On Wed, Oct 13, 2010 at 02:43:18PM -0700, Sebastian wrote:
>> On Wed, Oct 13, 2010 H.J. Lu wrote:
>> > gcc can not dump a callgraph.  Both GNU ld and gold can dump a
>> > cross-reference table, which is not a call graph but could perhaps be
>> > used to produce a call graph.  See the --cref option.
>> --cref isn't much use. It doesn't tell me which functions call other
>> functions, only which modules refer to them.
>>
>> Static analysis which work on source code are not ideal, either. They
>> don't know which functions will be inlined by the compiler.
>>
>> So it would be nice if gcc could provide a call graph.
>
> gcc compiles only one object file at a time; to produce a call graph you'd
> need data produced by the linker.  gcc cannot provide a call graph.
>
> To get a call graph, you'd need to combine data produced by the compiler
> (with stack-usage) and data produced by the linker (--cref).  It probably
> wouldn't be too hard to produce such a tool using a scripting language
> (perl or python, say) to parse the outputs from the compile and link
> steps.

You can use LTO and the cgraph dump for that.

Richard.

>

Reply via email to