Thanks. It works. I thought -fwhole-program was used with --combine and they are replaced by -flto. Now it seems that -flto is equivalent of --combine, and -fwhole-program is still important.
Bingfeng > -----Original Message----- > From: Diego Novillo [mailto:dnovi...@google.com] > Sent: 13 October 2009 14:30 > To: Bingfeng Mei > Cc: gcc@gcc.gnu.org > Subject: Re: LTO question > > On Tue, Oct 13, 2009 at 08:47, Bingfeng Mei <b...@broadcom.com> wrote: > > > a.c > > extern void foo(int); > > int main() > > { foo(20); > > return 1; > > } > > > > b.c > > #include <stdio.h> > > void foo(int c) > > { > > printf("Hello world: %d\n", c); > > } > > > > compiled with: > > firepath-elf-gcc -flto a.c b.c -save-temps -O2 > > > > I expected that foo should be inlined into main, but not. > Both functions > > of main and foo are present in a.s, while b.s contains the > LTO code. > > Try adding -fwhole-program. > > > Diego. > >