Boost C++ Libraries: Ticket #8993: boost_1_54_0 bootstrap broken on m68k-linux due to alignment mistakes https://svn.boost.org/trac10/ticket/8993 en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8993 Trac 1.4.3 Mikael Pettersson <mikpe@…> Wed, 14 Aug 2013 07:24:29 GMT attachment set https://svn.boost.org/trac10/ticket/8993 https://svn.boost.org/trac10/ticket/8993 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_1_54_0-m68k-1.patch</span> </li> </ul> <p> explicitly pad arrays of VAR_EDITs on the stack to a multiple of sizeof(LIST*) </p> Ticket Mikael Pettersson <mikpe@…> Wed, 14 Aug 2013 07:54:00 GMT <link>https://svn.boost.org/trac10/ticket/8993#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8993#comment:1</guid> <description> <p> Originally reported at Debian &lt;<a class="ext-link" href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=719484"><span class="icon">​</span>http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=719484</a>&gt;. </p> <p> Attempting to bootstrap boost_1_54_0 on m68k-linux fails early on with an assertion failure in tools/build/v2/engine/function.c: </p> <p> ../bootstrap/jam0 -f build.jam --toolset=gcc --toolset-root= clean jam0: function.c:233: check_alignment: Assertion `(size_t)s-&gt;data % sizeof( LIST * ) == 0' failed. Aborted </p> <p> With additional debugging added to that file, I observed that the stack went out of alignment in a stack_allocate call from expand_modifiers line 857, which allocated a multiple of sizeof(VAR_EDIT). However, sizeof(VAR_EDIT) is NOT a multiple of sizeof(LIST*) on m68k-linux, so the assertion triggered. </p> <p> The thing to know about m68k on Linux is that it has more relaxed alignment rules than most machines. In this case, even though VAR_EDIT contains some uint32_t-sized fields (pointers and ints) plus 6 plain char fields, its size ends up being k*sizeof(uint32_t) [for the embedded pointer and int fields] + 6, with no additional padding, which isn't a multiple of sizeof(LIST*). </p> <p> Assuming the sizeof(LIST*) alignment assertion actually is needed, the obvious solution is to ensure that (a) the stack end is aligned when initially allocated, and (b) affected allocation sites pad their allocations to a multiple of the alignment requirement (and likewise for the deallocation sites). </p> <p> During a complete build I couldn't find any other issues than the ones already mentioned (inital stack alignment, sizeof(VAR_EDIT)), so this patch only addresses those specific sites. There are other sites that allocate or deallocate data that isn't necessarily a multiple of sizeof(LIST*), but none of those triggered assertion failures during my build, so I'm leaving them alone. </p> </description> <category>Ticket</category> </item> <item> <author>Kohei Takahashi <flast@…></author> <pubDate>Thu, 09 Oct 2014 06:15:38 GMT</pubDate> <title>component changed; owner set https://svn.boost.org/trac10/ticket/8993#comment:2 https://svn.boost.org/trac10/ticket/8993#comment:2 <ul> <li><strong>owner</strong> set to <span class="trac-author">Vladimir Prus</span> </li> <li><strong>component</strong> <span class="trac-field-old">Building Boost</span> → <span class="trac-field-new">build</span> </li> </ul> Ticket Steven Watanabe Sat, 14 Mar 2015 02:19:37 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/8993#comment:3 https://svn.boost.org/trac10/ticket/8993#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I've fixed this by relaxing the alignment constraint to check for the alignment of LIST * instead of its size. </p> Ticket