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