COFF

From Wikipedia, the free encyclopedia

COFF
File extension: none, .o
Developed by: AT&T
Type of format: Binary, executable, object, shared libraries
Extended to: XCOFF, ECOFF, Portable Executable

The Common Object File Format (COFF) is a file format for executables, object code, and, in later systems, shared libraries; it was introduced in Unix System V on non-VAX 32-bit platforms such as the 3B20, and was later used by Microsoft as the basis of the Portable Executable format for Windows NT. It was superseded by the more powerful ELF in System V Release 4, but as of 2006, its derivative Portable Executable is still used in Windows.

The original Unix object file format a.out is a very simple design, and was too limited to effectively handle the additions of SVR3, such as shared libraries. Also, a.out does not define a symbolic debug data format; stabs works by encoding debug info into special symbols in the symbol table.

COFF's main improvement was the introduction of multiple named sections in the object file. Different object files could have different numbers and types of sections. In addition, a debug data format was defined.

However, the COFF design soon turned out also to be too limited; there was a limit on the maximum number of sections, a limit on the length of section names, and so forth. In addition, the debug info was really only capable of supporting C debugging; for instance, C++ had additional constructs that had no way to be represented, and the debug info was not designed to be extensible. IBM solved this in AIX with the XCOFF format, MIPS and others used ECOFF, and GNU tools adopted the workaround of encoding stabs info, which was extensible, into special COFF sections in a technique known as stabs-in-coff.

[edit] Relative Virtual Address

When a COFF file is generated, it is not usually known where in memory it will be loaded. The virtual address where the first byte of the file will be loaded is called image base address. The rest of the file is not necessarily loaded in a contiguous block, but in different sections.

Relative Virtual Addresses (RVAs) are not to be confused with standard virtual addresses. A relative virtual address is the virtual address of an object from the file once it is loaded into memory, minus the base address of the file image. If the file were to be mapped literally from disk to memory, the RVA would be the same that the offset into the file, but this is actually quite unusual.

Note that the RVA term is only used with objects in the image file. Once loaded into memory, the image base address is added, and ordinary VAs are used.

[edit] See also

[edit] External links

In other languages