OS/2 codes: How to pass linker commands to a linker using gcc

Some flags are availabile only to linkers such as ld and emxomfld. To use those flags, it is possible to use ld or emxomfld directly. But it is not recommended, because it is not compatible and comfortable.

If so, what are the ways to pass linker commands to linker using gcc ? gcc has two options. One is [-Wl,], which is supported on cross-platform. The other is [-Zlinker], which is specific to OS/2.

gcc with [-Wl,] passes commands separated by comma[,] to linkers such as ld or emxomfld. For example, both ld and emxomfld support -Zdll-search, which enables to find .dll as an ordinary library, but it is disabled by default. gcc does not supports this option directly. To enable dll search feature, [-Wl,] is needed, like this.

  • gcc -Wl,-Zdll-search ...

gcc with [-Zlinker] passes a command to linkers such as LINK386, ILINK or WLINK. That is, it passes commands only to emxomfld. In fact, it passes to ld as well. But an option(-O) which emxomfld understand but ld does not is prepended. So ld complains about the unknown option -O. For examples, if you want to use /EXEPACK:2 option of IBM linkers, do like this.

  • gcc -Zlinker /EXEPACK:2 ...

Remember that /EXEPACK:2 is ignored when using WLINK.

After all, if you want to pass common flags of ld and emxomfld, then use [-Wl,]. Or if you want to pass flags to OMF linkers, then use [-Zlinker] with [-Zomf].

댓글

이 블로그의 인기 게시물

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

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

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