| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #define BMAGIC 0415 |
| |
| |
| #define OMAGIC 0407 |
| #define NMAGIC 0410 |
| #define ZMAGIC 0413 |
| |
| |
| |
| |
| |
| |
| struct external_exec |
| { |
| |
| unsigned char e_info[4]; |
| unsigned char e_text[4]; |
| unsigned char e_data[4]; |
| unsigned char e_bss[4]; |
| unsigned char e_syms[4]; |
| unsigned char e_entry[4]; |
| unsigned char e_trsize[4]; |
| unsigned char e_drsize[4]; |
| |
| |
| unsigned char e_tload[4]; |
| unsigned char e_dload[4]; |
| unsigned char e_talign[1]; |
| unsigned char e_dalign[1]; |
| unsigned char e_balign[1]; |
| unsigned char e_relaxable[1]; |
| }; |
| |
| #define EXEC_BYTES_SIZE (sizeof (struct external_exec)) |
| |
| |
| |
| #define N_BADMAG(x) (((x)->a_info)!=BMAGIC) |
| #define N_TXTOFF(x) EXEC_BYTES_SIZE |
| #define N_DATOFF(x) ( N_TXTOFF(x) + (x)->a_text ) |
| #define N_TROFF(x) ( N_DATOFF(x) + (x)->a_data ) |
| #define N_TRELOFF N_TROFF |
| #define N_DROFF(x) ( N_TROFF(x) + (x)->a_trsize ) |
| #define N_DRELOFF N_DROFF |
| #define N_SYMOFF(x) ( N_DROFF(x) + (x)->a_drsize ) |
| #define N_STROFF(x) ( N_SYMOFF(x) + (x)->a_syms ) |
| #define N_DATADDR(x) ( (x)->a_dload ) |
| |
| |
| #if !defined (N_TXTADDR) |
| #define N_TXTADDR(x) 0 |
| #endif |
| |
| |
| struct nlist |
| { |
| union |
| { |
| char* n_name; |
| struct nlist * n_next; |
| long n_strx; |
| } n_un; |
| |
| unsigned char n_type; |
| char n_other; |
| short n_desc; |
| unsigned long n_value; |
| }; |
| |
| |
| |
| #define N_UNDF 0 |
| #define N_ABS 2 |
| #define N_TEXT 4 |
| #define N_DATA 6 |
| #define N_BSS 8 |
| #define N_FN 31 |
| |
| #define N_EXT 1 |
| #define N_TYPE 036 |
| #define N_STAB 0340 |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #define N_CALLNAME ((char)-1) |
| #define N_BALNAME ((char)-2) |
| #define IS_CALLNAME(x) (N_CALLNAME == (x)) |
| #define IS_BALNAME(x) (N_BALNAME == (x)) |
| #define IS_OTHER(x) ((x)>0 && (x) <=32) |
| |
| #define b_out_relocation_info relocation_info |
| struct relocation_info |
| { |
| int r_address; |
| unsigned |
| #define r_index r_symbolnum |
| r_symbolnum:24, |
| |
| |
| |
| |
| r_pcrel:1, |
| |
| |
| r_length:2, |
| |
| |
| |
| r_extern:1, |
| r_bsr:1, |
| r_disp:1, |
| r_callj:1, |
| r_relaxable:1; |
| }; |