<div dir="ltr">My post assumes that you have compiled with MSVC and are linking with cl.  If you are compiling with clang-cl and linking with lld-link then definitely lld-link should understand the file.  In any case, run dumpbin on the object file and see if it gives you any clues as to whether it's actually a COFF object file.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 11, 2019 at 4:54 PM Zachary Turner <<a href="mailto:zturner@roblox.com">zturner@roblox.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I'm guessing you have enabled LTCG.  In this case the file extension will be .obj, but it's actually not a COFF object file, and only Microsoft understands the format of this file.  <div><br></div><div>Make sure LTCG is off and that when you run dumpbin on the obj file you get some reasonable information from it.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 11, 2019 at 11:36 AM Eli Friedman via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-US">
<div>
<p class="MsoNormal">lld doesn’t care about the file extension; it examines the first few bytes of the file to figure out the filetype.  That error message means that examination failed: the header doesn’t correspond to any of the input filetypes lld-link supports.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The Unix “file” utility is generally useful for figuring out what sort of file you’re working with.  (On Windows, you can get it through Cygwin or gnuwin32.)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">-Eli<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt">
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>> <b>On Behalf Of
</b>Osman Zakir via llvm-dev<br>
<b>Sent:</b> Sunday, November 10, 2019 7:58 AM<br>
<b>To:</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> [EXT] [llvm-dev] lld-link.exe Can't Recognize .obj File Type?<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black">Hi.  <u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black">Just now when I tried to compile a .cpp file using the LLVM toolset in VS2019, I got two error messages from lld-link:<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black">"<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black">lld-link : error : Debug\cust_std_lib_facilities.obj: unknown file type<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black">lld-link : error : Debug\Ex10_10.obj: unknown file type<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black">"<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black">What's the reason for this, and is there a way to fix it?  This is the first time I'm saying this error; I've used LLVM before and this error never came up when I know .obj files should've been
 used then as well.<u></u><u></u></span></p>
</div>
</div>
</div>
</div>

_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div>