<html>
<head>
<base href="https://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 --- - llvm uses PLT to call locally defined function for PIE"
href="https://llvm.org/bugs/show_bug.cgi?id=24970">24970</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llvm uses PLT to call locally defined function for PIE
</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>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</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>hjl.tools@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, michael.m.kuperstein@intel.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>On x86 and x86-64, llvm uses PLT to call locally defined function for PIE.
But PLT shouldn't be needed:
[hjl@gnu-32 bin]$ cat z.c
int glob;
int foo(int i)
{
return glob;
}
void
bar ()
{
glob = foo(5);
}
[hjl@gnu-32 bin]$ ./clang -S -O1 -fPIE -m64 z.c
[hjl@gnu-32 bin]$ cat z.s
.text
.file "z.c"
.globl foo
.align 16, 0x90
.type foo,@function
foo: # @foo
.cfi_startproc
# BB#0:
movq glob@GOTPCREL(%rip), %rax
movl (%rax), %eax
retq
.Lfunc_end0:
.size foo, .Lfunc_end0-foo
.cfi_endproc
.globl bar
.align 16, 0x90
.type bar,@function
bar: # @bar
.cfi_startproc
# BB#0:
pushq %rax
.Ltmp0:
.cfi_def_cfa_offset 16
callq foo@PLT
movq glob@GOTPCREL(%rip), %rcx
movl %eax, (%rcx)
popq %rax
retq
.Lfunc_end1:
.size bar, .Lfunc_end1-bar
.cfi_endproc
.type glob,@object # @glob
.comm glob,4,4
[hjl@gnu-32 bin]$ gcc -S -O1 -fPIE -m64 z.c
[hjl@gnu-32 bin]$ cat z.s
.file "z.c"
.text
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
movl glob(%rip), %eax
ret
.cfi_endproc
.LFE0:
.size foo, .-foo
.globl bar
.type bar, @function
bar:
.LFB1:
.cfi_startproc
rep ret
.cfi_endproc
.LFE1:
.size bar, .-bar
.comm glob,4,4
[hjl@gnu-32 bin]$</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>