diff options
Diffstat (limited to 'bfd')
81 files changed, 2883 insertions, 1311 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5f949ed..1650199 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,9 +1,450 @@ +2003-04-15 Alexandre Oliva <aoliva@redhat.com> + + * dwarf2.c (_bfd_dwarf2_find_nearest_line): Fix typo in + 2003-04-09's change. + +2003-04-15 Brian Ford <ford@vss.fsi.com> + + * peicode.h (coff_swap_scnhdr_in): If a section holds + uninitialized data and is from an object file or from an + executable image that has not initialized the s_size field, or if + the physical size is padded, use the virtual size (stored in + s_paddr) instead. + +2003-04-15 H.J. Lu <hjl@gnu.org> + + * elflink.h (elf_link_add_object_symbols): Properly report + filename for alignment reduction. + +2003-04-15 Rohit Kumar Srivastava <rohits@kpitcummins.com> + + * archures.c: Replace occurrances of 'Hitachi' with 'Renesas'. + * reloc.c: Likewise. + * coff-h8300.c: Likewise. + * coff-h8500.c: Likewise. + * coff-sh.c: Likewise. + * cpu-h8300.c: Likewise. + * cpu-sh.c: Likewise. + * elf32-h8300.c: Likewise. + * elf32-sh.c: Likewise. + * elf32-sh64-com.c: Likewise. + * elf32-sh64.c: Likewise. + * elf64-sh64.c: Likewise. + * bfd-in2.h: Regenerate. + +2003-04-14 H.J. Lu <hjl@gnu.org> + + * elflink.h (elf_link_add_object_symbols): Maintain maximum + alignment for common symbols. Warn reducing alignment for + common symbols. Report old filename when symbol size changes. + +2003-04-12 Alexandre Oliva <aoliva@redhat.com> + + * elfxx-mips.c (mips_elf_calculate_relocation): Adjust two other + occurrences of the same test changed in the previous patch. + Optimize. + +2003-04-11 Alexandre Oliva <aoliva@redhat.com> + + * elfxx-mips.c (mips_elf_get_global_gotsym_index): New. + (mips_elf_calculate_relocation): Decay GOT_PAGE/GOT_OFST to + GOT_DISP/addend only if the symbol got a global GOT entry. + +2003-04-10 Alexandre Oliva <aoliva@redhat.com> + + * elfxx-mips.c (mips_elf_calculate_relocation): Decay + GOT_PAGE/GOT_OFST referencing overridable symbol to + GOT_DISP/addend. + (_bfd_mips_elf_check_relocs): Handle GOT_PAGE referencing + global symbol as GOT_DISP. + +2003-04-10 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (elf_xtensa_relocate_section): Don't continue to the + next relocation on an undefined symbol. + +2003-04-09 Richard Henderson <rth@redhat.com> + + * elf64-alpha.c (elf64_alpha_relocate_section) <R_ALPHA_GPREL32>: + Ignore relocations against r_symndx == 0. + +2003-04-09 H.J. Lu <hjl@gnu.org> + + * elf64-alpha.c (elf64_alpha_relocate_section): Don't return + FALSE for undefined symbols. + * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. + +2003-04-09 Alexandre Oliva <aoliva@redhat.com> + + * dwarf2.c (_bfd_dwarf2_find_nearest_line): Try DWARF3-standard + and IRIX-specific shift-to-64-bit 4-byte lengths before following + addr_size. + +2003-04-08 Alexandre Oliva <aoliva@redhat.com> + + * elf32-mips.c (bfd_elf32_bfd_reloc_type_lookup): Detect (ctor) + pointer size from ABI, not arch_bits_per_address. + +2003-04-07 Kevin Buettner <kevinb@redhat.com> + + * elfn32-mips.c (elf32_mips_grok_prstatus): Adjust core file related + constants for n32 ABI. + +2003-04-06 Andrew Cagney <cagney@redhat.com> + + * simple.c (bfd_simple_get_relocated_section_contents): Disable + free that leads to GDB vs BFD memory corruption. + +2003-04-04 Stephane Carrez <stcarrez@nerim.fr> + + * elf32-m68hc11.c (m68hc11_elf_relax_delete_bytes): Also adjust + symbols that mark the end of the section. + (m68hc11_elf_relax_section): Use R_M68HC11_PCREL_8 relocs when + converting to a relative branch so that the offset is computed after + the relaxation; also relocate a jsr into a bsr if possible but don't + relax them if they are to a far symbol as we need to call the + trampoline code. + (elf_m68hc11_howto_table): Set pcrel_offset to true. + +2003-04-04 Svein E. Seldal <Svein.Seldal@solidas.com> + + * archures.c: Namespace cleanup. Rename bfd_mach_c3x to + bfd_mach_tic3x and bfd_mach_c4x to bfd_mach_tic4x + * bfd-in2.h: Regenerate + * coff-tic4x.c: Namespace cleanup. Replace s/c4x/tic4x/ + * cpu-tic4x.c: Ditto + +2003-04-03 Nick Clifton <nickc@redhat.com> + + * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Compute ps and ss + differently for object files and executables. + * peicode.h (coff_swap_scnhdr_in): Only set the s_size field + for object files or for executables who have not already + initialised the field. + * libpei.h (bfd_pe_executable_p): New macro. Return true if + the PE format bfd is an executable. + +2003-04-03 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_check_relocs): Don't use SYMBOL_REFERENCES_LOCAL + here as it's too early to reliably determine locality. + (ppc_elf_gc_sweep_hook): Likewise. + (SYMBOL_REFERENCES_LOCAL): Expand comment. + +2003-04-02 Bob Wilson <bob.wilson@acm.org> + + * xtensa-modules.c: Remove comment indicating that this is a + generated file. + +2003-04-02 Alan Modra <amodra@bigpond.net.au> + + * elfxx-mips.c (_bfd_mips_elf_hide_symbol): Test for NULL dynobj. + +2003-04-01 Bob Wilson <bob.wilson@acm.org> + + * Makefile.am (ALL_MACHINES): Add cpu-xtensa.lo. + (ALL_MACHINES_CFILES): Add cpu-xtensa.c. + (BFD32_BACKENDS): Add elf32-xtensa.lo, xtensa-isa.lo, and + xtensa-modules.lo. + (BFD32_BACKENDS_CFILES): Add elf32-xtensa.c, xtensa-isa.c, and + xtensa-modules.c. + (cpu-xtensa.lo): New target. + (elf32-xtensa.lo): Likewise. + (xtensa-isa.lo): Likewise. + (xtensa-modules.lo): Likewise. + * Makefile.in: Regenerate. + * archures.c (bfd_architecture): Add bfd_{arch,mach}_xtensa. + (bfd_archures_list): Add bfd_xtensa_arch. + * config.bfd: Handle xtensa-*-*. + * configure.in: Handle bfd_elf32_xtensa_{le,be}_vec. + * configure: Regenerate. + * reloc.c: Add BFD_RELOC_XTENSA_{RTLD,GLOB_DAT,JMP_SLOT,RELATIVE, + PLT,OP0,OP1,OP2,ASM_EXPAND,ASM_SIMPLIFY}. + * targets.c (bfd_elf32_xtensa_be_vec): Declare. + (bfd_elf32_xtensa_le_vec): Likewise. + (bfd_target_vector): Add bfd_elf32_xtensa_{be,le}_vec. + * cpu-xtensa.c: New file. + * elf32-xtensa.c: Likewise. + * xtensa-isa.c: Likewise. + * xtensa-modules.c: Likewise. + * libbfd.h: Regenerate. + * bfd-in2.h: Likewise. + +2003-04-01 Nick Clifton <nickc@redhat.com> + + * archures.c (bfd_mach_arm_unknown): Define. + * bfd-in.h (bfd_arm_merge_machines, bfd_arm+update_notes, + bfd_arm_get_mach_from_notes): Prototype. + * bfd-in2.h: Regenerate. + * coff-arm.c (coff_arm_merge_private_bfd_data): Call + bfd_arm_merge_machines. + (coff_arm_final_link_postscript): Call bfd_arm_update_notes. + * coffcode.h (coff_set_arch_mach_hook): Call + bfd_arm_get_mach_from_notes. + * coffgen.c (coff_real_object_p): Revert previous delta. + * cpu_arm.c (arm_check_note): New function. Examine a note in a + .note section. + (bfd_arm_merge_machines): New function: Handle the merging of ARM + binaries compiled for different architectures.. + (bfd_arm_update_notes): New function: Update an ARM note section. + (bfd_arm_get_mach_from_notes): New function: Extract a bfd machine + number from an ARM note section. + * elf32-arm.h (elf32_arm_object_p): Use + bfd_arm_get_mach_from_notes. + (elf32_arm_merge_private_bfd_data): Use bfd_arm_merge_machines. + (elf32_arm_final_write_processing): Use bfd_arm_update_notes. + +2003-04-01 Ben Elliston <bje@wasabisystems.com> + + * dwarf2.c (read_attribute_value): Correct typo in comment. + +2003-04-01 Nick Clifton <nickc@redhat.com> + + * dwarf2.c (concat_filename): Use bfd_malloc() and strdup() + instead of concat(). + (decode_line_info): Only free filename if it is not NULL. + (add_line_info): Make a copy of the filename when storing it into + the info structure. + +2003-03-31 Andreas Schwab <schwab@suse.de> + Daniel Jacobowitz <drow@mvista.com> + + * simple.c (bfd_simple_get_relocated_section_contents): Add + parameter symbol_table. Optionally use it instead of the symbol + table from the bfd. Save and restore output offsets and output + sections around bfd_get_relocated_section_contents. Fix a memory + leak. + (simple_save_output_info, simple_restore_output_info): New + functions. + * bfd-in2.h: Regenerate. + * dwarf2.c (read_abbrevs): Use + bfd_simple_get_relocated_section_contents instead of + bfd_get_section_contents. + (decode_line_info): Likewise. + (_bfd_dwarf2_find_nearest_line): Likewise. Don't call + find_rela_addend. + (find_rela_addend): Remove. + * elfxx-ia64.c (elfNN_ia64_reloc): Weaken sanity check for + debugging sections. + (elfNN_ia64_hash_table_create): Create the hash table with malloc, + not bfd_zalloc. + +2003-03-31 David Heine <dlheine@suif.stanford.edu> + + * aoutx.h (aout_link_hash_table_create): Use bfd_malloc instead of + bfd_alloc. + * dwarf2.c (concat_filename): Always allocate space for the + returned filename. + (decode_line_info): Free the allocated filename returned by + concat_filename. + * elf-eh-frame.c (bfd_elf_write_section_eh_frame): Fix memory leaks. + * elf.c (copy_private_bfd_data): Likewise. + (_bfd_elf_slurp_version_tables): Fix bug freeing contents pointer. + * elflink.h (elf_link_sort_relocs): Fix memory leak. + * format.c (bfd_check_format_matches): Likewise. + * linker.c (bfd_generic_final_link): Likewise. + * opncls.c (find_separate_debug_info): Likewise. + * simple.c (bfd_simple_get_relocated_section_contents): Likewise. + +2003-03-28 H.J. Lu <hjl@gnu.org> + + * elflink.h (elf_link_add_object_symbols): Correctly combine + visibilities. + +2003-03-27 Jakub Jelinek <jakub@redhat.com> + + * elfxx-ia64.c (elfNN_ia64_relax_section): Reset self_dtpmod_offset + to -1 before recomputing got offsets. + +2003-03-26 Andreas Schwab <schwab@suse.de> + + * elf32-m68k.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. + (elf_m68k_relocate_section): Use it to correctly handle symbols + forced to be local. + (elf_m68k_finish_dynamic_symbol): Emit RELATIVE reloc for got + entries for symbols that are forced to be local. + +2003-03-25 Alexandre Oliva <aoliva@redhat.com> + + * elfxx-mips.c (_bfd_mips_relax_section): New function. + * elfxx-mips.h (_bfd_mips_relax_section): Declare. + * elfn32-mips.c, elf64-mips.c: Use it. + +2003-03-25 Stan Cox <scox@redhat.com> + Nick Clifton <nickc@redhat.com> + + Contribute support for Intel's iWMMXt chip - an ARM variant: + + * archures.c: Add bfd_mach_arm_iWMMXt. + * reloc.c: Add BFD_RELOC_ARM_CP_OFF_IMM_S2. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * coff-arm.c (coff_arm_merge_private_bfd_data): Allow iWMMXt + object files to be linked with XScale ones. + (coff_arm_final_link_postscript): Update note section. + * coffcode.h (coff_set_arch_mach_hook): Handle note section. + * coffgen.c (coff_real_object_p): Call bfd_coff_set_arch_mach_hook + after identifying a coff binary. + * cpu-arm.c (processors): Add iWMMXt. + (arch_inf): Likewise. + * elf32-arm.h (arm_object_p): Handle note section. + (elf32_arm_merge_private_bfd_data): Allow iWMMXt object files to + be linked with XScale ones. + (elf32_arm_section_flags): New function: Set flags on note section. + (elf32_arm_final_write_processing): Handle note section. + +2003-03-21 DJ Delorie <dj@redhat.com> + + * elf32-xstormy16.c (elf32_xstormy16_relocate_section): Call + _bfd_elf_rela_local_sym. + +2003-03-20 H.J. Lu <hjl@gnu.org> + + * elfxx-ia64.c (elfNN_ia64_relax_section): Don't try relax for + non-ELF outputs. + +2003-03-20 Nick Clifton <nickc@redhat.com> + + * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Initialise $idata2 and + $idata5 in case bfd_coff_final_link is not called. + +2003-03-19 Jakub Jelinek <jakub@redhat.com> + + * elf64-sparc.c (struct sparc64_elf_section_data): Add reloc_count + field. + (canon_reloc_count): Define. + (sparc64_elf_slurp_one_reloc_table, sparc64_elf_slurp_reloc_table, + sparc64_elf_canonicalize_dynamic_reloc): Use it instead of + reloc_count. + (sparc64_elf_canonicalize_reloc): New routine. + (bfd_elf64_canonicalize_reloc): Define. + +2003-03-18 Jakub Jelinek <jakub@redhat.com> + + * elfxx-ia64.c (elfNN_ia64_relax_section): Handle relaxation + againt mergeable sections. Take r_addend into account when caching + trampolines. + +2003-03-18 Richard Henderson <rth@redhat.com> + + * elfxx-ia64.c (get_dyn_sym_info): Return NULL gracefully for + local symbols that have no dyninfo. + +2003-03-14 Gene Smith <gene.smith@siemens.com> + + * ieee.c (ieee_write_expression): Handle the case where symbol is + NULL. + General formatting improvements. + +2003-03-13 Nick Clifton <nickc@redhat.com> + + * configure.in (LINGUAS): Add zh_CN. + * configure: Regenerate. + * po/zh_CN.po: New file. + +2003-03-13 Elias Athanasopoulos <elathan@phys.uoa.gr> + + * aout-cris.c (BYTES_IN_WORD): Don't define. + aout-encap.c: Likewise. + aout-ns32k.c: Likewise. + aout-tic30.c: Likewise. + hp300bsd.c: Likewise. + i386aout.c: Likewise. + i386dynix.c: Likewise. + i386linux.c: Likewise. + i386lynx.c: Likewise. + i386mach3.c: Likewise. + m68k4knetbsd.c: Likewise. + m68klinux.c: Likewise. + m68klynx.c: Likewise. + m68knetbsd.c: Likewise. + m88kmach3.c: Likewise. + mipsbsd.c: Likewise. + newsos3.c: Likewise. + sparclinux.c: Likewise. + sparclynx.c: Likewise. + sparcnetbsd.c: Likewise. + vaxbsd.c: Likewise. Fix comment formatting. + +2003-03-12 Alexandre Oliva <aoliva@redhat.com> + + * Reverted 2003-03-02's patch. + + * elfxx-target.h (bfd_elfNN_canonicalize_reloc): Make it + overridable. + * elf64-mips.c (mips_elf64_canonicalize_reloc, + mips_elf64_get_dynamic_reloc_upper_bound, + mips_elf64_canonicalize_dynamic_reloc): New, adapted from elf.c. + (bfd_elf64_get_canonicalize_reloc, + bfd_elf64_get_dynamic_reloc_upper_bound, + bfd_elf64_canonicalize_dynamic_reloc): Define. + (mips_elf64_slurp_reloc_table): Support dynamic. + (mips_elf64_slurp_one_reloc_table): Adjust. + +2003-03-12 Nick Clifton <nickc@redhat.com> + + * xsym.c (bfd_sym_fetch_type_information_table_entry): Change + 'index' to 'offset' in test for zero value. + +2003-03-11 Alexandre Oliva <aoliva@redhat.com> + + * elfxx-mips.c (mips_elf_create_dynamic_relocation): Do not create + dynamic relocations pointing to local or section symbols, use the + NULL symbol instead. Document the choice to not emit an + additional R_MIPS_64 relocation. + +2003-03-11 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_relocate_section): Subtract tls seg vma from + zero index dynamic tls relocs generated for the GOT. Tidy code. + Set "relocation" to 1 on DTPMOD32 relocs. Optimize HA adjustment. + * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. + +2003-03-07 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_relocate_section): Don't look for a nop after + a tls_get_addr call. + + * elf32-ppc.c (ELIMINATE_COPY_RELOCS): Define as one. + (ppc_elf_adjust_dynamic_symbol): For weak symbols, copy + ELF_LINK_NON_GOT_REF from weakdef. + * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Define as one. + (ppc64_elf_adjust_dynamic_symbol): For weak symbols, copy + ELF_LINK_NON_GOT_REF from weakdef. + * elf32-i386.c (ELIMINATE_COPY_RELOCS): Define as one. Use throughout. + (elf_i386_adjust_dynamic_symbol): For weak symbols, copy + ELF_LINK_NON_GOT_REF from weakdef. + +2003-03-06 Jakub Jelinek <jakub@redhat.com> + Andrew Haley <aph@redhat.com> + + * elflink.h (elf_bfd_discard_info): Don't process eh frames if + output is relocateable. + +2003-03-06 Steven Konopa <skonopa@kgo.csc.com> + + * som.c (som_fixup_formats): Correct formats for R_AUX_UNWIND and + R_COMMENT. + +2003-03-06 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_create_linker_section): Don't capitalize + error messages. + (ELIMINATE_COPY_RELOCS): Define to zero. + (ppc_elf_relocate_section): Don't deref htab->tls_sec when calculating + TLSLD relocs. Report reloc types on a number of errors. Optimize + LOCAL24PC check for non-local syms. Don't capitalize error messages. + * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Define to zero. + (ppc64_elf_relocate_section): Don't deref htab->tls_sec when + calculating TLSLD relocs. Report reloc types on a number of errors. + Don't capitalize error messages. + 2003-03-03 H.J. Lu <hjl@gnu.org> * elfxx-ia64.c (USE_BRL): Removed. (oor_ip): Removed. -Mon Mar 3 20:48:23 2003 J"orn Rennecke <joern.rennecke@superh.com> +2003-03-03 J"orn Rennecke <joern.rennecke@superh.com> * elf32-sh.c (sh_elf_howto_tab): Make R_SH_IND12W into an ordinary relocation (no special function), and make it non-partial_inplace. diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 401568f..ee04261 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -101,6 +101,7 @@ ALL_MACHINES = \ cpu-we32k.lo \ cpu-w65.lo \ cpu-xstormy16.lo \ + cpu-xtensa.lo \ cpu-z8k.lo ALL_MACHINES_CFILES = \ @@ -155,6 +156,7 @@ ALL_MACHINES_CFILES = \ cpu-we32k.c \ cpu-w65.c \ cpu-xstormy16.c \ + cpu-xtensa.c \ cpu-z8k.c # The .o files needed by all of the 32 bit vectors that are configured into @@ -249,6 +251,7 @@ BFD32_BACKENDS = \ elf32-v850.lo \ elf32-vax.lo \ elf32-xstormy16.lo \ + elf32-xtensa.lo \ elf32.lo \ elflink.lo \ elf-strtab.lo \ @@ -317,7 +320,9 @@ BFD32_BACKENDS = \ vms-misc.lo \ vms-tir.lo \ xcofflink.lo \ - xsym.lo + xsym.lo \ + xtensa-isa.lo \ + xtensa-modules.lo BFD32_BACKENDS_CFILES = \ aout-adobe.c \ @@ -408,6 +413,7 @@ BFD32_BACKENDS_CFILES = \ elf32-v850.c \ elf32-vax.c \ elf32-xstormy16.c \ + elf32-xtensa.c \ elf32.c \ elflink.c \ elf-strtab.c \ @@ -475,7 +481,9 @@ BFD32_BACKENDS_CFILES = \ vms-misc.c \ vms-tir.c \ xcofflink.c \ - xsym.c + xsym.c \ + xtensa-isa.c \ + xtensa-modules.c # The .o files needed by all of the 64 bit vectors that are configured into # target_vector in targets.c if configured with --enable-targets=all @@ -957,6 +965,7 @@ cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h +cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \ @@ -1286,6 +1295,9 @@ elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ elf32-target.h +elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/bfdlink.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/xtensa.h $(INCDIR)/xtensa-isa.h elf32-target.h elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ @@ -1490,6 +1502,10 @@ xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \ libxcoff.h xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h +xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-isa-internal.h +xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-isa-internal.h aix5ppc-core.lo: aix5ppc-core.c aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index a05b342..3de6121 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -226,6 +226,7 @@ ALL_MACHINES = \ cpu-we32k.lo \ cpu-w65.lo \ cpu-xstormy16.lo \ + cpu-xtensa.lo \ cpu-z8k.lo @@ -281,6 +282,7 @@ ALL_MACHINES_CFILES = \ cpu-we32k.c \ cpu-w65.c \ cpu-xstormy16.c \ + cpu-xtensa.c \ cpu-z8k.c @@ -376,6 +378,7 @@ BFD32_BACKENDS = \ elf32-v850.lo \ elf32-vax.lo \ elf32-xstormy16.lo \ + elf32-xtensa.lo \ elf32.lo \ elflink.lo \ elf-strtab.lo \ @@ -444,7 +447,9 @@ BFD32_BACKENDS = \ vms-misc.lo \ vms-tir.lo \ xcofflink.lo \ - xsym.lo + xsym.lo \ + xtensa-isa.lo \ + xtensa-modules.lo BFD32_BACKENDS_CFILES = \ @@ -536,6 +541,7 @@ BFD32_BACKENDS_CFILES = \ elf32-v850.c \ elf32-vax.c \ elf32-xstormy16.c \ + elf32-xtensa.c \ elf32.c \ elflink.c \ elf-strtab.c \ @@ -603,7 +609,9 @@ BFD32_BACKENDS_CFILES = \ vms-misc.c \ vms-tir.c \ xcofflink.c \ - xsym.c + xsym.c \ + xtensa-isa.c \ + xtensa-modules.c # The .o files needed by all of the 64 bit vectors that are configured into @@ -799,7 +807,7 @@ configure.in version.h DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = tar +TAR = gtar GZIP_ENV = --best SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS) @@ -1490,6 +1498,7 @@ cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h +cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \ @@ -1819,6 +1828,9 @@ elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ elf32-target.h +elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/bfdlink.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/xtensa.h $(INCDIR)/xtensa-isa.h elf32-target.h elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ @@ -2023,6 +2035,10 @@ xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \ libxcoff.h xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h +xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-isa-internal.h +xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-isa-internal.h aix5ppc-core.lo: aix5ppc-core.c aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ diff --git a/bfd/aout-cris.c b/bfd/aout-cris.c index 7027b17..4d1e48d 100644 --- a/bfd/aout-cris.c +++ b/bfd/aout-cris.c @@ -1,5 +1,5 @@ /* BFD backend for CRIS a.out binaries. - Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Axis Communications AB. Written by Hans-Peter Nilsson. @@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ functions. Beware; some of the information there is outdated. */ #define N_HEADER_IN_TEXT(x) 0 -#define BYTES_IN_WORD 4 #define N_TXTOFF(x) 32 #define ENTRY_CAN_BE_ZERO #define TEXT_START_ADDR 0 diff --git a/bfd/aout-encap.c b/bfd/aout-encap.c index 1a794ec..96c7082 100644 --- a/bfd/aout-encap.c +++ b/bfd/aout-encap.c @@ -1,5 +1,5 @@ /* BFD back-end for a.out files encapsulated with COFF headers. - Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2002 + Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_PAGE_SIZE 4096 #define SEGMENT_SIZE TARGET_PAGE_SIZE #define TEXT_START_ADDR 0 -#define BYTES_IN_WORD 4 #endif #include "bfd.h" diff --git a/bfd/aout-ns32k.c b/bfd/aout-ns32k.c index 4809ffb..0972b5d 100644 --- a/bfd/aout-ns32k.c +++ b/bfd/aout-ns32k.c @@ -1,5 +1,5 @@ /* BFD back-end for ns32k a.out-ish binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002 + Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Ian Dall (idall@eleceng.adelaide.edu.au). @@ -19,8 +19,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define BYTES_IN_WORD 4 - #include "bfd.h" #include "aout/aout64.h" #include "ns32k.h" diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index 6d5f48c..6e65fcf 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -1,5 +1,5 @@ /* BFD back-end for TMS320C30 a.out binaries. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) This file is part of BFD, the Binary File Descriptor library. @@ -21,7 +21,6 @@ #define TARGET_IS_BIG_ENDIAN_P #define N_HEADER_IN_TEXT(x) 1 -#define BYTES_IN_WORD 4 #define TEXT_START_ADDR 1024 #define TARGET_PAGE_SIZE 128 #define SEGMENT_SIZE TARGET_PAGE_SIZE diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 998bca7..7f02d13 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -1,6 +1,6 @@ /* BFD semi-generic back-end for a.out binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002 + 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -105,9 +105,7 @@ DESCRIPTION in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in} to use the @file{@var{XXX}.mt} file (by setting "<<bfd_target=XXX>>") when your - configuration is selected. - -*/ + configuration is selected. */ /* Some assumptions: * Any BFD with D_PAGED set is ZMAGIC, and vice versa. @@ -157,9 +155,8 @@ DESCRIPTION The standard records contain only an address, a symbol index, and a type field. The extended records (used on 29ks and sparcs) also have a full integer for an - addend. + addend. */ -*/ #ifndef CTOR_TABLE_RELOC_HOWTO #define CTOR_TABLE_RELOC_IDX 2 #define CTOR_TABLE_RELOC_HOWTO(BFD) \ @@ -230,7 +227,8 @@ reloc_howto_type howto_table_ext[] = /* Convert standard reloc records to "arelent" format (incl byte swap). */ -reloc_howto_type howto_table_std[] = { +reloc_howto_type howto_table_std[] = +{ /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone. */ HOWTO ( 0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", TRUE, 0x000000ff,0x000000ff, FALSE), HOWTO ( 1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"16", TRUE, 0x0000ffff,0x0000ffff, FALSE), @@ -3067,9 +3065,10 @@ NAME(aout,link_hash_table_create) (abfd) struct aout_link_hash_table *ret; bfd_size_type amt = sizeof (struct aout_link_hash_table); - ret = (struct aout_link_hash_table *) bfd_alloc (abfd, amt); + ret = (struct aout_link_hash_table *) bfd_malloc (amt); if (ret == NULL) return (struct bfd_link_hash_table *) NULL; + if (! NAME(aout,link_hash_table_init) (ret, abfd, NAME(aout,link_hash_newfunc))) { @@ -3906,10 +3905,8 @@ NAME(aout,final_link) (abfd, info, callback) for (o = abfd->sections; o != NULL; o = o->next) { for (p = o->link_order_head; p != NULL; p = p->next) - { - if (p->type == bfd_indirect_link_order) - p->u.indirect.section->linker_mark = TRUE; - } + if (p->type == bfd_indirect_link_order) + p->u.indirect.section->linker_mark = TRUE; } have_link_order_relocs = FALSE; diff --git a/bfd/archures.c b/bfd/archures.c index 62edda1..20087b2 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -163,7 +163,7 @@ DESCRIPTION . bfd_arch_m88k, {* Motorola 88xxx *} . bfd_arch_m98k, {* Motorola 98xxx *} . bfd_arch_pyramid, {* Pyramid Technology *} -. bfd_arch_h8300, {* Hitachi H8/300 *} +. bfd_arch_h8300, {* Renesas H8/300 (formerly Hitachi H8/300) *} .#define bfd_mach_h8300 1 .#define bfd_mach_h8300h 2 .#define bfd_mach_h8300s 3 @@ -208,8 +208,8 @@ DESCRIPTION . bfd_arch_z8k, {* Zilog Z8000 *} .#define bfd_mach_z8001 1 .#define bfd_mach_z8002 2 -. bfd_arch_h8500, {* Hitachi H8/500 *} -. bfd_arch_sh, {* Hitachi SH *} +. bfd_arch_h8500, {* Renesas H8/500 (formerly Hitachi H8/500) *} +. bfd_arch_sh, {* Renesas SH (formerly Hitachi SH) *} .#define bfd_mach_sh 1 .#define bfd_mach_sh2 0x20 .#define bfd_mach_sh_dsp 0x2d @@ -224,6 +224,7 @@ DESCRIPTION .#define bfd_mach_alpha_ev5 0x20 .#define bfd_mach_alpha_ev6 0x30 . bfd_arch_arm, {* Advanced Risc Machines ARM. *} +.#define bfd_mach_arm_unknown 0 .#define bfd_mach_arm_2 1 .#define bfd_mach_arm_2a 2 .#define bfd_mach_arm_3 3 @@ -235,12 +236,13 @@ DESCRIPTION .#define bfd_mach_arm_5TE 9 .#define bfd_mach_arm_XScale 10 .#define bfd_mach_arm_ep9312 11 +.#define bfd_mach_arm_iWMMXt 12 . bfd_arch_ns32k, {* National Semiconductors ns32000 *} . bfd_arch_w65, {* WDC 65816 *} . bfd_arch_tic30, {* Texas Instruments TMS320C30 *} . bfd_arch_tic4x, {* Texas Instruments TMS320C3X/4X *} -.#define bfd_mach_c3x 30 -.#define bfd_mach_c4x 40 +.#define bfd_mach_tic3x 30 +.#define bfd_mach_tic4x 40 . bfd_arch_tic54x, {* Texas Instruments TMS320C54X *} . bfd_arch_tic80, {* TI TMS320c80 (MVP) *} . bfd_arch_v850, {* NEC V850 *} @@ -306,6 +308,8 @@ DESCRIPTION .#define bfd_mach_msp44 44 .#define bfd_mach_msp15 15 .#define bfd_mach_msp16 16 +. bfd_arch_xtensa, {* Tensilica's Xtensa cores. *} +.#define bfd_mach_xtensa 1 . bfd_arch_last . }; */ @@ -397,6 +401,7 @@ extern const bfd_arch_info_type bfd_vax_arch; extern const bfd_arch_info_type bfd_we32k_arch; extern const bfd_arch_info_type bfd_w65_arch; extern const bfd_arch_info_type bfd_xstormy16_arch; +extern const bfd_arch_info_type bfd_xtensa_arch; extern const bfd_arch_info_type bfd_z8k_arch; static const bfd_arch_info_type * const bfd_archures_list[] = @@ -454,6 +459,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] = &bfd_w65_arch, &bfd_we32k_arch, &bfd_xstormy16_arch, + &bfd_xtensa_arch, &bfd_z8k_arch, #endif 0 diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 917b46f..c39bfedd 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -835,6 +835,16 @@ extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd PARAMS ((bfd *, struct bfd_link_info *)); +/* ARM Note section processing. */ +extern bfd_boolean bfd_arm_merge_machines + PARAMS ((bfd *, bfd *)); + +extern bfd_boolean bfd_arm_update_notes + PARAMS ((bfd *, const char *)); + +extern unsigned int bfd_arm_get_mach_from_notes + PARAMS ((bfd *, const char *)); + /* TI COFF load page support. */ extern void bfd_ticoff_set_section_load_page PARAMS ((struct sec *, int)); diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 9540eeb..d349f77 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -842,6 +842,16 @@ extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd PARAMS ((bfd *, struct bfd_link_info *)); +/* ARM Note section processing. */ +extern bfd_boolean bfd_arm_merge_machines + PARAMS ((bfd *, bfd *)); + +extern bfd_boolean bfd_arm_update_notes + PARAMS ((bfd *, const char *)); + +extern unsigned int bfd_arm_get_mach_from_notes + PARAMS ((bfd *, const char *)); + /* TI COFF load page support. */ extern void bfd_ticoff_set_section_load_page PARAMS ((struct sec *, int)); @@ -1619,7 +1629,7 @@ enum bfd_architecture bfd_arch_m88k, /* Motorola 88xxx */ bfd_arch_m98k, /* Motorola 98xxx */ bfd_arch_pyramid, /* Pyramid Technology */ - bfd_arch_h8300, /* Hitachi H8/300 */ + bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */ #define bfd_mach_h8300 1 #define bfd_mach_h8300h 2 #define bfd_mach_h8300s 3 @@ -1664,8 +1674,8 @@ enum bfd_architecture bfd_arch_z8k, /* Zilog Z8000 */ #define bfd_mach_z8001 1 #define bfd_mach_z8002 2 - bfd_arch_h8500, /* Hitachi H8/500 */ - bfd_arch_sh, /* Hitachi SH */ + bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */ + bfd_arch_sh, /* Renesas SH (formerly Hitachi SH) */ #define bfd_mach_sh 1 #define bfd_mach_sh2 0x20 #define bfd_mach_sh_dsp 0x2d @@ -1680,6 +1690,7 @@ enum bfd_architecture #define bfd_mach_alpha_ev5 0x20 #define bfd_mach_alpha_ev6 0x30 bfd_arch_arm, /* Advanced Risc Machines ARM. */ +#define bfd_mach_arm_unknown 0 #define bfd_mach_arm_2 1 #define bfd_mach_arm_2a 2 #define bfd_mach_arm_3 3 @@ -1691,12 +1702,13 @@ enum bfd_architecture #define bfd_mach_arm_5TE 9 #define bfd_mach_arm_XScale 10 #define bfd_mach_arm_ep9312 11 +#define bfd_mach_arm_iWMMXt 12 bfd_arch_ns32k, /* National Semiconductors ns32000 */ bfd_arch_w65, /* WDC 65816 */ bfd_arch_tic30, /* Texas Instruments TMS320C30 */ bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */ -#define bfd_mach_c3x 30 -#define bfd_mach_c4x 40 +#define bfd_mach_tic3x 30 +#define bfd_mach_tic4x 40 bfd_arch_tic54x, /* Texas Instruments TMS320C54X */ bfd_arch_tic80, /* TI TMS320c80 (MVP) */ bfd_arch_v850, /* NEC V850 */ @@ -1762,6 +1774,8 @@ enum bfd_architecture #define bfd_mach_msp44 44 #define bfd_mach_msp15 15 #define bfd_mach_msp16 16 + bfd_arch_xtensa, /* Tensilica's Xtensa cores. */ +#define bfd_mach_xtensa 1 bfd_arch_last }; @@ -2331,9 +2345,6 @@ to compensate for the borrow when the low bits are added. */ /* Like BFD_RELOC_LO16, but PC relative. */ BFD_RELOC_PCREL_LO16, -/* Like BFD_RELOC_16_PCREL_S2, but for MIPS Embedded PIC. */ - BFD_RELOC_MIPSEMB_16_PCREL_S2, - /* Relocation against a MIPS literal section. */ BFD_RELOC_MIPS_LITERAL, @@ -2566,6 +2577,7 @@ field in the instruction. */ BFD_RELOC_ARM_SWI, BFD_RELOC_ARM_MULTI, BFD_RELOC_ARM_CP_OFF_IMM, + BFD_RELOC_ARM_CP_OFF_IMM_S2, BFD_RELOC_ARM_ADR_IMM, BFD_RELOC_ARM_LDR_IMM, BFD_RELOC_ARM_LITERAL, @@ -2586,7 +2598,7 @@ field in the instruction. */ BFD_RELOC_ARM_GOTOFF, BFD_RELOC_ARM_GOTPC, -/* Hitachi SH relocs. Not all of these appear in object files. */ +/* Renesas SH relocs. Not all of these appear in object files. */ BFD_RELOC_SH_PCDISP8BY2, BFD_RELOC_SH_PCDISP12BY2, BFD_RELOC_SH_IMM4, @@ -3427,6 +3439,38 @@ to follow the 16K memory bank of 68HC12 (seen as mapped in the window). */ BFD_RELOC_IQ2000_OFFSET_16, BFD_RELOC_IQ2000_OFFSET_21, BFD_RELOC_IQ2000_UHI16, + +/* Special Xtensa relocation used only by PLT entries in ELF shared +objects to indicate that the runtime linker should set the value +to one of its own internal functions or data structures. */ + BFD_RELOC_XTENSA_RTLD, + +/* Xtensa relocations for ELF shared objects. */ + BFD_RELOC_XTENSA_GLOB_DAT, + BFD_RELOC_XTENSA_JMP_SLOT, + BFD_RELOC_XTENSA_RELATIVE, + +/* Xtensa relocation used in ELF object files for symbols that may require +PLT entries. Otherwise, this is just a generic 32-bit relocation. */ + BFD_RELOC_XTENSA_PLT, + +/* Generic Xtensa relocations. Only the operand number is encoded +in the relocation. The details are determined by extracting the +instruction opcode. */ + BFD_RELOC_XTENSA_OP0, + BFD_RELOC_XTENSA_OP1, + BFD_RELOC_XTENSA_OP2, + +/* Xtensa relocation to mark that the assembler expanded the +instructions from an original target. The expansion size is +encoded in the reloc size. */ + BFD_RELOC_XTENSA_ASM_EXPAND, + +/* Xtensa relocation to mark that the linker should simplify +assembler-expanded instructions. This is commonly used +internally by the linker after analysis of a +BFD_RELOC_XTENSA_ASM_EXPAND. */ + BFD_RELOC_XTENSA_ASM_SIMPLIFY, BFD_RELOC_UNUSED }; typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; reloc_howto_type * @@ -4386,7 +4430,7 @@ bfd_link_split_section PARAMS ((bfd *abfd, asection *sec)); /* Extracted from simple.c. */ bfd_byte * -bfd_simple_get_relocated_section_contents PARAMS ((bfd *abfd, asection *sec, bfd_byte *outbuf)); +bfd_simple_get_relocated_section_contents PARAMS ((bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table)); #ifdef __cplusplus } diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index 2fadcbe..f089a6c 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -2247,7 +2247,12 @@ coff_arm_merge_private_bfd_data (ibfd, obfd) || obfd->xvec->flavour != bfd_target_coff_flavour) return TRUE; - /* Verify that the APCS is the same for the two BFDs */ + /* Determine what should happen if the input ARM architecture + does not match the output ARM architecture. */ + if (! bfd_arm_merge_machines (ibfd, obfd)) + return FALSE; + + /* Verify that the APCS is the same for the two BFDs. */ if (APCS_SET (ibfd)) { if (APCS_SET (obfd)) @@ -2584,7 +2589,7 @@ coff_arm_final_link_postscript (abfd, pfinfo) globals->bfd_of_glue_owner->output_has_begun = TRUE; } - return TRUE; + return bfd_arm_update_notes (abfd, ARM_NOTE_SECTION); } #include "coffcode.h" diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index 2c99af1..dab7e01 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -1,4 +1,4 @@ -/* BFD back-end for Hitachi H8/300 COFF binaries. +/* BFD back-end for Renesas H8/300 COFF binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. diff --git a/bfd/coff-h8500.c b/bfd/coff-h8500.c index c54d977..656bb48 100644 --- a/bfd/coff-h8500.c +++ b/bfd/coff-h8500.c @@ -1,24 +1,24 @@ -/* BFD back-end for Hitachi H8/500 COFF binaries. - Copyright 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002 +/* BFD back-end for Renesas H8/500 COFF binaries. + Copyright 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, <sac@cygnus.com>. -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" diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index 8a4723f..bcf059d 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -1,25 +1,25 @@ -/* BFD back-end for Hitachi Super-H COFF binaries. - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +/* BFD back-end for Renesas Super-H COFF binaries. + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, <sac@cygnus.com>. Relaxing code written by Ian Lance Taylor, <ian@cygnus.com>. -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" diff --git a/bfd/coff-tic4x.c b/bfd/coff-tic4x.c index 3062b9f..5c8de41 100644 --- a/bfd/coff-tic4x.c +++ b/bfd/coff-tic4x.c @@ -1,6 +1,7 @@ /* BFD back-end for TMS320C4X coff binaries. - Copyright 1996, 1997, 1998, 1999, 2000, 2002 + Copyright 1996, 1997, 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz) This file is part of BFD, the Binary File Descriptor library. @@ -365,7 +366,7 @@ static const bfd_coff_backend_data ticoff1_swap_table = /* TI COFF v0, DOS tools (little-endian headers). */ const bfd_target tic4x_coff0_vec = { - "coff0-c4x", /* Name. */ + "coff0-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_LITTLE, /* Header byte order is little (DOS tools). */ @@ -409,7 +410,7 @@ const bfd_target tic4x_coff0_vec = /* TI COFF v0, SPARC tools (big-endian headers). */ const bfd_target tic4x_coff0_beh_vec = { - "coff0-beh-c4x", /* Name. */ + "coff0-beh-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_BIG, /* Header byte order is big. */ @@ -454,7 +455,7 @@ const bfd_target tic4x_coff0_beh_vec = /* TI COFF v1, DOS tools (little-endian headers). */ const bfd_target tic4x_coff1_vec = { - "coff1-c4x", /* Name. */ + "coff1-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_LITTLE, /* Header byte order is little (DOS tools). */ @@ -499,7 +500,7 @@ const bfd_target tic4x_coff1_vec = /* TI COFF v1, SPARC tools (big-endian headers). */ const bfd_target tic4x_coff1_beh_vec = { - "coff1-beh-c4x", /* Name. */ + "coff1-beh-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_BIG, /* Header byte order is big. */ @@ -544,7 +545,7 @@ const bfd_target tic4x_coff1_beh_vec = /* TI COFF v2, TI DOS tools output (little-endian headers). */ const bfd_target tic4x_coff2_vec = { - "coff2-c4x", /* Name. */ + "coff2-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_LITTLE, /* Header byte order is little (DOS tools). */ @@ -589,7 +590,7 @@ const bfd_target tic4x_coff2_vec = /* TI COFF v2, TI SPARC tools output (big-endian headers). */ const bfd_target tic4x_coff2_beh_vec = { - "coff2-beh-c4x", /* Name. */ + "coff2-beh-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_BIG, /* Header byte order is big. */ diff --git a/bfd/coffcode.h b/bfd/coffcode.h index ee50a10..5c6c286 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1883,21 +1883,25 @@ coff_set_arch_mach_hook (abfd, filehdr) case ARMPEMAGIC: case THUMBPEMAGIC: arch = bfd_arch_arm; - switch (internal_f->f_flags & F_ARM_ARCHITECTURE_MASK) + machine = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION); + if (machine == bfd_mach_arm_unknown) { - case F_ARM_2: machine = bfd_mach_arm_2; break; - case F_ARM_2a: machine = bfd_mach_arm_2a; break; - case F_ARM_3: machine = bfd_mach_arm_3; break; - default: - case F_ARM_3M: machine = bfd_mach_arm_3M; break; - case F_ARM_4: machine = bfd_mach_arm_4; break; - case F_ARM_4T: machine = bfd_mach_arm_4T; break; - /* The COFF header does not have enough bits available - to cover all the different ARM architectures. So - we interpret F_ARM_5, the highest flag value to mean - "the highest ARM architecture known to BFD" which is - currently the XScale. */ - case F_ARM_5: machine = bfd_mach_arm_XScale; break; + switch (internal_f->f_flags & F_ARM_ARCHITECTURE_MASK) + { + case F_ARM_2: machine = bfd_mach_arm_2; break; + case F_ARM_2a: machine = bfd_mach_arm_2a; break; + case F_ARM_3: machine = bfd_mach_arm_3; break; + default: + case F_ARM_3M: machine = bfd_mach_arm_3M; break; + case F_ARM_4: machine = bfd_mach_arm_4; break; + case F_ARM_4T: machine = bfd_mach_arm_4T; break; + /* The COFF header does not have enough bits available + to cover all the different ARM architectures. So + we interpret F_ARM_5, the highest flag value to mean + "the highest ARM architecture known to BFD" which is + currently the XScale. */ + case F_ARM_5: machine = bfd_mach_arm_XScale; break; + } } break; #endif diff --git a/bfd/coffgen.c b/bfd/coffgen.c index c905ab1..fcb00fc 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -226,7 +226,7 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a) if (! bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f)) goto fail; - /* Now copy data as required; construct all asections etc */ + /* Now copy data as required; construct all asections etc. */ if (nscns != 0) { unsigned int i; @@ -241,8 +241,6 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a) } } - /* make_abs_section (abfd); */ - return abfd->xvec; fail: diff --git a/bfd/config.bfd b/bfd/config.bfd index c678496..d034ce8 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -58,6 +58,7 @@ thumb*) targ_archs=bfd_arm_arch ;; v850*) targ_archs=bfd_v850_arch ;; x86_64) targ_archs=bfd_i386_arch ;; xscale*) targ_archs=bfd_arm_arch ;; +xtensa*) targ_archs=bfd_xtensa_arch ;; z8k*) targ_archs=bfd_z8k_arch ;; *) targ_archs=bfd_${targ_cpu}_arch ;; esac @@ -1214,6 +1215,11 @@ case "${targ}" in targ_defvec=bfd_elf32_xstormy16_vec ;; + xtensa-*-*) + targ_defvec=bfd_elf32_xtensa_le_vec + targ_selvecs=bfd_elf32_xtensa_be_vec + ;; + z8k*-*-*) targ_defvec=z8kcoff_vec targ_underscore=yes diff --git a/bfd/configure b/bfd/configure index f41ac1d..ad1475d 100755 --- a/bfd/configure +++ b/bfd/configure @@ -37,7 +37,7 @@ ac_help="$ac_help --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer" ac_help="$ac_help - --install-libbfd controls installation of libbfd and related headers" + --enable-install-libbfd controls installation of libbfd and related headers" ac_help="$ac_help --disable-nls do not use Native Language Support" ac_help="$ac_help @@ -59,6 +59,7 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -173,6 +174,7 @@ Configuration: --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -343,6 +345,11 @@ EOF -site=* | --site=* | --sit=*) site="$ac_optarg" ;; + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -508,12 +515,16 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -552,12 +563,12 @@ else fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:556: checking for Cygwin environment" >&5 +echo "configure:567: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 561 "configure" +#line 572 "configure" #include "confdefs.h" int main() { @@ -568,7 +579,7 @@ int main() { return __CYGWIN__; ; return 0; } EOF -if { (eval echo configure:572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:583: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -585,19 +596,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:589: checking for mingw32 environment" >&5 +echo "configure:600: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 594 "configure" +#line 605 "configure" #include "confdefs.h" int main() { return __MINGW32__; ; return 0; } EOF -if { (eval echo configure:601: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:612: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -662,7 +673,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:666: checking host system type" >&5 +echo "configure:677: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -683,7 +694,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:687: checking target system type" >&5 +echo "configure:698: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -701,7 +712,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:705: checking build system type" >&5 +echo "configure:716: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -726,7 +737,7 @@ test "$host_alias" != "$target_alias" && # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:730: checking for $ac_word" >&5 +echo "configure:741: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -756,7 +767,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:760: checking for $ac_word" >&5 +echo "configure:771: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -807,7 +818,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:811: checking for $ac_word" >&5 +echo "configure:822: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -839,7 +850,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:843: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:854: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -850,12 +861,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 854 "configure" +#line 865 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:859: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -881,12 +892,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:885: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:896: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:890: checking whether we are using GNU C" >&5 +echo "configure:901: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -895,7 +906,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:899: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:910: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -914,7 +925,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:918: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:929: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -946,7 +957,7 @@ else fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:950: checking for POSIXized ISC" >&5 +echo "configure:961: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -979,7 +990,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:983: checking for a BSD compatible install" >&5 +echo "configure:994: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1032,7 +1043,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:1036: checking whether build environment is sane" >&5 +echo "configure:1047: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -1089,7 +1100,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1093: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1104: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1135,7 +1146,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:1139: checking for working aclocal" >&5 +echo "configure:1150: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1148,7 +1159,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:1152: checking for working autoconf" >&5 +echo "configure:1163: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1161,7 +1172,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:1165: checking for working automake" >&5 +echo "configure:1176: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1174,7 +1185,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:1178: checking for working autoheader" >&5 +echo "configure:1189: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1187,7 +1198,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1191: checking for working makeinfo" >&5 +echo "configure:1202: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1222,7 +1233,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1226: checking for $ac_word" >&5 +echo "configure:1237: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1254,7 +1265,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1258: checking for $ac_word" >&5 +echo "configure:1269: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1286,7 +1297,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1290: checking for $ac_word" >&5 +echo "configure:1301: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1401,7 +1412,7 @@ ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1405: checking for ld used by GCC" >&5 +echo "configure:1416: checking for ld used by GCC" >&5 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -1431,10 +1442,10 @@ echo "configure:1405: checking for ld used by GCC" >&5 esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1435: checking for GNU ld" >&5 +echo "configure:1446: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1438: checking for non-GNU ld" >&5 +echo "configure:1449: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1469,7 +1480,7 @@ else fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1473: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1484: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1486,7 +1497,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1490: checking for $LD option to reload object files" >&5 +echo "configure:1501: checking for $LD option to reload object files" >&5 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1498,7 +1509,7 @@ reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1502: checking for BSD-compatible nm" >&5 +echo "configure:1513: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1536,7 +1547,7 @@ NM="$lt_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1540: checking whether ln -s works" >&5 +echo "configure:1551: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1557,7 +1568,7 @@ else fi echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:1561: checking how to recognise dependant libraries" >&5 +echo "configure:1572: checking how to recognise dependant libraries" >&5 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1730,13 +1741,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1734: checking for object suffix" >&5 +echo "configure:1745: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1740: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1756,7 +1767,7 @@ ac_objext=$ac_cv_objext echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1760: checking for executable suffix" >&5 +echo "configure:1771: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1766,10 +1777,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -1793,7 +1804,7 @@ case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:1797: checking for ${ac_tool_prefix}file" >&5 +echo "configure:1808: checking for ${ac_tool_prefix}file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1855,7 +1866,7 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:1859: checking for file" >&5 +echo "configure:1870: checking for file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1926,7 +1937,7 @@ esac # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1930: checking for $ac_word" >&5 +echo "configure:1941: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1958,7 +1969,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1962: checking for $ac_word" >&5 +echo "configure:1973: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1993,7 +2004,7 @@ fi # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1997: checking for $ac_word" >&5 +echo "configure:2008: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2025,7 +2036,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2029: checking for $ac_word" >&5 +echo "configure:2040: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2092,8 +2103,21 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2096 "configure"' > conftest.$ac_ext - if { (eval echo configure:2097: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 2107 "configure"' > conftest.$ac_ext + if { (eval echo configure:2108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" @@ -2105,6 +2129,7 @@ case $host in LD="${LD-ld} -64" ;; esac + fi fi rm -rf conftest* ;; @@ -2112,7 +2137,7 @@ case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2116: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:2141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *ELF-32*) HPUX_IA64_MODE="32" @@ -2130,7 +2155,7 @@ ia64-*-hpux*) SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2134: checking whether the C compiler needs -belf" >&5 +echo "configure:2159: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2143,14 +2168,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 2147 "configure" +#line 2172 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:2154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -2340,7 +2365,7 @@ if test -z "$target" ; then fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:2344: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:2369: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -2363,7 +2388,7 @@ fi echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6 -echo "configure:2367: checking whether to install libbfd" >&5 +echo "configure:2392: checking whether to install libbfd" >&5 # Check whether --enable-install-libbfd or --disable-install-libbfd was given. if test "${enable_install_libbfd+set}" = set; then enableval="$enable_install_libbfd" @@ -2400,7 +2425,7 @@ fi echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2404: checking for executable suffix" >&5 +echo "configure:2429: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2410,10 +2435,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:2414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:2439: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -2440,7 +2465,7 @@ bfd_default_target_size=32 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2444: checking for $ac_word" >&5 +echo "configure:2469: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2470,7 +2495,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2474: checking for $ac_word" >&5 +echo "configure:2499: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2521,7 +2546,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2525: checking for $ac_word" >&5 +echo "configure:2550: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2553,7 +2578,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2557: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2582: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2564,12 +2589,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2568 "configure" +#line 2593 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2595,12 +2620,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2599: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2624: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2604: checking whether we are using GNU C" >&5 +echo "configure:2629: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2609,7 +2634,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2613: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2638: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2628,7 +2653,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2632: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2657: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2660,9 +2685,9 @@ else fi -ALL_LINGUAS="fr tr ja es sv da" +ALL_LINGUAS="fr tr ja es sv da zh_CN" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2666: checking how to run the C preprocessor" >&5 +echo "configure:2691: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2677,13 +2702,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 2681 "configure" +#line 2706 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2687: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2712: \"$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 : @@ -2694,13 +2719,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 2698 "configure" +#line 2723 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2704: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2729: \"$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 : @@ -2711,13 +2736,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 2715 "configure" +#line 2740 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2721: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2746: \"$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 : @@ -2744,7 +2769,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2748: checking for $ac_word" >&5 +echo "configure:2773: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2772,12 +2797,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2776: checking for ANSI C header files" >&5 +echo "configure:2801: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2781 "configure" +#line 2806 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -2785,7 +2810,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2789: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2814: \"$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* @@ -2802,7 +2827,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2806 "configure" +#line 2831 "configure" #include "confdefs.h" #include <string.h> EOF @@ -2820,7 +2845,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2824 "configure" +#line 2849 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -2841,7 +2866,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 2845 "configure" +#line 2870 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2852,7 +2877,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2876,12 +2901,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2880: checking for working const" >&5 +echo "configure:2905: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2885 "configure" +#line 2910 "configure" #include "confdefs.h" int main() { @@ -2930,7 +2955,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:2934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2959: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2951,21 +2976,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2955: checking for inline" >&5 +echo "configure:2980: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 2962 "configure" +#line 2987 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:2969: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2991,12 +3016,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2995: checking for off_t" >&5 +echo "configure:3020: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3000 "configure" +#line 3025 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3024,12 +3049,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3028: checking for size_t" >&5 +echo "configure:3053: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3033 "configure" +#line 3058 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3059,19 +3084,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:3063: checking for working alloca.h" >&5 +echo "configure:3088: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3068 "configure" +#line 3093 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3092,12 +3117,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3096: checking for alloca" >&5 +echo "configure:3121: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3101 "configure" +#line 3126 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -3125,7 +3150,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:3129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3157,12 +3182,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3161: checking whether alloca needs Cray hooks" >&5 +echo "configure:3186: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3166 "configure" +#line 3191 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -3187,12 +3212,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3191: checking for $ac_func" >&5 +echo "configure:3216: 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 3196 "configure" +#line 3221 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3215,7 +3240,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3244: \"$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 @@ -3242,7 +3267,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3246: checking stack direction for C alloca" >&5 +echo "configure:3271: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3250,7 +3275,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 3254 "configure" +#line 3279 "configure" #include "confdefs.h" find_stack_direction () { @@ -3269,7 +3294,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:3273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3290,21 +3315,21 @@ EOF fi -for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h +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:3298: checking for $ac_hdr" >&5 +echo "configure:3323: 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 3303 "configure" +#line 3328 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3308: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3333: \"$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* @@ -3333,12 +3358,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3337: checking for $ac_func" >&5 +echo "configure:3362: 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 3342 "configure" +#line 3367 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3361,7 +3386,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3390: \"$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 @@ -3386,7 +3411,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3390: checking for working mmap" >&5 +echo "configure:3415: 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 @@ -3394,7 +3419,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 3398 "configure" +#line 3423 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -3422,24 +3447,11 @@ else #include <fcntl.h> #include <sys/mman.h> -#if HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif - -#if HAVE_STDLIB_H -# include <stdlib.h> -#endif - -#if HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif - -#if HAVE_UNISTD_H -# include <unistd.h> -#endif - /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -3547,7 +3559,7 @@ main() } EOF -if { (eval echo configure:3551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3563: \"$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 @@ -3575,17 +3587,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3579: checking for $ac_hdr" >&5 +echo "configure:3591: 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 3584 "configure" +#line 3596 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3601: \"$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* @@ -3615,12 +3627,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3619: checking for $ac_func" >&5 +echo "configure:3631: 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 3624 "configure" +#line 3636 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3643,7 +3655,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3659: \"$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 @@ -3672,12 +3684,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3676: checking for $ac_func" >&5 +echo "configure:3688: 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 3681 "configure" +#line 3693 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3700,7 +3712,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3716: \"$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 @@ -3734,19 +3746,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3738: checking for LC_MESSAGES" >&5 +echo "configure:3750: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3743 "configure" +#line 3755 "configure" #include "confdefs.h" #include <locale.h> int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -3767,7 +3779,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3771: checking whether NLS is requested" >&5 +echo "configure:3783: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -3787,7 +3799,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3791: checking whether included gettext is requested" >&5 +echo "configure:3803: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -3806,17 +3818,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3810: checking for libintl.h" >&5 +echo "configure:3822: checking for libintl.h" >&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 3815 "configure" +#line 3827 "configure" #include "confdefs.h" #include <libintl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3820: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3832: \"$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* @@ -3833,19 +3845,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3837: checking for gettext in libc" >&5 +echo "configure:3849: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3842 "configure" +#line 3854 "configure" #include "confdefs.h" #include <libintl.h> int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -3861,7 +3873,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3865: checking for bindtextdomain in -lintl" >&5 +echo "configure:3877: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3869,7 +3881,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3873 "configure" +#line 3885 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3880,7 +3892,7 @@ int main() { bindtextdomain() ; return 0; } EOF -if { (eval echo configure:3884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3896,19 +3908,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:3900: checking for gettext in libintl" >&5 +echo "configure:3912: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3905 "configure" +#line 3917 "configure" #include "confdefs.h" int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -3936,7 +3948,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3940: checking for $ac_word" >&5 +echo "configure:3952: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3970,12 +3982,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3974: checking for $ac_func" >&5 +echo "configure:3986: 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 3979 "configure" +#line 3991 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3998,7 +4010,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4014: \"$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 @@ -4025,7 +4037,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4029: checking for $ac_word" >&5 +echo "configure:4041: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4061,7 +4073,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4065: checking for $ac_word" >&5 +echo "configure:4077: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4093,7 +4105,7 @@ else fi cat > conftest.$ac_ext <<EOF -#line 4097 "configure" +#line 4109 "configure" #include "confdefs.h" int main() { @@ -4101,7 +4113,7 @@ extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:4105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -4133,7 +4145,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4137: checking for $ac_word" >&5 +echo "configure:4149: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4167,7 +4179,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4171: checking for $ac_word" >&5 +echo "configure:4183: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4203,7 +4215,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4207: checking for $ac_word" >&5 +echo "configure:4219: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4293,7 +4305,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4297: checking for catalogs to be installed" >&5 +echo "configure:4309: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4321,17 +4333,17 @@ echo "configure:4297: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4325: checking for linux/version.h" >&5 +echo "configure:4337: checking for linux/version.h" >&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 4330 "configure" +#line 4342 "configure" #include "confdefs.h" #include <linux/version.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4347: \"$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* @@ -4409,7 +4421,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:4413: checking for a BSD compatible install" >&5 +echo "configure:4425: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4492,7 +4504,7 @@ if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' else echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 -echo "configure:4496: checking for build system executable suffix" >&5 +echo "configure:4508: checking for build system executable suffix" >&5 if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4520,17 +4532,17 @@ for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4524: checking for $ac_hdr" >&5 +echo "configure:4536: 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 4529 "configure" +#line 4541 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4534: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4546: \"$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* @@ -4560,17 +4572,17 @@ for ac_hdr in fcntl.h sys/file.h sys/time.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4564: checking for $ac_hdr" >&5 +echo "configure:4576: 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 4569 "configure" +#line 4581 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4586: \"$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* @@ -4597,12 +4609,12 @@ fi done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:4601: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:4613: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4606 "configure" +#line 4618 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -4611,7 +4623,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:4615: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4627: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -4636,12 +4648,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:4640: checking for $ac_hdr that defines DIR" >&5 +echo "configure:4652: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4645 "configure" +#line 4657 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -4649,7 +4661,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:4653: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4665: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -4674,7 +4686,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:4678: checking for opendir in -ldir" >&5 +echo "configure:4690: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4682,7 +4694,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 4686 "configure" +#line 4698 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4693,7 +4705,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4715,7 +4727,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:4719: checking for opendir in -lx" >&5 +echo "configure:4731: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4723,7 +4735,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 4727 "configure" +#line 4739 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4734,7 +4746,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4759,12 +4771,12 @@ fi for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4763: checking for $ac_func" >&5 +echo "configure:4775: 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 4768 "configure" +#line 4780 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4787,7 +4799,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4803: \"$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 @@ -4822,12 +4834,12 @@ EOF esac echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:4826: checking whether strstr must be declared" >&5 +echo "configure:4838: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4831 "configure" +#line 4843 "configure" #include "confdefs.h" #include <stdio.h> @@ -4848,7 +4860,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:4852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -4869,12 +4881,12 @@ EOF fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:4873: checking whether malloc must be declared" >&5 +echo "configure:4885: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4878 "configure" +#line 4890 "configure" #include "confdefs.h" #include <stdio.h> @@ -4895,7 +4907,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:4899: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4911: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -4916,12 +4928,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:4920: checking whether realloc must be declared" >&5 +echo "configure:4932: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4925 "configure" +#line 4937 "configure" #include "confdefs.h" #include <stdio.h> @@ -4942,7 +4954,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:4946: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -4963,12 +4975,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:4967: checking whether free must be declared" >&5 +echo "configure:4979: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4972 "configure" +#line 4984 "configure" #include "confdefs.h" #include <stdio.h> @@ -4989,7 +5001,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:4993: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5005: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -5010,12 +5022,12 @@ EOF fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:5014: checking whether getenv must be declared" >&5 +echo "configure:5026: checking whether getenv must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5019 "configure" +#line 5031 "configure" #include "confdefs.h" #include <stdio.h> @@ -5036,7 +5048,7 @@ int main() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:5040: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5052: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_getenv=no else @@ -5223,16 +5235,16 @@ if test "${target}" = "${host}"; then # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE # have c_impl as a member of struct core_dumpx echo $ac_n "checking for c_impl in struct core_dumpx""... $ac_c" 1>&6 -echo "configure:5227: checking for c_impl in struct core_dumpx" >&5 +echo "configure:5239: checking for c_impl in struct core_dumpx" >&5 cat > conftest.$ac_ext <<EOF -#line 5229 "configure" +#line 5241 "configure" #include "confdefs.h" #include <core.h> int main() { struct core_dumpx c; c.c_impl = 0; ; return 0; } EOF -if { (eval echo configure:5236: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5248: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_ST_C_IMPL 1 @@ -5300,17 +5312,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:5304: checking for $ac_hdr" >&5 +echo "configure:5316: 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 5309 "configure" +#line 5321 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5314: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5326: \"$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* @@ -5338,12 +5350,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:5342: checking for prstatus_t in sys/procfs.h" >&5 +echo "configure:5354: 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 5347 "configure" +#line 5359 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5352,7 +5364,7 @@ int main() { prstatus_t avar ; return 0; } EOF -if { (eval echo configure:5356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5368: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus_t=yes else @@ -5374,12 +5386,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:5378: checking for prstatus32_t in sys/procfs.h" >&5 +echo "configure:5390: 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 5383 "configure" +#line 5395 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5388,7 +5400,7 @@ int main() { prstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5392: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5404: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus32_t=yes else @@ -5410,12 +5422,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:5414: checking for prstatus_t.pr_who in sys/procfs.h" >&5 +echo "configure:5426: 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 5419 "configure" +#line 5431 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5424,7 +5436,7 @@ int main() { prstatus_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5428: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5440: \"$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 @@ -5446,12 +5458,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:5450: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 +echo "configure:5462: 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 5455 "configure" +#line 5467 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5460,7 +5472,7 @@ int main() { prstatus32_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5476: \"$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 @@ -5482,12 +5494,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:5486: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:5498: 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 5491 "configure" +#line 5503 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5496,7 +5508,7 @@ int main() { pstatus_t avar ; return 0; } EOF -if { (eval echo configure:5500: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5512: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5518,12 +5530,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:5522: checking for pxstatus_t in sys/procfs.h" >&5 +echo "configure:5534: 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 5527 "configure" +#line 5539 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5532,7 +5544,7 @@ int main() { pxstatus_t avar ; return 0; } EOF -if { (eval echo configure:5536: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pxstatus_t=yes else @@ -5554,12 +5566,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:5558: checking for pstatus32_t in sys/procfs.h" >&5 +echo "configure:5570: 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 5563 "configure" +#line 5575 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5568,7 +5580,7 @@ int main() { pstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5584: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus32_t=yes else @@ -5590,12 +5602,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:5594: checking for prpsinfo_t in sys/procfs.h" >&5 +echo "configure:5606: 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 5599 "configure" +#line 5611 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5604,7 +5616,7 @@ int main() { prpsinfo_t avar ; return 0; } EOF -if { (eval echo configure:5608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5620: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo_t=yes else @@ -5626,12 +5638,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:5630: checking for prpsinfo32_t in sys/procfs.h" >&5 +echo "configure:5642: 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 5635 "configure" +#line 5647 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5640,7 +5652,7 @@ int main() { prpsinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5644: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes else @@ -5662,12 +5674,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:5666: checking for psinfo_t in sys/procfs.h" >&5 +echo "configure:5678: 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 5671 "configure" +#line 5683 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5676,7 +5688,7 @@ int main() { psinfo_t avar ; return 0; } EOF -if { (eval echo configure:5680: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5692: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo_t=yes else @@ -5698,12 +5710,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:5702: checking for psinfo32_t in sys/procfs.h" >&5 +echo "configure:5714: 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 5707 "configure" +#line 5719 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5712,7 +5724,7 @@ int main() { psinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5716: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5728: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo32_t=yes else @@ -5734,12 +5746,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:5738: checking for lwpstatus_t in sys/procfs.h" >&5 +echo "configure:5750: 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 5743 "configure" +#line 5755 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5748,7 +5760,7 @@ int main() { lwpstatus_t avar ; return 0; } EOF -if { (eval echo configure:5752: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5764: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpstatus_t=yes else @@ -5770,12 +5782,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:5774: checking for lwpxstatus_t in sys/procfs.h" >&5 +echo "configure:5786: 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 5779 "configure" +#line 5791 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5784,7 +5796,7 @@ int main() { lwpxstatus_t avar ; return 0; } EOF -if { (eval echo configure:5788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5800: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes else @@ -5806,12 +5818,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:5810: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 +echo "configure:5822: 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 5815 "configure" +#line 5827 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5820,7 +5832,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_context ; return 0; } EOF -if { (eval echo configure:5824: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5836: \"$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 @@ -5842,12 +5854,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:5846: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 +echo "configure:5858: 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 5851 "configure" +#line 5863 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5856,7 +5868,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_reg ; return 0; } EOF -if { (eval echo configure:5860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5872: \"$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 @@ -5878,12 +5890,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:5882: checking for win32_pstatus_t in sys/procfs.h" >&5 +echo "configure:5894: 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 5887 "configure" +#line 5899 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5892,7 +5904,7 @@ int main() { win32_pstatus_t avar ; return 0; } EOF -if { (eval echo configure:5896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5908: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes else @@ -6143,6 +6155,8 @@ do bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;; bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;; bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;; + bfd_elf32_xtensa_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;; + bfd_elf32_xtensa_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;; bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; @@ -6360,10 +6374,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:6363: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6378: 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 6366 "configure" +#line 6381 "configure" #include "confdefs.h" :__GNUC__:__GNUC_MINOR__:__i386__: EOF @@ -6405,21 +6419,21 @@ test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selar test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}" -for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h +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:6412: checking for $ac_hdr" >&5 +echo "configure:6427: 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 6417 "configure" +#line 6432 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6422: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6437: \"$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* @@ -6448,12 +6462,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6451: checking for $ac_func" >&5 +echo "configure:6466: 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 6456 "configure" +#line 6471 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6476,7 +6490,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6494: \"$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 @@ -6501,7 +6515,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6504: checking for working mmap" >&5 +echo "configure:6519: 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 @@ -6509,7 +6523,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 6512 "configure" +#line 6527 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6537,24 +6551,11 @@ else #include <fcntl.h> #include <sys/mman.h> -#if HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif - -#if HAVE_STDLIB_H -# include <stdlib.h> -#endif - -#if HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif - -#if HAVE_UNISTD_H -# include <unistd.h> -#endif - /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -6662,7 +6663,7 @@ main() } EOF -if { (eval echo configure:6665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6667: \"$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 @@ -6687,12 +6688,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6690: checking for $ac_func" >&5 +echo "configure:6692: 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 6695 "configure" +#line 6697 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6715,7 +6716,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6720: \"$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 82dc090..347ad97 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" +ALL_LINGUAS="fr tr ja es sv da zh_CN" CY_GNU_GETTEXT # Permit host specific settings. @@ -639,6 +639,8 @@ do bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;; bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;; bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;; + bfd_elf32_xtensa_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;; + bfd_elf32_xtensa_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;; bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c index 923c250..66c3a46 100644 --- a/bfd/cpu-arm.c +++ b/bfd/cpu-arm.c @@ -1,5 +1,5 @@ /* BFD support for the ARM processor - Copyright 1994, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright 1994, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) This file is part of BFD, the Binary File Descriptor library. @@ -21,11 +21,14 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" +#include "libiberty.h" static const bfd_arch_info_type * compatible PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); static bfd_boolean scan PARAMS ((const struct bfd_arch_info *, const char *)); +static bfd_boolean arm_check_note + PARAMS ((bfd *, char *, bfd_size_type, const char *, char **)); /* This routine is provided two arch_infos and works out which ARM machine which would be compatible with both and returns a pointer @@ -96,7 +99,8 @@ processors[] = { bfd_mach_arm_4, "strongarm110" }, { bfd_mach_arm_4, "strongarm1100" }, { bfd_mach_arm_XScale, "xscale" }, - { bfd_mach_arm_ep9312, "ep9312" } + { bfd_mach_arm_ep9312, "ep9312" }, + { bfd_mach_arm_iWMMXt, "iwmmxt" } }; static bfd_boolean @@ -142,8 +146,282 @@ static const bfd_arch_info_type arch_info_struct[] = N (bfd_mach_arm_5T, "armv5t", FALSE, & arch_info_struct[8]), N (bfd_mach_arm_5TE, "armv5te", FALSE, & arch_info_struct[9]), N (bfd_mach_arm_XScale, "xscale", FALSE, & arch_info_struct[10]), - N (bfd_mach_arm_ep9312, "ep9312", FALSE, NULL) + N (bfd_mach_arm_ep9312, "ep9312", FALSE, & arch_info_struct[11]), + N (bfd_mach_arm_iWMMXt,"iwmmxt", FALSE, NULL) }; const bfd_arch_info_type bfd_arm_arch = N (0, "arm", TRUE, & arch_info_struct[0]); + +/* 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 + 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. */ + +bfd_boolean +bfd_arm_merge_machines (ibfd, obfd) + bfd * ibfd; + bfd * obfd; +{ + unsigned int in = bfd_get_mach (ibfd); + unsigned int out = bfd_get_mach (obfd); + + /* If the output architecture is unknown, we now have a value to set. */ + if (out == bfd_mach_arm_unknown) + bfd_set_arch_mach (obfd, bfd_arch_arm, in); + + /* If the input architecure is unknown, + then so must be the output architecture. */ + else if (in == bfd_mach_arm_unknown) + /* FIXME: We ought to have some way to + override this on the command line. */ + bfd_set_arch_mach (obfd, bfd_arch_arm, bfd_mach_arm_unknown); + + /* If they are the same then nothing needs to be done. */ + else if (out == in) + ; + + /* Otherwise the general principle that a earlier architecture can be + linked with a later architecure 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 + Intel XScale binary, since these architecture have co-processors which + will not both be present on the same physical hardware. */ + else if (in == bfd_mach_arm_ep9312 + && (out == bfd_mach_arm_XScale || out == bfd_mach_arm_iWMMXt)) + { + _bfd_error_handler (_("\ +ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"), + bfd_archive_filename (ibfd), + bfd_get_filename (obfd)); + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } + else if (out == bfd_mach_arm_ep9312 + && (in == bfd_mach_arm_XScale || in == bfd_mach_arm_iWMMXt)) + { + _bfd_error_handler (_("\ +ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"), + bfd_archive_filename (obfd), + bfd_get_filename (ibfd)); + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } + else if (in > out) + bfd_set_arch_mach (obfd, bfd_arch_arm, in); + /* else + Nothing to do. */ + + return TRUE; +} + +typedef struct +{ + unsigned char namesz[4]; /* Size of entry's owner string. */ + unsigned char descsz[4]; /* Size of the note descriptor. */ + unsigned char type[4]; /* Interpretation of the descriptor. */ + char name[1]; /* Start of the name+desc data. */ +} arm_Note; + +static bfd_boolean +arm_check_note (abfd, buffer, buffer_size, expected_name, description_return) + bfd * abfd; + char * buffer; + bfd_size_type buffer_size; + const char * expected_name; + char ** description_return; +{ + unsigned long namesz; + unsigned long descsz; + unsigned long type; + char * descr; + + if (buffer_size < offsetof (arm_Note, name)) + return FALSE; + + /* We have to extract the values this way to allow for a + host whose endian-ness is different from the target. */ + namesz = bfd_get_32 (abfd, buffer); + descsz = bfd_get_32 (abfd, buffer + offsetof (arm_Note, descsz)); + type = bfd_get_32 (abfd, buffer + offsetof (arm_Note, type)); + descr = buffer + offsetof (arm_Note, name); + + /* Check for buffer overflow. */ + if (namesz + descsz + offsetof (arm_Note, name) > buffer_size) + return FALSE; + + if (expected_name == NULL) + { + if (namesz != 0) + return FALSE; + } + else + { + if (namesz != (strlen (expected_name) + 1 + 3) & ~3) + return FALSE; + + if (strcmp (descr, expected_name) != 0) + return FALSE; + + descr += (namesz + 3) & ~3; + } + + /* FIXME: We should probably check the type as well. */ + + if (description_return != NULL) + * description_return = descr; + + return TRUE; +} + +#define NOTE_ARCH_STRING "arch: " + +bfd_boolean +bfd_arm_update_notes (abfd, note_section) + bfd * abfd; + const char * note_section; +{ + asection * arm_arch_section; + bfd_size_type buffer_size; + char * buffer; + char * arch_string; + char * expected; + + /* Look for a note section. If one is present check the architecture + string encoded in it, and set it to the current architecture if it is + different. */ + arm_arch_section = bfd_get_section_by_name (abfd, note_section); + + if (arm_arch_section == NULL) + return TRUE; + + buffer_size = arm_arch_section->_raw_size; + if (buffer_size == 0) + return FALSE; + + buffer = bfd_malloc (buffer_size); + if (buffer == NULL) + return FALSE; + + if (! bfd_get_section_contents (abfd, arm_arch_section, buffer, + (file_ptr) 0, buffer_size)) + goto FAIL; + + /* Parse the note. */ + if (! arm_check_note (abfd, buffer, buffer_size, NOTE_ARCH_STRING, & arch_string)) + goto FAIL; + + /* Check the architecture in the note against the architecture of the bfd. */ + switch (bfd_get_mach (abfd)) + { + default: + case bfd_mach_arm_unknown: expected = "unknown"; break; + case bfd_mach_arm_2: expected = "armv2"; break; + case bfd_mach_arm_2a: expected = "armv2a"; break; + case bfd_mach_arm_3: expected = "armv3"; break; + case bfd_mach_arm_3M: expected = "armv3M"; break; + case bfd_mach_arm_4: expected = "armv4"; break; + case bfd_mach_arm_4T: expected = "armv4t"; break; + case bfd_mach_arm_5: expected = "armv5"; break; + case bfd_mach_arm_5T: expected = "armv5t"; break; + case bfd_mach_arm_5TE: expected = "armv5te"; break; + case bfd_mach_arm_XScale: expected = "XScale"; break; + case bfd_mach_arm_ep9312: expected = "ep9312"; break; + case bfd_mach_arm_iWMMXt: expected = "iWMMXt"; break; + } + + if (strcmp (arch_string, expected) != 0) + { + strcpy (buffer + offsetof (arm_Note, name) + ((strlen (NOTE_ARCH_STRING) + 3) & ~3), expected); + + if (! bfd_set_section_contents (abfd, arm_arch_section, buffer, + (file_ptr) 0, buffer_size)) + { + (*_bfd_error_handler) + (_("warning: unable to update contents of %s section in %s"), + note_section, bfd_get_filename (abfd)); + goto FAIL; + } + } + + free (buffer); + return TRUE; + + FAIL: + free (buffer); + return FALSE; +} + + +static struct +{ + const char * string; + unsigned int mach; +} +architectures[] = +{ + { "armv2", bfd_mach_arm_2 }, + { "armv2a", bfd_mach_arm_2a }, + { "armv3", bfd_mach_arm_3 }, + { "armv3M", bfd_mach_arm_3M }, + { "armv4", bfd_mach_arm_4 }, + { "armv4t", bfd_mach_arm_4T }, + { "armv5", bfd_mach_arm_5 }, + { "armv5t", bfd_mach_arm_5T }, + { "armv5te", bfd_mach_arm_5TE }, + { "XScale", bfd_mach_arm_XScale }, + { "ep9312", bfd_mach_arm_ep9312 }, + { "iWMMXt", bfd_mach_arm_iWMMXt } +}; + +/* Extract the machine number stored in a note section. */ +unsigned int +bfd_arm_get_mach_from_notes (abfd, note_section) + bfd * abfd; + const char * note_section; +{ + asection * arm_arch_section; + bfd_size_type buffer_size; + char * buffer; + char * arch_string; + int i; + + /* Look for a note section. If one is present check the architecture + string encoded in it, and set it to the current architecture if it is + different. */ + arm_arch_section = bfd_get_section_by_name (abfd, note_section); + + if (arm_arch_section == NULL) + return bfd_mach_arm_unknown; + + buffer_size = arm_arch_section->_raw_size; + if (buffer_size == 0) + return bfd_mach_arm_unknown; + + buffer = bfd_malloc (buffer_size); + if (buffer == NULL) + return bfd_mach_arm_unknown; + + if (! bfd_get_section_contents (abfd, arm_arch_section, buffer, + (file_ptr) 0, buffer_size)) + goto FAIL; + + /* Parse the note. */ + if (! arm_check_note (abfd, buffer, buffer_size, NOTE_ARCH_STRING, & arch_string)) + goto FAIL; + + /* Interpret the architecture string. */ + for (i = ARRAY_SIZE (architectures); i--;) + if (strcmp (arch_string, architectures[i].string) == 0) + { + free (buffer); + return architectures[i].mach; + } + + FAIL: + free (buffer); + return bfd_mach_arm_unknown; +} diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c index eafcb98..daef763 100644 --- a/bfd/cpu-h8300.c +++ b/bfd/cpu-h8300.c @@ -1,23 +1,23 @@ -/* BFD library support routines for the Hitachi H8/300 architecture. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002 +/* BFD library support routines for the Renesas H8/300 architecture. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Hacked by Steve Chamberlain of 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" diff --git a/bfd/cpu-sh.c b/bfd/cpu-sh.c index 9d9087f..fc4bf42 100644 --- a/bfd/cpu-sh.c +++ b/bfd/cpu-sh.c @@ -1,4 +1,4 @@ -/* BFD library support routines for the Hitachi-SH architecture. +/* BFD library support routines for the Renesas SH architecture. Copyright 1993, 1994, 1997, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support. diff --git a/bfd/cpu-tic4x.c b/bfd/cpu-tic4x.c index 2260f70..a7f40e1 100644 --- a/bfd/cpu-tic4x.c +++ b/bfd/cpu-tic4x.c @@ -1,5 +1,5 @@ /* bfd back-end for TMS320C[34]x support - Copyright 1996, 1997, 2002 Free Software Foundation, Inc. + Copyright 1996, 1997, 2002, 2003 Free Software Foundation, Inc. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz) @@ -23,12 +23,12 @@ #include "sysdep.h" #include "libbfd.h" -static bfd_boolean c4x_scan +static bfd_boolean tic4x_scan PARAMS ((const struct bfd_arch_info *, const char * )); static bfd_boolean -c4x_scan (info, string) +tic4x_scan (info, string) const struct bfd_arch_info *info; const char *string; { @@ -42,9 +42,9 @@ c4x_scan (info, string) return FALSE; if (*string == '3') - return (info->mach == bfd_mach_c3x); + return (info->mach == bfd_mach_tic3x); else if (*string == '4') - return info->mach == bfd_mach_c4x; + return info->mach == bfd_mach_tic4x; return FALSE; } @@ -56,13 +56,13 @@ const bfd_arch_info_type bfd_tic3x_arch = 32, /* 32 bits in an address. */ 32, /* 32 bits in a byte. */ bfd_arch_tic4x, - bfd_mach_c3x, /* Machine number. */ - "c3x", /* Architecture name. */ + bfd_mach_tic3x, /* Machine number. */ + "tic3x", /* Architecture name. */ "tms320c3x", /* Printable name. */ 0, /* Alignment power. */ FALSE, /* Not the default architecture. */ bfd_default_compatible, - c4x_scan, + tic4x_scan, 0 }; @@ -72,13 +72,13 @@ const bfd_arch_info_type bfd_tic4x_arch = 32, /* 32 bits in an address. */ 32, /* 32 bits in a byte. */ bfd_arch_tic4x, - bfd_mach_c4x, /* Machine number. */ - "c4x", /* Architecture name. */ + bfd_mach_tic4x, /* Machine number. */ + "tic4x", /* Architecture name. */ "tms320c4x", /* Printable name. */ 0, /* Alignment power. */ TRUE, /* The default architecture. */ bfd_default_compatible, - c4x_scan, + tic4x_scan, &bfd_tic3x_arch, }; diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index e7077a1..7a9e5b0 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -1,5 +1,5 @@ /* DWARF 2 support. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions @@ -245,8 +245,6 @@ static bfd_boolean lookup_address_in_line_info_table static bfd_boolean lookup_address_in_function_table PARAMS ((struct funcinfo *, bfd_vma, struct funcinfo **, const char **)); static bfd_boolean scan_unit_for_functions PARAMS ((struct comp_unit *)); -static bfd_vma find_rela_addend - PARAMS ((bfd *, asection *, bfd_size_type, asymbol**)); static struct comp_unit *parse_comp_unit PARAMS ((bfd *, struct dwarf2_debug *, bfd_vma, unsigned int)); static bfd_boolean comp_unit_contains_address @@ -546,13 +544,11 @@ read_abbrevs (abfd, offset, stash) } stash->dwarf_abbrev_size = msec->_raw_size; - stash->dwarf_abbrev_buffer = (char*) bfd_alloc (abfd, msec->_raw_size); + stash->dwarf_abbrev_buffer + = bfd_simple_get_relocated_section_contents (abfd, msec, NULL, + stash->syms); if (! stash->dwarf_abbrev_buffer) return 0; - - if (! bfd_get_section_contents (abfd, msec, stash->dwarf_abbrev_buffer, - (bfd_vma) 0, msec->_raw_size)) - return 0; } if (offset >= stash->dwarf_abbrev_size) @@ -654,7 +650,7 @@ read_attribute_value (attr, form, unit, info_ptr) switch (form) { case DW_FORM_addr: - /* FIXME: DWARF3 draft sais DW_FORM_ref_addr is offset_size. */ + /* FIXME: DWARF3 draft says DW_FORM_ref_addr is offset_size. */ case DW_FORM_ref_addr: DW_ADDR (attr) = read_address (unit, info_ptr); info_ptr += unit->addr_size; @@ -821,11 +817,11 @@ struct funcinfo bfd_vma high; }; -/* add_line_info: adds a new entry to the line_info list in the - line_info_table, ensuring that the list is sorted. Note that the - line_info list is sorted from highest to lowest VMA (with possible - duplicates); that is, line_info->prev_line always accesses an equal - or smaller VMA. */ +/* Adds a new entry to the line_info list in the line_info_table, ensuring + that the list is sorted. Note that the line_info list is sorted from + highest to lowest VMA (with possible duplicates); that is, + line_info->prev_line always accesses an equal or smaller VMA. */ + static void add_line_info (table, address, filename, line, column, end_sequence) struct line_info_table* table; @@ -905,12 +901,25 @@ add_line_info (table, address, filename, line, column, end_sequence) /* Set member data of 'info'. */ info->address = address; - info->filename = filename; info->line = line; info->column = column; info->end_sequence = end_sequence; + + amt = strlen (filename); + if (amt) + { + info->filename = bfd_alloc (table->abfd, amt + 1); + if (info->filename) + strcpy (info->filename, filename); + } + else + info->filename = NULL; } +/* Extract a fully qualified filename from a line info table. + The returned string has been malloc'ed and it is the caller's + responsibility to free it. */ + static char * concat_filename (table, file) struct line_info_table* table; @@ -922,25 +931,32 @@ concat_filename (table, file) { (*_bfd_error_handler) (_("Dwarf Error: mangled line number section (bad file number).")); - return "<unknown>"; + return strdup ("<unknown>"); } filename = table->files[file - 1].name; - if (IS_ABSOLUTE_PATH(filename)) - return filename; - else + + if (! IS_ABSOLUTE_PATH (filename)) { char* dirname = (table->files[file - 1].dir ? table->dirs[table->files[file - 1].dir - 1] : table->comp_dir); - /* Not all tools set DW_AT_comp_dir, so dirname may be unknown. The - best we can do is return the filename part. */ - if (dirname == NULL) - return filename; - else - return (char*) concat (dirname, "/", filename, NULL); + /* Not all tools set DW_AT_comp_dir, so dirname may be unknown. + The best we can do is return the filename part. */ + if (dirname != NULL) + { + unsigned int len = strlen (dirname) + strlen (filename) + 2; + char * name; + + name = bfd_malloc (len); + if (name) + sprintf (name, "%s/%s", dirname, filename); + return name; + } } + + return strdup (filename); } static void @@ -1019,21 +1035,15 @@ decode_line_info (unit, stash) } stash->dwarf_line_size = msec->_raw_size; - stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, msec->_raw_size); + stash->dwarf_line_buffer + = bfd_simple_get_relocated_section_contents (abfd, msec, NULL, + stash->syms); if (! stash->dwarf_line_buffer) return 0; - - if (! bfd_get_section_contents (abfd, msec, stash->dwarf_line_buffer, - (bfd_vma) 0, msec->_raw_size)) - return 0; - - /* FIXME: We ought to apply the relocs against this section before - we process it... */ } - /* Since we are using un-relocated data, it is possible to get a bad value - for the line_offset. Validate it here so that we won't get a segfault - below. */ + /* It is possible to get a bad value for the line_offset. Validate + it here so that we won't get a segfault below. */ if (unit->line_offset >= stash->dwarf_line_size) { (*_bfd_error_handler) (_("Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)."), @@ -1272,6 +1282,8 @@ decode_line_info (unit, stash) based, the references are 1 based. */ file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; + if (filename) + free (filename); filename = concat_filename (table, file); break; } @@ -1296,6 +1308,7 @@ decode_line_info (unit, stash) default: { int i; + /* Unknown standard opcode, ignore it. */ for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++) { @@ -1305,6 +1318,9 @@ decode_line_info (unit, stash) } } } + + if (filename) + free (filename); } return table; @@ -1521,60 +1537,6 @@ scan_unit_for_functions (unit) return TRUE; } -/* Look for a RELA relocation to be applied on OFFSET of section SEC, - and return the addend if such a relocation is found. Since this is - only used to find relocations referring to the .debug_abbrev - section, we make sure the relocation refers to this section, but - this is not strictly necessary, and it can probably be safely - removed if needed. However, it is important to note that this - function only returns the addend, it doesn't serve the purpose of - applying a generic relocation. - - If no suitable relocation is found, or if it is not a real RELA - relocation, this function returns 0. */ - -static bfd_vma -find_rela_addend (abfd, sec, offset, syms) - bfd* abfd; - asection* sec; - bfd_size_type offset; - asymbol** syms; -{ - long reloc_size = bfd_get_reloc_upper_bound (abfd, sec); - arelent **relocs = NULL; - long reloc_count, relc; - - if (reloc_size <= 0) - return 0; - - relocs = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); - if (relocs == NULL) - return 0; - - reloc_count = bfd_canonicalize_reloc (abfd, sec, relocs, syms); - - if (reloc_count <= 0) - { - free (relocs); - return 0; - } - - for (relc = 0; relc < reloc_count; relc++) - if (relocs[relc]->address == offset - && (*relocs[relc]->sym_ptr_ptr)->flags & BSF_SECTION_SYM - && strcmp ((*relocs[relc]->sym_ptr_ptr)->name, - ".debug_abbrev") == 0) - { - bfd_vma addend = (relocs[relc]->howto->partial_inplace - ? 0 : relocs[relc]->addend); - free (relocs); - return addend; - } - - free (relocs); - return 0; -} - /* 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 @@ -1602,7 +1564,6 @@ parse_comp_unit (abfd, stash, unit_length, offset_size) char *info_ptr = stash->info_ptr; char *end_ptr = info_ptr + unit_length; bfd_size_type amt; - bfd_size_type off; version = read_2_bytes (abfd, info_ptr); info_ptr += 2; @@ -1611,12 +1572,6 @@ parse_comp_unit (abfd, stash, unit_length, offset_size) abbrev_offset = read_4_bytes (abfd, info_ptr); else abbrev_offset = read_8_bytes (abfd, info_ptr); - /* The abbrev offset is generally a relocation pointing to - .debug_abbrev+offset. On RELA targets, we have to find the - relocation and extract the addend to obtain the actual - abbrev_offset, so do it here. */ - off = info_ptr - stash->sec_info_ptr; - abbrev_offset += find_rela_addend (abfd, stash->sec, off, stash->syms); info_ptr += offset_size; addr_size = read_1_byte (abfd, info_ptr); info_ptr += 1; @@ -1939,8 +1894,8 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, start = stash->info_ptr_end - stash->info_ptr; - if (! bfd_get_section_contents (abfd, msec, stash->info_ptr + start, - (bfd_vma) 0, size)) + if ((bfd_simple_get_relocated_section_contents + (abfd, msec, stash->info_ptr + start, symbols)) == NULL) continue; stash->info_ptr_end = stash->info_ptr + start + size; @@ -1953,21 +1908,6 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, stash->syms = symbols; } - /* FIXME: There is a problem with the contents of the - .debug_info section. The 'low' and 'high' addresses of the - comp_units are computed by relocs against symbols in the - .text segment. We need these addresses in order to determine - the nearest line number, and so we have to resolve the - relocs. There is a similar problem when the .debug_line - section is processed as well (e.g., there may be relocs - against the operand of the DW_LNE_set_address operator). - - Unfortunately getting hold of the reloc information is hard... - - For now, this means that disassembling object files (as - opposed to fully executables) does not always work as well as - we would like. */ - /* A null info_ptr indicates that there is no dwarf2 info (or that an error occured while setting up the stash). */ if (! stash->info_ptr) @@ -1987,26 +1927,34 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, bfd_boolean found; unsigned int offset_size = addr_size; - if (addr_size == 4) + length = read_4_bytes (abfd, stash->info_ptr); + /* A 0xffffff length is the DWARF3 way of indicating we use + 64-bit offsets, instead of 32-bit offsets. */ + if (length == 0xffffffff) { - length = read_4_bytes (abfd, stash->info_ptr); - if (length == 0xffffffff) - { - offset_size = 8; - length = read_8_bytes (abfd, stash->info_ptr + 4); - stash->info_ptr += 8; - } - else if (length == 0) - { - /* Handle (non-standard) 64-bit DWARF2 formats. */ - offset_size = 8; - length = read_4_bytes (abfd, stash->info_ptr + 4); - stash->info_ptr += 4; - } + offset_size = 8; + length = read_8_bytes (abfd, stash->info_ptr + 4); + stash->info_ptr += 12; + } + /* A zero length is the IRIX way of indicating 64-bit offsets, + mostly because the 64-bit length will generally fit in 32 + bits, and the endianness helps. */ + else if (length == 0) + { + offset_size = 8; + length = read_4_bytes (abfd, stash->info_ptr + 4); + stash->info_ptr += 8; + } + /* In the absence of the hints above, we assume addr_size-sized + offsets, for backward-compatibility with pre-DWARF3 64-bit + platforms. */ + else if (addr_size == 8) + { + length = read_8_bytes (abfd, stash->info_ptr); + stash->info_ptr += 8; } else - length = read_8_bytes (abfd, stash->info_ptr); - stash->info_ptr += addr_size; + stash->info_ptr += 4; if (length > 0) { @@ -2034,10 +1982,10 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, { if (comp_unit_contains_address (each, addr)) return comp_unit_find_nearest_line (each, addr, - filename_ptr, - functionname_ptr, - linenumber_ptr, - stash); + filename_ptr, + functionname_ptr, + linenumber_ptr, + stash); } else { diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index 7764074..7d0b52b 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -2,21 +2,21 @@ Copyright 2001, 2002, 2003 Free Software Foundation, Inc. Written by Jakub Jelinek <jakub@redhat.com>. -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" @@ -39,7 +39,7 @@ static void write_value static int cie_compare PARAMS ((struct cie *, struct cie *)); static int vma_compare - PARAMS ((const PTR a, const PTR b)); + PARAMS ((const PTR, const PTR)); /* Helper function for reading uleb128 encoded data. */ @@ -1112,7 +1112,7 @@ vma_compare (a, b) fde_count x [encoded] initial_loc, fde (array of encoded pairs containing FDE initial_location field and FDE address, - sorted by increasing initial_loc) */ + sorted by increasing initial_loc). */ bfd_boolean _bfd_elf_write_section_eh_frame_hdr (abfd, info) @@ -1125,6 +1125,7 @@ _bfd_elf_write_section_eh_frame_hdr (abfd, info) bfd_byte *contents; asection *eh_frame_sec; bfd_size_type size; + bfd_boolean retval; htab = elf_hash_table (info); hdr_info = &htab->eh_info; @@ -1141,15 +1142,18 @@ _bfd_elf_write_section_eh_frame_hdr (abfd, info) eh_frame_sec = bfd_get_section_by_name (abfd, ".eh_frame"); if (eh_frame_sec == NULL) - return FALSE; + { + free (contents); + return FALSE; + } memset (contents, 0, EH_FRAME_HDR_SIZE); - contents[0] = 1; /* Version */ - contents[1] = DW_EH_PE_pcrel | DW_EH_PE_sdata4; /* .eh_frame offset */ + contents[0] = 1; /* Version. */ + contents[1] = DW_EH_PE_pcrel | DW_EH_PE_sdata4; /* .eh_frame offset. */ if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count) { - contents[2] = DW_EH_PE_udata4; /* FDE count encoding */ - contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4; /* search table enc */ + contents[2] = DW_EH_PE_udata4; /* FDE count encoding. */ + contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4; /* Search table enc. */ } else { @@ -1177,7 +1181,9 @@ _bfd_elf_write_section_eh_frame_hdr (abfd, info) } } - return bfd_set_section_contents (abfd, sec->output_section, - contents, (file_ptr) sec->output_offset, - sec->_cooked_size); + retval = bfd_set_section_contents (abfd, sec->output_section, + contents, (file_ptr) sec->output_offset, + sec->_cooked_size); + free (contents); + return retval; } @@ -5068,7 +5068,10 @@ copy_private_bfd_data (ibfd, obfd) amt += ((bfd_size_type) section_count - 1) * sizeof (asection *); map = (struct elf_segment_map *) bfd_alloc (obfd, amt); if (map == NULL) - return FALSE; + { + free (sections); + return FALSE; + } /* Initialise the fields of the segment map. Set the physical physical address to the LMA of the first section that has @@ -5303,7 +5306,10 @@ swap_out_syms (abfd, sttp, relocatable_p) amt = (bfd_size_type) (1 + symcount) * bed->s->sizeof_sym; outbound_syms = bfd_alloc (abfd, amt); if (outbound_syms == NULL) - return FALSE; + { + _bfd_stringtab_free (stt); + return FALSE; + } symtab_hdr->contents = (PTR) outbound_syms; outbound_shndx = NULL; @@ -5313,7 +5319,11 @@ swap_out_syms (abfd, sttp, relocatable_p) amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx); outbound_shndx = bfd_zalloc (abfd, amt); if (outbound_shndx == NULL) - return FALSE; + { + _bfd_stringtab_free (stt); + return FALSE; + } + symtab_shndx_hdr->contents = outbound_shndx; symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX; symtab_shndx_hdr->sh_size = amt; @@ -5357,7 +5367,10 @@ swap_out_syms (abfd, sttp, relocatable_p) syms[idx]->name, TRUE, FALSE); if (sym.st_name == (unsigned long) -1) - return FALSE; + { + _bfd_stringtab_free (stt); + return FALSE; + } } type_ptr = elf_symbol_from (abfd, syms[idx]); @@ -5446,6 +5459,7 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"), syms[idx]->name ? syms[idx]->name : "<Local sym>", sec->name); bfd_set_error (bfd_error_invalid_operation); + _bfd_stringtab_free (stt); return FALSE; } @@ -5906,7 +5920,7 @@ _bfd_elf_slurp_version_tables (abfd) return TRUE; error_return: - if (contents == NULL) + if (contents != NULL) free (contents); return FALSE; } diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index 509b481..631b2b9 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -2119,11 +2119,19 @@ static bfd_boolean elf32_arm_object_p (abfd) bfd *abfd; { - /* XXX - we ought to examine a .note section here. */ + unsigned int mach; + + mach = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION); - if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT) + if (mach != bfd_mach_arm_unknown) + bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach); + + else if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT) bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_ep9312); + else + bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach); + return TRUE; } @@ -2263,6 +2271,11 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd) return TRUE; } + /* Determine what should happen if the input ARM architecture + does not match the output ARM architecture. */ + if (! bfd_arm_merge_machines (ibfd, obfd)) + return FALSE; + /* Identical flags must be compatible. */ if (in_flags == out_flags) return TRUE; @@ -3660,6 +3673,30 @@ elf32_arm_reloc_type_class (rela) } } +static bfd_boolean elf32_arm_section_flags PARAMS ((flagword *, Elf_Internal_Shdr *)); +static void elf32_arm_final_write_processing PARAMS ((bfd *, bfd_boolean)); + +/* Set the right machine number for an Arm ELF file. */ + +static bfd_boolean +elf32_arm_section_flags (flags, hdr) + flagword *flags; + Elf_Internal_Shdr *hdr; +{ + if (hdr->sh_type == SHT_NOTE) + *flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_CONTENTS; + + return TRUE; +} + +void +elf32_arm_final_write_processing (abfd, linker) + bfd *abfd; + bfd_boolean linker ATTRIBUTE_UNUSED; +{ + bfd_arm_update_notes (abfd, ARM_NOTE_SECTION); +} + #define ELF_ARCH bfd_arch_arm #define ELF_MACHINE_CODE EM_ARM #define ELF_MAXPAGESIZE 0x8000 @@ -3685,6 +3722,8 @@ elf32_arm_reloc_type_class (rela) #define elf_backend_post_process_headers elf32_arm_post_process_headers #define elf_backend_reloc_type_class elf32_arm_reloc_type_class #define elf_backend_object_p elf32_arm_object_p +#define elf_backend_section_flags elf32_arm_section_flags +#define elf_backend_final_write_processing elf32_arm_final_write_processing #define elf_backend_can_gc_sections 1 #define elf_backend_plt_readonly 1 diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index 09604e7..c79688a 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -1,5 +1,5 @@ -/* Generic support for 32-bit ELF - Copyright 1993, 1995, 1998, 1999, 2001, 2002 +/* BFD back-end for Renesas H8/300 ELF binaries. + Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index a751d98..eae3190 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -506,6 +506,12 @@ elf_i386_grok_psinfo (abfd, note) #define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1" +/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid + copying dynamic variables from a shared lib into an app's dynbss + section, and instead use a dynamic relocation to point into the + shared lib. */ +#define ELIMINATE_COPY_RELOCS 1 + /* The size in bytes of an entry in the procedure linkage table. */ #define PLT_ENTRY_SIZE 16 @@ -1106,7 +1112,8 @@ elf_i386_check_relocs (abfd, info, sec, relocs) || h->root.type == bfd_link_hash_defweak || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)))) - || (!info->shared + || (ELIMINATE_COPY_RELOCS + && !info->shared && (sec->flags & SEC_ALLOC) != 0 && h != NULL && (h->root.type == bfd_link_hash_defweak @@ -1372,8 +1379,6 @@ elf_i386_adjust_dynamic_symbol (info, h) struct elf_link_hash_entry *h; { struct elf_i386_link_hash_table *htab; - struct elf_i386_link_hash_entry * eh; - struct elf_i386_dyn_relocs *p; asection *s; unsigned int power_of_two; @@ -1418,6 +1423,10 @@ elf_i386_adjust_dynamic_symbol (info, h) || h->weakdef->root.type == bfd_link_hash_defweak); h->root.u.def.section = h->weakdef->root.u.def.section; h->root.u.def.value = h->weakdef->root.u.def.value; + if (ELIMINATE_COPY_RELOCS || info->nocopyreloc) + h->elf_link_hash_flags + = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) + | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); return TRUE; } @@ -1443,20 +1452,26 @@ elf_i386_adjust_dynamic_symbol (info, h) return TRUE; } - eh = (struct elf_i386_link_hash_entry *) h; - for (p = eh->dyn_relocs; p != NULL; p = p->next) + if (ELIMINATE_COPY_RELOCS) { - s = p->sec->output_section; - if (s != NULL && (s->flags & SEC_READONLY) != 0) - break; - } + struct elf_i386_link_hash_entry * eh; + struct elf_i386_dyn_relocs *p; - /* If we didn't find any dynamic relocs in read-only sections, then - we'll be keeping the dynamic relocs and avoiding the copy reloc. */ - if (p == NULL) - { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; - return TRUE; + eh = (struct elf_i386_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + s = p->sec->output_section; + if (s != NULL && (s->flags & SEC_READONLY) != 0) + break; + } + + /* If we didn't find any dynamic relocs in read-only sections, then + we'll be keeping the dynamic relocs and avoiding the copy reloc. */ + if (p == NULL) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return TRUE; + } } /* We must allocate the symbol in our .dynbss section, which will @@ -1676,7 +1691,7 @@ allocate_dynrelocs (h, inf) } } } - else + else if (ELIMINATE_COPY_RELOCS) { /* For the non-shared case, discard space for relocs against symbols which turn out to need copy relocs or are not @@ -2412,7 +2427,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, && (! info->symbolic || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)))) - || (!info->shared + || (ELIMINATE_COPY_RELOCS + && !info->shared && h != NULL && h->dynindx != -1 && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 98ea6a6..26fa393 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -1,5 +1,5 @@ /* Motorola 68HC11-specific support for 32-bit ELF - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Stephane Carrez (stcarrez@nerim.fr) (Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com)) @@ -143,7 +143,7 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { FALSE, /* partial_inplace */ 0x00ff, /* src_mask */ 0x00ff, /* dst_mask */ - FALSE), /* pcrel_offset */ + TRUE), /* pcrel_offset */ /* A 16 bit absolute relocation */ HOWTO (R_M68HC11_16, /* type */ @@ -204,7 +204,7 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { FALSE, /* partial_inplace */ 0xffff, /* src_mask */ 0xffff, /* dst_mask */ - FALSE), /* pcrel_offset */ + TRUE), /* pcrel_offset */ /* GNU extension to record C++ vtable hierarchy */ HOWTO (R_M68HC11_GNU_VTINHERIT, /* type */ @@ -247,8 +247,8 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { bfd_elf_generic_reloc, /* special_function */ "R_M68HC11_24", /* name */ FALSE, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ FALSE), /* pcrel_offset */ /* A 16-bit low relocation */ @@ -445,6 +445,9 @@ elf32_m68hc11_gc_sweep_hook (abfd, info, sec, relocs) return TRUE; } + +/* 68HC11 Linker Relaxation. */ + struct m68hc11_direct_relax { const char *name; @@ -694,6 +697,7 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) bfd_vma value; Elf_Internal_Sym *isym; asection *sym_sec; + int is_far = 0; /* If this isn't something that can be relaxed, then ignore this reloc. */ @@ -747,7 +751,7 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) prev_insn_group = 0; /* Do nothing if this reloc is the last byte in the section. */ - if (irel->r_offset == sec->_cooked_size) + if (irel->r_offset + 2 >= sec->_cooked_size) continue; /* See if the next instruction is an unconditional pc-relative @@ -793,6 +797,7 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) { /* A local symbol. */ isym = isymbuf + ELF32_R_SYM (irel->r_info); + is_far = isym->st_other & STO_M68HC12_FAR; sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); symval = (isym->st_value + sym_sec->output_section->vma @@ -818,6 +823,7 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) continue; } + is_far = h->other & STO_M68HC12_FAR; isym = 0; sym_sec = h->root.u.def.section; symval = (h->root.u.def.value @@ -891,23 +897,25 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) { code = 0x20; bfd_put_8 (abfd, code, contents + prev_insn_branch->r_offset); - bfd_put_8 (abfd, offset, + bfd_put_8 (abfd, 0xff, contents + prev_insn_branch->r_offset + 1); + irel->r_offset = prev_insn_branch->r_offset + 1; irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), - R_M68HC11_NONE); + R_M68HC11_PCREL_8); m68hc11_elf_relax_delete_bytes (abfd, sec, - irel->r_offset, 1); + irel->r_offset + 1, 1); } else { code ^= 0x1; bfd_put_8 (abfd, code, contents + prev_insn_branch->r_offset); - bfd_put_8 (abfd, offset, + bfd_put_8 (abfd, 0xff, contents + prev_insn_branch->r_offset + 1); + irel->r_offset = prev_insn_branch->r_offset + 1; irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), - R_M68HC11_NONE); + R_M68HC11_PCREL_8); m68hc11_elf_relax_delete_bytes (abfd, sec, - irel->r_offset - 1, 3); + irel->r_offset + 1, 3); } prev_insn_branch = 0; *again = TRUE; @@ -991,14 +999,14 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) /* That will change things, so, we should relax again. */ *again = TRUE; } - else if (ELF32_R_TYPE (irel->r_info) == R_M68HC11_16) + else if (ELF32_R_TYPE (irel->r_info) == R_M68HC11_16 && !is_far) { unsigned char code; bfd_vma offset; prev_insn_branch = 0; code = bfd_get_8 (abfd, contents + irel->r_offset - 1); - if (code == 0x7e) + if (code == 0x7e || code == 0xbd) { offset = value - (irel->r_offset + sec->output_section->vma @@ -1021,13 +1029,13 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) free_extsyms = NULL; /* Shrink the branch. */ - code = 0x20; + code = (code == 0x7e) ? 0x20 : 0x8d; bfd_put_8 (abfd, code, contents + irel->r_offset - 1); - bfd_put_8 (abfd, offset, + bfd_put_8 (abfd, 0xff, contents + irel->r_offset); irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), - R_M68HC11_NONE); + R_M68HC11_PCREL_8); m68hc11_elf_relax_delete_bytes (abfd, sec, irel->r_offset + 1, 1); /* That will change things, so, we should relax again. */ @@ -1220,7 +1228,7 @@ m68hc11_elf_relax_delete_bytes (abfd, sec, addr, count) { if (isym->st_shndx == sec_shndx && isym->st_value > addr - && isym->st_value < toaddr) + && isym->st_value <= toaddr) isym->st_value -= count; } @@ -1236,7 +1244,7 @@ m68hc11_elf_relax_delete_bytes (abfd, sec, addr, count) || sym_hash->root.type == bfd_link_hash_defweak) && sym_hash->root.u.def.section == sec && sym_hash->root.u.def.value > addr - && sym_hash->root.u.def.value < toaddr) + && sym_hash->root.u.def.value <= toaddr) { sym_hash->root.u.def.value -= count; } diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 19a2ce8..abb0eec 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1097,6 +1097,17 @@ elf_m68k_adjust_dynamic_symbol (info, h) return TRUE; } +/* This is the condition under which elf_m68k_finish_dynamic_symbol + will be called from elflink.h. If elflink.h doesn't call our + finish_dynamic_symbol routine, we'll need to do something about + initializing any .plt and .got entries in elf_m68k_relocate_section. */ +#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \ + ((DYN) \ + && ((SHARED) \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \ + && ((H)->dynindx != -1 \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) + /* Set the sizes of the dynamic sections. */ static bfd_boolean @@ -1416,9 +1427,14 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, || r_type == R_68K_GOT32) && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") != 0)) - && elf_hash_table (info)->dynamic_sections_created + && (WILL_CALL_FINISH_DYNAMIC_SYMBOL + (elf_hash_table (info)->dynamic_sections_created, + info->shared, h)) && (! info->shared - || (! info->symbolic && h->dynindx != -1) + || (! info->symbolic + && h->dynindx != -1 + && (h->elf_link_hash_flags + & ELF_LINK_FORCED_LOCAL) == 0) || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) || (info->shared @@ -1496,13 +1512,18 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, if (h != NULL) { + bfd_boolean dyn; + off = h->got.offset; BFD_ASSERT (off != (bfd_vma) -1); - if (!elf_hash_table (info)->dynamic_sections_created + dyn = elf_hash_table (info)->dynamic_sections_created; + if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) || (info->shared - && (info->symbolic || h->dynindx == -1) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) != 0) { /* This is actually a static link, or it is a -Bsymbolic link and the symbol is defined @@ -1940,7 +1961,9 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym) The entry in the global offset table will already have been initialized in the relocate_section function. */ if (info->shared - && (info->symbolic || h->dynindx == -1) + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) { rela.r_info = ELF32_R_INFO (0, R_68K_RELATIVE); diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index cf705d5..adf057b 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -261,11 +261,9 @@ static reloc_howto_type elf_mips_howto_table_rel[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. Note that the ABI document has a typo - and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. - We do the right thing here. */ + /* 16 bit PC relative reference. */ HOWTO (R_MIPS_PC16, /* type */ - 2, /* rightshift */ + 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -1403,7 +1401,7 @@ static const struct elf_reloc_map mips_reloc_map[] = { BFD_RELOC_GPREL16, R_MIPS_GPREL16 }, { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL }, { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 }, - { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 }, + { BFD_RELOC_16_PCREL, R_MIPS_PC16 }, { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 }, { BFD_RELOC_GPREL32, R_MIPS_GPREL32 }, { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 }, @@ -1442,11 +1440,12 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) case BFD_RELOC_CTOR: /* We need to handle BFD_RELOC_CTOR specially. Select the right relocation (R_MIPS_32 or R_MIPS_64) based on the - size of addresses on this architecture. */ - if (bfd_arch_bits_per_address (abfd) == 32) - return &howto_table[(int) R_MIPS_32]; - else + size of addresses of the ABI. */ + if ((elf_elfheader (abfd)->e_flags & (E_MIPS_ABI_O64 + | E_MIPS_ABI_EABI64)) != 0) return &elf_mips_ctor64_howto; + else + return &howto_table[(int) R_MIPS_32]; case BFD_RELOC_MIPS16_JMP: return &elf_mips16_jump_howto; @@ -1460,7 +1459,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) return &elf_mips_gnu_rel_hi16; case BFD_RELOC_PCREL_LO16: return &elf_mips_gnu_rel_lo16; - case BFD_RELOC_MIPSEMB_16_PCREL_S2: + case BFD_RELOC_16_PCREL_S2: return &elf_mips_gnu_rel16_s2; case BFD_RELOC_64_PCREL: return &elf_mips_gnu_pcrel64; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 9947af8..186f39d 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -147,8 +147,12 @@ static bfd_boolean ppc_elf_grok_psinfo #define DTP_OFFSET 0x8000 /* Will references to this symbol always reference the symbol - in this object? */ -#define SYMBOL_REFERENCES_LOCAL(INFO, H) \ + in this object? STV_PROTECTED is excluded from the visibility test + here so that function pointer comparisons work properly. Since + function symbols not defined in an app are set to their .plt entry, + it's necessary for shared libs to also reference the .plt even + though the symbol is really local to the shared lib. */ +#define SYMBOL_REFERENCES_LOCAL(INFO, H) \ ((! INFO->shared \ || INFO->symbolic \ || H->dynindx == -1 \ @@ -2300,7 +2304,7 @@ ppc_elf_create_linker_section (abfd, info, which) switch (which) { default: - (*_bfd_error_handler) (_("%s: Unknown special linker type %d"), + (*_bfd_error_handler) (_("%s: unknown special linker type %d"), bfd_get_filename (abfd), (int) which); @@ -2525,6 +2529,10 @@ ppc_elf_adjust_dynamic_symbol (info, h) || h->weakdef->root.type == bfd_link_hash_defweak); h->root.u.def.section = h->weakdef->root.u.def.section; h->root.u.def.value = h->weakdef->root.u.def.value; + if (ELIMINATE_COPY_RELOCS) + h->elf_link_hash_flags + = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) + | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); return TRUE; } @@ -3455,8 +3463,7 @@ ppc_elf_check_relocs (abfd, info, sec, relocs) case R_PPC_REL14_BRNTAKEN: case R_PPC_REL32: if (h == NULL - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0 - || SYMBOL_REFERENCES_LOCAL (info, h)) + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) break; /* fall through */ @@ -3741,8 +3748,7 @@ ppc_elf_gc_sweep_hook (abfd, info, sec, relocs) case R_PPC_REL14_BRNTAKEN: case R_PPC_REL32: if (h == NULL - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0 - || SYMBOL_REFERENCES_LOCAL (info, h)) + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) break; /* Fall thru */ @@ -4520,7 +4526,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, enum elf_ppc_reloc_type r_type2; unsigned long r_symndx2; struct elf_link_hash_entry *h2; - bfd_vma insn1, insn2, insn3; + bfd_vma insn1, insn2; bfd_vma offset; /* The next instruction should be a call to @@ -4547,8 +4553,6 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, offset = rel[1].r_offset; insn1 = bfd_get_32 (output_bfd, contents + rel->r_offset - 2); - insn3 = bfd_get_32 (output_bfd, - contents + offset + 4); if ((tls_mask & tls_gd) != 0) { /* IE */ @@ -4578,16 +4582,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, R_PPC_TPREL16_LO); rel[1].r_offset += 2; } - if (insn3 == NOP - || insn3 == CROR_151515 || insn3 == CROR_313131) - { - insn3 = insn2; - insn2 = NOP; - rel[1].r_offset += 4; - } bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2); bfd_put_32 (output_bfd, insn2, contents + offset); - bfd_put_32 (output_bfd, insn3, contents + offset + 4); if (tls_gd == 0) { /* We changed the symbol on an LD reloc. Start over @@ -4785,10 +4781,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_offset = (htab->got->output_section->vma + htab->got->output_offset + off); + outrel.r_addend = 0; if (tls_ty & (TLS_LD | TLS_GD)) { outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPMOD32); - outrel.r_addend = 0; if (tls_ty == (TLS_TLS | TLS_GD)) { loc = htab->relgot->contents; @@ -4796,9 +4792,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, * sizeof (Elf32_External_Rela)); bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + outrel.r_offset += 4; outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPREL32); - outrel.r_offset += 4; } } else if (tls_ty == (TLS_TLS | TLS_DTPREL)) @@ -4809,9 +4805,12 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_info = ELF32_R_INFO (indx, R_PPC_RELATIVE); else outrel.r_info = ELF32_R_INFO (indx, R_PPC_GLOB_DAT); - outrel.r_addend = 0; if (indx == 0) - outrel.r_addend += relocation; + { + outrel.r_addend += relocation; + if (tls_ty & (TLS_GD | TLS_DTPREL | TLS_TPREL)) + outrel.r_addend -= htab->tls_sec->vma; + } loc = htab->relgot->contents; loc += (htab->relgot->reloc_count++ * sizeof (Elf32_External_Rela)); @@ -4824,22 +4823,21 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, { bfd_vma value = relocation; - if ((tls_ty & (TLS_GD | TLS_TPREL | TLS_DTPREL - | TLS_TPRELGD)) != 0) + if (tls_ty == (TLS_TLS | TLS_LD)) + value = 1; + else if (tls_ty != 0) { value -= htab->tls_sec->vma + DTP_OFFSET; - if ((tls_ty & TLS_TPREL) != 0) + if (tls_ty == (TLS_TLS | TLS_TPREL)) value += DTP_OFFSET - TP_OFFSET; - } - if (tls_ty == (TLS_TLS | TLS_GD)) - { - bfd_put_32 (output_bfd, value, - htab->got->contents + off + 4); - value = 1; + if (tls_ty == (TLS_TLS | TLS_GD)) + { + bfd_put_32 (output_bfd, value, + htab->got->contents + off + 4); + value = 1; + } } - else if (tls_ty == (TLS_TLS | TLS_LD)) - value = 1; bfd_put_32 (output_bfd, value, htab->got->contents + off); } @@ -4887,10 +4885,11 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, got at entry m+n bears little relation to the entry m. */ if (addend != 0) (*_bfd_error_handler) - (_("%s(%s+0x%lx): non-zero addend on got reloc against `%s'"), + (_("%s(%s+0x%lx): non-zero addend on %s reloc against `%s'"), bfd_archive_filename (input_bfd), bfd_get_section_name (input_bfd, input_section), (long) rel->r_offset, + howto->name, sym_name); } break; @@ -4899,10 +4898,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_PPC_LOCAL24PC: /* It makes no sense to point a local relocation at a symbol not in this object. */ - if (h != NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && sec->output_section == NULL) + if (unresolved_reloc) { if (! (*info->callbacks->undefined_symbol) (info, h->root.root.string, @@ -4942,6 +4938,11 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, addend -= htab->tls_sec->vma + DTP_OFFSET; goto dodyn; + case R_PPC_DTPMOD32: + relocation = 1; + addend = 0; + goto dodyn; + case R_PPC_REL24: case R_PPC_REL32: case R_PPC_REL14: @@ -4968,7 +4969,6 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_PPC_ADDR14_BRNTAKEN: case R_PPC_UADDR32: case R_PPC_UADDR16: - case R_PPC_DTPMOD32: /* r_symndx will be zero only for relocs against symbols from removed linkonce sections, or sections discarded by a linker script. */ @@ -5037,8 +5037,6 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (skip) memset (&outrel, 0, sizeof outrel); - /* h->dynindx may be -1 if this symbol was marked to - become local. */ else if (h != NULL && !SYMBOL_REFERENCES_LOCAL (info, h)) { @@ -5175,7 +5173,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, || (strncmp (name, ".sbss", 5) == 0 && (name[5] == 0 || name[5] == '.')))) { - (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"), + (*_bfd_error_handler) (_("%s: the target (%s) of a %s relocation is in the wrong output section (%s)"), bfd_archive_filename (input_bfd), sym_name, howto->name, @@ -5199,7 +5197,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (! (strncmp (name, ".sdata2", 7) == 0 || strncmp (name, ".sbss2", 6) == 0)) { - (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"), + (*_bfd_error_handler) (_("%s: the target (%s) of a %s relocation is in the wrong output section (%s)"), bfd_archive_filename (input_bfd), sym_name, howto->name, @@ -5256,7 +5254,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { - (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"), + (*_bfd_error_handler) (_("%s: the target (%s) of a %s relocation is in the wrong output section (%s)"), bfd_archive_filename (input_bfd), sym_name, howto->name, @@ -5310,7 +5308,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_PPC_EMB_RELST_HA: case R_PPC_EMB_BIT_FLD: (*_bfd_error_handler) - (_("%s: Relocation %s is not yet supported for symbol %s."), + (_("%s: relocation %s is not yet supported for symbol %s."), bfd_archive_filename (input_bfd), howto->name, sym_name); @@ -5339,12 +5337,13 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_PPC_EMB_NADDR16_HA: case R_PPC_EMB_RELST_HA: /* It's just possible that this symbol is a weak symbol - that's not actually defined anywhere. In that case, + that's not actually defined anywhere. In that case, 'sec' would be NULL, and we should leave the symbol alone (it will be set to zero elsewhere in the link). */ if (sec != NULL) - /* Add 0x10000 if sign bit in 0:15 is set. */ - addend += ((relocation + addend) & 0x8000) << 1; + /* Add 0x10000 if sign bit in 0:15 is set. + Bits 0:15 are not used. */ + addend += 0x8000; break; } @@ -5363,10 +5362,11 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), + (_("%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"), bfd_archive_filename (input_bfd), bfd_get_section_name (input_bfd, input_section), (long) rel->r_offset, + howto->name, sym_name); ret = FALSE; } @@ -5412,10 +5412,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): reloc against `%s': error %d"), + (_("%s(%s+0x%lx): %s reloc against `%s': error %d"), bfd_archive_filename (input_bfd), bfd_get_section_name (input_bfd, input_section), - (long) rel->r_offset, sym_name, (int) r); + (long) rel->r_offset, howto->name, sym_name, (int) r); ret = FALSE; } } diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index c9167bc..8eb9a49 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -1,4 +1,4 @@ -/* Hitachi SH specific support for 32-bit ELF +/* Renesas SH specific support for 32-bit ELF Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Ian Lance Taylor, Cygnus Support. diff --git a/bfd/elf32-sh64-com.c b/bfd/elf32-sh64-com.c index 107e504..f14a042 100644 --- a/bfd/elf32-sh64-com.c +++ b/bfd/elf32-sh64-com.c @@ -1,4 +1,4 @@ -/* Hitachi SH64-specific support for 32-bit ELF +/* Renesas SH64-specific support for 32-bit ELF Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c index 13953e6..dc21b54 100644 --- a/bfd/elf32-sh64.c +++ b/bfd/elf32-sh64.c @@ -1,4 +1,4 @@ -/* Hitachi SH64-specific support for 32-bit ELF +/* Renesas SH64-specific support for 32-bit ELF Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index c09e9de..22ab8ef 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -845,9 +845,7 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections [r_symndx]; - relocation = (sec->output_section->vma - + sec->output_offset - + sym->st_value); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 9f564ca..bf18e205 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -4514,7 +4514,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, (!info->shared || info->no_undefined || ELF_ST_VISIBILITY (h->root.other))))) return FALSE; - ret_val = FALSE; continue; } @@ -4580,8 +4579,20 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, value -= gp; goto default_reloc; - case R_ALPHA_GPREL16: case R_ALPHA_GPREL32: + /* If the target section was a removed linkonce section, + r_symndx will be zero. In this case, assume that the + switch will not be used, so don't fill it in. If we + do nothing here, we'll get relocation truncated messages, + due to the placement of the application above 4GB. */ + if (r_symndx == 0) + { + r = bfd_reloc_ok; + break; + } + /* FALLTHRU */ + + case R_ALPHA_GPREL16: case R_ALPHA_GPRELLOW: if (dynamic_symbol_p) { diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 807ddf5..39f21b3 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -91,8 +91,14 @@ static void mips_elf64_info_to_howto_rela PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); static long mips_elf64_get_reloc_upper_bound PARAMS ((bfd *, asection *)); +static long mips_elf64_canonicalize_reloc + PARAMS ((bfd *, asection *, arelent **, asymbol **)); +static long mips_elf64_get_dynamic_reloc_upper_bound PARAMS ((bfd *)); +static long mips_elf64_canonicalize_dynamic_reloc + PARAMS ((bfd *, arelent **, asymbol **)); static bfd_boolean mips_elf64_slurp_one_reloc_table - PARAMS ((bfd *, asection *, asymbol **, const Elf_Internal_Shdr *)); + PARAMS ((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)); static void mips_elf64_write_relocs @@ -300,11 +306,9 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. Note that the ABI document has a typo - and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. - We do the right thing here. */ + /* 16 bit PC relative reference. */ HOWTO (R_MIPS_PC16, /* type */ - 2, /* rightshift */ + 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -797,11 +801,9 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. Note that the ABI document has a typo - and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. - We do the right thing here. */ + /* 16 bit PC relative reference. */ HOWTO (R_MIPS_PC16, /* type */ - 2, /* rightshift */ + 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -1898,7 +1900,7 @@ static const struct elf_reloc_map mips_reloc_map[] = /* There is no BFD reloc for R_MIPS_REL32. */ { BFD_RELOC_64, R_MIPS_64 }, { BFD_RELOC_CTOR, R_MIPS_64 }, - { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 }, + { BFD_RELOC_16_PCREL, R_MIPS_PC16 }, { BFD_RELOC_HI16_S, R_MIPS_HI16 }, { BFD_RELOC_LO16, R_MIPS_LO16 }, { BFD_RELOC_GPREL16, R_MIPS_GPREL16 }, @@ -2022,20 +2024,104 @@ mips_elf64_get_reloc_upper_bound (abfd, sec) return (sec->reloc_count * 3 + 1) * sizeof (arelent *); } -/* Read the relocations from one reloc section. */ +static long +mips_elf64_get_dynamic_reloc_upper_bound (abfd) + bfd *abfd; +{ + return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 3; +} + +/* We must also copy more relocations than the corresponding functions + in elf.c would, so the two following functions are slightly + modified from elf.c, that multiply the external relocation count by + 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; +{ + arelent *tblptr; + unsigned int i; + struct elf_backend_data *bed = get_elf_backend_data (abfd); + + if (! bed->s->slurp_reloc_table (abfd, section, symbols, FALSE)) + return -1; + + tblptr = section->relocation; + for (i = 0; i < section->reloc_count * 3; i++) + *relptr++ = tblptr++; + + *relptr = NULL; + + return section->reloc_count * 3; +} + +static long +mips_elf64_canonicalize_dynamic_reloc (abfd, storage, syms) + bfd *abfd; + arelent **storage; + asymbol **syms; +{ + bfd_boolean (*slurp_relocs) + PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); + asection *s; + long ret; + + if (elf_dynsymtab (abfd) == 0) + { + bfd_set_error (bfd_error_invalid_operation); + return -1; + } + + slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table; + ret = 0; + for (s = abfd->sections; s != NULL; s = s->next) + { + if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd) + && (elf_section_data (s)->this_hdr.sh_type == SHT_REL + || elf_section_data (s)->this_hdr.sh_type == SHT_RELA)) + { + arelent *p; + long count, i; + + if (! (*slurp_relocs) (abfd, s, syms, TRUE)) + return -1; + count = s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize * 3; + p = s->relocation; + for (i = 0; i < count; i++) + *storage++ = p++; + ret += count; + } + } + + *storage = NULL; + + return ret; +} + +/* Read the relocations from one reloc section. This is mostly copied + from elfcode.h, except for the changes to expand one external + relocation to 3 internal ones. We must unfortunately set + reloc_count to the number of external relocations, because a lot of + generic code seems to depend on this. */ static bfd_boolean -mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr) +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; - const Elf_Internal_Shdr *rel_hdr; + bfd_boolean dynamic; { PTR allocated = NULL; bfd_byte *native_relocs; - arelent *relents; arelent *relent; - bfd_vma count; bfd_vma i; int entsize; reloc_howto_type *howto_table; @@ -2045,26 +2131,24 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr) return FALSE; if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_bread (allocated, rel_hdr->sh_size, abfd) != rel_hdr->sh_size)) + || (bfd_bread (allocated, rel_hdr->sh_size, abfd) + != rel_hdr->sh_size)) goto error_return; native_relocs = (bfd_byte *) allocated; - relents = asect->relocation + asect->reloc_count; - entsize = rel_hdr->sh_entsize; BFD_ASSERT (entsize == sizeof (Elf64_Mips_External_Rel) || entsize == sizeof (Elf64_Mips_External_Rela)); - count = rel_hdr->sh_size / entsize; - if (entsize == sizeof (Elf64_Mips_External_Rel)) howto_table = mips_elf64_howto_table_rel; else howto_table = mips_elf64_howto_table_rela; - relent = relents; - for (i = 0; i < count; i++, native_relocs += entsize) + for (i = 0, relent = relents; + i < reloc_count; + i++, native_relocs += entsize) { Elf64_Mips_Internal_Rela rela; bfd_boolean used_sym, used_ssym; @@ -2166,7 +2250,7 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr) object file, and absolute for an executable file or shared library. The address of a BFD reloc is always section relative. */ - if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) + if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 || dynamic) relent->address = rela.r_offset; else relent->address = rela.r_offset - asect->vma; @@ -2193,7 +2277,10 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr) } /* Read the relocations. On Irix 6, there can be two reloc sections - associated with a single data section. */ + associated with a single data section. This is copied from + elfcode.h as well, with changes as small as accounting for 3 + internal relocs per external reloc and resetting reloc_count to + zero before processing the relocs of a section. */ static bfd_boolean mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic) @@ -2202,39 +2289,72 @@ mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic) asymbol **symbols; bfd_boolean dynamic; { - bfd_size_type amt; struct bfd_elf_section_data * const d = elf_section_data (asect); + Elf_Internal_Shdr *rel_hdr; + Elf_Internal_Shdr *rel_hdr2; + bfd_size_type reloc_count; + bfd_size_type reloc_count2; + arelent *relents; + bfd_size_type amt; + + if (asect->relocation != NULL) + return TRUE; - if (dynamic) + if (! dynamic) { - bfd_set_error (bfd_error_invalid_operation); - return FALSE; - } + if ((asect->flags & SEC_RELOC) == 0 + || asect->reloc_count == 0) + return TRUE; - if (asect->relocation != NULL - || (asect->flags & SEC_RELOC) == 0 - || asect->reloc_count == 0) - return TRUE; + rel_hdr = &d->rel_hdr; + reloc_count = NUM_SHDR_ENTRIES (rel_hdr); + rel_hdr2 = d->rel_hdr2; + reloc_count2 = (rel_hdr2 ? NUM_SHDR_ENTRIES (rel_hdr2) : 0); + + BFD_ASSERT (asect->reloc_count == reloc_count + reloc_count2); + BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset + || (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset)); + + } + else + { + /* Note that ASECT->RELOC_COUNT tends not to be accurate in this + case because relocations against this section may use the + dynamic symbol table, and in that case bfd_section_from_shdr + in elf.c does not update the RELOC_COUNT. */ + if (asect->_raw_size == 0) + return TRUE; + + rel_hdr = &d->this_hdr; + reloc_count = NUM_SHDR_ENTRIES (rel_hdr); + rel_hdr2 = NULL; + reloc_count2 = 0; + } /* Allocate space for 3 arelent structures for each Rel structure. */ - amt = asect->reloc_count; - amt *= 3 * sizeof (arelent); - asect->relocation = (arelent *) bfd_alloc (abfd, amt); - if (asect->relocation == NULL) + amt = (reloc_count + reloc_count2) * 3 * sizeof (arelent); + relents = (arelent *) bfd_alloc (abfd, amt); + if (relents == NULL) return FALSE; /* The slurp_one_reloc_table routine increments reloc_count. */ asect->reloc_count = 0; - if (! mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, &d->rel_hdr)) + if (! mips_elf64_slurp_one_reloc_table (abfd, asect, + rel_hdr, reloc_count, + relents, + symbols, dynamic)) return FALSE; if (d->rel_hdr2 != NULL) { - if (! mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, - d->rel_hdr2)) + if (! mips_elf64_slurp_one_reloc_table (abfd, asect, + rel_hdr2, reloc_count2, + relents + reloc_count * 3, + symbols, dynamic)) return FALSE; } + asect->relocation = relents; return TRUE; } @@ -2764,6 +2884,10 @@ const struct elf_size_info mips_elf64_size_info = _bfd_mips_elf_print_private_bfd_data #define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound +#define bfd_elf64_canonicalize_reloc mips_elf64_canonicalize_reloc +#define bfd_elf64_get_dynamic_reloc_upper_bound mips_elf64_get_dynamic_reloc_upper_bound +#define bfd_elf64_canonicalize_dynamic_reloc mips_elf64_canonicalize_dynamic_reloc +#define bfd_elf64_bfd_relax_section _bfd_mips_relax_section /* MIPS ELF64 archive functions. */ #define bfd_elf64_archive_functions diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 23d95d5..29c90fe 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -4518,6 +4518,10 @@ ppc64_elf_adjust_dynamic_symbol (info, h) || h->weakdef->root.type == bfd_link_hash_defweak); h->root.u.def.section = h->weakdef->root.u.def.section; h->root.u.def.value = h->weakdef->root.u.def.value; + if (ELIMINATE_COPY_RELOCS) + h->elf_link_hash_flags + = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) + | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); return TRUE; } @@ -7634,8 +7638,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, + off); if (tls_type & (TLS_LD | TLS_GD)) { - outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPMOD64); outrel.r_addend = 0; + outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPMOD64); if (tls_type == (TLS_TLS | TLS_GD)) { loc = htab->srelgot->contents; @@ -7643,9 +7647,9 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, * sizeof (Elf64_External_Rela)); bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + outrel.r_offset += 8; outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPREL64); - outrel.r_offset += 8; } } else if (tls_type == (TLS_TLS | TLS_DTPREL)) @@ -7658,7 +7662,11 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_info = ELF64_R_INFO (indx, R_PPC64_GLOB_DAT); outrel.r_addend = rel->r_addend; if (indx == 0) - outrel.r_addend += relocation; + { + outrel.r_addend += relocation; + if (tls_type & (TLS_GD | TLS_DTPREL | TLS_TPREL)) + outrel.r_addend -= htab->tls_sec->vma; + } loc = htab->srelgot->contents; loc += (htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela)); @@ -7670,21 +7678,22 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { relocation += rel->r_addend; - if (tls_type != 0) + if (tls_type == (TLS_TLS | TLS_LD)) + relocation = 1; + else if (tls_type != 0) { relocation -= htab->tls_sec->vma + DTP_OFFSET; - if ((tls_type & TLS_TPREL) != 0) + if (tls_type == (TLS_TLS | TLS_TPREL)) relocation += DTP_OFFSET - TP_OFFSET; - } - if ((tls_type & TLS_GD) != 0) - { - bfd_put_64 (output_bfd, relocation, - htab->sgot->contents + off + 8); - relocation = 1; + if (tls_type == (TLS_TLS | TLS_GD)) + { + bfd_put_64 (output_bfd, relocation, + htab->sgot->contents + off + 8); + relocation = 1; + } } - else if (tls_type == (TLS_TLS | TLS_LD)) - relocation = 1; + bfd_put_64 (output_bfd, relocation, htab->sgot->contents + off); } @@ -7793,6 +7802,11 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, addend -= htab->tls_sec->vma + DTP_OFFSET; break; + case R_PPC64_DTPMOD64: + relocation = 1; + addend = 0; + goto dodyn; + case R_PPC64_TPREL64: addend -= htab->tls_sec->vma + TP_OFFSET; goto dodyn; @@ -7803,7 +7817,6 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, /* Relocations that may need to be propagated if this is a dynamic object. */ - case R_PPC64_DTPMOD64: case R_PPC64_REL30: case R_PPC64_REL32: case R_PPC64_REL64: @@ -7981,7 +7994,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, /* These ones haven't been implemented yet. */ (*_bfd_error_handler) - (_("%s: Relocation %s is not supported for symbol %s."), + (_("%s: relocation %s is not supported for symbol %s."), bfd_archive_filename (input_bfd), ppc64_elf_howto_table[(int) r_type]->name, sym_name); @@ -8023,8 +8036,9 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, 'sec' would be NULL, and we should leave the symbol alone (it will be set to zero elsewhere in the link). */ if (sec != NULL) - /* Add 0x10000 if sign bit in 0:15 is set. */ - addend += ((relocation + addend) & 0x8000) << 1; + /* Add 0x10000 if sign bit in 0:15 is set. + Bits 0:15 are not used. */ + addend += 0x8000; break; case R_PPC64_ADDR16_DS: @@ -8095,10 +8109,11 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), + (_("%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"), bfd_archive_filename (input_bfd), bfd_get_section_name (input_bfd, input_section), (long) rel->r_offset, + ppc64_elf_howto_table[(int) r_type]->name, h->root.root.string); ret = FALSE; } @@ -8140,10 +8155,13 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): reloc against `%s': error %d"), + (_("%s(%s+0x%lx): %s reloc against `%s': error %d"), bfd_archive_filename (input_bfd), bfd_get_section_name (input_bfd, input_section), - (long) rel->r_offset, sym_name, (int) r); + (long) rel->r_offset, + ppc64_elf_howto_table[(int) r_type]->name, + sym_name, + (int) r); ret = FALSE; } } diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index 8f6490b..5a2f89a 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -1,5 +1,5 @@ -/* Hitachi SH64-specific support for 64-bit ELF - Copyright 2000, 2001, 2002 Free Software Foundation, Inc. +/* Renesas SH64-specific support for 64-bit ELF + Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index e4f04b5..bca09b7 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -96,6 +96,8 @@ static bfd_boolean sparc64_elf_slurp_one_reloc_table PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, asymbol **, bfd_boolean)); static bfd_boolean sparc64_elf_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); +static long sparc64_elf_canonicalize_reloc + PARAMS ((bfd *, asection *, arelent **, asymbol **)); static long sparc64_elf_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **, asymbol **)); static void sparc64_elf_write_relocs PARAMS ((bfd *, asection *, PTR)); @@ -311,6 +313,17 @@ sparc64_elf_info_to_howto (abfd, cache_ptr, dst) cache_ptr->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (dst->r_info)]; } +struct sparc64_elf_section_data +{ + struct bfd_elf_section_data elf; + unsigned int do_relax, reloc_count; +}; + +#define sec_do_relax(sec) \ + ((struct sparc64_elf_section_data *) elf_section_data (sec))->do_relax +#define canon_reloc_count(sec) \ + ((struct sparc64_elf_section_data *) elf_section_data (sec))->reloc_count + /* Due to the way how we handle R_SPARC_OLO10, each entry in a SHT_RELA section can represent up to two relocs, we must tell the user to allocate more space. */ @@ -361,7 +374,7 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic) native_relocs = (bfd_byte *) allocated; - relents = asect->relocation + asect->reloc_count; + relents = asect->relocation + canon_reloc_count (asect); entsize = rel_hdr->sh_entsize; BFD_ASSERT (entsize == sizeof (Elf64_External_Rela)); @@ -416,7 +429,7 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic) relent->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (rela.r_info)]; } - asect->reloc_count += relent - relents; + canon_reloc_count (asect) += relent - relents; if (allocated != NULL) free (allocated); @@ -478,8 +491,9 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic) if (asect->relocation == NULL) return FALSE; - /* The sparc64_elf_slurp_one_reloc_table routine increments reloc_count. */ - asect->reloc_count = 0; + /* The sparc64_elf_slurp_one_reloc_table routine increments + canon_reloc_count. */ + canon_reloc_count (asect) = 0; if (!sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)) @@ -493,6 +507,32 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic) return TRUE; } +/* Canonicalize the relocs. */ + +static long +sparc64_elf_canonicalize_reloc (abfd, section, relptr, symbols) + bfd *abfd; + sec_ptr section; + arelent **relptr; + asymbol **symbols; +{ + arelent *tblptr; + unsigned int i; + struct elf_backend_data *bed = get_elf_backend_data (abfd); + + if (! bed->s->slurp_reloc_table (abfd, section, symbols, FALSE)) + return -1; + + tblptr = section->relocation; + for (i = 0; i < canon_reloc_count (section); i++) + *relptr++ = tblptr++; + + *relptr = NULL; + + return canon_reloc_count (section); +} + + /* Canonicalize the dynamic relocation entries. Note that we return the dynamic relocations as a single block, although they are actually associated with particular sections; the interface, which @@ -528,7 +568,7 @@ sparc64_elf_canonicalize_dynamic_reloc (abfd, storage, syms) if (! sparc64_elf_slurp_reloc_table (abfd, s, syms, TRUE)) return -1; - count = s->reloc_count; + count = canon_reloc_count (s); p = s->relocation; for (i = 0; i < count; i++) *storage++ = p++; @@ -1918,15 +1958,6 @@ sparc64_elf_size_dynamic_sections (output_bfd, info) return TRUE; } -struct sparc64_elf_section_data -{ - struct bfd_elf_section_data elf; - unsigned int do_relax; -}; - -#define sec_do_relax(sec) \ - ((struct sparc64_elf_section_data *) elf_section_data (sec))->do_relax - static bfd_boolean sparc64_elf_new_section_hook (abfd, sec) bfd *abfd; @@ -3177,6 +3208,8 @@ const struct elf_size_info sparc64_elf_size_info = sparc64_elf_get_reloc_upper_bound #define bfd_elf64_get_dynamic_reloc_upper_bound \ sparc64_elf_get_dynamic_reloc_upper_bound +#define bfd_elf64_canonicalize_reloc \ + sparc64_elf_canonicalize_reloc #define bfd_elf64_canonicalize_dynamic_reloc \ sparc64_elf_canonicalize_dynamic_reloc #define bfd_elf64_bfd_reloc_type_lookup \ diff --git a/bfd/elflink.h b/bfd/elflink.h index 7d2d2e2..12f91ef 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -1609,10 +1609,12 @@ elf_link_add_object_symbols (abfd, info) const char *name; struct elf_link_hash_entry *h; bfd_boolean definition; - bfd_boolean size_change_ok, type_change_ok; + bfd_boolean size_change_ok; + bfd_boolean type_change_ok; bfd_boolean new_weakdef; - unsigned int old_alignment; bfd_boolean override; + unsigned int old_alignment; + bfd *old_bfd; override = FALSE; @@ -1717,6 +1719,8 @@ elf_link_add_object_symbols (abfd, info) size_change_ok = FALSE; type_change_ok = get_elf_backend_data (abfd)->type_change_ok; old_alignment = 0; + old_bfd = NULL; + if (info->hash->creator->flavour == bfd_target_elf_flavour) { Elf_Internal_Versym iver; @@ -1834,9 +1838,23 @@ elf_link_add_object_symbols (abfd, info) that we don't reduce the alignment later on. We can't check later, because _bfd_generic_link_add_one_symbol will set a default for the alignment which we want to - override. */ - if (h->root.type == bfd_link_hash_common) - old_alignment = h->root.u.c.p->alignment_power; + override. We also remember the old bfd where the existing + definition comes from. */ + switch (h->root.type) + { + default: + break; + + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + old_bfd = h->root.u.def.section->owner; + break; + + case bfd_link_hash_common: + old_bfd = h->root.u.c.p->section->owner; + old_alignment = h->root.u.c.p->alignment_power; + break; + } if (elf_tdata (abfd)->verdef != NULL && ! override @@ -1893,6 +1911,8 @@ elf_link_add_object_symbols (abfd, info) is specified and no other alignments have been specified. */ || (isym->st_value == 1 && old_alignment == 0)) h->root.u.c.p->alignment_power = align; + else + h->root.u.c.p->alignment_power = old_alignment; } if (info->hash->creator->flavour == bfd_target_elf_flavour) @@ -1901,15 +1921,64 @@ elf_link_add_object_symbols (abfd, info) 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 + definition or a common symbol is ignored due to the old + normal definition. We need to make sure the maximum + alignment is maintained. */ + if ((old_alignment || isym->st_shndx == SHN_COMMON) + && h->root.type != bfd_link_hash_common) + { + unsigned int common_align; + unsigned int normal_align; + unsigned int symbol_align; + bfd *normal_bfd; + bfd *common_bfd; + + symbol_align = ffs (h->root.u.def.value) - 1; + if ((h->root.u.def.section->owner->flags & DYNAMIC) == 0) + { + normal_align = h->root.u.def.section->alignment_power; + if (normal_align > symbol_align) + normal_align = symbol_align; + } + else + normal_align = symbol_align; + + if (old_alignment) + { + common_align = old_alignment; + common_bfd = old_bfd; + normal_bfd = abfd; + } + else + { + common_align = bfd_log2 (isym->st_value); + common_bfd = abfd; + normal_bfd = old_bfd; + } + + if (normal_align < common_align) + (*_bfd_error_handler) + (_("Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s"), + 1 << normal_align, + name, + bfd_archive_filename (normal_bfd), + 1 << common_align, + bfd_archive_filename (common_bfd)); + } + /* Remember the symbol size and type. */ if (isym->st_size != 0 && (definition || h->size == 0)) { if (h->size != 0 && h->size != isym->st_size && ! size_change_ok) (*_bfd_error_handler) - (_("Warning: size of symbol `%s' changed from %lu to %lu in %s"), + (_("Warning: size of symbol `%s' changed from %lu in %s to %lu in %s"), name, (unsigned long) h->size, - (unsigned long) isym->st_size, bfd_archive_filename (abfd)); + bfd_archive_filename (old_bfd), + (unsigned long) isym->st_size, + bfd_archive_filename (abfd)); h->size = isym->st_size; } @@ -1940,7 +2009,7 @@ elf_link_add_object_symbols (abfd, info) might be needed here. */ if (isym->st_other != 0) { - unsigned char hvis, symvis, other; + unsigned char hvis, symvis, other, nvis; /* Take the balance of OTHER from the definition. */ other = (definition ? isym->st_other : h->other); @@ -1949,8 +2018,14 @@ elf_link_add_object_symbols (abfd, info) /* Combine visibilities, using the most constraining one. */ hvis = ELF_ST_VISIBILITY (h->other); symvis = ELF_ST_VISIBILITY (isym->st_other); + if (! hvis) + nvis = symvis; + else if (! symvis) + nvis = hvis; + else + nvis = hvis < symvis ? hvis : symvis; - h->other = other | (hvis > symvis ? hvis : symvis); + h->other = other | nvis; } /* Set a flag in the hash table entry indicating the type of @@ -4849,6 +4924,7 @@ elf_link_sort_relocs (abfd, info, psec) } } + free (sort); *psec = reldyn; return ret; } @@ -8329,9 +8405,10 @@ elf_bfd_discard_info (output_bfd, info) continue; eh = bfd_get_section_by_name (abfd, ".eh_frame"); - if (eh != NULL - && (eh->_raw_size == 0 - || bfd_is_abs_section (eh->output_section))) + if (info->relocateable + || (eh != NULL + && (eh->_raw_size == 0 + || bfd_is_abs_section (eh->output_section)))) eh = NULL; stab = bfd_get_section_by_name (abfd, ".stab"); @@ -8432,6 +8509,7 @@ elf_bfd_discard_info (output_bfd, info) } if (info->eh_frame_hdr + && !info->relocateable && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info)) ret = TRUE; diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index b2d745b..ab255fa 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -275,11 +275,9 @@ static reloc_howto_type elf_mips_howto_table_rel[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. Note that the ABI document has a typo - and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. - We do the right thing here. */ + /* 16 bit PC relative reference. */ HOWTO (R_MIPS_PC16, /* type */ - 2, /* rightshift */ + 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -774,11 +772,9 @@ static reloc_howto_type elf_mips_howto_table_rela[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. Note that the ABI document has a typo - and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. - We do the right thing here. */ + /* 16 bit PC relative reference. */ HOWTO (R_MIPS_PC16, /* type */ - 2, /* rightshift */ + 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -1841,7 +1837,7 @@ static const struct elf_reloc_map mips_reloc_map[] = /* There is no BFD reloc for R_MIPS_REL32. */ { BFD_RELOC_CTOR, R_MIPS_32 }, { BFD_RELOC_64, R_MIPS_64 }, - { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 }, + { BFD_RELOC_16_PCREL, R_MIPS_PC16 }, { BFD_RELOC_HI16_S, R_MIPS_HI16 }, { BFD_RELOC_LO16, R_MIPS_LO16 }, { BFD_RELOC_GPREL16, R_MIPS_GPREL16 }, @@ -2028,7 +2024,7 @@ elf32_mips_grok_prstatus (abfd, note) default: return FALSE; - case 256: /* Linux/MIPS */ + case 440: /* Linux/MIPS N32 */ /* pr_cursig */ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); @@ -2037,7 +2033,7 @@ elf32_mips_grok_prstatus (abfd, note) /* pr_reg */ offset = 72; - raw_size = 180; + raw_size = 360; break; } @@ -2215,6 +2211,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags #define bfd_elf32_bfd_print_private_bfd_data \ _bfd_mips_elf_print_private_bfd_data +#define bfd_elf32_bfd_relax_section _bfd_mips_relax_section /* Support for SGI-ish mips targets using n32 ABI. */ diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index d1a78ab..bff78c8 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -357,6 +357,10 @@ elfNN_ia64_reloc (abfd, reloc, sym, data, input_section, reloc->address += input_section->output_offset; return bfd_reloc_ok; } + + if (input_section->flags & SEC_DEBUGGING) + return bfd_reloc_continue; + *error_message = "Unsupported call to elfNN_ia64_reloc"; return bfd_reloc_notsupported; } @@ -696,6 +700,10 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) one pass. */ *again = FALSE; + /* Don't even try to relax for non-ELF outputs. */ + if (link_info->hash->creator->flavour != bfd_target_elf_flavour) + return FALSE; + /* Nothing to do if there are no relocations. */ if ((sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0) @@ -819,6 +827,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) tsec = ia64_info->plt_sec; toff = dyn_i->plt2_offset; + BFD_ASSERT (irel->r_addend == 0); } /* Can't do anything else with dynamic symbols. */ @@ -837,10 +846,15 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) } } - symaddr = (tsec->output_section->vma - + tsec->output_offset - + toff - + irel->r_addend); + if (tsec->sec_info_type == ELF_INFO_TYPE_MERGE) + toff = _bfd_merged_section_offset (abfd, &tsec, + elf_section_data (tsec)->sec_info, + toff + irel->r_addend, + (bfd_vma) 0); + else + toff += irel->r_addend; + + symaddr = tsec->output_section->vma + tsec->output_offset + toff; roff = irel->r_offset; @@ -1022,6 +1036,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) struct elfNN_ia64_allocate_data data; data.info = link_info; data.ofs = 0; + ia64_info->self_dtpmod_offset = (bfd_vma) -1; elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_data_got, &data); elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_fptr_got, &data); @@ -1777,19 +1792,24 @@ elfNN_ia64_hash_table_create (abfd) { struct elfNN_ia64_link_hash_table *ret; - ret = bfd_zalloc (abfd, (bfd_size_type) sizeof (*ret)); + ret = bfd_zmalloc ((bfd_size_type) sizeof (*ret)); if (!ret) return 0; + if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, elfNN_ia64_new_elf_hash_entry)) { - bfd_release (abfd, ret); + free (ret); return 0; } if (!elfNN_ia64_local_hash_table_init (&ret->loc_hash_table, abfd, elfNN_ia64_new_loc_hash_entry)) - return 0; + { + free (ret); + return 0; + } + return &ret->root.root; } @@ -1965,7 +1985,11 @@ get_dyn_sym_info (ia64_info, h, abfd, rel, create) struct elfNN_ia64_local_hash_entry *loc_h; loc_h = get_local_sym_hash (ia64_info, abfd, rel, create); - BFD_ASSERT (loc_h); + if (!loc_h) + { + BFD_ASSERT (!create); + return NULL; + } pp = &loc_h->info; } @@ -3939,7 +3963,6 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, (!info->shared || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; - ret_val = FALSE; continue; } } diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 6ca4f06..0c3a5d9 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -408,6 +408,7 @@ static asection * mips_elf_rel_dyn_section PARAMS ((bfd *, bfd_boolean)); static asection * mips_elf_got_section PARAMS ((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)); static bfd_vma mips_elf_local_got_index PARAMS ((bfd *, bfd *, struct bfd_link_info *, bfd_vma)); static bfd_vma mips_elf_global_got_index @@ -496,6 +497,7 @@ static struct mips_got_info *mips_elf_got_for_ibfd static bfd *reldyn_sorting_bfd; /* Nonzero if ABFD is using the N32 ABI. */ + #define ABI_N32_P(abfd) \ ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0) @@ -1706,6 +1708,29 @@ mips_elf_got_info (abfd, sgotp) return g; } +/* 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; +{ + asection *sgot; + struct mips_got_info *g; + + if (abfd == NULL) + return 0; + + sgot = mips_elf_got_section (abfd, TRUE); + if (sgot == NULL || mips_elf_section_data (sgot) == NULL) + return 0; + + g = mips_elf_section_data (sgot)->u.got_info; + if (g == NULL || g->global_gotsym == NULL) + return 0; + + return g->global_gotsym->dynindx; +} + /* Returns the GOT offset at which the indicated address can be found. If there is not yet a GOT entry for this value, create one. Returns -1 if no satisfactory GOT offset can be found. */ @@ -2129,7 +2154,7 @@ mips_elf_bfd2got_entry_eq (entry1, entry2) return e1->bfd == e2->bfd; } -/* In a multi-got link, determine the GOT to be used for IBFD. G must +/* In a multi-got link, determine the GOT to be used for IBDF. G must be the master GOT data. */ static struct mips_got_info * @@ -3195,6 +3220,18 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, and we're going to need it, get it now. */ switch (r_type) { + case R_MIPS_GOT_PAGE: + case R_MIPS_GOT_OFST: + /* If this symbol got a global GOT entry, we have to decay + GOT_PAGE/GOT_OFST to GOT_DISP/addend. */ + local_p = local_p || ! h + || (h->root.dynindx + < mips_elf_get_global_gotsym_index (elf_hash_table (info) + ->dynobj)); + if (local_p || r_type == R_MIPS_GOT_OFST) + break; + /* Fall through. */ + case R_MIPS_CALL16: case R_MIPS_GOT16: case R_MIPS_GOT_DISP: @@ -3205,7 +3242,11 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, /* Find the index into the GOT where this value is located. */ if (!local_p) { - BFD_ASSERT (addend == 0); + /* GOT_PAGE may take a non-zero addend, that is ignored in a + GOT_PAGE relocation that decays to GOT_DISP because the + symbol turns out to be global. The addend is then added + as GOT_OFST. */ + BFD_ASSERT (addend == 0 || r_type == R_MIPS_GOT_PAGE); g = mips_elf_global_got_index (elf_hash_table (info)->dynobj, input_bfd, (struct elf_link_hash_entry *) h); @@ -3219,7 +3260,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, We must initialize this entry in the GOT. */ bfd *tmpbfd = elf_hash_table (info)->dynobj; asection *sgot = mips_elf_got_section (tmpbfd, FALSE); - MIPS_ELF_PUT_WORD (tmpbfd, symbol + addend, sgot->contents + g); + MIPS_ELF_PUT_WORD (tmpbfd, symbol, sgot->contents + g); } } else if (r_type == R_MIPS_GOT16 || r_type == R_MIPS_CALL16) @@ -3315,6 +3356,12 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, value &= howto->dst_mask; break; + case R_MIPS_GNU_REL16_S2: + value = symbol + mips_elf_sign_extend (addend << 2, 18) - p; + overflowed_p = mips_elf_overflow_p (value, 18); + value = (value >> 2) & howto->dst_mask; + break; + case R_MIPS_GNU_REL_HI16: /* Instead of subtracting 'p' here, we should be subtracting the equivalent value for the LO part of the reloc, since the value @@ -3432,6 +3479,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, /* Fall through. */ case R_MIPS_GOT_DISP: + got_disp: value = g; overflowed_p = mips_elf_overflow_p (value, 16); break; @@ -3443,10 +3491,8 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, break; case R_MIPS_PC16: - case R_MIPS_GNU_REL16_S2: - value = mips_elf_sign_extend (addend << 2, 18) + symbol - p; - overflowed_p = mips_elf_overflow_p (value, 18); - value = (value >> 2) & howto->dst_mask; + value = mips_elf_sign_extend (addend, 16) + symbol - p; + overflowed_p = mips_elf_overflow_p (value, 16); break; case R_MIPS_GOT_HI16: @@ -3465,6 +3511,11 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, break; case R_MIPS_GOT_PAGE: + /* GOT_PAGE relocations that reference non-local symbols decay + to GOT_DISP. The corresponding GOT_OFST relocation decays to + 0. */ + if (! local_p) + goto got_disp; value = mips_elf_got_page (abfd, input_bfd, info, symbol + addend, NULL); if (value == MINUS_ONE) return bfd_reloc_outofrange; @@ -3474,7 +3525,10 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, break; case R_MIPS_GOT_OFST: - mips_elf_got_page (abfd, input_bfd, info, symbol + addend, &value); + if (local_p) + mips_elf_got_page (abfd, input_bfd, info, symbol + addend, &value); + else + value = addend; overflowed_p = mips_elf_overflow_p (value, 16); break; @@ -3832,7 +3886,6 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, else { long indx; - bfd_vma section_offset; /* We must now calculate the dynamic symbol table index to use in the relocation. */ @@ -3862,15 +3915,18 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, abort (); } - /* Figure out how far the target of the relocation is from - the beginning of its section. */ - section_offset = symbol - sec->output_section->vma; - /* The relocation we're building is section-relative. - Therefore, the original addend must be adjusted by the - section offset. */ - *addendp += section_offset; - /* Now, the relocation is just against the section. */ - symbol = sec->output_section->vma; + /* Instead of generating a relocation using the section + symbol, we may as well make it a fully relative + relocation. We want to avoid generating relocations to + local symbols because we used to generate them + incorrectly, without adding the original symbol value, + which is mandated by the ABI for section symbols. In + order to give dynamic loaders and applications time to + phase out the incorrect use, we refrain from emitting + section-relative relocations. It's not like they're + useful, after all. This should be a bit more efficient + as well. */ + indx = 0; } /* If the relocation was previously an absolute relocation and @@ -3884,6 +3940,18 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, know where the shared library will wind up at load-time. */ outrel[0].r_info = ELF_R_INFO (output_bfd, (unsigned long) indx, R_MIPS_REL32); + /* For strict adherence to the ABI specification, we should + generate a R_MIPS_64 relocation record by itself before the + _REL32/_64 record as well, such that the addend is read in as + a 64-bit value (REL32 is a 32-bit relocation, after all). + However, since none of the existing ELF64 MIPS dynamic + loaders seems to care, we don't waste space with these + artificial relocations. If this turns out to not be true, + mips_elf_allocate_dynamic_relocation() should be tweaked so + as to make room for a pair of dynamic relocations per + 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, ABI_64_P (output_bfd) ? R_MIPS_64 @@ -5293,6 +5361,44 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs) } break; + case R_MIPS_GOT_PAGE: + /* If this is a global, overridable symbol, GOT_PAGE will + decay to GOT_DISP, so we'll need a GOT entry for it. */ + if (h == NULL) + break; + else + { + struct mips_elf_link_hash_entry *hmips = + (struct mips_elf_link_hash_entry *) h; + + while (hmips->root.root.type == bfd_link_hash_indirect + || hmips->root.root.type == bfd_link_hash_warning) + hmips = (struct mips_elf_link_hash_entry *) + hmips->root.root.u.i.link; + + if ((hmips->root.root.type == bfd_link_hash_defined + || hmips->root.root.type == bfd_link_hash_defweak) + && hmips->root.root.u.def.section + && ! (info->shared && ! info->symbolic + && ! (hmips->root.elf_link_hash_flags + & ELF_LINK_FORCED_LOCAL)) + /* If we've encountered any other relocation + referencing the symbol, we'll have marked it as + dynamic, and, even though we might be able to get + rid of the GOT entry should we know for sure all + previous relocations were GOT_PAGE ones, at this + point we can't tell, so just keep using the + symbol as dynamic. This is very important in the + multi-got case, since we don't decide whether to + decay GOT_PAGE to GOT_DISP on a per-GOT basis: if + the symbol is dynamic, we'll need a GOT entry for + every GOT in which the symbol is referenced with + a GOT_PAGE relocation. */ + && hmips->root.dynindx == -1) + break; + } + /* Fall through. */ + case R_MIPS_GOT16: case R_MIPS_GOT_HI16: case R_MIPS_GOT_LO16: @@ -5432,6 +5538,185 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs) return TRUE; } +bfd_boolean +_bfd_mips_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + bfd_boolean *again; +{ + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *irel, *irelend; + Elf_Internal_Shdr *symtab_hdr; + bfd_byte *contents = NULL; + bfd_byte *free_contents = NULL; + size_t extsymoff; + bfd_boolean changed_contents = FALSE; + bfd_vma sec_start = sec->output_section->vma + sec->output_offset; + Elf_Internal_Sym *isymbuf = NULL; + + /* We are not currently changing any sizes, so only one pass. */ + *again = FALSE; + + if (link_info->relocateable) + return TRUE; + + internal_relocs = (MNAME(abfd,_bfd_elf,link_read_relocs) + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + return TRUE; + + irelend = internal_relocs + sec->reloc_count + * get_elf_backend_data (abfd)->s->int_rels_per_ext_rel; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info; + + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma symval; + bfd_signed_vma sym_offset; + unsigned int r_type; + unsigned long r_symndx; + asection *sym_sec; + unsigned long instruction; + + /* Turn jalr into bgezal, and jr into beq, if they're marked + with a JALR relocation, that indicate where they jump to. + This saves some pipeline bubbles. */ + r_type = ELF_R_TYPE (abfd, irel->r_info); + if (r_type != R_MIPS_JALR) + continue; + + r_symndx = ELF_R_SYM (abfd, irel->r_info); + /* Compute the address of the jump target. */ + if (r_symndx >= extsymoff) + { + struct mips_elf_link_hash_entry *h + = ((struct mips_elf_link_hash_entry *) + elf_sym_hashes (abfd) [r_symndx - extsymoff]); + + while (h->root.root.type == bfd_link_hash_indirect + || h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; + + /* If a symbol is undefined, or if it may be overridden, + skip it. */ + if (! ((h->root.root.type == bfd_link_hash_defined + || h->root.root.type == bfd_link_hash_defweak) + && h->root.root.u.def.section) + || (link_info->shared && ! link_info->symbolic + && ! (h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))) + continue; + + sym_sec = h->root.root.u.def.section; + if (sym_sec->output_section) + symval = (h->root.root.u.def.value + + sym_sec->output_section->vma + + sym_sec->output_offset); + else + symval = h->root.root.u.def.value; + } + else + { + Elf_Internal_Sym *isym; + + /* Read this BFD's symbols if we haven't done so already. */ + if (isymbuf == NULL && symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto relax_return; + } + + isym = isymbuf + r_symndx; + if (isym->st_shndx == SHN_UNDEF) + continue; + else if (isym->st_shndx == SHN_ABS) + sym_sec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + sym_sec = bfd_com_section_ptr; + else + sym_sec + = bfd_section_from_elf_index (abfd, isym->st_shndx); + symval = isym->st_value + + sym_sec->output_section->vma + + sym_sec->output_offset; + } + + /* Compute branch offset, from delay slot of the jump to the + branch target. */ + sym_offset = (symval + irel->r_addend) + - (sec_start + irel->r_offset + 4); + + /* Branch offset must be properly aligned. */ + if ((sym_offset & 3) != 0) + continue; + + sym_offset >>= 2; + + /* Check that it's in range. */ + if (sym_offset < -0x8000 || sym_offset >= 0x8000) + continue; + + /* Get the section contents if we haven't done so already. */ + if (contents == NULL) + { + /* Get cached copy if it exists. */ + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + contents = (bfd_byte *) 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)) + goto relax_return; + } + } + + instruction = bfd_get_32 (abfd, contents + irel->r_offset); + + /* If it was jalr <reg>, turn it into bgezal $zero, <target>. */ + if ((instruction & 0xfc1fffff) == 0x0000f809) + instruction = 0x04110000; + /* If it was jr <reg>, turn it into b <target>. */ + else if ((instruction & 0xfc1fffff) == 0x00000008) + instruction = 0x10000000; + else + continue; + + instruction |= (sym_offset & 0xffff); + bfd_put_32 (abfd, instruction, contents + irel->r_offset); + changed_contents = TRUE; + } + + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + { + if (!changed_contents && !link_info->keep_memory) + free (contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + } + return TRUE; + + relax_return: + if (free_contents != NULL) + free (free_contents); + return FALSE; +} + /* Adjust a symbol defined by a dynamic object and referenced by a regular object. The current definition is in some section of the dynamic object, but we're not including those sections. We have to @@ -7518,55 +7803,58 @@ _bfd_mips_elf_hide_symbol (info, entry, force_local) h->forced_local = TRUE; dynobj = elf_hash_table (info)->dynobj; - got = mips_elf_got_section (dynobj, FALSE); - g = mips_elf_section_data (got)->u.got_info; - - if (g->next) + if (dynobj != NULL) { - struct mips_got_entry e; - struct mips_got_info *gg = g; + got = mips_elf_got_section (dynobj, FALSE); + g = mips_elf_section_data (got)->u.got_info; - /* Since we're turning what used to be a global symbol into a - local one, bump up the number of local entries of each GOT - that had an entry for it. This will automatically decrease - the number of global entries, since global_gotno is actually - the upper limit of global entries. */ - e.abfd = dynobj; - e.symndx = -1; - e.d.h = h; + if (g->next) + { + struct mips_got_entry e; + struct mips_got_info *gg = g; + + /* Since we're turning what used to be a global symbol into a + local one, bump up the number of local entries of each GOT + that had an entry for it. This will automatically decrease + the number of global entries, since global_gotno is actually + the upper limit of global entries. */ + e.abfd = dynobj; + e.symndx = -1; + e.d.h = h; - for (g = g->next; g != gg; g = g->next) - if (htab_find (g->got_entries, &e)) - { - BFD_ASSERT (g->global_gotno > 0); - g->local_gotno++; - g->global_gotno--; - } + for (g = g->next; g != gg; g = g->next) + if (htab_find (g->got_entries, &e)) + { + BFD_ASSERT (g->global_gotno > 0); + g->local_gotno++; + g->global_gotno--; + } - /* If this was a global symbol forced into the primary GOT, we - no longer need an entry for it. We can't release the entry - at this point, but we must at least stop counting it as one - of the symbols that required a forced got entry. */ - if (h->root.got.offset == 2) + /* If this was a global symbol forced into the primary GOT, we + no longer need an entry for it. We can't release the entry + at this point, but we must at least stop counting it as one + of the symbols that required a forced got entry. */ + if (h->root.got.offset == 2) + { + BFD_ASSERT (gg->assigned_gotno > 0); + gg->assigned_gotno--; + } + } + else if (g->global_gotno == 0 && g->global_gotsym == NULL) + /* If we haven't got through GOT allocation yet, just bump up the + number of local entries, as this symbol won't be counted as + global. */ + g->local_gotno++; + else if (h->root.got.offset == 1) { - BFD_ASSERT (gg->assigned_gotno > 0); - gg->assigned_gotno--; + /* If we're past non-multi-GOT allocation and this symbol had + been marked for a global got entry, give it a local entry + instead. */ + BFD_ASSERT (g->global_gotno > 0); + g->local_gotno++; + g->global_gotno--; } } - else if (g->global_gotno == 0 && g->global_gotsym == NULL) - /* If we haven't got through GOT allocation yet, just bump up the - number of local entries, as this symbol won't be counted as - global. */ - g->local_gotno++; - else if (h->root.got.offset == 1) - { - /* If we're past non-multi-GOT allocation and this symbol had - been marked for a global got entry, give it a local entry - instead. */ - BFD_ASSERT (g->global_gotno > 0); - g->local_gotno++; - g->global_gotno--; - } _bfd_elf_link_hash_hide_symbol (info, &h->root, force_local); } diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index 3f77943..3064c39 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -108,3 +108,6 @@ extern bfd_reloc_status_type _bfd_mips_elf32_gprel16_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); extern unsigned long _bfd_elf_mips_mach PARAMS ((flagword)); +extern bfd_boolean _bfd_mips_relax_section (bfd *, asection *, + struct bfd_link_info *, + bfd_boolean *); diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 69e3782..734d78b 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -33,7 +33,9 @@ #endif #define bfd_elfNN_canonicalize_dynamic_symtab _bfd_elf_canonicalize_dynamic_symtab +#ifndef bfd_elfNN_canonicalize_reloc #define bfd_elfNN_canonicalize_reloc _bfd_elf_canonicalize_reloc +#endif #ifndef bfd_elfNN_find_nearest_line #define bfd_elfNN_find_nearest_line _bfd_elf_find_nearest_line #endif diff --git a/bfd/format.c b/bfd/format.c index 9af6efc..655ccd9 100644 --- a/bfd/format.c +++ b/bfd/format.c @@ -163,7 +163,11 @@ bfd_check_format_matches (abfd, format, matching) if (!abfd->target_defaulted) { if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) /* rewind! */ - return FALSE; + { + if (matching) + free ((PTR) matching_vector); + return FALSE; + } right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd)); @@ -214,7 +218,11 @@ bfd_check_format_matches (abfd, format, matching) abfd->xvec = *target; /* Change BFD's target temporarily. */ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - return FALSE; + { + if (matching) + free ((PTR) matching_vector); + return FALSE; + } /* If _bfd_check_format neglects to set bfd_error, assume bfd_error_wrong_format. We didn't used to even pay any diff --git a/bfd/hp300bsd.c b/bfd/hp300bsd.c index c0e3f95..4d005ce 100644 --- a/bfd/hp300bsd.c +++ b/bfd/hp300bsd.c @@ -1,5 +1,5 @@ /* BFD back-end for HP 9000/300 (68000-based) machines running BSD Unix. - Copyright 1992, 1994, 1995, 2001 Free Software Foundation, Inc. + Copyright 1992, 1994, 1995, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -19,7 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_IS_BIG_ENDIAN_P #define N_HEADER_IN_TEXT(x) 0 -#define BYTES_IN_WORD 4 #define ENTRY_CAN_BE_ZERO #define N_SHARED_LIB(x) 0 /* Avoids warning */ #define TEXT_START_ADDR 0 diff --git a/bfd/i386aout.c b/bfd/i386aout.c index b2d106f..6b2948e 100644 --- a/bfd/i386aout.c +++ b/bfd/i386aout.c @@ -1,5 +1,5 @@ /* BFD back-end for i386 a.out binaries. - Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002 + Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ system, and I'll stick it in for the next release. */ #define N_HEADER_IN_TEXT(x) 0 -#define BYTES_IN_WORD 4 #define N_TXTOFF(x) 0x20 #define N_TXTADDR(x) (N_MAGIC(x)==ZMAGIC ? 0x1020 : 0) diff --git a/bfd/i386dynix.c b/bfd/i386dynix.c index 51f0844..1787196 100644 --- a/bfd/i386dynix.c +++ b/bfd/i386dynix.c @@ -1,5 +1,5 @@ /* BFD back-end for i386 a.out binaries under dynix. - Copyright 1994, 1995, 2001 Free Software Foundation, Inc. + Copyright 1994, 1995, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -20,8 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This BFD is currently only tested with gdb, writing object files may not work. */ -#define BYTES_IN_WORD 4 - #define TEXT_START_ADDR 4096 #define TARGET_PAGE_SIZE 4096 #define SEGMENT_SIZE TARGET_PAGE_SIZE diff --git a/bfd/i386linux.c b/bfd/i386linux.c index 5a2d382..6403e1c 100644 --- a/bfd/i386linux.c +++ b/bfd/i386linux.c @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored i386 a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SEGMENT_SIZE TARGET_PAGE_SIZE #define TEXT_START_ADDR 0x0 #define N_SHARED_LIB(x) 0 -#define BYTES_IN_WORD 4 #define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN) diff --git a/bfd/i386lynx.c b/bfd/i386lynx.c index 6bf6e72..32274ea 100644 --- a/bfd/i386lynx.c +++ b/bfd/i386lynx.c @@ -1,5 +1,5 @@ /* BFD back-end for i386 a.out binaries under LynxOS. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2001, 2002 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,7 +18,6 @@ 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. */ -#define BYTES_IN_WORD 4 #define N_SHARED_LIB(x) 0 #define TEXT_START_ADDR 0 diff --git a/bfd/i386mach3.c b/bfd/i386mach3.c index 0e4c4e7..215f814 100644 --- a/bfd/i386mach3.c +++ b/bfd/i386mach3.c @@ -1,5 +1,5 @@ /* BFD back-end for i386 a.out binaries. - Copyright 1990, 1991, 1993, 1994, 1995, 1997, 2001, 2002 + Copyright 1990, 1991, 1993, 1994, 1995, 1997, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SEGMENT_SIZE 0x1000 #define TEXT_START_ADDR 0x10000 #define ARCH 32 -#define BYTES_IN_WORD 4 /* This macro is only relevant when N_MAGIC(x) == ZMAGIC. */ #define N_HEADER_IN_TEXT(x) 1 @@ -225,8 +225,8 @@ ieee_write_int (abfd, value) { unsigned int length; - /* How many significant bytes ? */ - /* FIXME FOR LONGER INTS */ + /* How many significant bytes ? */ + /* FIXME FOR LONGER INTS. */ if (value & 0xff000000) length = 4; else if (value & 0x00ff0000) @@ -301,10 +301,8 @@ ieee_write_id (abfd, id) return TRUE; } -/*************************************************************************** -Functions for reading from ieee files in the strange way that the -standard requires: -*/ +/* Functions for reading from ieee files in the strange way that the + standard requires. */ #define this_byte(ieee) *((ieee)->input_p) #define next_byte(ieee) ((ieee)->input_p++) @@ -316,6 +314,7 @@ read_2bytes (ieee) { unsigned char c1 = this_byte_and_next (ieee); unsigned char c2 = this_byte_and_next (ieee); + return (c1 << 8) | c2; } @@ -326,10 +325,9 @@ bfd_get_string (ieee, string, length) size_t length; { size_t i; + for (i = 0; i < length; i++) - { - string[i] = this_byte_and_next (ieee); - } + string[i] = this_byte_and_next (ieee); } static char * @@ -338,23 +336,25 @@ read_id (ieee) { size_t length; char *string; + length = this_byte_and_next (ieee); if (length <= 0x7f) { - /* Simple string of length 0 to 127 */ + /* Simple string of length 0 to 127. */ } else if (length == 0xde) { - /* Length is next byte, allowing 0..255 */ + /* Length is next byte, allowing 0..255. */ length = this_byte_and_next (ieee); } else if (length == 0xdf) { - /* Length is next two bytes, allowing 0..65535 */ + /* Length is next two bytes, allowing 0..65535. */ length = this_byte_and_next (ieee); length = (length * 256) + this_byte_and_next (ieee); } - /* Buy memory and read string */ + + /* Buy memory and read string. */ string = bfd_alloc (ieee->abfd, (bfd_size_type) length + 1); if (!string) return NULL; @@ -380,57 +380,63 @@ ieee_write_expression (abfd, value, symbol, pcrel, index) term_count++; } - if (bfd_is_com_section (symbol->section) - || bfd_is_und_section (symbol->section)) - { - /* Def of a common symbol */ - if (! ieee_write_byte (abfd, ieee_variable_X_enum) - || ! ieee_write_int (abfd, symbol->value)) - return FALSE; - term_count++; - } - else if (! bfd_is_abs_section (symbol->section)) + /* Badly formatted binaries can have a missing symbol, + so test here to prevent a seg fault. */ + if (symbol != NULL) { - /* Ref to defined symbol - */ - - if (symbol->flags & BSF_GLOBAL) + if (bfd_is_com_section (symbol->section) + || bfd_is_und_section (symbol->section)) { - if (! ieee_write_byte (abfd, ieee_variable_I_enum) + /* Def of a common symbol. */ + if (! ieee_write_byte (abfd, ieee_variable_X_enum) || ! ieee_write_int (abfd, symbol->value)) return FALSE; - term_count++; + term_count ++; } - else if (symbol->flags & (BSF_LOCAL | BSF_SECTION_SYM)) + else if (! bfd_is_abs_section (symbol->section)) { - /* This is a reference to a defined local symbol. We can - easily do a local as a section+offset. */ - if (! ieee_write_byte (abfd, ieee_variable_R_enum) - || ! ieee_write_byte (abfd, - (bfd_byte) (symbol->section->index - + IEEE_SECTION_NUMBER_BASE))) - return FALSE; - term_count++; - if (symbol->value != 0) + /* Ref to defined symbol - */ + + if (symbol->flags & BSF_GLOBAL) { - if (! ieee_write_int (abfd, symbol->value)) + if (! ieee_write_byte (abfd, ieee_variable_I_enum) + || ! ieee_write_int (abfd, symbol->value)) return FALSE; term_count++; } - } - else - { - (*_bfd_error_handler) - (_("%s: unrecognized symbol `%s' flags 0x%x"), - bfd_get_filename (abfd), bfd_asymbol_name (symbol), - symbol->flags); - bfd_set_error (bfd_error_invalid_operation); - return FALSE; + else if (symbol->flags & (BSF_LOCAL | BSF_SECTION_SYM)) + { + /* This is a reference to a defined local symbol. We can + easily do a local as a section+offset. */ + if (! ieee_write_byte (abfd, ieee_variable_R_enum) + || ! ieee_write_byte (abfd, + (bfd_byte) (symbol->section->index + + IEEE_SECTION_NUMBER_BASE))) + return FALSE; + + term_count++; + if (symbol->value != 0) + { + if (! ieee_write_int (abfd, symbol->value)) + return FALSE; + term_count++; + } + } + else + { + (*_bfd_error_handler) + (_("%s: unrecognized symbol `%s' flags 0x%x"), + bfd_get_filename (abfd), bfd_asymbol_name (symbol), + symbol->flags); + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } } } if (pcrel) { - /* subtract the pc from here by asking for PC of this section*/ + /* Subtract the pc from here by asking for PC of this section. */ if (! ieee_write_byte (abfd, ieee_variable_P_enum) || ! ieee_write_byte (abfd, (bfd_byte) (index + IEEE_SECTION_NUMBER_BASE)) @@ -440,10 +446,8 @@ ieee_write_expression (abfd, value, symbol, pcrel, index) /* Handle the degenerate case of a 0 address. */ if (term_count == 0) - { - if (! ieee_write_int (abfd, (bfd_vma) 0)) - return FALSE; - } + if (! ieee_write_int (abfd, (bfd_vma) 0)) + return FALSE; while (term_count > 1) { @@ -455,11 +459,8 @@ ieee_write_expression (abfd, value, symbol, pcrel, index) return TRUE; } -/*****************************************************************************/ +/* Writes any integer into the buffer supplied and always takes 5 bytes. */ -/* -writes any integer into the buffer supplied and always takes 5 bytes -*/ static void ieee_write_int5 (buffer, value) bfd_byte *buffer; @@ -492,6 +493,7 @@ parse_int (ieee, value_ptr) { int value = this_byte (ieee); int result; + if (value >= 0 && value <= 127) { *value_ptr = value; @@ -501,6 +503,7 @@ parse_int (ieee, value_ptr) else if (value >= 0x80 && value <= 0x88) { unsigned int count = value & 0xf; + result = 0; next_byte (ieee); while (count) @@ -664,7 +667,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) bfd_boolean loop = TRUE; ieee_value_type stack[10]; - /* The stack pointer always points to the next unused location */ + /* The stack pointer always points to the next unused location. */ #define PUSH(x,y,z) TOS.symbol=x;TOS.section=y;TOS.value=z;INC; #define POP(x,y,z) DEC;x=TOS.symbol;y=TOS.section;z=TOS.value; ieee_value_type *sp = stack; @@ -675,9 +678,10 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) switch (this_byte (&(ieee->h))) { case ieee_variable_P_enum: - /* P variable, current program counter for section n */ + /* P variable, current program counter for section n. */ { int section_n; + next_byte (&(ieee->h)); *pcrel = TRUE; section_n = must_parse_int (&(ieee->h)); @@ -685,25 +689,25 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) break; } case ieee_variable_L_enum: - /* L variable address of section N */ + /* L variable address of section N. */ next_byte (&(ieee->h)); PUSH (NOSYMBOL, ieee->section_table[must_parse_int (&(ieee->h))], 0); break; case ieee_variable_R_enum: - /* R variable, logical address of section module */ - /* FIXME, this should be different to L */ + /* R variable, logical address of section module. */ + /* FIXME, this should be different to L. */ next_byte (&(ieee->h)); PUSH (NOSYMBOL, ieee->section_table[must_parse_int (&(ieee->h))], 0); break; case ieee_variable_S_enum: - /* S variable, size in MAUS of section module */ + /* S variable, size in MAUS of section module. */ next_byte (&(ieee->h)); PUSH (NOSYMBOL, 0, ieee->section_table[must_parse_int (&(ieee->h))]->_raw_size); break; case ieee_variable_I_enum: - /* Push the address of variable n */ + /* Push the address of variable n. */ { ieee_symbol_index_type sy; next_byte (&(ieee->h)); @@ -714,7 +718,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) } break; case ieee_variable_X_enum: - /* Push the address of external variable n */ + /* Push the address of external variable n. */ { ieee_symbol_index_type sy; next_byte (&(ieee->h)); @@ -776,7 +780,6 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) terms. We can tell if that's the case by ensuring that sp == stack here. If not, then we've pushed something too far, so we keep adding. */ - while (sp != stack + 1) { asection *section1; @@ -822,7 +825,7 @@ ieee_part_after (ieee, here) } static unsigned int last_index; -static char last_type; /* is the index for an X or a D */ +static char last_type; /* Is the index for an X or a D. */ static ieee_symbol_type * get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type) @@ -834,8 +837,9 @@ get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type) unsigned int *max_index; int this_type; { - /* Need a new symbol */ + /* Need a new symbol. */ unsigned int new_index = must_parse_int (&(ieee->h)); + if (new_index != last_index || this_type != last_type) { ieee_symbol_type *new_symbol; @@ -851,9 +855,8 @@ get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type) **pptr = new_symbol; *pptr = &new_symbol->next; if (new_index > *max_index) - { - *max_index = new_index; - } + *max_index = new_index; + last_type = this_type; new_symbol->symbol.section = bfd_abs_section_ptr; return new_symbol; @@ -941,7 +944,7 @@ ieee_slurp_external_symbols (abfd) } break; case ieee_external_reference_info_record_enum: - /* Skip over ATX record. */ + /* Skip over ATX record. */ parse_int (&(ieee->h), &value); parse_int (&(ieee->h), &value); parse_int (&(ieee->h), &value); @@ -950,7 +953,7 @@ ieee_slurp_external_symbols (abfd) case ieee_atn_record_enum: /* We may get call optimization information here, which we just ignore. The format is - {$F1}${CE}{index}{$00}{$3F}{$3F}{#_of_ASNs} */ + {$F1}${CE}{index}{$00}{$3F}{$3F}{#_of_ASNs}. */ parse_int (&ieee->h, &value); parse_int (&ieee->h, &value); parse_int (&ieee->h, &value); @@ -1036,16 +1039,16 @@ ieee_slurp_external_symbols (abfd) bfd_vma size; bfd_vma value; next_byte (&(ieee->h)); - /* Throw away the external reference index */ + /* Throw away the external reference index. */ (void) must_parse_int (&(ieee->h)); - /* Fetch the default size if not resolved */ + /* Fetch the default size if not resolved. */ size = must_parse_int (&(ieee->h)); - /* Fetch the defautlt value if available */ + /* Fetch the defautlt value if available. */ if (! parse_int (&(ieee->h), &value)) { value = 0; } - /* This turns into a common */ + /* This turns into a common. */ symbol->symbol.section = bfd_com_section_ptr; symbol->symbol.value = size; } @@ -1136,10 +1139,8 @@ ieee_get_symtab_upper_bound (abfd) (abfd->symcount + 1) * (sizeof (ieee_symbol_type *)) : 0; } -/* -Move from our internal lists to the canon table, and insert in -symbol index order -*/ +/* Move from our internal lists to the canon table, and insert in + symbol index order. */ extern const bfd_target ieee_vec; @@ -1172,41 +1173,35 @@ ieee_get_symtab (abfd, location) if (! ieee->symbol_table_full) { - /* Arrgh - there are gaps in the table, run through and fill them */ - /* up with pointers to a null place */ + /* Arrgh - there are gaps in the table, run through and fill them + up with pointers to a null place. */ unsigned int i; + for (i = 0; i < abfd->symcount; i++) - { - location[i] = &empty_symbol; - } + location[i] = &empty_symbol; } ieee->external_symbol_base_offset = -ieee->external_symbol_min_index; for (symp = IEEE_DATA (abfd)->external_symbols; symp != (ieee_symbol_type *) NULL; symp = symp->next) - { - /* Place into table at correct index locations */ - location[symp->index + ieee->external_symbol_base_offset] = &symp->symbol; - } + /* Place into table at correct index locations. */ + location[symp->index + ieee->external_symbol_base_offset] = &symp->symbol; - /* The external refs are indexed in a bit */ + /* The external refs are indexed in a bit. */ ieee->external_reference_base_offset = -ieee->external_reference_min_index + ieee->external_symbol_count; for (symp = IEEE_DATA (abfd)->external_reference; symp != (ieee_symbol_type *) NULL; symp = symp->next) - { - location[symp->index + ieee->external_reference_base_offset] = - &symp->symbol; - - } + location[symp->index + ieee->external_reference_base_offset] = + &symp->symbol; } + if (abfd->symcount) - { - location[abfd->symcount] = (asymbol *) NULL; - } + location[abfd->symcount] = (asymbol *) NULL; + return abfd->symcount; } @@ -1286,34 +1281,33 @@ ieee_slurp_sections (abfd) section_type[0] = this_byte_and_next (&(ieee->h)); /* Set minimal section attributes. Attributes are - extended later, based on section contents. */ - + extended later, based on section contents. */ switch (section_type[0]) { case 0xC1: - /* Normal attributes for absolute sections */ + /* Normal attributes for absolute sections. */ section_type[1] = this_byte (&(ieee->h)); section->flags = SEC_ALLOC; switch (section_type[1]) { - case 0xD3: /* AS Absolute section attributes */ + case 0xD3: /* AS Absolute section attributes. */ next_byte (&(ieee->h)); section_type[2] = this_byte (&(ieee->h)); switch (section_type[2]) { case 0xD0: - /* Normal code */ + /* Normal code. */ next_byte (&(ieee->h)); section->flags |= SEC_CODE; break; case 0xC4: - /* Normal data */ + /* Normal data. */ next_byte (&(ieee->h)); section->flags |= SEC_DATA; break; case 0xD2: next_byte (&(ieee->h)); - /* Normal rom data */ + /* Normal rom data. */ section->flags |= SEC_ROM | SEC_DATA; break; default: @@ -1321,20 +1315,20 @@ ieee_slurp_sections (abfd) } } break; - case 0xC3: /* Named relocatable sections (type C) */ + case 0xC3: /* Named relocatable sections (type C). */ section_type[1] = this_byte (&(ieee->h)); section->flags = SEC_ALLOC; switch (section_type[1]) { - case 0xD0: /* Normal code (CP) */ + case 0xD0: /* Normal code (CP). */ next_byte (&(ieee->h)); section->flags |= SEC_CODE; break; - case 0xC4: /* Normal data (CD) */ + case 0xC4: /* Normal data (CD). */ next_byte (&(ieee->h)); section->flags |= SEC_DATA; break; - case 0xD2: /* Normal rom data (CR) */ + case 0xD2: /* Normal rom data (CR). */ next_byte (&(ieee->h)); section->flags |= SEC_ROM | SEC_DATA; break; @@ -1343,12 +1337,12 @@ ieee_slurp_sections (abfd) } } - /* Read section name, use it if non empty. */ + /* Read section name, use it if non empty. */ name = read_id (&ieee->h); if (name[0]) section->name = name; - /* Skip these fields, which we don't care about */ + /* Skip these fields, which we don't care about. */ { bfd_vma parent, brother, context; parse_int (&(ieee->h), &parent); @@ -1452,9 +1446,7 @@ ieee_slurp_debug (abfd) return TRUE; } -/*********************************************************************** -* archive stuff -*/ +/* Archive stuff. */ const bfd_target * ieee_archive_p (abfd) @@ -1640,11 +1632,9 @@ ieee_object_p (abfd) goto got_wrong_format; ieee->mb.module_name = read_id (&(ieee->h)); if (abfd->filename == (const char *) NULL) - { - abfd->filename = ieee->mb.module_name; - } - /* Determine the architecture and machine type of the object file. - */ + abfd->filename = ieee->mb.module_name; + + /* Determine the architecture and machine type of the object file. */ { const bfd_arch_info_type *arch; char family[10]; @@ -1685,7 +1675,7 @@ ieee_object_p (abfd) } else if (TOUPPER (processor[3]) == 'F') /* 68F333 */ strcpy (family, "68332"); /* CPU32 */ - else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers */ + else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers. */ && ((TOUPPER (processor[2]) == 'E') || (TOUPPER (processor[2]) == 'H') || (TOUPPER (processor[2]) == 'L'))) @@ -1694,7 +1684,7 @@ ieee_object_p (abfd) strncat (family, processor + 4, 7); family[9] = '\0'; } - else /* "Regular" processors */ + else /* "Regular" processors. */ { strncpy (family, processor, 9); family[9] = '\0'; @@ -1716,43 +1706,34 @@ ieee_object_p (abfd) } if (this_byte (&(ieee->h)) != (int) ieee_address_descriptor_enum) - { - goto fail; - } + goto fail; + next_byte (&(ieee->h)); if (! parse_int (&(ieee->h), &ieee->ad.number_of_bits_mau)) - { - goto fail; - } + goto fail; + if (! parse_int (&(ieee->h), &ieee->ad.number_of_maus_in_address)) - { - goto fail; - } + goto fail; - /* If there is a byte order info, take it */ - if (this_byte (&(ieee->h)) == (int) ieee_variable_L_enum || - this_byte (&(ieee->h)) == (int) ieee_variable_M_enum) + /* If there is a byte order info, take it. */ + if (this_byte (&(ieee->h)) == (int) ieee_variable_L_enum + || this_byte (&(ieee->h)) == (int) ieee_variable_M_enum) next_byte (&(ieee->h)); for (part = 0; part < N_W_VARIABLES; part++) { bfd_boolean ok; + if (read_2bytes (&(ieee->h)) != (int) ieee_assign_value_to_variable_enum) - { - goto fail; - } + goto fail; + if (this_byte_and_next (&(ieee->h)) != part) - { - goto fail; - } + goto fail; ieee->w.offset[part] = parse_i (&(ieee->h), &ok); if (! ok) - { - goto fail; - } - + goto fail; } if (ieee->w.r.external_part != 0) @@ -1761,7 +1742,7 @@ ieee_object_p (abfd) /* By now we know that this is a real IEEE file, we're going to read the whole thing into memory so that we can run up and down it quickly. We can work out how big the file is from the trailer - record */ + record. */ amt = ieee->w.r.me_record + 1; IEEE_DATA (abfd)->h.first_byte = @@ -1782,7 +1763,6 @@ ieee_object_p (abfd) /* Parse section data to activate file and section flags implied by section contents. */ - if (! ieee_slurp_section_data (abfd)) goto fail; @@ -1835,6 +1815,7 @@ ieee_print_symbol (abfd, afile, symbol, how) (symbol->section == (asection *) NULL ? "*abs" : symbol->section->name); + if (symbol->name[0] == ' ') { fprintf (file, "* empty table entry "); @@ -1868,6 +1849,7 @@ do_one (ieee, current_map, location_ptr, s, iterations) { unsigned int number_of_maus; unsigned int i; + next_byte (&(ieee->h)); number_of_maus = must_parse_int (&(ieee->h)); @@ -1882,6 +1864,7 @@ do_one (ieee, current_map, location_ptr, s, iterations) case ieee_load_with_relocation_enum: { bfd_boolean loop = TRUE; + next_byte (&(ieee->h)); while (loop) { @@ -1923,7 +1906,7 @@ do_one (ieee, current_map, location_ptr, s, iterations) if (this_byte (&(ieee->h)) == (int) ieee_comma) { next_byte (&(ieee->h)); - /* Fetch number of bytes to pad */ + /* Fetch number of bytes to pad. */ extra = must_parse_int (&(ieee->h)); }; @@ -1941,7 +1924,7 @@ do_one (ieee, current_map, location_ptr, s, iterations) default: break; } - /* Build a relocation entry for this type */ + /* Build a relocation entry for this type. */ /* If pc rel then stick -ve pc into instruction and take out of reloc .. @@ -2053,7 +2036,8 @@ do_one (ieee, current_map, location_ptr, s, iterations) return TRUE; } -/* Read in all the section data and relocation stuff too */ +/* Read in all the section data and relocation stuff too. */ + static bfd_boolean ieee_slurp_section_data (abfd) bfd *abfd; @@ -2064,14 +2048,13 @@ ieee_slurp_section_data (abfd) ieee_per_section_type *current_map = (ieee_per_section_type *) NULL; asection *s; - /* Seek to the start of the data area */ + /* Seek to the start of the data area. */ if (ieee->read_data) return TRUE; ieee->read_data = TRUE; ieee_seek (ieee, ieee->w.r.data_part); - /* Allocate enough space for all the section contents */ - + /* Allocate enough space for all the section contents. */ for (s = abfd->sections; s != (asection *) NULL; s = s->next) { ieee_per_section_type *per = ieee_per_section (s); @@ -2080,7 +2063,6 @@ ieee_slurp_section_data (abfd) per->data = (bfd_byte *) bfd_alloc (ieee->h.abfd, s->_raw_size); if (!per->data) return FALSE; - /*SUPPRESS 68*/ per->reloc_tail_ptr = (ieee_reloc_type **) & (s->relocation); } @@ -2089,7 +2071,7 @@ ieee_slurp_section_data (abfd) { switch (this_byte (&(ieee->h))) { - /* IF we see anything strange then quit */ + /* IF we see anything strange then quit. */ default: return TRUE; @@ -2100,9 +2082,9 @@ ieee_slurp_section_data (abfd) s->flags |= SEC_LOAD | SEC_HAS_CONTENTS; current_map = ieee_per_section (s); location_ptr = current_map->data - s->vma; - /* The document I have says that Microtec's compilers reset */ - /* this after a sec section, even though the standard says not */ - /* to. SO .. */ + /* The document I have says that Microtec's compilers reset + this after a sec section, even though the standard says not + to, SO... */ current_map->pc = s->vma; break; @@ -2116,8 +2098,9 @@ ieee_slurp_section_data (abfd) ieee_symbol_index_type symbol; unsigned int extra; bfd_boolean pcrel; + next_byte (&(ieee->h)); - must_parse_int (&(ieee->h)); /* Throw away section #*/ + must_parse_int (&(ieee->h)); /* Throw away section #. */ parse_expression (ieee, &value, &symbol, &pcrel, &extra, @@ -2132,7 +2115,7 @@ ieee_slurp_section_data (abfd) if (this_byte (&(ieee->h)) == ieee_function_either_open_b_enum) next_byte (&(ieee->h)); abfd->start_address = must_parse_int (&(ieee->h)); - /* We've got to the end of the data now - */ + /* We've got to the end of the data now - */ return TRUE; default: BFD_FAIL (); @@ -2142,18 +2125,17 @@ ieee_slurp_section_data (abfd) case ieee_repeat_data_enum: { /* Repeat the following LD or LR n times - we do this by - remembering the stream pointer before running it and - resetting it and running it n times. We special case - the repetition of a repeat_data/load_constant - */ - + remembering the stream pointer before running it and + resetting it and running it n times. We special case + the repetition of a repeat_data/load_constant. */ unsigned int iterations; unsigned char *start; + next_byte (&(ieee->h)); iterations = must_parse_int (&(ieee->h)); start = ieee->h.input_p; - if (start[0] == (int) ieee_load_constant_bytes_enum && - start[1] == 1) + if (start[0] == (int) ieee_load_constant_bytes_enum + && start[1] == 1) { while (iterations != 0) { @@ -2179,10 +2161,8 @@ ieee_slurp_section_data (abfd) break; case ieee_load_constant_bytes_enum: case ieee_load_with_relocation_enum: - { - if (!do_one (ieee, current_map, location_ptr, s, 1)) - return FALSE; - } + if (!do_one (ieee, current_map, location_ptr, s, 1)) + return FALSE; } } } @@ -2245,7 +2225,7 @@ ieee_canonicalize_reloc (abfd, section, relptr, symbols) while (src != (ieee_reloc_type *) NULL) { - /* Work out which symbol to attach it this reloc to */ + /* Work out which symbol to attach it this reloc to. */ switch (src->symbol.letter) { case 'I': @@ -2304,7 +2284,7 @@ ieee_write_section_part (abfd) if (abfd->flags & EXEC_P) { - /* This image is executable, so output absolute sections */ + /* This image is executable, so output absolute sections. */ if (! ieee_write_byte (abfd, ieee_variable_A_enum) || ! ieee_write_byte (abfd, ieee_variable_S_enum)) return FALSE; @@ -2343,7 +2323,7 @@ ieee_write_section_part (abfd) ieee_write_int (abfd, 0); /* Brother */ ieee_write_int (abfd, 0); /* Context */ #endif - /* Alignment */ + /* Alignment. */ if (! ieee_write_byte (abfd, ieee_section_alignment_enum) || ! ieee_write_byte (abfd, (bfd_byte) (s->index @@ -2351,7 +2331,7 @@ ieee_write_section_part (abfd) || ! ieee_write_int (abfd, (bfd_vma) 1 << s->alignment_power)) return FALSE; - /* Size */ + /* Size. */ if (! ieee_write_2bytes (abfd, ieee_section_size_enum) || ! ieee_write_byte (abfd, (bfd_byte) (s->index @@ -2360,8 +2340,8 @@ ieee_write_section_part (abfd) return FALSE; if (abfd->flags & EXEC_P) { - /* Relocateable sections don't have asl records */ - /* Vma */ + /* Relocateable sections don't have asl records. */ + /* Vma. */ if (! ieee_write_2bytes (abfd, ieee_section_base_address_enum) || ! ieee_write_byte (abfd, ((bfd_byte) @@ -2394,7 +2374,7 @@ do_with_relocs (abfd, s) sizeof (arelent **), comp); - /* Output the section preheader */ + /* Output the section preheader. */ if (! ieee_write_byte (abfd, ieee_set_current_section_enum) || ! ieee_write_byte (abfd, (bfd_byte) (s->index + IEEE_SECTION_NUMBER_BASE)) @@ -2417,23 +2397,21 @@ do_with_relocs (abfd, s) if (relocs_to_go == 0) { /* If there aren't any relocations then output the load constant - byte opcode rather than the load with relocation opcode */ - + byte opcode rather than the load with relocation opcode. */ while (current_byte_index < s->_raw_size) { bfd_size_type run; unsigned int MAXRUN = 127; + run = MAXRUN; if (run > s->_raw_size - current_byte_index) - { - run = s->_raw_size - current_byte_index; - } + run = s->_raw_size - current_byte_index; if (run != 0) { if (! ieee_write_byte (abfd, ieee_load_constant_bytes_enum)) return FALSE; - /* Output a stream of bytes */ + /* Output a stream of bytes. */ if (! ieee_write_int (abfd, run)) return FALSE; if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd) @@ -2454,7 +2432,7 @@ do_with_relocs (abfd, s) if ((PTR) stream == (PTR) NULL) { - /* Outputting a section without data, fill it up */ + /* Outputting a section without data, fill it up. */ stream = (unsigned char *) bfd_zalloc (abfd, s->_raw_size); if (!stream) return FALSE; @@ -2463,6 +2441,7 @@ do_with_relocs (abfd, s) { bfd_size_type run; unsigned int MAXRUN = 127; + if (relocs_to_go) { run = (*p)->address - current_byte_index; @@ -2470,17 +2449,14 @@ do_with_relocs (abfd, s) run = MAXRUN; } else - { - run = MAXRUN; - } + run = MAXRUN; + if (run > s->_raw_size - current_byte_index) - { - run = s->_raw_size - current_byte_index; - } + run = s->_raw_size - current_byte_index; if (run != 0) { - /* Output a stream of bytes */ + /* Output a stream of bytes. */ if (! ieee_write_int (abfd, run)) return FALSE; if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd) @@ -2488,7 +2464,8 @@ do_with_relocs (abfd, s) return FALSE; current_byte_index += run; } - /* Output any relocations here */ + + /* Output any relocations here. */ if (relocs_to_go && (*p) && (*p)->address == current_byte_index) { while (relocs_to_go @@ -2496,14 +2473,10 @@ do_with_relocs (abfd, s) { arelent *r = *p; bfd_signed_vma ov; - #if 0 if (r->howto->pc_relative) - { - r->addend += current_byte_index; - } + r->addend += current_byte_index; #endif - switch (r->howto->size) { case 2: @@ -2638,6 +2611,7 @@ do_without_relocs (abfd, s) else { unsigned int i; + for (i = 0; i < s->_raw_size; i++) { if (stream[i] != 0) @@ -2699,6 +2673,7 @@ static void flush () { bfd_size_type amt = output_ptr - output_ptr_start; + if (bfd_bwrite ((PTR) (output_ptr_start), amt, output_bfd) != amt) abort (); output_ptr = output_ptr_start; @@ -2720,20 +2695,14 @@ write_int (value) else { unsigned int length; - /* How many significant bytes ? */ - /* FIXME FOR LONGER INTS */ + /* How many significant bytes ? */ + /* FIXME FOR LONGER INTS. */ if (value & 0xff000000) - { - length = 4; - } + length = 4; else if (value & 0x00ff0000) - { - length = 3; - } + length = 3; else if (value & 0x0000ff00) - { - length = 2; - } + length = 2; else length = 1; @@ -2749,7 +2718,6 @@ write_int (value) case 1: OUT (value); } - } } @@ -2758,6 +2726,7 @@ copy_id () { int length = THIS (); char ch; + OUT (length); NEXT (); while (length--) @@ -2775,6 +2744,7 @@ copy_expression () int stack[10]; int *tos = stack; int value; + while (1) { switch (THIS ()) @@ -2822,7 +2792,7 @@ copy_expression () default: if (THIS () > 0x84) { - /* Not a number, just bug out with the answer */ + /* Not a number, just bug out with the answer. */ write_int (*(--tos)); return; } @@ -2830,7 +2800,7 @@ copy_expression () NEXT (); break; case 0xa5: - /* PLUS anything */ + /* PLUS anything. */ value = *(--tos); value += *(--tos); *tos++ = value; @@ -2841,6 +2811,7 @@ copy_expression () int section_number; ieee_data_type *ieee; asection *s; + NEXT (); section_number = THIS (); @@ -2874,7 +2845,7 @@ fill_int (buf) { if (buf->buffer == output_buffer) { - /* Still a chance to output the size */ + /* Still a chance to output the size. */ int value = output_ptr - buf->ptrp + 3; buf->ptrp[0] = value >> 24; buf->ptrp[1] = value >> 16; @@ -2889,6 +2860,7 @@ drop_int (buf) { int type = THIS (); int ch; + if (type <= 0x84) { NEXT (); @@ -2962,7 +2934,8 @@ static void f1_record () { int ch; - /* ATN record */ + + /* ATN record. */ NEXT (); ch = THIS (); switch (ch) @@ -3002,7 +2975,7 @@ f1_record () } break; case 0xd8: - /* EXternal ref */ + /* EXternal ref. */ NEXT (); OUT (0xf1); OUT (0xd8); @@ -3056,13 +3029,12 @@ f1_record () break; } } - } static void f0_record () { - /* Attribute record */ + /* Attribute record. */ NEXT (); OUT (0xf0); INTn (Symbol name); @@ -3073,6 +3045,7 @@ static void copy_till_end () { int ch = THIS (); + while (1) { while (ch <= 0x80) @@ -3131,11 +3104,12 @@ f8_record () case 0x01: case 0x02: case 0x03: - /* Unique typedefs for module */ - /* GLobal typedefs */ - /* High level module scope beginning */ + /* Unique typedefs for module. */ + /* GLobal typedefs. */ + /* High level module scope beginning. */ { struct output_buffer_struct ob; + NEXT (); OUT (0xf8); OUT (ch); @@ -3150,9 +3124,10 @@ f8_record () } break; case 0x04: - /* Global function */ + /* Global function. */ { struct output_buffer_struct ob; + NEXT (); OUT (0xf8); OUT (0x04); @@ -3172,9 +3147,10 @@ f8_record () break; case 0x05: - /* File name for source line numbers */ + /* File name for source line numbers. */ { struct output_buffer_struct ob; + NEXT (); OUT (0xf8); OUT (0x05); @@ -3194,9 +3170,10 @@ f8_record () break; case 0x06: - /* Local function */ + /* Local function. */ { struct output_buffer_struct ob; + NEXT (); OUT (0xf8); OUT (0x06); @@ -3214,7 +3191,7 @@ f8_record () break; case 0x0a: - /* Assembler module scope beginning -*/ + /* Assembler module scope beginning - */ { struct output_buffer_struct ob; @@ -3243,6 +3220,7 @@ f8_record () case 0x0b: { struct output_buffer_struct ob; + NEXT (); OUT (0xf8); OUT (0x0b); @@ -3279,6 +3257,7 @@ static void block () { int ch; + while (1) { ch = THIS (); @@ -3310,11 +3289,8 @@ block () } - -/* relocate_debug, - moves all the debug information from the source bfd to the output - bfd, and relocates any expressions it finds -*/ +/* Moves all the debug information from the source bfd to the output + bfd, and relocates any expressions it finds. */ static void relocate_debug (output, input) @@ -3375,6 +3351,7 @@ ieee_write_debug_part (abfd) { bfd *entry = chain->this; ieee_data_type *entry_ieee = IEEE_DATA (entry); + if (entry_ieee->w.r.debug_information_part) { if (bfd_seek (entry, entry_ieee->w.r.debug_information_part, @@ -3385,14 +3362,11 @@ ieee_write_debug_part (abfd) chain = chain->next; } + if (some_debug) - { - ieee->w.r.debug_information_part = here; - } + ieee->w.r.debug_information_part = here; else - { - ieee->w.r.debug_information_part = 0; - } + ieee->w.r.debug_information_part = 0; flush (); } @@ -3407,8 +3381,10 @@ ieee_write_data_part (abfd) bfd *abfd; { asection *s; + ieee_data_type *ieee = IEEE_DATA (abfd); ieee->w.r.data_part = bfd_tell (abfd); + for (s = abfd->sections; s != (asection *) NULL; s = s->next) { /* Skip sections that have no loadable contents (.bss, @@ -3439,6 +3415,7 @@ init_for_output (abfd) bfd *abfd; { asection *s; + for (s = abfd->sections; s != (asection *) NULL; s = s->next) { if ((s->flags & SEC_DEBUGGING) != 0) @@ -3454,11 +3431,11 @@ init_for_output (abfd) return TRUE; } -/** exec and core file sections */ +/* Exec and core file sections. */ + +/* Set section contents is complicated with IEEE since the format is + not a byte image, but a record stream. */ -/* set section contents is complicated with IEEE since the format is -* not a byte image, but a record stream. -*/ static bfd_boolean ieee_set_section_contents (abfd, section, location, offset, count) bfd *abfd; @@ -3504,20 +3481,21 @@ ieee_write_external_part (abfd) { asymbol **q; ieee_data_type *ieee = IEEE_DATA (abfd); - unsigned int reference_index = IEEE_REFERENCE_BASE; unsigned int public_index = IEEE_PUBLIC_BASE + 2; file_ptr here = bfd_tell (abfd); bfd_boolean hadone = FALSE; + if (abfd->outsymbols != (asymbol **) NULL) { for (q = abfd->outsymbols; *q != (asymbol *) NULL; q++) { asymbol *p = *q; + if (bfd_is_und_section (p->section)) { - /* This must be a symbol reference .. */ + /* This must be a symbol reference. */ if (! ieee_write_byte (abfd, ieee_external_reference_enum) || ! ieee_write_int (abfd, (bfd_vma) reference_index) || ! ieee_write_id (abfd, p->name)) @@ -3528,7 +3506,7 @@ ieee_write_external_part (abfd) } else if (bfd_is_com_section (p->section)) { - /* This is a weak reference */ + /* This is a weak reference. */ if (! ieee_write_byte (abfd, ieee_external_reference_enum) || ! ieee_write_int (abfd, (bfd_vma) reference_index) || ! ieee_write_id (abfd, p->name) @@ -3543,8 +3521,7 @@ ieee_write_external_part (abfd) } else if (p->flags & BSF_GLOBAL) { - /* This must be a symbol definition */ - + /* This must be a symbol definition. */ if (! ieee_write_byte (abfd, ieee_external_symbol_enum) || ! ieee_write_int (abfd, (bfd_vma) public_index) || ! ieee_write_id (abfd, p->name) @@ -3555,7 +3532,7 @@ ieee_write_external_part (abfd) || ! ieee_write_byte (abfd, 1)) /* one of them */ return FALSE; - /* Write out the value */ + /* Write out the value. */ if (! ieee_write_2bytes (abfd, ieee_value_record_enum) || ! ieee_write_int (abfd, (bfd_vma) public_index)) return FALSE; @@ -3564,7 +3541,7 @@ ieee_write_external_part (abfd) if (abfd->flags & EXEC_P) { /* If fully linked, then output all symbols - relocated */ + relocated. */ if (! (ieee_write_int (abfd, (p->value @@ -3596,8 +3573,8 @@ ieee_write_external_part (abfd) } else { - /* This can happen - when there are gaps in the symbols read */ - /* from an input ieee file */ + /* This can happen - when there are gaps in the symbols read + from an input ieee file. */ } } } @@ -3611,9 +3588,9 @@ ieee_write_external_part (abfd) static const unsigned char exten[] = { 0xf0, 0x20, 0x00, - 0xf1, 0xce, 0x20, 0x00, 37, 3, 3, /* Set version 3 rev 3 */ - 0xf1, 0xce, 0x20, 0x00, 39, 2,/* keep symbol in original case */ - 0xf1, 0xce, 0x20, 0x00, 38 /* set object type relocateable to x */ + 0xf1, 0xce, 0x20, 0x00, 37, 3, 3, /* Set version 3 rev 3. */ + 0xf1, 0xce, 0x20, 0x00, 39, 2, /* Keep symbol in original case. */ + 0xf1, 0xce, 0x20, 0x00, 38 /* Set object type relocateable to x. */ }; static const unsigned char envi[] = @@ -3746,7 +3723,7 @@ ieee_write_object_contents (abfd) unsigned int i; file_ptr old; - /* Fast forward over the header area */ + /* Fast forward over the header area. */ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return FALSE; @@ -3755,14 +3732,14 @@ ieee_write_object_contents (abfd) || ! ieee_write_id (abfd, abfd->filename)) return FALSE; - /* Fast forward over the variable bits */ + /* Fast forward over the variable bits. */ if (! ieee_write_byte (abfd, ieee_address_descriptor_enum)) return FALSE; - /* Bits per MAU */ + /* Bits per MAU. */ if (! ieee_write_byte (abfd, (bfd_byte) (bfd_arch_bits_per_byte (abfd)))) return FALSE; - /* MAU's per address */ + /* MAU's per address. */ if (! ieee_write_byte (abfd, (bfd_byte) (bfd_arch_bits_per_address (abfd) / bfd_arch_bits_per_byte (abfd)))) @@ -3823,11 +3800,6 @@ ieee_write_object_contents (abfd) if (! ieee_write_external_part (abfd)) return FALSE; - /* ieee_write_byte(abfd, ieee_record_seperator_enum);*/ - - /* ieee_write_byte(abfd, ieee_record_seperator_enum);*/ - - /* Write any debugs we have been told about. */ if (! ieee_write_debug_part (abfd)) return FALSE; @@ -3842,7 +3814,7 @@ ieee_write_object_contents (abfd) if (! ieee_write_me_part (abfd)) return FALSE; - /* Generate the header */ + /* Generate the header. */ if (bfd_seek (abfd, old, SEEK_SET) != 0) return FALSE; @@ -3861,7 +3833,7 @@ ieee_write_object_contents (abfd) /* We read the symbols into a buffer, which is discarded when this function exits. We read the strings into a buffer large enough to - hold them all plus all the cached symbol entries. */ + hold them all plus all the cached symbol entries. */ static asymbol * ieee_make_empty_symbol (abfd) @@ -3869,6 +3841,7 @@ ieee_make_empty_symbol (abfd) { bfd_size_type amt = sizeof (ieee_symbol_type); ieee_symbol_type *new = (ieee_symbol_type *) bfd_zalloc (abfd, amt); + if (!new) return NULL; new->symbol.the_bfd = abfd; @@ -3881,15 +3854,16 @@ ieee_openr_next_archived_file (arch, prev) bfd *prev; { ieee_ar_data_type *ar = IEEE_AR_DATA (arch); - /* take the next one from the arch state, or reset */ + + /* Take the next one from the arch state, or reset. */ if (prev == (bfd *) NULL) - { - /* Reset the index - the first two entries are bogus*/ - ar->element_index = 2; - } + /* Reset the index - the first two entries are bogus. */ + ar->element_index = 2; + while (TRUE) { ieee_ar_obstack_type *p = ar->elements + ar->element_index; + ar->element_index++; if (ar->element_index <= ar->element_count) { @@ -3908,7 +3882,6 @@ ieee_openr_next_archived_file (arch, prev) bfd_set_error (bfd_error_no_more_archived_files); return (bfd *) NULL; } - } } @@ -3986,8 +3959,7 @@ ieee_bfd_debug_info_end (abfd) /* Add this section to the list of sections we have debug info for, to - be ready to output it at close time - */ + be ready to output it at close time. */ static void ieee_bfd_debug_info_accumulate (abfd, section) bfd *abfd; @@ -3995,37 +3967,34 @@ ieee_bfd_debug_info_accumulate (abfd, section) { ieee_data_type *ieee = IEEE_DATA (section->owner); ieee_data_type *output_ieee = IEEE_DATA (abfd); - /* can only accumulate data from other ieee bfds */ + + /* Can only accumulate data from other ieee bfds. */ if (section->owner->xvec != abfd->xvec) return; - /* Only bother once per bfd */ + /* Only bother once per bfd. */ if (ieee->done_debug) return; ieee->done_debug = TRUE; - /* Don't bother if there is no debug info */ + /* Don't bother if there is no debug info. */ if (ieee->w.r.debug_information_part == 0) return; - - /* Add to chain */ + /* Add to chain. */ { bfd_size_type amt = sizeof (bfd_chain_type); bfd_chain_type *n = (bfd_chain_type *) bfd_alloc (abfd, amt); + if (!n) abort (); /* FIXME */ n->this = section->owner; n->next = (bfd_chain_type *) NULL; if (output_ieee->chain_head) - { - output_ieee->chain_head->next = n; - } + output_ieee->chain_head->next = n; else - { - output_ieee->chain_root = n; + output_ieee->chain_root = n; - } output_ieee->chain_head = n; } } @@ -4075,7 +4044,6 @@ ieee_bfd_debug_info_accumulate (abfd, section) #define ieee_bfd_final_link _bfd_generic_final_link #define ieee_bfd_link_split_section _bfd_generic_link_split_section -/*SUPPRESS 460 */ const bfd_target ieee_vec = { "ieee", /* name */ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 14978ba..9bbdebd 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -850,7 +850,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_LO16", "BFD_RELOC_PCREL_HI16_S", "BFD_RELOC_PCREL_LO16", - "BFD_RELOC_MIPSEMB_16_PCREL_S2", "BFD_RELOC_MIPS_LITERAL", "BFD_RELOC_MIPS_GOT16", "BFD_RELOC_MIPS_CALL16", @@ -1044,6 +1043,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_ARM_SWI", "BFD_RELOC_ARM_MULTI", "BFD_RELOC_ARM_CP_OFF_IMM", + "BFD_RELOC_ARM_CP_OFF_IMM_S2", "BFD_RELOC_ARM_ADR_IMM", "BFD_RELOC_ARM_LDR_IMM", "BFD_RELOC_ARM_LITERAL", @@ -1475,6 +1475,16 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_IQ2000_OFFSET_16", "BFD_RELOC_IQ2000_OFFSET_21", "BFD_RELOC_IQ2000_UHI16", + "BFD_RELOC_XTENSA_RTLD", + "BFD_RELOC_XTENSA_GLOB_DAT", + "BFD_RELOC_XTENSA_JMP_SLOT", + "BFD_RELOC_XTENSA_RELATIVE", + "BFD_RELOC_XTENSA_PLT", + "BFD_RELOC_XTENSA_OP0", + "BFD_RELOC_XTENSA_OP1", + "BFD_RELOC_XTENSA_OP2", + "BFD_RELOC_XTENSA_ASM_EXPAND", + "BFD_RELOC_XTENSA_ASM_SIMPLIFY", "@@overflow: BFD_RELOC_UNUSED@@", }; #endif diff --git a/bfd/libpei.h b/bfd/libpei.h index 7a5f9fe..72fa7b5 100644 --- a/bfd/libpei.h +++ b/bfd/libpei.h @@ -1,31 +1,29 @@ /* Support for the generic parts of PE/PEI; common header information. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Solutions. -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. */ - -/* -Most of this hacked by Steve Chamberlain, +/* Most of this hacked by Steve Chamberlain, sac@cygnus.com -PE/PEI rearrangement (and code added): Donn Terry - Softway Systems, Inc. -*/ + PE/PEI rearrangement (and code added): Donn Terry + Softway Systems, Inc. */ /* Hey look, some documentation [and in a place you expect to find it]! @@ -53,8 +51,7 @@ PE/PEI rearrangement (and code added): Donn Terry FIXME: Please add more docs here so the next poor fool that has to hack on this code has a chance of getting something accomplished without - wasting too much time. -*/ + wasting too much time. */ #ifndef GET_FCN_LNNOPTR #define GET_FCN_LNNOPTR(abfd, ext) \ @@ -333,3 +330,6 @@ unsigned int _bfd_XX_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR)); unsigned int _bfd_XXi_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR)); bfd_boolean _bfd_XX_bfd_copy_private_section_data PARAMS ((bfd *, asection *, bfd *, asection *)); + +/* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file. */ +#define bfd_pe_executable_p(abfd) (strncmp ((abfd)->xvec->name, "pei-", 4) == 0) diff --git a/bfd/linker.c b/bfd/linker.c index 918f4f8..c0e3236 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -1,23 +1,23 @@ /* linker.c -- BFD linker routines - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Steve Chamberlain and 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. */ #include "bfd.h" #include "sysdep.h" @@ -2081,12 +2081,12 @@ _bfd_generic_final_link (abfd, info) input_section, relocs, symbols); + free (relocs); if (reloc_count < 0) return FALSE; BFD_ASSERT ((unsigned long) reloc_count == input_section->reloc_count); o->reloc_count += reloc_count; - free (relocs); } } if (o->reloc_count > 0) diff --git a/bfd/m68k4knetbsd.c b/bfd/m68k4knetbsd.c index 13e0a6d..1ca4a62 100644 --- a/bfd/m68k4knetbsd.c +++ b/bfd/m68k4knetbsd.c @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/m68k a.out-ish binaries. - Copyright 1990, 1991, 1992, 1995, 1998, 2001 + Copyright 1990, 1991, 1992, 1995, 1998, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,7 +18,6 @@ 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. */ -#define BYTES_IN_WORD 4 #define TARGET_IS_BIG_ENDIAN_P #define TARGET_PAGE_SIZE 0x1000 diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c index a526998..1a82980 100644 --- a/bfd/m68klinux.c +++ b/bfd/m68klinux.c @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored m68k a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SEGMENT_SIZE TARGET_PAGE_SIZE #define TEXT_START_ADDR 0x0 #define N_SHARED_LIB(x) 0 -#define BYTES_IN_WORD 4 #define MACHTYPE_OK(mtype) ((mtype) == M_68020 || (mtype) == M_UNKNOWN) diff --git a/bfd/m68klynx.c b/bfd/m68klynx.c index 00571ca..46fa076 100644 --- a/bfd/m68klynx.c +++ b/bfd/m68klynx.c @@ -1,5 +1,5 @@ /* BFD back-end for m68k binaries under LynxOS. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,7 +18,6 @@ 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. */ -#define BYTES_IN_WORD 4 #define N_SHARED_LIB(x) 0 #define TEXT_START_ADDR 0 diff --git a/bfd/m68knetbsd.c b/bfd/m68knetbsd.c index 521d646..2a74889 100644 --- a/bfd/m68knetbsd.c +++ b/bfd/m68knetbsd.c @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/m68k a.out-ish binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001 + Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,7 +18,6 @@ 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. */ -#define BYTES_IN_WORD 4 #define TARGET_IS_BIG_ENDIAN_P /* Our m68k ports use either 4K or 8K pages, but object files always diff --git a/bfd/m88kmach3.c b/bfd/m88kmach3.c index 8305401..79e3bb8 100644 --- a/bfd/m88kmach3.c +++ b/bfd/m88kmach3.c @@ -1,5 +1,5 @@ /* BFD back-end for Motorola m88k a.out (Mach 3) binaries. - Copyright 1990, 1991, 1993, 1994, 1995, 2001 + Copyright 1990, 1991, 1993, 1994, 1995, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_PAGE_SIZE (4096*2) #define SEGMENT_SIZE 0x20000 #define TEXT_START_ADDR 0 -#define BYTES_IN_WORD 4 #define N_HEADER_IN_TEXT(x) 1 /* (N_MAGIG(x) == ZMAGIC) */ #define N_SHARED_LIB(x) 0 diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c index 581ace2..af1ba55 100644 --- a/bfd/mipsbsd.c +++ b/bfd/mipsbsd.c @@ -1,5 +1,5 @@ /* BFD backend for MIPS BSD (a.out) binaries. - Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ralph Campbell. @@ -19,7 +19,6 @@ 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. */ -#define BYTES_IN_WORD 4 /* #define ENTRY_CAN_BE_ZERO */ #define N_HEADER_IN_TEXT(x) 1 #define N_SHARED_LIB(x) 0 diff --git a/bfd/newsos3.c b/bfd/newsos3.c index 34c4216..d0a5c54 100644 --- a/bfd/newsos3.c +++ b/bfd/newsos3.c @@ -1,5 +1,5 @@ /* BFD back-end for NewsOS3 (Sony, 68k) binaries. - Copyright 1990, 1991, 1994, 1995, 2000, 2001 + Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_PAGE_SIZE 4096 #define SEGMENT_SIZE TARGET_PAGE_SIZE #define TEXT_START_ADDR 0 -#define BYTES_IN_WORD 4 /* 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/opncls.c b/bfd/opncls.c index 81bd2c8..4771979 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -931,8 +931,13 @@ find_separate_debug_file (abfd, debug_file_directory) basename = get_debug_link_info (abfd, & crc32); - if (basename == NULL || strlen (basename) < 1) + if (basename == NULL) return NULL; + if (strlen (basename) < 1) + { + free (basename); + return NULL; + } dir = xstrdup (abfd->filename); BFD_ASSERT (strlen (dir) != 0); diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 7023678..ba1c219 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -1,5 +1,5 @@ /* Support for the generic parts of PE/PEI; the common executable parts. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Solutions. @@ -570,7 +570,9 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr; PEAOUTHDR *aouthdr_out = (PEAOUTHDR *) out; bfd_vma sa, fa, ib; + IMAGE_DATA_DIRECTORY idata2, idata5; + if (pe->force_minimum_alignment) { if (!extra->FileAlignment) @@ -586,6 +588,9 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) fa = extra->FileAlignment; ib = extra->ImageBase; + idata2 = pe->pe_opthdr.DataDirectory[1]; + idata5 = pe->pe_opthdr.DataDirectory[12]; + if (aouthdr_in->tsize) { aouthdr_in->text_start -= ib; @@ -614,28 +619,34 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) #define SA(x) (((x) + sa -1 ) & (- sa)) /* We like to have the sizes aligned. */ - aouthdr_in->bsize = FA (aouthdr_in->bsize); extra->NumberOfRvaAndSizes = IMAGE_NUMBEROF_DIRECTORY_ENTRIES; - /* first null out all data directory entries .. */ + /* First null out all data directory entries. */ memset (extra->DataDirectory, 0, sizeof (extra->DataDirectory)); add_data_entry (abfd, extra, 0, ".edata", ib); - - /* Don't call add_data_entry for .idata$2 or .idata$5. It's done in - bfd_coff_final_link where all the required information is - available. */ - - /* However, until other .idata fixes are made (pending patch), the - entry for .idata is needed for backwards compatability. FIXME. */ - add_data_entry (abfd, extra, 1, ".idata", ib); - add_data_entry (abfd, extra, 2, ".rsrc", ib); - add_data_entry (abfd, extra, 3, ".pdata", ib); + /* In theory we do not need to call add_data_entry for .idata$2 or + .idata$5. It will be done in bfd_coff_final_link where all the + required information is available. If however, we are not going + to perform a final link, eg because we have been invoked by objcopy + or strip, then we need to make sure that these Data Directory + entries are initialised properly. + + So - we copy the input values into the output values, and then, if + a final link is going to be performed, it can overwrite them. */ + extra->DataDirectory[1] = idata2; + extra->DataDirectory[12] = idata5; + + if (extra->DataDirectory[1].VirtualAddress == 0) + /* Until other .idata fixes are made (pending patch), the entry for + .idata is needed for backwards compatability. FIXME. */ + add_data_entry (abfd, extra, 1, ".idata", ib); + /* For some reason, the virtual size (which is what's set by add_data_entry) for .reloc is not the same as the size recorded in this slot by MSVC; it doesn't seem to cause problems (so far), @@ -689,7 +700,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) aouthdr_out->standard.text_start); #ifndef COFF_WITH_pep - /* PE32+ does not have data_start member! */ + /* PE32+ does not have data_start member! */ PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start, aouthdr_out->standard.data_start); #endif @@ -895,12 +906,24 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) sometimes). */ if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0) { - ps = scnhdr_int->s_size; - ss = 0; + if (bfd_pe_executable_p (abfd)) + { + ps = scnhdr_int->s_size; + ss = 0; + } + else + { + ps = 0; + ss = scnhdr_int->s_size; + } } else { - ps = scnhdr_int->s_paddr; + if (bfd_pe_executable_p (abfd)) + ps = scnhdr_int->s_paddr; + else + ps = 0; + ss = scnhdr_int->s_size; } @@ -1994,9 +2017,9 @@ _bfd_XXi_final_link_postscript (abfd, pfinfo) ((h1->root.u.def.value + h1->root.u.def.section->output_section->vma + h1->root.u.def.section->output_offset) - - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress); + - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress); } - + /* If we couldn't find idata$2, we either have an excessively trivial program or are in DEEP trouble; we have to assume trivial program.... */ diff --git a/bfd/peicode.h b/bfd/peicode.h index 2dff0ac..b3c1f29 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -1,31 +1,29 @@ /* Support for the generic parts of PE/PEI, for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Solutions. -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. */ -/* -Most of this hacked by Steve Chamberlain, +/* Most of this hacked by Steve Chamberlain, sac@cygnus.com -PE/PEI rearrangement (and code added): Donn Terry - Softway Systems, Inc. -*/ + PE/PEI rearrangement (and code added): Donn Terry + Softway Systems, Inc. */ /* Hey look, some documentation [and in a place you expect to find it]! @@ -53,8 +51,7 @@ PE/PEI rearrangement (and code added): Donn Terry FIXME: Please add more docs here so the next poor fool that has to hack on this code has a chance of getting something accomplished without - wasting too much time. -*/ + wasting too much time. */ #include "libpei.h" @@ -259,12 +256,17 @@ coff_swap_scnhdr_in (abfd, ext, in) } #ifndef COFF_NO_HACK_SCNHDR_SIZE - /* If this section holds uninitialized data, use the virtual size - (stored in s_paddr) instead of the physical size. */ - if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0 - && (scnhdr_int->s_paddr > 0)) + /* If this section holds uninitialized data and is from an object file + or from an executable image that has not initialized the field, + or if the physical size is padded, use the virtual size (stored in + s_paddr) instead. */ + if (scnhdr_int->s_paddr > 0 + && (((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0 + && (! bfd_pe_executable_p (abfd) || scnhdr_int->s_size == 0)) + || scnhdr_int->s_size > scnhdr_int->s_paddr)) { scnhdr_int->s_size = scnhdr_int->s_paddr; + /* This code used to set scnhdr_int->s_paddr to 0. However, coff_set_alignment_hook stores s_paddr in virt_size, which only works if it correctly holds the virtual size of the diff --git a/bfd/reloc.c b/bfd/reloc.c index 45660c8..f3f6428 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -2080,10 +2080,7 @@ ENUM BFD_RELOC_PCREL_LO16 ENUMDOC Like BFD_RELOC_LO16, but PC relative. -ENUM - BFD_RELOC_MIPSEMB_16_PCREL_S2 -ENUMDOC - Like BFD_RELOC_16_PCREL_S2, but for MIPS Embedded PIC. + ENUM BFD_RELOC_MIPS_LITERAL ENUMDOC @@ -2153,6 +2150,7 @@ ENUMX ENUMDOC Fujitsu Frv Relocations. COMMENT +COMMENT ENUMDOC MIPS ELF relocations. @@ -2521,6 +2519,8 @@ ENUMX ENUMX BFD_RELOC_ARM_CP_OFF_IMM ENUMX + BFD_RELOC_ARM_CP_OFF_IMM_S2 +ENUMX BFD_RELOC_ARM_ADR_IMM ENUMX BFD_RELOC_ARM_LDR_IMM @@ -2727,7 +2727,7 @@ ENUMX ENUMX BFD_RELOC_SH_TLS_TPOFF32 ENUMDOC - Hitachi SH relocs. Not all of these appear in object files. + Renesas SH relocs. Not all of these appear in object files. ENUM BFD_RELOC_THUMB_PCREL_BRANCH9 @@ -3850,6 +3850,49 @@ ENUMX ENUMDOC IQ2000 Relocations. +ENUM + BFD_RELOC_XTENSA_RTLD +ENUMDOC + Special Xtensa relocation used only by PLT entries in ELF shared + objects to indicate that the runtime linker should set the value + to one of its own internal functions or data structures. +ENUM + BFD_RELOC_XTENSA_GLOB_DAT +ENUMX + BFD_RELOC_XTENSA_JMP_SLOT +ENUMX + BFD_RELOC_XTENSA_RELATIVE +ENUMDOC + Xtensa relocations for ELF shared objects. +ENUM + BFD_RELOC_XTENSA_PLT +ENUMDOC + Xtensa relocation used in ELF object files for symbols that may require + PLT entries. Otherwise, this is just a generic 32-bit relocation. +ENUM + BFD_RELOC_XTENSA_OP0 +ENUMX + BFD_RELOC_XTENSA_OP1 +ENUMX + BFD_RELOC_XTENSA_OP2 +ENUMDOC + Generic Xtensa relocations. Only the operand number is encoded + in the relocation. The details are determined by extracting the + instruction opcode. +ENUM + BFD_RELOC_XTENSA_ASM_EXPAND +ENUMDOC + Xtensa relocation to mark that the assembler expanded the + instructions from an original target. The expansion size is + encoded in the reloc size. +ENUM + BFD_RELOC_XTENSA_ASM_SIMPLIFY +ENUMDOC + Xtensa relocation to mark that the linker should simplify + assembler-expanded instructions. This is commonly used + internally by the linker after analysis of a + BFD_RELOC_XTENSA_ASM_EXPAND. + ENDSENUM BFD_RELOC_UNUSED CODE_FRAGMENT diff --git a/bfd/simple.c b/bfd/simple.c index 88f1337..a247f11 100644 --- a/bfd/simple.c +++ b/bfd/simple.c @@ -1,5 +1,5 @@ /* simple.c -- BFD simple client routines - Copyright 2002 + Copyright 2002, 2003 Free Software Foundation, Inc. Contributed by MontaVista Software, Inc. @@ -42,8 +42,14 @@ static bfd_boolean simple_dummy_reloc_dangerous static bfd_boolean simple_dummy_unattached_reloc PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma)); +static void simple_save_output_info + PARAMS ((bfd *, asection *, PTR)); + +static void simple_restore_output_info + PARAMS ((bfd *, asection *, PTR)); + bfd_byte * bfd_simple_get_relocated_section_contents - PARAMS ((bfd *, asection *, bfd_byte *)); + PARAMS ((bfd *, asection *, bfd_byte *, asymbol **)); static bfd_boolean simple_dummy_warning (link_info, warning, symbol, abfd, section, address) @@ -105,17 +111,48 @@ simple_dummy_unattached_reloc (link_info, name, abfd, section, address) return TRUE; } +struct saved_output_info +{ + bfd_vma offset; + asection *section; +}; + +static void +simple_save_output_info (abfd, section, ptr) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section; + PTR ptr; +{ + struct saved_output_info *output_info = (struct saved_output_info *) ptr; + output_info[section->index].offset = section->output_offset; + output_info[section->index].section = section->output_section; + section->output_offset = 0; + section->output_section = section; +} + +static void +simple_restore_output_info (abfd, section, ptr) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section; + PTR ptr; +{ + struct saved_output_info *output_info = (struct saved_output_info *) ptr; + section->output_offset = output_info[section->index].offset; + section->output_section = output_info[section->index].section; +} + /* FUNCTION bfd_simple_relocate_secton SYNOPSIS - bfd_byte *bfd_simple_get_relocated_section_contents (bfd *abfd, asection *sec, bfd_byte *outbuf); + bfd_byte *bfd_simple_get_relocated_section_contents (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table); DESCRIPTION - Returns the relocated contents of section @var{sec}. Only symbols - from @var{abfd} and the output offsets assigned to sections in - @var{abfd} are used. The result will be stored at @var{outbuf} + Returns the relocated contents of section @var{sec}. The symbols in + @var{symbol_table} will be used, or the symbols from @var{abfd} if + @var{symbol_table} is NULL. The output offsets for all sections will + be temporarily reset to 0. The result will be stored at @var{outbuf} or allocated with @code{bfd_malloc} if @var{outbuf} is @code{NULL}. Generally all sections in @var{abfd} should have their @@ -126,17 +163,18 @@ DESCRIPTION */ bfd_byte * -bfd_simple_get_relocated_section_contents (abfd, sec, outbuf) +bfd_simple_get_relocated_section_contents (abfd, sec, outbuf, symbol_table) bfd *abfd; asection *sec; bfd_byte *outbuf; + asymbol **symbol_table; { struct bfd_link_info link_info; struct bfd_link_order link_order; struct bfd_link_callbacks callbacks; bfd_byte *contents, *data; - int storage_needed, number_of_symbols; - asymbol **symbol_table; + int storage_needed; + PTR saved_offsets; if (! (sec->flags & SEC_RELOC)) { @@ -183,11 +221,36 @@ bfd_simple_get_relocated_section_contents (abfd, sec, outbuf) return NULL; outbuf = data; } - bfd_link_add_symbols (abfd, &link_info); - storage_needed = bfd_get_symtab_upper_bound (abfd); - symbol_table = (asymbol **) bfd_malloc (storage_needed); - number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table); + /* 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 + 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 + section->output_offset to equal section->vma, which we do by setting + section->output_section to point back to section. Save the original + output offset and output section to restore later. */ + saved_offsets = malloc (sizeof (struct saved_output_info) + * abfd->section_count); + if (saved_offsets == NULL) + { + if (data) + free (data); + return NULL; + } + bfd_map_over_sections (abfd, simple_save_output_info, saved_offsets); + + if (symbol_table == NULL) + { + bfd_link_add_symbols (abfd, &link_info); + + storage_needed = bfd_get_symtab_upper_bound (abfd); + symbol_table = (asymbol **) bfd_malloc (storage_needed); + bfd_canonicalize_symtab (abfd, symbol_table); + } + else + storage_needed = 0; contents = bfd_get_relocated_section_contents (abfd, &link_info, @@ -198,6 +261,23 @@ bfd_simple_get_relocated_section_contents (abfd, sec, outbuf) if (contents == NULL && data != NULL) free (data); +#if 0 + /* NOTE: cagney/2003-04-05: This free, which was introduced on + 2003-03-31 to stop a memory leak, caused a memory corruption + between GDB and BFD. The problem, which is stabs specific, can + be identified by a bunch of failures in relocate.exp vis: + + gdb.base/relocate.exp: get address of static_bar + + Details of the problem can be found on the binutils@ mailing + list, see the discussion thread: "gdb.mi/mi-cli.exp failures". */ + if (storage_needed != 0) + free (symbol_table); +#endif + + bfd_map_over_sections (abfd, simple_restore_output_info, saved_offsets); + free (saved_offsets); + /* Foul hack to prevent bfd_section_size aborts. This flag only controls that macro (and the related size macros), selecting between _raw_size and _cooked_size. Debug sections won't change size while we're only @@ -1,6 +1,6 @@ /* bfd back-end for HP PA-RISC SOM objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by the Center for Software Science at the @@ -38,7 +38,7 @@ #include <machine/reg.h> #include <sys/file.h> -/* Magic not defined in standard HP-UX header files until 8.0 */ +/* Magic not defined in standard HP-UX header files until 8.0. */ #ifndef CPU_PA_RISC1_0 #define CPU_PA_RISC1_0 0x20B @@ -148,7 +148,7 @@ struct som_misc_symbol_info { unsigned int secondary_def; }; -/* Forward declarations */ +/* Forward declarations. */ static bfd_boolean som_mkobject PARAMS ((bfd *)); @@ -220,7 +220,6 @@ static int som_reloc_queue_find PARAMS ((unsigned char *, unsigned int, struct reloc_queue *)); static unsigned char * try_prev_fixup PARAMS ((bfd *, int *, unsigned char *, unsigned int, struct reloc_queue *)); - static unsigned char * som_reloc_skip PARAMS ((bfd *, unsigned int, unsigned char *, unsigned int *, struct reloc_queue *)); @@ -267,9 +266,8 @@ static int som_decode_symclass PARAMS ((asymbol *)); static bfd_boolean som_bfd_count_ar_symbols PARAMS ((bfd *, struct lst_header *, symindex *)); - static bfd_boolean som_bfd_fill_in_ar_symbols - PARAMS ((bfd *, struct lst_header *, carsym **syms)); + PARAMS ((bfd *, struct lst_header *, carsym **)); static bfd_boolean som_slurp_armap PARAMS ((bfd *)); static bfd_boolean som_write_armap @@ -659,7 +657,7 @@ static const struct fixup_format som_fixup_formats[256] = { /* R_TRANSLATED */ { 0, "" }, /* 0xce */ /* R_AUX_UNWIND */ - { 0,"Sd=Vf=Ef=" }, /* 0xcf */ + { 0,"Sd=Ve=Ee=" }, /* 0xcf */ /* R_COMP1 */ { 0, "Ob=" }, /* 0xd0 */ /* R_COMP2 */ @@ -684,7 +682,7 @@ static const struct fixup_format som_fixup_formats[256] = { /* R_LTP_OVERRIDE */ { 0, "" }, /* 0xdc */ /* R_COMMENT */ - { 0, "Ob=Ve=" }, /* 0xdd */ + { 0, "Ob=Vf=" }, /* 0xdd */ /* R_RESERVED */ { 0, "" }, /* 0xde */ { 0, "" }, /* 0xdf */ @@ -2328,7 +2326,6 @@ som_prep_headers (abfd) if (abfd->flags & (EXEC_P | DYNAMIC)) { - /* Make and attach an exec header to the BFD. */ amt = sizeof (struct som_exec_auxhdr); obj_som_exec_hdr (abfd) = @@ -5353,7 +5350,7 @@ som_get_section_contents (abfd, section, location, offset, count) if ((bfd_size_type) (offset+count) > section->_raw_size || bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0 || bfd_bread (location, count, abfd) != count) - return FALSE; /* on error */ + return FALSE; /* On error. */ return TRUE; } @@ -6369,7 +6366,7 @@ const bfd_target som_vec = { | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ /* leading_symbol_char: is the first char of a user symbol - predictable, and if so what is it */ + predictable, and if so what is it. */ 0, '/', /* ar_pad_char */ 14, /* ar_max_namelen */ diff --git a/bfd/sparclinux.c b/bfd/sparclinux.c index 4352727..40e49c8 100644 --- a/bfd/sparclinux.c +++ b/bfd/sparclinux.c @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored sparc a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -24,7 +24,6 @@ USA. */ #define SEGMENT_SIZE TARGET_PAGE_SIZE #define TEXT_START_ADDR 0x0 #define N_SHARED_LIB(x) 0 -#define BYTES_IN_WORD 4 #define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_UNKNOWN) diff --git a/bfd/sparclynx.c b/bfd/sparclynx.c index 84d9d4a..6be9a44 100644 --- a/bfd/sparclynx.c +++ b/bfd/sparclynx.c @@ -1,6 +1,6 @@ /* BFD support for Sparc binaries under LynxOS. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, - 2001, 2002 Free Software Foundation, Inc. + 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -19,7 +19,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if 0 -#define BYTES_IN_WORD 4 #define N_SHARED_LIB(x) 0 #define TEXT_START_ADDR 0 diff --git a/bfd/sparcnetbsd.c b/bfd/sparcnetbsd.c index 64d0eb1..be8e536 100644 --- a/bfd/sparcnetbsd.c +++ b/bfd/sparcnetbsd.c @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/sparc a.out-ish binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001 + Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,7 +18,6 @@ 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. */ -#define BYTES_IN_WORD 4 #define TARGET_IS_BIG_ENDIAN_P /* SPARC chips use either 4K or 8K pages, but object files always diff --git a/bfd/targets.c b/bfd/targets.c index 2211e12..5ccae2a 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -579,6 +579,8 @@ extern const bfd_target bfd_elf32_us_cris_vec; extern const bfd_target bfd_elf32_v850_vec; extern const bfd_target bfd_elf32_vax_vec; extern const bfd_target bfd_elf32_xstormy16_vec; +extern const bfd_target bfd_elf32_xtensa_be_vec; +extern const bfd_target bfd_elf32_xtensa_le_vec; extern const bfd_target bfd_elf64_alpha_freebsd_vec; extern const bfd_target bfd_elf64_alpha_vec; extern const bfd_target bfd_elf64_big_generic_vec; @@ -871,6 +873,8 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_v850_vec, &bfd_elf32_vax_vec, &bfd_elf32_xstormy16_vec, + &bfd_elf32_xtensa_be_vec, + &bfd_elf32_xtensa_le_vec, #ifdef BFD64 &bfd_elf64_alpha_freebsd_vec, &bfd_elf64_alpha_vec, diff --git a/bfd/vaxbsd.c b/bfd/vaxbsd.c index 5faedbe..a97408f 100644 --- a/bfd/vaxbsd.c +++ b/bfd/vaxbsd.c @@ -1,5 +1,5 @@ /* BFD back-end for BSD and Ultrix/VAX (1K page size) a.out-ish binaries. - Copyright 2002 Free Software Foundation, Inc. + Copyright 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,7 +18,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define N_HEADER_IN_TEXT(x) 0 -#define BYTES_IN_WORD 4 #define ENTRY_CAN_BE_ZERO #define N_SHARED_LIB(x) 0 /* Avoids warning */ #define TEXT_START_ADDR 0 @@ -26,7 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SEGMENT_SIZE TARGET_PAGE_SIZE #define DEFAULT_ARCH bfd_arch_vax -/* Do not "beautify" the CONCAT* macro args. Traditional C will not remove whitespace added here, and thus will fail to concatenate the tokens. */ +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate the + tokens. */ #define MY(OP) CONCAT2 (vaxbsd_,OP) #define TARGETNAME "a.out-vax-bsd" diff --git a/bfd/version.h b/bfd/version.h index d251770..4c25ee8 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20030305 +#define BFD_VERSION_DATE 20030416 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ @@ -1,5 +1,5 @@ /* xSYM symbol-file support for BFD. - Copyright 1999, 2000, 2001, 2002 + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1131,7 +1131,7 @@ bfd_sym_fetch_type_information_table_entry (abfd, entry, offset) BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - if (index == 0) + if (offset == 0) return -1; if (bfd_seek (abfd, offset, SEEK_SET) < 0) |