All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>,
	Jan Hubicka <jh@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: stack alignment on i386
Date: Thu, 17 May 2007 15:37:57 +0200	[thread overview]
Message-ID: <200705171537.57893.ak@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0705160648320.18296@artax.karlin.mff.cuni.cz>

On Wednesday 16 May 2007 07:24, Mikulas Patocka wrote:
> >    [PATCH] x86: Drop cc-options call for all options supported in gcc
> >3.2+
> >
> >    The kernel only supports gcc 3.2+ now so it doesn't make sense
> >    anymore to explicitely check for options this compiler version
> >    already has.
> >
> >    This actually fixes a bug. The -mprefered-stack-boundary check
> >    never worked because gcc rightly complains
> >
> >      CC      arch/i386/kernel/asm-offsets.s
> >    cc1: -mpreferred-stack-boundary=2 is not between 4 and 12
>
> Hi
>
> Your patch for stack alignment on i386 is wrong. -mprefered-stack-boundary
> is log2 of the stack alignment (read gcc man page). 

Ah just using the real number would have been too easy I guess.

> On AMD64 16-byte 
> alignment is enforced because of SSE, on i386 minimal alignment is 4
> bytes.

Ok fixed now

> See the code in gcc that triggered your error:
>        i = atoi (ix86_preferred_stack_boundary_string);
>        if (i < (TARGET_64BIT ? 4 : 2) || i > 12)
>          error ("-mpreferred-stack-boundary=%d is not between %d and 12",
> i,
>                 TARGET_64BIT ? 4 : 2);
>        else
>          ix86_preferred_stack_boundary = (1 << i) * BITS_PER_UNIT;
>
> You are actually dealing with gcc bug, not Linux bug --- when gcc is
> compiled with AMD64 support it enforces 16-byte alignment even in 32-bit
> mode.

Honza? 

> Rather let it be as it was, adding -mpreferred-stack-boundary=4 doesn't
> make sense, because it is default.

Hmm, maybe that was different on older gcc versions. There must have been
some reason this option was originally added.

Linus can you please just revert  c8fdd247255a3a027cd9f66dcf93e6847d1d2f85

-Andi


      reply	other threads:[~2007-05-17 13:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-16  5:24 stack alignment on i386 Mikulas Patocka
2007-05-17 13:37 ` Andi Kleen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200705171537.57893.ak@suse.de \
    --to=ak@suse.de \
    --cc=jh@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikulas@artax.karlin.mff.cuni.cz \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.