GCC on OS/2 supports several extra options. Most start with -Z. With the exception of -Zomf (others?) they are affecting the linking.
- -Zcrtdll: link the C library dynamically. This is the default and while unneeded, doesn't hurt.
- -Zdll: create a dynamic link library.
- -Zexe: create foo which is executable which calls foo.exe which is also created. Not usually needed as most configure scripts use exeext and OS/2 linkers will create an executable if the target ends with .exe
- -Zhigh-mem: link so that the C library calls in the program make use of "high memory". This is similiar to specifying OBJ_ANY to OS/2 API memory calls. If you use this option you should include os2safe.h as the first include file in every C file that uses OS/2 APIs unless you know the calls are high memory safe.
- -Zlinker: pass option through to linker (like
-Zlinker /EXEPACK:2 -Zlinker /PACKCODE
) - -Zmap: tell linker or emxbind to create a .map file that contains the addresses of all symbols
- -Zno-autoconv: switch off automatic conversion between a.out and OMF format when linking.
- -Zautoconv: switch on automatic conversion between a.out and OMF format when linking.
- -Zomf: compile and/or link using OMF format instead of a.out. kLIBC will link aout object files into an OMF target so only adding -Zomf to LDFLAGS is usually necessary.
- -Zargs-wild: call
_wildcard()
(see below) automatically on startup - -Zargs-resp: call
_reponse()
(see below) automatically on startup - -Zbin-files: open files in binary mode by default. Doesn't work 100% of the time.
- -Zdll-search: Enables dlls as valid libraries. (default disabled)
- -Zstack: set the stack size. Specify stack size in kBs. -Zstack 0x2000 will force use of a 8MB stack.
- -Zsym: Invoke mapsym.cmd on the mapfile to produce a .sym file. Requires -Zmap
These are not OS/2 specific
- -Bstatic, -non_shared, -dn, -static: Link with static libraries.
- -Bshared, -call_shared, -dy: Link with shared libraries. (default)
These are mentioned in ReleaseNotes.os2 but not sure what they do exactly:
- -Zhigh-low: ??
- -Zno-fork: turn off the
fork()
function? - -Zno-unix: non-unix like mode, affects slash handling and fork()?
These were supported options with EMX/gcc 2.8.x and generally are ignored for compatibility:
- -Zbsd-signals: select the `BSD' signal processing model, (now default)
- -Zmt: multithread code (now default)
- -Zmtd: multithread code, link C library dynamically
- -Zmts: multithread code, link C library statically. disabled due to licensing issues.
- -Zno-rte: create DLL without runtime environment
- -Zsmall-conv: use small, fast, and inaccurate routines for converting decimal numbers to binary and vice versa
- -Zso: create stand-alone DLL
-Zsys: create stand-alone OS/2 program (no emx.dll) - there's nothing similar for current libc, if you use new gcc with new libc, you always need the libcxxx.dll- -Zsysv-signals: select the `System V' signal processing model
There are also various environmental variables that affect the linker type. (from the output of emxomfld 0.6.3)
Environment variables:
EMXOMFLD_TYPE:
The type of linker we're using. Values: WLINK, VAC365, VAC308, LINK386.
WLINK wlink.exe from Open Watcom v1.5 or later. VAC365 ilink.exe from IBM C and C++ Compilers for OS/2 v3.6 or later. VAC308 ilink.exe from Visual Age for C++ v3.08. LINK386 link386 form OS/2 install or DDK.
EMXOMFLD_LINKER:
Name of the linker to use and optionally extra parameters. Spaces in the linker name or path is not supported. Quotes are not supported either.
The default values for these two variables are VAC365 and ilink.exe.
EMXOMFLD_RC_TYPE:
The type of resource compiler we're using. Values: RC,WRC.
RC rc.exe as shipped with OS/2 or found in the Toolkit WRC wrc.exe from Open Watcom v1.6 or later.
EMXOMFLD_RC:
Name of the resource compiler to use and optionally extra parameters. Spaces or quotes in the name or path are not supported.
The default values for these two variables are RC and rc.exe. Finally, there are a couple of special functions which simplify porting of Unix programs:
_wildcard (int *argc, char ***argv)
: Same as in EMX, i.e. it expands it's arguments like a unix shell would do (but OS/2 cmd.exe doesn't), so you typically want to use this when porting a unix command line application. Instead of adding this to a program, compilation with -Zargs-wild can be used._response (int *argc, char ***argv)
: Same as in EMX. Expand response files(@FILENAME)
. The FILENAME contains a list of arguments, one per line. Arguments enclosed in double quotes will not be expanded. If a response file can not be opened, the argument is kept the same. -Zargs-resp will automatically compile this in.