Why Code Segment Contents May Begin at Offset 16 (84734)



The information in this article applies to:

  • Microsoft LINK for MS-DOS 3.x
  • Microsoft LINK for MS-DOS 5.0x
  • Microsoft LINK for MS-DOS 5.1x
  • Microsoft LINK for MS-DOS 5.2
  • Microsoft LINK for MS-DOS 5.3x
  • Microsoft LINK for MS-DOS 5.5
  • Microsoft LINK for MS-DOS 5.6
  • Microsoft LINK for OS/2 5.0x
  • Microsoft LINK for OS/2 5.1
  • Microsoft LINK for OS/2 5.11
  • Microsoft LINK for OS/2 5.13
  • Microsoft LINK for OS/2 5.15

This article was previously published under Q84734

SUMMARY

Microsoft LINK inserts 16 null bytes at the beginning of the _TEXT segment if the following conditions are true:
  • DOSSEG ordering is specified
  • the LINK command line does not specify /NON[ULLSDOSSEG]
  • the _TEXT segment exists

MORE INFORMATION

LINK inserts 16 null bytes at the beginning of the _TEXT segment to provide support for the signal() function; 16 bytes provide space for its flags.

In DOSSEG ordering, segments appear in the file in the following order:

  1. All segments that have a class name that ends in "CODE"
  2. Data segments other than those in DGROUP
  3. DGROUP data segments, in the following order:

    1. Any data segments of class 'BEGDATA'
    2. Any data segments not of class 'BEGDATA,' 'BSS,' or 'STACK'
    3. Data segments of class 'BSS'
    4. Data segments of class 'STACK'
The run-time libraries distributed with Microsoft language products contain a special object module record that enables DOSSEG segment ordering. To specify DOSSEG ordering from the LINK command line, specify the /DOSSEG option.

In an application developed with the Microsoft Macro Assembler (MASM), the .MODEL directive requests DOSSEG statement ordering. However, LINK places 16 null bytes at the beginning of the _TEXT segment only if either the source code contains the .DOSSEG directive or if the LINK command line includes the /DOSSEG option.

The /NONULLSDOSSEG option instructs LINK to place segments into the DOSSEG ordering and to suppress generating the 16 null bytes at the beginning of the _TEXT segment.

Modification Type:MajorLast Reviewed:10/23/2003
Keywords:kb16bitonly KB84734