Omitting vtables does not work in egcs-2.93.20 19990501

Martin v. Loewis martin@mira.isdn.cs.tu-berlin.de
Sat May 1 04:21:00 GMT 1999


On i586-pc-linux-gnu, egcs 1.1.2 does not write vtables for the code

struct A{
  virtual void foo();
};

A a;

This is reasonable: A::foo must be implemented somewhere else.

With egcs-2.93.20 19990501, using '-S -O2', I get the assembler output
as attached below. Please notice that g++ writes a section

.section	.gnu.linkonce.d.__vt_1A,"aw",@progbits

Even though this is correct code, and even though the GNU linker will
remove the duplicate, I still think this is incorrect: the code using
the heuristis of the first non-inline virtual function is still in
import_export_class; it somehow doesn't have the desired effect.

I believe on Solaris, the problem is more serious, as the system
linker doesn't support the linkonce sections.

Martin



More information about the Gcc-bugs mailing list