<div dir="ltr">Hi again rui, :)<div><br></div><div>I've got all the patches into llvm and clang for supporting mingw-w64 via compiler-rt and now we are able to build a full mingw-w64 toolchain without gcc :)</div><div>With great help from yaron and rnk.</div><div><br></div><div>I've CC'd them as they might have interest in seeing this target through with me to the end :) </div><div><br></div><div>So I have again turned my attention to LLD so that we can also remove ld as a depend for this target </div><div><br></div><div>Previously I raised the issue that while lld would infact link exe's for me the issue was the sections were malformed and thus crashed on launch.</div><div><br></div><div>I've done some debugging reguarding this and discovered it is due to differences between what MSVC's lib.exe and binutils dlltool produces</div><div><br></div><div>I have attached a very simple .def file and generated libs via dlltool along with an objdump -s log of the lib.exe version</div><div><br></div><div>I don't know too much about the internals of lld to be able to tell the exact cause of the problem but there are 3 specific differences I noted.</div><div><br></div><div><div>1. With dlltool each object has the name of a compiled .o file this is the one it generates when building the code section</div><div>With lib each object has the dll name </div><div><br></div><div>2. With dlltool section 7 is used for the dll name and the function names with lib section 6 is used</div><div><br></div><div>3. Other differences are that there is no debug section with dlltool and the text section comes first rather than last with lib (that probably doesn't matter much though)</div></div><div><br></div><div>Please see attached notes.txt with objdump's of both libs</div><div><br></div><div>Can could you give me your thoughts on this and how best we support both layouts in COFF/PECOFF ?</div><div><br></div><div>What source files should I be looking at to patch this or is this something you can support with very little effort ?</div><div><br></div><div>I don't know if you would be opposed to supporting this or not being honest dlltool should generate libs using the same section number as lib.exe but we can't exactly change that now because existing toolchains and libs have already been built with this and changing that would break them.</div><div><br></div><div>If you are opposed I would like you to still tell me what I have to change to get it working after I do that I can narrow the scope for getting a patch up streamed into binutils to fix this :)</div><div><br></div><div>Kind Regards</div><div>Martell</div></div>