test1.obj: file format COFF-i386
Disassembly of section .text:
0000000000000000 _main:
0: 68 00 00 00 00 pushl $0
5: e8 00 00 00 00 calll 0 <_main+0xa>
a: 83 c4 04 addl $4, %esp
d: 33 c0 xorl %eax, %eax
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
The CodeView library in LLVM only supports Codeview C13 types, that is, MSVC 7.0 / Visual Studio 2002 or after.
De : llvm-dev <llvm-dev...@lists.llvm.org>
De la part de David Blaikie via llvm-dev
Envoyé : September 30, 2019 2:38 PM
À : Paul Moran <banky...@gmail.com>; Rui Ueyama <ru...@google.com>
Cc : llvm...@lists.llvm.org
Objet : Re: [llvm-dev] lld-link with MSVC6 object files
MSVC 6 is 1998 not 1989 :)
The latest MSVC linker can link these object files. Is this just because it has support for C13 types and some other code path for whatever MSVC6 uses? After some digging around it appears to be this format:
https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#coff-file-header-object-and-imageWhich is COFF object file format? Does lld link support this format?
> Hi,
>
> I have a question about lld-link. What obj file formats should it support?
> When I try to use an obj from msvc 6.0 it complains that the file magic is
> not valid.
I just tested building an object file with MSVC 6.0 and linking it with
lld, and it mostly works fine.
At first I got errors like these though:
lld-link: error: /safeseh: hello.obj is not compatible with SEH
But by adding -safeseh:no, I was able to link the file just fine.
If the MSVC 6.0 built object file was built with debug info, I get lld
warnings like these:
lld-link: warning: ignoring section .debug$S with unrecognized magic 0x2
lld-link: warning: ignoring section .debug$T with unrecognized magic 0x2
Is this what you got? Despite these, linking works (but you won't get a
working debug info).
// Martin
I have the most edge of edge use cases :). I am recovering the lost source code to an application built with MSVC 6. However because I want to produce byte for byte exact output I need to ensure that the import table is in the same order as the original binary.
Yeah ideally I wanted the tool chain to just produce the same binary. I suppose running a disassembly step could work to ensure that only offsets to imports have changed. But I think this would still give me issues with comparing data sections since offsets to constant strings and globals could also be swapped around too?I believe in GCC this can be "fixed" by using a linker script. MSVC doesn't have anything like this however.I haven't looked at lld-links binary output yet - but I would have imagined that the import table format and the way that global data is created must be done in the same way? It would just be orderings/lack of "rich" header and other things that lld-link does differently?