blob-object/subprojects/blob-object-coff/src/coff.h

52 lines
1.5 KiB
C

#ifndef _COFF_H
#define _COFF_H
#include <stdint.h>
struct coff_header {
uint16_t magic;
uint16_t nscns; /* number of sections */
uint32_t timdat; /* time and date stamp */
uint32_t symptr; /* file offset of symbol table */
uint32_t nsyms; /* number of symbols */
uint16_t opthdr; /* size of optional header */
uint16_t flags; /* flags */
};
#define MAGIC_AMD64 0x8664
struct coff_section {
char name[8]; /* section name */
uint32_t paddr; /* physical address */
uint32_t vaddr; /* virtual address */
uint32_t size; /* section size in bytes */
uint32_t scnptr; /* file offset to section data */
uint32_t relptr; /* file offset to relocation table */
uint32_t lnnoptr; /* file offset to line number table */
uint16_t nreloc; /* number of relocation table entries */
uint16_t nlnno; /* number of line number table entries */
uint32_t flags; /* section flags */
};
/* section types */
#define STYP_TEXT 0x0020
#define STYP_DATA 0x0040
#define STYP_BSS 0x0080
struct coff_symtab {
uint32_t zeroes; /* must be zero; used as part of a feature we don't care about */
uint32_t name; /* offset into the string table */
uint32_t value;
uint16_t scnum; /* section number */
uint16_t type;
uint8_t sclass; /* storage class */
uint8_t numaux; /* auxiliary count */
};
#define COFF_SYMTAB_SIZE 18
/* symbol storage classes */
#define C_EXT 2 /* global symbol storage class */
#define C_STAT 3 /* static symbol storage class */
#endif /* _COFF_H */