move a few development packages to trunk and add myself as a maintainer
[openwrt/svn-archive/archive.git] / package / devel / valgrind / patches / 110-add_a_out_h.patch
1 --- /dev/null
2 +++ b/include/a.out.h
3 @@ -0,0 +1,138 @@
4 +#ifndef __A_OUT_GNU_H__
5 +#define __A_OUT_GNU_H__
6 +
7 +#include <bits/a.out.h>
8 +
9 +#define __GNU_EXEC_MACROS__
10 +
11 +struct exec
12 +{
13 + unsigned long a_info; /* Use macros N_MAGIC, etc for access. */
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 uninitialized data area for file, in bytes. */
17 + unsigned int a_syms; /* Length of symbol table data in file, in bytes. */
18 + unsigned int a_entry; /* Start address. */
19 + unsigned int a_trsize;/* Length of relocation info for text, in bytes. */
20 + unsigned int a_drsize;/* Length of relocation info for data, in bytes. */
21 +};
22 +
23 +enum machine_type
24 +{
25 + M_OLDSUN2 = 0,
26 + M_68010 = 1,
27 + M_68020 = 2,
28 + M_SPARC = 3,
29 + M_386 = 100,
30 + M_MIPS1 = 151,
31 + M_MIPS2 = 152
32 +};
33 +
34 +#define N_MAGIC(exec) ((exec).a_info & 0xffff)
35 +#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
36 +#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
37 +#define N_SET_INFO(exec, magic, type, flags) \
38 + ((exec).a_info = ((magic) & 0xffff) \
39 + | (((int)(type) & 0xff) << 16) \
40 + | (((flags) & 0xff) << 24))
41 +#define N_SET_MAGIC(exec, magic) \
42 + ((exec).a_info = ((exec).a_info & 0xffff0000) | ((magic) & 0xffff))
43 +#define N_SET_MACHTYPE(exec, machtype) \
44 + ((exec).a_info = \
45 + ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
46 +#define N_SET_FLAGS(exec, flags) \
47 + ((exec).a_info = \
48 + ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
49 +
50 +/* Code indicating object file or impure executable. */
51 +#define OMAGIC 0407
52 +/* Code indicating pure executable. */
53 +#define NMAGIC 0410
54 +/* Code indicating demand-paged executable. */
55 +#define ZMAGIC 0413
56 +/* This indicates a demand-paged executable with the header in the text.
57 + The first page is unmapped to help trap NULL pointer references. */
58 +#define QMAGIC 0314
59 +/* Code indicating core file. */
60 +#define CMAGIC 0421
61 +
62 +#define N_TRSIZE(a) ((a).a_trsize)
63 +#define N_DRSIZE(a) ((a).a_drsize)
64 +#define N_SYMSIZE(a) ((a).a_syms)
65 +#define N_BADMAG(x) \
66 + (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \
67 + && N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC)
68 +#define _N_HDROFF(x) (1024 - sizeof (struct exec))
69 +#define N_TXTOFF(x) \
70 + (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
71 + (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
72 +#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
73 +#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
74 +#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
75 +#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
76 +#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
77 +
78 +/* Address of text segment in memory after it is loaded. */
79 +#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? 4096 : 0)
80 +
81 +/* Address of data segment in memory after it is loaded. */
82 +#define SEGMENT_SIZE 1024
83 +
84 +#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
85 +#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
86 +
87 +#define N_DATADDR(x) \
88 + (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
89 + : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
90 +#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
91 +
92 +#if !defined (N_NLIST_DECLARED)
93 +struct nlist
94 +{
95 + union
96 + {
97 + char *n_name;
98 + struct nlist *n_next;
99 + long n_strx;
100 + } n_un;
101 + unsigned char n_type;
102 + char n_other;
103 + short n_desc;
104 + unsigned long n_value;
105 +};
106 +#endif /* no N_NLIST_DECLARED. */
107 +
108 +#define N_UNDF 0
109 +#define N_ABS 2
110 +#define N_TEXT 4
111 +#define N_DATA 6
112 +#define N_BSS 8
113 +#define N_FN 15
114 +#define N_EXT 1
115 +#define N_TYPE 036
116 +#define N_STAB 0340
117 +#define N_INDR 0xa
118 +#define N_SETA 0x14 /* Absolute set element symbol. */
119 +#define N_SETT 0x16 /* Text set element symbol. */
120 +#define N_SETD 0x18 /* Data set element symbol. */
121 +#define N_SETB 0x1A /* Bss set element symbol. */
122 +#define N_SETV 0x1C /* Pointer to set vector in data area. */
123 +
124 +#if !defined (N_RELOCATION_INFO_DECLARED)
125 +/* This structure describes a single relocation to be performed.
126 + The text-relocation section of the file is a vector of these structures,
127 + all of which apply to the text section.
128 + Likewise, the data-relocation section applies to the data section. */
129 +
130 +struct relocation_info
131 +{
132 + int r_address;
133 + unsigned int r_symbolnum:24;
134 + unsigned int r_pcrel:1;
135 + unsigned int r_length:2;
136 + unsigned int r_extern:1;
137 + unsigned int r_pad:4;
138 +};
139 +#endif /* no N_RELOCATION_INFO_DECLARED. */
140 +
141 +#endif /* __A_OUT_GNU_H__ */
142 --- /dev/null
143 +++ b/include/bits/a.out.h
144 @@ -0,0 +1,13 @@
145 +#ifndef __A_OUT_GNU_H__
146 +# error "Never use <bits/a.out.h> directly; include <a.out.h> instead."
147 +#endif
148 +
149 +#include <bits/wordsize.h>
150 +
151 +#if __WORDSIZE == 64
152 +
153 +/* Signal to users of this header that this architecture really doesn't
154 + support a.out binary format. */
155 +#define __NO_A_OUT_SUPPORT 1
156 +
157 +#endif