Does `-fwhole-program' make sense when compiling shared libraries?

Toon Moene toon@moene.org
Mon May 17 17:57:00 GMT 2010


On 05/17/2010 08:08 PM, Dave Korn wrote:
>
>      Hi!
>
>    PR42904 is a bug where, when compiling a windows DLL using -fwhole-program,
> the compiler optimises away the entire library body, because there's no
> dependency chain related to 'main' to anchor it.

Aren't "shared library" and "whole program" mutually exclusive concepts ?

The mere fact that you are building a library means that it cannot be 
the whole program, and because a shared library cannot be determined to 
have being used by any fixed program, by definition cannot be "the whole 
program".

Or so I'd think.

Kind regards,

-- 
Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/gcc-4.5/changes.html#Fortran



More information about the Gcc mailing list