This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR target/40838: gcc shouldn't assume that the stack is aligned


On Thu, Oct 15, 2009 at 12:43 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Oct 15, 2009 at 12:32:12PM -0700, H.J. Lu wrote:
>> > Then we should do realignment the other way around: instead of using
>> > -mstackrealing for all the code (including where it has no effect), let's
>> > use -mstackrealign to activate realignment functionality that is introduced
>> > by your patch.
>>
>> That defeats the whole purpose of my patch, which automatically
>> realigns the stack when there is a hard alignment requirement. If it
>> isn't turned on by default, it is not very useful.
>>
>> > IOW, lightweight -mstackrealign, firing up only when there is the
>> > possibility of unaligned access in the code it precedes.
>> >
>>
>> That is what my patch does, but turned it on by default.
>
> I agree with Uros, I have nothing against a lightweight -mstackrealign,
> but forcing this upon everybody just because a few people insist on compiling
> code with -mpreferred-stack-boundary=2 is IMHO a very bad idea and I object
> against it. ?-mpreferred-stack-boundary=2 is fine for the kernel where you
> basically define your own ABI, like many other ABI changing options, and for
> people who know what they are doing and bear the consequences (e.g. that
> they need to -mstackrealign when calling outside code), but we shouldn't
> penalize because of that rare option all the code by default. ?At least not
> on Linux.

Gcc 3.4 and older may align stack to 4byte. Do we declare that
mixing object files compiled with different versions of gcc is
unsupported on Linux/i386?

As for penalty, it only happens at -O3 and its performance impact is
minimum.  We can provide an option to turn it off. It is a correctness
issue.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]