Commit b4a997c8 authored by Logan Chien's avatar Logan Chien
Browse files

Fix x86 stack realignment.

Due to the stack mis-alignment, it is possible for
the test-stlport to raise SEGV while unwinding the
stack.  This CL should fix the problem.

This CL is backported from upstream r160248, and
fixes PR11468.

------------------------------------------------------------
commit 99a92f26
Author: Alexey Samsonov <samsonov@google.com>
Date:   Mon Jul 16 06:54:09 2012 +0000

    This CL changes the function prologue and epilogue
    emitted on X86 when stack It is intended to fix PR11468.

    Old prologue and epilogue looked like this:
    push %rbp
    mov %rsp, %rbp
    and $alignment, %rsp
    push %r14
    push %r15
    ...
    pop %r15
    pop %r14
    mov %rbp, %rsp
    pop %rbp

    The problem was to reference the locations of
    callee-saved registers in exce locations of callee-saved
    had to be re-calculated regarding the stack alignm take
    some effort to implement this in LLVM, as currently
    MachineLocation can "Register + Offset". Funciton
    prologue and epilogue are now changed to:

    push %rbp
    mov %rsp, %rbp
    push %14
    push %15
    and $alignment, %rsp
    ...
    lea -$size_of_saved_registers(%rbp), %rsp
    pop %r15
    pop %r14
    pop %rbp

    Reviewed by Chad Rosier.

    git-svn-id:
    https://llvm.org/svn/llvm-project/llvm/trunk@160248
    91177308-0d3
------------------------------------------------------------

Change-Id: I7ff338229dd6c3f4d14c2f0245287475214acb41
parent 9e9a074a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment