[libunwind] r276215 - [libunwind] Properly align _Unwind_Exception.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 20 17:06:45 PDT 2016


@Hans This should be merged into 3.9.

Can a code owner give this the thumbs up?

/Eric

On Wed, Jul 20, 2016 at 5:56 PM, Eric Fiselier via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: ericwf
> Date: Wed Jul 20 18:56:42 2016
> New Revision: 276215
>
> URL: http://llvm.org/viewvc/llvm-project?rev=276215&view=rev
> Log:
> [libunwind] Properly align _Unwind_Exception.
>
> Summary: _Unwind_Exception is required to be double word aligned.
> Currently the struct is under aligned.
>
> Reviewers: mclow.lists, compnerd, kledzik, emaste
>
> Subscribers: emaste, cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D22543
>
> Added:
>     libunwind/trunk/test/alignment.pass.cpp
> Modified:
>     libunwind/trunk/include/unwind.h
>
> Modified: libunwind/trunk/include/unwind.h
> URL:
> http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/unwind.h?rev=276215&r1=276214&r2=276215&view=diff
>
> ==============================================================================
> --- libunwind/trunk/include/unwind.h (original)
> +++ libunwind/trunk/include/unwind.h Wed Jul 20 18:56:42 2016
> @@ -122,13 +122,16 @@ struct _Unwind_Exception {
>    uintptr_t private_1; // non-zero means forced unwind
>    uintptr_t private_2; // holds sp that phase1 found for phase2 to use
>  #ifndef __LP64__
> -  // The gcc implementation of _Unwind_Exception used attribute mode on
> the
> -  // above fields which had the side effect of causing this whole struct
> to
> +  // The implementation of _Unwind_Exception uses an attribute mode on the
> +  // above fields which has the side effect of causing this whole struct
> to
>    // round up to 32 bytes in size. To be more explicit, we add pad fields
>    // added for binary compatibility.
>    uint32_t reserved[3];
>  #endif
> -};
> +  // The Itanium ABI requires that _Unwind_Exception objects are
> "double-word
> +  // aligned".  GCC has interpreted this to mean "use the maximum useful
> +  // alignment for the target"; so do we.
> +} __attribute__((__aligned__));
>
>  typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
>      (int version,
>
> Added: libunwind/trunk/test/alignment.pass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/alignment.pass.cpp?rev=276215&view=auto
>
> ==============================================================================
> --- libunwind/trunk/test/alignment.pass.cpp (added)
> +++ libunwind/trunk/test/alignment.pass.cpp Wed Jul 20 18:56:42 2016
> @@ -0,0 +1,21 @@
> +// -*- C++ -*-
>
> +//===----------------------------------------------------------------------===//
> +//
> +//                     The LLVM Compiler Infrastructure
> +//
> +// This file is dual licensed under the MIT and the University of
> Illinois Open
> +// Source Licenses. See LICENSE.TXT for details.
> +//
>
> +//===----------------------------------------------------------------------===//
> +
> +// The Itanium ABI requires that _Unwind_Exception objects are
> "double-word
> +// aligned".
> +
> +#include <unwind.h>
> +
> +struct MaxAligned {} __attribute__((aligned));
> +static_assert(alignof(_Unwind_Exception) == alignof(MaxAligned), "");
> +
> +int main()
> +{
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160720/23a7a350/attachment.html>


More information about the cfe-commits mailing list