<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:andreas.haferburg@gmx.de" title="Andreas Haferburg <andreas.haferburg@gmx.de>"> <span class="fn">Andreas Haferburg</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - clang-cl /MT results in linker error unless /link /DEFAULTLIB:LIBCMT.lib is added"
href="https://bugs.llvm.org/show_bug.cgi?id=35120">bug 35120</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - clang-cl /MT results in linker error unless /link /DEFAULTLIB:LIBCMT.lib is added"
href="https://bugs.llvm.org/show_bug.cgi?id=35120#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - clang-cl /MT results in linker error unless /link /DEFAULTLIB:LIBCMT.lib is added"
href="https://bugs.llvm.org/show_bug.cgi?id=35120">bug 35120</a>
from <span class="vcard"><a class="email" href="mailto:andreas.haferburg@gmx.de" title="Andreas Haferburg <andreas.haferburg@gmx.de>"> <span class="fn">Andreas Haferburg</span></a>
</span></b>
<pre>Aha! Alright, now I understand, thank you. If I emit the instructions for the
linker in the IR, I no longer need to specify it when calling link.exe or
clang-cl.exe.
<span class="quote">> !llvm.linker.options = !{!1}
> !1 = !{!"/DEFAULTLIB:libcmt.lib"}</span >
>From the perspective of a frontend author, I do find it very surprising to look
at .ll as .obj. clang.exe will produce an .obj file from the .ll file, so they
must be different. But I understand that the clang-cl driver's job is to
produce IR, so everything it does should be contained in the IR. I guess it's a
pitfall for frontend authors that can't be avoided.
I believe the main problem was that I couldn't figure out how to make
`clang-cl.exe` output IR, since `-S -emit-llvm` doesn't work with clang-cl.exe,
and none of the examples are written for clang-cl.exe. What I ended up doing is
call `clang-cl.exe -###` to find out what it actually does, and then replace
the `-emit-obj` with `-emit-llvm`, but that is very much non-obvious. So I
ended up looking at random hello_world.ll files that I found on the web, which
was a bad idea.
There is no `-emit-llvm` flag in gcc either. Why doesn't `/c -emit-llvm` work
with clang-cl.exe? I'll open a feature request.</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>