[llvm-dev] lld-link.exe Can't Recognize .obj File Type?

Zachary Turner via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 11 16:55:25 PST 2019


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.

On Mon, Nov 11, 2019 at 4:54 PM Zachary Turner <zturner at roblox.com> wrote:

> 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.
>
> Make sure LTCG is off and that when you run dumpbin on the obj file you
> get some reasonable information from it.
>
> On Mon, Nov 11, 2019 at 11:36 AM Eli Friedman via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> 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.
>>
>>
>>
>> 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.)
>>
>>
>>
>> -Eli
>>
>>
>>
>> *From:* llvm-dev <llvm-dev-bounces at lists.llvm.org> *On Behalf Of *Osman
>> Zakir via llvm-dev
>> *Sent:* Sunday, November 10, 2019 7:58 AM
>> *To:* llvm-dev at lists.llvm.org
>> *Subject:* [EXT] [llvm-dev] lld-link.exe Can't Recognize .obj File Type?
>>
>>
>>
>> Hi.
>>
>>
>>
>> Just now when I tried to compile a .cpp file using the LLVM toolset in
>> VS2019, I got two error messages from lld-link:
>>
>> "
>>
>> lld-link : error : Debug\cust_std_lib_facilities.obj: unknown file type
>>
>> lld-link : error : Debug\Ex10_10.obj: unknown file type
>>
>> "
>>
>> 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.
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191111/5b762b6e/attachment.html>


More information about the llvm-dev mailing list