<div dir="rtl"><div dir="ltr">I'm looking into this, see <a href="https://llvm.org/bugs/show_bug.cgi?id=24395">https://llvm.org/bugs/show_bug.cgi?id=24395</a></div><div dir="ltr">The solution is somewhat more compilcated but you can use the patch there for now.</div><div dir="ltr"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div dir="ltr">2015-08-08 20:20 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">Some change in the latest source has completely broken linking for 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 -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 -Wl,--start-group "ex_aclass.obj" -Wl,-Bstatic -Wl,-Bdynamic -Wl,--end-group -g -march=i686 -m32<br>
<br>
libmingw32.a(lib32_libmingw32_a-pseudo-reloc.o):pseudo-reloc.c:(.text+0x1d6): undefined reference to `__chkstk_ms'<br>
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)<br>
<br>
Nor does it matter what source file is used in general, whenever the link is done for anything the "undefined reference to `__chkstk_ms'" 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 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 may have occurred trying to fix a more specific problem I reported in two other threads about linkage failure using dllexport and dllimport attributes on Windows, but going from a situation where a specific problem broke the linking to all situations are broken when attempting to link is not good.<br>
<br>
I tried looking at the clang unit tests and how they can be run on Windows but found very little information about both. I wouldn't mind contributing some basic unit tests, even though I am not a clang developer, just to make sure that clang on Windows targeting gcc will work when compiling/linking dlls and using those dlls from another module, if I could understand what to do. That way such a snafu as this latest breakage would not occur so easily as whatever 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>
<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>
</blockquote></div><br></div>