This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: static lib drops objects with side-effects
On Mon, Feb 10, 2003 at 07:01:19PM +0200, Elias Athanasopoulos wrote:
> Hello!
>
> On Mon, Feb 10, 2003 at 05:03:04PM +0100, Wesley W. Terpstra wrote:
> > g++ main.o libfat.a -o fails
> > This will NOT include the static_nut and will fail to print output
> >
> > This is a bug.
>
> Try this:
>
> % g++ -Wl,--whole-archive libfat.a -Wl,--no-whole-archive main.o -o works
I know about the whole-archive option. However, this is not the point. The
default behaviour of gnu binutils should not prevent the compilation of
conforming C++ code.
Also, I do not want to force the linker to bring in every symbol. It is ok
for the linker to drop objects which do not have side-effects. That is good
and proper and prevents needless code from being included.
There is simply something wrong in ld which needs fixing.
I have other work-arounds which I already use (and don't pull in the whole
library), but these are just that: work-arounds. ... and they aren't
portable.
--
Wesley W. Terpstra <wesley@terpstra.ca>