Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ User's Guide - the following describes the segment ordering of an application linked by the http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
The following describes the segment ordering of an application linked by the
Watcom Linker.  Note that this assumes that the "DOSSEG" linker option has
been specified.

 1. all segments not belonging to group "DGROUP" with class "CODE"

 2. all other segments not belonging to group "DGROUP"

 3. all segments belonging to group "DGROUP" with class "BEGDATA"

 4. all segments belonging to group "DGROUP" not with class "BEGDATA", "BSS"
    or "STACK"

 5. all segments belonging to group "DGROUP" with class "BSS"

 6. all segments belonging to group "DGROUP" with class "STACK"

A special segment belonging to class "BEGDATA" is defined when linking with
Watcom run-time libraries.  This segment is initialized with the hexadecimal
byte pattern "01" and is the first segment in group "DGROUP" so that storing
data at location 0 can be detected.

Segments belonging to class "BSS" contain uninitialized data.  Note that
this only includes uninitialized data in segments belonging to group
"DGROUP".  Segments belonging to class "STACK" are used to define the size
of the stack used for your application.  Segments belonging to the classes
"BSS" and "STACK" are last in the segment ordering so that uninitialized
data need not take space in the executable file.

In addition to these special segments, the following conventions are used by
Watcom C/C++.

 1. The "CODE" class contains the executable code for your application.  In
    a small code model, this consists of the segment "_TEXT".  In a big code
    model, this consists of the segments "<module>_TEXT" where <module> is
    the file name of the source file.

 2. The "FAR_DATA" class consists of the following:

    (a)
        data objects whose size exceeds the data threshold in large data
        memory models (the data threshold is 32K unless changed using the
        "zt" compiler option)

    (b)
        data objects defined using the "FAR" or "HUGE" keyword,

    (c)
        literals whose size exceeds the data threshold in large data memory
        models (the data threshold is 32K unless changed using the "zt"
        compiler option)

    (d)
        literals defined using the "FAR" or "HUGE" keyword.


You can override the default naming convention used by Watcom C/C++ to name
segments.

 1. The Watcom C/C++ "nm" option can be used to change the name of the
    module.  This, in turn, changes the name of the code segment when
    compiling for a big code model.

 2. The Watcom C/C++ "nt" option can be used to specify the name of the code
    segment regardless of the code model used.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson