<html>
    <head>
      <base href="http://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 --- - Implement MinGW(-w64) Clang Driver code"
   href="http://llvm.org/bugs/show_bug.cgi?id=18546">18546</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Implement MinGW(-w64) Clang Driver code
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Keywords</th>
          <td>missing-feature, new-feature
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>vanboxem.ruben@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=11892" name="attach_11892" title="MinGW-w64 driver support">attachment 11892</a> <a href="attachment.cgi?id=11892&action=edit" title="MinGW-w64 driver support">[details]</a></span>
MinGW-w64 driver support

Currently, MinGW(-w64), more specifically, these targets:
i686-pc-mingw32
i686-w64-mingw32
x86_64-w64-mingw32

use the Generic_GCC Driver code, which uses a substandard directory search.

Attached is a patch that introduces a new ToolChain, MinGWToolChain, that
provides the necessary MinGW-w64 search paths and libraries.

Currently, this links in libgcc/libstdc++, and there is a small snippet of code
that implements cross GCC version detection through its library directory. I
cannot inherit the Generic_GCC version, because this would add unwanted search
directories that could conflict with the cross-compilation. InitHeaderSearch
was also adapted to this end.

Currently the patch does not cater for MinGW.org, but this can be added if I
know the search paths. I have tested this on Arch Linux with its mingw-w64-gcc
packages, and on Windows with my toolchains.
I have no idea how to write a test for this though, and looking at the existing
tests has made me none the wiser.

I believe that instead of calling collect2, one could directly call ld,
removing another GCC dependency.

The only issue I have run into is when creating a DLL (entry point
DllMainCRTStartup not found). It seems the wrong *crt*.o objects are used
(there are those by MinGW-w64 and those from GCC) I know too little of this
that I invite someone else to investigate this. Also, first creating an *.o
file, and then linking removes the warning.</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>