From owner-freebsd-hackers@FreeBSD.ORG Thu Jan 13 22:00:58 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 3B0A1106564A for ; Thu, 13 Jan 2011 22:00:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id A8F3D8FC18 for ; Thu, 13 Jan 2011 22:00:56 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p0DM0r4D072460 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 14 Jan 2011 00:00:53 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p0DM0qnF083078 for ; Fri, 14 Jan 2011 00:00:52 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p0DM0qxg083077 for hackers@freebsd.org; Fri, 14 Jan 2011 00:00:52 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 14 Jan 2011 00:00:52 +0200 From: Kostik Belousov To: FreeBSD Hackers Message-ID: <20110113220052.GL2518@deviant.kiev.zoral.com.ua> References: <20110113215713.GB5278@britannica.bec.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VSJGZE3ajDCqFLUt" Content-Disposition: inline In-Reply-To: <20110113215713.GB5278@britannica.bec.de> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua 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 22:00:58 -0000 --VSJGZE3ajDCqFLUt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > 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=3D4 and > -mincoming-stack-boundary=3D2. I think gcc [*] requires 16-byte alignment. Also, it follows the policy of not changing the stack alignment through the calls. What you see is a plain bug in FreeBSD, when a developer (me) tried to adopt to newer ABI but failed. * Might be not gcc in our tree, but definitely newer gcc releases. --VSJGZE3ajDCqFLUt Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk0vdhQACgkQC3+MBN1Mb4j0SACgtUvjulBMeaNmpyWyg3Hv2UGP R7sAmwW4wOyAnlt9+EYIjXw71TR49W45 =W2jt -----END PGP SIGNATURE----- --VSJGZE3ajDCqFLUt--