a.out.h 2.9 KB

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