Porting to OS/2: aout vs omf

On OS/2, gcc supports two object formats. One is aout, which is a traditional format of Unix world. The other is OMF, which is a native format of OS/2.

When porting to OS/2, which is more proper ? My answer is aout. Because aout is supported by binutils, which is used by most of projects from Unix world. Using OMF requires additional works. And aout can be converted to OMF easily with emxomf.exe. As well as, kLIBC/gcc supports aout to OMF auto-conversion at linking time. Whereas, OMF to aout is not supported.

If you want to port, use aout. And if you develop a library with gcc, then use aout and convert it to OMF with emxomf.exe.

How can I select aout or OMF ? gcc provides -Zomf flags. This flag unlike the other -Z flags, works as both a compilation flag and a linker flag. If -Zomf is used at compilation time, the object file is OMF format. Otherwise aout format. If -Zomf is used at linking time, OMF linkers by emxomfld.exe are used. Otherwise, ld.exe is used.

By the way, I recommend to use -Zomf only at linking time if needed. As I said above, binutils does not support OMF format. So object files generated by -Zomf may cause binutils to fail. -Zomf is discouraged at compilation time.

However, -Zomf has good things at linking time. First, if aout libs and OMF libs are mixed in dependencies without -Zomf, linking fails. Second, we cannot make a debug build without -Zomf. Because even if debug informations were generated successfully, there are no debuggers understanding those debug informations.

Therefore, -Zomf is needless except these two situations.

FYI, one of differences between ld and emxomfld is that ld may fail if the order of dependencies is not correct, but emxomfld does not care about it.

댓글

이 블로그의 인기 게시물

토렌트: < 왕좌의 게임 > 시즌 1 ~ 시즌 8 완결편 마그넷

토렌트: < 스타워즈 > Ep.1 ~ Ep.6 마그넷

토렌트: NGC < 코스모스 > 우리말 더빙 전편(1편~13편) 마그넷