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



--- Comment #7 from Dmitry Gorbachev <d.g.gorbachev at gmail dot com> 
2013-01-30 13:39:37 UTC ---

> The other way around, compiling and installing with

> -O2 but then at link time use -O0 -g to get a debug

> build is more questionable



> However, I still don't see the point of "-O0 -flto"

> at link-time. We should either force it to be at

> least -O1 or (in my opinion better) give an error.



I think it could make sense. For example, I compile a certain static library

with `-O3 -flto', without `-g' (it's considered already debugged) and without

`-fno-fat-lto-objects' (so it can be used either with or without LTO); it is

shared between several programs. The programs have their own static libs, which

are compiled with `-g -O1 -flto -fno-fat-lto-objects' (could be `-O0', but

doesn't work, PR55102). Then, they are linked using `-g -O0 -flto' to get a

(partially) debug enabled program, or with `-O3 -flto' for a fully optimized

program.



> the docs have this example



Yes, but there is an aforementioned bug 55102.

Reply via email to