DEFAULT_VTABLE_THUNKS ?
Hi,
I rebuilt egcs, and it still had the same problem.
I looked into the code, and I can see in gcc/cp/cp-tree.h:
cp-tree.h:#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt$%s")
The flag_vtable_thunks variable gets set if the -fvtable-thunks option
is used when invoking egcs, or if the DEFAULT_VTABLE_THUNKS variable
is set when building egcs.
The egcs info file says this about DEFAULT_VTABLE_THUNKS:
GNU CC supports two ways of implementing C++ vtables: traditional
or with so-called "thunks". The flag `-fvtable-thunk' chooses
between them. Define this macro to be a C expression for the
default value of that flag. If `DEFAULT_VTABLE_THUNKS' is 0, GNU
CC uses the traditional implementation by default. The "thunk"
implementation is more efficient (especially if you have provided
an implementation of `ASM_OUTPUT_MI_THUNK', see *Note Function
Entry::), but is not binary compatible with code compiled using
the traditional implementation. If you are writing a new ports,
define `DEFAULT_VTABLE_THUNKS' to 1.
If you do not define this macro, the default for `-fvtable-thunk'
is 0.
config/mt-linux says:
# When using glibc 2 on Linux we must always use vtable thunks.
CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -fvtable-thunks -D_GNU_SOURCE
So this causes parts of egcs to be compiled with -fvtable-thunks.
(But apparently not all the parts)
It seems that DEFAULT_VTABLE_THUNKS is normally set to 1 for the other
Linux ports.
./linux.h:#undef DEFAULT_VTABLE_THUNKS
./linux.h:#define DEFAULT_VTABLE_THUNKS 1
./alpha/linux-elf.h:#undef DEFAULT_VTABLE_THUNKS
./alpha/linux-elf.h:#define DEFAULT_VTABLE_THUNKS 1
./rs6000/linux.h:#undef DEFAULT_VTABLE_THUNKS
./rs6000/linux.h:#define DEFAULT_VTABLE_THUNKS 1
./sparc/linux.h:#undef DEFAULT_VTABLE_THUNKS
./sparc/linux.h:#define DEFAULT_VTABLE_THUNKS 1
However, for the ARM port, it doesn't seem to be enabled.
When I recompile the offending elements that were messing up in
libgcc.a with -fvtable-tunks, the symbols used the newer mangling
scheme.
I checked Corel's gcc stuff, and DEFAULT_VTABLE_THUNKS is defined
there. So, I'm going to try this patch:
--- linux-elf.h~ Tue Jan 5 15:48:06 1999
+++ linux-elf.h Tue Jan 5 20:09:22 1999
@@ -35,6 +35,10 @@
" %{mapcs-26:-mapcs-26} %(!mapcs-26:-mapcs-32}"
#endif
+/* This was defined in linux.h. Define it here also. */
+#undef DEFAULT_VTABLE_THUNKS
+#define DEFAULT_VTABLE_THUNKS 1
+
/* Now we define the strings used to build the spec file */
#define ASM_SPEC "%{mbig-endian:-EB} "
I'll recompile egcs, and tell you all if it worked.
Cheers,
- Jim
Reply to: