<html>
<head>
<base href="http://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 - When using C-bindings, on x86_64 ELF, fails to generate the correct instruction for external call"
href="http://bugs.llvm.org/show_bug.cgi?id=32628">32628</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>When using C-bindings, on x86_64 ELF, fails to generate the correct instruction for external call
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>4.0
</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>OrcJIT
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vlad@cloudflare.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=18271" name="attach_18271" title="Code to reproduce the problem">attachment 18271</a> <a href="attachment.cgi?id=18271&action=edit" title="Code to reproduce the problem">[details]</a></span>
Code to reproduce the problem
Debian 8, using llvm 4.0, as well as the trunk, when running the attached code
I get a segfault.
It looks like the generated call is of the near, ip-relative type, and when the
symbol is resolved, the offset is incorrect, as it can't fit into 32-bit
allowed for that type of instruction.
$ clang -g min.c `llvm-config --cflags --ldflags --system-libs --libs core
orcjit native` -rdynamic -lstdc++ -o min
$ gdb min
$ (gdb) run
$ Program received signal SIGSEGV, Segmentation fault.
$ 0x00007ffff7ff0001 in ?? ()
$ (gdb) x/i 0x00007ffff7ff0001
$ => 0x7ffff7ff0001: callq 0x800000edbd50</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>