This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Fix demangler in symbol versioning


Carlo Wood <carlo@alinoe.com> writes:

> Documentation of __cxa_demangle:
> 
> // Ambiguities are possible between extern "C" object names and
> // internal built-in type names, e.g. "i" may be either an object
> // named "i" or the built-in "int" type.  Such ambiguities should
> // be resolved to user names over built-in names.  Builtin types
> // are any single lower case character.  Any other single
> // character is not a mangled type so we can treat those the same
> // here.
> 
> In other words, any single character input to c++filt should
> print 'i' if you call __cxa_demangle().

I guess I don't understand that.  By definition, there is an ambiguity
between extern "C" object names and mangled names, because you could
use extern "C" to produce any mangled name at all.  A real mangled
name does start with _Z, which is reserved to the system, so that is
some argument against ambiguity.  But a type-name does not start with
_Z, so literally any type name is ambiguous with an extern "C" object
name.

Is __cxa_demangle simply supposed to make an exception for names which
are a single character long?  Why should we treat "i" differently
from, e.g., "Ki"?

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]