/* hunk.h 12 Mar 86 edb */ /* * defines for understanding object & load module formats * Copyright 1986 Eric D. Black */ /* * Hunks are blocks of code or data or bss reservations, possibly with * blocks of relocation information and symbols, with optional names. * Object modules are output of compilers (e.g. *.o files), load modules * are similar with all external references resolved. The program loader * uses hunk relocation information to relocate pieces of code and/or * data when loaded into memory for execution. * * Each hunk consists of some number of hunk records, each of which * consists of a longword hunk type code, a longword count of data words, * and that number of data words. */ /* * Hunk type codes (decimal, hex equivalent in comments) */ #define HUNK_UNIT 999 /* 3e7 Start of program unit */ #define HUNK_NAME 1000 /* 3e8 Name of a hunk */ #define HUNK_CODE 1001 /* 3e9 Code segment */ #define HUNK_DATA 1002 /* 3ea Initialized Data segment */ #define HUNK_BSS 1003 /* 3eb Unitialized Data segment */ #define HUNK_RELOC32 1004 /* 3ec 32-bit relocation list */ #define HUNK_RELOC16 1005 /* 3ed 16-bit PC-relative relocation info */ #define HUNK_RELOC8 1006 /* 3ee 8-bit PC-relative relocation info */ #define HUNK_EXT 1007 /* 3ef External symbol info */ #define HUNK_SYMBOL 1008 /* 3f0 Symbol table info */ #define HUNK_DEBUG 1009 /* 3f1 Debug data */ #define HUNK_END 1010 /* 3f2 End of this hunk */ #define HUNK_HEADER 1011 /* 3f3 hunk summary info for loader */ #define HUNK_OVERLAY 1013 /* 3f5 overlay table info */ #define HUNK_BREAK 1014 /* 3f6 end of overlay node */ /* * External symbol info * Each HUNK_EXT record is a null-terminated list of symbol data units; * each symbol data unit consists of a type byte, 3-byte symbol length * in longwords, symbol name (null-padded if necessary), and data word(s). * EXTSYMB has null-terminated list of symbol data units, * EXTDEF, EXTABS, EXTRES have 1 longword of data, * EXTREF32, EXTREF16, EXTREF8 have longword count and n longwords of data, * EXTCOMMON also has longword size of common block before the data count. */ #define HUNK_EXTSYMB 0 /* symbol table */ #define HUNK_EXTDEF 1 /* relocatable definition */ #define HUNK_EXTABS 2 /* absolute definition */ #define HUNK_EXTRES 3 /* resident library definition */ #define HUNK_EXTREF32 129 /* 32-bit reference to symbol */ #define HUNK_EXTCOMMON 130 /* 32-bit reference to COMMON */ #define HUNK_EXTREF16 131 /* 16-bit reference to symbol */ #define HUNK_EXTREF8 132 /* 8-bit reference to symbol */