a.out.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. // TODO rename
  10. typedef struct Exec Exec;
  11. struct Exec
  12. {
  13. int32_t magic; /* magic number */
  14. int32_t text; /* size of text segment */
  15. int32_t data; /* size of initialized data */
  16. int32_t bss; /* size of uninitialized data */
  17. int32_t syms; /* size of symbol table */
  18. int32_t entry; /* entry point */
  19. int32_t spsz; /* size of pc/sp offset table */
  20. int32_t pcsz; /* size of pc/line number table */
  21. };
  22. #define HDR_MAGIC 0x00008000 /* header expansion */
  23. #define _MAGIC(f, b) ((f)|((((4*(b))+0)*(b))+7))
  24. #define A_MAGIC _MAGIC(0, 8) /* 68020 (retired) */
  25. #define I_MAGIC _MAGIC(0, 11) /* intel 386 */
  26. #define J_MAGIC _MAGIC(0, 12) /* intel 960 (retired) */
  27. #define K_MAGIC _MAGIC(0, 13) /* sparc */
  28. #define V_MAGIC _MAGIC(0, 16) /* mips 3000 BE */
  29. #define X_MAGIC _MAGIC(0, 17) /* att dsp 3210 (retired) */
  30. #define M_MAGIC _MAGIC(0, 18) /* mips 4000 BE */
  31. #define D_MAGIC _MAGIC(0, 19) /* amd 29000 (retired) */
  32. #define E_MAGIC _MAGIC(0, 20) /* arm */
  33. #define Q_MAGIC _MAGIC(0, 21) /* powerpc */
  34. #define N_MAGIC _MAGIC(0, 22) /* mips 4000 LE */
  35. #define L_MAGIC _MAGIC(0, 23) /* dec alpha (retired) */
  36. #define P_MAGIC _MAGIC(0, 24) /* mips 3000 LE */
  37. #define U_MAGIC _MAGIC(0, 25) /* sparc64 (retired) */
  38. #define S_MAGIC _MAGIC(HDR_MAGIC, 26) /* amd64 */
  39. #define T_MAGIC _MAGIC(HDR_MAGIC, 27) /* powerpc64 */
  40. #define R_MAGIC _MAGIC(HDR_MAGIC, 28) /* arm64 */
  41. #define MIN_MAGIC 8
  42. #define MAX_MAGIC 28 /* <= 90 */
  43. #define DYN_MAGIC 0x80000000 /* dlm */
  44. typedef struct Sym Sym;
  45. struct Sym
  46. {
  47. int64_t value;
  48. //uint sig;
  49. char type;
  50. char *name;
  51. uint8_t binding;
  52. uint8_t symtype;
  53. };