From owner-freebsd-current@FreeBSD.ORG Sun Nov 4 15:42:08 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C7DF51BF for ; Sun, 4 Nov 2012 15:42:08 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from adsum.doit.wisc.edu (adsum.doit.wisc.edu [144.92.197.210]) by mx1.freebsd.org (Postfix) with ESMTP id 91EA98FC16 for ; Sun, 4 Nov 2012 15:42:08 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth1.wiscmail.wisc.edu by smtpauth1.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0MCY00D00WU16Q00@smtpauth1.wiscmail.wisc.edu> for freebsd-current@freebsd.org; Sun, 04 Nov 2012 08:42:01 -0600 (CST) Received: from comporellon.tachypleus.net (adsl-71-150-249-157.dsl.mdsnwi.sbcglobal.net [71.150.249.157]) by smtpauth1.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0MCY00997WU08610@smtpauth1.wiscmail.wisc.edu> for freebsd-current@freebsd.org; Sun, 04 Nov 2012 08:42:01 -0600 (CST) Date: Sun, 04 Nov 2012 08:42:00 -0600 From: Nathan Whitehorn Subject: Re: November 5th is Clang-Day In-reply-to: <50967BD6.9090806@FreeBSD.org> To: freebsd-current@freebsd.org Message-id: <50967EB8.50308@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=71.150.249.157 X-Spam-PmxInfo: Server=avs-13, Version=5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.11.4.143317, SenderIP=71.150.249.157 References: <20121102032945.GF65074@lor.one-eyed-alien.net> <201211030948.43530.naylor.b.david@gmail.com> <1TUlad-0008bB-OF@internal.tormail.org> <201211041442.16620.naylor.b.david@gmail.com> <20121104131830.GL73505@kib.kiev.ua> <50967BD6.9090806@FreeBSD.org> User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:16.0) Gecko/20121103 Thunderbird/16.0.2 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Nov 2012 15:42:08 -0000 On 11/04/12 08:29, Dimitry Andric wrote: > On 2012-11-04 14:18, Konstantin Belousov wrote: >> On Sun, Nov 04, 2012 at 02:42:13PM +0200, David Naylor wrote: > ... >>> I tried building (using gcc) wine with your patch and now (at least) >>> winecfg >>> and regedit work with a clang built lib32. I'll email Gerald (wine's >>> maintainer) about including your patch in wine. >> >> The wine is the wrong place to fix. If system libraries suddenly started >> requiring 16-byte stack alignment on i386, it is unacceptable breakage >> of the ABI. > > So we really must use 4 byte stack alignment on i386 by default? I have > attached a diff to llvm for this, but I would like to verify that it is > really correct. Apparently Darwin, Linux and Solaris all use 16 byte > alignment. > > The Sys V ABI seems to say only: "The stack is word aligned. Although > the architecture does not require any alignment of the stack, software > convention and the operating system requires that the stack be aligned > on a word boundary". This is an ugly business. The stack is really 4 bytes aligned on Linux and Solaris too, but GCC decided to unilaterally change the ABI a few years ago (also on FreeBSD). You can find a chunk of the sordid story of this in a number of GCC bugs marked WONTFIX (e.g. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38496). To pacify the people who were yelling about it, they added some __attribute__(()) foo and compiler flags to change what it uses for specific programs and add magic to realign the stack at boundaries. So much water has passed under the bridge at this point as to reach flood stage, so I think the correct solution here is to add the same __attribute__(()) and flags to clang rather than changing the default alignment back to 4. Changing it only on FreeBSD is especially wrong. -Nathan