[LLVMdev] How to force stack alignment for particular target triple in JIT?

Yuri yuri at rawbw.com
Mon Feb 21 01:32:31 PST 2011


On 02/20/2011 23:50, Duncan Sands wrote:
> Hi Yuri,
>
>    
>> I get SEGV in gcc-compiled procedure in Solaris10-i386. This procedure
>> is called from llvm JIT code.
>> Exact instruction that crashes is this: movdqa %xmm0, 0x10(%esp)
>> %esp is 8-aligned, and by definition of movdqa it expects 16-aligned stack.
>> This leads me to believe that llvm uses wrong ABI when calling external
>> procedures and doesn't align stack properly.
>>
>> llvm module executing in JIT has this target triple: i386-pc-solaris2.10
>>
>> Isn't target triple supposed to set correct ABI including stack
>> alignment? How to set the correct alignment for this triple?
>>      
> it is, however as far as I can see nowhere in LLVM makes any important
> decisions based on the triple containing "solaris".  I suggest you try
> to work out how the stack alignment is set for other operating systems
> and send in a patch fixing the solaris case.
>
> Ciao, Duncan

The attached patch fixes the problem for me. Though further changes will 
likely be needed for full Solaris ABI compatibility.

Yuri
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110221/ef99d6c5/attachment.txt>


More information about the llvm-dev mailing list