[Mingw-w64-public] Do I need -flto when building a static lib?

2014-04-26 Thread lh_mouse
Hello there, do I need -flto when building a static lib? Here is an example: E:\Desktopgcc foo.c -c -flto E:\Desktopar rcs libfoo.a foo.o E:\Desktopgcc main.c -L. -lfoo -flto C:\Users\LH_Mouse\AppData\Local\Temp\ccc30oDd.ltrans0.ltrans.o:ccc30oDd.ltrans0.o:(.text+0x1e): undefined reference to

Re: [Mingw-w64-public] Do I need -flto when building a static lib?

2014-04-26 Thread TOCK Chiu
Are you using GCC 4.9.0? Since GCC 4.9.0, LTO-enabled object file doesn't contain normal object code but GIMPLE bytecode by default. If you want to link to a static library, you have to pass -fuse-linker-plugin to let it extract LTO segments, and AFAIK it's enabled by default when -flto is

Re: [Mingw-w64-public] Do I need -flto when building a static lib?

2014-04-26 Thread lh_mouse
2014-04-26 Best regards, lh_mouse 发件人:TOCK Chiu stanley82...@gmail.com 发送时间:2014-04-26 21:20 主题:Re: [Mingw-w64-public] Do I need -flto when building a static lib? 收件人:mingw-w64-publicmingw-w64-public@lists.sourceforge.net 抄送: Are you using GCC 4.9.0? Since GCC 4.9.0, LTO-enabled object

Re: [Mingw-w64-public] Do I need -flto when building a static lib?

2014-04-26 Thread lh_mouse
Yes gcc 4.9.0. Thread model: win32 gcc version 4.9.0 (i686-win32-sjlj-rev0, Built by MinGW-W64 project) 2014-04-26 Best regards, lh_mouse 发件人:TOCK Chiu stanley82...@gmail.com 发送时间:2014-04-26 21:20 主题:Re: [Mingw-w64-public] Do I need -flto when building a static lib? 收件人:mingw-w64

Re: [Mingw-w64-public] Do I need -flto when building a static lib?

2014-04-26 Thread TOCK Chiu
Then you must experience the same thing as I did. 2014-04-26 21:24 GMT+08:00 lh_mouse lh_mo...@126.com: Yes gcc 4.9.0. Thread model: win32 gcc version 4.9.0 (i686-win32-sjlj-rev0, Built by MinGW-W64 project) 2014-04-26 -- Best regards, lh_mouse