[PATCH] D33030: [libcxxabi] Align unwindHeader on a double-word boundary
Akira Hatanaka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 10 16:39:49 PDT 2017
ahatanak added a comment.
In https://reviews.llvm.org/D33030#751187, @mehdi_amini wrote:
> Something still isn't clear to me: the issue IIUC is not with the `unwindHeader` itself, but with the misaligned thrown object that is allocated right after the __cxa_exception itself. Isn't it?
> Then are you aligning the `unwindHeader` field and by side-effect the size of the __cxa_exception structure becomes aligned and then the thrown object will be as well?
Yes, that's correct.
If field unwindHeader is annotated with the aligned attribute, both the field and struct __cxa_exception are aligned. As a result, the exception object that follows __cxa_exception is aligned too.
If we annotate struct __cxa_exception with the attribute instead of annotating the field, the test case segfaults. It seems that this approach doesn't work because several places in cxa_exception.cpp assume the exception object immediately follows field unwindHeader (there are should be no paddings at the end of __cxa_exception).
More information about the cfe-commits