Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Nov 2012 14:50:00 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Nathan Whitehorn <nwhitehorn@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r242835 - head/contrib/llvm/lib/Target/X86
Message-ID:  <509FAD08.10400@FreeBSD.org>
In-Reply-To: <509F2AA6.9050509@freebsd.org>
References:  <201211091856.qA9IuRxX035169@svn.freebsd.org> <509F2AA6.9050509@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2012-11-11 05:33, Nathan Whitehorn wrote:
> On 11/09/12 12:56, Dimitry Andric wrote:
>> Author: dim
>> Date: Fri Nov  9 18:56:27 2012
>> New Revision: 242835
>> URL: http://svnweb.freebsd.org/changeset/base/242835
>>
>> Log:
>>     Reduce LLVM's default stack alignment for i386 from 16 to 4 bytes, as
>>     the FreeBSD ABI requires.  This is essentially a revert of upstream llvm
>>     commit r126226, and it will be reverted by upstream too.
...
> I'd like to object to this. We have an identical ABI to Linux (and
> Solaris, as far as I know).

Apparently Linux has standardized on 16-byte stack alignment for 32-bit
x86, somewhere in the past.  That is, it seems they were forced to do so
by the gcc maintainers.  Please read:

   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38496

for all the details.


> Splitting this by platform will only
> propagate the stack alignment breakage further

Apparently, that breakage seems to have existed since the beginning.  I
don't think it can be fixed anymore; it is probably better to migrate to
x86_64 anyway, and repeat all the mistakes of the past once again. :-)


> -- what we need is
> LLVM/our C library to handle different alignments.

It seems like we need this for all our 32-bit x86 executables and shared
libraries, not only our system libraries.  At least, that is what I have
been told.


> Please fix this for
> real instead of balkanizing the ABI support in LLVM and introducing
> different ABIs for LLVM and GCC to FreeBSD.

The balkanization was already there, since FreeBSD's ABI for 32-bit x86
executables has always used 4 byte stack alignment.  If anything, Linux
is the cause of the balkanization, since they switched from 4 to 16 byte
alignment somewhere along the road, and purposefully (or accidentally)
lost backwards compatibility.

If anything, we should probably send patches to upstream gcc to make
them aware of FreeBSD's specific stack alignment, if they are using 16
byte stack alignment now.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?509FAD08.10400>