[cfe-dev] clang-cl and intrinsics

Kim Gräsman via cfe-dev cfe-dev at lists.llvm.org
Mon Dec 14 21:09:02 PST 2015


Just to confirm: that was it.

Thanks!

- Kim

On Mon, Dec 14, 2015 at 6:46 PM, Reid Kleckner <rnk at google.com> wrote:
> This looks like skew between the compiler headers and the compiler. Both
> those builtins were added in the November / October time frame, so an old
> clang wouldn't know about them.
>
> Are you sure you made a symlink from cl.exe to clang-cl.exe and not a copy?
> Check if "D:\dev\private\llvm-trunk\out\reldbg\bin\cl.exe --version" and
> "D:\dev\private\llvm-trunk\out\reldbg\bin\clang.exe --version" agree.
>
> On Sun, Dec 13, 2015 at 9:42 PM, Kim Gräsman <cfe-dev at lists.llvm.org> wrote:
>>
>> Hi all,
>>
>> I'm trying to use clang-cl on Windows to be able to use ASAN. The
>> build system I'm using is a little wonky, so I worked around it by
>> putting the Clang build output dir in the executable search path, and
>> creating a link from cl.exe -> clang-cl.exe there.
>>
>> So far, so good -- clang-cl is compiling the code when I build from
>> Visual Studio.
>>
>> But as soon as it hits an <ostream> include, I get build errors from
>> Clang's intrinsics headers, e.g.:
>>
>> 1>  In file included from C:\project\t.cpp:1:
>> 1>  In file included from C:\project\t.h:5:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\ostream:6:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\ios:6:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\xlocnum:10:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\streambuf:6:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\xiosbase:6:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\xlocale:8:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\stdexcept:7:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\xstring:6:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\xmemory0:942:
>> 1>  In file included from
>>
>> D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\intrin.h:34:
>> 1>  In file included from
>>
>> D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\x86intrin.h:29:
>> 1>  In file included from
>>
>> D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\immintrin.h:31:
>>
>> 1>D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\emmintrin.h(1484,3):
>> error : use of undeclared identifier '__builtin_ia32_pause'
>> 1>    __builtin_ia32_pause();
>> 1>    ^
>>
>> 1>  In file included from C:\project\t.cpp:1:
>> 1>  In file included from C:\project\t.h:5:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\ostream:6:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\ios:6:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\xlocnum:10:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\streambuf:6:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\xiosbase:6:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\xlocale:8:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\stdexcept:7:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\xstring:6:
>> 1>  In file included from C:\Program Files (x86)\Microsoft Visual
>> Studio 11.0\VC\include\xmemory0:942:
>> 1>  In file included from
>>
>> D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\intrin.h:34:
>> 1>  In file included from
>>
>> D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\x86intrin.h:29:
>> 1>  In file included from
>>
>> D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\immintrin.h:37:
>>
>> 1>D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\smmintrin.h(146,45):
>> error : cannot initialize a parameter of type
>> '__attribute__((__vector_size__(2 * sizeof(long long)))) long long *'
>> with an rvalue of type 'const __v2di *'
>> 1>    return (__m128i) __builtin_ia32_movntdqa ((const __v2di *) __V);
>> 1>                                              ^~~~~~~~~~~~~~~~~~~~
>>
>> Did I miss anything here? I'm not telling clang-cl anything about
>> target, I did try passing various /arch: arguments without any
>> success.
>>
>> Thanks for any ideas!
>>
>> - Kim
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>



More information about the cfe-dev mailing list