[llvm-bugs] [Bug 25510] New: __builtin_cpu_supports("sse3") compiles, but fails when linking.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 12 13:18:25 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25510

            Bug ID: 25510
           Summary: __builtin_cpu_supports("sse3") compiles, but fails
                    when linking.
           Product: lld
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: pope at shifteleven.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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.
https://github.com/darktable-org/darktable/commit/081bc5823870918160fdd93d0157d56263add7d5.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151112/b69ae085/attachment.html>


More information about the llvm-bugs mailing list