<div dir="ltr">The references to _Unwind_Resume and __gxx_personality_v0 are surprising, but the rest make sense to me. If you don't need any EH, just pass -fno-exceptions to fix the issue. For more info, read on. :)<div><div><br></div><div>---</div><div><br></div><div>Clang has a few underlying -cc1 exception options:<div><br><div>-fexceptions: Indicates the presence of *any* kind of EH. Typically implied by any of the below options. Causes emission of *all* cleanups (C++ dtor, __attribute__((cleanup)), Obj-C @finally, etc)</div><div><br></div><div>-fcxx-exceptions: Enables C++ try / catch. Makes us use __gxx_personality_v0 etc.</div></div><div><br></div><div>-fobjc-exceptions: Enables Obj-C @try / @catch / @finally. Makes us use an Obj-C EH personality.</div><div><br></div><div>-fsjlj-exceptions: More of a backend option. This changes our EH lowering strategy.</div><div><br></div><div>clang-cl currently turns on -fexceptions and not -fcxx-exceptions, while clang will enable both by default. Long term, to implement the semantics of MSVC's /EHs, we want to disable C++ dtor cleanups while leaving SEH (__try / __except) enabled.</div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 2, 2015 at 8:30 AM, Russell Wallace <span dir="ltr"><<a href="mailto:russell.wallace@gmail.com" target="_blank">russell.wallace@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm trying to use Clang on Windows to compile C++ to bitcode and then to an executable (with a view to carrying out some experiments on whole program optimization of the bitcode).<div><br></div><div>When I use clang.exe, even with -D_HAS_EXCEPTIONS=0 -fms-compatibility -fms-extensions, I get errors:</div><div><br></div><div><div>main-621e97.o : error LNK2019: unresolved external symbol _Unwind_Resume referenced in function main</div><div>main-621e97.o : error LNK2001: unresolved external symbol __gxx_personality_v0</div><div>main-621e97.o : error LNK2019: unresolved external symbol __cxa_call_unexpected referenced in function "public: class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > __cdecl std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::begin(void)" (?begin@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QEAA?AV?$_Vector_iterator@V?$_Vector_val@U?$_Simple_types@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@@std@@@2@XZ)</div><div>a.out : fatal error LNK1120: 3 unresolved externals</div></div><div><br></div><div>clang-cl.exe avoids those errors and can generate an executable from C++, but it doesn't seem to have -emit-llvm or an equivalent option.</div><div><br></div><div>What am I missing?</div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>