Microsoft KB Archive/80437

= Description of the Map File Microsoft LINK Creates =

Article ID: 80437

Article Last Modified on 10/23/2003

-

APPLIES TO


 * Microsoft LINK for MS-DOS 3.x
 * Microsoft LINK for MS-DOS 4.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 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 Q80437



SUMMARY
When the Microsoft LINK command line includes the /MAP option, the field specifies the name for the map file. The default map file name is the base name of the executable file with the extension .MAP. To suppress creating a map file, set the map filename to NUL.

The map file contains the following contents:
 * For each logical segment, the Start address, Stop address, Length, Name, and Class
 * Groups
 * Program Entry point

When the LINK command line includes the /MAP:ADDRESS option, the map file also contains the following:
 * Public symbols by Value

When the LINK command line includes the /MAP:FULL option, the map file contains all the fields provided by the /MAP:ADDRESS option with the addition of the following:
 * Contributions of each object file to a segment (this information follows the description of each logical segment)
 * Public symbols by Name
 * Undecorated names of C++ symbols

The /LI[NENUMBERS] option adds to the map file source-file link numbers and the address associated with each line.



MORE INFORMATION
In applications developed for MS-DOS or OS/2 in real mode, the Start and Stop addresses are 20-bit hexadecimal addresses relative to the application's load image. In applications developed for Microsoft Windows or OS/2 in protected mode, the Start and Stop addresses are 32-bit addresses in segment:offset notation. In OS/2, the segment value represents a selector in the descriptor table that contains information about the segments.

A group is a collection of logical segments that total not more than 64K in size. To create a group, use the GROUP assembler directive. Microsoft language products create the group DGROUP that contains the _NULL, _DATA, CONST, C_COMMON, _BSS, and STACK segments, among others. For additional information, please see the following article(s) in the Microsoft Knowledge Base:

48241 Relationship Between Map File and Physical Memory

If an MS-DOS program contains overlays, the map file divides the logical segment information into sections. The first section is labeled the &quot;Resident&quot; portion of the program, and each subsequent overlay has its own section labeled &quot;Overlay 1h,&quot; &quot;Overlay 2h,&quot; and so on. In addition, each public symbol is assigned one of the following attributes:

RES -- The symbol resides in the resident portion

OVL -- The symbol resides in an overlay

ABS -- The symbol represents a constant value

In applications developed for Windows or OS/2 protected mode, public symbols might have one of the following attributes:

EXP -- If the symbol was exported

IMP -- If the symbol was imported

The program entry point is the location where the operating system begins executing the program. The reported address is an offset from the lowest memory address at which program code is loaded. The application loader places this address into CS:IP when the application begins execution. Applications developed with Microsoft language products require specific initialization code; the entry point for each program is the symbol __astart.

In an application developed for MS-DOS, the start segment is the base address of the program segment prefix (PSP) plus the size of the PSP (100h bytes). The loader places this value into the DS and ES registers when the application begins execution. To retrieve this segment address in C, declare the following variable: extern unsigned _psp; The absolute starting address is the program entry point, plus the base address of the PSP, plus the size of the PSP. In addition, to determine the absolute address of any symbol, add its relative address given in the map file to the base address of the PSP plus the size of the PSP.

In a protected-mode environment, there is no reliable method to determine the address of a symbol because segments may move in memory or be discarded.

Additional query words: kbinf 5.01.20 5.01.21 5.02 5.03 5.05 5.10 5.11 5.13 5.15 5.20 5.30 5.31.009 5.50 no32bit

Keywords: kb16bitonly KB80437

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.