Lines Matching defs:mdata

47   bfd_mach_o_data_struct *mdata = NULL;
50 mdata = bfd_mach_o_get_data (abfd);
52 return mdata->header.version;
541 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
543 if (mdata->last_command != NULL)
544 mdata->last_command->next = cmd;
546 mdata->first_command = cmd;
547 mdata->last_command = cmd;
695 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
699 fprintf (file, _(" magic: %#lx\n"), (long) mdata->header.magic);
700 fprintf (file, _(" cputype: %#lx (%s)\n"), (long) mdata->header.cputype,
701 cputype (mdata->header.cputype));
702 fprintf (file, _(" cpusubtype: %#lx%s\n"), (long) mdata->header.cpusubtype,
703 cpusubtype (mdata->header.cputype, mdata->header.cpusubtype, buff));
704 fprintf (file, _(" filetype: %#lx\n"), (long) mdata->header.filetype);
705 fprintf (file, _(" ncmds: %#lx\n"), (long) mdata->header.ncmds);
706 fprintf (file, _(" sizeocmds: %#lx\n"), (long) mdata->header.sizeofcmds);
707 fprintf (file, _(" flags: %#lx\n"), (long) mdata->header.flags);
708 fprintf (file, _(" version: %x\n"), mdata->header.version);
862 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
864 if (!mdata)
867 mdata->header.flags = flags;
876 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
878 if (mdata->symtab == NULL)
880 return mdata->symtab->nsyms;
894 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
896 bfd_mach_o_symtab_command *sym = mdata->symtab;
936 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
937 bfd_mach_o_dysymtab_command *dysymtab = mdata->dysymtab;
938 bfd_mach_o_symtab_command *symtab = mdata->symtab;
979 for (i = 0; i < mdata->nsects; i++)
981 bfd_mach_o_section *sec = mdata->sections[i];
1469 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
1502 if (num > mdata->nsects)
1510 sym = mdata->sections[num - 1]->bfdsection->symbol_ptr_ptr;
1516 res->addend = -mdata->sections[num - 1]->addr;
1544 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
1567 for (j = 0; j < mdata->nsects; j++)
1569 bfd_mach_o_section *sect = mdata->sections[j];
1694 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
1696 if (mdata->dysymtab == NULL)
1698 return (mdata->dysymtab->nextrel + mdata->dysymtab->nlocrel + 1)
1706 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
1707 bfd_mach_o_dysymtab_command *dysymtab = mdata->dysymtab;
1721 if (mdata->dyn_reloc_cache == NULL)
1765 mdata->dyn_reloc_cache = res;
1768 res = mdata->dyn_reloc_cache;
1988 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
2055 sym->stroff = mdata->filelen;
2056 mdata->filelen += sym->strsize;
2068 mdata->filelen += padlen;
2104 bfd_mach_o_count_indirect_symbols (bfd *abfd, bfd_mach_o_data_struct *mdata)
2109 for (i = 0; i < mdata->nsects; ++i)
2111 bfd_mach_o_section *sec = mdata->sections[i];
2132 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
2183 cmd->nindirectsyms = bfd_mach_o_count_indirect_symbols (abfd, mdata);
2190 mdata->filelen = FILE_ALIGN (mdata->filelen, 2);
2191 cmd->indirectsymoff = mdata->filelen;
2194 mdata->filelen += amt;
2201 for (i = 0; i < mdata->nsects; ++i)
2203 bfd_mach_o_section *sec = mdata->sections[i];
2571 bfd_mach_o_mangle_sections (bfd *abfd, bfd_mach_o_data_struct *mdata)
2582 if (mdata->nsects == nsect
2583 && (mdata->nsects == 0 || mdata->sections != NULL))
2594 mdata->nsects = nsect;
2595 amt = mdata->nsects * sizeof (bfd_mach_o_section *);
2596 mdata->sections = bfd_alloc (abfd, amt);
2597 if (mdata->sections == NULL)
2609 mdata->sections[target_index] = msect;
2628 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
2640 if (!bfd_mach_o_write_header (abfd, &mdata->header))
2644 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
2662 di->rebase_off = di->rebase_size != 0 ? mdata->filelen : 0;
2663 mdata->filelen += di->rebase_size;
2664 di->bind_off = di->bind_size != 0 ? mdata->filelen : 0;
2665 mdata->filelen += di->bind_size;
2666 di->weak_bind_off = di->weak_bind_size != 0 ? mdata->filelen : 0;
2667 mdata->filelen += di->weak_bind_size;
2668 di->lazy_bind_off = di->lazy_bind_size != 0 ? mdata->filelen : 0;
2669 mdata->filelen += di->lazy_bind_size;
2670 di->export_off = di->export_size != 0 ? mdata->filelen : 0;
2671 mdata->filelen += di->export_size;
2699 mdata->filelen = FILE_ALIGN (mdata->filelen, wide ? 3 : 2);
2700 symtab->symoff = mdata->filelen;
2703 mdata->filelen += symtab->nsyms * symlen;
2721 linkedit->vmsize = mdata->filelen - linkedit->fileoff;
2723 linkedit->filesize = mdata->filelen - linkedit->fileoff;
2731 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
2832 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
2836 seg->fileoff = mdata->filelen;
2847 for (i = 0; i < mdata->nsects; ++i)
2849 bfd_mach_o_section *s = mdata->sections[i];
2875 mdata->filelen = FILE_ALIGN (mdata->filelen, s->align);
2881 s->offset = mdata->filelen;
2885 mdata->filelen += s->size;
2899 for (i = 0; i < mdata->nsects; ++i)
2901 bfd_mach_o_section *s = mdata->sections[i];
2915 mdata->filelen = FILE_ALIGN (mdata->filelen, 2);
2917 for (i = 0; i < mdata->nsects; ++i)
2919 bfd_mach_o_section *ms = mdata->sections[i];
2929 sec->rel_filepos = mdata->filelen;
2931 mdata->filelen += sec->reloc_count * BFD_MACH_O_RELENT_SIZE;
2940 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
2948 seg->fileoff = mdata->filelen;
2956 for (i = 0; i < mdata->nsects; ++i)
2958 s = mdata->sections[i];
2982 if ((mdata->filelen & pagemask) > (vma & pagemask))
2983 mdata->filelen += pagemask + 1;
2984 seg->fileoff = mdata->filelen & ~pagemask;
2985 mdata->filelen = seg->fileoff + (vma & pagemask);
3004 mdata->filelen = FILE_ALIGN (mdata->filelen, s->align);
3006 s->offset = mdata->filelen;
3010 mdata->filelen += s->size;
3042 mdata->filelen = (mdata->filelen + pagemask) & ~pagemask;
3051 bfd_mach_o_layout_commands (bfd_mach_o_data_struct *mdata)
3053 unsigned wide = mach_o_wide_p (&mdata->header);
3063 mdata->header.ncmds = 0;
3065 for (cmd = mdata->first_command; cmd; cmd = cmd->next)
3067 mdata->header.ncmds++;
3121 mdata->header.sizeofcmds = offset - hdrlen;
3122 mdata->filelen = offset;
3131 bfd_mach_o_init_segment (bfd_mach_o_data_struct *mdata,
3136 unsigned wide = mach_o_wide_p (&mdata->header);
3164 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
3165 unsigned wide = mach_o_wide_p (&mdata->header);
3175 if (mdata->header.ncmds != 0)
3179 if (mdata->header.filetype == 0)
3182 mdata->header.filetype = BFD_MACH_O_MH_EXECUTE;
3184 mdata->header.filetype = BFD_MACH_O_MH_DYLIB;
3186 mdata->header.filetype = BFD_MACH_O_MH_OBJECT;
3192 if (mdata->nsects == 0 || mdata->sections == NULL)
3193 if (! bfd_mach_o_mangle_sections (abfd, mdata))
3202 if (mdata->header.filetype == BFD_MACH_O_MH_OBJECT)
3206 nbr_segcmd = (mdata->nsects > 0) ? 1 : 0;
3217 for (i = 0; i < mdata->nsects; i++)
3219 bfd_mach_o_section *this_sect = mdata->sections[i];
3247 if (mdata->header.filetype == BFD_MACH_O_MH_EXECUTE
3252 mdata->filelen = wide ? BFD_MACH_O_HEADER_64_SIZE : BFD_MACH_O_HEADER_SIZE;
3259 return bfd_mach_o_layout_commands (mdata);
3268 commands[nbr_commands - 1].next = mdata->first_command;
3269 if (mdata->first_command == NULL)
3270 mdata->last_command = &commands[nbr_commands - 1];
3271 mdata->first_command = &commands[0];
3273 if (mdata->header.filetype == BFD_MACH_O_MH_OBJECT && nbr_segcmd != 0)
3276 bfd_mach_o_init_segment (mdata, &commands[0], "", mdata->nsects);
3286 bfd_mach_o_init_segment (mdata, cmd, "__PAGEZERO", 0);
3290 for (i = 0; i < mdata->nsects;)
3292 const char *segname = mdata->sections[i]->segname;
3296 for (i++; i < mdata->nsects; i++)
3297 if (strcmp (mdata->sections[i]->segname, segname) == 0)
3302 bfd_mach_o_init_segment (mdata, cmd, segname, nbr_sect);
3307 bfd_mach_o_init_segment (mdata, cmd, "__LINKEDIT", 0);
3342 if (! bfd_mach_o_layout_commands (mdata))
3347 if (mdata->header.filetype == BFD_MACH_O_MH_OBJECT)
3376 commands[nbr_segcmd - 1].command.segment.fileoff = mdata->filelen;
3721 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
3722 unsigned int wide = mach_o_wide_p (&mdata->header);
3790 if ((section > 0) && (section <= mdata->nsects))
3792 s->symbol.section = mdata->sections[section - 1]->bfdsection;
3794 s->symbol.value - mdata->sections[section - 1]->addr;
3830 if ((section > 0) && (section <= mdata->nsects))
3832 s->symbol.section = mdata->sections[section - 1]->bfdsection;
3834 s->symbol.value - mdata->sections[section - 1]->addr;
3846 s->symbol.name, section, mdata->nsects);
3876 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
3877 bfd_mach_o_symtab_command *sym = mdata->symtab;
3922 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
3923 bfd_mach_o_symtab_command *sym = mdata->symtab;
3935 unsigned int wide = mach_o_wide_p (&mdata->header);
4048 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
4083 pos = mdata->hdr_offset + cmd->name_offset;
4185 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
4252 switch (mdata->header.cputype)
4301 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
4517 if (mdata->dysymtab)
4519 mdata->dysymtab = cmd;
4529 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
4558 if (mdata->symtab)
4560 mdata->symtab = symtab;
4920 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
4925 if (bfd_seek (abfd, mdata->hdr_offset + command->offset, SEEK_SET) != 0
5072 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
5078 mdata->nsects = 0;
5080 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
5087 mdata->nsects += seg->nsects;
5092 if (_bfd_mul_overflow (mdata->nsects, sizeof (bfd_mach_o_section *), &amt))
5097 mdata->sections = bfd_alloc (abfd, amt);
5098 if (mdata->sections == NULL && mdata->nsects != 0)
5104 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
5112 BFD_ASSERT (csect + seg->nsects <= mdata->nsects);
5115 mdata->sections[csect++] = sec;
5124 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
5129 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
5136 else if (cmd->type == BFD_MACH_O_LC_MAIN && mdata->nsects > 1)
5139 bfd_mach_o_section *text_sect = mdata->sections[0];
5156 if ((mdata->header.cputype == BFD_MACH_O_CPU_TYPE_I386)
5167 else if ((mdata->header.cputype == BFD_MACH_O_CPU_TYPE_POWERPC)
5178 else if ((mdata->header.cputype == BFD_MACH_O_CPU_TYPE_POWERPC_64)
5189 else if ((mdata->header.cputype == BFD_MACH_O_CPU_TYPE_X86_64)
5225 bfd_mach_o_data_struct *mdata)
5235 mdata->header = *header;
5252 abfd->tdata.mach_o_data = mdata;
5276 mdata->first_command = NULL;
5277 mdata->last_command = NULL;
5325 bfd_mach_o_data_struct *mdata = NULL;
5327 mdata = bfd_zalloc (abfd, sizeof (bfd_mach_o_data_struct));
5328 if (mdata == NULL)
5330 abfd->tdata.mach_o_data = mdata;
5332 mdata->header.magic = 0;
5333 mdata->header.cputype = 0;
5334 mdata->header.cpusubtype = 0;
5335 mdata->header.filetype = 0;
5336 mdata->header.ncmds = 0;
5337 mdata->header.sizeofcmds = 0;
5338 mdata->header.flags = 0;
5339 mdata->header.byteorder = BFD_ENDIAN_UNKNOWN;
5340 mdata->first_command = NULL;
5341 mdata->last_command = NULL;
5342 mdata->nsects = 0;
5343 mdata->sections = NULL;
5344 mdata->dyn_reloc_cache = NULL;
5352 bfd_mach_o_data_struct *mdata;
5357 mdata = bfd_mach_o_get_data (abfd);
5358 mdata->header.magic = BFD_MACH_O_MH_MAGIC;
5359 mdata->header.cputype = 0;
5360 mdata->header.cpusubtype = 0;
5361 mdata->header.byteorder = abfd->xvec->byteorder;
5362 mdata->header.version = 1;
5374 bfd_mach_o_data_struct *mdata;
5430 mdata = (bfd_mach_o_data_struct *) bfd_zalloc (abfd, sizeof (*mdata));
5431 if (mdata == NULL)
5433 mdata->hdr_offset = hdr_off;
5435 if (!bfd_mach_o_scan (abfd, &header, mdata))
5465 bfd_mach_o_data_struct *mdata;
5471 mdata = bfd_mach_o_get_data (abfd);
5473 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
5787 struct mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
5791 BFD_ASSERT (mdata != NULL);
5795 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
5909 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
5910 unsigned long stackaddr = bfd_mach_o_stack_addr (mdata->header.cputype);
5913 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
6147 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
6148 if (mdata == NULL)
6150 switch (mdata->header.filetype)
6158 if (mdata->dwarf2_find_line_info == NULL)
6160 mdata->dsym_bfd = bfd_mach_o_follow_dsym (abfd);
6164 mdata->dwarf2_find_line_info will be filled. */
6165 if (! mdata->dsym_bfd)
6167 if (! _bfd_dwarf2_slurp_debug_info (abfd, mdata->dsym_bfd,
6169 &mdata->dwarf2_find_line_info,
6181 &mdata->dwarf2_find_line_info);
6187 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
6188 if (bfd_get_format (abfd) == bfd_object && mdata != NULL)
6190 _bfd_dwarf2_cleanup_debug_info (abfd, &mdata->dwarf2_find_line_info);
6192 if (mdata->dsym_bfd != NULL)
6194 bfd *fat_bfd = mdata->dsym_bfd->my_archive;
6206 : bfd_get_filename (mdata->dsym_bfd));
6208 bfd_close (mdata->dsym_bfd);
6209 mdata->dsym_bfd = NULL;
6224 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
6226 free (mdata->dyn_reloc_cache);
6227 mdata->dyn_reloc_cache = NULL;