diff options
Diffstat (limited to 'bfd')
119 files changed, 2044 insertions, 2233 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 2fd5efe..bb4c9ce 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,313 @@ +2003-12-15 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru> + Nick Clifton <nickc@redhat.com> + + * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Ensure that correct flags + are set on known section types. + +2003-12-12 Nick Clifton <nickc@redhat.com> + + * po/ro.po: Updated translation. + +2003-12-12 Alan Modra <amodra@bigpond.net.au> + + * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Check for + NULL dyn_h. + +2003-12-11 Nick Clifton <nickc@redhat.com> + + * elf.c (INCLUDE_SECTION_IN_SEGMENT): Skip PT_GNU_STACK segments. + +2003-12-08 Richard Sandiford <rsandifo@redhat.com> + + * elfxx-mips.h, elfxx-mips.c, cpu-mips.c: Convert prototypes. + Remove casts that were only needed for K&R compatibility. + +2003-12-08 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (struct elf_backend_data): Remove "bfd *" and add + "elflink_hash_entry *" param to elf_backend_link_output_symbol_hook. + Add "elflink_hash_entry *" param to elf_backend_output_arch_syms. + * elflink.h (elf_link_output_sym): Add "elflink_hash_entry *" param, + and pass to output_symbol_hook. + (elf_bfd_final_link): Adjust elf_link_output_sym calls. + (elf_link_output_extsym): Likewise. + (elf_link_input_bfd): Likewise. + * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Adjust. + * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. + * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. + * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. + * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. + * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise. + * elf64-sparc.c (sparc64_elf_output_arch_syms): Likewise. + * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. + Validate dynh->h against h. + * elf64-ppc.c (struct ppc_link_hash_entry): Add adjust_done bitfield. + (link_hash_newfunc): Init it. + (adjust_opd_syms): New function. + (ppc64_elf_edit_opd): Set adjust_done when global .opd sym adjusted. + Set opd.adjust for all .opd relocs. Call adjust_opd_syms. + (ppc64_elf_tls_optimize): Adjust possible .opd sym values here. + (ppc64_elf_relocate_section): Also adjust syms not a multiple of 24. + (ppc64_elf_output_symbol_hook): New function. + (elf_backend_link_output_symbol_hook): Define. + +2003-12-07 Richard Sandiford <rsandifo@redhat.com> + + * elf32-mips.c, elfn32-mips.c, elf64-mips.c: Convert prototypes. + Remove casts that were only needed for K&R compatibility. + +2003-12-05 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru> + + * coff-arm.c (aoutarm_std_reloc_howto [ARM_WINCE]): Set + partial_inplace for these relocs to FALSE for comptability with + the MS linker. + Remap ARM_26D relocation from 5 to 0. This fixes "bad fixup" error + generated by MS linker, and brings the relocation in line the MS + PE documentation. + +2003-12-04 H.J. Lu <hongjiu.lu@intel.com> + + * elf32-ppc.c (ppc_elf_relax_section): Don't check relax_finalizing. + +2003-12-04 H.J. Lu <hongjiu.lu@intel.com> + + * elfxx-ia64.c (elfNN_ia64_relax_section): Use the + need_relax_finalize field in link_info instead of + relax_finalizing to check if the relax finalize pass is being + done. + +2003-12-04 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru> + + * coff-arm.c (coff_arm_relocate_section, bfd_arm_process_before_allocation): + Change ARM26* to ARM_26* in comments to match definitions. + (coff_arm_adjust_symndx): Replace hard-coded constants with + appropriate definitions (ARM_26*). + +2003-12-04 Alan Modra <amodra@bigpond.net.au> + + * coff-i860.c (coff_i860_reloc_nyi): Return bfd_reloc_not_supported. + * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Warning fixes. + (mn10300_elf_relax_section): Likewise. + * nlm32-alpha.c (ONES): Define. + (nlm32_alpha_howto_table): Use it to avoid warnings. + +2003-12-04 Alan Modra <amodra@bigpond.net.au> + + * elf32-i386.c (elf_i386_object_p): Delete. + (elf_backend_object_p): Don't define. + * elf32-s390.c (elf_s390_object_p): No need to alloc tdata here. + * elf32-sh.c (sh_elf_object_p): Likewise. + * elf32-sparc.c (elf32_sparc_object_p): Likewise. + * elf64-alpha.c (elf64_alpha_object_p): Likewise. + * elf64-s390.c (elf_s390_object_p): Likewise. + * elf64-x86-64.c (elf64_x86_64_elf_object_p): Likewise. + +2003-12-03 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + * archures.c (bfd_mach_m32r2): Add new machine type. + * bfd-in2.h: Regenerate. + * cpu-m32r.c : Add new machine type. + * elf32-m32r.c (m32r_elf_object_p, m32r_elf_final_write_processing, + m32r_elf_merge_private_bfd_data): Add support for new machine + type. + +2003-12-03 Dave Airlie <airlied@linux.ie> + + * config.bfd: Add vax-linux-gnu target. + * configure.in: Likewise. + * configure: Regenerate. + +2003-12-03 Alan Modra <amodra@bigpond.net.au> + + * ecoff.c (ecoff_link_add_archive_symbols): Update for renamed + bfd_link_hash_entry field "next" -> "und_next". + * linker.c (_bfd_link_hash_newfunc): Likewise. + (bfd_link_add_undef): Likewise. + (_bfd_generic_link_add_archive_symbols): Likewise. + (_bfd_generic_link_add_one_symbol): Likewise. + * xcofflink.c (xcoff_link_add_symbols): Likewise. + +2003-12-02 Nick Clifton <nickc@redhat.com> + + * configure.in (ALL_LINGUAS): Add ro. + * po/ro.po: New Romanian translation. + +2003-12-02 Alan Modra <amodra@bigpond.net.au> + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + +2003-12-01 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru> + + * coffcode.h (coff_compute_section_file_positions): Set page_size + to 1 instead of 0 in the case file alignment value is zero. + +2003-12-01 Kazu Hirata <kazu@cs.umass.edu> + + * coff-rs6000.c: Remove ARGSUSED and VARARGS. + * coff64-rs6000.c: Likewise. + * coffcode.h: Likewise. + * elf32-vax.c: Likewise. + * hash.c: Likewise. + * hppabsd-core.c: Likewise. + * hpux-core.c: Likewise. + * ihex.c: Likewise. + * netbsd-core.c: Likewise. + * osf-core.c: Likewise. + * pdp11.c: Likewise. + * ptrace-core.c: Likewise. + * sco5-core.c: Likewise. + * section.c: Likewise. + * sunos.c: Likewise. + * trad-core.c: Likewise. + +2003-12-01 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (is_elf_hash_table): Take hash tab rather than info arg. + * elf.c (_bfd_elf_merge_sections): Adjust to suit. + (_bfd_elf_link_just_syms): Likewise. + (bfd_elf_get_needed_list): Likewise. + (bfd_elf_get_runpath_list): Likewise. + (_bfd_elf_link_hash_copy_indirect): Remove unneeded parens. + * elf32-hppa.c (elf32_hppa_setup_section_lists): Don't check hash tab + creator flavour. + (elf32_hppa_set_gp): Look up output sections rather than using htab. + * elf32-i960.c: Comment fix. Formatting. + * elf32-m32r.c (m32r_elf_add_symbol_hook): Use is_elf_hash_table + rather than testing creator flavour. + * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise. + * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise. + * elflink.c (_bfd_elf_link_create_dynamic_sections): Adjust for + is_elf_hash_table change. Remove redundant test. + (bfd_elf_record_link_assignment): Use is_elf_hash_table rather than + testing creator flavour. + (elf_link_record_local_dynamic_symbol): Adjust for is_elf_hash_table. + (_bfd_elf_fix_symbol_flags): Likewise. + (_bfd_elf_adjust_dynamic_symbol): Likewise. + * elflink.h (elf_link_add_object_symbols): Likewise. Remove redundant + checks. Use is_elf_hash_table rather than testing creator flavour. + Use hash_table throughout in place of info->hash. + (elf_add_dynamic_entry): Adjust for is_elf_hash_table change. + (NAME(bfd_elf,size_dynamic_sections)): Likewise. Remove redundant + check. + (elf_bfd_final_link): Adjust for is_elf_hash_table change. + (elf_link_check_versioned_symbol): Use is_elf_hash_table rather than + testing creator flavour. + (elf_gc_sections): Add is_elf_hash_table check. + (elf_gc_common_finalize_got_offsets): Likewise. + (elf_bfd_discard_info): Adjust for is_elf_hash_table change. Remove + redundant check. + * elfxx-ia64.c (elfNN_ia64_relax_section): Use is_elf_hash_table + rather than testing creator flavour. + +2003-11-28 Christian Groessler <chris@groessler.org> + + * cpu-z8k.c: Convert to ISO C90. + * coff-z8k.c: Likewise. + +2003-11-27 Alexandre Oliva <aoliva@redhat.com> + + * elf-bfd.h (elf_backend_data::elf_backend_modify_segment_map): + Add link info argument. + * elf32-i370.c (elf_backend_modify_segment_map): Likewise. + * elf32-ppc.c (ppc_elf_modify_segment_map): Likewise. + * elf32-xtensa.c (elf_xtensa_modify_segment_map): Likewise. + * elf64-hppa.c (elf64_hppa_modify_segment_map): Likewise. + * elfxx-ia64.c (elfNN_ia64_modify_segment_map): Likewise. + * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Likewise. + * elfxx-mips.h (_bfd_mips_elf_modify_segment_map): Likewise. + * elf.c (assign_file_positions_except_relocs, + assign_file_positions_for_segments): Likewise. Adjust calls. + +2003-11-27 Mark Kettenis <kettenis@gnu.org> + + * elf.c (elfcore_grok_netbsd_procinfo): Make a pseudosection out + of the note. + +2003-11-26 Daniel Jacobowitz <drow@mvista.com> + Richard Sandiford <rsandifo@redhat.com> + + * elfxx-mips.c (mips_elf_set_global_got_offset): Don't set no_fn_stub. + (mips_elf_set_no_stub): New function. + (mips_elf_multi_got): Call it. + (_bfd_mips_elf_finish_dynamic_symbol): If a relocation is needed for + a secondary GOT entry, create an R_MIPS_32 or R_MIPS_64 relocation and + use mips_elf_create_dynamic_relocation to deal with any compatibility + issues. Store the adjusted addend in the GOT slot. + +2003-11-25 Mattias Engdegård <mattias@virtutech.se> + + * stabs.c (_bfd_link_section_stabs): Skip N_EXCL stabs when + procesing N_BINCL stabs. + +2003-11-25 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (ppc_type_of_stub): Disallow stubs other than + ppc_stub_plt_call to symbols defined in shared libs. + +2003-11-22 Jakub Jelinek <jakub@redhat.com> + + * elf-bfd.h (ELF_LINK_POINTER_EQUALITY_NEEDED): Define new flag. + * elf.c (_bfd_elf_link_hash_copy_indirect): Copy it. + * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise. + (elf_i386_check_relocs): Set it. + (elf_i386_finish_dynamic_symbol): If it is not set, + clear st_value of SHN_UNDEF symbol. + +2003-11-20 Jim Blandy <jimb@redhat.com> + + * cpu-powerpc.c (powerpc_compatible): Any ISA in the PowerPC + family is a superset of <bfd_arch_rs6000,bfd_mach_rs6k>. + +2003-11-20 Martin Schwidefsky <schwidefsky@de.ibm.com> + + * elf32-s390.c (elf_s390_relocate_section): Don't recalculate symbol + section for reloc output and subtract the output section's address + from the addend when converting a relocation into one against a + section symbol. + * elf64-s390.c (elf_s390_relocate_section): Likewise. + +2003-11-18 James E Wilson <wilson@specifixinc.com> + + * elfxx-ia64.c (get_fptr): For fptr_rel, use dynobj not abfd. + (elfNN_ia64_size_dynamic_sections): When stripping sections, check + for ia64_info->rel_fptr_sec. + +2003-11-18 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (toc_adjusting_stub_needed): Exit early if section + size is zero. + +2003-11-17 Daniel Jacobowitz <drow@mvista.com> + + * elf.c (_bfd_elf_link_hash_copy_indirect): Copy + ELF_LINK_HASH_NEEDS_PLT. Fix formatting. + * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise. + * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise. + * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Likewise. + * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise. + * elf32-sh.c (sh_elf_copy_indirect_symbol): Likewise. + * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise. + * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise. + * elf64-x86-64.c (elf64_x86_64_copy_indirect_symbol): Likewise. + * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise. + * elf32-xtensa.c (elf_xtensa_copy_indirect_symbol): Remove. + (elf_backend_copy_indirect_symbol): Don't define. + +2003-11-14 Daniel Jacobowitz <drow@mvista.com> + + * elfxx-mips.c (mips_elf_merge_gots): Weaken assert for local + GOT entries. + +2003-11-13 Martin Schwidefsky <schwidefsky@de.ibm.com> + + * elf32-s390.c (elf_s390_relocate_section): Only convert R_390_32 + to R_390_RELATIVE. Convert the other relocations against local + symbols to relocations against the start of the section. + * elf64-s390.c (elf_s390_relocate_section): Only convert R_390_64 + to R_390_RELATIVE. Convert the other relocations against local + symbols to relocations against the start of the section. + 2003-11-11 Nick Clifton <nickc@redhat.com> * elf-m10300.c (bfd_mn10300_elf_size_dynamic_sections): Use @@ -3030,7 +3340,7 @@ 2003-05-04 H.J. Lu <hjl@gnu.org> - * elflink.h (elf_merge_symbol): Correctly handle weak definiton. + * elflink.h (elf_merge_symbol): Correctly handle weak definition. 2003-05-04 H.J. Lu <hjl@gnu.org> @@ -8334,7 +8644,7 @@ * config.bfd: Added DLX configuraton. * Makefile.am: Added DLX configuraton. * configure.in: Added DLX configuraton. - * archures.c: Add DLX architecure. + * archures.c: Add DLX architecture. * reloc.c: Add DLX relocs. * targets.c: Added DLX target vector. * configure: Regenerate. diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 216b399..3a2d43e 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -1616,11 +1616,13 @@ cisco-core.lo: cisco-core.c $(INCDIR)/filenames.h elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \ + elf32-target.h elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/reloc-macros.h elf64-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \ + elf64-target.h peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \ libcoff.h $(INCDIR)/bfdlink.h libpei.h diff --git a/bfd/Makefile.in b/bfd/Makefile.in index f85a6fe..b3bf65b 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -812,7 +812,7 @@ configure.in version.h DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS) @@ -2151,11 +2151,13 @@ cisco-core.lo: cisco-core.c $(INCDIR)/filenames.h elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \ + elf32-target.h elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/reloc-macros.h elf64-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \ + elf64-target.h peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \ libcoff.h $(INCDIR)/bfdlink.h libpei.h diff --git a/bfd/aix5ppc-core.c b/bfd/aix5ppc-core.c index b0a9c5e..0351076 100644 --- a/bfd/aix5ppc-core.c +++ b/bfd/aix5ppc-core.c @@ -102,7 +102,7 @@ xcoff64_core_p (abfd) || (! (core.c_flag & LE_VALID))) goto xcoff64_core_p_error; - /* Check for trucated stack or general truncating. */ + /* Check for truncated stack or general truncating. */ if ((! (core.c_flag & USTACK_VALID)) || (core.c_flag & CORE_TRUNC)) { diff --git a/bfd/aout-arm.c b/bfd/aout-arm.c index 34a235a..38ecfab9 100644 --- a/bfd/aout-arm.c +++ b/bfd/aout-arm.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" -/* Avoid multiple defininitions from aoutx if supporting standarad a.out +/* Avoid multiple definitions from aoutx if supporting standard a.out as well as our own. */ /* Do not "beautify" the CONCAT* macro args. Traditional C will not remove whitespace added here, and thus will fail to concatenate diff --git a/bfd/aout-ns32k.c b/bfd/aout-ns32k.c index 8092705..1ac8d71 100644 --- a/bfd/aout-ns32k.c +++ b/bfd/aout-ns32k.c @@ -70,7 +70,7 @@ MY(put_reloc) PARAMS ((bfd *, int, int, bfd_vma, reloc_howto_type *, data. Of these, only the last fits into the standard relocation scheme. Immediate operands are stored huffman encoded and immediate operands are stored big endian (where as the natural byte - order is little endian for this achitecture). + order is little endian for this architecture). Note that the ns32k displacement storage method is orthogonal to whether the relocation is pc relative or not. The "displacement" diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 6c20bd0..3282f87 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -3254,7 +3254,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded) and this object file from the archive includes: int a = 5; In such a case, whether to include this object is target - dependant for backward compatability. + dependant for backward compatibility. FIXME: The SunOS 4.1.3 linker will pull in the archive element if the symbol is defined in the .data section, diff --git a/bfd/archures.c b/bfd/archures.c index 064fa55..f8aeeef 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -272,6 +272,7 @@ DESCRIPTION . bfd_arch_m32r, {* Renesas M32R (formerly Mitsubishi M32R/D) *} .#define bfd_mach_m32r 1 {* For backwards compatibility. *} .#define bfd_mach_m32rx 'x' +.#define bfd_mach_m32r2 '2' . bfd_arch_mn10200, {* Matsushita MN10200 *} . bfd_arch_mn10300, {* Matsushita MN10300 *} .#define bfd_mach_mn10300 300 @@ -865,7 +866,7 @@ bfd_default_scan (const bfd_arch_info_type *info, const char *string) } /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>; Do not - attempt to match just <mach>, it could be ambigious. This test + attempt to match just <mach>, it could be ambiguous. This test is left until later. */ /* NOTE: The below is retained for compatibility only. Please do @@ -1046,7 +1047,7 @@ SYNOPSIS (enum bfd_architecture arch, unsigned long machine); DESCRIPTION - Look for the architecure info structure which matches the + Look for the architecture info structure which matches the arguments @var{arch} and @var{machine}. A machine of 0 matches the machine/architecture structure which marks itself as the default. diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 1a67d08..ccfef1e 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -185,7 +185,7 @@ typedef unsigned char bfd_byte; typedef enum bfd_format { bfd_unknown = 0, /* File format is unknown. */ - bfd_object, /* Linker/assember/compiler output. */ + bfd_object, /* Linker/assembler/compiler output. */ bfd_archive, /* Object archive file. */ bfd_core, /* Core dump. */ bfd_type_end /* Marks the end; don't use it! */ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 5c17a7a..2afcf7f 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -192,7 +192,7 @@ typedef unsigned char bfd_byte; typedef enum bfd_format { bfd_unknown = 0, /* File format is unknown. */ - bfd_object, /* Linker/assember/compiler output. */ + bfd_object, /* Linker/assembler/compiler output. */ bfd_archive, /* Object archive file. */ bfd_core, /* Core dump. */ bfd_type_end /* Marks the end; don't use it! */ @@ -1710,6 +1710,7 @@ enum bfd_architecture bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */ #define bfd_mach_m32r 1 /* For backwards compatibility. */ #define bfd_mach_m32rx 'x' +#define bfd_mach_m32r2 '2' bfd_arch_mn10200, /* Matsushita MN10200 */ bfd_arch_mn10300, /* Matsushita MN10300 */ #define bfd_mach_mn10300 300 @@ -1932,7 +1933,7 @@ struct reloc_howto_struct /* If this field is non null, then the supplied function is called rather than the normal function. This allows really - strange relocation methods to be accomodated (e.g., i960 callj + strange relocation methods to be accommodated (e.g., i960 callj instructions). */ bfd_reloc_status_type (*special_function) (bfd *, arelent *, struct bfd_symbol *, void *, asection *, @@ -2551,7 +2552,7 @@ in the instruction. */ /* IBM 370/390 relocations */ BFD_RELOC_I370_D12, -/* The type of reloc used to build a contructor table - at the moment +/* The type of reloc used to build a constructor table - at the moment probably a 32 bit wide absolute relocation, but the target can choose. It generally does map to one of the other relocation types. */ BFD_RELOC_CTOR, @@ -2848,11 +2849,11 @@ data area pointer. */ BFD_RELOC_V850_TDA_4_4_OFFSET, /* This is a 16 bit offset from the short data area pointer, with the -bits placed non-contigously in the instruction. */ +bits placed non-contiguously in the instruction. */ BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET, /* This is a 16 bit offset from the zero data area pointer, with the -bits placed non-contigously in the instruction. */ +bits placed non-contiguously in the instruction. */ BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET, /* This is a 6 bit offset from the call table base pointer. */ @@ -3209,7 +3210,7 @@ that are not used, so that the code for those functions need not be included in the output. VTABLE_INHERIT is a zero-space relocation used to describe to the -linker the inheritence tree of a C++ virtual function table. The +linker the inheritance tree of a C++ virtual function table. The relocation's symbol should be the parent class' vtable, and the relocation should be located at the child vtable. @@ -3318,7 +3319,7 @@ This is the 3 bit of a value. */ /* Motorola 68HC11 reloc. This reloc marks the beginning of a jump/call instruction. It is used for linker relaxation to correctly identify beginning -of instruction and change some branchs to use PC-relative +of instruction and change some branches to use PC-relative addressing mode. */ BFD_RELOC_M68HC11_RL_JUMP, @@ -3530,7 +3531,7 @@ typedef struct bfd_symbol <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or <<BSF_GLOBAL>>. */ - /* The symbol is a debugging record. The value has an arbitary + /* The symbol is a debugging record. The value has an arbitrary meaning, unless BSF_DEBUGGING_RELOC is also set. */ #define BSF_DEBUGGING 0x08 @@ -396,7 +396,7 @@ SUBSECTION Some BFD functions want to print messages describing the problem. They call a BFD error handler function. This - function may be overriden by the program. + function may be overridden by the program. The BFD error handler acts like printf. diff --git a/bfd/bfdio.c b/bfd/bfdio.c index f99fddd..b196a52 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -395,7 +395,7 @@ DESCRIPTION error when it tries to read the table, or a "virtual memory exhausted" error when it tries to allocate 15 bazillon bytes of space for the 15 bazillon byte table it is about to read. - This function at least allows us to answer the quesion, "is the + This function at least allows us to answer the question, "is the size reasonable?". */ diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index 3655a30..9b26123 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -4,21 +4,21 @@ Free Software Foundation, Inc. Written by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -252,11 +252,11 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, #undef ARM_THUMB12 #undef ARM_26D +#define ARM_26D 0 #define ARM_32 1 #define ARM_RVA32 2 #define ARM_26 3 #define ARM_THUMB12 4 -#define ARM_26D 5 #define ARM_SECTION 14 #define ARM_SECREL 15 #endif @@ -264,7 +264,19 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, static reloc_howto_type aoutarm_std_reloc_howto[] = { #ifdef ARM_WINCE - EMPTY_HOWTO (-1), + HOWTO (ARM_26D, + 2, + 2, + 24, + FALSE, + 0, + complain_overflow_dont, + aoutarm_fix_pcrel_26_done, + "ARM_26D", + FALSE, + 0x00ffffff, + 0x0, + FALSE), HOWTO (ARM_32, 0, 2, @@ -274,7 +286,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = complain_overflow_bitfield, coff_arm_reloc, "ARM_32", - TRUE, + FALSE, 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -287,7 +299,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = complain_overflow_bitfield, coff_arm_reloc, "ARM_RVA32", - TRUE, + FALSE, 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -317,19 +329,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = 0x000007ff, 0x000007ff, PCRELOFFSET), - HOWTO (ARM_26D, - 2, - 2, - 24, - FALSE, - 0, - complain_overflow_dont, - aoutarm_fix_pcrel_26_done, - "ARM_26D", - TRUE, - 0x00ffffff, - 0x0, - FALSE), + EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), @@ -346,8 +346,8 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = 0, complain_overflow_bitfield, coff_arm_reloc, - "ARM_16", - TRUE, + "ARM_SECTION", + FALSE, 0x0000ffff, 0x0000ffff, PCRELOFFSET), @@ -359,8 +359,8 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = 0, complain_overflow_bitfield, coff_arm_reloc, - "ARM_32", - TRUE, + "ARM_SECREL", + FALSE, 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -921,13 +921,13 @@ struct coff_arm_link_hash_table /* The original coff_link_hash_table structure. MUST be first field. */ struct coff_link_hash_table root; - /* The size in bytes of the section containg the Thumb-to-ARM glue. */ + /* The size in bytes of the section containing the Thumb-to-ARM glue. */ bfd_size_type thumb_glue_size; - /* The size in bytes of the section containg the ARM-to-Thumb glue. */ + /* The size in bytes of the section containing the ARM-to-Thumb glue. */ bfd_size_type arm_glue_size; - /* An arbitary input BFD chosen to hold the glue sections. */ + /* An arbitrary input BFD chosen to hold the glue sections. */ bfd * bfd_of_glue_owner; /* Support interworking with old, non-interworking aware ARM code. */ @@ -991,7 +991,7 @@ arm_emit_base_file_entry (info, output_bfd, input_section, reloc_offset) instruction. It takes two thumb instructions to encode the target address. Each has - 11 bits to invest. The upper 11 bits are stored in one (identifed by + 11 bits to invest. The upper 11 bits are stored in one (identified by H-0.. see below), the lower 11 bits are stored in the other (identified by H-1). @@ -1248,7 +1248,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, /* The relocation_section function will skip pcrel_offset relocs when doing a relocatable link. However, we want to convert - ARM26 to ARM26D relocs if possible. We return a fake howto in + ARM_26 to ARM_26D relocs if possible. We return a fake howto in this case without pcrel_offset set, and adjust the addend to compensate. */ if (rel->r_type == ARM_26 @@ -1299,7 +1299,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, /* FIXME - it is not clear which targets need this next test and which do not. It is known that it is needed for the VxWorks and EPOC-PE targets, but it is also known that it - was supressed for other ARM targets. This ought to be + was suppressed for other ARM targets. This ought to be sorted out one day. */ #ifdef ARM_COFF_BUGFIX /* We must not ignore the symbol value. If the symbol is @@ -2198,8 +2198,8 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code) #define coff_bfd_copy_private_bfd_data coff_arm_copy_private_bfd_data #define coff_bfd_link_hash_table_create coff_arm_link_hash_table_create -/* When doing a relocatable link, we want to convert ARM26 relocs - into ARM26D relocs. */ +/* When doing a relocatable link, we want to convert ARM_26 relocs + into ARM_26D relocs. */ static bfd_boolean coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) @@ -2210,7 +2210,7 @@ coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) struct internal_reloc *irel; bfd_boolean *adjustedp; { - if (irel->r_type == 3) + if (irel->r_type == ARM_26) { struct coff_link_hash_entry *h; @@ -2219,7 +2219,7 @@ coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) && (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && h->root.u.def.section->output_section == sec->output_section) - irel->r_type = 7; + irel->r_type = ARM_26D; } *adjustedp = FALSE; return TRUE; @@ -2228,7 +2228,7 @@ coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) /* Called when merging the private data areas of two BFDs. This is important as it allows us to detect if we are attempting to merge binaries compiled for different ARM - targets, eg different CPUs or differents APCS's. */ + targets, eg different CPUs or different APCS's. */ static bfd_boolean coff_arm_merge_private_bfd_data (ibfd, obfd) @@ -2361,7 +2361,7 @@ coff_arm_print_private_bfd_data (abfd, ptr) if (APCS_SET (abfd)) { - /* xgettext: APCS is ARM Prodecure Call Standard, it should not be translated. */ + /* xgettext: APCS is ARM Procedure Call Standard, it should not be translated. */ fprintf (file, " [APCS-%d]", APCS_26_FLAG (abfd) ? 26 : 32); if (APCS_FLOAT_FLAG (abfd)) diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index 5cb327a..e9d1964 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -775,7 +775,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, src_address += 4; break; - /* A 16bit abolute relocation that was formerlly a 24/32bit + /* A 16bit absolute relocation that was formerly a 24/32bit absolute relocation. */ case R_MOVL2: value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); diff --git a/bfd/coff-i860.c b/bfd/coff-i860.c index 74b599c..edc9f4e 100644 --- a/bfd/coff-i860.c +++ b/bfd/coff-i860.c @@ -140,6 +140,7 @@ coff_i860_reloc_nyi (bfd *abfd ATTRIBUTE_UNUSED, { reloc_howto_type *howto = reloc_entry->howto; fprintf (stderr, _("Relocation `%s' not yet implemented\n"), howto->name); + return bfd_reloc_notsupported; } #ifndef PCRELOFFSET @@ -524,7 +525,7 @@ coff_i860_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, BFD_ASSERT (h != NULL); /* I think we *do* want to bypass this. If we don't, I have seen some data - parameters get the wrong relcation address. If I link two versions + parameters get the wrong relocation address. If I link two versions with and without this section bypassed and then do a binary comparison, the addresses which are different can be looked up in the map. The case in which this section has been bypassed has addresses which correspond diff --git a/bfd/coff-m88k.c b/bfd/coff-m88k.c index a8b2c55..bef0eab 100644 --- a/bfd/coff-m88k.c +++ b/bfd/coff-m88k.c @@ -1,4 +1,4 @@ -/* BFD back-end for Motorola 88000 COFF "Binary Compatability Standard" files. +/* BFD back-end for Motorola 88000 COFF "Binary Compatibility Standard" files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @@ -85,7 +85,7 @@ m88k_special_reloc (abfd, reloc_entry, symbol, data, asection *reloc_target_output_section; long relocation = 0; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c index c4b0735..25569e3 100644 --- a/bfd/coff-mcore.c +++ b/bfd/coff-mcore.c @@ -587,7 +587,7 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section, #include "coffcode.h" -/* Forward declaration to initialise alterbative_target field. */ +/* Forward declaration to initialise alternative_target field. */ extern const bfd_target TARGET_LITTLE_SYM; /* The transfer vectors that lead the outside world to all of the above. */ diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c index cf54942..c1c2c32 100644 --- a/bfd/coff-ppc.c +++ b/bfd/coff-ppc.c @@ -929,7 +929,7 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind) local_syms[sym] = global_toc_size; global_toc_size += 4; - /* The size must fit in a 16bit displacment. */ + /* The size must fit in a 16-bit displacement. */ if (global_toc_size > 65535) { (*_bfd_error_handler) (_("TOC overflow")); @@ -949,7 +949,7 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind) h->toc_offset = global_toc_size; global_toc_size += 4; - /* The size must fit in a 16bit displacment. */ + /* The size must fit in a 16-bit displacement. */ if (global_toc_size >= 65535) { (*_bfd_error_handler) (_("TOC overflow")); @@ -1274,7 +1274,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, our_toc_offset = val - (toc_section->output_section->vma + toc_section->output_offset); - /* The size must still fit in a 16bit displacment. */ + /* The size must still fit in a 16-bit displacement. */ if ((bfd_vma) our_toc_offset >= 65535) { (*_bfd_error_handler) @@ -1931,7 +1931,7 @@ ppc_imglue_reloc (abfd, reloc_entry, symbol, data, #define MAX_RELOC_INDEX \ (sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]) - 1) -/* FIXME: There is a possiblity that when we read in a reloc from a file, +/* FIXME: There is a possibility that when we read in a reloc from a file, that there are some bits encoded in the upper portion of the type field. Not yet implemented. */ static void ppc_coff_rtype2howto PARAMS ((arelent *, struct internal_reloc *)); diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 0b73bd5..56e34e2 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -1006,7 +1006,7 @@ xcoff_rtype2howto (relent, internal) /* Default howto layout works most of the time */ relent->howto = &xcoff_howto_table[internal->r_type]; - /* Special case some 16 bit reoloc */ + /* Special case some 16 bit reloc */ if (15 == (internal->r_size & 0x1f)) { if (R_BA == internal->r_type) @@ -1575,7 +1575,6 @@ normalize_filename (abfd) /* Write out an XCOFF armap. */ -/*ARGSUSED*/ static bfd_boolean xcoff_write_armap_old (abfd, elength, map, orl_count, stridx) bfd *abfd; diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c index 15c7f9d..cf4da77 100644 --- a/bfd/coff-z8k.c +++ b/bfd/coff-z8k.c @@ -28,11 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "coff/internal.h" #include "libcoff.h" -static void extra_case PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, bfd_byte *, unsigned int *, unsigned int *)); -static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); -static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); -static int coff_z8k_select_reloc PARAMS ((reloc_howto_type *)); - #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) static reloc_howto_type r_imm32 = @@ -74,8 +69,7 @@ HOWTO (R_CALLR, 0, 1, 12, TRUE, 0, complain_overflow_signed, 0, /* Turn a howto into a reloc number */ static int -coff_z8k_select_reloc (howto) - reloc_howto_type *howto; +coff_z8k_select_reloc (reloc_howto_type *howto) { return howto->type; } @@ -96,9 +90,7 @@ coff_z8k_select_reloc (howto) /* Code to turn a r_type into a howto ptr, uses the above howto table. */ static void -rtype2howto (internal, dst) - arelent * internal; - struct internal_reloc *dst; +rtype2howto (arelent *internal, struct internal_reloc *dst) { switch (dst->r_type) { @@ -143,12 +135,11 @@ rtype2howto (internal, dst) reloc_processing(relent, reloc, symbols, abfd, section) static void -reloc_processing (relent, reloc, symbols, abfd, section) - arelent * relent; - struct internal_reloc * reloc; - asymbol ** symbols; - bfd * abfd; - asection * section; +reloc_processing (arelent *relent, + struct internal_reloc *reloc, + asymbol **symbols, + bfd *abfd, + asection *section) { relent->address = reloc->r_vaddr; rtype2howto (relent, reloc); @@ -163,14 +154,13 @@ reloc_processing (relent, reloc, symbols, abfd, section) } static void -extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) - bfd * in_abfd; - struct bfd_link_info * link_info; - struct bfd_link_order * link_order; - arelent * reloc; - bfd_byte * data; - unsigned int * src_ptr; - unsigned int * dst_ptr; +extra_case (bfd *in_abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + arelent *reloc, + bfd_byte *data, + unsigned int *src_ptr, + unsigned int *dst_ptr) { asection * input_section = link_order->u.indirect.section; @@ -197,7 +187,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) { bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info, input_section); - /* Adresses are 23 bit, and the layout of those in a 32-bit + /* Addresses are 23 bit, and the layout of those in a 32-bit value is as follows: 1AAAAAAA xxxxxxxx AAAAAAAA AAAAAAAA (A - address bits, x - ignore). */ diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index 895f96b..ec9c695 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -1791,7 +1791,7 @@ xcoff64_rtype2howto (relent, internal) /* Default howto layout works most of the time */ relent->howto = &xcoff64_howto_table[internal->r_type]; - /* Special case some 16 bit reoloc */ + /* Special case some 16 bit reloc */ if (15 == (internal->r_size & 0x3f)) { if (R_BA == internal->r_type) @@ -2054,7 +2054,6 @@ xcoff64_openr_next_archived_file (archive, last_file) /* We can't use the usual coff_sizeof_headers routine, because AIX always uses an a.out header. */ -/*ARGSUSED*/ static int xcoff64_sizeof_headers (abfd, reloc) bfd *abfd; diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 924bb34..ccac05b 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1572,7 +1572,7 @@ coff_new_section_hook (abfd, section) return FALSE; /* We don't need to set up n_name, n_value, or n_scnum in the native - symbol information, since they'll be overriden by the BFD symbol + symbol information, since they'll be overridden by the BFD symbol anyhow. However, we do need to set the type and storage class, in case this symbol winds up getting written out. The value 0 for n_numaux is already correct. */ @@ -3014,6 +3014,11 @@ coff_compute_section_file_positions (abfd) if (coff_data (abfd)->link_info) { page_size = pe_data (abfd)->pe_opthdr.FileAlignment; + + /* If no file alignment has been set, default to one. + This repairs 'ld -r' for arm-wince-pe target. */ + if (page_size == 0) + page_size = 1; } else page_size = PE_DEF_FILE_ALIGNMENT; @@ -4681,7 +4686,7 @@ coff_slurp_symbol_table (abfd) #endif case C_REGPARM: /* Register parameter. */ case C_REG: /* register variable. */ - /* C_AUTOARG conflictes with TI COFF C_UEXT. */ + /* C_AUTOARG conflicts with TI COFF C_UEXT. */ #if !defined (TIC80COFF) && !defined (TICOFF) #ifdef C_AUTOARG case C_AUTOARG: /* 960-specific storage class. */ @@ -5122,7 +5127,6 @@ static reloc_howto_type *coff_rtype_to_howto struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *)); -/*ARGSUSED*/ static reloc_howto_type * coff_rtype_to_howto (abfd, sec, rel, h, sym, addendp) bfd *abfd ATTRIBUTE_UNUSED; diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 91a3822..4ad566c 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -2565,7 +2565,7 @@ _bfd_coff_write_global_sym (struct coff_link_hash_entry *h, void *data) isym.n_sclass = C_STAT; } - /* When a weak symbol is not overriden by a strong one, + /* When a weak symbol is not overridden by a strong one, turn it into an external symbol when not building a shared or relocatable object. */ if (! finfo->info->shared diff --git a/bfd/config.bfd b/bfd/config.bfd index 9f51538..c1ca87e 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -884,13 +884,27 @@ case "${targ}" in targ_selvecs="bfd_elf32_pjl_vec bfd_elf32_pj_vec bfd_elf32_i386_vec" ;; + powerpc-*-aix5.[01]) + targ_defvec=rs6000coff_vec + targ_selvecs="aix5coff64_vec" + want64=true + ;; +#ifdef BFD64 + powerpc64-*-aix5.[01]) + targ_defvec=aix5coff64_vec + targ_selvecs="rs6000coff_vec" + want64=true + ;; +#endif powerpc-*-aix5*) + targ_cflags=-DAIX_WEAK_SUPPORT targ_defvec=rs6000coff_vec targ_selvecs="aix5coff64_vec" want64=true ;; #ifdef BFD64 powerpc64-*-aix5*) + targ_cflags=-DAIX_WEAK_SUPPORT targ_defvec=aix5coff64_vec targ_selvecs="rs6000coff_vec" want64=true @@ -903,7 +917,6 @@ case "${targ}" in case "${targ}" in *-*-aix4.[3456789]* | *-*-aix[56789]*) want64=true;; - *) targ_cflags=-DSMALL_ARCHIVE;; esac @@ -1229,6 +1242,10 @@ case "${targ}" in targ_underscore=yes ;; + vax-*-linux-gnu*) + targ_defvec=bfd_elf32_vax_vec + ;; + vax*-*-*vms*) targ_defvec=vms_vax_vec ;; diff --git a/bfd/configure b/bfd/configure index 34d9bc5..42345bb 100755 --- a/bfd/configure +++ b/bfd/configure @@ -2708,7 +2708,7 @@ else fi -ALL_LINGUAS="fr tr ja es sv da zh_CN" +ALL_LINGUAS="fr tr ja es sv da zh_CN ro" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo "configure:2714: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. @@ -5487,6 +5487,10 @@ rm -f conftest* COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxult2.h"' ;; + vax-*-linux-gnu*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/vaxlinux.h"' + ;; vax-*-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxbsd.h"' @@ -5514,17 +5518,17 @@ rm -f conftest* do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5518: checking for $ac_hdr" >&5 +echo "configure:5522: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5523 "configure" +#line 5527 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5528: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5532: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5552,12 +5556,12 @@ done if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5556: checking for prstatus_t in sys/procfs.h" >&5 +echo "configure:5560: checking for prstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5561 "configure" +#line 5565 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5566,7 +5570,7 @@ int main() { prstatus_t avar ; return 0; } EOF -if { (eval echo configure:5570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5574: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus_t=yes else @@ -5588,12 +5592,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6 echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5592: checking for prstatus32_t in sys/procfs.h" >&5 +echo "configure:5596: checking for prstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5597 "configure" +#line 5601 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5602,7 +5606,7 @@ int main() { prstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5606: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5610: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus32_t=yes else @@ -5624,12 +5628,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6 echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5628: checking for prstatus_t.pr_who in sys/procfs.h" >&5 +echo "configure:5632: checking for prstatus_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5633 "configure" +#line 5637 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5638,7 +5642,7 @@ int main() { prstatus_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5646: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes else @@ -5660,12 +5664,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6 echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5664: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 +echo "configure:5668: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5669 "configure" +#line 5673 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5674,7 +5678,7 @@ int main() { prstatus32_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5678: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5682: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes else @@ -5696,12 +5700,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6 echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5700: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:5704: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5705 "configure" +#line 5709 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5710,7 +5714,7 @@ int main() { pstatus_t avar ; return 0; } EOF -if { (eval echo configure:5714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5718: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5732,12 +5736,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5736: checking for pxstatus_t in sys/procfs.h" >&5 +echo "configure:5740: checking for pxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5741 "configure" +#line 5745 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5746,7 +5750,7 @@ int main() { pxstatus_t avar ; return 0; } EOF -if { (eval echo configure:5750: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5754: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pxstatus_t=yes else @@ -5768,12 +5772,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6 echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5772: checking for pstatus32_t in sys/procfs.h" >&5 +echo "configure:5776: checking for pstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5777 "configure" +#line 5781 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5782,7 +5786,7 @@ int main() { pstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5790: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus32_t=yes else @@ -5804,12 +5808,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6 echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5808: checking for prpsinfo_t in sys/procfs.h" >&5 +echo "configure:5812: checking for prpsinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5813 "configure" +#line 5817 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5818,7 +5822,7 @@ int main() { prpsinfo_t avar ; return 0; } EOF -if { (eval echo configure:5822: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5826: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo_t=yes else @@ -5840,12 +5844,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6 echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5844: checking for prpsinfo32_t in sys/procfs.h" >&5 +echo "configure:5848: checking for prpsinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5849 "configure" +#line 5853 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5854,7 +5858,7 @@ int main() { prpsinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5858: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes else @@ -5876,12 +5880,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6 echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5880: checking for psinfo_t in sys/procfs.h" >&5 +echo "configure:5884: checking for psinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5885 "configure" +#line 5889 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5890,7 +5894,7 @@ int main() { psinfo_t avar ; return 0; } EOF -if { (eval echo configure:5894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5898: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo_t=yes else @@ -5912,12 +5916,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6 echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5916: checking for psinfo32_t in sys/procfs.h" >&5 +echo "configure:5920: checking for psinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5921 "configure" +#line 5925 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5926,7 +5930,7 @@ int main() { psinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5930: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo32_t=yes else @@ -5948,12 +5952,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6 echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5952: checking for lwpstatus_t in sys/procfs.h" >&5 +echo "configure:5956: checking for lwpstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5957 "configure" +#line 5961 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5962,7 +5966,7 @@ int main() { lwpstatus_t avar ; return 0; } EOF -if { (eval echo configure:5966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpstatus_t=yes else @@ -5984,12 +5988,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6 echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5988: checking for lwpxstatus_t in sys/procfs.h" >&5 +echo "configure:5992: checking for lwpxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5993 "configure" +#line 5997 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5998,7 +6002,7 @@ int main() { lwpxstatus_t avar ; return 0; } EOF -if { (eval echo configure:6002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes else @@ -6020,12 +6024,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:6024: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 +echo "configure:6028: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6029 "configure" +#line 6033 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -6034,7 +6038,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_context ; return 0; } EOF -if { (eval echo configure:6038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6042: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes else @@ -6056,12 +6060,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:6060: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 +echo "configure:6064: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6065 "configure" +#line 6069 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -6070,7 +6074,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_reg ; return 0; } EOF -if { (eval echo configure:6074: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6078: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes else @@ -6092,12 +6096,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6 echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:6096: checking for win32_pstatus_t in sys/procfs.h" >&5 +echo "configure:6100: checking for win32_pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6101 "configure" +#line 6105 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -6106,7 +6110,7 @@ int main() { win32_pstatus_t avar ; return 0; } EOF -if { (eval echo configure:6110: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes else @@ -6575,10 +6579,10 @@ case ${host64}-${target64}-${want64} in if test -n "$GCC" ; then bad_64bit_gcc=no; echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6 -echo "configure:6579: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6583: checking for gcc version with buggy 64-bit support" >&5 # Add more tests for gcc versions with non-working 64-bit support here. cat > conftest.$ac_ext <<EOF -#line 6582 "configure" +#line 6586 "configure" #include "confdefs.h" :__GNUC__:__GNUC_MINOR__:__i386__: EOF @@ -6624,17 +6628,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6628: checking for $ac_hdr" >&5 +echo "configure:6632: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6633 "configure" +#line 6637 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6638: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6642: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6663,12 +6667,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6667: checking for $ac_func" >&5 +echo "configure:6671: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6672 "configure" +#line 6676 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6691,7 +6695,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6716,7 +6720,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6720: checking for working mmap" >&5 +echo "configure:6724: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6724,7 +6728,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 6728 "configure" +#line 6732 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6864,7 +6868,7 @@ main() } EOF -if { (eval echo configure:6868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -6889,12 +6893,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6893: checking for $ac_func" >&5 +echo "configure:6897: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6898 "configure" +#line 6902 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6917,7 +6921,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/bfd/configure.in b/bfd/configure.in index 35ba4e2..72c32bd 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -103,7 +103,7 @@ bfd_default_target_size=32 AC_PROG_CC -ALL_LINGUAS="fr tr ja es sv da zh_CN" +ALL_LINGUAS="fr tr ja es sv da zh_CN ro" CY_GNU_GETTEXT # Permit host specific settings. @@ -397,6 +397,10 @@ changequote([,])dnl COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxult2.h"' ;; + vax-*-linux-gnu*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/vaxlinux.h"' + ;; vax-*-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxbsd.h"' diff --git a/bfd/cpu-alpha.c b/bfd/cpu-alpha.c index 7b1dde9..c593fc3 100644 --- a/bfd/cpu-alpha.c +++ b/bfd/cpu-alpha.c @@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define NN(index) (&arch_info_struct[index]) -/* These exist only so that we can resonably disassemble PALcode. */ +/* These exist only so that we can reasonably disassemble PALcode. */ static const bfd_arch_info_type arch_info_struct[] = { N (64, 64, bfd_mach_alpha_ev4, "alpha:ev4", FALSE, NN(1)), diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c index 9ef527c..17889f3 100644 --- a/bfd/cpu-arm.c +++ b/bfd/cpu-arm.c @@ -155,7 +155,7 @@ const bfd_arch_info_type bfd_arm_arch = /* Support functions used by both the COFF and ELF versions of the ARM port. */ -/* Handle the mergeing of the 'machine' settings of input file IBFD +/* Handle the merging of the 'machine' settings of input file IBFD and an output file OBFD. These values actually represent the different possible ARM architecture variants. Returns TRUE if they were merged successfully or FALSE otherwise. */ @@ -172,7 +172,7 @@ bfd_arm_merge_machines (ibfd, obfd) if (out == bfd_mach_arm_unknown) bfd_set_arch_mach (obfd, bfd_arch_arm, in); - /* If the input architecure is unknown, + /* If the input architecture is unknown, then so must be the output architecture. */ else if (in == bfd_mach_arm_unknown) /* FIXME: We ought to have some way to @@ -184,7 +184,7 @@ bfd_arm_merge_machines (ibfd, obfd) ; /* Otherwise the general principle that a earlier architecture can be - linked with a later architecure to produce a binary that will execute + linked with a later architecture to produce a binary that will execute on the later architecture. We fail however if we attempt to link a Cirrus EP9312 binary with an diff --git a/bfd/cpu-m32r.c b/bfd/cpu-m32r.c index bebc2ed..ee013ea 100644 --- a/bfd/cpu-m32r.c +++ b/bfd/cpu-m32r.c @@ -1,21 +1,21 @@ /* BFD support for the M32R processor. - Copyright 1996, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright 1996, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -25,15 +25,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ { 32, 32, 8, bfd_arch_m32r, number, "m32r", print, 4, default, \ bfd_default_compatible, bfd_default_scan, next } -#define NEXT NULL +#define M32R2_NEXT & arch_info_struct [1] +#define NEXT & arch_info_struct [0] static const bfd_arch_info_type arch_info_struct[] = { - N (bfd_mach_m32rx, "m32rx", FALSE, NULL) + N (bfd_mach_m32rx, "m32rx", FALSE, M32R2_NEXT) , + N (bfd_mach_m32r2, "m32r2", FALSE, NULL) }; -#undef NEXT -#define NEXT &arch_info_struct[0] - const bfd_arch_info_type bfd_m32r_arch = N (bfd_mach_m32r, "m32r", TRUE, NEXT); diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c index 1d56dff..01ecc4e 100644 --- a/bfd/cpu-mips.c +++ b/bfd/cpu-mips.c @@ -24,15 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "libbfd.h" static const bfd_arch_info_type *mips_compatible - PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); + (const bfd_arch_info_type *, const bfd_arch_info_type *); /* The default routine tests bits_per_word, which is wrong on mips as mips word size doesn't correlate with reloc size. */ static const bfd_arch_info_type * -mips_compatible (a, b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; +mips_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b) { if (a->arch != b->arch) return NULL; diff --git a/bfd/cpu-ns32k.c b/bfd/cpu-ns32k.c index aab1559..39e5b23 100644 --- a/bfd/cpu-ns32k.c +++ b/bfd/cpu-ns32k.c @@ -194,7 +194,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ @@ -678,7 +678,7 @@ _bfd_do_ns32k_reloc_contents (howto, input_bfd, relocation, location, /* For the signed case we use ADD, rather than SIGNED_ADD, to avoid warnings from SVR4 cc. This is OK since we - explictly handle the sign bits. */ + explicitly handle the sign bits. */ if (signed_add >= 0) signed_check += add >> howto->bitpos; else diff --git a/bfd/cpu-powerpc.c b/bfd/cpu-powerpc.c index 20b4909..a4e72d5 100644 --- a/bfd/cpu-powerpc.c +++ b/bfd/cpu-powerpc.c @@ -41,7 +41,7 @@ powerpc_compatible (a,b) case bfd_arch_powerpc: return bfd_default_compatible (a, b); case bfd_arch_rs6000: - if (a->mach == bfd_mach_ppc) + if (b->mach == bfd_mach_rs6k) return a; return NULL; } diff --git a/bfd/cpu-z8k.c b/bfd/cpu-z8k.c index 3ccedf6..d1ea14c 100644 --- a/bfd/cpu-z8k.c +++ b/bfd/cpu-z8k.c @@ -23,142 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "libbfd.h" -static const bfd_arch_info_type *compatible - PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); - -#if 0 /* not used currently */ -/* -Relocations for the Z8K - -*/ -static bfd_reloc_status_type -howto16_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct bfd_symbol *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - long x = bfd_get_16 (abfd, (bfd_byte *) data + addr); - - HOWTO_PREPARE (relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_16 (abfd, x, (bfd_byte *) data + addr); - return bfd_reloc_ok; -} - -static bfd_reloc_status_type -howto8_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct bfd_symbol *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - long x = bfd_get_8 (abfd, (bfd_byte *) data + addr); - - HOWTO_PREPARE (relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_8 (abfd, x, (bfd_byte *) data + addr); - return bfd_reloc_ok; -} - -static bfd_reloc_status_type -howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct bfd_symbol *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - - long x = bfd_get_8 (abfd, (bfd_byte *) data + addr); - abort (); - HOWTO_PREPARE (relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_8 (abfd, x, (bfd_byte *) data + addr); - return bfd_reloc_ok; -} - -static bfd_reloc_status_type -howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct bfd_symbol *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - long x = bfd_get_8 (abfd, (bfd_byte *) data + addr); - abort (); - HOWTO_PREPARE (relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_8 (abfd, x, (bfd_byte *) data + addr); - return bfd_reloc_ok; -} - -static reloc_howto_type howto_16 -= NEWHOWTO (howto16_callback, "abs16", 1, FALSE, FALSE); -static reloc_howto_type howto_8 -= NEWHOWTO (howto8_callback, "abs8", 0, FALSE, FALSE); - -static reloc_howto_type howto_8_FFnn -= NEWHOWTO (howto8_FFnn_callback, "ff00+abs8", 0, FALSE, FALSE); - -static reloc_howto_type howto_8_pcrel -= NEWHOWTO (howto8_pcrel_callback, "pcrel8", 0, FALSE, TRUE); - -static reloc_howto_type * -local_bfd_reloc_type_lookup (arch, code) - const struct bfd_arch_info *arch; - bfd_reloc_code_real_type code; -{ - switch (code) - { - case BFD_RELOC_16: - return &howto_16; - case BFD_RELOC_8_FFnn: - return &howto_8_FFnn; - case BFD_RELOC_8: - return &howto_8; - case BFD_RELOC_8_PCREL: - return &howto_8_pcrel; - default: - return (reloc_howto_type *) NULL; - } -} -#endif - /* This routine is provided two arch_infos and returns whether they'd be compatible */ static const bfd_arch_info_type * -compatible (a, b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; +compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b) { if (a->arch != b->arch || a->mach != b->mach) return NULL; diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 49422b2..68b3660 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -1530,7 +1530,7 @@ scan_unit_for_functions (unit) /* Parse a DWARF2 compilation unit starting at INFO_PTR. This includes the compilation unit header that proceeds the DIE's, but - does not include the length field that preceeds each compilation + does not include the length field that precedes each compilation unit header. END_PTR points one past the end of this comp unit. OFFSET_SIZE is the size of DWARF2 offsets (either 4 or 8 bytes). diff --git a/bfd/ecoff.c b/bfd/ecoff.c index b45f168..cfc5ae1 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -3566,9 +3566,9 @@ ecoff_link_add_archive_symbols (abfd, info) entry if it is the tail, because that would lose any entries we add to the list later on. */ if (*pundef != info->hash->undefs_tail) - *pundef = (*pundef)->next; + *pundef = (*pundef)->und_next; else - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; continue; } @@ -3578,7 +3578,7 @@ ecoff_link_add_archive_symbols (abfd, info) other object format. */ if (h->type != bfd_link_hash_undefined) { - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; continue; } @@ -3590,7 +3590,7 @@ ecoff_link_add_archive_symbols (abfd, info) if (file_offset == 0) { /* Nothing in this slot. */ - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; continue; } @@ -3621,7 +3621,7 @@ ecoff_link_add_archive_symbols (abfd, info) if (! found) { - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; continue; } @@ -3643,7 +3643,7 @@ ecoff_link_add_archive_symbols (abfd, info) if (! ecoff_link_add_object_symbols (element, info)) return FALSE; - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; } return TRUE; @@ -4129,7 +4129,7 @@ _bfd_ecoff_bfd_final_link (abfd, info) if (bfd_get_flavour (input_bfd) == bfd_target_ecoff_flavour) { - /* Abitrarily set the symbolic header vstamp to the vstamp + /* Arbitrarily set the symbolic header vstamp to the vstamp of the first object file in the link. */ if (symhdr->vstamp == 0) symhdr->vstamp diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c index 89edae3..9e23848 100644 --- a/bfd/ecofflink.c +++ b/bfd/ecofflink.c @@ -2007,7 +2007,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info) /* eraxxon: 'fdrtab_lookup' doesn't give what we want, at least for Compaq's C++ compiler 6.2. Consider three FDRs with starting addresses of x, y, and z, respectively, such that x < y < z. Assume further that - y < 'offset' < z. It is possble at times that the PDR for 'offset' is + y < 'offset' < z. It is possible at times that the PDR for 'offset' is associated with FDR x and *not* with FDR y. Erg!! From a binary dump of my C++ test case 'moo' using Compaq's coffobjanl @@ -2030,7 +2030,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info) Since the FDRs that are causing so much havok (in this case) 1) do not describe actual files (fdr.rss == -1), and 2) contain only compiler - genarated routines, I thought a simple fix would be to exclude them from + generated routines, I thought a simple fix would be to exclude them from the FDR table in 'mk_fdrtab'. But, besides not knowing for certain whether this would be correct, it creates an additional problem. If we happen to ask for source file info on a compiler generated (procedure) diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index d5965d3..c457a39 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -200,6 +200,9 @@ struct elf_link_hash_entry #define ELF_LINK_DYNAMIC_DEF 020000 /* Symbol is weak in all shared objects. */ #define ELF_LINK_DYNAMIC_WEAK 040000 + /* Symbol is referenced with a relocation where C/C++ pointer equality + matters. */ +#define ELF_LINK_POINTER_EQUALITY_NEEDED 0100000 }; /* Will references to this symbol always reference the symbol @@ -397,8 +400,8 @@ struct elf_link_hash_table #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash)) /* Returns TRUE if the hash table is a struct elf_link_hash_table. */ -#define is_elf_hash_table(p) \ - ((p)->hash->type == bfd_link_elf_hash_table) +#define is_elf_hash_table(htab) \ + (((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table) /* Used by bfd_section_from_r_symndx to cache a small number of local symbol to section mappings. */ @@ -623,8 +626,8 @@ struct elf_backend_data /* If this field is not NULL, it is called by the elf_link_output_sym phase of a link for each symbol which will appear in the object file. */ bfd_boolean (*elf_backend_link_output_symbol_hook) - (bfd *, struct bfd_link_info *info, const char *, Elf_Internal_Sym *, - asection *); + (struct bfd_link_info *info, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *); /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend linker the first time it encounters a dynamic object in the link. @@ -757,7 +760,7 @@ struct elf_backend_data /* This function is called to modify an existing segment map in a backend specific fashion. */ bfd_boolean (*elf_backend_modify_segment_map) - (bfd *); + (bfd *, struct bfd_link_info *); /* This function is called during section gc to discover the section a particular relocation refers to. */ @@ -785,12 +788,13 @@ struct elf_backend_data (bfd *, void *, asymbol *); /* This function, if defined, is called after all local symbols and - global symbols converted to locals are emited into the symtab + global symbols converted to locals are emitted into the symtab section. It allows the backend to emit special global symbols not handled in the hash table. */ bfd_boolean (*elf_backend_output_arch_syms) (bfd *, struct bfd_link_info *, void *, - bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *)); + bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *)); /* Copy any information related to dynamic linking from a pre-existing symbol to a newly created symbol. Also called to copy flags and diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index 0f15b0d..29579a4 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -1123,7 +1123,7 @@ elf_hppa_remark_useless_dynamic_symbols (struct elf_link_hash_entry *h, the generic code will warn that it is undefined. This behavior is undesirable on HPs since the standard shared - libraries contain reerences to undefined symbols. + libraries contain references to undefined symbols. So we twiddle the flags associated with such symbols so that they will not trigger the warning. ?!? FIXME. This is horribly fragile. @@ -1261,7 +1261,7 @@ elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info) hppa_info->data_segment_base = (bfd_vma)-1; /* HP's shared libraries have references to symbols that are not - defined anywhere. The generic ELF BFD linker code will complaim + defined anywhere. The generic ELF BFD linker code will complain about such symbols. So we detect the losing case and arrange for the flags on the symbol diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c index 7373dc0..133d2a9 100644 --- a/bfd/elf-m10200.c +++ b/bfd/elf-m10200.c @@ -469,7 +469,7 @@ mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section, /* This function handles relaxing for the mn10200. - There's quite a few relaxing opportunites available on the mn10200: + There are quite a few relaxing opportunities available on the mn10200: * jsr:24 -> jsr:16 2 bytes @@ -918,7 +918,7 @@ mn10200_elf_relax_section (abfd, sec, link_info, again) if (value & 0x8000) continue; - /* Note that we've changed the reldection contents, etc. */ + /* Note that we've changed the relocation contents, etc. */ elf_section_data (sec)->relocs = internal_relocs; elf_section_data (sec)->this_hdr.contents = contents; symtab_hdr->contents = (unsigned char *) isymbuf; @@ -957,7 +957,7 @@ mn10200_elf_relax_section (abfd, sec, link_info, again) case 0x40: case 0x44: case 0xc8: - /* Note that we've changed the reldection contents, etc. */ + /* Note that we've changed the relocation contents, etc. */ elf_section_data (sec)->relocs = internal_relocs; elf_section_data (sec)->this_hdr.contents = contents; symtab_hdr->contents = (unsigned char *) isymbuf; @@ -1040,7 +1040,7 @@ mn10200_elf_relax_section (abfd, sec, link_info, again) && (value & 0x8000) != 0) continue; - /* Note that we've changed the reldection contents, etc. */ + /* Note that we've changed the relocation contents, etc. */ elf_section_data (sec)->relocs = internal_relocs; elf_section_data (sec)->this_hdr.contents = contents; symtab_hdr->contents = (unsigned char *) isymbuf; diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 685ac9b..f628e76 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -85,7 +85,7 @@ struct elf32_mn10300_link_hash_entry { to the target when it's valid and profitable to do so. */ unsigned char movm_args; - /* For funtion symbols, the amount of stack space that would be allocated + /* For function symbols, the amount of stack space that would be allocated by the movm instruction. This is redundant with movm_args, but we add it to the hash table to avoid computing it over and over. */ unsigned char movm_stack_size; @@ -1743,13 +1743,16 @@ elf32_mn10300_finish_hash_table_entry (gen_entry, in_args) byte_count += 2; /* Count the insn to allocate stack space too. */ - if (entry->stack_size > 0 && entry->stack_size <= 128) - byte_count += 3; - else if (entry->stack_size > 0 && entry->stack_size < 256) - byte_count += 4; + if (entry->stack_size > 0) + { + if (entry->stack_size <= 128) + byte_count += 3; + else + byte_count += 4; + } /* If using "call" will result in larger code, then turn all - the associated "call" instructions into "calls" instrutions. */ + the associated "call" instructions into "calls" instructions. */ if (byte_count < entry->direct_calls) entry->flags |= MN10300_CONVERT_CALL_TO_CALLS; @@ -1759,7 +1762,7 @@ elf32_mn10300_finish_hash_table_entry (gen_entry, in_args) /* This function handles relaxing for the mn10300. - There's quite a few relaxing opportunites available on the mn10300: + There are quite a few relaxing opportunities available on the mn10300: * calls:32 -> calls:16 2 bytes * call:32 -> call:16 2 bytes @@ -2238,11 +2241,13 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) if (sym_hash->movm_args) bytes += 2; - if (sym_hash->stack_size && sym_hash->stack_size <= 128) - bytes += 3; - else if (sym_hash->stack_size - && sym_hash->stack_size < 256) - bytes += 4; + if (sym_hash->stack_size > 0) + { + if (sym_hash->stack_size <= 128) + bytes += 3; + else + bytes += 4; + } /* Note that we've deleted prologue bytes for this function. */ @@ -2290,11 +2295,13 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) if (sym_hash->movm_args) bytes += 2; - if (sym_hash->stack_size && sym_hash->stack_size <= 128) - bytes += 3; - else if (sym_hash->stack_size - && sym_hash->stack_size < 256) - bytes += 4; + if (sym_hash->stack_size > 0) + { + if (sym_hash->stack_size <= 128) + bytes += 3; + else + bytes += 4; + } /* Note that we've deleted prologue bytes for this function. */ @@ -3487,7 +3494,7 @@ compute_function_info (abfd, hash, addr, contents) } /* Now figure out how much stack space will be allocated by the movm - instruction. We need this kept separate from the funtion's normal + instruction. We need this kept separate from the function's normal stack space. */ if (hash->movm_args) { @@ -4008,7 +4015,7 @@ static const bfd_byte elf_mn10300_pic_plt_entry[PIC_PLT_ENTRY_SIZE] = /* Return offset of the GOT id in PLT0 entry. */ #define elf_mn10300_plt0_gotid_offset(info) 9 -/* Return offset of the tempoline in PLT entry */ +/* Return offset of the temporary in PLT entry */ #define elf_mn10300_plt_temp_offset(info) 8 /* Return offset of the symbol in PLT entry. */ @@ -41,7 +41,7 @@ #include "libiberty.h" static int elf_sort_sections (const void *, const void *); -static bfd_boolean assign_file_positions_except_relocs (bfd *); +static bfd_boolean assign_file_positions_except_relocs (bfd *, struct bfd_link_info *); static bfd_boolean prep_headers (bfd *); static bfd_boolean swap_out_syms (bfd *, struct bfd_strtab_hash **, int) ; static bfd_boolean elfcore_read_notes (bfd *, file_ptr, bfd_size_type) ; @@ -894,7 +894,7 @@ merge_sections_remove_hook (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean _bfd_elf_merge_sections (bfd *abfd, struct bfd_link_info *info) { - if (!is_elf_hash_table (info)) + if (!is_elf_hash_table (info->hash)) return FALSE; if (elf_hash_table (info)->merge_info) _bfd_merge_sections (abfd, elf_hash_table (info)->merge_info, @@ -907,7 +907,7 @@ _bfd_elf_link_just_syms (asection *sec, struct bfd_link_info *info) { sec->output_section = bfd_abs_section_ptr; sec->output_offset = sec->vma; - if (!is_elf_hash_table (info)) + if (!is_elf_hash_table (info->hash)) return; sec->sec_info_type = ELF_INFO_TYPE_JUST_SYMS; @@ -1354,12 +1354,13 @@ _bfd_elf_link_hash_copy_indirect (const struct elf_backend_data *bed, /* Copy down any references that we may have already seen to the symbol which just became indirect. */ - dir->elf_link_hash_flags |= - (ind->elf_link_hash_flags - & (ELF_LINK_HASH_REF_DYNAMIC - | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_NON_GOT_REF)); + dir->elf_link_hash_flags + |= ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC + | ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_NON_GOT_REF + | ELF_LINK_HASH_NEEDS_PLT + | ELF_LINK_POINTER_EQUALITY_NEEDED); if (ind->root.type != bfd_link_hash_indirect) return; @@ -1503,7 +1504,7 @@ struct bfd_link_needed_list * bfd_elf_get_needed_list (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) { - if (! is_elf_hash_table (info)) + if (! is_elf_hash_table (info->hash)) return NULL; return elf_hash_table (info)->needed; } @@ -1515,7 +1516,7 @@ struct bfd_link_needed_list * bfd_elf_get_runpath_list (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) { - if (! is_elf_hash_table (info)) + if (! is_elf_hash_table (info->hash)) return NULL; return elf_hash_table (info)->runpath; } @@ -3102,7 +3103,7 @@ _bfd_elf_compute_section_file_positions (bfd *abfd, /* sh_offset is set in assign_file_positions_except_relocs. */ shstrtab_hdr->sh_addralign = 1; - if (!assign_file_positions_except_relocs (abfd)) + if (!assign_file_positions_except_relocs (abfd, link_info)) return FALSE; if (link_info == NULL && bfd_get_symcount (abfd) > 0) @@ -3575,7 +3576,7 @@ elf_sort_sections (const void *arg1, const void *arg2) the file header, and writes out the program headers. */ static bfd_boolean -assign_file_positions_for_segments (bfd *abfd) +assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) { const struct elf_backend_data *bed = get_elf_backend_data (abfd); unsigned int count; @@ -3627,7 +3628,7 @@ assign_file_positions_for_segments (bfd *abfd) if (bed->elf_backend_modify_segment_map) { - if (! (*bed->elf_backend_modify_segment_map) (abfd)) + if (! (*bed->elf_backend_modify_segment_map) (abfd, link_info)) return FALSE; } @@ -4135,7 +4136,8 @@ get_program_header_size (bfd *abfd) We also don't set the positions of the .symtab and .strtab here. */ static bfd_boolean -assign_file_positions_except_relocs (bfd *abfd) +assign_file_positions_except_relocs (bfd *abfd, + struct bfd_link_info *link_info) { struct elf_obj_tdata * const tdata = elf_tdata (abfd); Elf_Internal_Ehdr * const i_ehdrp = elf_elfheader (abfd); @@ -4186,7 +4188,7 @@ assign_file_positions_except_relocs (bfd *abfd) /* Assign file positions for the loaded sections based on the assignment of sections to segments. */ - if (! assign_file_positions_for_segments (abfd)) + if (! assign_file_positions_for_segments (abfd, link_info)) return FALSE; /* Assign file positions for the other sections. */ @@ -4623,8 +4625,9 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) 2. It is an allocated segment, 3. There is an output section associated with it, 4. The section has not already been allocated to a previous segment. - 5. PT_TLS segment includes only SHF_TLS sections. - 6. SHF_TLS sections are only in PT_TLS or PT_LOAD segments. */ + 5. PT_GNU_STACK segments do not include any sections. + 6. PT_TLS segment includes only SHF_TLS sections. + 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments. */ #define INCLUDE_SECTION_IN_SEGMENT(section, segment, bed) \ ((((segment->p_paddr \ ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \ @@ -4632,6 +4635,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) && (section->flags & SEC_ALLOC) != 0) \ || IS_COREFILE_NOTE (segment, section)) \ && section->output_section != NULL \ + && segment->p_type != PT_GNU_STACK \ && (segment->p_type != PT_TLS \ || (section->flags & SEC_THREAD_LOCAL)) \ && (segment->p_type == PT_LOAD \ @@ -4675,7 +4679,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) if (IS_SOLARIS_PT_INTERP (segment, section)) { /* Mininal change so that the normal section to segment - assigment code will work. */ + assignment code will work. */ segment->p_vaddr = section->vma; break; } @@ -6834,7 +6838,8 @@ elfcore_grok_netbsd_procinfo (bfd *abfd, Elf_Internal_Note *note) elf_tdata (abfd)->core_command = _bfd_elfcore_strndup (abfd, note->descdata + 0x7c, 31); - return TRUE; + return elfcore_make_note_pseudosection (abfd, ".note.netbsdcore.procinfo", + note); } static bfd_boolean diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index bcc1188..d42eb27 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -235,13 +235,13 @@ struct elf32_arm_link_hash_table /* The main hash table. */ struct elf_link_hash_table root; - /* The size in bytes of the section containg the Thumb-to-ARM glue. */ + /* The size in bytes of the section containing the Thumb-to-ARM glue. */ bfd_size_type thumb_glue_size; - /* The size in bytes of the section containg the ARM-to-Thumb glue. */ + /* The size in bytes of the section containing the ARM-to-Thumb glue. */ bfd_size_type arm_glue_size; - /* An arbitary input BFD chosen to hold the glue sections. */ + /* An arbitrary input BFD chosen to hold the glue sections. */ bfd * bfd_of_glue_owner; /* A boolean indicating whether knowledge of the ARM's pipeline @@ -965,7 +965,7 @@ error_return: instruction. It takes two thumb instructions to encode the target address. Each has - 11 bits to invest. The upper 11 bits are stored in one (identifed by + 11 bits to invest. The upper 11 bits are stored in one (identified by H-0.. see below), the lower 11 bits are stored in the other (identified by H-1). @@ -2610,7 +2610,7 @@ elf32_arm_print_private_bfd_data (abfd, ptr) switch (EF_ARM_EABI_VERSION (flags)) { case EF_ARM_EABI_UNKNOWN: - /* The following flag bits are GNU extenstions and not part of the + /* The following flag bits are GNU extensions and not part of the official ARM ELF extended ABI. Hence they are only decoded if the EABI version is not set. */ if (flags & EF_ARM_INTERWORK) @@ -3985,7 +3985,7 @@ elf32_arm_finish_dynamic_sections (output_bfd, info) name = info->fini_function; get_sym: /* If it wasn't set by elf_bfd_final_link - then there is nothing to ajdust. */ + then there is nothing to adjust. */ if (dyn.d_un.d_val != 0) { struct elf_link_hash_entry * eh; diff --git a/bfd/elf32-d30v.c b/bfd/elf32-d30v.c index 4b184d6..b08977f 100644 --- a/bfd/elf32-d30v.c +++ b/bfd/elf32-d30v.c @@ -293,7 +293,7 @@ bfd_elf_d30v_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ @@ -402,7 +402,7 @@ bfd_elf_d30v_reloc_21 (abfd, reloc_entry, symbol, data, input_section, output_bf if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c index 1f380e8..6ccb9f5 100644 --- a/bfd/elf32-dlx.c +++ b/bfd/elf32-dlx.c @@ -228,7 +228,7 @@ HOWTO (R_DLX_RELOC_16_LO, /* type */ FALSE); /* pcrel_offset */ -/* The gas default beheaver is not to preform the %hi modifier so that the +/* The gas default behavior is not to preform the %hi modifier so that the GNU assembler can have the lower 16 bits offset placed in the insn, BUT we do like the gas to indicate it is %hi reloc type so when we in the link loader phase we can have the corrected hi16 vale replace the buggous lo16 @@ -493,7 +493,7 @@ elf32_dlx_relocate26 (abfd, reloc_entry, symbol, data, More about this table - for dlx elf relocation we do not really need this table, if we have a rtype defined in this table will caused tc_gen_relocate confused and die on us, but if we remove - this table it will caused more problem, so for now simple soulation + this table it will caused more problem, so for now simple solution is to remove those entries which may cause problem. */ struct elf_reloc_map { diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index 452db27..18d87d4 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -649,7 +649,7 @@ elf32_h8_merge_private_bfd_data (bfd *ibfd, bfd *obfd) /* This function handles relaxing for the H8.. - There's a few relaxing opportunites available on the H8: + There are a few relaxing opportunities available on the H8: jmp/jsr:24 -> bra/bsr:8 2 bytes The jmp may be completely eliminated if the previous insn is a @@ -1116,7 +1116,7 @@ elf32_h8_relax_section (bfd *abfd, asection *sec, /* FALLTHRU */ /* This is a 24/32bit absolute address in a "mov" insn, which may - become a 16bit absoulte address if it is in the right range. */ + become a 16-bit absolute address if it is in the right range. */ case R_H8_DIR32A16: { bfd_vma value; diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index c2e2f70..cf6c630 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1018,7 +1018,8 @@ elf32_hppa_copy_indirect_symbol (const struct elf_backend_data *bed, dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -2304,9 +2305,6 @@ elf32_hppa_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) bfd_size_type amt; struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info); - if (htab->elf.root.creator->flavour != bfd_target_elf_flavour) - return 0; - /* Count the number of input BFDs and find the top input section id. */ for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0; input_bfd != NULL; @@ -2910,21 +2908,8 @@ elf32_hppa_set_gp (bfd *abfd, struct bfd_link_info *info) } else { - asection *splt; - asection *sgot; - - if (htab->elf.root.creator->flavour == bfd_target_elf_flavour) - { - splt = htab->splt; - sgot = htab->sgot; - } - else - { - /* If we're not elf, look up the output sections in the - hope we may actually find them. */ - splt = bfd_get_section_by_name (abfd, ".plt"); - sgot = bfd_get_section_by_name (abfd, ".got"); - } + asection *splt = bfd_get_section_by_name (abfd, ".plt"); + asection *sgot = bfd_get_section_by_name (abfd, ".got"); /* Choose to point our LTP at, in this order, one of .plt, .got, or .data, if these sections exist. In the case of choosing diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index 83783ae..80c45f6 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -834,7 +834,7 @@ i370_elf_size_dynamic_sections (output_bfd, info) FIXME: We assume that there will never be relocations to locations in linker-created sections that do not have externally-visible names. Instead, we should work out precisely - which sections relocations are targetted at. */ + which sections relocations are targeted at. */ if (info->shared) { int c; @@ -1555,6 +1555,6 @@ static int i370_noop () #define elf_backend_additional_program_headers \ (int (*) PARAMS ((bfd *))) i370_noop #define elf_backend_modify_segment_map \ - (bfd_boolean (*) PARAMS ((bfd *))) i370_noop + (bfd_boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) i370_noop #include "elf32-target.h" diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index ff8aab4..876efc6 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -546,20 +546,6 @@ elf_i386_mkobject (bfd *abfd) return TRUE; } -static bfd_boolean -elf_i386_object_p (bfd *abfd) -{ - /* Allocate our special target data. */ - struct elf_i386_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct elf_i386_obj_tdata); - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; - return TRUE; -} - /* i386 ELF linker hash table. */ struct elf_i386_link_hash_table @@ -770,7 +756,9 @@ elf_i386_copy_indirect_symbol (const struct elf_backend_data *bed, dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT + | ELF_LINK_POINTER_EQUALITY_NEEDED)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -1000,6 +988,8 @@ elf_i386_check_relocs (bfd *abfd, /* We may need a .plt entry if the function this reloc refers to is in a shared lib. */ h->plt.refcount += 1; + if (r_type != R_386_PC32) + h->elf_link_hash_flags |= ELF_LINK_POINTER_EQUALITY_NEEDED; } /* If we are creating a shared library, and this is a reloc @@ -3003,11 +2993,16 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) { /* Mark the symbol as undefined, rather than as defined in - the .plt section. Leave the value alone. This is a clue + the .plt section. Leave the value if there were any + relocations where pointer equality matters (this is a clue for the dynamic linker, to make function pointer comparisons work between an application and shared - library. */ + library), otherwise set it to zero. If a function is only + called from a binary, there is no need to slow down + shared libraries because of that. */ sym->st_shndx = SHN_UNDEF; + if ((h->elf_link_hash_flags & ELF_LINK_POINTER_EQUALITY_NEEDED) == 0) + sym->st_value = 0; } } @@ -3244,7 +3239,6 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, #define elf_info_to_howto_rel elf_i386_info_to_howto_rel #define bfd_elf32_mkobject elf_i386_mkobject -#define elf_backend_object_p elf_i386_object_p #define bfd_elf32_bfd_is_local_label_name elf_i386_is_local_label_name #define bfd_elf32_bfd_link_hash_table_create elf_i386_link_hash_table_create diff --git a/bfd/elf32-i960.c b/bfd/elf32-i960.c index 6218e1a..99e5585 100644 --- a/bfd/elf32-i960.c +++ b/bfd/elf32-i960.c @@ -1,4 +1,4 @@ -/* Intel 860 specific support for 32-bit ELF +/* Intel 960 specific support for 32-bit ELF Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -107,13 +107,8 @@ elf32_i960_info_to_howto_rel (abfd, cache_ptr, dst) relocatable output against an external symbol. */ bfd_reloc_status_type -elf32_i960_relocate (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) +elf32_i960_relocate (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) bfd *abfd ATTRIBUTE_UNUSED; arelent *reloc_entry; asymbol *symbol; diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c index e8cb177..7606e0d 100644 --- a/bfd/elf32-ip2k.c +++ b/bfd/elf32-ip2k.c @@ -1007,7 +1007,7 @@ ip2k_elf_relax_section_page (abfd, sec, again, misc, page_start, page_end) int switch_table_128; int switch_table_256; - /* Walk thru the section looking for relaxation opertunities. */ + /* Walk thru the section looking for relaxation opportunities. */ for (irel = misc->irelbase; irel < irelend; irel++) { if (ELF32_R_TYPE (irel->r_info) != (int) R_IP2K_PAGE3) @@ -1388,7 +1388,7 @@ ip2k_final_link_relocate (howto, input_bfd, input_section, contents, rel, case R_IP2K_ADDR16CJP: if (BASEADDR (input_section) + rel->r_offset != page_addr + 2) { - /* No preceeding page instruction, verify that it isn't needed. */ + /* No preceding page instruction, verify that it isn't needed. */ if (PAGENO (relocation + rel->r_addend) != ip2k_nominal_page_bits (input_bfd, input_section, rel->r_offset, contents)) @@ -1398,7 +1398,7 @@ ip2k_final_link_relocate (howto, input_bfd, input_section, contents, rel, } else if (ip2k_relaxed) { - /* Preceeding page instruction. Verify that the page instruction is + /* Preceding page instruction. Verify that the page instruction is really needed. One reason for the relaxation to miss a page is if the section is not marked as executable. */ if (!ip2k_is_switch_table_128 (input_bfd, input_section, rel->r_offset - 2, contents) && diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 7500f56..2794ffb 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -2,21 +2,21 @@ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -843,7 +843,7 @@ m32r_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) if (! info->relocatable && (*namep)[0] == '_' && (*namep)[1] == 'S' && strcmp (*namep, "_SDA_BASE_") == 0 - && info->hash->creator->flavour == bfd_target_elf_flavour) + && is_elf_hash_table (info->hash)) { /* This is simpler than using _bfd_elf_create_linker_section (our needs are simpler than ppc's needs). Also @@ -1863,6 +1863,7 @@ m32r_elf_object_p (abfd) default: case E_M32R_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_m32r, bfd_mach_m32r); break; case E_M32RX_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_m32r, bfd_mach_m32rx); break; + case E_M32R2_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_m32r, bfd_mach_m32r2); break; } return TRUE; } @@ -1880,6 +1881,7 @@ m32r_elf_final_write_processing (abfd, linker) default: case bfd_mach_m32r: val = E_M32R_ARCH; break; case bfd_mach_m32rx: val = E_M32RX_ARCH; break; + case bfd_mach_m32r2: val = E_M32R2_ARCH; break; } elf_elfheader (abfd)->e_flags &=~ EF_M32R_ARCH; @@ -1946,7 +1948,9 @@ m32r_elf_merge_private_bfd_data (ibfd, obfd) if ((in_flags & EF_M32R_ARCH) != (out_flags & EF_M32R_ARCH)) { - if ((in_flags & EF_M32R_ARCH) != E_M32R_ARCH) + if ( ((in_flags & EF_M32R_ARCH) != E_M32R_ARCH) + || ((out_flags & EF_M32R_ARCH) == E_M32R_ARCH) + || ((in_flags & EF_M32R_ARCH) == E_M32R2_ARCH)) { (*_bfd_error_handler) (_("%s: Instruction set mismatch with previous modules"), @@ -1979,6 +1983,7 @@ m32r_elf_print_private_bfd_data (abfd, ptr) default: case E_M32R_ARCH: fprintf (file, _(": m32r instructions")); break; case E_M32RX_ARCH: fprintf (file, _(": m32rx instructions")); break; + case E_M32R2_ARCH: fprintf (file, _(": m32r2 instructions")); break; } fputc ('\n', file); diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 4d8f6b5..42010b0 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -954,7 +954,7 @@ m68hc11_elf_relax_section (bfd *abfd, asection *sec, { unsigned long old_sec_size = sec->_cooked_size; - /* Note that we've changed the reldection contents, etc. */ + /* Note that we've changed the relocation contents, etc. */ elf_section_data (sec)->relocs = internal_relocs; free_relocs = NULL; @@ -985,7 +985,7 @@ m68hc11_elf_relax_section (bfd *abfd, asection *sec, continue; } - /* Note that we've changed the reldection contents, etc. */ + /* Note that we've changed the relocation contents, etc. */ elf_section_data (sec)->relocs = internal_relocs; free_relocs = NULL; @@ -1030,7 +1030,7 @@ m68hc11_elf_relax_section (bfd *abfd, asection *sec, if ((offset & 0xff80) == 0 || (offset & 0xff80) == 0xff80) { - /* Note that we've changed the reldection contents, etc. */ + /* Note that we've changed the relocation contents, etc. */ elf_section_data (sec)->relocs = internal_relocs; free_relocs = NULL; diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 6992a3d..0fc9768 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -84,7 +84,7 @@ static reloc_howto_type mcore_elf_howto_raw[] = 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ - "ADDR32", /* name *//* For compatability with coff/pe port. */ + "ADDR32", /* name *//* For compatibility with coff/pe port. */ FALSE, /* partial_inplace */ 0x0, /* src_mask */ 0xffffffff, /* dst_mask */ diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index b17008e..299c395 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -48,48 +48,47 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ecoffswap.h" static bfd_reloc_status_type mips_elf_generic_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_hi16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_lo16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_got16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type gprel32_with_gp - PARAMS ((bfd *, asymbol *, arelent *, asection *, bfd_boolean, PTR, - bfd_vma)); + (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma); static bfd_reloc_status_type mips_elf_gprel32_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips32_64bit_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); + (bfd *, bfd_reloc_code_real_type); static reloc_howto_type *mips_elf32_rtype_to_howto - PARAMS ((unsigned int, bfd_boolean)); + (unsigned int, bfd_boolean); static void mips_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); static void mips_info_to_howto_rela - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); static bfd_boolean mips_elf_sym_is_global - PARAMS ((bfd *, asymbol *)); + (bfd *, asymbol *); static bfd_boolean mips_elf32_object_p - PARAMS ((bfd *)); + (bfd *); static bfd_boolean mips_elf_is_local_label_name - PARAMS ((bfd *, const char *)); + (bfd *, const char *); static bfd_reloc_status_type mips16_jump_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_gprel_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_final_gp - PARAMS ((bfd *, asymbol *, bfd_boolean, char **, bfd_vma *)); + (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *); static bfd_boolean mips_elf_assign_gp - PARAMS ((bfd *, bfd_vma *)); + (bfd *, bfd_vma *); static bfd_boolean elf32_mips_grok_prstatus - PARAMS ((bfd *, Elf_Internal_Note *)); + (bfd *, Elf_Internal_Note *); static bfd_boolean elf32_mips_grok_psinfo - PARAMS ((bfd *, Elf_Internal_Note *)); + (bfd *, Elf_Internal_Note *); static irix_compat_t elf32_mips_irix_compat - PARAMS ((bfd *)); + (bfd *); extern const bfd_target bfd_elf32_bigmips_vec; extern const bfd_target bfd_elf32_littlemips_vec; @@ -724,19 +723,14 @@ static reloc_howto_type elf_mips_gnu_vtentry_howto = /* We use this instead of bfd_elf_generic_reloc because the latter gets the handling of zero addends wrong. */ static bfd_reloc_status_type -mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -775,15 +769,9 @@ struct mips_hi16 static struct mips_hi16 *mips_hi16_list; static bfd_reloc_status_type -mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data, asection *input_section, + bfd *output_bfd, char **error_message) { bfd_reloc_status_type ret; bfd_vma relocation; @@ -791,7 +779,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -826,8 +814,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, } else { - if (bfd_is_und_section (symbol->section) - && output_bfd == (bfd *) NULL) + if (bfd_is_und_section (symbol->section) && output_bfd == NULL) ret = bfd_reloc_undefined; if (bfd_is_com_section (symbol->section)) @@ -844,7 +831,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_outofrange; /* Save the information, and let LO16 do the actual relocation. */ - n = (struct mips_hi16 *) bfd_malloc ((bfd_size_type) sizeof *n); + n = bfd_malloc (sizeof *n); if (n == NULL) return bfd_reloc_outofrange; n->addr = (bfd_byte *) data + reloc_entry->address; @@ -852,7 +839,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, n->next = mips_hi16_list; mips_hi16_list = n; - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) reloc_entry->address += input_section->output_offset; return ret; @@ -863,15 +850,9 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, R_MIPS_HI16 relocation described above. */ static bfd_reloc_status_type -mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { arelent gp_disp_relent; @@ -921,7 +902,7 @@ mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section, insn &= ~ (bfd_vma) 0xffff; insn |= val; - bfd_put_32 (abfd, (bfd_vma) insn, l->addr); + bfd_put_32 (abfd, insn, l->addr); } next = l->next; @@ -975,19 +956,13 @@ mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section, not yet know how to create global offset tables. */ static bfd_reloc_status_type -mips_elf_got16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1003,9 +978,7 @@ mips_elf_got16_reloc (abfd, reloc_entry, symbol, data, input_section, dangerous relocation. */ static bfd_boolean -mips_elf_assign_gp (output_bfd, pgp) - bfd *output_bfd; - bfd_vma *pgp; +mips_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp) { unsigned int count; asymbol **sym; @@ -1021,7 +994,7 @@ mips_elf_assign_gp (output_bfd, pgp) /* The linker script will have created a symbol named `_gp' with the appropriate value. */ - if (sym == (asymbol **) NULL) + if (sym == NULL) i = count; else { @@ -1057,12 +1030,8 @@ mips_elf_assign_gp (output_bfd, pgp) external symbol if we are producing relocatable output. */ static bfd_reloc_status_type -mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, pgp) - bfd *output_bfd; - asymbol *symbol; - bfd_boolean relocatable; - char **error_message; - bfd_vma *pgp; +mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable, + char **error_message, bfd_vma *pgp) { if (bfd_is_und_section (symbol->section) && ! relocatable) @@ -1100,15 +1069,10 @@ mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, pgp) merged. */ bfd_reloc_status_type -_bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +_bfd_mips_elf32_gprel16_reloc (bfd *abfd, arelent *reloc_entry, + asymbol *symbol, void *data, + asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1116,7 +1080,7 @@ _bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1124,7 +1088,7 @@ _bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_ok; } - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1146,15 +1110,9 @@ _bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, become the offset from the gp register. */ static bfd_reloc_status_type -mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1162,7 +1120,7 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1171,7 +1129,7 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_outofrange; } - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1189,15 +1147,9 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, } static bfd_reloc_status_type -gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocatable, data, - gp) - bfd *abfd; - asymbol *symbol; - arelent *reloc_entry; - asection *input_section; - bfd_boolean relocatable; - PTR data; - bfd_vma gp; +gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry, + asection *input_section, bfd_boolean relocatable, + void *data, bfd_vma gp) { bfd_vma relocation; bfd_vma val; @@ -1242,15 +1194,9 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocatable, data, sign extension. */ static bfd_reloc_status_type -mips32_64bit_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips32_64bit_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_reloc_status_type r; arelent reloc32; @@ -1279,7 +1225,7 @@ mips32_64bit_reloc (abfd, reloc_entry, symbol, data, input_section, addr = reloc_entry->address; if (bfd_little_endian (abfd)) addr += 4; - bfd_put_32 (abfd, (bfd_vma) val, (bfd_byte *) data + addr); + bfd_put_32 (abfd, val, (bfd_byte *) data + addr); return r; } @@ -1287,17 +1233,12 @@ mips32_64bit_reloc (abfd, reloc_entry, symbol, data, input_section, /* Handle a mips16 jump. */ static bfd_reloc_status_type -mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && reloc_entry->addend == 0) { @@ -1322,15 +1263,9 @@ mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, /* Handle a mips16 GP relative reloc. */ static bfd_reloc_status_type -mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1397,13 +1332,10 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, if (reloc_entry->howto->partial_inplace) { bfd_put_16 (abfd, - (bfd_vma) ((extend & 0xf800) - | ((val >> 11) & 0x1f) - | (val & 0x7e0)), + (extend & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0), (bfd_byte *) data + reloc_entry->address); bfd_put_16 (abfd, - (bfd_vma) ((insn & 0xffe0) - | (val & 0x1f)), + (insn & 0xffe0) | (val & 0x1f), (bfd_byte *) data + reloc_entry->address + 2); } else @@ -1453,9 +1385,7 @@ static const struct elf_reloc_map mips_reloc_map[] = /* Given a BFD reloc type, return a howto structure. */ static reloc_howto_type * -bfd_elf32_bfd_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; +bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) { unsigned int i; reloc_howto_type *howto_table = elf_mips_howto_table_rel; @@ -1507,9 +1437,8 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static reloc_howto_type * -mips_elf32_rtype_to_howto (r_type, rela_p) - unsigned int r_type; - bfd_boolean rela_p ATTRIBUTE_UNUSED; +mips_elf32_rtype_to_howto (unsigned int r_type, + bfd_boolean rela_p ATTRIBUTE_UNUSED) { switch (r_type) { @@ -1540,10 +1469,7 @@ mips_elf32_rtype_to_howto (r_type, rela_p) /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static void -mips_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) { unsigned int r_type; @@ -1563,10 +1489,7 @@ mips_info_to_howto_rel (abfd, cache_ptr, dst) /* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */ static void -mips_info_to_howto_rela (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +mips_info_to_howto_rela (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) { mips_info_to_howto_rel (abfd, cache_ptr, dst); @@ -1581,9 +1504,7 @@ mips_info_to_howto_rela (abfd, cache_ptr, dst) and externally visible symbols. */ static bfd_boolean -mips_elf_sym_is_global (abfd, sym) - bfd *abfd ATTRIBUTE_UNUSED; - asymbol *sym; +mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym) { if (SGI_COMPAT (abfd)) return (sym->flags & BSF_SECTION_SYM) == 0; @@ -1596,8 +1517,7 @@ mips_elf_sym_is_global (abfd, sym) /* Set the right machine number for a MIPS ELF file. */ static bfd_boolean -mips_elf32_object_p (abfd) - bfd *abfd; +mips_elf32_object_p (bfd *abfd) { unsigned long mach; @@ -1619,9 +1539,7 @@ mips_elf32_object_p (abfd) /* MIPS ELF local labels start with '$', not 'L'. */ static bfd_boolean -mips_elf_is_local_label_name (abfd, name) - bfd *abfd; - const char *name; +mips_elf_is_local_label_name (bfd *abfd, const char *name) { if (name[0] == '$') return TRUE; @@ -1633,9 +1551,7 @@ mips_elf_is_local_label_name (abfd, name) /* Support for core dump NOTE sections. */ static bfd_boolean -elf32_mips_grok_prstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; unsigned int raw_size; @@ -1665,9 +1581,7 @@ elf32_mips_grok_prstatus (abfd, note) } static bfd_boolean -elf32_mips_grok_psinfo (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) { switch (note->descsz) { @@ -1699,8 +1613,7 @@ elf32_mips_grok_psinfo (abfd, note) /* Depending on the target vector we generate some version of Irix executables or "normal" MIPS ELF ABI executables. */ static irix_compat_t -elf32_mips_irix_compat (abfd) - bfd *abfd; +elf32_mips_irix_compat (bfd *abfd) { if ((abfd->xvec == &bfd_elf32_bigmips_vec) || (abfd->xvec == &bfd_elf32_littlemips_vec)) @@ -1717,12 +1630,9 @@ elf32_mips_irix_compat (abfd) objects, and before the final_link entry point is called. */ bfd_boolean -bfd_mips_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) - bfd *abfd; - struct bfd_link_info *info; - asection *datasec; - asection *relsec; - char **errmsg; +bfd_mips_elf32_create_embedded_relocs (bfd *abfd, struct bfd_link_info *info, + asection *datasec, asection *relsec, + char **errmsg) { Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Sym *isymbuf = NULL; @@ -1752,13 +1662,12 @@ bfd_mips_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) } /* Get a copy of the native relocations. */ - internal_relocs = (_bfd_elf_link_read_relocs - (abfd, datasec, (PTR) NULL, (Elf_Internal_Rela *) NULL, - info->keep_memory)); + internal_relocs = _bfd_elf_link_read_relocs (abfd, datasec, NULL, NULL, + info->keep_memory); if (internal_relocs == NULL) goto error_return; - relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 12); + relsec->contents = bfd_alloc (abfd, datasec->reloc_count * 12); if (relsec->contents == NULL) goto error_return; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index e2de01e..4467eec 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -336,7 +336,8 @@ ppc_elf_copy_indirect_symbol (const struct elf_backend_data *bed, dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -1674,11 +1675,8 @@ ppc_elf_relax_section (bfd *abfd, *again = FALSE; - /* Nothing to do if there are no relocations and no need for - the relax finalize pass. */ - if ((isec->flags & SEC_RELOC) == 0 - || isec->reloc_count == 0 - || link_info->relax_finalizing) + /* Nothing to do if there are no relocations. */ + if ((isec->flags & SEC_RELOC) == 0 || isec->reloc_count == 0) return TRUE; /* If needed, initialize this section's cooked size. */ @@ -1763,7 +1761,7 @@ ppc_elf_relax_section (bfd *abfd, } isym = isymbuf + ELF32_R_SYM (irel->r_info); if (isym->st_shndx == SHN_UNDEF) - continue; /* We can't do anthing with undefined symbols. */ + continue; /* We can't do anything with undefined symbols. */ else if (isym->st_shndx == SHN_ABS) tsec = bfd_abs_section_ptr; else if (isym->st_shndx == SHN_COMMON) @@ -2738,7 +2736,8 @@ ppc_elf_additional_program_headers (bfd *abfd) /* Modify the segment map if needed. */ static bfd_boolean -ppc_elf_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED) +ppc_elf_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return TRUE; } @@ -4917,7 +4916,7 @@ ppc_elf_relocate_section (bfd *output_bfd, branch_bit = BRANCH_PREDICT_BIT; /* Fall thru */ - /* Branch not taken predicition relocations. */ + /* Branch not taken prediction relocations. */ case R_PPC_ADDR14_BRNTAKEN: case R_PPC_REL14_BRNTAKEN: insn = bfd_get_32 (output_bfd, contents + rel->r_offset); diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 80a753a..07ba23c 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -484,7 +484,7 @@ elf_s390_is_local_label_name (abfd, name) Word 1 is a pointer to a structure describing the object Word 2 is used to point to the loader entry address. - The code for position independand PLT entries looks like this: + The code for position independent PLT entries looks like this: r12 holds addr of the current GOT at entry to the PLT @@ -685,14 +685,6 @@ static bfd_boolean elf_s390_object_p (abfd) bfd *abfd; { - /* Allocate our special target data. */ - struct elf_s390_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct elf_s390_obj_tdata); - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; /* Set the right machine number for an s390 elf32 file. */ return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_31); } @@ -914,7 +906,8 @@ elf_s390_copy_indirect_symbol (bed, dir, ind) dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -2626,9 +2619,41 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, else { /* This symbol is local, or marked to become local. */ - relocate = TRUE; - outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE); outrel.r_addend = relocation + rel->r_addend; + if (r_type == R_390_32) + { + relocate = TRUE; + outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE); + } + else + { + long sindx; + + if (bfd_is_abs_section (sec)) + sindx = 0; + else if (sec == NULL || sec->owner == NULL) + { + bfd_set_error(bfd_error_bad_value); + return FALSE; + } + else + { + asection *osec; + + osec = sec->output_section; + sindx = elf_section_data (osec)->dynindx; + BFD_ASSERT (sindx > 0); + + /* We are turning this relocation into one + against a section symbol, so subtract out + the output section's address but not the + offset of the input section in the output + section. */ + + outrel.r_addend -= osec->vma; + } + outrel.r_info = ELF32_R_INFO (sindx, r_type); + } } sreloc = elf_section_data (input_section)->sreloc; diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 9ffd05b..c8a091d 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -457,7 +457,7 @@ static reloc_howto_type sh_elf_howto_table[] = TRUE), /* pcrel_offset */ /* The assembler will generate this reloc before a block of - instructions. A section should be processed as assumining it + instructions. A section should be processed as assuming it contains data, unless this reloc is seen. */ HOWTO (R_SH_CODE, /* type */ 0, /* rightshift */ @@ -2718,7 +2718,7 @@ sh_elf_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, /* The addend will be against the section symbol, thus for adjusting the addend, the relevant start is the start of the section. - N.B. If we want to abandom in-place changes here and + N.B. If we want to abandon in-place changes here and test directly using symbol + addend, we have to take into account that the addend has already been adjusted by -4. */ if (stop > addr && stop < toaddr) @@ -3412,7 +3412,7 @@ movi_shori_putval (bfd *output_bfd, unsigned long value, char *addr) #if 1 /* Note - this code has been "optimised" not to use r2. r2 is used by - GCC to return the address of large strutcures, so it should not be + GCC to return the address of large structures, so it should not be corrupted here. This does mean however, that this PLT does not conform to the SH PIC ABI. That spec says that r0 contains the type of the PLT and r2 contains the GOT id. This version stores the GOT id in r0 and @@ -3635,7 +3635,7 @@ static const bfd_byte *elf_sh_pic_plt_entry; /* Return offset of the GOT id in PLT0 entry. */ #define elf_sh_plt0_gotid_offset(info) 24 -/* Return offset of the tempoline in PLT entry */ +/* Return offset of the temporary in PLT entry */ #define elf_sh_plt_temp_offset(info) 8 /* Return offset of the symbol in PLT entry. */ @@ -6339,7 +6339,8 @@ sh_elf_copy_indirect_symbol (const struct elf_backend_data *bed, dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -6959,19 +6960,7 @@ sh_elf_merge_private_data (bfd *ibfd, bfd *obfd) static bfd_boolean sh_elf_object_p (bfd *abfd) { - struct sh_elf_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct sh_elf_obj_tdata); - - if (!sh_elf_set_mach_from_flags (abfd)) - return FALSE; - - /* Allocate our special target data. */ - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; - return TRUE; + return sh_elf_set_mach_from_flags (abfd); } /* Finish up dynamic symbol handling. We set the contents of various diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c index c3be09f..eac444a 100644 --- a/bfd/elf32-sh64.c +++ b/bfd/elf32-sh64.c @@ -59,8 +59,8 @@ static bfd_boolean sh64_elf_add_symbol_hook (bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *); static bfd_boolean sh64_elf_link_output_symbol_hook - (bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, - asection *); + (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *); static bfd_boolean sh64_backend_section_from_shdr (bfd *, Elf_Internal_Shdr *, const char *); static void sh64_elf_final_write_processing @@ -380,7 +380,7 @@ sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, { /* We want to do this for relocatable as well as final linking. */ if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL - && info->hash->creator->flavour == bfd_target_elf_flavour) + && is_elf_hash_table (info->hash)) { struct elf_link_hash_entry *h; @@ -470,11 +470,11 @@ sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, DataLabel symbol. */ bfd_boolean -sh64_elf_link_output_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +sh64_elf_link_output_symbol_hook (struct bfd_link_info *info, const char *cname, Elf_Internal_Sym *sym, - asection *input_sec ATTRIBUTE_UNUSED) + asection *input_sec ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED) { char *name = (char *) cname; diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index ea3a9b1..f77f22c 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -3340,15 +3340,6 @@ static bfd_boolean elf32_sparc_object_p (abfd) bfd *abfd; { - /* Allocate our special target data. */ - struct elf32_sparc_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct elf32_sparc_obj_tdata); - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; - if (elf_elfheader (abfd)->e_machine == EM_SPARC32PLUS) { if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US3) diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index fb290eb..45bb4f6 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -76,8 +76,8 @@ static bfd_boolean v850_elf_add_symbol_hook PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *)); static bfd_boolean v850_elf_link_output_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const char *, - Elf_Internal_Sym *, asection *)); + PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *)); static bfd_boolean v850_elf_section_from_shdr PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); static bfd_boolean v850_elf_gc_sweep_hook @@ -893,7 +893,7 @@ find_remembered_hi16s_reloc (addend, already_found) /* Extract the address. */ addr = match->address; - /* Remeber if this entry has already been used before. */ + /* Remember if this entry has already been used before. */ if (already_found) * already_found = match->found; @@ -904,7 +904,7 @@ find_remembered_hi16s_reloc (addend, already_found) } /* FIXME: The code here probably ought to be removed and the code in reloc.c - allowed to do its stuff instead. At least for most of the relocs, anwyay. */ + allowed to do its stuff instead. At least for most of the relocs, anyway. */ static bfd_reloc_status_type v850_elf_perform_relocation (abfd, r_type, addend, address) @@ -1362,7 +1362,7 @@ v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err) if (reloc->address > isection->_cooked_size) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ if (reloc->howto->pc_relative) @@ -2213,12 +2213,12 @@ v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) } static bfd_boolean -v850_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec) - bfd *abfd ATTRIBUTE_UNUSED; +v850_elf_link_output_symbol_hook (info, name, sym, input_sec, h) struct bfd_link_info *info ATTRIBUTE_UNUSED; const char *name ATTRIBUTE_UNUSED; Elf_Internal_Sym *sym; asection *input_sec; + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED; { /* If we see a common symbol, which implies a relocatable link, then if a symbol was in a special common section in an input file, mark diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 21fdd9d..c37ca00 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -1338,7 +1338,6 @@ elf_vax_size_dynamic_sections (output_bfd, info) in regular objects. We allocated space for them in the check_relocs routine, but we won't fill them in in the relocate_section routine. */ -/*ARGSUSED*/ static bfd_boolean elf_vax_discard_copies (h, ignore) struct elf_vax_link_hash_entry *h; @@ -1366,7 +1365,6 @@ elf_vax_discard_copies (h, ignore) creating a shared object or executable, space in the .got and .rela.got will be reserved for the symbol. */ -/*ARGSUSED*/ static bfd_boolean elf_vax_instantiate_got_entries (h, infoptr) struct elf_link_hash_entry *h; diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index e8c276b..44450c5 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -47,9 +47,6 @@ static bfd_boolean elf_xtensa_check_relocs const Elf_Internal_Rela *)); static void elf_xtensa_hide_symbol PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean)); -static void elf_xtensa_copy_indirect_symbol - PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *, - struct elf_link_hash_entry *)); static asection *elf_xtensa_gc_mark_hook PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *)); @@ -63,7 +60,7 @@ static bfd_boolean elf_xtensa_adjust_dynamic_symbol static bfd_boolean elf_xtensa_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static bfd_boolean elf_xtensa_modify_segment_map - PARAMS ((bfd *)); + PARAMS ((bfd *, struct bfd_link_info *)); static bfd_boolean elf_xtensa_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); @@ -796,19 +793,6 @@ elf_xtensa_hide_symbol (info, h, force_local) } -static void -elf_xtensa_copy_indirect_symbol (bed, dir, ind) - const struct elf_backend_data *bed; - struct elf_link_hash_entry *dir, *ind; -{ - _bfd_elf_link_hash_copy_indirect (bed, dir, ind); - - /* The standard function doesn't copy the NEEDS_PLT flag. */ - dir->elf_link_hash_flags |= - (ind->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT); -} - - /* Return the section that should be marked against GC for a given relocation. */ @@ -1431,8 +1415,9 @@ elf_xtensa_size_dynamic_sections (output_bfd, info) this and it probably ought to be moved into elf.c as well. */ static bfd_boolean -elf_xtensa_modify_segment_map (abfd) +elf_xtensa_modify_segment_map (abfd, info) bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; { struct elf_segment_map **m_p; @@ -1729,7 +1714,7 @@ bfd_elf_xtensa_reloc (abfd, reloc_entry, symbol, data, input_section, / bfd_octets_per_byte (abfd))) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ @@ -4186,7 +4171,7 @@ analyze_relocations (link_info) expensive and unnecessary unless the target section is actually going to be relaxed. This pass identifies all such sections by checking if they have L32Rs pointing to them. In the process, the total number - of relocations targetting each section is also counted so that we + of relocations targeting each section is also counted so that we know how much space to allocate for source_relocs against each relaxable literal section. */ @@ -5850,7 +5835,6 @@ static struct bfd_elf_special_section const elf_xtensa_special_sections[]= #define elf_backend_adjust_dynamic_symbol elf_xtensa_adjust_dynamic_symbol #define elf_backend_check_relocs elf_xtensa_check_relocs -#define elf_backend_copy_indirect_symbol elf_xtensa_copy_indirect_symbol #define elf_backend_create_dynamic_sections elf_xtensa_create_dynamic_sections #define elf_backend_discard_info elf_xtensa_discard_info #define elf_backend_ignore_discarded_relocs elf_xtensa_ignore_discarded_relocs diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index ac16fb5..6025277 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -393,15 +393,6 @@ static bfd_boolean elf64_alpha_object_p (abfd) bfd *abfd; { - /* Allocate our special target data. */ - struct alpha_elf_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata); - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; - /* Set the right machine number for an Alpha ELF file. */ return bfd_default_set_arch_mach (abfd, bfd_arch_alpha, 0); } @@ -3640,7 +3631,7 @@ elf64_alpha_size_got_sections (info) if (this_got == NULL) continue; - /* We are assuming no merging has yet ocurred. */ + /* We are assuming no merging has yet occurred. */ BFD_ASSERT (this_got == i); if (alpha_elf_tdata (this_got)->total_got_size > MAX_GOT_SIZE) diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 294d643..06aff7b 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -202,8 +202,8 @@ static bfd_boolean elf64_hppa_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static bfd_boolean elf64_hppa_link_output_symbol_hook - PARAMS ((bfd *abfd, struct bfd_link_info *, const char *, - Elf_Internal_Sym *, asection *input_sec)); + PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *)); static bfd_boolean elf64_hppa_finish_dynamic_symbol PARAMS ((bfd *, struct bfd_link_info *, @@ -213,7 +213,7 @@ static int elf64_hppa_additional_program_headers PARAMS ((bfd *)); static bfd_boolean elf64_hppa_modify_segment_map - PARAMS ((bfd *)); + PARAMS ((bfd *, struct bfd_link_info *)); static enum elf_reloc_type_class elf64_hppa_reloc_type_class PARAMS ((const Elf_Internal_Rela *)); @@ -975,7 +975,7 @@ elf64_hppa_dynamic_symbol_p (h, info) return FALSE; } -/* Mark all funtions exported by this file so that we can later allocate +/* Mark all functions exported by this file so that we can later allocate entries in .opd for them. */ static bfd_boolean @@ -1211,7 +1211,7 @@ elf64_hppa_post_process_headers (abfd, link_info) } /* Create function descriptor section (.opd). This section is called .opd - because it contains "official prodecure descriptors". The "official" + because it contains "official procedure descriptors". The "official" refers to the fact that these descriptors are used when taking the address of a procedure, thus ensuring a unique address for each procedure. */ @@ -1893,12 +1893,12 @@ elf64_hppa_size_dynamic_sections (output_bfd, info) table. Ick. */ static bfd_boolean -elf64_hppa_link_output_symbol_hook (abfd, info, name, sym, input_sec) - bfd *abfd ATTRIBUTE_UNUSED; +elf64_hppa_link_output_symbol_hook (info, name, sym, input_sec, h) struct bfd_link_info *info; const char *name; Elf_Internal_Sym *sym; asection *input_sec ATTRIBUTE_UNUSED; + struct elf_link_hash_entry *h; { struct elf64_hppa_link_hash_table *hppa_info; struct elf64_hppa_dyn_hash_entry *dyn_h; @@ -1912,6 +1912,8 @@ elf64_hppa_link_output_symbol_hook (abfd, info, name, sym, input_sec) hppa_info = elf64_hppa_hash_table (info); dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, name, FALSE, FALSE); + if (!dyn_h || dyn_h->h != h) + return TRUE; /* Function symbols for which we created .opd entries *may* have been munged by finish_dynamic_symbol and have to be un-munged here. @@ -1920,7 +1922,7 @@ elf64_hppa_link_output_symbol_hook (abfd, info, name, sym, input_sec) into non-dynamic ones, so we initialize st_shndx to -1 in mark_exported_functions and check to see if it was overwritten here instead of just checking dyn_h->h->dynindx. */ - if (dyn_h && dyn_h->want_opd && dyn_h->st_shndx != -1) + if (dyn_h->want_opd && dyn_h->st_shndx != -1) { /* Restore the saved value and section index. */ sym->st_value = dyn_h->st_value; @@ -2281,7 +2283,7 @@ elf64_hppa_finalize_dlt (dyn_h, data) bfd_put_64 (sdlt->owner, value, sdlt->contents + dyn_h->dlt_offset); } - /* Create a relocation for the DLT entry assocated with this symbol. + /* Create a relocation for the DLT entry associated with this symbol. When building a shared library the symbol does not have to be dynamic. */ if (dyn_h->want_dlt && (elf64_hppa_dynamic_symbol_p (dyn_h->h, info) || info->shared)) @@ -2609,8 +2611,9 @@ elf64_hppa_additional_program_headers (abfd) existence of a .interp section. */ static bfd_boolean -elf64_hppa_modify_segment_map (abfd) +elf64_hppa_modify_segment_map (abfd, info) bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; { struct elf_segment_map *m; asection *s; diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 11d0565..998c5df 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -62,79 +62,76 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ecoffswap.h" static void mips_elf64_swap_reloc_in - PARAMS ((bfd *, const Elf64_Mips_External_Rel *, - Elf64_Mips_Internal_Rela *)); + (bfd *, const Elf64_Mips_External_Rel *, Elf64_Mips_Internal_Rela *); static void mips_elf64_swap_reloca_in - PARAMS ((bfd *, const Elf64_Mips_External_Rela *, - Elf64_Mips_Internal_Rela *)); + (bfd *, const Elf64_Mips_External_Rela *, Elf64_Mips_Internal_Rela *); static void mips_elf64_swap_reloc_out - PARAMS ((bfd *, const Elf64_Mips_Internal_Rela *, - Elf64_Mips_External_Rel *)); + (bfd *, const Elf64_Mips_Internal_Rela *, Elf64_Mips_External_Rel *); static void mips_elf64_swap_reloca_out - PARAMS ((bfd *, const Elf64_Mips_Internal_Rela *, - Elf64_Mips_External_Rela *)); + (bfd *, const Elf64_Mips_Internal_Rela *, Elf64_Mips_External_Rela *); static void mips_elf64_be_swap_reloc_in - PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *)); + (bfd *, const bfd_byte *, Elf_Internal_Rela *); static void mips_elf64_be_swap_reloc_out - PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *)); + (bfd *, const Elf_Internal_Rela *, bfd_byte *); static void mips_elf64_be_swap_reloca_in - PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *)); + (bfd *, const bfd_byte *, Elf_Internal_Rela *); static void mips_elf64_be_swap_reloca_out - PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *)); + (bfd *, const Elf_Internal_Rela *, bfd_byte *); static reloc_howto_type *bfd_elf64_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); + (bfd *, bfd_reloc_code_real_type); static reloc_howto_type *mips_elf64_rtype_to_howto - PARAMS ((unsigned int, bfd_boolean)); + (unsigned int, bfd_boolean); static void mips_elf64_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); static void mips_elf64_info_to_howto_rela - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); static long mips_elf64_get_reloc_upper_bound - PARAMS ((bfd *, asection *)); + (bfd *, asection *); static long mips_elf64_canonicalize_reloc - PARAMS ((bfd *, asection *, arelent **, asymbol **)); -static long mips_elf64_get_dynamic_reloc_upper_bound PARAMS ((bfd *)); + (bfd *, asection *, arelent **, asymbol **); +static long mips_elf64_get_dynamic_reloc_upper_bound + (bfd *); static long mips_elf64_canonicalize_dynamic_reloc - PARAMS ((bfd *, arelent **, asymbol **)); + (bfd *, arelent **, asymbol **); static bfd_boolean mips_elf64_slurp_one_reloc_table - PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type, - arelent *, asymbol **, bfd_boolean)); + (bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type, arelent *, + asymbol **, bfd_boolean); static bfd_boolean mips_elf64_slurp_reloc_table - PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); + (bfd *, asection *, asymbol **, bfd_boolean); static void mips_elf64_write_relocs - PARAMS ((bfd *, asection *, PTR)); + (bfd *, asection *, void *); static void mips_elf64_write_rel - PARAMS((bfd *, asection *, Elf_Internal_Shdr *, int *, PTR)); + (bfd *, asection *, Elf_Internal_Shdr *, int *, void *); static void mips_elf64_write_rela - PARAMS((bfd *, asection *, Elf_Internal_Shdr *, int *, PTR)); + (bfd *, asection *, Elf_Internal_Shdr *, int *, void *); static bfd_reloc_status_type mips_elf64_hi16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_gprel16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_literal_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_gprel32_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_shift6_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_got16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_jump_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_gprel_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_boolean mips_elf64_assign_gp - PARAMS ((bfd *, bfd_vma *)); + (bfd *, bfd_vma *); static bfd_reloc_status_type mips_elf64_final_gp - PARAMS ((bfd *, asymbol *, bfd_boolean, char **, bfd_vma *)); + (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *); static bfd_boolean mips_elf64_object_p - PARAMS ((bfd *)); + (bfd *); static irix_compat_t elf64_mips_irix_compat - PARAMS ((bfd *)); + (bfd *); static bfd_boolean elf64_mips_grok_prstatus - PARAMS ((bfd *, Elf_Internal_Note *)); + (bfd *, Elf_Internal_Note *); static bfd_boolean elf64_mips_grok_psinfo - PARAMS ((bfd *, Elf_Internal_Note *)); + (bfd *, Elf_Internal_Note *); extern const bfd_target bfd_elf64_bigmips_vec; extern const bfd_target bfd_elf64_littlemips_vec; @@ -475,7 +472,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 64 bit substraction. */ + /* 64 bit subtraction. */ HOWTO (R_MIPS_SUB, /* type */ 0, /* rightshift */ 4, /* size (0 = byte, 1 = short, 2 = long) */ @@ -970,7 +967,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 64 bit substraction. */ + /* 64 bit subtraction. */ HOWTO (R_MIPS_SUB, /* type */ 0, /* rightshift */ 4, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1262,10 +1259,8 @@ static reloc_howto_type elf_mips_gnu_rela16_s2 = /* Swap in a MIPS 64-bit Rel reloc. */ static void -mips_elf64_swap_reloc_in (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_External_Rel *src; - Elf64_Mips_Internal_Rela *dst; +mips_elf64_swap_reloc_in (bfd *abfd, const Elf64_Mips_External_Rel *src, + Elf64_Mips_Internal_Rela *dst) { dst->r_offset = H_GET_64 (abfd, src->r_offset); dst->r_sym = H_GET_32 (abfd, src->r_sym); @@ -1279,10 +1274,8 @@ mips_elf64_swap_reloc_in (abfd, src, dst) /* Swap in a MIPS 64-bit Rela reloc. */ static void -mips_elf64_swap_reloca_in (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_External_Rela *src; - Elf64_Mips_Internal_Rela *dst; +mips_elf64_swap_reloca_in (bfd *abfd, const Elf64_Mips_External_Rela *src, + Elf64_Mips_Internal_Rela *dst) { dst->r_offset = H_GET_64 (abfd, src->r_offset); dst->r_sym = H_GET_32 (abfd, src->r_sym); @@ -1296,10 +1289,8 @@ mips_elf64_swap_reloca_in (abfd, src, dst) /* Swap out a MIPS 64-bit Rel reloc. */ static void -mips_elf64_swap_reloc_out (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_Internal_Rela *src; - Elf64_Mips_External_Rel *dst; +mips_elf64_swap_reloc_out (bfd *abfd, const Elf64_Mips_Internal_Rela *src, + Elf64_Mips_External_Rel *dst) { H_PUT_64 (abfd, src->r_offset, dst->r_offset); H_PUT_32 (abfd, src->r_sym, dst->r_sym); @@ -1312,10 +1303,8 @@ mips_elf64_swap_reloc_out (abfd, src, dst) /* Swap out a MIPS 64-bit Rela reloc. */ static void -mips_elf64_swap_reloca_out (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_Internal_Rela *src; - Elf64_Mips_External_Rela *dst; +mips_elf64_swap_reloca_out (bfd *abfd, const Elf64_Mips_Internal_Rela *src, + Elf64_Mips_External_Rela *dst) { H_PUT_64 (abfd, src->r_offset, dst->r_offset); H_PUT_32 (abfd, src->r_sym, dst->r_sym); @@ -1329,10 +1318,8 @@ mips_elf64_swap_reloca_out (abfd, src, dst) /* Swap in a MIPS 64-bit Rel reloc. */ static void -mips_elf64_be_swap_reloc_in (abfd, src, dst) - bfd *abfd; - const bfd_byte *src; - Elf_Internal_Rela *dst; +mips_elf64_be_swap_reloc_in (bfd *abfd, const bfd_byte *src, + Elf_Internal_Rela *dst) { Elf64_Mips_Internal_Rela mirel; @@ -1354,10 +1341,8 @@ mips_elf64_be_swap_reloc_in (abfd, src, dst) /* Swap in a MIPS 64-bit Rela reloc. */ static void -mips_elf64_be_swap_reloca_in (abfd, src, dst) - bfd *abfd; - const bfd_byte *src; - Elf_Internal_Rela *dst; +mips_elf64_be_swap_reloca_in (bfd *abfd, const bfd_byte *src, + Elf_Internal_Rela *dst) { Elf64_Mips_Internal_Rela mirela; @@ -1379,10 +1364,8 @@ mips_elf64_be_swap_reloca_in (abfd, src, dst) /* Swap out a MIPS 64-bit Rel reloc. */ static void -mips_elf64_be_swap_reloc_out (abfd, src, dst) - bfd *abfd; - const Elf_Internal_Rela *src; - bfd_byte *dst; +mips_elf64_be_swap_reloc_out (bfd *abfd, const Elf_Internal_Rela *src, + bfd_byte *dst) { Elf64_Mips_Internal_Rela mirel; @@ -1405,10 +1388,8 @@ mips_elf64_be_swap_reloc_out (abfd, src, dst) /* Swap out a MIPS 64-bit Rela reloc. */ static void -mips_elf64_be_swap_reloca_out (abfd, src, dst) - bfd *abfd; - const Elf_Internal_Rela *src; - bfd_byte *dst; +mips_elf64_be_swap_reloca_out (bfd *abfd, const Elf_Internal_Rela *src, + bfd_byte *dst) { Elf64_Mips_Internal_Rela mirela; @@ -1433,19 +1414,14 @@ mips_elf64_be_swap_reloca_out (abfd, src, dst) /* Do a R_MIPS_HI16 relocation. */ static bfd_reloc_status_type -mips_elf64_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf64_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1477,19 +1453,13 @@ mips_elf64_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, not yet know how to create global offset tables. */ static bfd_reloc_status_type -mips_elf64_got16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf64_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { /* If we're relocating, and this is a local symbol, we can handle it just like an R_MIPS_HI16. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && ((symbol->flags & BSF_SECTION_SYM) != 0 || (symbol->flags & BSF_LOCAL) == 0)) return mips_elf64_hi16_reloc (abfd, reloc_entry, symbol, data, @@ -1505,9 +1475,7 @@ mips_elf64_got16_reloc (abfd, reloc_entry, symbol, data, input_section, dangerous relocation. */ static bfd_boolean -mips_elf64_assign_gp (output_bfd, pgp) - bfd *output_bfd; - bfd_vma *pgp; +mips_elf64_assign_gp (bfd *output_bfd, bfd_vma *pgp) { unsigned int count; asymbol **sym; @@ -1523,7 +1491,7 @@ mips_elf64_assign_gp (output_bfd, pgp) /* The linker script will have created a symbol named `_gp' with the appropriate value. */ - if (sym == (asymbol **) NULL) + if (sym == NULL) i = count; else { @@ -1559,12 +1527,8 @@ mips_elf64_assign_gp (output_bfd, pgp) external symbol if we are producing relocatable output. */ static bfd_reloc_status_type -mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message, pgp) - bfd *output_bfd; - asymbol *symbol; - bfd_boolean relocatable; - char **error_message; - bfd_vma *pgp; +mips_elf64_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable, + char **error_message, bfd_vma *pgp) { if (bfd_is_und_section (symbol->section) && ! relocatable) @@ -1599,15 +1563,9 @@ mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message, pgp) become the offset from the gp register. */ static bfd_reloc_status_type -mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf64_gprel16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1615,7 +1573,7 @@ mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1623,7 +1581,7 @@ mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_ok; } - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1644,15 +1602,9 @@ mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, /* Do a R_MIPS_LITERAL relocation. */ static bfd_reloc_status_type -mips_elf64_literal_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf64_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1660,7 +1612,7 @@ mips_elf64_literal_reloc (abfd, reloc_entry, symbol, data, input_section, /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1669,7 +1621,7 @@ mips_elf64_literal_reloc (abfd, reloc_entry, symbol, data, input_section, } /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */ - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1691,15 +1643,9 @@ mips_elf64_literal_reloc (abfd, reloc_entry, symbol, data, input_section, become the offset from the gp register. */ static bfd_reloc_status_type -mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1709,7 +1655,7 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1718,7 +1664,7 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_outofrange; } - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1770,19 +1716,14 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, the rest is at bits 6-10. The bitpos already got right by the howto. */ static bfd_reloc_status_type -mips_elf64_shift6_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf64_shift6_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1802,17 +1743,12 @@ mips_elf64_shift6_reloc (abfd, reloc_entry, symbol, data, input_section, /* Handle a mips16 jump. */ static bfd_reloc_status_type -mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (! reloc_entry->howto->partial_inplace || reloc_entry->addend == 0)) @@ -1838,15 +1774,9 @@ mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, /* Handle a mips16 GP relative reloc. */ static bfd_reloc_status_type -mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1913,13 +1843,10 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, if (reloc_entry->howto->partial_inplace) { bfd_put_16 (abfd, - (bfd_vma) ((extend & 0xf800) - | ((val >> 11) & 0x1f) - | (val & 0x7e0)), + (extend & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0), (bfd_byte *) data + reloc_entry->address); bfd_put_16 (abfd, - (bfd_vma) ((insn & 0xffe0) - | (val & 0x1f)), + (insn & 0xffe0) | (val & 0x1f), (bfd_byte *) data + reloc_entry->address + 2); } else @@ -1982,9 +1909,8 @@ static const struct elf_reloc_map mips_reloc_map[] = /* Given a BFD reloc type, return a howto structure. */ static reloc_howto_type * -bfd_elf64_bfd_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { unsigned int i; /* FIXME: We default to RELA here instead of choosing the right @@ -2019,9 +1945,7 @@ bfd_elf64_bfd_reloc_type_lookup (abfd, code) /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static reloc_howto_type * -mips_elf64_rtype_to_howto (r_type, rela_p) - unsigned int r_type; - bfd_boolean rela_p; +mips_elf64_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p) { switch (r_type) { @@ -2051,19 +1975,17 @@ mips_elf64_rtype_to_howto (r_type, rela_p) /* Prevent relocation handling by bfd for MIPS ELF64. */ static void -mips_elf64_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr ATTRIBUTE_UNUSED; - Elf_Internal_Rela *dst ATTRIBUTE_UNUSED; +mips_elf64_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr ATTRIBUTE_UNUSED, + Elf_Internal_Rela *dst ATTRIBUTE_UNUSED) { BFD_ASSERT (0); } static void -mips_elf64_info_to_howto_rela (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr ATTRIBUTE_UNUSED; - Elf_Internal_Rela *dst ATTRIBUTE_UNUSED; +mips_elf64_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr ATTRIBUTE_UNUSED, + Elf_Internal_Rela *dst ATTRIBUTE_UNUSED) { BFD_ASSERT (0); } @@ -2072,16 +1994,13 @@ mips_elf64_info_to_howto_rela (abfd, cache_ptr, dst) to three relocs, we must tell the user to allocate more space. */ static long -mips_elf64_get_reloc_upper_bound (abfd, sec) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec; +mips_elf64_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) { return (sec->reloc_count * 3 + 1) * sizeof (arelent *); } static long -mips_elf64_get_dynamic_reloc_upper_bound (abfd) - bfd *abfd; +mips_elf64_get_dynamic_reloc_upper_bound (bfd *abfd) { return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 3; } @@ -2092,11 +2011,8 @@ mips_elf64_get_dynamic_reloc_upper_bound (abfd) 3 to obtain the internal relocation count. */ static long -mips_elf64_canonicalize_reloc (abfd, section, relptr, symbols) - bfd *abfd; - sec_ptr section; - arelent **relptr; - asymbol **symbols; +mips_elf64_canonicalize_reloc (bfd *abfd, sec_ptr section, + arelent **relptr, asymbol **symbols) { arelent *tblptr; unsigned int i; @@ -2115,13 +2031,10 @@ mips_elf64_canonicalize_reloc (abfd, section, relptr, symbols) } static long -mips_elf64_canonicalize_dynamic_reloc (abfd, storage, syms) - bfd *abfd; - arelent **storage; - asymbol **syms; +mips_elf64_canonicalize_dynamic_reloc (bfd *abfd, arelent **storage, + asymbol **syms) { - bfd_boolean (*slurp_relocs) - PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); + bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean); asection *s; long ret; @@ -2164,24 +2077,20 @@ mips_elf64_canonicalize_dynamic_reloc (abfd, storage, syms) generic code seems to depend on this. */ static bfd_boolean -mips_elf64_slurp_one_reloc_table (abfd, asect, rel_hdr, reloc_count, - relents, symbols, dynamic) - bfd *abfd; - asection *asect; - Elf_Internal_Shdr *rel_hdr; - bfd_size_type reloc_count; - arelent *relents; - asymbol **symbols; - bfd_boolean dynamic; +mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect, + Elf_Internal_Shdr *rel_hdr, + bfd_size_type reloc_count, + arelent *relents, asymbol **symbols, + bfd_boolean dynamic) { - PTR allocated = NULL; + void *allocated; bfd_byte *native_relocs; arelent *relent; bfd_vma i; int entsize; reloc_howto_type *howto_table; - allocated = (PTR) bfd_malloc (rel_hdr->sh_size); + allocated = bfd_malloc (rel_hdr->sh_size); if (allocated == NULL) return FALSE; @@ -2190,7 +2099,7 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, rel_hdr, reloc_count, != rel_hdr->sh_size)) goto error_return; - native_relocs = (bfd_byte *) allocated; + native_relocs = allocated; entsize = rel_hdr->sh_entsize; BFD_ASSERT (entsize == sizeof (Elf64_Mips_External_Rel) @@ -2338,11 +2247,8 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, rel_hdr, reloc_count, zero before processing the relocs of a section. */ static bfd_boolean -mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic) - bfd *abfd; - asection *asect; - asymbol **symbols; - bfd_boolean dynamic; +mips_elf64_slurp_reloc_table (bfd *abfd, asection *asect, + asymbol **symbols, bfd_boolean dynamic) { struct bfd_elf_section_data * const d = elf_section_data (asect); Elf_Internal_Shdr *rel_hdr; @@ -2388,7 +2294,7 @@ mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic) /* Allocate space for 3 arelent structures for each Rel structure. */ amt = (reloc_count + reloc_count2) * 3 * sizeof (arelent); - relents = (arelent *) bfd_alloc (abfd, amt); + relents = bfd_alloc (abfd, amt); if (relents == NULL) return FALSE; @@ -2416,12 +2322,9 @@ mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic) /* Write out the relocations. */ static void -mips_elf64_write_relocs (abfd, sec, data) - bfd *abfd; - asection *sec; - PTR data; +mips_elf64_write_relocs (bfd *abfd, asection *sec, void *data) { - bfd_boolean *failedp = (bfd_boolean *) data; + bfd_boolean *failedp = data; int count; Elf_Internal_Shdr *rel_hdr; unsigned int idx; @@ -2482,21 +2385,18 @@ mips_elf64_write_relocs (abfd, sec, data) } static void -mips_elf64_write_rel (abfd, sec, rel_hdr, count, data) - bfd *abfd; - asection *sec; - Elf_Internal_Shdr *rel_hdr; - int *count; - PTR data; +mips_elf64_write_rel (bfd *abfd, asection *sec, + Elf_Internal_Shdr *rel_hdr, + int *count, void *data) { - bfd_boolean *failedp = (bfd_boolean *) data; + bfd_boolean *failedp = data; Elf64_Mips_External_Rel *ext_rel; unsigned int idx; asymbol *last_sym = 0; int last_sym_idx = 0; - rel_hdr->sh_size = (bfd_vma)(rel_hdr->sh_entsize * *count); - rel_hdr->contents = (PTR) bfd_alloc (abfd, rel_hdr->sh_size); + rel_hdr->sh_size = rel_hdr->sh_entsize * *count; + rel_hdr->contents = bfd_alloc (abfd, rel_hdr->sh_size); if (rel_hdr->contents == NULL) { *failedp = TRUE; @@ -2581,21 +2481,18 @@ mips_elf64_write_rel (abfd, sec, rel_hdr, count, data) } static void -mips_elf64_write_rela (abfd, sec, rela_hdr, count, data) - bfd *abfd; - asection *sec; - Elf_Internal_Shdr *rela_hdr; - int *count; - PTR data; +mips_elf64_write_rela (bfd *abfd, asection *sec, + Elf_Internal_Shdr *rela_hdr, + int *count, void *data) { - bfd_boolean *failedp = (bfd_boolean *) data; + bfd_boolean *failedp = data; Elf64_Mips_External_Rela *ext_rela; unsigned int idx; asymbol *last_sym = 0; int last_sym_idx = 0; - rela_hdr->sh_size = (bfd_vma)(rela_hdr->sh_entsize * *count); - rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size); + rela_hdr->sh_size = rela_hdr->sh_entsize * *count; + rela_hdr->contents = bfd_alloc (abfd, rela_hdr->sh_size); if (rela_hdr->contents == NULL) { *failedp = TRUE; @@ -2683,8 +2580,7 @@ mips_elf64_write_rela (abfd, sec, rela_hdr, count, data) /* Set the right machine number for a MIPS ELF file. */ static bfd_boolean -mips_elf64_object_p (abfd) - bfd *abfd; +mips_elf64_object_p (bfd *abfd) { unsigned long mach; @@ -2702,8 +2598,7 @@ mips_elf64_object_p (abfd) /* Depending on the target vector we generate some version of Irix executables or "normal" MIPS ELF ABI executables. */ static irix_compat_t -elf64_mips_irix_compat (abfd) - bfd *abfd; +elf64_mips_irix_compat (bfd *abfd) { if ((abfd->xvec == &bfd_elf64_bigmips_vec) || (abfd->xvec == &bfd_elf64_littlemips_vec)) @@ -2714,9 +2609,7 @@ elf64_mips_irix_compat (abfd) /* Support for core dump NOTE sections. */ static bfd_boolean -elf64_mips_grok_prstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf64_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; unsigned int raw_size; @@ -2746,9 +2639,7 @@ elf64_mips_grok_prstatus (abfd, note) } static bfd_boolean -elf64_mips_grok_psinfo (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf64_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) { switch (note->descsz) { @@ -2948,9 +2839,9 @@ const struct elf_size_info mips_elf64_size_info = /* MIPS ELF64 archive functions. */ #define bfd_elf64_archive_functions extern bfd_boolean bfd_elf64_archive_slurp_armap - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean bfd_elf64_archive_write_armap - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); + (bfd *, unsigned int, struct orl *, unsigned int, int); #define bfd_elf64_archive_slurp_extended_name_table \ _bfd_archive_coff_slurp_extended_name_table #define bfd_elf64_archive_construct_extended_name_table \ diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 6440dcb..ca627ef 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -157,8 +157,8 @@ struct bpo_greg_section_info }; static bfd_boolean mmix_elf_link_output_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const char *, - Elf_Internal_Sym *, asection *)); + PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *)); static bfd_reloc_status_type mmix_elf_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); @@ -1280,7 +1280,7 @@ mmix_elf_reloc (abfd, reloc_entry, symbol, data, input_section, if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ @@ -2113,12 +2113,12 @@ _bfd_mmix_check_all_relocs (abfd, info) number. */ static bfd_boolean -mmix_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec) - bfd *abfd ATTRIBUTE_UNUSED; +mmix_elf_link_output_symbol_hook (info, name, sym, input_sec, h) struct bfd_link_info *info ATTRIBUTE_UNUSED; const char *name ATTRIBUTE_UNUSED; Elf_Internal_Sym *sym; asection *input_sec; + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED; { if (input_sec != NULL && input_sec->name != NULL diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 8ae3f12..3ed9042 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -92,6 +92,7 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc #define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol #define elf_backend_reloc_type_class ppc64_elf_reloc_type_class #define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections +#define elf_backend_link_output_symbol_hook ppc64_elf_output_symbol_hook #define elf_backend_special_sections ppc64_elf_special_sections /* The name of the dynamic interpreter. This is put in the .interp @@ -2641,7 +2642,7 @@ struct plt_entry pointers must reference the descriptor. Thus, a function pointer initialized to the address of a function in a shared library will either require a copy reloc, or a dynamic reloc. Using a copy reloc - redefines the function desctriptor symbol to point to the copy. This + redefines the function descriptor symbol to point to the copy. This presents a problem as a plt entry for that function is also initialized from the function descriptor symbol and the copy reloc may not be initialized first. */ @@ -2762,6 +2763,9 @@ struct ppc_link_hash_entry unsigned int is_func_descriptor:1; unsigned int is_entry:1; + /* Whether global opd sym has been adjusted or not. */ + unsigned int adjust_done:1; + /* Contexts in which symbol is used in the GOT (or TOC). TLS_GD .. TLS_EXPLICIT bits are or'd into the mask as the corresponding relocs are encountered during check_relocs. @@ -2971,6 +2975,7 @@ link_hash_newfunc (struct bfd_hash_entry *entry, eh->is_func = 0; eh->is_func_descriptor = 0; eh->is_entry = 0; + eh->adjust_done = 0; eh->tls_mask = 0; } @@ -3359,7 +3364,8 @@ ppc64_elf_copy_indirect_symbol edir->tls_mask |= eind->tls_mask; mask = (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK | ELF_LINK_NON_GOT_REF); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK | ELF_LINK_NON_GOT_REF + | ELF_LINK_HASH_NEEDS_PLT); /* If called to transfer flags for a weakdef during processing of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. We clear it ourselves for ELIMINATE_COPY_RELOCS. */ @@ -4874,10 +4880,53 @@ get_tls_mask (char **tls_maskp, unsigned long *toc_symndx, return 1; } +/* Adjust all global syms defined in opd sections. In gcc generated + code these will already have been done, but I suppose we have to + cater for all sorts of hand written assembly. */ + +static bfd_boolean +adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED) +{ + struct ppc_link_hash_entry *eh; + asection *sym_sec; + long *opd_adjust; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + return TRUE; + + eh = (struct ppc_link_hash_entry *) h; + if (eh->adjust_done) + return TRUE; + + sym_sec = eh->elf.root.u.def.section; + if (sym_sec != NULL + && elf_section_data (sym_sec) != NULL + && (opd_adjust = ppc64_elf_section_data (sym_sec)->opd.adjust) != NULL) + { + eh->elf.root.u.def.value += opd_adjust[eh->elf.root.u.def.value / 24]; + eh->adjust_done = 1; + } + return TRUE; +} + +/* Remove unused Official Procedure Descriptor entries. Currently we + only remove those associated with functions in discarded link-once + sections, or weakly defined functions that have been overridden. It + would be possible to remove many more entries for statically linked + applications. */ + bfd_boolean ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) { bfd *ibfd; + bfd_boolean some_edited = FALSE; for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) { @@ -5078,23 +5127,25 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) if (h != NULL) { - /* Redefine the function descriptor symbol - to this location in the opd section. - We've checked above that opd relocs are - ordered. */ + /* Redefine the function descriptor symbol to + this location in the opd section. It is + necessary to update the value here rather + than using an array of adjustments as we do + for local symbols, because various places + in the generic ELF code use the value + stored in u.def.value. */ fdh->elf.root.u.def.value = wptr - sec->contents; - } - else - { - /* Local syms are a bit tricky. We could - tweak them as they can be cached, but - we'd need to look through the local syms - for the function descriptor sym which we - don't have at the moment. So keep an - array of adjustments. */ - adjust[rel->r_offset / 24] = wptr - rptr; + fdh->adjust_done = 1; } + /* Local syms are a bit tricky. We could + tweak them as they can be cached, but + we'd need to look through the local syms + for the function descriptor sym which we + don't have at the moment. So keep an + array of adjustments. */ + adjust[rel->r_offset / 24] = wptr - rptr; + if (wptr != rptr) memcpy (wptr, rptr, 24); wptr += 24; @@ -5152,6 +5203,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) elf_section_data (sec)->rel_hdr.sh_size = sec->reloc_count * elf_section_data (sec)->rel_hdr.sh_entsize; BFD_ASSERT (elf_section_data (sec)->rel_hdr2 == NULL); + some_edited = TRUE; } else if (elf_section_data (sec)->relocs != relstart) free (relstart); @@ -5166,6 +5218,9 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) } } + if (some_edited) + elf_link_hash_traverse (elf_hash_table (info), adjust_opd_syms, NULL); + return TRUE; } @@ -5261,7 +5316,17 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) value = h->root.u.def.value; } else - value = sym->st_value; + { + value = sym->st_value; + + if (elf_section_data (sym_sec) != NULL) + { + long *adjust; + adjust = ppc64_elf_section_data (sym_sec)->opd.adjust; + if (adjust != NULL) + value += adjust[value / 24]; + } + } ok_tprel = FALSE; is_local = FALSE; @@ -6069,8 +6134,9 @@ ppc_type_of_stub (asection *input_sec, } } - if (h->elf.root.type != bfd_link_hash_defined - && h->elf.root.type != bfd_link_hash_defweak) + if (!(h->elf.root.type == bfd_link_hash_defined + || h->elf.root.type == bfd_link_hash_defweak) + || h->elf.root.u.def.section->output_section == NULL) return ppc_stub_none; } @@ -6565,6 +6631,9 @@ toc_adjusting_stub_needed (struct bfd_link_info *info, asection *isec) if ((isec->flags & SEC_LINKER_CREATED) != 0) return 0; + if (isec->_raw_size == 0) + return 0; + /* Hack for linux kernel. .fixup contains branches, but only back to the function that hit an exception. */ branch_ok = strcmp (isec->name, ".fixup") == 0; @@ -7397,7 +7466,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, long *opd_sym_adjust; opd_sym_adjust = ppc64_elf_section_data (sec)->opd.adjust; - if (opd_sym_adjust != NULL && sym->st_value % 24 == 0) + if (opd_sym_adjust != NULL) relocation += opd_sym_adjust[sym->st_value / 24]; } } @@ -8668,6 +8737,32 @@ ppc64_elf_relocate_section (bfd *output_bfd, return ret; } +/* Adjust the value of any local symbols in opd sections. */ + +static bfd_boolean +ppc64_elf_output_symbol_hook (struct bfd_link_info *info, + const char *name ATTRIBUTE_UNUSED, + Elf_Internal_Sym *elfsym, + asection *input_sec, + struct elf_link_hash_entry *h) +{ + long *adjust; + bfd_vma value; + + if (h != NULL + || input_sec == NULL + || ppc64_elf_section_data (input_sec) == NULL + || (adjust = ppc64_elf_section_data (input_sec)->opd.adjust) == NULL) + return TRUE; + + value = elfsym->st_value - input_sec->output_offset; + if (!info->relocatable) + value -= input_sec->output_section->vma; + + elfsym->st_value += adjust[value / 24]; + return TRUE; +} + /* Finish up dynamic symbol handling. We set the contents of various dynamic sections here. */ diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 6e72ced..2260248 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -638,14 +638,6 @@ static bfd_boolean elf_s390_object_p (abfd) bfd *abfd; { - /* Allocate our special target data. */ - struct elf_s390_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct elf_s390_obj_tdata); - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; /* Set the right machine number for an s390 elf32 file. */ return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_64); } @@ -867,7 +859,8 @@ elf_s390_copy_indirect_symbol (bed, dir, ind) dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -2605,9 +2598,41 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, else { /* This symbol is local, or marked to become local. */ - relocate = TRUE; - outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE); outrel.r_addend = relocation + rel->r_addend; + if (r_type == R_390_64) + { + relocate = TRUE; + outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE); + } + else + { + long sindx; + + if (bfd_is_abs_section (sec)) + sindx = 0; + else if (sec == NULL || sec->owner == NULL) + { + bfd_set_error(bfd_error_bad_value); + return FALSE; + } + else + { + asection *osec; + + osec = sec->output_section; + sindx = elf_section_data (osec)->dynindx; + BFD_ASSERT (sindx > 0); + + /* We are turning this relocation into one + against a section symbol, so subtract out + the output section's address but not the + offset of the input section in the output + section. */ + + outrel.r_addend -= osec->vma; + } + outrel.r_info = ELF64_R_INFO (sindx, r_type); + } } sreloc = elf_section_data (input_section)->sreloc; diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index db096a5..15c2992 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -144,8 +144,8 @@ static bfd_boolean sh64_elf64_add_symbol_hook (bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *); static bfd_boolean sh64_elf64_link_output_symbol_hook - (bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, - asection *); + (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *); static bfd_boolean sh64_elf64_fake_sections (bfd *, Elf_Internal_Shdr *, asection *); static void sh64_elf64_final_write_processing @@ -2892,7 +2892,7 @@ sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, { /* We want to do this for relocatable as well as final linking. */ if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL - && info->hash->creator->flavour == bfd_target_elf_flavour) + && is_elf_hash_table (info->hash)) { struct elf_link_hash_entry *h; @@ -2982,11 +2982,11 @@ sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, DataLabel symbol. */ static bfd_boolean -sh64_elf64_link_output_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +sh64_elf64_link_output_symbol_hook (struct bfd_link_info *info, const char *cname, Elf_Internal_Sym *sym, - asection *input_sec ATTRIBUTE_UNUSED) + asection *input_sec ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED) { char *name = (char *) cname; diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 92609e2..4224310 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -65,7 +65,8 @@ static bfd_boolean sparc64_elf_add_symbol_hook const char **, flagword *, asection **, bfd_vma *)); static bfd_boolean sparc64_elf_output_arch_syms PARAMS ((bfd *, struct bfd_link_info *, PTR, - bfd_boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *))); + bfd_boolean (*) (PTR, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *))); static void sparc64_elf_symbol_processing PARAMS ((bfd *, asymbol *)); @@ -1502,7 +1503,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) return TRUE; } -/* This function takes care of emiting STT_REGISTER symbols +/* This function takes care of emitting STT_REGISTER symbols which we cannot easily keep in the symbol hash table. */ static bfd_boolean @@ -1511,7 +1512,8 @@ sparc64_elf_output_arch_syms (output_bfd, info, finfo, func) struct bfd_link_info *info; PTR finfo; bfd_boolean (*func) - PARAMS ((PTR, const char *, Elf_Internal_Sym *, asection *)); + PARAMS ((PTR, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *)); { int reg; struct sparc64_elf_app_reg *app_regs = @@ -1557,7 +1559,8 @@ sparc64_elf_output_arch_syms (output_bfd, info, finfo, func) sym.st_shndx = app_regs [reg].shndx; if (! (*func) (finfo, app_regs [reg].name, &sym, sym.st_shndx == SHN_ABS - ? bfd_abs_section_ptr : bfd_und_section_ptr)) + ? bfd_abs_section_ptr : bfd_und_section_ptr, + NULL)) return FALSE; } diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 4cfcba5..a688620 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -560,7 +560,8 @@ elf64_x86_64_copy_indirect_symbol (const struct elf_backend_data *bed, dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -578,14 +579,6 @@ elf64_x86_64_mkobject (bfd *abfd) static bfd_boolean elf64_x86_64_elf_object_p (bfd *abfd) { - /* Allocate our special target data. */ - struct elf64_x86_64_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata); - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; /* Set the right machine number for an x86-64 elf64 file. */ bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64); return TRUE; diff --git a/bfd/elflink.c b/bfd/elflink.c index 919de9c..f58a67a 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -117,7 +117,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) struct bfd_link_hash_entry *bh; const struct elf_backend_data *bed; - if (! is_elf_hash_table (info)) + if (! is_elf_hash_table (info->hash)) return FALSE; if (elf_hash_table (info)->dynamic_sections_created) @@ -144,8 +144,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) return FALSE; } - if (! info->traditional_format - && info->hash->creator->flavour == bfd_target_elf_flavour) + if (! info->traditional_format) { s = bfd_make_section (abfd, ".eh_frame_hdr"); if (s == NULL @@ -424,7 +423,7 @@ bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED, { struct elf_link_hash_entry *h; - if (info->hash->creator->flavour != bfd_target_elf_flavour) + if (!is_elf_hash_table (info->hash)) return TRUE; h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, TRUE, FALSE); @@ -494,7 +493,7 @@ elf_link_record_local_dynamic_symbol (struct bfd_link_info *info, Elf_External_Sym_Shndx eshndx; char esym[sizeof (Elf64_External_Sym)]; - if (! is_elf_hash_table (info)) + if (! is_elf_hash_table (info->hash)) return 0; /* See if the entry exists already. */ @@ -795,7 +794,7 @@ _bfd_elf_merge_symbol (bfd *abfd, else olddef = TRUE; - /* We need to rememeber if a symbol has a definition in a dynamic + /* We need to remember if a symbol has a definition in a dynamic object or is weak in all dynamic objects. Internal and hidden visibility will make it unavailable to dynamic objects. */ if (newdyn && (h->elf_link_hash_flags & ELF_LINK_DYNAMIC_DEF) == 0) @@ -858,7 +857,7 @@ _bfd_elf_merge_symbol (bfd *abfd, return TRUE; } - /* We need to treat weak definiton right, depending on if there is a + /* We need to treat weak definition right, depending on if there is a definition from a dynamic object. */ if (bind == STB_WEAK) { @@ -1127,7 +1126,7 @@ _bfd_elf_merge_symbol (bfd *abfd, h->size, abfd, bfd_link_hash_common, sym->st_size))) return FALSE; - /* If the predumed common symbol in the dynamic object is + /* If the presumed common symbol in the dynamic object is larger, pretend that the new symbol has its size. */ if (h->size > *pvalue) @@ -1257,7 +1256,7 @@ _bfd_elf_add_default_symbol (bfd *abfd, if (override) { - /* We are overridden by an old defition. We need to check if we + /* We are overridden by an old definition. We need to check if we need to create the indirect symbol from the default name. */ hi = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, FALSE, FALSE); @@ -1416,7 +1415,7 @@ nondefault: { /* Here SHORTNAME is a versioned name, so we don't expect to see the type of override we do in the case above unless it is - overridden by a versioned definiton. */ + overridden by a versioned definition. */ if (hi->root.type != bfd_link_hash_defined && hi->root.type != bfd_link_hash_defweak) (*_bfd_error_handler) @@ -2206,7 +2205,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, will force it local. */ if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0 && eif->info->shared - && is_elf_hash_table (eif->info) + && is_elf_hash_table (eif->info->hash) && (eif->info->symbolic || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) @@ -2276,7 +2275,7 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data) bfd *dynobj; const struct elf_backend_data *bed; - if (! is_elf_hash_table (eif->info)) + if (! is_elf_hash_table (eif->info->hash)) return FALSE; if (h->root.type == bfd_link_hash_warning) diff --git a/bfd/elflink.h b/bfd/elflink.h index 04df5d6..f558e1c 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -437,7 +437,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) /* You can't use -r against a dynamic object. Also, there's no hope of using a dynamic object which does not exactly match the format of the output file. */ - if (info->relocatable || info->hash->creator != abfd->xvec) + if (info->relocatable + || !is_elf_hash_table (hash_table) + || hash_table->root.creator != abfd->xvec) { bfd_set_error (bfd_error_invalid_operation); goto error_return; @@ -475,7 +477,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) fix is to keep track of what warnings we are supposed to emit, and then handle them all at the end of the link. */ - if (dynamic && abfd->xvec == info->hash->creator) + if (dynamic) { struct elf_link_hash_entry *h; @@ -531,15 +533,15 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) format. FIXME: If there are no input BFD's of the same format as the output, we can't make a shared library. */ if (info->shared - && is_elf_hash_table (info) - && ! hash_table->dynamic_sections_created - && abfd->xvec == info->hash->creator) + && is_elf_hash_table (hash_table) + && hash_table->root.creator == abfd->xvec + && ! hash_table->dynamic_sections_created) { if (! _bfd_elf_link_create_dynamic_sections (abfd, info)) goto error_return; } } - else if (! is_elf_hash_table (info)) + else if (!is_elf_hash_table (hash_table)) goto error_return; else { @@ -723,9 +725,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) /* If this is the first dynamic object found in the link, create the special sections required for dynamic linking. */ - if (! hash_table->dynamic_sections_created) - if (! _bfd_elf_link_create_dynamic_sections (abfd, info)) - goto error_return; + if (! _bfd_elf_link_create_dynamic_sections (abfd, info)) + goto error_return; if (add_needed) { @@ -875,7 +876,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { /* This should be impossible, since ELF requires that all global symbols follow all local symbols, and that sh_info - point to the first global symbol. Unfortunatealy, Irix 5 + point to the first global symbol. Unfortunately, Irix 5 screws this up. */ continue; } @@ -968,7 +969,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) old_alignment = 0; old_bfd = NULL; - if (info->hash->creator->flavour == bfd_target_elf_flavour) + if (is_elf_hash_table (hash_table)) { Elf_Internal_Versym iver; unsigned int vernum = 0; @@ -1131,7 +1132,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) && definition && (flags & BSF_WEAK) != 0 && ELF_ST_TYPE (isym->st_info) != STT_FUNC - && info->hash->creator->flavour == bfd_target_elf_flavour + && is_elf_hash_table (hash_table) && h->weakdef == NULL) { /* Keep a list of all weak defined non function symbols from @@ -1167,14 +1168,14 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) h->root.u.c.p->alignment_power = old_alignment; } - if (info->hash->creator->flavour == bfd_target_elf_flavour) + if (is_elf_hash_table (hash_table)) { int old_flags; bfd_boolean dynsym; int new_flag; /* Check the alignment when a common symbol is involved. This - can change when a common symbol is overriden by a normal + can change when a common symbol is overridden by a normal definition or a common symbol is ignored due to the old normal definition. We need to make sure the maximum alignment is maintained. */ @@ -1380,9 +1381,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) bfd_size_type oldsize; bfd_size_type strindex; - if (! is_elf_hash_table (info)) - goto error_free_vers; - /* The symbol from a DT_NEEDED object is referenced from the regular object to create a dynamic executable. We have to make sure there is a DT_NEEDED entry for it. */ @@ -1446,7 +1444,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) shortname[amt] = '\0'; hi = (struct elf_link_hash_entry *) - bfd_link_hash_lookup (info->hash, shortname, + bfd_link_hash_lookup (&hash_table->root, shortname, FALSE, FALSE, FALSE); if (hi != NULL && hi->root.type == h->root.type @@ -1573,7 +1571,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) different format. It probably can't be done. */ check_relocs = get_elf_backend_data (abfd)->check_relocs; if (! dynamic - && abfd->xvec == info->hash->creator + && is_elf_hash_table (hash_table) + && hash_table->root.creator == abfd->xvec && check_relocs != NULL) { asection *o; @@ -1609,8 +1608,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) of the .stab/.stabstr sections. */ if (! dynamic && ! info->traditional_format - && info->hash->creator->flavour == bfd_target_elf_flavour - && is_elf_hash_table (info) + && is_elf_hash_table (hash_table) && (info->strip != strip_all && info->strip != strip_debugger)) { asection *stabstr; @@ -1643,8 +1641,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } } - if (! info->relocatable && ! dynamic - && is_elf_hash_table (info)) + if (! info->relocatable + && ! dynamic + && is_elf_hash_table (hash_table)) { asection *s; @@ -1664,7 +1663,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } } - if (is_elf_hash_table (info)) + if (is_elf_hash_table (hash_table)) { /* Add this bfd to the loaded list. */ struct elf_link_loaded_list *n; @@ -1702,7 +1701,7 @@ elf_add_dynamic_entry (struct bfd_link_info *info, bfd_vma tag, bfd_vma val) bfd_size_type newsize; bfd_byte *newcontents; - if (! is_elf_hash_table (info)) + if (! is_elf_hash_table (info->hash)) return FALSE; dynobj = elf_hash_table (info)->dynobj; @@ -1832,7 +1831,7 @@ compute_bucket_count (struct bfd_link_info *info) # if 1 /* Variant 1: optimize for short chains. We add the squares - of all the chain lengths (which favous many small chain + of all the chain lengths (which favors many small chain over a few long chains). */ for (j = 0; j < i; ++j) max += counts[j] * counts[j]; @@ -1907,10 +1906,7 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, soname_indx = (bfd_size_type) -1; - if (info->hash->creator->flavour != bfd_target_elf_flavour) - return TRUE; - - if (! is_elf_hash_table (info)) + if (!is_elf_hash_table (info->hash)) return TRUE; if (info->execstack) @@ -2056,7 +2052,7 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, return FALSE; } - /* Make all global versions with definiton. */ + /* Make all global versions with definition. */ for (t = verdefs; t != NULL; t = t->next) for (d = t->globals.list; d != NULL; d = d->next) if (!d->symver && d->symbol) @@ -2121,7 +2117,7 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, if (!info->allow_undefined_version) { - /* Check if all global versions have a definiton. */ + /* Check if all global versions have a definition. */ all_defined = TRUE; for (t = verdefs; t != NULL; t = t->next) for (d = t->globals.list; d != NULL; d = d->next) @@ -2837,7 +2833,8 @@ struct elf_final_link_info }; static bfd_boolean elf_link_output_sym - (struct elf_final_link_info *, const char *, Elf_Internal_Sym *, asection *); + (struct elf_final_link_info *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *); static bfd_boolean elf_link_flush_output_syms (struct elf_final_link_info *); static bfd_boolean elf_link_output_extsym @@ -3112,7 +3109,7 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info) asection *reldyn = 0; bfd_size_type amt; - if (! is_elf_hash_table (info)) + if (! is_elf_hash_table (info->hash)) return FALSE; if (info->shared) @@ -3411,7 +3408,8 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info) elfsym.st_info = 0; elfsym.st_other = 0; elfsym.st_shndx = SHN_UNDEF; - if (! elf_link_output_sym (&finfo, NULL, &elfsym, bfd_und_section_ptr)) + if (! elf_link_output_sym (&finfo, NULL, &elfsym, bfd_und_section_ptr, + NULL)) goto error_return; } @@ -3427,7 +3425,7 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info) elfsym.st_other = 0; elfsym.st_shndx = SHN_ABS; if (! elf_link_output_sym (&finfo, bfd_get_filename (abfd), - &elfsym, bfd_abs_section_ptr)) + &elfsym, bfd_abs_section_ptr, NULL)) goto error_return; #endif @@ -3452,7 +3450,7 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info) elfsym.st_value = 0; else elfsym.st_value = o->vma; - if (! elf_link_output_sym (&finfo, NULL, &elfsym, o)) + if (! elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL)) goto error_return; if (i == SHN_LORESERVE - 1) i += SHN_HIRESERVE + 1 - SHN_LORESERVE; @@ -3706,7 +3704,8 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info) if (bed->elf_backend_output_arch_syms) { typedef bfd_boolean (*out_sym_func) - (void *, const char *, Elf_Internal_Sym *, asection *); + (void *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *); if (! ((*bed->elf_backend_output_arch_syms) (abfd, info, &finfo, (out_sym_func) elf_link_output_sym))) @@ -4090,20 +4089,20 @@ static bfd_boolean elf_link_output_sym (struct elf_final_link_info *finfo, const char *name, Elf_Internal_Sym *elfsym, - asection *input_sec) + asection *input_sec, + struct elf_link_hash_entry *h) { Elf_External_Sym *dest; Elf_External_Sym_Shndx *destshndx; bfd_boolean (*output_symbol_hook) - (bfd *, struct bfd_link_info *info, const char *, - Elf_Internal_Sym *, asection *); + (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *); output_symbol_hook = get_elf_backend_data (finfo->output_bfd)-> elf_backend_link_output_symbol_hook; if (output_symbol_hook != NULL) { - if (! ((*output_symbol_hook) - (finfo->output_bfd, finfo->info, name, elfsym, input_sec))) + if (! (*output_symbol_hook) (finfo->info, name, elfsym, input_sec, h)) return FALSE; } @@ -4188,7 +4187,7 @@ elf_link_check_versioned_symbol (struct bfd_link_info *info, bfd *abfd; struct elf_link_loaded_list *loaded; - if (info->hash->creator->flavour != bfd_target_elf_flavour) + if (!is_elf_hash_table (info->hash)) return FALSE; switch (h->root.type) @@ -4644,7 +4643,7 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) h->indx = bfd_get_symcount (finfo->output_bfd); - if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec)) + if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec, h)) { eoinfo->failed = TRUE; return FALSE; @@ -4849,7 +4848,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) } } - if (! elf_link_output_sym (finfo, name, &osym, isec)) + if (! elf_link_output_sym (finfo, name, &osym, isec, NULL)) return FALSE; } @@ -5211,7 +5210,8 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) finfo->indices[r_symndx] = bfd_get_symcount (output_bfd); - if (! elf_link_output_sym (finfo, name, &sym, sec)) + if (! elf_link_output_sym (finfo, name, &sym, sec, + NULL)) return FALSE; } @@ -5674,7 +5674,7 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *idxptr) return TRUE; } -/* Propogate collected vtable information. This is called through +/* Propagate collected vtable information. This is called through elf_link_hash_traverse. */ static bfd_boolean @@ -5797,7 +5797,9 @@ elf_gc_sections (bfd *abfd, struct bfd_link_info *info) struct elf_link_hash_entry *h, Elf_Internal_Sym *); if (!get_elf_backend_data (abfd)->can_gc_sections - || info->relocatable || info->emitrelocations + || info->relocatable + || info->emitrelocations + || !is_elf_hash_table (info->hash) || elf_hash_table (info)->dynamic_sections_created) return TRUE; @@ -5840,7 +5842,7 @@ elf_gc_sections (bfd *abfd, struct bfd_link_info *info) return TRUE; } -/* Called from check_relocs to record the existance of a VTINHERIT reloc. */ +/* Called from check_relocs to record the existence of a VTINHERIT reloc. */ bfd_boolean elf_gc_record_vtinherit (bfd *abfd, @@ -5896,7 +5898,7 @@ elf_gc_record_vtinherit (bfd *abfd, return TRUE; } -/* Called from check_relocs to record the existance of a VTENTRY reloc. */ +/* Called from check_relocs to record the existence of a VTENTRY reloc. */ bfd_boolean elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED, @@ -5973,6 +5975,9 @@ elf_gc_common_finalize_got_offsets (bfd *abfd, const struct elf_backend_data *bed = get_elf_backend_data (abfd); bfd_vma gotoff; + if (! is_elf_hash_table (info->hash)) + return FALSE; + /* The GOT offset is relative to the .got section, but the GOT header is put into the .got.plt section, if the backend uses it. */ if (bed->want_got_plt) @@ -6179,8 +6184,7 @@ elf_bfd_discard_info (bfd *output_bfd, struct bfd_link_info *info) bfd_boolean ret = FALSE; if (info->traditional_format - || info->hash->creator->flavour != bfd_target_elf_flavour - || ! is_elf_hash_table (info)) + || !is_elf_hash_table (info->hash)) return FALSE; for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next) diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index d944a46..49cf898 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -48,50 +48,49 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ecoffswap.h" static bfd_reloc_status_type mips_elf_generic_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_hi16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_lo16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_got16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_boolean mips_elf_assign_gp - PARAMS ((bfd *, bfd_vma *)); + (bfd *, bfd_vma *); static bfd_reloc_status_type mips_elf_final_gp - PARAMS ((bfd *, asymbol *, bfd_boolean, char **, bfd_vma *)); + (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *); static bfd_reloc_status_type mips_elf_gprel16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_literal_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_gprel32_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type gprel32_with_gp - PARAMS ((bfd *, asymbol *, arelent *, asection *, bfd_boolean, PTR, - bfd_vma)); + (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma); static bfd_reloc_status_type mips_elf_shift6_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_jump_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_gprel_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); + (bfd *, bfd_reloc_code_real_type); static reloc_howto_type *mips_elf_n32_rtype_to_howto - PARAMS ((unsigned int, bfd_boolean)); + (unsigned int, bfd_boolean); static void mips_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); static void mips_info_to_howto_rela - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); static bfd_boolean mips_elf_sym_is_global - PARAMS ((bfd *, asymbol *)); + (bfd *, asymbol *); static bfd_boolean mips_elf_n32_object_p - PARAMS ((bfd *)); + (bfd *); static bfd_boolean elf32_mips_grok_prstatus - PARAMS ((bfd *, Elf_Internal_Note *)); + (bfd *, Elf_Internal_Note *); static bfd_boolean elf32_mips_grok_psinfo - PARAMS ((bfd *, Elf_Internal_Note *)); + (bfd *, Elf_Internal_Note *); static irix_compat_t elf_n32_mips_irix_compat - PARAMS ((bfd *)); + (bfd *); extern const bfd_target bfd_elf32_nbigmips_vec; extern const bfd_target bfd_elf32_nlittlemips_vec; @@ -941,7 +940,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 64 bit substraction. */ + /* 64 bit subtraction. */ HOWTO (R_MIPS_SUB, /* type */ 0, /* rightshift */ 4, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1240,7 +1239,7 @@ static reloc_howto_type elf_mips_gnu_rela16_s2 = { \ /* If we're relocating, and this is an external symbol, we don't \ want to change anything. */ \ - if ((obfd) != (bfd *) NULL \ + if ((obfd) != NULL \ && ((sym)->flags & BSF_SECTION_SYM) == 0 \ && (! (entry)->howto->partial_inplace \ || (entry)->addend == 0)) \ @@ -1268,15 +1267,10 @@ static reloc_howto_type elf_mips_gnu_rela16_s2 = } static bfd_reloc_status_type -mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) @@ -1310,15 +1304,9 @@ struct mips_hi16 static struct mips_hi16 *mips_hi16_list; static bfd_reloc_status_type -mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data, asection *input_section, + bfd *output_bfd, char **error_message ATTRIBUTE_UNUSED) { bfd_reloc_status_type ret; bfd_vma relocation; @@ -1328,7 +1316,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, ret = bfd_reloc_ok; - if (bfd_is_und_section (symbol->section) && output_bfd == (bfd *) NULL) + if (bfd_is_und_section (symbol->section) && output_bfd == NULL) ret = bfd_reloc_undefined; if (bfd_is_com_section (symbol->section)) @@ -1344,7 +1332,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_outofrange; /* Save the information, and let LO16 do the actual relocation. */ - n = (struct mips_hi16 *) bfd_malloc ((bfd_size_type) sizeof *n); + n = bfd_malloc (sizeof *n); if (n == NULL) return bfd_reloc_outofrange; n->addr = (bfd_byte *) data + reloc_entry->address; @@ -1352,7 +1340,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, n->next = mips_hi16_list; mips_hi16_list = n; - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) reloc_entry->address += input_section->output_offset; return ret; @@ -1363,15 +1351,9 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, R_MIPS_HI16 relocation described above. */ static bfd_reloc_status_type -mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { if (mips_hi16_list != NULL) { @@ -1412,7 +1394,7 @@ mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section, insn &= ~ (bfd_vma) 0xffff; insn |= val; - bfd_put_32 (abfd, (bfd_vma) insn, l->addr); + bfd_put_32 (abfd, insn, l->addr); next = l->next; free (l); @@ -1442,19 +1424,13 @@ mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section, not yet know how to create global offset tables. */ static bfd_reloc_status_type -mips_elf_got16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { /* If we're relocating, and this is a local symbol, we can handle it just like an R_MIPS_HI16. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && ((symbol->flags & BSF_SECTION_SYM) != 0 || (symbol->flags & BSF_LOCAL) == 0)) return mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, @@ -1469,9 +1445,7 @@ mips_elf_got16_reloc (abfd, reloc_entry, symbol, data, input_section, dangerous relocation. */ static bfd_boolean -mips_elf_assign_gp (output_bfd, pgp) - bfd *output_bfd; - bfd_vma *pgp; +mips_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp) { unsigned int count; asymbol **sym; @@ -1487,7 +1461,7 @@ mips_elf_assign_gp (output_bfd, pgp) /* The linker script will have created a symbol named `_gp' with the appropriate value. */ - if (sym == (asymbol **) NULL) + if (sym == NULL) i = count; else { @@ -1523,12 +1497,8 @@ mips_elf_assign_gp (output_bfd, pgp) external symbol if we are producing relocatable output. */ static bfd_reloc_status_type -mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, pgp) - bfd *output_bfd; - asymbol *symbol; - bfd_boolean relocatable; - char **error_message; - bfd_vma *pgp; +mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable, + char **error_message, bfd_vma *pgp) { if (bfd_is_und_section (symbol->section) && ! relocatable) @@ -1563,15 +1533,10 @@ mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, pgp) become the offset from the gp register. */ static bfd_reloc_status_type -mips_elf_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf_gprel16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1579,7 +1544,7 @@ mips_elf_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1600,15 +1565,9 @@ mips_elf_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, /* Do a R_MIPS_LITERAL relocation. */ static bfd_reloc_status_type -mips_elf_literal_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1617,7 +1576,7 @@ mips_elf_literal_reloc (abfd, reloc_entry, symbol, data, input_section, GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */ - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1639,15 +1598,9 @@ mips_elf_literal_reloc (abfd, reloc_entry, symbol, data, input_section, become the offset from the gp register. */ static bfd_reloc_status_type -mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1656,7 +1609,7 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) /* R_MIPS_GPREL32 relocations are defined for local symbols only. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1665,7 +1618,7 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_outofrange; } - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) { relocatable = TRUE; gp = _bfd_get_gp_value (output_bfd); @@ -1686,15 +1639,9 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, } static bfd_reloc_status_type -gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocatable, data, - gp) - bfd *abfd; - asymbol *symbol; - arelent *reloc_entry; - asection *input_section; - bfd_boolean relocatable; - PTR data; - bfd_vma gp; +gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry, + asection *input_section, bfd_boolean relocatable, + void *data, bfd_vma gp) { bfd_vma relocation; unsigned long val; @@ -1725,7 +1672,7 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocatable, data, || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; - bfd_put_32 (abfd, (bfd_vma) val, (bfd_byte *) data + reloc_entry->address); + bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address); if (relocatable) reloc_entry->address += input_section->output_offset; @@ -1737,15 +1684,10 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocatable, data, the rest is at bits 6-10. The bitpos already got right by the howto. */ static bfd_reloc_status_type -mips_elf_shift6_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf_shift6_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) @@ -1763,15 +1705,10 @@ mips_elf_shift6_reloc (abfd, reloc_entry, symbol, data, input_section, /* Handle a mips16 jump. */ static bfd_reloc_status_type -mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { static bfd_boolean warned = FALSE; @@ -1790,15 +1727,9 @@ mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, /* Handle a mips16 GP relative reloc. */ static bfd_reloc_status_type -mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1857,13 +1788,10 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, if (reloc_entry->howto->partial_inplace) { bfd_put_16 (abfd, - (bfd_vma) ((extend & 0xf800) - | ((val >> 11) & 0x1f) - | (val & 0x7e0)), + (extend & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0), (bfd_byte *) data + reloc_entry->address); bfd_put_16 (abfd, - (bfd_vma) ((insn & 0xffe0) - | (val & 0x1f)), + (insn & 0xffe0) | (val & 0x1f), (bfd_byte *) data + reloc_entry->address + 2); } else @@ -1929,9 +1857,8 @@ static const struct elf_reloc_map mips_reloc_map[] = /* Given a BFD reloc type, return a howto structure. */ static reloc_howto_type * -bfd_elf32_bfd_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { unsigned int i; /* FIXME: We default to RELA here instead of choosing the right @@ -1966,9 +1893,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static reloc_howto_type * -mips_elf_n32_rtype_to_howto (r_type, rela_p) - unsigned int r_type; - bfd_boolean rela_p; +mips_elf_n32_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p) { switch (r_type) { @@ -1998,10 +1923,7 @@ mips_elf_n32_rtype_to_howto (r_type, rela_p) /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static void -mips_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) { unsigned int r_type; @@ -2021,10 +1943,8 @@ mips_info_to_howto_rel (abfd, cache_ptr, dst) /* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */ static void -mips_info_to_howto_rela (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +mips_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, Elf_Internal_Rela *dst) { unsigned int r_type; @@ -2040,9 +1960,7 @@ mips_info_to_howto_rela (abfd, cache_ptr, dst) and externally visible symbols. */ static bfd_boolean -mips_elf_sym_is_global (abfd, sym) - bfd *abfd ATTRIBUTE_UNUSED; - asymbol *sym; +mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym) { if (SGI_COMPAT (abfd)) return (sym->flags & BSF_SECTION_SYM) == 0; @@ -2055,8 +1973,7 @@ mips_elf_sym_is_global (abfd, sym) /* Set the right machine number for a MIPS ELF file. */ static bfd_boolean -mips_elf_n32_object_p (abfd) - bfd *abfd; +mips_elf_n32_object_p (bfd *abfd) { unsigned long mach; @@ -2077,9 +1994,7 @@ mips_elf_n32_object_p (abfd) /* Support for core dump NOTE sections. */ static bfd_boolean -elf32_mips_grok_prstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; unsigned int raw_size; @@ -2109,9 +2024,7 @@ elf32_mips_grok_prstatus (abfd, note) } static bfd_boolean -elf32_mips_grok_psinfo (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) { switch (note->descsz) { @@ -2143,8 +2056,7 @@ elf32_mips_grok_psinfo (abfd, note) /* Depending on the target vector we generate some version of Irix executables or "normal" MIPS ELF ABI executables. */ static irix_compat_t -elf_n32_mips_irix_compat (abfd) - bfd *abfd; +elf_n32_mips_irix_compat (bfd *abfd) { if ((abfd->xvec == &bfd_elf32_nbigmips_vec) || (abfd->xvec == &bfd_elf32_nlittlemips_vec)) diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 24d6079..aba571a 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -53,7 +53,7 @@ descriptor for a MIN_PLT entry, and requires one IPLT reloc. MIN_PLT Created by PLTOFF entries against dynamic symbols. This - does not reqire dynamic relocations. */ + does not require dynamic relocations. */ #define NELEMS(a) ((int) (sizeof (a) / sizeof ((a)[0]))) @@ -81,7 +81,7 @@ struct elfNN_ia64_dyn_sym_info bfd_vma dtpmod_offset; bfd_vma dtprel_offset; - /* The symbol table entry, if any, that this was derrived from. */ + /* The symbol table entry, if any, that this was derived from. */ struct elf_link_hash_entry *h; /* Used to count non-got, non-plt relocations for delayed sizing @@ -194,7 +194,7 @@ static bfd_boolean elfNN_ia64_add_symbol_hook static int elfNN_ia64_additional_program_headers PARAMS ((bfd *abfd)); static bfd_boolean elfNN_ia64_modify_segment_map - PARAMS ((bfd *)); + PARAMS ((bfd *, struct bfd_link_info *)); static bfd_boolean elfNN_ia64_is_local_label_name PARAMS ((bfd *abfd, const char *name)); static bfd_boolean elfNN_ia64_dynamic_symbol_p @@ -707,14 +707,14 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) *again = FALSE; /* Don't even try to relax for non-ELF outputs. */ - if (link_info->hash->creator->flavour != bfd_target_elf_flavour) + if (!is_elf_hash_table (link_info->hash)) return FALSE; /* Nothing to do if there are no relocations or there is no need for the relax finalize pass. */ if ((sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 - || (link_info->relax_finalizing + || (!link_info->need_relax_finalize && sec->need_finalize_relax == 0)) return TRUE; @@ -765,14 +765,14 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) case R_IA64_PCREL21BI: case R_IA64_PCREL21M: case R_IA64_PCREL21F: - if (link_info->relax_finalizing) + if (!link_info->need_relax_finalize) continue; is_branch = TRUE; break; case R_IA64_LTOFF22X: case R_IA64_LDXMOV: - if (!link_info->relax_finalizing) + if (link_info->need_relax_finalize) { sec->need_finalize_relax = 1; continue; @@ -804,7 +804,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) isym = isymbuf + ELFNN_R_SYM (irel->r_info); if (isym->st_shndx == SHN_UNDEF) - continue; /* We can't do anthing with undefined symbols. */ + continue; /* We can't do anything with undefined symbols. */ else if (isym->st_shndx == SHN_ABS) tsec = bfd_abs_section_ptr; else if (isym->st_shndx == SHN_COMMON) @@ -852,7 +852,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) else { - /* We can't do anthing with undefined symbols. */ + /* We can't do anything with undefined symbols. */ if (h->root.type == bfd_link_hash_undefined || h->root.type == bfd_link_hash_undefweak) continue; @@ -1073,7 +1073,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) /* ??? Resize .rela.got too. */ } - if (link_info->relax_finalizing) + if (!link_info->need_relax_finalize) sec->need_finalize_relax = 0; *again = changed_contents || changed_relocs; @@ -1405,8 +1405,9 @@ elfNN_ia64_additional_program_headers (abfd) } static bfd_boolean -elfNN_ia64_modify_segment_map (abfd) +elfNN_ia64_modify_segment_map (abfd, info) bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; { struct elf_segment_map *m, **pm; Elf_Internal_Shdr *hdr; @@ -1592,7 +1593,8 @@ elfNN_ia64_hash_copy_indirect (bed, xdir, xind) (ind->root.elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); if (ind->root.root.type != bfd_link_hash_indirect) return; @@ -1952,7 +1954,7 @@ get_got (abfd, info, ia64_info) } /* Create function descriptor section (.opd). This section is called .opd - because it contains "official prodecure descriptors". The "official" + because it contains "official procedure descriptors". The "official" refers to the fact that these descriptors are used when taking the address of a procedure, thus ensuring a unique address for each procedure. */ @@ -1992,9 +1994,9 @@ get_fptr (abfd, info, ia64_info) if (info->pie) { asection *fptr_rel; - fptr_rel = bfd_make_section(abfd, ".rela.opd"); + fptr_rel = bfd_make_section(dynobj, ".rela.opd"); if (fptr_rel == NULL - || !bfd_set_section_flags (abfd, fptr_rel, + || !bfd_set_section_flags (dynobj, fptr_rel, (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY @@ -2927,6 +2929,15 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info) if (strip) ia64_info->fptr_sec = NULL; } + else if (sec == ia64_info->rel_fptr_sec) + { + if (strip) + ia64_info->rel_fptr_sec = NULL; + else + /* We use the reloc_count field as a counter if we need to + copy relocs into the output file. */ + sec->reloc_count = 0; + } else if (sec == ia64_info->plt_sec) { if (strip) diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index b545683..1af0f98 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -370,114 +370,137 @@ typedef struct runtime_pdr { #define rpdNil ((pRPDR) 0) static struct bfd_hash_entry *mips_elf_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); static void ecoff_swap_rpdr_out - PARAMS ((bfd *, const RPDR *, struct rpdr_ext *)); + (bfd *, const RPDR *, struct rpdr_ext *); static bfd_boolean mips_elf_create_procedure_table - PARAMS ((PTR, bfd *, struct bfd_link_info *, asection *, - struct ecoff_debug_info *)); + (void *, bfd *, struct bfd_link_info *, asection *, + struct ecoff_debug_info *); static bfd_boolean mips_elf_check_mips16_stubs - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); + (struct mips_elf_link_hash_entry *, void *); static void bfd_mips_elf32_swap_gptab_in - PARAMS ((bfd *, const Elf32_External_gptab *, Elf32_gptab *)); + (bfd *, const Elf32_External_gptab *, Elf32_gptab *); static void bfd_mips_elf32_swap_gptab_out - PARAMS ((bfd *, const Elf32_gptab *, Elf32_External_gptab *)); + (bfd *, const Elf32_gptab *, Elf32_External_gptab *); static void bfd_elf32_swap_compact_rel_out - PARAMS ((bfd *, const Elf32_compact_rel *, Elf32_External_compact_rel *)); + (bfd *, const Elf32_compact_rel *, Elf32_External_compact_rel *); static void bfd_elf32_swap_crinfo_out - PARAMS ((bfd *, const Elf32_crinfo *, Elf32_External_crinfo *)); + (bfd *, const Elf32_crinfo *, Elf32_External_crinfo *); static int sort_dynamic_relocs - PARAMS ((const void *, const void *)); + (const void *, const void *); static int sort_dynamic_relocs_64 - PARAMS ((const void *, const void *)); + (const void *, const void *); static bfd_boolean mips_elf_output_extsym - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); -static int gptab_compare PARAMS ((const void *, const void *)); -static asection * mips_elf_rel_dyn_section PARAMS ((bfd *, bfd_boolean)); -static asection * mips_elf_got_section PARAMS ((bfd *, bfd_boolean)); + (struct mips_elf_link_hash_entry *, void *); +static int gptab_compare + (const void *, const void *); +static asection *mips_elf_rel_dyn_section + (bfd *, bfd_boolean); +static asection *mips_elf_got_section + (bfd *, bfd_boolean); static struct mips_got_info *mips_elf_got_info - PARAMS ((bfd *, asection **)); -static long mips_elf_get_global_gotsym_index PARAMS ((bfd *abfd)); + (bfd *, asection **); +static long mips_elf_get_global_gotsym_index + (bfd *abfd); static bfd_vma mips_elf_local_got_index - PARAMS ((bfd *, bfd *, struct bfd_link_info *, bfd_vma)); + (bfd *, bfd *, struct bfd_link_info *, bfd_vma); static bfd_vma mips_elf_global_got_index - PARAMS ((bfd *, bfd *, struct elf_link_hash_entry *)); + (bfd *, bfd *, struct elf_link_hash_entry *); static bfd_vma mips_elf_got_page - PARAMS ((bfd *, bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *)); + (bfd *, bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *); static bfd_vma mips_elf_got16_entry - PARAMS ((bfd *, bfd *, struct bfd_link_info *, bfd_vma, bfd_boolean)); + (bfd *, bfd *, struct bfd_link_info *, bfd_vma, bfd_boolean); static bfd_vma mips_elf_got_offset_from_index - PARAMS ((bfd *, bfd *, bfd *, bfd_vma)); + (bfd *, bfd *, bfd *, bfd_vma); static struct mips_got_entry *mips_elf_create_local_got_entry - PARAMS ((bfd *, bfd *, struct mips_got_info *, asection *, bfd_vma)); + (bfd *, bfd *, struct mips_got_info *, asection *, bfd_vma); static bfd_boolean mips_elf_sort_hash_table - PARAMS ((struct bfd_link_info *, unsigned long)); + (struct bfd_link_info *, unsigned long); static bfd_boolean mips_elf_sort_hash_table_f - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); + (struct mips_elf_link_hash_entry *, void *); static bfd_boolean mips_elf_record_local_got_symbol - PARAMS ((bfd *, long, bfd_vma, struct mips_got_info *)); + (bfd *, long, bfd_vma, struct mips_got_info *); static bfd_boolean mips_elf_record_global_got_symbol - PARAMS ((struct elf_link_hash_entry *, bfd *, struct bfd_link_info *, - struct mips_got_info *)); + (struct elf_link_hash_entry *, bfd *, struct bfd_link_info *, + struct mips_got_info *); static const Elf_Internal_Rela *mips_elf_next_relocation - PARAMS ((bfd *, unsigned int, const Elf_Internal_Rela *, - const Elf_Internal_Rela *)); + (bfd *, unsigned int, const Elf_Internal_Rela *, const Elf_Internal_Rela *); static bfd_boolean mips_elf_local_relocation_p - PARAMS ((bfd *, const Elf_Internal_Rela *, asection **, bfd_boolean)); -static bfd_boolean mips_elf_overflow_p PARAMS ((bfd_vma, int)); -static bfd_vma mips_elf_high PARAMS ((bfd_vma)); -static bfd_vma mips_elf_higher PARAMS ((bfd_vma)); -static bfd_vma mips_elf_highest PARAMS ((bfd_vma)); + (bfd *, const Elf_Internal_Rela *, asection **, bfd_boolean); +static bfd_boolean mips_elf_overflow_p + (bfd_vma, int); +static bfd_vma mips_elf_high + (bfd_vma); +static bfd_vma mips_elf_higher + (bfd_vma); +static bfd_vma mips_elf_highest + (bfd_vma); static bfd_boolean mips_elf_create_compact_rel_section - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); static bfd_boolean mips_elf_create_got_section - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean)); + (bfd *, struct bfd_link_info *, bfd_boolean); static bfd_reloc_status_type mips_elf_calculate_relocation - PARAMS ((bfd *, bfd *, asection *, struct bfd_link_info *, - const Elf_Internal_Rela *, bfd_vma, reloc_howto_type *, - Elf_Internal_Sym *, asection **, bfd_vma *, const char **, - bfd_boolean *, bfd_boolean)); + (bfd *, bfd *, asection *, struct bfd_link_info *, + const Elf_Internal_Rela *, bfd_vma, reloc_howto_type *, + Elf_Internal_Sym *, asection **, bfd_vma *, const char **, + bfd_boolean *, bfd_boolean); static bfd_vma mips_elf_obtain_contents - PARAMS ((reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *)); + (reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *); static bfd_boolean mips_elf_perform_relocation - PARAMS ((struct bfd_link_info *, reloc_howto_type *, - const Elf_Internal_Rela *, bfd_vma, bfd *, asection *, bfd_byte *, - bfd_boolean)); + (struct bfd_link_info *, reloc_howto_type *, const Elf_Internal_Rela *, + bfd_vma, bfd *, asection *, bfd_byte *, bfd_boolean); static bfd_boolean mips_elf_stub_section_p - PARAMS ((bfd *, asection *)); + (bfd *, asection *); static void mips_elf_allocate_dynamic_relocations - PARAMS ((bfd *, unsigned int)); + (bfd *, unsigned int); static bfd_boolean mips_elf_create_dynamic_relocation - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Rela *, - struct mips_elf_link_hash_entry *, asection *, - bfd_vma, bfd_vma *, asection *)); -static void mips_set_isa_flags PARAMS ((bfd *)); -static INLINE char* elf_mips_abi_name PARAMS ((bfd *)); + (bfd *, struct bfd_link_info *, const Elf_Internal_Rela *, + struct mips_elf_link_hash_entry *, asection *, bfd_vma, + bfd_vma *, asection *); +static void mips_set_isa_flags + (bfd *); +static INLINE char *elf_mips_abi_name + (bfd *); static void mips_elf_irix6_finish_dynamic_symbol - PARAMS ((bfd *, const char *, Elf_Internal_Sym *)); -static bfd_boolean mips_mach_extends_p PARAMS ((unsigned long, unsigned long)); -static bfd_boolean mips_32bit_flags_p PARAMS ((flagword)); -static INLINE hashval_t mips_elf_hash_bfd_vma PARAMS ((bfd_vma)); -static hashval_t mips_elf_got_entry_hash PARAMS ((const PTR)); -static int mips_elf_got_entry_eq PARAMS ((const PTR, const PTR)); + (bfd *, const char *, Elf_Internal_Sym *); +static bfd_boolean mips_mach_extends_p + (unsigned long, unsigned long); +static bfd_boolean mips_32bit_flags_p + (flagword); +static INLINE hashval_t mips_elf_hash_bfd_vma + (bfd_vma); +static hashval_t mips_elf_got_entry_hash + (const void *); +static int mips_elf_got_entry_eq + (const void *, const void *); static bfd_boolean mips_elf_multi_got - PARAMS ((bfd *, struct bfd_link_info *, struct mips_got_info *, - asection *, bfd_size_type)); -static hashval_t mips_elf_multi_got_entry_hash PARAMS ((const PTR)); -static int mips_elf_multi_got_entry_eq PARAMS ((const PTR, const PTR)); -static hashval_t mips_elf_bfd2got_entry_hash PARAMS ((const PTR)); -static int mips_elf_bfd2got_entry_eq PARAMS ((const PTR, const PTR)); -static int mips_elf_make_got_per_bfd PARAMS ((void **, void *)); -static int mips_elf_merge_gots PARAMS ((void **, void *)); -static int mips_elf_set_global_got_offset PARAMS ((void**, void *)); -static int mips_elf_resolve_final_got_entry PARAMS ((void**, void *)); + (bfd *, struct bfd_link_info *, struct mips_got_info *, + asection *, bfd_size_type); +static hashval_t mips_elf_multi_got_entry_hash + (const void *); +static int mips_elf_multi_got_entry_eq + (const void *, const void *); +static hashval_t mips_elf_bfd2got_entry_hash + (const void *); +static int mips_elf_bfd2got_entry_eq + (const void *, const void *); +static int mips_elf_make_got_per_bfd + (void **, void *); +static int mips_elf_merge_gots + (void **, void *); +static int mips_elf_set_global_got_offset + (void **, void *); +static int mips_elf_set_no_stub + (void **, void *); +static int mips_elf_resolve_final_got_entry + (void **, void *); static void mips_elf_resolve_final_got_entries - PARAMS ((struct mips_got_info *)); + (struct mips_got_info *); static bfd_vma mips_elf_adjust_gp - PARAMS ((bfd *, struct mips_got_info *, bfd *)); + (bfd *, struct mips_got_info *, bfd *); static struct mips_got_info *mips_elf_got_for_ibfd - PARAMS ((struct mips_got_info *, bfd *)); + (struct mips_got_info *, bfd *); /* This will be used when we sort the dynamic relocation records. */ static bfd *reldyn_sorting_bfd; @@ -542,15 +565,15 @@ static bfd *reldyn_sorting_bfd; /* Add a dynamic symbol table-entry. */ #ifdef BFD64 -#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ - (ABI_64_P (elf_hash_table (info)->dynobj) \ - ? bfd_elf64_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val) \ - : bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val)) +#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ + (ABI_64_P (elf_hash_table (info)->dynobj) \ + ? bfd_elf64_add_dynamic_entry (info, tag, val) \ + : bfd_elf32_add_dynamic_entry (info, tag, val)) #else -#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ - (ABI_64_P (elf_hash_table (info)->dynobj) \ - ? (abort (), FALSE) \ - : bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val)) +#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ + (ABI_64_P (elf_hash_table (info)->dynobj) \ + ? (abort (), FALSE) \ + : bfd_elf32_add_dynamic_entry (info, tag, val)) #endif #define MIPS_ELF_RTYPE_TO_HOWTO(abfd, rtype, rela) \ @@ -680,7 +703,7 @@ static bfd *reldyn_sorting_bfd; #define mips_elf_link_hash_traverse(table, func, info) \ (elf_link_hash_traverse \ (&(table)->root, \ - (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ + (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \ (info))) /* Get the MIPS ELF linker hash table from a link_info structure. */ @@ -691,28 +714,24 @@ static bfd *reldyn_sorting_bfd; /* Create an entry in a MIPS ELF linker hash table. */ static struct bfd_hash_entry * -mips_elf_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +mips_elf_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, const char *string) { struct mips_elf_link_hash_entry *ret = (struct mips_elf_link_hash_entry *) entry; /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct mips_elf_link_hash_entry *) NULL) - ret = ((struct mips_elf_link_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct mips_elf_link_hash_entry))); - if (ret == (struct mips_elf_link_hash_entry *) NULL) + if (ret == NULL) + ret = bfd_hash_allocate (table, sizeof (struct mips_elf_link_hash_entry)); + if (ret == NULL) return (struct bfd_hash_entry *) ret; /* Call the allocation method of the superclass. */ ret = ((struct mips_elf_link_hash_entry *) _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); - if (ret != (struct mips_elf_link_hash_entry *) NULL) + if (ret != NULL) { /* Set local fields. */ memset (&ret->esym, 0, sizeof (EXTR)); @@ -733,17 +752,15 @@ mips_elf_link_hash_newfunc (entry, table, string) } bfd_boolean -_bfd_mips_elf_new_section_hook (abfd, sec) - bfd *abfd; - asection *sec; +_bfd_mips_elf_new_section_hook (bfd *abfd, asection *sec) { struct _mips_elf_section_data *sdata; bfd_size_type amt = sizeof (*sdata); - sdata = (struct _mips_elf_section_data *) bfd_zalloc (abfd, amt); + sdata = bfd_zalloc (abfd, amt); if (sdata == NULL) return FALSE; - sec->used_by_bfd = (PTR) sdata; + sec->used_by_bfd = sdata; return _bfd_elf_new_section_hook (abfd, sec); } @@ -752,23 +769,21 @@ _bfd_mips_elf_new_section_hook (abfd, sec) ecoff_debug_info structure. */ bfd_boolean -_bfd_mips_elf_read_ecoff_info (abfd, section, debug) - bfd *abfd; - asection *section; - struct ecoff_debug_info *debug; +_bfd_mips_elf_read_ecoff_info (bfd *abfd, asection *section, + struct ecoff_debug_info *debug) { HDRR *symhdr; const struct ecoff_debug_swap *swap; - char *ext_hdr = NULL; + char *ext_hdr; swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; memset (debug, 0, sizeof (*debug)); - ext_hdr = (char *) bfd_malloc (swap->external_hdr_size); + ext_hdr = bfd_malloc (swap->external_hdr_size); if (ext_hdr == NULL && swap->external_hdr_size != 0) goto error_return; - if (! bfd_get_section_contents (abfd, section, ext_hdr, (file_ptr) 0, + if (! bfd_get_section_contents (abfd, section, ext_hdr, 0, swap->external_hdr_size)) goto error_return; @@ -783,26 +798,26 @@ _bfd_mips_elf_read_ecoff_info (abfd, section, debug) else \ { \ bfd_size_type amt = (bfd_size_type) size * symhdr->count; \ - debug->ptr = (type) bfd_malloc (amt); \ + debug->ptr = bfd_malloc (amt); \ if (debug->ptr == NULL) \ goto error_return; \ - if (bfd_seek (abfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \ + if (bfd_seek (abfd, symhdr->offset, SEEK_SET) != 0 \ || bfd_bread (debug->ptr, amt, abfd) != amt) \ goto error_return; \ } READ (line, cbLineOffset, cbLine, sizeof (unsigned char), unsigned char *); - READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, PTR); - READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, PTR); - READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, PTR); - READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, PTR); + READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, void *); + READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, void *); + READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, void *); + READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, void *); READ (external_aux, cbAuxOffset, iauxMax, sizeof (union aux_ext), union aux_ext *); READ (ss, cbSsOffset, issMax, sizeof (char), char *); READ (ssext, cbSsExtOffset, issExtMax, sizeof (char), char *); - READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, PTR); - READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, PTR); - READ (external_ext, cbExtOffset, iextMax, swap->external_ext_size, PTR); + READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, void *); + READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, void *); + READ (external_ext, cbExtOffset, iextMax, swap->external_ext_size, void *); #undef READ debug->fdr = NULL; @@ -841,10 +856,7 @@ _bfd_mips_elf_read_ecoff_info (abfd, section, debug) /* Swap RPDR (runtime procedure table entry) for output. */ static void -ecoff_swap_rpdr_out (abfd, in, ex) - bfd *abfd; - const RPDR *in; - struct rpdr_ext *ex; +ecoff_swap_rpdr_out (bfd *abfd, const RPDR *in, struct rpdr_ext *ex) { H_PUT_S32 (abfd, in->adr, ex->p_adr); H_PUT_32 (abfd, in->regmask, ex->p_regmask); @@ -865,18 +877,15 @@ ecoff_swap_rpdr_out (abfd, in, ex) /* Create a runtime procedure table from the .mdebug section. */ static bfd_boolean -mips_elf_create_procedure_table (handle, abfd, info, s, debug) - PTR handle; - bfd *abfd; - struct bfd_link_info *info; - asection *s; - struct ecoff_debug_info *debug; +mips_elf_create_procedure_table (void *handle, bfd *abfd, + struct bfd_link_info *info, asection *s, + struct ecoff_debug_info *debug) { const struct ecoff_debug_swap *swap; HDRR *hdr = &debug->symbolic_header; RPDR *rpdr, *rp; struct rpdr_ext *erp; - PTR rtproc; + void *rtproc; struct pdr_ext *epdr; struct sym_ext *esym; char *ss, **sv; @@ -903,44 +912,44 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug) { size = swap->external_pdr_size; - epdr = (struct pdr_ext *) bfd_malloc (size * count); + epdr = bfd_malloc (size * count); if (epdr == NULL) goto error_return; - if (! _bfd_ecoff_get_accumulated_pdr (handle, (PTR) epdr)) + if (! _bfd_ecoff_get_accumulated_pdr (handle, (bfd_byte *) epdr)) goto error_return; size = sizeof (RPDR); - rp = rpdr = (RPDR *) bfd_malloc (size * count); + rp = rpdr = bfd_malloc (size * count); if (rpdr == NULL) goto error_return; size = sizeof (char *); - sv = (char **) bfd_malloc (size * count); + sv = bfd_malloc (size * count); if (sv == NULL) goto error_return; count = hdr->isymMax; size = swap->external_sym_size; - esym = (struct sym_ext *) bfd_malloc (size * count); + esym = bfd_malloc (size * count); if (esym == NULL) goto error_return; - if (! _bfd_ecoff_get_accumulated_sym (handle, (PTR) esym)) + if (! _bfd_ecoff_get_accumulated_sym (handle, (bfd_byte *) esym)) goto error_return; count = hdr->issMax; - ss = (char *) bfd_malloc (count); + ss = bfd_malloc (count); if (ss == NULL) goto error_return; - if (! _bfd_ecoff_get_accumulated_ss (handle, (PTR) ss)) + if (! _bfd_ecoff_get_accumulated_ss (handle, ss)) goto error_return; count = hdr->ipdMax; for (i = 0; i < (unsigned long) count; i++, rp++) { - (*swap->swap_pdr_in) (abfd, (PTR) (epdr + i), &pdr); - (*swap->swap_sym_in) (abfd, (PTR) &esym[pdr.isym], &sym); + (*swap->swap_pdr_in) (abfd, epdr + i, &pdr); + (*swap->swap_sym_in) (abfd, &esym[pdr.isym], &sym); rp->adr = sym.value; rp->regmask = pdr.regmask; rp->regoffset = pdr.regoffset; @@ -957,7 +966,7 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug) size = sizeof (struct rpdr_ext) * (count + 2) + sindex; size = BFD_ALIGN (size, 16); - rtproc = (PTR) bfd_alloc (abfd, size); + rtproc = bfd_alloc (abfd, size); if (rtproc == NULL) { mips_elf_hash_table (info)->procedure_count = 0; @@ -966,7 +975,7 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug) mips_elf_hash_table (info)->procedure_count = count + 2; - erp = (struct rpdr_ext *) rtproc; + erp = rtproc; memset (erp, 0, sizeof (struct rpdr_ext)); erp++; str = (char *) rtproc + sizeof (struct rpdr_ext) * (count + 2); @@ -982,11 +991,11 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug) /* Set the size and contents of .rtproc section. */ s->_raw_size = size; - s->contents = (bfd_byte *) rtproc; + s->contents = rtproc; /* Skip this section later on (I don't think this currently matters, but someday it might). */ - s->link_order_head = (struct bfd_link_order *) NULL; + s->link_order_head = NULL; if (epdr != NULL) free (epdr); @@ -1019,9 +1028,8 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug) discard them. */ static bfd_boolean -mips_elf_check_mips16_stubs (h, data) - struct mips_elf_link_hash_entry *h; - PTR data ATTRIBUTE_UNUSED; +mips_elf_check_mips16_stubs (struct mips_elf_link_hash_entry *h, + void *data ATTRIBUTE_UNUSED) { if (h->root.root.type == bfd_link_hash_warning) h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; @@ -1069,15 +1077,9 @@ mips_elf_check_mips16_stubs (h, data) } bfd_reloc_status_type -_bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, input_section, - relocatable, data, gp) - bfd *abfd; - asymbol *symbol; - arelent *reloc_entry; - asection *input_section; - bfd_boolean relocatable; - PTR data; - bfd_vma gp; +_bfd_mips_elf_gprel16_with_gp (bfd *abfd, asymbol *symbol, + arelent *reloc_entry, asection *input_section, + bfd_boolean relocatable, void *data, bfd_vma gp) { bfd_vma relocation; unsigned long insn = 0; @@ -1115,8 +1117,7 @@ _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, input_section, if (reloc_entry->howto->partial_inplace) { insn = (insn & ~0xffff) | (val & 0xffff); - bfd_put_32 (abfd, (bfd_vma) insn, - (bfd_byte *) data + reloc_entry->address); + bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); } else reloc_entry->addend = val; @@ -1133,30 +1134,24 @@ _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, input_section, on the equivalence of the two elements of the union. */ static void -bfd_mips_elf32_swap_gptab_in (abfd, ex, in) - bfd *abfd; - const Elf32_External_gptab *ex; - Elf32_gptab *in; +bfd_mips_elf32_swap_gptab_in (bfd *abfd, const Elf32_External_gptab *ex, + Elf32_gptab *in) { in->gt_entry.gt_g_value = H_GET_32 (abfd, ex->gt_entry.gt_g_value); in->gt_entry.gt_bytes = H_GET_32 (abfd, ex->gt_entry.gt_bytes); } static void -bfd_mips_elf32_swap_gptab_out (abfd, in, ex) - bfd *abfd; - const Elf32_gptab *in; - Elf32_External_gptab *ex; +bfd_mips_elf32_swap_gptab_out (bfd *abfd, const Elf32_gptab *in, + Elf32_External_gptab *ex) { H_PUT_32 (abfd, in->gt_entry.gt_g_value, ex->gt_entry.gt_g_value); H_PUT_32 (abfd, in->gt_entry.gt_bytes, ex->gt_entry.gt_bytes); } static void -bfd_elf32_swap_compact_rel_out (abfd, in, ex) - bfd *abfd; - const Elf32_compact_rel *in; - Elf32_External_compact_rel *ex; +bfd_elf32_swap_compact_rel_out (bfd *abfd, const Elf32_compact_rel *in, + Elf32_External_compact_rel *ex) { H_PUT_32 (abfd, in->id1, ex->id1); H_PUT_32 (abfd, in->num, ex->num); @@ -1167,10 +1162,8 @@ bfd_elf32_swap_compact_rel_out (abfd, in, ex) } static void -bfd_elf32_swap_crinfo_out (abfd, in, ex) - bfd *abfd; - const Elf32_crinfo *in; - Elf32_External_crinfo *ex; +bfd_elf32_swap_crinfo_out (bfd *abfd, const Elf32_crinfo *in, + Elf32_External_crinfo *ex) { unsigned long l; @@ -1188,10 +1181,8 @@ bfd_elf32_swap_crinfo_out (abfd, in, ex) BFD, so they are globally visible. */ void -bfd_mips_elf32_swap_reginfo_in (abfd, ex, in) - bfd *abfd; - const Elf32_External_RegInfo *ex; - Elf32_RegInfo *in; +bfd_mips_elf32_swap_reginfo_in (bfd *abfd, const Elf32_External_RegInfo *ex, + Elf32_RegInfo *in) { in->ri_gprmask = H_GET_32 (abfd, ex->ri_gprmask); in->ri_cprmask[0] = H_GET_32 (abfd, ex->ri_cprmask[0]); @@ -1202,10 +1193,8 @@ bfd_mips_elf32_swap_reginfo_in (abfd, ex, in) } void -bfd_mips_elf32_swap_reginfo_out (abfd, in, ex) - bfd *abfd; - const Elf32_RegInfo *in; - Elf32_External_RegInfo *ex; +bfd_mips_elf32_swap_reginfo_out (bfd *abfd, const Elf32_RegInfo *in, + Elf32_External_RegInfo *ex) { H_PUT_32 (abfd, in->ri_gprmask, ex->ri_gprmask); H_PUT_32 (abfd, in->ri_cprmask[0], ex->ri_cprmask[0]); @@ -1222,10 +1211,8 @@ bfd_mips_elf32_swap_reginfo_out (abfd, in, ex) without worrying about whether the 64 bit ABI has been included. */ void -bfd_mips_elf64_swap_reginfo_in (abfd, ex, in) - bfd *abfd; - const Elf64_External_RegInfo *ex; - Elf64_Internal_RegInfo *in; +bfd_mips_elf64_swap_reginfo_in (bfd *abfd, const Elf64_External_RegInfo *ex, + Elf64_Internal_RegInfo *in) { in->ri_gprmask = H_GET_32 (abfd, ex->ri_gprmask); in->ri_pad = H_GET_32 (abfd, ex->ri_pad); @@ -1237,10 +1224,8 @@ bfd_mips_elf64_swap_reginfo_in (abfd, ex, in) } void -bfd_mips_elf64_swap_reginfo_out (abfd, in, ex) - bfd *abfd; - const Elf64_Internal_RegInfo *in; - Elf64_External_RegInfo *ex; +bfd_mips_elf64_swap_reginfo_out (bfd *abfd, const Elf64_Internal_RegInfo *in, + Elf64_External_RegInfo *ex) { H_PUT_32 (abfd, in->ri_gprmask, ex->ri_gprmask); H_PUT_32 (abfd, in->ri_pad, ex->ri_pad); @@ -1254,10 +1239,8 @@ bfd_mips_elf64_swap_reginfo_out (abfd, in, ex) /* Swap in an options header. */ void -bfd_mips_elf_swap_options_in (abfd, ex, in) - bfd *abfd; - const Elf_External_Options *ex; - Elf_Internal_Options *in; +bfd_mips_elf_swap_options_in (bfd *abfd, const Elf_External_Options *ex, + Elf_Internal_Options *in) { in->kind = H_GET_8 (abfd, ex->kind); in->size = H_GET_8 (abfd, ex->size); @@ -1268,10 +1251,8 @@ bfd_mips_elf_swap_options_in (abfd, ex, in) /* Swap out an options header. */ void -bfd_mips_elf_swap_options_out (abfd, in, ex) - bfd *abfd; - const Elf_Internal_Options *in; - Elf_External_Options *ex; +bfd_mips_elf_swap_options_out (bfd *abfd, const Elf_Internal_Options *in, + Elf_External_Options *ex) { H_PUT_8 (abfd, in->kind, ex->kind); H_PUT_8 (abfd, in->size, ex->size); @@ -1283,9 +1264,7 @@ bfd_mips_elf_swap_options_out (abfd, in, ex) entries by increasing r_symndx value. */ static int -sort_dynamic_relocs (arg1, arg2) - const PTR arg1; - const PTR arg2; +sort_dynamic_relocs (const void *arg1, const void *arg2) { Elf_Internal_Rela int_reloc1; Elf_Internal_Rela int_reloc2; @@ -1299,9 +1278,7 @@ sort_dynamic_relocs (arg1, arg2) /* Like sort_dynamic_relocs, but used for elf64 relocations. */ static int -sort_dynamic_relocs_64 (arg1, arg2) - const PTR arg1; - const PTR arg2; +sort_dynamic_relocs_64 (const void *arg1, const void *arg2) { Elf_Internal_Rela int_reloc1[3]; Elf_Internal_Rela int_reloc2[3]; @@ -1331,11 +1308,9 @@ sort_dynamic_relocs_64 (arg1, arg2) when generating a final executable. */ static bfd_boolean -mips_elf_output_extsym (h, data) - struct mips_elf_link_hash_entry *h; - PTR data; +mips_elf_output_extsym (struct mips_elf_link_hash_entry *h, void *data) { - struct extsym_info *einfo = (struct extsym_info *) data; + struct extsym_info *einfo = data; bfd_boolean strip; asection *sec, *output_section; @@ -1513,12 +1488,10 @@ mips_elf_output_extsym (h, data) /* A comparison routine used to sort .gptab entries. */ static int -gptab_compare (p1, p2) - const PTR p1; - const PTR p2; +gptab_compare (const void *p1, const void *p2) { - const Elf32_gptab *a1 = (const Elf32_gptab *) p1; - const Elf32_gptab *a2 = (const Elf32_gptab *) p2; + const Elf32_gptab *a1 = p1; + const Elf32_gptab *a2 = p2; return a1->gt_entry.gt_g_value - a2->gt_entry.gt_g_value; } @@ -1529,8 +1502,7 @@ gptab_compare (p1, p2) hash number. */ static INLINE hashval_t -mips_elf_hash_bfd_vma (addr) - bfd_vma addr; +mips_elf_hash_bfd_vma (bfd_vma addr) { #ifdef BFD64 return addr + (addr >> 32); @@ -1544,8 +1516,7 @@ mips_elf_hash_bfd_vma (addr) union members. */ static hashval_t -mips_elf_got_entry_hash (entry_) - const PTR entry_; +mips_elf_got_entry_hash (const void *entry_) { const struct mips_got_entry *entry = (struct mips_got_entry *)entry_; @@ -1557,9 +1528,7 @@ mips_elf_got_entry_hash (entry_) } static int -mips_elf_got_entry_eq (entry1, entry2) - const PTR entry1; - const PTR entry2; +mips_elf_got_entry_eq (const void *entry1, const void *entry2) { const struct mips_got_entry *e1 = (struct mips_got_entry *)entry1; const struct mips_got_entry *e2 = (struct mips_got_entry *)entry2; @@ -1576,8 +1545,7 @@ mips_elf_got_entry_eq (entry1, entry2) accordingly. */ static hashval_t -mips_elf_multi_got_entry_hash (entry_) - const PTR entry_; +mips_elf_multi_got_entry_hash (const void *entry_) { const struct mips_got_entry *entry = (struct mips_got_entry *)entry_; @@ -1591,9 +1559,7 @@ mips_elf_multi_got_entry_hash (entry_) } static int -mips_elf_multi_got_entry_eq (entry1, entry2) - const PTR entry1; - const PTR entry2; +mips_elf_multi_got_entry_eq (const void *entry1, const void *entry2) { const struct mips_got_entry *e1 = (struct mips_got_entry *)entry1; const struct mips_got_entry *e2 = (struct mips_got_entry *)entry2; @@ -1608,9 +1574,7 @@ mips_elf_multi_got_entry_eq (entry1, entry2) /* Returns the dynamic relocation section for DYNOBJ. */ static asection * -mips_elf_rel_dyn_section (dynobj, create_p) - bfd *dynobj; - bfd_boolean create_p; +mips_elf_rel_dyn_section (bfd *dynobj, bfd_boolean create_p) { static const char dname[] = ".rel.dyn"; asection *sreloc; @@ -1637,9 +1601,7 @@ mips_elf_rel_dyn_section (dynobj, create_p) /* Returns the GOT section for ABFD. */ static asection * -mips_elf_got_section (abfd, maybe_excluded) - bfd *abfd; - bfd_boolean maybe_excluded; +mips_elf_got_section (bfd *abfd, bfd_boolean maybe_excluded) { asection *sgot = bfd_get_section_by_name (abfd, ".got"); if (sgot == NULL @@ -1653,9 +1615,7 @@ mips_elf_got_section (abfd, maybe_excluded) section. */ static struct mips_got_info * -mips_elf_got_info (abfd, sgotp) - bfd *abfd; - asection **sgotp; +mips_elf_got_info (bfd *abfd, asection **sgotp) { asection *sgot; struct mips_got_info *g; @@ -1675,8 +1635,7 @@ mips_elf_got_info (abfd, sgotp) /* Obtain the lowest dynamic index of a symbol that was assigned a global GOT entry. */ static long -mips_elf_get_global_gotsym_index (abfd) - bfd *abfd; +mips_elf_get_global_gotsym_index (bfd *abfd) { asection *sgot; struct mips_got_info *g; @@ -1700,10 +1659,8 @@ mips_elf_get_global_gotsym_index (abfd) -1 if no satisfactory GOT offset can be found. */ static bfd_vma -mips_elf_local_got_index (abfd, ibfd, info, value) - bfd *abfd, *ibfd; - struct bfd_link_info *info; - bfd_vma value; +mips_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, + bfd_vma value) { asection *sgot; struct mips_got_info *g; @@ -1721,9 +1678,7 @@ mips_elf_local_got_index (abfd, ibfd, info, value) /* Returns the GOT index for the global symbol indicated by H. */ static bfd_vma -mips_elf_global_got_index (abfd, ibfd, h) - bfd *abfd, *ibfd; - struct elf_link_hash_entry *h; +mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h) { bfd_vma index; asection *sgot; @@ -1744,7 +1699,7 @@ mips_elf_global_got_index (abfd, ibfd, h) e.symndx = -1; e.d.h = (struct mips_elf_link_hash_entry *)h; - p = (struct mips_got_entry *) htab_find (g->got_entries, &e); + p = htab_find (g->got_entries, &e); BFD_ASSERT (p->gotidx > 0); return p->gotidx; @@ -1773,11 +1728,8 @@ mips_elf_global_got_index (abfd, ibfd, h) OFFSETP, if it is non-NULL. */ static bfd_vma -mips_elf_got_page (abfd, ibfd, info, value, offsetp) - bfd *abfd, *ibfd; - struct bfd_link_info *info; - bfd_vma value; - bfd_vma *offsetp; +mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, + bfd_vma value, bfd_vma *offsetp) { asection *sgot; struct mips_got_info *g; @@ -1805,11 +1757,8 @@ mips_elf_got_page (abfd, ibfd, info, value, offsetp) for value. Return the index into the GOT for this entry. */ static bfd_vma -mips_elf_got16_entry (abfd, ibfd, info, value, external) - bfd *abfd, *ibfd; - struct bfd_link_info *info; - bfd_vma value; - bfd_boolean external; +mips_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, + bfd_vma value, bfd_boolean external) { asection *sgot; struct mips_got_info *g; @@ -1837,11 +1786,8 @@ mips_elf_got16_entry (abfd, ibfd, info, value, external) in the GOT. */ static bfd_vma -mips_elf_got_offset_from_index (dynobj, output_bfd, input_bfd, index) - bfd *dynobj; - bfd *output_bfd; - bfd *input_bfd; - bfd_vma index; +mips_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd, + bfd *input_bfd, bfd_vma index) { asection *sgot; bfd_vma gp; @@ -1858,11 +1804,9 @@ mips_elf_got_offset_from_index (dynobj, output_bfd, input_bfd, index) or -1 if it could not be created. */ static struct mips_got_entry * -mips_elf_create_local_got_entry (abfd, ibfd, gg, sgot, value) - bfd *abfd, *ibfd; - struct mips_got_info *gg; - asection *sgot; - bfd_vma value; +mips_elf_create_local_got_entry (bfd *abfd, bfd *ibfd, + struct mips_got_info *gg, + asection *sgot, bfd_vma value) { struct mips_got_entry entry, **loc; struct mips_got_info *g; @@ -1916,9 +1860,7 @@ mips_elf_create_local_got_entry (abfd, ibfd, gg, sgot, value) section symbols are added and the count is higher. */ static bfd_boolean -mips_elf_sort_hash_table (info, max_local) - struct bfd_link_info *info; - unsigned long max_local; +mips_elf_sort_hash_table (struct bfd_link_info *info, unsigned long max_local) { struct mips_elf_hash_sort_data hsd; struct mips_got_info *g; @@ -1963,12 +1905,9 @@ mips_elf_sort_hash_table (info, max_local) index. */ static bfd_boolean -mips_elf_sort_hash_table_f (h, data) - struct mips_elf_link_hash_entry *h; - PTR data; +mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *h, void *data) { - struct mips_elf_hash_sort_data *hsd - = (struct mips_elf_hash_sort_data *) data; + struct mips_elf_hash_sort_data *hsd = data; if (h->root.root.type == bfd_link_hash_warning) h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; @@ -2004,11 +1943,9 @@ mips_elf_sort_hash_table_f (h, data) posterity. */ static bfd_boolean -mips_elf_record_global_got_symbol (h, abfd, info, g) - struct elf_link_hash_entry *h; - bfd *abfd; - struct bfd_link_info *info; - struct mips_got_info *g; +mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h, + bfd *abfd, struct bfd_link_info *info, + struct mips_got_info *g) { struct mips_got_entry entry, **loc; @@ -2062,11 +1999,8 @@ mips_elf_record_global_got_symbol (h, abfd, info, g) SYMNDX in input bfd ABDF, plus ADDEND. */ static bfd_boolean -mips_elf_record_local_got_symbol (abfd, symndx, addend, g) - bfd *abfd; - long symndx; - bfd_vma addend; - struct mips_got_info *g; +mips_elf_record_local_got_symbol (bfd *abfd, long symndx, bfd_vma addend, + struct mips_got_info *g) { struct mips_got_entry entry, **loc; @@ -2094,8 +2028,7 @@ mips_elf_record_local_got_symbol (abfd, symndx, addend, g) /* Compute the hash value of the bfd in a bfd2got hash entry. */ static hashval_t -mips_elf_bfd2got_entry_hash (entry_) - const PTR entry_; +mips_elf_bfd2got_entry_hash (const void *entry_) { const struct mips_elf_bfd2got_hash *entry = (struct mips_elf_bfd2got_hash *)entry_; @@ -2106,9 +2039,7 @@ mips_elf_bfd2got_entry_hash (entry_) /* Check whether two hash entries have the same bfd. */ static int -mips_elf_bfd2got_entry_eq (entry1, entry2) - const PTR entry1; - const PTR entry2; +mips_elf_bfd2got_entry_eq (const void *entry1, const void *entry2) { const struct mips_elf_bfd2got_hash *e1 = (const struct mips_elf_bfd2got_hash *)entry1; @@ -2122,9 +2053,7 @@ mips_elf_bfd2got_entry_eq (entry1, entry2) be the master GOT data. */ static struct mips_got_info * -mips_elf_got_for_ibfd (g, ibfd) - struct mips_got_info *g; - bfd *ibfd; +mips_elf_got_for_ibfd (struct mips_got_info *g, bfd *ibfd) { struct mips_elf_bfd2got_hash e, *p; @@ -2132,7 +2061,7 @@ mips_elf_got_for_ibfd (g, ibfd) return g; e.bfd = ibfd; - p = (struct mips_elf_bfd2got_hash *) htab_find (g->bfd2got, &e); + p = htab_find (g->bfd2got, &e); return p ? p->g : NULL; } @@ -2141,9 +2070,7 @@ mips_elf_got_for_ibfd (g, ibfd) bfd requires. */ static int -mips_elf_make_got_per_bfd (entryp, p) - void **entryp; - void *p; +mips_elf_make_got_per_bfd (void **entryp, void *p) { struct mips_got_entry *entry = (struct mips_got_entry *)*entryp; struct mips_elf_got_per_bfd_arg *arg = (struct mips_elf_got_per_bfd_arg *)p; @@ -2187,8 +2114,7 @@ mips_elf_make_got_per_bfd (entryp, p) g->local_gotno = 0; g->assigned_gotno = -1; g->got_entries = htab_try_create (1, mips_elf_multi_got_entry_hash, - mips_elf_multi_got_entry_eq, - (htab_del) NULL); + mips_elf_multi_got_entry_eq, NULL); if (g->got_entries == NULL) { arg->obfd = 0; @@ -2222,9 +2148,7 @@ mips_elf_make_got_per_bfd (entryp, p) and then make make the new got current. */ static int -mips_elf_merge_gots (bfd2got_, p) - void **bfd2got_; - void *p; +mips_elf_merge_gots (void **bfd2got_, void *p) { struct mips_elf_bfd2got_hash *bfd2got = (struct mips_elf_bfd2got_hash *)*bfd2got_; @@ -2263,7 +2187,7 @@ mips_elf_merge_gots (bfd2got_, p) got entries, since they're all in the master got_entries hash table anyway. */ - BFD_ASSERT (old_lcount + lcount == arg->primary->local_gotno); + BFD_ASSERT (old_lcount + lcount >= arg->primary->local_gotno); BFD_ASSERT (old_gcount + gcount >= arg->primary->global_gotno); arg->primary_count = arg->primary->local_gotno @@ -2287,7 +2211,7 @@ mips_elf_merge_gots (bfd2got_, p) htab_delete (g->got_entries); - BFD_ASSERT (old_lcount + lcount == arg->current->local_gotno); + BFD_ASSERT (old_lcount + lcount >= arg->current->local_gotno); BFD_ASSERT (old_gcount + gcount >= arg->current->global_gotno); arg->current_count = arg->current->local_gotno @@ -2318,12 +2242,10 @@ mips_elf_merge_gots (bfd2got_, p) first available global GOT entry in G. VALUE must contain the size of a GOT entry in bytes. For each global GOT entry that requires a dynamic relocation, NEEDED_RELOCS is incremented, and the symbol is - marked as not elligible for lazy resolution through a function + marked as not eligible for lazy resolution through a function stub. */ static int -mips_elf_set_global_got_offset (entryp, p) - void **entryp; - void *p; +mips_elf_set_global_got_offset (void **entryp, void *p) { struct mips_got_entry *entry = (struct mips_got_entry *)*entryp; struct mips_elf_set_global_got_offset_arg *arg @@ -2338,10 +2260,6 @@ mips_elf_set_global_got_offset (entryp, p) BFD_ASSERT (g->global_gotsym == NULL); entry->gotidx = arg->value * (long) g->assigned_gotno++; - /* We can't do lazy update of GOT entries for - non-primary GOTs since the PLT entries don't use the - right offsets, so punt at it for now. */ - entry->d.h->no_fn_stub = TRUE; if (arg->info->shared || (elf_hash_table (arg->info)->dynamic_sections_created && ((entry->d.h->root.elf_link_hash_flags @@ -2357,6 +2275,21 @@ mips_elf_set_global_got_offset (entryp, p) return 1; } +/* Mark any global symbols referenced in the GOT we are iterating over + as inelligible for lazy resolution stubs. */ +static int +mips_elf_set_no_stub (void **entryp, void *p ATTRIBUTE_UNUSED) +{ + struct mips_got_entry *entry = (struct mips_got_entry *)*entryp; + + if (entry->abfd != NULL + && entry->symndx == -1 + && entry->d.h->root.dynindx != -1) + entry->d.h->no_fn_stub = TRUE; + + return 1; +} + /* Follow indirect and warning hash entries so that each got entry points to the final symbol definition. P must point to a pointer to the hash table we're traversing. Since this traversal may @@ -2364,9 +2297,7 @@ mips_elf_set_global_got_offset (entryp, p) we've made a potentially-destructive change to the hash table, so the traversal must be restarted. */ static int -mips_elf_resolve_final_got_entry (entryp, p) - void **entryp; - void *p; +mips_elf_resolve_final_got_entry (void **entryp, void *p) { struct mips_got_entry *entry = (struct mips_got_entry *)*entryp; htab_t got_entries = *(htab_t *)p; @@ -2408,8 +2339,7 @@ mips_elf_resolve_final_got_entry (entryp, p) /* Turn indirect got entries in a got_entries table into their final locations. */ static void -mips_elf_resolve_final_got_entries (g) - struct mips_got_info *g; +mips_elf_resolve_final_got_entries (struct mips_got_info *g) { htab_t got_entries; @@ -2427,10 +2357,7 @@ mips_elf_resolve_final_got_entries (g) /* Return the offset of an input bfd IBFD's GOT from the beginning of the primary GOT. */ static bfd_vma -mips_elf_adjust_gp (abfd, g, ibfd) - bfd *abfd; - struct mips_got_info *g; - bfd *ibfd; +mips_elf_adjust_gp (bfd *abfd, struct mips_got_info *g, bfd *ibfd) { if (g->bfd2got == NULL) return 0; @@ -2450,12 +2377,9 @@ mips_elf_adjust_gp (abfd, g, ibfd) a sequence of GOTs, each one 16-bit addressable. */ static bfd_boolean -mips_elf_multi_got (abfd, info, g, got, pages) - bfd *abfd; - struct bfd_link_info *info; - struct mips_got_info *g; - asection *got; - bfd_size_type pages; +mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info, + struct mips_got_info *g, asection *got, + bfd_size_type pages) { struct mips_elf_got_per_bfd_arg got_per_bfd_arg; struct mips_elf_set_global_got_offset_arg set_got_offset_arg; @@ -2463,8 +2387,7 @@ mips_elf_multi_got (abfd, info, g, got, pages) unsigned int assign; g->bfd2got = htab_try_create (1, mips_elf_bfd2got_entry_hash, - mips_elf_bfd2got_entry_eq, - (htab_del) NULL); + mips_elf_bfd2got_entry_eq, NULL); if (g->bfd2got == NULL) return FALSE; @@ -2509,7 +2432,7 @@ mips_elf_multi_got (abfd, info, g, got, pages) g->next->assigned_gotno = 0; g->next->got_entries = htab_try_create (1, mips_elf_multi_got_entry_hash, mips_elf_multi_got_entry_eq, - (htab_del) NULL); + NULL); if (g->next->got_entries == NULL) return FALSE; g->next->bfd2got = NULL; @@ -2624,6 +2547,11 @@ mips_elf_multi_got (abfd, info, g, got, pages) g->next = gg->next; gg->next = g; g = gn; + + /* Mark global symbols in every non-primary GOT as ineligible for + stubs. */ + if (g) + htab_traverse (g->got_entries, mips_elf_set_no_stub, NULL); } while (g); @@ -2638,11 +2566,9 @@ mips_elf_multi_got (abfd, info, g, got, pages) RELOCATION. RELEND is one-past-the-end of the relocation table. */ static const Elf_Internal_Rela * -mips_elf_next_relocation (abfd, r_type, relocation, relend) - bfd *abfd ATTRIBUTE_UNUSED; - unsigned int r_type; - const Elf_Internal_Rela *relocation; - const Elf_Internal_Rela *relend; +mips_elf_next_relocation (bfd *abfd ATTRIBUTE_UNUSED, unsigned int r_type, + const Elf_Internal_Rela *relocation, + const Elf_Internal_Rela *relend) { /* According to the MIPS ELF ABI, the R_MIPS_LO16 relocation must be immediately following. However, for the IRIX6 ABI, the next @@ -2666,12 +2592,10 @@ mips_elf_next_relocation (abfd, r_type, relocation, relend) /* Return whether a relocation is against a local symbol. */ static bfd_boolean -mips_elf_local_relocation_p (input_bfd, relocation, local_sections, - check_forced) - bfd *input_bfd; - const Elf_Internal_Rela *relocation; - asection **local_sections; - bfd_boolean check_forced; +mips_elf_local_relocation_p (bfd *input_bfd, + const Elf_Internal_Rela *relocation, + asection **local_sections, + bfd_boolean check_forced) { unsigned long r_symndx; Elf_Internal_Shdr *symtab_hdr; @@ -2707,9 +2631,7 @@ mips_elf_local_relocation_p (input_bfd, relocation, local_sections, /* Sign-extend VALUE, which has the indicated number of BITS. */ bfd_vma -_bfd_mips_elf_sign_extend (value, bits) - bfd_vma value; - int bits; +_bfd_mips_elf_sign_extend (bfd_vma value, int bits) { if (value & ((bfd_vma) 1 << (bits - 1))) /* VALUE is negative. */ @@ -2719,13 +2641,11 @@ _bfd_mips_elf_sign_extend (value, bits) } /* Return non-zero if the indicated VALUE has overflowed the maximum - range expressable by a signed number with the indicated number of + range expressible by a signed number with the indicated number of BITS. */ static bfd_boolean -mips_elf_overflow_p (value, bits) - bfd_vma value; - int bits; +mips_elf_overflow_p (bfd_vma value, int bits) { bfd_signed_vma svalue = (bfd_signed_vma) value; @@ -2743,8 +2663,7 @@ mips_elf_overflow_p (value, bits) /* Calculate the %high function. */ static bfd_vma -mips_elf_high (value) - bfd_vma value; +mips_elf_high (bfd_vma value) { return ((value + (bfd_vma) 0x8000) >> 16) & 0xffff; } @@ -2752,8 +2671,7 @@ mips_elf_high (value) /* Calculate the %higher function. */ static bfd_vma -mips_elf_higher (value) - bfd_vma value ATTRIBUTE_UNUSED; +mips_elf_higher (bfd_vma value ATTRIBUTE_UNUSED) { #ifdef BFD64 return ((value + (bfd_vma) 0x80008000) >> 32) & 0xffff; @@ -2766,8 +2684,7 @@ mips_elf_higher (value) /* Calculate the %highest function. */ static bfd_vma -mips_elf_highest (value) - bfd_vma value ATTRIBUTE_UNUSED; +mips_elf_highest (bfd_vma value ATTRIBUTE_UNUSED) { #ifdef BFD64 return ((value + (((bfd_vma) 0x8000 << 32) | 0x80008000)) >> 48) & 0xffff; @@ -2780,9 +2697,8 @@ mips_elf_highest (value) /* Create the .compact_rel section. */ static bfd_boolean -mips_elf_create_compact_rel_section (abfd, info) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; +mips_elf_create_compact_rel_section + (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED) { flagword flags; register asection *s; @@ -2808,10 +2724,8 @@ mips_elf_create_compact_rel_section (abfd, info) /* Create the .got section to hold the global offset table. */ static bfd_boolean -mips_elf_create_got_section (abfd, info, maybe_exclude) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean maybe_exclude; +mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info, + bfd_boolean maybe_exclude) { flagword flags; register asection *s; @@ -2849,8 +2763,7 @@ mips_elf_create_got_section (abfd, info, maybe_exclude) bh = NULL; if (! (_bfd_generic_link_add_one_symbol (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, FALSE, - get_elf_backend_data (abfd)->collect, &bh))) + 0, NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh))) return FALSE; h = (struct elf_link_hash_entry *) bh; @@ -2863,7 +2776,7 @@ mips_elf_create_got_section (abfd, info, maybe_exclude) return FALSE; amt = sizeof (struct mips_got_info); - g = (struct mips_got_info *) bfd_alloc (abfd, amt); + g = bfd_alloc (abfd, amt); if (g == NULL) return FALSE; g->global_gotsym = NULL; @@ -2873,8 +2786,7 @@ mips_elf_create_got_section (abfd, info, maybe_exclude) g->bfd2got = NULL; g->next = NULL; g->got_entries = htab_try_create (1, mips_elf_got_entry_hash, - mips_elf_got_entry_eq, - (htab_del) NULL); + mips_elf_got_entry_eq, NULL); if (g->got_entries == NULL) return FALSE; mips_elf_section_data (s)->u.got_info = g; @@ -2898,23 +2810,15 @@ mips_elf_create_got_section (abfd, info, maybe_exclude) overflow occurs, and bfd_reloc_ok to indicate success. */ static bfd_reloc_status_type -mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, - relocation, addend, howto, local_syms, - local_sections, valuep, namep, - require_jalxp, save_addend) - bfd *abfd; - bfd *input_bfd; - asection *input_section; - struct bfd_link_info *info; - const Elf_Internal_Rela *relocation; - bfd_vma addend; - reloc_howto_type *howto; - Elf_Internal_Sym *local_syms; - asection **local_sections; - bfd_vma *valuep; - const char **namep; - bfd_boolean *require_jalxp; - bfd_boolean save_addend; +mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, + asection *input_section, + struct bfd_link_info *info, + const Elf_Internal_Rela *relocation, + bfd_vma addend, reloc_howto_type *howto, + Elf_Internal_Sym *local_syms, + asection **local_sections, bfd_vma *valuep, + const char **namep, bfd_boolean *require_jalxp, + bfd_boolean save_addend) { /* The eventual value we will return. */ bfd_vma value; @@ -3518,11 +3422,9 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, /* Obtain the field relocated by RELOCATION. */ static bfd_vma -mips_elf_obtain_contents (howto, relocation, input_bfd, contents) - reloc_howto_type *howto; - const Elf_Internal_Rela *relocation; - bfd *input_bfd; - bfd_byte *contents; +mips_elf_obtain_contents (reloc_howto_type *howto, + const Elf_Internal_Rela *relocation, + bfd *input_bfd, bfd_byte *contents) { bfd_vma x; bfd_byte *location = contents + relocation->r_offset; @@ -3550,16 +3452,12 @@ mips_elf_obtain_contents (howto, relocation, input_bfd, contents) Returns FALSE if anything goes wrong. */ static bfd_boolean -mips_elf_perform_relocation (info, howto, relocation, value, input_bfd, - input_section, contents, require_jalx) - struct bfd_link_info *info; - reloc_howto_type *howto; - const Elf_Internal_Rela *relocation; - bfd_vma value; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - bfd_boolean require_jalx; +mips_elf_perform_relocation (struct bfd_link_info *info, + reloc_howto_type *howto, + const Elf_Internal_Rela *relocation, + bfd_vma value, bfd *input_bfd, + asection *input_section, bfd_byte *contents, + bfd_boolean require_jalx) { bfd_vma x; bfd_byte *location; @@ -3721,9 +3619,7 @@ mips_elf_perform_relocation (info, howto, relocation, value, input_bfd, /* Returns TRUE if SECTION is a MIPS16 stub section. */ static bfd_boolean -mips_elf_stub_section_p (abfd, section) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section; +mips_elf_stub_section_p (bfd *abfd ATTRIBUTE_UNUSED, asection *section) { const char *name = bfd_get_section_name (abfd, section); @@ -3735,9 +3631,7 @@ mips_elf_stub_section_p (abfd, section) /* Add room for N relocations to the .rel.dyn section in ABFD. */ static void -mips_elf_allocate_dynamic_relocations (abfd, n) - bfd *abfd; - unsigned int n; +mips_elf_allocate_dynamic_relocations (bfd *abfd, unsigned int n) { asection *s; @@ -3759,16 +3653,12 @@ mips_elf_allocate_dynamic_relocations (abfd, n) caller should store the result in place of the original addend. */ static bfd_boolean -mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, - symbol, addendp, input_section) - bfd *output_bfd; - struct bfd_link_info *info; - const Elf_Internal_Rela *rel; - struct mips_elf_link_hash_entry *h; - asection *sec; - bfd_vma symbol; - bfd_vma *addendp; - asection *input_section; +mips_elf_create_dynamic_relocation (bfd *output_bfd, + struct bfd_link_info *info, + const Elf_Internal_Rela *rel, + struct mips_elf_link_hash_entry *h, + asection *sec, bfd_vma symbol, + bfd_vma *addendp, asection *input_section) { Elf_Internal_Rela outrel[3]; bfd_boolean skip; @@ -3917,12 +3807,11 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, invocation if ABI_64_P, and here we should generate an additional relocation record with R_MIPS_64 by itself for a NULL symbol before this relocation record. */ - outrel[1].r_info = ELF_R_INFO (output_bfd, (unsigned long) 0, + outrel[1].r_info = ELF_R_INFO (output_bfd, 0, ABI_64_P (output_bfd) ? R_MIPS_64 : R_MIPS_NONE); - outrel[2].r_info = ELF_R_INFO (output_bfd, (unsigned long) 0, - R_MIPS_NONE); + outrel[2].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_NONE); /* Adjust the output offset of the relocation to reference the correct location in the output file. */ @@ -3993,8 +3882,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, /* Return the MACH for a MIPS e_flags value. */ unsigned long -_bfd_elf_mips_mach (flags) - flagword flags; +_bfd_elf_mips_mach (flagword flags) { switch (flags & EF_MIPS_MACH) { @@ -4073,8 +3961,7 @@ _bfd_elf_mips_mach (flags) /* Return printable name for ABI. */ static INLINE char * -elf_mips_abi_name (abfd) - bfd *abfd; +elf_mips_abi_name (bfd *abfd) { flagword flags; @@ -4121,9 +4008,7 @@ static asymbol *mips_elf_acom_symbol_ptr; This is used for both the 32-bit and the 64-bit ABI. */ void -_bfd_mips_elf_symbol_processing (abfd, asym) - bfd *abfd; - asymbol *asym; +_bfd_mips_elf_symbol_processing (bfd *abfd, asymbol *asym) { elf_symbol_type *elfsym; @@ -4199,9 +4084,7 @@ _bfd_mips_elf_symbol_processing (abfd, asym) a better way. */ bfd_boolean -_bfd_mips_elf_section_processing (abfd, hdr) - bfd *abfd; - Elf_Internal_Shdr *hdr; +_bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr) { if (hdr->sh_type == SHT_MIPS_REGINFO && hdr->sh_size > 0) @@ -4216,7 +4099,7 @@ _bfd_mips_elf_section_processing (abfd, hdr) SEEK_SET) != 0) return FALSE; H_PUT_32 (abfd, elf_gp (abfd), buf); - if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4) + if (bfd_bwrite (buf, 4, abfd) != 4) return FALSE; } @@ -4255,7 +4138,7 @@ _bfd_mips_elf_section_processing (abfd, hdr) SEEK_SET) != 0) return FALSE; H_PUT_64 (abfd, elf_gp (abfd), buf); - if (bfd_bwrite (buf, (bfd_size_type) 8, abfd) != 8) + if (bfd_bwrite (buf, 8, abfd) != 8) return FALSE; } else if (intopt.kind == ODK_REGINFO) @@ -4270,7 +4153,7 @@ _bfd_mips_elf_section_processing (abfd, hdr) SEEK_SET) != 0) return FALSE; H_PUT_32 (abfd, elf_gp (abfd), buf); - if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4) + if (bfd_bwrite (buf, 4, abfd) != 4) return FALSE; } l += intopt.size; @@ -4327,10 +4210,8 @@ _bfd_mips_elf_section_processing (abfd, hdr) how to. */ bfd_boolean -_bfd_mips_elf_section_from_shdr (abfd, hdr, name) - bfd *abfd; - Elf_Internal_Shdr *hdr; - const char *name; +_bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, + const char *name) { flagword flags = 0; @@ -4425,9 +4306,8 @@ _bfd_mips_elf_section_from_shdr (abfd, hdr, name) Elf32_External_RegInfo ext; Elf32_RegInfo s; - if (! bfd_get_section_contents (abfd, hdr->bfd_section, (PTR) &ext, - (file_ptr) 0, - (bfd_size_type) sizeof ext)) + if (! bfd_get_section_contents (abfd, hdr->bfd_section, + &ext, 0, sizeof ext)) return FALSE; bfd_mips_elf32_swap_reginfo_in (abfd, &ext, &s); elf_gp (abfd) = s.ri_gp_value; @@ -4441,11 +4321,11 @@ _bfd_mips_elf_section_from_shdr (abfd, hdr, name) { bfd_byte *contents, *l, *lend; - contents = (bfd_byte *) bfd_malloc (hdr->sh_size); + contents = bfd_malloc (hdr->sh_size); if (contents == NULL) return FALSE; if (! bfd_get_section_contents (abfd, hdr->bfd_section, contents, - (file_ptr) 0, hdr->sh_size)) + 0, hdr->sh_size)) { free (contents); return FALSE; @@ -4493,10 +4373,7 @@ _bfd_mips_elf_section_from_shdr (abfd, hdr, name) used by both the 32-bit and the 64-bit ABI. */ bfd_boolean -_bfd_mips_elf_fake_sections (abfd, hdr, sec) - bfd *abfd; - Elf_Internal_Shdr *hdr; - asection *sec; +_bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) { register const char *name; @@ -4618,10 +4495,8 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec) the .scommon section. */ bfd_boolean -_bfd_mips_elf_section_from_bfd_section (abfd, sec, retval) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec; - int *retval; +_bfd_mips_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec, int *retval) { if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) { @@ -4640,14 +4515,10 @@ _bfd_mips_elf_section_from_bfd_section (abfd, sec, retval) file. We must handle the special MIPS section numbers here. */ bfd_boolean -_bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) - bfd *abfd; - struct bfd_link_info *info; - const Elf_Internal_Sym *sym; - const char **namep; - flagword *flagsp ATTRIBUTE_UNUSED; - asection **secp; - bfd_vma *valp; +_bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, + const Elf_Internal_Sym *sym, const char **namep, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp, bfd_vma *valp) { if (SGI_COMPAT (abfd) && (abfd->flags & DYNAMIC) != 0 @@ -4769,8 +4640,7 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) /* Mark __rld_obj_head as dynamic. */ bh = NULL; if (! (_bfd_generic_link_add_one_symbol - (info, abfd, *namep, BSF_GLOBAL, *secp, - (bfd_vma) *valp, (const char *) NULL, FALSE, + (info, abfd, *namep, BSF_GLOBAL, *secp, *valp, NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh))) return FALSE; @@ -4799,12 +4669,10 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) also where we undo the increment of the value for a mips16 symbol. */ bfd_boolean -_bfd_mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - const char *name ATTRIBUTE_UNUSED; - Elf_Internal_Sym *sym; - asection *input_sec; +_bfd_mips_elf_link_output_symbol_hook + (struct bfd_link_info *info ATTRIBUTE_UNUSED, + const char *name ATTRIBUTE_UNUSED, Elf_Internal_Sym *sym, + asection *input_sec, struct elf_link_hash_entry *h ATTRIBUTE_UNUSED) { /* If we see a common symbol, which implies a relocatable link, then if a symbol was small common in an input file, mark it as small @@ -4825,9 +4693,7 @@ _bfd_mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec) /* Create dynamic sections when linking against a dynamic object. */ bfd_boolean -_bfd_mips_elf_create_dynamic_sections (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +_bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) { struct elf_link_hash_entry *h; struct bfd_link_hash_entry *bh; @@ -4887,9 +4753,8 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info) { bh = NULL; if (! (_bfd_generic_link_add_one_symbol - (info, abfd, *namep, BSF_GLOBAL, bfd_und_section_ptr, - (bfd_vma) 0, (const char *) NULL, FALSE, - get_elf_backend_data (abfd)->collect, &bh))) + (info, abfd, *namep, BSF_GLOBAL, bfd_und_section_ptr, 0, + NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh))) return FALSE; h = (struct elf_link_hash_entry *) bh; @@ -4933,9 +4798,8 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info) name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING"; bh = NULL; if (!(_bfd_generic_link_add_one_symbol - (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, - (bfd_vma) 0, (const char *) NULL, FALSE, - get_elf_backend_data (abfd)->collect, &bh))) + (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, 0, + NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh))) return FALSE; h = (struct elf_link_hash_entry *) bh; @@ -4958,8 +4822,7 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info) name = SGI_COMPAT (abfd) ? "__rld_map" : "__RLD_MAP"; bh = NULL; if (!(_bfd_generic_link_add_one_symbol - (info, abfd, name, BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, FALSE, + (info, abfd, name, BSF_GLOBAL, s, 0, NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh))) return FALSE; @@ -4980,11 +4843,8 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info) allocate space in the global offset table. */ bfd_boolean -_bfd_mips_elf_check_relocs (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; +_bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs) { const char *name; bfd *dynobj; @@ -5043,8 +4903,7 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs) continue; sec_relocs - = _bfd_elf_link_read_relocs (abfd, o, (PTR) NULL, - (Elf_Internal_Rela *) NULL, + = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, info->keep_memory); if (sec_relocs == NULL) return FALSE; @@ -5086,7 +4945,7 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs) else symcount = symtab_hdr->sh_info; amt = symcount * sizeof (asection *); - n = (asection **) bfd_zalloc (abfd, amt); + n = bfd_zalloc (abfd, amt); if (n == NULL) return FALSE; elf_tdata (abfd)->local_stubs = n; @@ -5476,11 +5335,9 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs) } bfd_boolean -_bfd_mips_relax_section (abfd, sec, link_info, again) - bfd *abfd; - asection *sec; - struct bfd_link_info *link_info; - bfd_boolean *again; +_bfd_mips_relax_section (bfd *abfd, asection *sec, + struct bfd_link_info *link_info, + bfd_boolean *again) { Elf_Internal_Rela *internal_relocs; Elf_Internal_Rela *irel, *irelend; @@ -5498,8 +5355,7 @@ _bfd_mips_relax_section (abfd, sec, link_info, again) if (link_info->relocatable) return TRUE; - internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, (PTR) NULL, - (Elf_Internal_Rela *) NULL, + internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, link_info->keep_memory); if (internal_relocs == NULL) return TRUE; @@ -5608,13 +5464,13 @@ _bfd_mips_relax_section (abfd, sec, link_info, again) contents = elf_section_data (sec)->this_hdr.contents; else { - contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + contents = bfd_malloc (sec->_raw_size); if (contents == NULL) goto relax_return; free_contents = contents; if (! bfd_get_section_contents (abfd, sec, contents, - (file_ptr) 0, sec->_raw_size)) + 0, sec->_raw_size)) goto relax_return; } } @@ -5661,9 +5517,8 @@ _bfd_mips_relax_section (abfd, sec, link_info, again) understand. */ bfd_boolean -_bfd_mips_elf_adjust_dynamic_symbol (info, h) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; +_bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) { bfd *dynobj; struct mips_elf_link_hash_entry *hmips; @@ -5764,9 +5619,8 @@ _bfd_mips_elf_adjust_dynamic_symbol (info, h) check for any mips16 stub sections that we can discard. */ bfd_boolean -_bfd_mips_elf_always_size_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; +_bfd_mips_elf_always_size_sections (bfd *output_bfd, + struct bfd_link_info *info) { asection *ri; @@ -5781,14 +5635,12 @@ _bfd_mips_elf_always_size_sections (output_bfd, info) /* The .reginfo section has a fixed size. */ ri = bfd_get_section_by_name (output_bfd, ".reginfo"); if (ri != NULL) - bfd_set_section_size (output_bfd, ri, - (bfd_size_type) sizeof (Elf32_External_RegInfo)); + bfd_set_section_size (output_bfd, ri, sizeof (Elf32_External_RegInfo)); if (! (info->relocatable || ! mips_elf_hash_table (info)->mips16_stubs_seen)) mips_elf_link_hash_traverse (mips_elf_hash_table (info), - mips_elf_check_mips16_stubs, - (PTR) NULL); + mips_elf_check_mips16_stubs, NULL); dynobj = elf_hash_table (info)->dynobj; if (dynobj == NULL) @@ -5857,9 +5709,8 @@ _bfd_mips_elf_always_size_sections (output_bfd, info) /* Set the sizes of the dynamic sections. */ bfd_boolean -_bfd_mips_elf_size_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; +_bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) { bfd *dynobj; asection *s; @@ -6028,7 +5879,7 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info) } /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + s->contents = bfd_zalloc (dynobj, s->_raw_size); if (s->contents == NULL && s->_raw_size != 0) { bfd_set_error (bfd_error_no_memory); @@ -6143,16 +5994,11 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info) /* Relocate a MIPS ELF section. */ bfd_boolean -_bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - Elf_Internal_Rela *relocs; - Elf_Internal_Sym *local_syms; - asection **local_sections; +_bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + bfd *input_bfd, asection *input_section, + bfd_byte *contents, Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) { Elf_Internal_Rela *rel; const Elf_Internal_Rela *relend; @@ -6172,7 +6018,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, REL relocation. */ bfd_boolean rela_relocation_p = TRUE; unsigned int r_type = ELF_R_TYPE (output_bfd, rel->r_info); - const char * msg = (const char *) NULL; + const char *msg; /* Find the relocation howto for this relocation. */ if (r_type == R_MIPS_64 && ! NEWABI_P (input_bfd)) @@ -6450,7 +6296,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, { BFD_ASSERT (name != NULL); if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, + (info, name, howto->name, 0, input_bfd, input_section, rel->r_offset))) return FALSE; } @@ -6531,10 +6377,8 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, adjust it appropriately now. */ static void -mips_elf_irix6_finish_dynamic_symbol (abfd, name, sym) - bfd *abfd ATTRIBUTE_UNUSED; - const char *name; - Elf_Internal_Sym *sym; +mips_elf_irix6_finish_dynamic_symbol (bfd *abfd ATTRIBUTE_UNUSED, + const char *name, Elf_Internal_Sym *sym) { /* The linker script takes care of providing names and values for these, but we must place them into the right sections. */ @@ -6583,11 +6427,10 @@ mips_elf_irix6_finish_dynamic_symbol (abfd, name, sym) dynamic sections here. */ bfd_boolean -_bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) - bfd *output_bfd; - struct bfd_link_info *info; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; +_bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, + struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { bfd *dynobj; bfd_vma gval; @@ -6660,10 +6503,8 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) if (g->next && h->dynindx != -1) { struct mips_got_entry e, *p; + bfd_vma entry; bfd_vma offset; - bfd_vma value; - Elf_Internal_Rela rel[3]; - bfd_vma addend = 0; gg = g; @@ -6671,18 +6512,6 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) e.symndx = -1; e.d.h = (struct mips_elf_link_hash_entry *)h; - if (info->shared - || h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak) - value = 0; - else if (sym->st_value) - value = sym->st_value; - else - value = h->root.u.def.value; - - memset (rel, 0, sizeof (rel)); - rel[0].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_REL32); - for (g = g->next; g->next != gg; g = g->next) { if (g->got_entries @@ -6690,22 +6519,37 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) &e))) { offset = p->gotidx; - rel[0].r_offset = rel[1].r_offset = rel[2].r_offset = offset; - - MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset); - - if ((info->shared - || (elf_hash_table (info)->dynamic_sections_created - && p->d.h != NULL - && ((p->d.h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0) - && ((p->d.h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) - && ! (mips_elf_create_dynamic_relocation - (output_bfd, info, rel, - e.d.h, NULL, value, &addend, sgot))) - return FALSE; - BFD_ASSERT (addend == 0); + if (info->shared + || (elf_hash_table (info)->dynamic_sections_created + && p->d.h != NULL + && ((p->d.h->root.elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0) + && ((p->d.h->root.elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) + { + /* Create an R_MIPS_REL32 relocation for this entry. Due to + the various compatibility problems, it's easier to mock + up an R_MIPS_32 or R_MIPS_64 relocation and leave + mips_elf_create_dynamic_relocation to calculate the + appropriate addend. */ + Elf_Internal_Rela rel[3]; + + memset (rel, 0, sizeof (rel)); + if (ABI_64_P (output_bfd)) + rel[0].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_64); + else + rel[0].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_32); + rel[0].r_offset = rel[1].r_offset = rel[2].r_offset = offset; + + entry = 0; + if (! (mips_elf_create_dynamic_relocation + (output_bfd, info, rel, + e.d.h, NULL, sym->st_value, &entry, sgot))) + return FALSE; + } + else + entry = sym->st_value; + MIPS_ELF_PUT_WORD (output_bfd, entry, sgot->contents + offset); } } } @@ -6767,7 +6611,7 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) asection *s = bfd_get_section_by_name (dynobj, ".rld_map"); BFD_ASSERT (s != NULL); sym->st_value = s->output_section->vma + s->output_offset; - bfd_put_32 (output_bfd, (bfd_vma) 0, s->contents); + bfd_put_32 (output_bfd, 0, s->contents); if (mips_elf_hash_table (info)->rld_value == 0) mips_elf_hash_table (info)->rld_value = sym->st_value; } @@ -6794,9 +6638,8 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) /* Finish up the dynamic sections. */ bfd_boolean -_bfd_mips_elf_finish_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; +_bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) { bfd *dynobj; asection *sdyn; @@ -6966,8 +6809,8 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) This isn't the case of IRIX rld. */ if (sgot != NULL && sgot->_raw_size > 0) { - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents); - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000, + MIPS_ELF_PUT_WORD (output_bfd, 0, sgot->contents); + MIPS_ELF_PUT_WORD (output_bfd, 0x80000000, sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd)); } @@ -6988,9 +6831,9 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) { bfd_vma index = g->next->local_gotno + g->next->global_gotno; - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents + MIPS_ELF_PUT_WORD (output_bfd, 0, sgot->contents + index++ * MIPS_ELF_GOT_SIZE (output_bfd)); - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000, sgot->contents + MIPS_ELF_PUT_WORD (output_bfd, 0x80000000, sgot->contents + index++ * MIPS_ELF_GOT_SIZE (output_bfd)); if (! info->shared) @@ -7056,12 +6899,10 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) reldyn_sorting_bfd = output_bfd; if (ABI_64_P (output_bfd)) - qsort ((Elf64_External_Rel *) s->contents + 1, - (size_t) s->reloc_count - 1, + qsort ((Elf64_External_Rel *) s->contents + 1, s->reloc_count - 1, sizeof (Elf64_Mips_External_Rel), sort_dynamic_relocs_64); else - qsort ((Elf32_External_Rel *) s->contents + 1, - (size_t) s->reloc_count - 1, + qsort ((Elf32_External_Rel *) s->contents + 1, s->reloc_count - 1, sizeof (Elf32_External_Rel), sort_dynamic_relocs); } } @@ -7073,8 +6914,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) /* Set ABFD's EF_MIPS_ARCH and EF_MIPS_MACH flags. */ static void -mips_set_isa_flags (abfd) - bfd *abfd; +mips_set_isa_flags (bfd *abfd) { flagword val; @@ -7171,9 +7011,8 @@ mips_set_isa_flags (abfd) number. This is used by both the 32-bit and the 64-bit ABI. */ void -_bfd_mips_elf_final_write_processing (abfd, linker) - bfd *abfd; - bfd_boolean linker ATTRIBUTE_UNUSED; +_bfd_mips_elf_final_write_processing (bfd *abfd, + bfd_boolean linker ATTRIBUTE_UNUSED) { unsigned int i; Elf_Internal_Shdr **hdrpp; @@ -7259,8 +7098,7 @@ _bfd_mips_elf_final_write_processing (abfd, linker) segments. */ int -_bfd_mips_elf_additional_program_headers (abfd) - bfd *abfd; +_bfd_mips_elf_additional_program_headers (bfd *abfd) { asection *s; int ret = 0; @@ -7288,8 +7126,8 @@ _bfd_mips_elf_additional_program_headers (abfd) /* Modify the segment map for an IRIX5 executable. */ bfd_boolean -_bfd_mips_elf_modify_segment_map (abfd) - bfd *abfd; +_bfd_mips_elf_modify_segment_map (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *s; struct elf_segment_map *m, **pm; @@ -7306,7 +7144,7 @@ _bfd_mips_elf_modify_segment_map (abfd) if (m == NULL) { amt = sizeof *m; - m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + m = bfd_zalloc (abfd, amt); if (m == NULL) return FALSE; @@ -7378,7 +7216,7 @@ _bfd_mips_elf_modify_segment_map (abfd) if (m == NULL) { amt = sizeof *m; - m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + m = bfd_zalloc (abfd, amt); if (m == NULL) return FALSE; @@ -7469,7 +7307,7 @@ _bfd_mips_elf_modify_segment_map (abfd) ++c; amt = sizeof *n + (bfd_size_type) (c - 1) * sizeof (asection *); - n = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + n = bfd_zalloc (abfd, amt); if (n == NULL) return FALSE; *n = *m; @@ -7500,12 +7338,11 @@ _bfd_mips_elf_modify_segment_map (abfd) relocation. */ asection * -_bfd_mips_elf_gc_mark_hook (sec, info, rel, h, sym) - asection *sec; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; +_bfd_mips_elf_gc_mark_hook (asection *sec, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Rela *rel, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { /* ??? Do mips16 stub sections need to be handled special? */ @@ -7541,11 +7378,10 @@ _bfd_mips_elf_gc_mark_hook (sec, info, rel, h, sym) /* Update the got entry reference counts for the section being removed. */ bfd_boolean -_bfd_mips_elf_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; - const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +_bfd_mips_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED) { #if 0 Elf_Internal_Shdr *symtab_hdr; @@ -7591,9 +7427,9 @@ _bfd_mips_elf_gc_sweep_hook (abfd, info, sec, relocs) _bfd_elf_link_hash_copy_indirect copy the flags for us. */ void -_bfd_mips_elf_copy_indirect_symbol (bed, dir, ind) - const struct elf_backend_data *bed; - struct elf_link_hash_entry *dir, *ind; +_bfd_mips_elf_copy_indirect_symbol (const struct elf_backend_data *bed, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) { struct mips_elf_link_hash_entry *dirmips, *indmips; @@ -7612,10 +7448,9 @@ _bfd_mips_elf_copy_indirect_symbol (bed, dir, ind) } void -_bfd_mips_elf_hide_symbol (info, entry, force_local) - struct bfd_link_info *info; - struct elf_link_hash_entry *entry; - bfd_boolean force_local; +_bfd_mips_elf_hide_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *entry, + bfd_boolean force_local) { bfd *dynobj; asection *got; @@ -7687,10 +7522,8 @@ _bfd_mips_elf_hide_symbol (info, entry, force_local) #define PDR_SIZE 32 bfd_boolean -_bfd_mips_elf_discard_info (abfd, cookie, info) - bfd *abfd; - struct elf_reloc_cookie *cookie; - struct bfd_link_info *info; +_bfd_mips_elf_discard_info (bfd *abfd, struct elf_reloc_cookie *cookie, + struct bfd_link_info *info) { asection *o; bfd_boolean ret = FALSE; @@ -7712,8 +7545,7 @@ _bfd_mips_elf_discard_info (abfd, cookie, info) if (! tdata) return FALSE; - cookie->rels = _bfd_elf_link_read_relocs (abfd, o, (PTR) NULL, - (Elf_Internal_Rela *) NULL, + cookie->rels = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, info->keep_memory); if (!cookie->rels) { @@ -7749,8 +7581,7 @@ _bfd_mips_elf_discard_info (abfd, cookie, info) } bfd_boolean -_bfd_mips_elf_ignore_discarded_relocs (sec) - asection *sec; +_bfd_mips_elf_ignore_discarded_relocs (asection *sec) { if (strcmp (sec->name, ".pdr") == 0) return TRUE; @@ -7758,10 +7589,8 @@ _bfd_mips_elf_ignore_discarded_relocs (sec) } bfd_boolean -_bfd_mips_elf_write_section (output_bfd, sec, contents) - bfd *output_bfd; - asection *sec; - bfd_byte *contents; +_bfd_mips_elf_write_section (bfd *output_bfd, asection *sec, + bfd_byte *contents) { bfd_byte *to, *from, *end; int i; @@ -7785,8 +7614,7 @@ _bfd_mips_elf_write_section (output_bfd, sec, contents) to += PDR_SIZE; } bfd_set_section_contents (output_bfd, sec->output_section, contents, - (file_ptr) sec->output_offset, - sec->_cooked_size); + sec->output_offset, sec->_cooked_size); return TRUE; } @@ -7800,15 +7628,11 @@ struct mips_elf_find_line }; bfd_boolean -_bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, - functionname_ptr, line_ptr) - bfd *abfd; - asection *section; - asymbol **symbols; - bfd_vma offset; - const char **filename_ptr; - const char **functionname_ptr; - unsigned int *line_ptr; +_bfd_mips_elf_find_nearest_line (bfd *abfd, asection *section, + asymbol **symbols, bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *line_ptr) { asection *msec; @@ -7819,8 +7643,7 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, filename_ptr, functionname_ptr, - line_ptr, - (unsigned) (ABI_64_P (abfd) ? 8 : 0), + line_ptr, ABI_64_P (abfd) ? 8 : 0, &elf_tdata (abfd)->dwarf2_find_line_info)) return TRUE; @@ -7848,7 +7671,7 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, struct fdr *fdr_ptr; bfd_size_type amt = sizeof (struct mips_elf_find_line); - fi = (struct mips_elf_find_line *) bfd_zalloc (abfd, amt); + fi = bfd_zalloc (abfd, amt); if (fi == NULL) { msec->flags = origflags; @@ -7863,7 +7686,7 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, /* Swap in the FDR information. */ amt = fi->d.symbolic_header.ifdMax * sizeof (struct fdr); - fi->d.fdr = (struct fdr *) bfd_alloc (abfd, amt); + fi->d.fdr = bfd_alloc (abfd, amt); if (fi->d.fdr == NULL) { msec->flags = origflags; @@ -7875,7 +7698,7 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, fraw_end = (fraw_src + fi->d.symbolic_header.ifdMax * external_fdr_size); for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++) - (*swap->swap_fdr_in) (abfd, (PTR) fraw_src, fdr_ptr); + (*swap->swap_fdr_in) (abfd, fraw_src, fdr_ptr); elf_tdata (abfd)->find_line_info = fi; @@ -7910,12 +7733,9 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, GP value in the section_processing routine. */ bfd_boolean -_bfd_mips_elf_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - const PTR location; - file_ptr offset; - bfd_size_type count; +_bfd_mips_elf_set_section_contents (bfd *abfd, sec_ptr section, + const void *location, + file_ptr offset, bfd_size_type count) { if (strcmp (section->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0) { @@ -7924,7 +7744,7 @@ _bfd_mips_elf_set_section_contents (abfd, section, location, offset, count) if (elf_section_data (section) == NULL) { bfd_size_type amt = sizeof (struct bfd_elf_section_data); - section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); + section->used_by_bfd = bfd_zalloc (abfd, amt); if (elf_section_data (section) == NULL) return FALSE; } @@ -7937,13 +7757,13 @@ _bfd_mips_elf_set_section_contents (abfd, section, location, offset, count) size = section->_cooked_size; else size = section->_raw_size; - c = (bfd_byte *) bfd_zalloc (abfd, size); + c = bfd_zalloc (abfd, size); if (c == NULL) return FALSE; mips_elf_section_data (section)->u.tdata = c; } - memcpy (c + offset, location, (size_t) count); + memcpy (c + offset, location, count); } return _bfd_elf_set_section_contents (abfd, section, location, offset, @@ -7954,14 +7774,13 @@ _bfd_mips_elf_set_section_contents (abfd, section, location, offset, count) MIPS relocations need to be handled specially. Sigh. */ bfd_byte * -_bfd_elf_mips_get_relocated_section_contents (abfd, link_info, link_order, - data, relocatable, symbols) - bfd *abfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - bfd_boolean relocatable; - asymbol **symbols; +_bfd_elf_mips_get_relocated_section_contents + (bfd *abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + bfd_boolean relocatable, + asymbol **symbols) { /* Get enough memory to hold the stuff */ bfd *input_bfd = link_order->u.indirect.section->owner; @@ -7974,15 +7793,12 @@ _bfd_elf_mips_get_relocated_section_contents (abfd, link_info, link_order, if (reloc_size < 0) goto error_return; - reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); + reloc_vector = bfd_malloc (reloc_size); if (reloc_vector == NULL && reloc_size != 0) goto error_return; /* read in the section */ - if (!bfd_get_section_contents (input_bfd, - input_section, - (PTR) data, - (file_ptr) 0, + if (!bfd_get_section_contents (input_bfd, input_section, data, 0, input_section->_raw_size)) goto error_return; @@ -8045,10 +7861,9 @@ _bfd_elf_mips_get_relocated_section_contents (abfd, link_info, link_order, gp_found = 0; } /* end mips */ - for (parent = reloc_vector; *parent != (arelent *) NULL; - parent++) + for (parent = reloc_vector; *parent != NULL; parent++) { - char *error_message = (char *) NULL; + char *error_message = NULL; bfd_reloc_status_type r; /* Specific to MIPS: Deal with relocation types that require @@ -8069,16 +7884,13 @@ _bfd_elf_mips_get_relocated_section_contents (abfd, link_info, link_order, /* bypass special_function call */ r = _bfd_mips_elf_gprel16_with_gp (input_bfd, sym, *parent, input_section, relocatable, - (PTR) data, gp); + data, gp); goto skip_bfd_perform_relocation; } /* end mips specific stuff */ - r = bfd_perform_relocation (input_bfd, - *parent, - (PTR) data, - input_section, - relocatable ? abfd : (bfd *) NULL, + r = bfd_perform_relocation (input_bfd, *parent, data, input_section, + relocatable ? abfd : NULL, &error_message); skip_bfd_perform_relocation: @@ -8103,7 +7915,7 @@ _bfd_elf_mips_get_relocated_section_contents (abfd, link_info, link_order, goto error_return; break; case bfd_reloc_dangerous: - BFD_ASSERT (error_message != (char *) NULL); + BFD_ASSERT (error_message != NULL); if (!((*link_info->callbacks->reloc_dangerous) (link_info, error_message, input_bfd, input_section, (*parent)->address))) @@ -8138,14 +7950,13 @@ error_return: /* Create a MIPS ELF linker hash table. */ struct bfd_link_hash_table * -_bfd_mips_elf_link_hash_table_create (abfd) - bfd *abfd; +_bfd_mips_elf_link_hash_table_create (bfd *abfd) { struct mips_elf_link_hash_table *ret; bfd_size_type amt = sizeof (struct mips_elf_link_hash_table); - ret = (struct mips_elf_link_hash_table *) bfd_malloc (amt); - if (ret == (struct mips_elf_link_hash_table *) NULL) + ret = bfd_malloc (amt); + if (ret == NULL) return NULL; if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, @@ -8174,9 +7985,7 @@ _bfd_mips_elf_link_hash_table_create (abfd) sections together, not write them all out sequentially. */ bfd_boolean -_bfd_mips_elf_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +_bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) { asection **secpp; asection *o; @@ -8188,7 +7997,7 @@ _bfd_mips_elf_final_link (abfd, info) const struct ecoff_debug_swap *swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; HDRR *symhdr = &debug.symbolic_header; - PTR mdebug_handle = NULL; + void *mdebug_handle = NULL; asection *s; EXTR esym; unsigned int i; @@ -8284,8 +8093,7 @@ _bfd_mips_elf_final_link (abfd, info) struct bfd_link_hash_entry *h; h = bfd_link_hash_lookup (info->hash, "_gp", FALSE, FALSE, TRUE); - if (h != (struct bfd_link_hash_entry *) NULL - && h->type == bfd_link_hash_defined) + if (h != NULL && h->type == bfd_link_hash_defined) elf_gp (abfd) = (h->u.def.value + h->u.def.section->output_section->vma + h->u.def.section->output_offset); @@ -8294,7 +8102,7 @@ _bfd_mips_elf_final_link (abfd, info) bfd_vma lo = MINUS_ONE; /* Find the GP-relative section with the lowest offset. */ - for (o = abfd->sections; o != (asection *) NULL; o = o->next) + for (o = abfd->sections; o != NULL; o = o->next) if (o->vma < lo && (elf_section_data (o)->this_hdr.sh_flags & SHF_MIPS_GPREL)) lo = o->vma; @@ -8316,7 +8124,7 @@ _bfd_mips_elf_final_link (abfd, info) mdebug_sec = NULL; gptab_data_sec = NULL; gptab_bss_sec = NULL; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) + for (o = abfd->sections; o != NULL; o = o->next) { if (strcmp (o->name, ".reginfo") == 0) { @@ -8325,9 +8133,7 @@ _bfd_mips_elf_final_link (abfd, info) /* We have found the .reginfo section in the output file. Look through all the link_orders comprising it and merge the information together. */ - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) + for (p = o->link_order_head; p != NULL; p = p->next) { asection *input_section; bfd *input_bfd; @@ -8350,9 +8156,7 @@ _bfd_mips_elf_final_link (abfd, info) input_section->_raw_size = sizeof (Elf32_External_RegInfo); if (! bfd_get_section_contents (input_bfd, input_section, - (PTR) &ext, - (file_ptr) 0, - (bfd_size_type) sizeof ext)) + &ext, 0, sizeof ext)) return FALSE; bfd_mips_elf32_swap_reginfo_in (input_bfd, &ext, &sub); @@ -8377,7 +8181,7 @@ _bfd_mips_elf_final_link (abfd, info) /* Skip this section later on (I don't think this currently matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; + o->link_order_head = NULL; reginfo_sec = o; } @@ -8421,7 +8225,7 @@ _bfd_mips_elf_final_link (abfd, info) debug.external_ext = debug.external_ext_end = NULL; mdebug_handle = bfd_ecoff_debug_init (abfd, &debug, swap, info); - if (mdebug_handle == (PTR) NULL) + if (mdebug_handle == NULL) return FALSE; esym.jmptbl = 0; @@ -8450,9 +8254,7 @@ _bfd_mips_elf_final_link (abfd, info) return FALSE; } - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) + for (p = o->link_order_head; p != NULL; p = p->next) { asection *input_section; bfd *input_bfd; @@ -8514,7 +8316,7 @@ _bfd_mips_elf_final_link (abfd, info) const char *name; struct mips_elf_link_hash_entry *h; - (*input_swap->swap_ext_in) (input_bfd, (PTR) eraw_src, &ext); + (*input_swap->swap_ext_in) (input_bfd, eraw_src, &ext); if (ext.asym.sc == scNil || ext.asym.sc == scUndefined || ext.asym.sc == scSUndefined) @@ -8583,8 +8385,7 @@ _bfd_mips_elf_final_link (abfd, info) einfo.swap = swap; einfo.failed = FALSE; mips_elf_link_hash_traverse (mips_elf_hash_table (info), - mips_elf_output_extsym, - (PTR) &einfo); + mips_elf_output_extsym, &einfo); if (einfo.failed) return FALSE; @@ -8593,7 +8394,7 @@ _bfd_mips_elf_final_link (abfd, info) /* Skip this section later on (I don't think this currently matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; + o->link_order_head = NULL; mdebug_sec = o; } @@ -8612,9 +8413,7 @@ _bfd_mips_elf_final_link (abfd, info) not used in executables files. */ if (! info->relocatable) { - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) + for (p = o->link_order_head; p != NULL; p = p->next) { asection *input_section; @@ -8634,7 +8433,7 @@ _bfd_mips_elf_final_link (abfd, info) /* Skip this section later on (I don't think this currently matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; + o->link_order_head = NULL; /* Really remove the section. */ for (secpp = &abfd->sections; @@ -8681,16 +8480,14 @@ _bfd_mips_elf_final_link (abfd, info) /* Set up the first entry. */ c = 1; amt = c * sizeof (Elf32_gptab); - tab = (Elf32_gptab *) bfd_malloc (amt); + tab = bfd_malloc (amt); if (tab == NULL) return FALSE; tab[0].gt_header.gt_current_g_value = elf_gp_size (abfd); tab[0].gt_header.gt_unused = 0; /* Combine the input sections. */ - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) + for (p = o->link_order_head; p != NULL; p = p->next) { asection *input_section; bfd *input_bfd; @@ -8725,9 +8522,8 @@ _bfd_mips_elf_final_link (abfd, info) unsigned int look; if (! (bfd_get_section_contents - (input_bfd, input_section, (PTR) &ext_gptab, - (file_ptr) gpentry, - (bfd_size_type) sizeof (Elf32_External_gptab)))) + (input_bfd, input_section, &ext_gptab, gpentry, + sizeof (Elf32_External_gptab)))) { free (tab); return FALSE; @@ -8755,7 +8551,7 @@ _bfd_mips_elf_final_link (abfd, info) /* We need a new table entry. */ amt = (bfd_size_type) (c + 1) * sizeof (Elf32_gptab); - new_tab = (Elf32_gptab *) bfd_realloc ((PTR) tab, amt); + new_tab = bfd_realloc (tab, amt); if (new_tab == NULL) { free (tab); @@ -8798,7 +8594,7 @@ _bfd_mips_elf_final_link (abfd, info) /* Swap out the table. */ amt = (bfd_size_type) c * sizeof (Elf32_External_gptab); - ext_tab = (Elf32_External_gptab *) bfd_alloc (abfd, amt); + ext_tab = bfd_alloc (abfd, amt); if (ext_tab == NULL) { free (tab); @@ -8814,7 +8610,7 @@ _bfd_mips_elf_final_link (abfd, info) /* Skip this section later on (I don't think this currently matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; + o->link_order_head = NULL; } } @@ -8824,18 +8620,16 @@ _bfd_mips_elf_final_link (abfd, info) /* Now write out the computed sections. */ - if (reginfo_sec != (asection *) NULL) + if (reginfo_sec != NULL) { Elf32_External_RegInfo ext; bfd_mips_elf32_swap_reginfo_out (abfd, ®info, &ext); - if (! bfd_set_section_contents (abfd, reginfo_sec, (PTR) &ext, - (file_ptr) 0, - (bfd_size_type) sizeof ext)) + if (! bfd_set_section_contents (abfd, reginfo_sec, &ext, 0, sizeof ext)) return FALSE; } - if (mdebug_sec != (asection *) NULL) + if (mdebug_sec != NULL) { BFD_ASSERT (abfd->output_has_begun); if (! bfd_ecoff_write_accumulated_debug (mdebug_handle, abfd, &debug, @@ -8846,21 +8640,19 @@ _bfd_mips_elf_final_link (abfd, info) bfd_ecoff_debug_free (mdebug_handle, abfd, &debug, swap, info); } - if (gptab_data_sec != (asection *) NULL) + if (gptab_data_sec != NULL) { if (! bfd_set_section_contents (abfd, gptab_data_sec, gptab_data_sec->contents, - (file_ptr) 0, - gptab_data_sec->_raw_size)) + 0, gptab_data_sec->_raw_size)) return FALSE; } - if (gptab_bss_sec != (asection *) NULL) + if (gptab_bss_sec != NULL) { if (! bfd_set_section_contents (abfd, gptab_bss_sec, gptab_bss_sec->contents, - (file_ptr) 0, - gptab_bss_sec->_raw_size)) + 0, gptab_bss_sec->_raw_size)) return FALSE; } @@ -8871,8 +8663,7 @@ _bfd_mips_elf_final_link (abfd, info) { if (! bfd_set_section_contents (abfd, rtproc_sec, rtproc_sec->contents, - (file_ptr) 0, - rtproc_sec->_raw_size)) + 0, rtproc_sec->_raw_size)) return FALSE; } } @@ -8944,8 +8735,7 @@ static const struct mips_mach_extension mips_mach_extensions[] = { /* Return true if bfd machine EXTENSION is an extension of machine BASE. */ static bfd_boolean -mips_mach_extends_p (base, extension) - unsigned long base, extension; +mips_mach_extends_p (unsigned long base, unsigned long extension) { size_t i; @@ -8960,8 +8750,7 @@ mips_mach_extends_p (base, extension) /* Return true if the given ELF header flags describe a 32-bit binary. */ static bfd_boolean -mips_32bit_flags_p (flags) - flagword flags; +mips_32bit_flags_p (flagword flags) { return ((flags & EF_MIPS_32BITMODE) != 0 || (flags & EF_MIPS_ABI) == E_MIPS_ABI_O32 @@ -8977,9 +8766,7 @@ mips_32bit_flags_p (flags) object file when linking. */ bfd_boolean -_bfd_mips_elf_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; +_bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { flagword old_flags; flagword new_flags; @@ -9184,9 +8971,7 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd) /* Function to keep MIPS specific file flags like as EF_MIPS_PIC. */ bfd_boolean -_bfd_mips_elf_set_private_flags (abfd, flags) - bfd *abfd; - flagword flags; +_bfd_mips_elf_set_private_flags (bfd *abfd, flagword flags) { BFD_ASSERT (!elf_flags_init (abfd) || elf_elfheader (abfd)->e_flags == flags); @@ -9197,11 +8982,9 @@ _bfd_mips_elf_set_private_flags (abfd, flags) } bfd_boolean -_bfd_mips_elf_print_private_bfd_data (abfd, ptr) - bfd *abfd; - PTR ptr; +_bfd_mips_elf_print_private_bfd_data (bfd *abfd, void *ptr) { - FILE *file = (FILE *) ptr; + FILE *file = ptr; BFD_ASSERT (abfd != NULL && ptr != NULL); diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index b4230eb..aef4e7b 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -21,97 +21,94 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "elf/internal.h" extern bfd_boolean _bfd_mips_elf_new_section_hook - PARAMS ((bfd *, asection *)); + (bfd *, asection *); extern void _bfd_mips_elf_symbol_processing - PARAMS ((bfd *, asymbol *)); + (bfd *, asymbol *); extern bfd_boolean _bfd_mips_elf_section_processing - PARAMS ((bfd *, Elf_Internal_Shdr *)); + (bfd *, Elf_Internal_Shdr *); extern bfd_boolean _bfd_mips_elf_section_from_shdr - PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); + (bfd *, Elf_Internal_Shdr *, const char *); extern bfd_boolean _bfd_mips_elf_fake_sections - PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); + (bfd *, Elf_Internal_Shdr *, asection *); extern bfd_boolean _bfd_mips_elf_section_from_bfd_section - PARAMS ((bfd *, asection *, int *)); + (bfd *, asection *, int *); extern bfd_boolean _bfd_mips_elf_add_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, - const char **, flagword *, asection **, bfd_vma *)); + (bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, + const char **, flagword *, asection **, bfd_vma *); extern bfd_boolean _bfd_mips_elf_link_output_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, - asection *)); + (struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *); extern bfd_boolean _bfd_mips_elf_create_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_check_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); + (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); extern bfd_boolean _bfd_mips_elf_adjust_dynamic_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); + (struct bfd_link_info *, struct elf_link_hash_entry *); extern bfd_boolean _bfd_mips_elf_always_size_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); + (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); extern bfd_boolean _bfd_mips_elf_finish_dynamic_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - Elf_Internal_Sym *)); + (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *); extern bfd_boolean _bfd_mips_elf_finish_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern void _bfd_mips_elf_final_write_processing - PARAMS ((bfd *, bfd_boolean)); + (bfd *, bfd_boolean); extern int _bfd_mips_elf_additional_program_headers - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean _bfd_mips_elf_modify_segment_map - PARAMS ((bfd *)); + (bfd *, struct bfd_link_info *); extern asection * _bfd_mips_elf_gc_mark_hook - PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *)); + (asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *); extern bfd_boolean _bfd_mips_elf_gc_sweep_hook - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); + (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); extern void _bfd_mips_elf_copy_indirect_symbol - PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *, - struct elf_link_hash_entry *)); + (const struct elf_backend_data *, struct elf_link_hash_entry *, + struct elf_link_hash_entry *); extern void _bfd_mips_elf_hide_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean)); + (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean); extern bfd_boolean _bfd_mips_elf_ignore_discarded_relocs - PARAMS ((asection *)); + (asection *); extern bfd_boolean _bfd_mips_elf_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, - const char **, unsigned int *)); + (bfd *, asection *, asymbol **, bfd_vma, const char **, + const char **, unsigned int *); extern bfd_boolean _bfd_mips_elf_set_section_contents - PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); + (bfd *, asection *, const void *, file_ptr, bfd_size_type); extern bfd_byte *_bfd_elf_mips_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, bfd_boolean, asymbol **)); + (bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, bfd_boolean, asymbol **); extern struct bfd_link_hash_table *_bfd_mips_elf_link_hash_table_create - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean _bfd_mips_elf_final_link - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_merge_private_bfd_data - PARAMS ((bfd *, bfd *)); + (bfd *, bfd *); extern bfd_boolean _bfd_mips_elf_set_private_flags - PARAMS ((bfd *, flagword)); + (bfd *, flagword); extern bfd_boolean _bfd_mips_elf_print_private_bfd_data - PARAMS ((bfd *, PTR)); + (bfd *, void *); extern bfd_boolean _bfd_mips_elf_discard_info - PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *)); + (bfd *, struct elf_reloc_cookie *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_write_section - PARAMS ((bfd *, asection *, bfd_byte *)); + (bfd *, asection *, bfd_byte *); extern bfd_boolean _bfd_mips_elf_read_ecoff_info - PARAMS ((bfd *, asection *, struct ecoff_debug_info *)); + (bfd *, asection *, struct ecoff_debug_info *); extern bfd_reloc_status_type _bfd_mips_elf_gprel16_with_gp - PARAMS ((bfd *, asymbol *, arelent *, asection *, bfd_boolean, PTR, - bfd_vma)); + (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma); extern bfd_reloc_status_type _bfd_mips_elf32_gprel16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); extern unsigned long _bfd_elf_mips_mach - PARAMS ((flagword)); + (flagword); extern bfd_boolean _bfd_mips_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); + (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); extern bfd_vma _bfd_mips_elf_sign_extend - PARAMS ((bfd_vma, int)); + (bfd_vma, int); extern struct bfd_elf_special_section const _bfd_mips_elf_special_sections[]; #define elf_backend_special_sections _bfd_mips_elf_special_sections diff --git a/bfd/format.c b/bfd/format.c index 256ec0e..9d9ee86 100644 --- a/bfd/format.c +++ b/bfd/format.c @@ -425,7 +425,7 @@ bfd_format_string (bfd_format format) switch (format) { case bfd_object: - return "object"; /* Linker/assember/compiler output. */ + return "object"; /* Linker/assembler/compiler output. */ case bfd_archive: return "archive"; /* Object archive file. */ case bfd_core: @@ -446,7 +446,6 @@ bfd_hash_replace (table, old, nw) /* Base method for creating a new hash table entry. */ -/*ARGSUSED*/ struct bfd_hash_entry * bfd_hash_newfunc (entry, table, string) struct bfd_hash_entry *entry; diff --git a/bfd/hp300hpux.c b/bfd/hp300hpux.c index e5a567d..f6cdd19 100644 --- a/bfd/hp300hpux.c +++ b/bfd/hp300hpux.c @@ -475,7 +475,7 @@ NAME (aout,swap_exec_header_in) (abfd, raw_bytes, execp) /***************************************************************/ /* check the header to see if it was generated by a bfd output */ - /* this is detected rather bizarely by requiring a bunch of */ + /* this is detected rather bizarrely by requiring a bunch of */ /* header fields to be zero and an old unused field (now used) */ /* to be set. */ /***************************************************************/ @@ -588,7 +588,7 @@ MY (slurp_symbol_table) (abfd) assignment to the strings pointer is done after we're thru using the nlist so we don't overwrite anything important. */ - /* OK, now walk the new symtable, cacheing symbol properties */ + /* OK, now walk the new symtable, caching symbol properties */ { aout_symbol_type *cache_ptr = cached; aout_symbol_type cache_save; @@ -611,7 +611,7 @@ MY (slurp_symbol_table) (abfd) return FALSE; /********************************************************/ - /* for hpux, the 'lenght' value indicates the length of */ + /* for hpux, the 'length' value indicates the length of */ /* the symbol name which follows the nlist entry. */ /********************************************************/ if (length) diff --git a/bfd/hppabsd-core.c b/bfd/hppabsd-core.c index 31aa2f1..4d17ba5 100644 --- a/bfd/hppabsd-core.c +++ b/bfd/hppabsd-core.c @@ -213,7 +213,6 @@ hppabsd_core_core_file_failing_command (abfd) return core_command (abfd); } -/* ARGSUSED */ static int hppabsd_core_core_file_failing_signal (abfd) bfd *abfd; @@ -221,7 +220,6 @@ hppabsd_core_core_file_failing_signal (abfd) return core_signal (abfd); } -/* ARGSUSED */ static bfd_boolean hppabsd_core_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd, *exec_bfd; diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c index b4869fc..04d2911 100644 --- a/bfd/hpux-core.c +++ b/bfd/hpux-core.c @@ -327,7 +327,6 @@ hpux_core_core_file_failing_command (abfd) return core_command (abfd); } -/* ARGSUSED */ static int hpux_core_core_file_failing_signal (abfd) bfd *abfd; @@ -335,7 +334,6 @@ hpux_core_core_file_failing_signal (abfd) return core_signal (abfd); } -/* ARGSUSED */ static bfd_boolean hpux_core_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd ATTRIBUTE_UNUSED; diff --git a/bfd/i386linux.c b/bfd/i386linux.c index 84ae477..da36e75 100644 --- a/bfd/i386linux.c +++ b/bfd/i386linux.c @@ -112,7 +112,7 @@ i386linux_write_object_contents (abfd) #endif /* This special symbol is a set vector that contains a list of - pointers to fixup tables. It will be present in any dynamicly + pointers to fixup tables. It will be present in any dynamically linked file. The linker generated fixup table should also be added to the list, and it should always appear in the second slot (the first one is a dummy with a magic number that is defined in @@ -1043,7 +1043,7 @@ ieee_slurp_external_symbols (abfd) (void) must_parse_int (&(ieee->h)); /* Fetch the default size if not resolved. */ size = must_parse_int (&(ieee->h)); - /* Fetch the defautlt value if available. */ + /* Fetch the default value if available. */ if (! parse_int (&(ieee->h), &value)) { value = 0; @@ -1639,7 +1639,7 @@ ieee_object_p (abfd) const bfd_arch_info_type *arch; char family[10]; - /* IEEE does not specify the format of the processor identificaton + /* IEEE does not specify the format of the processor identification string, so the compiler is free to put in it whatever it wants. We try here to recognize different processors belonging to the m68k family. Code for other processors can be added here. */ @@ -948,7 +948,6 @@ ihex_set_arch_mach (abfd, arch, mach) /* Get the size of the headers, for the linker. */ -/*ARGSUSED*/ static int ihex_sizeof_headers (abfd, exec) bfd *abfd ATTRIBUTE_UNUSED; diff --git a/bfd/linker.c b/bfd/linker.c index a1a8a4c..c55fb93 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -455,7 +455,7 @@ _bfd_link_hash_newfunc (struct bfd_hash_entry *entry, /* Initialize the local fields. */ h->type = bfd_link_hash_new; - h->next = NULL; + h->und_next = NULL; } return entry; @@ -614,9 +614,9 @@ void bfd_link_add_undef (struct bfd_link_hash_table *table, struct bfd_link_hash_entry *h) { - BFD_ASSERT (h->next == NULL); + BFD_ASSERT (h->und_next == NULL); if (table->undefs_tail != NULL) - table->undefs_tail->next = h; + table->undefs_tail->und_next = h; if (table->undefs == NULL) table->undefs = h; table->undefs_tail = h; @@ -988,9 +988,9 @@ _bfd_generic_link_add_archive_symbols us to lose track of whether the symbol has been referenced). */ if (*pundef != info->hash->undefs_tail) - *pundef = (*pundef)->next; + *pundef = (*pundef)->und_next; else - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; continue; } @@ -1013,7 +1013,7 @@ _bfd_generic_link_add_archive_symbols } if (arh == NULL) { - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; continue; } } @@ -1062,7 +1062,7 @@ _bfd_generic_link_add_archive_symbols } } - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; } archive_hash_table_free (&arsym_hash); @@ -1692,8 +1692,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, case REF: /* A reference to a defined symbol. */ - if (h->next == NULL && info->hash->undefs_tail != h) - h->next = h; + if (h->und_next == NULL && info->hash->undefs_tail != h) + h->und_next = h; break; case BIG: @@ -1879,8 +1879,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, case REFC: /* A reference to an indirect symbol. */ - if (h->next == NULL && info->hash->undefs_tail != h) - h->next = h; + if (h->und_next == NULL && info->hash->undefs_tail != h) + h->und_next = h; h = h->u.i.link; cycle = TRUE; break; @@ -1895,10 +1895,10 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, case CWARN: /* Warn if this symbol has been referenced already, otherwise add a warning. A symbol has been referenced if - the next field is not NULL, or it is the tail of the + the und_next field is not NULL, or it is the tail of the undefined symbol list. The REF case above helps to ensure this. */ - if (h->next != NULL || info->hash->undefs_tail == h) + if (h->und_next != NULL || info->hash->undefs_tail == h) { if (! (*info->callbacks->warning) (info, string, h->root.string, hash_entry_bfd (h), NULL, 0)) diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c index 90f342c..996e516 100644 --- a/bfd/m68klinux.c +++ b/bfd/m68klinux.c @@ -113,7 +113,7 @@ m68klinux_write_object_contents (abfd) #endif /* This special symbol is a set vector that contains a list of - pointers to fixup tables. It will be present in any dynamicly + pointers to fixup tables. It will be present in any dynamically linked file. The linker generated fixup table should also be added to the list, and it should always appear in the second slot (the first one is a dummy with a magic number that is defined in diff --git a/bfd/mach-o.h b/bfd/mach-o.h index c94f01d..1f7dd60 100644 --- a/bfd/mach-o.h +++ b/bfd/mach-o.h @@ -74,11 +74,11 @@ typedef enum bfd_mach_o_load_command_type BFD_MACH_O_LC_FVMFILE = 0x9, /* Fixed VM file inclusion. */ BFD_MACH_O_LC_PREPAGE = 0xa, /* Prepage command (internal use). */ BFD_MACH_O_LC_DYSYMTAB = 0xb, /* Dynamic link-edit symbol table info. */ - BFD_MACH_O_LC_LOAD_DYLIB = 0xc, /* Load a dynamicly linked shared library. */ - BFD_MACH_O_LC_ID_DYLIB = 0xd, /* Dynamicly linked shared lib identification. */ + BFD_MACH_O_LC_LOAD_DYLIB = 0xc, /* Load a dynamically linked shared library. */ + BFD_MACH_O_LC_ID_DYLIB = 0xd, /* Dynamically linked shared lib identification. */ BFD_MACH_O_LC_LOAD_DYLINKER = 0xe, /* Load a dynamic linker. */ BFD_MACH_O_LC_ID_DYLINKER = 0xf, /* Dynamic linker identification. */ - BFD_MACH_O_LC_PREBOUND_DYLIB = 0x10,/* Modules prebound for a dynamicly. */ + BFD_MACH_O_LC_PREBOUND_DYLIB = 0x10,/* Modules prebound for a dynamically. */ BFD_MACH_O_LC_ROUTINES = 0x11, /* Image routines. */ BFD_MACH_O_LC_SUB_FRAMEWORK = 0x12, /* Sub framework. */ BFD_MACH_O_LC_SUB_UMBRELLA = 0x13, /* Sub umbrella. */ @@ -86,7 +86,7 @@ typedef enum bfd_mach_o_load_command_type BFD_MACH_O_LC_SUB_LIBRARY = 0x15, /* Sub library. */ BFD_MACH_O_LC_TWOLEVEL_HINTS = 0x16,/* Two-level namespace lookup hints. */ BFD_MACH_O_LC_PREBIND_CKSUM = 0x17, /* Prebind checksum. */ - /* Load a dynamicly linked shared library that is allowed to be + /* Load a dynamically linked shared library that is allowed to be missing (weak). */ BFD_MACH_O_LC_LOAD_WEAK_DYLIB = 0x18 } @@ -231,7 +231,7 @@ typedef struct bfd_mach_o_symtab_command bfd_mach_o_symtab_command; /* This is the second set of the symbolic information which is used to support - the data structures for the dynamicly link editor. + the data structures for the dynamically link editor. The original set of symbolic information in the symtab_command which contains the symbol and string tables must also be present when this load command is @@ -250,7 +250,7 @@ bfd_mach_o_symtab_command; reference symbol table indirect symbol table The first three tables above (the table of contents, module table and - reference symbol table) are only present if the file is a dynamicly linked + reference symbol table) are only present if the file is a dynamically linked shared library. For executable and object modules, which are files containing only one module, the information that would be in these three tables is determined as follows: @@ -259,7 +259,7 @@ bfd_mach_o_symtab_command; file is part of the module. reference symbol table - is the defined and undefined external symbols - For dynamicly linked shared library files this load command also contains + For dynamically linked shared library files this load command also contains offsets and sizes to the pool of relocation entries for all sections separated into two groups: external relocation entries @@ -281,7 +281,7 @@ typedef struct bfd_mach_o_dysymtab_command The last two groups are used by the dynamic binding process to do the binding (indirectly through the module table and the reference symbol - table when this is a dynamicly linked shared library file). */ + table when this is a dynamically linked shared library file). */ unsigned long ilocalsym; /* Index to local symbols. */ unsigned long nlocalsym; /* Number of local symbols. */ @@ -293,7 +293,7 @@ typedef struct bfd_mach_o_dysymtab_command /* For the for the dynamic binding process to find which module a symbol is defined in the table of contents is used (analogous to the ranlib structure in an archive) which maps defined external symbols to modules - they are defined in. This exists only in a dynamicly linked shared + they are defined in. This exists only in a dynamically linked shared library file. For executable and object modules the defined external symbols are sorted by name and is use as the table of contents. */ @@ -304,7 +304,7 @@ typedef struct bfd_mach_o_dysymtab_command table must reflect the modules that the file was created from. This is done by having a module table that has indexes and counts into the merged tables for each module. The module structure that these two entries - refer to is described below. This exists only in a dynamicly linked + refer to is described below. This exists only in a dynamically linked shared library file. For executable and object modules the file only contains one module so everything in the file belongs to the module. */ @@ -315,7 +315,7 @@ typedef struct bfd_mach_o_dysymtab_command indicates the external references (defined and undefined) each module makes. For each module there is an offset and a count into the reference symbol table for the symbols that the module references. - This exists only in a dynamicly linked shared library file. For + This exists only in a dynamically linked shared library file. For executable and object modules the defined external symbols and the undefined external symbols indicates the external references. */ @@ -363,7 +363,7 @@ typedef struct bfd_mach_o_dysymtab_command /* All the local relocation entries are grouped together (they are not grouped by their module since they are only used if the object is moved - from it staticly link edited address). */ + from it statically link edited address). */ unsigned long locreloff; /* Offset to local relocation entries. */ unsigned long nlocrel; /* Number of local relocation entries. */ diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c index 59f231b..cb2050f 100644 --- a/bfd/mipsbsd.c +++ b/bfd/mipsbsd.c @@ -220,7 +220,7 @@ mips_fix_jmp_addr (abfd, reloc_entry, symbol, data, input_section, output_bfd, && (symbol->flags & BSF_WEAK) == 0) return bfd_reloc_undefined; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ if (bfd_is_com_section (symbol->section)) relocation = 0; @@ -271,7 +271,7 @@ mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section, && (symbol->flags & BSF_WEAK) == 0) return bfd_reloc_undefined; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ if (bfd_is_com_section (symbol->section)) relocation = 0; diff --git a/bfd/netbsd-core.c b/bfd/netbsd-core.c index a9f1260..7498990 100644 --- a/bfd/netbsd-core.c +++ b/bfd/netbsd-core.c @@ -53,7 +53,6 @@ static void swap_abort /* Handle NetBSD-style core dump file. */ -/* ARGSUSED */ static const bfd_target * netbsd_core_file_p (abfd) bfd *abfd; @@ -179,7 +178,6 @@ netbsd_core_file_failing_command (abfd) return abfd->tdata.netbsd_core_data->core.c_name; } -/* ARGSUSED */ static int netbsd_core_file_failing_signal (abfd) bfd *abfd; @@ -188,7 +186,6 @@ netbsd_core_file_failing_signal (abfd) return abfd->tdata.netbsd_core_data->core.c_signo; } -/* ARGSUSED */ static bfd_boolean netbsd_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd ATTRIBUTE_UNUSED; diff --git a/bfd/nlm32-alpha.c b/bfd/nlm32-alpha.c index bcaa6ab..990ce8d 100644 --- a/bfd/nlm32-alpha.c +++ b/bfd/nlm32-alpha.c @@ -97,6 +97,8 @@ nlm_alpha_write_prefix (abfd) return TRUE; } +#define ONES(n) (((bfd_vma) 1 << ((n) - 1) << 1) - 1) + /* How to process the various reloc types. */ static reloc_howto_type nlm32_alpha_howto_table[] = @@ -144,8 +146,8 @@ static reloc_howto_type nlm32_alpha_howto_table[] = 0, /* special_function */ "REFQUAD", /* name */ TRUE, /* partial_inplace */ - 0xffffffffffffffff, /* src_mask */ - 0xffffffffffffffff, /* dst_mask */ + ONES (64), /* src_mask */ + ONES (64), /* dst_mask */ FALSE), /* pcrel_offset */ /* A 32 bit GP relative offset. This is just like REFLONG except @@ -304,8 +306,8 @@ static reloc_howto_type nlm32_alpha_howto_table[] = 0, /* special_function */ "SREL64", /* name */ TRUE, /* partial_inplace */ - 0xffffffffffffffff, /* src_mask */ - 0xffffffffffffffff, /* dst_mask */ + ONES (64), /* src_mask */ + ONES (64), /* dst_mask */ FALSE), /* pcrel_offset */ /* Push a value on the reloc evaluation stack. */ @@ -336,7 +338,7 @@ static reloc_howto_type nlm32_alpha_howto_table[] = "OP_STORE", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ - 0xffffffffffffffff, /* dst_mask */ + ONES (64), /* dst_mask */ FALSE), /* pcrel_offset */ /* Subtract the reloc address from the value on the top of the diff --git a/bfd/oasys.c b/bfd/oasys.c index 8c30197..be6a8d9 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -324,7 +324,7 @@ oasys_archive_p (abfd) /* There isn't a magic number in an Oasys archive, so the best we - can do to verify reasnableness is to make sure that the values in + can do to verify reasonableness is to make sure that the values in the header are too weird */ diff --git a/bfd/opncls.c b/bfd/opncls.c index 34b39ae..96f1e14 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -201,7 +201,7 @@ DESCRIPTION descriptors for other opens), with the supplied @var{fd} used as an initial file descriptor (but subject to closure at any time), call bfd_set_cacheable(bfd, 1) on the returned BFD. The default - is to assume no cacheing; the file descriptor will remain open + is to assume no caching; the file descriptor will remain open until <<bfd_close>>, and will not be affected by BFD operations on other files. diff --git a/bfd/osf-core.c b/bfd/osf-core.c index 95292a3..9ba0d18 100644 --- a/bfd/osf-core.c +++ b/bfd/osf-core.c @@ -164,7 +164,6 @@ osf_core_core_file_failing_command (abfd) return core_command (abfd); } -/* ARGSUSED */ static int osf_core_core_file_failing_signal (abfd) bfd *abfd; @@ -172,7 +171,6 @@ osf_core_core_file_failing_signal (abfd) return core_signal (abfd); } -/* ARGSUSED */ static bfd_boolean osf_core_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd ATTRIBUTE_UNUSED; diff --git a/bfd/pdp11.c b/bfd/pdp11.c index 3d009ba..a4af824 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -2469,7 +2469,6 @@ NAME(aout,get_symbol_info) (abfd, symbol, ret) } } -/*ARGSUSED*/ void NAME(aout,print_symbol) (abfd, afile, symbol, how) bfd * abfd; diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index f3b3a96..2fe294f 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -645,7 +645,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) if (extra->DataDirectory[1].VirtualAddress == 0) /* Until other .idata fixes are made (pending patch), the entry for - .idata is needed for backwards compatability. FIXME. */ + .idata is needed for backwards compatibility. FIXME. */ add_data_entry (abfd, extra, 1, ".idata", ib); /* For some reason, the virtual size (which is what's set by @@ -943,23 +943,59 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, scnhdr_ext->s_lnnoptr); - /* Extra flags must be set when dealing with NT. All sections should also - have the IMAGE_SCN_MEM_READ (0x40000000) flag set. In addition, the - .text section must have IMAGE_SCN_MEM_EXECUTE (0x20000000) and the data - sections (.idata, .data, .bss, .CRT) must have IMAGE_SCN_MEM_WRITE set - (this is especially important when dealing with the .idata section since - the addresses for routines from .dlls must be overwritten). If .reloc - section data is ever generated, we must add IMAGE_SCN_MEM_DISCARDABLE - (0x02000000). Also, the resource data should also be read and - writable. */ - - /* FIXME: alignment is also encoded in this field, at least on ppc (krk) */ - /* FIXME: even worse, I don't see how to get the original alignment field*/ - /* back... */ - { + /* Extra flags must be set when dealing with PE. All sections should also + have the IMAGE_SCN_MEM_READ (0x40000000) flag set. In addition, the + .text section must have IMAGE_SCN_MEM_EXECUTE (0x20000000) and the data + sections (.idata, .data, .bss, .CRT) must have IMAGE_SCN_MEM_WRITE set + (this is especially important when dealing with the .idata section since + the addresses for routines from .dlls must be overwritten). If .reloc + section data is ever generated, we must add IMAGE_SCN_MEM_DISCARDABLE + (0x02000000). Also, the resource data should also be read and + writable. */ + + /* FIXME: Alignment is also encoded in this field, at least on PPC and + ARM-WINCE. Although - how do we get the original alignment field + back ? */ + + typedef struct + { + const char * section_name; + unsigned long must_have; + } + pe_required_section_flags; + + pe_required_section_flags known_sections [] = + { + { ".arch", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE | IMAGE_SCN_ALIGN_8BYTES }, + { ".bss", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".data", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".edata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, + { ".idata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".pdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, + { ".rdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, + { ".reloc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE }, + { ".rsrc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".text" , IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE }, + { ".tls", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".xdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, + { NULL, 0} + }; + + pe_required_section_flags * p; int flags = scnhdr_int->s_flags; + for (p = known_sections; p->section_name; p++) + if (strcmp (scnhdr_int->s_name, p->section_name) == 0) + { + /* We have defaulted to adding the IMAGE_SCN_MEM_WRITE flag, but now + we know exactly what this specific section wants so we remove it + and then allow the must_have field to add it back in if necessary. */ + flags &= ~IMAGE_SCN_MEM_WRITE; + flags |= p->must_have; + break; + } + H_PUT_32 (abfd, flags, scnhdr_ext->s_flags); } @@ -969,7 +1005,7 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) && strcmp (scnhdr_int->s_name, ".text") == 0) { /* By inference from looking at MS output, the 32 bit field - which is the combintion of the number_of_relocs and + which is the combination of the number_of_relocs and number_of_linenos is used for the line number count in executables. A 16-bit field won't do for cc1. The MS document says that the number of relocs is zero for diff --git a/bfd/ptrace-core.c b/bfd/ptrace-core.c index 23bc8de..4f441ce 100644 --- a/bfd/ptrace-core.c +++ b/bfd/ptrace-core.c @@ -55,7 +55,6 @@ bfd_boolean ptrace_unix_core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd)); static void swap_abort PARAMS ((void)); -/* ARGSUSED */ const bfd_target * ptrace_unix_core_file_p (abfd) bfd *abfd; @@ -146,7 +145,6 @@ ptrace_unix_core_file_failing_command (abfd) return 0; } -/* ARGSUSED */ int ptrace_unix_core_file_failing_signal (abfd) bfd *abfd; @@ -154,7 +152,6 @@ ptrace_unix_core_file_failing_signal (abfd) return abfd->tdata.trad_core_data->u.pt_sigframe.sig_num; } -/* ARGSUSED */ bfd_boolean ptrace_unix_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd, *exec_bfd; diff --git a/bfd/reloc.c b/bfd/reloc.c index 8fdca41..ad4963f 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -319,7 +319,7 @@ CODE_FRAGMENT . . {* If this field is non null, then the supplied function is . called rather than the normal function. This allows really -. strange relocation methods to be accomodated (e.g., i960 callj +. strange relocation methods to be accommodated (e.g., i960 callj . instructions). *} . bfd_reloc_status_type (*special_function) . (bfd *, arelent *, struct bfd_symbol *, void *, asection *, @@ -627,7 +627,7 @@ bfd_perform_relocation (bfd *abfd, / bfd_octets_per_byte (abfd))) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ @@ -1017,7 +1017,7 @@ bfd_install_relocation (bfd *abfd, / bfd_octets_per_byte (abfd))) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ @@ -2507,7 +2507,7 @@ ENUMDOC ENUM BFD_RELOC_CTOR ENUMDOC - The type of reloc used to build a contructor table - at the moment + The type of reloc used to build a constructor table - at the moment probably a 32 bit wide absolute relocation, but the target can choose. It generally does map to one of the other relocation types. @@ -2971,12 +2971,12 @@ ENUM BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET ENUMDOC This is a 16 bit offset from the short data area pointer, with the - bits placed non-contigously in the instruction. + bits placed non-contiguously in the instruction. ENUM BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET ENUMDOC This is a 16 bit offset from the zero data area pointer, with the - bits placed non-contigously in the instruction. + bits placed non-contiguously in the instruction. ENUM BFD_RELOC_V850_CALLT_6_7_OFFSET ENUMDOC @@ -3482,7 +3482,7 @@ ENUMDOC included in the output. VTABLE_INHERIT is a zero-space relocation used to describe to the - linker the inheritence tree of a C++ virtual function table. The + linker the inheritance tree of a C++ virtual function table. The relocation's symbol should be the parent class' vtable, and the relocation should be located at the child vtable. @@ -3675,7 +3675,7 @@ ENUMDOC Motorola 68HC11 reloc. This reloc marks the beginning of a jump/call instruction. It is used for linker relaxation to correctly identify beginning - of instruction and change some branchs to use PC-relative + of instruction and change some branches to use PC-relative addressing mode. ENUM BFD_RELOC_M68HC11_RL_GROUP diff --git a/bfd/reloc16.c b/bfd/reloc16.c index 3a4c3d3..720e2d6 100644 --- a/bfd/reloc16.c +++ b/bfd/reloc16.c @@ -193,7 +193,7 @@ bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again) bfd_size_type amt; /* Allocate and initialize the shrinks array for this section. - The last element is used as an accumlator of shrinks. */ + The last element is used as an accumulator of shrinks. */ amt = reloc_count + 1; amt *= sizeof (unsigned); shrinks = (unsigned *) bfd_zmalloc (amt); diff --git a/bfd/sco5-core.c b/bfd/sco5-core.c index 4928622..311de70 100644 --- a/bfd/sco5-core.c +++ b/bfd/sco5-core.c @@ -110,7 +110,6 @@ read_uarea(abfd, filepos) return &rawptr->u; } -/* ARGSUSED */ const bfd_target * sco5_core_file_p (abfd) bfd *abfd; @@ -338,7 +337,6 @@ sco5_core_file_failing_command (abfd) return NULL; } -/* ARGSUSED */ int sco5_core_file_failing_signal (ignore_abfd) bfd *ignore_abfd; @@ -348,7 +346,6 @@ sco5_core_file_failing_signal (ignore_abfd) : -1); } -/* ARGSUSED */ bfd_boolean sco5_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd ATTRIBUTE_UNUSED; diff --git a/bfd/section.c b/bfd/section.c index e99062a..fce8e1e 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -1025,7 +1025,6 @@ DESCRIPTION */ -/*ARGSUSED*/ bfd_boolean bfd_set_section_flags (bfd *abfd ATTRIBUTE_UNUSED, sec_ptr section, @@ -1065,7 +1064,7 @@ DESCRIPTION | func (abfd, the_section, obj); - This is the prefered method for iterating over sections; an + This is the preferred method for iterating over sections; an alternative would be to use a loop: | section *p; @@ -1074,7 +1073,6 @@ DESCRIPTION */ -/*VARARGS2*/ void bfd_map_over_sections (bfd *abfd, void (*operation) (bfd *, asection *, void *), diff --git a/bfd/simple.c b/bfd/simple.c index afed604..4b597a4 100644 --- a/bfd/simple.c +++ b/bfd/simple.c @@ -211,7 +211,7 @@ bfd_simple_get_relocated_section_contents (bfd *abfd, /* The sections in ABFD may already have output sections and offsets set. Because this function is primarily for debug sections, and GCC uses the - knowledge that debug sections will generally have VMA 0 when emiting + knowledge that debug sections will generally have VMA 0 when emitting relocations between DWARF-2 sections (which are supposed to be section-relative offsets anyway), we need to reset the output offsets to zero. We also need to arrange for section->output_section->vma plus @@ -1715,7 +1715,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field, sym_diff, sym) #ifndef NO_PCREL_MODES /* If we have short and long pcrel modes, then generate the proper mode selector, then the pcrel relocation. Redundant selectors - will be eliminted as the relocs are sized and emitted. */ + will be eliminated as the relocs are sized and emitted. */ bfd_size_type amt = sizeof (int); final_types[0] = (int *) bfd_alloc (abfd, amt); if (!final_types[0]) @@ -2480,7 +2480,7 @@ som_is_subspace (section) return TRUE; } -/* Return TRUE if the given space containins the given subspace. It +/* Return TRUE if the given space contains the given subspace. It is safe to assume space really is a space, and subspace really is a subspace. */ @@ -2734,7 +2734,7 @@ som_write_fixups (abfd, current_offset, total_reloc_sizep) continue; /* If this subspace does not have real data, then we are - finised with it. */ + finished with it. */ if ((subsection->flags & SEC_HAS_CONTENTS) == 0) { som_section_data (subsection)->subspace_dict->fixup_request_index @@ -3200,7 +3200,7 @@ som_write_symbol_strings (abfd, current_offset, syms, num_syms, string_sizep, /* This gets a bit gruesome because of the compilation unit. The strings within the compilation unit are part of the symbol strings, but don't have symbol_dictionary entries. So, manually - write them and update the compliation unit header. On input, the + write them and update the compilation unit header. On input, the compilation unit header contains local copies of the strings. Move them aside. */ if (compilation_unit) @@ -3906,7 +3906,7 @@ som_finish_writing (abfd) section = section->next; } - /* All the subspace dictiondary records are written, and all the + /* All the subspace dictionary records are written, and all the fields are set up in the space dictionary records. Seek to the right location and start writing the space @@ -3978,7 +3978,7 @@ som_finish_writing (abfd) exec_header->exec_flags = obj_som_exec_data (abfd)->exec_flags; /* Oh joys. Ram some of the BSS data into the DATA section - to be compatable with how the hp linker makes objects + to be compatible with how the hp linker makes objects (saves memory space). */ tmp = exec_header->exec_dsize; tmp = SOM_ALIGN (tmp, PA_PAGESIZE); @@ -5780,7 +5780,7 @@ som_slurp_armap (abfd) + sizeof (struct lst_header)), SEEK_SET) != 0) return FALSE; - /* Initializae the cache and allocate space for the library symbols. */ + /* Initialize the cache and allocate space for the library symbols. */ ardata->cache = 0; amt = ardata->symdef_count; amt *= sizeof (carsym); @@ -210,7 +210,7 @@ struct som_section_data_struct should be internal to the BFD backend. The idea is both SOM and ELF define these basic relocation - types so they map into a SOM or ELF specific reloation as + types so they map into a SOM or ELF specific relocation as appropriate. This allows GAS to share much more code between the two object formats. */ diff --git a/bfd/sparclinux.c b/bfd/sparclinux.c index 0a936b1..ecaaa0f 100644 --- a/bfd/sparclinux.c +++ b/bfd/sparclinux.c @@ -113,7 +113,7 @@ sparclinux_write_object_contents (abfd) #endif /* This special symbol is a set vector that contains a list of - pointers to fixup tables. It will be present in any dynamicly + pointers to fixup tables. It will be present in any dynamically linked file. The linker generated fixup table should also be added to the list, and it should always appear in the second slot (the first one is a dummy with a magic number that is defined in @@ -1009,7 +1009,7 @@ srec_write_header (abfd) { unsigned int len = strlen (abfd->filename); - /* I'll put an arbitary 40 char limit on header size. */ + /* I'll put an arbitrary 40 char limit on header size. */ if (len > 40) len = 40; diff --git a/bfd/stabs.c b/bfd/stabs.c index 193fc58..42944a4 100644 --- a/bfd/stabs.c +++ b/bfd/stabs.c @@ -3,21 +3,21 @@ Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This file contains support for linking stabs in sections, as used on COFF and ELF. */ @@ -358,6 +358,8 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of incl_type = incl_sym[TYPEOFF]; if (incl_type == 0) break; + else if (incl_type == (int) N_EXCL) + continue; else if (incl_type == (int) N_EINCL) { if (nest == 0) diff --git a/bfd/sunos.c b/bfd/sunos.c index fb8e17b..5b1b18b 100644 --- a/bfd/sunos.c +++ b/bfd/sunos.c @@ -1246,7 +1246,6 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string, /* Return the list of objects needed by BFD. */ -/*ARGSUSED*/ struct bfd_link_needed_list * bfd_sunos_get_needed_list (abfd, info) bfd *abfd ATTRIBUTE_UNUSED; @@ -2165,7 +2164,6 @@ sunos_scan_dynamic_symbol (h, data) this point. This entry point exists to prevent the regular linker code from doing anything with the object. */ -/*ARGSUSED*/ static bfd_boolean sunos_link_dynamic_object (info, abfd) struct bfd_link_info *info ATTRIBUTE_UNUSED; @@ -2410,7 +2408,6 @@ sunos_write_dynamic_symbol (output_bfd, info, harg) copy it over, and tell the caller to not bother processing this reloc. */ -/*ARGSUSED*/ static bfd_boolean sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc, contents, skip, relocationp) @@ -133,9 +133,9 @@ SUBSECTION | nm foo | 00012345 A dummy_symbol - Many formats cannot represent arbitary symbol information; for + Many formats cannot represent arbitrary symbol information; for instance, the <<a.out>> object format does not allow an - arbitary number of sections. A symbol pointing to a section + arbitrary number of sections. A symbol pointing to a section which is not one of <<.text>>, <<.data>> or <<.bss>> cannot be described. @@ -222,7 +222,7 @@ CODE_FRAGMENT . <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or . <<BSF_GLOBAL>>. *} . -. {* The symbol is a debugging record. The value has an arbitary +. {* The symbol is a debugging record. The value has an arbitrary . meaning, unless BSF_DEBUGGING_RELOC is also set. *} .#define BSF_DEBUGGING 0x08 . @@ -1222,7 +1222,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, long low, high; long mid = -1; - /* Cache non-existant or invalid. Do binary search on + /* Cache non-existent or invalid. Do binary search on indextable. */ indexentry = NULL; diff --git a/bfd/targets.c b/bfd/targets.c index a173857..488e8e4 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -30,7 +30,7 @@ SECTION Targets DESCRIPTION - Each port of BFD to a different machine requries the creation + Each port of BFD to a different machine requires the creation of a target back end. All the back end provides to the root part of BFD is a structure containing pointers to functions which perform certain low level operations on files. BFD diff --git a/bfd/tekhex.c b/bfd/tekhex.c index 32c3d97..f828fe7 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -29,7 +29,7 @@ DESCRIPTION relocations. Their main application is communication with devices like PROM programmers and ICE equipment. - It seems that the sections are descibed as being really big, + It seems that the sections are described as being really big, the example I have says that the text section is 0..ffffffff. BFD would barf with this, many apps would try to alloc 4GB to read in the file. diff --git a/bfd/trad-core.c b/bfd/trad-core.c index 958ce11..0603150 100644 --- a/bfd/trad-core.c +++ b/bfd/trad-core.c @@ -71,7 +71,6 @@ static void swap_abort PARAMS ((void)); /* Handle 4.2-style (and perhaps also sysV-style) core dump file. */ -/* ARGSUSED */ const bfd_target * trad_unix_core_file_p (abfd) bfd *abfd; @@ -248,7 +247,6 @@ trad_unix_core_file_failing_command (abfd) return 0; } -/* ARGSUSED */ int trad_unix_core_file_failing_signal (ignore_abfd) bfd *ignore_abfd ATTRIBUTE_UNUSED; @@ -260,7 +258,6 @@ trad_unix_core_file_failing_signal (ignore_abfd) #endif } -/* ARGSUSED */ bfd_boolean trad_unix_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd ATTRIBUTE_UNUSED; diff --git a/bfd/versados.c b/bfd/versados.c index b978312..19df300 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -32,9 +32,9 @@ A VERSAdos file looks like contains - o Indentification Record + o Identification Record o External Symbol Definition Record - o Object Text Recrod + o Object Text Record o End Record */ diff --git a/bfd/version.h b/bfd/version.h index 339535c..33474d8 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20031111 +#define BFD_VERSION_DATE 20031215 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c index 7bb7a77..660c06c 100644 --- a/bfd/vms-gsd.c +++ b/bfd/vms-gsd.c @@ -788,7 +788,7 @@ _bfd_vms_write_gsd (abfd, objtype) last_index++; } - /* Don't know if this is neccesary for the linker but for now it keeps + /* Don't know if this is necessary for the linker but for now it keeps vms_slurp_gsd happy */ sname = (char *)section->name; diff --git a/bfd/vms-hdr.c b/bfd/vms-hdr.c index adbecac..c261111 100644 --- a/bfd/vms-hdr.c +++ b/bfd/vms-hdr.c @@ -206,7 +206,7 @@ _bfd_vms_slurp_hdr (abfd, objtype) /*-----------------------------------------------------------------------------*/ /* Output routines. */ -/* Manufacure a VMS like time on a unix based system. +/* Manufacture a VMS like time on a unix based system. stolen from obj-vms.c */ static unsigned char * diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c index b6f3042..d0a24c7 100644 --- a/bfd/vms-misc.c +++ b/bfd/vms-misc.c @@ -49,7 +49,7 @@ static asymbol *new_symbol PARAMS ((bfd *, char *)); ... 9 almost everything - level is also identation level. Indentation is performed + level is also indentation level. Indentation is performed if level > 0 */ @@ -668,7 +668,7 @@ _bfd_vms_output_begin (abfd, rectype, rechead) _bfd_vms_output_short (abfd, (unsigned int) rectype); - /* save current output position to fill in lenght later */ + /* save current output position to fill in length later */ if (PRIV (push_level) > 0) PRIV (length_pos) = PRIV (output_size); diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 6f94029..ccd82be 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -1248,7 +1248,7 @@ xcoff_link_add_symbols (abfd, info) } linoff = (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr - enclosing->line_filepos); - /* explict cast to bfd_signed_vma for compiler */ + /* explicit cast to bfd_signed_vma for compiler */ if (linoff < (bfd_signed_vma) (enclosing->lineno_count * linesz)) { struct internal_lineno lin; @@ -1827,7 +1827,7 @@ xcoff_link_add_symbols (abfd, info) section = bfd_und_section_ptr; value = 0; } - else if ((*sym_hash)->root.next != NULL + else if ((*sym_hash)->root.und_next != NULL || info->hash->undefs_tail == &(*sym_hash)->root) { /* This symbol has been referenced. In this @@ -2898,7 +2898,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, xcoff_mark_symbol (info, hsym); hsym->flags |= (XCOFF_DEF_REGULAR | XCOFF_RTINIT); - /* __rtinit initalized */ + /* __rtinit initialized */ amt = sizeof (struct internal_ldsym); ldsym = (struct internal_ldsym *) bfd_malloc (amt); @@ -133,7 +133,7 @@ typedef struct bfd_sym_resources_table_entry bfd_sym_resources_table_entry; (Note that having a single module copied into two resources is not possible). Modules map back to their resource via an index into the resource table and an offset into the resource. Modules also point - to their source files, both the definition module and implemention + to their source files, both the definition module and implementation module. Because modules can be textually nested within other modules, a link to the parent (containing) module is required. This module can textually contain other modules. A link to the contiguous |