KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Article: Q67004
Product(s): See article
Version(s): 5.10 5.11
Operating System(s): OS/2
Keyword(s): ENDUSER | buglist5.10 buglist5.11 | mspl13_basic
Last Modified: 4-DEC-1990

The code sample below produces the following error when compiled and
linked with the following switches:

cl /c /Gs /Alfu /ML foo.c

link foo.obj, foo.dll,,, foo.def;

Error
-----

   L2002: fix-up overflow at 2 in segment FOO_TEXT
    frm seg _DATA, tgt seg _DATA, tgt offset 0

This error is produced when creating a dynamic link library and
specifying _loadds on function entry (either with the /Au switch or
the _loadds keyword). If each segment that comprises the default data
segment is of zero length, the linker will return this error. In
earlier linkers, the error wasn't generated.

The following are three possible workarounds:

1. If the function does not contain any static data, compile with the
   option /Aw (DS not reloaded on function entry) and/or remove the
   _loadds keyword from the function declaration.

2. Turn on stack checking (compile without /Gs option).

3. Declare data so at least one of the segments in DGROUP is not zero
   length.

   a. For _DATA, declare initialized global or static data.

   b. For _CONST, declare a constant in the program.

   c. For _BSS, declare uninitialized static data.

Microsoft has confirmed this to be a problem in versions 5.10 and
5.11. We are researching this problem and will post new information
here as it becomes available.

Sample Code
-----------

void foo(int i)
{
   char c;

   c=i;
}

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.