From owner-freebsd-hackers@FreeBSD.ORG Thu Jan 13 21:57:20 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02CC0106564A for ; Thu, 13 Jan 2011 21:57:20 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo-p00-ob.rzone.de (mo-p00-ob.rzone.de [81.169.146.161]) by mx1.freebsd.org (Postfix) with ESMTP id 624508FC14 for ; Thu, 13 Jan 2011 21:57:19 +0000 (UTC) X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQv0cW+St/nW/YPAwtil3kVlq3myX X-RZG-CLASS-ID: mo00 Received: from britannica.bec.de (dslb-088-074-063-088.pools.arcor-ip.net [88.74.63.88]) by post.strato.de (jimi mo49) (RZmta 24.9) with (DHE-RSA-AES128-SHA encrypted) ESMTP id Y05860n0DKCHm3 ; Thu, 13 Jan 2011 22:57:16 +0100 (MET) Received: by britannica.bec.de (sSMTP sendmail emulation); Thu, 13 Jan 2011 22:57:15 +0100 Date: Thu, 13 Jan 2011 22:57:15 +0100 From: Joerg Sonnenberger To: freebsd-hackers@freebsd.org, FreeBSD Hackers Message-ID: <20110113215713.GB5278@britannica.bec.de> Mail-Followup-To: freebsd-hackers@freebsd.org, FreeBSD Hackers References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Cc: Subject: Re: What does the FreeBSD/i386 ABI say about stack alignment? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jan 2011 21:57:20 -0000 On Thu, Jan 13, 2011 at 12:19:00PM -0500, Ryan Stone wrote: > I've been trying to get an application compiled with gcc 4.5.1 running > on FreeBSD 8.1, but it's been crashing during startup with a SIGBUS. > It turns out that the problem is that gcc is issuing SSE > instructions(in my case, a movdqa) that assume that the stack will be > aligned to a 16-byte boundary. It seems that Linux/i386 guarantees > this, and I worry that gcc has extended this assumption to all i386 > architectures. I'm assuming that FreeBSD doesn't make any such > promises based on the fact that I'm getting crashes. FreeBSD follows the original SYSV ABI. Linux at some point silently decided to redefine the ABI to fit their mindset. I think you want to use a combination of -mpreferred-stack-boundary=4 and -mincoming-stack-boundary=2. Joerg