* frv.opc (parse_uhi16): Fix handling of %hi operator on 64-bit
[deliverable/binutils-gdb.git] / bfd / mach-o.h
CommitLineData
3af9a47b 1/* Mach-O support for BFD.
a4551119 2 Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2009, 2011
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"
74f26653 26#include "mach-o/loader.h"
15e1c58a 27
3af9a47b
NC
28typedef struct bfd_mach_o_header
29{
30 unsigned long magic;
31 unsigned long cputype;
32 unsigned long cpusubtype;
33 unsigned long filetype;
34 unsigned long ncmds;
35 unsigned long sizeofcmds;
36 unsigned long flags;
1e8a024a
TG
37 unsigned int reserved;
38 /* Version 1: 32 bits, version 2: 64 bits. */
39 unsigned int version;
3af9a47b
NC
40 enum bfd_endian byteorder;
41}
42bfd_mach_o_header;
43
f1bde64c
TG
44#define BFD_MACH_O_SEGNAME_SIZE 16
45#define BFD_MACH_O_SECTNAME_SIZE 16
46
3af9a47b
NC
47typedef struct bfd_mach_o_section
48{
53d58d96 49 /* Fields present in the file. */
f1bde64c
TG
50 char sectname[BFD_MACH_O_SECTNAME_SIZE + 1]; /* Always NUL padded. */
51 char segname[BFD_MACH_O_SEGNAME_SIZE + 1];
3af9a47b
NC
52 bfd_vma addr;
53 bfd_vma size;
54 bfd_vma offset;
55 unsigned long align;
56 bfd_vma reloff;
57 unsigned long nreloc;
58 unsigned long flags;
59 unsigned long reserved1;
60 unsigned long reserved2;
1e8a024a 61 unsigned long reserved3;
53d58d96
TG
62
63 /* Corresponding bfd section. */
64 asection *bfdsection;
f1bde64c
TG
65
66 /* Simply linked list. */
67 struct bfd_mach_o_section *next;
3af9a47b
NC
68}
69bfd_mach_o_section;
70
71typedef struct bfd_mach_o_segment_command
72{
a4551119 73 char segname[BFD_MACH_O_SEGNAME_SIZE + 1];
3af9a47b
NC
74 bfd_vma vmaddr;
75 bfd_vma vmsize;
76 bfd_vma fileoff;
77 unsigned long filesize;
15e1c58a
TG
78 unsigned long maxprot; /* Maximum permitted protection. */
79 unsigned long initprot; /* Initial protection. */
3af9a47b
NC
80 unsigned long nsects;
81 unsigned long flags;
f1bde64c
TG
82
83 /* Linked list of sections. */
84 bfd_mach_o_section *sect_head;
85 bfd_mach_o_section *sect_tail;
3af9a47b
NC
86}
87bfd_mach_o_segment_command;
88
15e1c58a
TG
89/* Protection flags. */
90#define BFD_MACH_O_PROT_READ 0x01
91#define BFD_MACH_O_PROT_WRITE 0x02
92#define BFD_MACH_O_PROT_EXECUTE 0x04
93
92bc0e80
TG
94/* Expanded internal representation of a relocation entry. */
95typedef struct bfd_mach_o_reloc_info
96{
97 bfd_vma r_address;
98 bfd_vma r_value;
99 unsigned int r_scattered : 1;
100 unsigned int r_type : 4;
101 unsigned int r_pcrel : 1;
102 unsigned int r_length : 2;
103 unsigned int r_extern : 1;
104}
105bfd_mach_o_reloc_info;
106
107typedef struct bfd_mach_o_asymbol
108{
109 /* The actual symbol which the rest of BFD works with. */
110 asymbol symbol;
111
112 /* Fields from Mach-O symbol. */
113 unsigned char n_type;
114 unsigned char n_sect;
115 unsigned short n_desc;
116}
117bfd_mach_o_asymbol;
118
3af9a47b
NC
119typedef struct bfd_mach_o_symtab_command
120{
92bc0e80
TG
121 unsigned int symoff;
122 unsigned int nsyms;
123 unsigned int stroff;
124 unsigned int strsize;
125 bfd_mach_o_asymbol *symbols;
3af9a47b 126 char *strtab;
3af9a47b
NC
127}
128bfd_mach_o_symtab_command;
129
130/* This is the second set of the symbolic information which is used to support
7dee875e 131 the data structures for the dynamically link editor.
e84d6fca 132
3af9a47b
NC
133 The original set of symbolic information in the symtab_command which contains
134 the symbol and string tables must also be present when this load command is
135 present. When this load command is present the symbol table is organized
136 into three groups of symbols:
137 local symbols (static and debugging symbols) - grouped by module
138 defined external symbols - grouped by module (sorted by name if not lib)
139 undefined external symbols (sorted by name)
140 In this load command there are offsets and counts to each of the three groups
141 of symbols.
e84d6fca 142
3af9a47b
NC
143 This load command contains a the offsets and sizes of the following new
144 symbolic information tables:
145 table of contents
146 module table
147 reference symbol table
148 indirect symbol table
149 The first three tables above (the table of contents, module table and
7dee875e 150 reference symbol table) are only present if the file is a dynamically linked
3af9a47b
NC
151 shared library. For executable and object modules, which are files
152 containing only one module, the information that would be in these three
153 tables is determined as follows:
154 table of contents - the defined external symbols are sorted by name
155 module table - the file contains only one module so everything in the
156 file is part of the module.
157 reference symbol table - is the defined and undefined external symbols
e84d6fca 158
7dee875e 159 For dynamically linked shared library files this load command also contains
3af9a47b
NC
160 offsets and sizes to the pool of relocation entries for all sections
161 separated into two groups:
162 external relocation entries
163 local relocation entries
164 For executable and object modules the relocation entries continue to hang
165 off the section structures. */
166
046b007d
TG
167typedef struct bfd_mach_o_dylib_module
168{
169 /* Index into the string table indicating the name of the module. */
170 unsigned long module_name_idx;
171 char *module_name;
172
173 /* Index into the symbol table of the first defined external symbol provided
174 by the module. */
175 unsigned long iextdefsym;
176
177 /* Number of external symbols provided by this module. */
178 unsigned long nextdefsym;
179
180 /* Index into the external reference table of the first entry
181 provided by this module. */
182 unsigned long irefsym;
183
184 /* Number of external reference entries provided by this module. */
185 unsigned long nrefsym;
186
187 /* Index into the symbol table of the first local symbol provided by this
188 module. */
189 unsigned long ilocalsym;
190
191 /* Number of local symbols provided by this module. */
192 unsigned long nlocalsym;
193
194 /* Index into the external relocation table of the first entry provided
195 by this module. */
196 unsigned long iextrel;
197
198 /* Number of external relocation entries provided by this module. */
199 unsigned long nextrel;
200
201 /* Index in the module initialization section to the pointers for this
202 module. */
203 unsigned short iinit;
204
205 /* Index in the module termination section to the pointers for this
206 module. */
207 unsigned short iterm;
208
209 /* Number of pointers in the module initialization for this module. */
210 unsigned short ninit;
211
212 /* Number of pointers in the module termination for this module. */
213 unsigned short nterm;
214
215 /* Number of data byte for this module that are used in the __module_info
216 section of the __OBJC segment. */
217 unsigned long objc_module_info_size;
218
219 /* Statically linked address of the start of the data for this module
220 in the __module_info section of the __OBJC_segment. */
221 bfd_vma objc_module_info_addr;
222}
223bfd_mach_o_dylib_module;
046b007d
TG
224
225typedef struct bfd_mach_o_dylib_table_of_content
226{
227 /* Index into the symbol table to the defined external symbol. */
228 unsigned long symbol_index;
229
230 /* Index into the module table to the module for this entry. */
231 unsigned long module_index;
232}
233bfd_mach_o_dylib_table_of_content;
046b007d
TG
234
235typedef struct bfd_mach_o_dylib_reference
236{
237 /* Index into the symbol table for the symbol being referenced. */
238 unsigned long isym;
239
240 /* Type of the reference being made (use REFERENCE_FLAGS constants). */
241 unsigned long flags;
242}
243bfd_mach_o_dylib_reference;
244#define BFD_MACH_O_REFERENCE_SIZE 4
245
3af9a47b
NC
246typedef struct bfd_mach_o_dysymtab_command
247{
248 /* The symbols indicated by symoff and nsyms of the LC_SYMTAB load command
249 are grouped into the following three groups:
250 local symbols (further grouped by the module they are from)
251 defined external symbols (further grouped by the module they are from)
252 undefined symbols
e84d6fca 253
3af9a47b
NC
254 The local symbols are used only for debugging. The dynamic binding
255 process may have to use them to indicate to the debugger the local
256 symbols for a module that is being bound.
e84d6fca 257
3af9a47b
NC
258 The last two groups are used by the dynamic binding process to do the
259 binding (indirectly through the module table and the reference symbol
7dee875e 260 table when this is a dynamically linked shared library file). */
3af9a47b
NC
261
262 unsigned long ilocalsym; /* Index to local symbols. */
263 unsigned long nlocalsym; /* Number of local symbols. */
264 unsigned long iextdefsym; /* Index to externally defined symbols. */
265 unsigned long nextdefsym; /* Number of externally defined symbols. */
266 unsigned long iundefsym; /* Index to undefined symbols. */
267 unsigned long nundefsym; /* Number of undefined symbols. */
268
269 /* For the for the dynamic binding process to find which module a symbol
270 is defined in the table of contents is used (analogous to the ranlib
271 structure in an archive) which maps defined external symbols to modules
7dee875e 272 they are defined in. This exists only in a dynamically linked shared
3af9a47b
NC
273 library file. For executable and object modules the defined external
274 symbols are sorted by name and is use as the table of contents. */
275
276 unsigned long tocoff; /* File offset to table of contents. */
277 unsigned long ntoc; /* Number of entries in table of contents. */
278
279 /* To support dynamic binding of "modules" (whole object files) the symbol
280 table must reflect the modules that the file was created from. This is
281 done by having a module table that has indexes and counts into the merged
282 tables for each module. The module structure that these two entries
7dee875e 283 refer to is described below. This exists only in a dynamically linked
3af9a47b
NC
284 shared library file. For executable and object modules the file only
285 contains one module so everything in the file belongs to the module. */
286
287 unsigned long modtaboff; /* File offset to module table. */
288 unsigned long nmodtab; /* Number of module table entries. */
289
290 /* To support dynamic module binding the module structure for each module
291 indicates the external references (defined and undefined) each module
292 makes. For each module there is an offset and a count into the
293 reference symbol table for the symbols that the module references.
7dee875e 294 This exists only in a dynamically linked shared library file. For
3af9a47b
NC
295 executable and object modules the defined external symbols and the
296 undefined external symbols indicates the external references. */
297
298 unsigned long extrefsymoff; /* Offset to referenced symbol table. */
299 unsigned long nextrefsyms; /* Number of referenced symbol table entries. */
300
301 /* The sections that contain "symbol pointers" and "routine stubs" have
302 indexes and (implied counts based on the size of the section and fixed
303 size of the entry) into the "indirect symbol" table for each pointer
304 and stub. For every section of these two types the index into the
305 indirect symbol table is stored in the section header in the field
306 reserved1. An indirect symbol table entry is simply a 32bit index into
307 the symbol table to the symbol that the pointer or stub is referring to.
308 The indirect symbol table is ordered to match the entries in the section. */
309
310 unsigned long indirectsymoff; /* File offset to the indirect symbol table. */
311 unsigned long nindirectsyms; /* Number of indirect symbol table entries. */
312
313 /* To support relocating an individual module in a library file quickly the
314 external relocation entries for each module in the library need to be
315 accessed efficiently. Since the relocation entries can't be accessed
316 through the section headers for a library file they are separated into
317 groups of local and external entries further grouped by module. In this
318 case the presents of this load command who's extreloff, nextrel,
319 locreloff and nlocrel fields are non-zero indicates that the relocation
320 entries of non-merged sections are not referenced through the section
321 structures (and the reloff and nreloc fields in the section headers are
322 set to zero).
323
324 Since the relocation entries are not accessed through the section headers
325 this requires the r_address field to be something other than a section
326 offset to identify the item to be relocated. In this case r_address is
327 set to the offset from the vmaddr of the first LC_SEGMENT command.
328
329 The relocation entries are grouped by module and the module table
330 entries have indexes and counts into them for the group of external
331 relocation entries for that the module.
332
333 For sections that are merged across modules there must not be any
334 remaining external relocation entries for them (for merged sections
335 remaining relocation entries must be local). */
336
337 unsigned long extreloff; /* Offset to external relocation entries. */
338 unsigned long nextrel; /* Number of external relocation entries. */
339
340 /* All the local relocation entries are grouped together (they are not
341 grouped by their module since they are only used if the object is moved
7dee875e 342 from it statically link edited address). */
3af9a47b
NC
343
344 unsigned long locreloff; /* Offset to local relocation entries. */
345 unsigned long nlocrel; /* Number of local relocation entries. */
046b007d
TG
346
347 bfd_mach_o_dylib_module *dylib_module;
348 bfd_mach_o_dylib_table_of_content *dylib_toc;
349 unsigned int *indirect_syms;
350 bfd_mach_o_dylib_reference *ext_refs;
3af9a47b 351}
e84d6fca 352bfd_mach_o_dysymtab_command;
3af9a47b 353
e84d6fca 354/* An indirect symbol table entry is simply a 32bit index into the symbol table
3af9a47b 355 to the symbol that the pointer or stub is refering to. Unless it is for a
046b007d 356 non-lazy symbol pointer section for a defined symbol which strip(1) has
3af9a47b
NC
357 removed. In which case it has the value INDIRECT_SYMBOL_LOCAL. If the
358 symbol was also absolute INDIRECT_SYMBOL_ABS is or'ed with that. */
359
15e1c58a
TG
360#define BFD_MACH_O_INDIRECT_SYMBOL_LOCAL 0x80000000
361#define BFD_MACH_O_INDIRECT_SYMBOL_ABS 0x40000000
046b007d 362#define BFD_MACH_O_INDIRECT_SYMBOL_SIZE 4
3af9a47b 363
b32e07d7
TG
364/* For LC_THREAD or LC_UNIXTHREAD. */
365
3af9a47b
NC
366typedef struct bfd_mach_o_thread_flavour
367{
368 unsigned long flavour;
b32e07d7 369 unsigned long offset;
3af9a47b
NC
370 unsigned long size;
371}
372bfd_mach_o_thread_flavour;
373
374typedef struct bfd_mach_o_thread_command
375{
376 unsigned long nflavours;
e84d6fca 377 bfd_mach_o_thread_flavour *flavours;
3af9a47b
NC
378 asection *section;
379}
380bfd_mach_o_thread_command;
381
046b007d
TG
382/* For LC_LOAD_DYLINKER and LC_ID_DYLINKER. */
383
3af9a47b
NC
384typedef struct bfd_mach_o_dylinker_command
385{
846b9259
TG
386 unsigned long name_offset; /* Offset to library's path name. */
387 unsigned long name_len; /* Offset to library's path name. */
b32e07d7 388 char *name_str;
3af9a47b
NC
389}
390bfd_mach_o_dylinker_command;
391
046b007d
TG
392/* For LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, LC_ID_DYLIB
393 or LC_REEXPORT_DYLIB. */
394
3af9a47b
NC
395typedef struct bfd_mach_o_dylib_command
396{
3af9a47b
NC
397 unsigned long name_offset; /* Offset to library's path name. */
398 unsigned long name_len; /* Offset to library's path name. */
399 unsigned long timestamp; /* Library's build time stamp. */
400 unsigned long current_version; /* Library's current version number. */
401 unsigned long compatibility_version; /* Library's compatibility vers number. */
b32e07d7 402 char *name_str;
3af9a47b
NC
403}
404bfd_mach_o_dylib_command;
405
046b007d
TG
406/* For LC_PREBOUND_DYLIB. */
407
3af9a47b
NC
408typedef struct bfd_mach_o_prebound_dylib_command
409{
3af9a47b
NC
410 unsigned long name; /* Library's path name. */
411 unsigned long nmodules; /* Number of modules in library. */
412 unsigned long linked_modules; /* Bit vector of linked modules. */
3af9a47b
NC
413}
414bfd_mach_o_prebound_dylib_command;
415
046b007d
TG
416/* For LC_UUID. */
417
15e1c58a
TG
418typedef struct bfd_mach_o_uuid_command
419{
046b007d 420 unsigned char uuid[16];
15e1c58a
TG
421}
422bfd_mach_o_uuid_command;
423
046b007d
TG
424/* For LC_CODE_SIGNATURE or LC_SEGMENT_SPLIT_INFO. */
425
426typedef struct bfd_mach_o_linkedit_command
427{
428 unsigned long dataoff;
429 unsigned long datasize;
430}
431bfd_mach_o_linkedit_command;
432
433typedef struct bfd_mach_o_str_command
434{
435 unsigned long stroff;
436 unsigned long str_len;
437 char *str;
438}
439bfd_mach_o_str_command;
440
ad86f1fb
TG
441typedef struct bfd_mach_o_dyld_info_command
442{
443 /* File offset and size to rebase info. */
444 unsigned int rebase_off;
445 unsigned int rebase_size;
446
447 /* File offset and size of binding info. */
448 unsigned int bind_off;
449 unsigned int bind_size;
450
451 /* File offset and size of weak binding info. */
452 unsigned int weak_bind_off;
453 unsigned int weak_bind_size;
454
455 /* File offset and size of lazy binding info. */
456 unsigned int lazy_bind_off;
457 unsigned int lazy_bind_size;
458
459 /* File offset and size of export info. */
460 unsigned int export_off;
461 unsigned int export_size;
462}
463bfd_mach_o_dyld_info_command;
464
edbdea0e
TG
465typedef struct bfd_mach_o_version_min_command
466{
467 unsigned char rel;
468 unsigned char maj;
469 unsigned char min;
470 unsigned int reserved;
471}
472bfd_mach_o_version_min_command;
473
3af9a47b
NC
474typedef struct bfd_mach_o_load_command
475{
476 bfd_mach_o_load_command_type type;
154a1ee5 477 bfd_boolean type_required;
92bc0e80
TG
478 unsigned int offset;
479 unsigned int len;
3af9a47b
NC
480 union
481 {
482 bfd_mach_o_segment_command segment;
483 bfd_mach_o_symtab_command symtab;
484 bfd_mach_o_dysymtab_command dysymtab;
485 bfd_mach_o_thread_command thread;
486 bfd_mach_o_dylib_command dylib;
487 bfd_mach_o_dylinker_command dylinker;
488 bfd_mach_o_prebound_dylib_command prebound_dylib;
15e1c58a 489 bfd_mach_o_uuid_command uuid;
046b007d
TG
490 bfd_mach_o_linkedit_command linkedit;
491 bfd_mach_o_str_command str;
ad86f1fb 492 bfd_mach_o_dyld_info_command dyld_info;
edbdea0e 493 bfd_mach_o_version_min_command version_min;
3af9a47b
NC
494 }
495 command;
496}
497bfd_mach_o_load_command;
498
499typedef struct mach_o_data_struct
500{
92bc0e80 501 /* Mach-O header. */
3af9a47b 502 bfd_mach_o_header header;
92bc0e80 503 /* Array of load commands (length is given by header.ncmds). */
3af9a47b 504 bfd_mach_o_load_command *commands;
92bc0e80
TG
505
506 /* Flatten array of sections. The array is 0-based. */
3af9a47b
NC
507 unsigned long nsects;
508 bfd_mach_o_section **sections;
92bc0e80
TG
509
510 /* Used while writting: current length of the output file. This is used
511 to allocate space in the file. */
512 ufile_ptr filelen;
046b007d
TG
513
514 /* As symtab is referenced by other load command, it is handy to have
edbdea0e 515 a direct access to it. Although it is not clearly stated, only one symtab
046b007d
TG
516 is expected. */
517 bfd_mach_o_symtab_command *symtab;
b32e07d7 518 bfd_mach_o_dysymtab_command *dysymtab;
d9071b0c
TG
519
520 /* A place to stash dwarf2 info for this bfd. */
521 void *dwarf2_find_line_info;
3af9a47b 522}
046b007d 523bfd_mach_o_data_struct;
3af9a47b 524
c5012cd8
TG
525typedef struct bfd_mach_o_xlat_name
526{
527 const char *name;
528 unsigned long val;
529}
530bfd_mach_o_xlat_name;
531
92bc0e80 532/* Target specific routines. */
15e1c58a 533
046b007d 534#define bfd_mach_o_get_data(abfd) ((abfd)->tdata.mach_o_data)
92bc0e80
TG
535#define bfd_mach_o_get_backend_data(abfd) \
536 ((bfd_mach_o_backend_data*)(abfd)->xvec->backend_data)
3af9a47b 537
f1bde64c
TG
538/* Get the Mach-O header for section SEC. */
539#define bfd_mach_o_get_mach_o_section(sec) \
540 ((bfd_mach_o_section *)(sec)->used_by_bfd)
541
154a1ee5 542bfd_boolean bfd_mach_o_valid (bfd *);
154a1ee5
TG
543bfd_boolean bfd_mach_o_mkobject_init (bfd *);
544const bfd_target *bfd_mach_o_object_p (bfd *);
545const bfd_target *bfd_mach_o_core_p (bfd *);
546const bfd_target *bfd_mach_o_archive_p (bfd *);
547bfd *bfd_mach_o_openr_next_archived_file (bfd *, bfd *);
42fa0891
TG
548bfd_boolean bfd_mach_o_set_arch_mach (bfd *, enum bfd_architecture,
549 unsigned long);
154a1ee5 550int bfd_mach_o_lookup_command (bfd *, bfd_mach_o_load_command_type, bfd_mach_o_load_command **);
f1bde64c 551bfd_boolean bfd_mach_o_new_section_hook (bfd *, asection *);
154a1ee5
TG
552bfd_boolean bfd_mach_o_write_contents (bfd *);
553bfd_boolean bfd_mach_o_bfd_copy_private_symbol_data (bfd *, asymbol *,
554 bfd *, asymbol *);
555bfd_boolean bfd_mach_o_bfd_copy_private_section_data (bfd *, asection *,
556 bfd *, asection *);
557bfd_boolean bfd_mach_o_bfd_copy_private_bfd_data (bfd *, bfd *);
558long bfd_mach_o_get_symtab_upper_bound (bfd *);
559long bfd_mach_o_canonicalize_symtab (bfd *, asymbol **);
b2b62060
TG
560long bfd_mach_o_get_synthetic_symtab (bfd *, long, asymbol **, long,
561 asymbol **, asymbol **ret);
b32e07d7
TG
562long bfd_mach_o_get_reloc_upper_bound (bfd *, asection *);
563long bfd_mach_o_canonicalize_reloc (bfd *, asection *, arelent **, asymbol **);
564long bfd_mach_o_get_dynamic_reloc_upper_bound (bfd *);
565long bfd_mach_o_canonicalize_dynamic_reloc (bfd *, arelent **, asymbol **);
154a1ee5
TG
566asymbol *bfd_mach_o_make_empty_symbol (bfd *);
567void bfd_mach_o_get_symbol_info (bfd *, asymbol *, symbol_info *);
568void bfd_mach_o_print_symbol (bfd *, PTR, asymbol *, bfd_print_symbol_type);
154a1ee5
TG
569int bfd_mach_o_sizeof_headers (bfd *, struct bfd_link_info *);
570unsigned long bfd_mach_o_stack_addr (enum bfd_mach_o_cpu_type);
571int bfd_mach_o_core_fetch_environment (bfd *, unsigned char **, unsigned int *);
572char *bfd_mach_o_core_file_failing_command (bfd *);
573int bfd_mach_o_core_file_failing_signal (bfd *);
574bfd_boolean bfd_mach_o_core_file_matches_executable_p (bfd *, bfd *);
846b9259 575bfd *bfd_mach_o_fat_extract (bfd *, bfd_format , const bfd_arch_info_type *);
154a1ee5
TG
576const bfd_target *bfd_mach_o_header_p (bfd *, bfd_mach_o_filetype,
577 bfd_mach_o_cpu_type);
b32e07d7 578bfd_boolean bfd_mach_o_build_commands (bfd *);
154a1ee5
TG
579bfd_boolean bfd_mach_o_set_section_contents (bfd *, asection *, const void *,
580 file_ptr, bfd_size_type);
c2f09c75 581unsigned int bfd_mach_o_version (bfd *);
3af9a47b 582
53d58d96
TG
583unsigned int bfd_mach_o_get_section_type_from_name (const char *);
584unsigned int bfd_mach_o_get_section_attribute_from_name (const char *);
a4551119
TG
585
586void bfd_mach_o_convert_section_name_to_bfd (bfd *, const char *, const char *,
587 const char **, flagword *);
d9071b0c
TG
588bfd_boolean bfd_mach_o_find_nearest_line (bfd *, asection *, asymbol **,
589 bfd_vma, const char **,
590 const char **, unsigned int *);
591bfd_boolean bfd_mach_o_close_and_cleanup (bfd *);
53d58d96 592
c5012cd8
TG
593unsigned int bfd_mach_o_section_get_nbr_indirect (bfd *, bfd_mach_o_section *);
594unsigned int bfd_mach_o_section_get_entry_size (bfd *, bfd_mach_o_section *);
595bfd_boolean bfd_mach_o_read_symtab_symbols (bfd *);
596bfd_boolean bfd_mach_o_read_symtab_strtab (bfd *abfd);
597
598extern const bfd_mach_o_xlat_name bfd_mach_o_section_attribute_name[];
599extern const bfd_mach_o_xlat_name bfd_mach_o_section_type_name[];
600
3af9a47b
NC
601extern const bfd_target mach_o_fat_vec;
602
a4551119
TG
603/* Interfaces between BFD names and Mach-O names. */
604
605typedef struct mach_o_section_name_xlat
606{
607 const char *bfd_name;
608 const char *mach_o_name;
609 flagword bfd_flags;
610 unsigned int macho_sectype;
611 unsigned int macho_secattr;
612 unsigned int sectalign;
613} mach_o_section_name_xlat;
614
615typedef struct mach_o_segment_name_xlat
616{
617 const char *segname;
618 const mach_o_section_name_xlat *sections;
619} mach_o_segment_name_xlat;
620
621const mach_o_section_name_xlat *
622bfd_mach_o_section_data_for_mach_sect (bfd *, const char *, const char *);
623const mach_o_section_name_xlat *
624bfd_mach_o_section_data_for_bfd_name (bfd *, const char *, const char **);
625
626typedef struct bfd_mach_o_backend_data
627{
628 enum bfd_architecture arch;
629 bfd_boolean (*_bfd_mach_o_swap_reloc_in)(arelent *, bfd_mach_o_reloc_info *);
630 bfd_boolean (*_bfd_mach_o_swap_reloc_out)(arelent *, bfd_mach_o_reloc_info *);
631 bfd_boolean (*_bfd_mach_o_print_thread)(bfd *, bfd_mach_o_thread_flavour *,
632 void *, char *);
633 const mach_o_segment_name_xlat *segsec_names_xlat;
634}
635bfd_mach_o_backend_data;
636
3af9a47b 637#endif /* _BFD_MACH_O_H_ */
This page took 0.521237 seconds and 4 git commands to generate.