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
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to