<div dir="rtl"><div dir="ltr">See r244407 for a fuller patch with test case. It may also solve the other issues.</div><div dir="ltr">If not, the best way to diagnose such problem is to run clang++ and g++ with -v argument and the same pther arguments of the case, comparing both compiler outputs to see what's different. </div><div dir="ltr">With this input we could patch the mingw toolchain.</div><div dir="ltr"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div dir="ltr">2015-08-08 22:37 GMT+03:00 Edward Diener <span dir="ltr"><<a href="mailto:eldlistmailingz@tropicsoft.com" target="_blank">eldlistmailingz@tropicsoft.com</a>></span>:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 8/8/2015 1:59 PM, Yaron Keren wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm looking into this, see <a href="https://llvm.org/bugs/show_bug.cgi?id=24395" rel="noreferrer" target="_blank">https://llvm.org/bugs/show_bug.cgi?id=24395</a><br>
The solution is somewhat more compilcated but you can use the patch<br>
there for now.<br>
</blockquote>
<br></span>
The patch solved the general problem I illustrated below. Thanks !<br>
<br>
But for the example in my other posts, where an exception was being thrown from a module using as a type a class that is in another DLL that is being exported/imported, the attempt to link to that DLL now fails with:<br>
<br>
ex_exception.obj: In function `ex_exception':<br>
ex_exception.cpp:42: undefined reference to `_Unwind_Resume'<br>
ex_xml_exception.obj: In function `ex_xml_exception':<br>
ex_xml_exception.cpp:32: undefined reference to `_Unwind_Resume'<br>
ex_xml_exception.cpp:39: undefined reference to `_Unwind_Resume'<br>
ex_xml_exception.cpp:42: undefined reference to `_Unwind_Resume'<span class=""><br>
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)<br>
<br></span>
These error messages are exactly the same whether or not I attempt to export/import the individual member functions of a visible class or whether I attempt to export/import the class as a whole. At least the previous error messages which occurred in the above situation have disappeared <g>.<br>
<br>
If you need for me to repeat the ex_exception, ex_xml_exception, and throw_exception_ex source, with their command lines, in this post I will be glad to do it.<br>
<br>
Searching the web for "undefined reference to `_Unwind_Resume'" yields various possibilities but none are definitive for this case AFAICS.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
2015-08-08 20:20 GMT+03:00 Edward Diener<br></span>
<eldlistmailingz-5p0dqD/<a href="mailto:c5LGWd6l5hS35sQ@public.gmane.org" target="_blank">c5LGWd6l5hS35sQ@public.gmane.org</a><br>
<mailto:<a href="mailto:eldlistmailingz-5p0dqD" target="_blank">eldlistmailingz-5p0dqD</a>/<a href="mailto:c5LGWd6l5hS35sQ@public.gmane.org" target="_blank">c5LGWd6l5hS35sQ@public.gmane.org</a>>>:<div><div class="h5"><br>
<br>
Some change in the latest source has completely broken linking for<br>
clang on Windows targeting gcc.<br>
<br>
// ex_aclass.hpp<br>
<br>
#ifndef EX_ACLASS_HPP<br>
#define EX_ACLASS_HPP<br>
#if defined(BLD_EX_EXAMPLE)<br>
#define EX_DECL __attribute__((__dllexport__))<br>
#else<br>
#define EX_DECL __attribute__((__dllimport__))<br>
#endif<br>
class EX_DECL ex_aclass<br>
{<br>
public:<br>
int a_function(long);<br>
};<br>
#endif // EX_ACLASS_HPP<br>
<br>
// ex_aclass.cpp<br>
<br>
#define BLD_EX_EXAMPLE<br>
#include "ex_aclass.hpp"<br>
int ex_aclass::a_function(long amt)<br>
{<br>
return(amt > 1000000 ? 10 : 20);<br>
}<br>
<br>
// Compile ex_aclass.cpp<br>
<br>
clang++.exe -c -x c++ -D__MINGW_FORCE_SYS_INTRINS -O0 -g -fno-inline<br>
-Wall -g -march=i686 -m32 -o "ex_aclass.obj" "ex_aclass.cpp"<br>
<br>
// Link into ex_ac.dll<br>
<br>
clang++.exe" -o "ex_ac.dll" -Wl,-soname -Wl,ex_ac.dll -shared<br>
-Wl,--start-group "ex_aclass.obj" -Wl,-Bstatic -Wl,-Bdynamic<br>
-Wl,--end-group -g -march=i686 -m32<br>
<br>
libmingw32.a(lib32_libmingw32_a-pseudo-reloc.o):pseudo-reloc.c:(.text+0x1d6):<br>
undefined reference to `__chkstk_ms'<br>
clang++.exe: error: linker command failed with exit code 1 (use -v<br>
to see invocation)<br>
<br>
Nor does it matter what source file is used in general, whenever the<br>
link is done for anything the "undefined reference to `__chkstk_ms'"<br>
occurs.<br>
<br>
Can some one of the clang developers please look at this ?<br>
<br>
I am using clang on Windows with the 32-bit version of<br>
mingw-64/gcc-5.1 as i686-5.1.0-posix-dwarf-rt_v4-rev0.<br>
<br>
I realize the current problems for clang on Windows targeting gcc<br>
may have occurred trying to fix a more specific problem I reported<br>
in two other threads about linkage failure using dllexport and<br>
dllimport attributes on Windows, but going from a situation where a<br>
specific problem broke the linking to all situations are broken when<br>
attempting to link is not good.<br>
<br>
I tried looking at the clang unit tests and how they can be run on<br>
Windows but found very little information about both. I wouldn't<br>
mind contributing some basic unit tests, even though I am not a<br>
clang developer, just to make sure that clang on Windows targeting<br>
gcc will work when compiling/linking dlls and using those dlls from<br>
another module, if I could understand what to do. That way such a<br>
snafu as this latest breakage would not occur so easily as whatever<br>
broke in the change should have been caught by some unit tests.<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br></div></div>
<mailto:<a href="mailto:cfe-dev-NBbBogny7ofFcdTEL8lfRQ@public.gmane.org" target="_blank">cfe-dev-NBbBogny7ofFcdTEL8lfRQ@public.gmane.org</a>><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><span class=""><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br>
</span></blockquote><div class="HOEnZb"><div class="h5">
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div>