[LLVMbugs] [Bug 15250] New: regparm(3) function can't be called with PIC on i686

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 12 16:53:58 PST 2013


            Bug ID: 15250
           Summary: regparm(3) function can't be called with PIC on i686
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This testcase .ll file:

; ModuleID = 'b.bc'
target datalayout =
target triple = "i386-unknown-linux-gnu"

define void @test(i32 %a, i32 %b) nounwind {
  tail call void @callee(i32 inreg 0, i32 inreg 0, i32 inreg 0) nounwind
  ret void

declare void @callee(i32 inreg, i32 inreg, i32 inreg)

fails to build:

nlewycky at ducttape:~$ llvm/Debug+Asserts/bin/llc -relocation-model=pic b.ll
LLVM ERROR: ran out of registers during register allocation

but it works without PIC. The input source to cause this from clang is:

  void __attribute((regparm(3))) callee(int, int, int);
  void test(int a, int b) {
    callee(0, 0, 0);

which gcc handles like so:

nlewycky at ducttape:~$ gcc -S -m32 -O2 -fPIC z.i -o -
        .file   "z.i"
        .p2align 4,,15
        .globl  test
        .type   test, @function
        pushl   %ebx
        .cfi_def_cfa_offset 8
        .cfi_offset 3, -8
        xorl    %ecx, %ecx
        call    __i686.get_pc_thunk.bx
        addl    $_GLOBAL_OFFSET_TABLE_, %ebx
        subl    $8, %esp
        .cfi_def_cfa_offset 16
        xorl    %edx, %edx
        xorl    %eax, %eax
        call    callee at PLT
        addl    $8, %esp
        .cfi_def_cfa_offset 8
        popl    %ebx
        .cfi_def_cfa_offset 4
        .cfi_restore 3
        .size   test, .-test
.text.__i686.get_pc_thunk.bx,"axG", at progbits,__i686.get_pc_thunk.bx,comdat
        .globl  __i686.get_pc_thunk.bx
        .hidden __i686.get_pc_thunk.bx
        .type   __i686.get_pc_thunk.bx, @function
        movl    (%esp), %ebx
        .ident  "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
        .section        .note.GNU-stack,"", at progbits

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130213/bd4ad623/attachment.html>

More information about the llvm-bugs mailing list