a.out.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef __SPARC_A_OUT_H__
  2. #define __SPARC_A_OUT_H__
  3. #define SPARC_PGSIZE 0x2000 /* Thanks to the sun4 architecture... */
  4. #define SEGMENT_SIZE SPARC_PGSIZE /* whee... */
  5. #ifndef __ASSEMBLY__
  6. struct exec {
  7. unsigned char a_dynamic:1; /* A __DYNAMIC is in this image */
  8. unsigned char a_toolversion:7;
  9. unsigned char a_machtype;
  10. unsigned short a_info;
  11. unsigned int a_text; /* length of text, in bytes */
  12. unsigned int a_data; /* length of data, in bytes */
  13. unsigned int a_bss; /* length of bss, in bytes */
  14. unsigned int a_syms; /* length of symbol table, in bytes */
  15. unsigned int a_entry; /* where program begins */
  16. unsigned int a_trsize;
  17. unsigned int a_drsize;
  18. };
  19. #endif /* !__ASSEMBLY__ */
  20. /* Where in the file does the text information begin? */
  21. #define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? 0 : sizeof (struct exec))
  22. /* Where do the Symbols start? */
  23. #define N_SYMOFF(x) (N_TXTOFF(x) + (x).a_text + \
  24. (x).a_data + (x).a_trsize + \
  25. (x).a_drsize)
  26. /* Where does text segment go in memory after being loaded? */
  27. #define N_TXTADDR(x) (unsigned long)(((N_MAGIC(x) == ZMAGIC) && \
  28. ((x).a_entry < SPARC_PGSIZE)) ? \
  29. 0 : SPARC_PGSIZE)
  30. /* And same for the data segment.. */
  31. #define N_DATADDR(x) (N_MAGIC(x)==OMAGIC ? \
  32. (N_TXTADDR(x) + (x).a_text) \
  33. : (unsigned long) (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
  34. #define N_TRSIZE(a) ((a).a_trsize)
  35. #define N_DRSIZE(a) ((a).a_drsize)
  36. #define N_SYMSIZE(a) ((a).a_syms)
  37. #ifndef __ASSEMBLY__
  38. /*
  39. * Sparc relocation types
  40. */
  41. enum reloc_type
  42. {
  43. RELOC_8,
  44. RELOC_16,
  45. RELOC_32, /* simplest relocs */
  46. RELOC_DISP8,
  47. RELOC_DISP16,
  48. RELOC_DISP32, /* Disp's (pc-rel) */
  49. RELOC_WDISP30,
  50. RELOC_WDISP22, /* SR word disp's */
  51. RELOC_HI22,
  52. RELOC_22, /* SR 22-bit relocs */
  53. RELOC_13,
  54. RELOC_LO10, /* SR 13&10-bit relocs */
  55. RELOC_SFA_BASE,
  56. RELOC_SFA_OFF13, /* SR S.F.A. relocs */
  57. RELOC_BASE10,
  58. RELOC_BASE13,
  59. RELOC_BASE22, /* base_relative pic */
  60. RELOC_PC10,
  61. RELOC_PC22, /* special pc-rel pic */
  62. RELOC_JMP_TBL, /* jmp_tbl_rel in pic */
  63. RELOC_SEGOFF16, /* ShLib offset-in-seg */
  64. RELOC_GLOB_DAT,
  65. RELOC_JMP_SLOT,
  66. RELOC_RELATIVE /* rtld relocs */
  67. };
  68. /*
  69. * Format of a relocation datum.
  70. */
  71. struct relocation_info /* used when header.a_machtype == M_SPARC */
  72. {
  73. unsigned int r_address; /* relocation addr */
  74. unsigned int r_index:24; /* segment index or symbol index */
  75. unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */
  76. unsigned int r_pad:2; /* <unused> */
  77. enum reloc_type r_type:5; /* type of relocation to perform */
  78. int r_addend; /* addend for relocation value */
  79. };
  80. #define N_RELOCATION_INFO_DECLARED 1
  81. #endif /* !(__ASSEMBLY__) */
  82. #endif /* __SPARC_A_OUT_H__ */