[LLVMbugs] [Bug 5723] New: TLS Acces in pic Leaf Causes Stack Corruption

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Dec 8 11:53:53 PST 2009


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

           Summary: TLS Acces in pic Leaf Causes Stack Corruption
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: greened at obbligato.org
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=3926)
 --> (http://llvm.org/bugs/attachment.cgi?id=3926)
Dynamic Library Source

When compiling a leaf routine in pic mode that has a thread-local storage
access, LLVM fails to allocate stack space for the call to __get_tls_addr.

llc generates the following for the attached library code (function "leaf"):

.L_Z4leafv_label.Llabel2:
.LBB_Z4leafv_1: # @CFE_debug_label_0

        .byte   0x66; leaq      ptr at TLSGD(%rip), %rdi; .word    0x6666; rex64
        call    __tls_get_addr at PLT
        movq    (%rax), %rax
        movq    %rax, -8(%rsp)
.LBB_Z4leafv_2: # @CFE_debug_label_2

        .byte   0x66; leaq      link_ptr at TLSGD(%rip), %rdi; .word       0x6666;
rex64
        call    __tls_get_addr at PLT

The second call to __tls_get_addr clobbers the spilled register.

The problem is the llc thinks "leaf" is a leaf function when in fact it's not,
due to the late-generated call.


-- 
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