This is the mail archive of the
mailing list for the GCC project.
Re: Fix type_info comparison for ARM EABI
On Mon, 6 Nov 2006, Benjamin Kosnik wrote:
> > 2006-11-01 Joseph Myers <firstname.lastname@example.org>
> > * libsupc++/typeinfo (__GXX_TYPEINFO_EQUALITY_INLINE): Define.
> > Use instead of __GXX_MERGED_TYPEINFO_NAMES to condition inline
> > definitions.
> > * libsupc++/tinfo.cc (operator==): Condition on
> > __GXX_TYPEINFO_EQUALITY_INLINE; check __GXX_MERGED_TYPEINFO_NAMES
> > to determine algorithm.
> > * libsupc++/tinfo2.cc (type_info::before): Likewise.
> This seems confused to me. It is possible that I am the one confused.
My claim is that it's actually the existing code that is confused (namely,
it confuses two different and independent things, whether type_info
comparison is inline and which algorithm it uses).
> I would like to see better documentation for these new macros and what
> you are trying to accomplish. Specifically, I'd like to see documentation on
> and how they inter-relate, and what problem you are trying to solve.
> This should be added as comments in the code.
The problem, as stated, is the failure of
FAIL: g++.dg/abi/local1.C execution test
on ARM EABI. The C++ ABI for the ARM Architecture says "These
std::type_info functions should not be inline by default, as doing so
makes the relocatable file platform-specific. A C++ system must provide an
option or default (Q-o-I) to force them out of line.".
So that the .o files are not platform-specific, the implementation must be
So that this testcase works, the algorithm used must test pointer equality
when libstdc++ is built for a target where this algorithm works (meaning
all ARM EABI targets apart from Symbian OS).
There are four possibilities for the combinations of whether the
comparison is inline and which algorithm is used. At present two are
implemented. My patch adds a third as required for ARM EABI. It doesn't
add the fourth (inline strcmp) because I'm not aware of any platforms
How does the following seem as documentation?
// Determine whether typeinfo names for the same type are merged (in which
// case comparison can just compare pointers) or not (in which case
// strings must be compared and g++.dg/abi/local1.C will fail), and
// whether comparison is to be implemented inline or not. By default we
// use inline pointer comparison if weak symbols are available, and
// out-of-line strcmp if not. Out-of-line pointer comparison is used
// where the object files are to be portable to multiple systems, some of
// which may not be able to use pointer comparison, but the particular
// system for which libstdc++ is being built can use pointer comparison;
// in particular for most ARM EABI systems, where the ABI specifies
// out-of-line comparison. Inline strcmp is not currently supported. The
// compiler's target configuration can override the defaults by defining
// __GXX_TYPEINFO_EQUALITY_INLINE to 1 or 0 to indicate whether or not
// comparison is inline, and __GXX_MERGED_TYPEINFO_NAMES to 1 or 0 to
// indicate whether or not pointer comparison can be used.
Joseph S. Myers