------- Comment #4 from hubicka at ucw dot cz  2009-02-17 18:01 -------
Subject: Re:  LTO and -fwhole-program do not play along well

> > Hi,
> > functions are brought local in function_and_variable_visibility that
> > needs to be scheduled after LTO is read in.
> > The pas computes externaly_visible flags that should be up-to-date for
> > early IPA passes before LTO is written out, so I guess we need early
> > function_and_vairable_visibility pass and late one where the first one
> > is not bringing functions local at -fwhole-program -lto
> 
> OK, but I think there is a bigger issue here.  Even if -flto is *not*
> used, we get link errors.  Just by compiling each file with
> -fwhole-program is enough to reproduce the failure:
> 
> $ gcc -fwhole-program -c f1.c
> $ gcc -fwhole-program -c f2.c
> $ gcc -fwhole-program -o f f1.o f2.o
> 
> This is just a natural side-effect of using -fwhole-program.  It was
> not intended to be used like this.

This is intended behaviour.
-fwhole-program essentially hides everything except for main and
functions/variables explicitly marked via attribute, so this is
exepcted.  You need to use --combine and or -lto to compile programs
consisting of multiple compilation units with -fwhole-program.

Honza


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39203

Reply via email to