Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

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?

like image 661
Puppy Avatar asked Jun 09 '14 11:06

Puppy


1 Answers

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.

like image 158
Lightness Races in Orbit Avatar answered Nov 11 '22 01:11

Lightness Races in Orbit