Hello,

(I'm still a newbie in gcc)

I am interested in -fwhole-program analysis (flag_whole_program) and I know 
that with -O3 -fwhole-program the cgraph_nodes is cleaned (in cgraphunit.c 
probably by cgraph_varpool_remove_unreferenced_decls) so that only functions 
callable from main are kept (as a counter example, compile with -fwhole-program 
-O3 a test.c file without any main function, you'll get a nearly empty test.s 
without any code; I even submitted a trivial patch 
http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00626.html to gcc-patches@ adding 
a warning in that case)

But I do not understand exactly where in the GCC source code the main entry 
point is used as a starting point for this call graph analysis. I guess that it 
is in the decide_is_function_needed function of cgraphunit.c (with a 
MAIN_NAME_P test).

Could someone confirm my partial understanding please?


Regards.
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France

Reply via email to