From owner-freebsd-current@FreeBSD.ORG Sun Nov 4 14:37:03 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 7B3893EB; Sun, 4 Nov 2012 14:37:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kostikbel-1-pt.tunnel.tserv11.ams1.ipv6.he.net [IPv6:2001:470:1f14:13d6::2]) by mx1.freebsd.org (Postfix) with ESMTP id C30CF8FC0C; Sun, 4 Nov 2012 14:37:02 +0000 (UTC) Received: from tom.home (localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qA4EaxXg035931; Sun, 4 Nov 2012 16:36:59 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qA4Eaxax035930; Sun, 4 Nov 2012 16:36:59 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 4 Nov 2012 16:36:59 +0200 From: Konstantin Belousov To: Dimitry Andric Subject: Re: November 5th is Clang-Day Message-ID: <20121104143658.GM73505@kib.kiev.ua> 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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PlDVpzlhHY5RV9ko" Content-Disposition: inline In-Reply-To: <50967BD6.9090806@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=0.2 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: David Chisnall , freebsd-current@freebsd.org, David Naylor , Brooks Davis , Jan Beich 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 14:37:03 -0000 --PlDVpzlhHY5RV9ko Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 04, 2012 at 03:29:42PM +0100, 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) w= inecfg > >> 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. >=20 > 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. No, this is a misunderstanding. We must provide libraries that tolerate the 4-byte aligned stack. Also, to be compatible with broken compilers (both older versions of gcc and some versions of clang) we must provide the libraries which preserve the %esp mod 0x10 across the functions entry/leave points. The crt ensures that the stack is 16-byte aligned on entry to main. >=20 > 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". Right, this is ABI which some binaries follow. There are some other binarie= s, generated by arguably broken compilers, which require 16-byte alignment. The system shall support both. > Index: contrib/llvm/lib/Target/X86/X86Subtarget.cpp > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- contrib/llvm/lib/Target/X86/X86Subtarget.cpp (revision 242480) > +++ contrib/llvm/lib/Target/X86/X86Subtarget.cpp (working copy) > @@ -416,12 +416,12 @@ X86Subtarget::X86Subtarget(const std::string &TT, > assert((!In64BitMode || HasX86_64) && > "64-bit code requested on a subtarget that doesn't support it!"= ); > =20 > - // Stack alignment is 16 bytes on Darwin, FreeBSD, Linux and Solaris (= both > - // 32 and 64 bit) and for all 64-bit targets. > + // Stack alignment is 16 bytes on Darwin, Linux and Solaris (both 32 a= nd 64 > + // bit) and for all 64-bit targets. > if (StackAlignOverride) > - stackAlignment =3D StackAlignOverride; > - else if (isTargetDarwin() || isTargetFreeBSD() || isTargetLinux() || > - isTargetSolaris() || In64BitMode) > + stackAlignment =3D StackAlignOverride; > + else if (isTargetDarwin() || isTargetLinux() || isTargetSolaris() || > + In64BitMode) > stackAlignment =3D 16; > } > =20 --PlDVpzlhHY5RV9ko Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlCWfYoACgkQC3+MBN1Mb4g8SACfXYluKR7qLZ6kHg+aXgYAbc/l GzUAn1u0IfN7lHr+4FS7TpqyXZTq8x5O =crOO -----END PGP SIGNATURE----- --PlDVpzlhHY5RV9ko--