Line 9... |
Line 9... |
The actual loader module only uses a few of these structures. The full
|
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
|
set is documented here because I received the full set. If you wish
|
more information about COFF, then O'Reilly has a very excellent book.
|
more information about COFF, then O'Reilly has a very excellent book.
|
*/
|
*/
|
|
|
|
|
#define E_SYMNMLEN 8 /* Number of characters in a symbol name */
|
#define E_SYMNMLEN 8 /* Number of characters in a symbol name */
|
#define E_FILNMLEN 14 /* Number of characters in a file name */
|
#define E_FILNMLEN 14 /* Number of characters in a file name */
|
#define E_DIMNUM 4 /* Number of array dimensions in auxiliary entry */
|
#define E_DIMNUM 4 /* Number of array dimensions in auxiliary entry */
|
|
|
/*
|
/*
|
Line 62... |
Line 61... |
#define COFF_LONG(v) COFF_LONG_L(v)
|
#define COFF_LONG(v) COFF_LONG_L(v)
|
#define COFF_SHORT(v) COFF_SHORT_L(v)
|
#define COFF_SHORT(v) COFF_SHORT_L(v)
|
|
|
/*** coff information for Intel 386/486. */
|
/*** coff information for Intel 386/486. */
|
|
|
|
|
/*
|
/*
|
* Bits for f_flags:
|
* Bits for f_flags:
|
*
|
*
|
* F_RELFLG relocation info stripped from file
|
* F_RELFLG relocation info stripped from file
|
* F_EXEC file is executable (i.e. no unresolved external
|
* F_EXEC file is executable (i.e. no unresolved external
|
Line 112... |
Line 110... |
#define COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC)
|
#define COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC)
|
#endif
|
#endif
|
|
|
/********************** FILE HEADER **********************/
|
/********************** FILE HEADER **********************/
|
|
|
struct coff_filehdr
|
struct coff_filehdr {
|
{
|
|
char f_magic[2]; // magic number
|
char f_magic[2]; // magic number
|
char f_nscns[2]; // number of sections
|
char f_nscns[2]; // number of sections
|
char f_timdat[4]; // time & date stamp
|
char f_timdat[4]; // time & date stamp
|
char f_symptr[4]; // file pointer to symtab
|
char f_symptr[4]; // file pointer to symtab
|
char f_nsyms[4]; // number of symtab entries
|
char f_nsyms[4]; // number of symtab entries
|
Line 140... |
Line 137... |
Use the 'f_opthdr' field in the main coff header for the size of the
|
Use the 'f_opthdr' field in the main coff header for the size of the
|
structure actually written to the file!!
|
structure actually written to the file!!
|
*/
|
*/
|
|
|
//typedef struct
|
//typedef struct
|
struct COFF_aouthdr
|
struct COFF_aouthdr {
|
{
|
|
char magic[2]; /* type of file */
|
char magic[2]; /* type of file */
|
char vstamp[2]; /* version stamp */
|
char vstamp[2]; /* version stamp */
|
char tsize[4]; /* text size in bytes, padded to FW bdry */
|
char tsize[4]; /* text size in bytes, padded to FW bdry */
|
char dsize[4]; /* initialized data " " */
|
char dsize[4]; /* initialized data " " */
|
char bsize[4]; /* uninitialized data " " */
|
char bsize[4]; /* uninitialized data " " */
|
Line 341... |
Line 337... |
|
|
/*
|
/*
|
* All symbols and sections have the following definition
|
* All symbols and sections have the following definition
|
*/
|
*/
|
|
|
struct COFF_syment
|
struct COFF_syment {
|
{
|
|
union {
|
union {
|
char e_name[E_SYMNMLEN]; /* Symbol name (first 8 characters) */
|
char e_name[E_SYMNMLEN]; /* Symbol name (first 8 characters) */
|
struct {
|
struct {
|
char e_zeroes[4]; /* Leading zeros */
|
char e_zeroes[4]; /* Leading zeros */
|
char e_offset[4]; /* Offset if this is a header section */
|
char e_offset[4]; /* Offset if this is a header section */
|