[cfe-dev] clang-cl question

Stephan Bergmann via cfe-dev cfe-dev at lists.llvm.org
Wed Nov 11 08:46:14 PST 2015


I'm experimenting with building LibreOffice on Windows with the clang-cl 
wrapper (and that looks really promising nowadays; it looked much worse 
when I naively tried last time).  I'm using a recent Clang trunk build.

After some trial and error, I get along quite well for a while with passing

> C:/clang/build/Debug/bin/clang-cl.exe -fmsc-version=1700 -Qunused-arguments --target=x86_64-windows-mscv

as CC and CXX into LibreOffice's build system (which heavily expects the 
compiler to be MSVC on Windows, of course).

However, one place that is causing trouble is code calling 
RtlSecureZeroMemory, which leads to referencing an unresolved external 
symbol __stosb during linking.  The definition of RtlSecureZeroMemory in 
winnt.h is using

> #if defined(_M_AMD64)
> __stosb(...)

where __stosb is apparently an MSVC intrinsic, and I see an inline 
definition of it in the Clang installation's 
lib/clang/3.8.0/include/Intrin.h, but that include file is apparently 
not used when compiling the above code.

When I manually #include <Intrin.h> into the LibreOffice source file 
that calls RtlSecureZeroMemory, compiling and linking succeeds, but I'm 
not sure that's the intended setup.  Am I missing something how to set 
up things so that Clang's Intrin.h gets picked up automatically (or is 
this the wrong approach to fix things anyway)?



More information about the cfe-dev mailing list