diff options
author | Alan Modra <amodra@gmail.com> | 2017-12-06 09:26:00 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2017-12-06 17:51:43 +1030 |
commit | 07d6d2b8345ef3dc82eab49635acac9ee67dbb18 (patch) | |
tree | 380d1e08ae32b2a37d5f9610f1811bb98299ac09 /bfd/mach-o.c | |
parent | 65281396861dfcfa993eb5af4769d6837104890d (diff) | |
download | gdb-07d6d2b8345ef3dc82eab49635acac9ee67dbb18.zip gdb-07d6d2b8345ef3dc82eab49635acac9ee67dbb18.tar.gz gdb-07d6d2b8345ef3dc82eab49635acac9ee67dbb18.tar.bz2 |
BFD whitespace fixes
Binutils is supposed to use tabs. In my git config I have
whitespace = indent-with-non-tab,space-before-tab,trailing-space
and I got annoyed enough seeing red in "git diff" output to fix
the problems.
* doc/header.sed: Trim trailing space when splitting lines.
* aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c,
* aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h,
* arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c,
* archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c,
* bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c,
* coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c,
* coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c,
* coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c,
* coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c,
* coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c,
* cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c,
* cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c,
* cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c,
* cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c,
* cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c,
* cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c,
* cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c,
* ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c,
* elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c,
* elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c,
* elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h,
* elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c,
* elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c,
* elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c,
* elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c,
* elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c,
* elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c,
* elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c,
* elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h,
* elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c,
* elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c,
* elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c,
* elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c,
* elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c,
* elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h,
* elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
* elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c,
* elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c,
* host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c,
* i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c,
* i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h,
* libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h,
* libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c,
* m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c,
* mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c,
* mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h,
* netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c,
* nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c,
* opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c,
* pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c,
* pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c,
* peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c,
* riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h,
* sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c,
* syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c,
* vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c,
* vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c,
* xsym.c, * xsym.h: Whitespace fixes.
* bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r-- | bfd/mach-o.c | 884 |
1 files changed, 442 insertions, 442 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 9fe6326..29a4d91 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -315,9 +315,9 @@ bfd_mach_o_section_data_for_mach_sect (bfd *abfd, const char *segname, for (seg = segsec_names_xlat; seg->segname; seg++) if (strncmp (seg->segname, segname, BFD_MACH_O_SEGNAME_SIZE) == 0) for (sec = seg->sections; sec->mach_o_name; sec++) - if (strncmp (sec->mach_o_name, sectname, + if (strncmp (sec->mach_o_name, sectname, BFD_MACH_O_SECTNAME_SIZE) == 0) - return sec; + return sec; return NULL; } @@ -432,8 +432,8 @@ bfd_mach_o_convert_section_name_to_bfd (bfd *abfd, const char *segname, static const mach_o_section_name_xlat * bfd_mach_o_convert_section_name_to_mach_o (bfd *abfd ATTRIBUTE_UNUSED, - asection *sect, - bfd_mach_o_section *section) + asection *sect, + bfd_mach_o_section *section) { const mach_o_section_name_xlat *xlat; const char *name = bfd_get_section_name (abfd, sect); @@ -472,13 +472,13 @@ bfd_mach_o_convert_section_name_to_mach_o (bfd *abfd ATTRIBUTE_UNUSED, if (seglen <= BFD_MACH_O_SEGNAME_SIZE && seclen <= BFD_MACH_O_SECTNAME_SIZE) - { - memcpy (section->segname, name, seglen); - section->segname[seglen] = 0; - memcpy (section->sectname, dot + 1, seclen); - section->sectname[seclen] = 0; - return NULL; - } + { + memcpy (section->segname, name, seglen); + section->segname[seglen] = 0; + memcpy (section->sectname, dot + 1, seclen); + section->sectname[seclen] = 0; + return NULL; + } } /* The segment and section names are both missing - don't make them @@ -776,7 +776,7 @@ bfd_mach_o_canonicalize_symtab (bfd *abfd, asymbol **alocation) if (!bfd_mach_o_read_symtab_symbols (abfd)) { _bfd_error_handler - (_("bfd_mach_o_canonicalize_symtab: unable to load symbols")); + (_("bfd_mach_o_canonicalize_symtab: unable to load symbols")); return 0; } @@ -794,11 +794,11 @@ bfd_mach_o_canonicalize_symtab (bfd *abfd, asymbol **alocation) long bfd_mach_o_get_synthetic_symtab (bfd *abfd, - long symcount ATTRIBUTE_UNUSED, - asymbol **syms ATTRIBUTE_UNUSED, - long dynsymcount ATTRIBUTE_UNUSED, - asymbol **dynsyms ATTRIBUTE_UNUSED, - asymbol **ret) + long symcount ATTRIBUTE_UNUSED, + asymbol **syms ATTRIBUTE_UNUSED, + long dynsymcount ATTRIBUTE_UNUSED, + asymbol **dynsyms ATTRIBUTE_UNUSED, + asymbol **ret) { bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd); bfd_mach_o_dysymtab_command *dysymtab = mdata->dysymtab; @@ -853,63 +853,63 @@ bfd_mach_o_get_synthetic_symtab (bfd *abfd, bfd_vma entry_size; switch (sec->flags & BFD_MACH_O_SECTION_TYPE_MASK) - { - case BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS: - case BFD_MACH_O_S_LAZY_SYMBOL_POINTERS: - case BFD_MACH_O_S_SYMBOL_STUBS: - /* Only these sections have indirect symbols. */ - first = sec->reserved1; - last = first + bfd_mach_o_section_get_nbr_indirect (abfd, sec); - addr = sec->addr; - entry_size = bfd_mach_o_section_get_entry_size (abfd, sec); + { + case BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS: + case BFD_MACH_O_S_LAZY_SYMBOL_POINTERS: + case BFD_MACH_O_S_SYMBOL_STUBS: + /* Only these sections have indirect symbols. */ + first = sec->reserved1; + last = first + bfd_mach_o_section_get_nbr_indirect (abfd, sec); + addr = sec->addr; + entry_size = bfd_mach_o_section_get_entry_size (abfd, sec); /* PR 17512: file: 08e15eec. */ if (first >= count || last >= count || first > last) goto fail; - for (j = first; j < last; j++) - { - unsigned int isym = dysymtab->indirect_syms[j]; + for (j = first; j < last; j++) + { + unsigned int isym = dysymtab->indirect_syms[j]; /* PR 17512: file: 04d64d9b. */ if (((char *) s) + sizeof (* s) > s_end) goto fail; - s->flags = BSF_GLOBAL | BSF_SYNTHETIC; - s->section = sec->bfdsection; - s->value = addr - sec->addr; - s->udata.p = NULL; + s->flags = BSF_GLOBAL | BSF_SYNTHETIC; + s->section = sec->bfdsection; + s->value = addr - sec->addr; + s->udata.p = NULL; - if (isym < symtab->nsyms - && symtab->symbols[isym].symbol.name) - { - const char *sym = symtab->symbols[isym].symbol.name; - size_t len; + if (isym < symtab->nsyms + && symtab->symbols[isym].symbol.name) + { + const char *sym = symtab->symbols[isym].symbol.name; + size_t len; - s->name = names; - len = strlen (sym); + s->name = names; + len = strlen (sym); /* PR 17512: file: 47dfd4d2. */ if (names + len >= s_end) goto fail; - memcpy (names, sym, len); - names += len; + memcpy (names, sym, len); + names += len; /* PR 17512: file: 18f340a4. */ if (names + sizeof (stub) >= s_end) goto fail; - memcpy (names, stub, sizeof (stub)); - names += sizeof (stub); - } - else - s->name = nul_name; - - addr += entry_size; - s++; - n++; - } - break; - default: - break; - } + memcpy (names, stub, sizeof (stub)); + names += sizeof (stub); + } + else + s->name = nul_name; + + addr += entry_size; + s++; + n++; + } + break; + default: + break; + } } return n; @@ -951,10 +951,10 @@ bfd_mach_o_print_symbol (bfd *abfd, switch (asym->n_type & BFD_MACH_O_N_TYPE) { case BFD_MACH_O_N_UNDF: - if (symbol->value == 0) - name = "UND"; - else - name = "COM"; + if (symbol->value == 0) + name = "UND"; + else + name = "COM"; break; case BFD_MACH_O_N_ABS: name = "ABS"; @@ -975,7 +975,7 @@ bfd_mach_o_print_symbol (bfd *abfd, if (name == NULL) name = ""; fprintf (file, " %02x %-6s %02x %04x", - asym->n_type, name, asym->n_sect, asym->n_desc); + asym->n_type, name, asym->n_sect, asym->n_desc); if ((asym->n_type & BFD_MACH_O_N_STAB) == 0 && (asym->n_type & BFD_MACH_O_N_TYPE) == BFD_MACH_O_N_SECT) fprintf (file, " [%s]", symbol->section->name); @@ -1019,26 +1019,26 @@ bfd_mach_o_convert_architecture (bfd_mach_o_cpu_type mtype, case BFD_MACH_O_CPU_TYPE_ARM: *type = bfd_arch_arm; switch (msubtype) - { - case BFD_MACH_O_CPU_SUBTYPE_ARM_V4T: - *subtype = bfd_mach_arm_4T; - break; - case BFD_MACH_O_CPU_SUBTYPE_ARM_V6: - *subtype = bfd_mach_arm_4T; /* Best fit ? */ - break; - case BFD_MACH_O_CPU_SUBTYPE_ARM_V5TEJ: - *subtype = bfd_mach_arm_5TE; - break; - case BFD_MACH_O_CPU_SUBTYPE_ARM_XSCALE: - *subtype = bfd_mach_arm_XScale; - break; - case BFD_MACH_O_CPU_SUBTYPE_ARM_V7: - *subtype = bfd_mach_arm_5TE; /* Best fit ? */ - break; - case BFD_MACH_O_CPU_SUBTYPE_ARM_ALL: - default: - break; - } + { + case BFD_MACH_O_CPU_SUBTYPE_ARM_V4T: + *subtype = bfd_mach_arm_4T; + break; + case BFD_MACH_O_CPU_SUBTYPE_ARM_V6: + *subtype = bfd_mach_arm_4T; /* Best fit ? */ + break; + case BFD_MACH_O_CPU_SUBTYPE_ARM_V5TEJ: + *subtype = bfd_mach_arm_5TE; + break; + case BFD_MACH_O_CPU_SUBTYPE_ARM_XSCALE: + *subtype = bfd_mach_arm_XScale; + break; + case BFD_MACH_O_CPU_SUBTYPE_ARM_V7: + *subtype = bfd_mach_arm_5TE; /* Best fit ? */ + break; + case BFD_MACH_O_CPU_SUBTYPE_ARM_ALL: + default: + break; + } break; case BFD_MACH_O_CPU_TYPE_MC88000: *type = bfd_arch_m88k; @@ -1155,13 +1155,13 @@ bfd_mach_o_write_thread (bfd *abfd, bfd_mach_o_load_command *command) { BFD_ASSERT ((cmd->flavours[i].size % 4) == 0); BFD_ASSERT (cmd->flavours[i].offset == - (command->offset + offset + BFD_MACH_O_LC_SIZE)); + (command->offset + offset + BFD_MACH_O_LC_SIZE)); bfd_h_put_32 (abfd, cmd->flavours[i].flavour, raw.flavour); bfd_h_put_32 (abfd, (cmd->flavours[i].size / 4), raw.count); if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0 - || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) return FALSE; offset += cmd->flavours[i].size + sizeof (raw); @@ -1291,7 +1291,7 @@ bfd_mach_o_write_dyld_info (bfd *abfd, bfd_mach_o_load_command *command) long bfd_mach_o_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED, - asection *asect) + asection *asect) { return (asect->reloc_count + 1) * sizeof (arelent *); } @@ -1374,7 +1374,7 @@ bfd_mach_o_canonicalize_non_scattered_reloc (bfd *abfd, binary) contains the address of the section. To comply with bfd convention, subtract the section address. Use the address from the header, so that the user can modify - the vma of the section. */ + the vma of the section. */ res->addend = -mdata->sections[num - 1]->addr; } @@ -1427,15 +1427,15 @@ bfd_mach_o_pre_canonicalize_one_reloc (bfd *abfd, the following section or, if it falls within alignment padding, as null - which will assert later. */ for (j = 0; j < mdata->nsects; j++) - { - bfd_mach_o_section *sect = mdata->sections[j]; - if (symnum >= sect->addr && symnum < sect->addr + sect->size) - { - res->sym_ptr_ptr = sect->bfdsection->symbol_ptr_ptr; - res->addend = symnum - sect->addr; - break; - } - } + { + bfd_mach_o_section *sect = mdata->sections[j]; + if (symnum >= sect->addr && symnum < sect->addr + sect->size) + { + res->sym_ptr_ptr = sect->bfdsection->symbol_ptr_ptr; + res->addend = symnum - sect->addr; + break; + } + } /* Extract the info and address fields from r_address. */ reloc->r_type = BFD_MACH_O_GET_SR_TYPE (addr); @@ -1452,7 +1452,7 @@ bfd_mach_o_pre_canonicalize_one_reloc (bfd *abfd, res->address = addr; /* The value and info fields have to be extracted dependent on target - endian-ness. */ + endian-ness. */ bfd_mach_o_swap_in_non_scattered_reloc (abfd, reloc, raw->r_symbolnum); if (!bfd_mach_o_canonicalize_non_scattered_reloc (abfd, reloc, @@ -1469,8 +1469,8 @@ bfd_mach_o_pre_canonicalize_one_reloc (bfd *abfd, static int bfd_mach_o_canonicalize_relocs (bfd *abfd, unsigned long filepos, - unsigned long count, - arelent *res, asymbol **syms) + unsigned long count, + arelent *res, asymbol **syms) { bfd_mach_o_backend_data *bed = bfd_mach_o_get_backend_data (abfd); unsigned long i; @@ -1497,7 +1497,7 @@ bfd_mach_o_canonicalize_relocs (bfd *abfd, unsigned long filepos, { if (!(*bed->_bfd_mach_o_canonicalize_one_reloc)(abfd, &native_relocs[i], &res[i], syms, res)) - goto err; + goto err; } free (native_relocs); return i; @@ -1508,7 +1508,7 @@ bfd_mach_o_canonicalize_relocs (bfd *abfd, unsigned long filepos, long bfd_mach_o_canonicalize_reloc (bfd *abfd, asection *asect, - arelent **rels, asymbol **syms) + arelent **rels, asymbol **syms) { bfd_mach_o_backend_data *bed = bfd_mach_o_get_backend_data (abfd); unsigned long i; @@ -1527,14 +1527,14 @@ bfd_mach_o_canonicalize_reloc (bfd *abfd, asection *asect, return -1; res = bfd_malloc (asect->reloc_count * sizeof (arelent)); if (res == NULL) - return -1; + return -1; if (bfd_mach_o_canonicalize_relocs (abfd, asect->rel_filepos, - asect->reloc_count, res, syms) < 0) - { - free (res); - return -1; - } + asect->reloc_count, res, syms) < 0) + { + free (res); + return -1; + } asect->relocation = res; } @@ -1559,7 +1559,7 @@ bfd_mach_o_get_dynamic_reloc_upper_bound (bfd *abfd) long bfd_mach_o_canonicalize_dynamic_reloc (bfd *abfd, arelent **rels, - struct bfd_symbol **syms) + struct bfd_symbol **syms) { bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd); bfd_mach_o_dysymtab_command *dysymtab = mdata->dysymtab; @@ -1583,24 +1583,24 @@ bfd_mach_o_canonicalize_dynamic_reloc (bfd *abfd, arelent **rels, return -1; res = bfd_malloc ((dysymtab->nextrel + dysymtab->nlocrel) - * sizeof (arelent)); + * sizeof (arelent)); if (res == NULL) - return -1; + return -1; if (bfd_mach_o_canonicalize_relocs (abfd, dysymtab->extreloff, - dysymtab->nextrel, res, syms) < 0) - { - free (res); - return -1; - } + dysymtab->nextrel, res, syms) < 0) + { + free (res); + return -1; + } if (bfd_mach_o_canonicalize_relocs (abfd, dysymtab->locreloff, - dysymtab->nlocrel, - res + dysymtab->nextrel, syms) < 0) - { - free (res); - return -1; - } + dysymtab->nlocrel, + res + dysymtab->nextrel, syms) < 0) + { + free (res); + return -1; + } mdata->dyn_reloc_cache = res; } @@ -1675,32 +1675,32 @@ bfd_mach_o_write_relocs (bfd *abfd, bfd_mach_o_section *section) /* Convert relocation to an intermediate representation. */ if (!(*bed->_bfd_mach_o_swap_reloc_out) (rel, pinfo)) - return FALSE; + return FALSE; /* Lower the relocation info. */ if (pinfo->r_scattered) - { - unsigned long v; - - v = BFD_MACH_O_SR_SCATTERED - | (pinfo->r_pcrel ? BFD_MACH_O_SR_PCREL : 0) - | BFD_MACH_O_SET_SR_LENGTH (pinfo->r_length) - | BFD_MACH_O_SET_SR_TYPE (pinfo->r_type) - | BFD_MACH_O_SET_SR_ADDRESS (pinfo->r_address); - /* Note: scattered relocs have field in reverse order... */ - bfd_put_32 (abfd, v, raw.r_address); - bfd_put_32 (abfd, pinfo->r_value, raw.r_symbolnum); - } + { + unsigned long v; + + v = BFD_MACH_O_SR_SCATTERED + | (pinfo->r_pcrel ? BFD_MACH_O_SR_PCREL : 0) + | BFD_MACH_O_SET_SR_LENGTH (pinfo->r_length) + | BFD_MACH_O_SET_SR_TYPE (pinfo->r_type) + | BFD_MACH_O_SET_SR_ADDRESS (pinfo->r_address); + /* Note: scattered relocs have field in reverse order... */ + bfd_put_32 (abfd, v, raw.r_address); + bfd_put_32 (abfd, pinfo->r_value, raw.r_symbolnum); + } else - { - bfd_put_32 (abfd, pinfo->r_address, raw.r_address); - bfd_mach_o_swap_out_non_scattered_reloc (abfd, raw.r_symbolnum, + { + bfd_put_32 (abfd, pinfo->r_address, raw.r_address); + bfd_mach_o_swap_out_non_scattered_reloc (abfd, raw.r_symbolnum, pinfo); - } + } if (bfd_bwrite (&raw, BFD_MACH_O_RELENT_SIZE, abfd) - != BFD_MACH_O_RELENT_SIZE) - return FALSE; + != BFD_MACH_O_RELENT_SIZE) + return FALSE; } return TRUE; } @@ -1853,43 +1853,43 @@ bfd_mach_o_write_symtab_content (bfd *abfd, bfd_mach_o_symtab_command *sym) if (s->symbol.name == 0 || s->symbol.name[0] == '\0') /* An index of 0 always means the empty string. */ - str_index = 0; + str_index = 0; else - { - str_index = _bfd_stringtab_add (strtab, s->symbol.name, TRUE, FALSE); + { + str_index = _bfd_stringtab_add (strtab, s->symbol.name, TRUE, FALSE); - if (str_index == (bfd_size_type) -1) - goto err; - } + if (str_index == (bfd_size_type) -1) + goto err; + } if (wide) - { - struct mach_o_nlist_64_external raw; - - bfd_h_put_32 (abfd, str_index, raw.n_strx); - bfd_h_put_8 (abfd, s->n_type, raw.n_type); - bfd_h_put_8 (abfd, s->n_sect, raw.n_sect); - bfd_h_put_16 (abfd, s->n_desc, raw.n_desc); - bfd_h_put_64 (abfd, s->symbol.section->vma + s->symbol.value, - raw.n_value); - - if (bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) - goto err; - } + { + struct mach_o_nlist_64_external raw; + + bfd_h_put_32 (abfd, str_index, raw.n_strx); + bfd_h_put_8 (abfd, s->n_type, raw.n_type); + bfd_h_put_8 (abfd, s->n_sect, raw.n_sect); + bfd_h_put_16 (abfd, s->n_desc, raw.n_desc); + bfd_h_put_64 (abfd, s->symbol.section->vma + s->symbol.value, + raw.n_value); + + if (bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + goto err; + } else - { - struct mach_o_nlist_external raw; + { + struct mach_o_nlist_external raw; - bfd_h_put_32 (abfd, str_index, raw.n_strx); - bfd_h_put_8 (abfd, s->n_type, raw.n_type); - bfd_h_put_8 (abfd, s->n_sect, raw.n_sect); - bfd_h_put_16 (abfd, s->n_desc, raw.n_desc); - bfd_h_put_32 (abfd, s->symbol.section->vma + s->symbol.value, - raw.n_value); + bfd_h_put_32 (abfd, str_index, raw.n_strx); + bfd_h_put_8 (abfd, s->n_type, raw.n_type); + bfd_h_put_8 (abfd, s->n_sect, raw.n_sect); + bfd_h_put_16 (abfd, s->n_desc, raw.n_desc); + bfd_h_put_32 (abfd, s->symbol.section->vma + s->symbol.value, + raw.n_value); - if (bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) - goto err; - } + if (bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + goto err; + } } sym->strsize = _bfd_stringtab_size (strtab); sym->stroff = mdata->filelen; @@ -2034,7 +2034,7 @@ bfd_mach_o_build_dysymtab (bfd *abfd, bfd_mach_o_dysymtab_command *cmd) return FALSE; cmd->indirect_syms = bfd_zalloc (abfd, cmd->nindirectsyms * 4); if (cmd->indirect_syms == NULL) - return FALSE; + return FALSE; n = 0; for (i = 0; i < mdata->nsects; ++i) @@ -2058,13 +2058,13 @@ bfd_mach_o_build_dysymtab (bfd *abfd, bfd_mach_o_dysymtab_command *cmd) for (j = 0; j < num; j++, n++) { if (isyms[j] == NULL) - cmd->indirect_syms[n] = BFD_MACH_O_INDIRECT_SYM_LOCAL; + cmd->indirect_syms[n] = BFD_MACH_O_INDIRECT_SYM_LOCAL; else if (isyms[j]->symbol.section == bfd_abs_section_ptr && ! (isyms[j]->n_type & BFD_MACH_O_N_EXT)) - cmd->indirect_syms[n] = BFD_MACH_O_INDIRECT_SYM_LOCAL + cmd->indirect_syms[n] = BFD_MACH_O_INDIRECT_SYM_LOCAL | BFD_MACH_O_INDIRECT_SYM_ABS; else - cmd->indirect_syms[n] = isyms[j]->symbol.udata.i; + cmd->indirect_syms[n] = isyms[j]->symbol.udata.i; } } break; @@ -2299,9 +2299,9 @@ bfd_mach_o_cf_symbols (const void *a, const void *b) if (soa == 0) { if (sa->symbol.udata.i < sb->symbol.udata.i) - return -1; + return -1; if (sa->symbol.udata.i > sb->symbol.udata.i) - return 1; + return 1; /* This is probably an error. */ return 0; @@ -2349,38 +2349,38 @@ bfd_mach_o_mangle_symbols (bfd *abfd) this, since more meaningful diagnostics can be made that way. */ if (s->symbol.udata.i == SYM_MACHO_FIELDS_UNSET) - { - /* No symbol information has been set - therefore determine - it from the bfd symbol flags/info. */ - if (s->symbol.section == bfd_abs_section_ptr) - s->n_type = BFD_MACH_O_N_ABS; - else if (s->symbol.section == bfd_und_section_ptr) - { - s->n_type = BFD_MACH_O_N_UNDF; - if (s->symbol.flags & BSF_WEAK) - s->n_desc |= BFD_MACH_O_N_WEAK_REF; - /* mach-o automatically makes undefined symbols extern. */ + { + /* No symbol information has been set - therefore determine + it from the bfd symbol flags/info. */ + if (s->symbol.section == bfd_abs_section_ptr) + s->n_type = BFD_MACH_O_N_ABS; + else if (s->symbol.section == bfd_und_section_ptr) + { + s->n_type = BFD_MACH_O_N_UNDF; + if (s->symbol.flags & BSF_WEAK) + s->n_desc |= BFD_MACH_O_N_WEAK_REF; + /* mach-o automatically makes undefined symbols extern. */ s->n_type |= BFD_MACH_O_N_EXT; s->symbol.flags |= BSF_GLOBAL; - } - else if (s->symbol.section == bfd_com_section_ptr) + } + else if (s->symbol.section == bfd_com_section_ptr) { - s->n_type = BFD_MACH_O_N_UNDF | BFD_MACH_O_N_EXT; - s->symbol.flags |= BSF_GLOBAL; - } - else - s->n_type = BFD_MACH_O_N_SECT; + s->n_type = BFD_MACH_O_N_UNDF | BFD_MACH_O_N_EXT; + s->symbol.flags |= BSF_GLOBAL; + } + else + s->n_type = BFD_MACH_O_N_SECT; - if (s->symbol.flags & BSF_GLOBAL) - s->n_type |= BFD_MACH_O_N_EXT; - } + if (s->symbol.flags & BSF_GLOBAL) + s->n_type |= BFD_MACH_O_N_EXT; + } /* Put the section index in, where required. */ if ((s->symbol.section != bfd_abs_section_ptr - && s->symbol.section != bfd_und_section_ptr - && s->symbol.section != bfd_com_section_ptr) - || ((s->n_type & BFD_MACH_O_N_STAB) != 0 - && s->symbol.name == NULL)) + && s->symbol.section != bfd_und_section_ptr + && s->symbol.section != bfd_com_section_ptr) + || ((s->n_type & BFD_MACH_O_N_STAB) != 0 + && s->symbol.name == NULL)) s->n_sect = s->symbol.section->output_section->target_index; /* Number to preserve order for local and debug syms. */ @@ -2589,7 +2589,7 @@ bfd_mach_o_write_contents (bfd *abfd) bfd_h_put_32 (abfd, cmd->len, raw.cmdsize); if (bfd_seek (abfd, cmd->offset, SEEK_SET) != 0 - || bfd_bwrite (&raw, BFD_MACH_O_LC_SIZE, abfd) != 8) + || bfd_bwrite (&raw, BFD_MACH_O_LC_SIZE, abfd) != 8) return FALSE; switch (cmd->type) @@ -2644,7 +2644,7 @@ bfd_mach_o_write_contents (bfd *abfd) static void bfd_mach_o_append_section_to_segment (bfd_mach_o_segment_command *seg, - bfd_mach_o_section *s) + bfd_mach_o_section *s) { if (seg->sect_head == NULL) seg->sect_head = s; @@ -2707,9 +2707,9 @@ bfd_mach_o_build_obj_seg_command (bfd *abfd, bfd_mach_o_segment_command *seg) /* Zerofill sections have zero file size & offset, the only content written to the file is the symbols. */ if ((s->flags & BFD_MACH_O_SECTION_TYPE_MASK) == BFD_MACH_O_S_ZEROFILL - || ((s->flags & BFD_MACH_O_SECTION_TYPE_MASK) + || ((s->flags & BFD_MACH_O_SECTION_TYPE_MASK) == BFD_MACH_O_S_GB_ZEROFILL)) - continue; + continue; /* The Darwin system tools (in MH_OBJECT files, at least) always account sections, even those with zero size. */ @@ -2722,13 +2722,13 @@ bfd_mach_o_build_obj_seg_command (bfd *abfd, bfd_mach_o_segment_command *seg) if (1) { seg->filesize = FILE_ALIGN (seg->filesize, s->align); - mdata->filelen = FILE_ALIGN (mdata->filelen, s->align); - } + mdata->filelen = FILE_ALIGN (mdata->filelen, s->align); + } seg->filesize += s->size; /* The system tools write even zero-sized sections with an offset field set to the current file position. */ - s->offset = mdata->filelen; + s->offset = mdata->filelen; } sec->filepos = s->offset; @@ -2771,11 +2771,11 @@ bfd_mach_o_build_obj_seg_command (bfd *abfd, bfd_mach_o_segment_command *seg) ms->nreloc = sec->reloc_count; if (ms->nreloc == 0) - { + { /* Clear nreloc and reloff if there is no relocs. */ ms->reloff = 0; continue; - } + } sec->rel_filepos = mdata->filelen; ms->reloff = sec->rel_filepos; mdata->filelen += sec->reloc_count * BFD_MACH_O_RELENT_SIZE; @@ -2847,7 +2847,7 @@ bfd_mach_o_build_exec_seg_command (bfd *abfd, bfd_mach_o_segment_command *seg) seg->filesize = FILE_ALIGN (seg->filesize, s->align); if ((s->flags & BFD_MACH_O_SECTION_TYPE_MASK) != BFD_MACH_O_S_ZEROFILL - && ((s->flags & BFD_MACH_O_SECTION_TYPE_MASK) + && ((s->flags & BFD_MACH_O_SECTION_TYPE_MASK) != BFD_MACH_O_S_GB_ZEROFILL)) { mdata->filelen = FILE_ALIGN (mdata->filelen, s->align); @@ -3028,11 +3028,11 @@ bfd_mach_o_build_commands (bfd *abfd) if (mdata->header.filetype == 0) { if (abfd->flags & EXEC_P) - mdata->header.filetype = BFD_MACH_O_MH_EXECUTE; + mdata->header.filetype = BFD_MACH_O_MH_EXECUTE; else if (abfd->flags & DYNAMIC) - mdata->header.filetype = BFD_MACH_O_MH_DYLIB; + mdata->header.filetype = BFD_MACH_O_MH_DYLIB; else - mdata->header.filetype = BFD_MACH_O_MH_OBJECT; + mdata->header.filetype = BFD_MACH_O_MH_OBJECT; } /* If hasn't already been done, flatten sections list, and sort @@ -3395,7 +3395,7 @@ bfd_mach_o_new_section_hook (bfd *abfd, asection *sec) static void bfd_mach_o_init_section_from_mach_o (bfd *abfd, asection *sec, - unsigned long prot) + unsigned long prot) { flagword flags; bfd_mach_o_section *section; @@ -3410,27 +3410,27 @@ bfd_mach_o_init_section_from_mach_o (bfd *abfd, asection *sec, { /* Try to guess flags. */ if (section->flags & BFD_MACH_O_S_ATTR_DEBUG) - flags = SEC_DEBUGGING; + flags = SEC_DEBUGGING; else - { - flags = SEC_ALLOC; - if ((section->flags & BFD_MACH_O_SECTION_TYPE_MASK) - != BFD_MACH_O_S_ZEROFILL) - { - flags |= SEC_LOAD; - if (prot & BFD_MACH_O_PROT_EXECUTE) - flags |= SEC_CODE; - if (prot & BFD_MACH_O_PROT_WRITE) - flags |= SEC_DATA; - else if (prot & BFD_MACH_O_PROT_READ) - flags |= SEC_READONLY; - } - } + { + flags = SEC_ALLOC; + if ((section->flags & BFD_MACH_O_SECTION_TYPE_MASK) + != BFD_MACH_O_S_ZEROFILL) + { + flags |= SEC_LOAD; + if (prot & BFD_MACH_O_PROT_EXECUTE) + flags |= SEC_CODE; + if (prot & BFD_MACH_O_PROT_WRITE) + flags |= SEC_DATA; + else if (prot & BFD_MACH_O_PROT_READ) + flags |= SEC_READONLY; + } + } } else { if ((flags & SEC_DEBUGGING) == 0) - flags |= SEC_ALLOC; + flags |= SEC_ALLOC; } if (section->offset != 0) @@ -3452,8 +3452,8 @@ bfd_mach_o_init_section_from_mach_o (bfd *abfd, asection *sec, static asection * bfd_mach_o_make_bfd_section (bfd *abfd, - const unsigned char *segname, - const unsigned char *sectname) + const unsigned char *segname, + const unsigned char *sectname) { const char *sname; flagword flags; @@ -3564,9 +3564,9 @@ bfd_mach_o_read_section (bfd *abfd, unsigned long prot, unsigned int wide) static bfd_boolean bfd_mach_o_read_symtab_symbol (bfd *abfd, - bfd_mach_o_symtab_command *sym, - bfd_mach_o_asymbol *s, - unsigned long i) + bfd_mach_o_symtab_command *sym, + bfd_mach_o_asymbol *s, + unsigned long i) { bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd); unsigned int wide = mach_o_wide_p (&mdata->header); @@ -3588,8 +3588,8 @@ bfd_mach_o_read_symtab_symbol (bfd *abfd, { _bfd_error_handler /* xgettext:c-format */ - (_("bfd_mach_o_read_symtab_symbol: unable to read %d bytes at %u"), - symwidth, symoff); + (_("bfd_mach_o_read_symtab_symbol: unable to read %d bytes at %u"), + symwidth, symoff); return FALSE; } @@ -3607,9 +3607,9 @@ bfd_mach_o_read_symtab_symbol (bfd *abfd, { _bfd_error_handler /* xgettext:c-format */ - (_("bfd_mach_o_read_symtab_symbol: name out of range (%lu >= %u)"), - stroff, - sym->strsize); + (_("bfd_mach_o_read_symtab_symbol: name out of range (%lu >= %u)"), + stroff, + sym->strsize); return FALSE; } @@ -3641,7 +3641,7 @@ bfd_mach_o_read_symtab_symbol (bfd *abfd, { s->symbol.section = mdata->sections[section - 1]->bfdsection; s->symbol.value = - s->symbol.value - mdata->sections[section - 1]->addr; + s->symbol.value - mdata->sections[section - 1]->addr; } break; } @@ -3656,19 +3656,19 @@ bfd_mach_o_read_symtab_symbol (bfd *abfd, switch (symtype) { case BFD_MACH_O_N_UNDF: - if (type == (BFD_MACH_O_N_UNDF | BFD_MACH_O_N_EXT) - && s->symbol.value != 0) - { - /* A common symbol. */ - s->symbol.section = bfd_com_section_ptr; - s->symbol.flags = BSF_NO_FLAGS; - } - else - { - s->symbol.section = bfd_und_section_ptr; - if (s->n_desc & BFD_MACH_O_N_WEAK_REF) - s->symbol.flags |= BSF_WEAK; - } + if (type == (BFD_MACH_O_N_UNDF | BFD_MACH_O_N_EXT) + && s->symbol.value != 0) + { + /* A common symbol. */ + s->symbol.section = bfd_com_section_ptr; + s->symbol.flags = BSF_NO_FLAGS; + } + else + { + s->symbol.section = bfd_und_section_ptr; + if (s->n_desc & BFD_MACH_O_N_WEAK_REF) + s->symbol.flags |= BSF_WEAK; + } break; case BFD_MACH_O_N_PBUD: s->symbol.section = bfd_und_section_ptr; @@ -3681,7 +3681,7 @@ bfd_mach_o_read_symtab_symbol (bfd *abfd, { s->symbol.section = mdata->sections[section - 1]->bfdsection; s->symbol.value = - s->symbol.value - mdata->sections[section - 1]->addr; + s->symbol.value - mdata->sections[section - 1]->addr; } else { @@ -3754,17 +3754,17 @@ bfd_mach_o_read_symtab_strtab (bfd *abfd) return FALSE; sym->strtab = bfd_alloc (abfd, sym->strsize + 1); if (sym->strtab == NULL) - return FALSE; + return FALSE; if (bfd_seek (abfd, sym->stroff, SEEK_SET) != 0 - || bfd_bread (sym->strtab, sym->strsize, abfd) != sym->strsize) - { + || bfd_bread (sym->strtab, sym->strsize, abfd) != sym->strsize) + { /* PR 17512: file: 10888-1609-0.004. */ bfd_release (abfd, sym->strtab); sym->strtab = NULL; - bfd_set_error (bfd_error_file_truncated); - return FALSE; - } + bfd_set_error (bfd_error_file_truncated); + return FALSE; + } /* Zero terminate the string table. */ sym->strtab[sym->strsize] = 0; } @@ -3914,7 +3914,7 @@ bfd_mach_o_read_dylib (bfd *abfd, bfd_mach_o_load_command *command) static bfd_boolean bfd_mach_o_read_prebound_dylib (bfd *abfd, - bfd_mach_o_load_command *command) + bfd_mach_o_load_command *command) { bfd_mach_o_prebound_dylib_command *cmd = &command->command.prebound_dylib; struct mach_o_prebound_dylib_command_external raw; @@ -4025,7 +4025,7 @@ bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command) return FALSE; if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0 - || bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + || bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) return FALSE; offset += sizeof (raw) + bfd_h_get_32 (abfd, raw.count) * 4; @@ -4052,7 +4052,7 @@ bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command) return FALSE; if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0 - || bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + || bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) return FALSE; cmd->flavours[nflavours].flavour = bfd_h_get_32 (abfd, raw.flavour); @@ -4156,48 +4156,48 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) unsigned int module_len = wide ? 56 : 52; cmd->dylib_module = - bfd_alloc2 (abfd, cmd->nmodtab, sizeof (bfd_mach_o_dylib_module)); + bfd_alloc2 (abfd, cmd->nmodtab, sizeof (bfd_mach_o_dylib_module)); if (cmd->dylib_module == NULL) - return FALSE; + return FALSE; if (bfd_seek (abfd, cmd->modtaboff, SEEK_SET) != 0) - return FALSE; + return FALSE; for (i = 0; i < cmd->nmodtab; i++) - { - bfd_mach_o_dylib_module *module = &cmd->dylib_module[i]; - unsigned long v; - unsigned char buf[56]; - - if (bfd_bread ((void *) buf, module_len, abfd) != module_len) - return FALSE; - - module->module_name_idx = bfd_h_get_32 (abfd, buf + 0); - module->iextdefsym = bfd_h_get_32 (abfd, buf + 4); - module->nextdefsym = bfd_h_get_32 (abfd, buf + 8); - module->irefsym = bfd_h_get_32 (abfd, buf + 12); - module->nrefsym = bfd_h_get_32 (abfd, buf + 16); - module->ilocalsym = bfd_h_get_32 (abfd, buf + 20); - module->nlocalsym = bfd_h_get_32 (abfd, buf + 24); - module->iextrel = bfd_h_get_32 (abfd, buf + 28); - module->nextrel = bfd_h_get_32 (abfd, buf + 32); - v = bfd_h_get_32 (abfd, buf +36); - module->iinit = v & 0xffff; - module->iterm = (v >> 16) & 0xffff; - v = bfd_h_get_32 (abfd, buf + 40); - module->ninit = v & 0xffff; - module->nterm = (v >> 16) & 0xffff; - if (wide) - { - module->objc_module_info_size = bfd_h_get_32 (abfd, buf + 44); - module->objc_module_info_addr = bfd_h_get_64 (abfd, buf + 48); - } - else - { - module->objc_module_info_addr = bfd_h_get_32 (abfd, buf + 44); - module->objc_module_info_size = bfd_h_get_32 (abfd, buf + 48); - } - } + { + bfd_mach_o_dylib_module *module = &cmd->dylib_module[i]; + unsigned long v; + unsigned char buf[56]; + + if (bfd_bread ((void *) buf, module_len, abfd) != module_len) + return FALSE; + + module->module_name_idx = bfd_h_get_32 (abfd, buf + 0); + module->iextdefsym = bfd_h_get_32 (abfd, buf + 4); + module->nextdefsym = bfd_h_get_32 (abfd, buf + 8); + module->irefsym = bfd_h_get_32 (abfd, buf + 12); + module->nrefsym = bfd_h_get_32 (abfd, buf + 16); + module->ilocalsym = bfd_h_get_32 (abfd, buf + 20); + module->nlocalsym = bfd_h_get_32 (abfd, buf + 24); + module->iextrel = bfd_h_get_32 (abfd, buf + 28); + module->nextrel = bfd_h_get_32 (abfd, buf + 32); + v = bfd_h_get_32 (abfd, buf +36); + module->iinit = v & 0xffff; + module->iterm = (v >> 16) & 0xffff; + v = bfd_h_get_32 (abfd, buf + 40); + module->ninit = v & 0xffff; + module->nterm = (v >> 16) & 0xffff; + if (wide) + { + module->objc_module_info_size = bfd_h_get_32 (abfd, buf + 44); + module->objc_module_info_addr = bfd_h_get_64 (abfd, buf + 48); + } + else + { + module->objc_module_info_addr = bfd_h_get_32 (abfd, buf + 44); + module->objc_module_info_size = bfd_h_get_32 (abfd, buf + 48); + } + } } if (cmd->ntoc != 0) @@ -4205,24 +4205,24 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) unsigned long i; cmd->dylib_toc = bfd_alloc2 - (abfd, cmd->ntoc, sizeof (bfd_mach_o_dylib_table_of_content)); + (abfd, cmd->ntoc, sizeof (bfd_mach_o_dylib_table_of_content)); if (cmd->dylib_toc == NULL) - return FALSE; + return FALSE; if (bfd_seek (abfd, cmd->tocoff, SEEK_SET) != 0) - return FALSE; + return FALSE; for (i = 0; i < cmd->ntoc; i++) - { - struct mach_o_dylib_table_of_contents_external raw; - bfd_mach_o_dylib_table_of_content *toc = &cmd->dylib_toc[i]; + { + struct mach_o_dylib_table_of_contents_external raw; + bfd_mach_o_dylib_table_of_content *toc = &cmd->dylib_toc[i]; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) - return FALSE; + if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + return FALSE; - toc->symbol_index = bfd_h_get_32 (abfd, raw.symbol_index); - toc->module_index = bfd_h_get_32 (abfd, raw.module_index); - } + toc->symbol_index = bfd_h_get_32 (abfd, raw.symbol_index); + toc->module_index = bfd_h_get_32 (abfd, raw.module_index); + } } if (cmd->nindirectsyms != 0) @@ -4230,23 +4230,23 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) unsigned int i; cmd->indirect_syms = bfd_alloc2 - (abfd, cmd->nindirectsyms, sizeof (unsigned int)); + (abfd, cmd->nindirectsyms, sizeof (unsigned int)); if (cmd->indirect_syms == NULL) - return FALSE; + return FALSE; if (bfd_seek (abfd, cmd->indirectsymoff, SEEK_SET) != 0) - return FALSE; + return FALSE; for (i = 0; i < cmd->nindirectsyms; i++) - { - unsigned char raw[4]; - unsigned int *is = &cmd->indirect_syms[i]; + { + unsigned char raw[4]; + unsigned int *is = &cmd->indirect_syms[i]; - if (bfd_bread (raw, sizeof (raw), abfd) != sizeof (raw)) - return FALSE; + if (bfd_bread (raw, sizeof (raw), abfd) != sizeof (raw)) + return FALSE; - *is = bfd_h_get_32 (abfd, raw); - } + *is = bfd_h_get_32 (abfd, raw); + } } if (cmd->nextrefsyms != 0) @@ -4255,35 +4255,35 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) unsigned int i; cmd->ext_refs = bfd_alloc2 - (abfd, cmd->nextrefsyms, sizeof (bfd_mach_o_dylib_reference)); + (abfd, cmd->nextrefsyms, sizeof (bfd_mach_o_dylib_reference)); if (cmd->ext_refs == NULL) - return FALSE; + return FALSE; if (bfd_seek (abfd, cmd->extrefsymoff, SEEK_SET) != 0) - return FALSE; + return FALSE; for (i = 0; i < cmd->nextrefsyms; i++) - { - unsigned char raw[4]; - bfd_mach_o_dylib_reference *ref = &cmd->ext_refs[i]; - - if (bfd_bread (raw, sizeof (raw), abfd) != sizeof (raw)) - return FALSE; - - /* Fields isym and flags are written as bit-fields, thus we need - a specific processing for endianness. */ - v = bfd_h_get_32 (abfd, raw); - if (bfd_big_endian (abfd)) - { - ref->isym = (v >> 8) & 0xffffff; - ref->flags = v & 0xff; - } - else - { - ref->isym = v & 0xffffff; - ref->flags = (v >> 24) & 0xff; - } - } + { + unsigned char raw[4]; + bfd_mach_o_dylib_reference *ref = &cmd->ext_refs[i]; + + if (bfd_bread (raw, sizeof (raw), abfd) != sizeof (raw)) + return FALSE; + + /* Fields isym and flags are written as bit-fields, thus we need + a specific processing for endianness. */ + v = bfd_h_get_32 (abfd, raw); + if (bfd_big_endian (abfd)) + { + ref->isym = (v >> 8) & 0xffffff; + ref->flags = v & 0xff; + } + else + { + ref->isym = v & 0xffffff; + ref->flags = (v >> 24) & 0xff; + } + } } if (mdata->dysymtab) @@ -4552,8 +4552,8 @@ bfd_mach_o_read_source_version (bfd *abfd, bfd_mach_o_load_command *command) static bfd_boolean bfd_mach_o_read_segment (bfd *abfd, - bfd_mach_o_load_command *command, - unsigned int wide) + bfd_mach_o_load_command *command, + unsigned int wide) { bfd_mach_o_segment_command *seg = &command->command.segment; unsigned long i; @@ -4565,7 +4565,7 @@ bfd_mach_o_read_segment (bfd *abfd, BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT_64); if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) - return FALSE; + return FALSE; memcpy (seg->segname, raw.segname, 16); seg->segname[16] = '\0'; @@ -4586,7 +4586,7 @@ bfd_mach_o_read_segment (bfd *abfd, BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT); if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) - return FALSE; + return FALSE; memcpy (seg->segname, raw.segname, 16); seg->segname[16] = '\0'; @@ -4609,7 +4609,7 @@ bfd_mach_o_read_segment (bfd *abfd, sec = bfd_mach_o_read_section (abfd, seg->initprot, wide); if (sec == NULL) - return FALSE; + return FALSE; bfd_mach_o_append_section_to_segment (seg, bfd_mach_o_get_mach_o_section (sec)); @@ -4704,7 +4704,7 @@ bfd_mach_o_read_command (bfd *abfd, bfd_mach_o_load_command *command) case BFD_MACH_O_LC_SUB_CLIENT: case BFD_MACH_O_LC_RPATH: if (!bfd_mach_o_read_str (abfd, command)) - return FALSE; + return FALSE; break; case BFD_MACH_O_LC_DYSYMTAB: if (!bfd_mach_o_read_dysymtab (abfd, command)) @@ -4801,11 +4801,11 @@ bfd_mach_o_flatten_sections (bfd *abfd) || cmd->type == BFD_MACH_O_LC_SEGMENT_64) { bfd_mach_o_segment_command *seg = &cmd->command.segment; - bfd_mach_o_section *sec; + bfd_mach_o_section *sec; BFD_ASSERT (csect + seg->nsects <= mdata->nsects); - for (sec = seg->sect_head; sec != NULL; sec = sec->next) + for (sec = seg->sect_head; sec != NULL; sec = sec->next) mdata->sections[csect++] = sec; } } @@ -4823,8 +4823,8 @@ bfd_mach_o_scan_start_address (bfd *abfd) if (cmd->type == BFD_MACH_O_LC_THREAD || cmd->type == BFD_MACH_O_LC_UNIXTHREAD) { - thr = &cmd->command.thread; - break; + thr = &cmd->command.thread; + break; } else if (cmd->type == BFD_MACH_O_LC_MAIN && mdata->nsects > 1) { @@ -4852,7 +4852,7 @@ bfd_mach_o_scan_start_address (bfd *abfd) unsigned char buf[4]; if (bfd_seek (abfd, thr->flavours[i].offset + 40, SEEK_SET) != 0 - || bfd_bread (buf, 4, abfd) != 4) + || bfd_bread (buf, 4, abfd) != 4) return FALSE; abfd->start_address = bfd_h_get_32 (abfd, buf); @@ -4863,33 +4863,33 @@ bfd_mach_o_scan_start_address (bfd *abfd) unsigned char buf[4]; if (bfd_seek (abfd, thr->flavours[i].offset + 0, SEEK_SET) != 0 - || bfd_bread (buf, 4, abfd) != 4) + || bfd_bread (buf, 4, abfd) != 4) return FALSE; abfd->start_address = bfd_h_get_32 (abfd, buf); } else if ((mdata->header.cputype == BFD_MACH_O_CPU_TYPE_POWERPC_64) - && (thr->flavours[i].flavour == BFD_MACH_O_PPC_THREAD_STATE64)) - { - unsigned char buf[8]; + && (thr->flavours[i].flavour == BFD_MACH_O_PPC_THREAD_STATE64)) + { + unsigned char buf[8]; - if (bfd_seek (abfd, thr->flavours[i].offset + 0, SEEK_SET) != 0 - || bfd_bread (buf, 8, abfd) != 8) - return FALSE; + if (bfd_seek (abfd, thr->flavours[i].offset + 0, SEEK_SET) != 0 + || bfd_bread (buf, 8, abfd) != 8) + return FALSE; - abfd->start_address = bfd_h_get_64 (abfd, buf); - } + abfd->start_address = bfd_h_get_64 (abfd, buf); + } else if ((mdata->header.cputype == BFD_MACH_O_CPU_TYPE_X86_64) - && (thr->flavours[i].flavour == BFD_MACH_O_x86_THREAD_STATE64)) - { - unsigned char buf[8]; + && (thr->flavours[i].flavour == BFD_MACH_O_x86_THREAD_STATE64)) + { + unsigned char buf[8]; - if (bfd_seek (abfd, thr->flavours[i].offset + (16 * 8), SEEK_SET) != 0 - || bfd_bread (buf, 8, abfd) != 8) - return FALSE; + if (bfd_seek (abfd, thr->flavours[i].offset + (16 * 8), SEEK_SET) != 0 + || bfd_bread (buf, 8, abfd) != 8) + return FALSE; - abfd->start_address = bfd_h_get_64 (abfd, buf); - } + abfd->start_address = bfd_h_get_64 (abfd, buf); + } } return TRUE; @@ -4897,8 +4897,8 @@ bfd_mach_o_scan_start_address (bfd *abfd) bfd_boolean bfd_mach_o_set_arch_mach (bfd *abfd, - enum bfd_architecture arch, - unsigned long machine) + enum bfd_architecture arch, + unsigned long machine) { bfd_mach_o_backend_data *bed = bfd_mach_o_get_backend_data (abfd); @@ -4950,8 +4950,8 @@ bfd_mach_o_scan (bfd *abfd, { _bfd_error_handler /* xgettext:c-format */ - (_("bfd_mach_o_scan: unknown architecture 0x%lx/0x%lx"), - header->cputype, header->cpusubtype); + (_("bfd_mach_o_scan: unknown architecture 0x%lx/0x%lx"), + header->cputype, header->cpusubtype); return FALSE; } @@ -5043,8 +5043,8 @@ bfd_mach_o_gen_mkobject (bfd *abfd) const bfd_target * bfd_mach_o_header_p (bfd *abfd, file_ptr hdr_off, - bfd_mach_o_filetype filetype, - bfd_mach_o_cpu_type cputype) + bfd_mach_o_filetype filetype, + bfd_mach_o_cpu_type cputype) { bfd_mach_o_header header; bfd_mach_o_data_struct *mdata; @@ -5074,7 +5074,7 @@ bfd_mach_o_header_p (bfd *abfd, if (cputype) { if (header.cputype != cputype) - goto wrong; + goto wrong; } else { @@ -5089,18 +5089,18 @@ bfd_mach_o_header_p (bfd *abfd, if (filetype) { if (header.filetype != filetype) - goto wrong; + goto wrong; } else { switch (header.filetype) - { - case BFD_MACH_O_MH_CORE: - /* Handled by core_p */ - goto wrong; - default: - break; - } + { + case BFD_MACH_O_MH_CORE: + /* Handled by core_p */ + goto wrong; + default: + break; + } } mdata = (bfd_mach_o_data_struct *) bfd_zalloc (abfd, sizeof (*mdata)); @@ -5235,9 +5235,9 @@ bfd_mach_o_fat_archive_p (bfd *abfd) static void bfd_mach_o_fat_member_init (bfd *abfd, - enum bfd_architecture arch_type, - unsigned long arch_subtype, - mach_o_fat_archentry *entry) + enum bfd_architecture arch_type, + unsigned long arch_subtype, + mach_o_fat_archentry *entry) { struct areltdata *areltdata; /* Create the member filename. Use ARCH_NAME. */ @@ -5254,7 +5254,7 @@ bfd_mach_o_fat_member_init (bfd *abfd, const size_t namelen = 2 + 8 + 1 + 2 + 8 + 1; char *name = xmalloc (namelen); snprintf (name, namelen, "0x%lx-0x%lx", - entry->cputype, entry->cpusubtype); + entry->cputype, entry->cpusubtype); abfd->filename = name; } @@ -5569,10 +5569,10 @@ bfd_mach_o_core_fetch_environment (bfd *abfd, return -1; if (bfd_seek (abfd, end - size, SEEK_SET) != 0) - { - free (buf); - return -1; - } + { + free (buf); + return -1; + } nread = bfd_bread (buf, size, abfd); @@ -5674,7 +5674,7 @@ bfd_mach_o_dsym_for_uuid_p (bfd *abfd, const bfd_mach_o_uuid_command *uuid_cmd) return FALSE; if (memcmp (uuid_cmd->uuid, dsym_uuid_cmd->uuid, - sizeof (uuid_cmd->uuid)) != 0) + sizeof (uuid_cmd->uuid)) != 0) return FALSE; return TRUE; @@ -5686,8 +5686,8 @@ bfd_mach_o_dsym_for_uuid_p (bfd *abfd, const bfd_mach_o_uuid_command *uuid_cmd) static bfd * bfd_mach_o_find_dsym (const char *dsym_filename, - const bfd_mach_o_uuid_command *uuid_cmd, - const bfd_arch_info_type *arch) + const bfd_mach_o_uuid_command *uuid_cmd, + const bfd_arch_info_type *arch) { bfd *base_dsym_bfd, *dsym_bfd; @@ -5742,13 +5742,13 @@ bfd_mach_o_follow_dsym (bfd *abfd) http://opensource.apple.com/source/gdb/gdb-1708/src/gdb/macosx/macosx-tdep.c */ dsym_filename = (char *)bfd_malloc (strlen (base_bfd->filename) - + strlen (dsym_subdir) + 1 - + strlen (base_basename) + 1); + + strlen (dsym_subdir) + 1 + + strlen (base_basename) + 1); sprintf (dsym_filename, "%s%s/%s", - base_bfd->filename, dsym_subdir, base_basename); + base_bfd->filename, dsym_subdir, base_basename); dsym_bfd = bfd_mach_o_find_dsym (dsym_filename, uuid_cmd, - bfd_get_arch_info (abfd)); + bfd_get_arch_info (abfd)); if (dsym_bfd == NULL) free (dsym_filename); @@ -5777,20 +5777,20 @@ bfd_mach_o_find_nearest_line (bfd *abfd, case BFD_MACH_O_MH_BUNDLE: case BFD_MACH_O_MH_KEXT_BUNDLE: if (mdata->dwarf2_find_line_info == NULL) - { - mdata->dsym_bfd = bfd_mach_o_follow_dsym (abfd); - /* When we couldn't find dSYM for this binary, we look for - the debug information in the binary itself. In this way, - we won't try finding separated dSYM again because - mdata->dwarf2_find_line_info will be filled. */ - if (! mdata->dsym_bfd) - break; - if (! _bfd_dwarf2_slurp_debug_info (abfd, mdata->dsym_bfd, - dwarf_debug_sections, symbols, - &mdata->dwarf2_find_line_info, + { + mdata->dsym_bfd = bfd_mach_o_follow_dsym (abfd); + /* When we couldn't find dSYM for this binary, we look for + the debug information in the binary itself. In this way, + we won't try finding separated dSYM again because + mdata->dwarf2_find_line_info will be filled. */ + if (! mdata->dsym_bfd) + break; + if (! _bfd_dwarf2_slurp_debug_info (abfd, mdata->dsym_bfd, + dwarf_debug_sections, symbols, + &mdata->dwarf2_find_line_info, FALSE)) - return FALSE; - } + return FALSE; + } break; default: return FALSE; @@ -5811,8 +5811,8 @@ bfd_mach_o_close_and_cleanup (bfd *abfd) _bfd_dwarf2_cleanup_debug_info (abfd, &mdata->dwarf2_find_line_info); bfd_mach_o_free_cached_info (abfd); if (mdata->dsym_bfd != NULL) - { - bfd *fat_bfd = mdata->dsym_bfd->my_archive; + { + bfd *fat_bfd = mdata->dsym_bfd->my_archive; #if 0 /* FIXME: PR 19435: This calculation to find the memory allocated by bfd_mach_o_follow_dsym for the filename does not always end up @@ -5822,18 +5822,18 @@ bfd_mach_o_close_and_cleanup (bfd *abfd) commented out. This does mean that there will be a memory leak, but it is small, and happens when we are closing down, so it should not matter too much. */ - char *dsym_filename = (char *)(fat_bfd - ? fat_bfd->filename - : mdata->dsym_bfd->filename); + char *dsym_filename = (char *)(fat_bfd + ? fat_bfd->filename + : mdata->dsym_bfd->filename); #endif - bfd_close (mdata->dsym_bfd); - mdata->dsym_bfd = NULL; - if (fat_bfd) - bfd_close (fat_bfd); + bfd_close (mdata->dsym_bfd); + mdata->dsym_bfd = NULL; + if (fat_bfd) + bfd_close (fat_bfd); #if 0 - free (dsym_filename); + free (dsym_filename); #endif - } + } } return _bfd_generic_close_and_cleanup (abfd); @@ -5863,12 +5863,12 @@ bfd_boolean bfd_mach_o_free_cached_info (bfd *abfd) #define bfd_mach_o_tgt_seg_table NULL #define bfd_mach_o_section_type_valid_for_tgt NULL -#define TARGET_NAME mach_o_be_vec -#define TARGET_STRING "mach-o-be" +#define TARGET_NAME mach_o_be_vec +#define TARGET_STRING "mach-o-be" #define TARGET_ARCHITECTURE bfd_arch_unknown #define TARGET_PAGESIZE 1 -#define TARGET_BIG_ENDIAN 1 -#define TARGET_ARCHIVE 0 +#define TARGET_BIG_ENDIAN 1 +#define TARGET_ARCHIVE 0 #define TARGET_PRIORITY 1 #include "mach-o-target.c" @@ -5880,12 +5880,12 @@ bfd_boolean bfd_mach_o_free_cached_info (bfd *abfd) #undef TARGET_ARCHIVE #undef TARGET_PRIORITY -#define TARGET_NAME mach_o_le_vec -#define TARGET_STRING "mach-o-le" +#define TARGET_NAME mach_o_le_vec +#define TARGET_STRING "mach-o-le" #define TARGET_ARCHITECTURE bfd_arch_unknown #define TARGET_PAGESIZE 1 -#define TARGET_BIG_ENDIAN 0 -#define TARGET_ARCHIVE 0 +#define TARGET_BIG_ENDIAN 0 +#define TARGET_ARCHIVE 0 #define TARGET_PRIORITY 1 #include "mach-o-target.c" @@ -5899,21 +5899,21 @@ bfd_boolean bfd_mach_o_free_cached_info (bfd *abfd) #undef TARGET_PRIORITY /* Not yet handled: creating an archive. */ -#define bfd_mach_o_mkarchive _bfd_noarchive_mkarchive +#define bfd_mach_o_mkarchive _bfd_noarchive_mkarchive -#define bfd_mach_o_close_and_cleanup bfd_true +#define bfd_mach_o_close_and_cleanup bfd_true /* Not used. */ -#define bfd_mach_o_generic_stat_arch_elt bfd_mach_o_fat_stat_arch_elt +#define bfd_mach_o_generic_stat_arch_elt bfd_mach_o_fat_stat_arch_elt #define bfd_mach_o_openr_next_archived_file bfd_mach_o_fat_openr_next_archived_file #define bfd_mach_o_archive_p bfd_mach_o_fat_archive_p -#define TARGET_NAME mach_o_fat_vec -#define TARGET_STRING "mach-o-fat" +#define TARGET_NAME mach_o_fat_vec +#define TARGET_STRING "mach-o-fat" #define TARGET_ARCHITECTURE bfd_arch_unknown #define TARGET_PAGESIZE 1 -#define TARGET_BIG_ENDIAN 1 -#define TARGET_ARCHIVE 1 +#define TARGET_BIG_ENDIAN 1 +#define TARGET_ARCHIVE 1 #define TARGET_PRIORITY 0 #include "mach-o-target.c" |