OSDN Git Service

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