LINK Fails to Generate L2041 Error with /NOD and /DOSSEG

ID Number: Q70360

3.x 4.0x 4.10 5.0x 5.10 5.11 5.13 | 5.0x 5.10 5.11 5.13

MS-DOS | OS/2

buglist5.10 buglist5.11 buglist5.13

Summary:

When the combined size of the stack and DGROUP data is too large, LINK

usually generates an "L2041: stack plus data exceeds 64K" error

message, but this message will not be generated if the /DOSSEG switch

is not enabled. With Microsoft high-level languages, the /DOSSEG

switch is automatically enabled by a special object module in the

run-time libraries, and it may also be enabled by using the .DOSSEG

directive in MASM or by specifying /DOSSEG on the LINK command line.

If /NOD is specified to LINK and no run-time libraries are specified,

then /DOSSEG is not automatically enabled; therefore, no L2041 error

will be displayed. In this case, explicitly adding the /DOSSEG option

to the LINK command line along with /NOD should cause the L2041 error

to be generated, but in this particular situation the L2041 error is

not generated as it should be.

Microsoft has confirmed this to be a problem in LINK versions 3.65,

3.69, 4.06, 4.07, 4.10, 5.01.20, 5.01.21, 5.03, 5.05, 5.10, 5.11, and

5.13. We are researching this problem and will post new information

here as it becomes available.

More Information:

The sample C code below may be used to illustrate this problem. The

following three LINK command lines demonstrate the three possible

scenarios and the resulting error messages:

1. link test;

LINK : fatal error L2041: stack plus data exceed 64k

2. link /NOD test;

LINK : warning L4021: no stack segment

(unresolved externals)

LINK : warning L4038: program has no starting address

Note: L2041 is not generated (as expected).

3. link /NOD /DOSSEG test;

LINK : warning L4021: no stack segment

(unresolved externals)

LINK : warning L4038: program has no starting address

Note: Same errors as above with /NOD alone. Link error L2041 should

be generated when the /DOSSEG switch is specified.

Sample Code

-----------

/* Compile options needed: /c

*/

unsigned char a[30*1024] = {0}; /* 30k */

unsigned char b[30*1024] = {0}; /* 30k */

unsigned char c[10*1024]; /* 10k */

/* Total = 70k */

void main(void)

{ }

Additional keywords: buglist3.65 buglist3.69 buglist4.06 buglist4.07

buglist4.10 buglist5.01 buglist5.03 buglist5.05 buglist501.20

buglist501.21