69 lines
1.2 KiB
C
69 lines
1.2 KiB
C
|
#ifndef LIBTCC_OBJECT_COFF_H
|
||
|
# define LIBTCC_OBJECT_COFF_H 1
|
||
|
|
||
|
# include <stdint.h>
|
||
|
|
||
|
/**
|
||
|
* @defgroup object_coff COFF Object
|
||
|
* @ingroup object
|
||
|
* @{
|
||
|
*/
|
||
|
|
||
|
# define COFF_MAGIC 0x14c
|
||
|
|
||
|
typedef struct COFFFileHeader {
|
||
|
uint16_t magic;
|
||
|
uint16_t nscns;
|
||
|
int32_t timdat;
|
||
|
int32_t nsyms;
|
||
|
uint16_t opthdr;
|
||
|
uint16_t flags;
|
||
|
} COFFFileHeader;
|
||
|
|
||
|
# define COFF_FILHSZ sizeof(COFFFileHeader)
|
||
|
|
||
|
# define COFF_F_RELFLG 0x0001
|
||
|
# define COFF_F_EXEC 0x0002
|
||
|
# define COFF_F_LNNO 0x0004
|
||
|
# define COFF_F_LSYMS 0x0008
|
||
|
# define COFF_F_LITTLE 0x0100
|
||
|
# define COFF_F_BIG 0x0200
|
||
|
# define COFF_F_SYMMERGE 0x1000
|
||
|
|
||
|
typedef struct AOutHeader {
|
||
|
int16_t magic;
|
||
|
int16_t vstamp;
|
||
|
int32_t tsize;
|
||
|
int32_t dsize;
|
||
|
int32_t bsize;
|
||
|
int32_t entry;
|
||
|
int32_t text_start;
|
||
|
int32_t data_start;
|
||
|
} AOutHeader;
|
||
|
|
||
|
# define AOUT_HSZ sizeof(AOutHeader)
|
||
|
|
||
|
# define AOUT_OMAGIC 0404
|
||
|
# define AOUT_NMAGIC 0410
|
||
|
# define AOUT_ZMAGIC 0413
|
||
|
# define AOUT_STMAGIC 0401
|
||
|
# define AOUT_SHMAGIC 0443
|
||
|
|
||
|
typedef struct COFFSectionHeader {
|
||
|
int8_t name[8];
|
||
|
int32_t paddr;
|
||
|
int32_t vaddr;
|
||
|
int32_t size;
|
||
|
int32_t scnptr;
|
||
|
int32_t relptr;
|
||
|
int32_t lnnoptr;
|
||
|
uint16_t nreloc;
|
||
|
uint16_t nlnno;
|
||
|
int32_t flags;
|
||
|
} COFFSectionHeader;
|
||
|
|
||
|
/**
|
||
|
* @}
|
||
|
*/
|
||
|
|
||
|
#endif /* !LIBTCC_COFF_H */
|