[cxx-abi-dev] Question about guard variable types

Mark Mitchell mark at codesourcery.com
Fri Dec 6 17:22:58 UTC 2002


>> (Note that even though the __cxa_guard functions are extern "C" you
>> can still observe their types; take their addresses.)
>
> But that is not relevant for the ABI, is it?

Well, the ABI has this little API part. :-)  The <cxxabi.h> header
is documented and required.  You can use it in low-level
applications -- one good example would be if you're writing a C++
interpreter that wants to interact correctly with compiled C++
object files.  (This was CenterLine's ObjectCenter product.)

All of the other functions have portable types; why not this one?

> In what way would you have to change g++? I.e. on what system does it
> support a type long long which has not exactly 8 bytes?

Well, the runtime is broken, as Richard Henderson pointed out; we use
"mode((DI))" which needn't be 64 bits.  There's certainly nothing to
keep someone from making a GCC port where "long long" isn't 64 bits;
I don't know whether there already is such a thing in the FSF tree or
not.

> I claim that g++ conforms to the ABI, as both the ABI and g++ are, in
> this very moment.

But if that's true, then it's harmless to make the ABI say "long long"
to match.

The point is that the G++ front end explicitly uses "long long" -- not
"64-bit type" -- when constructing a guard variable.

There are two cases:

1) Those things are always the same, in which case we may as well say
   "long long" in the ABI so that things match up and we have a
   well-defined type for the function, and so that a new GCC port
   doesn't accidentally stray from the ABI, or;

2) Those things are not always the same, in which case something needs
   to change, and G++'s widespread deployment would argue for the ABI
   changing.

-- 
Mark Mitchell                mark at codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com



More information about the cxx-abi-dev mailing list