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;
550 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
552 if (mdata->last_command != NULL)
553 mdata->last_command->next = cmd;
555 mdata->first_command = cmd;
556 mdata->last_command = cmd;
704 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
708 fprintf (file, _(" magic: %#lx\n"), (long) mdata->header.magic);
709 fprintf (file, _(" cputype: %#lx (%s)\n"), (long) mdata->header.cputype,
710 cputype (mdata->header.cputype));
711 fprintf (file, _(" cpusubtype: %#lx%s\n"), (long) mdata->header.cpusubtype,
712 cpusubtype (mdata->header.cputype, mdata->header.cpusubtype, buff));
713 fprintf (file, _(" filetype: %#lx\n"), (long) mdata->header.filetype);
714 fprintf (file, _(" ncmds: %#lx\n"), (long) mdata->header.ncmds);
715 fprintf (file, _(" sizeocmds: %#lx\n"), (long) mdata->header.sizeofcmds);
716 fprintf (file, _(" flags: %#lx\n"), (long) mdata->header.flags);
717 fprintf (file, _(" version: %x\n"), mdata->header.version);
871 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
873 if (!mdata)
876 mdata->header.flags = flags;
885 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
887 if (mdata->symtab == NULL)
889 return mdata->symtab->nsyms;
903 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
905 bfd_mach_o_symtab_command *sym = mdata->symtab;
945 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
946 bfd_mach_o_dysymtab_command *dysymtab = mdata->dysymtab;
947 bfd_mach_o_symtab_command *symtab = mdata->symtab;
988 for (i = 0; i < mdata->nsects; i++)
990 bfd_mach_o_section *sec = mdata->sections[i];
1478 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
1511 if (num > mdata->nsects)
1519 sym = mdata->sections[num - 1]->bfdsection->symbol_ptr_ptr;
1525 res->addend = -mdata->sections[num - 1]->addr;
1553 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
1576 for (j = 0; j < mdata->nsects; j++)
1578 bfd_mach_o_section *sect = mdata->sections[j];
1703 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
1704 bfd_mach_o_dysymtab_command *dysymtab = mdata->dysymtab;
1740 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
1741 bfd_mach_o_dysymtab_command *dysymtab = mdata->dysymtab;
1755 if (mdata->dyn_reloc_cache == NULL)
1777 mdata->dyn_reloc_cache = res;
1780 res = mdata->dyn_reloc_cache;
2000 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
2067 sym->stroff = mdata->filelen;
2068 mdata->filelen += sym->strsize;
2082 mdata->filelen += padlen;
2118 bfd_mach_o_count_indirect_symbols (bfd *abfd, bfd_mach_o_data_struct *mdata)
2123 for (i = 0; i < mdata->nsects; ++i)
2125 bfd_mach_o_section *sec = mdata->sections[i];
2146 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
2197 cmd->nindirectsyms = bfd_mach_o_count_indirect_symbols (abfd, mdata);
2204 mdata->filelen = FILE_ALIGN (mdata->filelen, 2);
2205 cmd->indirectsymoff = mdata->filelen;
2208 mdata->filelen += amt;
2215 for (i = 0; i < mdata->nsects; ++i)
2217 bfd_mach_o_section *sec = mdata->sections[i];
2585 bfd_mach_o_mangle_sections (bfd *abfd, bfd_mach_o_data_struct *mdata)
2596 if (mdata->nsects == nsect
2597 && (mdata->nsects == 0 || mdata->sections != NULL))
2608 mdata->nsects = nsect;
2609 amt = mdata->nsects * sizeof (bfd_mach_o_section *);
2610 mdata->sections = bfd_alloc (abfd, amt);
2611 if (mdata->sections == NULL)
2623 mdata->sections[target_index] = msect;
2642 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
2654 if (!bfd_mach_o_write_header (abfd, &mdata->header))
2658 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
2676 di->rebase_off = di->rebase_size != 0 ? mdata->filelen : 0;
2677 mdata->filelen += di->rebase_size;
2678 di->bind_off = di->bind_size != 0 ? mdata->filelen : 0;
2679 mdata->filelen += di->bind_size;
2680 di->weak_bind_off = di->weak_bind_size != 0 ? mdata->filelen : 0;
2681 mdata->filelen += di->weak_bind_size;
2682 di->lazy_bind_off = di->lazy_bind_size != 0 ? mdata->filelen : 0;
2683 mdata->filelen += di->lazy_bind_size;
2684 di->export_off = di->export_size != 0 ? mdata->filelen : 0;
2685 mdata->filelen += di->export_size;
2713 mdata->filelen = FILE_ALIGN (mdata->filelen, wide ? 3 : 2);
2714 symtab->symoff = mdata->filelen;
2717 mdata->filelen += symtab->nsyms * symlen;
2735 linkedit->vmsize = mdata->filelen - linkedit->fileoff;
2737 linkedit->filesize = mdata->filelen - linkedit->fileoff;
2745 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
2846 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
2850 seg->fileoff = mdata->filelen;
2861 for (i = 0; i < mdata->nsects; ++i)
2863 bfd_mach_o_section *s = mdata->sections[i];
2889 mdata->filelen = FILE_ALIGN (mdata->filelen, s->align);
2895 s->offset = mdata->filelen;
2899 mdata->filelen += s->size;
2913 for (i = 0; i < mdata->nsects; ++i)
2915 bfd_mach_o_section *s = mdata->sections[i];
2929 mdata->filelen = FILE_ALIGN (mdata->filelen, 2);
2931 for (i = 0; i < mdata->nsects; ++i)
2933 bfd_mach_o_section *ms = mdata->sections[i];
2943 sec->rel_filepos = mdata->filelen;
2945 mdata->filelen += sec->reloc_count * BFD_MACH_O_RELENT_SIZE;
2954 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
2962 seg->fileoff = mdata->filelen;
2970 for (i = 0; i < mdata->nsects; ++i)
2972 s = mdata->sections[i];
2996 if ((mdata->filelen & pagemask) > (vma & pagemask))
2997 mdata->filelen += pagemask + 1;
2998 seg->fileoff = mdata->filelen & ~pagemask;
2999 mdata->filelen = seg->fileoff + (vma & pagemask);
3018 mdata->filelen = FILE_ALIGN (mdata->filelen, s->align);
3020 s->offset = mdata->filelen;
3024 mdata->filelen += s->size;
3056 mdata->filelen = (mdata->filelen + pagemask) & ~pagemask;
3065 bfd_mach_o_layout_commands (bfd_mach_o_data_struct *mdata)
3067 unsigned wide = mach_o_wide_p (&mdata->header);
3077 mdata->header.ncmds = 0;
3079 for (cmd = mdata->first_command; cmd; cmd = cmd->next)
3081 mdata->header.ncmds++;
3135 mdata->header.sizeofcmds = offset - hdrlen;
3136 mdata->filelen = offset;
3145 bfd_mach_o_init_segment (bfd_mach_o_data_struct *mdata,
3150 unsigned wide = mach_o_wide_p (&mdata->header);
3178 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
3179 unsigned wide = mach_o_wide_p (&mdata->header);
3189 if (mdata->header.ncmds != 0)
3193 if (mdata->header.filetype == 0)
3196 mdata->header.filetype = BFD_MACH_O_MH_EXECUTE;
3198 mdata->header.filetype = BFD_MACH_O_MH_DYLIB;
3200 mdata->header.filetype = BFD_MACH_O_MH_OBJECT;
3206 if (mdata->nsects == 0 || mdata->sections == NULL)
3207 if (! bfd_mach_o_mangle_sections (abfd, mdata))
3216 if (mdata->header.filetype == BFD_MACH_O_MH_OBJECT)
3220 nbr_segcmd = (mdata->nsects > 0) ? 1 : 0;
3231 for (i = 0; i < mdata->nsects; i++)
3233 bfd_mach_o_section *this_sect = mdata->sections[i];
3261 if (mdata->header.filetype == BFD_MACH_O_MH_EXECUTE
3266 mdata->filelen = wide ? BFD_MACH_O_HEADER_64_SIZE : BFD_MACH_O_HEADER_SIZE;
3273 return bfd_mach_o_layout_commands (mdata);
3282 commands[nbr_commands - 1].next = mdata->first_command;
3283 if (mdata->first_command == NULL)
3284 mdata->last_command = &commands[nbr_commands - 1];
3285 mdata->first_command = &commands[0];
3287 if (mdata->header.filetype == BFD_MACH_O_MH_OBJECT && nbr_segcmd != 0)
3290 bfd_mach_o_init_segment (mdata, &commands[0], "", mdata->nsects);
3300 bfd_mach_o_init_segment (mdata, cmd, "__PAGEZERO", 0);
3304 for (i = 0; i < mdata->nsects;)
3306 const char *segname = mdata->sections[i]->segname;
3310 for (i++; i < mdata->nsects; i++)
3311 if (strcmp (mdata->sections[i]->segname, segname) == 0)
3316 bfd_mach_o_init_segment (mdata, cmd, segname, nbr_sect);
3321 bfd_mach_o_init_segment (mdata, cmd, "__LINKEDIT", 0);
3356 if (! bfd_mach_o_layout_commands (mdata))
3361 if (mdata->header.filetype == BFD_MACH_O_MH_OBJECT)
3390 commands[nbr_segcmd - 1].command.segment.fileoff = mdata->filelen;
3735 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
3736 unsigned int wide = mach_o_wide_p (&mdata->header);
3804 if ((section > 0) && (section <= mdata->nsects))
3806 s->symbol.section = mdata->sections[section - 1]->bfdsection;
3808 s->symbol.value - mdata->sections[section - 1]->addr;
3844 if ((section > 0) && (section <= mdata->nsects))
3846 s->symbol.section = mdata->sections[section - 1]->bfdsection;
3848 s->symbol.value - mdata->sections[section - 1]->addr;
3860 s->symbol.name, section, mdata->nsects);
3890 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
3891 bfd_mach_o_symtab_command *sym = mdata->symtab;
3936 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
3937 bfd_mach_o_symtab_command *sym = mdata->symtab;
3949 unsigned int wide = mach_o_wide_p (&mdata->header);
4062 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
4097 pos = mdata->hdr_offset + cmd->name_offset;
4199 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
4266 switch (mdata->header.cputype)
4315 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
4531 if (mdata->dysymtab)
4533 mdata->dysymtab = cmd;
4543 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
4572 if (mdata->symtab)
4574 mdata->symtab = symtab;
4934 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
4939 if (bfd_seek (abfd, mdata->hdr_offset + command->offset, SEEK_SET) != 0
5086 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
5092 mdata->nsects = 0;
5094 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
5101 mdata->nsects += seg->nsects;
5106 if (_bfd_mul_overflow (mdata->nsects, sizeof (bfd_mach_o_section *), &amt))
5111 mdata->sections = bfd_alloc (abfd, amt);
5112 if (mdata->sections == NULL && mdata->nsects != 0)
5118 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
5126 BFD_ASSERT (csect + seg->nsects <= mdata->nsects);
5129 mdata->sections[csect++] = sec;
5138 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
5143 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
5150 else if (cmd->type == BFD_MACH_O_LC_MAIN && mdata->nsects > 1)
5153 bfd_mach_o_section *text_sect = mdata->sections[0];
5170 if ((mdata->header.cputype == BFD_MACH_O_CPU_TYPE_I386)
5181 else if ((mdata->header.cputype == BFD_MACH_O_CPU_TYPE_POWERPC)
5192 else if ((mdata->header.cputype == BFD_MACH_O_CPU_TYPE_POWERPC_64)
5203 else if ((mdata->header.cputype == BFD_MACH_O_CPU_TYPE_X86_64)
5239 bfd_mach_o_data_struct *mdata)
5249 mdata->header = *header;
5266 abfd->tdata.mach_o_data = mdata;
5290 mdata->first_command = NULL;
5291 mdata->last_command = NULL;
5339 bfd_mach_o_data_struct *mdata = NULL;
5341 mdata = bfd_zalloc (abfd, sizeof (bfd_mach_o_data_struct));
5342 if (mdata == NULL)
5344 abfd->tdata.mach_o_data = mdata;
5346 mdata->header.magic = 0;
5347 mdata->header.cputype = 0;
5348 mdata->header.cpusubtype = 0;
5349 mdata->header.filetype = 0;
5350 mdata->header.ncmds = 0;
5351 mdata->header.sizeofcmds = 0;
5352 mdata->header.flags = 0;
5353 mdata->header.byteorder = BFD_ENDIAN_UNKNOWN;
5354 mdata->first_command = NULL;
5355 mdata->last_command = NULL;
5356 mdata->nsects = 0;
5357 mdata->sections = NULL;
5358 mdata->dyn_reloc_cache = NULL;
5366 bfd_mach_o_data_struct *mdata;
5371 mdata = bfd_mach_o_get_data (abfd);
5372 mdata->header.magic = BFD_MACH_O_MH_MAGIC;
5373 mdata->header.cputype = 0;
5374 mdata->header.cpusubtype = 0;
5375 mdata->header.byteorder = abfd->xvec->byteorder;
5376 mdata->header.version = 1;
5388 bfd_mach_o_data_struct *mdata;
5444 mdata = (bfd_mach_o_data_struct *) bfd_zalloc (abfd, sizeof (*mdata));
5445 if (mdata == NULL)
5447 mdata->hdr_offset = hdr_off;
5449 if (!bfd_mach_o_scan (abfd, &header, mdata))
5479 bfd_mach_o_data_struct *mdata;
5485 mdata = bfd_mach_o_get_data (abfd);
5487 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
5801 struct mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
5805 BFD_ASSERT (mdata != NULL);
5809 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
5923 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
5924 unsigned long stackaddr = bfd_mach_o_stack_addr (mdata->header.cputype);
5927 for (cmd = mdata->first_command; cmd != NULL; cmd = cmd->next)
6161 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
6162 if (mdata == NULL)
6164 switch (mdata->header.filetype)
6172 if (mdata->dwarf2_find_line_info == NULL)
6174 mdata->dsym_bfd = bfd_mach_o_follow_dsym (abfd);
6178 mdata->dwarf2_find_line_info will be filled. */
6179 if (! mdata->dsym_bfd)
6181 if (! _bfd_dwarf2_slurp_debug_info (abfd, mdata->dsym_bfd,
6183 &mdata->dwarf2_find_line_info,
6195 &mdata->dwarf2_find_line_info);
6201 bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
6202 if (bfd_get_format (abfd) == bfd_object && mdata != NULL)
6204 if (mdata->dsym_bfd != NULL)
6206 bfd *fat_bfd = mdata->dsym_bfd->my_archive;
6218 : bfd_get_filename (mdata->dsym_bfd));
6220 bfd_close (mdata->dsym_bfd);
6221 mdata->dsym_bfd = NULL;
6236 bfd_mach_o_data_struct *mdata;
6240 && (mdata = bfd_mach_o_get_data (abfd)) != NULL)
6242 _bfd_dwarf2_cleanup_debug_info (abfd, &mdata->dwarf2_find_line_info);
6243 free (mdata->dyn_reloc_cache);
6244 mdata->dyn_reloc_cache = NULL;