<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - (mingw) undefined reference to `__chkstk_ms'"
   href="https://llvm.org/bugs/show_bug.cgi?id=24395">24395</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>(mingw) undefined reference to `__chkstk_ms'
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.7
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>t.poechtrager@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I am getting the following linker errors when I am tryink to link a MinGW
project on Linux with Clang.

config.o:(.text+0x29a): undefined reference to `_alloca'
/usr/i686-w64-mingw32/lib/libmingw32.a(lib32_libmingw32_a-pseudo-reloc.o): In
function `pei386_runtime_relocator':
/build/mingw-w64-crt/src/mingw-w64-v4.0.2/mingw-w64-crt/crt/pseudo-reloc.c:476:
undefined reference to `__chkstk_ms'
/usr/i686-w64-mingw32/lib/libmingwex.a(lib32_libmingwex_a-mingw_vfscanf.o): In
function `_mingw_vfscanf':
/build/mingw-w64-crt/src/mingw-w64-v4.0.2/mingw-w64-crt/stdio/mingw_vfscanf.c:1614:
undefined reference to `__chkstk_ms'
/usr/i686-w64-mingw32/lib/libmingwex.a(lib32_libmingwex_a-mingw_vfscanf.o): In
function `_mingw_vsscanf':
/build/mingw-w64-crt/src/mingw-w64-v4.0.2/mingw-w64-crt/stdio/mingw_vfscanf.c:1623:
undefined reference to `__chkstk_ms'
/usr/i686-w64-mingw32/lib/libmingwex.a(lib32_libmingwex_a-mingw_pformat.o): In
function `_pformat_emit_radix_point':
/build/mingw-w64-crt/src/mingw-w64-v4.0.2/mingw-w64-crt/stdio/mingw_pformat.c:1183:
undefined reference to `__chkstk_ms'
/usr/i686-w64-mingw32/lib/libmingwex.a(lib32_libmingwex_a-mingw_pformat.o): In
function `_pformat_int':
/build/mingw-w64-crt/src/mingw-w64-v4.0.2/mingw-w64-crt/stdio/mingw_pformat.c:685:
undefined reference to `__chkstk_ms'
/usr/i686-w64-mingw32/lib/libmingwex.a(lib32_libmingwex_a-mingw_pformat.o):/build/mingw-w64-crt/src/mingw-w64-v4.0.2/mingw-w64-crt/stdio/mingw_pformat.c:860:
more undefined references to `__chkstk_ms' follow
clang-3.7: error: linker command failed with exit code 1 (use -v to see
invocation)

>From comparing gcc's and clang's linker flags it looks like -lgcc went missing.

Clang:
 -ldl -lconfig -lGeoIP -lenet -lz -lws2_32 -lwinmm -lshlwapi -lstdc++
 -lmingw32 -lgcc_s -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32
 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lmoldname -lmingwex
 -lmsvcrt /usr/lib/gcc/i686-w64-mingw32/5.2.0/crtend.o

GCC:
 -ldl -lconfig -lGeoIP -lenet -lz -lws2_32 -lwinmm -lshlwapi -lstdc++
 -lmingw32 -lgcc_s --> -lgcc <-- -lmoldname -lmingwex -lmsvcrt -lpthread
-ladvapi32
 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s --> -lgcc <-- -lmoldname
-lmingwex
 -lmsvcrt /usr/lib/gcc/i686-w64-mingw32/5.2.0/crtend.o

$ clang --version                                                               
clang version 3.7.0 (branches/release_37 244340)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>