<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 --- - __builtin_cpu_supports("sse3") compiles, but fails when linking."
href="https://llvm.org/bugs/show_bug.cgi?id=25510">25510</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>__builtin_cpu_supports("sse3") compiles, but fails when linking.
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>pope@shifteleven.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>I am compiling on OSX 10.11 with clang-3.7 from macports. Here's some sample
code to demonstrate the problem:
#include <stdio.h>
#include <stdlib.h>
int main() {
#if(__has_builtin(__builtin_cpu_supports)) && defined(__x86_64__)
printf("__builtin_cpu_supports: %d\n", __builtin_cpu_supports("sse3"));
#else
printf("__builtin_cpu_cupports not available\n");
#endif
return EXIT_SUCCESS;
}
If I compile with clang-3.7 or clang-3.8 (both which claim to have the builtin
cpu supports), everything works. However, during linking, I get the following:
Undefined symbols for architecture x86_64:
"___cpu_model", referenced from:
_dt_init in darktable.c.o
ld: symbol(s) not found for architecture x86_64
With earlier versions of clang, I see the else clause.
I have also seen this in the wild where this problem exists for FreeBSD as
well.
<a href="https://github.com/darktable-org/darktable/commit/081bc5823870918160fdd93d0157d56263add7d5">https://github.com/darktable-org/darktable/commit/081bc5823870918160fdd93d0157d56263add7d5</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>