gccの専門家、
gcc が私のシステム (RedHat Enterprise Linux 5.7) に付属しているため、ライブラリ アーカイブで gcc lto を使用しようとしています。
1. binutils-2.22 を2 でビルドします--enable-plugins
。3 で gcc-4.7.2 をビルドし--with-plugin-ld=/path/to/ld/built/in/step1 --enable-lto
ます。次に、次の簡単なテストを行います。
// 1.c:
int foo(void)
{ return 0; }
// 2.c:
extern int foo(void)
int main(void)
{ return foo(); }
以下はfoo()
インライン化 できます。
my_gcc -O3 -flto -c -o 1.o 1.c
my_gcc -O3 -flto -c -o 2.o 2.c
my_gcc -O3 -flto -o a.out 1.o 2.o
以下はできませんが:
my_gcc -O3 -flto -c -o 1.o 1.c
my_gcc -O3 -flto -c -o 2.o 2.c
my_ar cr --plugin <my_gcc>/libexec/gcc/x86_64-redhat-linux/4.7.2/liblto_plugin.so 1.a 1.o
my_ar cr --plugin <my_gcc>/libexec/gcc/x86_64-redhat-linux/4.7.2/liblto_plugin.so 2.a 2.o
gcc -O3 -flto -fuse-linker-plugin -o a.out 1.a 2.a
私が取り組んでいる製品の構築システムはアーカイブを使用する必要があるため、lto をライブラリ アーカイブで動作させるにはどうすればよいですか?
あなたの助けは大歓迎です。
どうもありがとう。