<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - 'P' inline assembly operand modifier should obey -fno-plt"
href="https://bugs.llvm.org/show_bug.cgi?id=49525">49525</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>'P' inline assembly operand modifier should obey -fno-plt
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>thiago@kde.org
</td>
</tr>
<tr>
<th>CC</th>
<td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, pengfei.wang@intel.com, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre>Unlike GCC, Clang seems not to print the "@PLT" suffix for the 'P' constraint
in PIC mode:
$ cat test.c
extern void f(void);
void g() { asm("call %P0 # asm" : : "X" (f)); }
int h() { f(); return 0; }
$ clang -fno-pic -S -o - -O2 test.c | grep call
callq f # asm
callq f
$ clang -fPIC -S -o - -O2 test.c | grep call
callq f # asm
callq f@PLT
$ gcc -fPIC -S -o - -O2 test.c | grep call
call f@PLT # asm
call f@PLT
That's not a big deal because the linker will generate the PLT anyway if the
function is defined in a shared library being linked.
But the call violates -fno-plt:
$ clang -fno-pic -S -o - -O2 test.c | grep call
callq f # asm
callq *f@GOTPCREL(%rip)
$ clang -fPIC -S -o - -O2 test.c | grep call
callq f # asm
callq *f@GOTPCREL(%rip)
$ gcc -fPIC -S -o - -O2 test.c | grep call
call f@PLT # asm
call *f@GOTPCREL(%rip)
Equivalent GCC bug report: <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99530">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99530</a></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>