COHERENT manpages
This page displays the COHERENT manpage for coff.h [Format for COFF objects].
List of available manpages
Index
coff.h -- Header File Format for COFF objects #include <coff.h> coff.h describes the Common Object File Format (COFF), which is the object format used by COHERENT 386. What Is COFF? In brief, COFF is the UNIX System V standard for file formats. It defines the formats for relocatable object modules, for executable files, and for archives. A COFF file is built around three sections, or segments: text This holds executable machine code. It is write protected -- the operating system is forbidden to overwrite it. (This is why operating systems that use COFF or similar formats are said to run in ``protected mode.'') data This holds initialized data, that is, the data that the program finds when it begins execution. The program can read and write into this segment. bss This segment holds unitialized data. It is simply a mass of space that is initialized to zeroes. It is contiguous with the data segment. The term bss from the old IBM mainframe days, and stands for ``block started by symbol''. Not all segments have to be included in every COFF file. Further, some implementations of COFF define their own segments that manipulate special features of the operating system or hardware. The following describes the structure of a COFF file. The areas within the file are described in the order in which they appear. 1. file header This holds information set when the file was created, such as the date and time it was created, the number of segments in the file, a pointer to the symbol table, and status flags. 2. optional header This gives information set at run-time, such as the address of the program entry point, and the size of the code and data segments. 3. segment headers The next area holds a header for each segment in the file. Each header describes its segment's characteristics and contains pointers to the segment's contents, relocation information, line-number information, and other useful addresses. 4. segment contents The next area holds the contents of the segments used in this file. 5. relocation information The fifth area gives relocation information, one set of information for each segment in the file. The linker ld uses this information to generate the executable file at link time. 6. line-number information This area holds debug information, one set of information for each segment. This area is optional. 7. symbol table This area holds information used by both the linker and the debugger. 8. string table This table holds very long names of variables. Most of this information is irrelevant to the average user, or even the average developer of software. To the average user, COFF is ``a machine that would go of itself''; you can run or compile programs without worrying what the linker puts where, or why. These details, however, can be very important if you are writing tools that manipulate the internals of files, such as archivers or debuggers. If you need detailed information on COFF and how to manipulate it, see Understanding and Using COFF (citation appears below). For more information on how the COFF format affects COHERENT's language tools, see the Lexicon articles for ar, as, cc, db, and ld. See Also ar, as, cc, cdmp, coffnlist(), file formats, header files, ld Gircys, G.R.: Understanding and Using COFF. Sebastopol, Calif., O'Reilly & Associates, Inc., 1988.