Also, it appears to help if you put the word [PATCH] in the title<br><br>Cheers,<br>-Ken Noland<br><br><div class="gmail_quote">On Mon, Aug 16, 2010 at 10:38 AM, Ken Noland <span dir="ltr"><<a href="mailto:nippbit@gmail.com">nippbit@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">Hey,<br><br>I'm new on this list, but earlier I caught a thread about 
similar issues. Check out the thread "CLang compiling windows.h from the
 Windows SDK" from Francois Pichet.<br><br>If I understand this 
correctly, there are a lot of things about the windows headers that are 
not going to be easy fixes. However, I'm interested in doing the same 
thing; getting CLang to compile a windows executable. Personally, I 
prefer Doug's recommended way of dealing with other companies or 
projects that are not compliant, by telling them to correct their 
headers, but who knows how long that will take until MS finally get 
around to fixing them.<br>
<br>I'll check out this patch later tonight and see what results I get 
and post my results back here. Can someone with commit rights check out 
the patch as well?<br><br>Thanks,<br>-Ken Noland<br><br></div><div class="gmail_quote"><div class="im">2010/8/16 <a href="mailto:per@lumai.se" target="_blank">per@lumai.se</a> <span dir="ltr"><<a href="mailto:per@lumai.se" target="_blank">per@lumai.se</a>></span><br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Ping? Does anyone feel like taking a look at these patches? Should I<div><div></div><div class="h5"><br>
submit any bugs for the issues below?<br>
<br>
--<br>
Per Lindén<br>
<br>
<a href="mailto:per@lumai.se" target="_blank">per@lumai.se</a> skrev 2010-08-11 18:11:<br>
<div>> Hi all,<br>
><br>
> I have been experimenting with the creation of Win32 executables using<br>
> only MSVC SDK headers, clang, llc and link.exe from MS Visual Studio<br>
> 2008. This has uncovered a few issues:<br>
><br>
> 1) VisualStudioWindowsX86_32TargetInfo needs to define<br>
> _STDCALL_SUPPORTED. Otherwise the Win32 API does not get dllimport<br>
> declarations and linking fails. Patch attached.<br>
><br>
> 2) The SDK include directory search fails for me.<br>
> InitHeaderSearch.cpp:getWindowsSDKDir() uses key "InstallationFolder"<br>
> whose contents lacks the final "\include" needed for SDK 6.0a.<br>
><br>
> 3) Compiling the simple test program below causes the resulting llvm<br>
> assembly to include definitions of the functions Int64ShllMod32,<br>
> Int64ShraMod32 and Int64ShrlMod32 although these are neither used or<br>
> referenced in the code. This in turn causes problems in 4):<br>
><br>
> define x86_stdcallcc i64 @Int64ShllMod32(i64 %Value, i32 %ShiftCount)<br>
> nounwind inlinehint {<br>
> entry:<br>
> %retval = alloca i64, align 8 ; <i64*> [#uses=1]<br>
> %Value.addr = alloca i64, align 8 ; <i64*> [#uses=1]<br>
> %ShiftCount.addr = alloca i32, align 4 ; <i32*> [#uses=1]<br>
> store i64 %Value, i64* %Value.addr<br>
> store i32 %ShiftCount, i32* %ShiftCount.addr<br>
> call void asm sideeffect "FIXME: not done",<br>
</div>> "~{dirflag},~{fpsr},~{flags}"() nounwind, !srcloc !0<br>
> %0 = load i64* %retval ; <i64> [#uses=1]<br>
> ret i64 %0<br>
> }<br>
><br>
> 4) Parser::FuzzyParseMicrosoftAsmStatement() emits "FIXME: not done" in<br>
> the llvm code above when microsoft assembly is encountered. Changing it<br>
> to emit "/*"FIXME: not done*/" makes the resulting file compile. Patch<br>
> attached.<br>
><br>
> ***<br>
><br>
> The final Win32 executable works when fixes for the stuff above are<br>
> applied...! I personally find this very cool. Steps to reproduce:<br>
><br>
> Create test.c:<br>
><br>
> #include <windows.h><br>
> int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR<br>
> lpCmdLine, int nCmdShow) {<br>
> MessageBox(NULL, "hello msgbox world\n", "Title", MB_OK);<br>
> return 0;<br>
> }<br>
><br>
> Run (in the "Visual Studio 2008 Command Prompt" or another working MSVC<br>
> environment):<br>
><br>
> clang -I <path to SDK/include> -D_STDCALL_SUPPORTED -c -emit-llvm test.c<br>
> llc -filetype obj test.o -o test.obj<br>
> link test.obj user32.lib msvcrt.lib<br>
><br>
> link.exe = the MSVC linker<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br>
</blockquote></div><br>