Puppy
Puppy

Reputation: 146998

Are there any alignment guarantees for exception memory allocated through the Itanium ABI?

The Itanium ABI states that memory for an exception is obtained by calling __cxa_allocate_exception(size). What is the alignment guarantee of the returned memory?

Upvotes: 7

Views: 108

Answers (1)

Lightness Races in Orbit
Lightness Races in Orbit

Reputation: 385325

Section 1.2 in chapter 4 says:

The unwind interface uses a pointer to an exception header object as its representation of an exception being thrown. In general, the full representation of an exception object is language- and implementation-specific, but it will be prefixed by a header understood by the unwind interface, defined as follows:

followed by a definition of struct _Unwind_Exception, followed by:

An _Unwind_Exception object must be double-word aligned.

As this is a prefix to the exception object at large, the entire block of memory must be double-word aligned.

Arguably this text does not prohibit arbitrary padding found before the _Unwind_Exception, but if this is taken to be the case then the answer is that there is no alignment guarantee whatsoever; I choose to interpret this as a minor wording defect instead.

Upvotes: 6

Related Questions