<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - regparm(3) function can't be called with PIC on i686"
href="http://llvm.org/bugs/show_bug.cgi?id=15250">15250</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>regparm(3) function can't be called with PIC on i686
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nlewycky@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>This testcase .ll file:
; ModuleID = 'b.bc'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
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@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@ducttape:~$ gcc -S -m32 -O2 -fPIC z.i -o -
.file "z.i"
.text
.p2align 4,,15
.globl test
.type test, @function
test:
.LFB0:
.cfi_startproc
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@PLT
addl $8, %esp
.cfi_def_cfa_offset 8
popl %ebx
.cfi_def_cfa_offset 4
.cfi_restore 3
ret
.cfi_endproc
.LFE0:
.size test, .-test
.section
.text.__i686.get_pc_thunk.bx,"axG",@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
__i686.get_pc_thunk.bx:
.LFB1:
.cfi_startproc
movl (%esp), %ebx
ret
.cfi_endproc
.LFE1:
.ident "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
.section .note.GNU-stack,"",@progbits</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>