HomePhabricator

[libcxxabi] Insert padding in __cxa_exception struct for compatibility

Authored by steven_wu on Jan 30 2020, 10:02 AM.

Description

[libcxxabi] Insert padding in __cxa_exception struct for compatibility

Summary:
Preserve the old ABI for cxa_exception and cxa_dependent_exception
on 64 bit platforms or ARM_EHABI platforms.

After r276215, libunwind in llvm-project labels _Unwind_Exception to be
double word aligned. That change implictly adds a padding before
unwindHeader field in cxa_exception and cxa_dependent_exception.
Preserve the same negative offsets in those struct by moving the padding
to the beginning of the field.

The assumption here is that if the ABI is not aware of the padding before
unwindHeader and put the referenceCount/primaryException in there, no padding
should exist before unwindHeader.

Reviewers: EricWF, mclow.lists, ldionne, jroelofs, dexonsmith, rjmccall, compnerd, phosek, ahatanak

Reviewed By: rjmccall

Subscribers: hans, smeenai, kristof.beyls, christof, jkorous, ributzka, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D72543

(cherry picked from commit f2a436058fcbc11291e73badb44e243f61046183)