|
Packit |
6c4009 |
#ifndef __A_OUT_GNU_H__
|
|
Packit |
6c4009 |
#define __A_OUT_GNU_H__
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <bits/a.out.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define __GNU_EXEC_MACROS__
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
struct exec
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
unsigned char a_dynamic:1; /* A __DYNAMIC is in this image. */
|
|
Packit |
6c4009 |
unsigned char a_toolversion:7;
|
|
Packit |
6c4009 |
unsigned char a_machtype;
|
|
Packit |
6c4009 |
unsigned short a_info;
|
|
Packit |
6c4009 |
unsigned int a_text; /* Length of text, in bytes. */
|
|
Packit |
6c4009 |
unsigned int a_data; /* Length of data, in bytes. */
|
|
Packit |
6c4009 |
unsigned int a_bss; /* Length of bss, in bytes. */
|
|
Packit |
6c4009 |
unsigned int a_syms; /* Length of symbol table, in bytes. */
|
|
Packit |
6c4009 |
unsigned int a_entry; /* Where program begins. */
|
|
Packit |
6c4009 |
unsigned int a_trsize;
|
|
Packit |
6c4009 |
unsigned int a_drsize;
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
enum machine_type
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
M_OLDSUN2 = 0,
|
|
Packit |
6c4009 |
M_68010 = 1,
|
|
Packit |
6c4009 |
M_68020 = 2,
|
|
Packit |
6c4009 |
M_SPARC = 3,
|
|
Packit |
6c4009 |
M_386 = 100,
|
|
Packit |
6c4009 |
M_MIPS1 = 151,
|
|
Packit |
6c4009 |
M_MIPS2 = 152
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define N_MAGIC(exec) ((exec).a_info & 0xffff)
|
|
Packit |
6c4009 |
#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
|
|
Packit |
6c4009 |
#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
|
|
Packit |
6c4009 |
#define N_SET_INFO(exec, magic, type, flags) \
|
|
Packit |
6c4009 |
((exec).a_info = ((magic) & 0xffff) \
|
|
Packit |
6c4009 |
| (((int)(type) & 0xff) << 16) \
|
|
Packit |
6c4009 |
| (((flags) & 0xff) << 24))
|
|
Packit |
6c4009 |
#define N_SET_MAGIC(exec, magic) \
|
|
Packit |
6c4009 |
((exec).a_info = ((exec).a_info & 0xffff0000) | ((magic) & 0xffff))
|
|
Packit |
6c4009 |
#define N_SET_MACHTYPE(exec, machtype) \
|
|
Packit |
6c4009 |
((exec).a_info = \
|
|
Packit |
6c4009 |
((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
|
|
Packit |
6c4009 |
#define N_SET_FLAGS(exec, flags) \
|
|
Packit |
6c4009 |
((exec).a_info = \
|
|
Packit |
6c4009 |
((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Code indicating object file or impure executable. */
|
|
Packit |
6c4009 |
#define OMAGIC 0407
|
|
Packit |
6c4009 |
/* Code indicating pure executable. */
|
|
Packit |
6c4009 |
#define NMAGIC 0410
|
|
Packit |
6c4009 |
/* Code indicating demand-paged executable. */
|
|
Packit |
6c4009 |
#define ZMAGIC 0413
|
|
Packit |
6c4009 |
/* This indicates a demand-paged executable with the header in the text.
|
|
Packit |
6c4009 |
The first page is unmapped to help trap NULL pointer references. */
|
|
Packit |
6c4009 |
#define QMAGIC 0314
|
|
Packit |
6c4009 |
/* Code indicating core file. */
|
|
Packit |
6c4009 |
#define CMAGIC 0421
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define N_TRSIZE(a) ((a).a_trsize)
|
|
Packit |
6c4009 |
#define N_DRSIZE(a) ((a).a_drsize)
|
|
Packit |
6c4009 |
#define N_SYMSIZE(a) ((a).a_syms)
|
|
Packit |
6c4009 |
#define N_BADMAG(x) \
|
|
Packit |
6c4009 |
(N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \
|
|
Packit |
6c4009 |
&& N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC)
|
|
Packit |
6c4009 |
#define _N_HDROFF(x) (1024 - sizeof (struct exec))
|
|
Packit |
6c4009 |
#define N_TXTOFF(x) \
|
|
Packit |
6c4009 |
(N_MAGIC(x) == ZMAGIC ? 0 : sizeof (struct exec))
|
|
Packit |
6c4009 |
#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
|
|
Packit |
6c4009 |
#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
|
|
Packit |
6c4009 |
#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
|
|
Packit |
6c4009 |
#define N_SYMOFF(x) \
|
|
Packit |
6c4009 |
(N_TXTOFF(x) + (x).a_text + (x).a_data + (x).a_trsize + (x).a_drsize)
|
|
Packit |
6c4009 |
#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define SPARC_PGSIZE 0x2000
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Address of text segment in memory after it is loaded. */
|
|
Packit |
6c4009 |
#define N_TXTADDR(x) \
|
|
Packit |
6c4009 |
(unsigned long)(((N_MAGIC(x) == ZMAGIC) && ((x).a_entry < SPARC_PGSIZE)) \
|
|
Packit |
6c4009 |
? 0 : SPARC_PGSIZE)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Address of data segment in memory after it is loaded. */
|
|
Packit |
6c4009 |
#define SEGMENT_SIZE SPARC_PGSIZE
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
|
|
Packit |
6c4009 |
#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define N_DATADDR(x) \
|
|
Packit |
6c4009 |
(N_MAGIC(x)==OMAGIC \
|
|
Packit |
6c4009 |
? (N_TXTADDR(x) + (x).a_text) \
|
|
Packit |
6c4009 |
: (unsigned long)(_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
|
|
Packit |
6c4009 |
#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if !defined (N_NLIST_DECLARED)
|
|
Packit |
6c4009 |
struct nlist
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
union
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
char *n_name;
|
|
Packit |
6c4009 |
struct nlist *n_next;
|
|
Packit |
6c4009 |
long n_strx;
|
|
Packit |
6c4009 |
} n_un;
|
|
Packit |
6c4009 |
unsigned char n_type;
|
|
Packit |
6c4009 |
char n_other;
|
|
Packit |
6c4009 |
short n_desc;
|
|
Packit |
6c4009 |
unsigned long n_value;
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
#endif /* no N_NLIST_DECLARED. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define N_UNDF 0
|
|
Packit |
6c4009 |
#define N_ABS 2
|
|
Packit |
6c4009 |
#define N_TEXT 4
|
|
Packit |
6c4009 |
#define N_DATA 6
|
|
Packit |
6c4009 |
#define N_BSS 8
|
|
Packit |
6c4009 |
#define N_FN 15
|
|
Packit |
6c4009 |
#define N_EXT 1
|
|
Packit |
6c4009 |
#define N_TYPE 036
|
|
Packit |
6c4009 |
#define N_STAB 0340
|
|
Packit |
6c4009 |
#define N_INDR 0xa
|
|
Packit |
6c4009 |
#define N_SETA 0x14 /* Absolute set element symbol. */
|
|
Packit |
6c4009 |
#define N_SETT 0x16 /* Text set element symbol. */
|
|
Packit |
6c4009 |
#define N_SETD 0x18 /* Data set element symbol. */
|
|
Packit |
6c4009 |
#define N_SETB 0x1A /* Bss set element symbol. */
|
|
Packit |
6c4009 |
#define N_SETV 0x1C /* Pointer to set vector in data area. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if !defined (N_RELOCATION_INFO_DECLARED)
|
|
Packit |
6c4009 |
enum reloc_type
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
RELOC_8,
|
|
Packit |
6c4009 |
RELOC_16,
|
|
Packit |
6c4009 |
RELOC_32,
|
|
Packit |
6c4009 |
RELOC_DISP8,
|
|
Packit |
6c4009 |
RELOC_DISP16,
|
|
Packit |
6c4009 |
RELOC_DISP32,
|
|
Packit |
6c4009 |
RELOC_WDISP30,
|
|
Packit |
6c4009 |
RELOC_WDISP22,
|
|
Packit |
6c4009 |
RELOC_HI22,
|
|
Packit |
6c4009 |
RELOC_22,
|
|
Packit |
6c4009 |
RELOC_13,
|
|
Packit |
6c4009 |
RELOC_LO10,
|
|
Packit |
6c4009 |
RELOC_SFA_BASE,
|
|
Packit |
6c4009 |
RELOC_SFA_OFF13,
|
|
Packit |
6c4009 |
RELOC_BASE10,
|
|
Packit |
6c4009 |
RELOC_BASE13,
|
|
Packit |
6c4009 |
RELOC_BASE22,
|
|
Packit |
6c4009 |
RELOC_PC10,
|
|
Packit |
6c4009 |
RELOC_PC22,
|
|
Packit |
6c4009 |
RELOC_JMP_TBL,
|
|
Packit |
6c4009 |
RELOC_SEGOFF16,
|
|
Packit |
6c4009 |
RELOC_GLOB_DAT,
|
|
Packit |
6c4009 |
RELOC_JMP_SLOT,
|
|
Packit |
6c4009 |
RELOC_RELATIVE
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* This structure describes a single relocation to be performed.
|
|
Packit |
6c4009 |
The text-relocation section of the file is a vector of these structures,
|
|
Packit |
6c4009 |
all of which apply to the text section.
|
|
Packit |
6c4009 |
Likewise, the data-relocation section applies to the data section. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
struct relocation_info
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
unsigned int r_address;
|
|
Packit |
6c4009 |
unsigned int r_index:24;
|
|
Packit |
6c4009 |
unsigned int r_extern:1;
|
|
Packit |
6c4009 |
int r_pad:2;
|
|
Packit |
6c4009 |
enum reloc_type r_type:5;
|
|
Packit |
6c4009 |
int r_addend;
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
#endif /* no N_RELOCATION_INFO_DECLARED. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif /* __A_OUT_GNU_H__ */
|