1 typedef struct Exec Exec; 2 struct Exec 3 { 4 long magic; /* magic number */ 5 long text; /* size of text segment */ 6 long data; /* size of initialized data */ 7 long bss; /* size of uninitialized data */ 8 long syms; /* size of symbol table */ 9 long entry; /* entry point */ 10 long spsz; /* size of pc/sp offset table */ 11 long pcsz; /* size of pc/line number table */ 12 }; 13 14 #define HDR_MAGIC 0x00008000 /* header expansion */ 15 16 #define _MAGIC(f, b) ((f)|((((4*(b))+0)*(b))+7)) 17 #define A_MAGIC _MAGIC(0, 8) /* 68020 */ 18 #define I_MAGIC _MAGIC(0, 11) /* intel 386 */ 19 #define J_MAGIC _MAGIC(0, 12) /* intel 960 (retired) */ 20 #define K_MAGIC _MAGIC(0, 13) /* sparc */ 21 #define V_MAGIC _MAGIC(0, 16) /* mips 3000 BE */ 22 #define X_MAGIC _MAGIC(0, 17) /* att dsp 3210 (retired) */ 23 #define M_MAGIC _MAGIC(0, 18) /* mips 4000 BE */ 24 #define D_MAGIC _MAGIC(0, 19) /* amd 29000 (retired) */ 25 #define E_MAGIC _MAGIC(0, 20) /* arm */ 26 #define Q_MAGIC _MAGIC(0, 21) /* powerpc */ 27 #define N_MAGIC _MAGIC(0, 22) /* mips 4000 LE */ 28 #define L_MAGIC _MAGIC(0, 23) /* dec alpha (retired) */ 29 #define P_MAGIC _MAGIC(0, 24) /* mips 3000 LE */ 30 #define U_MAGIC _MAGIC(0, 25) /* sparc64 (retired) */ 31 #define S_MAGIC _MAGIC(HDR_MAGIC, 26) /* amd64 */ 32 #define T_MAGIC _MAGIC(HDR_MAGIC, 27) /* powerpc64 */ 33 #define R_MAGIC _MAGIC(HDR_MAGIC, 28) /* arm64 */ 34 #define Z_MAGIC _MAGIC(0, 29) /* riscv */ 35 #define Y_MAGIC _MAGIC(0, 30) /* riscv64 */ 36 37 #define MIN_MAGIC 8 38 #define MAX_MAGIC 30 /* <= 90 */ 39 40 #define DYN_MAGIC 0x80000000 /* dlm */ 41 42 typedef struct Sym Sym; 43 struct Sym 44 { 45 vlong value; 46 uint sig; 47 char type; 48 char *name; 49 }; 50