Converting COFF lib file to OMF format

点点圈 提交于 2019-12-09 13:31:31

问题


Is there any way to convert COFF library (lib file) to OMF library for using with C++Builder6 ? This coff is not just import library, it conatians some code. When I try to convert it using borland's coff2omf.exe, I get 1KB file from 15KB file.


回答1:


It's fairly typical for an OMF object file to be a lot smaller than an equivalent COFF object, so what you're getting may well be valid.

If you find that it's really not, you can probably break the lib file into individual object files, disassemble the object files, re-assemble them to OMF object files, and put those together into an OMF lib file.




回答2:


Instead of DigitalMars converter, you may use the Object file converter available at http://agner.org/optimize

This utility can be used for converting object files between COFF/PE, OMF, ELF and Mach-O formats for all 32-bit and 64-bit x86 platforms. Can modify symbol names in object files. Can build, modify and convert function libraries across platforms. Can dump object files and executable files. Also includes a very good disassembler supporting the SSE4, AVX, AVX2, FMA and XOP instruction sets. Source code included (GPL).

This is a great site for low-level optimization, and there are a lot of useful information in the associated manual pdf file, about the library formats across several platforms.




回答3:


This is rather late, but if anyone is looking for an answer, you can checkout COFFIMPLIB from DigitalMars. COFF2OMF is available at the same site, but it looks like that's older.




回答4:


Integrating Delphi (omf) and Ada (gcc, coff) required lots of effort until I've given up doing it in a single exe.

I honestly tried to disintegrate gcc rtl and ada rtl .a (coff libraries) into lots of .o (objects), convert them via coff2omf (there were DMD coff2omf and iirc another convobj or so). Some of the coff .o failed to be converted to .obj so I can't say if it was a reliable way at all.

Assembler level conversion is not so simple when it takes to exceptions and other deep details.

It's a pity I haven't tried a tool named ftp://ftp.styx.cabel.net/pub/UniLink/

It's not obvious, but UniLink can probably be used to achieve the goal. One of its targets is C++ Builder package (both dynamic and static). unilink -Tpp -GI should do the trick




回答5:


It may be worth noticing that in newer versions of Delphi (>= XE2), the compiler accepts COFF as well as OMF. It's probably also true for C++ Builder. The 64 bit compilers use only COFF. See here for more informations about linking COFF.



来源:https://stackoverflow.com/questions/3114339/converting-coff-lib-file-to-omf-format

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!