Go to the source code of this file.
Data Structures | |
| struct | COFF_AOUTHDR |
| ********************* AOUT "OPTIONAL HEADER" ********************* More... | |
| struct | COFF_scnhdr |
| ********************* SECTION HEADER ********************* More... | |
| struct | COFF_slib |
| struct | COFF_lineno |
| ********************* LINE NUMBERS ********************* More... | |
| struct | COFF_syment |
| union | COFF_auxent |
| struct | COFF_reloc |
| ********************* RELOCATION DIRECTIVES ********************* More... | |
Defines | |
| #define | E_SYMNMLEN 8 |
| Number of characters in a symbol name. | |
| #define | E_FILNMLEN 14 |
| Number of characters in a file name. | |
| #define | E_DIMNUM 4 |
| Number of array dimensions in auxiliary entry. | |
| #define | COFF_SHORT_L(ps) |
| Load a short int from the following tables with little-endian formats. | |
| #define | COFF_LONG_L(ps) |
| Load a long int from the following tables with little-endian formats. | |
| #define | COFF_SHORT_H(ps) |
| Load a short int from the following tables with big-endian formats. | |
| #define | COFF_LONG_H(ps) |
| Load a long int from the following tables with big-endian formats. | |
| #define | COFF_LONG(v) COFF_LONG_L(v) |
| #define | COFF_SHORT(v) COFF_SHORT_L(v) |
| #define | COFF_F_RELFLG 0000001 |
| #define | COFF_F_EXEC 0000002 |
| #define | COFF_F_LNNO 0000004 |
| #define | COFF_F_LSYMS 0000010 |
| #define | COFF_F_MINMAL 0000020 |
| #define | COFF_F_UPDATE 0000040 |
| #define | COFF_F_SWABD 0000100 |
| #define | COFF_F_AR16WR 0000200 |
| #define | COFF_F_AR32WR 0000400 |
| #define | COFF_F_AR32W 0001000 |
| #define | COFF_F_PATCH 0002000 |
| #define | COFF_F_NODF 0002000 |
| #define | COFF_I386MAGIC 0x14c |
| Linux's system Perhaps, someday, these formats may be used. | |
| #define | COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC) |
| #define | COFF_FILHDR struct COFF_filehdr |
| #define | COFF_FILHSZ sizeof(COFF_FILHDR) |
| #define | COFF_AOUTSZ (sizeof(COFF_AOUTHDR)) |
| #define | COFF_STMAGIC 0401 |
| #define | COFF_OMAGIC 0404 |
| #define | COFF_JMAGIC 0407 |
| dirty text and data image, can't share | |
| #define | COFF_DMAGIC 0410 |
| dirty text segment, data aligned | |
| #define | COFF_ZMAGIC 0413 |
| The proper magic number for executabls. | |
| #define | COFF_SHMAGIC 0443 |
| shared library header | |
| #define | COFF_SCNHDR struct COFF_scnhdr |
| #define | COFF_SCNHSZ sizeof(COFF_SCNHDR) |
| #define | COFF_TEXT ".text" |
| #define | COFF_DATA ".data" |
| #define | COFF_BSS ".bss" |
| #define | COFF_COMMENT ".comment" |
| #define | COFF_LIB ".lib" |
| #define | COFF_SECT_TEXT 0 |
| Section for instruction code. | |
| #define | COFF_SECT_DATA 1 |
| Section for initialized globals. | |
| #define | COFF_SECT_BSS 2 |
| Section for un-initialized globals. | |
| #define | COFF_SECT_REQD 3 |
| Minimum number of sections for good file. | |
| #define | COFF_STYP_REG 0x00 |
| regular segment | |
| #define | COFF_STYP_DSECT 0x01 |
| dummy segment | |
| #define | COFF_STYP_NOLOAD 0x02 |
| no-load segment | |
| #define | COFF_STYP_GROUP 0x04 |
| group segment | |
| #define | COFF_STYP_PAD 0x08 |
| .pad segment | |
| #define | COFF_STYP_COPY 0x10 |
| copy section | |
| #define | COFF_STYP_TEXT 0x20 |
| .text segment | |
| #define | COFF_STYP_DATA 0x40 |
| .data segment | |
| #define | COFF_STYP_BSS 0x80 |
| .bss segment | |
| #define | COFF_STYP_INFO 0x200 |
| .comment section | |
| #define | COFF_STYP_OVER 0x400 |
| overlay section | |
| #define | COFF_STYP_LIB 0x800 |
| library section | |
| #define | COFF_SLIBHD struct COFF_slib |
| #define | COFF_SLIBSZ sizeof(COFF_SLIBHD) |
| #define | COFF_LINENO struct COFF_lineno |
| #define | COFF_LINESZ 6 |
| #define | COFF_E_SYMNMLEN 8 |
| ********************* SYMBOLS ********************* # characters in a short symbol name | |
| #define | COFF_E_FILNMLEN 14 |
| # characters in a file name | |
| #define | COFF_E_DIMNUM 4 |
| # array dimensions in auxiliary entry | |
| #define | COFF_N_BTMASK (0xf) |
| Mask for important class bits. | |
| #define | COFF_N_TMASK (0x30) |
| Mask for important type bits. | |
| #define | COFF_N_BTSHFT (4) |
| # bits to shift class field | |
| #define | COFF_N_TSHIFT (2) |
| # bits to shift type field | |
| #define | COFF_SYMENT struct COFF_syment |
| #define | COFF_SYMESZ 18 |
| #define | COFF_AUXENT union COFF_auxent |
| #define | COFF_AUXESZ 18 |
| #define | COFF_ETEXT "etext" |
| #define | COFF_RELOC struct COFF_reloc |
| #define | COFF_RELSZ 10 |
| #define | COFF_DEF_DATA_SECTION_ALIGNMENT 4 |
| #define | COFF_DEF_BSS_SECTION_ALIGNMENT 4 |
| #define | COFF_DEF_TEXT_SECTION_ALIGNMENT 4 |
| #define | COFF_DEF_SECTION_ALIGNMENT 4 |
| For new sections we havn't heard of before. | |
| #define COFF_AOUTSZ (sizeof(COFF_AOUTHDR)) |
| #define COFF_AUXENT union COFF_auxent |
| #define COFF_DEF_SECTION_ALIGNMENT 4 |
| #define COFF_E_DIMNUM 4 |
| #define COFF_E_SYMNMLEN 8 |
| #define COFF_F_RELFLG 0000001 |
coff information for Intel 386/486.
/********************* FILE HEADER *********************
struct COFF_filehdr { char f_magic[2]; ///< magic number char f_nscns[2]; ///< number of sections char f_timdat[4]; ///< time & date stamp char f_symptr[4]; ///< file pointer to symtab char f_nsyms[4]; ///< number of symtab entries char f_opthdr[2]; ///< sizeof(optional hdr) char f_flags[2]; ///< flags };
/**
Bits for f_flags:
F_RELFLG relocation info stripped from file F_EXEC file is executable (i.e. no unresolved externel references) F_LNNO line nunbers stripped from file F_LSYMS local symbols stripped from file F_MINMAL this is a minimal object file (".m") output of fextract F_UPDATE this is a fully bound update file, output of ogen F_SWABD this file has had its bytes swabbed (in names) F_AR16WR this file has the byte ordering of an AR16WR (e.g. 11/70) machine F_AR32WR this file has the byte ordering of an AR32WR machine (e.g. vax and iNTEL 386) F_AR32W this file has the byte ordering of an AR32W machine (e.g. 3b,maxi) F_PATCH file contains "patch" list in optional header F_NODF (minimal file only) no decision functions for replaced functions
| #define COFF_I386BADMAG | ( | x | ) | (COFF_SHORT((x).f_magic) != COFF_I386MAGIC) |
| #define COFF_I386MAGIC 0x14c |
| #define COFF_JMAGIC 0407 |
| #define COFF_LINENO struct COFF_lineno |
| #define COFF_LONG | ( | v | ) | COFF_LONG_L(v) |
| #define COFF_LONG_H | ( | ps | ) |
Value:
(((long)(((unsigned long)((unsigned char)ps[0])<<24) |\ ((unsigned long)((unsigned char)ps[1])<<16) |\ ((unsigned long)((unsigned char)ps[2])<<8) |\ ((unsigned long)((unsigned char)ps[3])))))
| #define COFF_LONG_L | ( | ps | ) |
Value:
(((long)(((unsigned long)((unsigned char)ps[3])<<24) |\ ((unsigned long)((unsigned char)ps[2])<<16) |\ ((unsigned long)((unsigned char)ps[1])<<8) |\ ((unsigned long)((unsigned char)ps[0])))))
| #define COFF_RELOC struct COFF_reloc |
| #define COFF_SCNHDR struct COFF_scnhdr |
| #define COFF_SECT_REQD 3 |
| #define COFF_SHORT_H | ( | ps | ) |
| #define COFF_SHORT_L | ( | ps | ) |
Value:
((short)(((unsigned short)((unsigned char)ps[1])<<8)|\ ((unsigned short)((unsigned char)ps[0]))))
These defines are byte order independant. There is no alignment of fields permitted in the structures. Therefore they are declared as characters and the values loaded from the character positions. It also makes it nice to have it "endian" independant.
| #define COFF_SYMENT struct COFF_syment |
| #define COFF_ZMAGIC 0413 |
| #define E_DIMNUM 4 |
| #define E_SYMNMLEN 8 |
Number of characters in a symbol name.
This file is derrived from the GAS 2.1.4 assembler control file. The GAS product is under the GNU Public License, version 2 or later. As such, this file is also uder that license.
If the file format changes in the COFF object, this file should be subsequently updated to reflect the changes.
The actual loader module only uses a few of these structures. The full set is documented here because I received the full set. If you wish more information about COFF, then O'Rielly has a very excellent book.
1.4.6-5