Exceptions in ARM
Timo Sintonen
t.sintonen at luukku.com
Sun Jan 5 00:26:16 PST 2014
On Thursday, 2 January 2014 at 06:54:18 UTC, Timo Sintonen wrote:
> I have fond one thing that confuses me. I have defined
> ARM_EABI_UNWINDER but gcc/deh.d has checks for
> GNU_ARM_EABI_Unwinder. Is this what I should have? When using
> this I get an error in line 116: static assert ( 8 == 4 ) is
> false.
I think that this code in gcc/deh.d line 105 may not get it right
// To place 'obj' behing unwindHeader.
enum UNWIND_PAD = (Phase1Info.sizeof + Object.sizeof)
% _Unwind_Exception.alignof;
static if (UNWIND_PAD > 0)
byte[UNWIND_PAD] _pad;
Object obj;
// The exception object must be directly behind unwindHeader.
// (See build_exception_object.)
static assert(unwindHeader.offsetof - obj.offsetof ==
obj.sizeof);
// The generic exception header
_Unwind_Exception unwindHeader;
Its purpose seems to add padding so that obj is aligned at the
end of align block just before unwindHeader.
Fitst, if I uderstand correct, the amount to pad should be align
- modulo, not modulo. The current code happens to work anyway if
align is 8 and modulo is 0 or 4 which is usually the case.
Second, When I define GNU_ARM_EABI_Unwinder, the assertion fails.
Nothing changes in calculation of UNWIND_PAD but the alignment is
not correct and the assert fails. With this define the whole size
of struct if 96 bytes and 40 bytes without. Something is aligned
differently such a way that this calculation cannot find it. I
can not print offsetof with pragma msg so I do not know what
happens.
More information about the D.gnu
mailing list