[Lldb-commits] [PATCH] D34750: [UnwindAssembly/x86] Add support for "lea imm(%ebp), %esp" pattern

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 29 03:12:49 PDT 2017


On 28 June 2017 at 15:16, Scott Smith <scott.smith at purestorage.com> wrote:
> x86_64 stacks are supposed to be naturally 16-byte aligned.  Maybe try a
> 32-byte AVX instruction and see if the compiler aligns to a 32-byte
> boundary?
>

I was able to generate the "andq $-16, %rsp" part of the pattern. The
trick was that the compiler then chose to restore it with a simple
"movq %rbp, %rsp" instead of the more fancy lea instruction.

I am guessing this has something to do with the %ebx register being
spilled in order to store the global offset table pointer. Normally,
all other registers were spilled after the stack was realigned, but
for some reason this one was spilled before the realigning took place.
x86_64 PIC code is simpler and there is no need for this spill, so
that's why a "mov" was sufficient.


More information about the lldb-commits mailing list