This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Mon, May 17, 2010 at 10:57:31AM -0700, Toon Moene wrote:
> 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.

Not a bug, but perhaps the beginning of a reasonable enhancement project.

> 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.

The concept would need to be extended so that the compiler would be told
exactly what interfaces of the shared library are considered free, and
which are considered internal calls.  Then a -fwhole-library could make
sense.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]