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

This is what __attribute__ ((externally_visible)) is intended for.  If you want 
to build
shared library with whole program, you need to explicitely mark all the entry 
points.

Alternatively with LTO we might take the existing hidden linkage hints for same 
effect,
but this is not implemented (yet).

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

Reply via email to