Re: PATCH: Also check for `movl %esp, %ebp' for x32

H.J. Lu
2012-05-06T20:42:55Z

On Sun, May 6, 2012 at 1:31 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> Date: Thu, 3 May 2012 23:50:03 +0200 (CEST)
>> From: Mark Kettenis <mark.kettenis@xs4all.nl>
>>
>> > >> I did have a look at it, but still have some questions.
>> > >>
>> > >>> Hi,
>> > >>>
>> > >>> X32 may use `movl %esp, %ebp' in prologue.  This patch checks it for
>> > >>> x32.  Tested on Linux/x86-64.  OK for trunk?
>> > >>
>> > >> But the prologues generated by various compilers are expected to be
>> > >> otherwise the same for both the x32 ABI and the normal 64-bit ABI?  I
>> > >> guess x32 has to use "pushq %rbp" as "pushl %ebp" isn't available.
>> > >> And I guess you want to keep the stack 16-byte aligned anyway.  I
>> > >> suppose that "movq %rsp, %rbp" is still ok for x32, but "movl %esp,
>> > >> %ebp" can be encoded in less bytes, so it might be a bit more
>> > >> efficient for x32.
>> > >
>> > > That is correct.
>> >
>> > Is my patch OK to install?
>>
>> Sorry, no.  I'm really unhappy with that multi-line if clause.  It
>> really is hard to parse.  I'm trying to come up with a suggestion to
>> make this better, but so far haven't succeeded.
>
> OK, below is what I'd prefer to check in.  No regressions on
> OpenBSD/amd64 (which will only ever support the "real" LP64 ABI).
> H.J. can you check that this indeed does the right thing for X32?
>
>
> 2012-05-06  Mark Kettenis  <kettenis@gnu.org>
>            H.J. Lu  <hongjiu.lu@intel.com>
>
>        * amd64-tdep.c (amd64_analyze_prologue): Additionally check for
>        `movl %esp, %ebp' for the X32 ABI.
>

It works fine for x32.

Thanks.

--
H.J.