<div dir="ltr">@Hans This should be merged into 3.9.<div><br></div><div>Can a code owner give this the thumbs up?</div><div><br></div><div>/Eric</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 20, 2016 at 5:56 PM, Eric Fiselier via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ericwf<br>
Date: Wed Jul 20 18:56:42 2016<br>
New Revision: 276215<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=276215&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=276215&view=rev</a><br>
Log:<br>
[libunwind] Properly align _Unwind_Exception.<br>
<br>
Summary: _Unwind_Exception is required to be double word aligned. Currently the struct is under aligned.<br>
<br>
Reviewers: mclow.lists, compnerd, kledzik, emaste<br>
<br>
Subscribers: emaste, cfe-commits<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D22543" rel="noreferrer" target="_blank">https://reviews.llvm.org/D22543</a><br>
<br>
Added:<br>
    libunwind/trunk/test/alignment.pass.cpp<br>
Modified:<br>
    libunwind/trunk/include/unwind.h<br>
<br>
Modified: libunwind/trunk/include/unwind.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/unwind.h?rev=276215&r1=276214&r2=276215&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/unwind.h?rev=276215&r1=276214&r2=276215&view=diff</a><br>
==============================================================================<br>
--- libunwind/trunk/include/unwind.h (original)<br>
+++ libunwind/trunk/include/unwind.h Wed Jul 20 18:56:42 2016<br>
@@ -122,13 +122,16 @@ struct _Unwind_Exception {<br>
   uintptr_t private_1; // non-zero means forced unwind<br>
   uintptr_t private_2; // holds sp that phase1 found for phase2 to use<br>
 #ifndef __LP64__<br>
-  // The gcc implementation of _Unwind_Exception used attribute mode on the<br>
-  // above fields which had the side effect of causing this whole struct to<br>
+  // The implementation of _Unwind_Exception uses an attribute mode on the<br>
+  // above fields which has the side effect of causing this whole struct to<br>
   // round up to 32 bytes in size. To be more explicit, we add pad fields<br>
   // added for binary compatibility.<br>
   uint32_t reserved[3];<br>
 #endif<br>
-};<br>
+  // The Itanium ABI requires that _Unwind_Exception objects are "double-word<br>
+  // aligned".  GCC has interpreted this to mean "use the maximum useful<br>
+  // alignment for the target"; so do we.<br>
+} __attribute__((__aligned__));<br>
<br>
 typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)<br>
     (int version,<br>
<br>
Added: libunwind/trunk/test/alignment.pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/alignment.pass.cpp?rev=276215&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/alignment.pass.cpp?rev=276215&view=auto</a><br>
==============================================================================<br>
--- libunwind/trunk/test/alignment.pass.cpp (added)<br>
+++ libunwind/trunk/test/alignment.pass.cpp Wed Jul 20 18:56:42 2016<br>
@@ -0,0 +1,21 @@<br>
+// -*- C++ -*-<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// The Itanium ABI requires that _Unwind_Exception objects are "double-word<br>
+// aligned".<br>
+<br>
+#include <unwind.h><br>
+<br>
+struct MaxAligned {} __attribute__((aligned));<br>
+static_assert(alignof(_Unwind_Exception) == alignof(MaxAligned), "");<br>
+<br>
+int main()<br>
+{<br>
+}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>