From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 14 07:57:54 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAB07106566C; Fri, 14 Jan 2011 07:57:54 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo-p00-ob.rzone.de (mo-p00-ob.rzone.de [81.169.146.162]) by mx1.freebsd.org (Postfix) with ESMTP id 5A1618FC1C; Fri, 14 Jan 2011 07:57:53 +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 mo35) (RZmta 24.9) with (DHE-RSA-AES128-SHA encrypted) ESMTP id a0531dn0E5YeW2 ; Fri, 14 Jan 2011 08:57:51 +0100 (MET) Received: by britannica.bec.de (sSMTP sendmail emulation); Fri, 14 Jan 2011 08:57:51 +0100 Date: Fri, 14 Jan 2011 08:57:51 +0100 From: Joerg Sonnenberger To: freebsd-hackers@freebsd.org, FreeBSD Hackers Message-ID: <20110114075751.GA9961@britannica.bec.de> Mail-Followup-To: freebsd-hackers@freebsd.org, FreeBSD Hackers References: <20110113215713.GB5278@britannica.bec.de> <20110113220052.GL2518@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110113220052.GL2518@deviant.kiev.zoral.com.ua> 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: Fri, 14 Jan 2011 07:57:55 -0000 On Fri, Jan 14, 2011 at 12:00:52AM +0200, Kostik Belousov wrote: > On Thu, Jan 13, 2011 at 10:57:15PM +0100, Joerg Sonnenberger wrote: > > 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. > > I think gcc [*] requires 16-byte alignment. Also, it follows the > policy of not changing the stack alignment through the calls. Well, yes. GCC decided to force the Linux ABI change down our throat. It's not an issue if you decide to rebuild all your libraries every week, but it is a major PITA if you deal with old binary-only releases. Joerg