[LLVMbugs] [Bug 3801] New: non- PIC-aware assembler code in X86 jit

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Mar 13 14:34:33 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=3801

           Summary: non- PIC-aware assembler code in X86 jit
           Product: libraries
           Version: trunk
          Platform: PC
               URL: http://www.nabble.com/Bug-in-X86CompilationCallback_SSE-
                    to22445736.html
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: czoccolo at gmail.com
                CC: llvmbugs at cs.uiuc.edu


X86CompilationCallback_SSE wrapper for
X86CompilationCallback2 (and possibly others) is not setting up properly for
the PIC invocation.

Dump of assembler code for function X86CompilationCallback_SSE:
0xb74544f8 <X86CompilationCallback_SSE+0>:      push   %ebp
0xb74544f9 <X86CompilationCallback_SSE+1>:      mov    %esp,%ebp
0xb74544fb <X86CompilationCallback_SSE+3>:      push   %eax
0xb74544fc <X86CompilationCallback_SSE+4>:      push   %edx
0xb74544fd <X86CompilationCallback_SSE+5>:      push   %ecx
0xb74544fe <X86CompilationCallback_SSE+6>:      and    $0xfffffff0,%esp
0xb7454501 <X86CompilationCallback_SSE+9>:      sub    $0x40,%esp
0xb7454504 <X86CompilationCallback_SSE+12>:     movaps %xmm0,(%esp)
0xb7454508 <X86CompilationCallback_SSE+16>:     movaps %xmm1,0x10(%esp)
0xb745450d <X86CompilationCallback_SSE+21>:     movaps %xmm2,0x20(%esp)
0xb7454512 <X86CompilationCallback_SSE+26>:     movaps %xmm3,0x30(%esp)
0xb7454517 <X86CompilationCallback_SSE+31>:     sub    $0x10,%esp
0xb745451a <X86CompilationCallback_SSE+34>:     mov    0x4(%ebp),%eax
0xb745451d <X86CompilationCallback_SSE+37>:     mov    %eax,0x4(%esp)
0xb7454521 <X86CompilationCallback_SSE+41>:     mov    %ebp,(%esp)
0xb7454524 <X86CompilationCallback_SSE+44>:     call   0xb729e348
<X86CompilationCallback2 at plt>
0xb7454529 <X86CompilationCallback_SSE+49>:     add    $0x10,%esp
0xb745452c <X86CompilationCallback_SSE+52>:     movaps 0x30(%esp),%xmm3
0xb7454531 <X86CompilationCallback_SSE+57>:     movaps 0x20(%esp),%xmm2
0xb7454536 <X86CompilationCallback_SSE+62>:     movaps 0x10(%esp),%xmm1
0xb745453b <X86CompilationCallback_SSE+67>:     movaps (%esp),%xmm0
0xb745453f <X86CompilationCallback_SSE+71>:     mov    %ebp,%esp
0xb7454541 <X86CompilationCallback_SSE+73>:     sub    $0xc,%esp
0xb7454544 <X86CompilationCallback_SSE+76>:     pop    %ecx
0xb7454545 <X86CompilationCallback_SSE+77>:     pop    %edx
0xb7454546 <X86CompilationCallback_SSE+78>:     pop    %eax
0xb7454547 <X86CompilationCallback_SSE+79>:     pop    %ebp
0xb7454548 <X86CompilationCallback_SSE+80>:     ret

This bug is uncovered only when the pointer to the compilation
callback is handed to a function residing in a different .so library,
and called from there (e.g. if called from python's ctypes ffi).

A possible way to patch it is to rely on compiler to generate the correct code
for the call, using inline assembler just to save/restore registers.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list