Solution -------- As we need to dump the combined call graph for multiple files, we need to consider link time optimization (LTO). Thus we specify the options "-flto". Now if we specify the option "-flto-partiton=none", it loads the function body and call graph. However when we do not specify the option "-flto-partiton=none" the default partiton is used. This option loads only the call graph and not the function body. for (node = cgraph_nodes; node; node = node->next) { /* Nodes without a body, and clone nodes are not interesting. */ if (!gimple_has_body_p (node->decl) || node->clone_of) continue; push_cfun (DECL_STRUCT_FUNCTION (node->decl)); fprintf (dump_file, "\n Function : "); fprintf (dump_file,"%s\t",cgraph_node_name(node)); /* Check if the node i.e. a function has callers */ if(node->callers) { /* Print the first caller */ fprintf (dump_file, "\t Caller :"); fprintf (dump_file,"%s",cgraph_node_name(node->callers->caller)); /* Extract the next caller */ edge = node->callers->next_caller; /* Iterate over all the remaining callers */ while(edge) { fprintf (dump_file, "\t Caller :"); fprintf (dump_file,"%s",cgraph_node_name(edge->caller)); edge = edge->next_caller; } } /* restoring the context by popping cfun. */ pop_cfun (); } We have 2 input files `test1.c' and `test2.c'. Below are the observations to be noted. 1. If we execute without specifying "-flto" option it generates dump file for test1.c and test2.c but not for the combined output (i.e. all files merged.*.* are missing). gcc -fplugin=./plugin.so -c test1.c -fdump-ipa-all gcc -fplugin=./plugin.so -c test2.c -fdump-ipa-all gcc -fplugin=./plugin.so -o merged test1.o test2.o -fdump-ipa-all In order to create these files, we need to enable the lto mode. 2. If we execute using the "-flto" option it does not generate any data in the combined output file. In this case default partiton is considered which loads only the call graph and not the function body. gcc -fplugin=./plugin.so -c -flto test1.c -fdump-ipa-all gcc -fplugin=./plugin.so -c -flto test2.c -fdump-ipa-all gcc -fplugin=./plugin.so -o merged -flto test1.o test2.o -fdump-ipa-all As we have the check to test if the function has body, it skips the code to dump the functions without callers. if (!gimple_has_body_p (node->decl) || node->clone_of) continue; If we remove this condition, we get correct output for individual files as well as for combined output. 3. If we execute using "-flto -flto-partition=none" option, it generates complete output. When we use the option "-flto-partition=none". both the call graph and the function bodies gets loaded. This gives us the complete output. gcc -fplugin=./plugin.so -c -flto -flto-partition=none test1.c -fdump-ipa-all gcc -fplugin=./plugin.so -c -flto -flto-partition=none test2.c -fdump-ipa-all gcc -fplugin=./plugin.so -o merged -flto -flto-partition=none test1.o test2.o -fdump-ipa-all