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).


https://reviews.llvm.org/D33030



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to