Commit | Line | Data |
---|---|---|
3af9a47b | 1 | /* Mach-O support for BFD. |
1e8a024a | 2 | Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008 |
3af9a47b NC |
3 | Free Software Foundation, Inc. |
4 | ||
5 | This file is part of BFD, the Binary File Descriptor library. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
cd123cb7 | 9 | the Free Software Foundation; either version 3 of the License, or |
3af9a47b NC |
10 | (at your option) any later version. |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
e84d6fca | 18 | along with this program; if not, write to the Free Software |
cd123cb7 NC |
19 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
20 | MA 02110-1301, USA. */ | |
3af9a47b NC |
21 | |
22 | #ifndef _BFD_MACH_O_H_ | |
23 | #define _BFD_MACH_O_H_ | |
24 | ||
25 | #include "bfd.h" | |
26 | ||
27 | #define BFD_MACH_O_N_STAB 0xe0 /* If any of these bits set, a symbolic debugging entry. */ | |
28 | #define BFD_MACH_O_N_PEXT 0x10 /* Private external symbol bit. */ | |
29 | #define BFD_MACH_O_N_TYPE 0x0e /* Mask for the type bits. */ | |
30 | #define BFD_MACH_O_N_EXT 0x01 /* External symbol bit, set for external symbols. */ | |
31 | #define BFD_MACH_O_N_UNDF 0x00 /* Undefined, n_sect == NO_SECT. */ | |
32 | #define BFD_MACH_O_N_ABS 0x02 /* Absolute, n_sect == NO_SECT. */ | |
33 | #define BFD_MACH_O_N_SECT 0x0e /* Defined in section number n_sect. */ | |
34 | #define BFD_MACH_O_N_PBUD 0x0c /* Prebound undefined (defined in a dylib). */ | |
35 | #define BFD_MACH_O_N_INDR 0x0a /* Indirect. */ | |
36 | ||
37 | typedef enum bfd_mach_o_ppc_thread_flavour | |
116c20d2 NC |
38 | { |
39 | BFD_MACH_O_PPC_THREAD_STATE = 1, | |
40 | BFD_MACH_O_PPC_FLOAT_STATE = 2, | |
41 | BFD_MACH_O_PPC_EXCEPTION_STATE = 3, | |
1e8a024a TG |
42 | BFD_MACH_O_PPC_VECTOR_STATE = 4, |
43 | BFD_MACH_O_PPC_THREAD_STATE_64 = 5 | |
116c20d2 | 44 | } |
3af9a47b NC |
45 | bfd_mach_o_ppc_thread_flavour; |
46 | ||
47 | typedef enum bfd_mach_o_i386_thread_flavour | |
116c20d2 NC |
48 | { |
49 | BFD_MACH_O_i386_NEW_THREAD_STATE = 1, | |
50 | BFD_MACH_O_i386_FLOAT_STATE = 2, | |
51 | BFD_MACH_O_i386_ISA_PORT_MAP_STATE = 3, | |
52 | BFD_MACH_O_i386_V86_ASSIST_STATE = 4, | |
53 | BFD_MACH_O_i386_REGS_SEGS_STATE = 5, | |
54 | BFD_MACH_O_i386_THREAD_SYSCALL_STATE = 6, | |
116c20d2 NC |
55 | BFD_MACH_O_i386_SAVED_STATE = 8, |
56 | BFD_MACH_O_i386_THREAD_STATE = -1, | |
57 | BFD_MACH_O_i386_THREAD_FPSTATE = -2, | |
58 | BFD_MACH_O_i386_THREAD_EXCEPTSTATE = -3, | |
59 | BFD_MACH_O_i386_THREAD_CTHREADSTATE = -4, | |
1e8a024a TG |
60 | BFD_MACH_O_x86_THREAD_STATE64 = 4, |
61 | BFD_MACH_O_x86_FLOAT_STATE64 = 5, | |
62 | BFD_MACH_O_x86_EXCEPTION_STATE64 = 6, | |
63 | BFD_MACH_O_x86_THREAD_STATE = 7, | |
64 | BFD_MACH_O_x86_FLOAT_STATE = 8, | |
65 | BFD_MACH_O_x86_EXCEPTION_STATE = 9, | |
66 | BFD_MACH_O_i386_THREAD_STATE_NONE = 10, | |
116c20d2 | 67 | } |
3af9a47b NC |
68 | bfd_mach_o_i386_thread_flavour; |
69 | ||
70 | #define BFD_MACH_O_LC_REQ_DYLD 0x80000000 | |
71 | ||
72 | typedef enum bfd_mach_o_load_command_type | |
116c20d2 NC |
73 | { |
74 | BFD_MACH_O_LC_SEGMENT = 0x1, /* File segment to be mapped. */ | |
75 | BFD_MACH_O_LC_SYMTAB = 0x2, /* Link-edit stab symbol table info (obsolete). */ | |
76 | BFD_MACH_O_LC_SYMSEG = 0x3, /* Link-edit gdb symbol table info. */ | |
77 | BFD_MACH_O_LC_THREAD = 0x4, /* Thread. */ | |
78 | BFD_MACH_O_LC_UNIXTHREAD = 0x5, /* UNIX thread (includes a stack). */ | |
79 | BFD_MACH_O_LC_LOADFVMLIB = 0x6, /* Load a fixed VM shared library. */ | |
80 | BFD_MACH_O_LC_IDFVMLIB = 0x7, /* Fixed VM shared library id. */ | |
81 | BFD_MACH_O_LC_IDENT = 0x8, /* Object identification information (obsolete). */ | |
82 | BFD_MACH_O_LC_FVMFILE = 0x9, /* Fixed VM file inclusion. */ | |
83 | BFD_MACH_O_LC_PREPAGE = 0xa, /* Prepage command (internal use). */ | |
84 | BFD_MACH_O_LC_DYSYMTAB = 0xb, /* Dynamic link-edit symbol table info. */ | |
85 | BFD_MACH_O_LC_LOAD_DYLIB = 0xc, /* Load a dynamically linked shared library. */ | |
86 | BFD_MACH_O_LC_ID_DYLIB = 0xd, /* Dynamically linked shared lib identification. */ | |
87 | BFD_MACH_O_LC_LOAD_DYLINKER = 0xe, /* Load a dynamic linker. */ | |
88 | BFD_MACH_O_LC_ID_DYLINKER = 0xf, /* Dynamic linker identification. */ | |
89 | BFD_MACH_O_LC_PREBOUND_DYLIB = 0x10, /* Modules prebound for a dynamically. */ | |
90 | BFD_MACH_O_LC_ROUTINES = 0x11, /* Image routines. */ | |
91 | BFD_MACH_O_LC_SUB_FRAMEWORK = 0x12, /* Sub framework. */ | |
92 | BFD_MACH_O_LC_SUB_UMBRELLA = 0x13, /* Sub umbrella. */ | |
93 | BFD_MACH_O_LC_SUB_CLIENT = 0x14, /* Sub client. */ | |
94 | BFD_MACH_O_LC_SUB_LIBRARY = 0x15, /* Sub library. */ | |
95 | BFD_MACH_O_LC_TWOLEVEL_HINTS = 0x16, /* Two-level namespace lookup hints. */ | |
96 | BFD_MACH_O_LC_PREBIND_CKSUM = 0x17, /* Prebind checksum. */ | |
97 | /* Load a dynamically linked shared library that is allowed to be | |
3af9a47b | 98 | missing (weak). */ |
1e8a024a TG |
99 | BFD_MACH_O_LC_LOAD_WEAK_DYLIB = 0x18, |
100 | BFD_MACH_O_LC_SEGMENT_64 = 0x19, /* 64-bit segment of this file to be | |
101 | mapped. */ | |
102 | BFD_MACH_O_LC_ROUTINES_64 = 0x1a, /* Address of the dyld init routine | |
103 | in a dylib. */ | |
104 | BFD_MACH_O_LC_UUID = 0x1b /* 128-bit UUID of the executable. */ | |
116c20d2 | 105 | } |
3af9a47b NC |
106 | bfd_mach_o_load_command_type; |
107 | ||
1e8a024a TG |
108 | #define BFD_MACH_O_CPU_IS64BIT 0x1000000 |
109 | ||
3af9a47b | 110 | typedef enum bfd_mach_o_cpu_type |
116c20d2 NC |
111 | { |
112 | BFD_MACH_O_CPU_TYPE_VAX = 1, | |
113 | BFD_MACH_O_CPU_TYPE_MC680x0 = 6, | |
114 | BFD_MACH_O_CPU_TYPE_I386 = 7, | |
115 | BFD_MACH_O_CPU_TYPE_MIPS = 8, | |
116 | BFD_MACH_O_CPU_TYPE_MC98000 = 10, | |
117 | BFD_MACH_O_CPU_TYPE_HPPA = 11, | |
118 | BFD_MACH_O_CPU_TYPE_ARM = 12, | |
119 | BFD_MACH_O_CPU_TYPE_MC88000 = 13, | |
120 | BFD_MACH_O_CPU_TYPE_SPARC = 14, | |
121 | BFD_MACH_O_CPU_TYPE_I860 = 15, | |
122 | BFD_MACH_O_CPU_TYPE_ALPHA = 16, | |
1e8a024a TG |
123 | BFD_MACH_O_CPU_TYPE_POWERPC = 18, |
124 | BFD_MACH_O_CPU_TYPE_POWERPC_64 = (BFD_MACH_O_CPU_TYPE_POWERPC | BFD_MACH_O_CPU_IS64BIT), | |
125 | BFD_MACH_O_CPU_TYPE_X86_64 = (BFD_MACH_O_CPU_TYPE_I386 | BFD_MACH_O_CPU_IS64BIT) | |
116c20d2 | 126 | } |
3af9a47b NC |
127 | bfd_mach_o_cpu_type; |
128 | ||
129 | typedef enum bfd_mach_o_filetype | |
116c20d2 NC |
130 | { |
131 | BFD_MACH_O_MH_OBJECT = 1, | |
132 | BFD_MACH_O_MH_EXECUTE = 2, | |
133 | BFD_MACH_O_MH_FVMLIB = 3, | |
134 | BFD_MACH_O_MH_CORE = 4, | |
135 | BFD_MACH_O_MH_PRELOAD = 5, | |
136 | BFD_MACH_O_MH_DYLIB = 6, | |
137 | BFD_MACH_O_MH_DYLINKER = 7, | |
138 | BFD_MACH_O_MH_BUNDLE = 8 | |
139 | } | |
3af9a47b NC |
140 | bfd_mach_o_filetype; |
141 | ||
142 | /* Constants for the type of a section. */ | |
143 | ||
144 | typedef enum bfd_mach_o_section_type | |
116c20d2 NC |
145 | { |
146 | /* Regular section. */ | |
147 | BFD_MACH_O_S_REGULAR = 0x0, | |
3af9a47b | 148 | |
116c20d2 NC |
149 | /* Zero fill on demand section. */ |
150 | BFD_MACH_O_S_ZEROFILL = 0x1, | |
3af9a47b | 151 | |
116c20d2 NC |
152 | /* Section with only literal C strings. */ |
153 | BFD_MACH_O_S_CSTRING_LITERALS = 0x2, | |
3af9a47b | 154 | |
116c20d2 NC |
155 | /* Section with only 4 byte literals. */ |
156 | BFD_MACH_O_S_4BYTE_LITERALS = 0x3, | |
3af9a47b | 157 | |
116c20d2 NC |
158 | /* Section with only 8 byte literals. */ |
159 | BFD_MACH_O_S_8BYTE_LITERALS = 0x4, | |
3af9a47b | 160 | |
116c20d2 NC |
161 | /* Section with only pointers to literals. */ |
162 | BFD_MACH_O_S_LITERAL_POINTERS = 0x5, | |
3af9a47b | 163 | |
116c20d2 NC |
164 | /* For the two types of symbol pointers sections and the symbol stubs |
165 | section they have indirect symbol table entries. For each of the | |
166 | entries in the section the indirect symbol table entries, in | |
167 | corresponding order in the indirect symbol table, start at the index | |
168 | stored in the reserved1 field of the section structure. Since the | |
169 | indirect symbol table entries correspond to the entries in the | |
170 | section the number of indirect symbol table entries is inferred from | |
171 | the size of the section divided by the size of the entries in the | |
172 | section. For symbol pointers sections the size of the entries in | |
173 | the section is 4 bytes and for symbol stubs sections the byte size | |
174 | of the stubs is stored in the reserved2 field of the section | |
175 | structure. */ | |
3af9a47b | 176 | |
116c20d2 NC |
177 | /* Section with only non-lazy symbol pointers. */ |
178 | BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS = 0x6, | |
e84d6fca | 179 | |
116c20d2 NC |
180 | /* Section with only lazy symbol pointers. */ |
181 | BFD_MACH_O_S_LAZY_SYMBOL_POINTERS = 0x7, | |
e84d6fca | 182 | |
116c20d2 NC |
183 | /* Section with only symbol stubs, byte size of stub in the reserved2 field. */ |
184 | BFD_MACH_O_S_SYMBOL_STUBS = 0x8, | |
e84d6fca | 185 | |
116c20d2 NC |
186 | /* Section with only function pointers for initialization. */ |
187 | BFD_MACH_O_S_MOD_INIT_FUNC_POINTERS = 0x9 | |
188 | } | |
3af9a47b NC |
189 | bfd_mach_o_section_type; |
190 | ||
191 | typedef unsigned long bfd_mach_o_cpu_subtype; | |
192 | ||
193 | typedef struct bfd_mach_o_header | |
194 | { | |
195 | unsigned long magic; | |
196 | unsigned long cputype; | |
197 | unsigned long cpusubtype; | |
198 | unsigned long filetype; | |
199 | unsigned long ncmds; | |
200 | unsigned long sizeofcmds; | |
201 | unsigned long flags; | |
1e8a024a TG |
202 | unsigned int reserved; |
203 | /* Version 1: 32 bits, version 2: 64 bits. */ | |
204 | unsigned int version; | |
3af9a47b NC |
205 | enum bfd_endian byteorder; |
206 | } | |
207 | bfd_mach_o_header; | |
208 | ||
209 | typedef struct bfd_mach_o_section | |
210 | { | |
211 | asection *bfdsection; | |
212 | char sectname[16 + 1]; | |
213 | char segname[16 + 1]; | |
214 | bfd_vma addr; | |
215 | bfd_vma size; | |
216 | bfd_vma offset; | |
217 | unsigned long align; | |
218 | bfd_vma reloff; | |
219 | unsigned long nreloc; | |
220 | unsigned long flags; | |
221 | unsigned long reserved1; | |
222 | unsigned long reserved2; | |
1e8a024a | 223 | unsigned long reserved3; |
3af9a47b NC |
224 | } |
225 | bfd_mach_o_section; | |
226 | ||
227 | typedef struct bfd_mach_o_segment_command | |
228 | { | |
229 | char segname[16]; | |
230 | bfd_vma vmaddr; | |
231 | bfd_vma vmsize; | |
232 | bfd_vma fileoff; | |
233 | unsigned long filesize; | |
1e8a024a TG |
234 | unsigned long maxprot; |
235 | unsigned long initprot; | |
3af9a47b NC |
236 | unsigned long nsects; |
237 | unsigned long flags; | |
238 | bfd_mach_o_section *sections; | |
239 | asection *segment; | |
240 | } | |
241 | bfd_mach_o_segment_command; | |
242 | ||
243 | typedef struct bfd_mach_o_symtab_command | |
244 | { | |
245 | unsigned long symoff; | |
246 | unsigned long nsyms; | |
247 | unsigned long stroff; | |
248 | unsigned long strsize; | |
249 | asymbol *symbols; | |
250 | char *strtab; | |
251 | asection *stabs_segment; | |
252 | asection *stabstr_segment; | |
253 | } | |
254 | bfd_mach_o_symtab_command; | |
255 | ||
256 | /* This is the second set of the symbolic information which is used to support | |
7dee875e | 257 | the data structures for the dynamically link editor. |
e84d6fca | 258 | |
3af9a47b NC |
259 | The original set of symbolic information in the symtab_command which contains |
260 | the symbol and string tables must also be present when this load command is | |
261 | present. When this load command is present the symbol table is organized | |
262 | into three groups of symbols: | |
263 | local symbols (static and debugging symbols) - grouped by module | |
264 | defined external symbols - grouped by module (sorted by name if not lib) | |
265 | undefined external symbols (sorted by name) | |
266 | In this load command there are offsets and counts to each of the three groups | |
267 | of symbols. | |
e84d6fca | 268 | |
3af9a47b NC |
269 | This load command contains a the offsets and sizes of the following new |
270 | symbolic information tables: | |
271 | table of contents | |
272 | module table | |
273 | reference symbol table | |
274 | indirect symbol table | |
275 | The first three tables above (the table of contents, module table and | |
7dee875e | 276 | reference symbol table) are only present if the file is a dynamically linked |
3af9a47b NC |
277 | shared library. For executable and object modules, which are files |
278 | containing only one module, the information that would be in these three | |
279 | tables is determined as follows: | |
280 | table of contents - the defined external symbols are sorted by name | |
281 | module table - the file contains only one module so everything in the | |
282 | file is part of the module. | |
283 | reference symbol table - is the defined and undefined external symbols | |
e84d6fca | 284 | |
7dee875e | 285 | For dynamically linked shared library files this load command also contains |
3af9a47b NC |
286 | offsets and sizes to the pool of relocation entries for all sections |
287 | separated into two groups: | |
288 | external relocation entries | |
289 | local relocation entries | |
290 | For executable and object modules the relocation entries continue to hang | |
291 | off the section structures. */ | |
292 | ||
293 | typedef struct bfd_mach_o_dysymtab_command | |
294 | { | |
295 | /* The symbols indicated by symoff and nsyms of the LC_SYMTAB load command | |
296 | are grouped into the following three groups: | |
297 | local symbols (further grouped by the module they are from) | |
298 | defined external symbols (further grouped by the module they are from) | |
299 | undefined symbols | |
e84d6fca | 300 | |
3af9a47b NC |
301 | The local symbols are used only for debugging. The dynamic binding |
302 | process may have to use them to indicate to the debugger the local | |
303 | symbols for a module that is being bound. | |
e84d6fca | 304 | |
3af9a47b NC |
305 | The last two groups are used by the dynamic binding process to do the |
306 | binding (indirectly through the module table and the reference symbol | |
7dee875e | 307 | table when this is a dynamically linked shared library file). */ |
3af9a47b NC |
308 | |
309 | unsigned long ilocalsym; /* Index to local symbols. */ | |
310 | unsigned long nlocalsym; /* Number of local symbols. */ | |
311 | unsigned long iextdefsym; /* Index to externally defined symbols. */ | |
312 | unsigned long nextdefsym; /* Number of externally defined symbols. */ | |
313 | unsigned long iundefsym; /* Index to undefined symbols. */ | |
314 | unsigned long nundefsym; /* Number of undefined symbols. */ | |
315 | ||
316 | /* For the for the dynamic binding process to find which module a symbol | |
317 | is defined in the table of contents is used (analogous to the ranlib | |
318 | structure in an archive) which maps defined external symbols to modules | |
7dee875e | 319 | they are defined in. This exists only in a dynamically linked shared |
3af9a47b NC |
320 | library file. For executable and object modules the defined external |
321 | symbols are sorted by name and is use as the table of contents. */ | |
322 | ||
323 | unsigned long tocoff; /* File offset to table of contents. */ | |
324 | unsigned long ntoc; /* Number of entries in table of contents. */ | |
325 | ||
326 | /* To support dynamic binding of "modules" (whole object files) the symbol | |
327 | table must reflect the modules that the file was created from. This is | |
328 | done by having a module table that has indexes and counts into the merged | |
329 | tables for each module. The module structure that these two entries | |
7dee875e | 330 | refer to is described below. This exists only in a dynamically linked |
3af9a47b NC |
331 | shared library file. For executable and object modules the file only |
332 | contains one module so everything in the file belongs to the module. */ | |
333 | ||
334 | unsigned long modtaboff; /* File offset to module table. */ | |
335 | unsigned long nmodtab; /* Number of module table entries. */ | |
336 | ||
337 | /* To support dynamic module binding the module structure for each module | |
338 | indicates the external references (defined and undefined) each module | |
339 | makes. For each module there is an offset and a count into the | |
340 | reference symbol table for the symbols that the module references. | |
7dee875e | 341 | This exists only in a dynamically linked shared library file. For |
3af9a47b NC |
342 | executable and object modules the defined external symbols and the |
343 | undefined external symbols indicates the external references. */ | |
344 | ||
345 | unsigned long extrefsymoff; /* Offset to referenced symbol table. */ | |
346 | unsigned long nextrefsyms; /* Number of referenced symbol table entries. */ | |
347 | ||
348 | /* The sections that contain "symbol pointers" and "routine stubs" have | |
349 | indexes and (implied counts based on the size of the section and fixed | |
350 | size of the entry) into the "indirect symbol" table for each pointer | |
351 | and stub. For every section of these two types the index into the | |
352 | indirect symbol table is stored in the section header in the field | |
353 | reserved1. An indirect symbol table entry is simply a 32bit index into | |
354 | the symbol table to the symbol that the pointer or stub is referring to. | |
355 | The indirect symbol table is ordered to match the entries in the section. */ | |
356 | ||
357 | unsigned long indirectsymoff; /* File offset to the indirect symbol table. */ | |
358 | unsigned long nindirectsyms; /* Number of indirect symbol table entries. */ | |
359 | ||
360 | /* To support relocating an individual module in a library file quickly the | |
361 | external relocation entries for each module in the library need to be | |
362 | accessed efficiently. Since the relocation entries can't be accessed | |
363 | through the section headers for a library file they are separated into | |
364 | groups of local and external entries further grouped by module. In this | |
365 | case the presents of this load command who's extreloff, nextrel, | |
366 | locreloff and nlocrel fields are non-zero indicates that the relocation | |
367 | entries of non-merged sections are not referenced through the section | |
368 | structures (and the reloff and nreloc fields in the section headers are | |
369 | set to zero). | |
370 | ||
371 | Since the relocation entries are not accessed through the section headers | |
372 | this requires the r_address field to be something other than a section | |
373 | offset to identify the item to be relocated. In this case r_address is | |
374 | set to the offset from the vmaddr of the first LC_SEGMENT command. | |
375 | ||
376 | The relocation entries are grouped by module and the module table | |
377 | entries have indexes and counts into them for the group of external | |
378 | relocation entries for that the module. | |
379 | ||
380 | For sections that are merged across modules there must not be any | |
381 | remaining external relocation entries for them (for merged sections | |
382 | remaining relocation entries must be local). */ | |
383 | ||
384 | unsigned long extreloff; /* Offset to external relocation entries. */ | |
385 | unsigned long nextrel; /* Number of external relocation entries. */ | |
386 | ||
387 | /* All the local relocation entries are grouped together (they are not | |
388 | grouped by their module since they are only used if the object is moved | |
7dee875e | 389 | from it statically link edited address). */ |
3af9a47b NC |
390 | |
391 | unsigned long locreloff; /* Offset to local relocation entries. */ | |
392 | unsigned long nlocrel; /* Number of local relocation entries. */ | |
393 | } | |
e84d6fca | 394 | bfd_mach_o_dysymtab_command; |
3af9a47b | 395 | |
e84d6fca | 396 | /* An indirect symbol table entry is simply a 32bit index into the symbol table |
3af9a47b | 397 | to the symbol that the pointer or stub is refering to. Unless it is for a |
e84d6fca | 398 | non-lazy symbol pointer section for a defined symbol which strip(1) as |
3af9a47b NC |
399 | removed. In which case it has the value INDIRECT_SYMBOL_LOCAL. If the |
400 | symbol was also absolute INDIRECT_SYMBOL_ABS is or'ed with that. */ | |
401 | ||
402 | #define INDIRECT_SYMBOL_LOCAL 0x80000000 | |
403 | #define INDIRECT_SYMBOL_ABS 0x40000000 | |
404 | ||
405 | typedef struct bfd_mach_o_thread_flavour | |
406 | { | |
407 | unsigned long flavour; | |
408 | bfd_vma offset; | |
409 | unsigned long size; | |
410 | } | |
411 | bfd_mach_o_thread_flavour; | |
412 | ||
413 | typedef struct bfd_mach_o_thread_command | |
414 | { | |
415 | unsigned long nflavours; | |
e84d6fca | 416 | bfd_mach_o_thread_flavour *flavours; |
3af9a47b NC |
417 | asection *section; |
418 | } | |
419 | bfd_mach_o_thread_command; | |
420 | ||
421 | typedef struct bfd_mach_o_dylinker_command | |
422 | { | |
423 | unsigned long cmd; /* LC_ID_DYLIB or LC_LOAD_DYLIB. */ | |
424 | unsigned long cmdsize; /* Includes pathname string. */ | |
425 | unsigned long name_offset; /* Offset to library's path name. */ | |
426 | unsigned long name_len; /* Offset to library's path name. */ | |
427 | asection *section; | |
428 | } | |
429 | bfd_mach_o_dylinker_command; | |
430 | ||
431 | typedef struct bfd_mach_o_dylib_command | |
432 | { | |
433 | unsigned long cmd; /* LC_ID_DYLIB or LC_LOAD_DYLIB. */ | |
434 | unsigned long cmdsize; /* Includes pathname string. */ | |
435 | unsigned long name_offset; /* Offset to library's path name. */ | |
436 | unsigned long name_len; /* Offset to library's path name. */ | |
437 | unsigned long timestamp; /* Library's build time stamp. */ | |
438 | unsigned long current_version; /* Library's current version number. */ | |
439 | unsigned long compatibility_version; /* Library's compatibility vers number. */ | |
440 | asection *section; | |
441 | } | |
442 | bfd_mach_o_dylib_command; | |
443 | ||
444 | typedef struct bfd_mach_o_prebound_dylib_command | |
445 | { | |
446 | unsigned long cmd; /* LC_PREBOUND_DYLIB. */ | |
447 | unsigned long cmdsize; /* Includes strings. */ | |
448 | unsigned long name; /* Library's path name. */ | |
449 | unsigned long nmodules; /* Number of modules in library. */ | |
450 | unsigned long linked_modules; /* Bit vector of linked modules. */ | |
451 | asection *section; | |
452 | } | |
453 | bfd_mach_o_prebound_dylib_command; | |
454 | ||
455 | typedef struct bfd_mach_o_load_command | |
456 | { | |
457 | bfd_mach_o_load_command_type type; | |
458 | unsigned int type_required; | |
459 | bfd_vma offset; | |
460 | bfd_vma len; | |
461 | union | |
462 | { | |
463 | bfd_mach_o_segment_command segment; | |
464 | bfd_mach_o_symtab_command symtab; | |
465 | bfd_mach_o_dysymtab_command dysymtab; | |
466 | bfd_mach_o_thread_command thread; | |
467 | bfd_mach_o_dylib_command dylib; | |
468 | bfd_mach_o_dylinker_command dylinker; | |
469 | bfd_mach_o_prebound_dylib_command prebound_dylib; | |
470 | } | |
471 | command; | |
472 | } | |
473 | bfd_mach_o_load_command; | |
474 | ||
475 | typedef struct mach_o_data_struct | |
476 | { | |
477 | bfd_mach_o_header header; | |
478 | bfd_mach_o_load_command *commands; | |
479 | unsigned long nsymbols; | |
480 | asymbol *symbols; | |
481 | unsigned long nsects; | |
482 | bfd_mach_o_section **sections; | |
483 | bfd *ibfd; | |
484 | } | |
485 | mach_o_data_struct; | |
486 | ||
487 | typedef struct mach_o_data_struct bfd_mach_o_data_struct; | |
488 | ||
116c20d2 NC |
489 | bfd_boolean bfd_mach_o_valid (bfd *); |
490 | int bfd_mach_o_scan_read_symtab_symbol (bfd *, bfd_mach_o_symtab_command *, asymbol *, unsigned long); | |
491 | int bfd_mach_o_scan_read_symtab_strtab (bfd *, bfd_mach_o_symtab_command *); | |
492 | int bfd_mach_o_scan_read_symtab_symbols (bfd *, bfd_mach_o_symtab_command *); | |
493 | int bfd_mach_o_scan_read_dysymtab_symbol (bfd *, bfd_mach_o_dysymtab_command *, bfd_mach_o_symtab_command *, asymbol *, unsigned long); | |
494 | int bfd_mach_o_scan_start_address (bfd *); | |
495 | int bfd_mach_o_scan (bfd *, bfd_mach_o_header *, bfd_mach_o_data_struct *); | |
496 | bfd_boolean bfd_mach_o_mkobject (bfd *); | |
497 | const bfd_target * bfd_mach_o_object_p (bfd *); | |
498 | const bfd_target * bfd_mach_o_core_p (bfd *); | |
499 | const bfd_target * bfd_mach_o_archive_p (bfd *); | |
500 | bfd * bfd_mach_o_openr_next_archived_file (bfd *, bfd *); | |
501 | int bfd_mach_o_lookup_section (bfd *, asection *, bfd_mach_o_load_command **, bfd_mach_o_section **); | |
502 | int bfd_mach_o_lookup_command (bfd *, bfd_mach_o_load_command_type, bfd_mach_o_load_command **); | |
503 | unsigned long bfd_mach_o_stack_addr (enum bfd_mach_o_cpu_type); | |
504 | int bfd_mach_o_core_fetch_environment (bfd *, unsigned char **, unsigned int *); | |
505 | char * bfd_mach_o_core_file_failing_command (bfd *); | |
506 | int bfd_mach_o_core_file_failing_signal (bfd *); | |
507 | bfd_boolean bfd_mach_o_core_file_matches_executable_p (bfd *, bfd *); | |
3af9a47b NC |
508 | |
509 | extern const bfd_target mach_o_be_vec; | |
510 | extern const bfd_target mach_o_le_vec; | |
511 | extern const bfd_target mach_o_fat_vec; | |
512 | ||
513 | #endif /* _BFD_MACH_O_H_ */ |