<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 - Unable to use __builtin_cpu_supports with compiler-rt"
href="https://bugs.llvm.org/show_bug.cgi?id=41230">41230</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Unable to use __builtin_cpu_supports with compiler-rt
</td>
</tr>
<tr>
<th>Product</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Version</th>
<td>8.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>compiler-rt
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>chris@detrino.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>When using the toolchain provided by
<a href="http://releases.llvm.org/7.0.1/clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz">http://releases.llvm.org/7.0.1/clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz</a>
Consider the following file test.cc:
<span class="quote">>bool Foo() {
> return __builtin_cpu_supports("avx2");
>}</span >
The following compiles sucessfully:
<span class="quote">>$ bin/clang++ -shared -o test.so test.cc -fPIC</span >
And the following leads to an error:
<span class="quote">>$ bin/clang++ -shared -o test.so test.cc -fPIC -rtlib=compiler-rt
>/usr/bin/ld: /tmp/test-46520d.o: relocation R_X86_64_PC32 against symbol `__cpu_model' can not be used when making a shared object; recompile with -fPIC
>/usr/bin/ld: final link failed: Bad value
>clang-8: error: linker command failed with exit code 1 (use -v to see invocation)</span ></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>