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