diff -Nur binutils-2.12/bfd/ChangeLog binutils-2.12.1/bfd/ChangeLog --- binutils-2.12/bfd/ChangeLog Fri Mar 8 01:14:41 2002 +++ binutils-2.12.1/bfd/ChangeLog Tue May 14 19:35:22 2002 @@ -1,3 +1,620 @@ +2002-05-14 Daniel Jacobowitz + + * configure.in: Set is_release=y for 2.12.1 release. + * configure: Likewise. + +2002-05-13 David Edelsohn + + * configure.in: Auto-configure HAVE_ST_C_IMPL. + * configure: Regenerate. + * config.in: Regenerate. + * rs6000-core.c (CNEW_IMPL): Guard use of c_impl with HAVE_ST_C_IMPL + or AIX_5_CORE. + +2002-05-11 Daniel Jacobowitz + + Merge from mainline (to elf32-mips.c): + 2002-05-03 H.J. Lu (hjl@gnu.org) + + * elfxx-mips.c (mips_elf_link_hash_entry): Add forced_local. + (mips_elf_link_hash_newfunc): Initialize forced_local to false. + (mips_elf_record_global_got_symbol): Call _bfd_mips_elf_hide_symbol + to hide a global symbol. + (_bfd_mips_elf_hide_symbol): Return if forced_local is true. Set + forced_local to true. + +2002-05-11 Ralf Corsepius + Daniel Jacobowitz + + * coff-sh.c (sh_reloc_map): Map to R_SH_IMM32 for non-PE. Don't + map BFD_RELOC_RVA. + +2002-05-09 Alan Modra + + * elf64-ppc.c (RA_REGISTER_MASK, RA_REGISTER_SHIFT): Delete. + + Merge from mainline + 2002-05-08 Alan Modra + * elf32-ppc.c (ppc_elf_create_got): New function. + (ppc_elf_create_dynamic_sections): Call ppc_elf_create_got before + _bfd_elf_create_dynamic_sections. Correct .plt flags. + (ppc_elf_check_relocs): Use ppc_elf_create_got in place of + _bfd_elf_create_got_section. + + 2002-05-07 Alan Modra + * elf-bfd.h (struct elf_backend_data): Add rela_normal. + * elfxx-target.h (elf_backend_rela_normal): Define. + (elfNN_bed): Init rela_normal. + * elflink.h (elf_link_input_bfd ): Handle adjustment + for section symbols here if rela_normal. Simplify abs section test. + * elf-m10200.c (mn10200_elf_relocate_section): If relocatable, + return immediately. Remove code handling relocatable linking. + * elf-m10300.c (mn10300_elf_relocate_section): Likewise. + * elf32-fr30.c (fr30_elf_relocate_section): Likewise. + * elf32-i370.c (i370_elf_relocate_section): Likewise. + * elf32-i860.c (elf32_i860_relocate_section): Likewise. + * elf32-m68k.c (elf_m68k_relocate_section): Likewise. + * elf32-mcore.c (mcore_elf_relocate_section): Likewise. + * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise. + * elf32-ppc.c (ppc_elf_relocate_section): Likewise. + * elf32-s390.c (elf_s390_relocate_section): Likewise. + * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise. + * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. + * elf64-s390.c (elf_s390_relocate_section): Likewise. + * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. + * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. + * elf32-arm.h (elf32_arm_relocate_section): Likewise #ifndef USE_REL. + * elf32-m32r.c (m32r_elf_relocate_section): Likewise. + * elf-m10200.c (elf_backend_rela_normal): Define. + * elf-m10300.c (elf_backend_rela_normal): Define. + * elf32-fr30.c (elf_backend_rela_normal): Define. + * elf32-i370.c (elf_backend_rela_normal): Define. + * elf32-i860.c (elf_backend_rela_normal): Define. + * elf32-m68k.c (elf_backend_rela_normal): Define. + * elf32-mcore.c (elf_backend_rela_normal): Define. + * elf32-openrisc.c (elf_backend_rela_normal): Define. + * elf32-ppc.c (elf_backend_rela_normal): Define. + * elf32-s390.c (elf_backend_rela_normal): Define. + * elf32-xstormy16.c (elf_backend_rela_normal): Define. + * elf64-ppc.c (elf_backend_rela_normal): Define. + * elf64-s390.c (elf_backend_rela_normal): Define. + * elf64-x86-64.c (elf_backend_rela_normal): Define. + * elfxx-ia64.c (elf_backend_rela_normal): Define. + * elf32-arm.h (elf_backend_rela_normal): Define #ifndef USE_REL. + * elf32-m32r.c (elf_backend_rela_normal): Likewise. + + 2002-05-06 Alan Modra + * elflink.h (elf_link_input_bfd ): Adjust r_offset + when not relocatable. Fix reloc_emitter call for K&R. + + 2002-05-04 Alan Modra + * dwarf2.c (struct line_head): Make prologue_length a bfd_vma. + (read_abbrevs): Change "offset" param to bfd_vma. + (parse_comp_unit): Change "version" and addr_size to unsigned ints. + Change "abbrev_offset" to bfd_vma. + (read_indirect_string): Use correct conversion chars in error + message format string, cast bfd_vma's to unsigned long. + (read_abbrevs): Likewise. + (read_attribute_value): Likewise. + (decode_line_info): Likewise. + (scan_unit_for_functions): Likewise. + (parse_comp_unit): Likewise. + + 2002-05-04 Bob Byrnes + * opncls.c (_bfd_new_bfd_contained_in): Check return value of + _bfd_new_bfd. + + 2002-05-02 Alan Modra + * elf64-ppc.c (ppc64_elf_howto_raw ): Change to a + 16 bit reloc. + : Likewise. + (ppc64_elf_reloc_type_lookup): Map from BFD_RELOC_16_BASEREL to + SECTOFF reloc. + * elf32-ppc.c (ppc_elf_howto_raw ): Correct. + (ppc_elf_reloc_type_lookup): Map from BFD_RELOC_16_BASEREL to + SECTOFF reloc. + * elf64-ppc.c (ppc64_elf_addr16_ha_reloc): Delete. + (ppc64_elf_ha_reloc): New function. + (ppc64_elf_brtaken_reloc): New function. + (ppc64_elf_sectoff_reloc): New function. + (ppc64_elf_sectoff_ha_reloc): New function. + (ppc64_elf_toc_reloc): New function. + (ppc64_elf_toc_ha_reloc): New function. + (ppc64_elf_toc64_reloc): New function. + (ppc64_elf_unhandled_reloc): New function. + (ppc64_elf_howto_raw): Use the above. + : Mark pc_relative, pcrel_offset. + : Not pc_relative or pcrel_offset. Fix dst_mask. + : Likewise. + (IS_ABSOLUTE_RELOC): Update. + (struct ppc_link_hash_table): Add have_undefweak. + (ppc64_elf_link_hash_table_create): Init. + (func_desc_adjust): Set have_undefweak. + (ppc64_elf_func_desc_adjust): Call func_desc_adjust earlier. Only + add the .sfpr blr when have_undefweak. + (ppc64_elf_set_toc): Rename to ppc64_elf_toc, remove info param + and relocatable test. Return TOCstart and don't set elf_gp. + (ppc64_elf_relocate_section): Correct BRTAKEN/BRNTAKEN branch + offset calculation. Add assert on weak sym branch tweaks. + * elf64-ppc.h (ppc64_elf_set_toc): Delete. + (ppc64_elf_toc): Declare. + + 2002-05-01 Alan Modra + * syms.c (_bfd_stab_section_find_nearest_line): Don't bomb on NULL + file_name. + + 2002-05-01 Alan Modra + * elf64-ppc.c (CROR_151515, CROR_313131): Define. + (ppc64_elf_relocate_section): Use them. Don't look for plt calls + on R_PPC64_ADDR24 relocs. Require a nop or no link reg on plt + call branches. Correct undefined weak destination. + (ppc64_elf_func_desc_adjust): Always create at least one blr in + .sfpr, and correct case where either only savef* or restf* is + needed. + + 2002-04-09 DJ Delorie + * elfarm-nabi.c (elf32_arm_howto_table): Fix ABS16 masks. + +2002-05-06 Nick Clifton + + * elf32-arm.h (elf32_arm_final_link_relocate): Convert + 'reloc_signed_max' and 'reloc_signed_min' into half-word offsets. + +2002-05-02 Richard Henderson + + * elf64-alpha.c (elf64_alpha_relocate_section): Force relative relocs + vs SHN_UNDEF to zero. + +2002-04-27 Alan Modra + + Merge from mainline + 2002-04-12 Alan Modra + * elf.c (prep_headers): Don't zero EI_OSABI, EI_ABIVERSION or + header pad. + + 2002-02-21 Andreas Jaeger + * elf64-x86-64.c: Major rework that introduces all recent changes + to the x86-64 backend. Get a closer match to elf32-i386. + (struct elf64_x86_64_dyn_relocs): Rename from + elf64_x86_64_pcrel_relocs_copied, add additional fields. Change + all users. + (struct elf64_x86_64_link_hash_table): Add short cuts to some + sections. + (link_hash_newfunc): Rename from elf64_x86_64_link_hash_newfunc, + remove casts, initialize new hash members. + (create_got_section): New. + (elf64_x86_64_create_dynamic_sections): New. + (elf64_x86_64_copy_indirect_symbol): New. + (elf64_x86_64_check_relocs): Don't allocate space for dynamic + relocs, .got or .relgot here but do it in allocate_dynrelocs. + Reference count possible .plt and .got entries. Don't test input + section SEC_READONLY here to try to avoid copy relocs, and keep + dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set + DF_TEXTREL here. Delay setting of variables until needed. Cache + pointer to "sreloc" section in elf_section_data. Tweak condition + under which .got created. Report files with bad relocation + section names. + (elf64_x86_64_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. + Reference count possible .plt entries. Don't deallocate .got and + .relgot space here. + (elf64_x86_64_adjust_dynamic_symbol): Handle nocopyreloc. Don't + do copy reloc processing for weakdefs. Remove redundant casts and + aborts. Delay setting of vars until needed. Move creation of + dynamic symbols and allocation of .plt and .rela.plt to + allocate_dynrelocs. Replace BFD_ASSERT with abort. + (WILL_CALL_FINISH_DYNAMIC_SYMBOL): New. + (allocate_dynrelocs): New. + (readonly_dynrelocs): New. + (elf64_x86_64_size_dynamic_sections): Call readonly_dynrelocs. + Allocate space for dyn relocs. Replace BFD_ASSERT with abort. + Zero out the dynamic allocated content space. + (elf64_x86_64_discard_copies): Removed. + (elf64_x86_64_relocate_section): Make use of dynamic section + short-cuts. Localise vars, and delay setting. Better error + reporting, replace BFD_ASSERT with abort. Check + ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the + regular object file and tread the weak definition as the normal + one. Don't discard relocs for undefweak or undefined symbols and + check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy + relocs. + (elf64_x86_64_finish_dynamic_symbol): Don't copy relocs for + symbols that have been forced local. Use same test to decide if + we can use a relative reloc for got as relocate_section. Expand + SHN_UNDEF comment. Move expressions out of function calls. + Replace BFD_ASSERT with abort. + (bfd_elf64_bfd_final_link): Removed. + (elf_backend_copy_indirect_symbol): Define. + + * reloc.c: Move sh relocs to where they belong. + * libbfd.h, bfd-in2.h: Regenerate. + + Merge from mainline + 2002-04-26 Alan Modra + * opncls.c (bfd_make_readable): Call bfd_section_list_clear. + * xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise. + * elflink.h (elf_bfd_final_link): Ensure input bfd class is the + same as the output before calling elf_link_input_bfd. + * coffcode.h (coff_compute_section_file_positions): Set + section_tail after shuffling section list. + + 2002-04-23 Alan Modra + * elf32-hppa.c (hppa_type_of_stub): Correct and simplify condition + under which a plt call stub is used. + (final_link_relocate): Similarly. + (allocate_plt_static): Clear h-plabel except when plt entry is + exclusively used for a plabel. + (allocate_dynrelocs): Use the above to simplify plt sizing. + (struct elf32_hppa_link_hash_table): Add has_22bit_branch. + (elf32_hppa_link_hash_table_create): Init. + (BL22_RP): Define. + (hppa_build_one_stub): Use BL22_RP if has_22bit_branch. + (elf32_hppa_check_relocs): Set has_22bit_branch. + * elf32-hppa.c (elf32_hppa_check_relocs): Remove debug message. + (final_link_relocate): Likewise. + + 2002-04-20 Alan Modra + * archures.c (bfd_arch_info): Add comment on list order. + (bfd_default_set_arch_mach): Use bfd_lookup_arch. + * cpu-powerpc.c (bfd_powerpc_archs): Re-order so that the default + is always at head of list. + * bfd-in2.h: Regenerate. + + 2002-04-16 Alan Modra + * elf32-m32r.c (m32r_elf_add_symbol_hook): Check the hash table + type rather than just assuming entries are ELF. + * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise. + * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise. + * elf64-sparc.c (sparc64_elf_add_symbol_hook): Likewise. + * elf64-mmix.c (mmix_elf_add_symbol_hook): Use bfd_link_hash_entry + rather than elf_link_hash_entry. + + 2002-04-15 Alan Modra + * elf32-ppc.c (ppc_elf_add_symbol_hook): Check the hash table type. + + 2002-04-08 Randolph Chung + * elf32-hppa.c (hppa_unwind_entry_compare): Move to elf-hppa.h. + (elf32_hppa_final_link): Split out sorting logic to.. + * elf-hppa.h (elf_hppa_sort_unwind): ..here. + (elf_hppa_final_link): Call elf_hppa_sort_unwind. + +2002-04-26 Richard Smith + Jakub Jelinek + + * elf-eh-frame.c (struct eh_cie_fde): Add per_encoding_relative. + (_bfd_elf_discard_section_eh_frame): Set it for CIEs with pcrel + encoded personality. + (_bfd_elf_write_section_eh_frame): Adjust pcrel encoded personality + for CIE/FDE removal. + +2002-04-26 Jakub Jelinek + + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't build + search table if some FDE is DW_EH_PE_aligned encoded either. + (_bfd_elf_write_section_eh_frame): Handle terminating FDE specially. + +2002-04-18 Nick Clifton + + * coff-arm.c (coff_thumb_pcrel_12, coff_thumb_pcrel_9, + insert_thumb_branch, record_thumb_to_arm_glue): Suppress + definition of these functions for ARM_WINCE builds as they are + not used. + (SWAP_IN_RELOC_OFFSET, SWAP_OUT_RELOC_OFFSET): Do not define + for ARM_WINCE builds. + +2002-04-16 Nick Clifton + + * ihex.c (ihex_write_object_contents): Fix check for records + crossing 64K boundaries. + +2002-04-06 Hans-Peter Nilsson + + * elf32-cris.c (cris_elf_howto_table) : Fix typo in name. + (cris_elf_check_relocs): Always create .rela.got here when + R_CRIS_16_GOTPLT or R_CRIS_32_GOTPLT is seen. + (elf_cris_adjust_gotplt_to_got): Don't create .rela.got here; + assume it's created. + +2002-04-04 Alan Modra + + * configure.in: Bump version to 2.12.1 and comment out is_release. + * configure: Regenerate. + * dep-in.sed: Cope with absolute paths. + * Makefile.am (dep.sed): Subst TOPDIR, and not INCDIR. + Run "make dep-am". + * Makefile.in: Regenerate. + + Merge from mainline + 2002-04-04 Alan Modra + * srec.c (MAXCHUNK, Chunk): Revise comments. + (srec_write_record): Correct buffer size. + (srec_write_header): Do without intermediate buffer. + (srec_write_section): Validate Chunk. + (srec_write_terminator): Pass NULL instead of dummy buffer. + (srec_write_symbols): Pass file and symbol names directly to + bfd_bwrite so sprintf won't overflow buffer. + + 2002-04-03 Jakub Jelinek + * elf32-sparc.c (elf32_sparc_relocate_section): Don't emit dynamic + PC relative relocs against hidden symbols. + * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. + + 2002-04-03 Alan Modra + * elf.c (_bfd_elf_make_section_from_shdr): When setting section + LMAs, loop over segments until p_vaddr and p_memsz specify an + extent enclosing the section. + + 2002-04-02 Nick Clifton + * ihex.c (ihex_write_object_contents): Do not allow records to + cross a 64K boundary - wrap if necessary. + + 2002-03-28 Alan Modra + * linker.c (link_action): Ignore duplicate warning syms. + (_bfd_generic_link_write_global_symbol): Follow warning symbol link. + * elflink.h (elf_adjust_dynstr_offsets): Likewise. + (elf_adjust_dynamic_symbol): Likewise. + (elf_export_symbol): Likewise. + (elf_link_find_version_dependencies): Likewise. + (elf_link_assign_sym_version): Likewise. + (elf_link_sec_merge_syms): Likewise. + (elf_link_output_extsym): Likewise. + (elf_gc_sweep_symbol): Likewise. + (elf_gc_propagate_vtable_entries_used): Likewise. + (elf_gc_smash_unused_vtentry_relocs): Likewise. + (elf_gc_allocate_got_offsets): Likewise. + (elf_collect_hash_codes): Likewise. + * elflink.c (elf_link_renumber_hash_table_dynsyms): Likewise. + * elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): Likewise. + (elf_hppa_remark_useless_dynamic_symbols): Likewise. + * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise. + * elf32-arm.h (elf32_arm_discard_copies): Likewise. + * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Likewise. + (elf_cris_discard_excess_dso_dynamics): Likewise. + * elf32-hppa.c (clobber_millicode_symbols): Likewise. + (mark_PIC_calls): Likewise. + (allocate_plt_static): Likewise. + (allocate_dynrelocs): Likewise. + (readonly_dynrelocs): Likewise. + * elf32-i386.c (allocate_dynrelocs): Likewise. + (readonly_dynrelocs): Likewise. + * elf32-i370.c (i370_elf_adjust_dynindx): Likewise. + * elf32-m68k.c (elf_m68k_discard_copies): Likewise. + * elf32-mips.c (mips_elf_output_extsym): Likewise. + (mips_elf_sort_hash_table_f): Likewise. + (mips_elf_check_mips16_stubs): Likewise. + * elf32-s390.c (allocate_dynrelocs): Likewise. + (readonly_dynrelocs): Likewise. + * elf32-sh.c (sh_elf_discard_copies): Likewise. + * elf32-xstormy16.c (xstormy16_relax_plt_check): Likewise. + (xstormy16_relax_plt_realloc): Likewise. + * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Likewise. + (elf64_alpha_output_extsym): Likewise. + * elf64-hppa.c (elf64_hppa_mark_exported_functions): Likewise. + * elf64-mips.c (mips_elf64_sort_hash_table_f): Likewise. + (mips_elf64_check_mips16_stubs): Likewise. + (mips_elf64_output_extsym): Likewise. + * elf64-ppc.c (func_desc_adjust): Likewise. + (allocate_dynrelocs): Likewise. + (readonly_dynrelocs): Likewise. + * elf64-s390.c (allocate_dynrelocs): Likewise. + (readonly_dynrelocs): Likewise. + * elf64-sh64.c (sh64_elf64_discard_copies): Likewise. + * elf64-x86-64.c (elf64_x86_64_discard_copies): Likewise. + * elfxx-ia64.c (elfNN_ia64_global_dyn_sym_thunk): Likewise. + * aoutx.h (aout_link_write_other_symbol): Likewise. + * cofflink.c (_bfd_coff_write_task_globals): Likewise. + (_bfd_coff_write_global_sym): Likewise. + * i386linux.c (linux_tally_symbols): Likewise. + * m68klinux.c (linux_tally_symbols): Likewise. + * sparclinux.c (linux_tally_symbols): Likewise. + * pdp11.c (aout_link_write_other_symbol): Likewise. + * sunos.c (sunos_scan_dynamic_symbol): Likewise. + * xcofflink.c (xcoff_build_ldsyms): Likewise. + (xcoff_write_global_symbol): Likewise. + * cofflink.c (_bfd_coff_final_link): Formatting. + * elf32-i386.c (elf_i386_check_relocs): Formatting. + * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise. + * elf64-alpha.c (elf64_alpha_output_extsym): Likewise. + * elf64-mips.c (mips_elf64_sort_hash_table): Likewise. + (mips_elf64_final_link): Likewise. + * elflink.h (elf_link_find_version_dependencies): Remove duplicate + prototype. + + 2002-03-21 Richard Earnshaw + * elf32-arm.h (elf32_arm_final_link_relocate , + ): Handle relocations to Thumb functions. + + 2002-03-19 Hans-Peter Nilsson + * elflink.h (NAME(bfd_elf,record_link_assignment)): Don't set + STT_NOTYPE symbols to STT_OBJECT. + + 2002-03-13 Alan Modra + * archures.c (bfd_default_compatible): Test bits_per_word. + * cpu-i386.c (i386_compatible): Remove. Replace occurrences with + bfd_default_compatible. + * cpu-i370.c (i370_compatible): Likewise. + * cpu-sparc.c (sparc_compatible): Likewise. + * cpu-h8300.c (compatible): Test in->arch == out->arch. + + 2002-02-19 Martin Schwidefsky + * archures.c (bfd_mach_s390_esa): Rename to bfd_mach_s390_31. + (bfd_mach_s390_esame): Rename to bfd_mach_s390_64. + * bfd-in2.h: Regenerate. + * cpu-s390.c (arch_info_struct): Use renamed architecture defines. + Replace architecture name "s390" with "s390:31-bit" and "s390:esame" + with "s390:64-bit". + * elf32-s390.c (elf_howto_table): Add 32 bit pc relative relocations. + (elf_s390_reloc_type_lookup): Likewise. + (elf_s390_check_relocs): Likewise. + (elf_s390_gc_sweep_hook): Likewise. + (elf_s390_relocate_section): Likewise. + (elf_s390_object_p): Use renamed architecture define. + * elf64-s390.c (elf_s390_object_p): Use renamed architecture define. + +2002-04-03 Alan Modra + + Merge from mainline. + 2002-03-28 Alan Modra + * cpu-mips.c (mips_compatible): Make static, prototype. + + 2002-03-14 Alan Modra + * cpu-mips.c (mips_compatible): New. Don't check bits_per_word. + (N): Use the above. + +2002-04-01 Nathan Williams + + * elf.c (elfcore_netbsd_get_lwpid): Fix off-by-one error + which caused the returned LWP ID to always be 0. + +2002-04-01 Richard Henderson + + * elf32-sparc.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): New. + (elf32_sparc_relocate_section): Use it to figure out when to + initialize .got entries. + * elf64-sparc.c: Similarly. + +2002-03-28 Alan Modra + + * aclocal.m4: Regenerate. + * config.in: Regenerate. + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + + Merge from mainline + 2002-03-27 Gregory Steuck + * elf.c (_bfd_elf_get_symtab_upper_bound): Leave space for + terminating NULL if empty symbol table. + (_bfd_elf_get_dynamic_symtab_upper_bound): Likewise. + + 2002-03-26 Alan Modra + * elflink.h (elf_gc_mark): Don't recurse into non-ELF sections. + + 2002-03-23 Alan Modra + * elf.c (_bfd_elf_make_section_from_shdr): Don't set lma based on + section file offset for !SEC_LOAD sections. + + 2002-03-20 Daniel Jacobowitz + * dwarf2.c (struct funcinfo): Move up. + (lookup_address_in_function_table): New argument function_ptr. + Set it. + (lookup_address_in_line_table): New argument function. If function + is non-NULL, use it to handle ``addr'' before the first line note of + the function. + (comp_unit_find_nearest_line): Update and swap calls to + lookup_address_in_function_table and lookup_address_in_line_table. + * syms.c (_bfd_stab_section_find_nearest_line): Use the first + N_SLINE encountered if we see an N_FUN before any N_SLINE. + + 2002-03-18 Alan Modra + * libbfd.c (bfd_write_bigendian_4byte_int): Return true iff success. + * libbfd.h: Regenerate. + * archive.c (coff_write_armap): Pass on failures from + bfd_write_bigendian_4byte_int. + + 2002-03-14 H.J. Lu + * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set the BFD + error to bfd_error_nonrepresentable_section for reinit_array + section in DSO. + + 2002-03-14 Nick Clifton + * coffcode.h (coff_slurp_symbol_table): When adding BSF_WEAK flag, + OR it in rather than replacing previously selected flags. + * elfxx-target.h (TARGET_BIG_SYM): Set ar_max_namelen to 15. + (TARGET_LITTLE_SYM): Set ar_max_namelen to 15. + + 2002-03-14 Alan Modra + * elflink.h (elf_bfd_final_link): Revert last change. Instead, + ensure reloc size matches before calling elf_link_input_bfd. + Add an assert to check reloc size when counting output relocs. + + 2002-03-14 Nick Clifton + * mmo.c (mmo_get_loc): Return NULL rather than false. + + 2002-03-13 Alan Modra + * elflink.h: Formatting fixes. + (elf_link_output_extsym): Merge undefined and undef weak cases. + * elflink.h (elf_bfd_final_link): Only call elf_link_input_bfd + when word size of input matches output word size. + + 2002-03-07 H.J. Lu (hjl@gnu.org) + * coff-sh.c (shcoff_reloc_map): Use bfd_reloc_code_real_type + as the type for bfd_reloc_val. + + 2002-03-05 John David Anglin + * elf-hppa.h (elf_hppa_is_dynamic_loader_symbol): New function. + (elf_hppa_relocate_section): Ignore undefined dynamic loader symbols. + (elf_hppa_final_link_relocate): Correct relocations for indirect + references to local data through the DLT. Fix .opd creation for + local symbols using R_PARISC_LTOFF_FPTR32 and R_PARISC_FPTR64 + relocations. Use e_lsel selector for R_PARISC_DLTIND21L, + R_PARISC_LTOFF_FPTR21L and R_PARISC_LTOFF_TP21L as per + "Processor-Specific ELF for PA_RISC, Version 1.43" document. + Similarly, use e_rsel for DLT and LTOFF 'R' relocations. + * elf32-hppa.c (final_link_relocate): Revise relocation selectors + as per "Processor-Specific ELF for PA_RISC, Version 1.43" document. + + 2002-03-05 Jakub Jelinek + * merge.c (_bfd_merge_sections): Don't segfault if there + is nothing to merge due to GC. + + 2002-03-05 Alan Modra + * elf32-hppa.c (clobber_millicode_symbols): Remove hack to keep + symbols that have been forced local. + * elflink.h (elf_bfd_final_link): Call elf_link_output_extsym + to output forced local syms for non-shared link. + (elf_link_output_extsym): Tweak condition for calling backend + adjust_dynamic_symbol so that previous behaviour is kept. + Whitespace changes throughout file. + + 2002-03-04 H.J. Lu + * elf.c (bfd_section_from_shdr): Handle special sections, + .init_array, .fini_array and .preinit_array. + (elf_fake_sections): Likewise. + * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Create the + DT entry only if the section is in output for .init_array, + .fini_array and .preinit_array. Complain about .preinit_array + section in DSO. + (elf_bfd_final_link): Warn zero size for .init_array, + .fini_array and .preinit_array sections. + * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Remove + SHT_INIT_ARRAY, SHT_FINI_ARRAY and SHT_PREINIT_ARRAY. + (elfNN_ia64_fake_sections): Remove .init_array, .fini_array and + .preinit_array. + + 2002-03-01 David Mosberger + * elflink.h (size_dynamic_sections): If section named + ".preinit_array" exists, create DT_PREINIT_ARRAY and + DT_PREINIT_ARRAYSZ entries in dynamic table. Analogously for + ".init_array" and ".fini_array". + (elf_bfd_final_link): Handle DT_PREINIT_ARRAYSZ, DT_INIT_ARRAYSZ, + DT_FINI_ARRAYSZ, DT_PREINIT_ARRAY, DT_INIT_ARRAY, and + DT_FINI_ARRAY. + + 2002-02-19 Frank Ch. Eigler + * syms.c (stt[]): Sorted. Added .init/.fini -> "t" mapping. + + 2002-02-13 Nick Clifton + * elf.c (_bfd_elf_make_section_from_shdr): Do not insist on + non-zero physical addresses when adjusting the LMAs of new + sections. + + 2002-02-11 Michael Snyder + * elf-bfd.h (elfcore_write_lwpstatus): Add prototype. + * elf.c (elfcore_grok_pstatus): Add prototype. + (elfcore_grok_lwpstatus): Add prototype. + (elfcore_write_lwpstatus): New function. + (elfcore_write_pstatus): Fix typo, eliminate unnecessary memcpy. + +2002-03-20 Tom Rix + + * coff-rs6000.c (_bfd_xcoff_stat_arch_elt): Renamed from + _bfd_xcoff_generic_stat_arch_elt. Fix format check. + * coff64-rs6000.c : Use _bfd_xcoff_stat_arch_elt. + +Mon Mar 18 18:06:54 CET 2002 Jan Hubicka + + * cpu-i386.c (bfd_x86_64_arch): Rename to "i386:x86-64" + 2002-03-07 Daniel Jacobowitz * configure.in: Set is_release=y for 2.12 release. diff -Nur binutils-2.12/bfd/ChangeLog-9495 binutils-2.12.1/bfd/ChangeLog-9495 --- binutils-2.12/bfd/ChangeLog-9495 Thu Mar 8 16:03:56 2001 +++ binutils-2.12.1/bfd/ChangeLog-9495 Thu May 9 10:48:40 2002 @@ -6887,7 +6887,7 @@ * libelf.h (struct elf_obj_tdata): Add new field bad_symtab. (elf_bad_symtab): Define new accessor macro. (_bfd_elf_link_hash_newfunc): Declare. - (_bew_elf_link_hash_table_init): Declare. + (_bfd_elf_link_hash_table_init): Declare. * elfcode.h (elf_object_p): Call backend object_p hook after swapping in all the section headers. (map_program_segments): Correct typo: Internal for External. diff -Nur binutils-2.12/bfd/Makefile.am binutils-2.12.1/bfd/Makefile.am --- binutils-2.12/bfd/Makefile.am Fri Feb 8 00:33:21 2002 +++ binutils-2.12.1/bfd/Makefile.am Thu Apr 4 11:20:20 2002 @@ -700,8 +700,8 @@ dep.sed: dep-in.sed config.status sed <$(srcdir)/dep-in.sed >dep.sed \ -e 's!@BFD_H@!$(BFD_H)!' \ - -e 's!@INCDIR@!$(INCDIR)!' \ - -e 's!@SRCDIR@!$(srcdir)!' + -e 's!@SRCDIR@!$(srcdir)!' \ + -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/bfd$$,,`'!' dep: DEP sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile @@ -1141,12 +1141,9 @@ elf32-target.h elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h $(srcdir)/../opcodes/sh64-opc.h -elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf64-target.h + $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ + elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ @@ -1425,6 +1422,10 @@ elf64-s390.lo: elf64-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ + elf64-target.h +elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ elf64-target.h elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ diff -Nur binutils-2.12/bfd/Makefile.in binutils-2.12.1/bfd/Makefile.in --- binutils-2.12/bfd/Makefile.in Fri Feb 8 00:33:21 2002 +++ binutils-2.12.1/bfd/Makefile.in Thu Apr 4 11:20:20 2002 @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -750,7 +750,7 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS) @@ -917,7 +917,7 @@ dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ - test "$$subdir" = "." && dot_seen=yes; \ + test "$$subdir" != "." || dot_seen=yes; \ done; \ test "$$dot_seen" = "no" && rev=". $$rev"; \ target=`echo $@ | sed s/-recursive//`; \ @@ -1258,8 +1258,8 @@ dep.sed: dep-in.sed config.status sed <$(srcdir)/dep-in.sed >dep.sed \ -e 's!@BFD_H@!$(BFD_H)!' \ - -e 's!@INCDIR@!$(INCDIR)!' \ - -e 's!@SRCDIR@!$(srcdir)!' + -e 's!@SRCDIR@!$(srcdir)!' \ + -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/bfd$$,,`'!' dep: DEP sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile @@ -1685,12 +1685,9 @@ elf32-target.h elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h $(srcdir)/../opcodes/sh64-opc.h -elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf64-target.h + $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ + elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ @@ -1969,6 +1966,10 @@ elf64-s390.lo: elf64-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ + elf64-target.h +elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ elf64-target.h elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ diff -Nur binutils-2.12/bfd/aclocal.m4 binutils-2.12.1/bfd/aclocal.m4 --- binutils-2.12/bfd/aclocal.m4 Fri Apr 27 17:25:04 2001 +++ binutils-2.12.1/bfd/aclocal.m4 Mon Apr 1 20:28:43 2002 @@ -1,6 +1,6 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4 +dnl aclocal.m4 generated automatically by aclocal 1.4-p5 -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -145,7 +145,7 @@ dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) -AC_DEFUN(AM_INIT_AUTOMAKE, +AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) @@ -173,7 +173,7 @@ # Check to make sure that the build environment is sane. # -AC_DEFUN(AM_SANITY_CHECK, +AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 @@ -214,7 +214,7 @@ dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. -AC_DEFUN(AM_MISSING_PROG, +AC_DEFUN([AM_MISSING_PROG], [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. @@ -230,7 +230,7 @@ # Like AC_CONFIG_HEADER, but automatically create stamp file. -AC_DEFUN(AM_CONFIG_HEADER, +AC_DEFUN([AM_CONFIG_HEADER], [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) dnl When config.status generates a header, we must update the stamp-h file. @@ -256,7 +256,7 @@ # serial 1 -AC_DEFUN(AM_MAINTAINER_MODE, +AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, @@ -273,7 +273,7 @@ # Define a conditional. -AC_DEFUN(AM_CONDITIONAL, +AC_DEFUN([AM_CONDITIONAL], [AC_SUBST($1_TRUE) AC_SUBST($1_FALSE) if $2; then diff -Nur binutils-2.12/bfd/aoutx.h binutils-2.12.1/bfd/aoutx.h --- binutils-2.12/bfd/aoutx.h Wed Oct 10 08:08:27 2001 +++ binutils-2.12.1/bfd/aoutx.h Thu Apr 4 11:20:22 2002 @@ -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 + 2001, 2002 Free Software Foundation, Inc. Written by Cygnus Support. @@ -4577,6 +4577,13 @@ bfd_size_type indx; bfd_size_type amt; + if (h->root.type == bfd_link_hash_warning) + { + h = (struct aout_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return true; + } + output_bfd = finfo->output_bfd; if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL) @@ -4605,6 +4612,7 @@ switch (h->root.type) { default: + case bfd_link_hash_warning: abort (); /* Avoid variable not initialized warnings. */ return true; @@ -4646,9 +4654,8 @@ type = N_WEAKU; val = 0; case bfd_link_hash_indirect: - case bfd_link_hash_warning: - /* FIXME: Ignore these for now. The circumstances under which - they should be written out are not clear to me. */ + /* We ignore these symbols, since the indirected symbol is + already in the hash table. */ return true; } diff -Nur binutils-2.12/bfd/archive.c binutils-2.12.1/bfd/archive.c --- binutils-2.12/bfd/archive.c Wed Dec 5 17:46:21 2001 +++ binutils-2.12.1/bfd/archive.c Mon Apr 1 20:28:44 2002 @@ -1,6 +1,6 @@ /* BFD back-end for archive files (libraries). Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 + 2000, 2001, 2002 Free Software Foundation, Inc. Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault. @@ -2190,7 +2190,8 @@ != sizeof (struct ar_hdr)) return false; - bfd_write_bigendian_4byte_int (arch, symbol_count); + if (!bfd_write_bigendian_4byte_int (arch, symbol_count)) + return false; /* Two passes, first write the file offsets for each symbol - remembering that each offset is on a two byte boundary. */ @@ -2207,7 +2208,8 @@ while (count < symbol_count && map[count].u.abfd == current) { - bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr); + if (!bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr)) + return false; count++; } /* Add size of this archive entry. */ diff -Nur binutils-2.12/bfd/archures.c binutils-2.12.1/bfd/archures.c --- binutils-2.12/bfd/archures.c Fri Feb 8 00:33:22 2002 +++ binutils-2.12.1/bfd/archures.c Thu May 9 10:48:42 2002 @@ -259,8 +259,8 @@ .#define bfd_mach_avr5 5 . bfd_arch_cris, {* Axis CRIS *} . bfd_arch_s390, {* IBM s390 *} -.#define bfd_mach_s390_esa 0 -.#define bfd_mach_s390_esame 1 +.#define bfd_mach_s390_31 0 +.#define bfd_mach_s390_64 1 . bfd_arch_openrisc, {* OpenRISC *} . bfd_arch_mmix, {* Donald Knuth's educational processor. *} . bfd_arch_xstormy16, @@ -288,7 +288,9 @@ . const char *arch_name; . const char *printable_name; . unsigned int section_align_power; -. {* True if this is the default machine for the architecture. *} +. {* True if this is the default machine for the architecture. +. The default arch should be the first entry for an arch so that +. all the entries for that arch can be accessed via <>. *} . boolean the_default; . const struct bfd_arch_info * (*compatible) . PARAMS ((const struct bfd_arch_info *a, @@ -604,21 +606,9 @@ enum bfd_architecture arch; unsigned long mach; { - const bfd_arch_info_type * const *app, *ap; - - for (app = bfd_archures_list; *app != NULL; app++) - { - for (ap = *app; ap != NULL; ap = ap->next) - { - if (ap->arch == arch - && (ap->mach == mach - || (mach == 0 && ap->the_default))) - { - abfd->arch_info = ap; - return true; - } - } - } + abfd->arch_info = bfd_lookup_arch (arch, mach); + if (abfd->arch_info != NULL) + return true; abfd->arch_info = &bfd_default_arch_struct; bfd_set_error (bfd_error_bad_value); @@ -720,6 +710,9 @@ const bfd_arch_info_type *b; { if (a->arch != b->arch) + return NULL; + + if (a->bits_per_word != b->bits_per_word) return NULL; if (a->mach > b->mach) diff -Nur binutils-2.12/bfd/bfd-in2.h binutils-2.12.1/bfd/bfd-in2.h --- binutils-2.12/bfd/bfd-in2.h Sat Feb 9 17:53:53 2002 +++ binutils-2.12.1/bfd/bfd-in2.h Thu May 9 10:48:44 2002 @@ -1638,8 +1638,8 @@ #define bfd_mach_avr5 5 bfd_arch_cris, /* Axis CRIS */ bfd_arch_s390, /* IBM s390 */ -#define bfd_mach_s390_esa 0 -#define bfd_mach_s390_esame 1 +#define bfd_mach_s390_31 0 +#define bfd_mach_s390_64 1 bfd_arch_openrisc, /* OpenRISC */ bfd_arch_mmix, /* Donald Knuth's educational processor. */ bfd_arch_xstormy16, @@ -1657,7 +1657,9 @@ const char *arch_name; const char *printable_name; unsigned int section_align_power; - /* True if this is the default machine for the architecture. */ + /* True if this is the default machine for the architecture. + The default arch should be the first entry for an arch so that + all the entries for that arch can be accessed via <>. */ boolean the_default; const struct bfd_arch_info * (*compatible) PARAMS ((const struct bfd_arch_info *a, @@ -2194,55 +2196,6 @@ BFD_RELOC_MIPS_REL16, BFD_RELOC_MIPS_RELGOT, BFD_RELOC_MIPS_JALR, - BFD_RELOC_SH_GOT_LOW16, - BFD_RELOC_SH_GOT_MEDLOW16, - BFD_RELOC_SH_GOT_MEDHI16, - BFD_RELOC_SH_GOT_HI16, - BFD_RELOC_SH_GOTPLT_LOW16, - BFD_RELOC_SH_GOTPLT_MEDLOW16, - BFD_RELOC_SH_GOTPLT_MEDHI16, - BFD_RELOC_SH_GOTPLT_HI16, - BFD_RELOC_SH_PLT_LOW16, - BFD_RELOC_SH_PLT_MEDLOW16, - BFD_RELOC_SH_PLT_MEDHI16, - BFD_RELOC_SH_PLT_HI16, - BFD_RELOC_SH_GOTOFF_LOW16, - BFD_RELOC_SH_GOTOFF_MEDLOW16, - BFD_RELOC_SH_GOTOFF_MEDHI16, - BFD_RELOC_SH_GOTOFF_HI16, - BFD_RELOC_SH_GOTPC_LOW16, - BFD_RELOC_SH_GOTPC_MEDLOW16, - BFD_RELOC_SH_GOTPC_MEDHI16, - BFD_RELOC_SH_GOTPC_HI16, - BFD_RELOC_SH_COPY64, - BFD_RELOC_SH_GLOB_DAT64, - BFD_RELOC_SH_JMP_SLOT64, - BFD_RELOC_SH_RELATIVE64, - BFD_RELOC_SH_GOT10BY4, - BFD_RELOC_SH_GOT10BY8, - BFD_RELOC_SH_GOTPLT10BY4, - BFD_RELOC_SH_GOTPLT10BY8, - BFD_RELOC_SH_GOTPLT32, - BFD_RELOC_SH_SHMEDIA_CODE, - BFD_RELOC_SH_IMMU5, - BFD_RELOC_SH_IMMS6, - BFD_RELOC_SH_IMMS6BY32, - BFD_RELOC_SH_IMMU6, - BFD_RELOC_SH_IMMS10, - BFD_RELOC_SH_IMMS10BY2, - BFD_RELOC_SH_IMMS10BY4, - BFD_RELOC_SH_IMMS10BY8, - BFD_RELOC_SH_IMMS16, - BFD_RELOC_SH_IMMU16, - BFD_RELOC_SH_IMM_LOW16, - BFD_RELOC_SH_IMM_LOW16_PCREL, - BFD_RELOC_SH_IMM_MEDLOW16, - BFD_RELOC_SH_IMM_MEDLOW16_PCREL, - BFD_RELOC_SH_IMM_MEDHI16, - BFD_RELOC_SH_IMM_MEDHI16_PCREL, - BFD_RELOC_SH_IMM_HI16, - BFD_RELOC_SH_IMM_HI16_PCREL, - BFD_RELOC_SH_PT_16, /* i386/elf relocations */ @@ -2423,6 +2376,55 @@ BFD_RELOC_SH_JMP_SLOT, BFD_RELOC_SH_RELATIVE, BFD_RELOC_SH_GOTPC, + BFD_RELOC_SH_GOT_LOW16, + BFD_RELOC_SH_GOT_MEDLOW16, + BFD_RELOC_SH_GOT_MEDHI16, + BFD_RELOC_SH_GOT_HI16, + BFD_RELOC_SH_GOTPLT_LOW16, + BFD_RELOC_SH_GOTPLT_MEDLOW16, + BFD_RELOC_SH_GOTPLT_MEDHI16, + BFD_RELOC_SH_GOTPLT_HI16, + BFD_RELOC_SH_PLT_LOW16, + BFD_RELOC_SH_PLT_MEDLOW16, + BFD_RELOC_SH_PLT_MEDHI16, + BFD_RELOC_SH_PLT_HI16, + BFD_RELOC_SH_GOTOFF_LOW16, + BFD_RELOC_SH_GOTOFF_MEDLOW16, + BFD_RELOC_SH_GOTOFF_MEDHI16, + BFD_RELOC_SH_GOTOFF_HI16, + BFD_RELOC_SH_GOTPC_LOW16, + BFD_RELOC_SH_GOTPC_MEDLOW16, + BFD_RELOC_SH_GOTPC_MEDHI16, + BFD_RELOC_SH_GOTPC_HI16, + BFD_RELOC_SH_COPY64, + BFD_RELOC_SH_GLOB_DAT64, + BFD_RELOC_SH_JMP_SLOT64, + BFD_RELOC_SH_RELATIVE64, + BFD_RELOC_SH_GOT10BY4, + BFD_RELOC_SH_GOT10BY8, + BFD_RELOC_SH_GOTPLT10BY4, + BFD_RELOC_SH_GOTPLT10BY8, + BFD_RELOC_SH_GOTPLT32, + BFD_RELOC_SH_SHMEDIA_CODE, + BFD_RELOC_SH_IMMU5, + BFD_RELOC_SH_IMMS6, + BFD_RELOC_SH_IMMS6BY32, + BFD_RELOC_SH_IMMU6, + BFD_RELOC_SH_IMMS10, + BFD_RELOC_SH_IMMS10BY2, + BFD_RELOC_SH_IMMS10BY4, + BFD_RELOC_SH_IMMS10BY8, + BFD_RELOC_SH_IMMS16, + BFD_RELOC_SH_IMMU16, + BFD_RELOC_SH_IMM_LOW16, + BFD_RELOC_SH_IMM_LOW16_PCREL, + BFD_RELOC_SH_IMM_MEDLOW16, + BFD_RELOC_SH_IMM_MEDLOW16_PCREL, + BFD_RELOC_SH_IMM_MEDHI16, + BFD_RELOC_SH_IMM_MEDHI16_PCREL, + BFD_RELOC_SH_IMM_HI16, + BFD_RELOC_SH_IMM_HI16_PCREL, + BFD_RELOC_SH_PT_16, /* Thumb 23-, 12- and 9-bit pc-relative branches. The lowest bit must be zero and is not stored in the instruction. */ diff -Nur binutils-2.12/bfd/coff-arm.c binutils-2.12.1/bfd/coff-arm.c --- binutils-2.12/bfd/coff-arm.c Fri Feb 1 08:26:56 2002 +++ binutils-2.12.1/bfd/coff-arm.c Sat May 11 11:12:37 2002 @@ -1,6 +1,6 @@ /* BFD back-end for ARM COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 + 2000, 2001, 2002 Free Software Foundation, Inc. Written by Cygnus Support. @@ -87,12 +87,16 @@ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static bfd_reloc_status_type aoutarm_fix_pcrel_26 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +#ifndef ARM_WINCE static bfd_reloc_status_type coff_thumb_pcrel_23 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type coff_thumb_pcrel_12 - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static bfd_reloc_status_type coff_thumb_pcrel_9 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static insn32 insert_thumb_branch + PARAMS ((insn32, int)); +#endif +static bfd_reloc_status_type coff_thumb_pcrel_12 + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static bfd_reloc_status_type coff_arm_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static boolean coff_arm_adjust_symndx @@ -109,8 +113,6 @@ PARAMS ((bfd *, bfd_reloc_code_real_type)); static struct bfd_link_hash_table * coff_arm_link_hash_table_create PARAMS ((bfd *)); -static insn32 insert_thumb_branch - PARAMS ((insn32, int)); static struct coff_link_hash_entry * find_thumb_glue PARAMS ((struct bfd_link_info *, const char *, bfd *)); static struct coff_link_hash_entry * find_arm_glue @@ -118,9 +120,11 @@ #ifndef COFF_IMAGE_WITH_PE static void record_arm_to_thumb_glue PARAMS ((struct bfd_link_info *, struct coff_link_hash_entry *)); +#ifndef ARM_WINCE static void record_thumb_to_arm_glue PARAMS ((struct bfd_link_info *, struct coff_link_hash_entry *)); #endif +#endif static boolean coff_arm_merge_private_bfd_data PARAMS ((bfd *, bfd *)); static boolean coff_arm_print_private_bfd_data @@ -801,6 +805,7 @@ return flag; } +#ifndef ARM_WINCE static bfd_reloc_status_type coff_thumb_pcrel_23 (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) @@ -818,7 +823,7 @@ } static bfd_reloc_status_type -coff_thumb_pcrel_12 (abfd, reloc_entry, symbol, data, input_section, +coff_thumb_pcrel_9 (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) bfd *abfd; arelent *reloc_entry; @@ -830,11 +835,12 @@ { return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message, - b12); + b9); } +#endif /* not ARM_WINCE */ static bfd_reloc_status_type -coff_thumb_pcrel_9 (abfd, reloc_entry, symbol, data, input_section, +coff_thumb_pcrel_12 (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) bfd *abfd; arelent *reloc_entry; @@ -846,7 +852,7 @@ { return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message, - b9); + b12); } static const struct reloc_howto_struct * @@ -900,6 +906,13 @@ #define BADMAG(x) ARMBADMAG(x) #define ARM 1 /* Customize coffcode.h */ +#ifndef ARM_WINCE +/* Make sure that the 'r_offset' field is copied properly + so that identical binaries will compare the same. */ +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 +#endif + /* Extend the coff_link_hash_table structure with a few ARM specific fields. This allows us to store global data here without actually creating any global variables, which is a no-no in the BFD world. */ @@ -970,6 +983,7 @@ } +#ifndef ARM_WINCE /* The thumb form of a long branch is a bit finicky, because the offset encoding is split over two fields, each in it's own instruction. They can occur in any order. So given a thumb form of long branch, and an @@ -1026,6 +1040,7 @@ return br_insn; } + static struct coff_link_hash_entry * find_thumb_glue (info, name, input_bfd) @@ -1055,6 +1070,7 @@ return myh; } +#endif /* not ARM_WINCE */ static struct coff_link_hash_entry * find_arm_glue (info, name, input_bfd) @@ -1909,6 +1925,7 @@ return; } +#ifndef ARM_WINCE static void record_thumb_to_arm_glue (info, h) struct bfd_link_info * info; @@ -1982,6 +1999,7 @@ return; } +#endif /* not ARM_WINCE */ /* Select a BFD to be used to hold the sections used by the glue code. This function is called from the linker scripts in ld/emultempl/ diff -Nur binutils-2.12/bfd/coff-rs6000.c binutils-2.12.1/bfd/coff-rs6000.c --- binutils-2.12/bfd/coff-rs6000.c Sun Feb 10 17:16:35 2002 +++ binutils-2.12.1/bfd/coff-rs6000.c Mon Apr 1 20:28:45 2002 @@ -46,7 +46,7 @@ extern const bfd_target *_bfd_xcoff_archive_p PARAMS ((bfd *)); extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *)); extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *)); -extern int _bfd_xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); +extern int _bfd_xcoff_stat_arch_elt PARAMS ((bfd *, struct stat *)); extern boolean _bfd_xcoff_write_armap PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); extern boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *)); @@ -1389,7 +1389,7 @@ /* Stat an element in an XCOFF archive. */ int -_bfd_xcoff_generic_stat_arch_elt (abfd, s) +_bfd_xcoff_stat_arch_elt (abfd, s) bfd *abfd; struct stat *s; { @@ -1399,7 +1399,7 @@ return -1; } - if (! xcoff_big_format_p (abfd)) + if (! xcoff_big_format_p (abfd->my_archive)) { struct xcoff_ar_hdr *hdrp = arch_xhdr (abfd); @@ -3536,7 +3536,7 @@ _bfd_xcoff_read_ar_hdr, /* _read_ar_hdr */ _bfd_xcoff_openr_next_archived_file, /* _openr_next_archived_file */ _bfd_generic_get_elt_at_index, /* _get_elt_at_index */ - _bfd_xcoff_generic_stat_arch_elt, /* _generic_dtat_arch_elt */ + _bfd_xcoff_stat_arch_elt, /* _generic_stat_arch_elt */ /* XCOFF archives do not have a timestamp. */ bfd_true, /* _update_armap_timestamp */ @@ -3797,7 +3797,7 @@ _bfd_xcoff_read_ar_hdr, /* _read_ar_hdr */ _bfd_xcoff_openr_next_archived_file, /* _openr_next_archived_file */ _bfd_generic_get_elt_at_index, /* _get_elt_at_index */ - _bfd_xcoff_generic_stat_arch_elt, /* _generic_dtat_arch_elt */ + _bfd_xcoff_stat_arch_elt, /* _generic_stat_arch_elt */ /* XCOFF archives do not have a timestamp. */ bfd_true, /* _update_armap_timestamp */ diff -Nur binutils-2.12/bfd/coff-sh.c binutils-2.12.1/bfd/coff-sh.c --- binutils-2.12/bfd/coff-sh.c Thu Sep 20 19:30:34 2001 +++ binutils-2.12.1/bfd/coff-sh.c Sat May 11 13:03:03 2002 @@ -469,10 +469,11 @@ /* This structure is used to map BFD reloc codes to SH PE relocs. */ struct shcoff_reloc_map { - unsigned char bfd_reloc_val; + bfd_reloc_code_real_type bfd_reloc_val; unsigned char shcoff_reloc_val; }; +#ifdef COFF_WITH_PE /* An array mapping BFD reloc codes to SH PE relocs. */ static const struct shcoff_reloc_map sh_reloc_map[] = { @@ -480,6 +481,14 @@ { BFD_RELOC_RVA, R_SH_IMAGEBASE }, { BFD_RELOC_CTOR, R_SH_IMM32CE }, }; +#else +/* An array mapping BFD reloc codes to SH PE relocs. */ +static const struct shcoff_reloc_map sh_reloc_map[] = +{ + { BFD_RELOC_32, R_SH_IMM32 }, + { BFD_RELOC_CTOR, R_SH_IMM32 }, +}; +#endif /* Given a BFD reloc code, return the howto structure for the corresponding SH PE reloc. */ diff -Nur binutils-2.12/bfd/coff64-rs6000.c binutils-2.12.1/bfd/coff64-rs6000.c --- binutils-2.12/bfd/coff64-rs6000.c Sun Dec 30 23:08:23 2001 +++ binutils-2.12.1/bfd/coff64-rs6000.c Mon Apr 1 20:28:46 2002 @@ -103,7 +103,7 @@ extern boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *)); extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *)); extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *)); -extern int _bfd_xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); +extern int _bfd_xcoff_stat_arch_elt PARAMS ((bfd *, struct stat *)); extern boolean _bfd_xcoff_write_armap PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); extern boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *)); @@ -2577,9 +2577,9 @@ bfd_dont_truncate_arname, /* _truncate_arname */ _bfd_xcoff_write_armap, /* _write_armap */ _bfd_xcoff_read_ar_hdr, /* _read_ar_hdr */ - xcoff64_openr_next_archived_file, /* _openr_next_archived_file */ + xcoff64_openr_next_archived_file, /* _openr_next_archived_file */ _bfd_generic_get_elt_at_index, /* _get_elt_at_index */ - _bfd_xcoff_generic_stat_arch_elt, /* _generic_dtat_arch_elt */ + _bfd_xcoff_stat_arch_elt, /* _generic_stat_arch_elt */ /* XCOFF archives do not have a timestamp. */ bfd_true, /* _update_armap_timestamp */ diff -Nur binutils-2.12/bfd/coffcode.h binutils-2.12.1/bfd/coffcode.h --- binutils-2.12/bfd/coffcode.h Wed Feb 6 11:29:28 2002 +++ binutils-2.12.1/bfd/coffcode.h Thu May 9 10:48:49 2002 @@ -3014,6 +3014,7 @@ else current->target_index = target_index++; } + abfd->section_tail = ¤t->next; free (section_list); } @@ -4443,16 +4444,14 @@ #ifdef COFF_WITH_PE if (src->u.syment.n_sclass == C_NT_WEAK) - dst->symbol.flags = BSF_WEAK; + dst->symbol.flags |= BSF_WEAK; + if (src->u.syment.n_sclass == C_SECTION && src->u.syment.n_scnum > 0) - { - dst->symbol.flags = BSF_LOCAL; - } + dst->symbol.flags = BSF_LOCAL; #endif - if (src->u.syment.n_sclass == C_WEAKEXT) - dst->symbol.flags = BSF_WEAK; + dst->symbol.flags |= BSF_WEAK; break; diff -Nur binutils-2.12/bfd/cofflink.c binutils-2.12.1/bfd/cofflink.c --- binutils-2.12/bfd/cofflink.c Wed Oct 10 08:08:27 2001 +++ binutils-2.12.1/bfd/cofflink.c Thu Apr 4 11:20:27 2002 @@ -1,5 +1,5 @@ /* COFF specific linker code. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. @@ -1005,7 +1005,8 @@ if (info->task_link) { finfo.failed = false; - coff_link_hash_traverse (coff_hash_table (info), _bfd_coff_write_task_globals, + coff_link_hash_traverse (coff_hash_table (info), + _bfd_coff_write_task_globals, (PTR) &finfo); if (finfo.failed) goto error_return; @@ -1013,7 +1014,8 @@ /* Write out the global symbols. */ finfo.failed = false; - coff_link_hash_traverse (coff_hash_table (info), _bfd_coff_write_global_sym, + coff_link_hash_traverse (coff_hash_table (info), + _bfd_coff_write_global_sym, (PTR) &finfo); if (finfo.failed) goto error_return; @@ -2497,6 +2499,13 @@ output_bfd = finfo->output_bfd; + if (h->root.type == bfd_link_hash_warning) + { + h = (struct coff_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return true; + } + if (h->indx >= 0) return true; @@ -2512,6 +2521,7 @@ { default: case bfd_link_hash_new: + case bfd_link_hash_warning: abort (); return false; @@ -2544,7 +2554,6 @@ break; case bfd_link_hash_indirect: - case bfd_link_hash_warning: /* Just ignore these. They can't be handled anyhow. */ return true; } @@ -2698,6 +2707,9 @@ struct coff_final_link_info *finfo = (struct coff_final_link_info *) data; boolean rtnval = true; boolean save_global_to_static; + + if (h->root.type == bfd_link_hash_warning) + h = (struct coff_link_hash_entry *) h->root.u.i.link; if (h->indx < 0) { diff -Nur binutils-2.12/bfd/config.in binutils-2.12.1/bfd/config.in --- binutils-2.12/bfd/config.in Wed May 23 13:26:35 2001 +++ binutils-2.12.1/bfd/config.in Mon May 13 12:20:11 2002 @@ -160,9 +160,15 @@ /* Define if you have the header file. */ #undef HAVE_SYS_PROCFS_H +/* Define if you have the header file. */ +#undef HAVE_SYS_STAT_H + /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H +/* Define if you have the header file. */ +#undef HAVE_SYS_TYPES_H + /* Define if you have the header file. */ #undef HAVE_TIME_H @@ -207,6 +213,9 @@ /* Define if getenv is not declared in system header files. */ #undef NEED_DECLARATION_GETENV + +/* Define if struct core_dumpx has member c_impl */ +#undef HAVE_ST_C_IMPL /* Define if has prstatus_t. */ #undef HAVE_PRSTATUS_T diff -Nur binutils-2.12/bfd/configure binutils-2.12.1/bfd/configure --- binutils-2.12/bfd/configure Fri Mar 8 01:12:03 2002 +++ binutils-2.12.1/bfd/configure Tue May 14 19:34:41 2002 @@ -1116,7 +1116,7 @@ PACKAGE=bfd -VERSION=2.12 +VERSION=2.12.1 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -5173,6 +5173,32 @@ rs6000-*-aix4.[3-9]* | powerpc-*-aix4.[3-9]*) COREFILE=rs6000-core.lo COREFLAG="$COREFLAG -DAIX_CORE_DUMPX_CORE" + # 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:5180: checking for c_impl in struct core_dumpx" >&5 + cat > conftest.$ac_ext < +int main() { +struct core_dumpx c; c.c_impl = 0; +; return 0; } +EOF +if { (eval echo configure:5189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_ST_C_IMPL 1 +EOF + + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* ;; rs6000-*-aix4*) COREFILE=rs6000-core.lo ;; rs6000-*-*) COREFILE=rs6000-core.lo ;; @@ -5226,17 +5252,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5230: checking for $ac_hdr" >&5 +echo "configure:5256: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5240: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5266: \"$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* @@ -5264,12 +5290,12 @@ 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:5268: checking for prstatus_t in sys/procfs.h" >&5 +echo "configure:5294: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5308: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus_t=yes else @@ -5300,12 +5326,12 @@ 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:5304: checking for prstatus32_t in sys/procfs.h" >&5 +echo "configure:5330: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5344: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus32_t=yes else @@ -5336,12 +5362,12 @@ 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:5340: checking for prstatus_t.pr_who in sys/procfs.h" >&5 +echo "configure:5366: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5380: \"$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 @@ -5372,12 +5398,12 @@ 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:5376: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 +echo "configure:5402: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5416: \"$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 @@ -5408,12 +5434,12 @@ 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:5412: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:5438: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5452: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5444,12 +5470,12 @@ 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:5448: checking for pxstatus_t in sys/procfs.h" >&5 +echo "configure:5474: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5488: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pxstatus_t=yes else @@ -5480,12 +5506,12 @@ 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:5484: checking for pstatus32_t in sys/procfs.h" >&5 +echo "configure:5510: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5524: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus32_t=yes else @@ -5516,12 +5542,12 @@ 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:5520: checking for prpsinfo_t in sys/procfs.h" >&5 +echo "configure:5546: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5560: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo_t=yes else @@ -5552,12 +5578,12 @@ 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:5556: checking for prpsinfo32_t in sys/procfs.h" >&5 +echo "configure:5582: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5596: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes else @@ -5588,12 +5614,12 @@ 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:5592: checking for psinfo_t in sys/procfs.h" >&5 +echo "configure:5618: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5632: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo_t=yes else @@ -5624,12 +5650,12 @@ 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:5628: checking for psinfo32_t in sys/procfs.h" >&5 +echo "configure:5654: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5668: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo32_t=yes else @@ -5660,12 +5686,12 @@ 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:5664: checking for lwpstatus_t in sys/procfs.h" >&5 +echo "configure:5690: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpstatus_t=yes else @@ -5696,12 +5722,12 @@ 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:5700: checking for lwpxstatus_t in sys/procfs.h" >&5 +echo "configure:5726: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5740: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes else @@ -5732,12 +5758,12 @@ 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:5736: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 +echo "configure:5762: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5776: \"$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 @@ -5768,12 +5794,12 @@ 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:5772: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 +echo "configure:5798: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5812: \"$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 @@ -5804,12 +5830,12 @@ 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:5808: checking for win32_pstatus_t in sys/procfs.h" >&5 +echo "configure:5834: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes else @@ -6235,10 +6261,10 @@ 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:6239: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6265: 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 <&6 -echo "configure:6287: checking for $ac_hdr" >&5 +echo "configure:6313: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6323: \"$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* @@ -6322,12 +6348,12 @@ for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6326: checking for $ac_func" >&5 +echo "configure:6352: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6380: \"$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 @@ -6375,7 +6401,7 @@ done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6379: checking for working mmap" >&5 +echo "configure:6405: 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 @@ -6383,7 +6409,7 @@ ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6566: \"$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 @@ -6561,12 +6587,12 @@ for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6565: checking for $ac_func" >&5 +echo "configure:6591: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6619: \"$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 -Nur binutils-2.12/bfd/configure.in binutils-2.12.1/bfd/configure.in --- binutils-2.12/bfd/configure.in Fri Mar 8 01:12:11 2002 +++ binutils-2.12.1/bfd/configure.in Tue May 14 19:34:33 2002 @@ -7,7 +7,7 @@ AC_CANONICAL_SYSTEM AC_ISC_POSIX -AM_INIT_AUTOMAKE(bfd, 2.12) +AM_INIT_AUTOMAKE(bfd, 2.12.1) # Uncomment the next line to remove the date from the reported bfd version is_release=y @@ -327,6 +327,14 @@ changequote([,])dnl COREFILE=rs6000-core.lo COREFLAG="$COREFLAG -DAIX_CORE_DUMPX_CORE" + # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE + # have c_impl as a member of struct core_dumpx + AC_MSG_CHECKING([for c_impl in struct core_dumpx]) + AC_TRY_COMPILE([#include ], + [struct core_dumpx c; c.c_impl = 0;], + [AC_DEFINE(HAVE_ST_C_IMPL, 1, + [Define if struct core_dumpx has member c_impl]) + AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)]) ;; rs6000-*-aix4*) COREFILE=rs6000-core.lo ;; rs6000-*-*) COREFILE=rs6000-core.lo ;; diff -Nur binutils-2.12/bfd/cpu-h8300.c binutils-2.12.1/bfd/cpu-h8300.c --- binutils-2.12/bfd/cpu-h8300.c Tue Sep 18 05:57:22 2001 +++ binutils-2.12.1/bfd/cpu-h8300.c Thu Apr 4 11:20:28 2002 @@ -1,5 +1,5 @@ /* BFD library support routines for the Hitachi H8/300 architecture. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2001 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support. @@ -91,7 +91,7 @@ const bfd_arch_info_type *out; { /* It's really not a good idea to mix and match modes. */ - if (in->mach != out->mach) + if (in->arch != out->arch || in->mach != out->mach) return 0; else return in; diff -Nur binutils-2.12/bfd/cpu-i370.c binutils-2.12.1/bfd/cpu-i370.c --- binutils-2.12/bfd/cpu-i370.c Thu Mar 8 16:03:58 2001 +++ binutils-2.12.1/bfd/cpu-i370.c Thu Apr 4 11:20:28 2002 @@ -1,5 +1,5 @@ /* BFD i370 CPU definition - Copyright 1994, 1995, 1996, 1998, 1999, 2000 + Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. Contributed by Ian Lance Taylor, Cygnus Support. Hacked by Linas Vepstas in 1998, 1999 @@ -24,27 +24,6 @@ #include "sysdep.h" #include "libbfd.h" -/* The common i360/370 architecture comes in many forms */ - -static const bfd_arch_info_type *i370_compatible - PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); - -static const bfd_arch_info_type * -i370_compatible (a, b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; -{ - BFD_ASSERT (a->arch == bfd_arch_i370); - switch (b->arch) - { - default: - return NULL; - case bfd_arch_i370: - return bfd_default_compatible (a, b); - } - /*NOTREACHED*/ -} - static const bfd_arch_info_type arch_info_struct[] = { /* hack alert: old old machines are really 16 and 24 bit arch ... */ @@ -58,7 +37,7 @@ "i370:360", 3, false, /* not the default */ - i370_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[1] }, @@ -72,7 +51,7 @@ "i370:370", 3, false, /* not the default */ - i370_compatible, + bfd_default_compatible, bfd_default_scan, 0 }, @@ -89,7 +68,7 @@ "i370:common", 3, true, /* the default */ - i370_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[0] }; diff -Nur binutils-2.12/bfd/cpu-i386.c binutils-2.12.1/bfd/cpu-i386.c --- binutils-2.12/bfd/cpu-i386.c Wed Nov 14 07:01:58 2001 +++ binutils-2.12.1/bfd/cpu-i386.c Thu Apr 4 11:20:28 2002 @@ -1,5 +1,5 @@ /* BFD support for the Intel 386 architecture. - Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001 + Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -44,8 +44,8 @@ 8, /* 8 bits in a byte */ bfd_arch_i386, bfd_mach_x86_64_intel_syntax, - "x86-64:intel", - "x86-64:intel", + "i386:intel", + "i386:x86-64:intel", 3, true, bfd_default_compatible, @@ -75,8 +75,8 @@ 8, /* 8 bits in a byte */ bfd_arch_i386, bfd_mach_x86_64, - "x86-64", - "x86-64", + "i386", + "i386:x86-64", 3, true, bfd_default_compatible, diff -Nur binutils-2.12/bfd/cpu-mips.c binutils-2.12.1/bfd/cpu-mips.c --- binutils-2.12/bfd/cpu-mips.c Fri Aug 31 17:24:28 2001 +++ binutils-2.12.1/bfd/cpu-mips.c Tue Apr 2 19:48:05 2002 @@ -1,5 +1,5 @@ /* bfd back-end for mips support - Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000 + Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. @@ -23,6 +23,29 @@ #include "sysdep.h" #include "libbfd.h" +static const bfd_arch_info_type *mips_compatible + PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); + +/* The default routine tests bits_per_word, which is wrong on mips as + mips word size doesn't correlate with reloc size. */ + +static const bfd_arch_info_type * +mips_compatible (a, b) + const bfd_arch_info_type *a; + const bfd_arch_info_type *b; +{ + if (a->arch != b->arch) + return NULL; + + if (a->mach > b->mach) + return a; + + if (b->mach > a->mach) + return b; + + return a; +} + #define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \ { \ BITS_WORD, /* bits in a word */ \ @@ -34,7 +57,7 @@ PRINT, \ 3, \ DEFAULT, \ - bfd_default_compatible, \ + mips_compatible, \ bfd_default_scan, \ NEXT, \ } diff -Nur binutils-2.12/bfd/cpu-powerpc.c binutils-2.12.1/bfd/cpu-powerpc.c --- binutils-2.12/bfd/cpu-powerpc.c Mon Feb 4 22:35:14 2002 +++ binutils-2.12.1/bfd/cpu-powerpc.c Thu May 9 10:48:52 2002 @@ -50,6 +50,65 @@ const bfd_arch_info_type bfd_powerpc_archs[] = { +#if BFD_DEFAULT_TARGET_SIZE == 64 /* default arch must come first. */ + { + 64, /* 64 bits in a word */ + 64, /* 64 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_powerpc, + bfd_mach_ppc64, + "powerpc", + "powerpc:common64", + 3, + true, /* default for 64 bit target */ + powerpc_compatible, + bfd_default_scan, + &bfd_powerpc_archs[1] + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_powerpc, + bfd_mach_ppc, /* for the POWER/PowerPC common architecture */ + "powerpc", + "powerpc:common", + 3, + false, + powerpc_compatible, + bfd_default_scan, + &bfd_powerpc_archs[2], + }, +#else + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_powerpc, + bfd_mach_ppc, /* for the POWER/PowerPC common architecture */ + "powerpc", + "powerpc:common", + 3, + true, /* default for 32 bit target */ + powerpc_compatible, + bfd_default_scan, + &bfd_powerpc_archs[1], + }, + { + 64, /* 64 bits in a word */ + 64, /* 64 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_powerpc, + bfd_mach_ppc64, + "powerpc", + "powerpc:common64", + 3, + false, + powerpc_compatible, + bfd_default_scan, + &bfd_powerpc_archs[2] + }, +#endif { 32, /* 32 bits in a word */ 32, /* 32 bits in an address */ @@ -62,7 +121,7 @@ false, /* not the default */ powerpc_compatible, bfd_default_scan, - &bfd_powerpc_archs[1] + &bfd_powerpc_archs[3] }, { 32, /* 32 bits in a word */ @@ -76,7 +135,7 @@ false, /* not the default */ powerpc_compatible, bfd_default_scan, - &bfd_powerpc_archs[2] + &bfd_powerpc_archs[4] }, { 32, /* 32 bits in a word */ @@ -90,7 +149,7 @@ false, /* not the default */ powerpc_compatible, bfd_default_scan, - &bfd_powerpc_archs[3] + &bfd_powerpc_archs[5] }, { 32, /* 32 bits in a word */ @@ -104,7 +163,7 @@ false, /* not the default */ powerpc_compatible, bfd_default_scan, - &bfd_powerpc_archs[4] + &bfd_powerpc_archs[6] }, { 32, /* 32 bits in a word */ @@ -118,7 +177,7 @@ false, /* not the default */ powerpc_compatible, bfd_default_scan, - &bfd_powerpc_archs[5] + &bfd_powerpc_archs[7] }, { 64, /* 64 bits in a word */ @@ -132,7 +191,7 @@ false, /* not the default */ powerpc_compatible, bfd_default_scan, - &bfd_powerpc_archs[6] + &bfd_powerpc_archs[8] }, { 64, /* 64 bits in a word */ @@ -146,7 +205,7 @@ false, /* not the default */ powerpc_compatible, bfd_default_scan, - &bfd_powerpc_archs[7] + &bfd_powerpc_archs[9] }, { 64, /* 64 bits in a word */ @@ -160,7 +219,7 @@ false, /* not the default */ powerpc_compatible, bfd_default_scan, - &bfd_powerpc_archs[8] + &bfd_powerpc_archs[10] }, { 64, /* 64 bits in a word */ @@ -174,7 +233,7 @@ false, /* not the default */ powerpc_compatible, bfd_default_scan, - &bfd_powerpc_archs[9] + &bfd_powerpc_archs[11] }, { 64, /* 64 bits in a word */ @@ -188,7 +247,7 @@ false, /* not the default */ powerpc_compatible, bfd_default_scan, - &bfd_powerpc_archs[10] + &bfd_powerpc_archs[12] }, { 32, /* 32 bits in a word */ @@ -202,7 +261,7 @@ false, /* not the default */ powerpc_compatible, bfd_default_scan, - &bfd_powerpc_archs[11] + &bfd_powerpc_archs[13] }, { 32, /* 32 bits in a word */ @@ -214,34 +273,6 @@ "powerpc:MPC8XX", 3, false, /* not the default */ - powerpc_compatible, - bfd_default_scan, - &bfd_powerpc_archs[12] - }, - { - 64, /* 64 bits in a word */ - 64, /* 64 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_powerpc, - bfd_mach_ppc64, - "powerpc", - "powerpc:common64", - 3, - BFD_DEFAULT_TARGET_SIZE == 64, /* default for 64 bit target */ - powerpc_compatible, - bfd_default_scan, - &bfd_powerpc_archs[13] - }, - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_powerpc, - bfd_mach_ppc, /* for the POWER/PowerPC common architecture */ - "powerpc", - "powerpc:common", - 3, - BFD_DEFAULT_TARGET_SIZE != 64, /* default for 32 bit target */ powerpc_compatible, bfd_default_scan, 0 diff -Nur binutils-2.12/bfd/cpu-s390.c binutils-2.12.1/bfd/cpu-s390.c --- binutils-2.12/bfd/cpu-s390.c Thu Mar 8 16:03:58 2001 +++ binutils-2.12.1/bfd/cpu-s390.c Thu Apr 4 11:20:29 2002 @@ -1,5 +1,5 @@ /* BFD support for the s390 processor. - Copyright 2000, 2001 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Carl B. Pedersen and Martin Schwidefsky. This file is part of BFD, the Binary File Descriptor library. @@ -23,15 +23,15 @@ #include "sysdep.h" #include "libbfd.h" -const bfd_arch_info_type bfd_s390_esame_arch = +const bfd_arch_info_type bfd_s390_64_arch = { 64, /* bits in a word */ 64, /* bits in an address */ 8, /* bits in a byte */ bfd_arch_s390, - bfd_mach_s390_esame, + bfd_mach_s390_64, "s390", - "s390:esame", + "s390:64-bit", 3, /* section alignment power */ true, /* the default */ bfd_default_compatible, @@ -45,12 +45,12 @@ 32, /* bits in an address */ 8, /* bits in a byte */ bfd_arch_s390, - bfd_mach_s390_esa, + bfd_mach_s390_31, "s390", - "s390:390", + "s390:31-bit", 3, /* section alignment power */ true, /* the default */ bfd_default_compatible, bfd_default_scan, - &bfd_s390_esame_arch + &bfd_s390_64_arch }; diff -Nur binutils-2.12/bfd/cpu-sparc.c binutils-2.12.1/bfd/cpu-sparc.c --- binutils-2.12/bfd/cpu-sparc.c Thu Mar 8 16:03:58 2001 +++ binutils-2.12.1/bfd/cpu-sparc.c Thu Apr 4 11:20:30 2002 @@ -1,5 +1,6 @@ /* BFD support for the SPARC architecture. - Copyright 1992, 1995, 1996, 1998, 2000 Free Software Foundation, Inc. + Copyright 1992, 1995, 1996, 1998, 2000, 2002 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -21,22 +22,6 @@ #include "sysdep.h" #include "libbfd.h" -/* Don't mix 32 bit and 64 bit files. */ - -static const bfd_arch_info_type *sparc_compatible - PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); - -static const bfd_arch_info_type * -sparc_compatible (a, b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; -{ - if (a->bits_per_word != b->bits_per_word) - return NULL; - - return bfd_default_compatible (a, b); -} - static const bfd_arch_info_type arch_info_struct[] = { { @@ -49,7 +34,7 @@ "sparc:sparclet", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[1], }, @@ -63,7 +48,7 @@ "sparc:sparclite", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[2], }, @@ -77,7 +62,7 @@ "sparc:v8plus", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[3], }, @@ -91,7 +76,7 @@ "sparc:v8plusa", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[4], }, @@ -105,7 +90,7 @@ "sparc:sparclite_le", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[5], }, @@ -119,7 +104,7 @@ "sparc:v9", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[6], }, @@ -133,7 +118,7 @@ "sparc:v9a", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[7], }, @@ -147,7 +132,7 @@ "sparc:v8plusb", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[8], }, @@ -161,7 +146,7 @@ "sparc:v9b", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, 0, } @@ -178,7 +163,7 @@ "sparc", 3, true, /* the default */ - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[0], }; diff -Nur binutils-2.12/bfd/dep-in.sed binutils-2.12.1/bfd/dep-in.sed --- binutils-2.12/bfd/dep-in.sed Thu Oct 4 11:37:38 2001 +++ binutils-2.12.1/bfd/dep-in.sed Thu Apr 4 11:20:31 2002 @@ -5,8 +5,10 @@ s!\.o:!.lo:! s! @BFD_H@!!g -s!@INCDIR@!$(INCDIR)!g +s!@SRCDIR@/../include!$(INCDIR)!g +s!@TOPDIR@/include!$(INCDIR)!g s!@SRCDIR@/../opcodes!$(srcdir)/../opcodes!g +s!@TOPDIR@/opcodes!$(srcdir)/../opcodes!g s!@SRCDIR@/!!g s! hosts/[^ ]*\.h! !g s! sysdep.h!!g diff -Nur binutils-2.12/bfd/doc/ChangeLog binutils-2.12.1/bfd/doc/ChangeLog --- binutils-2.12/bfd/doc/ChangeLog Fri Feb 1 04:22:53 2002 +++ binutils-2.12.1/bfd/doc/ChangeLog Mon Apr 1 20:28:55 2002 @@ -1,3 +1,7 @@ +2002-03-28 Alan Modra + + * Makefile.in: Regenerate. + 2002-02-01 Alan Modra * chew.c (WORD): Eliminate. diff -Nur binutils-2.12/bfd/doc/Makefile.in binutils-2.12.1/bfd/doc/Makefile.in --- binutils-2.12/bfd/doc/Makefile.in Fri Feb 8 00:33:25 2002 +++ binutils-2.12.1/bfd/doc/Makefile.in Mon Apr 1 20:28:55 2002 @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -242,7 +242,7 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best all: all-redirect .SUFFIXES: @@ -328,7 +328,7 @@ else ii=; fi; \ list='$(INFO_DEPS)'; \ for file in $$list; do \ - test -z "$ii" \ + test -z "$$ii" \ || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \ done @$(NORMAL_UNINSTALL) diff -Nur binutils-2.12/bfd/doc/archures.texi binutils-2.12.1/bfd/doc/archures.texi --- binutils-2.12/bfd/doc/archures.texi Fri Mar 8 01:16:00 2002 +++ binutils-2.12.1/bfd/doc/archures.texi Mon May 13 09:15:29 2002 @@ -225,8 +225,8 @@ #define bfd_mach_avr5 5 bfd_arch_cris, /* Axis CRIS */ bfd_arch_s390, /* IBM s390 */ -#define bfd_mach_s390_esa 0 -#define bfd_mach_s390_esame 1 +#define bfd_mach_s390_31 0 +#define bfd_mach_s390_64 1 bfd_arch_openrisc, /* OpenRISC */ bfd_arch_mmix, /* Donald Knuth's educational processor. */ bfd_arch_xstormy16, @@ -253,7 +253,9 @@ const char *arch_name; const char *printable_name; unsigned int section_align_power; - /* True if this is the default machine for the architecture. */ + /* True if this is the default machine for the architecture. + The default arch should be the first entry for an arch so that + all the entries for that arch can be accessed via @code{next}. */ boolean the_default; const struct bfd_arch_info * (*compatible) PARAMS ((const struct bfd_arch_info *a, diff -Nur binutils-2.12/bfd/doc/bfd.info binutils-2.12.1/bfd/doc/bfd.info --- binutils-2.12/bfd/doc/bfd.info Fri Mar 8 01:16:00 2002 +++ binutils-2.12.1/bfd/doc/bfd.info Tue May 14 19:47:17 2002 @@ -1,4 +1,4 @@ -This is bfd.info, produced by makeinfo version 4.0f from bfd.texinfo. +This is bfd.info, produced by makeinfo version 4.1 from bfd.texinfo. START-INFO-DIR-ENTRY * Bfd: (bfd). The Binary File Descriptor library. @@ -17,79 +17,79 @@  Indirect: -bfd.info-1: 687 -bfd.info-2: 39393 -bfd.info-3: 86644 -bfd.info-4: 102441 -bfd.info-5: 142458 -bfd.info-6: 192424 -bfd.info-7: 226691 -bfd.info-8: 266268 -bfd.info-9: 284690 +bfd.info-1: 686 +bfd.info-2: 39392 +bfd.info-3: 86643 +bfd.info-4: 102440 +bfd.info-5: 142457 +bfd.info-6: 189788 +bfd.info-7: 226834 +bfd.info-8: 266411 +bfd.info-9: 284833  Tag Table: (Indirect) -Node: Top687 -Node: Overview1019 -Node: History2069 -Node: How It Works3010 -Node: What BFD Version 2 Can Do4548 -Node: BFD information loss5858 -Node: Canonical format8381 -Node: BFD front end12742 -Node: Memory Usage33491 -Node: Initialization34714 -Node: Sections35091 -Node: Section Input35569 -Node: Section Output36925 -Node: typedef asection39393 -Node: section prototypes57594 -Node: Symbols64472 -Node: Reading Symbols66062 -Node: Writing Symbols67236 -Node: Mini Symbols68926 -Node: typedef asymbol69891 -Node: symbol handling functions74831 -Node: Archives79496 -Node: Formats83114 -Node: Relocations85924 -Node: typedef arelent86644 -Node: howto manager102441 -Node: Core Files139474 -Node: Targets140495 -Node: bfd_target142458 -Node: Architectures161944 -Node: Opening and Closing177771 -Node: Internal182168 -Node: File Caching189645 -Node: Linker Functions192424 -Node: Creating a Linker Hash Table194090 -Node: Adding Symbols to the Hash Table195818 -Node: Differing file formats196708 -Node: Adding symbols from an object file198441 -Node: Adding symbols from an archive200577 -Node: Performing the Final Link202976 -Node: Information provided by the linker204207 -Node: Relocating the section contents205343 -Node: Writing the symbol table207080 -Node: Hash Tables209674 -Node: Creating and Freeing a Hash Table210865 -Node: Looking Up or Entering a String212022 -Node: Traversing a Hash Table213264 -Node: Deriving a New Hash Table Type214042 -Node: Define the Derived Structures215097 -Node: Write the Derived Creation Routine216163 -Node: Write Other Derived Routines218862 -Node: BFD back ends220162 -Node: What to Put Where220428 -Node: aout220566 -Node: coff226691 -Node: elf251424 -Node: mmo252269 -Node: File layout253192 -Node: Symbol-table258830 -Node: mmo section mapping262625 -Node: GNU Free Documentation License266268 -Node: Index284690 +Node: Top686 +Node: Overview1018 +Node: History2068 +Node: How It Works3009 +Node: What BFD Version 2 Can Do4547 +Node: BFD information loss5857 +Node: Canonical format8380 +Node: BFD front end12741 +Node: Memory Usage33490 +Node: Initialization34713 +Node: Sections35090 +Node: Section Input35568 +Node: Section Output36924 +Node: typedef asection39392 +Node: section prototypes57593 +Node: Symbols64471 +Node: Reading Symbols66061 +Node: Writing Symbols67235 +Node: Mini Symbols68925 +Node: typedef asymbol69890 +Node: symbol handling functions74830 +Node: Archives79495 +Node: Formats83113 +Node: Relocations85923 +Node: typedef arelent86643 +Node: howto manager102440 +Node: Core Files139473 +Node: Targets140494 +Node: bfd_target142457 +Node: Architectures161943 +Node: Opening and Closing177911 +Node: Internal182308 +Node: File Caching189788 +Node: Linker Functions192567 +Node: Creating a Linker Hash Table194233 +Node: Adding Symbols to the Hash Table195961 +Node: Differing file formats196851 +Node: Adding symbols from an object file198584 +Node: Adding symbols from an archive200720 +Node: Performing the Final Link203119 +Node: Information provided by the linker204350 +Node: Relocating the section contents205486 +Node: Writing the symbol table207223 +Node: Hash Tables209817 +Node: Creating and Freeing a Hash Table211008 +Node: Looking Up or Entering a String212165 +Node: Traversing a Hash Table213407 +Node: Deriving a New Hash Table Type214185 +Node: Define the Derived Structures215240 +Node: Write the Derived Creation Routine216306 +Node: Write Other Derived Routines219005 +Node: BFD back ends220305 +Node: What to Put Where220571 +Node: aout220709 +Node: coff226834 +Node: elf251567 +Node: mmo252412 +Node: File layout253335 +Node: Symbol-table258973 +Node: mmo section mapping262768 +Node: GNU Free Documentation License266411 +Node: Index284833  End Tag Table diff -Nur binutils-2.12/bfd/doc/bfd.info-1 binutils-2.12.1/bfd/doc/bfd.info-1 --- binutils-2.12/bfd/doc/bfd.info-1 Fri Mar 8 01:16:00 2002 +++ binutils-2.12.1/bfd/doc/bfd.info-1 Tue May 14 19:47:17 2002 @@ -1,4 +1,4 @@ -This is bfd.info, produced by makeinfo version 4.0f from bfd.texinfo. +This is bfd.info, produced by makeinfo version 4.1 from bfd.texinfo. START-INFO-DIR-ENTRY * Bfd: (bfd). The Binary File Descriptor library. diff -Nur binutils-2.12/bfd/doc/bfd.info-2 binutils-2.12.1/bfd/doc/bfd.info-2 --- binutils-2.12/bfd/doc/bfd.info-2 Fri Mar 8 01:16:00 2002 +++ binutils-2.12.1/bfd/doc/bfd.info-2 Tue May 14 19:47:17 2002 @@ -1,4 +1,4 @@ -This is bfd.info, produced by makeinfo version 4.0f from bfd.texinfo. +This is bfd.info, produced by makeinfo version 4.1 from bfd.texinfo. START-INFO-DIR-ENTRY * Bfd: (bfd). The Binary File Descriptor library. diff -Nur binutils-2.12/bfd/doc/bfd.info-3 binutils-2.12.1/bfd/doc/bfd.info-3 --- binutils-2.12/bfd/doc/bfd.info-3 Fri Mar 8 01:16:00 2002 +++ binutils-2.12.1/bfd/doc/bfd.info-3 Tue May 14 19:47:17 2002 @@ -1,4 +1,4 @@ -This is bfd.info, produced by makeinfo version 4.0f from bfd.texinfo. +This is bfd.info, produced by makeinfo version 4.1 from bfd.texinfo. START-INFO-DIR-ENTRY * Bfd: (bfd). The Binary File Descriptor library. diff -Nur binutils-2.12/bfd/doc/bfd.info-4 binutils-2.12.1/bfd/doc/bfd.info-4 --- binutils-2.12/bfd/doc/bfd.info-4 Fri Mar 8 01:16:00 2002 +++ binutils-2.12.1/bfd/doc/bfd.info-4 Tue May 14 19:47:17 2002 @@ -1,4 +1,4 @@ -This is bfd.info, produced by makeinfo version 4.0f from bfd.texinfo. +This is bfd.info, produced by makeinfo version 4.1 from bfd.texinfo. START-INFO-DIR-ENTRY * Bfd: (bfd). The Binary File Descriptor library. @@ -301,55 +301,6 @@ - : BFD_RELOC_MIPS_REL16 - : BFD_RELOC_MIPS_RELGOT - : BFD_RELOC_MIPS_JALR - - : BFD_RELOC_SH_GOT_LOW16 - - : BFD_RELOC_SH_GOT_MEDLOW16 - - : BFD_RELOC_SH_GOT_MEDHI16 - - : BFD_RELOC_SH_GOT_HI16 - - : BFD_RELOC_SH_GOTPLT_LOW16 - - : BFD_RELOC_SH_GOTPLT_MEDLOW16 - - : BFD_RELOC_SH_GOTPLT_MEDHI16 - - : BFD_RELOC_SH_GOTPLT_HI16 - - : BFD_RELOC_SH_PLT_LOW16 - - : BFD_RELOC_SH_PLT_MEDLOW16 - - : BFD_RELOC_SH_PLT_MEDHI16 - - : BFD_RELOC_SH_PLT_HI16 - - : BFD_RELOC_SH_GOTOFF_LOW16 - - : BFD_RELOC_SH_GOTOFF_MEDLOW16 - - : BFD_RELOC_SH_GOTOFF_MEDHI16 - - : BFD_RELOC_SH_GOTOFF_HI16 - - : BFD_RELOC_SH_GOTPC_LOW16 - - : BFD_RELOC_SH_GOTPC_MEDLOW16 - - : BFD_RELOC_SH_GOTPC_MEDHI16 - - : BFD_RELOC_SH_GOTPC_HI16 - - : BFD_RELOC_SH_COPY64 - - : BFD_RELOC_SH_GLOB_DAT64 - - : BFD_RELOC_SH_JMP_SLOT64 - - : BFD_RELOC_SH_RELATIVE64 - - : BFD_RELOC_SH_GOT10BY4 - - : BFD_RELOC_SH_GOT10BY8 - - : BFD_RELOC_SH_GOTPLT10BY4 - - : BFD_RELOC_SH_GOTPLT10BY8 - - : BFD_RELOC_SH_GOTPLT32 - - : BFD_RELOC_SH_SHMEDIA_CODE - - : BFD_RELOC_SH_IMMU5 - - : BFD_RELOC_SH_IMMS6 - - : BFD_RELOC_SH_IMMS6BY32 - - : BFD_RELOC_SH_IMMU6 - - : BFD_RELOC_SH_IMMS10 - - : BFD_RELOC_SH_IMMS10BY2 - - : BFD_RELOC_SH_IMMS10BY4 - - : BFD_RELOC_SH_IMMS10BY8 - - : BFD_RELOC_SH_IMMS16 - - : BFD_RELOC_SH_IMMU16 - - : BFD_RELOC_SH_IMM_LOW16 - - : BFD_RELOC_SH_IMM_LOW16_PCREL - - : BFD_RELOC_SH_IMM_MEDLOW16 - - : BFD_RELOC_SH_IMM_MEDLOW16_PCREL - - : BFD_RELOC_SH_IMM_MEDHI16 - - : BFD_RELOC_SH_IMM_MEDHI16_PCREL - - : BFD_RELOC_SH_IMM_HI16 - - : BFD_RELOC_SH_IMM_HI16_PCREL - - : BFD_RELOC_SH_PT_16 MIPS ELF relocations. - : BFD_RELOC_386_GOT32 @@ -530,6 +481,55 @@ - : BFD_RELOC_SH_JMP_SLOT - : BFD_RELOC_SH_RELATIVE - : BFD_RELOC_SH_GOTPC + - : BFD_RELOC_SH_GOT_LOW16 + - : BFD_RELOC_SH_GOT_MEDLOW16 + - : BFD_RELOC_SH_GOT_MEDHI16 + - : BFD_RELOC_SH_GOT_HI16 + - : BFD_RELOC_SH_GOTPLT_LOW16 + - : BFD_RELOC_SH_GOTPLT_MEDLOW16 + - : BFD_RELOC_SH_GOTPLT_MEDHI16 + - : BFD_RELOC_SH_GOTPLT_HI16 + - : BFD_RELOC_SH_PLT_LOW16 + - : BFD_RELOC_SH_PLT_MEDLOW16 + - : BFD_RELOC_SH_PLT_MEDHI16 + - : BFD_RELOC_SH_PLT_HI16 + - : BFD_RELOC_SH_GOTOFF_LOW16 + - : BFD_RELOC_SH_GOTOFF_MEDLOW16 + - : BFD_RELOC_SH_GOTOFF_MEDHI16 + - : BFD_RELOC_SH_GOTOFF_HI16 + - : BFD_RELOC_SH_GOTPC_LOW16 + - : BFD_RELOC_SH_GOTPC_MEDLOW16 + - : BFD_RELOC_SH_GOTPC_MEDHI16 + - : BFD_RELOC_SH_GOTPC_HI16 + - : BFD_RELOC_SH_COPY64 + - : BFD_RELOC_SH_GLOB_DAT64 + - : BFD_RELOC_SH_JMP_SLOT64 + - : BFD_RELOC_SH_RELATIVE64 + - : BFD_RELOC_SH_GOT10BY4 + - : BFD_RELOC_SH_GOT10BY8 + - : BFD_RELOC_SH_GOTPLT10BY4 + - : BFD_RELOC_SH_GOTPLT10BY8 + - : BFD_RELOC_SH_GOTPLT32 + - : BFD_RELOC_SH_SHMEDIA_CODE + - : BFD_RELOC_SH_IMMU5 + - : BFD_RELOC_SH_IMMS6 + - : BFD_RELOC_SH_IMMS6BY32 + - : BFD_RELOC_SH_IMMU6 + - : BFD_RELOC_SH_IMMS10 + - : BFD_RELOC_SH_IMMS10BY2 + - : BFD_RELOC_SH_IMMS10BY4 + - : BFD_RELOC_SH_IMMS10BY8 + - : BFD_RELOC_SH_IMMS16 + - : BFD_RELOC_SH_IMMU16 + - : BFD_RELOC_SH_IMM_LOW16 + - : BFD_RELOC_SH_IMM_LOW16_PCREL + - : BFD_RELOC_SH_IMM_MEDLOW16 + - : BFD_RELOC_SH_IMM_MEDLOW16_PCREL + - : BFD_RELOC_SH_IMM_MEDHI16 + - : BFD_RELOC_SH_IMM_MEDHI16_PCREL + - : BFD_RELOC_SH_IMM_HI16 + - : BFD_RELOC_SH_IMM_HI16_PCREL + - : BFD_RELOC_SH_PT_16 Hitachi SH relocs. Not all of these appear in object files. - : BFD_RELOC_THUMB_PCREL_BRANCH9 diff -Nur binutils-2.12/bfd/doc/bfd.info-5 binutils-2.12.1/bfd/doc/bfd.info-5 --- binutils-2.12/bfd/doc/bfd.info-5 Fri Mar 8 01:16:00 2002 +++ binutils-2.12.1/bfd/doc/bfd.info-5 Tue May 14 19:47:17 2002 @@ -1,4 +1,4 @@ -This is bfd.info, produced by makeinfo version 4.0f from bfd.texinfo. +This is bfd.info, produced by makeinfo version 4.1 from bfd.texinfo. START-INFO-DIR-ENTRY * Bfd: (bfd). The Binary File Descriptor library. @@ -660,8 +660,8 @@ #define bfd_mach_avr5 5 bfd_arch_cris, /* Axis CRIS */ bfd_arch_s390, /* IBM s390 */ - #define bfd_mach_s390_esa 0 - #define bfd_mach_s390_esame 1 + #define bfd_mach_s390_31 0 + #define bfd_mach_s390_64 1 bfd_arch_openrisc, /* OpenRISC */ bfd_arch_mmix, /* Donald Knuth's educational processor. */ bfd_arch_xstormy16, @@ -685,7 +685,9 @@ const char *arch_name; const char *printable_name; unsigned int section_align_power; - /* True if this is the default machine for the architecture. */ + /* True if this is the default machine for the architecture. + The default arch should be the first entry for an arch so that + all the entries for that arch can be accessed via `next'. */ boolean the_default; const struct bfd_arch_info * (*compatible) PARAMS ((const struct bfd_arch_info *a, @@ -1039,7 +1041,7 @@ ............................... *Synopsis* - void bfd_write_bigendian_4byte_int (bfd *, unsigned int); + boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int); *Description* Write a 4 byte integer I to the output BFD ABFD, in big endian order regardless of what else is going on. This is useful in archives. @@ -1222,93 +1224,4 @@ *Description* Return the log base 2 of the value supplied, rounded up. E.g., an X of 1025 returns 11. A X of 0 returns 0. - - -File: bfd.info, Node: File Caching, Next: Linker Functions, Prev: Internal, Up: BFD front end - -File caching -============ - - The file caching mechanism is embedded within BFD and allows the -application to open as many BFDs as it wants without regard to the -underlying operating system's file descriptor limit (often as low as 20 -open files). The module in `cache.c' maintains a least recently used -list of `BFD_CACHE_MAX_OPEN' files, and exports the name -`bfd_cache_lookup', which runs around and makes sure that the required -BFD is open. If not, then it chooses a file to close, closes it and -opens the one wanted, returning its file handle. - -`BFD_CACHE_MAX_OPEN macro' -.......................... - - *Description* -The maximum number of files which the cache will keep open at one time. - #define BFD_CACHE_MAX_OPEN 10 - -`bfd_last_cache' -................ - - *Synopsis* - extern bfd *bfd_last_cache; - *Description* -Zero, or a pointer to the topmost BFD on the chain. This is used by -the `bfd_cache_lookup' macro in `libbfd.h' to determine when it can -avoid a function call. - -`bfd_cache_lookup' -.................. - - *Description* -Check to see if the required BFD is the same as the last one looked up. -If so, then it can use the stream in the BFD with impunity, since it -can't have changed since the last lookup; otherwise, it has to perform -the complicated lookup function. - #define bfd_cache_lookup(x) \ - ((x)==bfd_last_cache? \ - (FILE*) (bfd_last_cache->iostream): \ - bfd_cache_lookup_worker(x)) - -`bfd_cache_init' -................ - - *Synopsis* - boolean bfd_cache_init (bfd *abfd); - *Description* -Add a newly opened BFD to the cache. - -`bfd_cache_close' -................. - - *Synopsis* - boolean bfd_cache_close (bfd *abfd); - *Description* -Remove the BFD ABFD from the cache. If the attached file is open, then -close it too. - - *Returns* -`false' is returned if closing the file fails, `true' is returned if -all is well. - -`bfd_open_file' -............... - - *Synopsis* - FILE* bfd_open_file(bfd *abfd); - *Description* -Call the OS to open a file for ABFD. Return the `FILE *' (possibly -`NULL') that results from this operation. Set up the BFD so that -future accesses know the file is open. If the `FILE *' returned is -`NULL', then it won't have been put in the cache, so it won't have to -be removed from it. - -`bfd_cache_lookup_worker' -......................... - - *Synopsis* - FILE *bfd_cache_lookup_worker(bfd *abfd); - *Description* -Called when the macro `bfd_cache_lookup' fails to find a quick answer. -Find a file descriptor for ABFD. If necessary, it open it. If there -are already more than `BFD_CACHE_MAX_OPEN' files open, it tries to -close one first, to avoid running out of file descriptors. diff -Nur binutils-2.12/bfd/doc/bfd.info-6 binutils-2.12.1/bfd/doc/bfd.info-6 --- binutils-2.12/bfd/doc/bfd.info-6 Fri Mar 8 01:16:00 2002 +++ binutils-2.12.1/bfd/doc/bfd.info-6 Tue May 14 19:47:17 2002 @@ -1,4 +1,4 @@ -This is bfd.info, produced by makeinfo version 4.0f from bfd.texinfo. +This is bfd.info, produced by makeinfo version 4.1 from bfd.texinfo. START-INFO-DIR-ENTRY * Bfd: (bfd). The Binary File Descriptor library. @@ -14,6 +14,95 @@ with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". + + +File: bfd.info, Node: File Caching, Next: Linker Functions, Prev: Internal, Up: BFD front end + +File caching +============ + + The file caching mechanism is embedded within BFD and allows the +application to open as many BFDs as it wants without regard to the +underlying operating system's file descriptor limit (often as low as 20 +open files). The module in `cache.c' maintains a least recently used +list of `BFD_CACHE_MAX_OPEN' files, and exports the name +`bfd_cache_lookup', which runs around and makes sure that the required +BFD is open. If not, then it chooses a file to close, closes it and +opens the one wanted, returning its file handle. + +`BFD_CACHE_MAX_OPEN macro' +.......................... + + *Description* +The maximum number of files which the cache will keep open at one time. + #define BFD_CACHE_MAX_OPEN 10 + +`bfd_last_cache' +................ + + *Synopsis* + extern bfd *bfd_last_cache; + *Description* +Zero, or a pointer to the topmost BFD on the chain. This is used by +the `bfd_cache_lookup' macro in `libbfd.h' to determine when it can +avoid a function call. + +`bfd_cache_lookup' +.................. + + *Description* +Check to see if the required BFD is the same as the last one looked up. +If so, then it can use the stream in the BFD with impunity, since it +can't have changed since the last lookup; otherwise, it has to perform +the complicated lookup function. + #define bfd_cache_lookup(x) \ + ((x)==bfd_last_cache? \ + (FILE*) (bfd_last_cache->iostream): \ + bfd_cache_lookup_worker(x)) + +`bfd_cache_init' +................ + + *Synopsis* + boolean bfd_cache_init (bfd *abfd); + *Description* +Add a newly opened BFD to the cache. + +`bfd_cache_close' +................. + + *Synopsis* + boolean bfd_cache_close (bfd *abfd); + *Description* +Remove the BFD ABFD from the cache. If the attached file is open, then +close it too. + + *Returns* +`false' is returned if closing the file fails, `true' is returned if +all is well. + +`bfd_open_file' +............... + + *Synopsis* + FILE* bfd_open_file(bfd *abfd); + *Description* +Call the OS to open a file for ABFD. Return the `FILE *' (possibly +`NULL') that results from this operation. Set up the BFD so that +future accesses know the file is open. If the `FILE *' returned is +`NULL', then it won't have been put in the cache, so it won't have to +be removed from it. + +`bfd_cache_lookup_worker' +......................... + + *Synopsis* + FILE *bfd_cache_lookup_worker(bfd *abfd); + *Description* +Called when the macro `bfd_cache_lookup' fails to find a quick answer. +Find a file descriptor for ABFD. If necessary, it open it. If there +are already more than `BFD_CACHE_MAX_OPEN' files open, it tries to +close one first, to avoid running out of file descriptors.  File: bfd.info, Node: Linker Functions, Next: Hash Tables, Prev: File Caching, Up: BFD front end diff -Nur binutils-2.12/bfd/doc/bfd.info-7 binutils-2.12.1/bfd/doc/bfd.info-7 --- binutils-2.12/bfd/doc/bfd.info-7 Fri Mar 8 01:16:00 2002 +++ binutils-2.12.1/bfd/doc/bfd.info-7 Tue May 14 19:47:17 2002 @@ -1,4 +1,4 @@ -This is bfd.info, produced by makeinfo version 4.0f from bfd.texinfo. +This is bfd.info, produced by makeinfo version 4.1 from bfd.texinfo. START-INFO-DIR-ENTRY * Bfd: (bfd). The Binary File Descriptor library. diff -Nur binutils-2.12/bfd/doc/bfd.info-8 binutils-2.12.1/bfd/doc/bfd.info-8 --- binutils-2.12/bfd/doc/bfd.info-8 Fri Mar 8 01:16:00 2002 +++ binutils-2.12.1/bfd/doc/bfd.info-8 Tue May 14 19:47:17 2002 @@ -1,4 +1,4 @@ -This is bfd.info, produced by makeinfo version 4.0f from bfd.texinfo. +This is bfd.info, produced by makeinfo version 4.1 from bfd.texinfo. START-INFO-DIR-ENTRY * Bfd: (bfd). The Binary File Descriptor library. diff -Nur binutils-2.12/bfd/doc/bfd.info-9 binutils-2.12.1/bfd/doc/bfd.info-9 --- binutils-2.12/bfd/doc/bfd.info-9 Fri Mar 8 01:16:00 2002 +++ binutils-2.12.1/bfd/doc/bfd.info-9 Tue May 14 19:47:17 2002 @@ -1,4 +1,4 @@ -This is bfd.info, produced by makeinfo version 4.0f from bfd.texinfo. +This is bfd.info, produced by makeinfo version 4.1 from bfd.texinfo. START-INFO-DIR-ENTRY * Bfd: (bfd). The Binary File Descriptor library. diff -Nur binutils-2.12/bfd/doc/libbfd.texi binutils-2.12.1/bfd/doc/libbfd.texi --- binutils-2.12/bfd/doc/libbfd.texi Fri Mar 8 01:16:00 2002 +++ binutils-2.12.1/bfd/doc/libbfd.texi Mon May 13 09:15:31 2002 @@ -10,7 +10,7 @@ @subsubsection @code{bfd_write_bigendian_4byte_int} @strong{Synopsis} @example -void bfd_write_bigendian_4byte_int (bfd *, unsigned int); +boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int); @end example @strong{Description}@* Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big diff -Nur binutils-2.12/bfd/doc/reloc.texi binutils-2.12.1/bfd/doc/reloc.texi --- binutils-2.12/bfd/doc/reloc.texi Fri Mar 8 01:16:00 2002 +++ binutils-2.12.1/bfd/doc/reloc.texi Mon May 13 09:15:31 2002 @@ -768,55 +768,6 @@ @deffnx {} BFD_RELOC_MIPS_REL16 @deffnx {} BFD_RELOC_MIPS_RELGOT @deffnx {} BFD_RELOC_MIPS_JALR -@deffnx {} BFD_RELOC_SH_GOT_LOW16 -@deffnx {} BFD_RELOC_SH_GOT_MEDLOW16 -@deffnx {} BFD_RELOC_SH_GOT_MEDHI16 -@deffnx {} BFD_RELOC_SH_GOT_HI16 -@deffnx {} BFD_RELOC_SH_GOTPLT_LOW16 -@deffnx {} BFD_RELOC_SH_GOTPLT_MEDLOW16 -@deffnx {} BFD_RELOC_SH_GOTPLT_MEDHI16 -@deffnx {} BFD_RELOC_SH_GOTPLT_HI16 -@deffnx {} BFD_RELOC_SH_PLT_LOW16 -@deffnx {} BFD_RELOC_SH_PLT_MEDLOW16 -@deffnx {} BFD_RELOC_SH_PLT_MEDHI16 -@deffnx {} BFD_RELOC_SH_PLT_HI16 -@deffnx {} BFD_RELOC_SH_GOTOFF_LOW16 -@deffnx {} BFD_RELOC_SH_GOTOFF_MEDLOW16 -@deffnx {} BFD_RELOC_SH_GOTOFF_MEDHI16 -@deffnx {} BFD_RELOC_SH_GOTOFF_HI16 -@deffnx {} BFD_RELOC_SH_GOTPC_LOW16 -@deffnx {} BFD_RELOC_SH_GOTPC_MEDLOW16 -@deffnx {} BFD_RELOC_SH_GOTPC_MEDHI16 -@deffnx {} BFD_RELOC_SH_GOTPC_HI16 -@deffnx {} BFD_RELOC_SH_COPY64 -@deffnx {} BFD_RELOC_SH_GLOB_DAT64 -@deffnx {} BFD_RELOC_SH_JMP_SLOT64 -@deffnx {} BFD_RELOC_SH_RELATIVE64 -@deffnx {} BFD_RELOC_SH_GOT10BY4 -@deffnx {} BFD_RELOC_SH_GOT10BY8 -@deffnx {} BFD_RELOC_SH_GOTPLT10BY4 -@deffnx {} BFD_RELOC_SH_GOTPLT10BY8 -@deffnx {} BFD_RELOC_SH_GOTPLT32 -@deffnx {} BFD_RELOC_SH_SHMEDIA_CODE -@deffnx {} BFD_RELOC_SH_IMMU5 -@deffnx {} BFD_RELOC_SH_IMMS6 -@deffnx {} BFD_RELOC_SH_IMMS6BY32 -@deffnx {} BFD_RELOC_SH_IMMU6 -@deffnx {} BFD_RELOC_SH_IMMS10 -@deffnx {} BFD_RELOC_SH_IMMS10BY2 -@deffnx {} BFD_RELOC_SH_IMMS10BY4 -@deffnx {} BFD_RELOC_SH_IMMS10BY8 -@deffnx {} BFD_RELOC_SH_IMMS16 -@deffnx {} BFD_RELOC_SH_IMMU16 -@deffnx {} BFD_RELOC_SH_IMM_LOW16 -@deffnx {} BFD_RELOC_SH_IMM_LOW16_PCREL -@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16 -@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16_PCREL -@deffnx {} BFD_RELOC_SH_IMM_MEDHI16 -@deffnx {} BFD_RELOC_SH_IMM_MEDHI16_PCREL -@deffnx {} BFD_RELOC_SH_IMM_HI16 -@deffnx {} BFD_RELOC_SH_IMM_HI16_PCREL -@deffnx {} BFD_RELOC_SH_PT_16 MIPS ELF relocations. @end deffn @deffn {} BFD_RELOC_386_GOT32 @@ -996,6 +947,55 @@ @deffnx {} BFD_RELOC_SH_JMP_SLOT @deffnx {} BFD_RELOC_SH_RELATIVE @deffnx {} BFD_RELOC_SH_GOTPC +@deffnx {} BFD_RELOC_SH_GOT_LOW16 +@deffnx {} BFD_RELOC_SH_GOT_MEDLOW16 +@deffnx {} BFD_RELOC_SH_GOT_MEDHI16 +@deffnx {} BFD_RELOC_SH_GOT_HI16 +@deffnx {} BFD_RELOC_SH_GOTPLT_LOW16 +@deffnx {} BFD_RELOC_SH_GOTPLT_MEDLOW16 +@deffnx {} BFD_RELOC_SH_GOTPLT_MEDHI16 +@deffnx {} BFD_RELOC_SH_GOTPLT_HI16 +@deffnx {} BFD_RELOC_SH_PLT_LOW16 +@deffnx {} BFD_RELOC_SH_PLT_MEDLOW16 +@deffnx {} BFD_RELOC_SH_PLT_MEDHI16 +@deffnx {} BFD_RELOC_SH_PLT_HI16 +@deffnx {} BFD_RELOC_SH_GOTOFF_LOW16 +@deffnx {} BFD_RELOC_SH_GOTOFF_MEDLOW16 +@deffnx {} BFD_RELOC_SH_GOTOFF_MEDHI16 +@deffnx {} BFD_RELOC_SH_GOTOFF_HI16 +@deffnx {} BFD_RELOC_SH_GOTPC_LOW16 +@deffnx {} BFD_RELOC_SH_GOTPC_MEDLOW16 +@deffnx {} BFD_RELOC_SH_GOTPC_MEDHI16 +@deffnx {} BFD_RELOC_SH_GOTPC_HI16 +@deffnx {} BFD_RELOC_SH_COPY64 +@deffnx {} BFD_RELOC_SH_GLOB_DAT64 +@deffnx {} BFD_RELOC_SH_JMP_SLOT64 +@deffnx {} BFD_RELOC_SH_RELATIVE64 +@deffnx {} BFD_RELOC_SH_GOT10BY4 +@deffnx {} BFD_RELOC_SH_GOT10BY8 +@deffnx {} BFD_RELOC_SH_GOTPLT10BY4 +@deffnx {} BFD_RELOC_SH_GOTPLT10BY8 +@deffnx {} BFD_RELOC_SH_GOTPLT32 +@deffnx {} BFD_RELOC_SH_SHMEDIA_CODE +@deffnx {} BFD_RELOC_SH_IMMU5 +@deffnx {} BFD_RELOC_SH_IMMS6 +@deffnx {} BFD_RELOC_SH_IMMS6BY32 +@deffnx {} BFD_RELOC_SH_IMMU6 +@deffnx {} BFD_RELOC_SH_IMMS10 +@deffnx {} BFD_RELOC_SH_IMMS10BY2 +@deffnx {} BFD_RELOC_SH_IMMS10BY4 +@deffnx {} BFD_RELOC_SH_IMMS10BY8 +@deffnx {} BFD_RELOC_SH_IMMS16 +@deffnx {} BFD_RELOC_SH_IMMU16 +@deffnx {} BFD_RELOC_SH_IMM_LOW16 +@deffnx {} BFD_RELOC_SH_IMM_LOW16_PCREL +@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16 +@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16_PCREL +@deffnx {} BFD_RELOC_SH_IMM_MEDHI16 +@deffnx {} BFD_RELOC_SH_IMM_MEDHI16_PCREL +@deffnx {} BFD_RELOC_SH_IMM_HI16 +@deffnx {} BFD_RELOC_SH_IMM_HI16_PCREL +@deffnx {} BFD_RELOC_SH_PT_16 Hitachi SH relocs. Not all of these appear in object files. @end deffn @deffn {} BFD_RELOC_THUMB_PCREL_BRANCH9 diff -Nur binutils-2.12/bfd/dwarf2.c binutils-2.12.1/bfd/dwarf2.c --- binutils-2.12/bfd/dwarf2.c Wed Jan 30 05:28:47 2002 +++ binutils-2.12.1/bfd/dwarf2.c Thu May 9 10:48:54 2002 @@ -42,7 +42,7 @@ { bfd_vma total_length; unsigned short version; - unsigned int prologue_length; + bfd_vma prologue_length; unsigned char minimum_instruction_length; unsigned char default_is_stmt; int line_base; @@ -225,7 +225,7 @@ static struct abbrev_info *lookup_abbrev PARAMS ((unsigned int, struct abbrev_info **)); static struct abbrev_info **read_abbrevs - PARAMS ((bfd *, unsigned int, struct dwarf2_debug *)); + PARAMS ((bfd *, bfd_vma, struct dwarf2_debug *)); static char *read_attribute PARAMS ((struct attribute *, struct attr_abbrev *, struct comp_unit *, char *)); @@ -240,9 +240,10 @@ static struct line_info_table *decode_line_info PARAMS ((struct comp_unit *, struct dwarf2_debug *)); static boolean lookup_address_in_line_info_table - PARAMS ((struct line_info_table *, bfd_vma, const char **, unsigned int *)); + PARAMS ((struct line_info_table *, bfd_vma, struct funcinfo *, + const char **, unsigned int *)); static boolean lookup_address_in_function_table - PARAMS ((struct funcinfo *, bfd_vma, const char **)); + PARAMS ((struct funcinfo *, bfd_vma, struct funcinfo **, const char **)); static boolean scan_unit_for_functions PARAMS ((struct comp_unit *)); static bfd_vma find_rela_addend PARAMS ((bfd *, asection *, bfd_size_type, asymbol**)); @@ -395,8 +396,8 @@ if (offset >= stash->dwarf_str_size) { - (*_bfd_error_handler) (_("Dwarf Error: DW_FORM_strp offset (%u) greater than or equal to .debug_str size (%u)."), - offset, stash->dwarf_str_size); + (*_bfd_error_handler) (_("Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str size (%lu)."), + (unsigned long) offset, stash->dwarf_str_size); bfd_set_error (bfd_error_bad_value); return NULL; } @@ -522,7 +523,7 @@ static struct abbrev_info** read_abbrevs (abfd, offset, stash) bfd * abfd; - unsigned int offset; + bfd_vma offset; struct dwarf2_debug *stash; { struct abbrev_info **abbrevs; @@ -556,8 +557,8 @@ if (offset >= stash->dwarf_abbrev_size) { - (*_bfd_error_handler) (_("Dwarf Error: Abbrev offset (%u) greater than or equal to .debug_abbrev size (%u)."), - offset, stash->dwarf_abbrev_size); + (*_bfd_error_handler) (_("Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size (%lu)."), + (unsigned long) offset, stash->dwarf_abbrev_size); bfd_set_error (bfd_error_bad_value); return 0; } @@ -753,7 +754,7 @@ info_ptr = read_attribute_value (attr, form, unit, info_ptr); break; default: - (*_bfd_error_handler) (_("Dwarf Error: Invalid or unhandled FORM value: %d."), + (*_bfd_error_handler) (_("Dwarf Error: Invalid or unhandled FORM value: %u."), form); bfd_set_error (bfd_error_bad_value); } @@ -808,6 +809,14 @@ struct line_info* last_line; }; +struct funcinfo +{ + struct funcinfo *prev_func; + char* name; + bfd_vma low; + bfd_vma high; +}; + static void add_line_info (table, address, filename, line, column, end_sequence) struct line_info_table* table; @@ -949,7 +958,7 @@ below. */ if (unit->line_offset >= stash->dwarf_line_size) { - (*_bfd_error_handler) (_("Dwarf Error: Line offset (%u) greater than or equal to .debug_line size (%u)."), + (*_bfd_error_handler) (_("Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)."), unit->line_offset, stash->dwarf_line_size); bfd_set_error (bfd_error_bad_value); return 0; @@ -1215,10 +1224,12 @@ static boolean lookup_address_in_line_info_table (table, addr, + function, filename_ptr, linenumber_ptr) struct line_info_table* table; bfd_vma addr; + struct funcinfo *function; const char **filename_ptr; unsigned int *linenumber_ptr; { @@ -1235,35 +1246,53 @@ if (!each_line->end_sequence && addr >= each_line->address && addr < next_line->address) { - *filename_ptr = each_line->filename; - *linenumber_ptr = each_line->line; + /* If this line appears to span functions, and addr is in the + later function, return the first line of that function instead + of the last line of the earlier one. This check is for GCC + 2.95, which emits the first line number for a function late. */ + if (function != NULL + && each_line->address < function->low + && next_line->address > function->low) + { + *filename_ptr = next_line->filename; + *linenumber_ptr = next_line->line; + } + else + { + *filename_ptr = each_line->filename; + *linenumber_ptr = each_line->line; + } return true; } next_line = each_line; each_line = each_line->prev_line; } + /* At this point each_line is NULL but next_line is not. If we found the + containing function in this compilation unit, return the first line we + have a number for. This is also for compatibility with GCC 2.95. */ + if (function != NULL) + { + *filename_ptr = next_line->filename; + *linenumber_ptr = next_line->line; + return true; + } + return false; } /* Function table functions. */ -struct funcinfo -{ - struct funcinfo *prev_func; - char* name; - bfd_vma low; - bfd_vma high; -}; - /* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return true. */ static boolean lookup_address_in_function_table (table, addr, + function_ptr, functionname_ptr) struct funcinfo* table; bfd_vma addr; + struct funcinfo** function_ptr; const char **functionname_ptr; { struct funcinfo* each_func; @@ -1275,6 +1304,7 @@ if (addr >= each_func->low && addr < each_func->high) { *functionname_ptr = each_func->name; + *function_ptr = each_func; return true; } } @@ -1315,7 +1345,7 @@ abbrev = lookup_abbrev (abbrev_number,unit->abbrevs); if (! abbrev) { - (*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %d."), + (*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %u."), abbrev_number); bfd_set_error (bfd_error_bad_value); return false; @@ -1456,9 +1486,9 @@ unsigned int offset_size; { struct comp_unit* unit; - unsigned short version; - unsigned int abbrev_offset = 0; - unsigned char addr_size; + unsigned int version; + bfd_vma abbrev_offset = 0; + unsigned int addr_size; struct abbrev_info** abbrevs; unsigned int abbrev_number, bytes_read, i; struct abbrev_info *abbrev; @@ -1487,7 +1517,7 @@ if (version != 2) { - (*_bfd_error_handler) (_("Dwarf Error: found dwarf version '%hu', this reader only handles version 2 information."), version); + (*_bfd_error_handler) (_("Dwarf Error: found dwarf version '%u', this reader only handles version 2 information."), version); bfd_set_error (bfd_error_bad_value); return 0; } @@ -1496,7 +1526,7 @@ { (*_bfd_error_handler) (_("Dwarf Error: found address size '%u', this reader can not handle sizes greater than '%u'."), addr_size, - sizeof (bfd_vma)); + (unsigned int) sizeof (bfd_vma)); bfd_set_error (bfd_error_bad_value); return 0; } @@ -1517,7 +1547,7 @@ info_ptr += bytes_read; if (! abbrev_number) { - (*_bfd_error_handler) (_("Dwarf Error: Bad abbrev number: %d."), + (*_bfd_error_handler) (_("Dwarf Error: Bad abbrev number: %u."), abbrev_number); bfd_set_error (bfd_error_bad_value); return 0; @@ -1526,7 +1556,7 @@ abbrev = lookup_abbrev (abbrev_number, abbrevs); if (! abbrev) { - (*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %d."), + (*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %u."), abbrev_number); bfd_set_error (bfd_error_bad_value); return 0; @@ -1636,6 +1666,7 @@ { boolean line_p; boolean func_p; + struct funcinfo *function; if (unit->error) return false; @@ -1664,13 +1695,16 @@ } } + function = NULL; + func_p = lookup_address_in_function_table (unit->function_table, + addr, + &function, + functionname_ptr); line_p = lookup_address_in_line_info_table (unit->line_table, addr, + function, filename_ptr, linenumber_ptr); - func_p = lookup_address_in_function_table (unit->function_table, - addr, - functionname_ptr); return line_p || func_p; } diff -Nur binutils-2.12/bfd/ecoff.c binutils-2.12.1/bfd/ecoff.c --- binutils-2.12/bfd/ecoff.c Wed Oct 10 08:08:28 2001 +++ binutils-2.12.1/bfd/ecoff.c Thu Apr 4 11:20:31 2002 @@ -1,5 +1,5 @@ /* Generic ECOFF (Extended-COFF) routines. - Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 + Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -4393,6 +4393,13 @@ bfd *output_bfd = einfo->abfd; boolean strip; + if (h->root.type == bfd_link_hash_warning) + { + h = (struct ecoff_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return true; + } + /* We need to check if this symbol is being stripped. */ if (h->root.type == bfd_link_hash_undefined || h->root.type == bfd_link_hash_undefweak) @@ -4474,6 +4481,7 @@ switch (h->root.type) { default: + case bfd_link_hash_warning: case bfd_link_hash_new: abort (); case bfd_link_hash_undefined: @@ -4502,9 +4510,8 @@ h->esym.asym.value = h->root.u.c.size; break; case bfd_link_hash_indirect: - case bfd_link_hash_warning: - /* FIXME: Ignore these for now. The circumstances under which - they should be written out are not clear to me. */ + /* We ignore these symbols, since the indirected symbol is + already in the hash table. */ return true; } diff -Nur binutils-2.12/bfd/elf-bfd.h binutils-2.12.1/bfd/elf-bfd.h --- binutils-2.12/bfd/elf-bfd.h Mon Jan 21 05:29:07 2002 +++ binutils-2.12.1/bfd/elf-bfd.h Thu May 9 10:48:54 2002 @@ -788,6 +788,11 @@ section. */ unsigned default_use_rela_p : 1; + /* Set if RELA relocations for a relocatable link can be handled by + generic code. Backends that set this flag need do nothing in the + backend relocate_section routine for relocatable linking. */ + unsigned rela_normal : 1; + /* True if addresses "naturally" sign extend. This is used when swapping in from Elf32 when BFD64. */ unsigned sign_extend_vma : 1; @@ -1531,6 +1536,8 @@ PARAMS ((bfd *, char *, int *, void *, int)); extern char *elfcore_write_prxfpreg PARAMS ((bfd *, char *, int *, void *, int)); +extern char *elfcore_write_lwpstatus + PARAMS ((bfd*, char*, int*, long, int, void*)); /* MIPS ELF specific routines. */ diff -Nur binutils-2.12/bfd/elf-eh-frame.c binutils-2.12.1/bfd/elf-eh-frame.c --- binutils-2.12/bfd/elf-eh-frame.c Tue Feb 19 08:10:18 2002 +++ binutils-2.12.1/bfd/elf-eh-frame.c Fri Apr 26 10:24:38 2002 @@ -64,6 +64,7 @@ unsigned char removed : 1; unsigned char make_relative : 1; unsigned char make_lsda_relative : 1; + unsigned char per_encoding_relative : 1; }; struct eh_frame_sec_info @@ -469,6 +470,8 @@ = cie.make_relative; sec_info->entry[last_cie_ndx].make_lsda_relative = cie.make_lsda_relative; + sec_info->entry[last_cie_ndx].per_encoding_relative + = (cie.per_encoding & 0x70) == DW_EH_PE_pcrel; } } @@ -633,8 +636,9 @@ else { if (info->shared - && (cie.fde_encoding & 0xf0) == DW_EH_PE_absptr - && cie.make_relative == 0) + && (((cie.fde_encoding & 0xf0) == DW_EH_PE_absptr + && cie.make_relative == 0) + || (cie.fde_encoding & 0xf0) == DW_EH_PE_aligned)) { /* If shared library uses absolute pointers which we cannot turn into PC relative, @@ -689,6 +693,7 @@ { sec_info->entry[i].make_relative = make_relative; sec_info->entry[i].make_lsda_relative = make_lsda_relative; + sec_info->entry[i].per_encoding_relative = 0; } } else if (sec_info->entry[i].cie && sec_info->entry[i].sec == sec) @@ -947,7 +952,8 @@ /* CIE */ cie_offset = sec_info->entry[i].new_offset; if (sec_info->entry[i].make_relative - || sec_info->entry[i].make_lsda_relative) + || sec_info->entry[i].make_lsda_relative + || sec_info->entry[i].per_encoding_relative) { unsigned char *aug; unsigned int action; @@ -956,7 +962,8 @@ /* Need to find 'R' or 'L' augmentation's argument and modify DW_EH_PE_* value. */ action = (sec_info->entry[i].make_relative ? 1 : 0) - | (sec_info->entry[i].make_lsda_relative ? 2 : 0); + | (sec_info->entry[i].make_lsda_relative ? 2 : 0) + | (sec_info->entry[i].per_encoding_relative ? 4 : 0); buf = contents + sec_info->entry[i].offset; /* Skip length, id and version. */ buf += 9; @@ -988,10 +995,22 @@ per_width = get_DW_EH_PE_width (per_encoding, ptr_size); BFD_ASSERT (per_width != 0); + BFD_ASSERT (((per_encoding & 0x70) == DW_EH_PE_pcrel) + == sec_info->entry[i].per_encoding_relative); if ((per_encoding & 0xf0) == DW_EH_PE_aligned) buf = (contents + ((buf - contents + per_width - 1) & ~((bfd_size_type) per_width - 1))); + if (action & 4) + { + bfd_vma value; + + value = read_value (abfd, buf, per_width); + value += (sec_info->entry[i].offset + - sec_info->entry[i].new_offset); + write_value (abfd, buf, value, per_width); + action &= ~4; + } buf += per_width; break; case 'R': @@ -1008,7 +1027,7 @@ } } } - else + else if (sec_info->entry[i].size > 4) { /* FDE */ bfd_vma value = 0, address; @@ -1081,6 +1100,9 @@ } } } + else + /* Terminating FDE must be at the end of .eh_frame section only. */ + BFD_ASSERT (i == sec_info->count - 1); BFD_ASSERT (p == contents + sec_info->entry[i].new_offset); memmove (p, contents + sec_info->entry[i].offset, diff -Nur binutils-2.12/bfd/elf-hppa.h binutils-2.12.1/bfd/elf-hppa.h --- binutils-2.12/bfd/elf-hppa.h Sun Feb 17 18:12:07 2002 +++ binutils-2.12.1/bfd/elf-hppa.h Thu May 9 10:48:54 2002 @@ -64,6 +64,12 @@ static void elf_hppa_final_write_processing PARAMS ((bfd *, boolean)); +static int hppa_unwind_entry_compare + PARAMS ((const PTR, const PTR)); + +static boolean elf_hppa_sort_unwind + PARAMS ((bfd *)); + #if ARCH_SIZE == 64 static boolean elf_hppa_add_symbol_hook PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, @@ -75,6 +81,9 @@ static boolean elf_hppa_remark_useless_dynamic_symbols PARAMS ((struct elf_link_hash_entry *, PTR)); +static boolean elf_hppa_is_dynamic_loader_symbol + PARAMS ((const char *)); + static void elf_hppa_record_segment_addrs PARAMS ((bfd *, asection *, PTR)); @@ -83,12 +92,12 @@ static boolean elf_hppa_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, - bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); + bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); static bfd_reloc_status_type elf_hppa_final_link_relocate PARAMS ((Elf_Internal_Rela *, bfd *, bfd *, asection *, - bfd_byte *, bfd_vma, struct bfd_link_info *, - asection *, struct elf_link_hash_entry *, + bfd_byte *, bfd_vma, struct bfd_link_info *, + asection *, struct elf_link_hash_entry *, struct elf64_hppa_dyn_hash_entry *)); static int elf_hppa_relocate_insn @@ -706,7 +715,7 @@ be a section relative relocation. Dwarf2 (for example) uses 32bit section relative relocations. */ if (bfd_get_arch_info (abfd)->bits_per_address != 32) - final_type = R_PARISC_SECREL32; + final_type = R_PARISC_SECREL32; break; case e_psel: final_type = R_PARISC_PLABEL32; @@ -1034,6 +1043,64 @@ | EF_PARISC_TRAPNIL); } +/* Comparison function for qsort to sort unwind section during a + final link. */ + +static int +hppa_unwind_entry_compare (a, b) + const PTR a; + const PTR b; +{ + const bfd_byte *ap, *bp; + unsigned long av, bv; + + ap = (const bfd_byte *) a; + av = (unsigned long) ap[0] << 24; + av |= (unsigned long) ap[1] << 16; + av |= (unsigned long) ap[2] << 8; + av |= (unsigned long) ap[3]; + + bp = (const bfd_byte *) b; + bv = (unsigned long) bp[0] << 24; + bv |= (unsigned long) bp[1] << 16; + bv |= (unsigned long) bp[2] << 8; + bv |= (unsigned long) bp[3]; + + return av < bv ? -1 : av > bv ? 1 : 0; +} + +static boolean elf_hppa_sort_unwind (abfd) + bfd *abfd; +{ + asection *s; + + /* Magic section names, but this is much safer than having + relocate_section remember where SEGREL32 relocs occurred. + Consider what happens if someone inept creates a linker script + that puts unwind information in .text. */ + s = bfd_get_section_by_name (abfd, ".PARISC.unwind"); + if (s != NULL) + { + bfd_size_type size; + char *contents; + + size = s->_raw_size; + contents = bfd_malloc (size); + if (contents == NULL) + return false; + + if (! bfd_get_section_contents (abfd, s, contents, (file_ptr) 0, size)) + return false; + + qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare); + + if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size)) + return false; + } + + return true; +} + #if ARCH_SIZE == 64 /* Hook called by the linker routine which adds symbols from an object file. HP's libraries define symbols with HP specific section @@ -1076,6 +1143,9 @@ { struct bfd_link_info *info = (struct bfd_link_info *)data; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* If we are not creating a shared library, and this symbol is referenced by a shared library but is not defined anywhere, then the generic code will warn that it is undefined. @@ -1109,6 +1179,9 @@ { struct bfd_link_info *info = (struct bfd_link_info *)data; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* If we are not creating a shared library, and this symbol is referenced by a shared library but is not defined anywhere, then the generic code will warn that it is undefined. @@ -1136,6 +1209,23 @@ return true; } +static boolean +elf_hppa_is_dynamic_loader_symbol (name) + const char * name; +{ + return (! strcmp (name, "__CPU_REVISION") + || ! strcmp (name, "__CPU_KEYBITS_1") + || ! strcmp (name, "__SYSTEM_ID_D") + || ! strcmp (name, "__FPU_MODEL") + || ! strcmp (name, "__FPU_REVISION") + || ! strcmp (name, "__ARGC") + || ! strcmp (name, "__ARGV") + || ! strcmp (name, "__ENVP") + || ! strcmp (name, "__TLS_SIZE_D") + || ! strcmp (name, "__LOAD_INFO") + || ! strcmp (name, "__systab")); +} + /* Record the lowest address for the data and text segments. */ static void elf_hppa_record_segment_addrs (abfd, section, data) @@ -1258,6 +1348,11 @@ elf_hppa_remark_useless_dynamic_symbols, info); + /* If we're producing a final executable, sort the contents of the + unwind section. */ + if (retval) + retval = elf_hppa_sort_unwind (abfd); + return retval; } @@ -1390,7 +1485,7 @@ relocation = 0; } /* Allow undefined symbols in shared libraries. */ - else if (info->shared && !info->no_undefined + else if (info->shared && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) { if (info->symbolic) @@ -1419,11 +1514,17 @@ relocation = 0; else { - if (!((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, true))) - return false; - break; + /* Ignore dynamic loader defined symbols. */ + if (elf_hppa_is_dynamic_loader_symbol (h->root.root.string)) + relocation = 0; + else + { + if (!((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, true))) + return false; + break; + } } } @@ -1620,11 +1721,7 @@ a local function which had its address taken. */ if (dyn_h->h == NULL) { - bfd_put_64 (hppa_info->dlt_sec->owner, - value, - hppa_info->dlt_sec->contents + dyn_h->dlt_offset); - - /* Now handle .opd creation if needed. */ + /* Now do .opd creation if needed. */ if (r_type == R_PARISC_LTOFF_FPTR14R || r_type == R_PARISC_LTOFF_FPTR14DR || r_type == R_PARISC_LTOFF_FPTR14WR @@ -1638,7 +1735,7 @@ 0, 16); /* The next word is the address of the function. */ - bfd_put_64 (hppa_info->opd_sec->owner, value, + bfd_put_64 (hppa_info->opd_sec->owner, value + addend, (hppa_info->opd_sec->contents + dyn_h->opd_offset + 16)); @@ -1648,7 +1745,17 @@ bfd_put_64 (hppa_info->opd_sec->owner, value, (hppa_info->opd_sec->contents + dyn_h->opd_offset + 24)); + + /* The DLT value is the address of the .opd entry. */ + value = (dyn_h->opd_offset + + hppa_info->opd_sec->output_offset + + hppa_info->opd_sec->output_section->vma); + addend = 0; } + + bfd_put_64 (hppa_info->dlt_sec->owner, + value + addend, + hppa_info->dlt_sec->contents + dyn_h->dlt_offset); } /* We want the value of the DLT offset for this symbol, not @@ -1666,7 +1773,7 @@ if (r_type == R_PARISC_DLTIND21L || r_type == R_PARISC_LTOFF_FPTR21L || r_type == R_PARISC_LTOFF_TP21L) - value = hppa_field_adjust (value, addend, e_lrsel); + value = hppa_field_adjust (value, 0, e_lsel); else if (r_type == R_PARISC_DLTIND14F || r_type == R_PARISC_LTOFF_FPTR16F || r_type == R_PARISC_LTOFF_FPTR16WF @@ -1677,9 +1784,9 @@ || r_type == R_PARISC_LTOFF_TP16F || r_type == R_PARISC_LTOFF_TP16WF || r_type == R_PARISC_LTOFF_TP16DF) - value = hppa_field_adjust (value, addend, e_fsel); + value = hppa_field_adjust (value, 0, e_fsel); else - value = hppa_field_adjust (value, addend, e_rrsel); + value = hppa_field_adjust (value, 0, e_rsel); insn = elf_hppa_relocate_insn (insn, (int) value, r_type); break; @@ -1804,7 +1911,7 @@ memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16); /* The next word is the address of the function. */ - bfd_put_64 (hppa_info->opd_sec->owner, value, + bfd_put_64 (hppa_info->opd_sec->owner, value + addend, (hppa_info->opd_sec->contents + dyn_h->opd_offset + 16)); @@ -1813,6 +1920,15 @@ (hppa_info->opd_sec->output_section->owner); bfd_put_64 (hppa_info->opd_sec->owner, value, hppa_info->opd_sec->contents + dyn_h->opd_offset + 24); + + /* The DLT value is the address of the .opd entry. */ + value = (dyn_h->opd_offset + + hppa_info->opd_sec->output_offset + + hppa_info->opd_sec->output_section->vma); + + bfd_put_64 (hppa_info->dlt_sec->owner, + value, + hppa_info->dlt_sec->contents + dyn_h->dlt_offset); } /* We want the value of the DLT offset for this symbol, not @@ -1838,7 +1954,7 @@ memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16); /* The next word is the address of the function. */ - bfd_put_64 (hppa_info->opd_sec->owner, value, + bfd_put_64 (hppa_info->opd_sec->owner, value + addend, (hppa_info->opd_sec->contents + dyn_h->opd_offset + 16)); @@ -1847,6 +1963,15 @@ (hppa_info->opd_sec->output_section->owner); bfd_put_64 (hppa_info->opd_sec->owner, value, hppa_info->opd_sec->contents + dyn_h->opd_offset + 24); + + /* The DLT value is the address of the .opd entry. */ + value = (dyn_h->opd_offset + + hppa_info->opd_sec->output_offset + + hppa_info->opd_sec->output_section->vma); + + bfd_put_64 (hppa_info->dlt_sec->owner, + value, + hppa_info->dlt_sec->contents + dyn_h->dlt_offset); } /* We want the value of the DLT offset for this symbol, not @@ -1938,7 +2063,7 @@ memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16); /* The next word is the address of the function. */ - bfd_put_64 (hppa_info->opd_sec->owner, value, + bfd_put_64 (hppa_info->opd_sec->owner, value + addend, (hppa_info->opd_sec->contents + dyn_h->opd_offset + 16)); @@ -1950,12 +2075,12 @@ } /* We want the value of the OPD offset for this symbol, not - the symbol's actual address. */ + the symbol's actual address. */ value = (dyn_h->opd_offset + hppa_info->opd_sec->output_offset + hppa_info->opd_sec->output_section->vma); - bfd_put_64 (input_bfd, value + addend, hit_data); + bfd_put_64 (input_bfd, value, hit_data); return bfd_reloc_ok; } @@ -1991,7 +2116,7 @@ bfd_put_32 (input_bfd, value, hit_data); else bfd_put_64 (input_bfd, value, hit_data); - return bfd_reloc_ok; + return bfd_reloc_ok; } /* Something we don't know how to handle. */ diff -Nur binutils-2.12/bfd/elf-m10200.c binutils-2.12.1/bfd/elf-m10200.c --- binutils-2.12/bfd/elf-m10200.c Sun Dec 16 19:52:34 2001 +++ binutils-2.12.1/bfd/elf-m10200.c Thu May 9 10:48:54 2002 @@ -1,5 +1,5 @@ /* Matsushita 10200 specific support for 32-bit ELF - Copyright 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -347,6 +347,9 @@ struct elf_link_hash_entry **sym_hashes; Elf_Internal_Rela *rel, *relend; + if (info->relocateable) + return true; + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -367,26 +370,6 @@ r_type = ELF32_R_TYPE (rel->r_info); howto = elf_mn10200_howto_table + r_type; - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -1572,6 +1555,7 @@ #define ELF_MACHINE_ALT1 EM_CYGNUS_MN10200 #define ELF_MAXPAGESIZE 0x1000 +#define elf_backend_rela_normal 1 #define elf_info_to_howto mn10200_info_to_howto #define elf_info_to_howto_rel 0 #define elf_backend_relocate_section mn10200_elf_relocate_section diff -Nur binutils-2.12/bfd/elf-m10300.c binutils-2.12.1/bfd/elf-m10300.c --- binutils-2.12/bfd/elf-m10300.c Tue Feb 12 04:24:00 2002 +++ binutils-2.12.1/bfd/elf-m10300.c Thu May 9 10:48:54 2002 @@ -551,6 +551,9 @@ struct elf32_mn10300_link_hash_entry **sym_hashes; Elf_Internal_Rela *rel, *relend; + if (info->relocateable) + return true; + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = (struct elf32_mn10300_link_hash_entry **) (elf_sym_hashes (input_bfd)); @@ -577,26 +580,6 @@ || r_type == R_MN10300_GNU_VTENTRY) continue; - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -709,6 +692,9 @@ entry = (struct elf32_mn10300_link_hash_entry *) gen_entry; + if (entry->root.root.type == bfd_link_hash_warning) + entry = (struct elf32_mn10300_link_hash_entry *) entry->root.root.u.i.link; + /* If we already know we want to convert "call" to "calls" for calls to this symbol, then return now. */ if (entry->flags == MN10300_CONVERT_CALL_TO_CALLS) @@ -3081,6 +3067,7 @@ #define elf_info_to_howto mn10300_info_to_howto #define elf_info_to_howto_rel 0 #define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 #define elf_backend_check_relocs mn10300_elf_check_relocs #define elf_backend_gc_mark_hook mn10300_elf_gc_mark_hook #define elf_backend_relocate_section mn10300_elf_relocate_section diff -Nur binutils-2.12/bfd/elf.c binutils-2.12.1/bfd/elf.c --- binutils-2.12/bfd/elf.c Wed Feb 13 23:12:45 2002 +++ binutils-2.12.1/bfd/elf.c Thu May 9 10:48:54 2002 @@ -652,27 +652,44 @@ offset plus size lies within the segment's memory span and, if the section is loaded, the extent of the loaded data lies within the extent of the segment. - If the p_paddr field is not set, we don't alter the - LMA. */ + + Note - we used to check the p_paddr field as well, and + refuse to set the LMA if it was 0. This is wrong + though, as a perfectly valid initialised segment can + have a p_paddr of zero. Some architectures, eg ARM, + place special significance on the address 0 and + executables need to be able to have a segment which + covers this address. */ if (phdr->p_type == PT_LOAD - && phdr->p_paddr && (bfd_vma) hdr->sh_offset >= phdr->p_offset && (hdr->sh_offset + hdr->sh_size <= phdr->p_offset + phdr->p_memsz) && ((flags & SEC_LOAD) == 0 - || (phdr->p_offset + phdr->p_filesz - >= hdr->sh_offset + hdr->sh_size))) + || (hdr->sh_offset + hdr->sh_size + <= phdr->p_offset + phdr->p_filesz))) { - /* We used to do a relative adjustment here, but - that doesn't work if the segment is packed with - code from multiple VMAs. Instead we calculate - the LMA absoultely, based on the LMA of the - segment (it is assumed that the segment will - contain sections with contiguous LMAs, even if - the VMAs are not). */ - newsect->lma = phdr->p_paddr - + hdr->sh_offset - phdr->p_offset; - break; + if ((flags & SEC_LOAD) == 0) + newsect->lma = (phdr->p_paddr + + hdr->sh_addr - phdr->p_vaddr); + else + /* We used to use the same adjustment for SEC_LOAD + sections, but that doesn't work if the segment + is packed with code from multiple VMAs. + Instead we calculate the section LMA based on + the segment LMA. It is assumed that the + segment will contain sections with contiguous + LMAs, even if the VMAs are not. */ + newsect->lma = (phdr->p_paddr + + hdr->sh_offset - phdr->p_offset); + + /* With contiguous segments, we can't tell from file + offsets whether a section with zero size should + be placed at the end of one segment or the + beginning of the next. Decide based on vaddr. */ + if (hdr->sh_addr >= phdr->p_vaddr + && (hdr->sh_addr + hdr->sh_size + <= phdr->p_vaddr + phdr->p_memsz)) + break; } } } @@ -1558,6 +1575,9 @@ case SHT_NOBITS: /* .bss section. */ case SHT_HASH: /* .hash section. */ case SHT_NOTE: /* .note section. */ + case SHT_INIT_ARRAY: /* .init_array section. */ + case SHT_FINI_ARRAY: /* .fini_array section. */ + case SHT_PREINIT_ARRAY: /* .preinit_array section. */ return _bfd_elf_make_section_from_shdr (abfd, hdr, name); case SHT_SYMTAB: /* A symbol table */ @@ -2172,6 +2192,12 @@ this_hdr->sh_type = SHT_REL; this_hdr->sh_entsize = bed->s->sizeof_rel; } + else if (strcmp (asect->name, ".init_array") == 0) + this_hdr->sh_type = SHT_INIT_ARRAY; + else if (strcmp (asect->name, ".fini_array") == 0) + this_hdr->sh_type = SHT_FINI_ARRAY; + else if (strcmp (asect->name, ".preinit_array") == 0) + this_hdr->sh_type = SHT_PREINIT_ARRAY; else if (strncmp (asect->name, ".note", 5) == 0) this_hdr->sh_type = SHT_NOTE; else if (strncmp (asect->name, ".stab", 5) == 0 @@ -3855,7 +3881,6 @@ Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */ Elf_Internal_Phdr *i_phdrp = 0; /* Program header table, internal form */ Elf_Internal_Shdr **i_shdrp; /* Section header table, internal form */ - int count; struct elf_strtab_hash *shstrtab; struct elf_backend_data *bed = get_elf_backend_data (abfd); @@ -3878,12 +3903,6 @@ bfd_big_endian (abfd) ? ELFDATA2MSB : ELFDATA2LSB; i_ehdrp->e_ident[EI_VERSION] = bed->s->ev_current; - i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_NONE; - i_ehdrp->e_ident[EI_ABIVERSION] = 0; - - for (count = EI_PAD; count < EI_NIDENT; count++) - i_ehdrp->e_ident[count] = 0; - if ((abfd->flags & DYNAMIC) != 0) i_ehdrp->e_type = ET_DYN; else if ((abfd->flags & EXEC_P) != 0) @@ -5096,7 +5115,9 @@ Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->symtab_hdr; symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym; - symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *)); + symtab_size = (symcount + 1) * (sizeof (asymbol *)); + if (symcount > 0) + symtab_size -= sizeof (asymbol *); return symtab_size; } @@ -5116,7 +5137,9 @@ } symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym; - symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *)); + symtab_size = (symcount + 1) * (sizeof (asymbol *)); + if (symcount > 0) + symtab_size -= sizeof (asymbol *); return symtab_size; } @@ -6149,6 +6172,8 @@ #endif /* defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) */ #if defined (HAVE_PSTATUS_T) +static boolean elfcore_grok_pstatus PARAMS ((bfd *, Elf_Internal_Note *)); + static boolean elfcore_grok_pstatus (abfd, note) bfd *abfd; @@ -6186,6 +6211,8 @@ #endif /* defined (HAVE_PSTATUS_T) */ #if defined (HAVE_LWPSTATUS_T) +static boolean elfcore_grok_lwpstatus PARAMS ((bfd *, Elf_Internal_Note *)); + static boolean elfcore_grok_lwpstatus (abfd, note) bfd *abfd; @@ -6416,7 +6443,7 @@ cp = strchr (note->namedata, '@'); if (cp != NULL) { - *lwpidp = atoi(cp); + *lwpidp = atoi(cp + 1); return true; } return false; @@ -6599,6 +6626,38 @@ } #endif /* HAVE_PRSTATUS_T */ +#if defined (HAVE_LWPSTATUS_T) +char * +elfcore_write_lwpstatus (abfd, buf, bufsiz, pid, cursig, gregs) + bfd *abfd; + char *buf; + int *bufsiz; + long pid; + int cursig; + void *gregs; +{ + lwpstatus_t lwpstat; + char *note_name = "CORE"; + + memset (&lwpstat, 0, sizeof (lwpstat)); + lwpstat.pr_lwpid = pid >> 16; + lwpstat.pr_cursig = cursig; +#if defined (HAVE_LWPSTATUS_T_PR_REG) + memcpy (lwpstat.pr_reg, gregs, sizeof (lwpstat.pr_reg)); +#elif defined (HAVE_LWPSTATUS_T_PR_CONTEXT) +#if !defined(gregs) + memcpy (lwpstat.pr_context.uc_mcontext.gregs, + gregs, sizeof (lwpstat.pr_context.uc_mcontext.gregs)); +#else + memcpy (lwpstat.pr_context.uc_mcontext.__gregs, + gregs, sizeof (lwpstat.pr_context.uc_mcontext.__gregs)); +#endif +#endif + return elfcore_write_note (abfd, buf, bufsiz, note_name, + NT_LWPSTATUS, &lwpstat, sizeof (lwpstat)); +} +#endif /* HAVE_LWPSTATUS_T */ + #if defined (HAVE_PSTATUS_T) char * elfcore_write_pstatus (abfd, buf, bufsiz, pid, cursig, gregs) @@ -6612,11 +6671,11 @@ pstatus_t pstat; char *note_name = "CORE"; - memset (&pstat, 0, sizeof (prstat)); - pstat.pr_pid = pid; - memcpy (pstat.pr_reg, gregs, sizeof (pstat.pr_reg)); - return elfcore_write_note (abfd, buf, bufsiz, - note_name, NT_PSTATUS, &pstat, sizeof (pstat)); + memset (&pstat, 0, sizeof (pstat)); + pstat.pr_pid = pid & 0xffff; + buf = elfcore_write_note (abfd, buf, bufsiz, note_name, + NT_PSTATUS, &pstat, sizeof (pstat)); + return buf; } #endif /* HAVE_PSTATUS_T */ diff -Nur binutils-2.12/bfd/elf32-arm.h binutils-2.12.1/bfd/elf32-arm.h --- binutils-2.12/bfd/elf32-arm.h Tue Feb 19 08:10:19 2002 +++ binutils-2.12.1/bfd/elf32-arm.h Thu May 9 10:48:55 2002 @@ -1390,7 +1390,7 @@ boolean overflow = false; bfd_vma upper_insn = bfd_get_16 (input_bfd, hit_data); bfd_vma lower_insn = bfd_get_16 (input_bfd, hit_data + 2); - bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; + bfd_signed_vma reloc_signed_max = ((1 << (howto->bitsize - 1)) - 1) >> howto->rightshift; bfd_signed_vma reloc_signed_min = ~ reloc_signed_max; bfd_vma check; bfd_signed_vma signed_check; @@ -1560,6 +1560,12 @@ if (sgot == NULL) return bfd_reloc_notsupported; + /* If we are addressing a Thumb function, we need to adjust the + address by one, so that attempts to call the function pointer will + correctly interpret it as Thumb code. */ + if (sym_flags == STT_ARM_TFUNC) + value += 1; + /* Note that sgot->output_offset is not involved in this calculation. We always want the start of .got. If we define _GLOBAL_OFFSET_TABLE in a different way, as is @@ -1612,6 +1618,13 @@ off &= ~1; else { + /* If we are addressing a Thumb function, we need to + adjust the address by one, so that attempts to + call the function pointer will correctly + interpret it as Thumb code. */ + if (sym_flags == STT_ARM_TFUNC) + value |= 1; + bfd_put_32 (output_bfd, value, sgot->contents + off); h->got.offset |= 1; } @@ -1817,6 +1830,11 @@ Elf_Internal_Rela * relend; const char * name; +#ifndef USE_REL + if (info->relocateable) + return true; +#endif + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -1849,6 +1867,7 @@ #endif howto = bfd_reloc.howto; +#ifdef USE_REL if (info->relocateable) { /* This is a relocateable link. We don't have to change @@ -1861,19 +1880,16 @@ if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) { sec = local_sections[r_symndx]; -#ifdef USE_REL arm_add_to_rel (input_bfd, contents + rel->r_offset, howto, (bfd_signed_vma) (sec->output_offset + sym->st_value)); -#else - rel->r_addend += (sec->output_offset + sym->st_value); -#endif } } continue; } +#endif /* This is a final link. */ h = NULL; @@ -3275,6 +3291,9 @@ { struct elf32_arm_pcrel_relocs_copied * s; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf32_arm_link_hash_entry *) h->root.root.u.i.link; + /* We only discard relocs for symbols defined in a regular object. */ if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) return true; @@ -3621,6 +3640,9 @@ #define elf_backend_plt_readonly 1 #define elf_backend_want_got_plt 1 #define elf_backend_want_plt_sym 0 +#ifndef USE_REL +#define elf_backend_rela_normal 1 +#endif #define elf_backend_got_header_size 12 #define elf_backend_plt_header_size PLT_ENTRY_SIZE diff -Nur binutils-2.12/bfd/elf32-cris.c binutils-2.12.1/bfd/elf32-cris.c --- binutils-2.12/bfd/elf32-cris.c Tue Feb 19 08:10:19 2002 +++ binutils-2.12.1/bfd/elf32-cris.c Fri Apr 26 10:24:39 2002 @@ -180,7 +180,7 @@ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ - "R_CRIS_16", /* name */ + "R_CRIS_16_PCREL", /* name */ false, /* partial_inplace */ 0x00000000, /* src_mask */ 0x0000ffff, /* dst_mask */ @@ -195,7 +195,7 @@ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ - "R_CRIS_32", /* name */ + "R_CRIS_32_PCREL", /* name */ false, /* partial_inplace */ 0x00000000, /* src_mask */ 0xffffffff, /* dst_mask */ @@ -1930,6 +1930,9 @@ BFD_ASSERT (dynobj != NULL); + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link; + /* If nobody wanted a GOTPLT with this symbol, we're done. */ if (h->gotplt_refcount <= 0) return true; @@ -1954,28 +1957,9 @@ h->gotplt_refcount = -1; - /* We always have a .got section when there are dynamic - relocs. */ - BFD_ASSERT (sgot != NULL /* Surely have .got section. */); - - /* We might have had a PLT but with no GOT entry and - further no GOT reloc section at all needed before. - Add it. */ - if (srelgot == NULL) - { - srelgot = bfd_make_section (dynobj, ".rela.got"); - - if (srelgot == NULL - || !bfd_set_section_flags (dynobj, srelgot, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || !bfd_set_section_alignment (dynobj, srelgot, 2)) - return false; - } + /* We always have a .got and a .rela.got section if there were + GOTPLT relocs in input. */ + BFD_ASSERT (sgot != NULL && srelgot != NULL); /* Allocate space in the .got section. */ sgot->_raw_size += 4; @@ -2365,8 +2349,38 @@ specific GOT entry). */ switch (r_type) { + /* For R_CRIS_16_GOTPLT and R_CRIS_32_GOTPLT, we need a GOT + entry only for local symbols. Unfortunately, we don't know + until later on if there's a version script that forces the + symbol local. We must have the .rela.got section in place + before we know if the symbol looks global now, so we need + to treat the reloc just like for R_CRIS_16_GOT and + R_CRIS_32_GOT. */ + case R_CRIS_16_GOTPLT: + case R_CRIS_32_GOTPLT: case R_CRIS_16_GOT: case R_CRIS_32_GOT: + if (srelgot == NULL + && (h != NULL || info->shared)) + { + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + if (srelgot == NULL) + { + srelgot = bfd_make_section (dynobj, ".rela.got"); + if (srelgot == NULL + || !bfd_set_section_flags (dynobj, srelgot, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || !bfd_set_section_alignment (dynobj, srelgot, 2)) + return false; + } + } + /* Fall through. */ + case R_CRIS_32_GOTREL: case R_CRIS_32_PLT_GOTREL: if (sgot == NULL) @@ -2413,27 +2427,6 @@ case R_CRIS_16_GOT: case R_CRIS_32_GOT: /* This symbol requires a global offset table entry. */ - - if (srelgot == NULL - && (h != NULL || info->shared)) - { - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - if (srelgot == NULL) - { - srelgot = bfd_make_section (dynobj, ".rela.got"); - if (srelgot == NULL - || !bfd_set_section_flags (dynobj, srelgot, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || !bfd_set_section_alignment (dynobj, srelgot, 2)) - return false; - } - } - if (h != NULL) { if (h->got.refcount == 0) @@ -2881,6 +2874,9 @@ struct elf_cris_pcrel_relocs_copied *s; struct bfd_link_info *info = (struct bfd_link_info *) inf; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link; + /* If a symbol has been forced local or we have found a regular definition for the symbolic link case, then we won't be needing any relocs. */ @@ -2905,6 +2901,9 @@ PTR inf; { struct bfd_link_info *info = (struct bfd_link_info *) inf; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link; /* If we're not creating a shared library and have a symbol which is referred to by .got references, but the symbol is defined locally, diff -Nur binutils-2.12/bfd/elf32-fr30.c binutils-2.12.1/bfd/elf32-fr30.c --- binutils-2.12/bfd/elf32-fr30.c Sun Dec 16 19:52:35 2001 +++ binutils-2.12.1/bfd/elf32-fr30.c Thu May 9 10:48:55 2002 @@ -1,5 +1,5 @@ /* FR30-specific support for 32-bit ELF. - Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -517,6 +517,9 @@ Elf_Internal_Rela * rel; Elf_Internal_Rela * relend; + if (info->relocateable) + return true; + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; @@ -541,27 +544,6 @@ r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections [r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ howto = fr30_elf_howto_table + ELF32_R_TYPE (rel->r_info); h = NULL; sym = NULL; @@ -806,6 +788,7 @@ #define elf_backend_check_relocs fr30_elf_check_relocs #define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 #define bfd_elf32_bfd_reloc_type_lookup fr30_reloc_type_lookup diff -Nur binutils-2.12/bfd/elf32-hppa.c binutils-2.12.1/bfd/elf32-hppa.c --- binutils-2.12/bfd/elf32-hppa.c Tue Feb 19 08:10:20 2002 +++ binutils-2.12.1/bfd/elf32-hppa.c Thu May 9 10:48:56 2002 @@ -71,14 +71,14 @@ (single sub-space version) : addil LR'lt_ptr+ltoff,%dp ; get procedure entry point : ldw RR'lt_ptr+ltoff(%r1),%r21 - : bv %r0(%r21) + : bv %r0(%r21) : ldw RR'lt_ptr+ltoff+4(%r1),%r19 ; get new dlt value. Import stub to call shared library routine from shared library (single sub-space version) : addil LR'ltoff,%r19 ; get procedure entry point : ldw RR'ltoff(%r1),%r21 - : bv %r0(%r21) + : bv %r0(%r21) : ldw RR'ltoff+4(%r1),%r19 ; get new dlt value. Import stub to call shared library routine from normal object file @@ -203,9 +203,6 @@ #endif } *dyn_relocs; - /* Set during a static link if we detect a function is PIC. */ - unsigned int maybe_pic_call:1; - /* Set if the only reason we need a .plt entry is for a non-PIC to PIC function call. */ unsigned int pic_call:1; @@ -255,10 +252,11 @@ /* Whether we support multiple sub-spaces for shared libs. */ unsigned int multi_subspace:1; - /* Flags set when PCREL12F and PCREL17F branches detected. Used to + /* Flags set when various size branches are detected. Used to select suitable defaults for the stub group size. */ unsigned int has_12bit_branch:1; unsigned int has_17bit_branch:1; + unsigned int has_22bit_branch:1; /* Set if we need a .plt stub to support lazy dynamic linking. */ unsigned int need_plt_stub:1; @@ -373,9 +371,6 @@ PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); -static int hppa_unwind_entry_compare - PARAMS ((const PTR, const PTR)); - static boolean elf32_hppa_finish_dynamic_symbol PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, Elf_Internal_Sym *)); @@ -460,7 +455,6 @@ eh = (struct elf32_hppa_link_hash_entry *) entry; eh->stub_cache = NULL; eh->dyn_relocs = NULL; - eh->maybe_pic_call = 0; eh->pic_call = 0; eh->plabel = 0; } @@ -508,6 +502,7 @@ ret->multi_subspace = 0; ret->has_12bit_branch = 0; ret->has_17bit_branch = 0; + ret->has_22bit_branch = 0; ret->need_plt_stub = 0; ret->sym_sec.abfd = NULL; @@ -670,21 +665,12 @@ unsigned int r_type; if (hash != NULL - && (((hash->elf.root.type == bfd_link_hash_defined - || hash->elf.root.type == bfd_link_hash_defweak) - && hash->elf.root.u.def.section->output_section == NULL) - || (hash->elf.root.type == bfd_link_hash_defweak - && hash->elf.dynindx != -1 - && hash->elf.plt.offset != (bfd_vma) -1) - || hash->elf.root.type == bfd_link_hash_undefweak - || hash->elf.root.type == bfd_link_hash_undefined - || (hash->maybe_pic_call && !(input_sec->flags & SEC_HAS_GOT_REF)))) - { - /* If output_section is NULL, then it's a symbol defined in a - shared library. We will need an import stub. Decide between - hppa_stub_import and hppa_stub_import_shared later. For - shared links we need stubs for undefined or weak syms too; - They will presumably be resolved by the dynamic linker. */ + && hash->elf.plt.offset != (bfd_vma) -1 + && (hash->elf.dynindx != -1 || hash->pic_call) + && !hash->plabel) + { + /* We need an import stub. Decide between hppa_stub_import + and hppa_stub_import_shared later. */ return hppa_stub_import; } @@ -742,6 +728,7 @@ #define BE_SR0_R21 0xe2a00000 /* be 0(%sr0,%r21) */ #define STW_RP 0x6bc23fd1 /* stw %rp,-24(%sr0,%sp) */ +#define BL22_RP 0xe800a002 /* b,l,n XXX,%rp */ #define BL_RP 0xe8400002 /* b,l,n XXX,%rp */ #define NOP 0x08000240 /* nop */ #define LDW_RP 0x4bc23fd1 /* ldw -24(%sr0,%sp),%rp */ @@ -931,7 +918,9 @@ + stub_sec->output_offset + stub_sec->output_section->vma); - if (sym_value - 8 + 0x40000 >= 0x80000) + if (sym_value - 8 + (1 << (17 + 1)) >= (1 << (17 + 2)) + && (!htab->has_22bit_branch + || sym_value - 8 + (1 << (22 + 1)) >= (1 << (22 + 2)))) { (*_bfd_error_handler) (_("%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"), @@ -944,7 +933,10 @@ } val = hppa_field_adjust (sym_value, (bfd_signed_vma) -8, e_fsel) >> 2; - insn = hppa_rebuild_insn ((int) BL_RP, val, 17); + if (!htab->has_22bit_branch) + insn = hppa_rebuild_insn ((int) BL_RP, val, 17); + else + insn = hppa_rebuild_insn ((int) BL22_RP, val, 22); bfd_put_32 (stub_bfd, insn, loc); bfd_put_32 (stub_bfd, (bfd_vma) NOP, loc + 4); @@ -1263,12 +1255,16 @@ case R_PARISC_PCREL12F: htab->has_12bit_branch = 1; - /* Fall thru. */ + goto branch_common; + case R_PARISC_PCREL17C: case R_PARISC_PCREL17F: htab->has_17bit_branch = 1; - /* Fall thru. */ + goto branch_common; + case R_PARISC_PCREL22F: + htab->has_22bit_branch = 1; + branch_common: /* Function calls might need to go through the .plt, and might require long branch stubs. */ if (h == NULL) @@ -1322,7 +1318,7 @@ case R_PARISC_DIR14F: /* Used for load/store from absolute locn. */ case R_PARISC_DIR14R: case R_PARISC_DIR21L: /* As above, and for ext branches too. */ -#if 1 +#if 0 /* Help debug shared library creation. Any of the above relocs can be used in shared libs, but they may cause pages to become unshared. */ @@ -1838,19 +1834,10 @@ unsigned int power_of_two; /* If this is a function, put it in the procedure linkage table. We - will fill in the contents of the procedure linkage table later, - when we know the address of the .got section. */ + will fill in the contents of the procedure linkage table later. */ if (h->type == STT_FUNC || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) { - if (!info->shared - && h->plt.refcount > 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 - && (h->root.u.def.section->flags & SEC_HAS_GOT_REF) != 0) - { - ((struct elf32_hppa_link_hash_entry *) h)->maybe_pic_call = 1; - } - if (h->plt.refcount <= 0 || ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 && h->root.type != bfd_link_hash_defweak @@ -1867,7 +1854,10 @@ /* As a special sop to the hppa ABI, we keep a .plt entry for functions in sections containing PIC code. */ - if (((struct elf32_hppa_link_hash_entry *) h)->maybe_pic_call) + if (!info->shared + && h->plt.refcount > 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + && (h->root.u.def.section->flags & SEC_HAS_GOT_REF) != 0) ((struct elf32_hppa_link_hash_entry *) h)->pic_call = 1; else { @@ -1918,7 +1908,7 @@ } /* 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. */ + 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; @@ -1982,6 +1972,9 @@ struct elf_link_hash_entry *h; PTR inf ATTRIBUTE_UNUSED; { + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (! (h->plt.refcount > 0 && (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) @@ -1993,7 +1986,6 @@ } h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - ((struct elf32_hppa_link_hash_entry *) h)->maybe_pic_call = 1; ((struct elf32_hppa_link_hash_entry *) h)->pic_call = 1; return true; @@ -2011,16 +2003,19 @@ struct elf32_hppa_link_hash_table *htab; asection *s; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = hppa_link_hash_table (info); if (((struct elf32_hppa_link_hash_entry *) h)->pic_call) { /* Make an entry in the .plt section for non-pic code that is calling pic code. */ + ((struct elf32_hppa_link_hash_entry *) h)->plabel = 0; s = htab->splt; h->plt.offset = s->_raw_size; s->_raw_size += PLT_ENTRY_SIZE; @@ -2040,7 +2035,11 @@ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) { - /* Allocate these later. */ + /* Allocate these later. From this point on, h->plabel + means that the plt entry is only used by a plabel. + We'll be using a normal plt entry for this symbol, so + clear the plabel indicator. */ + ((struct elf32_hppa_link_hash_entry *) h)->plabel = 0; } else if (((struct elf32_hppa_link_hash_entry *) h)->plabel) { @@ -2080,16 +2079,18 @@ struct elf32_hppa_link_hash_entry *eh; struct elf32_hppa_dyn_reloc_entry *p; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = hppa_link_hash_table (info); if (htab->elf.dynamic_sections_created && h->plt.offset != (bfd_vma) -1 && !((struct elf32_hppa_link_hash_entry *) h)->pic_call - && WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) + && !((struct elf32_hppa_link_hash_entry *) h)->plabel) { /* Make an entry in the .plt section. */ s = htab->splt; @@ -2213,14 +2214,13 @@ struct elf_link_hash_entry *h; struct bfd_link_info *info; { + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->type == STT_PARISC_MILLI && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) { elf32_hppa_hide_symbol (info, h, true); - - /* ?!? We only want to remove these from the dynamic symbol table. - Therefore we do not leave ELF_LINK_FORCED_LOCAL set. */ - h->elf_link_hash_flags &= ~ELF_LINK_FORCED_LOCAL; } return true; } @@ -2235,6 +2235,9 @@ struct elf32_hppa_link_hash_entry *eh; struct elf32_hppa_dyn_reloc_entry *p; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + eh = (struct elf32_hppa_link_hash_entry *) h; for (p = eh->dyn_relocs; p != NULL; p = p->next) { @@ -3258,37 +3261,13 @@ bfd *abfd; struct bfd_link_info *info; { - asection *s; - /* Invoke the regular ELF linker to do all the work. */ if (!bfd_elf32_bfd_final_link (abfd, info)) return false; /* If we're producing a final executable, sort the contents of the - unwind section. Magic section names, but this is much safer than - having elf32_hppa_relocate_section remember where SEGREL32 relocs - occurred. Consider what happens if someone inept creates a - linker script that puts unwind information in .text. */ - s = bfd_get_section_by_name (abfd, ".PARISC.unwind"); - if (s != NULL) - { - bfd_size_type size; - char *contents; - - size = s->_raw_size; - contents = bfd_malloc (size); - if (contents == NULL) - return false; - - if (! bfd_get_section_contents (abfd, s, contents, (file_ptr) 0, size)) - return false; - - qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare); - - if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size)) - return false; - } - return true; + unwind section. */ + return elf_hppa_sort_unwind (abfd); } /* Record the lowest address for the data and text segments. */ @@ -3361,19 +3340,14 @@ case R_PARISC_PCREL12F: case R_PARISC_PCREL17F: case R_PARISC_PCREL22F: - /* If this is a call to a function defined in another dynamic - library, or if it is a call to a PIC function in the same - object, or if this is a shared link and it is a call to a - weak symbol which may or may not be in the same object, then - find the import stub in the stub hash. */ + /* If this call should go via the plt, find the import stub in + the stub hash. */ if (sym_sec == NULL || sym_sec->output_section == NULL || (h != NULL - && ((h->maybe_pic_call - && !(input_section->flags & SEC_HAS_GOT_REF)) - || (h->elf.root.type == bfd_link_hash_defweak - && h->elf.dynindx != -1 - && h->elf.plt.offset != (bfd_vma) -1)))) + && h->elf.plt.offset != (bfd_vma) -1 + && (h->elf.dynindx != -1 || h->pic_call) + && !h->plabel)) { stub_entry = hppa_get_stub_entry (input_section, sym_sec, h, rel, htab); @@ -3428,7 +3402,7 @@ == (((int) OP_ADDIL << 26) | (27 << 21))) { insn &= ~ (0x1f << 21); -#if 1 /* debug them. */ +#if 0 /* debug them. */ (*_bfd_error_handler) (_("%s(%s+0x%lx): fixing %s"), bfd_archive_filename (input_bfd), @@ -3475,21 +3449,27 @@ r_field = e_fsel; break; - case R_PARISC_DIR21L: + case R_PARISC_DLTIND21L: case R_PARISC_PCREL21L: - case R_PARISC_DPREL21L: case R_PARISC_PLABEL21L: - case R_PARISC_DLTIND21L: + r_field = e_lsel; + break; + + case R_PARISC_DIR21L: + case R_PARISC_DPREL21L: r_field = e_lrsel; break; - case R_PARISC_DIR17R: case R_PARISC_PCREL17R: - case R_PARISC_DIR14R: case R_PARISC_PCREL14R: - case R_PARISC_DPREL14R: case R_PARISC_PLABEL14R: case R_PARISC_DLTIND14R: + r_field = e_rsel; + break; + + case R_PARISC_DIR17R: + case R_PARISC_DIR14R: + case R_PARISC_DPREL14R: r_field = e_rrsel; break; @@ -4091,32 +4071,6 @@ } return true; -} - -/* Comparison function for qsort to sort unwind section during a - final link. */ - -static int -hppa_unwind_entry_compare (a, b) - const PTR a; - const PTR b; -{ - const bfd_byte *ap, *bp; - unsigned long av, bv; - - ap = (const bfd_byte *) a; - av = (unsigned long) ap[0] << 24; - av |= (unsigned long) ap[1] << 16; - av |= (unsigned long) ap[2] << 8; - av |= (unsigned long) ap[3]; - - bp = (const bfd_byte *) b; - bv = (unsigned long) bp[0] << 24; - bv |= (unsigned long) bp[1] << 16; - bv |= (unsigned long) bp[2] << 8; - bv |= (unsigned long) bp[3]; - - return av < bv ? -1 : av > bv ? 1 : 0; } /* Finish up dynamic symbol handling. We set the contents of various diff -Nur binutils-2.12/bfd/elf32-i370.c binutils-2.12.1/bfd/elf32-i370.c --- binutils-2.12/bfd/elf32-i370.c Tue Feb 19 08:10:21 2002 +++ binutils-2.12.1/bfd/elf32-i370.c Thu May 9 10:48:56 2002 @@ -1,5 +1,5 @@ /* i370-specific support for 32-bit ELF - Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001 + Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. Hacked by Linas Vepstas for i370 linas@linas.org @@ -736,6 +736,9 @@ h->dynindx, *cp); #endif + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->dynindx != -1) h->dynindx += *cp; @@ -1274,6 +1277,9 @@ bfd_vma *local_got_offsets; boolean ret = true; + if (info->relocateable) + return true; + #ifdef DEBUG fprintf (stderr, "i370_elf_relocate_section called for %s section %s, %ld relocations%s\n", bfd_archive_filename (input_bfd), @@ -1317,34 +1323,6 @@ howto = i370_elf_howto_table[(int)r_type]; r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if ((unsigned)ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - addend = rel->r_addend += sec->output_offset + sym->st_value; - } - } - -#ifdef DEBUG - fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n", - howto->name, - (int)r_type, - r_symndx, - (long)offset, - (long)addend); -#endif - continue; - } - - /* This is a final link. */ if (r_symndx < symtab_hdr->sh_info) { sym = local_syms + r_symndx; @@ -1658,6 +1636,7 @@ #define elf_backend_plt_not_loaded 1 #define elf_backend_got_symbol_offset 4 +#define elf_backend_rela_normal 1 #define bfd_elf32_bfd_reloc_type_lookup i370_elf_reloc_type_lookup #define bfd_elf32_bfd_set_private_flags i370_elf_set_private_flags diff -Nur binutils-2.12/bfd/elf32-i386.c binutils-2.12.1/bfd/elf32-i386.c --- binutils-2.12/bfd/elf32-i386.c Tue Feb 19 08:10:18 2002 +++ binutils-2.12.1/bfd/elf32-i386.c Thu Apr 4 11:20:34 2002 @@ -1,5 +1,5 @@ /* Intel 80386/80486-specific support for 32-bit ELF - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -847,11 +847,10 @@ { const char *name; bfd *dynobj; + unsigned int strndx = elf_elfheader (abfd)->e_shstrndx; + unsigned int shnam = elf_section_data (sec)->rel_hdr.sh_name; - name = (bfd_elf_string_from_elf_section - (abfd, - elf_elfheader (abfd)->e_shstrndx, - elf_section_data (sec)->rel_hdr.sh_name)); + name = bfd_elf_string_from_elf_section (abfd, strndx, shnam); if (name == NULL) return false; @@ -1251,10 +1250,15 @@ struct elf_i386_link_hash_entry *eh; struct elf_i386_dyn_relocs *p; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + /* When warning symbols are created, they **replace** the "real" + entry in the hash table, thus we never get to see the real + symbol in a hash traversal. So look at it now. */ + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = elf_i386_hash_table (info); @@ -1420,6 +1424,9 @@ { struct elf_i386_link_hash_entry *eh; struct elf_i386_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; eh = (struct elf_i386_link_hash_entry *) h; for (p = eh->dyn_relocs; p != NULL; p = p->next) diff -Nur binutils-2.12/bfd/elf32-i860.c binutils-2.12.1/bfd/elf32-i860.c --- binutils-2.12/bfd/elf32-i860.c Fri Nov 23 07:17:16 2001 +++ binutils-2.12.1/bfd/elf32-i860.c Thu May 9 10:48:56 2002 @@ -1,5 +1,6 @@ /* Intel i860 specific support for 32-bit ELF. - Copyright 1993, 1995, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1993, 1995, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. Full i860 support contributed by Jason Eckhardt . @@ -878,6 +879,9 @@ Elf_Internal_Rela * rel; Elf_Internal_Rela * relend; + if (info->relocateable) + return true; + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; @@ -904,27 +908,6 @@ r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections [r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ howto = lookup_howto ((unsigned) ELF32_R_TYPE (rel->r_info)); h = NULL; sym = NULL; @@ -1097,6 +1080,7 @@ #define ELF_MACHINE_CODE EM_860 #define ELF_MAXPAGESIZE 4096 +#define elf_backend_rela_normal 1 #define elf_info_to_howto_rel NULL #define elf_info_to_howto elf32_i860_info_to_howto_rela #define elf_backend_relocate_section elf32_i860_relocate_section diff -Nur binutils-2.12/bfd/elf32-m32r.c binutils-2.12.1/bfd/elf32-m32r.c --- binutils-2.12/bfd/elf32-m32r.c Thu Jan 17 08:02:40 2002 +++ binutils-2.12.1/bfd/elf32-m32r.c Thu May 9 10:48:56 2002 @@ -838,7 +838,8 @@ { if (! info->relocateable && (*namep)[0] == '_' && (*namep)[1] == 'S' - && strcmp (*namep, "_SDA_BASE_") == 0) + && strcmp (*namep, "_SDA_BASE_") == 0 + && info->hash->creator->flavour == bfd_target_elf_flavour) { /* This is simpler than using _bfd_elf_create_linker_section (our needs are simpler than ppc's needs). Also @@ -980,6 +981,11 @@ /* Assume success. */ boolean ret = true; +#ifndef USE_REL + if (info->relocateable) + return true; +#endif + rel = relocs; relend = relocs + input_section->reloc_count; for (; rel < relend; rel++) @@ -1019,6 +1025,7 @@ howto = m32r_elf_howto_table + r_type; r_symndx = ELF32_R_SYM (rel->r_info); +#ifdef USE_REL if (info->relocateable) { /* This is a relocateable link. We don't have to change @@ -1044,16 +1051,7 @@ sec = local_sections[r_symndx]; addend += sec->output_offset + sym->st_value; -#ifndef USE_REL - /* This can't be done for USE_REL because it doesn't mean anything - and elf_link_input_bfd asserts this stays zero. */ - rel->r_addend = addend; -#endif -#ifndef USE_REL - /* Addends are stored with relocs. We're done. */ - continue; -#else /* USE_REL */ /* If partial_inplace, we need to store any additional addend back in the section. */ if (! howto->partial_inplace) @@ -1087,9 +1085,9 @@ r = _bfd_relocate_contents (howto, input_bfd, addend, contents + offset); } -#endif /* USE_REL */ } else +#endif /* USE_REL */ { bfd_vma relocation; @@ -2160,6 +2158,9 @@ #define elf_backend_check_relocs m32r_elf_check_relocs #define elf_backend_can_gc_sections 1 +#ifndef USE_REL +#define elf_backend_rela_normal 1 +#endif #if 0 /* not yet */ /* relax support */ #define bfd_elf32_bfd_relax_section m32r_elf_relax_section diff -Nur binutils-2.12/bfd/elf32-m68k.c binutils-2.12.1/bfd/elf32-m68k.c --- binutils-2.12/bfd/elf32-m68k.c Tue Feb 19 08:10:21 2002 +++ binutils-2.12.1/bfd/elf32-m68k.c Thu May 9 10:48:57 2002 @@ -1,5 +1,5 @@ /* Motorola 68k series support for 32-bit ELF - Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1271,6 +1271,9 @@ { struct elf_m68k_pcrel_relocs_copied *s; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_m68k_link_hash_entry *) h->root.root.u.i.link; + /* We only discard relocs for symbols defined in a regular object. */ if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) return true; @@ -1305,6 +1308,9 @@ Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; + if (info->relocateable) + return true; + dynobj = elf_hash_table (info)->dynobj; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -1337,26 +1343,6 @@ r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -2322,5 +2308,6 @@ #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 12 +#define elf_backend_rela_normal 1 #include "elf32-target.h" diff -Nur binutils-2.12/bfd/elf32-mcore.c binutils-2.12.1/bfd/elf32-mcore.c --- binutils-2.12/bfd/elf32-mcore.c Tue Dec 18 12:59:58 2001 +++ binutils-2.12.1/bfd/elf32-mcore.c Thu May 9 10:48:57 2002 @@ -1,5 +1,6 @@ /* Motorola MCore specific support for 32-bit ELF - Copyright 1994, 1995, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1994, 1995, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -414,6 +415,9 @@ (info->relocateable) ? " (relocatable)" : ""); #endif + if (info->relocateable) + return true; + if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) /* Initialize howto table if needed */ mcore_elf_howto_init (); @@ -447,32 +451,6 @@ howto = mcore_elf_howto_table [(int) r_type]; r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - - if ((unsigned)ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - addend = rel->r_addend += sec->output_offset + sym->st_value; - } - } - -#ifdef DEBUG - fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n", - howto->name, (int) r_type, r_symndx, (long) offset, (long) addend); -#endif - continue; - } - - /* This is a final link. */ - /* Complain about known relocation that are not yet supported. */ if (howto->special_function == mcore_elf_unsupported_reloc) { @@ -726,5 +704,6 @@ #define elf_backend_check_relocs mcore_elf_check_relocs #define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 #include "elf32-target.h" diff -Nur binutils-2.12/bfd/elf32-mips.c binutils-2.12.1/bfd/elf32-mips.c --- binutils-2.12/bfd/elf32-mips.c Tue Feb 19 08:10:29 2002 +++ binutils-2.12.1/bfd/elf32-mips.c Sat May 11 13:54:17 2002 @@ -105,6 +105,9 @@ /* This is like the call_stub field, but it is used if the function being called returns a floating point value. */ asection *call_fp_stub; + + /* Are we forced local? .*/ + boolean forced_local; }; static bfd_reloc_status_type mips32_64bit_reloc @@ -4528,6 +4531,7 @@ ret->need_fn_stub = false; ret->call_stub = NULL; ret->call_fp_stub = NULL; + ret->forced_local = false; } return (struct bfd_hash_entry *) ret; @@ -4543,7 +4547,12 @@ asection *got; struct mips_got_info *g; struct mips_elf_link_hash_entry *h; + h = (struct mips_elf_link_hash_entry *) entry; + if (h->forced_local) + return; + h->forced_local = true; + dynobj = elf_hash_table (info)->dynobj; got = bfd_get_section_by_name (dynobj, ".got"); g = (struct mips_got_info *) elf_section_data (got)->tdata; @@ -4779,6 +4788,9 @@ boolean strip; asection *sec, *output_section; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; + if (h->root.indx == -2) strip = false; else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 @@ -6044,9 +6056,18 @@ { /* A global symbol in the GOT must also be in the dynamic symbol table. */ - if (h->dynindx == -1 - && !bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; + if (h->dynindx == -1) + { + switch (ELF_ST_VISIBILITY (h->other)) + { + case STV_INTERNAL: + case STV_HIDDEN: + _bfd_mips_elf_hide_symbol (info, h, true); + break; + } + if (!bfd_elf32_link_record_dynamic_symbol (info, h)) + return false; + } /* If we've already marked this entry as needing GOT space, we don't need to do it again. */ @@ -6089,6 +6110,9 @@ struct mips_elf_hash_sort_data *hsd = (struct mips_elf_hash_sort_data *) data; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; + /* Symbols without dynamic symbol table entries aren't interesting at all. */ if (h->root.dynindx == -1) @@ -8789,6 +8813,9 @@ struct mips_elf_link_hash_entry *h; PTR data ATTRIBUTE_UNUSED; { + if (h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; + if (h->fn_stub != NULL && ! h->need_fn_stub) { diff -Nur binutils-2.12/bfd/elf32-openrisc.c binutils-2.12.1/bfd/elf32-openrisc.c --- binutils-2.12/bfd/elf32-openrisc.c Sun Dec 16 19:52:35 2001 +++ binutils-2.12.1/bfd/elf32-openrisc.c Thu May 9 10:48:57 2002 @@ -1,5 +1,5 @@ /* OpenRISC-specific support for 32-bit ELF. - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002 Free Software Foundation, Inc. Contributed by Johan Rydberg, jrydberg@opencores.org This file is part of BFD, the Binary File Descriptor library. @@ -338,6 +338,9 @@ Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; + if (info->relocateable) + return true; + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; @@ -361,25 +364,6 @@ || r_type == R_OPENRISC_GNU_VTENTRY) continue; - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - continue; - } - if ((unsigned int) r_type > (sizeof openrisc_elf_howto_table / sizeof (reloc_howto_type))) abort (); @@ -645,6 +629,7 @@ #define elf_backend_check_relocs openrisc_elf_check_relocs #define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 #define bfd_elf32_bfd_reloc_type_lookup openrisc_reloc_type_lookup diff -Nur binutils-2.12/bfd/elf32-ppc.c binutils-2.12.1/bfd/elf32-ppc.c --- binutils-2.12/bfd/elf32-ppc.c Tue Feb 19 08:10:21 2002 +++ binutils-2.12.1/bfd/elf32-ppc.c Thu May 9 10:48:57 2002 @@ -1,5 +1,5 @@ /* PowerPC-specific support for 32-bit ELF - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. @@ -49,6 +49,8 @@ static int ppc_elf_additional_program_headers PARAMS ((bfd *)); static boolean ppc_elf_modify_segment_map PARAMS ((bfd *)); +static asection *ppc_elf_create_got + PARAMS ((bfd *, struct bfd_link_info *)); static boolean ppc_elf_create_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); @@ -679,20 +681,20 @@ 0xffff, /* dst_mask */ false), /* pcrel_offset */ - /* 32-bit section relative relocation. */ + /* 16-bit section relative relocation. */ HOWTO (R_PPC_SECTOFF, /* type */ 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_PPC_SECTOFF", /* name */ false, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ /* 16-bit lower half section relative relocation. */ HOWTO (R_PPC_SECTOFF_LO, /* type */ @@ -1295,7 +1297,7 @@ case BFD_RELOC_HI16_PLTOFF: ppc_reloc = R_PPC_PLT16_HI; break; case BFD_RELOC_HI16_S_PLTOFF: ppc_reloc = R_PPC_PLT16_HA; break; case BFD_RELOC_GPREL16: ppc_reloc = R_PPC_SDAREL16; break; - case BFD_RELOC_32_BASEREL: ppc_reloc = R_PPC_SECTOFF; break; + case BFD_RELOC_16_BASEREL: ppc_reloc = R_PPC_SECTOFF; break; case BFD_RELOC_LO16_BASEREL: ppc_reloc = R_PPC_SECTOFF_LO; break; case BFD_RELOC_HI16_BASEREL: ppc_reloc = R_PPC_SECTOFF_HI; break; case BFD_RELOC_HI16_S_BASEREL: ppc_reloc = R_PPC_SECTOFF_HA; break; @@ -1632,6 +1634,30 @@ return true; } +/* The powerpc .got has a blrl instruction in it. Mark it executable. */ + +static asection * +ppc_elf_create_got (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + register asection *s; + flagword flags; + + if (!_bfd_elf_create_got_section (abfd, info)) + return NULL; + + s = bfd_get_section_by_name (abfd, ".got"); + if (s == NULL) + abort (); + + flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + if (!bfd_set_section_flags (abfd, s, flags)) + return NULL; + return s; +} + /* We have to create .dynsbss and .rela.sbss here so that they get mapped to output sections (just like _bfd_elf_create_dynamic_sections has to create .dynbss and .rela.bss). */ @@ -1644,6 +1670,9 @@ register asection *s; flagword flags; + if (!ppc_elf_create_got (abfd, info)) + return false; + if (!_bfd_elf_create_dynamic_sections (abfd, info)) return false; @@ -1663,7 +1692,13 @@ || ! bfd_set_section_alignment (abfd, s, 2)) return false; } - return true; + + s = bfd_get_section_by_name (abfd, ".plt"); + if (s == NULL) + abort (); + + flags = SEC_ALLOC | SEC_CODE | SEC_IN_MEMORY | SEC_LINKER_CREATED; + return bfd_set_section_flags (abfd, s, flags); } /* Adjust a symbol defined by a dynamic object and referenced by a @@ -2119,10 +2154,9 @@ { if (dynobj == NULL) elf_hash_table (info)->dynobj = dynobj = abfd; - if (! _bfd_elf_create_got_section (dynobj, info)) + sgot = ppc_elf_create_got (dynobj, info); + if (sgot == NULL) return false; - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); } } @@ -2139,10 +2173,9 @@ { if (dynobj == NULL) elf_hash_table (info)->dynobj = dynobj = abfd; - if (! _bfd_elf_create_got_section (dynobj, info)) + sgot = ppc_elf_create_got (dynobj, info); + if (sgot == NULL) return false; - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); } if (srelgot == NULL @@ -2542,7 +2575,8 @@ { if (sym->st_shndx == SHN_COMMON && !info->relocateable - && sym->st_size <= elf_gp_size (abfd)) + && sym->st_size <= elf_gp_size (abfd) + && info->hash->creator->flavour == bfd_target_elf_flavour) { /* Common symbols less than or equal to -G nn bytes are automatically put into .sdata. */ @@ -2895,6 +2929,9 @@ (info->relocateable) ? " (relocatable)" : ""); #endif + if (info->relocateable) + return true; + if (!ppc_elf_howto_table[R_PPC_ADDR32]) /* Initialize howto table if needed. */ ppc_elf_howto_init (); @@ -2939,34 +2976,6 @@ howto = ppc_elf_howto_table[(int) r_type]; r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if ((unsigned) ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - addend = rel->r_addend += sec->output_offset + sym->st_value; - } - } - -#ifdef DEBUG - fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n", - howto->name, - (int) r_type, - r_symndx, - (long) offset, - (long) addend); -#endif - continue; - } - - /* This is a final link. */ if (r_symndx < symtab_hdr->sh_info) { sym = local_syms + r_symndx; @@ -3780,6 +3789,7 @@ #define elf_backend_can_refcount 1 #define elf_backend_got_header_size 12 #define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE +#define elf_backend_rela_normal 1 #define bfd_elf32_bfd_merge_private_bfd_data ppc_elf_merge_private_bfd_data #define bfd_elf32_bfd_relax_section ppc_elf_relax_section diff -Nur binutils-2.12/bfd/elf32-s390.c binutils-2.12.1/bfd/elf32-s390.c --- binutils-2.12/bfd/elf32-s390.c Tue Feb 19 08:10:22 2002 +++ binutils-2.12.1/bfd/elf32-s390.c Thu May 9 10:48:58 2002 @@ -1,5 +1,5 @@ /* IBM S/390-specific support for 32-bit ELF - Copyright 2000, 2001 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Carl B. Pedersen and Martin Schwidefsky. This file is part of BFD, the Binary File Descriptor library. @@ -111,6 +111,10 @@ HOWTO(R_390_PC16, 0, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC16", false, 0,0x0000ffff, true), HOWTO(R_390_PC16DBL, 1, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC16DBL", false, 0,0x0000ffff, true), HOWTO(R_390_PLT16DBL, 1, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PLT16DBL", false, 0,0x0000ffff, true), + HOWTO(R_390_PC32DBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC32DBL", false, 0,0xffffffff, true), + HOWTO(R_390_PLT32DBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PLT32DBL", false, 0,0xffffffff, true), + HOWTO(R_390_GOTPCDBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTPCDBL", false, 0,0xffffffff, true), + HOWTO(R_390_GOTENT, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTENT", false, 0,0xffffffff, true), }; /* GNU extension to record C++ vtable hierarchy. */ @@ -166,6 +170,14 @@ return &elf_howto_table[(int) R_390_PC16DBL]; case BFD_RELOC_390_PLT16DBL: return &elf_howto_table[(int) R_390_PLT16DBL]; + case BFD_RELOC_390_PC32DBL: + return &elf_howto_table[(int) R_390_PC32DBL]; + case BFD_RELOC_390_PLT32DBL: + return &elf_howto_table[(int) R_390_PLT32DBL]; + case BFD_RELOC_390_GOTPCDBL: + return &elf_howto_table[(int) R_390_GOTPCDBL]; + case BFD_RELOC_390_GOTENT: + return &elf_howto_table[(int) R_390_GOTENT]; case BFD_RELOC_VTABLE_INHERIT: return &elf32_s390_vtinherit_howto; case BFD_RELOC_VTABLE_ENTRY: @@ -650,6 +662,7 @@ case R_390_GOT12: case R_390_GOT16: case R_390_GOT32: + case R_390_GOTENT: /* This symbol requires a global offset table entry. */ if (h != NULL) { @@ -679,6 +692,7 @@ case R_390_GOTOFF: case R_390_GOTPC: + case R_390_GOTPCDBL: if (htab->sgot == NULL) { if (htab->elf.dynobj == NULL) @@ -689,6 +703,7 @@ break; case R_390_PLT16DBL: + case R_390_PLT32DBL: case R_390_PLT32: /* This symbol requires a procedure linkage table entry. We actually build the entry in adjust_dynamic_symbol, @@ -711,6 +726,7 @@ case R_390_32: case R_390_PC16: case R_390_PC16DBL: + case R_390_PC32DBL: case R_390_PC32: if (h != NULL && !info->shared) { @@ -752,6 +768,7 @@ && (sec->flags & SEC_ALLOC) != 0 && ((ELF32_R_TYPE (rel->r_info) != R_390_PC16 && ELF32_R_TYPE (rel->r_info) != R_390_PC16DBL + && ELF32_R_TYPE (rel->r_info) != R_390_PC32DBL && ELF32_R_TYPE (rel->r_info) != R_390_PC32) || (h != NULL && (! info->symbolic @@ -854,6 +871,7 @@ p->count += 1; if (ELF32_R_TYPE (rel->r_info) == R_390_PC16 || ELF32_R_TYPE (rel->r_info) == R_390_PC16DBL + || ELF32_R_TYPE (rel->r_info) == R_390_PC32DBL || ELF32_R_TYPE (rel->r_info) == R_390_PC32) p->pc_count += 1; } @@ -954,6 +972,8 @@ case R_390_GOT32: case R_390_GOTOFF: case R_390_GOTPC: + case R_390_GOTPCDBL: + case R_390_GOTENT: r_symndx = ELF32_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) { @@ -974,6 +994,7 @@ case R_390_32: case R_390_PC16: case R_390_PC16DBL: + case R_390_PC32DBL: case R_390_PC32: r_symndx = ELF32_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) @@ -994,6 +1015,7 @@ { if (ELF32_R_TYPE (rel->r_info) == R_390_PC16 || ELF32_R_TYPE (rel->r_info) == R_390_PC16DBL + || ELF32_R_TYPE (rel->r_info) == R_390_PC32DBL || ELF32_R_TYPE (rel->r_info) == R_390_PC32) p->pc_count -= 1; p->count -= 1; @@ -1005,6 +1027,7 @@ break; case R_390_PLT16DBL: + case R_390_PLT32DBL: case R_390_PLT32: r_symndx = ELF32_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) @@ -1191,10 +1214,12 @@ struct elf_s390_link_hash_entry *eh; struct elf_s390_dyn_relocs *p; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = elf_s390_hash_table (info); @@ -1361,6 +1386,9 @@ struct elf_s390_link_hash_entry *eh; struct elf_s390_dyn_relocs *p; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + eh = (struct elf_s390_link_hash_entry *) h; for (p = eh->dyn_relocs; p != NULL; p = p->next) { @@ -1604,6 +1632,9 @@ Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; + if (info->relocateable) + return true; + htab = elf_s390_hash_table (info); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -1633,30 +1664,9 @@ bfd_set_error (bfd_error_bad_value); return false; } - howto = elf_howto_table + r_type; + howto = elf_howto_table + r_type; r_symndx = ELF32_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -1716,6 +1726,7 @@ case R_390_GOT12: case R_390_GOT16: case R_390_GOT32: + case R_390_GOTENT: /* Relocation is to the entry for this symbol in the global offset table. */ if (htab->sgot == NULL) @@ -1803,6 +1814,16 @@ abort (); relocation = htab->sgot->output_offset + off; + + /* + * For @GOTENT the relocation is against the offset between + * the instruction and the symbols entry in the GOT and not + * between the start of the GOT and the symbols entry. We + * add the vma of the GOT to get the correct value. + */ + if (r_type == R_390_GOTENT) + relocation += htab->sgot->output_section->vma; + break; case R_390_GOTOFF: @@ -1818,12 +1839,14 @@ break; case R_390_GOTPC: + case R_390_GOTPCDBL: /* Use global offset table as symbol value. */ relocation = htab->sgot->output_section->vma; unresolved_reloc = false; break; case R_390_PLT16DBL: + case R_390_PLT32DBL: case R_390_PLT32: /* Relocation is to the entry for this symbol in the procedure linkage table. */ @@ -1853,6 +1876,7 @@ case R_390_32: case R_390_PC16: case R_390_PC16DBL: + case R_390_PC32DBL: case R_390_PC32: /* r_symndx will be zero only for relocs against symbols from removed linkonce sections, or sections discarded by @@ -1864,6 +1888,7 @@ if ((info->shared && ((r_type != R_390_PC16 && r_type != R_390_PC16DBL + && r_type != R_390_PC32DBL && r_type != R_390_PC32) || (h != NULL && h->dynindx != -1 @@ -1909,6 +1934,7 @@ && h->dynindx != -1 && (r_type == R_390_PC16 || r_type == R_390_PC16DBL + || r_type == R_390_PC32DBL || r_type == R_390_PC32 || !info->shared || !info->symbolic @@ -2375,7 +2401,7 @@ elf_s390_object_p (abfd) bfd *abfd; { - return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_esa); + return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_31); } static boolean @@ -2423,6 +2449,7 @@ #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 12 #define elf_backend_plt_header_size PLT_ENTRY_SIZE +#define elf_backend_rela_normal 1 #define elf_info_to_howto elf_s390_info_to_howto diff -Nur binutils-2.12/bfd/elf32-sh.c binutils-2.12.1/bfd/elf32-sh.c --- binutils-2.12/bfd/elf32-sh.c Tue Feb 19 08:10:23 2002 +++ binutils-2.12.1/bfd/elf32-sh.c Thu Apr 4 11:20:36 2002 @@ -3899,8 +3899,8 @@ will not fill them in in the relocate_section routine. */ if (info->shared && info->symbolic) sh_elf_link_hash_traverse (sh_elf_hash_table (info), - sh_elf_discard_copies, - (PTR) NULL); + sh_elf_discard_copies, + (PTR) NULL); /* The check_relocs and adjust_dynamic_symbol entry points have determined the sizes of the various dynamic sections. Allocate @@ -4037,6 +4037,9 @@ PTR ignore ATTRIBUTE_UNUSED; { struct elf_sh_pcrel_relocs_copied *s; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_sh_link_hash_entry *) h->root.root.u.i.link; /* We only discard relocs for symbols defined in a regular object. */ if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) diff -Nur binutils-2.12/bfd/elf32-sh64.c binutils-2.12.1/bfd/elf32-sh64.c --- binutils-2.12/bfd/elf32-sh64.c Mon Feb 11 01:18:13 2002 +++ binutils-2.12.1/bfd/elf32-sh64.c Thu May 9 10:48:59 2002 @@ -389,7 +389,8 @@ bfd_vma *valp; { /* We want to do this for relocatable as well as final linking. */ - if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL) + if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL + && info->hash->creator->flavour == bfd_target_elf_flavour) { struct elf_link_hash_entry *h; diff -Nur binutils-2.12/bfd/elf32-sparc.c binutils-2.12.1/bfd/elf32-sparc.c --- binutils-2.12/bfd/elf32-sparc.c Tue Feb 19 08:10:24 2002 +++ binutils-2.12.1/bfd/elf32-sparc.c Thu Apr 4 11:20:36 2002 @@ -1084,6 +1084,17 @@ return true; } +/* This is the condition under which 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 relocate_section. */ +#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \ + ((DYN) \ + && ((INFO)->shared \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \ + && ((H)->dynindx != -1 \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) + /* Relocate a SPARC ELF section. */ static boolean @@ -1133,9 +1144,10 @@ struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; asection *sec; - bfd_vma relocation; + bfd_vma relocation, off; bfd_reloc_status_type r; boolean is_plt = false; + boolean unresolved_reloc; r_type = ELF32_R_TYPE (rel->r_info); @@ -1175,6 +1187,7 @@ h = NULL; sym = NULL; sec = NULL; + unresolved_reloc = false; if (r_symndx < symtab_hdr->sh_info) { sym = local_syms + r_symndx; @@ -1187,71 +1200,30 @@ while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + relocation = 0; if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { sec = h->root.u.def.section; - if (((r_type == R_SPARC_WPLT30 - || r_type == R_SPARC_PLT32) - && h->plt.offset != (bfd_vma) -1) - || ((r_type == R_SPARC_GOT10 - || r_type == R_SPARC_GOT13 - || r_type == R_SPARC_GOT22) - && elf_hash_table (info)->dynamic_sections_created - && (! info->shared - || (! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - || (info->shared - && ((! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0) - && (r_type == R_SPARC_8 - || r_type == R_SPARC_16 - || r_type == R_SPARC_32 - || r_type == R_SPARC_DISP8 - || r_type == R_SPARC_DISP16 - || r_type == R_SPARC_DISP32 - || r_type == R_SPARC_WDISP30 - || r_type == R_SPARC_WDISP22 - || r_type == R_SPARC_WDISP19 - || r_type == R_SPARC_WDISP16 - || r_type == R_SPARC_HI22 - || r_type == R_SPARC_22 - || r_type == R_SPARC_13 - || r_type == R_SPARC_LO10 - || r_type == R_SPARC_UA16 - || r_type == R_SPARC_UA32 - || ((r_type == R_SPARC_PC10 - || r_type == R_SPARC_PC22) - && strcmp (h->root.root.string, - "_GLOBAL_OFFSET_TABLE_") != 0)) - && ((input_section->flags & SEC_ALLOC) != 0 - /* DWARF will emit R_SPARC_32 relocations in its - sections against symbols defined externally - in shared libraries. We can't do anything - with them here. */ - || ((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))) - { - /* In these cases, we don't need the relocation - value. We check specially because in some - obscure cases sec->output_section will be NULL. */ - relocation = 0; - } + if (sec->output_section == NULL) + /* Set a flag that will be cleared later if we find a + relocation value for this symbol. output_section + is typically NULL for symbols satisfied by a shared + library. */ + unresolved_reloc = true; else relocation = (h->root.u.def.value + sec->output_section->vma + sec->output_offset); } else if (h->root.type == bfd_link_hash_undefweak) - relocation = 0; + ; else if (info->shared && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) - relocation = 0; + ; else { if (! ((*info->callbacks->undefined_symbol) @@ -1260,7 +1232,6 @@ (!info->shared || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return false; - relocation = 0; } } @@ -1279,14 +1250,17 @@ if (h != NULL) { - bfd_vma off; + boolean dyn; off = h->got.offset; BFD_ASSERT (off != (bfd_vma) -1); + dyn = elf_hash_table (info)->dynamic_sections_created; - if (! elf_hash_table (info)->dynamic_sections_created + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) || (info->shared - && (info->symbolic || h->dynindx == -1) + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) { /* This is actually a static link, or it is a @@ -1310,13 +1284,11 @@ h->got.offset |= 1; } } - - relocation = sgot->output_offset + off - got_base; + else + unresolved_reloc = false; } else { - bfd_vma off; - BFD_ASSERT (local_got_offsets != NULL && local_got_offsets[r_symndx] != (bfd_vma) -1); @@ -1355,10 +1327,8 @@ local_got_offsets[r_symndx] |= 1; } - - relocation = sgot->output_offset + off - got_base; } - + relocation = sgot->output_offset + off - got_base; break; case R_SPARC_PLT32: @@ -1396,6 +1366,7 @@ relocation = (splt->output_section->vma + splt->output_offset + h->plt.offset); + unresolved_reloc = false; if (r_type == R_SPARC_PLT32) { r_type = R_SPARC_32; @@ -1496,6 +1467,17 @@ if (!(outrel.r_offset & 3)) r_type = R_SPARC_32; break; + case R_SPARC_DISP8: + case R_SPARC_DISP16: + case R_SPARC_DISP32: + /* If the symbol is not dynamic, we should not keep + a dynamic relocation. But an .rela.* slot has been + allocated for it, output R_SPARC_NONE. + FIXME: Add code tracking needed dynamic relocs as + e.g. i386 has. */ + if (h->dynindx == -1) + skip = true, relocate = true; + break; } if (skip) @@ -1581,6 +1563,18 @@ default: break; } + + /* ??? Copied from elf32-i386.c, debugging section check and all. */ + if (unresolved_reloc + && !(info->shared + && (input_section->flags & SEC_DEBUGGING) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + (*_bfd_error_handler) + (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, + h->root.root.string); r = bfd_reloc_continue; if (r_type == R_SPARC_WDISP16) diff -Nur binutils-2.12/bfd/elf32-xstormy16.c binutils-2.12.1/bfd/elf32-xstormy16.c --- binutils-2.12/bfd/elf32-xstormy16.c Tue Jan 15 06:58:42 2002 +++ binutils-2.12.1/bfd/elf32-xstormy16.c Thu May 9 10:48:59 2002 @@ -500,6 +500,9 @@ { struct relax_plt_data *data = (struct relax_plt_data *) xdata; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->plt.offset != (bfd_vma) -1) { bfd_vma address; @@ -533,6 +536,9 @@ { bfd_vma *entry = (bfd_vma *) xdata; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->plt.offset != (bfd_vma) -1) { h->plt.offset = *entry; @@ -784,6 +790,9 @@ bfd *dynobj; asection *splt; + if (info->relocateable) + return true; + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; @@ -812,28 +821,6 @@ continue; r_symndx = ELF32_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections [r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ howto = xstormy16_elf_howto_table + ELF32_R_TYPE (rel->r_info); h = NULL; sym = NULL; @@ -1102,6 +1089,7 @@ xstormy16_elf_finish_dynamic_sections #define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 #define bfd_elf32_bfd_reloc_type_lookup xstormy16_reloc_type_lookup #define bfd_elf32_bfd_relax_section xstormy16_elf_relax_section diff -Nur binutils-2.12/bfd/elf64-alpha.c binutils-2.12.1/bfd/elf64-alpha.c --- binutils-2.12/bfd/elf64-alpha.c Tue Feb 19 08:10:25 2002 +++ binutils-2.12.1/bfd/elf64-alpha.c Thu May 9 10:48:59 2002 @@ -2120,18 +2120,21 @@ boolean strip; asection *sec, *output_section; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; + if (h->root.indx == -2) strip = false; else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0) - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) + || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0) + && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 + && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) strip = true; else if (einfo->info->strip == strip_all - || (einfo->info->strip == strip_some - && bfd_hash_lookup (einfo->info->keep_hash, - h->root.root.root.string, - false, false) == NULL)) + || (einfo->info->strip == strip_some + && bfd_hash_lookup (einfo->info->keep_hash, + h->root.root.root.string, + false, false) == NULL)) strip = true; else strip = false; @@ -2150,44 +2153,44 @@ h->esym.asym.st = stGlobal; if (h->root.root.type != bfd_link_hash_defined - && h->root.root.type != bfd_link_hash_defweak) - h->esym.asym.sc = scAbs; + && h->root.root.type != bfd_link_hash_defweak) + h->esym.asym.sc = scAbs; else - { - const char *name; + { + const char *name; + + sec = h->root.root.u.def.section; + output_section = sec->output_section; - sec = h->root.root.u.def.section; - output_section = sec->output_section; + /* When making a shared library and symbol h is the one from + the another shared library, OUTPUT_SECTION may be null. */ + if (output_section == NULL) + h->esym.asym.sc = scUndefined; + else + { + name = bfd_section_name (output_section->owner, output_section); - /* When making a shared library and symbol h is the one from - the another shared library, OUTPUT_SECTION may be null. */ - if (output_section == NULL) - h->esym.asym.sc = scUndefined; - else - { - name = bfd_section_name (output_section->owner, output_section); - - if (strcmp (name, ".text") == 0) - h->esym.asym.sc = scText; - else if (strcmp (name, ".data") == 0) - h->esym.asym.sc = scData; - else if (strcmp (name, ".sdata") == 0) - h->esym.asym.sc = scSData; - else if (strcmp (name, ".rodata") == 0 - || strcmp (name, ".rdata") == 0) - h->esym.asym.sc = scRData; - else if (strcmp (name, ".bss") == 0) - h->esym.asym.sc = scBss; - else if (strcmp (name, ".sbss") == 0) - h->esym.asym.sc = scSBss; - else if (strcmp (name, ".init") == 0) - h->esym.asym.sc = scInit; - else if (strcmp (name, ".fini") == 0) - h->esym.asym.sc = scFini; - else - h->esym.asym.sc = scAbs; - } - } + if (strcmp (name, ".text") == 0) + h->esym.asym.sc = scText; + else if (strcmp (name, ".data") == 0) + h->esym.asym.sc = scData; + else if (strcmp (name, ".sdata") == 0) + h->esym.asym.sc = scSData; + else if (strcmp (name, ".rodata") == 0 + || strcmp (name, ".rdata") == 0) + h->esym.asym.sc = scRData; + else if (strcmp (name, ".bss") == 0) + h->esym.asym.sc = scBss; + else if (strcmp (name, ".sbss") == 0) + h->esym.asym.sc = scSBss; + else if (strcmp (name, ".init") == 0) + h->esym.asym.sc = scInit; + else if (strcmp (name, ".fini") == 0) + h->esym.asym.sc = scFini; + else + h->esym.asym.sc = scAbs; + } + } h->esym.asym.reserved = 0; h->esym.asym.index = indexNil; @@ -2199,18 +2202,18 @@ || h->root.root.type == bfd_link_hash_defweak) { if (h->esym.asym.sc == scCommon) - h->esym.asym.sc = scBss; + h->esym.asym.sc = scBss; else if (h->esym.asym.sc == scSCommon) - h->esym.asym.sc = scSBss; + h->esym.asym.sc = scSBss; sec = h->root.root.u.def.section; output_section = sec->output_section; if (output_section != NULL) - h->esym.asym.value = (h->root.root.u.def.value - + sec->output_offset - + output_section->vma); + h->esym.asym.value = (h->root.root.u.def.value + + sec->output_offset + + output_section->vma); else - h->esym.asym.value = 0; + h->esym.asym.value = 0; } else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) { @@ -2232,8 +2235,8 @@ } if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap, - h->root.root.root.string, - &h->esym)) + h->root.root.root.string, + &h->esym)) { einfo->failed = true; return false; @@ -2861,6 +2864,9 @@ { struct alpha_elf_got_entry *gotent; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; + for (gotent = h->got_entries; gotent; gotent = gotent->next) if (gotent->use_count > 0) { @@ -3038,6 +3044,9 @@ struct alpha_elf_link_hash_entry *h; struct bfd_link_info *info; { + if (h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; + /* If the symbol was defined as a common symbol in a regular object file, and there was no definition in any dynamic object, then the linker will have allocated space for the symbol in a common @@ -3684,6 +3693,16 @@ BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count <= srel->_cooked_size); } + goto default_reloc; + + case R_ALPHA_SREL32: + case R_ALPHA_SREL64: + /* ??? .eh_frame references to discarded sections will be smashed + to relocations against SHN_UNDEF. The .eh_frame format allows + NULL to be encoded as 0 in any format, so this works here. */ + if (r_symndx == 0) + howto = (elf64_alpha_howto_table + + (r_type - R_ALPHA_SREL32 + R_ALPHA_REFLONG)); goto default_reloc; default: diff -Nur binutils-2.12/bfd/elf64-hppa.c binutils-2.12.1/bfd/elf64-hppa.c --- binutils-2.12/bfd/elf64-hppa.c Sun Dec 16 19:52:35 2001 +++ binutils-2.12.1/bfd/elf64-hppa.c Thu Apr 4 11:20:37 2002 @@ -1,5 +1,5 @@ /* Support for HPPA 64-bit ELF - Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1022,6 +1022,9 @@ struct elf64_hppa_link_hash_table *hppa_info; hppa_info = elf64_hppa_hash_table (info); + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; if (h && (h->root.type == bfd_link_hash_defined diff -Nur binutils-2.12/bfd/elf64-mips.c binutils-2.12.1/bfd/elf64-mips.c --- binutils-2.12/bfd/elf64-mips.c Tue Feb 19 08:10:32 2002 +++ binutils-2.12.1/bfd/elf64-mips.c Thu Apr 4 11:20:38 2002 @@ -3052,6 +3052,9 @@ struct mips_elf64_hash_sort_data *hsd = (struct mips_elf64_hash_sort_data *) data; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link; + /* Symbols without dynamic symbol table entries aren't interesting at all. */ if (h->root.dynindx == -1) @@ -3090,9 +3093,9 @@ hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount; hsd.max_non_got_dynindx = max_local; mips_elf64_link_hash_traverse (((struct mips_elf64_link_hash_table *) - elf_hash_table (info)), - mips_elf64_sort_hash_table_f, - &hsd); + elf_hash_table (info)), + mips_elf64_sort_hash_table_f, + &hsd); /* There shoud have been enough room in the symbol table to accomodate both the GOT and non-GOT symbols. */ @@ -4685,6 +4688,9 @@ struct mips_elf64_link_hash_entry *h; PTR data ATTRIBUTE_UNUSED; { + if (h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link; + if (h->fn_stub != NULL && ! h->need_fn_stub) { @@ -6129,6 +6135,9 @@ boolean strip; asection *sec, *output_section; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link; + if (h->root.indx == -2) strip = false; else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 @@ -6619,8 +6628,8 @@ einfo.swap = swap; einfo.failed = false; mips_elf64_link_hash_traverse (mips_elf64_hash_table (info), - mips_elf64_output_extsym, - (PTR) &einfo); + mips_elf64_output_extsym, + (PTR) &einfo); if (einfo.failed) return false; diff -Nur binutils-2.12/bfd/elf64-mmix.c binutils-2.12.1/bfd/elf64-mmix.c --- binutils-2.12/bfd/elf64-mmix.c Sat Feb 9 00:04:27 2002 +++ binutils-2.12.1/bfd/elf64-mmix.c Thu May 9 10:49:00 2002 @@ -1953,16 +1953,16 @@ strlen (MMIX_LOC_SECTION_START_SYMBOL_PREFIX)) == 0) { /* See if we have another one. */ - struct elf_link_hash_entry *h - = (struct elf_link_hash_entry *) bfd_link_hash_lookup (info->hash, - *namep, - false, - false, false); + struct bfd_link_hash_entry *h = bfd_link_hash_lookup (info->hash, + *namep, + false, + false, + false); - if (h != NULL && h->root.type != bfd_link_hash_undefined) + if (h != NULL && h->type != bfd_link_hash_undefined) { /* How do we get the asymbol (or really: the filename) from h? - h->root.u.def.section->owner is NULL. */ + h->u.def.section->owner is NULL. */ ((*_bfd_error_handler) (_("%s: Error: multiple definition of `%s'; start of %s is set in a earlier linked file\n"), bfd_get_filename (abfd), *namep, diff -Nur binutils-2.12/bfd/elf64-ppc.c binutils-2.12.1/bfd/elf64-ppc.c --- binutils-2.12/bfd/elf64-ppc.c Mon Feb 25 00:03:58 2002 +++ binutils-2.12.1/bfd/elf64-ppc.c Thu May 9 10:49:01 2002 @@ -39,7 +39,21 @@ PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); static void ppc64_elf_info_to_howto PARAMS ((bfd *abfd, arelent *cache_ptr, Elf64_Internal_Rela *dst)); -static bfd_reloc_status_type ppc64_elf_addr16_ha_reloc +static bfd_reloc_status_type ppc64_elf_ha_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type ppc64_elf_brtaken_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type ppc64_elf_sectoff_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type ppc64_elf_sectoff_ha_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type ppc64_elf_toc_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type ppc64_elf_toc_ha_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type ppc64_elf_toc64_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type ppc64_elf_unhandled_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static boolean ppc64_elf_set_private_flags PARAMS ((bfd *, flagword)); @@ -101,12 +115,6 @@ PARAMS ((bfd *, struct bfd_link_info *)); -/* Mask to set RA in memory instructions. */ -#define RA_REGISTER_MASK 0x001f0000 - -/* Value to shift register by to insert RA. */ -#define RA_REGISTER_SHIFT 16 - /* The name of the dynamic interpreter. This is put in the .interp section. */ #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" @@ -146,6 +154,10 @@ /* Pad with this. */ #define NOP 0x60000000 +/* Some other nops. */ +#define CROR_151515 0x4def7b82 +#define CROR_313131 0x4ffffb82 + /* .glink entries for the first 32k functions are two instructions. */ #define LI_R0_0 0x38000000 /* li %r0,0 */ #define B_DOT 0x48000000 /* b . */ @@ -273,7 +285,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - ppc64_elf_addr16_ha_reloc, /* special_function */ + ppc64_elf_ha_reloc, /* special_function */ "R_PPC64_ADDR16_HA", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -306,7 +318,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_brtaken_reloc, /* special_function */ "R_PPC64_ADDR14_BRTAKEN",/* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -323,7 +335,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_brtaken_reloc, /* special_function */ "R_PPC64_ADDR14_BRNTAKEN",/* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -370,7 +382,7 @@ true, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_brtaken_reloc, /* special_function */ "R_PPC64_REL14_BRTAKEN", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -387,7 +399,7 @@ true, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_brtaken_reloc, /* special_function */ "R_PPC64_REL14_BRNTAKEN",/* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -403,7 +415,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_GOT16", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -419,7 +431,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_GOT16_LO", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -435,7 +447,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_GOT16_HI", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -451,7 +463,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont,/* complain_on_overflow */ - ppc64_elf_addr16_ha_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_GOT16_HA", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -470,7 +482,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_COPY", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -486,7 +498,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_GLOB_DAT", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -502,7 +514,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_JMP_SLOT", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -580,7 +592,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_PLT32", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -612,7 +624,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_PLT16_LO", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -628,7 +640,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_PLT16_HI", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -644,31 +656,29 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - ppc64_elf_addr16_ha_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_PLT16_HA", /* name */ false, /* partial_inplace */ 0, /* src_mask */ 0xffff, /* dst_mask */ false), /* pcrel_offset */ - /* 32-bit section relative relocation. */ - /* FIXME: Verify R_PPC64_SECTOFF. Seems strange with size=2 and - dst_mask=0. */ + /* 16-bit section relative relocation. */ HOWTO (R_PPC64_SECTOFF, /* type */ 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_sectoff_reloc, /* special_function */ "R_PPC64_SECTOFF", /* name */ false, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ - /* 16-bit lower half section relative relocation. */ + /* Like R_PPC64_SECTOFF, but no overflow warning. */ HOWTO (R_PPC64_SECTOFF_LO, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ @@ -676,7 +686,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_sectoff_reloc, /* special_function */ "R_PPC64_SECTOFF_LO", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -691,7 +701,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_sectoff_reloc, /* special_function */ "R_PPC64_SECTOFF_HI", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -706,7 +716,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - ppc64_elf_addr16_ha_reloc, /* special_function */ + ppc64_elf_sectoff_ha_reloc, /* special_function */ "R_PPC64_SECTOFF_HA", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -714,8 +724,7 @@ false), /* pcrel_offset */ /* Like R_PPC64_REL24 without touching the two least significant - bits. */ - /* FIXME: Verify R_PPC64_ADDR30. */ + bits. Should have been named R_PPC64_REL30! */ HOWTO (R_PPC64_ADDR30, /* type */ 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -771,7 +780,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - ppc64_elf_addr16_ha_reloc, /* special_function */ + ppc64_elf_ha_reloc, /* special_function */ "R_PPC64_ADDR16_HIGHERA", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -802,7 +811,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - ppc64_elf_addr16_ha_reloc, /* special_function */ + ppc64_elf_ha_reloc, /* special_function */ "R_PPC64_ADDR16_HIGHESTA", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -847,7 +856,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_PLT64", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -864,7 +873,7 @@ true, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_PLTREL64", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -881,7 +890,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_toc_reloc, /* special_function */ "R_PPC64_TOC16", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -898,7 +907,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_toc_reloc, /* special_function */ "R_PPC64_TOC16_LO", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -915,7 +924,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_toc_reloc, /* special_function */ "R_PPC64_TOC16_HI", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -934,7 +943,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - ppc64_elf_addr16_ha_reloc, /* special_function */ + ppc64_elf_toc_ha_reloc, /* special_function */ "R_PPC64_TOC16_HA", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -951,7 +960,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_toc64_reloc, /* special_function */ "R_PPC64_TOC", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -974,7 +983,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_PLTGOT16", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -990,7 +999,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_PLTGOT16_LO", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -1006,7 +1015,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_PLTGOT16_HI", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -1024,7 +1033,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont,/* complain_on_overflow */ - ppc64_elf_addr16_ha_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_PLTGOT16_HA", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -1069,7 +1078,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_GOT16_DS", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -1084,7 +1093,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_GOT16_LO_DS", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -1099,7 +1108,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_PLT16_LO_DS", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -1107,21 +1116,19 @@ false), /* pcrel_offset */ /* Like R_PPC64_SECTOFF, but for instructions with a DS field. */ - /* FIXME: Verify R_PPC64_SECTOFF. Seems strange with size=2 and - dst_mask=0. */ HOWTO (R_PPC64_SECTOFF_DS, /* type */ 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_sectoff_reloc, /* special_function */ "R_PPC64_SECTOFF_DS", /* name */ false, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ + 0xfffc, /* dst_mask */ + false), /* pcrel_offset */ /* Like R_PPC64_SECTOFF_LO, but for instructions with a DS field. */ HOWTO (R_PPC64_SECTOFF_LO_DS, /* type */ @@ -1131,7 +1138,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_sectoff_reloc, /* special_function */ "R_PPC64_SECTOFF_LO_DS",/* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -1146,7 +1153,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_toc_reloc, /* special_function */ "R_PPC64_TOC16_DS", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -1161,7 +1168,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_toc_reloc, /* special_function */ "R_PPC64_TOC16_LO_DS", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -1177,7 +1184,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_PLTGOT16_DS", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -1193,7 +1200,7 @@ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_unhandled_reloc, /* special_function */ "R_PPC64_PLTGOT16_LO_DS",/* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -1319,7 +1326,7 @@ break; case BFD_RELOC_HI16_S_PLTOFF: ppc_reloc = R_PPC64_PLT16_HA; break; - case BFD_RELOC_32_BASEREL: ppc_reloc = R_PPC64_SECTOFF; + case BFD_RELOC_16_BASEREL: ppc_reloc = R_PPC64_SECTOFF; break; case BFD_RELOC_LO16_BASEREL: ppc_reloc = R_PPC64_SECTOFF_LO; break; @@ -1417,41 +1424,265 @@ /* Handle the R_PPC_ADDR16_HA and similar relocs. */ static bfd_reloc_status_type -ppc64_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; +ppc64_elf_ha_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; arelent *reloc_entry; asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; + PTR data; asection *input_section; bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; + char **error_message; { - bfd_vma relocation; + /* If this is a relocatable link (output_bfd test tells us), just + call the generic function. Any adjustment will be done at final + link time. */ + if (output_bfd != NULL) + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + + /* Adjust the addend for sign extension of the low 16 bits. + We won't actually be using the low 16 bits, so trashing them + doesn't matter. */ + reloc_entry->addend += 0x8000; + return bfd_reloc_continue; +} +static bfd_reloc_status_type +ppc64_elf_brtaken_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + long insn; + enum elf_ppc_reloc_type r_type; + bfd_size_type octets; + /* Disabled until we sort out how ld should choose 'y' vs 'at'. */ + boolean is_power4 = false; + + /* If this is a relocatable link (output_bfd test tells us), just + call the generic function. Any adjustment will be done at final + link time. */ if (output_bfd != NULL) + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + + octets = reloc_entry->address * bfd_octets_per_byte (abfd); + insn = bfd_get_32 (abfd, (bfd_byte *) data + octets); + insn &= ~(0x01 << 21); + r_type = (enum elf_ppc_reloc_type) reloc_entry->howto->type; + if (r_type == R_PPC64_ADDR14_BRTAKEN + || r_type == R_PPC64_REL14_BRTAKEN) + insn |= 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field. */ + + if (is_power4) + { + /* Set 'a' bit. This is 0b00010 in BO field for branch + on CR(BI) insns (BO == 001at or 011at), and 0b01000 + for branch on CTR insns (BO == 1a00t or 1a01t). */ + if ((insn & (0x14 << 21)) == (0x04 << 21)) + insn |= 0x02 << 21; + else if ((insn & (0x14 << 21)) == (0x10 << 21)) + insn |= 0x08 << 21; + else + return bfd_reloc_continue; + } + else { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; + bfd_vma target = 0; + bfd_vma from; + + if (!bfd_is_com_section (symbol->section)) + target = symbol->value; + target += symbol->section->output_section->vma; + target += symbol->section->output_offset; + target += reloc_entry->addend; + + from = (reloc_entry->address + + input_section->output_offset + + input_section->output_section->vma); + + /* Invert 'y' bit if not the default. */ + if ((bfd_signed_vma) (target - from) < 0) + insn ^= 0x01 << 21; } + bfd_put_32 (abfd, (bfd_vma) insn, (bfd_byte *) data + octets); + return bfd_reloc_continue; +} + +static bfd_reloc_status_type +ppc64_elf_sectoff_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + /* If this is a relocatable link (output_bfd test tells us), just + call the generic function. Any adjustment will be done at final + link time. */ + if (output_bfd != NULL) + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; + /* Subtract the symbol section base address. */ + reloc_entry->addend -= symbol->section->output_section->vma; + return bfd_reloc_continue; +} - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; +static bfd_reloc_status_type +ppc64_elf_sectoff_ha_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + /* If this is a relocatable link (output_bfd test tells us), just + call the generic function. Any adjustment will be done at final + link time. */ + if (output_bfd != NULL) + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; + /* Subtract the symbol section base address. */ + reloc_entry->addend -= symbol->section->output_section->vma; - reloc_entry->addend += (relocation & 0x8000) << 1; + /* Adjust the addend for sign extension of the low 16 bits. */ + reloc_entry->addend += 0x8000; + return bfd_reloc_continue; +} +static bfd_reloc_status_type +ppc64_elf_toc_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + bfd_vma TOCstart; + + /* If this is a relocatable link (output_bfd test tells us), just + call the generic function. Any adjustment will be done at final + link time. */ + if (output_bfd != NULL) + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + + TOCstart = _bfd_get_gp_value (input_section->output_section->owner); + if (TOCstart == 0) + TOCstart = ppc64_elf_toc (input_section->output_section->owner); + + /* Subtract the TOC base address. */ + reloc_entry->addend -= TOCstart + TOC_BASE_OFF; return bfd_reloc_continue; } +static bfd_reloc_status_type +ppc64_elf_toc_ha_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + bfd_vma TOCstart; + + /* If this is a relocatable link (output_bfd test tells us), just + call the generic function. Any adjustment will be done at final + link time. */ + if (output_bfd != NULL) + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + + TOCstart = _bfd_get_gp_value (input_section->output_section->owner); + if (TOCstart == 0) + TOCstart = ppc64_elf_toc (input_section->output_section->owner); + + /* Subtract the TOC base address. */ + reloc_entry->addend -= TOCstart + TOC_BASE_OFF; + + /* Adjust the addend for sign extension of the low 16 bits. */ + reloc_entry->addend += 0x8000; + return bfd_reloc_continue; +} + +static bfd_reloc_status_type +ppc64_elf_toc64_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + bfd_vma TOCstart; + bfd_size_type octets; + + /* If this is a relocatable link (output_bfd test tells us), just + call the generic function. Any adjustment will be done at final + link time. */ + if (output_bfd != NULL) + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + + TOCstart = _bfd_get_gp_value (input_section->output_section->owner); + if (TOCstart == 0) + TOCstart = ppc64_elf_toc (input_section->output_section->owner); + + octets = reloc_entry->address * bfd_octets_per_byte (abfd); + bfd_put_64 (abfd, TOCstart + TOC_BASE_OFF, (bfd_byte *) data + octets); + return bfd_reloc_ok; +} + +static bfd_reloc_status_type +ppc64_elf_unhandled_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + /* If this is a relocatable link (output_bfd test tells us), just + call the generic function. Any adjustment will be done at final + link time. */ + if (output_bfd != NULL) + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + + if (error_message != NULL) + { + static char buf[60]; + sprintf (buf, "generic linker can't handle %s", + reloc_entry->howto->name); + *error_message = buf; + } + return bfd_reloc_dangerous; +} + /* Function to set whether a module needs the -mrelocatable bit set. */ static boolean @@ -1731,6 +1962,9 @@ /* Set on error. */ int plt_overflow; + /* Set if we detect a reference undefined weak symbol. */ + unsigned int have_undefweak; + /* Small local sym to section mapping cache. */ struct sym_sec_cache sym_sec; }; @@ -1800,6 +2034,7 @@ htab->sglink = NULL; htab->sfpr = NULL; htab->plt_overflow = 0; + htab->have_undefweak = 0; htab->sym_sec.abfd = NULL; return &htab->elf.root; @@ -2501,10 +2736,12 @@ struct bfd_link_info *info; struct ppc_link_hash_table *htab; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = ppc_hash_table (info); @@ -2513,6 +2750,10 @@ if (!((struct ppc_link_hash_entry *) h)->is_func) return true; + if (h->root.type == bfd_link_hash_undefweak + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR)) + htab->have_undefweak = true; + if (h->plt.refcount > 0 && h->root.root.string[0] == '.' && h->root.root.string[1] != '\0') @@ -2608,6 +2849,7 @@ unsigned int lowest_restf = MAX_SAVE_FPR + 2; unsigned int i; struct elf_link_hash_entry *h; + bfd_byte *p; char sym[10]; htab = ppc_hash_table (info); @@ -2658,41 +2900,52 @@ } } + elf_link_hash_traverse (&htab->elf, func_desc_adjust, (PTR) info); + htab->sfpr->_raw_size = ((MAX_SAVE_FPR + 2 - lowest_savef) * 4 + (MAX_SAVE_FPR + 2 - lowest_restf) * 4); if (htab->sfpr->_raw_size == 0) { - _bfd_strip_section_from_output (info, htab->sfpr); - } - else - { - bfd_byte *p = (bfd_byte *) bfd_alloc (htab->elf.dynobj, - htab->sfpr->_raw_size); - if (p == NULL) - return false; - htab->sfpr->contents = p; - - for (i = lowest_savef; i <= MAX_SAVE_FPR; i++) + if (!htab->have_undefweak) { - unsigned int fpr = i << 21; - unsigned int stackoff = (1 << 16) - (MAX_SAVE_FPR + 1 - i) * 8; - bfd_put_32 (htab->elf.dynobj, STFD_FR0_0R1 + fpr + stackoff, p); - p += 4; + _bfd_strip_section_from_output (info, htab->sfpr); + return true; } + + htab->sfpr->_raw_size = 4; + } + + p = (bfd_byte *) bfd_alloc (htab->elf.dynobj, htab->sfpr->_raw_size); + if (p == NULL) + return false; + htab->sfpr->contents = p; + + for (i = lowest_savef; i <= MAX_SAVE_FPR; i++) + { + unsigned int fpr = i << 21; + unsigned int stackoff = (1 << 16) - (MAX_SAVE_FPR + 1 - i) * 8; + bfd_put_32 (htab->elf.dynobj, STFD_FR0_0R1 + fpr + stackoff, p); + p += 4; + } + if (lowest_savef <= MAX_SAVE_FPR) + { bfd_put_32 (htab->elf.dynobj, BLR, p); p += 4; + } - for (i = lowest_restf; i <= MAX_SAVE_FPR; i++) - { - unsigned int fpr = i << 21; - unsigned int stackoff = (1 << 16) - (MAX_SAVE_FPR + 1 - i) * 8; - bfd_put_32 (htab->elf.dynobj, LFD_FR0_0R1 + fpr + stackoff, p); - p += 4; - } - bfd_put_32 (htab->elf.dynobj, BLR, p); + for (i = lowest_restf; i <= MAX_SAVE_FPR; i++) + { + unsigned int fpr = i << 21; + unsigned int stackoff = (1 << 16) - (MAX_SAVE_FPR + 1 - i) * 8; + bfd_put_32 (htab->elf.dynobj, LFD_FR0_0R1 + fpr + stackoff, p); p += 4; } + if (lowest_restf <= MAX_SAVE_FPR + || htab->sfpr->_raw_size == 4) + { + bfd_put_32 (htab->elf.dynobj, BLR, p); + } elf_link_hash_traverse (&htab->elf, func_desc_adjust, (PTR) info); return true; @@ -2875,10 +3128,12 @@ struct ppc_link_hash_entry *eh; struct ppc_dyn_relocs *p; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = ppc_hash_table (info); @@ -3034,6 +3289,9 @@ struct ppc_link_hash_entry *eh; struct ppc_dyn_relocs *p; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + eh = (struct ppc_link_hash_entry *) h; for (p = eh->dyn_relocs; p != NULL; p = p->next) { @@ -3278,69 +3536,61 @@ return true; } -/* Called after we have seen all the input files/sections, but before - final symbol resolution and section placement has been determined. - - We use this hook to provide a value for TOCstart, which we store in - the output bfd elf_gp. */ +/* Called after we have determined section placement. If sections + move, we'll be called again. Provide a value for TOCstart. */ -boolean -ppc64_elf_set_toc (obfd, info) +bfd_vma +ppc64_elf_toc (obfd) bfd *obfd; - struct bfd_link_info *info; { - if (!info->relocateable) - { - asection *s; - bfd_vma TOCstart; + asection *s; + bfd_vma TOCstart; - /* The TOC consists of sections .got, .toc, .tocbss, .plt in that - order. The TOC starts where the first of these sections starts. */ - s = bfd_get_section_by_name (obfd, ".got"); - if (s == NULL) - s = bfd_get_section_by_name (obfd, ".toc"); + /* The TOC consists of sections .got, .toc, .tocbss, .plt in that + order. The TOC starts where the first of these sections starts. */ + s = bfd_get_section_by_name (obfd, ".got"); + if (s == NULL) + s = bfd_get_section_by_name (obfd, ".toc"); + if (s == NULL) + s = bfd_get_section_by_name (obfd, ".tocbss"); + if (s == NULL) + s = bfd_get_section_by_name (obfd, ".plt"); + if (s == NULL) + { + /* This may happen for + o references to TOC base (SYM@toc / TOC[tc0]) without a + .toc directive + o bad linker script + o --gc-sections and empty TOC sections + + FIXME: Warn user? */ + + /* Look for a likely section. We probably won't even be + using TOCstart. */ + for (s = obfd->sections; s != NULL; s = s->next) + if ((s->flags & (SEC_ALLOC | SEC_SMALL_DATA | SEC_READONLY)) + == (SEC_ALLOC | SEC_SMALL_DATA)) + break; if (s == NULL) - s = bfd_get_section_by_name (obfd, ".tocbss"); + for (s = obfd->sections; s != NULL; s = s->next) + if ((s->flags & (SEC_ALLOC | SEC_SMALL_DATA)) + == (SEC_ALLOC | SEC_SMALL_DATA)) + break; if (s == NULL) - s = bfd_get_section_by_name (obfd, ".plt"); + for (s = obfd->sections; s != NULL; s = s->next) + if ((s->flags & (SEC_ALLOC | SEC_READONLY)) == SEC_ALLOC) + break; if (s == NULL) - { - /* This may happen for - o references to TOC base (SYM@toc / TOC[tc0]) without a - .toc directive - o bad linker script - o --gc-sections and empty TOC sections - - FIXME: Warn user? */ - - /* Look for a likely section. We probably won't even be - using TOCstart. */ - for (s = obfd->sections; s != NULL; s = s->next) - if ((s->flags & (SEC_ALLOC | SEC_SMALL_DATA | SEC_READONLY)) - == (SEC_ALLOC | SEC_SMALL_DATA)) - break; - if (s == NULL) - for (s = obfd->sections; s != NULL; s = s->next) - if ((s->flags & (SEC_ALLOC | SEC_SMALL_DATA)) - == (SEC_ALLOC | SEC_SMALL_DATA)) - break; - if (s == NULL) - for (s = obfd->sections; s != NULL; s = s->next) - if ((s->flags & (SEC_ALLOC | SEC_READONLY)) == SEC_ALLOC) - break; - if (s == NULL) - for (s = obfd->sections; s != NULL; s = s->next) - if ((s->flags & SEC_ALLOC) == SEC_ALLOC) - break; - } + for (s = obfd->sections; s != NULL; s = s->next) + if ((s->flags & SEC_ALLOC) == SEC_ALLOC) + break; + } - TOCstart = 0; - if (s != NULL) - TOCstart = s->output_section->vma + s->output_offset; + TOCstart = 0; + if (s != NULL) + TOCstart = s->output_section->vma + s->output_offset; - elf_gp (obfd) = TOCstart; - } - return true; + return TOCstart; } /* PowerPC64 .plt entries are 24 bytes long, which doesn't divide @@ -3635,6 +3885,9 @@ /* Disabled until we sort out how ld should choose 'y' vs 'at'. */ boolean is_power4 = false; + if (info->relocateable) + return true; + /* Initialize howto table if needed. */ if (!ppc64_elf_howto_table[R_PPC64_ADDR32]) ppc_howto_init (); @@ -3661,32 +3914,11 @@ unsigned long r_symndx; bfd_vma relocation; boolean unresolved_reloc; - boolean has_nop; long insn; + bfd_vma from; r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info); r_symndx = ELF64_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocatable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if ((unsigned) ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - continue; - } - - /* This is a final link. */ - offset = rel->r_offset; addend = rel->r_addend; r = bfd_reloc_other; @@ -3709,6 +3941,7 @@ sym_name = ""; relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + /* rel may have changed, update our copy of addend. */ addend = rel->r_addend; } else @@ -3784,8 +4017,12 @@ } else { + from = (offset + + input_section->output_offset + + input_section->output_section->vma); + /* Invert 'y' bit if not the default. */ - if ((bfd_signed_vma) (relocation - offset) < 0) + if ((bfd_signed_vma) (relocation + addend - from) < 0) insn ^= 0x01 << 21; } @@ -3793,57 +4030,71 @@ break; case R_PPC64_REL24: - case R_PPC64_ADDR24: - /* An ADDR24 or REL24 branching to a linkage function may be - followed by a nop that we have to replace with a ld in - order to restore the TOC base pointer. Only calls to - shared objects need to alter the TOC base. These are - recognized by their need for a PLT entry. */ - has_nop = 0; + /* A REL24 branching to a linkage function is followed by a + nop. We replace the nop with a ld in order to restore + the TOC base pointer. Only calls to shared objects need + to alter the TOC base. These are recognized by their + need for a PLT entry. */ if (h != NULL && h->plt.offset != (bfd_vma) -1 && htab->sstub != NULL) { - /* plt.offset here is the offset into the stub section. */ - relocation = (htab->sstub->output_section->vma - + htab->sstub->output_offset - + h->plt.offset); - unresolved_reloc = false; + boolean can_plt_call = 0; - /* Make sure that there really is an instruction after - the branch that we can decode. */ if (offset + 8 <= input_section->_cooked_size) { - bfd_byte *pnext; - - pnext = contents + offset + 4; - insn = bfd_get_32 (input_bfd, pnext); - - if (insn == 0x60000000 /* nop (ori r0,r0,0) */ - || insn == 0x4def7b82 /* cror 15,15,15 */ - || insn == 0x4ffffb82) /* cror 31,31,31 */ + insn = bfd_get_32 (input_bfd, contents + offset + 4); + if (insn == NOP + || insn == CROR_151515 || insn == CROR_313131) { - bfd_put_32 (input_bfd, - (bfd_vma) 0xe8410028, /* ld r2,40(r1) */ - pnext); - has_nop = 1; + bfd_put_32 (input_bfd, (bfd_vma) LD_R2_40R1, + contents + offset + 4); + can_plt_call = 1; } } + + if (!can_plt_call) + { + /* If this is a plain branch rather than a branch + and link, don't require a nop. */ + insn = bfd_get_32 (input_bfd, contents + offset); + if ((insn & 1) == 0) + can_plt_call = 1; + } + + if (can_plt_call) + { + /* plt.offset here is the offset into the stub section. */ + relocation = (htab->sstub->output_section->vma + + htab->sstub->output_offset + + h->plt.offset); + addend = 0; + unresolved_reloc = false; + } } if (h != NULL && h->root.type == bfd_link_hash_undefweak - && r_type == R_PPC64_REL24 - && addend == 0 - && relocation == 0) + && relocation == 0 + && addend == 0) { - /* Tweak calls to undefined weak functions to behave as - if the "called" function immediately returns. We can - thus call to a weak function without first checking - whether the function is defined. */ - relocation = 4; - if (has_nop) - relocation = 8; + /* Tweak calls to undefined weak functions to point at a + blr. We can thus call a weak function without first + checking whether the function is defined. We have a + blr at the end of .sfpr. */ + BFD_ASSERT (htab->sfpr->_raw_size != 0); + relocation = (htab->sfpr->_raw_size - 4 + + htab->sfpr->output_offset + + htab->sfpr->output_section->vma); + from = (offset + + input_section->output_offset + + input_section->output_section->vma); + + /* But let's not be silly about it. If the blr isn't in + reach, just go to the next instruction. */ + if (relocation - from + (1 << 25) >= (1 << 26) + || htab->sfpr->_raw_size == 0) + relocation = from + 4; } break; } @@ -4586,6 +4837,7 @@ #define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE #define elf_backend_can_gc_sections 1 #define elf_backend_can_refcount 1 +#define elf_backend_rela_normal 1 #define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup #define bfd_elf64_bfd_set_private_flags ppc64_elf_set_private_flags diff -Nur binutils-2.12/bfd/elf64-ppc.h binutils-2.12.1/bfd/elf64-ppc.h --- binutils-2.12/bfd/elf64-ppc.h Wed Jan 16 00:50:03 2002 +++ binutils-2.12.1/bfd/elf64-ppc.h Thu May 9 10:49:01 2002 @@ -17,6 +17,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -boolean ppc64_elf_set_toc PARAMS ((bfd *, struct bfd_link_info *)); +bfd_vma ppc64_elf_toc PARAMS ((bfd *)); boolean ppc64_elf_size_stubs PARAMS ((bfd *, struct bfd_link_info *, int *)); boolean ppc64_elf_build_stubs PARAMS ((bfd *, struct bfd_link_info *)); diff -Nur binutils-2.12/bfd/elf64-s390.c binutils-2.12.1/bfd/elf64-s390.c --- binutils-2.12/bfd/elf64-s390.c Tue Feb 19 08:10:26 2002 +++ binutils-2.12.1/bfd/elf64-s390.c Thu May 9 10:49:01 2002 @@ -1,5 +1,5 @@ /* IBM S/390-specific support for 64-bit ELF - Copyright 2000, 2001 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. Contributed Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of BFD, the Binary File Descriptor library. @@ -1169,10 +1169,12 @@ struct elf_s390_link_hash_entry *eh; struct elf_s390_dyn_relocs *p; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = elf_s390_hash_table (info); @@ -1339,6 +1341,9 @@ struct elf_s390_link_hash_entry *eh; struct elf_s390_dyn_relocs *p; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + eh = (struct elf_s390_link_hash_entry *) h; for (p = eh->dyn_relocs; p != NULL; p = p->next) { @@ -1582,6 +1587,9 @@ Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; + if (info->relocateable) + return true; + htab = elf_s390_hash_table (info); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -1611,30 +1619,9 @@ bfd_set_error (bfd_error_bad_value); return false; } - howto = elf_howto_table + r_type; + howto = elf_howto_table + r_type; r_symndx = ELF64_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ h = NULL; sym = NULL; sec = NULL; @@ -2325,7 +2312,7 @@ elf_s390_object_p (abfd) bfd *abfd; { - return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_esame); + return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_64); } /* @@ -2379,6 +2366,7 @@ #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 24 #define elf_backend_plt_header_size PLT_ENTRY_SIZE +#define elf_backend_rela_normal 1 #define elf_info_to_howto elf_s390_info_to_howto diff -Nur binutils-2.12/bfd/elf64-sh64.c binutils-2.12.1/bfd/elf64-sh64.c --- binutils-2.12/bfd/elf64-sh64.c Fri Feb 22 05:06:17 2002 +++ binutils-2.12.1/bfd/elf64-sh64.c Thu May 9 10:49:01 2002 @@ -2929,7 +2929,8 @@ bfd_vma *valp; { /* We want to do this for relocatable as well as final linking. */ - if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL) + if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL + && info->hash->creator->flavour == bfd_target_elf_flavour) { struct elf_link_hash_entry *h; @@ -3606,6 +3607,9 @@ PTR ignore ATTRIBUTE_UNUSED; { struct elf_sh64_pcrel_relocs_copied *s; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_sh64_link_hash_entry *) h->root.root.u.i.link; /* We only discard relocs for symbols defined in a regular object. */ if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) diff -Nur binutils-2.12/bfd/elf64-sparc.c binutils-2.12.1/bfd/elf64-sparc.c --- binutils-2.12/bfd/elf64-sparc.c Tue Feb 19 08:10:28 2002 +++ binutils-2.12.1/bfd/elf64-sparc.c Thu May 9 10:49:01 2002 @@ -1,5 +1,5 @@ /* SPARC-specific support for 64-bit ELF - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1385,9 +1385,8 @@ *namep = NULL; return true; } - else if (! *namep || ! **namep) - return true; - else + else if (*namep && **namep + && info->hash->creator->flavour == bfd_target_elf_flavour) { int i; struct sparc64_elf_app_reg *p; @@ -1881,6 +1880,17 @@ return true; } +/* This is the condition under which 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 relocate_section. */ +#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \ + ((DYN) \ + && ((INFO)->shared \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \ + && ((H)->dynindx != -1 \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) + /* Relocate a SPARC64 ELF section. */ static boolean @@ -1928,9 +1938,10 @@ struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; asection *sec; - bfd_vma relocation; + bfd_vma relocation, off; bfd_reloc_status_type r; boolean is_plt = false; + boolean unresolved_reloc; r_type = ELF64_R_TYPE_ID (rel->r_info); if (r_type < 0 || r_type >= (int) R_SPARC_max_std) @@ -1965,6 +1976,7 @@ h = NULL; sym = NULL; sec = NULL; + unresolved_reloc = false; if (r_symndx < symtab_hdr->sh_info) { sym = local_syms + r_symndx; @@ -1977,116 +1989,30 @@ while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + relocation = 0; if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { - boolean skip_it = false; sec = h->root.u.def.section; - - switch (r_type) - { - case R_SPARC_WPLT30: - case R_SPARC_PLT32: - case R_SPARC_HIPLT22: - case R_SPARC_LOPLT10: - case R_SPARC_PCPLT32: - case R_SPARC_PCPLT22: - case R_SPARC_PCPLT10: - case R_SPARC_PLT64: - if (h->plt.offset != (bfd_vma) -1) - skip_it = true; - break; - - case R_SPARC_GOT10: - case R_SPARC_GOT13: - case R_SPARC_GOT22: - if (elf_hash_table(info)->dynamic_sections_created - && (!info->shared - || (!info->symbolic && h->dynindx != -1) - || !(h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR))) - skip_it = true; - break; - - case R_SPARC_PC10: - case R_SPARC_PC22: - case R_SPARC_PC_HH22: - case R_SPARC_PC_HM10: - case R_SPARC_PC_LM22: - if (!strcmp(h->root.root.string, "_GLOBAL_OFFSET_TABLE_")) - break; - /* FALLTHRU */ - - case R_SPARC_8: - case R_SPARC_16: - case R_SPARC_32: - case R_SPARC_DISP8: - case R_SPARC_DISP16: - case R_SPARC_DISP32: - case R_SPARC_WDISP30: - case R_SPARC_WDISP22: - case R_SPARC_HI22: - case R_SPARC_22: - case R_SPARC_13: - case R_SPARC_LO10: - case R_SPARC_UA32: - case R_SPARC_10: - case R_SPARC_11: - case R_SPARC_64: - case R_SPARC_OLO10: - case R_SPARC_HH22: - case R_SPARC_HM10: - case R_SPARC_LM22: - case R_SPARC_WDISP19: - case R_SPARC_WDISP16: - case R_SPARC_7: - case R_SPARC_5: - case R_SPARC_6: - case R_SPARC_DISP64: - case R_SPARC_HIX22: - case R_SPARC_LOX10: - case R_SPARC_H44: - case R_SPARC_M44: - case R_SPARC_L44: - case R_SPARC_UA64: - case R_SPARC_UA16: - if (info->shared - && ((!info->symbolic && h->dynindx != -1) - || !(h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR)) - && ((input_section->flags & SEC_ALLOC) != 0 - /* DWARF will emit R_SPARC_{32,64} relocations in - its sections against symbols defined externally - in shared libraries. We can't do anything - with them here. */ - || ((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0))) - skip_it = true; - break; - } - - if (skip_it) - { - /* In these cases, we don't need the relocation - value. We check specially because in some - obscure cases sec->output_section will be NULL. */ - relocation = 0; - } + if (sec->output_section == NULL) + /* Set a flag that will be cleared later if we find a + relocation value for this symbol. output_section + is typically NULL for symbols satisfied by a shared + library. */ + unresolved_reloc = true; else - { - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } + relocation = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); } else if (h->root.type == bfd_link_hash_undefweak) - relocation = 0; + ; else if (info->shared && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) - relocation = 0; + ; else { if (! ((*info->callbacks->undefined_symbol) @@ -2107,7 +2033,7 @@ } } -do_dynreloc: + do_dynreloc: /* When generating a shared object, these relocations are copied into the output file to be resolved at run time. */ if (info->shared && r_symndx != 0 && (input_section->flags & SEC_ALLOC)) @@ -2126,11 +2052,11 @@ case R_SPARC_DISP8: case R_SPARC_DISP16: case R_SPARC_DISP32: + case R_SPARC_DISP64: case R_SPARC_WDISP30: case R_SPARC_WDISP22: case R_SPARC_WDISP19: case R_SPARC_WDISP16: - case R_SPARC_DISP64: if (h == NULL) break; /* Fall through. */ @@ -2219,6 +2145,18 @@ case R_SPARC_UA64: if (!(outrel.r_offset & 7)) r_type = R_SPARC_64; break; + case R_SPARC_DISP8: + case R_SPARC_DISP16: + case R_SPARC_DISP32: + case R_SPARC_DISP64: + /* If the symbol is not dynamic, we should not keep + a dynamic relocation. But an .rela.* slot has been + allocated for it, output R_SPARC_NONE. + FIXME: Add code tracking needed dynamic relocs as + e.g. i386 has. */ + if (h->dynindx == -1) + skip = true, relocate = true; + break; } if (skip) @@ -2326,14 +2264,18 @@ if (h != NULL) { - bfd_vma off = h->got.offset; + boolean dyn; + + off = h->got.offset; BFD_ASSERT (off != (bfd_vma) -1); + dyn = elf_hash_table (info)->dynamic_sections_created; - if (! elf_hash_table (info)->dynamic_sections_created + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, 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)) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) { /* This is actually a static link, or it is a -Bsymbolic link and the symbol is defined locally, or the symbol @@ -2356,12 +2298,11 @@ h->got.offset |= 1; } } - relocation = sgot->output_offset + off - got_base; + else + unresolved_reloc = false; } else { - bfd_vma off; - BFD_ASSERT (local_got_offsets != NULL); off = local_got_offsets[r_symndx]; BFD_ASSERT (off != (bfd_vma) -1); @@ -2407,8 +2348,8 @@ else bfd_put_64 (output_bfd, relocation, sgot->contents + off); } - relocation = sgot->output_offset + off - got_base; } + relocation = sgot->output_offset + off - got_base; goto do_default; case R_SPARC_WPLT30: @@ -2440,6 +2381,7 @@ relocation = (splt->output_section->vma + splt->output_offset + sparc64_elf_plt_entry_offset (h->plt.offset)); + unresolved_reloc = false; if (r_type == R_SPARC_WPLT30) goto do_wplt30; if (r_type == R_SPARC_PLT32 || r_type == R_SPARC_PLT64) @@ -2622,6 +2564,17 @@ relocation, rel->r_addend); break; } + + if (unresolved_reloc + && !(info->shared + && (input_section->flags & SEC_DEBUGGING) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + (*_bfd_error_handler) + (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, + h->root.root.string); switch (r) { diff -Nur binutils-2.12/bfd/elf64-x86-64.c binutils-2.12.1/bfd/elf64-x86-64.c --- binutils-2.12/bfd/elf64-x86-64.c Fri Feb 22 05:06:18 2002 +++ binutils-2.12.1/bfd/elf64-x86-64.c Thu May 9 10:49:02 2002 @@ -1,5 +1,5 @@ /* X86-64 specific support for 64-bit ELF - Copyright 2000, 2001 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Jan Hubicka . This file is part of BFD, the Binary File Descriptor library. @@ -20,13 +20,14 @@ #include "bfd.h" #include "sysdep.h" +#include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" #include "elf/x86-64.h" /* We use only the RELA entries. */ -#define USE_RELA +#define USE_RELA 1 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */ #define MINUS_ONE (~ (bfd_vma) 0) @@ -127,6 +128,12 @@ static struct bfd_link_hash_table *elf64_x86_64_link_hash_table_create PARAMS ((bfd *)); static boolean elf64_x86_64_elf_object_p PARAMS ((bfd *abfd)); +static boolean create_got_section + PARAMS((bfd *, struct bfd_link_info *)); +static boolean elf64_x86_64_create_dynamic_sections + PARAMS((bfd *, struct bfd_link_info *)); +static void elf64_x86_64_copy_indirect_symbol + PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *)); static boolean elf64_x86_64_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *sec, const Elf_Internal_Rela *)); @@ -138,11 +145,15 @@ PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); -static struct bfd_hash_entry *elf64_x86_64_link_hash_newfunc +static struct bfd_hash_entry *link_hash_newfunc PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); static boolean elf64_x86_64_adjust_dynamic_symbol PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); +static boolean allocate_dynrelocs + PARAMS ((struct elf_link_hash_entry *, PTR)); +static boolean readonly_dynrelocs + PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean elf64_x86_64_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static boolean elf64_x86_64_relocate_section @@ -235,53 +246,54 @@ }; /* The x86-64 linker needs to keep track of the number of relocs that - it decides to copy in check_relocs for each symbol. This is so - that it can discard PC relative relocs if it doesn't need them when - linking with -Bsymbolic. We store the information in a field - extending the regular ELF linker hash table. */ + it decides to copy as dynamic relocs in check_relocs for each symbol. + This is so that it can later discard them if they are found to be + unnecessary. We store the information in a field extending the + regular ELF linker hash table. */ -/* This structure keeps track of the number of PC relative relocs we - have copied for a given symbol. */ - -struct elf64_x86_64_pcrel_relocs_copied +struct elf64_x86_64_dyn_relocs { /* Next section. */ - struct elf64_x86_64_pcrel_relocs_copied *next; - /* A section in dynobj. */ - asection *section; - /* Number of relocs copied in this section. */ + struct elf64_x86_64_dyn_relocs *next; + + /* The input section of the reloc. */ + asection *sec; + + /* Total number of relocs copied for the input section. */ bfd_size_type count; + + /* Number of pc-relative relocs copied for the input section. */ + bfd_size_type pc_count; }; /* x86-64 ELF linker hash entry. */ struct elf64_x86_64_link_hash_entry { - struct elf_link_hash_entry root; + struct elf_link_hash_entry elf; - /* Number of PC relative relocs copied for this symbol. */ - struct elf64_x86_64_pcrel_relocs_copied *pcrel_relocs_copied; + /* Track dynamic relocs copied for this symbol. */ + struct elf64_x86_64_dyn_relocs *dyn_relocs; }; -/* x86-64 ELF linker hash table. */ +/* x86-64 ELF linker hash table. */ struct elf64_x86_64_link_hash_table { - struct elf_link_hash_table root; -}; - -/* Declare this now that the above structures are defined. */ + struct elf_link_hash_table elf; -static boolean elf64_x86_64_discard_copies - PARAMS ((struct elf64_x86_64_link_hash_entry *, PTR)); - -/* Traverse an x86-64 ELF linker hash table. */ + /* Short-cuts to get to dynamic linker sections. */ + asection *sgot; + asection *sgotplt; + asection *srelgot; + asection *splt; + asection *srelplt; + asection *sdynbss; + asection *srelbss; -#define elf64_x86_64_link_hash_traverse(table, func, info) \ - (elf_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ - (info))) + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; +}; /* Get the x86-64 ELF linker hash table from a link_info structure. */ @@ -291,33 +303,32 @@ /* Create an entry in an x86-64 ELF linker hash table. */ static struct bfd_hash_entry * -elf64_x86_64_link_hash_newfunc (entry, table, string) +link_hash_newfunc (entry, table, string) struct bfd_hash_entry *entry; struct bfd_hash_table *table; const char *string; { - struct elf64_x86_64_link_hash_entry *ret = - (struct elf64_x86_64_link_hash_entry *) entry; - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct elf64_x86_64_link_hash_entry *) NULL) - ret = ((struct elf64_x86_64_link_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct elf64_x86_64_link_hash_entry))); - if (ret == (struct elf64_x86_64_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; + subclass. */ + if (entry == NULL) + { + entry = bfd_hash_allocate (table, + sizeof (struct elf64_x86_64_link_hash_entry)); + if (entry == NULL) + return entry; + } /* Call the allocation method of the superclass. */ - ret = ((struct elf64_x86_64_link_hash_entry *) - _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != (struct elf64_x86_64_link_hash_entry *) NULL) + entry = _bfd_elf_link_hash_newfunc (entry, table, string); + if (entry != NULL) { - ret->pcrel_relocs_copied = NULL; + struct elf64_x86_64_link_hash_entry *eh; + + eh = (struct elf64_x86_64_link_hash_entry *) entry; + eh->dyn_relocs = NULL; } - return (struct bfd_hash_entry *) ret; + return entry; } /* Create an X86-64 ELF linker hash table. */ @@ -329,18 +340,135 @@ struct elf64_x86_64_link_hash_table *ret; bfd_size_type amt = sizeof (struct elf64_x86_64_link_hash_table); - ret = ((struct elf64_x86_64_link_hash_table *) bfd_alloc (abfd, amt)); - if (ret == (struct elf64_x86_64_link_hash_table *) NULL) + ret = (struct elf64_x86_64_link_hash_table *) bfd_alloc (abfd, amt); + if (ret == NULL) return NULL; - if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, - elf64_x86_64_link_hash_newfunc)) + if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc)) { bfd_release (abfd, ret); return NULL; } - return &ret->root.root; + ret->sgot = NULL; + ret->sgotplt = NULL; + ret->srelgot = NULL; + ret->splt = NULL; + ret->srelplt = NULL; + ret->sdynbss = NULL; + ret->srelbss = NULL; + ret->sym_sec.abfd = NULL; + + return &ret->elf.root; +} + +/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up + shortcuts to them in our hash table. */ + +static boolean +create_got_section (dynobj, info) + bfd *dynobj; + struct bfd_link_info *info; +{ + struct elf64_x86_64_link_hash_table *htab; + + if (! _bfd_elf_create_got_section (dynobj, info)) + return false; + + htab = elf64_x86_64_hash_table (info); + htab->sgot = bfd_get_section_by_name (dynobj, ".got"); + htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + if (!htab->sgot || !htab->sgotplt) + abort (); + + htab->srelgot = bfd_make_section (dynobj, ".rela.got"); + if (htab->srelgot == NULL + || ! bfd_set_section_flags (dynobj, htab->srelgot, + (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED + | SEC_READONLY)) + || ! bfd_set_section_alignment (dynobj, htab->srelgot, 3)) + return false; + return true; +} + +/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and + .rela.bss sections in DYNOBJ, and set up shortcuts to them in our + hash table. */ + +static boolean +elf64_x86_64_create_dynamic_sections (dynobj, info) + bfd *dynobj; + struct bfd_link_info *info; +{ + struct elf64_x86_64_link_hash_table *htab; + + htab = elf64_x86_64_hash_table (info); + if (!htab->sgot && !create_got_section (dynobj, info)) + return false; + + if (!_bfd_elf_create_dynamic_sections (dynobj, info)) + return false; + + htab->splt = bfd_get_section_by_name (dynobj, ".plt"); + htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt"); + htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss"); + if (!info->shared) + htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss"); + + if (!htab->splt || !htab->srelplt || !htab->sdynbss + || (!info->shared && !htab->srelbss)) + abort (); + + return true; +} + +/* Copy the extra info we tack onto an elf_link_hash_entry. */ + +static void +elf64_x86_64_copy_indirect_symbol (dir, ind) + struct elf_link_hash_entry *dir, *ind; +{ + struct elf64_x86_64_link_hash_entry *edir, *eind; + + edir = (struct elf64_x86_64_link_hash_entry *) dir; + eind = (struct elf64_x86_64_link_hash_entry *) ind; + + if (eind->dyn_relocs != NULL) + { + if (edir->dyn_relocs != NULL) + { + struct elf64_x86_64_dyn_relocs **pp; + struct elf64_x86_64_dyn_relocs *p; + + if (ind->root.type == bfd_link_hash_indirect) + abort (); + + /* Add reloc counts against the weak sym to the strong sym + list. Merge any entries against the same section. */ + for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + { + struct elf64_x86_64_dyn_relocs *q; + + for (q = edir->dyn_relocs; q != NULL; q = q->next) + if (q->sec == p->sec) + { + q->pc_count += p->pc_count; + q->count += p->count; + *pp = p->next; + break; + } + if (q == NULL) + pp = &p->next; + } + *pp = edir->dyn_relocs; + } + + edir->dyn_relocs = eind->dyn_relocs; + eind->dyn_relocs = NULL; + } + + _bfd_elf_link_hash_copy_indirect (dir, ind); } static boolean @@ -353,8 +481,8 @@ } /* Look through the relocs for a section during the first phase, and - allocate space in the global offset table or procedure linkage - table. */ + calculate needed space in the global offset table, procedure + linkage table, and dynamic reloc sections. */ static boolean elf64_x86_64_check_relocs (abfd, info, sec, relocs) @@ -363,25 +491,22 @@ asection *sec; const Elf_Internal_Rela *relocs; { - bfd *dynobj; + struct elf64_x86_64_link_hash_table *htab; Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; - bfd_signed_vma *local_got_refcounts; const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - asection *sgot; - asection *srelgot; asection *sreloc; if (info->relocateable) return true; - dynobj = elf_hash_table (info)->dynobj; + htab = elf64_x86_64_hash_table (info); symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); - sgot = srelgot = sreloc = NULL; + sreloc = NULL; + rel_end = relocs + sec->reloc_count; for (rel = relocs; rel < rel_end; rel++) { @@ -389,75 +514,35 @@ struct elf_link_hash_entry *h; r_symndx = ELF64_R_SYM (rel->r_info); + + if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) + { + (*_bfd_error_handler) (_("%s: bad symbol index: %d"), + bfd_archive_filename (abfd), + r_symndx); + return false; + } + if (r_symndx < symtab_hdr->sh_info) h = NULL; else h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - /* Some relocs require a global offset table. */ - if (dynobj == NULL) - { - switch (ELF64_R_TYPE (rel->r_info)) - { - case R_X86_64_GOT32: - case R_X86_64_GOTPCREL: - elf_hash_table (info)->dynobj = dynobj = abfd; - if (! _bfd_elf_create_got_section (dynobj, info)) - return false; - break; - } - } - switch (ELF64_R_TYPE (rel->r_info)) { - case R_X86_64_GOTPCREL: case R_X86_64_GOT32: + case R_X86_64_GOTPCREL: /* This symbol requires a global offset table entry. */ - - if (sgot == NULL) - { - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - } - - if (srelgot == NULL && (h != NULL || info->shared)) - { - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - if (srelgot == NULL) - { - srelgot = bfd_make_section (dynobj, ".rela.got"); - if (srelgot == NULL - || ! bfd_set_section_flags (dynobj, srelgot, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, srelgot, 3)) - return false; - } - } - if (h != NULL) { - if (h->got.refcount == 0) - { - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (! bfd_elf64_link_record_dynamic_symbol (info, h)) - return false; - } - - sgot->_raw_size += GOT_ENTRY_SIZE; - srelgot->_raw_size += sizeof (Elf64_External_Rela); - } h->got.refcount += 1; } else { + bfd_signed_vma *local_got_refcounts; + /* This is a global offset table entry for a local symbol. */ + local_got_refcounts = elf_local_got_refcounts (abfd); if (local_got_refcounts == NULL) { bfd_size_type size; @@ -470,19 +555,18 @@ return false; elf_local_got_refcounts (abfd) = local_got_refcounts; } - if (local_got_refcounts[r_symndx] == 0) - { - sgot->_raw_size += GOT_ENTRY_SIZE; - if (info->shared) - { - /* If we are generating a shared object, we need to - output a R_X86_64_RELATIVE reloc so that the dynamic - linker can adjust this GOT entry. */ - srelgot->_raw_size += sizeof (Elf64_External_Rela); - } - } local_got_refcounts[r_symndx] += 1; } + /* Fall through */ + + //case R_X86_64_GOTPCREL: + if (htab->sgot == NULL) + { + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + if (!create_got_section (htab->elf.dynobj, info)) + return false; + } break; case R_X86_64_PLT32: @@ -507,9 +591,23 @@ case R_X86_64_32: case R_X86_64_64: case R_X86_64_32S: + case R_X86_64_PC8: + case R_X86_64_PC16: case R_X86_64_PC32: - if (h != NULL) - h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + if (h != NULL && !info->shared) + { + /* If this reloc is in a read-only section, we might + need a copy reloc. We can't check reliably at this + stage whether the section is read-only, as input + sections have not yet been mapped to output sections. + Tentatively set the flag for now, and correct in + adjust_dynamic_symbol. */ + h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + + /* We may need a .plt entry if the function this reloc + refers to is in a shared lib. */ + h->plt.refcount += 1; + } /* If we are creating a shared library, and this is a reloc against a global symbol, or a non PC relative reloc @@ -520,27 +618,45 @@ including in the link (i.e., DEF_REGULAR is set). At this point we have not seen all the input files, so it is possible that DEF_REGULAR is not set now but will be set - later (it is never cleared). We account for that - possibility below by storing information in the - pcrel_relocs_copied field of the hash table entry. - A similar situation occurs when creating shared libraries - and symbol visibility changes render the symbol local. */ - if (info->shared - && (sec->flags & SEC_ALLOC) != 0 - && (((ELF64_R_TYPE (rel->r_info) != R_X86_64_PC8) - && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC16) - && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC32)) - || (h != NULL - && (! info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) - { - /* When creating a shared object, we must copy these - reloc types into the output file. We create a reloc - section in dynobj and make room for this reloc. */ + later (it is never cleared). In case of a weak definition, + DEF_REGULAR may be cleared later by a strong definition in + a shared library. We account for that possibility below by + storing information in the relocs_copied field of the hash + table entry. A similar situation occurs when creating + shared libraries and symbol visibility changes render the + symbol local. + + If on the other hand, we are creating an executable, we + may need to keep relocations for symbols satisfied by a + dynamic library if we manage to avoid copy relocs for the + symbol. */ + if ((info->shared + && (sec->flags & SEC_ALLOC) != 0 + && (((ELF64_R_TYPE (rel->r_info) != R_X86_64_PC8) + && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC16) + && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC32)) + || (h != NULL + && (! info->symbolic + || h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || (!info->shared + && (sec->flags & SEC_ALLOC) != 0 + && h != NULL + && (h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) + { + struct elf64_x86_64_dyn_relocs *p; + struct elf64_x86_64_dyn_relocs **head; + + /* We must copy these reloc types into the output file. + Create a reloc section in dynobj and make room for + this reloc. */ if (sreloc == NULL) { const char *name; + bfd *dynobj; name = (bfd_elf_string_from_elf_section (abfd, @@ -549,9 +665,19 @@ if (name == NULL) return false; - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (abfd, sec), - name + 5) == 0); + if (strncmp (name, ".rela", 5) != 0 + || strcmp (bfd_get_section_name (abfd, sec), + name + 5) != 0) + { + (*_bfd_error_handler) + (_("%s: bad relocation section name `%s\'"), + bfd_archive_filename (abfd), name); + } + + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + + dynobj = htab->elf.dynobj; sreloc = bfd_get_section_by_name (dynobj, name); if (sreloc == NULL) @@ -568,46 +694,51 @@ || ! bfd_set_section_alignment (dynobj, sreloc, 3)) return false; } - if (sec->flags & SEC_READONLY) - info->flags |= DF_TEXTREL; + elf_section_data (sec)->sreloc = sreloc; } - sreloc->_raw_size += sizeof (Elf64_External_Rela); - - /* If this is a global symbol, we count the number of PC - relative relocations we have entered for this symbol, - so that we can discard them later as necessary. Note - that this function is only called if we are using an - elf64_x86_64 linker hash table, which means that h is - really a pointer to an elf64_x86_64_link_hash_entry. */ - if (h != NULL - && ((ELF64_R_TYPE (rel->r_info) == R_X86_64_PC8) - || (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC16) - || (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC32))) + /* If this is a global symbol, we count the number of + relocations we need for this symbol. */ + if (h != NULL) { - struct elf64_x86_64_link_hash_entry *eh; - struct elf64_x86_64_pcrel_relocs_copied *p; - - eh = (struct elf64_x86_64_link_hash_entry *) h; + head = &((struct elf64_x86_64_link_hash_entry *) h)->dyn_relocs; + } + else + { + /* Track dynamic relocs needed for local syms too. + We really need local syms available to do this + easily. Oh well. */ + + asection *s; + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, + sec, r_symndx); + if (s == NULL) + return false; - for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next) - if (p->section == sreloc) - break; + head = ((struct elf64_x86_64_dyn_relocs **) + &elf_section_data (s)->local_dynrel); + } + p = *head; + if (p == NULL || p->sec != sec) + { + bfd_size_type amt = sizeof *p; + p = ((struct elf64_x86_64_dyn_relocs *) + bfd_alloc (htab->elf.dynobj, amt)); if (p == NULL) - { - p = ((struct elf64_x86_64_pcrel_relocs_copied *) - bfd_alloc (dynobj, (bfd_size_type) sizeof *p)); - if (p == NULL) - return false; - p->next = eh->pcrel_relocs_copied; - eh->pcrel_relocs_copied = p; - p->section = sreloc; - p->count = 0; - } - - ++p->count; + return false; + p->next = *head; + *head = p; + p->sec = sec; + p->count = 0; + p->pc_count = 0; } + + p->count += 1; + if (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC8 + || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC16 + || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC32) + p->pc_count += 1; } break; @@ -624,6 +755,9 @@ if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return false; break; + + default: + break; } } @@ -637,7 +771,7 @@ elf64_x86_64_gc_mark_hook (abfd, info, rel, h, sym) bfd *abfd; struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; { @@ -677,7 +811,7 @@ static boolean elf64_x86_64_gc_sweep_hook (abfd, info, sec, relocs) bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; + struct bfd_link_info *info; asection *sec; const Elf_Internal_Rela *relocs; { @@ -687,21 +821,13 @@ const Elf_Internal_Rela *rel, *relend; unsigned long r_symndx; struct elf_link_hash_entry *h; - bfd *dynobj; - asection *sgot; - asection *srelgot; + + elf_section_data (sec)->local_dynrel = NULL; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); local_got_refcounts = elf_local_got_refcounts (abfd); - dynobj = elf_hash_table (info)->dynobj; - if (dynobj == NULL) - return true; - - sgot = bfd_get_section_by_name (dynobj, ".got"); - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - relend = relocs + sec->reloc_count; for (rel = relocs; rel < relend; rel++) switch (ELF64_R_TYPE (rel->r_info)) @@ -713,30 +839,53 @@ { h = sym_hashes[r_symndx - symtab_hdr->sh_info]; if (h->got.refcount > 0) - { - h->got.refcount -= 1; - if (h->got.refcount == 0) - { - sgot->_raw_size -= GOT_ENTRY_SIZE; - srelgot->_raw_size -= sizeof (Elf64_External_Rela); - } - } + h->got.refcount -= 1; } else if (local_got_refcounts != NULL) { if (local_got_refcounts[r_symndx] > 0) - { - local_got_refcounts[r_symndx] -= 1; - if (local_got_refcounts[r_symndx] == 0) - { - sgot->_raw_size -= GOT_ENTRY_SIZE; - if (info->shared) - srelgot->_raw_size -= sizeof (Elf64_External_Rela); - } - } + local_got_refcounts[r_symndx] -= 1; } break; + case R_X86_64_8: + case R_X86_64_16: + case R_X86_64_32: + case R_X86_64_64: + case R_X86_64_32S: + case R_X86_64_PC8: + case R_X86_64_PC16: + case R_X86_64_PC32: + r_symndx = ELF64_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + struct elf64_x86_64_link_hash_entry *eh; + struct elf64_x86_64_dyn_relocs **pp; + struct elf64_x86_64_dyn_relocs *p; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + if (!info->shared && h->plt.refcount > 0) + h->plt.refcount -= 1; + + eh = (struct elf64_x86_64_link_hash_entry *) h; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { + if (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC8 + || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC16 + || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC32) + p->pc_count -= 1; + p->count -= 1; + if (p->count == 0) + *pp = p->next; + break; + } + } + break; + + case R_X86_64_PLT32: r_symndx = ELF64_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) @@ -765,33 +914,24 @@ struct bfd_link_info *info; struct elf_link_hash_entry *h; { - bfd *dynobj; + struct elf64_x86_64_link_hash_table *htab; + struct elf64_x86_64_link_hash_entry * eh; + struct elf64_x86_64_dyn_relocs *p; asection *s; unsigned int power_of_two; - dynobj = elf_hash_table (info)->dynobj; - - /* Make sure we know what is going on here. */ - BFD_ASSERT (dynobj != NULL - && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) - || h->weakdef != NULL - || ((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))); - /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later, when we know the address of the .got section. */ if (h->type == STT_FUNC || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) { - if ((! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0) - || (info->shared && h->plt.refcount <= 0)) + if (h->plt.refcount <= 0 + || (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 + && h->root.type != bfd_link_hash_undefweak + && h->root.type != bfd_link_hash_undefined)) { /* This case can occur if we saw a PLT32 reloc in an input file, but the symbol was never referred to by a dynamic @@ -800,55 +940,16 @@ linkage table, and we can just do a PC32 reloc instead. */ h->plt.offset = (bfd_vma) -1; h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - return true; - } - - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (! bfd_elf64_link_record_dynamic_symbol (info, h)) - return false; - } - - s = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (s != NULL); - - /* If this is the first .plt entry, make room for the special - first entry. */ - if (s->_raw_size == 0) - s->_raw_size = PLT_ENTRY_SIZE; - - /* If this symbol is not defined in a regular file, and we are - not generating a shared library, then set the symbol to this - location in the .plt. This is required to make function - pointers compare as equal between the normal executable and - the shared library. */ - if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; } - h->plt.offset = s->_raw_size; - - /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; - - /* We also need to make an entry in the .got.plt section, which - will be placed in the .got section by the linker script. */ - s = bfd_get_section_by_name (dynobj, ".got.plt"); - BFD_ASSERT (s != NULL); - s->_raw_size += GOT_ENTRY_SIZE; - - /* We also need to make an entry in the .rela.plt section. */ - s = bfd_get_section_by_name (dynobj, ".rela.plt"); - BFD_ASSERT (s != NULL); - s->_raw_size += sizeof (Elf64_External_Rela); - return true; } else + /* It's possible that we incorrectly decided a .plt reloc was + needed for an R_X86_64_PC32 reloc to a non-function sym in + check_relocs. We can't decide accurately between function and + non-function syms in check-relocs; Objects loaded later in + the link may change h->type. So fix it now. */ h->plt.offset = (bfd_vma) -1; /* If this is a weak symbol, and there is a real definition, the @@ -878,6 +979,29 @@ if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) return true; + /* If -z nocopyreloc was given, we won't generate them either. */ + if (info->nocopyreloc) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return true; + } + + eh = (struct elf64_x86_64_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 become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -888,20 +1012,14 @@ both the dynamic object and the regular object will refer to the same memory location for the variable. */ - s = bfd_get_section_by_name (dynobj, ".dynbss"); - BFD_ASSERT (s != NULL); + htab = elf64_x86_64_hash_table (info); /* We must generate a R_X86_64_COPY reloc to tell the dynamic linker to copy the initial value out of the dynamic object and into the - runtime process image. We need to remember the offset into the - .rela.bss section we are going to use. */ + runtime process image. */ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { - asection *srel; - - srel = bfd_get_section_by_name (dynobj, ".rela.bss"); - BFD_ASSERT (srel != NULL); - srel->_raw_size += sizeof (Elf64_External_Rela); + htab->srelbss->_raw_size += sizeof (Elf64_External_Rela); h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; } @@ -915,10 +1033,11 @@ power_of_two = 4; /* Apply the required alignment. */ + s = htab->sdynbss; s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) + if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) { - if (! bfd_set_section_alignment (dynobj, s, power_of_two)) + if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) return false; } @@ -932,6 +1051,223 @@ return true; } +/* This is the condition under which elf64_x86_64_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 elf64_x86_64_relocate_section. */ +#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \ + ((DYN) \ + && ((INFO)->shared \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \ + && ((H)->dynindx != -1 \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) + +/* Allocate space in .plt, .got and associated reloc sections for + dynamic relocs. */ + +static boolean +allocate_dynrelocs (h, inf) + struct elf_link_hash_entry *h; + PTR inf; +{ + struct bfd_link_info *info; + struct elf64_x86_64_link_hash_table *htab; + struct elf64_x86_64_link_hash_entry *eh; + struct elf64_x86_64_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_indirect) + return true; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + info = (struct bfd_link_info *) inf; + htab = elf64_x86_64_hash_table (info); + + if (htab->elf.dynamic_sections_created + && h->plt.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf64_link_record_dynamic_symbol (info, h)) + return false; + } + + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) + { + asection *s = htab->splt; + + /* If this is the first .plt entry, make room for the special + first entry. */ + if (s->_raw_size == 0) + s->_raw_size += PLT_ENTRY_SIZE; + + h->plt.offset = s->_raw_size; + + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + h->root.u.def.section = s; + h->root.u.def.value = h->plt.offset; + } + + /* Make room for this entry. */ + s->_raw_size += PLT_ENTRY_SIZE; + + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + htab->sgotplt->_raw_size += GOT_ENTRY_SIZE; + + /* We also need to make an entry in the .rela.plt section. */ + htab->srelplt->_raw_size += sizeof (Elf64_External_Rela); + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + + if (h->got.refcount > 0) + { + asection *s; + boolean dyn; + + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf64_link_record_dynamic_symbol (info, h)) + return false; + } + + s = htab->sgot; + h->got.offset = s->_raw_size; + s->_raw_size += GOT_ENTRY_SIZE; + dyn = htab->elf.dynamic_sections_created; + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) + htab->srelgot->_raw_size += sizeof (Elf64_External_Rela); + } + else + h->got.offset = (bfd_vma) -1; + + eh = (struct elf64_x86_64_link_hash_entry *) h; + if (eh->dyn_relocs == NULL) + return true; + + /* In the shared -Bsymbolic case, discard space allocated for + dynamic pc-relative relocs against symbols which turn out to be + defined in regular objects. For the normal shared case, discard + space for pc-relative relocs that have become local due to symbol + visibility changes. */ + + if (info->shared) + { + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 + || info->symbolic)) + { + struct elf64_x86_64_dyn_relocs **pp; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + { + p->count -= p->pc_count; + p->pc_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } + } + else + { + /* For the non-shared case, discard space for relocs against + symbols which turn out to need copy relocs or are not + dynamic. */ + + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 + && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + || (htab->elf.dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf64_link_record_dynamic_symbol (info, h)) + return false; + } + + /* If that succeeded, we know we'll be keeping all the + relocs. */ + if (h->dynindx != -1) + goto keep; + } + + eh->dyn_relocs = NULL; + + keep: ; + } + + /* Finally, allocate space. */ + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *sreloc = elf_section_data (p->sec)->sreloc; + sreloc->_raw_size += p->count * sizeof (Elf64_External_Rela); + } + + return true; +} + +/* Find any dynamic relocs that apply to read-only sections. */ + +static boolean +readonly_dynrelocs (h, inf) + struct elf_link_hash_entry *h; + PTR inf; +{ + struct elf64_x86_64_link_hash_entry *eh; + struct elf64_x86_64_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + eh = (struct elf64_x86_64_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *s = p->sec->output_section; + + if (s != NULL && (s->flags & SEC_READONLY) != 0) + { + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + info->flags |= DF_TEXTREL; + + /* Not an error, just cut short the traversal. */ + return false; + } + } + return true; +} + /* Set the sizes of the dynamic sections. */ static boolean @@ -939,110 +1275,140 @@ bfd *output_bfd ATTRIBUTE_UNUSED; struct bfd_link_info *info; { + struct elf64_x86_64_link_hash_table *htab; bfd *dynobj; asection *s; - boolean plt; boolean relocs; + bfd *ibfd; - dynobj = elf_hash_table (info)->dynobj; - BFD_ASSERT (dynobj != NULL); + htab = elf64_x86_64_hash_table (info); + dynobj = htab->elf.dynobj; + if (dynobj == NULL) + abort (); - if (elf_hash_table (info)->dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ if (! info->shared) { s = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (s != NULL); + if (s == NULL) + abort (); s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; } } - else - { - /* We may have created entries in the .rela.got section. - However, if we are not creating the dynamic sections, we will - not actually use these entries. Reset the size of .rela.got, - which will cause it to get stripped from the output file - below. */ - s = bfd_get_section_by_name (dynobj, ".rela.got"); - if (s != NULL) - s->_raw_size = 0; - } - /* If this is a -Bsymbolic shared link, then we need to discard all - PC relative relocs against symbols defined in a regular object. - We allocated space for them in the check_relocs routine, but we - will not fill them in in the relocate_section routine. */ - if (info->shared) - elf64_x86_64_link_hash_traverse (elf64_x86_64_hash_table (info), - elf64_x86_64_discard_copies, - (PTR) info); - - /* The check_relocs and adjust_dynamic_symbol entry points have - determined the sizes of the various dynamic sections. Allocate - memory for them. */ - plt = relocs = false; - for (s = dynobj->sections; s != NULL; s = s->next) - { - const char *name; - boolean strip; + /* Set up .got offsets for local syms, and space for local dynamic + relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + bfd_signed_vma *local_got; + bfd_signed_vma *end_local_got; + bfd_size_type locsymcount; + Elf_Internal_Shdr *symtab_hdr; + asection *srel; - if ((s->flags & SEC_LINKER_CREATED) == 0) + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) continue; - /* It's OK to base decisions on the section name, because none - of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); - - strip = false; - if (strcmp (name, ".plt") == 0) + for (s = ibfd->sections; s != NULL; s = s->next) { - if (s->_raw_size == 0) - { - /* Strip this section if we don't need it; see the - comment below. */ - strip = true; - } - else + struct elf64_x86_64_dyn_relocs *p; + + for (p = *((struct elf64_x86_64_dyn_relocs **) + &elf_section_data (s)->local_dynrel); + p != NULL; + p = p->next) { - /* Remember whether there is a PLT. */ - plt = true; + if (!bfd_is_abs_section (p->sec) + && bfd_is_abs_section (p->sec->output_section)) + { + /* Input section has been discarded, either because + it is a copy of a linkonce section or due to + linker script /DISCARD/, so we'll be discarding + the relocs too. */ + } + else if (p->count != 0) + { + srel = elf_section_data (p->sec)->sreloc; + srel->_raw_size += p->count * sizeof (Elf64_External_Rela); + if ((p->sec->output_section->flags & SEC_READONLY) != 0) + info->flags |= DF_TEXTREL; + + } } } - else if (strncmp (name, ".rela", 5) == 0) + + local_got = elf_local_got_refcounts (ibfd); + if (!local_got) + continue; + + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; + end_local_got = local_got + locsymcount; + s = htab->sgot; + srel = htab->srelgot; + for (; local_got < end_local_got; ++local_got) { - if (s->_raw_size == 0) + if (*local_got > 0) { - /* If we don't need this section, strip it from the - output file. This is mostly to handle .rela.bss and - .rela.plt. We must create both sections in - create_dynamic_sections, because they must be created - before the linker maps input sections to output - sections. The linker does that before - adjust_dynamic_symbol is called, and it is that - function which decides whether anything needs to go - into these sections. */ - strip = true; + *local_got = s->_raw_size; + s->_raw_size += GOT_ENTRY_SIZE; + if (info->shared) + srel->_raw_size += sizeof (Elf64_External_Rela); } else - { - if (strcmp (name, ".rela.plt") != 0) - relocs = true; + *local_got = (bfd_vma) -1; + } + } - /* We use the reloc_count field as a counter if we need - to copy relocs into the output file. */ - s->reloc_count = 0; - } + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ + elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info); + + /* We now have determined the sizes of the various dynamic sections. + Allocate memory for them. */ + relocs = false; + for (s = dynobj->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + if (s == htab->splt + || s == htab->sgot + || s == htab->sgotplt) + { + /* Strip this section if we don't need it; see the + comment below. */ } - else if (strncmp (name, ".got", 4) != 0) + else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + { + if (s->_raw_size != 0 && s != htab->srelplt) + relocs = true; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + else { /* It's not one of our sections, so don't allocate space. */ continue; } - if (strip) + if (s->_raw_size == 0) { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + _bfd_strip_section_from_output (info, s); continue; } @@ -1053,11 +1419,11 @@ but this way if it does, we get a R_X86_64_NONE reloc instead of garbage. */ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) + if (s->contents == NULL) return false; } - if (elf_hash_table (info)->dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { /* Add some entries to the .dynamic section. We fill in the values later, in elf64_x86_64_finish_dynamic_sections, but we @@ -1073,7 +1439,7 @@ return false; } - if (plt) + if (htab->splt->_raw_size != 0) { if (!add_dynamic_entry (DT_PLTGOT, 0) || !add_dynamic_entry (DT_PLTRELSZ, 0) @@ -1088,12 +1454,18 @@ || !add_dynamic_entry (DT_RELASZ, 0) || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela))) return false; - } - if ((info->flags & DF_TEXTREL) != 0) - { - if (!add_dynamic_entry (DT_TEXTREL, 0)) - return false; + /* If any dynamic relocs apply to a read-only section, + then we need a DT_TEXTREL entry. */ + if ((info->flags & DF_TEXTREL) == 0) + elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, + (PTR) info); + + if ((info->flags & DF_TEXTREL) != 0) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return false; + } } } #undef add_dynamic_entry @@ -1101,37 +1473,6 @@ return true; } -/* This function is called via elf64_x86_64_link_hash_traverse if we are - creating a shared object. In the -Bsymbolic case, it discards the - space allocated to copy PC relative relocs against symbols which - are defined in regular objects. For the normal non-symbolic case, - we also discard space for relocs that have become local due to - symbol visibility changes. We allocated space for them in the - check_relocs routine, but we won't fill them in in the - relocate_section routine. */ - -static boolean -elf64_x86_64_discard_copies (h, inf) - struct elf64_x86_64_link_hash_entry *h; - PTR inf; -{ - struct elf64_x86_64_pcrel_relocs_copied *s; - struct bfd_link_info *info = (struct bfd_link_info *) inf; - - /* If a symbol has been forced local or we have found a regular - definition for the symbolic link case, then we won't be needing - any relocs. */ - if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 - && ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 - || info->symbolic)) - { - for (s = h->pcrel_relocs_copied; s != NULL; s = s->next) - s->section->_raw_size -= s->count * sizeof (Elf64_External_Rela); - } - - return true; -} - /* Relocate an x86_64 ELF section. */ static boolean @@ -1146,31 +1487,24 @@ Elf_Internal_Sym *local_syms; asection **local_sections; { - bfd *dynobj; + struct elf64_x86_64_link_hash_table *htab; Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; bfd_vma *local_got_offsets; - asection *sgot; - asection *splt; - asection *sreloc; - Elf_Internal_Rela *rela; + Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - dynobj = elf_hash_table (info)->dynobj; + if (info->relocateable) + return true; + + htab = elf64_x86_64_hash_table (info); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); local_got_offsets = elf_local_got_offsets (input_bfd); - sreloc = splt = sgot = NULL; - if (dynobj != NULL) - { - splt = bfd_get_section_by_name (dynobj, ".plt"); - sgot = bfd_get_section_by_name (dynobj, ".got"); - } - - rela = relocs; + rel = relocs; relend = relocs + input_section->reloc_count; - for (; rela < relend; rela++) + for (; rel < relend; rel++) { int r_type; reloc_howto_type *howto; @@ -1178,52 +1512,34 @@ struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; asection *sec; + bfd_vma off; bfd_vma relocation; + boolean unresolved_reloc; bfd_reloc_status_type r; - unsigned int indx; - r_type = ELF64_R_TYPE (rela->r_info); + r_type = ELF64_R_TYPE (rel->r_info); if (r_type == (int) R_X86_64_GNU_VTINHERIT || r_type == (int) R_X86_64_GNU_VTENTRY) continue; - if ((indx = (unsigned) r_type) >= R_X86_64_max) + if (r_type < 0 || r_type >= R_X86_64_max) { bfd_set_error (bfd_error_bad_value); return false; } - howto = x86_64_elf_howto_table + indx; - - r_symndx = ELF64_R_SYM (rela->r_info); - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rela->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - /* This is a final link. */ + howto = x86_64_elf_howto_table + r_type; + r_symndx = ELF64_R_SYM (rel->r_info); h = NULL; sym = NULL; sec = NULL; + unresolved_reloc = false; if (r_symndx < symtab_hdr->sh_info) { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rela); + + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); } else { @@ -1231,50 +1547,18 @@ while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { sec = h->root.u.def.section; - if ((r_type == R_X86_64_PLT32 - && splt != NULL - && h->plt.offset != (bfd_vma) -1) - || ((r_type == R_X86_64_GOT32 || r_type == R_X86_64_GOTPCREL) - && elf_hash_table (info)->dynamic_sections_created - && (!info->shared - || (! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - || (info->shared - && ((! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0) - && (r_type == R_X86_64_8 - || r_type == R_X86_64_16 - || r_type == R_X86_64_32 - || r_type == R_X86_64_64 - || r_type == R_X86_64_PC8 - || r_type == R_X86_64_PC16 - || r_type == R_X86_64_PC32) - && ((input_section->flags & SEC_ALLOC) != 0 - /* DWARF will emit R_X86_64_32 relocations in its - sections against symbols defined externally - in shared libraries. We can't do anything - with them here. */ - || ((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))) - { - /* In these cases, we don't need the relocation - value. We check specially because in some - obscure cases sec->output_section will be NULL. */ - relocation = 0; - } - else if (sec->output_section == NULL) + if (sec->output_section == NULL) { - (*_bfd_error_handler) - (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), - bfd_archive_filename (input_bfd), h->root.root.string, - bfd_get_section_name (input_bfd, input_section)); + /* Set a flag that will be cleared later if we find a + relocation value for this symbol. output_section + is typically NULL for symbols satisfied by a shared + library. */ + unresolved_reloc = true; relocation = 0; } else @@ -1293,14 +1577,13 @@ { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rela->r_offset, + input_section, rel->r_offset, (!info->shared || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return false; relocation = 0; } } - /* When generating a shared object, the relocations handled here are copied into the output file to be resolved at run time. */ switch (r_type) @@ -1310,16 +1593,21 @@ offset table. */ case R_X86_64_GOTPCREL: /* Use global offset table as symbol value. */ - BFD_ASSERT (sgot != NULL); + if (htab->sgot == NULL) + abort (); if (h != NULL) { - bfd_vma off = h->got.offset; - BFD_ASSERT (off != (bfd_vma) -1); + boolean dyn; + + off = h->got.offset; + dyn = htab->elf.dynamic_sections_created; - if (! elf_hash_table (info)->dynamic_sections_created + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) || (info->shared - && (info->symbolic || h->dynindx == -1) + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) { /* This is actually a static link, or it is a -Bsymbolic @@ -1338,21 +1626,17 @@ else { bfd_put_64 (output_bfd, relocation, - sgot->contents + off); + htab->sgot->contents + off); h->got.offset |= 1; } } - if (r_type == R_X86_64_GOTPCREL) - relocation = sgot->output_section->vma + sgot->output_offset + off; else - relocation = sgot->output_offset + off; + unresolved_reloc = false; } else { - bfd_vma off; - - BFD_ASSERT (local_got_offsets != NULL - && local_got_offsets[r_symndx] != (bfd_vma) -1); + if (local_got_offsets == NULL) + abort (); off = local_got_offsets[r_symndx]; @@ -1363,39 +1647,42 @@ off &= ~1; else { - bfd_put_64 (output_bfd, relocation, sgot->contents + off); + bfd_put_64 (output_bfd, relocation, + htab->sgot->contents + off); if (info->shared) { asection *srelgot; Elf_Internal_Rela outrel; + Elf64_External_Rela *loc; /* We need to generate a R_X86_64_RELATIVE reloc for the dynamic linker. */ - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - BFD_ASSERT (srelgot != NULL); + srelgot = htab->srelgot; + if (srelgot == NULL) + abort (); - outrel.r_offset = (sgot->output_section->vma - + sgot->output_offset + outrel.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + off); outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE); outrel.r_addend = relocation; - bfd_elf64_swap_reloca_out (output_bfd, &outrel, - (((Elf64_External_Rela *) - srelgot->contents) - + srelgot->reloc_count)); - ++srelgot->reloc_count; + loc = (Elf64_External_Rela *) srelgot->contents; + loc += srelgot->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); } local_got_offsets[r_symndx] |= 1; } - - if (r_type == R_X86_64_GOTPCREL) - relocation = sgot->output_section->vma + sgot->output_offset + off; - else - relocation = sgot->output_offset + off; } + if (off >= (bfd_vma) -2) + abort (); + + relocation = htab->sgot->output_offset + off; + if (r_type == R_X86_64_GOTPCREL) + relocation += htab->sgot->output_section->vma; + break; case R_X86_64_PLT32: @@ -1407,7 +1694,8 @@ if (h == NULL) break; - if (h->plt.offset == (bfd_vma) -1 || splt == NULL) + if (h->plt.offset == (bfd_vma) -1 + || htab->splt == NULL) { /* We didn't make a PLT entry for this symbol. This happens when statically linking PIC code, or when @@ -1415,62 +1703,64 @@ break; } - relocation = (splt->output_section->vma - + splt->output_offset + relocation = (htab->splt->output_section->vma + + htab->splt->output_offset + h->plt.offset); + unresolved_reloc = false; break; case R_X86_64_PC8: case R_X86_64_PC16: case R_X86_64_PC32: - if (h == NULL || h->dynindx == -1 - || (info->symbolic - && h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) - break; - /* Fall through. */ case R_X86_64_8: case R_X86_64_16: case R_X86_64_32: case R_X86_64_64: /* FIXME: The ABI says the linker should make sure the value is the same when it's zeroextended to 64 bit. */ - if (info->shared - && r_symndx != 0 - && (input_section->flags & SEC_ALLOC) != 0) + + /* r_symndx will be zero only for relocs against symbols + from removed linkonce sections, or sections discarded by + a linker script. */ + if (r_symndx == 0 + || (input_section->flags & SEC_ALLOC) == 0) + break; + + if ((info->shared + && ((r_type != R_X86_64_PC8 + && r_type != R_X86_64_PC16 + && r_type != R_X86_64_PC32) + || (h != NULL + && h->dynindx != -1 + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || (!info->shared + && h != NULL + && h->dynindx != -1 + && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 + && (((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) + || h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined))) { Elf_Internal_Rela outrel; boolean skip, relocate; + asection *sreloc; + Elf64_External_Rela *loc; /* When generating a shared object, these relocations are copied into the output file to be resolved at run time. */ - if (sreloc == NULL) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (input_bfd, - elf_elfheader (input_bfd)->e_shstrndx, - elf_section_data (input_section)->rel_hdr.sh_name)); - if (name == NULL) - return false; - - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (input_bfd, - input_section), - name + 5) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - BFD_ASSERT (sreloc != NULL); - } - skip = false; relocate = false; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, - rela->r_offset); + rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; else if (outrel.r_offset == (bfd_vma) -2) @@ -1481,65 +1771,37 @@ if (skip) memset (&outrel, 0, sizeof outrel); + /* h->dynindx may be -1 if this symbol was marked to become local. */ else if (h != NULL - && ((! info->symbolic && h->dynindx != -1) + && h->dynindx != -1 + && (r_type == R_X86_64_PC8 + || r_type == R_X86_64_PC16 + || r_type == R_X86_64_PC32 + || !info->shared + || !info->symbolic || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) { - BFD_ASSERT (h->dynindx != -1); outrel.r_info = ELF64_R_INFO (h->dynindx, r_type); - outrel.r_addend = relocation + rela->r_addend; + outrel.r_addend = rel->r_addend; } else { - if (r_type == R_X86_64_64) - { - relocate = true; - outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE); - outrel.r_addend = relocation + rela->r_addend; - } - else - { - long sindx; - - if (h == NULL) - sec = local_sections[r_symndx]; - else - { - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || (h->root.type - == bfd_link_hash_defweak)); - sec = h->root.u.def.section; - } - if (sec != NULL && bfd_is_abs_section (sec)) - sindx = 0; - else if (sec == NULL || sec->owner == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - else - { - asection *osec; - - osec = sec->output_section; - sindx = elf_section_data (osec)->dynindx; - BFD_ASSERT (sindx > 0); - } - - outrel.r_info = ELF64_R_INFO (sindx, r_type); - outrel.r_addend = relocation + rela->r_addend; - } - + /* This symbol is local, or marked to become local. */ + relocate = true; + outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE); + outrel.r_addend = relocation + rel->r_addend; } - bfd_elf64_swap_reloca_out (output_bfd, &outrel, - (((Elf64_External_Rela *) - sreloc->contents) - + sreloc->reloc_count)); - ++sreloc->reloc_count; + sreloc = elf_section_data (input_section)->sreloc; + if (sreloc == NULL) + abort (); + + loc = (Elf64_External_Rela *) sreloc->contents; + loc += sreloc->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, we @@ -1555,39 +1817,59 @@ break; } + /* FIXME: Why do we allow debugging sections to escape this error? + More importantly, why do we not emit dynamic relocs for + R_386_32 above in debugging sections (which are ! SEC_ALLOC)? + If we had emitted the dynamic reloc, we could remove the + fudge here. */ + if (unresolved_reloc + && !(info->shared + && (input_section->flags & SEC_DEBUGGING) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + (*_bfd_error_handler) + (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, + h->root.root.string); + r = _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rela->r_offset, - relocation, rela->r_addend); + contents, rel->r_offset, + relocation, rel->r_addend); if (r != bfd_reloc_ok) { - switch (r) + const char *name; + + if (h != NULL) + name = h->root.root.string; + else { - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - { - const char *name; - - if (h != NULL) - name = h->root.root.string; - else - { - name = bfd_elf_string_from_elf_section (input_bfd, - symtab_hdr->sh_link, - sym->st_name); - if (name == NULL) - return false; - if (*name == '\0') - name = bfd_section_name (input_bfd, sec); - } - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rela->r_offset))) - return false; - } - break; + name = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name); + if (name == NULL) + return false; + if (*name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + if (r == bfd_reloc_overflow) + { + + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return false; + } + else + { + (*_bfd_error_handler) + (_("%s(%s+0x%lx): reloc against `%s': error %d"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, name, (int) r); + return false; } } } @@ -1605,28 +1887,25 @@ struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; { - bfd *dynobj; + struct elf64_x86_64_link_hash_table *htab; - dynobj = elf_hash_table (info)->dynobj; + htab = elf64_x86_64_hash_table (info); if (h->plt.offset != (bfd_vma) -1) { - asection *splt; - asection *sgot; - asection *srela; bfd_vma plt_index; bfd_vma got_offset; Elf_Internal_Rela rela; + Elf64_External_Rela *loc; /* This symbol has an entry in the procedure linkage table. Set it up. */ - BFD_ASSERT (h->dynindx != -1); - - splt = bfd_get_section_by_name (dynobj, ".plt"); - sgot = bfd_get_section_by_name (dynobj, ".got.plt"); - srela = bfd_get_section_by_name (dynobj, ".rela.plt"); - BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL); + if (h->dynindx == -1 + || htab->splt == NULL + || htab->sgotplt == NULL + || htab->srelplt == NULL) + abort (); /* Get the index in the procedure linkage table which corresponds to this symbol. This is the index of this symbol @@ -1640,7 +1919,7 @@ got_offset = (plt_index + 3) * GOT_ENTRY_SIZE; /* Fill in the entry in the procedure linkage table. */ - memcpy (splt->contents + h->plt.offset, elf64_x86_64_plt_entry, + memcpy (htab->splt->contents + h->plt.offset, elf64_x86_64_plt_entry, PLT_ENTRY_SIZE); /* Insert the relocation positions of the plt section. The magic @@ -1649,67 +1928,61 @@ /* Put offset for jmp *name@GOTPCREL(%rip), since the instruction uses 6 bytes, subtract this value. */ bfd_put_32 (output_bfd, - (sgot->output_section->vma - + sgot->output_offset + (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + got_offset - - splt->output_section->vma - - splt->output_offset + - htab->splt->output_section->vma + - htab->splt->output_offset - h->plt.offset - 6), - splt->contents + h->plt.offset + 2); + htab->splt->contents + h->plt.offset + 2); /* Put relocation index. */ bfd_put_32 (output_bfd, plt_index, - splt->contents + h->plt.offset + 7); + htab->splt->contents + h->plt.offset + 7); /* Put offset for jmp .PLT0. */ bfd_put_32 (output_bfd, - (h->plt.offset + PLT_ENTRY_SIZE), - splt->contents + h->plt.offset + 12); + htab->splt->contents + h->plt.offset + 12); /* Fill in the entry in the global offset table, initially this points to the pushq instruction in the PLT which is at offset 6. */ - bfd_put_64 (output_bfd, (splt->output_section->vma + splt->output_offset + bfd_put_64 (output_bfd, (htab->splt->output_section->vma + + htab->splt->output_offset + h->plt.offset + 6), - sgot->contents + got_offset); + htab->sgotplt->contents + got_offset); /* Fill in the entry in the .rela.plt section. */ - rela.r_offset = (sgot->output_section->vma - + sgot->output_offset + rela.r_offset = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + got_offset); rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_JUMP_SLOT); rela.r_addend = 0; - bfd_elf64_swap_reloca_out (output_bfd, &rela, - ((Elf64_External_Rela *) srela->contents - + plt_index)); + loc = (Elf64_External_Rela *) htab->srelplt->contents + plt_index; + bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) { /* Mark the symbol as undefined, rather than as defined in - the .plt section. Leave the value alone. */ + the .plt section. Leave the value alone. This is a clue + for the dynamic linker, to make function pointer + comparisons work between an application and shared + library. */ sym->st_shndx = SHN_UNDEF; - /* If the symbol is weak, we do need to clear the value. - Otherwise, the PLT entry would provide a definition for - the symbol even if the symbol wasn't defined anywhere, - and so the symbol would never be NULL. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) - == 0) - sym->st_value = 0; } } if (h->got.offset != (bfd_vma) -1) { - asection *sgot; - asection *srela; Elf_Internal_Rela rela; + Elf64_External_Rela *loc; /* This symbol has an entry in the global offset table. Set it up. */ - sgot = bfd_get_section_by_name (dynobj, ".got"); - srela = bfd_get_section_by_name (dynobj, ".rela.got"); - BFD_ASSERT (sgot != NULL && srela != NULL); + if (htab->sgot == NULL || htab->srelgot == NULL) + abort (); - rela.r_offset = (sgot->output_section->vma - + sgot->output_offset + rela.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + (h->got.offset &~ (bfd_vma) 1)); /* If this is a static link, or it is a -Bsymbolic link and the @@ -1717,10 +1990,11 @@ of a version file, we just want to emit a RELATIVE reloc. The entry in the global offset table will already have been initialized in the relocate_section function. */ - if (! elf_hash_table (info)->dynamic_sections_created - || (info->shared - && (info->symbolic || h->dynindx == -1) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + if (info->shared + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) { BFD_ASSERT((h->got.offset & 1) != 0); rela.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE); @@ -1731,41 +2005,38 @@ else { BFD_ASSERT((h->got.offset & 1) == 0); - bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); + bfd_put_64 (output_bfd, (bfd_vma) 0, + htab->sgot->contents + h->got.offset); rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_GLOB_DAT); rela.r_addend = 0; } - bfd_elf64_swap_reloca_out (output_bfd, &rela, - ((Elf64_External_Rela *) srela->contents - + srela->reloc_count)); - ++srela->reloc_count; + loc = (Elf64_External_Rela *) htab->srelgot->contents; + loc += htab->srelgot->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); } if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) { - asection *s; Elf_Internal_Rela rela; + Elf64_External_Rela *loc; /* This symbol needs a copy reloc. Set it up. */ - BFD_ASSERT (h->dynindx != -1 - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)); - - s = bfd_get_section_by_name (h->root.u.def.section->owner, - ".rela.bss"); - BFD_ASSERT (s != NULL); + if (h->dynindx == -1 + || (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + || htab->srelbss == NULL) + abort (); rela.r_offset = (h->root.u.def.value + h->root.u.def.section->output_section->vma + h->root.u.def.section->output_offset); rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_COPY); rela.r_addend = 0; - bfd_elf64_swap_reloca_out (output_bfd, &rela, - ((Elf64_External_Rela *) s->contents - + s->reloc_count)); - ++s->reloc_count; + loc = (Elf64_External_Rela *) htab->srelbss->contents; + loc += htab->srelbss->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); } /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ @@ -1776,6 +2047,26 @@ return true; } +/* Used to decide how to sort relocs in an optimal manner for the + dynamic linker, before writing them out. */ + +static enum elf_reloc_type_class +elf64_x86_64_reloc_type_class (rela) + const Elf_Internal_Rela *rela; +{ + switch ((int) ELF64_R_TYPE (rela->r_info)) + { + case R_X86_64_RELATIVE: + return reloc_class_relative; + case R_X86_64_JUMP_SLOT: + return reloc_class_plt; + case R_X86_64_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} + /* Finish up the dynamic sections. */ static boolean @@ -1783,29 +2074,26 @@ bfd *output_bfd; struct bfd_link_info *info; { + struct elf64_x86_64_link_hash_table *htab; bfd *dynobj; asection *sdyn; - asection *sgot; - - dynobj = elf_hash_table (info)->dynobj; - sgot = bfd_get_section_by_name (dynobj, ".got.plt"); - BFD_ASSERT (sgot != NULL); + htab = elf64_x86_64_hash_table (info); + dynobj = htab->elf.dynobj; sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - if (elf_hash_table (info)->dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { - asection *splt; Elf64_External_Dyn *dyncon, *dynconend; - BFD_ASSERT (sdyn != NULL); + if (sdyn == NULL || htab->sgot == NULL) + abort (); dyncon = (Elf64_External_Dyn *) sdyn->contents; dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size); for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; - const char *name; asection *s; bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); @@ -1816,115 +2104,100 @@ continue; case DT_PLTGOT: - name = ".got"; - goto get_vma; + dyn.d_un.d_ptr = htab->sgot->output_section->vma; + break; case DT_JMPREL: - name = ".rela.plt"; + dyn.d_un.d_ptr = htab->srelplt->output_section->vma; + break; - get_vma: - s = bfd_get_section_by_name (output_bfd, name); - BFD_ASSERT (s != NULL); - dyn.d_un.d_ptr = s->vma; + case DT_PLTRELSZ: + s = htab->srelplt->output_section; + if (s->_cooked_size != 0) + dyn.d_un.d_val = s->_cooked_size; + else + dyn.d_un.d_val = s->_raw_size; break; case DT_RELASZ: - /* FIXME: This comment and code is from elf64-alpha.c: */ - /* My interpretation of the TIS v1.1 ELF document indicates - that RELASZ should not include JMPREL. This is not what - the rest of the BFD does. It is, however, what the - glibc ld.so wants. Do this fixup here until we found - out who is right. */ - s = bfd_get_section_by_name (output_bfd, ".rela.plt"); - if (s) + /* The procedure linkage table relocs (DT_JMPREL) should + not be included in the overall relocs (DT_RELA). + Therefore, we override the DT_RELASZ entry here to + make it not include the JMPREL relocs. Since the + linker script arranges for .rela.plt to follow all + other relocation sections, we don't have to worry + about changing the DT_RELA entry. */ + if (htab->srelplt != NULL) { - /* Subtract JMPREL size from RELASZ. */ - dyn.d_un.d_val -= - (s->_cooked_size ? s->_cooked_size : s->_raw_size); + s = htab->srelplt->output_section; + if (s->_cooked_size != 0) + dyn.d_un.d_val -= s->_cooked_size; + else + dyn.d_un.d_val -= s->_raw_size; } break; - - case DT_PLTRELSZ: - s = bfd_get_section_by_name (output_bfd, ".rela.plt"); - BFD_ASSERT (s != NULL); - dyn.d_un.d_val = - (s->_cooked_size != 0 ? s->_cooked_size : s->_raw_size); - break; } + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); } - /* Initialize the contents of the .plt section. */ - splt = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (splt != NULL); - if (splt->_raw_size > 0) + /* Fill in the special first entry in the procedure linkage table. */ + if (htab->splt && htab->splt->_raw_size > 0) { /* Fill in the first entry in the procedure linkage table. */ - memcpy (splt->contents, elf64_x86_64_plt0_entry, PLT_ENTRY_SIZE); + memcpy (htab->splt->contents, elf64_x86_64_plt0_entry, + PLT_ENTRY_SIZE); /* Add offset for pushq GOT+8(%rip), since the instruction uses 6 bytes subtract this value. */ bfd_put_32 (output_bfd, - (sgot->output_section->vma - + sgot->output_offset + (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + 8 - - splt->output_section->vma - - splt->output_offset + - htab->splt->output_section->vma + - htab->splt->output_offset - 6), - splt->contents + 2); + htab->splt->contents + 2); /* Add offset for jmp *GOT+16(%rip). The 12 is the offset to the end of the instruction. */ bfd_put_32 (output_bfd, - (sgot->output_section->vma - + sgot->output_offset + (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + 16 - - splt->output_section->vma - - splt->output_offset + - htab->splt->output_section->vma + - htab->splt->output_offset - 12), - splt->contents + 8); + htab->splt->contents + 8); + elf_section_data (htab->splt->output_section)->this_hdr.sh_entsize = + PLT_ENTRY_SIZE; } - - elf_section_data (splt->output_section)->this_hdr.sh_entsize = - PLT_ENTRY_SIZE; } - /* Set the first entry in the global offset table to the address of - the dynamic section. */ - if (sgot->_raw_size > 0) + if (htab->sgotplt) { - if (sdyn == NULL) - bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents); - else - bfd_put_64 (output_bfd, - sdyn->output_section->vma + sdyn->output_offset, - sgot->contents); - /* Write GOT[1] and GOT[2], needed for the dynamic linker. */ - bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + GOT_ENTRY_SIZE); - bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + GOT_ENTRY_SIZE*2); - } + /* Fill in the first three entries in the global offset table. */ + if (htab->sgotplt->_raw_size > 0) + { + /* Set the first entry in the global offset table to the address of + the dynamic section. */ + if (sdyn == NULL) + bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents); + else + bfd_put_64 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + htab->sgotplt->contents); + /* Write GOT[1] and GOT[2], needed for the dynamic linker. */ + bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + GOT_ENTRY_SIZE); + bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + GOT_ENTRY_SIZE*2); + } - elf_section_data (sgot->output_section)->this_hdr.sh_entsize = - GOT_ENTRY_SIZE; + elf_section_data (htab->sgotplt->output_section)->this_hdr.sh_entsize = + GOT_ENTRY_SIZE; + } return true; } -static enum elf_reloc_type_class -elf64_x86_64_reloc_type_class (rela) - const Elf_Internal_Rela *rela; -{ - switch ((int) ELF64_R_TYPE (rela->r_info)) - { - case R_X86_64_RELATIVE: - return reloc_class_relative; - case R_X86_64_JUMP_SLOT: - return reloc_class_plt; - case R_X86_64_COPY: - return reloc_class_copy; - default: - return reloc_class_normal; - } -} #define TARGET_LITTLE_SYM bfd_elf64_x86_64_vec #define TARGET_LITTLE_NAME "elf64-x86-64" @@ -1939,25 +2212,25 @@ #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size (GOT_ENTRY_SIZE*3) #define elf_backend_plt_header_size PLT_ENTRY_SIZE +#define elf_backend_rela_normal 1 #define elf_info_to_howto elf64_x86_64_info_to_howto -#define bfd_elf64_bfd_final_link _bfd_elf64_gc_common_final_link #define bfd_elf64_bfd_link_hash_table_create \ elf64_x86_64_link_hash_table_create #define bfd_elf64_bfd_reloc_type_lookup elf64_x86_64_reloc_type_lookup #define elf_backend_adjust_dynamic_symbol elf64_x86_64_adjust_dynamic_symbol #define elf_backend_check_relocs elf64_x86_64_check_relocs -#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections -#define elf_backend_finish_dynamic_sections \ - elf64_x86_64_finish_dynamic_sections +#define elf_backend_copy_indirect_symbol elf64_x86_64_copy_indirect_symbol +#define elf_backend_create_dynamic_sections elf64_x86_64_create_dynamic_sections +#define elf_backend_finish_dynamic_sections elf64_x86_64_finish_dynamic_sections #define elf_backend_finish_dynamic_symbol elf64_x86_64_finish_dynamic_symbol #define elf_backend_gc_mark_hook elf64_x86_64_gc_mark_hook #define elf_backend_gc_sweep_hook elf64_x86_64_gc_sweep_hook +#define elf_backend_reloc_type_class elf64_x86_64_reloc_type_class #define elf_backend_relocate_section elf64_x86_64_relocate_section #define elf_backend_size_dynamic_sections elf64_x86_64_size_dynamic_sections #define elf_backend_object_p elf64_x86_64_elf_object_p -#define elf_backend_reloc_type_class elf64_x86_64_reloc_type_class #include "elf64-target.h" diff -Nur binutils-2.12/bfd/elfarm-nabi.c binutils-2.12.1/bfd/elfarm-nabi.c --- binutils-2.12/bfd/elfarm-nabi.c Tue Sep 18 05:57:24 2001 +++ binutils-2.12.1/bfd/elfarm-nabi.c Thu May 9 10:49:02 2002 @@ -138,8 +138,8 @@ bfd_elf_generic_reloc, /* special_function */ "R_ARM_ABS16", /* name */ false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ false), /* pcrel_offset */ /* 12 bit absolute */ diff -Nur binutils-2.12/bfd/elflink.c binutils-2.12.1/bfd/elflink.c --- binutils-2.12/bfd/elflink.c Wed Jan 16 00:50:02 2002 +++ binutils-2.12.1/bfd/elflink.c Thu Apr 4 11:20:41 2002 @@ -1,5 +1,5 @@ /* ELF linking support for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -329,6 +329,9 @@ PTR data; { size_t *count = (size_t *) data; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; if (h->dynindx != -1) h->dynindx = ++(*count); diff -Nur binutils-2.12/bfd/elflink.h binutils-2.12.1/bfd/elflink.h --- binutils-2.12/bfd/elflink.h Mon Feb 25 18:35:03 2002 +++ binutils-2.12.1/bfd/elflink.h Thu May 9 10:49:02 2002 @@ -57,8 +57,6 @@ PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean elf_link_find_version_dependencies PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_link_find_version_dependencies - PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean elf_link_assign_sym_version PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean elf_collect_hash_codes @@ -592,7 +590,7 @@ asection *hsec; /* This code handles the special SHN_MIPS_{TEXT,DATA} section - indices used by MIPS ELF. */ + indices used by MIPS ELF. */ switch (h->root.type) { default: @@ -702,10 +700,10 @@ && sym->st_size != h->size) { /* Since we think we have two common symbols, issue a multiple - common warning if desired. Note that we only warn if the - size is different. If the size is the same, we simply let - the old symbol override the new one as normally happens with - symbols defined in dynamic objects. */ + common warning if desired. Note that we only warn if the + size is different. If the size is the same, we simply let + the old symbol override the new one as normally happens with + symbols defined in dynamic objects. */ if (! ((*info->callbacks->multiple_common) (info, h->root.root.string, oldbfd, bfd_link_hash_common, @@ -755,10 +753,10 @@ *size_change_ok = true; /* If we get here when the old symbol is a common symbol, then - we are explicitly letting it override a weak symbol or - function in a dynamic object, and we don't want to warn about - a type change. If the old symbol is a defined symbol, a type - change warning may still be appropriate. */ + we are explicitly letting it override a weak symbol or + function in a dynamic object, and we don't want to warn about + a type change. If the old symbol is a defined symbol, a type + change warning may still be appropriate. */ if (h->root.type == bfd_link_hash_common) *type_change_ok = true; @@ -817,7 +815,7 @@ olddyncommon = false; /* We again permit a type change when a common symbol may be - overriding a function. */ + overriding a function. */ if (bfd_is_com_section (sec)) *type_change_ok = true; @@ -829,11 +827,11 @@ h->verinfo.vertree = NULL; /* In this special case, if H is the target of an indirection, - we want the caller to frob with H rather than with the - indirect symbol. That will permit the caller to redefine the - target of the indirection, rather than the indirect symbol - itself. FIXME: This will break the -y option if we store a - symbol with a different name. */ + we want the caller to frob with H rather than with the + indirect symbol. That will permit the caller to redefine the + target of the indirection, rather than the indirect symbol + itself. FIXME: This will break the -y option if we store a + symbol with a different name. */ *sym_hash = h; } @@ -856,7 +854,7 @@ return false; /* If the predumed common symbol in the dynamic object is - larger, pretend that the new symbol has its size. */ + larger, pretend that the new symbol has its size. */ if (h->size > *pvalue) *pvalue = h->size; @@ -890,8 +888,8 @@ && bind != STB_WEAK) { /* To make this work we have to frob the flags so that the rest - of the code does not think we are using the regular - definition. */ + of the code does not think we are using the regular + definition. */ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) h->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR; else if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0) @@ -900,9 +898,9 @@ | ELF_LINK_HASH_DEF_DYNAMIC); /* If H is the target of an indirection, we want the caller to - use H rather than the indirect symbol. Otherwise if we are - defining a new indirect symbol we will wind up attaching it - to the entry we are overriding. */ + use H rather than the indirect symbol. Otherwise if we are + defining a new indirect symbol we will wind up attaching it + to the entry we are overriding. */ *sym_hash = h; } @@ -1047,7 +1045,7 @@ } /* Now set HI to H, so that the following code will set the - other fields correctly. */ + other fields correctly. */ hi = h; } @@ -1133,7 +1131,7 @@ & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_DEF_REGULAR)) == 0); - (*bed->elf_backend_copy_indirect_symbol) (h, hi); + (*bed->elf_backend_copy_indirect_symbol) (h, hi); /* See if the new flags lead us to realize that the symbol must be dynamic. */ @@ -1259,8 +1257,8 @@ || h->root.type == bfd_link_hash_defweak)) { /* We don't want to issue this warning. Clobber - the section size so that the warning does not - get copied into the output file. */ + the section size so that the warning does not + get copied into the output file. */ s->_raw_size = 0; continue; } @@ -1284,7 +1282,7 @@ if (! info->relocateable) { /* Clobber the section size so that the warning does - not get copied into the output file. */ + not get copied into the output file. */ s->_raw_size = 0; } } @@ -1315,7 +1313,7 @@ goto error_return; /* Read in the symbol versions, but don't bother to convert them - to internal format. */ + to internal format. */ if (elf_dynversym (abfd) != 0) { Elf_Internal_Shdr *versymhdr; @@ -1373,10 +1371,10 @@ if (! dynamic) { /* If we are creating a shared library, create all the dynamic - sections immediately. We need to attach them to something, - so we attach them to this BFD, provided it is the right - format. FIXME: If there are no input BFD's of the same - format as the output, we can't make a shared library. */ + sections immediately. We need to attach them to something, + so we attach them to this BFD, provided it is the right + format. FIXME: If there are no input BFD's of the same + format as the output, we can't make a shared library. */ if (info->shared && is_elf_hash_table (info) && ! hash_table->dynamic_sections_created @@ -1411,7 +1409,7 @@ if (*name == '\0') { if (elf_dt_soname (abfd) != NULL) - dt_needed = true; + dt_needed = true; add_needed = false; } @@ -1531,7 +1529,7 @@ } /* Ignore DT_RPATH if we have seen DT_RUNPATH. */ if (!runpath && dyn.d_tag == DT_RPATH) - { + { struct bfd_link_needed_list *n, **pn; char *fnm, *anm; unsigned int tagv = dyn.d_un.d_val; @@ -1623,7 +1621,7 @@ } /* Save the SONAME, if there is one, because sometimes the - linker emulation code will need to know it. */ + linker emulation code will need to know it. */ if (*name == '\0') name = basename (bfd_get_filename (abfd)); elf_dt_name (abfd) = name; @@ -1764,10 +1762,10 @@ vernum = iver.vs_vers & VERSYM_VERSION; /* If this is a hidden symbol, or if it is not version - 1, we append the version name to the symbol name. - However, we do not modify a non-hidden absolute - symbol, because it might be the version symbol - itself. FIXME: What if it isn't? */ + 1, we append the version name to the symbol name. + However, we do not modify a non-hidden absolute + symbol, because it might be the version symbol + itself. FIXME: What if it isn't? */ if ((iver.vs_vers & VERSYM_HIDDEN) != 0 || (vernum > 1 && ! bfd_is_abs_section (sec))) { @@ -1866,10 +1864,10 @@ h = (struct elf_link_hash_entry *) h->root.u.i.link; /* Remember the old alignment if this is a common symbol, so - 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. */ + 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; @@ -1950,10 +1948,10 @@ } /* If this is a common symbol, then we always want H->SIZE - to be the size of the common symbol. The code just above - won't fix the size if a common symbol becomes larger. We - don't warn about a size change here, because that is - covered by --warn-common. */ + to be the size of the common symbol. The code just above + won't fix the size if a common symbol becomes larger. We + don't warn about a size change here, because that is + covered by --warn-common. */ if (h->root.type == bfd_link_hash_common) h->size = h->root.u.c.size; @@ -1983,8 +1981,8 @@ h->other = sym.st_other; /* If neither has visibility, use the st_other of the - definition. This is an arbitrary choice, since the - other bits have no general meaning. */ + definition. This is an arbitrary choice, since the + other bits have no general meaning. */ if (!symvis && !hvis && (definition || h->other == 0)) h->other = sym.st_other; @@ -2071,7 +2069,7 @@ goto error_return; /* The symbol from a DT_NEEDED object is referenced from - the regular object to create a dynamic executable. We + the regular object to create a dynamic executable. We have to make sure there is a DT_NEEDED entry for it. */ dt_needed = false; @@ -2167,10 +2165,10 @@ } /* If the real definition is in the list of dynamic - symbols, make sure the weak definition is put there - as well. If we don't do this, then the dynamic - loader might not merge the entries for the real - definition and the weak definition. */ + symbols, make sure the weak definition is put there + as well. If we don't do this, then the dynamic + loader might not merge the entries for the real + definition and the weak definition. */ if (h->dynindx != -1 && hlook->dynindx == -1) { @@ -2795,10 +2793,6 @@ h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - /* When possible, keep the original type of the symbol. */ - if (h->type == STT_NOTYPE) - h->type = STT_OBJECT; - if (((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_DYNAMIC)) != 0 || info->shared) @@ -3140,11 +3134,11 @@ eif.failed = false; /* If we are supposed to export all symbols into the dynamic symbol - table (this is not the normal case), then do so. */ + table (this is not the normal case), then do so. */ if (info->export_dynamic) { elf_link_hash_traverse (elf_hash_table (info), elf_export_symbol, - (PTR) &eif); + (PTR) &eif); if (eif.failed) return false; } @@ -3200,6 +3194,53 @@ return false; } + if (bfd_get_section_by_name (output_bfd, ".preinit_array") != NULL) + { + /* DT_PREINIT_ARRAY is not allowed in shared library. */ + if (info->shared) + { + bfd *sub; + asection *o; + + for (sub = info->input_bfds; sub != NULL; + sub = sub->link_next) + for (o = sub->sections; o != NULL; o = o->next) + if (elf_section_data (o)->this_hdr.sh_type + == SHT_PREINIT_ARRAY) + { + (*_bfd_error_handler) + (_("%s: .preinit_array section is not allowed in DSO"), + bfd_archive_filename (sub)); + break; + } + + bfd_set_error (bfd_error_nonrepresentable_section); + return false; + } + + if (!elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAY, + (bfd_vma) 0) + || !elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAYSZ, + (bfd_vma) 0)) + return false; + } + if (bfd_get_section_by_name (output_bfd, ".init_array") != NULL) + { + if (!elf_add_dynamic_entry (info, (bfd_vma) DT_INIT_ARRAY, + (bfd_vma) 0) + || !elf_add_dynamic_entry (info, (bfd_vma) DT_INIT_ARRAYSZ, + (bfd_vma) 0)) + return false; + } + if (bfd_get_section_by_name (output_bfd, ".fini_array") != NULL) + { + if (!elf_add_dynamic_entry (info, (bfd_vma) DT_FINI_ARRAY, + (bfd_vma) 0) + || !elf_add_dynamic_entry (info, (bfd_vma) DT_FINI_ARRAYSZ, + (bfd_vma) 0)) + return false; + } + dynstr = bfd_get_section_by_name (dynobj, ".dynstr"); /* If .dynstr is excluded from the link, we don't want any of these tags. Strictly, we should be checking each section @@ -3239,7 +3280,7 @@ BFD_ASSERT (s != NULL); /* We may have created additional version definitions if we are - just linking a regular application. */ + just linking a regular application. */ verdefs = asvinfo.verdefs; /* Skip anonymous version tag. */ @@ -3633,10 +3674,10 @@ /* This function is used to adjust offsets into .dynstr for dynamic symbols. This is called via elf_link_hash_traverse. */ - + static boolean elf_adjust_dynstr_offsets PARAMS ((struct elf_link_hash_entry *, PTR)); - + static boolean elf_adjust_dynstr_offsets (h, data) struct elf_link_hash_entry *h; @@ -3644,6 +3685,9 @@ { struct elf_strtab_hash *dynstr = (struct elf_strtab_hash *) data; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->dynindx != -1) h->dynstr_index = _bfd_elf_strtab_offset (dynstr, h->dynstr_index); return true; @@ -3716,7 +3760,7 @@ bfd_size_type i; Elf_Internal_Verdef def; Elf_Internal_Verdaux defaux; - + s = bfd_get_section_by_name (dynobj, ".gnu.version_d"); p = (bfd_byte *) s->contents; do @@ -3746,7 +3790,7 @@ bfd_size_type i; Elf_Internal_Verneed need; Elf_Internal_Vernaux needaux; - + s = bfd_get_section_by_name (dynobj, ".gnu.version_r"); p = (bfd_byte *) s->contents; do @@ -3824,11 +3868,11 @@ else { /* Unfortunately, ELF_LINK_NON_ELF is only correct if the symbol - was first seen in a non-ELF file. Fortunately, if the symbol - was first seen in an ELF file, we're probably OK unless the - symbol was defined in a non-ELF file. Catch that case here. - FIXME: We're still in trouble if the symbol was first seen in - a dynamic object, and then later in a non-ELF regular object. */ + was first seen in a non-ELF file. Fortunately, if the symbol + was first seen in an ELF file, we're probably OK unless the + symbol was defined in a non-ELF file. Catch that case here. + FIXME: We're still in trouble if the symbol was first seen in + a dynamic object, and then later in a non-ELF regular object. */ if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 @@ -3923,6 +3967,17 @@ bfd *dynobj; struct elf_backend_data *bed; + if (h->root.type == bfd_link_hash_warning) + { + h->plt.offset = (bfd_vma) -1; + h->got.offset = (bfd_vma) -1; + + /* When warning symbols are created, they **replace** the "real" + entry in the hash table, thus we never get to see the real + symbol in a hash traversal. So look at it now. */ + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } + /* Ignore indirect symbols. These are added by the versioning code. */ if (h->root.type == bfd_link_hash_indirect) return true; @@ -4039,6 +4094,9 @@ if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->dynindx == -1 && (h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0) @@ -4068,14 +4126,14 @@ } if (!eif->verdefs) - { + { doit: if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h)) { eif->failed = true; return false; } - } + } } return true; @@ -4096,6 +4154,9 @@ Elf_Internal_Vernaux *a; bfd_size_type amt; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* We only care about symbols defined in shared objects with version information. */ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 @@ -4176,6 +4237,9 @@ sinfo = (struct elf_assign_sym_version_info *) data; info = sinfo->info; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* Fix the symbol flags. */ eif.failed = false; eif.info = info; @@ -4201,7 +4265,7 @@ hidden = true; /* There are two consecutive ELF_VER_CHR characters if this is - not a hidden symbol. */ + not a hidden symbol. */ ++p; if (*p == ELF_VER_CHR) { @@ -4229,11 +4293,11 @@ len = p - h->root.root.string; alc = bfd_malloc ((bfd_size_type) len); if (alc == NULL) - return false; + return false; strncpy (alc, h->root.root.string, len - 1); alc[len - 1] = '\0'; if (alc[len - 2] == ELF_VER_CHR) - alc[len - 2] = '\0'; + alc[len - 2] = '\0'; h->verinfo.vertree = t; t->used = true; @@ -4247,7 +4311,7 @@ } /* See if there is anything to force this symbol to - local scope. */ + local scope. */ if (d == NULL && t->locals != NULL) { for (d = t->locals; d != NULL; d = d->next) @@ -4272,14 +4336,14 @@ } /* If we are building an application, we need to create a - version node for this version. */ + version node for this version. */ if (t == NULL && ! info->shared) { struct bfd_elf_version_tree **pp; int version_index; /* If we aren't going to export this symbol, we don't need - to worry about it. */ + to worry about it. */ if (h->dynindx == -1) return true; @@ -4315,7 +4379,7 @@ else if (t == NULL) { /* We could not find the version for a symbol when - generating a shared archive. Return an error. */ + generating a shared archive. Return an error. */ (*_bfd_error_handler) (_("%s: undefined versioned symbol name %s"), bfd_get_filename (sinfo->output_bfd), h->root.root.string); @@ -4337,8 +4401,8 @@ struct bfd_elf_version_expr *d; /* See if can find what version this symbol is in. If the - symbol is supposed to be local, then don't actually register - it. */ + symbol is supposed to be local, then don't actually register + it. */ deflt = NULL; for (t = sinfo->verdefs; t != NULL; t = t->next) { @@ -4858,8 +4922,8 @@ dynobj = elf_hash_table (info)->dynobj; emit_relocs = (info->relocateable - || info->emitrelocations - || bed->elf_backend_emit_relocs); + || info->emitrelocations + || bed->elf_backend_emit_relocs); finfo.info = info; finfo.output_bfd = abfd; @@ -4929,7 +4993,7 @@ if (info->relocateable || info->emitrelocations) o->reloc_count += sec->reloc_count; - else if (bed->elf_backend_count_relocs) + else if (bed->elf_backend_count_relocs) { Elf_Internal_Rela * relocs; @@ -4937,8 +5001,8 @@ (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, info->keep_memory)); - o->reloc_count += (*bed->elf_backend_count_relocs) - (sec, relocs); + o->reloc_count + += (*bed->elf_backend_count_relocs) (sec, relocs); if (!info->keep_memory) free (relocs); @@ -5040,10 +5104,20 @@ = elf_section_data (output_section); unsigned int *rel_count; unsigned int *rel_count2; + bfd_size_type entsize; + bfd_size_type entsize2; - /* We must be careful to add the relocation froms the + /* We must be careful to add the relocations from the input section to the right output count. */ - if (esdi->rel_hdr.sh_entsize == esdo->rel_hdr.sh_entsize) + entsize = esdi->rel_hdr.sh_entsize; + entsize2 = esdi->rel_hdr2 ? esdi->rel_hdr2->sh_entsize : 0; + BFD_ASSERT ((entsize == sizeof (Elf_External_Rel) + || entsize == sizeof (Elf_External_Rela)) + && entsize2 != entsize + && (entsize2 == 0 + || entsize2 == sizeof (Elf_External_Rel) + || entsize2 == sizeof (Elf_External_Rela))); + if (entsize == esdo->rel_hdr.sh_entsize) { rel_count = &esdo->rel_count; rel_count2 = &esdo->rel_count2; @@ -5274,10 +5348,10 @@ for (p = o->link_order_head; p != NULL; p = p->next) { if (p->type == bfd_indirect_link_order - && (bfd_get_flavour (p->u.indirect.section->owner) - == bfd_target_elf_flavour)) + && (bfd_get_flavour ((sub = p->u.indirect.section->owner)) + == bfd_target_elf_flavour) + && elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass) { - sub = p->u.indirect.section->owner; if (! sub->output_has_begun) { if (! elf_link_input_bfd (&finfo, sub)) @@ -5299,28 +5373,25 @@ } } + /* Output any global symbols that got converted to local in a + version script or due to symbol visibility. We do this in a + separate step since ELF requires all local symbols to appear + prior to any global symbols. FIXME: We should only do this if + some global symbols were, in fact, converted to become local. + FIXME: Will this work correctly with the Irix 5 linker? */ + eoinfo.failed = false; + eoinfo.finfo = &finfo; + eoinfo.localsyms = true; + elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym, + (PTR) &eoinfo); + if (eoinfo.failed) + return false; + /* That wrote out all the local symbols. Finish up the symbol table with the global symbols. Even if we want to strip everything we can, we still need to deal with those global symbols that got converted to local in a version script. */ - if (info->shared) - { - /* Output any global symbols that got converted to local in a - version script. We do this in a separate step since ELF - requires all local symbols to appear prior to any global - symbols. FIXME: We should only do this if some global - symbols were, in fact, converted to become local. FIXME: - Will this work correctly with the Irix 5 linker? */ - eoinfo.failed = false; - eoinfo.finfo = &finfo; - eoinfo.localsyms = true; - elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym, - (PTR) &eoinfo); - if (eoinfo.failed) - return false; - } - /* The sh_info field records the index of the first non local symbol. */ symtab_hdr->sh_info = bfd_get_symcount (abfd); @@ -5372,8 +5443,8 @@ /* Copy the internal symbol as is. Note that we saved a word of storage and overwrote - the original st_name with the dynstr_index. */ - sym = e->isym; + the original st_name with the dynstr_index. */ + sym = e->isym; if (e->isym.st_shndx != SHN_UNDEF && (e->isym.st_shndx < SHN_LORESERVE @@ -5550,6 +5621,34 @@ } break; + case DT_PREINIT_ARRAYSZ: + name = ".preinit_array"; + goto get_size; + case DT_INIT_ARRAYSZ: + name = ".init_array"; + goto get_size; + case DT_FINI_ARRAYSZ: + name = ".fini_array"; + get_size: + o = bfd_get_section_by_name (abfd, name); + BFD_ASSERT (o != NULL); + if (o->_raw_size == 0) + (*_bfd_error_handler) + (_("warning: %s section has zero size"), name); + dyn.d_un.d_val = o->_raw_size; + elf_swap_dyn_out (dynobj, &dyn, dyncon); + break; + + case DT_PREINIT_ARRAY: + name = ".preinit_array"; + goto get_vma; + case DT_INIT_ARRAY: + name = ".init_array"; + goto get_vma; + case DT_FINI_ARRAY: + name = ".fini_array"; + goto get_vma; + case DT_HASH: name = ".hash"; goto get_vma; @@ -5622,7 +5721,7 @@ if ((o->flags & SEC_LINKER_CREATED) == 0) { /* At this point, we are only interested in sections - created by elf_link_create_dynamic_sections. */ + created by elf_link_create_dynamic_sections. */ continue; } if ((elf_section_data (o->output_section)->this_hdr.sh_type @@ -5638,7 +5737,7 @@ else { /* The contents of the .dynstr section are actually in a - stringtab. */ + stringtab. */ off = elf_section_data (o->output_section)->this_hdr.sh_offset; if (bfd_seek (abfd, off, SEEK_SET) != 0 || ! _bfd_elf_strtab_emit (abfd, @@ -5694,7 +5793,7 @@ { if ((o->flags & SEC_RELOC) != 0 && elf_section_data (o)->rel_hashes != NULL) - free (elf_section_data (o)->rel_hashes); + free (elf_section_data (o)->rel_hashes); } elf_tdata (abfd)->linker = true; @@ -5745,7 +5844,7 @@ { Elf_External_Sym *dest; Elf_External_Sym_Shndx *destshndx; - + boolean (*output_symbol_hook) PARAMS ((bfd *, struct bfd_link_info *info, const char *, @@ -5841,6 +5940,9 @@ { asection *sec; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && ((sec = h->root.u.def.section)->flags & SEC_MERGE) @@ -5876,6 +5978,13 @@ Elf_Internal_Sym sym; asection *input_sec; + if (h->root.type == bfd_link_hash_warning) + { + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return true; + } + /* Decide whether to output this symbol in this pass. */ if (eoinfo->localsyms) { @@ -5953,14 +6062,11 @@ { default: case bfd_link_hash_new: + case bfd_link_hash_warning: abort (); return false; case bfd_link_hash_undefined: - input_sec = bfd_und_section_ptr; - sym.st_shndx = SHN_UNDEF; - break; - case bfd_link_hash_undefweak: input_sec = bfd_und_section_ptr; sym.st_shndx = SHN_UNDEF; @@ -6011,29 +6117,22 @@ case bfd_link_hash_indirect: /* These symbols are created by symbol versioning. They point - to the decorated version of the name. For example, if the - symbol foo@@GNU_1.2 is the default, which should be used when - foo is used with no version, then we add an indirect symbol - foo which points to foo@@GNU_1.2. We ignore these symbols, - since the indirected symbol is already in the hash table. */ + to the decorated version of the name. For example, if the + symbol foo@@GNU_1.2 is the default, which should be used when + foo is used with no version, then we add an indirect symbol + foo which points to foo@@GNU_1.2. We ignore these symbols, + since the indirected symbol is already in the hash table. */ return true; - - case bfd_link_hash_warning: - /* We can't represent these symbols in ELF, although a warning - symbol may have come from a .gnu.warning.SYMBOL section. We - just put the target symbol in the hash table. If the target - symbol does not really exist, don't do anything. */ - if (h->root.u.i.link->type == bfd_link_hash_new) - return true; - return (elf_link_output_extsym - ((struct elf_link_hash_entry *) h->root.u.i.link, data)); } /* Give the processor backend a chance to tweak the symbol value, and also to finish up anything that needs to be done for this - symbol. */ + symbol. FIXME: Not calling elf_backend_finish_dynamic_symbol for + forced local syms when non-shared is due to a historical quirk. */ if ((h->dynindx != -1 || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + && (finfo->info->shared + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) && elf_hash_table (finfo->info)->dynamic_sections_created) { struct elf_backend_data *bed; @@ -6287,8 +6386,8 @@ return true; emit_relocs = (finfo->info->relocateable - || finfo->info->emitrelocations - || bed->elf_backend_emit_relocs); + || finfo->info->emitrelocations + || bed->elf_backend_emit_relocs); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; if (elf_bad_symtab (input_bfd)) @@ -6404,10 +6503,10 @@ continue; /* If this symbol is defined in a section which we are - discarding, we don't need to keep it, but note that - linker_mark is only reliable for sections that have contents. - For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE - as well as linker_mark. */ + discarding, we don't need to keep it, but note that + linker_mark is only reliable for sections that have contents. + For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE + as well as linker_mark. */ if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE) && isec != NULL && ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0) @@ -6482,9 +6581,9 @@ } /* Get the contents of the section. They have been cached by a - relaxation routine. Note that o is a section in an input - file, so the contents field will not have been set by any of - the routines which work on output files. */ + relaxation routine. Note that o is a section in an input + file, so the contents field will not have been set by any of + the routines which work on output files. */ if (elf_section_data (o)->this_hdr.contents != NULL) contents = elf_section_data (o)->this_hdr.contents; else @@ -6655,6 +6754,12 @@ void (*reloc_emitter) PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *)); + boolean rela_normal; + + input_rel_hdr = &elf_section_data (o)->rel_hdr; + rela_normal = (bed->rela_normal + && (input_rel_hdr->sh_entsize + == sizeof (Elf_External_Rela))); /* Adjust the reloc addresses and symbol indices. */ @@ -6677,7 +6782,7 @@ irela->r_offset += o->output_offset; /* Relocs in an executable have to be virtual addresses. */ - if (finfo->info->emitrelocations) + if (!finfo->info->relocateable) irela->r_offset += o->output_section->vma; r_symndx = ELF_R_SYM (irela->r_info); @@ -6728,10 +6833,9 @@ processor specific section. If we have discarded a section, the output_section will be the absolute section. */ - if (sec != NULL - && (bfd_is_abs_section (sec) - || (sec->output_section != NULL - && bfd_is_abs_section (sec->output_section)))) + if (bfd_is_abs_section (sec) + || (sec != NULL + && bfd_is_abs_section (sec->output_section))) r_symndx = 0; else if (sec == NULL || sec->owner == NULL) { @@ -6743,6 +6847,11 @@ r_symndx = sec->output_section->target_index; BFD_ASSERT (r_symndx != 0); } + + /* Adjust the addend according to where the + section winds up in the output section. */ + if (rela_normal) + irela->r_addend += sec->output_offset; } else { @@ -6794,23 +6903,23 @@ } /* Swap out the relocs. */ - if (bed->elf_backend_emit_relocs - && !(finfo->info->relocateable + if (bed->elf_backend_emit_relocs + && !(finfo->info->relocateable || finfo->info->emitrelocations)) - reloc_emitter = bed->elf_backend_emit_relocs; - else - reloc_emitter = elf_link_output_relocs; + reloc_emitter = bed->elf_backend_emit_relocs; + else + reloc_emitter = elf_link_output_relocs; - input_rel_hdr = &elf_section_data (o)->rel_hdr; - (*reloc_emitter) (output_bfd, o, input_rel_hdr, internal_relocs); + (*reloc_emitter) (output_bfd, o, input_rel_hdr, internal_relocs); input_rel_hdr = elf_section_data (o)->rel_hdr2; - if (input_rel_hdr) - { - internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr) + if (input_rel_hdr) + { + internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr) * bed->s->int_rels_per_ext_rel); - reloc_emitter (output_bfd, o, input_rel_hdr, internal_relocs); - } + (*reloc_emitter) (output_bfd, o, input_rel_hdr, + internal_relocs); + } } } @@ -6910,7 +7019,7 @@ struct elf_link_hash_entry *h; /* Treat a reloc against a defined symbol as though it were - actually against the section. */ + actually against the section. */ h = ((struct elf_link_hash_entry *) bfd_wrapped_link_hash_lookup (output_bfd, info, link_order->u.reloc.p->u.name, @@ -6925,8 +7034,8 @@ indx = section->output_section->target_index; *rel_hash_ptr = NULL; /* It seems that we ought to add the symbol value to the - addend here, but in practice it has already been added - because it was passed to constructor_callback. */ + addend here, but in practice it has already been added + because it was passed to constructor_callback. */ addend += section->output_section->vma + section->output_offset; } else if (h != NULL) @@ -7399,7 +7508,7 @@ if (elf_bad_symtab (input_bfd)) { nlocsyms = symtab_hdr->sh_size / sizeof (Elf_External_Sym); - extsymoff = 0; + extsymoff = 0; } else extsymoff = nlocsyms = symtab_hdr->sh_info; @@ -7461,11 +7570,11 @@ locsym_shndx + (locsym_shndx ? r_symndx : 0), &s); if (ELF_ST_BIND (s.st_info) == STB_LOCAL) - rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s); + rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s); else { - h = sym_hashes[r_symndx - extsymoff]; - rsec = (*gc_mark_hook) (sec->owner, info, rel, h, NULL); + h = sym_hashes[r_symndx - extsymoff]; + rsec = (*gc_mark_hook) (sec->owner, info, rel, h, NULL); } } else if (r_symndx >= nlocsyms) @@ -7483,11 +7592,15 @@ } if (rsec && !rsec->gc_mark) - if (!elf_gc_mark (info, rsec, gc_mark_hook)) - { - ret = false; - goto out2; - } + { + if (bfd_get_flavour (rsec->owner) != bfd_target_elf_flavour) + rsec->gc_mark = 1; + else if (!elf_gc_mark (info, rsec, gc_mark_hook)) + { + ret = false; + goto out2; + } + } } out2: @@ -7586,6 +7699,9 @@ { int *idx = (int *) idxptr; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->dynindx != -1 && ((h->root.type != bfd_link_hash_defined && h->root.type != bfd_link_hash_defweak) @@ -7603,6 +7719,9 @@ struct elf_link_hash_entry *h; PTR okp; { + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* Those that are not vtables. */ if (h->vtable_parent == NULL) return true; @@ -7636,9 +7755,9 @@ pu = h->vtable_parent->vtable_entries_used; if (pu != NULL) { - asection *sec = h->root.u.def.section; - struct elf_backend_data *bed = get_elf_backend_data (sec->owner); - int file_align = bed->s->file_align; + asection *sec = h->root.u.def.section; + struct elf_backend_data *bed = get_elf_backend_data (sec->owner); + int file_align = bed->s->file_align; n = h->vtable_parent->vtable_entries_size / file_align; while (n--) @@ -7665,6 +7784,9 @@ struct elf_backend_data *bed; int file_align; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* Take care of both those symbols that do not describe vtables as well as those that are not loaded. */ if (h->vtable_parent == NULL) @@ -7715,7 +7837,7 @@ bfd *sub; asection * (*gc_mark_hook) PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *h, Elf_Internal_Sym *)); + struct elf_link_hash_entry *h, Elf_Internal_Sym *)); if (!get_elf_backend_data (abfd)->can_gc_sections || info->relocateable || info->emitrelocations @@ -7749,7 +7871,7 @@ for (o = sub->sections; o != NULL; o = o->next) { if (o->flags & SEC_KEEP) - if (!elf_gc_mark (info, o, gc_mark_hook)) + if (!elf_gc_mark (info, o, gc_mark_hook)) return false; } } @@ -7952,6 +8074,9 @@ { bfd_vma *off = (bfd_vma *) offarg; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->got.refcount > 0) { h->got.offset = off[0]; @@ -7992,6 +8117,9 @@ unsigned long ha; char *alc = NULL; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* Ignore indirect symbols. These are added by the versioning code. */ if (h->dynindx == -1) return true; @@ -8144,7 +8272,8 @@ } stab = strip ? NULL : bfd_get_section_by_name (abfd, ".stab"); - if ((! stab || elf_section_data(stab)->sec_info_type != ELF_INFO_TYPE_STABS) + if ((! stab + || elf_section_data(stab)->sec_info_type != ELF_INFO_TYPE_STABS) && ! eh && (strip || ! bed->elf_backend_discard_info)) continue; @@ -8169,24 +8298,24 @@ freesyms = NULL; if (symtab_hdr->contents) - cookie.locsyms = (void *) symtab_hdr->contents; + cookie.locsyms = (void *) symtab_hdr->contents; else if (cookie.locsymcount == 0) - cookie.locsyms = NULL; + cookie.locsyms = NULL; else - { - bfd_size_type amt = cookie.locsymcount * sizeof (Elf_External_Sym); - cookie.locsyms = bfd_malloc (amt); - if (cookie.locsyms == NULL) + { + bfd_size_type amt = cookie.locsymcount * sizeof (Elf_External_Sym); + cookie.locsyms = bfd_malloc (amt); + if (cookie.locsyms == NULL) return false; freesyms = cookie.locsyms; if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || bfd_bread (cookie.locsyms, amt, abfd) != amt) + || bfd_bread (cookie.locsyms, amt, abfd) != amt) { error_ret_free_loc: free (cookie.locsyms); return false; - } - } + } + } cookie.locsym_shndx = NULL; if (shndx_hdr->sh_size != 0 && cookie.locsymcount != 0) @@ -8232,8 +8361,7 @@ cookie.relend = NULL; if (eh->reloc_count) cookie.rels = (NAME(_bfd_elf,link_read_relocs) - (abfd, eh, (PTR) NULL, - (Elf_Internal_Rela *) NULL, + (abfd, eh, (PTR) NULL, (Elf_Internal_Rela *) NULL, info->keep_memory)); if (cookie.rels) { @@ -8262,9 +8390,7 @@ free (freesyms); } - if (ehdr - && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, - info, ehdr)) + if (ehdr && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info, ehdr)) ret = true; return ret; } @@ -8273,6 +8399,8 @@ elf_section_ignore_discarded_relocs (sec) asection *sec; { + struct elf_backend_data *bed; + switch (elf_section_data (sec)->sec_info_type) { case ELF_INFO_TYPE_STABS: @@ -8281,10 +8409,10 @@ default: break; } - if ((get_elf_backend_data (sec->owner)->elf_backend_ignore_discarded_relocs - != NULL) - && (*get_elf_backend_data (sec->owner) - ->elf_backend_ignore_discarded_relocs) (sec)) + + bed = get_elf_backend_data (sec->owner); + if (bed->elf_backend_ignore_discarded_relocs != NULL + && (*bed->elf_backend_ignore_discarded_relocs) (sec)) return true; return false; diff -Nur binutils-2.12/bfd/elfxx-ia64.c binutils-2.12.1/bfd/elfxx-ia64.c --- binutils-2.12/bfd/elfxx-ia64.c Tue Feb 19 08:10:29 2002 +++ binutils-2.12.1/bfd/elfxx-ia64.c Thu May 9 10:49:03 2002 @@ -1016,9 +1016,6 @@ switch (hdr->sh_type) { case SHT_IA_64_UNWIND: - case SHT_INIT_ARRAY: - case SHT_FINI_ARRAY: - case SHT_PREINIT_ARRAY: case SHT_IA_64_HP_OPT_ANOT: break; @@ -1076,12 +1073,6 @@ } else if (strcmp (name, ELF_STRING_ia64_archext) == 0) hdr->sh_type = SHT_IA_64_EXT; - else if (strcmp (name, ".init_array") == 0) - hdr->sh_type = SHT_INIT_ARRAY; - else if (strcmp (name, ".fini_array") == 0) - hdr->sh_type = SHT_FINI_ARRAY; - else if (strcmp (name, ".preinit_array") == 0) - hdr->sh_type = SHT_PREINIT_ARRAY; else if (strcmp (name, ".HP.opt_annot") == 0) hdr->sh_type = SHT_IA_64_HP_OPT_ANOT; else if (strcmp (name, ".reloc") == 0) @@ -1719,6 +1710,9 @@ = (struct elfNN_ia64_dyn_sym_traverse_data *) xdata; struct elfNN_ia64_dyn_sym_info *dyn_i; + if (entry->root.root.type == bfd_link_hash_warning) + entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link; + for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next) if (! (*data->func) (dyn_i, data->data)) return false; @@ -3508,6 +3502,7 @@ elf_section_data(input_section->output_section) ->this_hdr.sh_flags |= flags; + return true; } gp_val = _bfd_get_gp_value (output_bfd); @@ -3540,29 +3535,9 @@ ret_val = false; continue; } + howto = lookup_howto (r_type); r_symndx = ELFNN_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sym_sec = local_sections[r_symndx]; - rel->r_addend += sym_sec->output_offset; - } - } - continue; - } - - /* This is a final link. */ - h = NULL; sym = NULL; sym_sec = NULL; @@ -4567,6 +4542,7 @@ #define elf_backend_copy_indirect_symbol elfNN_ia64_hash_copy_indirect #define elf_backend_hide_symbol elfNN_ia64_hash_hide_symbol #define elf_backend_reloc_type_class elfNN_ia64_reloc_type_class +#define elf_backend_rela_normal 1 #include "elfNN-target.h" diff -Nur binutils-2.12/bfd/elfxx-target.h binutils-2.12.1/bfd/elfxx-target.h --- binutils-2.12/bfd/elfxx-target.h Tue Dec 18 12:59:59 2001 +++ binutils-2.12.1/bfd/elfxx-target.h Thu May 9 10:49:03 2002 @@ -1,5 +1,5 @@ /* Target definitions for NN-bit ELF - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -390,6 +390,10 @@ #define elf_backend_default_use_rela_p !USE_REL #endif +#ifndef elf_backend_rela_normal +#define elf_backend_rela_normal 0 +#endif + #ifndef ELF_MACHINE_ALT1 #define ELF_MACHINE_ALT1 0 #endif @@ -470,6 +474,7 @@ elf_backend_may_use_rel_p, elf_backend_may_use_rela_p, elf_backend_default_use_rela_p, + elf_backend_rela_normal, elf_backend_sign_extend_vma, elf_backend_want_got_plt, elf_backend_plt_readonly, @@ -523,9 +528,9 @@ /* ar_max_namelen: maximum number of characters in an archive header FIXME: this really has nothing to do with ELF, this is a characteristic - of the archiver and should be independently tunable. This value is - a WAG (wild a** guess) */ - 14, + of the archiver and should be independently tunable. The System V ABI, + Chapter 7 (Formats & Protocols), Archive section sets this as 15. */ + 15, /* Routines to byte-swap various sized integers from the data sections */ bfd_getb64, bfd_getb_signed_64, bfd_putb64, @@ -619,9 +624,9 @@ /* ar_max_namelen: maximum number of characters in an archive header FIXME: this really has nothing to do with ELF, this is a characteristic - of the archiver and should be independently tunable. This value is - a WAG (wild a** guess) */ - 14, + of the archiver and should be independently tunable. The System V ABI, + Chapter 7 (Formats & Protocols), Archive section sets this as 15. */ + 15, /* Routines to byte-swap various sized integers from the data sections */ bfd_getl64, bfd_getl_signed_64, bfd_putl64, diff -Nur binutils-2.12/bfd/i386linux.c binutils-2.12.1/bfd/i386linux.c --- binutils-2.12/bfd/i386linux.c Tue Oct 2 01:58:41 2001 +++ binutils-2.12.1/bfd/i386linux.c Thu Apr 4 11:20:44 2002 @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored i386 a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -437,6 +437,9 @@ int is_plt; struct linux_link_hash_entry *h1, *h2; boolean exists; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct linux_link_hash_entry *) h->root.root.u.i.link; if (h->root.root.type == bfd_link_hash_undefined && strncmp (h->root.root.root.string, NEEDS_SHRLIB, diff -Nur binutils-2.12/bfd/ihex.c binutils-2.12.1/bfd/ihex.c --- binutils-2.12/bfd/ihex.c Wed Jan 30 11:07:28 2002 +++ binutils-2.12.1/bfd/ihex.c Fri Apr 26 10:24:46 2002 @@ -873,6 +873,11 @@ } rec_addr = where - (extbase + segbase); + + /* Output records shouldn't cross 64K boundaries. */ + if (rec_addr + now > 0xffff) + now = 0x10000 - rec_addr; + if (! ihex_write_record (abfd, now, rec_addr, 0, p)) return false; diff -Nur binutils-2.12/bfd/libbfd.c binutils-2.12.1/bfd/libbfd.c --- binutils-2.12/bfd/libbfd.c Wed Jan 30 11:07:28 2002 +++ binutils-2.12.1/bfd/libbfd.c Mon Apr 1 20:28:52 2002 @@ -593,7 +593,7 @@ bfd_write_bigendian_4byte_int SYNOPSIS - void bfd_write_bigendian_4byte_int (bfd *, unsigned int); + boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int); DESCRIPTION Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big @@ -601,15 +601,14 @@ archives. */ -void +boolean bfd_write_bigendian_4byte_int (abfd, i) bfd *abfd; unsigned int i; { bfd_byte buffer[4]; bfd_putb32 ((bfd_vma) i, buffer); - if (bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) != 4) - abort (); + return bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) == 4; } bfd_vma diff -Nur binutils-2.12/bfd/libbfd.h binutils-2.12.1/bfd/libbfd.h --- binutils-2.12/bfd/libbfd.h Sat Feb 9 17:53:53 2002 +++ binutils-2.12.1/bfd/libbfd.h Thu May 9 10:49:06 2002 @@ -586,7 +586,7 @@ /* And more follows */ -void +boolean bfd_write_bigendian_4byte_int PARAMS ((bfd *, unsigned int)); unsigned int @@ -752,55 +752,6 @@ "BFD_RELOC_MIPS_REL16", "BFD_RELOC_MIPS_RELGOT", "BFD_RELOC_MIPS_JALR", - "BFD_RELOC_SH_GOT_LOW16", - "BFD_RELOC_SH_GOT_MEDLOW16", - "BFD_RELOC_SH_GOT_MEDHI16", - "BFD_RELOC_SH_GOT_HI16", - "BFD_RELOC_SH_GOTPLT_LOW16", - "BFD_RELOC_SH_GOTPLT_MEDLOW16", - "BFD_RELOC_SH_GOTPLT_MEDHI16", - "BFD_RELOC_SH_GOTPLT_HI16", - "BFD_RELOC_SH_PLT_LOW16", - "BFD_RELOC_SH_PLT_MEDLOW16", - "BFD_RELOC_SH_PLT_MEDHI16", - "BFD_RELOC_SH_PLT_HI16", - "BFD_RELOC_SH_GOTOFF_LOW16", - "BFD_RELOC_SH_GOTOFF_MEDLOW16", - "BFD_RELOC_SH_GOTOFF_MEDHI16", - "BFD_RELOC_SH_GOTOFF_HI16", - "BFD_RELOC_SH_GOTPC_LOW16", - "BFD_RELOC_SH_GOTPC_MEDLOW16", - "BFD_RELOC_SH_GOTPC_MEDHI16", - "BFD_RELOC_SH_GOTPC_HI16", - "BFD_RELOC_SH_COPY64", - "BFD_RELOC_SH_GLOB_DAT64", - "BFD_RELOC_SH_JMP_SLOT64", - "BFD_RELOC_SH_RELATIVE64", - "BFD_RELOC_SH_GOT10BY4", - "BFD_RELOC_SH_GOT10BY8", - "BFD_RELOC_SH_GOTPLT10BY4", - "BFD_RELOC_SH_GOTPLT10BY8", - "BFD_RELOC_SH_GOTPLT32", - "BFD_RELOC_SH_SHMEDIA_CODE", - "BFD_RELOC_SH_IMMU5", - "BFD_RELOC_SH_IMMS6", - "BFD_RELOC_SH_IMMS6BY32", - "BFD_RELOC_SH_IMMU6", - "BFD_RELOC_SH_IMMS10", - "BFD_RELOC_SH_IMMS10BY2", - "BFD_RELOC_SH_IMMS10BY4", - "BFD_RELOC_SH_IMMS10BY8", - "BFD_RELOC_SH_IMMS16", - "BFD_RELOC_SH_IMMU16", - "BFD_RELOC_SH_IMM_LOW16", - "BFD_RELOC_SH_IMM_LOW16_PCREL", - "BFD_RELOC_SH_IMM_MEDLOW16", - "BFD_RELOC_SH_IMM_MEDLOW16_PCREL", - "BFD_RELOC_SH_IMM_MEDHI16", - "BFD_RELOC_SH_IMM_MEDHI16_PCREL", - "BFD_RELOC_SH_IMM_HI16", - "BFD_RELOC_SH_IMM_HI16_PCREL", - "BFD_RELOC_SH_PT_16", "BFD_RELOC_386_GOT32", "BFD_RELOC_386_PLT32", @@ -947,6 +898,55 @@ "BFD_RELOC_SH_JMP_SLOT", "BFD_RELOC_SH_RELATIVE", "BFD_RELOC_SH_GOTPC", + "BFD_RELOC_SH_GOT_LOW16", + "BFD_RELOC_SH_GOT_MEDLOW16", + "BFD_RELOC_SH_GOT_MEDHI16", + "BFD_RELOC_SH_GOT_HI16", + "BFD_RELOC_SH_GOTPLT_LOW16", + "BFD_RELOC_SH_GOTPLT_MEDLOW16", + "BFD_RELOC_SH_GOTPLT_MEDHI16", + "BFD_RELOC_SH_GOTPLT_HI16", + "BFD_RELOC_SH_PLT_LOW16", + "BFD_RELOC_SH_PLT_MEDLOW16", + "BFD_RELOC_SH_PLT_MEDHI16", + "BFD_RELOC_SH_PLT_HI16", + "BFD_RELOC_SH_GOTOFF_LOW16", + "BFD_RELOC_SH_GOTOFF_MEDLOW16", + "BFD_RELOC_SH_GOTOFF_MEDHI16", + "BFD_RELOC_SH_GOTOFF_HI16", + "BFD_RELOC_SH_GOTPC_LOW16", + "BFD_RELOC_SH_GOTPC_MEDLOW16", + "BFD_RELOC_SH_GOTPC_MEDHI16", + "BFD_RELOC_SH_GOTPC_HI16", + "BFD_RELOC_SH_COPY64", + "BFD_RELOC_SH_GLOB_DAT64", + "BFD_RELOC_SH_JMP_SLOT64", + "BFD_RELOC_SH_RELATIVE64", + "BFD_RELOC_SH_GOT10BY4", + "BFD_RELOC_SH_GOT10BY8", + "BFD_RELOC_SH_GOTPLT10BY4", + "BFD_RELOC_SH_GOTPLT10BY8", + "BFD_RELOC_SH_GOTPLT32", + "BFD_RELOC_SH_SHMEDIA_CODE", + "BFD_RELOC_SH_IMMU5", + "BFD_RELOC_SH_IMMS6", + "BFD_RELOC_SH_IMMS6BY32", + "BFD_RELOC_SH_IMMU6", + "BFD_RELOC_SH_IMMS10", + "BFD_RELOC_SH_IMMS10BY2", + "BFD_RELOC_SH_IMMS10BY4", + "BFD_RELOC_SH_IMMS10BY8", + "BFD_RELOC_SH_IMMS16", + "BFD_RELOC_SH_IMMU16", + "BFD_RELOC_SH_IMM_LOW16", + "BFD_RELOC_SH_IMM_LOW16_PCREL", + "BFD_RELOC_SH_IMM_MEDLOW16", + "BFD_RELOC_SH_IMM_MEDLOW16_PCREL", + "BFD_RELOC_SH_IMM_MEDHI16", + "BFD_RELOC_SH_IMM_MEDHI16_PCREL", + "BFD_RELOC_SH_IMM_HI16", + "BFD_RELOC_SH_IMM_HI16_PCREL", + "BFD_RELOC_SH_PT_16", "BFD_RELOC_THUMB_PCREL_BRANCH9", "BFD_RELOC_THUMB_PCREL_BRANCH12", "BFD_RELOC_THUMB_PCREL_BRANCH23", diff -Nur binutils-2.12/bfd/linker.c binutils-2.12.1/bfd/linker.c --- binutils-2.12/bfd/linker.c Sat Sep 29 02:21:59 2001 +++ binutils-2.12.1/bfd/linker.c Thu Apr 4 11:20:45 2002 @@ -1419,7 +1419,7 @@ /* DEFW_ROW */ {DEFW, DEFW, DEFW, NOACT, NOACT, NOACT, NOACT, CYCLE }, /* COMMON_ROW */ {COM, COM, COM, CREF, COM, BIG, REFC, WARNC }, /* INDR_ROW */ {IND, IND, IND, MDEF, IND, CIND, MIND, CYCLE }, - /* WARN_ROW */ {MWARN, WARN, WARN, CWARN, CWARN, WARN, CWARN, MWARN }, + /* WARN_ROW */ {MWARN, WARN, WARN, CWARN, CWARN, WARN, CWARN, NOACT }, /* SET_ROW */ {SET, SET, SET, SET, SET, SET, CYCLE, CYCLE } }; @@ -2455,6 +2455,9 @@ struct generic_write_global_symbol_info *wginfo = (struct generic_write_global_symbol_info *) data; asymbol *sym; + + if (h->root.type == bfd_link_hash_warning) + h = (struct generic_link_hash_entry *) h->root.u.i.link; if (h->written) return true; diff -Nur binutils-2.12/bfd/m68klinux.c binutils-2.12.1/bfd/m68klinux.c --- binutils-2.12/bfd/m68klinux.c Tue Oct 2 01:58:41 2001 +++ binutils-2.12.1/bfd/m68klinux.c Thu Apr 4 11:20:45 2002 @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored m68k a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -441,6 +441,9 @@ int is_plt; struct linux_link_hash_entry *h1, *h2; boolean exists; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct linux_link_hash_entry *) h->root.root.u.i.link; if (h->root.root.type == bfd_link_hash_undefined && strncmp (h->root.root.root.string, NEEDS_SHRLIB, diff -Nur binutils-2.12/bfd/merge.c binutils-2.12.1/bfd/merge.c --- binutils-2.12/bfd/merge.c Tue Jan 15 07:52:15 2002 +++ binutils-2.12.1/bfd/merge.c Mon Apr 1 20:28:52 2002 @@ -804,6 +804,9 @@ if (secinfo) continue; + if (sinfo->htab->first == NULL) + continue; + if (sinfo->htab->strings) merge_strings (sinfo); else diff -Nur binutils-2.12/bfd/mmo.c binutils-2.12.1/bfd/mmo.c --- binutils-2.12/bfd/mmo.c Sun Feb 17 17:55:35 2002 +++ binutils-2.12.1/bfd/mmo.c Mon Apr 1 20:28:53 2002 @@ -1523,7 +1523,7 @@ entry = (mmo_data_list_type *) bfd_zalloc (sec->owner, sizeof (mmo_data_list_type) + allocated_size); if (entry == NULL) - return false; + return NULL; entry->where = vma; entry->size = size; entry->allocated_size = allocated_size; diff -Nur binutils-2.12/bfd/opncls.c binutils-2.12.1/bfd/opncls.c --- binutils-2.12/bfd/opncls.c Sun Dec 16 19:40:53 2001 +++ binutils-2.12.1/bfd/opncls.c Thu May 9 10:49:09 2002 @@ -1,6 +1,6 @@ /* opncls.c -- open and close a BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001 + 2001, 2002 Free Software Foundation, Inc. Written by Cygnus Support. @@ -96,6 +96,8 @@ bfd *nbfd; nbfd = _bfd_new_bfd (); + if (nbfd == NULL) + return NULL; nbfd->xvec = obfd->xvec; nbfd->my_archive = obfd; nbfd->direction = read_direction; @@ -618,7 +620,6 @@ abfd->arch_info = &bfd_default_arch_struct; abfd->where = 0; - abfd->sections = (asection *) NULL; abfd->format = bfd_unknown; abfd->my_archive = (bfd *) NULL; abfd->origin = 0; @@ -637,6 +638,7 @@ abfd->outsymbols = 0; abfd->tdata.any = 0; + bfd_section_list_clear (abfd); bfd_check_format(abfd, bfd_object); return true; diff -Nur binutils-2.12/bfd/pdp11.c binutils-2.12.1/bfd/pdp11.c --- binutils-2.12/bfd/pdp11.c Wed Oct 17 08:01:05 2001 +++ binutils-2.12.1/bfd/pdp11.c Thu Apr 4 11:20:45 2002 @@ -1,5 +1,5 @@ /* BFD back-end for PDP-11 a.out binaries. - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -4304,6 +4304,13 @@ struct external_nlist outsym; bfd_size_type indx; bfd_size_type amt; + + if (h->root.type == bfd_link_hash_warning) + { + h = (struct aout_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return true; + } output_bfd = finfo->output_bfd; diff -Nur binutils-2.12/bfd/reloc.c binutils-2.12.1/bfd/reloc.c --- binutils-2.12/bfd/reloc.c Sat Feb 9 17:53:53 2002 +++ binutils-2.12.1/bfd/reloc.c Thu May 9 10:49:10 2002 @@ -2051,106 +2051,6 @@ BFD_RELOC_MIPS_JALR COMMENT COMMENT -ENUMX - BFD_RELOC_SH_GOT_LOW16 -ENUMX - BFD_RELOC_SH_GOT_MEDLOW16 -ENUMX - BFD_RELOC_SH_GOT_MEDHI16 -ENUMX - BFD_RELOC_SH_GOT_HI16 -ENUMX - BFD_RELOC_SH_GOTPLT_LOW16 -ENUMX - BFD_RELOC_SH_GOTPLT_MEDLOW16 -ENUMX - BFD_RELOC_SH_GOTPLT_MEDHI16 -ENUMX - BFD_RELOC_SH_GOTPLT_HI16 -ENUMX - BFD_RELOC_SH_PLT_LOW16 -ENUMX - BFD_RELOC_SH_PLT_MEDLOW16 -ENUMX - BFD_RELOC_SH_PLT_MEDHI16 -ENUMX - BFD_RELOC_SH_PLT_HI16 -ENUMX - BFD_RELOC_SH_GOTOFF_LOW16 -ENUMX - BFD_RELOC_SH_GOTOFF_MEDLOW16 -ENUMX - BFD_RELOC_SH_GOTOFF_MEDHI16 -ENUMX - BFD_RELOC_SH_GOTOFF_HI16 -ENUMX - BFD_RELOC_SH_GOTPC_LOW16 -ENUMX - BFD_RELOC_SH_GOTPC_MEDLOW16 -ENUMX - BFD_RELOC_SH_GOTPC_MEDHI16 -ENUMX - BFD_RELOC_SH_GOTPC_HI16 -ENUMX - BFD_RELOC_SH_COPY64 -ENUMX - BFD_RELOC_SH_GLOB_DAT64 -ENUMX - BFD_RELOC_SH_JMP_SLOT64 -ENUMX - BFD_RELOC_SH_RELATIVE64 -ENUMX - BFD_RELOC_SH_GOT10BY4 -ENUMX - BFD_RELOC_SH_GOT10BY8 -ENUMX - BFD_RELOC_SH_GOTPLT10BY4 -ENUMX - BFD_RELOC_SH_GOTPLT10BY8 -ENUMX - BFD_RELOC_SH_GOTPLT32 -COMMENT -ENUMX - BFD_RELOC_SH_SHMEDIA_CODE -ENUMX - BFD_RELOC_SH_IMMU5 -ENUMX - BFD_RELOC_SH_IMMS6 -ENUMX - BFD_RELOC_SH_IMMS6BY32 -ENUMX - BFD_RELOC_SH_IMMU6 -ENUMX - BFD_RELOC_SH_IMMS10 -ENUMX - BFD_RELOC_SH_IMMS10BY2 -ENUMX - BFD_RELOC_SH_IMMS10BY4 -ENUMX - BFD_RELOC_SH_IMMS10BY8 -ENUMX - BFD_RELOC_SH_IMMS16 -ENUMX - BFD_RELOC_SH_IMMU16 -ENUMX - BFD_RELOC_SH_IMM_LOW16 -ENUMX - BFD_RELOC_SH_IMM_LOW16_PCREL -ENUMX - BFD_RELOC_SH_IMM_MEDLOW16 -ENUMX - BFD_RELOC_SH_IMM_MEDLOW16_PCREL -ENUMX - BFD_RELOC_SH_IMM_MEDHI16 -ENUMX - BFD_RELOC_SH_IMM_MEDHI16_PCREL -ENUMX - BFD_RELOC_SH_IMM_HI16 -ENUMX - BFD_RELOC_SH_IMM_HI16_PCREL -ENUMX - BFD_RELOC_SH_PT_16 -COMMENT ENUMDOC MIPS ELF relocations. @@ -2487,6 +2387,104 @@ BFD_RELOC_SH_RELATIVE ENUMX BFD_RELOC_SH_GOTPC +ENUMX + BFD_RELOC_SH_GOT_LOW16 +ENUMX + BFD_RELOC_SH_GOT_MEDLOW16 +ENUMX + BFD_RELOC_SH_GOT_MEDHI16 +ENUMX + BFD_RELOC_SH_GOT_HI16 +ENUMX + BFD_RELOC_SH_GOTPLT_LOW16 +ENUMX + BFD_RELOC_SH_GOTPLT_MEDLOW16 +ENUMX + BFD_RELOC_SH_GOTPLT_MEDHI16 +ENUMX + BFD_RELOC_SH_GOTPLT_HI16 +ENUMX + BFD_RELOC_SH_PLT_LOW16 +ENUMX + BFD_RELOC_SH_PLT_MEDLOW16 +ENUMX + BFD_RELOC_SH_PLT_MEDHI16 +ENUMX + BFD_RELOC_SH_PLT_HI16 +ENUMX + BFD_RELOC_SH_GOTOFF_LOW16 +ENUMX + BFD_RELOC_SH_GOTOFF_MEDLOW16 +ENUMX + BFD_RELOC_SH_GOTOFF_MEDHI16 +ENUMX + BFD_RELOC_SH_GOTOFF_HI16 +ENUMX + BFD_RELOC_SH_GOTPC_LOW16 +ENUMX + BFD_RELOC_SH_GOTPC_MEDLOW16 +ENUMX + BFD_RELOC_SH_GOTPC_MEDHI16 +ENUMX + BFD_RELOC_SH_GOTPC_HI16 +ENUMX + BFD_RELOC_SH_COPY64 +ENUMX + BFD_RELOC_SH_GLOB_DAT64 +ENUMX + BFD_RELOC_SH_JMP_SLOT64 +ENUMX + BFD_RELOC_SH_RELATIVE64 +ENUMX + BFD_RELOC_SH_GOT10BY4 +ENUMX + BFD_RELOC_SH_GOT10BY8 +ENUMX + BFD_RELOC_SH_GOTPLT10BY4 +ENUMX + BFD_RELOC_SH_GOTPLT10BY8 +ENUMX + BFD_RELOC_SH_GOTPLT32 +ENUMX + BFD_RELOC_SH_SHMEDIA_CODE +ENUMX + BFD_RELOC_SH_IMMU5 +ENUMX + BFD_RELOC_SH_IMMS6 +ENUMX + BFD_RELOC_SH_IMMS6BY32 +ENUMX + BFD_RELOC_SH_IMMU6 +ENUMX + BFD_RELOC_SH_IMMS10 +ENUMX + BFD_RELOC_SH_IMMS10BY2 +ENUMX + BFD_RELOC_SH_IMMS10BY4 +ENUMX + BFD_RELOC_SH_IMMS10BY8 +ENUMX + BFD_RELOC_SH_IMMS16 +ENUMX + BFD_RELOC_SH_IMMU16 +ENUMX + BFD_RELOC_SH_IMM_LOW16 +ENUMX + BFD_RELOC_SH_IMM_LOW16_PCREL +ENUMX + BFD_RELOC_SH_IMM_MEDLOW16 +ENUMX + BFD_RELOC_SH_IMM_MEDLOW16_PCREL +ENUMX + BFD_RELOC_SH_IMM_MEDHI16 +ENUMX + BFD_RELOC_SH_IMM_MEDHI16_PCREL +ENUMX + BFD_RELOC_SH_IMM_HI16 +ENUMX + BFD_RELOC_SH_IMM_HI16_PCREL +ENUMX + BFD_RELOC_SH_PT_16 ENUMDOC Hitachi SH relocs. Not all of these appear in object files. diff -Nur binutils-2.12/bfd/rs6000-core.c binutils-2.12.1/bfd/rs6000-core.c --- binutils-2.12/bfd/rs6000-core.c Sat Jan 5 08:11:33 2002 +++ binutils-2.12.1/bfd/rs6000-core.c Mon May 13 12:18:47 2002 @@ -182,7 +182,7 @@ /* Return the c_impl field from struct core_dumpx C. */ -#ifdef AIX_CORE_DUMPX_CORE +#if defined (HAVE_ST_C_IMPL) || defined (AIX_5_CORE) # define CNEW_IMPL(c) (c).c_impl #else # define CNEW_IMPL(c) 0 diff -Nur binutils-2.12/bfd/sparclinux.c binutils-2.12.1/bfd/sparclinux.c --- binutils-2.12/bfd/sparclinux.c Tue Oct 2 01:58:41 2001 +++ binutils-2.12.1/bfd/sparclinux.c Thu Apr 4 11:20:46 2002 @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored sparc a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -438,6 +438,9 @@ int is_plt; struct linux_link_hash_entry *h1, *h2; boolean exists; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct linux_link_hash_entry *) h->root.root.u.i.link; if (h->root.root.type == bfd_link_hash_undefined && strncmp (h->root.root.root.string, NEEDS_SHRLIB, diff -Nur binutils-2.12/bfd/srec.c binutils-2.12.1/bfd/srec.c --- binutils-2.12/bfd/srec.c Sun Jan 6 02:30:35 2002 +++ binutils-2.12.1/bfd/srec.c Thu Apr 4 11:20:46 2002 @@ -167,13 +167,13 @@ } } -/* The maximum number of bytes on a line is FF. */ +/* The maximum number of address+data+crc bytes on a line is FF. */ #define MAXCHUNK 0xff /* Default size for a CHUNK. */ #define DEFAULT_CHUNK 16 -/* The number of bytes we actually fit onto a line on output. +/* The number of data bytes we actually fit onto a line on output. This variable can be modified by objcopy's --srec-len parameter. For a 0x75 byte record you should set --srec-len=0x70. */ unsigned int Chunk = DEFAULT_CHUNK; @@ -936,7 +936,7 @@ const bfd_byte *data; const bfd_byte *end; { - char buffer[MAXCHUNK]; + char buffer[2 * MAXCHUNK + 6]; unsigned int check_sum = 0; const bfd_byte *src = data; char *dst = buffer; @@ -994,15 +994,14 @@ srec_write_header (abfd) bfd *abfd; { - bfd_byte buffer[MAXCHUNK]; - bfd_byte *dst = buffer; - unsigned int i; + unsigned int len = strlen (abfd->filename); /* I'll put an arbitary 40 char limit on header size. */ - for (i = 0; i < 40 && abfd->filename[i]; i++) - *dst++ = abfd->filename[i]; + if (len > 40) + len = 40; - return srec_write_record (abfd, 0, (bfd_vma) 0, buffer, dst); + return srec_write_record (abfd, 0, (bfd_vma) 0, + abfd->filename, abfd->filename + len); } static boolean @@ -1014,6 +1013,17 @@ unsigned int octets_written = 0; bfd_byte *location = list->data; + /* Validate number of data bytes to write. The srec length byte + counts the address, data and crc bytes. S1 (tdata->type == 1) + records have two address bytes, S2 (tdata->type == 2) records + have three, and S3 (tdata->type == 3) records have four. + The total length can't exceed 255, and a zero data length will + spin for a long time. */ + if (Chunk == 0) + Chunk = 1; + else if (Chunk > MAXCHUNK - tdata->type - 2) + Chunk = MAXCHUNK - tdata->type - 2; + while (octets_written < list->size) { bfd_vma address; @@ -1043,17 +1053,14 @@ bfd *abfd; tdata_type *tdata; { - bfd_byte buffer[2]; - return srec_write_record (abfd, 10 - tdata->type, - abfd->start_address, buffer, buffer); + abfd->start_address, NULL, NULL); } static boolean srec_write_symbols (abfd) bfd *abfd; { - char buffer[MAXCHUNK]; /* Dump out the symbols of a bfd. */ int i; int count = bfd_get_symcount (abfd); @@ -1062,10 +1069,10 @@ { bfd_size_type len; asymbol **table = bfd_get_outsymbols (abfd); - sprintf (buffer, "$$ %s\r\n", abfd->filename); - - len = strlen (buffer); - if (bfd_bwrite (buffer, len, abfd) != len) + len = strlen (abfd->filename); + if (bfd_bwrite ("$$ ", (bfd_size_type) 3, abfd) != 3 + || bfd_bwrite (abfd->filename, len, abfd) != len + || bfd_bwrite ("\r\n", (bfd_size_type) 2, abfd) != 2) return false; for (i = 0; i < count; i++) @@ -1075,23 +1082,29 @@ && (s->flags & BSF_DEBUGGING) == 0) { /* Just dump out non debug symbols. */ - char buf2[40], *p; + char buf[42], *p; + + len = strlen (s->name); + if (bfd_bwrite (" ", (bfd_size_type) 2, abfd) != 2 + || bfd_bwrite (s->name, len, abfd) != len) + return false; - sprintf_vma (buf2, - s->value + s->section->output_section->lma - + s->section->output_offset); - p = buf2; + sprintf_vma (buf + 1, (s->value + + s->section->output_section->lma + + s->section->output_offset)); + p = buf + 1; while (p[0] == '0' && p[1] != 0) p++; - sprintf (buffer, " %s $%s\r\n", s->name, p); - len = strlen (buffer); - if (bfd_bwrite (buffer, len, abfd) != len) + len = strlen (p); + p[len] = '\r'; + p[len + 1] = '\n'; + *--p = ' '; + len += 3; + if (bfd_bwrite (p, len, abfd) != len) return false; } } - sprintf (buffer, "$$ \r\n"); - len = strlen (buffer); - if (bfd_bwrite (buffer, len, abfd) != len) + if (bfd_bwrite ("$$ \r\n", (bfd_size_type) 5, abfd) != 5) return false; } diff -Nur binutils-2.12/bfd/sunos.c binutils-2.12.1/bfd/sunos.c --- binutils-2.12/bfd/sunos.c Sat Jan 5 08:11:31 2002 +++ binutils-2.12.1/bfd/sunos.c Thu Apr 4 11:20:47 2002 @@ -2052,6 +2052,9 @@ { struct bfd_link_info *info = (struct bfd_link_info *) data; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct sunos_link_hash_entry *) h->root.root.u.i.link; + /* Set the written flag for symbols we do not want to write out as part of the regular symbol table. This is all symbols which are not defined in a regular object file. For some reason symbols diff -Nur binutils-2.12/bfd/syms.c binutils-2.12.1/bfd/syms.c --- binutils-2.12/bfd/syms.c Wed Jan 30 13:12:16 2002 +++ binutils-2.12.1/bfd/syms.c Thu May 9 10:49:11 2002 @@ -545,23 +545,25 @@ adding entries. Since it is so short, a linear search is used. */ static const struct section_to_type stt[] = { - {"*DEBUG*", 'N'}, {".bss", 'b'}, - {"zerovars", 'b'}, /* MRI .bss */ + {"code", 't'}, /* MRI .text */ {".data", 'd'}, - {"vars", 'd'}, /* MRI .data */ + {"*DEBUG*", 'N'}, + {".debug", 'N'}, /* MSVC's .debug (non-standard debug syms) */ + {".drectve", 'i'}, /* MSVC's .drective section */ + {".edata", 'e'}, /* MSVC's .edata (export) section */ + {".fini", 't'}, /* ELF fini section */ + {".idata", 'i'}, /* MSVC's .idata (import) section */ + {".init", 't'}, /* ELF init section */ + {".pdata", 'p'}, /* MSVC's .pdata (stack unwind) section */ {".rdata", 'r'}, /* Read only data. */ {".rodata", 'r'}, /* Read only data. */ {".sbss", 's'}, /* Small BSS (uninitialized data). */ {".scommon", 'c'}, /* Small common. */ {".sdata", 'g'}, /* Small initialized data. */ {".text", 't'}, - {"code", 't'}, /* MRI .text */ - {".drectve", 'i'}, /* MSVC's .drective section */ - {".idata", 'i'}, /* MSVC's .idata (import) section */ - {".edata", 'e'}, /* MSVC's .edata (export) section */ - {".pdata", 'p'}, /* MSVC's .pdata (stack unwind) section */ - {".debug", 'N'}, /* MSVC's .debug (non-standard debug syms) */ + {"vars", 'd'}, /* MRI .data */ + {"zerovars", 'b'}, /* MRI .bss */ {0, 0} }; @@ -1236,9 +1238,11 @@ for (; stab < (indexentry+1)->stab; stab += STABSIZE) { - boolean done; + boolean done, saw_line, saw_func; bfd_vma val; + saw_line = false; + saw_func = false; done = false; switch (stab[TYPEOFF]) @@ -1259,7 +1263,11 @@ /* A line number. The value is relative to the start of the current function. */ val = indexentry->val + bfd_get_32 (abfd, stab + VALOFF); - if (val <= offset) + /* If this line starts before our desired offset, or if it's + the first line we've been able to find, use it. The + !saw_line check works around a bug in GCC 2.95.3, which emits + the first N_SLINE late. */ + if (!saw_line || val <= offset) { *pline = bfd_get_16 (abfd, stab + DESCOFF); @@ -1272,11 +1280,14 @@ } if (val > offset) done = true; + saw_line = true; break; case N_FUN: case N_SO: - done = true; + if (saw_func || saw_line) + done = true; + saw_func = true; break; } @@ -1286,7 +1297,8 @@ *pfound = true; - if (IS_ABSOLUTE_PATH(file_name) || directory_name == NULL) + if (file_name == NULL || IS_ABSOLUTE_PATH (file_name) + || directory_name == NULL) *pfilename = file_name; else { diff -Nur binutils-2.12/bfd/version.h binutils-2.12.1/bfd/version.h --- binutils-2.12/bfd/version.h Fri Feb 8 18:00:05 2002 +++ binutils-2.12.1/bfd/version.h Tue May 14 19:33:07 2002 @@ -1 +1 @@ -#define BFD_VERSION_DATE 20020209 +#define BFD_VERSION_DATE 20020514 diff -Nur binutils-2.12/bfd/xcofflink.c binutils-2.12.1/bfd/xcofflink.c --- binutils-2.12/bfd/xcofflink.c Sat Jan 5 08:11:31 2002 +++ binutils-2.12.1/bfd/xcofflink.c Thu May 9 10:49:14 2002 @@ -2114,7 +2114,7 @@ /* Remove the sections from this object, so that they do not get included in the link. */ - abfd->sections = NULL; + bfd_section_list_clear (abfd); bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr); @@ -3264,6 +3264,9 @@ struct xcoff_loader_info *ldinfo = (struct xcoff_loader_info *) p; bfd_size_type amt; + if (h->root.type == bfd_link_hash_warning) + h = (struct xcoff_link_hash_entry *) h->root.u.i.link; + /* __rtinit Special handling of this symbol to make is the first symbol in the loader symbol table. Make sure this pass through does not @@ -5395,6 +5398,13 @@ output_bfd = finfo->output_bfd; outsym = finfo->outsyms; + + if (h->root.type == bfd_link_hash_warning) + { + h = (struct xcoff_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return true; + } /* If this symbol was garbage collected, just skip it. */ if (xcoff_hash_table (finfo->info)->gc diff -Nur binutils-2.12/binutils/ChangeLog binutils-2.12.1/binutils/ChangeLog --- binutils-2.12/binutils/ChangeLog Fri Mar 8 01:04:46 2002 +++ binutils-2.12.1/binutils/ChangeLog Sat May 11 13:32:44 2002 @@ -1,3 +1,143 @@ +2002-05-09 Alan Modra + + * configure.in: Replace `*pe' with `pe' throughout. + * configure: Regenerate. + + Merge from mainline + 2002-05-06 Alan Modra + * dlltool.c (process_def_file): Add missing prototype. + (new_directive, assemble_file, main): Likewise. + (process_def_file, new_directive): Make static. + (inform): Rewrite using VA_FIXEDARG. + * dllwrap.c (mybasename): Add missing prototype. + (strhash, main): Likewise. + (inform): Rewrite using VA_FIXEDARG. + (warn): Likewise. + (cleanup_and_exit): Use old style function definition. + (strhash): Likewise. + * windres.c (define_resource): Use one memset to clear all of + struct res_resource. + * rcparse.y: Remove newcmd rule. Move rcparse_discard_strings + call to rules that need no lookahead. Check for no lookahead. + + 2002-05-06 Borut Razem + * rclex.l (get_string): Correct "strings" list handling. + * resrc.c (read_rc_file): Discard strings. + + 2002-05-04 Bob Byrnes + * size.c (display_archive): Add last_arfile and code to close archives. + + 2002-05-01 Alan Modra + * nm.c (print_symbol): Check returned filename from + bfd_find_nearest_line is non-NULL. + + 2002-04-17 Thiemo Seufer + * arparse.y: Fix syntax warning. + + 2002-04-16 Nick Clifton + * rcparse.y: Set MEMFLAG_DISCARDABLE by default. + + 2002-04-15 Nick Clifton + * resrc.c (write_rc_dialog): If charset is non-default value + display all of the DIALOGEX parameters. + + 2002-04-15 Eric Kohl + * rcparse.y: Allow two to five parameter in FONT statement of + DIALOGEX resources. + * resbin.c (bin_to_res_dialog): Fixed read/write code for dialogex + resource data. + (res_to_bin_dialog): Likewise. + * windres.h: Added misssing charset variable to dialog_ex + structure. + + 2002-04-10 Nick Clifton + * rcparse.y: Set MEMFLAG_PURE by default. + + 2002-04-09 Bernd Herd + * rcparse.y: CLASS definitions in DIALOG resources + are quoted. + Fix typo in BEDIT warning. + Don't add default dialog style when explicit style specified. + Add WS_CAPTION dialog style if CAPTION is specified. + * rclex.l (handle_quotes): "\xhex" encoding in strings corrected. + (handle_quotes) "\a" escape (used for right justified key + definitions in menus) is encodes as binary 8. + * resrc.c (write_rc_dialog): Print style even if it is 0. + (write_rc_directory): Fix overlooked sublang shift bug. + (bin_to_res_dialog): Don't print empty dialog caption. + * resbin.c (bin_to_res_dialog): Use signature to identify + DIALOGEX. + * windres.c (main): Set default LANGUAGE to english/us. + + 2002-04-09 Gunnar Degnbol + * resrc.c: print CLASS names in quotes + +2002-04-27 Alan Modra + + Merge from mainline + 2002-04-25 Elena Zannoni + * readelf.c (get_AT_name): Handle DW_AT_GNU_vector. + + 2002-04-16 Nick Clifton + * readelf.c (fetch_location_list): Remove unused function. + * readelf.c (process_corefile_note_segment): Catch corrupt notes + and display a warning message, then exit the loop. + + 2002-04-24 Christian Groessler + * MAINTAINERS: Changed my email address. + + 2002-04-09 J"orn Rennecke + * MAINTAINERS: Update my email address. + + 2002-03-27 Peter Targett + * MAINTAINERS: Update my email address. + + 2002-03-20 Daniel Berlin + * readelf.c: Add support for displaying dwarf2 location lists. + (do_debug_loc, debug_loc_section, debug_loc_size): New. + (parse_args): Use 'O' as shorthand for displaying location list + section. + (process_section_headers): Handle debug_loc as well. + (load_debug_loc): New. + (free_debug_loc): New. + (fetch_location_list): New. + (display_debug_loc): New. + (display_debug_info): Call load_debug_loc and free_debug_loc. + (debug_displays): We can display .debug_loc now, too. + (usage): Update usage string. + (read_and_display_attr_value): Note location lists, but don't + display them inline. + + 2002-03-01 Dmitry Timoshkov + * dlltool.c (gen_exp_file): Take into account --kill-at (-k) while + generating .exp file. + + 2002-02-21 Nick Clifton + * readelf.c (dump_relocations): Fix typo. + + 2002-02-18 Timothy Daly + * readelf.c (dump_relocations): Display 2nd and 3rd reloc + types for 64-bit MIPS. Narrow some fields for 80-char + output. + (dump_relocations): Change spelling from 'unrecognised' + to 'unrecognized'. + (decode_ARM_machine_flags): Likewise. + (parse_args): Likewise. + (read_and_display_attr_value): Likewise. + (display_debug_section): Likewise. + +2002-04-04 Alan Modra + + * dep-in.sed: Cope with absolute paths. + * Makefile.am (dep.sed): Subst TOPDIR. + Run "make dep-am". + * Makefile.in: Regenerate. + +2002-03-28 Alan Modra + + * aclocal.m4: Regenerate. + * configure: Regenerate. + 2002-03-07 Daniel Jacobowitz * README: Update some version numbers. diff -Nur binutils-2.12/binutils/MAINTAINERS binutils-2.12.1/binutils/MAINTAINERS --- binutils-2.12/binutils/MAINTAINERS Tue Feb 12 04:48:51 2002 +++ binutils-2.12.1/binutils/MAINTAINERS Thu May 9 10:49:16 2002 @@ -50,7 +50,7 @@ maintainer. The first maintainer is free to devolve that responsibility among the other maintainers. - ARC Peter Targett + ARC Peter Targett ARM Nick Clifton ARM Richard Earnshaw AVR Denis Chertykov @@ -74,12 +74,13 @@ PPC Geoff Keating PPC XCOFF Tom Rix s390, s390x Martin Schwidefsky - SH Jörn Rennecke + SH Jörn Rennecke SH Hans-Peter Nilsson SH Alexandre Oliva SPARC Jakub Jelinek TIC54X Timothy Wall - z8k Christian Groessler + z8k Christian Groessler + --------- CGEN Maintainers ------------- diff -Nur binutils-2.12/binutils/Makefile.am binutils-2.12.1/binutils/Makefile.am --- binutils-2.12/binutils/Makefile.am Thu Jan 31 22:26:32 2002 +++ binutils-2.12.1/binutils/Makefile.am Thu Apr 4 11:20:11 2002 @@ -307,7 +307,8 @@ -e 's!@INCDIR@!$(INCDIR)!' \ -e 's!@BFDDIR@!$(BFDDIR)!' \ -e 's!@SRCDIR@!$(srcdir)!' \ - -e "s!@OBJDIR@!$${objdir}!" + -e "s!@OBJDIR@!$${objdir}!" \ + -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/binutils$$,,`'!' dep: DEP sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile @@ -376,11 +377,13 @@ bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h -coffdump.o: coffdump.c coffgrok.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h -coffgrok.o: coffgrok.c bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h coffgrok.h +coffdump.o: coffdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h coffgrok.h \ + bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h +coffgrok.o: coffgrok.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h coffgrok.h debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h @@ -435,21 +438,24 @@ size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ $(INCDIR)/libiberty.h -srconv.o: srconv.c bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h sysroff.h coffgrok.h $(INCDIR)/coff/internal.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h sysroff.c +srconv.o: srconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h sysroff.h coffgrok.h $(INCDIR)/libiberty.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + sysroff.c stabs.o: stabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/filenames.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def strings.o: strings.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h + $(INCDIR)/symcat.h $(INCDIR)/getopt.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h sysroff.h \ - sysroff.c + $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h $(INCDIR)/libiberty.h \ + sysroff.h sysroff.c version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h @@ -508,7 +514,8 @@ arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h arsup.h -arlex.o: arlex.c $(INCDIR)/libiberty.h arparse.h +arlex.o: arlex.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + arparse.h sysroff.o: sysroff.c sysinfo.o: sysinfo.c syslex.o: syslex.c sysinfo.h @@ -517,8 +524,8 @@ $(INCDIR)/fopen-same.h dlltool.h deflex.o: deflex.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ defparse.h dlltool.h -nlmheader.o: nlmheader.c $(INCDIR)/safe-ctype.h ../bfd/bfd.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ +nlmheader.o: nlmheader.c $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h \ + ../bfd/bfd.h $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ nlmconv.h rcparse.o: rcparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ diff -Nur binutils-2.12/binutils/Makefile.in binutils-2.12.1/binutils/Makefile.in --- binutils-2.12/binutils/Makefile.in Thu Jan 31 22:26:32 2002 +++ binutils-2.12.1/binutils/Makefile.in Thu Apr 4 11:20:11 2002 @@ -1032,7 +1032,8 @@ -e 's!@INCDIR@!$(INCDIR)!' \ -e 's!@BFDDIR@!$(BFDDIR)!' \ -e 's!@SRCDIR@!$(srcdir)!' \ - -e "s!@OBJDIR@!$${objdir}!" + -e "s!@OBJDIR@!$${objdir}!" \ + -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/binutils$$,,`'!' dep: DEP sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile @@ -1095,11 +1096,13 @@ bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h -coffdump.o: coffdump.c coffgrok.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h -coffgrok.o: coffgrok.c bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h coffgrok.h +coffdump.o: coffdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h coffgrok.h \ + bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h +coffgrok.o: coffgrok.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h coffgrok.h debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h @@ -1154,21 +1157,24 @@ size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ $(INCDIR)/libiberty.h -srconv.o: srconv.c bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h sysroff.h coffgrok.h $(INCDIR)/coff/internal.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h sysroff.c +srconv.o: srconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h sysroff.h coffgrok.h $(INCDIR)/libiberty.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + sysroff.c stabs.o: stabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/filenames.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def strings.o: strings.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h + $(INCDIR)/symcat.h $(INCDIR)/getopt.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h sysroff.h \ - sysroff.c + $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h $(INCDIR)/libiberty.h \ + sysroff.h sysroff.c version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h @@ -1227,7 +1233,8 @@ arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h arsup.h -arlex.o: arlex.c $(INCDIR)/libiberty.h arparse.h +arlex.o: arlex.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + arparse.h sysroff.o: sysroff.c sysinfo.o: sysinfo.c syslex.o: syslex.c sysinfo.h @@ -1236,8 +1243,8 @@ $(INCDIR)/fopen-same.h dlltool.h deflex.o: deflex.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ defparse.h dlltool.h -nlmheader.o: nlmheader.c $(INCDIR)/safe-ctype.h ../bfd/bfd.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ +nlmheader.o: nlmheader.c $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h \ + ../bfd/bfd.h $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ nlmconv.h rcparse.o: rcparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ diff -Nur binutils-2.12/binutils/aclocal.m4 binutils-2.12.1/binutils/aclocal.m4 --- binutils-2.12/binutils/aclocal.m4 Tue Mar 13 01:43:56 2001 +++ binutils-2.12.1/binutils/aclocal.m4 Mon Apr 1 20:28:36 2002 @@ -1,6 +1,6 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4 +dnl aclocal.m4 generated automatically by aclocal 1.4-p5 -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -37,24 +37,6 @@ AC_PROG_LEX AC_DECL_YYTEXT]) -#serial 1 -# This test replaces the one in autoconf. -# Currently this macro should have the same name as the autoconf macro -# because gettext's gettext.m4 (distributed in the automake package) -# still uses it. Otherwise, the use in gettext.m4 makes autoheader -# give these diagnostics: -# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX -# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX - -undefine([AC_ISC_POSIX]) - -AC_DEFUN(AC_ISC_POSIX, - [ - dnl This test replaces the obsolescent AC_ISC_POSIX kludge. - AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) - ] -) - # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. @@ -64,7 +46,7 @@ dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) -AC_DEFUN(AM_INIT_AUTOMAKE, +AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) @@ -92,7 +74,7 @@ # Check to make sure that the build environment is sane. # -AC_DEFUN(AM_SANITY_CHECK, +AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 @@ -133,7 +115,7 @@ dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. -AC_DEFUN(AM_MISSING_PROG, +AC_DEFUN([AM_MISSING_PROG], [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. @@ -149,7 +131,7 @@ # Like AC_CONFIG_HEADER, but automatically create stamp file. -AC_DEFUN(AM_CONFIG_HEADER, +AC_DEFUN([AM_CONFIG_HEADER], [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) dnl When config.status generates a header, we must update the stamp-h file. @@ -175,7 +157,7 @@ # serial 1 -AC_DEFUN(AM_MAINTAINER_MODE, +AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, @@ -192,7 +174,7 @@ # Define a conditional. -AC_DEFUN(AM_CONDITIONAL, +AC_DEFUN([AM_CONDITIONAL], [AC_SUBST($1_TRUE) AC_SUBST($1_FALSE) if $2; then diff -Nur binutils-2.12/binutils/arparse.c binutils-2.12.1/binutils/arparse.c --- binutils-2.12/binutils/arparse.c Fri Mar 8 01:15:54 2002 +++ binutils-2.12.1/binutils/arparse.c Mon May 13 09:14:40 2002 @@ -1,5 +1,5 @@ /* A Bison parser, made from arparse.y - by GNU bison 1.33. */ + by GNU bison 1.35. */ #define YYBISON 1 /* Identify Bison output. */ @@ -65,6 +65,7 @@ } yystype; # define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 #endif #ifndef YYDEBUG # define YYDEBUG 0 @@ -141,11 +142,11 @@ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { - 0, 66, 66, 70, 72, 75, 78, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 98, 103, 108, 113, 117, 122, 127, 134, - 139, 145, 149, 156, 159, 162, 165, 169, 176, 180, - 182, 186 + 0, 66, 66, 70, 72, 75, 79, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 99, 104, 109, 114, 118, 123, 128, 135, + 140, 146, 150, 157, 160, 163, 166, 170, 177, 181, + 183, 187 }; #endif @@ -163,7 +164,7 @@ "addmod_command", "list_command", "save_command", "open_command", "create_command", "addlib_command", "directory_command", "optional_filename", "modulelist", "modulename", "optcomma", - "verbose_command", NULL + "verbose_command", 0 }; #endif @@ -283,12 +284,6 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -#ifdef __cplusplus -# define YYSTD(x) std::x -#else -# define YYSTD(x) x -#endif - #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -311,18 +306,19 @@ /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # else -# ifdef __cplusplus -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T std::size_t -# else -# ifdef __STDC__ -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t # endif -# define YYSTACK_ALLOC YYSTD (malloc) -# define YYSTACK_FREE YYSTD (free) +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free # endif +#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -349,24 +345,41 @@ + YYSTACK_GAP_MAX) # endif -/* Relocate the TYPE STACK from its old location to the new one. The +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Type, Stack) \ +# define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - yymemcpy ((char *) yyptr, (char *) (Stack), \ - yysize * (YYSIZE_T) sizeof (Type)); \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) -#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ +#endif #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) @@ -376,14 +389,9 @@ # define YYSIZE_T size_t #endif #if ! defined (YYSIZE_T) -# ifdef __cplusplus -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T std::size_t -# else -# ifdef __STDC__ -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t # endif #endif #if ! defined (YYSIZE_T) @@ -462,12 +470,8 @@ #if YYDEBUG # ifndef YYFPRINTF -# ifdef __cplusplus -# include /* INFRINGES ON USER NAME SPACE */ -# else -# include /* INFRINGES ON USER NAME SPACE */ -# endif -# define YYFPRINTF YYSTD (fprintf) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ @@ -475,10 +479,8 @@ if (yydebug) \ YYFPRINTF Args; \ } while (0) -/* Nonzero means print parse trace. [The following comment makes no - sense to me. Could someone clarify it? --akim] Since this is - uninitialized, it does not stop multiple parsers from coexisting. - */ +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) @@ -504,33 +506,6 @@ # define YYMAXDEPTH 10000 #endif -#if ! defined (yyoverflow) && ! defined (yymemcpy) -# if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -# define yymemcpy __builtin_memcpy -# else /* not GNU C or C++ */ - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -# if defined (__STDC__) || defined (__cplusplus) -yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount) -# else -yymemcpy (yyto, yyfrom, yycount) - char *yyto; - const char *yyfrom; - YYSIZE_T yycount; -# endif -{ - register const char *yyf = yyfrom; - register char *yyt = yyto; - register YYSIZE_T yyi = yycount; - - while (yyi-- != 0) - *yyt++ = *yyf++; -} -# endif -#endif - #ifdef YYERROR_VERBOSE # ifndef yystrlen @@ -583,7 +558,7 @@ # endif #endif -#line 341 "/usr/share/bison/bison.simple" +#line 315 "/usr/share/bison/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed @@ -593,13 +568,13 @@ to the proper pointer type. */ #ifdef YYPARSE_PARAM -# ifdef __cplusplus +# if defined (__STDC__) || defined (__cplusplus) # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM # define YYPARSE_PARAM_DECL -# else /* !__cplusplus */ +# else # define YYPARSE_PARAM_ARG YYPARSE_PARAM # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -# endif /* !__cplusplus */ +# endif #else /* !YYPARSE_PARAM */ # define YYPARSE_PARAM_ARG # define YYPARSE_PARAM_DECL @@ -773,6 +748,9 @@ yyvs = yyvs1; } #else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) goto yyoverflowlab; @@ -786,15 +764,16 @@ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyoverflowlab; - YYSTACK_RELOCATE (short, yyss); - YYSTACK_RELOCATE (YYSTYPE, yyvs); + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); # if YYLSP_NEEDED - YYSTACK_RELOCATE (YYLTYPE, yyls); + YYSTACK_RELOCATE (yyls); # endif # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } +# endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; @@ -981,75 +960,75 @@ { prompt(); } break; case 18: -#line 91 "arparse.y" +#line 92 "arparse.y" { ar_end(); return 0; } break; case 20: -#line 93 "arparse.y" +#line 94 "arparse.y" { yyerror("foo"); } break; case 22: -#line 100 "arparse.y" +#line 101 "arparse.y" { ar_extract(yyvsp[0].list); } break; case 23: -#line 105 "arparse.y" +#line 106 "arparse.y" { ar_replace(yyvsp[0].list); } break; case 24: -#line 110 "arparse.y" +#line 111 "arparse.y" { ar_clear(); } break; case 25: -#line 115 "arparse.y" +#line 116 "arparse.y" { ar_delete(yyvsp[0].list); } break; case 26: -#line 119 "arparse.y" +#line 120 "arparse.y" { ar_addmod(yyvsp[0].list); } break; case 27: -#line 124 "arparse.y" +#line 125 "arparse.y" { ar_list(); } break; case 28: -#line 129 "arparse.y" +#line 130 "arparse.y" { ar_save(); } break; case 29: -#line 136 "arparse.y" +#line 137 "arparse.y" { ar_open(yyvsp[0].name,0); } break; case 30: -#line 141 "arparse.y" +#line 142 "arparse.y" { ar_open(yyvsp[0].name,1); } break; case 31: -#line 147 "arparse.y" +#line 148 "arparse.y" { ar_addlib(yyvsp[-1].name,yyvsp[0].list); } break; case 32: -#line 151 "arparse.y" +#line 152 "arparse.y" { ar_directory(yyvsp[-2].name, yyvsp[-1].list, yyvsp[0].name); } break; case 33: -#line 158 "arparse.y" +#line 159 "arparse.y" { yyval.name = yyvsp[0].name; } break; case 34: -#line 159 "arparse.y" +#line 160 "arparse.y" { yyval.name = 0; } break; case 35: -#line 164 "arparse.y" +#line 165 "arparse.y" { yyval.list = yyvsp[-1].list; } break; case 36: -#line 166 "arparse.y" +#line 167 "arparse.y" { yyval.list = 0; } break; case 37: -#line 171 "arparse.y" +#line 172 "arparse.y" { struct list *n = (struct list *) malloc(sizeof(struct list)); n->next = yyvsp[-2].list; n->name = yyvsp[0].name; @@ -1057,16 +1036,16 @@ } break; case 38: -#line 176 "arparse.y" +#line 177 "arparse.y" { yyval.list = 0; } break; case 41: -#line 188 "arparse.y" +#line 189 "arparse.y" { verbose = !verbose; } break; } -#line 727 "/usr/share/bison/bison.simple" +#line 705 "/usr/share/bison/bison.simple" yyvsp -= yylen; @@ -1297,7 +1276,7 @@ #endif return yyresult; } -#line 192 "arparse.y" +#line 193 "arparse.y" static int diff -Nur binutils-2.12/binutils/arparse.h binutils-2.12.1/binutils/arparse.h --- binutils-2.12/binutils/arparse.h Fri Mar 8 01:15:54 2002 +++ binutils-2.12.1/binutils/arparse.h Mon May 13 09:14:40 2002 @@ -8,6 +8,7 @@ } yystype; # define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 #endif # define NEWLINE 257 # define VERBOSE 258 diff -Nur binutils-2.12/binutils/arparse.y binutils-2.12.1/binutils/arparse.y --- binutils-2.12/binutils/arparse.y Tue Mar 13 01:43:57 2001 +++ binutils-2.12.1/binutils/arparse.y Thu May 9 10:49:16 2002 @@ -74,6 +74,7 @@ command_line: command NEWLINE { prompt(); } + ; command: open_command diff -Nur binutils-2.12/binutils/config.in binutils-2.12.1/binutils/config.in --- binutils-2.12/binutils/config.in Tue Dec 4 05:11:22 2001 +++ binutils-2.12.1/binutils/config.in Thu May 9 10:49:17 2002 @@ -28,6 +28,9 @@ /* Define to `long' if doesn't define. */ #undef off_t +/* Define if you need to in order for stat and other things to work. */ +#undef _POSIX_SOURCE + /* Define to `unsigned' if doesn't define. */ #undef size_t diff -Nur binutils-2.12/binutils/configure binutils-2.12.1/binutils/configure --- binutils-2.12/binutils/configure Sun Jan 27 23:59:36 2002 +++ binutils-2.12.1/binutils/configure Thu May 9 10:49:17 2002 @@ -717,49 +717,249 @@ NONENONEs,x,x, && program_prefix=${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:724: 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 + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi - echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6 -echo "configure:723: checking for strerror in -lcposix" >&5 -ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +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:754: 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 - ac_save_LIBS="$LIBS" -LIBS="-lcposix $LIBS" -cat > conftest.$ac_ext <&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # 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:805: 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 + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:837: 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. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 848 "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 - builtin and then its argument prototype would still apply. */ -char strerror(); -int main() { -strerror() -; return 0; } +main(){return(0);} EOF -if { (eval echo configure:742: \"$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" +if { (eval echo configure:853: \"$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 + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +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:879: 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:884: 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 + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +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:912: 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 + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no fi rm -f conftest* -LIBS="$ac_save_LIBS" fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:944: 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 echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -lcposix" + ISC=yes # If later tests want to check for ISC. + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + if test "$GCC" = yes; then + CC="$CC -posix" + else + CC="$CC -Xp" + fi else echo "$ac_t""no" 1>&6 + ISC= fi - - BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in` # Find a good install program. We prefer a C program (faster), @@ -774,7 +974,7 @@ # 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:778: checking for a BSD compatible install" >&5 +echo "configure:978: 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 @@ -827,7 +1027,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:831: checking whether build environment is sane" >&5 +echo "configure:1031: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -884,7 +1084,7 @@ 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:888: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1088: 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 @@ -930,7 +1130,7 @@ missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:934: checking for working aclocal" >&5 +echo "configure:1134: 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. @@ -943,7 +1143,7 @@ fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:947: checking for working autoconf" >&5 +echo "configure:1147: 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. @@ -956,7 +1156,7 @@ fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:960: checking for working automake" >&5 +echo "configure:1160: 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. @@ -969,7 +1169,7 @@ fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:973: checking for working autoheader" >&5 +echo "configure:1173: 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. @@ -982,7 +1182,7 @@ fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:986: checking for working makeinfo" >&5 +echo "configure:1186: 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. @@ -1065,228 +1265,6 @@ enable_fast_install=yes fi -# 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:1072: 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 - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -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:1102: 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 - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # 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:1153: 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 - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1185: 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. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 1196 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:1201: \"$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 - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -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:1227: 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:1232: 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 - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -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:1260: 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 - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" @@ -1299,7 +1277,7 @@ 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:1303: checking for ld used by GCC" >&5 +echo "configure:1281: checking for ld used by GCC" >&5 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -1329,10 +1307,10 @@ esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1333: checking for GNU ld" >&5 +echo "configure:1311: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1336: checking for non-GNU ld" >&5 +echo "configure:1314: 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 @@ -1367,7 +1345,7 @@ 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:1371: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1349: 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 @@ -1384,7 +1362,7 @@ echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1388: checking for $LD option to reload object files" >&5 +echo "configure:1366: 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 @@ -1396,7 +1374,7 @@ test -n "$reload_flag" && reload_flag=" $reload_flag" echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1400: checking for BSD-compatible nm" >&5 +echo "configure:1378: 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 @@ -1434,7 +1412,7 @@ echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1438: checking whether ln -s works" >&5 +echo "configure:1416: 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 @@ -1455,7 +1433,7 @@ fi echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:1459: checking how to recognise dependant libraries" >&5 +echo "configure:1437: 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 @@ -1628,13 +1606,13 @@ deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1632: checking for object suffix" >&5 +echo "configure:1610: 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:1638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1616: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1654,7 +1632,7 @@ echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1658: checking for executable suffix" >&5 +echo "configure:1636: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1664,7 +1642,7 @@ rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -1697,7 +1675,7 @@ 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:1701: checking for ${ac_tool_prefix}file" >&5 +echo "configure:1679: 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 @@ -1759,7 +1737,7 @@ 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:1763: checking for file" >&5 +echo "configure:1741: 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 @@ -1830,7 +1808,7 @@ # 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:1834: checking for $ac_word" >&5 +echo "configure:1812: 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 @@ -1862,7 +1840,7 @@ # 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:1866: checking for $ac_word" >&5 +echo "configure:1844: 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 @@ -1897,7 +1875,7 @@ # 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:1901: checking for $ac_word" >&5 +echo "configure:1879: 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 @@ -1929,7 +1907,7 @@ # 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:1933: checking for $ac_word" >&5 +echo "configure:1911: 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 @@ -1996,8 +1974,8 @@ case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2000 "configure"' > conftest.$ac_ext - if { (eval echo configure:2001: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 1978 "configure"' > conftest.$ac_ext + if { (eval echo configure:1979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" @@ -2016,7 +1994,7 @@ ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2020: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:1998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *ELF-32*) HPUX_IA64_MODE="32" @@ -2034,7 +2012,7 @@ SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2038: checking whether the C compiler needs -belf" >&5 +echo "configure:2016: 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 @@ -2047,14 +2025,14 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2036: \"$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 @@ -2227,7 +2205,7 @@ # 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:2231: checking for $ac_word" >&5 +echo "configure:2209: 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 @@ -2257,7 +2235,7 @@ # 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:2261: checking for $ac_word" >&5 +echo "configure:2239: 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 @@ -2308,7 +2286,7 @@ # 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:2312: checking for $ac_word" >&5 +echo "configure:2290: 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 @@ -2340,7 +2318,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2344: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2322: 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. @@ -2351,12 +2329,12 @@ cat > conftest.$ac_ext << EOF -#line 2355 "configure" +#line 2333 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2338: \"$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 @@ -2382,12 +2360,12 @@ { 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:2386: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2364: 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:2391: checking whether we are using GNU C" >&5 +echo "configure:2369: 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 @@ -2396,7 +2374,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2400: \"$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:2378: \"$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 @@ -2415,7 +2393,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2419: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2397: 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 @@ -2452,7 +2430,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2456: checking for $ac_word" >&5 +echo "configure:2434: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2483,7 +2461,7 @@ test -n "$YACC" || YACC="yacc" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2487: checking how to run the C preprocessor" >&5 +echo "configure:2465: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2498,13 +2476,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2486: \"$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 : @@ -2515,13 +2493,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2503: \"$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 : @@ -2532,13 +2510,13 @@ rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2542: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2520: \"$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 : @@ -2568,7 +2546,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2572: checking for $ac_word" >&5 +echo "configure:2550: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2601,7 +2579,7 @@ # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2605: checking for $ac_word" >&5 +echo "configure:2583: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2635,7 +2613,7 @@ *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:2639: checking for yywrap in -l$ac_lib" >&5 +echo "configure:2617: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2643,7 +2621,7 @@ ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2636: \"$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 @@ -2677,7 +2655,7 @@ fi echo $ac_n "checking lex output file root""... $ac_c" 1>&6 -echo "configure:2681: checking lex output file root" >&5 +echo "configure:2659: checking lex output file root" >&5 if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2698,7 +2676,7 @@ LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6 -echo "configure:2702: checking whether yytext is a pointer" >&5 +echo "configure:2680: checking whether yytext is a pointer" >&5 if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2710,14 +2688,14 @@ ac_save_LIBS="$LIBS" LIBS="$LIBS $LEXLIB" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_prog_lex_yytext_pointer=yes else @@ -2743,7 +2721,7 @@ # 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:2747: checking for $ac_word" >&5 +echo "configure:2725: 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 @@ -2771,12 +2749,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2775: checking for ANSI C header files" >&5 +echo "configure:2753: 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 < #include @@ -2784,7 +2762,7 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2788: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2766: \"$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* @@ -2801,7 +2779,7 @@ 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 @@ -2819,7 +2797,7 @@ 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 @@ -2840,7 +2818,7 @@ : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2851,7 +2829,7 @@ exit (0); } EOF -if { (eval echo configure:2855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2875,12 +2853,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2879: checking for working const" >&5 +echo "configure:2857: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2911: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2950,21 +2928,21 @@ fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2954: checking for inline" >&5 +echo "configure:2932: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2946: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2990,12 +2968,12 @@ esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2994: checking for off_t" >&5 +echo "configure:2972: 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 < #if STDC_HEADERS @@ -3023,12 +3001,12 @@ fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3027: checking for size_t" >&5 +echo "configure:3005: 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 < #if STDC_HEADERS @@ -3058,19 +3036,19 @@ # 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:3062: checking for working alloca.h" >&5 +echo "configure:3040: 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 < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3052: \"$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 @@ -3091,12 +3069,12 @@ fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3095: checking for alloca" >&5 +echo "configure:3073: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3106: \"$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 @@ -3156,12 +3134,12 @@ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3160: checking whether alloca needs Cray hooks" >&5 +echo "configure:3138: 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 <&6 -echo "configure:3190: checking for $ac_func" >&5 +echo "configure:3168: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3196: \"$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 @@ -3241,7 +3219,7 @@ fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3245: checking stack direction for C alloca" >&5 +echo "configure:3223: 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 @@ -3249,7 +3227,7 @@ ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3250: \"$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 @@ -3289,21 +3267,21 @@ fi -for ac_hdr in unistd.h +for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3297: checking for $ac_hdr" >&5 +echo "configure:3275: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3285: \"$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* @@ -3332,12 +3310,12 @@ for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3336: checking for $ac_func" >&5 +echo "configure:3314: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3342: \"$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 @@ -3385,7 +3363,7 @@ done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3389: checking for working mmap" >&5 +echo "configure:3367: 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 @@ -3393,7 +3371,7 @@ ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext < #include +#if HAVE_SYS_TYPES_H +# include +#endif + +#if HAVE_STDLIB_H +# include +#endif + +#if HAVE_SYS_STAT_H +# include +#endif + +#if HAVE_UNISTD_H +# include +#endif + /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include -# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -3533,7 +3524,7 @@ } EOF -if { (eval echo configure:3537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3528: \"$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 @@ -3561,17 +3552,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3565: checking for $ac_hdr" >&5 +echo "configure:3556: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3575: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3566: \"$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* @@ -3601,12 +3592,12 @@ __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3605: checking for $ac_func" >&5 +echo "configure:3596: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3624: \"$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 @@ -3658,12 +3649,12 @@ for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3662: checking for $ac_func" >&5 +echo "configure:3653: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3681: \"$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 @@ -3720,19 +3711,19 @@ if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3724: checking for LC_MESSAGES" >&5 +echo "configure:3715: 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 < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3727: \"$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 @@ -3753,7 +3744,7 @@ fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3757: checking whether NLS is requested" >&5 +echo "configure:3748: 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" @@ -3773,7 +3764,7 @@ EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3777: checking whether included gettext is requested" >&5 +echo "configure:3768: 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" @@ -3792,17 +3783,17 @@ ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3796: checking for libintl.h" >&5 +echo "configure:3787: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3806: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3797: \"$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* @@ -3819,19 +3810,19 @@ 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:3823: checking for gettext in libc" >&5 +echo "configure:3814: 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 < int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3826: \"$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 @@ -3847,7 +3838,7 @@ if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3851: checking for bindtextdomain in -lintl" >&5 +echo "configure:3842: 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 @@ -3855,7 +3846,7 @@ ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&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* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3882,19 +3873,19 @@ 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:3886: checking for gettext in libintl" >&5 +echo "configure:3877: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3889: \"$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 @@ -3922,7 +3913,7 @@ # 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:3926: checking for $ac_word" >&5 +echo "configure:3917: 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 @@ -3956,12 +3947,12 @@ for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3960: checking for $ac_func" >&5 +echo "configure:3951: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3979: \"$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 @@ -4011,7 +4002,7 @@ # 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:4015: checking for $ac_word" >&5 +echo "configure:4006: 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 @@ -4047,7 +4038,7 @@ # 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:4051: checking for $ac_word" >&5 +echo "configure:4042: 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 @@ -4079,7 +4070,7 @@ fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -4119,7 +4110,7 @@ # 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:4123: checking for $ac_word" >&5 +echo "configure:4114: 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 @@ -4153,7 +4144,7 @@ # 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:4157: checking for $ac_word" >&5 +echo "configure:4148: 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 @@ -4189,7 +4180,7 @@ # 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:4193: checking for $ac_word" >&5 +echo "configure:4184: 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 @@ -4279,7 +4270,7 @@ LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4283: checking for catalogs to be installed" >&5 +echo "configure:4274: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4307,17 +4298,17 @@ 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:4311: checking for linux/version.h" >&5 +echo "configure:4302: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4321: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4312: \"$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* @@ -4380,7 +4371,7 @@ echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:4384: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:4375: 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" @@ -4405,7 +4396,7 @@ echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:4409: checking for executable suffix" >&5 +echo "configure:4400: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4415,7 +4406,7 @@ rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:4419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:4410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -4458,7 +4449,7 @@ # 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:4462: checking for $ac_word" >&5 +echo "configure:4453: 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 @@ -4497,7 +4488,7 @@ # 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:4501: checking for a BSD compatible install" >&5 +echo "configure:4492: 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 @@ -4564,7 +4555,7 @@ EXEEXT_FOR_BUILD='$(EXEEXT)' else echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 -echo "configure:4568: checking for build system executable suffix" >&5 +echo "configure:4559: 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 @@ -4599,17 +4590,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4603: checking for $ac_hdr" >&5 +echo "configure:4594: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4613: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4604: \"$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* @@ -4636,12 +4627,12 @@ done echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:4640: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:4631: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -4657,7 +4648,7 @@ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:4661: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -4680,19 +4671,19 @@ # 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:4684: checking for working alloca.h" >&5 +echo "configure:4675: 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 < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:4696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4687: \"$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 @@ -4713,12 +4704,12 @@ fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:4717: checking for alloca" >&5 +echo "configure:4708: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4741: \"$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 @@ -4778,12 +4769,12 @@ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:4782: checking whether alloca needs Cray hooks" >&5 +echo "configure:4773: 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 <&6 -echo "configure:4812: checking for $ac_func" >&5 +echo "configure:4803: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4831: \"$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 @@ -4863,7 +4854,7 @@ fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:4867: checking stack direction for C alloca" >&5 +echo "configure:4858: 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 @@ -4871,7 +4862,7 @@ ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4885: \"$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 @@ -4914,12 +4905,12 @@ for ac_func in sbrk utimes setmode getc_unlocked do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4918: checking for $ac_func" >&5 +echo "configure:4909: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4937: \"$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 @@ -4970,19 +4961,19 @@ # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE # needs to be defined for it echo $ac_n "checking for fopen64""... $ac_c" 1>&6 -echo "configure:4974: checking for fopen64" >&5 +echo "configure:4965: checking for fopen64" >&5 if eval "test \"`echo '$''{'bu_cv_have_fopen64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { FILE *f = fopen64 ("/tmp/foo","r"); ; return 0; } EOF -if { (eval echo configure:4986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bu_cv_have_fopen64=yes else @@ -4992,14 +4983,14 @@ saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" cat > conftest.$ac_ext < int main() { FILE *f = fopen64 ("/tmp/foo","r"); ; return 0; } EOF -if { (eval echo configure:5003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE" else @@ -5031,14 +5022,14 @@ # Some systems have frexp only in -lm, not in -lc. echo $ac_n "checking for library containing frexp""... $ac_c" 1>&6 -echo "configure:5035: checking for library containing frexp" >&5 +echo "configure:5026: checking for library containing frexp" >&5 if eval "test \"`echo '$''{'ac_cv_search_frexp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_frexp="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_frexp="none required" else @@ -5060,7 +5051,7 @@ test "$ac_cv_search_frexp" = "no" && for i in m; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_frexp="-l$i" break @@ -5093,19 +5084,19 @@ fi echo $ac_n "checking for time_t in time.h""... $ac_c" 1>&6 -echo "configure:5097: checking for time_t in time.h" >&5 +echo "configure:5088: checking for time_t in time.h" >&5 if eval "test \"`echo '$''{'bu_cv_decl_time_t_time_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { time_t i; ; return 0; } EOF -if { (eval echo configure:5109: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5100: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bu_cv_decl_time_t_time_h=yes else @@ -5126,19 +5117,19 @@ fi echo $ac_n "checking for time_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:5130: checking for time_t in sys/types.h" >&5 +echo "configure:5121: checking for time_t in sys/types.h" >&5 if eval "test \"`echo '$''{'bu_cv_decl_time_t_types_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { time_t i; ; return 0; } EOF -if { (eval echo configure:5142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bu_cv_decl_time_t_types_h=yes else @@ -5161,12 +5152,12 @@ # Under Next 3.2 apparently does not define struct utimbuf # by default. echo $ac_n "checking for utime.h""... $ac_c" 1>&6 -echo "configure:5165: checking for utime.h" >&5 +echo "configure:5156: checking for utime.h" >&5 if eval "test \"`echo '$''{'bu_cv_header_utime_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifdef HAVE_TIME_H @@ -5177,7 +5168,7 @@ struct utimbuf s; ; return 0; } EOF -if { (eval echo configure:5181: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5172: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bu_cv_header_utime_h=yes else @@ -5198,12 +5189,12 @@ fi echo $ac_n "checking whether fprintf must be declared""... $ac_c" 1>&6 -echo "configure:5202: checking whether fprintf must be declared" >&5 +echo "configure:5193: checking whether fprintf must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_fprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5224,7 +5215,7 @@ char *(*pfn) = (char *(*)) fprintf ; return 0; } EOF -if { (eval echo configure:5228: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_fprintf=no else @@ -5245,12 +5236,12 @@ fi echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:5249: checking whether strstr must be declared" >&5 +echo "configure:5240: 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 < @@ -5271,7 +5262,7 @@ char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:5275: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5266: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -5292,12 +5283,12 @@ fi echo $ac_n "checking whether sbrk must be declared""... $ac_c" 1>&6 -echo "configure:5296: checking whether sbrk must be declared" >&5 +echo "configure:5287: checking whether sbrk must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_sbrk'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5318,7 +5309,7 @@ char *(*pfn) = (char *(*)) sbrk ; return 0; } EOF -if { (eval echo configure:5322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_sbrk=no else @@ -5339,12 +5330,12 @@ fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:5343: checking whether getenv must be declared" >&5 +echo "configure:5334: 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 < @@ -5365,7 +5356,7 @@ char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:5369: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5360: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_getenv=no else @@ -5386,12 +5377,12 @@ fi echo $ac_n "checking whether environ must be declared""... $ac_c" 1>&6 -echo "configure:5390: checking whether environ must be declared" >&5 +echo "configure:5381: checking whether environ must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_environ'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5412,7 +5403,7 @@ char *(*pfn) = (char *(*)) environ ; return 0; } EOF -if { (eval echo configure:5416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5407: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_environ=no else @@ -5504,12 +5495,12 @@ DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; - arm-*pe* | arm-*-wince) + arm-pe* | arm-*-wince) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; - thumb-*pe*) + thumb-pe*) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' @@ -5517,7 +5508,7 @@ arm*-* | xscale-* | strongarm-* | d10v-*) OBJDUMP_DEFS="-DDISASSEMBLER_NEEDS_RELOCS" ;; - i[3-6]86-*pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32*) + i[3-6]86-pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32*) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' @@ -5527,22 +5518,22 @@ BUILD_DLLTOOL='$(DLLTOOL_PROG)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" ;; - powerpc*-*-*pe* | powerpc*-*-cygwin*) + powerpc*-*-pe* | powerpc*-*-cygwin*) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; - sh*-*-*pe) + sh*-*-pe) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; - mips*-*-*pe) + mips*-*-pe) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; - mcore-*pe) + mcore-pe) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' @@ -5731,6 +5722,7 @@ s%@build_cpu@%$build_cpu%g s%@build_vendor@%$build_vendor%g s%@build_os@%$build_os%g +s%@CC@%$CC%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g @@ -5742,7 +5734,6 @@ s%@AUTOHEADER@%$AUTOHEADER%g s%@MAKEINFO@%$MAKEINFO%g s%@SET_MAKE@%$SET_MAKE%g -s%@CC@%$CC%g s%@LN_S@%$LN_S%g s%@OBJEXT@%$OBJEXT%g s%@EXEEXT@%$EXEEXT%g diff -Nur binutils-2.12/binutils/configure.in binutils-2.12.1/binutils/configure.in --- binutils-2.12/binutils/configure.in Mon Jan 14 08:10:13 2002 +++ binutils-2.12.1/binutils/configure.in Thu May 9 10:49:17 2002 @@ -235,12 +235,12 @@ DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; - arm-*pe* | arm-*-wince) + arm-pe* | arm-*-wince) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; - thumb-*pe*) + thumb-pe*) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' @@ -249,7 +249,7 @@ OBJDUMP_DEFS="-DDISASSEMBLER_NEEDS_RELOCS" ;; changequote(,)dnl - i[3-6]86-*pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32*) + i[3-6]86-pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32*) changequote([,])dnl BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" @@ -260,22 +260,22 @@ BUILD_DLLTOOL='$(DLLTOOL_PROG)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" ;; - powerpc*-*-*pe* | powerpc*-*-cygwin*) + powerpc*-*-pe* | powerpc*-*-cygwin*) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; - sh*-*-*pe) + sh*-*-pe) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; - mips*-*-*pe) + mips*-*-pe) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; - mcore-*pe) + mcore-pe) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' diff -Nur binutils-2.12/binutils/dep-in.sed binutils-2.12.1/binutils/dep-in.sed --- binutils-2.12/binutils/dep-in.sed Mon May 3 03:29:09 1999 +++ binutils-2.12.1/binutils/dep-in.sed Thu Apr 4 11:20:11 2002 @@ -3,7 +3,9 @@ /\\$/b loop s!@INCDIR@!$(INCDIR)!g +s!@TOPDIR@/include!$(INCDIR)!g s!@BFDDIR@!$(BFDDIR)!g +s!@TOPDIR@/bfd!$(BFDDIR)!g s!@SRCDIR@/!!g s!@OBJDIR@/!!g diff -Nur binutils-2.12/binutils/dlltool.c binutils-2.12.1/binutils/dlltool.c --- binutils-2.12/binutils/dlltool.c Wed Jan 23 11:12:55 2002 +++ binutils-2.12.1/binutils/dlltool.c Sat May 11 13:31:56 2002 @@ -1,5 +1,5 @@ /* dlltool.c -- tool to generate stuff for PE style DLLs - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -658,6 +658,8 @@ static const char *rvaafter PARAMS ((int)); static const char *rvabefore PARAMS ((int)); static const char *asm_prefix PARAMS ((int)); +static void process_def_file PARAMS ((const char *)); +static void new_directive PARAMS ((char *)); static void append_import PARAMS ((const char *, const char *, int)); static void run PARAMS ((const char *, char *)); static void scan_drectve_symbols PARAMS ((bfd *)); @@ -674,6 +676,7 @@ static void flush_page PARAMS ((FILE *, long *, int, int)); static void gen_def_file PARAMS ((void)); static void generate_idata_ofile PARAMS ((FILE *)); +static void assemble_file PARAMS ((const char *, const char *)); static void gen_exp_file PARAMS ((void)); static const char *xlate PARAMS ((const char *)); #if 0 @@ -697,28 +700,17 @@ static void -#ifdef __STDC__ -inform (const char * message, ...) -#else -inform (message, va_alist) - const char * message; - va_dcl -#endif +inform VPARAMS ((const char *message, ...)) { - va_list args; - + VA_OPEN (args, message); + VA_FIXEDARG (args, const char *, message); + if (!verbose) return; -#ifdef __STDC__ - va_start (args, message); -#else - va_start (args); -#endif - report (message, args); - - va_end (args); + + VA_CLOSE (args); } static const char * @@ -820,7 +812,7 @@ static char **oav; -void +static void process_def_file (name) const char *name; { @@ -943,7 +935,7 @@ d_list = d; } -void +static void new_directive (dir) char *dir; { @@ -1865,7 +1857,7 @@ if (!exp->noname || show_allnames) { fprintf (f, "n%d: %s \"%s\"\n", - exp->ordinal, ASM_TEXT, exp->name); + exp->ordinal, ASM_TEXT, xlate (exp->name)); if (exp->forward != 0) fprintf (f, "f%d: %s \"%s\"\n", exp->forward, ASM_TEXT, exp->internal_name); @@ -3205,6 +3197,8 @@ {"compat-implib", no_argument, NULL, 'C'}, {NULL,0,NULL,0} }; + +int main PARAMS ((int, char **)); int main (ac, av) diff -Nur binutils-2.12/binutils/dllwrap.c binutils-2.12.1/binutils/dllwrap.c --- binutils-2.12/binutils/dllwrap.c Wed Jan 23 11:12:55 2002 +++ binutils-2.12.1/binutils/dllwrap.c Thu May 9 10:49:17 2002 @@ -115,14 +115,16 @@ static int delete_def_file = 1; static int run PARAMS ((const char *, char *)); +static char *mybasename PARAMS ((const char *)); +static int strhash PARAMS ((const char *)); static void usage PARAMS ((FILE *, int)); static void display PARAMS ((const char *, va_list)); static void inform PARAMS ((const char *, ...)); -static void warn PARAMS ((const char *format, ...)); +static void warn PARAMS ((const char *, ...)); static char *look_for_prog PARAMS ((const char *, const char *, int)); static char *deduce_name PARAMS ((const char *)); static void delete_temp_files PARAMS ((void)); -static void cleanup_and_exit PARAMS ((int status)); +static void cleanup_and_exit PARAMS ((int)); /**********************************************************************/ @@ -147,58 +149,30 @@ } -#ifdef __STDC__ static void -inform (const char * message, ...) +inform VPARAMS ((const char *message, ...)) { - va_list args; + VA_OPEN (args, message); + VA_FIXEDARG (args, const char *, message); if (!verbose) return; - va_start (args, message); display (message, args); - va_end (args); -} -static void -warn (const char *format, ...) -{ - va_list args; - - va_start (args, format); - display (format, args); - va_end (args); + VA_CLOSE (args); } -#else static void -inform (message, va_alist) - const char * message; - va_dcl +warn VPARAMS ((const char *format, ...)) { - va_list args; + VA_OPEN (args, format); + VA_FIXEDARG (args, const char *, format); - if (!verbose) - return; - - va_start (args); - display (message, args); - va_end (args); -} - -static void -warn (format, va_alist) - const char *format; - va_dcl -{ - va_list args; - - va_start (args); display (format, args); - va_end (args); + + VA_CLOSE (args); } -#endif /* Look for the program formed by concatenating PROG_NAME and the string running from PREFIX to END_PREFIX. If the concatenated @@ -375,7 +349,8 @@ } static void -cleanup_and_exit (int status) +cleanup_and_exit (status) + int status; { delete_temp_files (); exit (status); @@ -487,7 +462,8 @@ } static int -strhash (const char *str) +strhash (str) + const char *str; { const unsigned char *s; unsigned long hash; @@ -634,6 +610,8 @@ {"as", required_argument, NULL, OPTION_AS}, {0, 0, 0, 0} }; + +int main PARAMS ((int, char **)); int main (argc, argv) diff -Nur binutils-2.12/binutils/doc/Makefile.in binutils-2.12.1/binutils/doc/Makefile.in --- binutils-2.12/binutils/doc/Makefile.in Sat Jan 26 16:25:00 2002 +++ binutils-2.12.1/binutils/doc/Makefile.in Thu May 9 10:49:21 2002 @@ -175,7 +175,7 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best all: all-redirect .SUFFIXES: diff -Nur binutils-2.12/binutils/doc/addr2line.1 binutils-2.12.1/binutils/doc/addr2line.1 --- binutils-2.12/binutils/doc/addr2line.1 Fri Mar 8 01:15:55 2002 +++ binutils-2.12.1/binutils/doc/addr2line.1 Tue May 14 19:47:12 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "ADDR2LINE 1" -.TH ADDR2LINE 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH ADDR2LINE 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" addr2line \- convert addresses into file names and line numbers. diff -Nur binutils-2.12/binutils/doc/ar.1 binutils-2.12.1/binutils/doc/ar.1 --- binutils-2.12/binutils/doc/ar.1 Fri Mar 8 01:15:55 2002 +++ binutils-2.12.1/binutils/doc/ar.1 Tue May 14 19:47:12 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "AR 1" -.TH AR 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH AR 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" ar \- create, modify, and extract from archives diff -Nur binutils-2.12/binutils/doc/binutils.info binutils-2.12.1/binutils/doc/binutils.info --- binutils-2.12/binutils/doc/binutils.info Fri Mar 8 14:45:06 2002 +++ binutils-2.12.1/binutils/doc/binutils.info Tue May 14 19:47:12 2002 @@ -1,4 +1,4 @@ -This is binutils.info, produced by makeinfo version 4.0f from +This is binutils.info, produced by makeinfo version 4.1 from binutils.texi. START-INFO-DIR-ENTRY @@ -32,38 +32,38 @@  Indirect: -binutils.info-1: 1670 -binutils.info-2: 44149 -binutils.info-3: 92226 +binutils.info-1: 1669 +binutils.info-2: 44150 +binutils.info-3: 92227  Tag Table: (Indirect) -Node: Top1670 -Node: ar3167 -Node: ar cmdline5341 -Node: ar scripts13473 -Node: nm19152 -Node: objcopy26561 -Node: objdump44149 -Node: ranlib55750 -Node: size56501 -Node: strings59364 -Node: strip61663 -Node: c++filt64653 -Ref: c++filt-Footnote-167595 -Node: addr2line67701 -Node: nlmconv70294 -Node: windres72897 -Node: dlltool77949 -Node: readelf87397 -Node: Selecting The Target System91209 -Node: Target Selection92226 -Node: Architecture Selection94927 -Node: Linker Emulation Selection96172 -Node: Reporting Bugs97050 -Node: Bug Criteria97826 -Node: Bug Reporting98372 -Node: GNU Free Documentation License105399 -Node: Index123827 +Node: Top1669 +Node: ar3168 +Node: ar cmdline5342 +Node: ar scripts13474 +Node: nm19153 +Node: objcopy26562 +Node: objdump44150 +Node: ranlib55751 +Node: size56502 +Node: strings59365 +Node: strip61664 +Node: c++filt64654 +Ref: c++filt-Footnote-167596 +Node: addr2line67702 +Node: nlmconv70295 +Node: windres72898 +Node: dlltool77950 +Node: readelf87398 +Node: Selecting The Target System91210 +Node: Target Selection92227 +Node: Architecture Selection94928 +Node: Linker Emulation Selection96173 +Node: Reporting Bugs97051 +Node: Bug Criteria97827 +Node: Bug Reporting98373 +Node: GNU Free Documentation License105400 +Node: Index123828  End Tag Table diff -Nur binutils-2.12/binutils/doc/binutils.info-1 binutils-2.12.1/binutils/doc/binutils.info-1 --- binutils-2.12/binutils/doc/binutils.info-1 Fri Mar 8 14:45:06 2002 +++ binutils-2.12.1/binutils/doc/binutils.info-1 Tue May 14 19:47:12 2002 @@ -1,4 +1,4 @@ -This is binutils.info, produced by makeinfo version 4.0f from +This is binutils.info, produced by makeinfo version 4.1 from binutils.texi. START-INFO-DIR-ENTRY @@ -37,7 +37,7 @@ ************ This brief manual contains preliminary documentation for the GNU -binary utilities (collectively version 2.12): +binary utilities (collectively version 2.12.1): This document is distributed under the terms of the GNU Free Documentation License. A copy of the license is included in the diff -Nur binutils-2.12/binutils/doc/binutils.info-2 binutils-2.12.1/binutils/doc/binutils.info-2 --- binutils-2.12/binutils/doc/binutils.info-2 Fri Mar 8 14:45:06 2002 +++ binutils-2.12.1/binutils/doc/binutils.info-2 Tue May 14 19:47:12 2002 @@ -1,4 +1,4 @@ -This is binutils.info, produced by makeinfo version 4.0f from +This is binutils.info, produced by makeinfo version 4.1 from binutils.texi. START-INFO-DIR-ENTRY diff -Nur binutils-2.12/binutils/doc/binutils.info-3 binutils-2.12.1/binutils/doc/binutils.info-3 --- binutils-2.12/binutils/doc/binutils.info-3 Fri Mar 8 14:45:06 2002 +++ binutils-2.12.1/binutils/doc/binutils.info-3 Tue May 14 19:47:12 2002 @@ -1,4 +1,4 @@ -This is binutils.info, produced by makeinfo version 4.0f from +This is binutils.info, produced by makeinfo version 4.1 from binutils.texi. START-INFO-DIR-ENTRY diff -Nur binutils-2.12/binutils/doc/cxxfilt.man binutils-2.12.1/binutils/doc/cxxfilt.man --- binutils-2.12/binutils/doc/cxxfilt.man Fri Mar 8 01:15:59 2002 +++ binutils-2.12.1/binutils/doc/cxxfilt.man Tue May 14 19:47:16 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "C++FILT 1" -.TH C++FILT 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH C++FILT 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" cxxfilt \- Demangle \*(C+ and Java symbols. diff -Nur binutils-2.12/binutils/doc/dlltool.1 binutils-2.12.1/binutils/doc/dlltool.1 --- binutils-2.12/binutils/doc/dlltool.1 Fri Mar 8 01:15:56 2002 +++ binutils-2.12.1/binutils/doc/dlltool.1 Tue May 14 19:47:13 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "DLLTOOL 1" -.TH DLLTOOL 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH DLLTOOL 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" dlltool \- Create files needed to build and use DLLs. diff -Nur binutils-2.12/binutils/doc/nlmconv.1 binutils-2.12.1/binutils/doc/nlmconv.1 --- binutils-2.12/binutils/doc/nlmconv.1 Fri Mar 8 01:15:56 2002 +++ binutils-2.12.1/binutils/doc/nlmconv.1 Tue May 14 19:47:13 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "NLMCONV 1" -.TH NLMCONV 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH NLMCONV 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" nlmconv \- converts object code into an \s-1NLM\s0. diff -Nur binutils-2.12/binutils/doc/nm.1 binutils-2.12.1/binutils/doc/nm.1 --- binutils-2.12/binutils/doc/nm.1 Fri Mar 8 01:15:56 2002 +++ binutils-2.12.1/binutils/doc/nm.1 Tue May 14 19:47:13 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "NM 1" -.TH NM 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH NM 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" nm \- list symbols from object files diff -Nur binutils-2.12/binutils/doc/objcopy.1 binutils-2.12.1/binutils/doc/objcopy.1 --- binutils-2.12/binutils/doc/objcopy.1 Fri Mar 8 01:15:57 2002 +++ binutils-2.12.1/binutils/doc/objcopy.1 Tue May 14 19:47:14 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "OBJCOPY 1" -.TH OBJCOPY 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH OBJCOPY 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" objcopy \- copy and translate object files diff -Nur binutils-2.12/binutils/doc/objdump.1 binutils-2.12.1/binutils/doc/objdump.1 --- binutils-2.12/binutils/doc/objdump.1 Fri Mar 8 01:15:57 2002 +++ binutils-2.12.1/binutils/doc/objdump.1 Tue May 14 19:47:14 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "OBJDUMP 1" -.TH OBJDUMP 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH OBJDUMP 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" objdump \- display information from object files. diff -Nur binutils-2.12/binutils/doc/ranlib.1 binutils-2.12.1/binutils/doc/ranlib.1 --- binutils-2.12/binutils/doc/ranlib.1 Fri Mar 8 01:15:57 2002 +++ binutils-2.12.1/binutils/doc/ranlib.1 Tue May 14 19:47:14 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "RANLIB 1" -.TH RANLIB 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH RANLIB 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" ranlib \- generate index to archive. diff -Nur binutils-2.12/binutils/doc/readelf.1 binutils-2.12.1/binutils/doc/readelf.1 --- binutils-2.12/binutils/doc/readelf.1 Fri Mar 8 01:15:57 2002 +++ binutils-2.12.1/binutils/doc/readelf.1 Tue May 14 19:47:15 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "READELF 1" -.TH READELF 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH READELF 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" readelf \- Displays information about \s-1ELF\s0 files. diff -Nur binutils-2.12/binutils/doc/size.1 binutils-2.12.1/binutils/doc/size.1 --- binutils-2.12/binutils/doc/size.1 Fri Mar 8 01:15:58 2002 +++ binutils-2.12.1/binutils/doc/size.1 Tue May 14 19:47:15 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "SIZE 1" -.TH SIZE 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH SIZE 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" size \- list section sizes and total size. diff -Nur binutils-2.12/binutils/doc/strings.1 binutils-2.12.1/binutils/doc/strings.1 --- binutils-2.12/binutils/doc/strings.1 Fri Mar 8 01:15:58 2002 +++ binutils-2.12.1/binutils/doc/strings.1 Tue May 14 19:47:15 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "STRINGS 1" -.TH STRINGS 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH STRINGS 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" strings \- print the strings of printable characters in files. diff -Nur binutils-2.12/binutils/doc/strip.1 binutils-2.12.1/binutils/doc/strip.1 --- binutils-2.12/binutils/doc/strip.1 Fri Mar 8 01:15:58 2002 +++ binutils-2.12.1/binutils/doc/strip.1 Tue May 14 19:47:15 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "STRIP 1" -.TH STRIP 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH STRIP 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" strip \- Discard symbols from object files. diff -Nur binutils-2.12/binutils/doc/windres.1 binutils-2.12.1/binutils/doc/windres.1 --- binutils-2.12/binutils/doc/windres.1 Fri Mar 8 01:15:58 2002 +++ binutils-2.12.1/binutils/doc/windres.1 Tue May 14 19:47:16 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "WINDRES 1" -.TH WINDRES 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH WINDRES 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" windres \- manipulate Windows resources. diff -Nur binutils-2.12/binutils/nm.c binutils-2.12.1/binutils/nm.c --- binutils-2.12/binutils/nm.c Wed Jan 30 00:00:07 2002 +++ binutils-2.12.1/binutils/nm.c Thu May 9 10:49:19 2002 @@ -1291,7 +1291,8 @@ bfd_asymbol_name (*r->sym_ptr_ptr)) == 0 && bfd_find_nearest_line (abfd, secs[i], syms, r->address, &filename, - &functionname, &lineno)) + &functionname, &lineno) + && filename != NULL) { /* We only print the first one we find. */ printf ("\t%s:%u", filename, lineno); diff -Nur binutils-2.12/binutils/rclex.c binutils-2.12.1/binutils/rclex.c --- binutils-2.12/binutils/rclex.c Fri Mar 8 12:01:00 2002 +++ binutils-2.12.1/binutils/rclex.c Mon May 13 09:14:44 2002 @@ -1,7 +1,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvs/src/src/binutils/Attic/rclex.c,v 1.1.6.1 2002/03/08 17:01:00 drow Exp $ + * $Header: /cvs/src/src/binutils/Attic/rclex.c,v 1.1.6.2 2002/05/11 20:00:49 drow Exp $ */ #define FLEX_SCANNER @@ -22,7 +22,7 @@ #ifdef __cplusplus #include -#ifndef _Win32 +#ifndef _WIN32 #include #else #ifndef YY_ALWAYS_INTERACTIVE @@ -643,7 +643,7 @@ #line 1 "rclex.l" #define INITIAL 0 #line 2 "rclex.l" -/* Copyright 1997, 1998, 1999, 2001 Free Software Foundation, Inc. +/* Copyright 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -2022,7 +2022,7 @@ } -#ifndef _Win32 +#ifndef _WIN32 #include #else #ifndef YY_ALWAYS_INTERACTIVE @@ -2400,11 +2400,11 @@ if (!initial_fn) { initial_fn = xmalloc (strlen (fn) + 1); - strcpy(initial_fn, fn); + strcpy (initial_fn, fn); } /* Allow the initial file, regardless of name. Suppress all other - files if they end in ".h" (this allows included "*.rc") */ + files if they end in ".h" (this allows included "*.rc"). */ if (strcmp (initial_fn, fn) == 0 || strcmp (fn + strlen (fn) - 2, ".h") != 0) suppress_cpp_data = 0; @@ -2447,7 +2447,7 @@ break; case 'a': - *s++ = ESCAPE_A; + *s++ = ESCAPE_B; /* Strange, but true... */ ++t; break; @@ -2510,9 +2510,9 @@ if (*t >= '0' && *t <= '9') ch = (ch << 4) | (*t - '0'); else if (*t >= 'a' && *t <= 'f') - ch = (ch << 4) | (*t - 'a'); + ch = (ch << 4) | (*t - 'a' + 10); else if (*t >= 'A' && *t <= 'F') - ch = (ch << 4) | (*t - 'A'); + ch = (ch << 4) | (*t - 'A' + 10); else break; ++t; @@ -2568,7 +2568,7 @@ as->s = xmalloc (len); as->next = strings; - strings = as->next; + strings = as; return as->s; } diff -Nur binutils-2.12/binutils/rclex.l binutils-2.12.1/binutils/rclex.l --- binutils-2.12/binutils/rclex.l Wed Sep 19 01:33:16 2001 +++ binutils-2.12.1/binutils/rclex.l Thu May 9 10:49:19 2002 @@ -1,5 +1,5 @@ %{ /* rclex.l -- lexer for Windows rc files parser */ -/* Copyright 1997, 1998, 1999, 2001 Free Software Foundation, Inc. +/* Copyright 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -284,11 +284,11 @@ if (!initial_fn) { initial_fn = xmalloc (strlen (fn) + 1); - strcpy(initial_fn, fn); + strcpy (initial_fn, fn); } /* Allow the initial file, regardless of name. Suppress all other - files if they end in ".h" (this allows included "*.rc") */ + files if they end in ".h" (this allows included "*.rc"). */ if (strcmp (initial_fn, fn) == 0 || strcmp (fn + strlen (fn) - 2, ".h") != 0) suppress_cpp_data = 0; @@ -331,7 +331,7 @@ break; case 'a': - *s++ = ESCAPE_A; + *s++ = ESCAPE_B; /* Strange, but true... */ ++t; break; @@ -394,9 +394,9 @@ if (*t >= '0' && *t <= '9') ch = (ch << 4) | (*t - '0'); else if (*t >= 'a' && *t <= 'f') - ch = (ch << 4) | (*t - 'a'); + ch = (ch << 4) | (*t - 'a' + 10); else if (*t >= 'A' && *t <= 'F') - ch = (ch << 4) | (*t - 'A'); + ch = (ch << 4) | (*t - 'A' + 10); else break; ++t; @@ -452,7 +452,7 @@ as->s = xmalloc (len); as->next = strings; - strings = as->next; + strings = as; return as->s; } diff -Nur binutils-2.12/binutils/rcparse.c binutils-2.12.1/binutils/rcparse.c --- binutils-2.12/binutils/rcparse.c Fri Mar 8 01:15:55 2002 +++ binutils-2.12.1/binutils/rcparse.c Mon May 13 09:14:44 2002 @@ -1,5 +1,5 @@ /* A Bison parser, made from rcparse.y - by GNU bison 1.33. */ + by GNU bison 1.35. */ #define YYBISON 1 /* Identify Bison output. */ @@ -89,7 +89,7 @@ #line 1 "rcparse.y" /* rcparse.y -- parser for Windows rc files - Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -186,6 +186,7 @@ } ss; } yystype; # define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 #endif #ifndef YYDEBUG # define YYDEBUG 0 @@ -198,7 +199,7 @@ #define YYNTBASE 99 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ -#define YYTRANSLATE(x) ((unsigned)(x) <= 339 ? yytranslate[x] : 191) +#define YYTRANSLATE(x) ((unsigned)(x) <= 339 ? yytranslate[x] : 189) /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ static const char yytranslate[] = @@ -242,126 +243,126 @@ #if YYDEBUG static const short yyprhs[] = { - 0, 0, 1, 5, 9, 13, 17, 21, 25, 29, - 33, 37, 41, 45, 49, 53, 57, 61, 62, 69, - 70, 73, 76, 81, 83, 85, 87, 91, 94, 96, - 98, 100, 102, 104, 106, 111, 116, 117, 131, 132, - 146, 147, 162, 163, 167, 168, 172, 176, 177, 182, - 186, 192, 200, 204, 208, 213, 217, 218, 221, 222, - 226, 227, 231, 232, 236, 237, 241, 242, 246, 247, - 251, 263, 276, 289, 303, 304, 308, 309, 313, 314, - 318, 319, 323, 324, 328, 335, 344, 355, 367, 368, - 372, 373, 377, 378, 382, 383, 387, 388, 392, 393, - 397, 398, 402, 403, 407, 408, 412, 413, 430, 438, - 448, 459, 460, 462, 465, 466, 470, 471, 475, 476, - 480, 481, 485, 490, 495, 499, 506, 507, 510, 515, - 518, 525, 526, 530, 533, 535, 537, 539, 541, 543, - 545, 552, 553, 556, 559, 563, 569, 572, 578, 585, - 593, 603, 608, 615, 616, 619, 620, 622, 624, 626, - 630, 634, 635, 642, 643, 647, 652, 659, 664, 671, - 672, 679, 686, 690, 694, 698, 702, 706, 707, 716, - 724, 725, 731, 732, 736, 738, 740, 742, 745, 748, - 751, 753, 754, 757, 761, 766, 770, 771, 774, 775, - 778, 780, 782, 784, 786, 788, 790, 792, 794, 796, - 798, 801, 805, 810, 812, 816, 817, 819, 822, 824, - 826, 830, 833, 836, 840, 844, 848, 852, 856, 860, - 864, 868, 871, 873, 875, 879, 882, 886, 890, 894, - 898, 902, 906, 910 + 0, 0, 1, 4, 7, 10, 13, 16, 19, 22, + 25, 28, 31, 34, 37, 40, 43, 46, 53, 54, + 57, 60, 65, 67, 69, 71, 75, 78, 80, 82, + 84, 86, 88, 90, 95, 100, 101, 115, 116, 130, + 131, 146, 147, 151, 152, 156, 160, 164, 168, 172, + 178, 185, 193, 202, 206, 210, 215, 219, 220, 223, + 224, 228, 229, 233, 234, 238, 239, 243, 244, 248, + 249, 253, 265, 278, 291, 305, 306, 310, 311, 315, + 316, 320, 321, 325, 326, 330, 337, 346, 357, 369, + 370, 374, 375, 379, 380, 384, 385, 389, 390, 394, + 395, 399, 400, 404, 405, 409, 410, 414, 415, 432, + 440, 450, 461, 462, 464, 467, 468, 472, 473, 477, + 478, 482, 483, 487, 492, 497, 501, 508, 509, 512, + 517, 520, 527, 528, 532, 535, 537, 539, 541, 543, + 545, 547, 554, 555, 558, 561, 565, 571, 574, 580, + 587, 595, 605, 610, 617, 618, 621, 622, 624, 626, + 628, 632, 636, 637, 644, 645, 649, 654, 661, 666, + 673, 674, 681, 688, 692, 696, 700, 704, 708, 709, + 718, 726, 727, 733, 734, 738, 740, 742, 744, 747, + 750, 753, 755, 756, 759, 763, 768, 772, 773, 776, + 777, 780, 782, 784, 786, 788, 790, 792, 794, 796, + 798, 800, 803, 807, 812, 814, 818, 819, 821, 824, + 826, 828, 832, 835, 838, 842, 846, 850, 854, 858, + 862, 866, 870, 873, 875, 877, 881, 884, 888, 892, + 896, 900, 904, 908, 912 }; static const short yyrhs[] = { - -1, 99, 100, 101, 0, 99, 100, 107, 0, 99, - 100, 108, 0, 99, 100, 109, 0, 99, 100, 148, - 0, 99, 100, 149, 0, 99, 100, 150, 0, 99, - 100, 151, 0, 99, 100, 156, 0, 99, 100, 159, - 0, 99, 100, 160, 0, 99, 100, 165, 0, 99, - 100, 168, 0, 99, 100, 169, 0, 99, 100, 84, - 0, 0, 174, 5, 177, 3, 102, 4, 0, 0, - 102, 103, 0, 104, 188, 0, 104, 188, 95, 105, - 0, 80, 0, 189, 0, 106, 0, 105, 95, 106, - 0, 105, 106, 0, 6, 0, 7, 0, 8, 0, - 9, 0, 10, 0, 11, 0, 174, 12, 179, 181, - 0, 174, 13, 178, 181, 0, 0, 174, 14, 179, - 113, 189, 185, 185, 185, 110, 114, 3, 116, 4, - 0, 0, 174, 15, 179, 113, 189, 185, 185, 185, - 111, 114, 3, 116, 4, 0, 0, 174, 15, 179, - 113, 189, 185, 185, 185, 185, 112, 114, 3, 116, - 4, 0, 0, 16, 96, 186, 0, 0, 114, 17, - 80, 0, 114, 18, 174, 0, 0, 114, 19, 115, - 182, 0, 114, 16, 186, 0, 114, 41, 186, 95, - 80, 0, 114, 41, 186, 95, 80, 185, 185, 0, - 114, 46, 174, 0, 114, 44, 186, 0, 114, 43, - 186, 185, 0, 114, 45, 186, 0, 0, 116, 117, - 0, 0, 20, 118, 139, 0, 0, 21, 119, 139, - 0, 0, 22, 120, 139, 0, 0, 38, 121, 139, - 0, 0, 23, 122, 139, 0, 0, 24, 123, 139, - 0, 10, 140, 186, 185, 142, 185, 185, 185, 185, - 184, 141, 0, 10, 140, 186, 185, 142, 185, 185, - 185, 185, 185, 185, 141, 0, 10, 140, 186, 95, - 80, 142, 185, 185, 185, 185, 184, 141, 0, 10, - 140, 186, 95, 80, 142, 185, 185, 185, 185, 185, - 185, 141, 0, 0, 25, 124, 139, 0, 0, 26, - 125, 139, 0, 0, 27, 126, 139, 0, 0, 28, - 127, 139, 0, 0, 39, 128, 139, 0, 42, 176, - 186, 185, 185, 141, 0, 42, 176, 186, 185, 185, - 185, 185, 141, 0, 42, 176, 186, 185, 185, 185, - 185, 144, 184, 141, 0, 42, 176, 186, 185, 185, - 185, 185, 144, 185, 185, 141, 0, 0, 40, 129, - 139, 0, 0, 29, 130, 139, 0, 0, 30, 131, - 139, 0, 0, 31, 132, 139, 0, 0, 32, 133, - 139, 0, 0, 33, 134, 139, 0, 0, 34, 135, - 139, 0, 0, 35, 136, 139, 0, 0, 36, 137, - 139, 0, 0, 37, 80, 95, 186, 95, 186, 95, - 186, 95, 186, 95, 186, 95, 138, 182, 184, 0, - 140, 186, 185, 185, 185, 185, 141, 0, 140, 186, - 185, 185, 185, 185, 146, 184, 141, 0, 140, 186, - 185, 185, 185, 185, 146, 185, 185, 141, 0, 0, - 80, 0, 80, 95, 0, 0, 3, 161, 4, 0, - 0, 95, 143, 182, 0, 0, 95, 145, 182, 0, - 0, 95, 147, 182, 0, 174, 41, 178, 181, 0, - 174, 42, 178, 181, 0, 43, 186, 185, 0, 174, - 46, 177, 3, 152, 4, 0, 0, 152, 153, 0, - 48, 80, 185, 154, 0, 48, 49, 0, 50, 80, - 154, 3, 152, 4, 0, 0, 154, 95, 155, 0, - 154, 155, 0, 51, 0, 52, 0, 53, 0, 54, - 0, 55, 0, 56, 0, 174, 47, 177, 3, 157, - 4, 0, 0, 157, 158, 0, 48, 80, 0, 48, - 80, 185, 0, 48, 80, 185, 185, 184, 0, 48, - 49, 0, 50, 80, 3, 157, 4, 0, 50, 80, - 185, 3, 157, 4, 0, 50, 80, 185, 185, 3, - 157, 4, 0, 50, 80, 185, 185, 185, 184, 3, - 157, 4, 0, 174, 57, 179, 181, 0, 174, 58, - 177, 3, 161, 4, 0, 0, 162, 163, 0, 0, - 164, 0, 83, 0, 187, 0, 164, 95, 83, 0, - 164, 95, 187, 0, 0, 59, 177, 3, 166, 167, - 4, 0, 0, 167, 186, 80, 0, 167, 186, 95, - 80, 0, 174, 174, 177, 3, 161, 4, 0, 174, - 174, 177, 181, 0, 174, 60, 170, 3, 171, 4, - 0, 0, 170, 61, 186, 185, 185, 185, 0, 170, - 62, 186, 185, 185, 185, 0, 170, 63, 186, 0, - 170, 64, 186, 0, 170, 65, 186, 0, 170, 66, - 186, 0, 170, 67, 186, 0, 0, 171, 68, 3, - 71, 3, 172, 4, 4, 0, 171, 69, 3, 70, - 80, 173, 4, 0, 0, 172, 70, 80, 95, 80, - 0, 0, 173, 185, 185, 0, 189, 0, 81, 0, - 80, 0, 80, 95, 0, 81, 95, 0, 189, 95, - 0, 175, 0, 0, 177, 180, 0, 177, 44, 186, - 0, 177, 43, 186, 185, 0, 177, 45, 186, 0, - 0, 178, 180, 0, 0, 179, 180, 0, 72, 0, - 73, 0, 74, 0, 75, 0, 76, 0, 77, 0, - 78, 0, 80, 0, 81, 0, 183, 0, 79, 183, - 0, 182, 85, 183, 0, 182, 85, 79, 183, 0, - 82, 0, 97, 186, 98, 0, 0, 185, 0, 95, - 186, 0, 187, 0, 82, 0, 97, 187, 98, 0, - 93, 187, 0, 89, 187, 0, 187, 90, 187, 0, - 187, 91, 187, 0, 187, 92, 187, 0, 187, 88, - 187, 0, 187, 89, 187, 0, 187, 87, 187, 0, - 187, 86, 187, 0, 187, 85, 187, 0, 95, 189, - 0, 190, 0, 82, 0, 97, 187, 98, 0, 93, - 187, 0, 190, 90, 187, 0, 190, 91, 187, 0, - 190, 92, 187, 0, 190, 88, 187, 0, 190, 89, - 187, 0, 190, 87, 187, 0, 190, 86, 187, 0, - 190, 85, 187, 0 + -1, 99, 100, 0, 99, 106, 0, 99, 107, 0, + 99, 108, 0, 99, 146, 0, 99, 147, 0, 99, + 148, 0, 99, 149, 0, 99, 154, 0, 99, 157, + 0, 99, 158, 0, 99, 163, 0, 99, 166, 0, + 99, 167, 0, 99, 84, 0, 172, 5, 175, 3, + 101, 4, 0, 0, 101, 102, 0, 103, 186, 0, + 103, 186, 95, 104, 0, 80, 0, 187, 0, 105, + 0, 104, 95, 105, 0, 104, 105, 0, 6, 0, + 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, + 172, 12, 177, 179, 0, 172, 13, 176, 179, 0, + 0, 172, 14, 177, 112, 187, 183, 183, 183, 109, + 113, 3, 114, 4, 0, 0, 172, 15, 177, 112, + 187, 183, 183, 183, 110, 113, 3, 114, 4, 0, + 0, 172, 15, 177, 112, 187, 183, 183, 183, 183, + 111, 113, 3, 114, 4, 0, 0, 16, 96, 184, + 0, 0, 113, 17, 80, 0, 113, 18, 172, 0, + 113, 19, 180, 0, 113, 16, 184, 0, 113, 18, + 80, 0, 113, 41, 184, 95, 80, 0, 113, 41, + 184, 95, 80, 183, 0, 113, 41, 184, 95, 80, + 183, 183, 0, 113, 41, 184, 95, 80, 183, 183, + 183, 0, 113, 46, 172, 0, 113, 44, 184, 0, + 113, 43, 184, 183, 0, 113, 45, 184, 0, 0, + 114, 115, 0, 0, 20, 116, 137, 0, 0, 21, + 117, 137, 0, 0, 22, 118, 137, 0, 0, 38, + 119, 137, 0, 0, 23, 120, 137, 0, 0, 24, + 121, 137, 0, 10, 138, 184, 183, 140, 183, 183, + 183, 183, 182, 139, 0, 10, 138, 184, 183, 140, + 183, 183, 183, 183, 183, 183, 139, 0, 10, 138, + 184, 95, 80, 140, 183, 183, 183, 183, 182, 139, + 0, 10, 138, 184, 95, 80, 140, 183, 183, 183, + 183, 183, 183, 139, 0, 0, 25, 122, 137, 0, + 0, 26, 123, 137, 0, 0, 27, 124, 137, 0, + 0, 28, 125, 137, 0, 0, 39, 126, 137, 0, + 42, 174, 184, 183, 183, 139, 0, 42, 174, 184, + 183, 183, 183, 183, 139, 0, 42, 174, 184, 183, + 183, 183, 183, 142, 182, 139, 0, 42, 174, 184, + 183, 183, 183, 183, 142, 183, 183, 139, 0, 0, + 40, 127, 137, 0, 0, 29, 128, 137, 0, 0, + 30, 129, 137, 0, 0, 31, 130, 137, 0, 0, + 32, 131, 137, 0, 0, 33, 132, 137, 0, 0, + 34, 133, 137, 0, 0, 35, 134, 137, 0, 0, + 36, 135, 137, 0, 0, 37, 80, 95, 184, 95, + 184, 95, 184, 95, 184, 95, 184, 95, 136, 180, + 182, 0, 138, 184, 183, 183, 183, 183, 139, 0, + 138, 184, 183, 183, 183, 183, 144, 182, 139, 0, + 138, 184, 183, 183, 183, 183, 144, 183, 183, 139, + 0, 0, 80, 0, 80, 95, 0, 0, 3, 159, + 4, 0, 0, 95, 141, 180, 0, 0, 95, 143, + 180, 0, 0, 95, 145, 180, 0, 172, 41, 176, + 179, 0, 172, 42, 176, 179, 0, 43, 184, 183, + 0, 172, 46, 175, 3, 150, 4, 0, 0, 150, + 151, 0, 48, 80, 183, 152, 0, 48, 49, 0, + 50, 80, 152, 3, 150, 4, 0, 0, 152, 95, + 153, 0, 152, 153, 0, 51, 0, 52, 0, 53, + 0, 54, 0, 55, 0, 56, 0, 172, 47, 175, + 3, 155, 4, 0, 0, 155, 156, 0, 48, 80, + 0, 48, 80, 183, 0, 48, 80, 183, 183, 182, + 0, 48, 49, 0, 50, 80, 3, 155, 4, 0, + 50, 80, 183, 3, 155, 4, 0, 50, 80, 183, + 183, 3, 155, 4, 0, 50, 80, 183, 183, 183, + 182, 3, 155, 4, 0, 172, 57, 177, 179, 0, + 172, 58, 175, 3, 159, 4, 0, 0, 160, 161, + 0, 0, 162, 0, 83, 0, 185, 0, 162, 95, + 83, 0, 162, 95, 185, 0, 0, 59, 175, 3, + 164, 165, 4, 0, 0, 165, 184, 80, 0, 165, + 184, 95, 80, 0, 172, 172, 175, 3, 159, 4, + 0, 172, 172, 175, 179, 0, 172, 60, 168, 3, + 169, 4, 0, 0, 168, 61, 184, 183, 183, 183, + 0, 168, 62, 184, 183, 183, 183, 0, 168, 63, + 184, 0, 168, 64, 184, 0, 168, 65, 184, 0, + 168, 66, 184, 0, 168, 67, 184, 0, 0, 169, + 68, 3, 71, 3, 170, 4, 4, 0, 169, 69, + 3, 70, 80, 171, 4, 0, 0, 170, 70, 80, + 95, 80, 0, 0, 171, 183, 183, 0, 187, 0, + 81, 0, 80, 0, 80, 95, 0, 81, 95, 0, + 187, 95, 0, 173, 0, 0, 175, 178, 0, 175, + 44, 184, 0, 175, 43, 184, 183, 0, 175, 45, + 184, 0, 0, 176, 178, 0, 0, 177, 178, 0, + 72, 0, 73, 0, 74, 0, 75, 0, 76, 0, + 77, 0, 78, 0, 80, 0, 81, 0, 181, 0, + 79, 181, 0, 180, 85, 181, 0, 180, 85, 79, + 181, 0, 82, 0, 97, 184, 98, 0, 0, 183, + 0, 95, 184, 0, 185, 0, 82, 0, 97, 185, + 98, 0, 93, 185, 0, 89, 185, 0, 185, 90, + 185, 0, 185, 91, 185, 0, 185, 92, 185, 0, + 185, 88, 185, 0, 185, 89, 185, 0, 185, 87, + 185, 0, 185, 86, 185, 0, 185, 85, 185, 0, + 95, 187, 0, 188, 0, 82, 0, 97, 185, 98, + 0, 93, 185, 0, 188, 90, 185, 0, 188, 91, + 185, 0, 188, 92, 185, 0, 188, 88, 185, 0, + 188, 89, 185, 0, 188, 87, 185, 0, 188, 86, + 185, 0, 188, 85, 185, 0 }; #endif @@ -371,30 +372,30 @@ static const short yyrline[] = { 0, 154, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 173, 182, 189, - 194, 214, 220, 231, 253, 262, 267, 272, 278, 283, - 288, 292, 296, 300, 308, 317, 326, 326, 348, 348, - 371, 371, 397, 402, 408, 410, 414, 418, 418, 424, - 428, 434, 447, 451, 455, 459, 465, 467, 477, 477, - 488, 488, 498, 498, 508, 508, 521, 521, 531, 531, - 541, 552, 561, 574, 585, 585, 595, 595, 605, 605, - 615, 615, 625, 625, 638, 643, 649, 655, 661, 661, - 674, 674, 684, 684, 694, 694, 704, 704, 714, 714, - 724, 724, 734, 734, 744, 744, 754, 754, 771, 784, - 795, 806, 811, 815, 821, 826, 834, 834, 840, 840, - 846, 846, 854, 863, 873, 882, 889, 894, 910, 915, - 919, 925, 930, 934, 940, 945, 949, 953, 957, 961, - 969, 976, 981, 997, 1002, 1006, 1010, 1014, 1018, 1022, - 1026, 1035, 1044, 1054, 1054, 1065, 1071, 1077, 1086, 1094, - 1103, 1116, 1116, 1122, 1124, 1128, 1137, 1142, 1150, 1157, - 1164, 1170, 1176, 1181, 1186, 1191, 1196, 1209, 1214, 1218, - 1224, 1229, 1235, 1240, 1248, 1254, 1269, 1274, 1278, 1285, - 1291, 1307, 1315, 1321, 1326, 1331, 1340, 1347, 1357, 1364, - 1375, 1381, 1386, 1391, 1396, 1401, 1406, 1415, 1420, 1436, - 1441, 1445, 1449, 1455, 1460, 1468, 1473, 1481, 1490, 1499, - 1504, 1508, 1513, 1518, 1523, 1528, 1533, 1538, 1543, 1548, - 1553, 1563, 1572, 1583, 1588, 1592, 1597, 1602, 1607, 1612, - 1617, 1622, 1627, 1632 + 164, 165, 166, 167, 168, 169, 170, 175, 185, 190, + 210, 216, 227, 249, 258, 263, 268, 274, 279, 284, + 288, 292, 296, 304, 316, 328, 328, 354, 354, 381, + 381, 411, 416, 422, 424, 430, 434, 439, 443, 447, + 460, 475, 490, 505, 509, 513, 517, 523, 525, 535, + 535, 546, 546, 556, 556, 566, 566, 579, 579, 589, + 589, 599, 610, 619, 632, 643, 643, 653, 653, 663, + 663, 673, 673, 683, 683, 696, 701, 707, 713, 719, + 719, 732, 732, 742, 742, 752, 752, 762, 762, 772, + 772, 782, 782, 792, 792, 802, 802, 812, 812, 829, + 842, 853, 864, 869, 873, 879, 884, 892, 892, 898, + 898, 904, 904, 912, 924, 937, 946, 956, 961, 977, + 982, 986, 992, 997, 1001, 1007, 1012, 1016, 1020, 1024, + 1028, 1036, 1046, 1051, 1067, 1072, 1076, 1080, 1084, 1088, + 1092, 1096, 1105, 1117, 1130, 1130, 1141, 1147, 1153, 1162, + 1170, 1179, 1192, 1192, 1198, 1200, 1207, 1219, 1227, 1238, + 1248, 1255, 1261, 1267, 1272, 1277, 1282, 1287, 1300, 1305, + 1309, 1315, 1320, 1326, 1331, 1339, 1345, 1360, 1365, 1369, + 1376, 1382, 1398, 1406, 1412, 1417, 1422, 1431, 1438, 1448, + 1455, 1466, 1472, 1477, 1482, 1487, 1492, 1497, 1506, 1511, + 1527, 1532, 1536, 1540, 1546, 1551, 1559, 1564, 1572, 1581, + 1590, 1595, 1599, 1604, 1609, 1614, 1619, 1624, 1629, 1634, + 1639, 1644, 1654, 1663, 1674, 1679, 1683, 1688, 1693, 1698, + 1703, 1708, 1713, 1718, 1723 }; #endif @@ -420,22 +421,22 @@ "IMPURE", "PRELOAD", "LOADONCALL", "DISCARDABLE", "NOT", "QUOTEDSTRING", "STRING", "NUMBER", "SIZEDSTRING", "IGNORED_TOKEN", "'|'", "'^'", "'&'", "'+'", "'-'", "'*'", "'/'", "'%'", "'~'", "NEG", "','", "'='", "'('", - "')'", "input", "newcmd", "accelerator", "acc_entries", "acc_entry", - "acc_event", "acc_options", "acc_option", "bitmap", "cursor", "dialog", - "@1", "@2", "@3", "exstyle", "styles", "@4", "controls", "control", - "@5", "@6", "@7", "@8", "@9", "@10", "@11", "@12", "@13", "@14", "@15", - "@16", "@17", "@18", "@19", "@20", "@21", "@22", "@23", "@24", "@25", + "')'", "input", "accelerator", "acc_entries", "acc_entry", "acc_event", + "acc_options", "acc_option", "bitmap", "cursor", "dialog", "@1", "@2", + "@3", "exstyle", "styles", "controls", "control", "@4", "@5", "@6", + "@7", "@8", "@9", "@10", "@11", "@12", "@13", "@14", "@15", "@16", + "@17", "@18", "@19", "@20", "@21", "@22", "@23", "@24", "control_params", "optstringc", "opt_control_data", "control_styleexpr", - "@26", "icon_styleexpr", "@27", "control_params_styleexpr", "@28", + "@25", "icon_styleexpr", "@26", "control_params_styleexpr", "@27", "font", "icon", "language", "menu", "menuitems", "menuitem", "menuitem_flags", "menuitem_flag", "menuex", "menuexitems", - "menuexitem", "messagetable", "rcdata", "optrcdata_data", "@29", - "optrcdata_data_int", "rcdata_data", "stringtable", "@30", + "menuexitem", "messagetable", "rcdata", "optrcdata_data", "@28", + "optrcdata_data_int", "rcdata_data", "stringtable", "@29", "string_data", "user", "versioninfo", "fixedverinfo", "verblocks", "vervals", "vertrans", "id", "resname", "resref", "suboptions", "memflags_move_discard", "memflags_move", "memflag", "file_name", "styleexpr", "parennumber", "optcnumexpr", "cnumexpr", "numexpr", - "sizednumexpr", "cposnumexpr", "posnumexpr", "sizedposnumexpr", NULL + "sizednumexpr", "cposnumexpr", "posnumexpr", "sizedposnumexpr", 0 }; #endif @@ -443,60 +444,60 @@ static const short yyr1[] = { 0, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 100, 101, 102, - 102, 103, 103, 104, 104, 105, 105, 105, 106, 106, - 106, 106, 106, 106, 107, 108, 110, 109, 111, 109, - 112, 109, 113, 113, 114, 114, 114, 115, 114, 114, - 114, 114, 114, 114, 114, 114, 116, 116, 118, 117, - 119, 117, 120, 117, 121, 117, 122, 117, 123, 117, - 117, 117, 117, 117, 124, 117, 125, 117, 126, 117, - 127, 117, 128, 117, 117, 117, 117, 117, 129, 117, - 130, 117, 131, 117, 132, 117, 133, 117, 134, 117, - 135, 117, 136, 117, 137, 117, 138, 117, 139, 139, - 139, 140, 140, 140, 141, 141, 143, 142, 145, 144, - 147, 146, 148, 149, 150, 151, 152, 152, 153, 153, - 153, 154, 154, 154, 155, 155, 155, 155, 155, 155, - 156, 157, 157, 158, 158, 158, 158, 158, 158, 158, - 158, 159, 160, 162, 161, 163, 163, 164, 164, 164, - 164, 166, 165, 167, 167, 167, 168, 168, 169, 170, - 170, 170, 170, 170, 170, 170, 170, 171, 171, 171, - 172, 172, 173, 173, 174, 174, 175, 175, 175, 176, - 176, 177, 177, 177, 177, 177, 178, 178, 179, 179, - 180, 180, 180, 180, 180, 180, 180, 181, 181, 182, - 182, 182, 182, 183, 183, 184, 184, 185, 186, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 188, 189, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190 + 99, 99, 99, 99, 99, 99, 99, 100, 101, 101, + 102, 102, 103, 103, 104, 104, 104, 105, 105, 105, + 105, 105, 105, 106, 107, 109, 108, 110, 108, 111, + 108, 112, 112, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 114, 114, 116, + 115, 117, 115, 118, 115, 119, 115, 120, 115, 121, + 115, 115, 115, 115, 115, 122, 115, 123, 115, 124, + 115, 125, 115, 126, 115, 115, 115, 115, 115, 127, + 115, 128, 115, 129, 115, 130, 115, 131, 115, 132, + 115, 133, 115, 134, 115, 135, 115, 136, 115, 137, + 137, 137, 138, 138, 138, 139, 139, 141, 140, 143, + 142, 145, 144, 146, 147, 148, 149, 150, 150, 151, + 151, 151, 152, 152, 152, 153, 153, 153, 153, 153, + 153, 154, 155, 155, 156, 156, 156, 156, 156, 156, + 156, 156, 157, 158, 160, 159, 161, 161, 162, 162, + 162, 162, 164, 163, 165, 165, 165, 166, 166, 167, + 168, 168, 168, 168, 168, 168, 168, 168, 169, 169, + 169, 170, 170, 171, 171, 172, 172, 173, 173, 173, + 174, 174, 175, 175, 175, 175, 175, 176, 176, 177, + 177, 178, 178, 178, 178, 178, 178, 178, 179, 179, + 180, 180, 180, 180, 181, 181, 182, 182, 183, 184, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 186, 187, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const short yyr2[] = { - 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 0, 6, 0, - 2, 2, 4, 1, 1, 1, 3, 2, 1, 1, - 1, 1, 1, 1, 4, 4, 0, 13, 0, 13, - 0, 14, 0, 3, 0, 3, 3, 0, 4, 3, - 5, 7, 3, 3, 4, 3, 0, 2, 0, 3, - 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, - 11, 12, 12, 13, 0, 3, 0, 3, 0, 3, - 0, 3, 0, 3, 6, 8, 10, 11, 0, 3, - 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, - 0, 3, 0, 3, 0, 3, 0, 16, 7, 9, - 10, 0, 1, 2, 0, 3, 0, 3, 0, 3, - 0, 3, 4, 4, 3, 6, 0, 2, 4, 2, - 6, 0, 3, 2, 1, 1, 1, 1, 1, 1, - 6, 0, 2, 2, 3, 5, 2, 5, 6, 7, - 9, 4, 6, 0, 2, 0, 1, 1, 1, 3, - 3, 0, 6, 0, 3, 4, 6, 4, 6, 0, - 6, 6, 3, 3, 3, 3, 3, 0, 8, 7, - 0, 5, 0, 3, 1, 1, 1, 2, 2, 2, - 1, 0, 2, 3, 4, 3, 0, 2, 0, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 3, 4, 1, 3, 0, 1, 2, 1, 1, - 3, 2, 2, 3, 3, 3, 3, 3, 3, 3, - 3, 2, 1, 1, 3, 2, 3, 3, 3, 3, - 3, 3, 3, 3 + 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 6, 0, 2, + 2, 4, 1, 1, 1, 3, 2, 1, 1, 1, + 1, 1, 1, 4, 4, 0, 13, 0, 13, 0, + 14, 0, 3, 0, 3, 3, 3, 3, 3, 5, + 6, 7, 8, 3, 3, 4, 3, 0, 2, 0, + 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, + 3, 11, 12, 12, 13, 0, 3, 0, 3, 0, + 3, 0, 3, 0, 3, 6, 8, 10, 11, 0, + 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, + 3, 0, 3, 0, 3, 0, 3, 0, 16, 7, + 9, 10, 0, 1, 2, 0, 3, 0, 3, 0, + 3, 0, 3, 4, 4, 3, 6, 0, 2, 4, + 2, 6, 0, 3, 2, 1, 1, 1, 1, 1, + 1, 6, 0, 2, 2, 3, 5, 2, 5, 6, + 7, 9, 4, 6, 0, 2, 0, 1, 1, 1, + 3, 3, 0, 6, 0, 3, 4, 6, 4, 6, + 0, 6, 6, 3, 3, 3, 3, 3, 0, 8, + 7, 0, 5, 0, 3, 1, 1, 1, 2, 2, + 2, 1, 0, 2, 3, 4, 3, 0, 2, 0, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 3, 4, 1, 3, 0, 1, 2, 1, + 1, 3, 2, 2, 3, 3, 3, 3, 3, 3, + 3, 3, 2, 1, 1, 3, 2, 3, 3, 3, + 3, 3, 3, 3, 3 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE @@ -504,290 +505,290 @@ error. */ static const short yydefact[] = { - 1, 17, 0, 0, 191, 185, 233, 16, 0, 0, - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 0, 184, 232, 219, 0, 0, - 0, 0, 218, 0, 235, 0, 191, 198, 196, 198, - 198, 196, 196, 191, 191, 198, 191, 169, 191, 0, - 0, 0, 0, 0, 0, 0, 0, 222, 221, 0, - 0, 124, 0, 0, 0, 0, 0, 0, 0, 0, - 161, 0, 0, 0, 200, 201, 202, 203, 204, 205, - 206, 192, 234, 0, 0, 0, 42, 42, 0, 0, - 0, 0, 0, 0, 0, 0, 243, 242, 241, 239, - 240, 236, 237, 238, 220, 217, 230, 229, 228, 226, - 227, 223, 224, 225, 163, 0, 193, 195, 19, 207, - 208, 199, 34, 197, 35, 0, 0, 0, 122, 123, - 126, 141, 151, 153, 177, 0, 0, 0, 0, 0, - 0, 0, 153, 167, 0, 194, 0, 0, 0, 0, - 0, 0, 0, 155, 0, 0, 0, 172, 173, 174, - 175, 176, 0, 162, 0, 18, 23, 20, 0, 24, - 43, 0, 0, 125, 0, 0, 127, 140, 0, 0, - 142, 152, 157, 154, 156, 158, 168, 0, 0, 0, - 0, 166, 164, 0, 0, 21, 0, 0, 129, 0, - 131, 146, 143, 0, 0, 0, 0, 0, 0, 165, - 231, 0, 36, 38, 131, 0, 144, 141, 0, 159, - 160, 0, 0, 170, 171, 28, 29, 30, 31, 32, - 33, 22, 25, 44, 44, 40, 128, 126, 134, 135, - 136, 137, 138, 139, 0, 133, 215, 0, 141, 0, - 180, 182, 0, 27, 0, 0, 44, 0, 132, 145, - 216, 147, 0, 141, 215, 0, 0, 26, 56, 0, - 0, 0, 47, 0, 0, 0, 0, 0, 56, 0, - 130, 148, 0, 0, 0, 0, 179, 0, 0, 49, - 45, 46, 0, 0, 0, 53, 55, 52, 0, 56, - 149, 141, 178, 0, 183, 37, 111, 58, 60, 62, - 66, 68, 74, 76, 78, 80, 90, 92, 94, 96, - 98, 100, 102, 104, 0, 64, 82, 88, 0, 57, - 0, 213, 0, 48, 209, 0, 54, 39, 0, 0, - 0, 112, 0, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 0, 111, 111, 111, 186, 0, 190, 0, 0, 210, - 0, 0, 50, 41, 150, 181, 113, 0, 59, 0, - 61, 63, 67, 69, 75, 77, 79, 81, 91, 93, - 95, 97, 99, 101, 103, 105, 0, 65, 83, 89, - 187, 188, 0, 189, 214, 0, 211, 0, 0, 0, - 0, 0, 0, 212, 51, 0, 116, 0, 0, 0, - 114, 0, 0, 0, 0, 0, 153, 84, 0, 0, - 117, 0, 0, 0, 0, 114, 0, 0, 114, 0, - 115, 118, 85, 215, 0, 215, 120, 108, 215, 0, - 0, 114, 216, 215, 114, 216, 0, 114, 216, 0, - 119, 86, 114, 114, 216, 70, 114, 121, 109, 114, - 0, 87, 72, 114, 71, 110, 0, 73, 106, 0, - 215, 107, 0, 0 + 1, 0, 0, 192, 186, 234, 16, 0, 0, 2, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 0, 185, 233, 220, 0, 0, 0, + 0, 219, 0, 236, 0, 192, 199, 197, 199, 199, + 197, 197, 192, 192, 199, 192, 170, 192, 0, 0, + 0, 0, 0, 0, 0, 0, 223, 222, 0, 0, + 125, 0, 0, 0, 0, 0, 0, 0, 0, 162, + 0, 0, 0, 201, 202, 203, 204, 205, 206, 207, + 193, 235, 0, 0, 0, 41, 41, 0, 0, 0, + 0, 0, 0, 0, 0, 244, 243, 242, 240, 241, + 237, 238, 239, 221, 218, 231, 230, 229, 227, 228, + 224, 225, 226, 164, 0, 194, 196, 18, 208, 209, + 200, 33, 198, 34, 0, 0, 0, 123, 124, 127, + 142, 152, 154, 178, 0, 0, 0, 0, 0, 0, + 0, 154, 168, 0, 195, 0, 0, 0, 0, 0, + 0, 0, 156, 0, 0, 0, 173, 174, 175, 176, + 177, 0, 163, 0, 17, 22, 19, 0, 23, 42, + 0, 0, 126, 0, 0, 128, 141, 0, 0, 143, + 153, 158, 155, 157, 159, 169, 0, 0, 0, 0, + 167, 165, 0, 0, 20, 0, 0, 130, 0, 132, + 147, 144, 0, 0, 0, 0, 0, 0, 166, 232, + 0, 35, 37, 132, 0, 145, 142, 0, 160, 161, + 0, 0, 171, 172, 27, 28, 29, 30, 31, 32, + 21, 24, 43, 43, 39, 129, 127, 135, 136, 137, + 138, 139, 140, 0, 134, 216, 0, 142, 0, 181, + 183, 0, 26, 0, 0, 43, 0, 133, 146, 217, + 148, 0, 142, 216, 0, 0, 25, 57, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 57, 0, 131, + 149, 0, 0, 0, 0, 180, 0, 0, 47, 44, + 48, 45, 0, 214, 0, 46, 210, 0, 0, 54, + 56, 53, 0, 57, 150, 142, 179, 0, 184, 36, + 112, 59, 61, 63, 67, 69, 75, 77, 79, 81, + 91, 93, 95, 97, 99, 101, 103, 105, 0, 65, + 83, 89, 0, 58, 211, 0, 0, 0, 55, 38, + 0, 0, 0, 113, 0, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 0, 112, 112, 112, 187, 0, 191, 0, + 0, 215, 0, 212, 49, 40, 151, 182, 114, 0, + 60, 0, 62, 64, 68, 70, 76, 78, 80, 82, + 92, 94, 96, 98, 100, 102, 104, 106, 0, 66, + 84, 90, 188, 189, 0, 190, 213, 50, 0, 0, + 0, 0, 0, 51, 0, 117, 0, 0, 0, 115, + 52, 0, 0, 0, 0, 0, 154, 85, 0, 0, + 118, 0, 0, 0, 0, 115, 0, 0, 115, 0, + 116, 119, 86, 216, 0, 216, 121, 109, 216, 0, + 0, 115, 217, 216, 115, 217, 0, 115, 217, 0, + 120, 87, 115, 115, 217, 71, 115, 122, 110, 115, + 0, 88, 73, 115, 72, 111, 0, 74, 107, 0, + 216, 108, 0, 0 }; static const short yydefgoto[] = { - 1, 2, 10, 146, 167, 168, 231, 232, 11, 12, - 13, 233, 234, 256, 126, 254, 292, 288, 329, 343, - 344, 345, 361, 346, 347, 348, 349, 350, 351, 362, - 363, 352, 353, 354, 355, 356, 357, 358, 359, 479, - 378, 379, 427, 417, 422, 443, 450, 448, 456, 14, - 15, 16, 17, 150, 176, 215, 245, 18, 151, 180, - 19, 20, 152, 153, 183, 184, 21, 114, 144, 22, - 23, 94, 154, 265, 266, 24, 366, 367, 33, 85, - 84, 81, 122, 333, 334, 259, 260, 105, 32, 195, - 25, 26 + 1, 9, 145, 166, 167, 230, 231, 10, 11, 12, + 232, 233, 255, 125, 253, 287, 333, 345, 346, 347, + 363, 348, 349, 350, 351, 352, 353, 364, 365, 354, + 355, 356, 357, 358, 359, 360, 361, 479, 380, 381, + 427, 416, 422, 443, 450, 448, 456, 13, 14, 15, + 16, 149, 175, 214, 244, 17, 150, 179, 18, 19, + 151, 152, 182, 183, 20, 113, 143, 21, 22, 93, + 153, 264, 265, 23, 368, 369, 32, 84, 83, 80, + 121, 295, 296, 258, 259, 104, 31, 194, 24, 25 }; static const short yypact[] = { - -32768, 31, 240, 241,-32768,-32768,-32768,-32768, 241, 241, + -32768, 13, 412,-32768,-32768,-32768,-32768, 412, 412,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768, 68,-32768, 578,-32768, 241, 241, - 241, -73, 586, 169,-32768, 388,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 241, - 241, 241, 241, 241, 241, 241, 241,-32768,-32768, 513, - 241,-32768, 241, 241, 241, 241, 241, 241, 241, 241, - -32768, 241, 241, 241,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768, 215, 581, 581, 268, 268, 581, 581, - 232, 275, 581, 283, 250, 156, 593, 599, 616, 98, - 98,-32768,-32768,-32768,-32768,-32768, 593, 599, 616, 98, - 98,-32768,-32768,-32768,-32768, -73,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768, -61, 290, 290,-32768,-32768, - -32768,-32768,-32768,-32768,-32768, 241, 241, 241, 241, 241, - 241, 241,-32768,-32768, 4,-32768, 5, 241, -73, -73, - 9, 92, 32, 309, 10, -73, -73,-32768,-32768,-32768, - -32768,-32768, 54,-32768, -57,-32768,-32768,-32768, -20,-32768, - -32768, -73, -73,-32768, 39, -9,-32768,-32768, 40, 11, - -32768,-32768,-32768,-32768, 36, 586,-32768, 145, 151, -73, - -73,-32768,-32768, 78, 290, 79, -73, -73,-32768, -73, - -32768,-32768, -73, 16, 365, 106, 108, -73, -73,-32768, - -32768, 686,-32768, -73,-32768, 52, -73,-32768, 17,-32768, - 586, 178, 128,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768, 34,-32768,-32768,-32768,-32768, 314,-32768,-32768,-32768, - -32768,-32768,-32768,-32768, 647,-32768, -73, 95,-32768, 18, - -32768,-32768, 686,-32768, 150, 378,-32768, 112,-32768,-32768, - -32768,-32768, 123,-32768, -73, 6, 29,-32768,-32768, 241, - 129, 281,-32768, 241, 241, 241, 241, 281,-32768, 452, - -32768,-32768, 135, 200, 213, 143,-32768, -73, 479,-32768, - -32768,-32768, 182, 91, -73,-32768,-32768,-32768, 516,-32768, - -32768,-32768,-32768, 130,-32768,-32768, 147,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768, 158,-32768,-32768,-32768, 170,-32768, - 73,-32768, 241, 154,-32768, 160,-32768,-32768, 553, 172, - 168, 161, 241, 147, 147, 147, 147, 147, 147, 147, - 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, - 173, 147, 147, 147, 174, 186,-32768, 241, 187,-32768, - 196, 183, -73,-32768,-32768,-32768,-32768, 201,-32768, 241, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768, 241,-32768,-32768,-32768, - -32768,-32768, -73,-32768,-32768, 73,-32768, -73, 293, 202, - -73, 203, -73,-32768,-32768, 202,-32768, -73, -73, 241, - 22, -73, 182, -73, -73, 205,-32768,-32768, -73, -73, - 154, -73, -73, 241, 297, 26, -73, -73, 27, 208, - -32768,-32768,-32768, -73, -73, -73,-32768,-32768, -73, 241, - 182, 251, -73, -73, 251, -73, 182, 251, -73, 230, - 154,-32768, 251, 251, -73,-32768, 251, 154,-32768, 251, - 241,-32768,-32768, 251,-32768,-32768, 236,-32768,-32768, 182, - -11,-32768, 332,-32768 + -32768,-32768,-32768, 111,-32768, 511,-32768, 412, 412, 412, + -79, 600, 244,-32768, 562,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 412, 412, + 412, 412, 412, 412, 412, 412,-32768,-32768, 576, 412, + -32768, 412, 412, 412, 412, 412, 412, 412, 412,-32768, + 412, 412, 412,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768, 256, 603, 603, 297, 297, 603, 603, 280, + 337, 603, 345, 100, 231, 607, 613, 567, 172, 172, + -32768,-32768,-32768,-32768,-32768, 607, 613, 567, 172, 172, + -32768,-32768,-32768,-32768, -79,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768, -60, 63, 63,-32768,-32768,-32768, + -32768,-32768,-32768,-32768, 412, 412, 412, 412, 412, 412, + 412,-32768,-32768, 7,-32768, 5, 412, -79, -79, 33, + 34, 35, 254, 51, -79, -79,-32768,-32768,-32768,-32768, + -32768, 36,-32768, 60,-32768,-32768,-32768, -38,-32768,-32768, + -79, -79,-32768, -39, 11,-32768,-32768, 59, 25,-32768, + -32768,-32768,-32768, 27, 600,-32768, 127, 144, -79, -79, + -32768,-32768, 74, 63, 87, -79, -79,-32768, -79,-32768, + -32768, -79, 12, 294, 118, 128, -79, -79,-32768,-32768, + 700,-32768, -79,-32768, 22, -79,-32768, 14,-32768, 600, + 194, 121,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 23,-32768,-32768,-32768,-32768, 309,-32768,-32768,-32768,-32768, + -32768,-32768,-32768, 661,-32768, -79, 38,-32768, 16,-32768, + -32768, 700,-32768, 383, 472,-32768, 42,-32768,-32768,-32768, + -32768, 124,-32768, -79, 10, 4,-32768,-32768, 412, 126, + 187, 99, 412, 412, 412, 412, 200,-32768, 480,-32768, + -32768, 125, 204, 207, 135,-32768, -79, 510,-32768,-32768, + -32768,-32768, 49,-32768, 412, 136,-32768, 133, -79,-32768, + -32768,-32768, 547,-32768,-32768,-32768,-32768, 134,-32768,-32768, + 152,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 153,-32768, + -32768,-32768, 374,-32768,-32768, 140, 112, 157,-32768,-32768, + 584, 138, 160, 148, 412, 152, 152, 152, 152, 152, + 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, + 152, 152, 158, 152, 152, 152, 161, 163,-32768, 412, + 165,-32768, 49,-32768, -79,-32768,-32768,-32768,-32768, 170, + -32768, 412,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 412,-32768, + -32768,-32768,-32768,-32768, -79,-32768,-32768, -79, 123, 183, + -79, 184, -79, -79, 183,-32768, -79, -79, 412, 17, + -32768, -79, 99, -79, -79, 190,-32768,-32768, -79, -79, + 136, -79, -79, 412, 248, 18, -79, -79, 19, 195, + -32768,-32768,-32768, -79, -79, -79,-32768,-32768, -79, 412, + 99, 245, -79, -79, 245, -79, 99, 245, -79, 196, + 136,-32768, 245, 245, -79,-32768, 245, 136,-32768, 245, + 412,-32768,-32768, 245,-32768,-32768, 201,-32768,-32768, 99, + 64,-32768, 295,-32768 }; static const short yypgoto[] = { - -32768,-32768,-32768,-32768,-32768,-32768,-32768, -220,-32768,-32768, - -32768,-32768,-32768,-32768, 248, -222,-32768, -262,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768, -206,-32768,-32768,-32768, + -32768,-32768,-32768, 212, -85, -259,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 289, 30, 159, -44,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768, 117,-32768, 163, 140,-32768, -171,-32768, - -32768,-32768, -141,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768, -22,-32768,-32768, 486, -24, - 55, 480, 316, -304, -315, -261, 8, -3, -2,-32768, - -122,-32768 + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 281, -8, + -212, -104,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768, 78,-32768, 113, 92,-32768, -204,-32768,-32768,-32768, + -140,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768, -21,-32768,-32768, 350, 139, 175, 475, + 416, -329, -257, -258, 29, -2, -1,-32768, -122,-32768 }; -#define YYLAST 708 +#define YYLAST 717 static const short yytable[] = { - 31, 162, 48, 283, 148, 149, 34, 35, 163, 165, - 284, 253, 255, 173, 186, 369, 298, 88, 89, 217, - 248, 263, 60, 192, 169, 426, 57, 58, 59, 426, - 426, 482, 267, 286, 279, 147, 181, 338, 193, 61, - 225, 226, 227, 228, 229, 230, 247, 96, 97, 98, - 99, 100, 101, 102, 103, 237, 406, 174, 191, 175, - 106, 107, 108, 109, 110, 111, 112, 113, 115, 116, - 117, 200, 210, 36, 371, 194, 285, 262, 187, 188, - 37, 38, 39, 40, 60, 166, 27, 6, 198, 201, - 413, 203, 282, 28, 86, 87, 177, 29, 8, 261, - 92, 30, 9, 238, 239, 240, 241, 242, 243, 41, - 42, 60, 60, 60, 43, 44, 280, 60, 430, 199, - 202, 441, 446, 145, 60, 45, 46, 281, 47, 252, - 339, 204, 155, 156, 157, 158, 159, 160, 161, 300, - 178, 164, 179, 178, 170, 179, 460, 244, 205, 5, - 6, 185, 467, 268, 206, 331, 171, 172, 209, 142, - 174, 8, 175, 189, 190, 9, 269, 270, 271, 272, - 332, 178, 70, 179, 211, 480, 374, 221, 222, 196, - 197, 250, 451, 178, 454, 179, 335, 457, 67, 68, - 69, 273, 463, 274, 275, 276, 277, 207, 208, 71, - 72, 73, 220, 301, 212, 213, 368, 214, 251, 290, - 216, 218, 71, 72, 73, 223, 224, 302, 118, 481, - 178, 235, 179, 303, 246, 340, 249, 341, 74, 75, - 76, 77, 78, 79, 80, 130, 119, 120, 360, 371, - 372, 74, 75, 76, 77, 78, 79, 80, 375, 291, - 364, 365, 6, 134, 426, 297, 376, 264, 71, 72, - 73, 330, 405, 8, 331, 331, 289, 9, 396, 400, - 293, 294, 295, 296, 287, 71, 72, 73, 131, 332, - 332, 401, 403, 3, 125, 434, 133, 74, 75, 76, - 77, 78, 79, 80, 404, 304, 408, 416, 419, 4, - 433, 440, 336, 449, 74, 75, 76, 77, 78, 79, - 80, 135, 136, 137, 138, 139, 140, 141, 71, 72, - 73, 5, 6, 27, 7, 470, 71, 72, 73, 370, - 28, 478, 483, 8, 29, 127, 342, 9, 30, 377, - 74, 75, 76, 77, 78, 79, 80, 74, 75, 76, - 77, 78, 79, 80, 257, 74, 75, 76, 77, 78, - 79, 80, 5, 6, 402, 238, 239, 240, 241, 242, - 243, 421, 6, 415, 8, 27, 410, 236, 9, 0, - 407, 278, 28, 8, 258, 409, 29, 9, 0, 0, - 30, 27, 182, 411, 269, 270, 271, 272, 28, 0, - 0, 124, 29, 0, 128, 129, 30, 0, 132, 244, - 412, 143, 0, 0, 0, 414, 425, 0, 418, 273, - 420, 274, 275, 276, 277, 423, 424, 0, 428, 429, - 439, 431, 432, 0, 0, 0, 435, 436, 0, 437, - 438, 0, 0, 0, 444, 445, 459, 27, 219, 0, - 0, 452, 453, 455, 28, 299, 458, 0, 29, 0, - 462, 464, 30, 466, 0, 0, 469, 476, 269, 270, - 271, 272, 473, 62, 63, 64, 65, 66, 67, 68, - 69, 0, 0, 305, 0, 0, 82, 0, 0, 306, - 0, 0, 0, 273, 0, 274, 275, 276, 277, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, - 337, 328, 83, 0, 0, 0, 306, 0, 0, 90, - 91, 0, 93, 0, 95, 0, 307, 308, 309, 310, + 30, 161, 47, 147, 148, 282, 33, 34, 285, 164, + 197, 162, 246, 482, 283, 216, 59, 247, 302, 262, + 426, 426, 426, 168, 252, 236, 56, 57, 58, 224, + 225, 226, 227, 228, 229, 334, 146, 172, 176, 180, + 190, 198, 260, 261, 340, 266, 279, 95, 96, 97, + 98, 99, 100, 101, 102, 185, 2, 193, 281, 60, + 105, 106, 107, 108, 109, 110, 111, 112, 114, 115, + 116, 209, 3, 237, 238, 239, 240, 241, 242, 373, + 284, 173, 177, 174, 178, 165, 177, 5, 178, 26, + 173, 199, 174, 430, 4, 5, 27, 6, 7, 59, + 28, 341, 8, 133, 29, 202, 7, 59, 200, 59, + 8, 59, 59, 441, 446, 406, 35, 243, 251, 186, + 187, 460, 203, 36, 37, 38, 39, 467, 280, 304, + 204, 293, 154, 155, 156, 157, 158, 159, 160, 201, + 191, 163, 376, 144, 169, 5, 294, 205, 254, 336, + 480, 184, 40, 41, 208, 192, 7, 42, 43, 59, + 8, 134, 135, 136, 137, 138, 139, 140, 44, 45, + 278, 46, 177, 177, 178, 178, 170, 171, 292, 87, + 88, 293, 210, 188, 189, 451, 177, 454, 178, 220, + 457, 372, 4, 5, 293, 463, 294, 249, 221, 195, + 196, 250, 219, 414, 7, 26, 289, 305, 8, 294, + 370, 306, 27, 85, 86, 307, 28, 206, 207, 91, + 29, 336, 481, 442, 211, 212, 447, 213, 337, 342, + 215, 217, 343, 362, 141, 222, 223, 374, 371, 461, + 377, 234, 465, 378, 245, 468, 248, 69, 426, 291, + 471, 472, 440, 398, 474, 301, 402, 475, 403, 117, + 405, 477, 66, 67, 68, 408, 288, 290, 4, 5, + 297, 298, 299, 300, 70, 71, 72, 263, 415, 418, + 7, 4, 5, 129, 8, 433, 434, 70, 71, 72, + 449, 470, 335, 7, 286, 483, 478, 8, 126, 70, + 71, 72, 344, 73, 74, 75, 76, 77, 78, 79, + 421, 118, 119, 124, 256, 308, 73, 74, 75, 76, + 77, 78, 79, 70, 71, 72, 235, 338, 73, 74, + 75, 76, 77, 78, 79, 257, 26, 181, 0, 0, + 130, 0, 379, 27, 0, 0, 0, 28, 132, 0, + 0, 29, 73, 74, 75, 76, 77, 78, 79, 0, + 237, 238, 239, 240, 241, 242, 0, 404, 0, 73, + 74, 75, 76, 77, 78, 79, 26, 218, 0, 410, + 70, 71, 72, 27, 0, 82, 267, 28, 70, 71, + 72, 29, 89, 90, 0, 92, 411, 94, 0, 268, + 269, 270, 271, 407, 243, 0, 0, 0, 409, 73, + 74, 75, 76, 77, 78, 79, 425, 73, 74, 75, + 76, 77, 78, 79, 272, 0, 273, 274, 275, 276, + 0, 439, 0, 412, 0, 0, 413, 0, 0, 417, + 0, 419, 420, 0, 0, 423, 424, 459, 428, 0, + 429, 0, 431, 432, 366, 367, 5, 435, 436, 0, + 437, 438, 0, 0, 0, 444, 445, 7, 476, 0, + 0, 8, 452, 453, 455, 277, 0, 458, 0, 0, + 0, 462, 464, 303, 466, 0, 0, 469, 268, 269, + 270, 271, 0, 473, 26, 0, 268, 269, 270, 271, + 123, 27, 0, 127, 128, 28, 0, 131, 0, 29, + 142, 0, 0, 272, 309, 273, 274, 275, 276, 0, + 310, 272, 0, 273, 274, 275, 276, 0, 0, 0, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 325, 326, 327, 373, 328, 0, - 0, 0, 0, 306, 121, 123, 121, 121, 123, 123, - 0, 0, 121, 307, 308, 309, 310, 311, 312, 313, + 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 339, 332, 0, 0, 0, 0, 310, 120, 122, + 120, 120, 122, 122, 0, 0, 120, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 325, 326, 327, 442, 328, 0, 447, 62, 63, - 64, 65, 66, 67, 68, 69, 0, 0, 0, 0, - 461, 104, 0, 465, 0, 0, 468, 0, 0, 0, - 0, 471, 472, 0, 0, 474, 0, 0, 475, 0, - 0, 0, 477, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 0, - 397, 398, 399, 74, 75, 76, 77, 78, 79, 80, - 0, 119, 120, 49, 50, 51, 52, 53, 54, 55, - 56, 62, 63, 64, 65, 66, 67, 68, 69, 63, - 64, 65, 66, 67, 68, 69, 64, 65, 66, 67, - 68, 69, 225, 226, 227, 228, 229, 230, 238, 239, - 240, 241, 242, 243, 65, 66, 67, 68, 69 + 324, 325, 326, 327, 328, 329, 330, 331, 375, 332, + 0, 0, 0, 0, 310, 0, 48, 49, 50, 51, + 52, 53, 54, 55, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 0, 332, 382, 383, 384, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, 0, 399, 400, 401, 61, 62, 63, + 64, 65, 66, 67, 68, 64, 65, 66, 67, 68, + 81, 61, 62, 63, 64, 65, 66, 67, 68, 0, + 0, 0, 0, 0, 103, 73, 74, 75, 76, 77, + 78, 79, 0, 118, 119, 61, 62, 63, 64, 65, + 66, 67, 68, 62, 63, 64, 65, 66, 67, 68, + 63, 64, 65, 66, 67, 68, 224, 225, 226, 227, + 228, 229, 237, 238, 239, 240, 241, 242 }; static const short yycheck[] = { - 3, 142, 24, 264, 126, 127, 8, 9, 4, 4, - 4, 231, 234, 4, 4, 330, 278, 41, 42, 3, - 3, 3, 95, 80, 146, 3, 28, 29, 30, 3, - 3, 0, 252, 4, 256, 96, 4, 299, 95, 31, - 6, 7, 8, 9, 10, 11, 217, 49, 50, 51, - 52, 53, 54, 55, 56, 3, 371, 48, 4, 50, - 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, - 73, 80, 194, 5, 85, 95, 70, 248, 68, 69, - 12, 13, 14, 15, 95, 80, 82, 82, 49, 49, - 405, 80, 263, 89, 39, 40, 4, 93, 93, 4, - 45, 97, 97, 51, 52, 53, 54, 55, 56, 41, - 42, 95, 95, 95, 46, 47, 4, 95, 422, 80, - 80, 95, 95, 115, 95, 57, 58, 4, 60, 95, - 301, 95, 135, 136, 137, 138, 139, 140, 141, 4, - 48, 144, 50, 48, 147, 50, 450, 95, 3, 81, - 82, 153, 456, 3, 3, 82, 148, 149, 80, 3, - 48, 93, 50, 155, 156, 97, 16, 17, 18, 19, - 97, 48, 3, 50, 95, 479, 4, 71, 70, 171, - 172, 3, 443, 48, 445, 50, 95, 448, 90, 91, - 92, 41, 453, 43, 44, 45, 46, 189, 190, 43, - 44, 45, 204, 3, 196, 197, 328, 199, 80, 80, - 202, 203, 43, 44, 45, 207, 208, 4, 3, 480, - 48, 213, 50, 80, 216, 95, 218, 80, 72, 73, - 74, 75, 76, 77, 78, 3, 80, 81, 80, 85, - 80, 72, 73, 74, 75, 76, 77, 78, 80, 271, - 80, 81, 82, 3, 3, 277, 95, 249, 43, 44, - 45, 79, 79, 93, 82, 82, 269, 97, 95, 95, - 273, 274, 275, 276, 266, 43, 44, 45, 3, 97, - 97, 95, 95, 43, 16, 426, 3, 72, 73, 74, - 75, 76, 77, 78, 98, 287, 95, 95, 95, 59, - 95, 4, 294, 95, 72, 73, 74, 75, 76, 77, - 78, 61, 62, 63, 64, 65, 66, 67, 43, 44, - 45, 81, 82, 82, 84, 95, 43, 44, 45, 332, - 89, 95, 0, 93, 93, 87, 306, 97, 97, 342, - 72, 73, 74, 75, 76, 77, 78, 72, 73, 74, - 75, 76, 77, 78, 237, 72, 73, 74, 75, 76, - 77, 78, 81, 82, 367, 51, 52, 53, 54, 55, - 56, 415, 82, 80, 93, 82, 379, 214, 97, -1, - 372, 3, 89, 93, 244, 377, 93, 97, -1, -1, - 97, 82, 83, 396, 16, 17, 18, 19, 89, -1, - -1, 85, 93, -1, 88, 89, 97, -1, 92, 95, - 402, 95, -1, -1, -1, 407, 419, -1, 410, 41, - 412, 43, 44, 45, 46, 417, 418, -1, 420, 421, - 433, 423, 424, -1, -1, -1, 428, 429, -1, 431, - 432, -1, -1, -1, 436, 437, 449, 82, 83, -1, - -1, 443, 444, 445, 89, 3, 448, -1, 93, -1, - 452, 453, 97, 455, -1, -1, 458, 470, 16, 17, - 18, 19, 464, 85, 86, 87, 88, 89, 90, 91, - 92, -1, -1, 4, -1, -1, 98, -1, -1, 10, - -1, -1, -1, 41, -1, 43, 44, 45, 46, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 4, 42, 36, -1, -1, -1, 10, -1, -1, 43, - 44, -1, 46, -1, 48, -1, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 4, 42, -1, - -1, -1, -1, 10, 84, 85, 86, 87, 88, 89, - -1, -1, 92, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 435, 42, -1, 438, 85, 86, - 87, 88, 89, 90, 91, 92, -1, -1, -1, -1, - 451, 98, -1, 454, -1, -1, 457, -1, -1, -1, - -1, 462, 463, -1, -1, 466, -1, -1, 469, -1, - -1, -1, 473, 344, 345, 346, 347, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, -1, - 361, 362, 363, 72, 73, 74, 75, 76, 77, 78, - -1, 80, 81, 85, 86, 87, 88, 89, 90, 91, - 92, 85, 86, 87, 88, 89, 90, 91, 92, 86, - 87, 88, 89, 90, 91, 92, 87, 88, 89, 90, - 91, 92, 6, 7, 8, 9, 10, 11, 51, 52, - 53, 54, 55, 56, 88, 89, 90, 91, 92 + 2, 141, 23, 125, 126, 263, 7, 8, 4, 4, + 49, 4, 216, 0, 4, 3, 95, 3, 277, 3, + 3, 3, 3, 145, 230, 3, 27, 28, 29, 6, + 7, 8, 9, 10, 11, 292, 96, 4, 4, 4, + 4, 80, 4, 247, 303, 251, 4, 48, 49, 50, + 51, 52, 53, 54, 55, 4, 43, 95, 262, 30, + 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, + 72, 193, 59, 51, 52, 53, 54, 55, 56, 336, + 70, 48, 48, 50, 50, 80, 48, 82, 50, 82, + 48, 80, 50, 422, 81, 82, 89, 84, 93, 95, + 93, 305, 97, 3, 97, 80, 93, 95, 49, 95, + 97, 95, 95, 95, 95, 372, 5, 95, 95, 68, + 69, 450, 95, 12, 13, 14, 15, 456, 4, 4, + 3, 82, 134, 135, 136, 137, 138, 139, 140, 80, + 80, 143, 4, 114, 146, 82, 97, 3, 233, 85, + 479, 152, 41, 42, 80, 95, 93, 46, 47, 95, + 97, 61, 62, 63, 64, 65, 66, 67, 57, 58, + 255, 60, 48, 48, 50, 50, 147, 148, 79, 40, + 41, 82, 95, 154, 155, 443, 48, 445, 50, 71, + 448, 79, 81, 82, 82, 453, 97, 3, 70, 170, + 171, 80, 203, 80, 93, 82, 80, 3, 97, 97, + 332, 4, 89, 38, 39, 80, 93, 188, 189, 44, + 97, 85, 480, 435, 195, 196, 438, 198, 95, 95, + 201, 202, 80, 80, 3, 206, 207, 80, 98, 451, + 80, 212, 454, 95, 215, 457, 217, 3, 3, 270, + 462, 463, 4, 95, 466, 276, 95, 469, 95, 3, + 95, 473, 90, 91, 92, 95, 268, 80, 81, 82, + 272, 273, 274, 275, 43, 44, 45, 248, 95, 95, + 93, 81, 82, 3, 97, 95, 426, 43, 44, 45, + 95, 95, 294, 93, 265, 0, 95, 97, 86, 43, + 44, 45, 310, 72, 73, 74, 75, 76, 77, 78, + 414, 80, 81, 16, 236, 286, 72, 73, 74, 75, + 76, 77, 78, 43, 44, 45, 213, 298, 72, 73, + 74, 75, 76, 77, 78, 243, 82, 83, -1, -1, + 3, -1, 344, 89, -1, -1, -1, 93, 3, -1, + -1, 97, 72, 73, 74, 75, 76, 77, 78, -1, + 51, 52, 53, 54, 55, 56, -1, 369, -1, 72, + 73, 74, 75, 76, 77, 78, 82, 83, -1, 381, + 43, 44, 45, 89, -1, 35, 3, 93, 43, 44, + 45, 97, 42, 43, -1, 45, 398, 47, -1, 16, + 17, 18, 19, 374, 95, -1, -1, -1, 379, 72, + 73, 74, 75, 76, 77, 78, 418, 72, 73, 74, + 75, 76, 77, 78, 41, -1, 43, 44, 45, 46, + -1, 433, -1, 404, -1, -1, 407, -1, -1, 410, + -1, 412, 413, -1, -1, 416, 417, 449, 419, -1, + 421, -1, 423, 424, 80, 81, 82, 428, 429, -1, + 431, 432, -1, -1, -1, 436, 437, 93, 470, -1, + -1, 97, 443, 444, 445, 3, -1, 448, -1, -1, + -1, 452, 453, 3, 455, -1, -1, 458, 16, 17, + 18, 19, -1, 464, 82, -1, 16, 17, 18, 19, + 84, 89, -1, 87, 88, 93, -1, 91, -1, 97, + 94, -1, -1, 41, 4, 43, 44, 45, 46, -1, + 10, 41, -1, 43, 44, 45, 46, -1, -1, -1, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 4, 42, -1, -1, -1, -1, 10, 83, 84, + 85, 86, 87, 88, -1, -1, 91, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 4, 42, + -1, -1, -1, -1, 10, -1, 85, 86, 87, 88, + 89, 90, 91, 92, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, -1, 42, 346, 347, 348, + 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, + 359, 360, 361, -1, 363, 364, 365, 85, 86, 87, + 88, 89, 90, 91, 92, 88, 89, 90, 91, 92, + 98, 85, 86, 87, 88, 89, 90, 91, 92, -1, + -1, -1, -1, -1, 98, 72, 73, 74, 75, 76, + 77, 78, -1, 80, 81, 85, 86, 87, 88, 89, + 90, 91, 92, 86, 87, 88, 89, 90, 91, 92, + 87, 88, 89, 90, 91, 92, 6, 7, 8, 9, + 10, 11, 51, 52, 53, 54, 55, 56 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/share/bison/bison.simple" @@ -829,12 +830,6 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -#ifdef __cplusplus -# define YYSTD(x) std::x -#else -# define YYSTD(x) x -#endif - #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -857,18 +852,19 @@ /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # else -# ifdef __cplusplus -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T std::size_t -# else -# ifdef __STDC__ -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t # endif -# define YYSTACK_ALLOC YYSTD (malloc) -# define YYSTACK_FREE YYSTD (free) +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free # endif +#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -895,24 +891,41 @@ + YYSTACK_GAP_MAX) # endif -/* Relocate the TYPE STACK from its old location to the new one. The +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Type, Stack) \ +# define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - yymemcpy ((char *) yyptr, (char *) (Stack), \ - yysize * (YYSIZE_T) sizeof (Type)); \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) -#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ +#endif #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) @@ -922,14 +935,9 @@ # define YYSIZE_T size_t #endif #if ! defined (YYSIZE_T) -# ifdef __cplusplus -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T std::size_t -# else -# ifdef __STDC__ -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t # endif #endif #if ! defined (YYSIZE_T) @@ -1008,12 +1016,8 @@ #if YYDEBUG # ifndef YYFPRINTF -# ifdef __cplusplus -# include /* INFRINGES ON USER NAME SPACE */ -# else -# include /* INFRINGES ON USER NAME SPACE */ -# endif -# define YYFPRINTF YYSTD (fprintf) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ @@ -1021,10 +1025,8 @@ if (yydebug) \ YYFPRINTF Args; \ } while (0) -/* Nonzero means print parse trace. [The following comment makes no - sense to me. Could someone clarify it? --akim] Since this is - uninitialized, it does not stop multiple parsers from coexisting. - */ +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) @@ -1050,33 +1052,6 @@ # define YYMAXDEPTH 10000 #endif -#if ! defined (yyoverflow) && ! defined (yymemcpy) -# if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -# define yymemcpy __builtin_memcpy -# else /* not GNU C or C++ */ - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -# if defined (__STDC__) || defined (__cplusplus) -yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount) -# else -yymemcpy (yyto, yyfrom, yycount) - char *yyto; - const char *yyfrom; - YYSIZE_T yycount; -# endif -{ - register const char *yyf = yyfrom; - register char *yyt = yyto; - register YYSIZE_T yyi = yycount; - - while (yyi-- != 0) - *yyt++ = *yyf++; -} -# endif -#endif - #ifdef YYERROR_VERBOSE # ifndef yystrlen @@ -1129,7 +1104,7 @@ # endif #endif -#line 341 "/usr/share/bison/bison.simple" +#line 315 "/usr/share/bison/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed @@ -1139,13 +1114,13 @@ to the proper pointer type. */ #ifdef YYPARSE_PARAM -# ifdef __cplusplus +# if defined (__STDC__) || defined (__cplusplus) # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM # define YYPARSE_PARAM_DECL -# else /* !__cplusplus */ +# else # define YYPARSE_PARAM_ARG YYPARSE_PARAM # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -# endif /* !__cplusplus */ +# endif #else /* !YYPARSE_PARAM */ # define YYPARSE_PARAM_ARG # define YYPARSE_PARAM_DECL @@ -1319,6 +1294,9 @@ yyvs = yyvs1; } #else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) goto yyoverflowlab; @@ -1332,15 +1310,16 @@ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyoverflowlab; - YYSTACK_RELOCATE (short, yyss); - YYSTACK_RELOCATE (YYSTYPE, yyvs); + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); # if YYLSP_NEEDED - YYSTACK_RELOCATE (YYLTYPE, yyls); + YYSTACK_RELOCATE (yyls); # endif # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } +# endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; @@ -1519,26 +1498,23 @@ switch (yyn) { case 17: -#line 175 "rcparse.y" +#line 177 "rcparse.y" { + define_accelerator (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].pacc); + if (yychar != YYEMPTY) + YYERROR; rcparse_discard_strings (); } break; case 18: -#line 184 "rcparse.y" +#line 187 "rcparse.y" { - define_accelerator (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].pacc); + yyval.pacc = NULL; } break; case 19: #line 191 "rcparse.y" { - yyval.pacc = NULL; - } - break; -case 20: -#line 195 "rcparse.y" -{ struct accelerator *a; a = (struct accelerator *) res_alloc (sizeof *a); @@ -1556,15 +1532,15 @@ } } break; -case 21: -#line 216 "rcparse.y" +case 20: +#line 212 "rcparse.y" { yyval.acc = yyvsp[-1].acc; yyval.acc.id = yyvsp[0].il; } break; -case 22: -#line 221 "rcparse.y" +case 21: +#line 217 "rcparse.y" { yyval.acc = yyvsp[-3].acc; yyval.acc.id = yyvsp[-2].il; @@ -1574,8 +1550,8 @@ rcparse_warning (_("inappropriate modifiers for non-VIRTKEY")); } break; -case 23: -#line 233 "rcparse.y" +case 22: +#line 229 "rcparse.y" { const char *s = yyvsp[0].s; char ch; @@ -1597,8 +1573,8 @@ rcparse_warning (_("accelerator should only be one character")); } break; -case 24: -#line 254 "rcparse.y" +case 23: +#line 250 "rcparse.y" { yyval.acc.next = NULL; yyval.acc.flags = 0; @@ -1606,75 +1582,81 @@ yyval.acc.key = yyvsp[0].il; } break; +case 24: +#line 260 "rcparse.y" +{ + yyval.is = yyvsp[0].is; + } + break; case 25: #line 264 "rcparse.y" { - yyval.is = yyvsp[0].is; + yyval.is = yyvsp[-2].is | yyvsp[0].is; } break; case 26: -#line 268 "rcparse.y" +#line 269 "rcparse.y" { - yyval.is = yyvsp[-2].is | yyvsp[0].is; + yyval.is = yyvsp[-1].is | yyvsp[0].is; } break; case 27: -#line 273 "rcparse.y" +#line 276 "rcparse.y" { - yyval.is = yyvsp[-1].is | yyvsp[0].is; + yyval.is = ACC_VIRTKEY; } break; case 28: #line 280 "rcparse.y" { - yyval.is = ACC_VIRTKEY; + /* This is just the absence of VIRTKEY. */ + yyval.is = 0; } break; case 29: -#line 284 "rcparse.y" +#line 285 "rcparse.y" { - /* This is just the absence of VIRTKEY. */ - yyval.is = 0; + yyval.is = ACC_NOINVERT; } break; case 30: #line 289 "rcparse.y" { - yyval.is = ACC_NOINVERT; + yyval.is = ACC_SHIFT; } break; case 31: #line 293 "rcparse.y" { - yyval.is = ACC_SHIFT; + yyval.is = ACC_CONTROL; } break; case 32: #line 297 "rcparse.y" { - yyval.is = ACC_CONTROL; - } - break; -case 33: -#line 301 "rcparse.y" -{ yyval.is = ACC_ALT; } break; -case 34: -#line 310 "rcparse.y" +case 33: +#line 306 "rcparse.y" { define_bitmap (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 35: -#line 319 "rcparse.y" +case 34: +#line 318 "rcparse.y" { define_cursor (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 36: -#line 329 "rcparse.y" +case 35: +#line 331 "rcparse.y" { memset (&dialog, 0, sizeof dialog); dialog.x = yyvsp[-3].il; @@ -1689,16 +1671,20 @@ dialog.ex = NULL; dialog.controls = NULL; sub_res_info = yyvsp[-5].res_info; + style = 0; } break; -case 37: -#line 345 "rcparse.y" +case 36: +#line 348 "rcparse.y" { define_dialog (yyvsp[-12].id, &sub_res_info, &dialog); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 38: -#line 350 "rcparse.y" +case 37: +#line 356 "rcparse.y" { memset (&dialog, 0, sizeof dialog); dialog.x = yyvsp[-3].il; @@ -1715,16 +1701,20 @@ memset (dialog.ex, 0, sizeof (struct dialog_ex)); dialog.controls = NULL; sub_res_info = yyvsp[-5].res_info; + style = 0; } break; -case 39: -#line 368 "rcparse.y" +case 38: +#line 375 "rcparse.y" { define_dialog (yyvsp[-12].id, &sub_res_info, &dialog); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 40: -#line 373 "rcparse.y" +case 39: +#line 383 "rcparse.y" { memset (&dialog, 0, sizeof dialog); dialog.x = yyvsp[-4].il; @@ -1742,66 +1732,99 @@ dialog.ex->help = yyvsp[0].il; dialog.controls = NULL; sub_res_info = yyvsp[-6].res_info; + style = 0; } break; -case 41: -#line 392 "rcparse.y" +case 40: +#line 403 "rcparse.y" { define_dialog (yyvsp[-13].id, &sub_res_info, &dialog); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 42: -#line 399 "rcparse.y" +case 41: +#line 413 "rcparse.y" { yyval.il = 0; } break; -case 43: -#line 403 "rcparse.y" +case 42: +#line 417 "rcparse.y" { yyval.il = yyvsp[0].il; } break; -case 45: -#line 411 "rcparse.y" +case 44: +#line 425 "rcparse.y" { + dialog.style |= WS_CAPTION; + style |= WS_CAPTION; unicode_from_ascii ((int *) NULL, &dialog.caption, yyvsp[0].s); } break; -case 46: -#line 415 "rcparse.y" +case 45: +#line 431 "rcparse.y" { dialog.class = yyvsp[0].id; } break; +case 46: +#line 436 "rcparse.y" +{ + dialog.style = style; + } + break; case 47: -#line 419 "rcparse.y" -{ style = dialog.style; } +#line 440 "rcparse.y" +{ + dialog.exstyle = yyvsp[0].il; + } break; case 48: -#line 421 "rcparse.y" +#line 444 "rcparse.y" { - dialog.style = style; + res_string_to_id (& dialog.class, yyvsp[0].s); } break; case 49: -#line 425 "rcparse.y" +#line 448 "rcparse.y" { - dialog.exstyle = yyvsp[0].il; + dialog.style |= DS_SETFONT; + style |= DS_SETFONT; + dialog.pointsize = yyvsp[-2].il; + unicode_from_ascii ((int *) NULL, &dialog.font, yyvsp[0].s); + if (dialog.ex != NULL) + { + dialog.ex->weight = 0; + dialog.ex->italic = 0; + dialog.ex->charset = 1; + } } break; case 50: -#line 429 "rcparse.y" +#line 461 "rcparse.y" { dialog.style |= DS_SETFONT; - dialog.pointsize = yyvsp[-2].il; - unicode_from_ascii ((int *) NULL, &dialog.font, yyvsp[0].s); + style |= DS_SETFONT; + dialog.pointsize = yyvsp[-3].il; + unicode_from_ascii ((int *) NULL, &dialog.font, yyvsp[-1].s); + if (dialog.ex == NULL) + rcparse_warning (_("extended FONT requires DIALOGEX")); + else + { + dialog.ex->weight = yyvsp[0].il; + dialog.ex->italic = 0; + dialog.ex->charset = 1; + } } break; case 51: -#line 435 "rcparse.y" +#line 476 "rcparse.y" { dialog.style |= DS_SETFONT; + style |= DS_SETFONT; dialog.pointsize = yyvsp[-4].il; unicode_from_ascii ((int *) NULL, &dialog.font, yyvsp[-2].s); if (dialog.ex == NULL) @@ -1810,35 +1833,53 @@ { dialog.ex->weight = yyvsp[-1].il; dialog.ex->italic = yyvsp[0].il; + dialog.ex->charset = 1; } } break; case 52: -#line 448 "rcparse.y" +#line 491 "rcparse.y" { - dialog.menu = yyvsp[0].id; + dialog.style |= DS_SETFONT; + style |= DS_SETFONT; + dialog.pointsize = yyvsp[-5].il; + unicode_from_ascii ((int *) NULL, &dialog.font, yyvsp[-3].s); + if (dialog.ex == NULL) + rcparse_warning (_("extended FONT requires DIALOGEX")); + else + { + dialog.ex->weight = yyvsp[-2].il; + dialog.ex->italic = yyvsp[-1].il; + dialog.ex->charset = yyvsp[0].il; + } } break; case 53: -#line 452 "rcparse.y" +#line 506 "rcparse.y" { - sub_res_info.characteristics = yyvsp[0].il; + dialog.menu = yyvsp[0].id; } break; case 54: -#line 456 "rcparse.y" +#line 510 "rcparse.y" { - sub_res_info.language = yyvsp[-1].il | (yyvsp[0].il << SUBLANG_SHIFT); + sub_res_info.characteristics = yyvsp[0].il; } break; case 55: -#line 460 "rcparse.y" +#line 514 "rcparse.y" +{ + sub_res_info.language = yyvsp[-1].il | (yyvsp[0].il << SUBLANG_SHIFT); + } + break; +case 56: +#line 518 "rcparse.y" { sub_res_info.version = yyvsp[0].il; } break; -case 57: -#line 468 "rcparse.y" +case 58: +#line 526 "rcparse.y" { struct dialog_control **pp; @@ -1847,95 +1888,95 @@ *pp = yyvsp[0].dialog_control; } break; -case 58: -#line 479 "rcparse.y" +case 59: +#line 537 "rcparse.y" { default_style = BS_AUTO3STATE | WS_TABSTOP; base_style = BS_AUTO3STATE; class = CTL_BUTTON; } break; -case 59: -#line 485 "rcparse.y" +case 60: +#line 543 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 60: -#line 489 "rcparse.y" +case 61: +#line 547 "rcparse.y" { default_style = BS_AUTOCHECKBOX | WS_TABSTOP; base_style = BS_AUTOCHECKBOX; class = CTL_BUTTON; } break; -case 61: -#line 495 "rcparse.y" +case 62: +#line 553 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 62: -#line 499 "rcparse.y" +case 63: +#line 557 "rcparse.y" { default_style = BS_AUTORADIOBUTTON | WS_TABSTOP; base_style = BS_AUTORADIOBUTTON; class = CTL_BUTTON; } break; -case 63: -#line 505 "rcparse.y" +case 64: +#line 563 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 64: -#line 509 "rcparse.y" +case 65: +#line 567 "rcparse.y" { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; } break; -case 65: -#line 515 "rcparse.y" +case 66: +#line 573 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; if (dialog.ex == NULL) - rcparse_warning (_("IEDIT requires DIALOGEX")); + rcparse_warning (_("BEDIT requires DIALOGEX")); res_string_to_id (&yyval.dialog_control->class, "BEDIT"); } break; -case 66: -#line 522 "rcparse.y" +case 67: +#line 580 "rcparse.y" { default_style = BS_CHECKBOX | WS_TABSTOP; base_style = BS_CHECKBOX | WS_TABSTOP; class = CTL_BUTTON; } break; -case 67: -#line 528 "rcparse.y" +case 68: +#line 586 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 68: -#line 532 "rcparse.y" +case 69: +#line 590 "rcparse.y" { default_style = CBS_SIMPLE | WS_TABSTOP; base_style = 0; class = CTL_COMBOBOX; } break; -case 69: -#line 538 "rcparse.y" +case 70: +#line 596 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 70: -#line 543 "rcparse.y" +case 71: +#line 601 "rcparse.y" { yyval.dialog_control = define_control (yyvsp[-9].s, yyvsp[-8].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-7].il, style, yyvsp[-1].il); if (yyvsp[0].rcdata_item != NULL) @@ -1946,8 +1987,8 @@ } } break; -case 71: -#line 554 "rcparse.y" +case 72: +#line 612 "rcparse.y" { yyval.dialog_control = define_control (yyvsp[-10].s, yyvsp[-9].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-8].il, style, yyvsp[-2].il); if (dialog.ex == NULL) @@ -1956,8 +1997,8 @@ yyval.dialog_control->data = yyvsp[0].rcdata_item; } break; -case 72: -#line 563 "rcparse.y" +case 73: +#line 621 "rcparse.y" { yyval.dialog_control = define_control (yyvsp[-10].s, yyvsp[-9].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, 0, style, yyvsp[-1].il); if (yyvsp[0].rcdata_item != NULL) @@ -1967,11 +2008,11 @@ yyval.dialog_control->data = yyvsp[0].rcdata_item; } yyval.dialog_control->class.named = 1; - unicode_from_ascii(&yyval.dialog_control->class.u.n.length, &yyval.dialog_control->class.u.n.name, yyvsp[-7].s); + unicode_from_ascii (&yyval.dialog_control->class.u.n.length, &yyval.dialog_control->class.u.n.name, yyvsp[-7].s); } break; -case 73: -#line 576 "rcparse.y" +case 74: +#line 634 "rcparse.y" { yyval.dialog_control = define_control (yyvsp[-11].s, yyvsp[-10].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, 0, style, yyvsp[-2].il); if (dialog.ex == NULL) @@ -1979,75 +2020,75 @@ yyval.dialog_control->help = yyvsp[-1].il; yyval.dialog_control->data = yyvsp[0].rcdata_item; yyval.dialog_control->class.named = 1; - unicode_from_ascii(&yyval.dialog_control->class.u.n.length, &yyval.dialog_control->class.u.n.name, yyvsp[-8].s); + unicode_from_ascii (&yyval.dialog_control->class.u.n.length, &yyval.dialog_control->class.u.n.name, yyvsp[-8].s); } break; -case 74: -#line 586 "rcparse.y" +case 75: +#line 644 "rcparse.y" { default_style = SS_CENTER | WS_GROUP; base_style = SS_CENTER; class = CTL_STATIC; } break; -case 75: -#line 592 "rcparse.y" +case 76: +#line 650 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 76: -#line 596 "rcparse.y" +case 77: +#line 654 "rcparse.y" { default_style = BS_DEFPUSHBUTTON | WS_TABSTOP; base_style = BS_DEFPUSHBUTTON | WS_TABSTOP; class = CTL_BUTTON; } break; -case 77: -#line 602 "rcparse.y" +case 78: +#line 660 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 78: -#line 606 "rcparse.y" +case 79: +#line 664 "rcparse.y" { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; } break; -case 79: -#line 612 "rcparse.y" +case 80: +#line 670 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 80: -#line 616 "rcparse.y" +case 81: +#line 674 "rcparse.y" { default_style = BS_GROUPBOX; base_style = BS_GROUPBOX; class = CTL_BUTTON; } break; -case 81: -#line 622 "rcparse.y" +case 82: +#line 680 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 82: -#line 626 "rcparse.y" +case 83: +#line 684 "rcparse.y" { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; } break; -case 83: -#line 632 "rcparse.y" +case 84: +#line 690 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; if (dialog.ex == NULL) @@ -2055,44 +2096,44 @@ res_string_to_id (&yyval.dialog_control->class, "HEDIT"); } break; -case 84: -#line 639 "rcparse.y" +case 85: +#line 697 "rcparse.y" { yyval.dialog_control = define_icon_control (yyvsp[-4].id, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-1].il, 0, 0, 0, yyvsp[0].rcdata_item, dialog.ex); } break; -case 85: -#line 645 "rcparse.y" +case 86: +#line 703 "rcparse.y" { yyval.dialog_control = define_icon_control (yyvsp[-6].id, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, 0, 0, 0, yyvsp[0].rcdata_item, dialog.ex); } break; -case 86: -#line 651 "rcparse.y" +case 87: +#line 709 "rcparse.y" { yyval.dialog_control = define_icon_control (yyvsp[-8].id, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, style, yyvsp[-1].il, 0, yyvsp[0].rcdata_item, dialog.ex); } break; -case 87: -#line 657 "rcparse.y" +case 88: +#line 715 "rcparse.y" { yyval.dialog_control = define_icon_control (yyvsp[-9].id, yyvsp[-8].il, yyvsp[-7].il, yyvsp[-6].il, style, yyvsp[-2].il, yyvsp[-1].il, yyvsp[0].rcdata_item, dialog.ex); } break; -case 88: -#line 662 "rcparse.y" +case 89: +#line 720 "rcparse.y" { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; } break; -case 89: -#line 668 "rcparse.y" +case 90: +#line 726 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; if (dialog.ex == NULL) @@ -2100,131 +2141,131 @@ res_string_to_id (&yyval.dialog_control->class, "IEDIT"); } break; -case 90: -#line 675 "rcparse.y" +case 91: +#line 733 "rcparse.y" { default_style = LBS_NOTIFY | WS_BORDER; base_style = LBS_NOTIFY | WS_BORDER; class = CTL_LISTBOX; } break; -case 91: -#line 681 "rcparse.y" +case 92: +#line 739 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 92: -#line 685 "rcparse.y" +case 93: +#line 743 "rcparse.y" { default_style = SS_LEFT | WS_GROUP; base_style = SS_LEFT; class = CTL_STATIC; } break; -case 93: -#line 691 "rcparse.y" +case 94: +#line 749 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 94: -#line 695 "rcparse.y" +case 95: +#line 753 "rcparse.y" { default_style = BS_PUSHBOX | WS_TABSTOP; base_style = BS_PUSHBOX; class = CTL_BUTTON; } break; -case 95: -#line 701 "rcparse.y" +case 96: +#line 759 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 96: -#line 705 "rcparse.y" +case 97: +#line 763 "rcparse.y" { default_style = BS_PUSHBUTTON | WS_TABSTOP; base_style = BS_PUSHBUTTON | WS_TABSTOP; class = CTL_BUTTON; } break; -case 97: -#line 711 "rcparse.y" +case 98: +#line 769 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 98: -#line 715 "rcparse.y" +case 99: +#line 773 "rcparse.y" { default_style = BS_RADIOBUTTON | WS_TABSTOP; base_style = BS_RADIOBUTTON; class = CTL_BUTTON; } break; -case 99: -#line 721 "rcparse.y" +case 100: +#line 779 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 100: -#line 725 "rcparse.y" +case 101: +#line 783 "rcparse.y" { default_style = SS_RIGHT | WS_GROUP; base_style = SS_RIGHT; class = CTL_STATIC; } break; -case 101: -#line 731 "rcparse.y" +case 102: +#line 789 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 102: -#line 735 "rcparse.y" +case 103: +#line 793 "rcparse.y" { default_style = SBS_HORZ; base_style = 0; class = CTL_SCROLLBAR; } break; -case 103: -#line 741 "rcparse.y" +case 104: +#line 799 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 104: -#line 745 "rcparse.y" +case 105: +#line 803 "rcparse.y" { default_style = BS_3STATE | WS_TABSTOP; base_style = BS_3STATE; class = CTL_BUTTON; } break; -case 105: -#line 751 "rcparse.y" +case 106: +#line 809 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; -case 106: -#line 756 "rcparse.y" +case 107: +#line 814 "rcparse.y" { style = WS_CHILD | WS_VISIBLE; } break; -case 107: -#line 758 "rcparse.y" +case 108: +#line 816 "rcparse.y" { yyval.dialog_control = define_control (yyvsp[-14].s, yyvsp[-12].il, yyvsp[-10].il, yyvsp[-8].il, yyvsp[-6].il, yyvsp[-4].il, CTL_BUTTON, style, yyvsp[0].il); } break; -case 108: -#line 774 "rcparse.y" +case 109: +#line 832 "rcparse.y" { yyval.dialog_control = define_control (yyvsp[-6].s, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-1].il, class, default_style | WS_CHILD | WS_VISIBLE, 0); @@ -2236,8 +2277,8 @@ } } break; -case 109: -#line 786 "rcparse.y" +case 110: +#line 844 "rcparse.y" { yyval.dialog_control = define_control (yyvsp[-8].s, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, class, style, yyvsp[-1].il); if (yyvsp[0].rcdata_item != NULL) @@ -2248,8 +2289,8 @@ } } break; -case 110: -#line 797 "rcparse.y" +case 111: +#line 855 "rcparse.y" { yyval.dialog_control = define_control (yyvsp[-9].s, yyvsp[-8].il, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, class, style, yyvsp[-2].il); if (dialog.ex == NULL) @@ -2258,80 +2299,89 @@ yyval.dialog_control->data = yyvsp[0].rcdata_item; } break; -case 111: -#line 808 "rcparse.y" +case 112: +#line 866 "rcparse.y" { yyval.s = NULL; } break; -case 112: -#line 812 "rcparse.y" +case 113: +#line 870 "rcparse.y" { yyval.s = yyvsp[0].s; } break; -case 113: -#line 816 "rcparse.y" +case 114: +#line 874 "rcparse.y" { yyval.s = yyvsp[-1].s; } break; -case 114: -#line 823 "rcparse.y" +case 115: +#line 881 "rcparse.y" { yyval.rcdata_item = NULL; } break; -case 115: -#line 827 "rcparse.y" +case 116: +#line 885 "rcparse.y" { yyval.rcdata_item = yyvsp[-1].rcdata.first; } break; -case 116: -#line 836 "rcparse.y" +case 117: +#line 894 "rcparse.y" { style = WS_CHILD | WS_VISIBLE; } break; -case 118: -#line 842 "rcparse.y" +case 119: +#line 900 "rcparse.y" { style = SS_ICON | WS_CHILD | WS_VISIBLE; } break; -case 120: -#line 848 "rcparse.y" +case 121: +#line 906 "rcparse.y" { style = base_style | WS_CHILD | WS_VISIBLE; } break; -case 122: -#line 856 "rcparse.y" +case 123: +#line 914 "rcparse.y" { define_font (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 123: -#line 865 "rcparse.y" +case 124: +#line 926 "rcparse.y" { define_icon (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 124: -#line 875 "rcparse.y" +case 125: +#line 939 "rcparse.y" { language = yyvsp[-1].il | (yyvsp[0].il << SUBLANG_SHIFT); } break; -case 125: -#line 884 "rcparse.y" +case 126: +#line 948 "rcparse.y" { define_menu (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].menuitem); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 126: -#line 891 "rcparse.y" +case 127: +#line 958 "rcparse.y" { yyval.menuitem = NULL; } break; -case 127: -#line 895 "rcparse.y" +case 128: +#line 962 "rcparse.y" { if (yyvsp[-1].menuitem == NULL) yyval.menuitem = yyvsp[0].menuitem; @@ -2346,92 +2396,95 @@ } } break; -case 128: -#line 912 "rcparse.y" +case 129: +#line 979 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-2].s, yyvsp[-1].il, yyvsp[0].is, 0, 0, NULL); } break; -case 129: -#line 916 "rcparse.y" +case 130: +#line 983 "rcparse.y" { yyval.menuitem = define_menuitem (NULL, 0, 0, 0, 0, NULL); } break; -case 130: -#line 920 "rcparse.y" +case 131: +#line 987 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-4].s, 0, yyvsp[-3].is, 0, 0, yyvsp[-1].menuitem); } break; -case 131: -#line 927 "rcparse.y" +case 132: +#line 994 "rcparse.y" { yyval.is = 0; } break; -case 132: -#line 931 "rcparse.y" +case 133: +#line 998 "rcparse.y" { yyval.is = yyvsp[-2].is | yyvsp[0].is; } break; -case 133: -#line 935 "rcparse.y" +case 134: +#line 1002 "rcparse.y" { yyval.is = yyvsp[-1].is | yyvsp[0].is; } break; -case 134: -#line 942 "rcparse.y" +case 135: +#line 1009 "rcparse.y" { yyval.is = MENUITEM_CHECKED; } break; -case 135: -#line 946 "rcparse.y" +case 136: +#line 1013 "rcparse.y" { yyval.is = MENUITEM_GRAYED; } break; -case 136: -#line 950 "rcparse.y" +case 137: +#line 1017 "rcparse.y" { yyval.is = MENUITEM_HELP; } break; -case 137: -#line 954 "rcparse.y" +case 138: +#line 1021 "rcparse.y" { yyval.is = MENUITEM_INACTIVE; } break; -case 138: -#line 958 "rcparse.y" +case 139: +#line 1025 "rcparse.y" { yyval.is = MENUITEM_MENUBARBREAK; } break; -case 139: -#line 962 "rcparse.y" +case 140: +#line 1029 "rcparse.y" { yyval.is = MENUITEM_MENUBREAK; } break; -case 140: -#line 971 "rcparse.y" +case 141: +#line 1038 "rcparse.y" { define_menu (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].menuitem); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 141: -#line 978 "rcparse.y" +case 142: +#line 1048 "rcparse.y" { yyval.menuitem = NULL; } break; -case 142: -#line 982 "rcparse.y" +case 143: +#line 1052 "rcparse.y" { if (yyvsp[-1].menuitem == NULL) yyval.menuitem = yyvsp[0].menuitem; @@ -2446,94 +2499,100 @@ } } break; -case 143: -#line 999 "rcparse.y" +case 144: +#line 1069 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[0].s, 0, 0, 0, 0, NULL); } break; -case 144: -#line 1003 "rcparse.y" +case 145: +#line 1073 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-1].s, yyvsp[0].il, 0, 0, 0, NULL); } break; -case 145: -#line 1007 "rcparse.y" +case 146: +#line 1077 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-3].s, yyvsp[-2].il, yyvsp[-1].il, yyvsp[0].il, 0, NULL); } break; -case 146: -#line 1011 "rcparse.y" +case 147: +#line 1081 "rcparse.y" { yyval.menuitem = define_menuitem (NULL, 0, 0, 0, 0, NULL); } break; -case 147: -#line 1015 "rcparse.y" +case 148: +#line 1085 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-3].s, 0, 0, 0, 0, yyvsp[-1].menuitem); } break; -case 148: -#line 1019 "rcparse.y" +case 149: +#line 1089 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-4].s, yyvsp[-3].il, 0, 0, 0, yyvsp[-1].menuitem); } break; -case 149: -#line 1023 "rcparse.y" +case 150: +#line 1093 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-5].s, yyvsp[-4].il, yyvsp[-3].il, 0, 0, yyvsp[-1].menuitem); } break; -case 150: -#line 1028 "rcparse.y" +case 151: +#line 1098 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-7].s, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-1].menuitem); } break; -case 151: -#line 1037 "rcparse.y" +case 152: +#line 1107 "rcparse.y" { define_messagetable (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 152: -#line 1046 "rcparse.y" +case 153: +#line 1119 "rcparse.y" { define_rcdata (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].rcdata.first); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 153: -#line 1055 "rcparse.y" +case 154: +#line 1131 "rcparse.y" { rcparse_rcdata (); } break; -case 154: -#line 1059 "rcparse.y" +case 155: +#line 1135 "rcparse.y" { rcparse_normal (); yyval.rcdata = yyvsp[0].rcdata; } break; -case 155: -#line 1067 "rcparse.y" +case 156: +#line 1143 "rcparse.y" { yyval.rcdata.first = NULL; yyval.rcdata.last = NULL; } break; -case 156: -#line 1072 "rcparse.y" +case 157: +#line 1148 "rcparse.y" { yyval.rcdata = yyvsp[0].rcdata; } break; -case 157: -#line 1079 "rcparse.y" +case 158: +#line 1155 "rcparse.y" { struct rcdata_item *ri; @@ -2542,8 +2601,8 @@ yyval.rcdata.last = ri; } break; -case 158: -#line 1087 "rcparse.y" +case 159: +#line 1163 "rcparse.y" { struct rcdata_item *ri; @@ -2552,8 +2611,8 @@ yyval.rcdata.last = ri; } break; -case 159: -#line 1095 "rcparse.y" +case 160: +#line 1171 "rcparse.y" { struct rcdata_item *ri; @@ -2563,8 +2622,8 @@ yyval.rcdata.last = ri; } break; -case 160: -#line 1104 "rcparse.y" +case 161: +#line 1180 "rcparse.y" { struct rcdata_item *ri; @@ -2574,150 +2633,165 @@ yyval.rcdata.last = ri; } break; -case 161: -#line 1118 "rcparse.y" +case 162: +#line 1194 "rcparse.y" { sub_res_info = yyvsp[-1].res_info; } break; -case 164: -#line 1125 "rcparse.y" +case 165: +#line 1201 "rcparse.y" { define_stringtable (&sub_res_info, yyvsp[-1].il, yyvsp[0].s); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 165: -#line 1129 "rcparse.y" +case 166: +#line 1208 "rcparse.y" { define_stringtable (&sub_res_info, yyvsp[-2].il, yyvsp[0].s); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 166: -#line 1139 "rcparse.y" +case 167: +#line 1221 "rcparse.y" { define_user_data (yyvsp[-5].id, yyvsp[-4].id, &yyvsp[-3].res_info, yyvsp[-1].rcdata.first); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 167: -#line 1143 "rcparse.y" +case 168: +#line 1228 "rcparse.y" { define_user_file (yyvsp[-3].id, yyvsp[-2].id, &yyvsp[-1].res_info, yyvsp[0].s); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 168: -#line 1152 "rcparse.y" +case 169: +#line 1240 "rcparse.y" { define_versioninfo (yyvsp[-5].id, language, yyvsp[-3].fixver, yyvsp[-1].verinfo); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } break; -case 169: -#line 1159 "rcparse.y" +case 170: +#line 1250 "rcparse.y" { yyval.fixver = ((struct fixed_versioninfo *) res_alloc (sizeof (struct fixed_versioninfo))); memset (yyval.fixver, 0, sizeof (struct fixed_versioninfo)); } break; -case 170: -#line 1165 "rcparse.y" +case 171: +#line 1256 "rcparse.y" { yyvsp[-5].fixver->file_version_ms = (yyvsp[-3].il << 16) | yyvsp[-2].il; yyvsp[-5].fixver->file_version_ls = (yyvsp[-1].il << 16) | yyvsp[0].il; yyval.fixver = yyvsp[-5].fixver; } break; -case 171: -#line 1171 "rcparse.y" +case 172: +#line 1262 "rcparse.y" { yyvsp[-5].fixver->product_version_ms = (yyvsp[-3].il << 16) | yyvsp[-2].il; yyvsp[-5].fixver->product_version_ls = (yyvsp[-1].il << 16) | yyvsp[0].il; yyval.fixver = yyvsp[-5].fixver; } break; -case 172: -#line 1177 "rcparse.y" +case 173: +#line 1268 "rcparse.y" { yyvsp[-2].fixver->file_flags_mask = yyvsp[0].il; yyval.fixver = yyvsp[-2].fixver; } break; -case 173: -#line 1182 "rcparse.y" +case 174: +#line 1273 "rcparse.y" { yyvsp[-2].fixver->file_flags = yyvsp[0].il; yyval.fixver = yyvsp[-2].fixver; } break; -case 174: -#line 1187 "rcparse.y" +case 175: +#line 1278 "rcparse.y" { yyvsp[-2].fixver->file_os = yyvsp[0].il; yyval.fixver = yyvsp[-2].fixver; } break; -case 175: -#line 1192 "rcparse.y" +case 176: +#line 1283 "rcparse.y" { yyvsp[-2].fixver->file_type = yyvsp[0].il; yyval.fixver = yyvsp[-2].fixver; } break; -case 176: -#line 1197 "rcparse.y" +case 177: +#line 1288 "rcparse.y" { yyvsp[-2].fixver->file_subtype = yyvsp[0].il; yyval.fixver = yyvsp[-2].fixver; } break; -case 177: -#line 1211 "rcparse.y" +case 178: +#line 1302 "rcparse.y" { yyval.verinfo = NULL; } break; -case 178: -#line 1215 "rcparse.y" +case 179: +#line 1306 "rcparse.y" { yyval.verinfo = append_ver_stringfileinfo (yyvsp[-7].verinfo, yyvsp[-4].s, yyvsp[-2].verstring); } break; -case 179: -#line 1219 "rcparse.y" +case 180: +#line 1310 "rcparse.y" { yyval.verinfo = append_ver_varfileinfo (yyvsp[-6].verinfo, yyvsp[-2].s, yyvsp[-1].vervar); } break; -case 180: -#line 1226 "rcparse.y" +case 181: +#line 1317 "rcparse.y" { yyval.verstring = NULL; } break; -case 181: -#line 1230 "rcparse.y" +case 182: +#line 1321 "rcparse.y" { yyval.verstring = append_verval (yyvsp[-4].verstring, yyvsp[-2].s, yyvsp[0].s); } break; -case 182: -#line 1237 "rcparse.y" +case 183: +#line 1328 "rcparse.y" { yyval.vervar = NULL; } break; -case 183: -#line 1241 "rcparse.y" +case 184: +#line 1332 "rcparse.y" { yyval.vervar = append_vertrans (yyvsp[-2].vervar, yyvsp[-1].il, yyvsp[0].il); } break; -case 184: -#line 1250 "rcparse.y" +case 185: +#line 1341 "rcparse.y" { yyval.id.named = 0; yyval.id.u.id = yyvsp[0].il; } break; -case 185: -#line 1255 "rcparse.y" +case 186: +#line 1346 "rcparse.y" { char *copy, *s; @@ -2729,33 +2803,33 @@ free (copy); } break; -case 186: -#line 1271 "rcparse.y" +case 187: +#line 1362 "rcparse.y" { yyval.s = yyvsp[0].s; } break; -case 187: -#line 1275 "rcparse.y" +case 188: +#line 1366 "rcparse.y" { yyval.s = yyvsp[-1].s; } break; -case 188: -#line 1279 "rcparse.y" +case 189: +#line 1370 "rcparse.y" { yyval.s = yyvsp[-1].s; } break; -case 189: -#line 1287 "rcparse.y" +case 190: +#line 1378 "rcparse.y" { yyval.id.named = 0; yyval.id.u.id = yyvsp[-1].il; } break; -case 190: -#line 1292 "rcparse.y" +case 191: +#line 1383 "rcparse.y" { char *copy, *s; @@ -2767,361 +2841,361 @@ free (copy); } break; -case 191: -#line 1309 "rcparse.y" +case 192: +#line 1400 "rcparse.y" { memset (&yyval.res_info, 0, sizeof (struct res_res_info)); yyval.res_info.language = language; /* FIXME: Is this the right default? */ - yyval.res_info.memflags = MEMFLAG_MOVEABLE; + yyval.res_info.memflags = MEMFLAG_MOVEABLE | MEMFLAG_PURE | MEMFLAG_DISCARDABLE; } break; -case 192: -#line 1316 "rcparse.y" +case 193: +#line 1407 "rcparse.y" { yyval.res_info = yyvsp[-1].res_info; yyval.res_info.memflags |= yyvsp[0].memflags.on; yyval.res_info.memflags &=~ yyvsp[0].memflags.off; } break; -case 193: -#line 1322 "rcparse.y" +case 194: +#line 1413 "rcparse.y" { yyval.res_info = yyvsp[-2].res_info; yyval.res_info.characteristics = yyvsp[0].il; } break; -case 194: -#line 1327 "rcparse.y" +case 195: +#line 1418 "rcparse.y" { yyval.res_info = yyvsp[-3].res_info; yyval.res_info.language = yyvsp[-1].il | (yyvsp[0].il << SUBLANG_SHIFT); } break; -case 195: -#line 1332 "rcparse.y" +case 196: +#line 1423 "rcparse.y" { yyval.res_info = yyvsp[-2].res_info; yyval.res_info.version = yyvsp[0].il; } break; -case 196: -#line 1342 "rcparse.y" +case 197: +#line 1433 "rcparse.y" { memset (&yyval.res_info, 0, sizeof (struct res_res_info)); yyval.res_info.language = language; yyval.res_info.memflags = MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE; } break; -case 197: -#line 1348 "rcparse.y" +case 198: +#line 1439 "rcparse.y" { yyval.res_info = yyvsp[-1].res_info; yyval.res_info.memflags |= yyvsp[0].memflags.on; yyval.res_info.memflags &=~ yyvsp[0].memflags.off; } break; -case 198: -#line 1359 "rcparse.y" +case 199: +#line 1450 "rcparse.y" { memset (&yyval.res_info, 0, sizeof (struct res_res_info)); yyval.res_info.language = language; - yyval.res_info.memflags = MEMFLAG_MOVEABLE; + yyval.res_info.memflags = MEMFLAG_MOVEABLE | MEMFLAG_PURE | MEMFLAG_DISCARDABLE; } break; -case 199: -#line 1365 "rcparse.y" +case 200: +#line 1456 "rcparse.y" { yyval.res_info = yyvsp[-1].res_info; yyval.res_info.memflags |= yyvsp[0].memflags.on; yyval.res_info.memflags &=~ yyvsp[0].memflags.off; } break; -case 200: -#line 1377 "rcparse.y" +case 201: +#line 1468 "rcparse.y" { yyval.memflags.on = MEMFLAG_MOVEABLE; yyval.memflags.off = 0; } break; -case 201: -#line 1382 "rcparse.y" +case 202: +#line 1473 "rcparse.y" { yyval.memflags.on = 0; yyval.memflags.off = MEMFLAG_MOVEABLE; } break; -case 202: -#line 1387 "rcparse.y" +case 203: +#line 1478 "rcparse.y" { yyval.memflags.on = MEMFLAG_PURE; yyval.memflags.off = 0; } break; -case 203: -#line 1392 "rcparse.y" +case 204: +#line 1483 "rcparse.y" { yyval.memflags.on = 0; yyval.memflags.off = MEMFLAG_PURE; } break; -case 204: -#line 1397 "rcparse.y" +case 205: +#line 1488 "rcparse.y" { yyval.memflags.on = MEMFLAG_PRELOAD; yyval.memflags.off = 0; } break; -case 205: -#line 1402 "rcparse.y" +case 206: +#line 1493 "rcparse.y" { yyval.memflags.on = 0; yyval.memflags.off = MEMFLAG_PRELOAD; } break; -case 206: -#line 1407 "rcparse.y" +case 207: +#line 1498 "rcparse.y" { yyval.memflags.on = MEMFLAG_DISCARDABLE; yyval.memflags.off = 0; } break; -case 207: -#line 1417 "rcparse.y" +case 208: +#line 1508 "rcparse.y" { yyval.s = yyvsp[0].s; } break; -case 208: -#line 1421 "rcparse.y" +case 209: +#line 1512 "rcparse.y" { yyval.s = yyvsp[0].s; } break; -case 209: -#line 1438 "rcparse.y" +case 210: +#line 1529 "rcparse.y" { style |= yyvsp[0].il; } break; -case 210: -#line 1442 "rcparse.y" +case 211: +#line 1533 "rcparse.y" { style &=~ yyvsp[0].il; } break; -case 211: -#line 1446 "rcparse.y" +case 212: +#line 1537 "rcparse.y" { style |= yyvsp[0].il; } break; -case 212: -#line 1450 "rcparse.y" +case 213: +#line 1541 "rcparse.y" { style &=~ yyvsp[0].il; } break; -case 213: -#line 1457 "rcparse.y" +case 214: +#line 1548 "rcparse.y" { yyval.il = yyvsp[0].i.val; } break; -case 214: -#line 1461 "rcparse.y" +case 215: +#line 1552 "rcparse.y" { yyval.il = yyvsp[-1].il; } break; -case 215: -#line 1470 "rcparse.y" +case 216: +#line 1561 "rcparse.y" { yyval.il = 0; } break; -case 216: -#line 1474 "rcparse.y" +case 217: +#line 1565 "rcparse.y" { yyval.il = yyvsp[0].il; } break; -case 217: -#line 1483 "rcparse.y" +case 218: +#line 1574 "rcparse.y" { yyval.il = yyvsp[0].il; } break; -case 218: -#line 1492 "rcparse.y" +case 219: +#line 1583 "rcparse.y" { yyval.il = yyvsp[0].i.val; } break; -case 219: -#line 1501 "rcparse.y" +case 220: +#line 1592 "rcparse.y" { yyval.i = yyvsp[0].i; } break; -case 220: -#line 1505 "rcparse.y" +case 221: +#line 1596 "rcparse.y" { yyval.i = yyvsp[-1].i; } break; -case 221: -#line 1509 "rcparse.y" +case 222: +#line 1600 "rcparse.y" { yyval.i.val = ~ yyvsp[0].i.val; yyval.i.dword = yyvsp[0].i.dword; } break; -case 222: -#line 1514 "rcparse.y" +case 223: +#line 1605 "rcparse.y" { yyval.i.val = - yyvsp[0].i.val; yyval.i.dword = yyvsp[0].i.dword; } break; -case 223: -#line 1519 "rcparse.y" +case 224: +#line 1610 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val * yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 224: -#line 1524 "rcparse.y" +case 225: +#line 1615 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val / yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 225: -#line 1529 "rcparse.y" +case 226: +#line 1620 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val % yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 226: -#line 1534 "rcparse.y" +case 227: +#line 1625 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val + yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 227: -#line 1539 "rcparse.y" +case 228: +#line 1630 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val - yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 228: -#line 1544 "rcparse.y" +case 229: +#line 1635 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val & yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 229: -#line 1549 "rcparse.y" +case 230: +#line 1640 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val ^ yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 230: -#line 1554 "rcparse.y" +case 231: +#line 1645 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val | yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 231: -#line 1565 "rcparse.y" +case 232: +#line 1656 "rcparse.y" { yyval.il = yyvsp[0].il; } break; -case 232: -#line 1574 "rcparse.y" +case 233: +#line 1665 "rcparse.y" { yyval.il = yyvsp[0].i.val; } break; -case 233: -#line 1585 "rcparse.y" +case 234: +#line 1676 "rcparse.y" { yyval.i = yyvsp[0].i; } break; -case 234: -#line 1589 "rcparse.y" +case 235: +#line 1680 "rcparse.y" { yyval.i = yyvsp[-1].i; } break; -case 235: -#line 1593 "rcparse.y" +case 236: +#line 1684 "rcparse.y" { yyval.i.val = ~ yyvsp[0].i.val; yyval.i.dword = yyvsp[0].i.dword; } break; -case 236: -#line 1598 "rcparse.y" +case 237: +#line 1689 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val * yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 237: -#line 1603 "rcparse.y" +case 238: +#line 1694 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val / yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 238: -#line 1608 "rcparse.y" +case 239: +#line 1699 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val % yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 239: -#line 1613 "rcparse.y" +case 240: +#line 1704 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val + yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 240: -#line 1618 "rcparse.y" +case 241: +#line 1709 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val - yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 241: -#line 1623 "rcparse.y" +case 242: +#line 1714 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val & yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 242: -#line 1628 "rcparse.y" +case 243: +#line 1719 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val ^ yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 243: -#line 1633 "rcparse.y" +case 244: +#line 1724 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val | yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; @@ -3129,7 +3203,7 @@ break; } -#line 727 "/usr/share/bison/bison.simple" +#line 705 "/usr/share/bison/bison.simple" yyvsp -= yylen; @@ -3360,7 +3434,7 @@ #endif return yyresult; } -#line 1639 "rcparse.y" +#line 1730 "rcparse.y" /* Set the language from the command line. */ diff -Nur binutils-2.12/binutils/rcparse.h binutils-2.12.1/binutils/rcparse.h --- binutils-2.12/binutils/rcparse.h Fri Mar 8 01:15:55 2002 +++ binutils-2.12.1/binutils/rcparse.h Mon May 13 09:14:44 2002 @@ -42,6 +42,7 @@ } ss; } yystype; # define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 #endif # define BEG 257 # define END 258 diff -Nur binutils-2.12/binutils/rcparse.y binutils-2.12.1/binutils/rcparse.y --- binutils-2.12/binutils/rcparse.y Wed Sep 19 01:33:16 2001 +++ binutils-2.12.1/binutils/rcparse.y Thu May 9 10:49:19 2002 @@ -1,5 +1,5 @@ %{ /* rcparse.y -- parser for Windows rc files - Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -153,28 +153,21 @@ input: /* empty */ - | input newcmd accelerator - | input newcmd bitmap - | input newcmd cursor - | input newcmd dialog - | input newcmd font - | input newcmd icon - | input newcmd language - | input newcmd menu - | input newcmd menuex - | input newcmd messagetable - | input newcmd rcdata - | input newcmd stringtable - | input newcmd user - | input newcmd versioninfo - | input newcmd IGNORED_TOKEN - ; - -newcmd: - /* empty */ - { - rcparse_discard_strings (); - } + | input accelerator + | input bitmap + | input cursor + | input dialog + | input font + | input icon + | input language + | input menu + | input menuex + | input messagetable + | input rcdata + | input stringtable + | input user + | input versioninfo + | input IGNORED_TOKEN ; /* Accelerator resources. */ @@ -183,6 +176,9 @@ id ACCELERATORS suboptions BEG acc_entries END { define_accelerator ($1, &$3, $5); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } ; @@ -309,6 +305,9 @@ id BITMAP memflags_move file_name { define_bitmap ($1, &$3, $4); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } ; @@ -318,6 +317,9 @@ id CURSOR memflags_move_discard file_name { define_cursor ($1, &$3, $4); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } ; @@ -340,10 +342,14 @@ dialog.ex = NULL; dialog.controls = NULL; sub_res_info = $3; + style = 0; } styles BEG controls END { define_dialog ($1, &sub_res_info, &dialog); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } | id DIALOGEX memflags_move exstyle posnumexpr cnumexpr cnumexpr cnumexpr @@ -363,10 +369,14 @@ memset (dialog.ex, 0, sizeof (struct dialog_ex)); dialog.controls = NULL; sub_res_info = $3; + style = 0; } styles BEG controls END { define_dialog ($1, &sub_res_info, &dialog); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } | id DIALOGEX memflags_move exstyle posnumexpr cnumexpr cnumexpr cnumexpr cnumexpr @@ -387,10 +397,14 @@ dialog.ex->help = $9; dialog.controls = NULL; sub_res_info = $3; + style = 0; } styles BEG controls END { define_dialog ($1, &sub_res_info, &dialog); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } ; @@ -409,6 +423,8 @@ /* empty */ | styles CAPTION QUOTEDSTRING { + dialog.style |= WS_CAPTION; + style |= WS_CAPTION; unicode_from_ascii ((int *) NULL, &dialog.caption, $3); } | styles CLASS id @@ -416,7 +432,6 @@ dialog.class = $3; } | styles STYLE - { style = dialog.style; } styleexpr { dialog.style = style; @@ -425,15 +440,57 @@ { dialog.exstyle = $3; } + | styles CLASS QUOTEDSTRING + { + res_string_to_id (& dialog.class, $3); + } | styles FONT numexpr ',' QUOTEDSTRING { dialog.style |= DS_SETFONT; + style |= DS_SETFONT; dialog.pointsize = $3; unicode_from_ascii ((int *) NULL, &dialog.font, $5); + if (dialog.ex != NULL) + { + dialog.ex->weight = 0; + dialog.ex->italic = 0; + dialog.ex->charset = 1; + } + } + | styles FONT numexpr ',' QUOTEDSTRING cnumexpr + { + dialog.style |= DS_SETFONT; + style |= DS_SETFONT; + dialog.pointsize = $3; + unicode_from_ascii ((int *) NULL, &dialog.font, $5); + if (dialog.ex == NULL) + rcparse_warning (_("extended FONT requires DIALOGEX")); + else + { + dialog.ex->weight = $6; + dialog.ex->italic = 0; + dialog.ex->charset = 1; + } } | styles FONT numexpr ',' QUOTEDSTRING cnumexpr cnumexpr { dialog.style |= DS_SETFONT; + style |= DS_SETFONT; + dialog.pointsize = $3; + unicode_from_ascii ((int *) NULL, &dialog.font, $5); + if (dialog.ex == NULL) + rcparse_warning (_("extended FONT requires DIALOGEX")); + else + { + dialog.ex->weight = $6; + dialog.ex->italic = $7; + dialog.ex->charset = 1; + } + } + | styles FONT numexpr ',' QUOTEDSTRING cnumexpr cnumexpr cnumexpr + { + dialog.style |= DS_SETFONT; + style |= DS_SETFONT; dialog.pointsize = $3; unicode_from_ascii ((int *) NULL, &dialog.font, $5); if (dialog.ex == NULL) @@ -442,6 +499,7 @@ { dialog.ex->weight = $6; dialog.ex->italic = $7; + dialog.ex->charset = $8; } } | styles MENU id @@ -515,7 +573,7 @@ { $$ = $3; if (dialog.ex == NULL) - rcparse_warning (_("IEDIT requires DIALOGEX")); + rcparse_warning (_("BEDIT requires DIALOGEX")); res_string_to_id (&$$->class, "BEDIT"); } | CHECKBOX @@ -569,7 +627,7 @@ $$->data = $12; } $$->class.named = 1; - unicode_from_ascii(&$$->class.u.n.length, &$$->class.u.n.name, $5); + unicode_from_ascii (&$$->class.u.n.length, &$$->class.u.n.name, $5); } | CONTROL optstringc numexpr ',' QUOTEDSTRING control_styleexpr cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr opt_control_data @@ -580,7 +638,7 @@ $$->help = $12; $$->data = $13; $$->class.named = 1; - unicode_from_ascii(&$$->class.u.n.length, &$$->class.u.n.name, $5); + unicode_from_ascii (&$$->class.u.n.length, &$$->class.u.n.name, $5); } | CTEXT { @@ -855,6 +913,9 @@ id FONT memflags_move_discard file_name { define_font ($1, &$3, $4); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } ; @@ -864,6 +925,9 @@ id ICON memflags_move_discard file_name { define_icon ($1, &$3, $4); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } ; @@ -883,6 +947,9 @@ id MENU suboptions BEG menuitems END { define_menu ($1, &$3, $5); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } ; @@ -970,6 +1037,9 @@ id MENUEX suboptions BEG menuexitems END { define_menu ($1, &$3, $5); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } ; @@ -1036,6 +1106,9 @@ id MESSAGETABLE memflags_move file_name { define_messagetable ($1, &$3, $4); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } ; @@ -1045,6 +1118,9 @@ id RCDATA suboptions BEG optrcdata_data END { define_rcdata ($1, &$3, $5.first); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } ; @@ -1124,10 +1200,16 @@ | string_data numexpr QUOTEDSTRING { define_stringtable (&sub_res_info, $2, $3); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } | string_data numexpr ',' QUOTEDSTRING { define_stringtable (&sub_res_info, $2, $4); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } ; @@ -1138,10 +1220,16 @@ id id suboptions BEG optrcdata_data END { define_user_data ($1, $2, &$3, $5.first); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } | id id suboptions file_name { define_user_file ($1, $2, &$3, $4); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } ; @@ -1151,6 +1239,9 @@ id VERSIONINFO fixedverinfo BEG verblocks END { define_versioninfo ($1, language, $3, $5); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); } ; @@ -1310,7 +1401,7 @@ memset (&$$, 0, sizeof (struct res_res_info)); $$.language = language; /* FIXME: Is this the right default? */ - $$.memflags = MEMFLAG_MOVEABLE; + $$.memflags = MEMFLAG_MOVEABLE | MEMFLAG_PURE | MEMFLAG_DISCARDABLE; } | suboptions memflag { @@ -1359,7 +1450,7 @@ { memset (&$$, 0, sizeof (struct res_res_info)); $$.language = language; - $$.memflags = MEMFLAG_MOVEABLE; + $$.memflags = MEMFLAG_MOVEABLE | MEMFLAG_PURE | MEMFLAG_DISCARDABLE; } | memflags_move memflag { diff -Nur binutils-2.12/binutils/readelf.c binutils-2.12.1/binutils/readelf.c --- binutils-2.12/binutils/readelf.c Wed Feb 13 14:16:42 2002 +++ binutils-2.12.1/binutils/readelf.c Thu May 9 10:49:20 2002 @@ -127,6 +127,7 @@ int do_debug_frames_interp; int do_debug_macinfo; int do_debug_str; +int do_debug_loc; int do_arch; int do_notes; int is_32bit_elf; @@ -227,10 +228,13 @@ static int display_debug_frames PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *)); static int display_debug_macinfo PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *)); static int display_debug_str PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *)); +static int display_debug_loc PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *)); static unsigned char * process_abbrev_section PARAMS ((unsigned char *, unsigned char *)); static void load_debug_str PARAMS ((FILE *)); static void free_debug_str PARAMS ((void)); static const char * fetch_indirect_string PARAMS ((unsigned long)); +static void load_debug_loc PARAMS ((FILE *)); +static void free_debug_loc PARAMS ((void)); static unsigned long read_leb128 PARAMS ((unsigned char *, int *, int)); static int process_extended_line_op PARAMS ((unsigned char *, int, int)); static void reset_state_machine PARAMS ((int)); @@ -845,29 +849,49 @@ if (is_32bit_elf) { if (is_rela) - printf - (_(" Offset Info Type Symbol's Value Symbol's Name Addend\n")); + { + if (do_wide) + printf (_(" Offset Info Type Sym. Value Symbol's Name + Addend\n")); + else + printf (_(" Offset Info Type Sym.Value Sym. Name + Addend\n")); + } else - printf - (_(" Offset Info Type Symbol's Value Symbol's Name\n")); + { + if (do_wide) + printf (_(" Offset Info Type Sym. Value Symbol's Name\n")); + else + printf (_(" Offset Info Type Sym.Value Sym. Name\n")); + } } else { if (is_rela) - printf - (_(" Offset Info Type Symbol's Value Symbol's Name Addend\n")); + { + if (do_wide) + printf (_(" Offset Info Type Symbol's Value Symbol's Name + Addend\n")); + else + printf (_(" Offset Info Type Sym. Value Sym. Name + Addend\n")); + } else - printf - (_(" Offset Info Type Symbol's Value Symbol's Name\n")); + { + if (do_wide) + printf (_(" Offset Info Type Symbol's Value Symbol's Name\n")); + else + printf (_(" Offset Info Type Sym. Value Sym. Name\n")); + } } for (i = 0; i < rel_size; i++) { const char * rtype; + const char * rtype2 = NULL; + const char * rtype3 = NULL; bfd_vma offset; bfd_vma info; bfd_vma symtab_index; bfd_vma type; + bfd_vma type2 = (bfd_vma) NULL; + bfd_vma type3 = (bfd_vma) NULL; if (is_rela) { @@ -887,10 +911,16 @@ } else { - if (elf_header.e_machine == EM_SPARCV9) - type = ELF64_R_TYPE_ID (info); + if (elf_header.e_machine == EM_MIPS) + { + type = ELF64_MIPS_R_TYPE (info); + type2 = ELF64_MIPS_R_TYPE2 (info); + type3 = ELF64_MIPS_R_TYPE3 (info); + } + else if (elf_header.e_machine == EM_SPARCV9) + type = ELF64_R_TYPE_ID (info); else - type = ELF64_R_TYPE (info); + type = ELF64_R_TYPE (info); /* The #ifdef BFD64 below is to prevent a compile time warning. We know that if we do not have a 64 bit data type that we will never execute this code anyway. */ @@ -910,13 +940,18 @@ else { #ifdef _bfd_int64_low - printf ("%8.8lx%8.8lx %8.8lx%8.8lx ", + printf (do_wide + ? "%8.8lx%8.8lx %8.8lx%8.8lx " + : "%4.4lx%8.8lx %4.4lx%8.8lx ", _bfd_int64_high (offset), _bfd_int64_low (offset), _bfd_int64_high (info), _bfd_int64_low (info)); #else - printf ("%16.16lx %16.16lx ", offset, info); + printf (do_wide + ? "%16.16lx %16.16lx " + : "%12.12lx %12.12lx ", + offset, info); #endif } @@ -1006,6 +1041,11 @@ case EM_MIPS: case EM_MIPS_RS3_LE: rtype = elf_mips_reloc_type (type); + if (!is_32bit_elf) + { + rtype2 = elf_mips_reloc_type (type2); + rtype3 = elf_mips_reloc_type (type3); + } break; case EM_ALPHA: @@ -1067,12 +1107,12 @@ if (rtype == NULL) #ifdef _bfd_int64_low - printf (_("unrecognised: %-7lx"), _bfd_int64_low (type)); + printf (_("unrecognized: %-7lx"), _bfd_int64_low (type)); #else - printf (_("unrecognised: %-7lx"), type); + printf (_("unrecognized: %-7lx"), type); #endif else - printf ("%-21.21s", rtype); + printf (do_wide ? "%-21.21s" : "%-17.17s", rtype); if (symtab_index) { @@ -1086,14 +1126,14 @@ printf (" "); print_vma (psym->st_value, LONG_HEX); - printf (" "); + printf (is_32bit_elf ? " " : " "); if (psym->st_name == 0) - print_symbol (-25, SECTION_NAME (section_headers + psym->st_shndx)); + print_symbol (22, SECTION_NAME (section_headers + psym->st_shndx)); else if (strtab == NULL) printf (_(""), psym->st_name); else - print_symbol (-25, strtab + psym->st_name); + print_symbol (22, strtab + psym->st_name); if (is_rela) printf (" + %lx", (unsigned long) relas [i].r_addend); @@ -1101,7 +1141,7 @@ } else if (is_rela) { - printf ("%*c", is_32bit_elf ? 34 : 26, ' '); + printf ("%*c", is_32bit_elf ? (do_wide ? 34 : 28) : (do_wide ? 26 : 20), ' '); print_vma (relas[i].r_addend, LONG_HEX); } @@ -1110,6 +1150,33 @@ printf (" + %lx", (unsigned long) ELF64_R_TYPE_DATA (info)); putchar ('\n'); + + if (! is_32bit_elf && elf_header.e_machine == EM_MIPS) + { + printf (" Type2: "); + + if (rtype2 == NULL) +#ifdef _bfd_int64_low + printf (_("unrecognized: %-7lx"), _bfd_int64_low (type2)); +#else + printf (_("unrecognized: %-7lx"), type2); +#endif + else + printf ("%-17.17s", rtype2); + + printf("\n Type3: "); + + if (rtype3 == NULL) +#ifdef _bfd_int64_low + printf (_("unrecognized: %-7lx"), _bfd_int64_low (type3)); +#else + printf (_("unrecognized: %-7lx"), type3); +#endif + else + printf ("%-17.17s", rtype3); + + putchar ('\n'); + } } if (is_rela) @@ -1504,7 +1571,7 @@ switch (eabi) { default: - strcat (buf, ", "); + strcat (buf, ", "); if (e_flags) unknown = 1; break; @@ -2185,7 +2252,7 @@ -A --arch-specific Display architecture specific information (if any).\n\ -D --use-dynamic Use the dynamic section info when displaying symbols\n\ -x --hex-dump= Dump the contents of section \n\ - -w --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str]\n\ + -w --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n\ Display the contents of DWARF2 debug sections\n")); #ifdef SUPPORT_DISASSEMBLY fprintf (stdout, _("\ @@ -2372,8 +2439,13 @@ do_debug_str = 1; break; + case 'o': + case 'O': + do_debug_loc = 1; + break; + default: - warn (_("Unrecognised debug option '%s'\n"), optarg); + warn (_("Unrecognized debug option '%s'\n"), optarg); break; } } @@ -3238,7 +3310,8 @@ } else if ((do_debugging || do_debug_info || do_debug_abbrevs || do_debug_lines || do_debug_pubnames || do_debug_aranges - || do_debug_frames || do_debug_macinfo || do_debug_str) + || do_debug_frames || do_debug_macinfo || do_debug_str + || do_debug_loc) && strncmp (name, ".debug_", 7) == 0) { name += 7; @@ -3252,6 +3325,7 @@ || (do_debug_frames && (strcmp (name, "frame") == 0)) || (do_debug_macinfo && (strcmp (name, "macinfo") == 0)) || (do_debug_str && (strcmp (name, "str") == 0)) + || (do_debug_loc && (strcmp (name, "loc") == 0)) ) request_dump (i, DEBUG_DUMP); } @@ -6455,6 +6529,7 @@ case DW_AT_src_coords: return "DW_AT_src_coords"; case DW_AT_body_begin: return "DW_AT_body_begin"; case DW_AT_body_end: return "DW_AT_body_end"; + case DW_AT_GNU_vector: return "DW_AT_GNU_vector"; default: { static char buffer [100]; @@ -7124,6 +7199,112 @@ } } +static const char * debug_loc_contents; +static bfd_vma debug_loc_size; + +static void +load_debug_loc (file) + FILE * file; +{ + Elf32_Internal_Shdr * sec; + unsigned int i; + + /* If it is already loaded, do nothing. */ + if (debug_loc_contents != NULL) + return; + + /* Locate the .debug_loc section. */ + for (i = 0, sec = section_headers; + i < elf_header.e_shnum; + i ++, sec ++) + if (strcmp (SECTION_NAME (sec), ".debug_loc") == 0) + break; + + if (i == elf_header.e_shnum || sec->sh_size == 0) + return; + + debug_loc_size = sec->sh_size; + + debug_loc_contents = ((char *) + get_data (NULL, file, sec->sh_offset, sec->sh_size, + _("debug_loc section data"))); +} + +static void +free_debug_loc () +{ + if (debug_loc_contents == NULL) + return; + + free ((char *) debug_loc_contents); + debug_loc_contents = NULL; + debug_loc_size = 0; +} + + +static int +display_debug_loc (section, start, file) + Elf32_Internal_Shdr * section; + unsigned char * start; + FILE * file ATTRIBUTE_UNUSED; +{ + unsigned char *section_end; + unsigned long bytes; + unsigned char *section_begin = start; + bfd_vma addr; + + addr = section->sh_addr; + bytes = section->sh_size; + section_end = start + bytes; + if (bytes == 0) + { + printf (_("\nThe .debug_loc section is empty.\n")); + return 0; + } + printf (_("Contents of the .debug_loc section:\n\n")); + printf (_("\n Offset Begin End Expression\n")); + while (start < section_end) + { + unsigned long begin; + unsigned long end; + unsigned short length; + unsigned long offset; + + offset = start - section_begin; + + while (1) + { + /* Normally, the lists in the debug_loc section are related to a + given compilation unit, and thus, we would use the + pointer size of that compilation unit. However, since we are + displaying it seperately here, we either have to store + pointer sizes of all compilation units, or assume they don't + change. We assume, like the debug_line display, that + it doesn't change. */ + begin = byte_get (start, debug_line_pointer_size); + start += debug_line_pointer_size; + end = byte_get (start, debug_line_pointer_size); + start += debug_line_pointer_size; + + if (begin == 0 && end == 0) + break; + + begin += addr; + end += addr; + + length = byte_get (start, 2); + start += 2; + + printf (" %8.8lx %8.8lx %8.8lx (", offset, begin, end); + decode_location_expression (start, debug_line_pointer_size, length); + printf (")\n"); + + start += length; + } + printf ("\n"); + } + return 1; +} static const char * debug_str_contents; static bfd_vma debug_str_size; @@ -7379,7 +7560,7 @@ break; default: - warn (_("Unrecognised form: %d\n"), form); + warn (_("Unrecognized form: %d\n"), form); break; } @@ -7528,6 +7709,12 @@ decode_location_expression (block_start, pointer_size, uvalue); printf (")"); } + else if (form == DW_FORM_data4) + { + printf ("("); + printf ("location list"); + printf (")"); + } break; default: @@ -7564,6 +7751,7 @@ printf (_("The section %s contains:\n\n"), SECTION_NAME (section)); load_debug_str (file); + load_debug_loc (file); while (start < end) { @@ -7748,6 +7936,7 @@ } free_debug_str (); + free_debug_loc (); printf ("\n"); @@ -8559,7 +8748,7 @@ { ".eh_frame", display_debug_frames, NULL }, { ".debug_macinfo", display_debug_macinfo, NULL }, { ".debug_str", display_debug_str, NULL }, - + { ".debug_loc", display_debug_loc, NULL }, { ".debug_pubtypes", display_debug_not_supported, NULL }, { ".debug_ranges", display_debug_not_supported, NULL }, { ".debug_static_func", display_debug_not_supported, NULL }, @@ -8602,7 +8791,7 @@ } if (i == -1) - printf (_("Unrecognised debug section: %s\n"), name); + printf (_("Unrecognized debug section: %s\n"), name); free (start); @@ -9240,6 +9429,7 @@ while (external < (Elf_External_Note *)((char *) pnotes + length)) { + Elf_External_Note * next; Elf32_Internal_Note inote; char * temp = NULL; @@ -9250,7 +9440,18 @@ inote.descdata = inote.namedata + align_power (inote.namesz, 2); inote.descpos = offset + (inote.descdata - (char *) pnotes); - external = (Elf_External_Note *)(inote.descdata + align_power (inote.descsz, 2)); + next = (Elf_External_Note *)(inote.descdata + align_power (inote.descsz, 2)); + + if (((char *) next) > (((char *) pnotes) + length)) + { + warn (_("corrupt note found at offset %x into core notes\n"), + ((char *) external) - ((char *) pnotes)); + warn (_(" type: %x, namesize: %08lx, descsize: %08lx\n"), + inote.type, inote.namesz, inote.descsz); + break; + } + + external = next; /* Verify that name is null terminated. It appears that at least one version of Linux (RedHat 6.0) generates corefiles that don't diff -Nur binutils-2.12/binutils/resbin.c binutils-2.12.1/binutils/resbin.c --- binutils-2.12/binutils/resbin.c Tue Mar 13 01:43:58 2001 +++ binutils-2.12.1/binutils/resbin.c Thu May 9 10:49:20 2002 @@ -1,5 +1,5 @@ /* resbin.c -- manipulate the Windows binary resource format. - Copyright 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -30,6 +30,7 @@ /* Macros to swap in values. */ +#define get_8(s) (*((unsigned char *)(s))) #define get_16(be, s) ((be) ? bfd_getb16 (s) : bfd_getl16 (s)) #define get_32(be, s) ((be) ? bfd_getb32 (s) : bfd_getl32 (s)) @@ -68,6 +69,9 @@ PARAMS ((const unsigned char *, unsigned long, int)); static struct res_resource *bin_to_res_userdata PARAMS ((const unsigned char *, unsigned long, int)); +static void get_version_header + PARAMS ((const unsigned char *, unsigned long, int, const char *, + unichar **, int *, int *, int *, int *)); /* Given a resource type ID, a pointer to data, a length, return a res_resource structure which represents that resource. The caller @@ -460,7 +464,7 @@ unsigned long length; int big_endian; { - int version; + int signature; struct dialog *d; int c, sublen, i; unsigned int off; @@ -472,8 +476,8 @@ d = (struct dialog *) res_alloc (sizeof *d); - version = get_16 (big_endian, data); - if (version != 1) + signature = get_16 (big_endian, data + 2); + if (signature != 0xffff) { d->ex = NULL; d->style = get_32 (big_endian, data); @@ -482,11 +486,11 @@ } else { - int signature; + int version; - signature = get_16 (big_endian, data + 2); - if (signature != 0xffff) - fatal (_("unexpected dialog signature %d"), signature); + version = get_16 (big_endian, data); + if (version != 1) + fatal (_("unexpected DIALOGEX version %d"), version); d->ex = (struct dialog_ex *) res_alloc (sizeof (struct dialog_ex)); d->ex->help = get_32 (big_endian, data + 4); @@ -514,6 +518,8 @@ d->caption = get_unicode (data + off, length - off, big_endian, &sublen); off += sublen * 2 + 2; + if (sublen == 0) + d->caption = NULL; if ((d->style & DS_SETFONT) == 0) { @@ -523,6 +529,7 @@ { d->ex->weight = 0; d->ex->italic = 0; + d->ex->charset = 1; /* Default charset. */ } } else @@ -538,7 +545,8 @@ if (length < off + 4) toosmall (_("dialogex font information")); d->ex->weight = get_16 (big_endian, data + off); - d->ex->italic = get_16 (big_endian, data + off + 2); + d->ex->italic = get_8 (data + off + 2); + d->ex->charset = get_8 (data + off + 3); off += 4; } @@ -808,7 +816,7 @@ bin_to_res_rcdata (data, length, big_endian) const unsigned char *data; unsigned long length; - int big_endian; + int big_endian ATTRIBUTE_UNUSED; { struct rcdata_item *ri; struct res_resource *r; @@ -1019,7 +1027,7 @@ struct res_resource *r; get_version_header (data, length, big_endian, "VS_VERSION_INFO", - (unichar *) NULL, &verlen, &vallen, &type, &off); + (unichar **) NULL, &verlen, &vallen, &type, &off); if ((unsigned int) verlen != length) fatal (_("version length %d does not match resource length %lu"), @@ -1091,7 +1099,7 @@ vi->type = VERINFO_STRING; get_version_header (data, length, big_endian, "StringFileInfo", - (unichar *) NULL, &verlen, &vallen, &type, + (unichar **) NULL, &verlen, &vallen, &type, &off); if (vallen != 0) @@ -1163,7 +1171,7 @@ vi->type = VERINFO_VAR; get_version_header (data, length, big_endian, "VarFileInfo", - (unichar *) NULL, &verlen, &vallen, &type, + (unichar **) NULL, &verlen, &vallen, &type, &off); if (vallen != 0) @@ -1231,7 +1239,7 @@ bin_to_res_userdata (data, length, big_endian) const unsigned char *data; unsigned long length; - int big_endian; + int big_endian ATTRIBUTE_UNUSED; { struct rcdata_item *ri; struct res_resource *r; @@ -1252,6 +1260,7 @@ /* Macros to swap out values. */ +#define put_8(v, s) (*((unsigned char *) (s)) = (unsigned char) (v)) #define put_16(be, v, s) ((be) ? bfd_putb16 ((v), (s)) : bfd_putl16 ((v), (s))) #define put_32(be, v, s) ((be) ? bfd_putb32 ((v), (s)) : bfd_putl32 ((v), (s))) @@ -1621,12 +1630,14 @@ if (dialog->ex == NULL) { put_16 (big_endian, 0, d->data + 2); - put_16 (big_endian, 0, d->data + 4); + put_8 (0, d->data + 4); + put_8 (1, d->data + 5); } else { put_16 (big_endian, dialog->ex->weight, d->data + 2); - put_16 (big_endian, dialog->ex->italic, d->data + 4); + put_8 (dialog->ex->italic, d->data + 4); + put_8 (dialog->ex->charset, d->data + 5); } } diff -Nur binutils-2.12/binutils/resrc.c binutils-2.12.1/binutils/resrc.c --- binutils-2.12/binutils/resrc.c Wed Sep 19 01:33:16 2001 +++ binutils-2.12.1/binutils/resrc.c Thu May 9 10:49:20 2002 @@ -1,5 +1,5 @@ /* resrc.c -- read and write Windows rc files. - Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -131,7 +131,7 @@ static char *cpp_temp_file; -/* Input stream is either a file or a pipe. */ +/* Input stream is either a file or a pipe. */ static enum {ISTREAM_PIPE, ISTREAM_FILE} istream_type; @@ -173,7 +173,7 @@ PARAMS ((FILE *, unsigned char *, unsigned long, const char *)); static void define_fontdirs PARAMS ((void)); -/* Run `cmd' and redirect the output to `redir'. */ +/* Run `cmd' and redirect the output to `redir'. */ static int run_cmd (cmd, redir) @@ -481,6 +481,7 @@ rcparse_set_language (language); yyin = cpp_pipe; yyparse (); + rcparse_discard_strings (); close_input_stream (); @@ -518,7 +519,7 @@ pclose (cpp_pipe); } - /* Since this is also run via xatexit, safeguard. */ + /* Since this is also run via xatexit, safeguard. */ cpp_pipe = NULL; cpp_temp_file = NULL; } @@ -1580,7 +1581,7 @@ case 2: /* If we're at level 2, the key of this resource is the name - we are going to use in the rc printout. */ + we are going to use in the rc printout. */ name = &re->id; break; @@ -1592,7 +1593,8 @@ && (re->id.u.id & 0xffff) == re->id.u.id) { fprintf (e, "LANGUAGE %lu, %lu\n", - re->id.u.id & 0xff, (re->id.u.id >> 8) & 0xff); + re->id.u.id & ((1 << SUBLANG_SHIFT) - 1), + (re->id.u.id >> SUBLANG_SHIFT) & 0xff); *language = re->id.u.id; } break; @@ -2052,23 +2054,26 @@ { const struct dialog_control *control; - if (dialog->style != 0) - fprintf (e, "STYLE 0x%lx\n", dialog->style); + fprintf (e, "STYLE 0x%lx\n", dialog->style); + if (dialog->exstyle != 0) fprintf (e, "EXSTYLE 0x%lx\n", dialog->exstyle); + if ((dialog->class.named && dialog->class.u.n.length > 0) || dialog->class.u.id != 0) { fprintf (e, "CLASS "); - res_id_print (e, dialog->class, 0); + res_id_print (e, dialog->class, 1); fprintf (e, "\n"); } + if (dialog->caption != NULL) { fprintf (e, "CAPTION \""); unicode_print (e, dialog->caption, -1); fprintf (e, "\"\n"); } + if ((dialog->menu.named && dialog->menu.u.n.length > 0) || dialog->menu.u.id != 0) { @@ -2076,14 +2081,18 @@ res_id_print (e, dialog->menu, 0); fprintf (e, "\n"); } + if (dialog->font != NULL) { fprintf (e, "FONT %d, \"", dialog->pointsize); unicode_print (e, dialog->font, -1); fprintf (e, "\""); if (dialog->ex != NULL - && (dialog->ex->weight != 0 || dialog->ex->italic != 0)) - fprintf (e, ", %d, %d", dialog->ex->weight, dialog->ex->italic); + && (dialog->ex->weight != 0 + || dialog->ex->italic != 0 + || dialog->ex->charset != 1)) + fprintf (e, ", %d, %d, %d", + dialog->ex->weight, dialog->ex->italic, dialog->ex->charset); fprintf (e, "\n"); } diff -Nur binutils-2.12/binutils/size.c binutils-2.12.1/binutils/size.c --- binutils-2.12/binutils/size.c Tue Jan 29 11:46:37 2002 +++ binutils-2.12.1/binutils/size.c Thu May 9 10:49:20 2002 @@ -316,6 +316,7 @@ bfd *file; { bfd *arfile = (bfd *) NULL; + bfd *last_arfile = (bfd *) NULL; for (;;) { @@ -333,8 +334,14 @@ } display_bfd (arfile); - /* Don't close the archive elements; we need them for next_archive. */ + + if (last_arfile != NULL) + bfd_close (last_arfile); + last_arfile = arfile; } + + if (last_arfile != NULL) + bfd_close (last_arfile); } static void diff -Nur binutils-2.12/binutils/testsuite/ChangeLog binutils-2.12.1/binutils/testsuite/ChangeLog --- binutils-2.12/binutils/testsuite/ChangeLog Mon Feb 18 04:19:50 2002 +++ binutils-2.12.1/binutils/testsuite/ChangeLog Thu May 9 10:49:23 2002 @@ -1,3 +1,63 @@ +2002-05-09 Alan Modra + + Merge from mainline. + 2002-04-16 Eric Kohl + * binutils-all/windres/dialog0.rc: New test case: Check default + attributes for dialogs + * binutils-all/windres/dialog0.rsd: New file: Expected output. + * binutils-all/windres/dialog1.rc: New test case: Check + DISCARDABLE flag is propogated. + * binutils-all/windres/dialog1.rsd: New file: Expected output. + + 2002-04-15 Eric Kohl + * binutils-all/windres/dlgfont.rc: New test case: Checks FONT + statement in DIALOG and DIALOGEX resources. + * binutils-all/windres/dlgfont.rsd: Expected output. + + 2002-04-10 Nick Clifton + * binutils-all/windres/capstyle.rsd: Regenerate using MSVC. + * binutils-all/windres/deflang.rsd: Regenerate using MSVC. + * binutils-all/windres/dialogsignature.rsd: Regenerate using MSVC. + * binutils-all/windres/escapea.rsd: Regenerate using MSVC. + * binutils-all/windres/escapex.rsd: Regenerate using MSVC. + * binutils-all/windres/nocaption.rsd: Regenerate using MSVC. + * binutils-all/windres/printstyle.rsd: Regenerate using MSVC. + * binutils-all/windres/sublang.rsd: Regenerate using MSVC. + + 2002-04-09 Nick Clifton + * binutils-all/windres/capstyle.rc: New test case: Set default + style for captions. + * binutils-all/windres/capstyle.rsd: Expected output. + * binutils-all/windres/deflang.rc: New test case: Check default + language. + * binutils-all/windres/deflang.rsd: Expected output. + * binutils-all/windres/dialogsignature.rc: New test case for + decoding the dialog signature. + * binutils-all/windres/dialogsignature.rsd: Expected output. + * binutils-all/windres/escapea.rc: New test case for encoding \a + escape sequence. + * binutils-all/windres/escapea.rsd: Expected output. + * binutils-all/windres/escapex.rc: New test case for hex constants + in strings. + * binutils-all/windres/escapex.rsd: Expected output + * binutils-all/windres/nocaption.rc: New test case dialogs without + captions. + * binutils-all/windres/nocaption.rsd: Expected output + * binutils-all/windres/quoteclass.rc: New test case for quoted + CLASS definitions in DIALOG resources. + * binutils-all/windres/sublang.rc: New test case: Check assignment + of sub-language. + * binutils-all/windres/sublang.rsd: Expected output. + +2002-04-27 Alan Modra + + Merge from mainline. + 2002-02-18 Timothy Daly + * binutils-all/readelf.r: Change expected output to match new, + narrowed-to-80-chars format. + * binutils-all/readelf.r-64: Change expected output to match new, + narrowed-to-80-chars format. + 2002-02-18 Hans-Peter Nilsson * binutils-all/objcopy.exp diff -Nur binutils-2.12/binutils/testsuite/binutils-all/readelf.r binutils-2.12.1/binutils/testsuite/binutils-all/readelf.r --- binutils-2.12/binutils/testsuite/binutils-all/readelf.r Tue Aug 21 11:54:16 2001 +++ binutils-2.12.1/binutils/testsuite/binutils-all/readelf.r Thu May 9 10:49:23 2002 @@ -1,4 +1,4 @@ Relocation section '.rel.*text' at offset 0x.* contains 1 entries: - Offset Info Type Symbol's Value Symbol's Name.* -00000004 [0-9A-Fa-f]+ *R_.*00000000 external_symbol.* + Offset Info Type Sym.Value Sym. Name.* +00000004 [0-9A-Fa-f]+ *R_.*00000000 external_symbol.* diff -Nur binutils-2.12/binutils/testsuite/binutils-all/readelf.r-64 binutils-2.12.1/binutils/testsuite/binutils-all/readelf.r-64 --- binutils-2.12/binutils/testsuite/binutils-all/readelf.r-64 Tue Aug 21 11:54:16 2001 +++ binutils-2.12.1/binutils/testsuite/binutils-all/readelf.r-64 Thu May 9 10:49:23 2002 @@ -1,4 +1,4 @@ Relocation section '.rel.*text' at offset 0x.* contains 1 entries: - Offset Info Type Symbol's Value Symbol's Name.* -0000000000000004 [0-9A-Fa-f]+ *R_.*0000000000000000 external_symbol.* + Offset Info Type Sym. Value Sym. Name.* +0+04 [0-9A-Fa-f]+ *R_.*0+00 external_symbol.* diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/capstyle.rc binutils-2.12.1/binutils/testsuite/binutils-all/windres/capstyle.rc --- binutils-2.12/binutils/testsuite/binutils-all/windres/capstyle.rc Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/capstyle.rc Thu May 9 07:53:28 2002 @@ -0,0 +1,5 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +CAPTION "" +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/capstyle.rsd binutils-2.12.1/binutils/testsuite/binutils-all/windres/capstyle.rsd --- binutils-2.12/binutils/testsuite/binutils-all/windres/capstyle.rsd Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/capstyle.rsd Thu May 9 07:53:28 2002 @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 0000c880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/deflang.rc binutils-2.12.1/binutils/testsuite/binutils-all/windres/deflang.rc --- binutils-2.12/binutils/testsuite/binutils-all/windres/deflang.rc Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/deflang.rc Thu May 9 07:53:28 2002 @@ -0,0 +1,4 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/deflang.rsd binutils-2.12.1/binutils/testsuite/binutils-all/windres/deflang.rsd --- binutils-2.12/binutils/testsuite/binutils-all/windres/deflang.rsd Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/deflang.rsd Thu May 9 07:53:28 2002 @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/dialog0.rc binutils-2.12.1/binutils/testsuite/binutils-all/windres/dialog0.rc --- binutils-2.12/binutils/testsuite/binutils-all/windres/dialog0.rc Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/dialog0.rc Thu May 9 07:53:28 2002 @@ -0,0 +1,4 @@ +101 DIALOG 0, 0, 186, 95 +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/dialog0.rsd binutils-2.12.1/binutils/testsuite/binutils-all/windres/dialog0.rsd --- binutils-2.12/binutils/testsuite/binutils-all/windres/dialog0.rsd Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/dialog0.rsd Thu May 9 07:53:28 2002 @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/dialog1.rc binutils-2.12.1/binutils/testsuite/binutils-all/windres/dialog1.rc --- binutils-2.12/binutils/testsuite/binutils-all/windres/dialog1.rc Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/dialog1.rc Thu May 9 07:53:28 2002 @@ -0,0 +1,5 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/dialog1.rsd binutils-2.12.1/binutils/testsuite/binutils-all/windres/dialog1.rsd --- binutils-2.12/binutils/testsuite/binutils-all/windres/dialog1.rsd Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/dialog1.rsd Thu May 9 07:53:28 2002 @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/dialogsignature.rc binutils-2.12.1/binutils/testsuite/binutils-all/windres/dialogsignature.rc --- binutils-2.12/binutils/testsuite/binutils-all/windres/dialogsignature.rc Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/dialogsignature.rc Thu May 9 07:53:28 2002 @@ -0,0 +1,5 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +STYLE 1 +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/dialogsignature.rsd binutils-2.12.1/binutils/testsuite/binutils-all/windres/dialogsignature.rsd --- binutils-2.12/binutils/testsuite/binutils-all/windres/dialogsignature.rsd Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/dialogsignature.rsd Thu May 9 07:53:28 2002 @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 01000000 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/dlgfont.rc binutils-2.12.1/binutils/testsuite/binutils-all/windres/dlgfont.rc --- binutils-2.12/binutils/testsuite/binutils-all/windres/dlgfont.rc Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/dlgfont.rc Thu May 9 07:53:28 2002 @@ -0,0 +1,29 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma" +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + +102 DIALOGEX DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma" +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + +103 DIALOGEX DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma", 0 +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + +104 DIALOGEX DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma", 0, 0 +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + +105 DIALOGEX DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma", 0, 0, 1 +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/dlgfont.rsd binutils-2.12.1/binutils/testsuite/binutils-all/windres/dlgfont.rsd --- binutils-2.12/binutils/testsuite/binutils-all/windres/dlgfont.rsd Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/dlgfont.rsd Thu May 9 07:53:28 2002 @@ -0,0 +1,39 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 46000000 20000000 ffff0500 ffff6500 F... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 40008880 00000000 01000000 0000ba00 @............... + 0050 5f000000 00000000 08005400 61006800 _.........T.a.h. + 0060 6f006d00 61000000 01000150 00000000 o.m.a......P.... + 0070 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0080 4b000000 00000000 58000000 20000000 K.......X... ... + 0090 ffff0500 ffff6600 00000000 30100904 ......f.....0... + 00a0 00000000 00000000 0100ffff 00000000 ................ + 00b0 00000000 40008880 01000000 0000ba00 ....@........... + 00c0 5f000000 00000000 08000000 00015400 _.............T. + 00d0 61006800 6f006d00 61000000 00000000 a.h.o.m.a....... + 00e0 00000000 01000150 81000700 32000e00 .......P....2... + 00f0 01000000 ffff8000 4f004b00 00000000 ........O.K..... + 0100 58000000 20000000 ffff0500 ffff6700 X... .........g. + 0110 00000000 30100904 00000000 00000000 ....0........... + 0120 0100ffff 00000000 00000000 40008880 ............@... + 0130 01000000 0000ba00 5f000000 00000000 ........_....... + 0140 08000000 00015400 61006800 6f006d00 ......T.a.h.o.m. + 0150 61000000 00000000 00000000 01000150 a..............P + 0160 81000700 32000e00 01000000 ffff8000 ....2........... + 0170 4f004b00 00000000 58000000 20000000 O.K.....X... ... + 0180 ffff0500 ffff6800 00000000 30100904 ......h.....0... + 0190 00000000 00000000 0100ffff 00000000 ................ + 01a0 00000000 40008880 01000000 0000ba00 ....@........... + 01b0 5f000000 00000000 08000000 00015400 _.............T. + 01c0 61006800 6f006d00 61000000 00000000 a.h.o.m.a....... + 01d0 00000000 01000150 81000700 32000e00 .......P....2... + 01e0 01000000 ffff8000 4f004b00 00000000 ........O.K..... + 01f0 58000000 20000000 ffff0500 ffff6900 X... .........i. + 0200 00000000 30100904 00000000 00000000 ....0........... + 0210 0100ffff 00000000 00000000 40008880 ............@... + 0220 01000000 0000ba00 5f000000 00000000 ........_....... + 0230 08000000 00015400 61006800 6f006d00 ......T.a.h.o.m. + 0240 61000000 00000000 00000000 01000150 a..............P + 0250 81000700 32000e00 01000000 ffff8000 ....2........... + 0260 4f004b00 00000000 O.K..... diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/escapea.rc binutils-2.12.1/binutils/testsuite/binutils-all/windres/escapea.rc --- binutils-2.12/binutils/testsuite/binutils-all/windres/escapea.rc Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/escapea.rc Thu May 9 07:53:28 2002 @@ -0,0 +1,7 @@ +20 MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Open\a^O", 17 + END +END diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/escapea.rsd binutils-2.12.1/binutils/testsuite/binutils-all/windres/escapea.rsd --- binutils-2.12/binutils/testsuite/binutils-all/windres/escapea.rsd Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/escapea.rsd Thu May 9 07:53:28 2002 @@ -0,0 +1,7 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 28000000 20000000 ffff0400 ffff1400 (... ........... + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00000000 90002600 46006900 6c006500 ......&.F.i.l.e. + 0050 00008000 11002600 4f007000 65006e00 ......&.O.p.e.n. + 0060 08005e00 4f000000 ..^.O... diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/escapex.rc binutils-2.12.1/binutils/testsuite/binutils-all/windres/escapex.rc --- binutils-2.12/binutils/testsuite/binutils-all/windres/escapex.rc Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/escapex.rc Thu May 9 07:53:28 2002 @@ -0,0 +1,4 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +BEGIN + LTEXT "\xB0",-1,23,46,28,8 +END diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/escapex.rsd binutils-2.12.1/binutils/testsuite/binutils-all/windres/escapex.rsd --- binutils-2.12/binutils/testsuite/binutils-all/windres/escapex.rsd Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/escapex.rsd Thu May 9 07:53:28 2002 @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 34000000 20000000 ffff0500 ffff6500 4... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 00000250 00000000 _..........P.... + 0060 17002e00 1c000800 ffffffff 8200b000 ................ + 0070 00000000 .... diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/nocaption.rc binutils-2.12.1/binutils/testsuite/binutils-all/windres/nocaption.rc --- binutils-2.12/binutils/testsuite/binutils-all/windres/nocaption.rc Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/nocaption.rc Thu May 9 07:53:28 2002 @@ -0,0 +1,4 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/nocaption.rsd binutils-2.12.1/binutils/testsuite/binutils-all/windres/nocaption.rsd --- binutils-2.12/binutils/testsuite/binutils-all/windres/nocaption.rsd Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/nocaption.rsd Thu May 9 07:53:28 2002 @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/printstyle.rc binutils-2.12.1/binutils/testsuite/binutils-all/windres/printstyle.rc --- binutils-2.12/binutils/testsuite/binutils-all/windres/printstyle.rc Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/printstyle.rc Thu May 9 07:53:28 2002 @@ -0,0 +1,6 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +STYLE 0 +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END + diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/printstyle.rsd binutils-2.12.1/binutils/testsuite/binutils-all/windres/printstyle.rsd --- binutils-2.12/binutils/testsuite/binutils-all/windres/printstyle.rsd Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/printstyle.rsd Thu May 9 07:53:28 2002 @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00000000 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/quoteclass.rc binutils-2.12.1/binutils/testsuite/binutils-all/windres/quoteclass.rc --- binutils-2.12/binutils/testsuite/binutils-all/windres/quoteclass.rc Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/quoteclass.rc Thu May 9 07:53:28 2002 @@ -0,0 +1,8 @@ +// parse-only + +101 DIALOG DISCARDABLE 0, 0, 186, 95 +CLASS "myclass" +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END + diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/sublang.rc binutils-2.12.1/binutils/testsuite/binutils-all/windres/sublang.rc --- binutils-2.12/binutils/testsuite/binutils-all/windres/sublang.rc Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/sublang.rc Thu May 9 07:53:28 2002 @@ -0,0 +1,5 @@ +LANGUAGE 9, 1 +101 DIALOG DISCARDABLE 0, 0, 186, 95 +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END diff -Nur binutils-2.12/binutils/testsuite/binutils-all/windres/sublang.rsd binutils-2.12.1/binutils/testsuite/binutils-all/windres/sublang.rsd --- binutils-2.12/binutils/testsuite/binutils-all/windres/sublang.rsd Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/binutils/testsuite/binutils-all/windres/sublang.rsd Thu May 9 07:53:28 2002 @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff -Nur binutils-2.12/binutils/windres.c binutils-2.12.1/binutils/windres.c --- binutils-2.12/binutils/windres.c Wed Jan 23 11:12:56 2002 +++ binutils-2.12.1/binutils/windres.c Thu May 9 10:49:21 2002 @@ -145,6 +145,8 @@ static void usage PARAMS ((FILE *, int)); static int cmp_res_entry PARAMS ((const PTR, const PTR)); static struct res_directory *sort_resources PARAMS ((struct res_directory *)); +static void reswr_init PARAMS ((void)); +static const char * quot PARAMS ((const char *)); /* When we are building a resource tree, we allocate everything onto an obstack, so that we can free it all at once if we want. */ @@ -441,11 +443,9 @@ re->u.res = ((struct res_resource *) res_alloc (sizeof (struct res_resource))); + memset (re->u.res, 0, sizeof (struct res_resource)); re->u.res->type = RES_TYPE_UNINITIALIZED; - memset (&re->u.res->res_info, 0, sizeof (struct res_res_info)); - memset (&re->u.res->coff_info, 0, sizeof (struct res_coff_info)); - return re->u.res; } @@ -765,6 +765,9 @@ return buf; } +/* This keeps gcc happy when using -Wmissing-prototypes -Wstrict-prototypes. */ +int main PARAMS ((int, char **)); + /* The main function. */ int @@ -809,7 +812,7 @@ target = NULL; preprocessor = NULL; preprocargs = NULL; - language = -1; + language = 0x409; /* LANG_ENGLISH, SUBLANG_ENGLISH_US. */ use_temp_file = 0; while ((c = getopt_long (argc, argv, "i:o:I:O:F:D:hHvV", long_options, diff -Nur binutils-2.12/binutils/windres.h binutils-2.12.1/binutils/windres.h --- binutils-2.12/binutils/windres.h Mon Jul 16 21:19:19 2001 +++ binutils-2.12.1/binutils/windres.h Thu May 9 10:49:21 2002 @@ -1,5 +1,5 @@ /* windres.h -- header file for windres program. - Copyright 1997, 1998, 2000 Free Software Foundation, Inc. + Copyright 1997, 1998, 2000, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -315,7 +315,9 @@ /* Font weight. */ unsigned short weight; /* Whether the font is italic. */ - unsigned short italic; + unsigned char italic; + /* Character set. */ + unsigned char charset; }; /* Window style flags, from the winsup Defines.h header file. These @@ -519,7 +521,7 @@ short index; /* Length of font information. */ unsigned long length; - /* Font information. */ + /* Font information. */ const unsigned char *data; }; diff -Nur binutils-2.12/gas/ChangeLog binutils-2.12.1/gas/ChangeLog --- binutils-2.12/gas/ChangeLog Thu Mar 7 23:20:48 2002 +++ binutils-2.12.1/gas/ChangeLog Mon May 13 09:15:47 2002 @@ -1,3 +1,214 @@ +2002-05-13 Nick Clifton + + * stabs.c (s_stab_generic): Fix grammatical error in warning + message. + +2002-05-11 Nick Clifton + + * stabs.c (s_stab_generic): Warn about a description field that is + too big. + +2002-05-11 Daniel Jacobowitz + + Merge from mainline: + 2002-05-11 Nick Clifton + * config/obj-coff.c: Fix compile time warnings when compiling + without BFD_ASSEMBLER defined. + Fix formatting. + + * config/tc-sh.c (md_pcrel_from): Define for use with sh-hms + target. + (md_pcrel_from_section): Use md_pcrel_from(). + +2002-05-09 Alan Modra + + * config/tc-i386.c (md_estimate_size_before_relax) Don't lose + reloc when no_cond_jump_promotion. + + Merge from mainline + 2002-05-08 Jim Wilson + * config/tc-i960.c (md_estimate_size_before_relax): Return size of + current variable part of frag. + + 2002-05-02 Alan Modra + * config/tc-ppc.c (mapping): Map sectoff to BFD_RELOC_16_BASEREL. + (ppc_elf_validate_fix): Replace BFD_RELOC_32_BASEREL with + BFD_RELOC_16_BASEREL. + (md_assemble): Likewise. + (md_apply_fix3): Likewise. + + 2002-05-01 Andrew Macleod + * config/tc-i386.c (extra_symbol_chars): Add '[' to the list. + + 2002-04-28 Alan Modra + * config/tc-i386.c: Formatting fixes, add missing space in error + message. + +2002-05-03 Alexandre Oliva + + * config/tc-s390.c (md_gather_operands): Emit dwarf2 line-number + information for instructions. + +2002-05-02 Nick Clifton + + * config/tc-arm.c (thumb_add_sub): Do not convert a subtract of + zero into an add of zero - it is not the same. + +2002-04-27 Alan Modra + + Merge from mainline. + 2002-04-17 Martin Schwidefsky + * config/tc-s390.c (tc_s390_fix_adjustable): Prevent adjustments to + symbols in merge sections. + + 2002-02-19 Martin Schwidefsky + * config/tc-s390.c (md_parse_option): Add switches -m31 and -m64. + Make bit size independent of architecture switch. + (md_begin): Add warning for -m64 with -Aesa. + (s390_md_end): Use renamed architecture defines. + + 2002-02-19 Tom Tromey + * config/tc-xstormy16.h (DWARF2_LINE_MIN_INSN_LENGTH): Define. + + Tue Apr 9 16:45:48 2002 J"orn Rennecke + * config/tc-sh.h (TC_FIX_ADJUSTABLE): Disable adjusting if + symbol_used_in_reloc_p is true. + * config/tc-sh.c (md_apply_fix3): Don't zero relocations on big + endian hosts. + + 2002-04-03 Alan Modra + * symbols.c (resolve_symbol_value ): Derive final_seg from add_symbol. + : More final_seg twiddles. + +2002-04-24 Andreas Schwab + + * config/tc-i386.c (output_jump, output_disp) + (md_estimate_size_before_relax): Don't set fx_pcrel_adjust any + more. + (md_apply_fix3): Remember addend value for rela relocations. + (tc_gen_reloc): Correctly compute pc-relative relocation addend. + +2002-04-10 Alan Modra + + * as.c (parse_args ): Use VERSION is + BFD_VERSION_STRING unavailable. + * config/tc-i386.c (INLINE): Define (for non-BFD assembler). + +2002-04-04 Alan Modra + + * dep-in.sed: Cope with absolute paths. + * Makefile.am (dep.sed): Subst TOPDIR. + Run "make dep-am". + * Makefile.in: Regenerate. + +2002-04-01 Jessica Han + + * config/tc-ia64.c (ia64_cons_fix_new): Handle 8 byte iplt reloc + in 32-bit mode. + +2002-03-28 Alan Modra + + * aclocal.m4: Regenerate. + * config.in: Regenerate. + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + * doc/Makefile.in: Regenerate. + + Merge from mainline. + 2002-03-12 Andreas Schwab + * config/tc-ia64.c (fixup_unw_records): Clear region when seeing a + body record so that an error is given for misplaced .save + pseudo-ops. + + 2002-03-09 Alan Modra + * config/tc-i386.h (REX_OPCODE): Define. + (REX_MODE64, REX_EXTX, REX_EXTY, REX_EXTZ): Define. + (rex_byte): typedef to int. + * config/tc-i386.c: Group prototypes and vars together. + Formatting fixes. Remove occurrences of "register" keyword. + (true): Delete. + (false): Delete. + (mode_from_disp_size): Add INLINE keyword to prototype. + (fits_in_signed_byte): Likewise. + (fits_in_unsigned_byte): Likewise. + (fits_in_unsigned_word): Likewise. + (fits_in_signed_word): Likewise. + (fits_in_unsigned_long): Likewise. + (fits_in_signed_long): Likewise. + (type_names): Constify. + (intel_float_operand): Constify param. + (add_prefix): Use REX_OPCODE. + (md_assemble): Likewise. Modify for changed rex_byte. + (parse_insn): Split out of md_assemble. + (parse_operands): Likewise. + (swap_operands): Likewise. + (optimize_imm): Likewise. + (optimize_disp): Likewise. + (match_template): Likewise. + (check_string): Likewise. + (process_suffix): Likewise. + (check_byte_reg): Likewise. + (check_long_reg): Likewise. + (check_qword_reg): Likewise. + (check_word_reg): Likewise. + (finalize_imm): Likewise. + (process_operands): Likewise. + (build_modrm_byte): Likewise. + (output_insn): Likewise. + (output_branch): Likewise. + (output_jump): Likewise. + (output_interseg_jump): Likewise. + (output_disp): Likewise. + (output_imm): Likewise. + + 2002-03-06 Alan Modra + * config/tc-i386.c (tc_gen_reloc): Don't attempt to handle 8 byte + relocs except when BFD64. + * write.c (number_to_chars_bigendian): Don't abort when N is + larger than sizeof (VAL). + (number_to_chars_littleendian): Likewise. + + 2002-03-05 John David Anglin + * config/tc-hppa.c (md_apply_fix3): Add cast. + (hppa_fix_adjustable): Adjust list of selectors using e_lrsel and + e_rrsel. + + 2002-03-04 H.J. Lu + * config/obj-elf.c (special_section): Add .init_array, + .fini_array and .preinit_array. + * config/tc-ia64.h (ELF_TC_SPECIAL_SECTIONS): Remove + .init_array and .fini_array. + + 2002-03-01 Jakub Jelinek + * config/obj-elf.c (elf_copy_symbol_attributes): Don't copy + visibility. + (obj_frob_symbol): Copy visibility. + +2002-03-27 Andreas Schwab + + * config/tc-i386.c (md_assemble): Set fx_pcrel_adjust to size of + field for pc-relative fixups. + (md_estimate_size_before_relax): Likewise. + (tc_gen_reloc): Subtract fx_pcrel_adjust instead of fx_size for + pc-relative fixups in 64bit mode. + +2002-03-20 Albert Chin-A-Young + + * config/tc-arm.c (vfp_dp_reg_required_here): Fix typo + (vfp_sp_reg_pos -> vfp_dp_reg_pos). + +2002-03-19 Alexandre Oliva + + * config/tc-mips.c (md_estimate_size_before_relax): Do not modify + the EXTENDED bit here; report the estimate according to the + current size. + +2002-03-17 Hans-Peter Nilsson + + * config/tc-mmix.c (md_estimate_size_before_relax): Don't consider + a weak symbol in same section to be within reach. + 2002-03-07 Daniel Jacobowitz * doc/as.texinfo: Wrap @menu in @ifnottex, not @ifinfo. @@ -135,7 +346,7 @@ 2002-02-11 Tom Rix - * config/tc-ppc.c (md_apply_fix3): Check for insert fop invalid for + * config/tc-ppc.c (md_apply_fix3): Check for insert fop invalid for xcoff64. 2002-02-11 Alexandre Oliva @@ -353,7 +564,7 @@ BFD_RELOC_SH_PT_16>: Set lowest bit in field to be relocated to 1. (shmedia_md_convert_frag) : Set lowest bit of field to relocate to 1 and rest to empty, - if reloc is emitted. + if reloc is emitted. 2000-12-31 Hans-Peter Nilsson New options plus bugfixes. * config/tc-sh.c (md_longopts): New options "-no-expand" and @@ -662,7 +873,7 @@ * config/tc-sh.c (parse_at): Install the correct version of 2002-02-04's patch. - + * config/tc-sh.c (md_apply_fix3) : Don't assume fixP->fx_subsy is non-NULL. @@ -719,7 +930,7 @@ Support on-demand global register allocation by passing on base-plus-offset relocs to the linker. * config/tc-mmix.c: Tweak and fix typos in comments. - (allocate_undefined_gregs_in_linker): New variable. + (allocate_undefined_gregs_in_linker): New variable. (OPTION_LINKER_ALLOCATED_GREGS): New option macro. (md_longopts): Add --linker-allocated-gregs. (md_parse_option) : Imply --linker-allocated-gregs. @@ -835,7 +1046,7 @@ 2002-01-21 Jason Thorpe * configure.in (ia64-*-netbsd*): New target. - * configure: Regenerate. + * configure: Regenerate. 2002-01-21 Hans-Peter Nilsson @@ -874,7 +1085,7 @@ * NEWS: Mention new ARM command-line options and VFP support. - * config/tc-arm.c (ARM_CEXT_XSCALE): Replaces ARM_EXT_XSCALE. All + * config/tc-arm.c (ARM_CEXT_XSCALE): Replaces ARM_EXT_XSCALE. All uses changed. (ARM_CEXT_MAVERICK): Similarly. (ARM_ANY): Now means any core instruction. diff -Nur binutils-2.12/gas/Makefile.am binutils-2.12.1/gas/Makefile.am --- binutils-2.12/gas/Makefile.am Fri Feb 8 01:32:16 2002 +++ binutils-2.12.1/gas/Makefile.am Thu Apr 4 11:21:08 2002 @@ -921,7 +921,8 @@ sed <$(srcdir)/dep-in.sed >dep.sed \ -e "s!@INCDIR@!$${srcdir}/../include!" \ -e "s!@BFDDIR@!$${srcdir}/../bfd!" \ - -e "s!@SRCDIR@!$${srcdir}!" + -e "s!@SRCDIR@!$${srcdir}!" \ + -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/gas,,`'!' dep: DEP sed -e '/^.MKDEP.*WARNING BELOW./,/^.MKDEP.*WARNING ABOVE./d' \ @@ -1084,12 +1085,14 @@ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/hppa.h \ dwarf2dbg.h DEPTC_ia64_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-ia64.h $(INCDIR)/coff/internal.h \ + $(srcdir)/config/tc-ia64.h $(INCDIR)/opcode/ia64.h \ + $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h DEPTC_ia64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h \ + $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/safe-ctype.h dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h DEPTC_i370_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-i370.h $(INCDIR)/coff/internal.h \ @@ -1413,15 +1416,23 @@ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h \ subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h DEPTC_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-v850.h $(INCDIR)/coff/internal.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h \ - dwarf2dbg.h + $(srcdir)/config/tc-v850.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/v850.h dwarf2dbg.h DEPTC_v850_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/v850.h dwarf2dbg.h + $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/safe-ctype.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h \ + dwarf2dbg.h +DEPTC_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/safe-ctype.h $(srcdir)/../opcodes/sh64-opc.h \ + $(srcdir)/config/tc-sh.c subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h DEPTC_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-xstormy16.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ @@ -1787,20 +1798,6 @@ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/aout/aout64.h -DEPTC_sh64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h \ - $(srcdir)/../opcodes/sh64-opc.h $(srcdir)/config/tc-sh.c \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \ - struc-symbol.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - dwarf2dbg.h $(INCDIR)/symcat.h -DEPOBJ_sh64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h $(INCDIR)/elf/sh.h -DEP_sh64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h DEPOBJ_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h @@ -1889,6 +1886,17 @@ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/aout/aout64.h +DEPOBJ_sh64_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h DEPOBJ_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-xstormy16.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -2193,6 +2201,14 @@ DEP_v850_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h +DEP_sh64_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_sh64_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h DEP_xstormy16_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-xstormy16.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h @@ -2237,8 +2253,8 @@ $(INCDIR)/safe-ctype.h input-scrub.o: input-scrub.c $(INCDIR)/symcat.h input-file.h \ sb.h -listing.o: listing.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ - input-file.h subsegs.h +listing.o: listing.c $(INCDIR)/symcat.h $(INCDIR)/obstack.h \ + $(INCDIR)/safe-ctype.h input-file.h subsegs.h literal.o: literal.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h macro.o: macro.c $(INCDIR)/safe-ctype.h sb.h macro.h messages.o: messages.c $(INCDIR)/symcat.h @@ -2253,7 +2269,8 @@ $(INCDIR)/obstack.h subsegs.h struc-symbol.h write.o: write.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h \ output-file.h dwarf2dbg.h -gasp.o: gasp.c $(INCDIR)/safe-ctype.h sb.h macro.h +gasp.o: gasp.c $(INCDIR)/getopt.h $(INCDIR)/safe-ctype.h \ + sb.h macro.h itbl-ops.o: itbl-ops.c itbl-ops.h $(INCDIR)/symcat.h e-crisaout.o: $(srcdir)/config/e-crisaout.c $(INCDIR)/symcat.h \ emul-target.h diff -Nur binutils-2.12/gas/Makefile.in binutils-2.12.1/gas/Makefile.in --- binutils-2.12/gas/Makefile.in Fri Feb 8 01:32:16 2002 +++ binutils-2.12.1/gas/Makefile.in Thu Apr 4 11:21:08 2002 @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -818,13 +818,15 @@ dwarf2dbg.h DEPTC_ia64_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-ia64.h $(INCDIR)/coff/internal.h \ + $(srcdir)/config/tc-ia64.h $(INCDIR)/opcode/ia64.h \ + $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h DEPTC_ia64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h \ + $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/safe-ctype.h dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h DEPTC_i370_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ @@ -1216,16 +1218,25 @@ subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h DEPTC_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-v850.h $(INCDIR)/coff/internal.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h \ - dwarf2dbg.h + $(srcdir)/config/tc-v850.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/v850.h dwarf2dbg.h DEPTC_v850_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/v850.h dwarf2dbg.h + $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/safe-ctype.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h \ + dwarf2dbg.h + +DEPTC_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/safe-ctype.h $(srcdir)/../opcodes/sh64-opc.h \ + $(srcdir)/config/tc-sh.c subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h DEPTC_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-xstormy16.h $(INCDIR)/coff/internal.h \ @@ -1677,23 +1688,6 @@ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/aout/aout64.h -DEPTC_sh64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h \ - $(srcdir)/../opcodes/sh64-opc.h $(srcdir)/config/tc-sh.c \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \ - struc-symbol.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - dwarf2dbg.h $(INCDIR)/symcat.h - -DEPOBJ_sh64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h $(INCDIR)/elf/sh.h - -DEP_sh64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h - DEPOBJ_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h @@ -1803,6 +1797,19 @@ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/aout/aout64.h +DEPOBJ_sh64_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h + +DEPOBJ_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h + DEPOBJ_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-xstormy16.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -2211,6 +2218,16 @@ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h +DEP_sh64_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + +DEP_sh64_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h + DEP_xstormy16_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-xstormy16.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h @@ -2282,7 +2299,7 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(itbl_test_SOURCES) $(as_new_SOURCES) $(EXTRA_as_new_SOURCES) $(gasp_new_SOURCES) OBJECTS = $(itbl_test_OBJECTS) $(as_new_OBJECTS) $(gasp_new_OBJECTS) @@ -2443,7 +2460,7 @@ dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ - test "$$subdir" = "." && dot_seen=yes; \ + test "$$subdir" != "." || dot_seen=yes; \ done; \ test "$$dot_seen" = "no" && rev=". $$rev"; \ target=`echo $@ | sed s/-recursive//`; \ @@ -3076,7 +3093,8 @@ sed <$(srcdir)/dep-in.sed >dep.sed \ -e "s!@INCDIR@!$${srcdir}/../include!" \ -e "s!@BFDDIR@!$${srcdir}/../bfd!" \ - -e "s!@SRCDIR@!$${srcdir}!" + -e "s!@SRCDIR@!$${srcdir}!" \ + -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/gas,,`'!' dep: DEP sed -e '/^.MKDEP.*WARNING BELOW./,/^.MKDEP.*WARNING ABOVE./d' \ @@ -3124,8 +3142,8 @@ $(INCDIR)/safe-ctype.h input-scrub.o: input-scrub.c $(INCDIR)/symcat.h input-file.h \ sb.h -listing.o: listing.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ - input-file.h subsegs.h +listing.o: listing.c $(INCDIR)/symcat.h $(INCDIR)/obstack.h \ + $(INCDIR)/safe-ctype.h input-file.h subsegs.h literal.o: literal.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h macro.o: macro.c $(INCDIR)/safe-ctype.h sb.h macro.h messages.o: messages.c $(INCDIR)/symcat.h @@ -3140,7 +3158,8 @@ $(INCDIR)/obstack.h subsegs.h struc-symbol.h write.o: write.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h \ output-file.h dwarf2dbg.h -gasp.o: gasp.c $(INCDIR)/safe-ctype.h sb.h macro.h +gasp.o: gasp.c $(INCDIR)/getopt.h $(INCDIR)/safe-ctype.h \ + sb.h macro.h itbl-ops.o: itbl-ops.c itbl-ops.h $(INCDIR)/symcat.h e-crisaout.o: $(srcdir)/config/e-crisaout.c $(INCDIR)/symcat.h \ emul-target.h diff -Nur binutils-2.12/gas/aclocal.m4 binutils-2.12.1/gas/aclocal.m4 --- binutils-2.12/gas/aclocal.m4 Fri Feb 8 01:32:17 2002 +++ binutils-2.12.1/gas/aclocal.m4 Mon Apr 1 20:28:59 2002 @@ -1,6 +1,6 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4 +dnl aclocal.m4 generated automatically by aclocal 1.4-p5 -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -92,7 +92,7 @@ dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) -AC_DEFUN(AM_INIT_AUTOMAKE, +AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) @@ -120,7 +120,7 @@ # Check to make sure that the build environment is sane. # -AC_DEFUN(AM_SANITY_CHECK, +AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 @@ -161,7 +161,7 @@ dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. -AC_DEFUN(AM_MISSING_PROG, +AC_DEFUN([AM_MISSING_PROG], [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. @@ -177,7 +177,7 @@ # Like AC_CONFIG_HEADER, but automatically create stamp file. -AC_DEFUN(AM_CONFIG_HEADER, +AC_DEFUN([AM_CONFIG_HEADER], [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) dnl When config.status generates a header, we must update the stamp-h file. @@ -201,9 +201,9 @@ dnl AM_PROG_LEX dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT -AC_DEFUN(AM_PROG_LEX, +AC_DEFUN([AM_PROG_LEX], [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1) -AC_CHECK_PROGS(LEX, flex lex, $missing_dir/missing flex) +AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex") AC_PROG_LEX AC_DECL_YYTEXT]) @@ -212,7 +212,7 @@ # serial 1 -AC_DEFUN(AM_MAINTAINER_MODE, +AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, @@ -229,7 +229,7 @@ # Define a conditional. -AC_DEFUN(AM_CONDITIONAL, +AC_DEFUN([AM_CONDITIONAL], [AC_SUBST($1_TRUE) AC_SUBST($1_FALSE) if $2; then diff -Nur binutils-2.12/gas/as.c binutils-2.12.1/gas/as.c --- binutils-2.12/gas/as.c Fri Jan 18 06:28:36 2002 +++ binutils-2.12.1/gas/as.c Fri Apr 26 10:26:59 2002 @@ -524,7 +524,11 @@ case OPTION_VERSION: /* This output is intended to follow the GNU standards document. */ +#ifdef BFD_ASSEMBLER printf (_("GNU assembler %s\n"), BFD_VERSION_STRING); +#else + printf (_("GNU assembler %s\n"), VERSION); +#endif printf (_("Copyright 2002 Free Software Foundation, Inc.\n")); printf (_("\ This program is free software; you may redistribute it under the terms of\n\ diff -Nur binutils-2.12/gas/config/obj-coff.c binutils-2.12.1/gas/config/obj-coff.c --- binutils-2.12/gas/config/obj-coff.c Thu Jan 31 12:33:00 2002 +++ binutils-2.12.1/gas/config/obj-coff.c Sat May 11 12:47:05 2002 @@ -1713,9 +1713,9 @@ int function_lineoff = -1; /* Offset in line#s where the last function started (the odd entry for line #0) */ -/* structure used to keep the filenames which +/* Structure used to keep the filenames which are too long around so that we can stick them - into the string table */ + into the string table. */ struct filename_list { char *filename; @@ -1729,39 +1729,38 @@ /* Add 4 to the real value to get the index and compensate the negatives. This vector is used by S_GET_SEGMENT to turn a coff - section number into a segment number -*/ -static symbolS *previous_file_symbol; -void c_symbol_merge (); -static int line_base; + section number into a segment number. */ -symbolS *c_section_symbol (); bfd *abfd; +static symbolS *previous_file_symbol; +static int line_base; -static void fixup_segment PARAMS ((segment_info_type *segP, - segT this_segment_type)); - -static void fixup_mdeps PARAMS ((fragS *, - object_headers *, - segT)); - -static void fill_section PARAMS ((bfd * abfd, - object_headers *, - unsigned long *)); - -static int c_line_new PARAMS ((symbolS * symbol, long paddr, - int line_number, - fragS * frag)); - -static void w_symbols PARAMS ((bfd * abfd, char *where, - symbolS * symbol_rootP)); - -static void adjust_stab_section PARAMS ((bfd *abfd, segT seg)); - +void c_symbol_merge PARAMS ((symbolS *, symbolS *)); +symbolS *c_section_symbol PARAMS ((char *, int)); +void obj_coff_section PARAMS ((int)); +void do_relocs_for PARAMS ((bfd *, object_headers *, unsigned long *)); +char * symbol_to_chars PARAMS ((bfd *, char *, symbolS *)); +void w_strings PARAMS ((char *)); + +static void fixup_segment PARAMS ((segment_info_type *, segT)); +static void fixup_mdeps PARAMS ((fragS *, object_headers *, segT)); +static void fill_section PARAMS ((bfd *, object_headers *, unsigned long *)); +static int c_line_new PARAMS ((symbolS *, long, int, fragS *)); +static void w_symbols PARAMS ((bfd *, char *, symbolS *)); +static void adjust_stab_section PARAMS ((bfd *, segT)); static void obj_coff_lcomm PARAMS ((int)); static void obj_coff_text PARAMS ((int)); static void obj_coff_data PARAMS ((int)); -void obj_coff_section PARAMS ((int)); +static unsigned int count_entries_in_chain PARAMS ((unsigned int)); +static void coff_header_append PARAMS ((bfd *, object_headers *)); +static unsigned int yank_symbols PARAMS ((void)); +static unsigned int glue_symbols PARAMS ((symbolS **, symbolS **)); +static unsigned int tie_tags PARAMS ((void)); +static void crawl_symbols PARAMS ((object_headers *, bfd *)); +static void do_linenos_for PARAMS ((bfd *, object_headers *, unsigned long *)); +static void remove_subsegs PARAMS ((void)); + + /* When not using BFD_ASSEMBLER, we permit up to 40 sections. @@ -1800,6 +1799,8 @@ #define SEG_INFO_FROM_SECTION_NUMBER(x) (seg_info_off_by_4[(x)+4]) +static relax_addressT relax_align PARAMS ((relax_addressT, long)); + static relax_addressT relax_align (address, alignment) relax_addressT address; @@ -1820,8 +1821,11 @@ return SEG_INFO_FROM_SECTION_NUMBER (x->sy_symbol.ost_entry.n_scnum); } -/* calculate the size of the frag chain and fill in the section header - to contain all of it, also fill in the addr of the sections */ +static unsigned int size_section PARAMS ((bfd *, unsigned int)); + +/* Calculate the size of the frag chain and fill in the section header + to contain all of it, also fill in the addr of the sections. */ + static unsigned int size_section (abfd, idx) bfd *abfd ATTRIBUTE_UNUSED; @@ -1830,6 +1834,7 @@ unsigned int size = 0; fragS *frag = segment_info[idx].frchainP->frch_root; + while (frag) { size = frag->fr_address; @@ -1882,7 +1887,7 @@ unsigned int nrelocs; fixS *fixup_ptr; - /* Count the relocations */ + /* Count the relocations. */ fixup_ptr = segment_info[idx].fix_root; nrelocs = 0; while (fixup_ptr != (fixS *) NULL) @@ -1908,7 +1913,8 @@ static int compare_external_relocs PARAMS ((const PTR, const PTR)); -/* AUX's ld expects relocations to be sorted */ +/* AUX's ld expects relocations to be sorted. */ + static int compare_external_relocs (x, y) const PTR x; @@ -1923,7 +1929,8 @@ #endif -/* output all the relocations for a section */ +/* Output all the relocations for a section. */ + void do_relocs_for (abfd, h, file_cursor) bfd * abfd; @@ -1961,13 +1968,12 @@ { struct internal_reloc intr; - /* Only output some of the relocations */ + /* Only output some of the relocations. */ if (fix_ptr->fx_done == 0 && TC_COUNT_RELOC (fix_ptr)) { #ifdef TC_RELOC_MANGLE TC_RELOC_MANGLE (&segment_info[idx], fix_ptr, &intr, base); - #else symbolS *dot; symbolS *symbol_ptr = fix_ptr->fx_addsy; @@ -2012,36 +2018,26 @@ as_bad (_("bad relocation: symbol `%s' not in symbol table"), S_GET_NAME (symbol_ptr)); } + dot = segment_info[S_GET_SEGMENT (symbol_ptr)].dot; if (dot) - { - intr.r_symndx = dot->sy_number; - } + intr.r_symndx = dot->sy_number; else - { - intr.r_symndx = symbol_ptr->sy_number; - } - + intr.r_symndx = symbol_ptr->sy_number; } else - { - intr.r_symndx = -1; - } + intr.r_symndx = -1; #endif - (void) bfd_coff_swap_reloc_out (abfd, &intr, ext_ptr); ext_ptr++; - #if defined(TC_A29K) - /* The 29k has a special kludge for the high 16 bit reloc. Two relocations are emited, R_IHIHALF, and R_IHCONST. The second one doesn't contain a symbol, but uses the value for offset. */ - if (intr.r_type == R_IHIHALF) { - /* now emit the second bit */ + /* Now emit the second bit. */ intr.r_type = R_IHCONST; intr.r_symndx = fix_ptr->fx_addnumber; (void) bfd_coff_swap_reloc_out (abfd, &intr, ext_ptr); @@ -2066,14 +2062,12 @@ fix_ptr = fix_ptr->fx_next; } - #ifdef TE_AUX - /* Sort the reloc table */ + /* Sort the reloc table. */ qsort ((PTR) external_reloc_vec, nrelocs, sizeof (struct external_reloc), compare_external_relocs); #endif - - /* Write out the reloc table */ + /* Write out the reloc table. */ bfd_bwrite ((PTR) external_reloc_vec, (bfd_size_type) external_reloc_size, abfd); free (external_reloc_vec); @@ -2085,25 +2079,25 @@ } else { - /* No relocs */ + /* No relocs. */ segment_info[idx].scnhdr.s_relptr = 0; } } } - /* Set relocation_size field in file headers */ + + /* Set relocation_size field in file headers. */ H_SET_RELOCATION_SIZE (h, *file_cursor - reloc_start, 0); } -/* run through a frag chain and write out the data to go with it, fill - in the scnhdrs with the info on the file postions -*/ +/* Run through a frag chain and write out the data to go with it, fill + in the scnhdrs with the info on the file postions. */ + static void fill_section (abfd, h, file_cursor) bfd * abfd; object_headers *h ATTRIBUTE_UNUSED; unsigned long *file_cursor; { - unsigned int i; unsigned int paddr = 0; @@ -2229,7 +2223,7 @@ } } -/* Coff file generation & utilities */ +/* Coff file generation & utilities. */ static void coff_header_append (abfd, h) @@ -2279,7 +2273,6 @@ string_size += strlen (segment_info[i].name) + 1; } #endif - size = bfd_coff_swap_scnhdr_out (abfd, &(segment_info[i].scnhdr), buffer); @@ -2300,13 +2293,11 @@ unsigned int i; valueT val; - /* Turn any symbols with register attributes into abs symbols */ + /* Turn any symbols with register attributes into abs symbols. */ if (S_GET_SEGMENT (symbolP) == reg_section) - { - S_SET_SEGMENT (symbolP, absolute_section); - } - /* At the same time, relocate all symbols to their output value */ + S_SET_SEGMENT (symbolP, absolute_section); + /* At the same time, relocate all symbols to their output value. */ #ifndef TE_PE val = (segment_info[S_GET_SEGMENT (symbolP)].scnhdr.s_paddr + S_GET_VALUE (symbolP)); @@ -2329,25 +2320,25 @@ S_GET_STORAGE_CLASS (symbolP), i, numaux, where); } - return where; + return where; } void coff_obj_symbol_new_hook (symbolP) symbolS *symbolP; { - char underscore = 0; /* Symbol has leading _ */ + char underscore = 0; /* Symbol has leading _ */ - /* Effective symbol */ + /* Effective symbol. */ /* Store the pointer in the offset. */ S_SET_ZEROES (symbolP, 0L); S_SET_DATA_TYPE (symbolP, T_NULL); S_SET_STORAGE_CLASS (symbolP, 0); S_SET_NUMBER_AUXILIARY (symbolP, 0); - /* Additional information */ + /* Additional information. */ symbolP->sy_symbol.ost_flags = 0; - /* Auxiliary entries */ + /* Auxiliary entries. */ memset ((char *) &symbolP->sy_symbol.ost_auxent[0], 0, AUXESZ); if (S_IS_STRING (symbolP)) @@ -2356,9 +2347,7 @@ SF_SET_LOCAL (symbolP); } -/* - * Handle .ln directives. - */ +/* Handle .ln directives. */ static void obj_coff_ln (appline) @@ -2368,10 +2357,11 @@ if (! appline && def_symbol_in_progress != NULL) { + /* Wrong context. */ as_warn (_(".ln pseudo-op inside .def/.endef: ignored.")); demand_empty_rest_of_line (); return; - } /* wrong context */ + } l = get_absolute_expression (); c_line_new (0, frag_now_fix (), l, frag_now); @@ -2395,19 +2385,14 @@ demand_empty_rest_of_line (); } -/* - * def() - * - * Handle .def directives. - * - * One might ask : why can't we symbol_new if the symbol does not - * already exist and fill it with debug information. Because of - * the C_EFCN special symbol. It would clobber the value of the - * function symbol before we have a chance to notice that it is - * a C_EFCN. And a second reason is that the code is more clear this - * way. (at least I think it is :-). - * - */ +/* Handle .def directives. + + One might ask : why can't we symbol_new if the symbol does not + already exist and fill it with debug information. Because of + the C_EFCN special symbol. It would clobber the value of the + function symbol before we have a chance to notice that it is + a C_EFCN. And a second reason is that the code is more clear this + way. (at least I think it is :-). */ #define SKIP_SEMI_COLON() while (*input_line_pointer++ != ';') #define SKIP_WHITESPACES() while (*input_line_pointer == ' ' || \ @@ -2418,9 +2403,9 @@ obj_coff_def (what) int what ATTRIBUTE_UNUSED; { - char name_end; /* Char after the end of name */ - char *symbol_name; /* Name of the debug symbol */ - char *symbol_name_copy; /* Temporary copy of the name */ + char name_end; /* Char after the end of name. */ + char *symbol_name; /* Name of the debug symbol. */ + char *symbol_name_copy; /* Temporary copy of the name. */ unsigned int symbol_name_length; if (def_symbol_in_progress != NULL) @@ -2428,7 +2413,7 @@ as_warn (_(".def pseudo-op used inside of .def/.endef: ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } SKIP_WHITESPACES (); @@ -2444,7 +2429,7 @@ symbol_name_copy = tc_canonicalize_symbol_name (symbol_name_copy); #endif - /* Initialize the new symbol */ + /* Initialize the new symbol. */ #ifdef STRIP_UNDERSCORE S_SET_NAME (def_symbol_in_progress, (*symbol_name_copy == '_' ? symbol_name_copy + 1 @@ -2480,7 +2465,7 @@ as_warn (_(".endef pseudo-op used outside of .def/.endef: ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } /* Set the section number according to storage class. */ switch (S_GET_STORAGE_CLASS (def_symbol_in_progress)) @@ -2489,7 +2474,8 @@ case C_ENTAG: case C_UNTAG: SF_SET_TAG (def_symbol_in_progress); - /* intentional fallthrough */ + /* Intentional fallthrough. */ + case C_FILE: case C_TPDEF: SF_SET_DEBUG (def_symbol_in_progress); @@ -2497,20 +2483,23 @@ break; case C_EFCN: - SF_SET_LOCAL (def_symbol_in_progress); /* Do not emit this symbol. */ - /* intentional fallthrough */ + /* Do not emit this symbol. */ + SF_SET_LOCAL (def_symbol_in_progress); + /* Intentional fallthrough. */ + case C_BLOCK: - SF_SET_PROCESS (def_symbol_in_progress); /* Will need processing before writing */ - /* intentional fallthrough */ + /* Will need processing before writing. */ + SF_SET_PROCESS (def_symbol_in_progress); + /* Intentional fallthrough. */ + case C_FCN: S_SET_SEGMENT (def_symbol_in_progress, SEG_E0); if (strcmp (S_GET_NAME (def_symbol_in_progress), ".bf") == 0) { /* .bf */ if (function_lineoff < 0) - { - fprintf (stderr, _("`.bf' symbol without preceding function\n")); - } /* missing function symbol */ + fprintf (stderr, _("`.bf' symbol without preceding function\n")); + SA_GET_SYM_LNNOPTR (last_line_symbol) = function_lineoff; SF_SET_PROCESS (last_line_symbol); @@ -2518,6 +2507,7 @@ SF_SET_PROCESS (def_symbol_in_progress); function_lineoff = -1; } + /* Value is always set to . */ def_symbol_in_progress->sy_frag = frag_now; S_SET_VALUE (def_symbol_in_progress, (valueT) frag_now_fix ()); @@ -2546,7 +2536,7 @@ #endif case C_STAT: case C_LABEL: - /* Valid but set somewhere else (s_comm, s_lcomm, colon) */ + /* Valid but set somewhere else (s_comm, s_lcomm, colon). */ break; case C_USTATIC: @@ -2554,7 +2544,7 @@ case C_ULABEL: as_warn (_("unexpected storage class %d"), S_GET_STORAGE_CLASS (def_symbol_in_progress)); break; - } /* switch on storage class */ + } /* Now that we have built a debug symbol, try to find if we should merge with an existing symbol or not. If a symbol is C_EFCN or @@ -2609,16 +2599,16 @@ /* For functions, and tags, and static symbols, the symbol *must* be where the debug symbol appears. Move the existing symbol to the current place. */ - /* If it already is at the end of the symbol list, do nothing */ + /* If it already is at the end of the symbol list, do nothing. */ if (def_symbol_in_progress != symbol_lastP) { symbol_remove (def_symbol_in_progress, &symbol_rootP, &symbol_lastP); symbol_append (def_symbol_in_progress, symbol_lastP, &symbol_rootP, &symbol_lastP); - } /* if not already in place */ - } /* if function */ - } /* normal or mergable */ + } + } + } if (SF_GET_TAG (def_symbol_in_progress)) { @@ -2644,8 +2634,8 @@ /* That is, if this is the first time we've seen the function... */ symbol_table_insert (def_symbol_in_progress); - } /* definition follows debug */ - } /* Create the line number entry pointing to the function being defined */ + } + } def_symbol_in_progress = NULL; demand_empty_rest_of_line (); @@ -2662,7 +2652,7 @@ as_warn (_(".dim pseudo-op used outside of .def/.endef: ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); @@ -2680,7 +2670,8 @@ default: as_warn (_("badly formed .dim directive ignored")); - /* intentional fallthrough */ + /* Intentional fallthrough. */ + case '\n': case ';': dim_index = DIMNUM; @@ -2715,17 +2706,13 @@ #if 0 /* XXX Can we ever have line numbers going backwards? */ if (this_base > line_base) #endif - { - line_base = this_base; - } + line_base = this_base; #ifndef NO_LISTING { extern int listing; if (listing) - { - listing_source_line ((unsigned int) line_base); - } + listing_source_line ((unsigned int) line_base); } #endif } @@ -2745,7 +2732,7 @@ as_warn (_(".size pseudo-op used outside of .def/.endef ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); SA_SET_SYM_SIZE (def_symbol_in_progress, get_absolute_expression ()); @@ -2761,7 +2748,7 @@ as_warn (_(".scl pseudo-op used outside of .def/.endef ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } S_SET_STORAGE_CLASS (def_symbol_in_progress, get_absolute_expression ()); demand_empty_rest_of_line (); @@ -2793,9 +2780,7 @@ SA_SET_SYM_TAGNDX (def_symbol_in_progress, (long) tag_find_or_make (symbol_name)); if (SA_GET_SYM_TAGNDX (def_symbol_in_progress) == 0L) - { - as_warn (_("tag not found for .tag %s"), symbol_name); - } /* not defined */ + as_warn (_("tag not found for .tag %s"), symbol_name); SF_SET_TAGGED (def_symbol_in_progress); *input_line_pointer = name_end; @@ -2812,15 +2797,13 @@ as_warn (_(".type pseudo-op used outside of .def/.endef ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } S_SET_DATA_TYPE (def_symbol_in_progress, get_absolute_expression ()); if (ISFCN (S_GET_DATA_TYPE (def_symbol_in_progress)) && S_GET_STORAGE_CLASS (def_symbol_in_progress) != C_TPDEF) - { - SF_SET_FUNCTION (def_symbol_in_progress); - } /* is a function */ + SF_SET_FUNCTION (def_symbol_in_progress); demand_empty_rest_of_line (); } @@ -2834,7 +2817,7 @@ as_warn (_(".val pseudo-op used outside of .def/.endef ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } if (is_name_beginner (*input_line_pointer)) { @@ -2849,7 +2832,7 @@ { def_symbol_in_progress->sy_frag = frag_now; S_SET_VALUE (def_symbol_in_progress, (valueT) frag_now_fix ()); - /* If the .val is != from the .def (e.g. statics) */ + /* If the .val is != from the .def (e.g. statics). */ } else if (strcmp (S_GET_NAME (def_symbol_in_progress), symbol_name)) { @@ -2918,13 +2901,13 @@ } /* This function runs through the symbol table and puts all the - externals onto another chain */ + externals onto another chain. */ /* The chain of globals. */ symbolS *symbol_globalP; symbolS *symbol_global_lastP; -/* The chain of externals */ +/* The chain of externals. */ symbolS *symbol_externP; symbolS *symbol_extern_lastP; @@ -2961,7 +2944,7 @@ if (!SF_GET_DEBUG (symbolP)) { - /* Debug symbols do not need all this rubbish */ + /* Debug symbols do not need all this rubbish. */ symbolS *real_symbolP; /* L* and C_EFCN symbols never merge. */ @@ -2980,20 +2963,18 @@ list.) Because some pointers refer to the real symbol whereas no pointers refer to the debug symbol. */ c_symbol_merge (symbolP, real_symbolP); - /* Replace the current symbol by the real one */ + /* Replace the current symbol by the real one. */ /* The symbols will never be the last or the first because : 1st symbol is .file and 3 last symbols are - .text, .data, .bss */ + .text, .data, .bss. */ symbol_remove (real_symbolP, &symbol_rootP, &symbol_lastP); symbol_insert (real_symbolP, symbolP, &symbol_rootP, &symbol_lastP); symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); symbolP = real_symbolP; - } /* if not local but dup'd */ + } if (flag_readonly_data_in_text && (S_GET_SEGMENT (symbolP) == SEG_E1)) - { - S_SET_SEGMENT (symbolP, SEG_E0); - } /* push data into text */ + S_SET_SEGMENT (symbolP, SEG_E0); resolve_symbol_value (symbolP); @@ -3003,17 +2984,15 @@ { S_SET_EXTERNAL (symbolP); } + else if (S_GET_SEGMENT (symbolP) == SEG_E0) - { - S_SET_STORAGE_CLASS (symbolP, C_LABEL); - } + S_SET_STORAGE_CLASS (symbolP, C_LABEL); + else - { - S_SET_STORAGE_CLASS (symbolP, C_STAT); - } + S_SET_STORAGE_CLASS (symbolP, C_STAT); } - /* Mainly to speed up if not -g */ + /* Mainly to speed up if not -g. */ if (SF_GET_PROCESS (symbolP)) { /* Handle the nested blocks auxiliary info. */ @@ -3022,8 +3001,10 @@ if (!strcmp (S_GET_NAME (symbolP), ".bb")) stack_push (block_stack, (char *) &symbolP); else - { /* .eb */ - register symbolS *begin_symbolP; + { + /* .eb */ + symbolS *begin_symbolP; + begin_symbolP = *(symbolS **) stack_pop (block_stack); if (begin_symbolP == (symbolS *) 0) as_warn (_("mismatched .eb")); @@ -3041,13 +3022,11 @@ last_functionP = symbolP; if (S_GET_NUMBER_AUXILIARY (symbolP) < 1) - { - S_SET_NUMBER_AUXILIARY (symbolP, 1); - } /* make it at least 1 */ + S_SET_NUMBER_AUXILIARY (symbolP, 1); /* Clobber possible stale .dim information. */ #if 0 - /* Iffed out by steve - this fries the lnnoptr info too */ + /* Iffed out by steve - this fries the lnnoptr info too. */ bzero (symbolP->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen, sizeof (symbolP->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen)); #endif @@ -3078,19 +3057,19 @@ else if (SF_GET_TAG (symbolP)) { /* First descriptor of a structure must point to - the first slot after the structure description. */ + the first slot after the structure description. */ last_tagP = symbolP; } else if (S_GET_STORAGE_CLASS (symbolP) == C_EOS) { - /* +2 take in account the current symbol */ + /* +2 take in account the current symbol. */ SA_SET_SYM_ENDNDX (last_tagP, symbol_number + 2); } else if (S_GET_STORAGE_CLASS (symbolP) == C_FILE) { /* If the filename was too long to fit in the - auxent, put it in the string table */ + auxent, put it in the string table. */ if (SA_GET_FILE_FNAME_ZEROS (symbolP) == 0 && SA_GET_FILE_FNAME_OFFSET (symbolP) != 0) { @@ -3102,8 +3081,8 @@ { S_SET_VALUE (symbolP, last_file_symno); last_file_symno = symbol_number; - } /* no one points at the first .file symbol */ - } /* if debug or tag or eos or file */ + } + } #ifdef tc_frob_coff_symbol tc_frob_coff_symbol (symbolP); @@ -3122,8 +3101,8 @@ if (SF_GET_LOCAL (symbolP)) { - /* remove C_EFCN and LOCAL (L...) symbols */ - /* next pointer remains valid */ + /* Remove C_EFCN and LOCAL (L...) symbols. */ + /* Next pointer remains valid. */ symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); } @@ -3143,7 +3122,7 @@ #endif || S_GET_STORAGE_CLASS (symbolP) == C_WEAKEXT)) { - /* if external, Remove from the list */ + /* If external, Remove from the list. */ symbolS *hold = symbol_previous (symbolP); symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); @@ -3165,7 +3144,6 @@ /* The O'Reilly COFF book says that defined global symbols come at the end of the symbol table, just before undefined global symbols. */ - symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); symbol_clear_list_pointers (symbolP); symbol_append (symbolP, symbol_global_lastP, &symbol_globalP, @@ -3182,14 +3160,14 @@ else { symbolP->sy_name_offset = 0; - } /* fix "long" names */ + } symbolP->sy_number = symbol_number; symbol_number += 1 + S_GET_NUMBER_AUXILIARY (symbolP); - } /* if local symbol */ - } /* traverse the symbol list */ - return symbol_number; + } + } + return symbol_number; } static unsigned int @@ -3203,11 +3181,11 @@ { symbolS *tmp = *head; - /* append */ + /* Append. */ symbol_remove (tmp, head, tail); symbol_append (tmp, symbol_lastP, &symbol_rootP, &symbol_lastP); - /* and process */ + /* Process. */ if (SF_GET_STRING (tmp)) { tmp->sy_name_offset = string_byte_count; @@ -3215,12 +3193,13 @@ } else { + /* Fix "long" names. */ tmp->sy_name_offset = 0; - } /* fix "long" names */ + } tmp->sy_number = symbol_number; symbol_number += 1 + S_GET_NUMBER_AUXILIARY (tmp); - } /* append the entire extern chain */ + } return symbol_number; } @@ -3248,6 +3227,7 @@ return symbol_number; } + static void crawl_symbols (h, abfd) object_headers *h; @@ -3255,40 +3235,35 @@ { unsigned int i; - /* Initialize the stack used to keep track of the matching .bb .be */ + /* Initialize the stack used to keep track of the matching .bb .be. */ block_stack = stack_init (512, sizeof (symbolS *)); /* The symbol list should be ordered according to the following sequence - * order : - * . .file symbol - * . debug entries for functions - * . fake symbols for the sections, including .text .data and .bss - * . defined symbols - * . undefined symbols - * But this is not mandatory. The only important point is to put the - * undefined symbols at the end of the list. - */ + order : + . .file symbol + . debug entries for functions + . fake symbols for the sections, including .text .data and .bss + . defined symbols + . undefined symbols + But this is not mandatory. The only important point is to put the + undefined symbols at the end of the list. */ /* Is there a .file symbol ? If not insert one at the beginning. */ if (symbol_rootP == NULL || S_GET_STORAGE_CLASS (symbol_rootP) != C_FILE) - { - c_dot_file_symbol ("fake"); - } + c_dot_file_symbol ("fake"); - /* - * Build up static symbols for the sections, they are filled in later - */ + /* Build up static symbols for the sections, they are filled in later. */ for (i = SEG_E0; i < SEG_LAST; i++) if (segment_info[i].scnhdr.s_name[0]) - segment_info[i].dot = c_section_symbol (segment_info[i].name, + segment_info[i].dot = c_section_symbol ((char *) segment_info[i].name, i - SEG_E0 + 1); - /* Take all the externals out and put them into another chain */ + /* Take all the externals out and put them into another chain. */ H_SET_SYMBOL_TABLE_SIZE (h, yank_symbols ()); - /* Take the externals and glue them onto the end.*/ + /* Take the externals and glue them onto the end. */ H_SET_SYMBOL_TABLE_SIZE (h, (H_GET_SYMBOL_COUNT (h) + glue_symbols (&symbol_globalP, @@ -3303,9 +3278,7 @@ know (symbol_extern_lastP == NULL); } -/* - * Find strings by crawling along symbol table chain. - */ +/* Find strings by crawling along symbol table chain. */ void w_strings (where) @@ -3314,7 +3287,7 @@ symbolS *symbolP; struct filename_list *filename_list_scan = filename_list_head; - /* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */ + /* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK. */ md_number_to_chars (where, (valueT) string_byte_count, 4); where += 4; @@ -3386,7 +3359,7 @@ struct external_lineno *dst = buffer; /* Run through the table we've built and turn it into its external - form, take this chance to remove duplicates */ + form, take this chance to remove duplicates. */ for (line_ptr = s->lineno_list_head; line_ptr != (struct lineno_list *) NULL; @@ -3401,13 +3374,10 @@ ((symbolS *) line_ptr->line.l_addr.l_symndx)->sy_number; } else - { - line_ptr->line.l_addr.l_paddr += ((struct frag *) (line_ptr->frag))->fr_address; - } + line_ptr->line.l_addr.l_paddr += ((struct frag *) (line_ptr->frag))->fr_address; (void) bfd_coff_swap_lineno_out (abfd, &(line_ptr->line), dst); dst++; - } s->scnhdr.s_lnnoptr = *file_cursor; @@ -3418,12 +3388,13 @@ *file_cursor += s->scnhdr.s_nlnno * LINESZ; } } + H_SET_LINENO_SIZE (h, *file_cursor - start); } /* Now we run through the list of frag chains in a segment and make all the subsegment frags appear at the end of the - list, as if the seg 0 was extra long */ + list, as if the seg 0 was extra long. */ static void remove_subsegs () @@ -3448,6 +3419,7 @@ unsigned long machine; int coff_flags; + extern void write_object_file () { @@ -3506,9 +3478,7 @@ remove_subsegs (); for (i = SEG_E0; i < SEG_UNKNOWN; i++) - { - relax_segment (segment_info[i].frchainP->frch_root, i); - } + relax_segment (segment_info[i].frchainP->frch_root, i); /* Relaxation has completed. Freeze all syms. */ finalize_syms = 1; @@ -3562,7 +3532,7 @@ H_SET_BSS_SIZE (&headers, size); } - /* Turn the gas native symbol table shape into a coff symbol table */ + /* Turn the gas native symbol table shape into a coff symbol table. */ crawl_symbols (&headers, abfd); if (string_byte_count == 4) @@ -3596,8 +3566,7 @@ bfd_seek (abfd, (file_ptr) file_cursor, 0); - /* Plant the data */ - + /* Plant the data. */ fill_section (abfd, &headers, &file_cursor); do_relocs_for (abfd, &headers, &file_cursor); @@ -3692,28 +3661,26 @@ return (segT) i; } -/* - * implement the .section pseudo op: - * .section name {, "flags"} - * ^ ^ - * | +--- optional flags: 'b' for bss - * | 'i' for info - * +-- section name 'l' for lib - * 'n' for noload - * 'o' for over - * 'w' for data - * 'd' (apparently m88k for data) - * 'x' for text - * 'r' for read-only data - * But if the argument is not a quoted string, treat it as a - * subsegment number. - */ +/* Implement the .section pseudo op: + .section name {, "flags"} + ^ ^ + | +--- optional flags: 'b' for bss + | 'i' for info + +-- section name 'l' for lib + 'n' for noload + 'o' for over + 'w' for data + 'd' (apparently m88k for data) + 'x' for text + 'r' for read-only data + But if the argument is not a quoted string, treat it as a + subsegment number. */ void obj_coff_section (ignore) int ignore ATTRIBUTE_UNUSED; { - /* Strip out the section name */ + /* Strip out the section name. */ char *section_name, *name; char c; unsigned int exp; @@ -3810,11 +3777,12 @@ obj_coff_ident (ignore) int ignore ATTRIBUTE_UNUSED; { - segT current_seg = now_seg; /* save current seg */ + segT current_seg = now_seg; /* Save current seg. */ subsegT current_subseg = now_subseg; - subseg_new (".comment", 0); /* .comment seg */ - stringer (1); /* read string */ - subseg_set (current_seg, current_subseg); /* restore current seg */ + + subseg_new (".comment", 0); /* .comment seg. */ + stringer (1); /* Read string. */ + subseg_set (current_seg, current_subseg); /* Restore current seg. */ } void @@ -3826,20 +3794,16 @@ S_SET_STORAGE_CLASS (normal, S_GET_STORAGE_CLASS (debug)); if (S_GET_NUMBER_AUXILIARY (debug) > S_GET_NUMBER_AUXILIARY (normal)) - { - S_SET_NUMBER_AUXILIARY (normal, S_GET_NUMBER_AUXILIARY (debug)); - } /* take the most we have */ + S_SET_NUMBER_AUXILIARY (normal, S_GET_NUMBER_AUXILIARY (debug)); if (S_GET_NUMBER_AUXILIARY (debug) > 0) - { - memcpy ((char *) &normal->sy_symbol.ost_auxent[0], - (char *) &debug->sy_symbol.ost_auxent[0], - (unsigned int) (S_GET_NUMBER_AUXILIARY (debug) * AUXESZ)); - } /* Move all the auxiliary information */ + memcpy ((char *) &normal->sy_symbol.ost_auxent[0], + (char *) &debug->sy_symbol.ost_auxent[0], + (unsigned int) (S_GET_NUMBER_AUXILIARY (debug) * AUXESZ)); /* Move the debug flags. */ SF_SET_DEBUG_FIELD (normal, SF_GET_DEBUG_FIELD (debug)); -} /* c_symbol_merge() */ +} static int c_line_new (symbol, paddr, line_number, frag) @@ -3868,13 +3832,10 @@ new_line->next = (struct lineno_list *) NULL; if (s->lineno_list_head == (struct lineno_list *) NULL) - { - s->lineno_list_head = new_line; - } + s->lineno_list_head = new_line; else - { - s->lineno_list_tail->next = new_line; - } + s->lineno_list_tail->next = new_line; + s->lineno_list_tail = new_line; return LINESZ * s->scnhdr.s_nlnno++; } @@ -3898,7 +3859,7 @@ /* Filename is too long to fit into an auxent, we stick it into the string table instead. We keep a linked list of the filenames we find so we can emit - them later.*/ + them later. */ struct filename_list *f = ((struct filename_list *) xmalloc (sizeof (struct filename_list))); @@ -3922,29 +3883,23 @@ { extern int listing; if (listing) - { - listing_source_file (filename); - } - + listing_source_file (filename); } - #endif SF_SET_DEBUG (symbolP); S_SET_VALUE (symbolP, (valueT) previous_file_symbol); previous_file_symbol = symbolP; - /* Make sure that the symbol is first on the symbol chain */ + /* Make sure that the symbol is first on the symbol chain. */ if (symbol_rootP != symbolP) { symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); symbol_insert (symbolP, symbol_rootP, &symbol_rootP, &symbol_lastP); } -} /* c_dot_file_symbol() */ +} -/* - * Build a 'section static' symbol. - */ +/* Build a 'section static' symbol. */ symbolS * c_section_symbol (name, idx) @@ -4004,7 +3959,7 @@ #endif /* TE_PE */ return symbolP; -} /* c_section_symbol() */ +} static void w_symbols (abfd, where, symbol_rootP) @@ -4015,7 +3970,7 @@ symbolS *symbolP; unsigned int i; - /* First fill in those values we have only just worked out */ + /* First fill in those values we have only just worked out. */ for (i = SEG_E0; i < SEG_LAST; i++) { symbolP = segment_info[i].dot; @@ -4027,23 +3982,19 @@ } } - /* - * Emit all symbols left in the symbol chain. - */ + /* Emit all symbols left in the symbol chain. */ for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP)) { /* Used to save the offset of the name. It is used to point - to the string in memory but must be a file offset. */ - register char *temp; + to the string in memory but must be a file offset. */ + char *temp; /* We can't fix the lnnoptr field in yank_symbols with the other adjustments, because we have to wait until we know where they go in the file. */ if (SF_GET_ADJ_LNNOPTR (symbolP)) - { - SA_GET_SYM_LNNOPTR (symbolP) += - segment_info[S_GET_SEGMENT (symbolP)].scnhdr.s_lnnoptr; - } + SA_GET_SYM_LNNOPTR (symbolP) += + segment_info[S_GET_SEGMENT (symbolP)].scnhdr.s_lnnoptr; tc_coff_symbol_emit_hook (symbolP); @@ -4061,8 +4012,7 @@ where = symbol_to_chars (abfd, where, symbolP); S_SET_NAME (symbolP, temp); } - -} /* w_symbols() */ +} static void obj_coff_lcomm (ignore) @@ -4112,7 +4062,7 @@ if (! need_pass_2) { char *p; - segT current_seg = now_seg; /* save current seg */ + segT current_seg = now_seg; /* Save current seg. */ subsegT current_subseg = now_subseg; subseg_set (SEG_E2, 1); @@ -4120,7 +4070,7 @@ p = frag_var(rs_org, 1, 1, (relax_substateT)0, symbolP, (offsetT) temp, (char *) 0); *p = 0; - subseg_set (current_seg, current_subseg); /* restore current seg */ + subseg_set (current_seg, current_subseg); /* Restore current seg. */ S_SET_SEGMENT (symbolP, SEG_E2); S_SET_STORAGE_CLASS (symbolP, C_STAT); } @@ -4139,6 +4089,7 @@ segT this_segment; { subseg_change (this_segment, 0); + while (frags) { switch (frags->fr_type) @@ -4177,16 +4128,16 @@ segment_info_type * segP; segT this_segment_type; { - register fixS * fixP; - register symbolS *add_symbolP; - register symbolS *sub_symbolP; + fixS * fixP; + symbolS *add_symbolP; + symbolS *sub_symbolP; long add_number; - register int size; - register char *place; - register long where; - register char pcrel; - register fragS *fragP; - register segT add_symbol_segment = absolute_section; + int size; + char *place; + long where; + char pcrel; + fragS *fragP; + segT add_symbol_segment = absolute_section; for (fixP = segP->fix_root; fixP; fixP = fixP->fx_next) { @@ -4274,9 +4225,7 @@ } if (add_symbolP) - { - add_symbol_segment = S_GET_SEGMENT (add_symbolP); - } /* if there is an addend */ + add_symbol_segment = S_GET_SEGMENT (add_symbolP); if (sub_symbolP) { @@ -4307,7 +4256,7 @@ } /* not absolute */ /* if sub_symbol is in the same segment that add_symbol - and add_symbol is either in DATA, TEXT, BSS or ABSOLUTE */ + and add_symbol is either in DATA, TEXT, BSS or ABSOLUTE. */ } else if (S_GET_SEGMENT (sub_symbolP) == add_symbol_segment && SEG_NORMAL (add_symbol_segment)) @@ -4319,10 +4268,8 @@ /* Makes no sense to use the difference of 2 arbitrary symbols as the target of a call instruction. */ if (fixP->fx_tcbit) - { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("callj to difference of 2 symbols")); - } + as_bad_where (fixP->fx_file, fixP->fx_line, + _("callj to difference of 2 symbols")); #endif /* TC_I960 */ add_number += S_GET_VALUE (add_symbolP) - S_GET_VALUE (sub_symbolP); @@ -4345,9 +4292,8 @@ know (!(S_IS_EXTERNAL (sub_symbolP) && (S_GET_SEGMENT (sub_symbolP) == absolute_section))); if ((S_GET_SEGMENT (sub_symbolP) == absolute_section)) - { - add_number -= S_GET_VALUE (sub_symbolP); - } + add_number -= S_GET_VALUE (sub_symbolP); + #ifdef DIFF_EXPR_OK else if (S_GET_SEGMENT (sub_symbolP) == this_segment_type #if 0 /* Okay for 68k, at least... */ @@ -4371,25 +4317,22 @@ segment_name (S_GET_SEGMENT (sub_symbolP)), S_GET_NAME (sub_symbolP), (long) (fragP->fr_address + where)); - } /* if absolute */ + } } - } /* if sub_symbolP */ + } if (add_symbolP) { if (add_symbol_segment == this_segment_type && pcrel) { - /* - * This fixup was made when the symbol's segment was - * SEG_UNKNOWN, but it is now in the local segment. - * So we know how to do the address without relocation. - */ + /* This fixup was made when the symbol's segment was + SEG_UNKNOWN, but it is now in the local segment. + So we know how to do the address without relocation. */ #ifdef TC_I960 /* reloc_callj() may replace a 'call' with a 'calls' or a 'bal', - * in which cases it modifies *fixP as appropriate. In the case - * of a 'calls', no further work is required, and *fixP has been - * set up to make the rest of the code below a no-op. - */ + in which cases it modifies *fixP as appropriate. In the case + of a 'calls', no further work is required, and *fixP has been + set up to make the rest of the code below a no-op. */ reloc_callj (fixP); #endif /* TC_I960 */ @@ -4423,7 +4366,8 @@ { case absolute_section: #ifdef TC_I960 - reloc_callj (fixP); /* See comment about reloc_callj() above*/ + /* See comment about reloc_callj() above. */ + reloc_callj (fixP); #endif /* TC_I960 */ add_number += S_GET_VALUE (add_symbolP); add_symbolP = NULL; @@ -4451,16 +4395,15 @@ if ((int) fixP->fx_bit_fixP == 13) { /* This is a COBR instruction. They have only a - * 13-bit displacement and are only to be used - * for local branches: flag as error, don't generate - * relocation. - */ + 13-bit displacement and are only to be used + for local branches: flag as error, don't generate + relocation. */ as_bad_where (fixP->fx_file, fixP->fx_line, _("can't use COBR format with external label")); fixP->fx_addsy = NULL; fixP->fx_done = 1; continue; - } /* COBR */ + } #endif /* TC_I960 */ #if ((defined (TC_I386) || defined (TE_LYNX) || defined (TE_AUX)) && !defined(TE_PE)) || defined (COFF_COMMON_ADDEND) /* 386 COFF uses a peculiar format in which the @@ -4476,9 +4419,9 @@ #endif break; - } /* switch on symbol seg */ - } /* if not in local seg */ - } /* if there was a + symbol */ + } + } + } if (pcrel) { @@ -4488,9 +4431,7 @@ add_number -= md_pcrel_from (fixP); #endif if (add_symbolP == 0) - { - fixP->fx_addsy = &abs_symbol; - } /* if there's an add_symbol */ + fixP->fx_addsy = &abs_symbol; #if defined (TC_I386) || defined (TE_LYNX) || defined (TC_I960) || defined (TC_M68K) /* On the 386 we must adjust by the segment vaddr as well. Ian Taylor. @@ -4510,7 +4451,7 @@ add_number -= segP->scnhdr.s_vaddr; #endif - } /* if pcrel */ + } md_apply_fix3 (fixP, (valueT *) & add_number, this_segment_type); @@ -4549,9 +4490,9 @@ (long) add_number, (unsigned long) (fragP->fr_address + where)); #endif - } /* not a bit fix */ - } /* For each fixS in this segment. */ -} /* fixup_segment() */ + } + } +} #endif diff -Nur binutils-2.12/gas/config/obj-elf.c binutils-2.12.1/gas/config/obj-elf.c --- binutils-2.12/gas/config/obj-elf.c Mon Jan 28 08:34:39 2002 +++ binutils-2.12.1/gas/config/obj-elf.c Mon Apr 1 20:28:59 2002 @@ -595,6 +595,27 @@ { ".rodata", SHT_PROGBITS, SHF_ALLOC }, { ".rodata1", SHT_PROGBITS, SHF_ALLOC }, { ".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, +#if 0 + /* FIXME: The current gcc, as of 2002-03-03, will emit + + .section .init_array,"aw",@progbits + + for __attribute__ ((section (".init_array"))). "@progbits" marks + the incorrect section type. For now, we make them with + SHT_PROGBITS. BFD will fix the section type. Gcc should be changed + to emit + + .section .init_array + + */ + { ".init_array",SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE }, + { ".fini_array",SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE }, + { ".preinit_array",SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE }, +#else + { ".init_array",SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".fini_array",SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".preinit_array",SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, +#endif #ifdef ELF_TC_SPECIAL_SECTIONS ELF_TC_SPECIAL_SECTIONS @@ -1408,7 +1429,9 @@ destelf->size = NULL; } S_SET_SIZE (dest, S_GET_SIZE (src)); - S_SET_OTHER (dest, S_GET_OTHER (src)); + /* Don't copy visibility. */ + S_SET_OTHER (dest, (ELF_ST_VISIBILITY (S_GET_OTHER (dest)) + | (S_GET_OTHER (src) & ~ELF_ST_VISIBILITY (-1)))); } void @@ -1838,6 +1861,8 @@ /* This will copy over the size information. */ copy_symbol_attributes (symp2, symp); + + S_SET_OTHER (symp2, S_GET_OTHER (symp)); if (S_IS_WEAK (symp)) S_SET_WEAK (symp2); diff -Nur binutils-2.12/gas/config/tc-arm.c binutils-2.12.1/gas/config/tc-arm.c --- binutils-2.12/gas/config/tc-arm.c Sat Jan 19 09:52:01 2002 +++ binutils-2.12.1/gas/config/tc-arm.c Sat May 11 11:13:29 2002 @@ -521,7 +521,7 @@ unsigned long regno; }; -static const struct vfp_reg vfp_regs[] = +static const struct vfp_reg vfp_regs[] = { {"fpsid", 0x00000000}, {"FPSID", 0x00000000}, @@ -842,7 +842,7 @@ static void do_mav_binops_3b PARAMS ((char *)); static void do_mav_binops_3c PARAMS ((char *)); static void do_mav_binops_3d PARAMS ((char *)); -static void do_mav_triple PARAMS ((char *, int, enum arm_reg_type, +static void do_mav_triple PARAMS ((char *, int, enum arm_reg_type, enum arm_reg_type, enum arm_reg_type)); static void do_mav_triple_4a PARAMS ((char *)); @@ -855,7 +855,7 @@ static void do_mav_triple_5f PARAMS ((char *)); static void do_mav_triple_5g PARAMS ((char *)); static void do_mav_triple_5h PARAMS ((char *)); -static void do_mav_quad PARAMS ((char *, int, enum arm_reg_type, +static void do_mav_quad PARAMS ((char *, int, enum arm_reg_type, enum arm_reg_type, enum arm_reg_type, enum arm_reg_type)); @@ -1106,7 +1106,7 @@ {"strh", 0xe00000b0, 3, ARM_EXT_V4, do_ldstv4}, /* ARM Architecture 4T. */ - /* Note: bx (and blx) are required on V5, even if the processor does + /* Note: bx (and blx) are required on V5, even if the processor does not support Thumb. */ {"bx", 0xe12fff10, 2, ARM_EXT_V4T | ARM_EXT_V5, do_bx}, @@ -6425,7 +6425,7 @@ static int vfp_dp_reg_required_here (str, pos) char **str; - enum vfp_sp_reg_pos pos; + enum vfp_dp_reg_pos pos; { int reg; char *start = *str; @@ -7447,7 +7447,9 @@ return; } } - else + /* Note - you cannot convert a subtract of 0 into an + add of 0 because the carry flag is set differently. */ + else if (offset > 0) subtract = 0; if (Rd == REG_SP) @@ -7927,7 +7929,7 @@ /* Restore the start point. */ *str = start; - + /* In the few cases where we might be able to accept something else this error can be overridden. */ inst.error = _(all_reg_maps[regtype].expected); diff -Nur binutils-2.12/gas/config/tc-hppa.c binutils-2.12.1/gas/config/tc-hppa.c --- binutils-2.12/gas/config/tc-hppa.c Sun Feb 17 18:12:09 2002 +++ binutils-2.12.1/gas/config/tc-hppa.c Mon Apr 1 20:29:02 2002 @@ -4459,7 +4459,7 @@ return; } - buf = fixP->fx_frag->fr_literal + fixP->fx_where; + buf = (unsigned char *) (fixP->fx_frag->fr_literal + fixP->fx_where); insn = bfd_get_32 (stdoutput, buf); fmt = bfd_hppa_insn2fmt (stdoutput, insn); @@ -8398,13 +8398,8 @@ { /* Relocation types which use e_lrsel. */ case R_PARISC_DIR21L: - case R_PARISC_DLTIND21L: case R_PARISC_DLTREL21L: case R_PARISC_DPREL21L: - case R_PARISC_LTOFF_FPTR21L: - case R_PARISC_LTOFF_TP21L: - case R_PARISC_PCREL21L: - case R_PARISC_PLABEL21L: case R_PARISC_PLTOFF21L: /* Relocation types which use e_rrsel. */ @@ -8412,24 +8407,15 @@ case R_PARISC_DIR14DR: case R_PARISC_DIR14WR: case R_PARISC_DIR17R: - case R_PARISC_DLTIND14R: - case R_PARISC_DLTIND14DR: - case R_PARISC_DLTIND14WR: case R_PARISC_DLTREL14R: case R_PARISC_DLTREL14DR: case R_PARISC_DLTREL14WR: case R_PARISC_DPREL14R: case R_PARISC_DPREL14DR: case R_PARISC_DPREL14WR: - case R_PARISC_PCREL14R: - case R_PARISC_PCREL17R: - case R_PARISC_PLABEL14R: - case R_PARISC_LTOFF_FPTR14R: - case R_PARISC_LTOFF_FPTR14DR: - case R_PARISC_LTOFF_FPTR14WR: - case R_PARISC_LTOFF_TP14R: - case R_PARISC_LTOFF_TP14DR: - case R_PARISC_LTOFF_TP14WR: + case R_PARISC_PLTOFF14R: + case R_PARISC_PLTOFF14DR: + case R_PARISC_PLTOFF14WR: /* Other types that we reject for reduction. */ case R_PARISC_GNU_VTENTRY: diff -Nur binutils-2.12/gas/config/tc-i386.c binutils-2.12.1/gas/config/tc-i386.c --- binutils-2.12/gas/config/tc-i386.c Fri Feb 15 09:21:07 2002 +++ binutils-2.12.1/gas/config/tc-i386.c Thu May 9 10:49:39 2002 @@ -48,20 +48,31 @@ #define SCALE1_WHEN_NO_INDEX 1 #endif -#ifndef true -#define true 1 +#ifdef BFD_ASSEMBLER +#define RELOC_ENUM enum bfd_reloc_code_real +#else +#define RELOC_ENUM int +#endif + +#ifndef DEFAULT_ARCH +#define DEFAULT_ARCH "i386" +#endif + +#ifndef INLINE +#if __GNUC__ >= 2 +#define INLINE __inline__ +#else +#define INLINE #endif -#ifndef false -#define false 0 #endif -static unsigned int mode_from_disp_size PARAMS ((unsigned int)); -static int fits_in_signed_byte PARAMS ((offsetT)); -static int fits_in_unsigned_byte PARAMS ((offsetT)); -static int fits_in_unsigned_word PARAMS ((offsetT)); -static int fits_in_signed_word PARAMS ((offsetT)); -static int fits_in_unsigned_long PARAMS ((offsetT)); -static int fits_in_signed_long PARAMS ((offsetT)); +static INLINE unsigned int mode_from_disp_size PARAMS ((unsigned int)); +static INLINE int fits_in_signed_byte PARAMS ((offsetT)); +static INLINE int fits_in_unsigned_byte PARAMS ((offsetT)); +static INLINE int fits_in_unsigned_word PARAMS ((offsetT)); +static INLINE int fits_in_signed_word PARAMS ((offsetT)); +static INLINE int fits_in_unsigned_long PARAMS ((offsetT)); +static INLINE int fits_in_signed_long PARAMS ((offsetT)); static int smallest_imm_type PARAMS ((offsetT)); static offsetT offset_in_range PARAMS ((offsetT, int)); static int add_prefix PARAMS ((unsigned int)); @@ -69,18 +80,36 @@ static void set_16bit_gcc_code_flag PARAMS ((int)); static void set_intel_syntax PARAMS ((int)); static void set_cpu_arch PARAMS ((int)); - -#ifdef BFD_ASSEMBLER -static bfd_reloc_code_real_type reloc - PARAMS ((int, int, int, bfd_reloc_code_real_type)); -#define RELOC_ENUM enum bfd_reloc_code_real -#else -#define RELOC_ENUM int +static char *output_invalid PARAMS ((int c)); +static int i386_operand PARAMS ((char *operand_string)); +static int i386_intel_operand PARAMS ((char *operand_string, int got_a_float)); +static const reg_entry *parse_register PARAMS ((char *reg_string, + char **end_op)); +static char *parse_insn PARAMS ((char *, char *)); +static char *parse_operands PARAMS ((char *, const char *)); +static void swap_operands PARAMS ((void)); +static void optimize_imm PARAMS ((void)); +static void optimize_disp PARAMS ((void)); +static int match_template PARAMS ((void)); +static int check_string PARAMS ((void)); +static int process_suffix PARAMS ((void)); +static int check_byte_reg PARAMS ((void)); +static int check_long_reg PARAMS ((void)); +static int check_qword_reg PARAMS ((void)); +static int check_word_reg PARAMS ((void)); +static int finalize_imm PARAMS ((void)); +static int process_operands PARAMS ((void)); +static const seg_entry *build_modrm_byte PARAMS ((void)); +static void output_insn PARAMS ((void)); +static void output_branch PARAMS ((void)); +static void output_jump PARAMS ((void)); +static void output_interseg_jump PARAMS ((void)); +static void output_imm PARAMS ((void)); +static void output_disp PARAMS ((void)); +#ifndef I386COFF +static void s_bss PARAMS ((int)); #endif -#ifndef DEFAULT_ARCH -#define DEFAULT_ARCH "i386" -#endif static const char *default_arch = DEFAULT_ARCH; /* 'md_assemble ()' gathers together information and puts it into a @@ -153,22 +182,20 @@ /* List of chars besides those in app.c:symbol_chars that can start an operand. Used to prevent the scrubber eating vital white-space. */ #ifdef LEX_AT -const char extra_symbol_chars[] = "*%-(@"; +const char extra_symbol_chars[] = "*%-(@["; #else -const char extra_symbol_chars[] = "*%-("; +const char extra_symbol_chars[] = "*%-(["; #endif +#if (defined (TE_I386AIX) \ + || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) \ + && !defined (TE_LINUX) \ + && !defined (TE_FreeBSD) \ + && !defined (TE_NetBSD))) /* This array holds the chars that always start a comment. If the pre-processor is disabled, these aren't very useful. */ -#if defined (TE_I386AIX) || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && ! defined (TE_LINUX) && !defined(TE_FreeBSD) && !defined(TE_NetBSD)) -/* Putting '/' here makes it impossible to use the divide operator. - However, we need it for compatibility with SVR4 systems. */ const char comment_chars[] = "#/"; #define PREFIX_SEPARATOR '\\' -#else -const char comment_chars[] = "#"; -#define PREFIX_SEPARATOR '/' -#endif /* This array holds the chars that only start a comment at the beginning of a line. If the line seems to have the form '# 123 filename' @@ -178,9 +205,14 @@ #NO_APP at the beginning of its output. Also note that comments started like this one will always work if '/' isn't otherwise defined. */ -#if defined (TE_I386AIX) || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && ! defined (TE_LINUX) && !defined(TE_FreeBSD) && !defined(TE_NetBSD)) const char line_comment_chars[] = ""; + #else +/* Putting '/' here makes it impossible to use the divide operator. + However, we need it for compatibility with SVR4 systems. */ +const char comment_chars[] = "#"; +#define PREFIX_SEPARATOR '/' + const char line_comment_chars[] = "/"; #endif @@ -275,12 +307,15 @@ static const char *cpu_arch_name = NULL; /* CPU feature flags. */ -static unsigned int cpu_arch_flags = CpuUnknownFlags|CpuNo64; +static unsigned int cpu_arch_flags = CpuUnknownFlags | CpuNo64; /* If set, conditional jumps are not automatically promoted to handle larger than a byte offset. */ static unsigned int no_cond_jump_promotion = 0; +/* Pre-defined "_GLOBAL_OFFSET_TABLE_". */ +symbolS *GOT_symbol; + /* Interface to relax_segment. There are 3 major relax states for 386 jump insns because the different types of jumps add different sizes to frags when we're @@ -294,9 +329,9 @@ /* Sizes. */ #define CODE16 1 #define SMALL 0 -#define SMALL16 (SMALL|CODE16) +#define SMALL16 (SMALL | CODE16) #define BIG 2 -#define BIG16 (BIG|CODE16) +#define BIG16 (BIG | CODE16) #ifndef INLINE #ifdef __GNUC__ @@ -377,6 +412,43 @@ {NULL, 0 } }; +const pseudo_typeS md_pseudo_table[] = +{ +#if !defined(OBJ_AOUT) && !defined(USE_ALIGN_PTWO) + {"align", s_align_bytes, 0}, +#else + {"align", s_align_ptwo, 0}, +#endif + {"arch", set_cpu_arch, 0}, +#ifndef I386COFF + {"bss", s_bss, 0}, +#endif + {"ffloat", float_cons, 'f'}, + {"dfloat", float_cons, 'd'}, + {"tfloat", float_cons, 'x'}, + {"value", cons, 2}, + {"noopt", s_ignore, 0}, + {"optim", s_ignore, 0}, + {"code16gcc", set_16bit_gcc_code_flag, CODE_16BIT}, + {"code16", set_code_flag, CODE_16BIT}, + {"code32", set_code_flag, CODE_32BIT}, + {"code64", set_code_flag, CODE_64BIT}, + {"intel_syntax", set_intel_syntax, 1}, + {"att_syntax", set_intel_syntax, 0}, + {"file", dwarf2_directive_file, 0}, + {"loc", dwarf2_directive_loc, 0}, + {0, 0, 0} +}; + +/* For interface with expression (). */ +extern char *input_line_pointer; + +/* Hash table for instruction mnemonic lookup. */ +static struct hash_control *op_hash; + +/* Hash table for register lookup. */ +static struct hash_control *reg_hash; + void i386_align_code (fragP, count) fragS *fragP; @@ -471,18 +543,6 @@ } } -static char *output_invalid PARAMS ((int c)); -static int i386_operand PARAMS ((char *operand_string)); -static int i386_intel_operand PARAMS ((char *operand_string, int got_a_float)); -static const reg_entry *parse_register PARAMS ((char *reg_string, - char **end_op)); - -#ifndef I386COFF -static void s_bss PARAMS ((int)); -#endif - -symbolS *GOT_symbol; /* Pre-defined "_GLOBAL_OFFSET_TABLE_". */ - static INLINE unsigned int mode_from_disp_size (t) unsigned int t; @@ -610,7 +670,8 @@ int ret = 1; int q; - if (prefix >= 0x40 && prefix < 0x50 && flag_code == CODE_64BIT) + if (prefix >= REX_OPCODE && prefix < REX_OPCODE + 16 + && flag_code == CODE_64BIT) q = REX_PREFIX; else switch (prefix) @@ -648,7 +709,7 @@ break; } - if (i.prefix[q]) + if (i.prefix[q] != 0) { as_bad (_("same type of prefix used twice")); return 0; @@ -695,7 +756,7 @@ int ask_naked_reg = 0; SKIP_WHITESPACE (); - if (! is_end_of_line[(unsigned char) *input_line_pointer]) + if (!is_end_of_line[(unsigned char) *input_line_pointer]) { char *string = input_line_pointer; int e = get_symbol_end (); @@ -732,7 +793,7 @@ { SKIP_WHITESPACE (); - if (! is_end_of_line[(unsigned char) *input_line_pointer]) + if (!is_end_of_line[(unsigned char) *input_line_pointer]) { char *string = input_line_pointer; int e = get_symbol_end (); @@ -758,7 +819,7 @@ no_cond_jump_promotion = 0; if (*input_line_pointer == ',' - && ! is_end_of_line[(unsigned char) input_line_pointer[1]]) + && !is_end_of_line[(unsigned char) input_line_pointer[1]]) { char *string = ++input_line_pointer; int e = get_symbol_end (); @@ -776,43 +837,6 @@ demand_empty_rest_of_line (); } -const pseudo_typeS md_pseudo_table[] = -{ -#if !defined(OBJ_AOUT) && !defined(USE_ALIGN_PTWO) - {"align", s_align_bytes, 0}, -#else - {"align", s_align_ptwo, 0}, -#endif - {"arch", set_cpu_arch, 0}, -#ifndef I386COFF - {"bss", s_bss, 0}, -#endif - {"ffloat", float_cons, 'f'}, - {"dfloat", float_cons, 'd'}, - {"tfloat", float_cons, 'x'}, - {"value", cons, 2}, - {"noopt", s_ignore, 0}, - {"optim", s_ignore, 0}, - {"code16gcc", set_16bit_gcc_code_flag, CODE_16BIT}, - {"code16", set_code_flag, CODE_16BIT}, - {"code32", set_code_flag, CODE_32BIT}, - {"code64", set_code_flag, CODE_64BIT}, - {"intel_syntax", set_intel_syntax, 1}, - {"att_syntax", set_intel_syntax, 0}, - {"file", dwarf2_directive_file, 0}, - {"loc", dwarf2_directive_loc, 0}, - {0, 0, 0} -}; - -/* For interface with expression (). */ -extern char *input_line_pointer; - -/* Hash table for instruction mnemonic lookup. */ -static struct hash_control *op_hash; - -/* Hash table for register lookup. */ -static struct hash_control *reg_hash; - #ifdef BFD_ASSEMBLER unsigned long i386_mach () @@ -835,8 +859,8 @@ op_hash = hash_new (); { - register const template *optab; - register templates *core_optab; + const template *optab; + templates *core_optab; /* Setup for loop. */ optab = i386_optab; @@ -872,7 +896,7 @@ /* Initialize reg_hash hash table. */ reg_hash = hash_new (); { - register const reg_entry *regtab; + const reg_entry *regtab; for (regtab = i386_regtab; regtab < i386_regtab + sizeof (i386_regtab) / sizeof (i386_regtab[0]); @@ -888,8 +912,8 @@ /* Fill in lexical tables: mnemonic_chars, operand_chars. */ { - register int c; - register char *p; + int c; + char *p; for (c = 0; c < 256; c++) { @@ -978,7 +1002,10 @@ fprintf (stdout, " sib: base %x index %x scale %x\n", x->sib.base, x->sib.index, x->sib.scale); fprintf (stdout, " rex: 64bit %x extX %x extY %x extZ %x\n", - x->rex.mode64, x->rex.extX, x->rex.extY, x->rex.extZ); + (x->rex & REX_MODE64) != 0, + (x->rex & REX_EXTX) != 0, + (x->rex & REX_EXTY) != 0, + (x->rex & REX_EXTZ) != 0); for (i = 0; i < x->operands; i++) { fprintf (stdout, " #%d: ", i + 1); @@ -1053,7 +1080,7 @@ char *tname; } -type_names[] = +static const type_names[] = { { Reg8, "r8" }, { Reg16, "r16" }, @@ -1093,7 +1120,7 @@ pt (t) unsigned int t; { - register struct type_name *ty; + const struct type_name *ty; for (ty = type_names; ty->mask; ty++) if (t & ty->mask) @@ -1119,6 +1146,8 @@ } #ifdef BFD_ASSEMBLER +static bfd_reloc_code_real_type reloc + PARAMS ((int, int, int, bfd_reloc_code_real_type)); static bfd_reloc_code_real_type reloc (size, pcrel, sign, other) @@ -1212,11 +1241,11 @@ #define BFD_RELOC_X86_64_GOTPCREL 0 #endif -static int intel_float_operand PARAMS ((char *mnemonic)); +static int intel_float_operand PARAMS ((const char *mnemonic)); static int intel_float_operand (mnemonic) - char *mnemonic; + const char *mnemonic; { if (mnemonic[0] == 'f' && mnemonic[1] == 'i') return 2; @@ -1235,11 +1264,7 @@ md_assemble (line) char *line; { - /* Points to template once we've found it. */ - const template *t; - int j; - char mnemonic[MAX_MNEM_SIZE]; /* Initialize globals. */ @@ -1253,1908 +1278,2075 @@ /* First parse an instruction mnemonic & call i386_operand for the operands. We assume that the scrubber has arranged it so that line[0] is the valid start of a (possibly prefixed) mnemonic. */ - { - char *l = line; - char *token_start = l; - char *mnem_p; - /* Non-zero if we found a prefix only acceptable with string insns. */ - const char *expecting_string_instruction = NULL; + line = parse_insn (line, mnemonic); + if (line == NULL) + return; + + line = parse_operands (line, mnemonic); + if (line == NULL) + return; - while (1) - { - mnem_p = mnemonic; - while ((*mnem_p = mnemonic_chars[(unsigned char) *l]) != 0) - { - mnem_p++; - if (mnem_p >= mnemonic + sizeof (mnemonic)) - { - as_bad (_("no such instruction: `%s'"), token_start); - return; - } - l++; - } - if (!is_space_char (*l) - && *l != END_OF_INSN - && *l != PREFIX_SEPARATOR - && *l != ',') - { - as_bad (_("invalid character %s in mnemonic"), - output_invalid (*l)); - return; - } - if (token_start == l) - { - if (*l == PREFIX_SEPARATOR) - as_bad (_("expecting prefix; got nothing")); - else - as_bad (_("expecting mnemonic; got nothing")); - return; - } + /* Now we've parsed the mnemonic into a set of templates, and have the + operands at hand. */ - /* Look up instruction (or prefix) via hash table. */ - current_templates = hash_find (op_hash, mnemonic); + /* All intel opcodes have reversed operands except for "bound" and + "enter". We also don't reverse intersegment "jmp" and "call" + instructions with 2 immediate operands so that the immediate segment + precedes the offset, as it does when in AT&T mode. "enter" and the + intersegment "jmp" and "call" instructions are the only ones that + have two immediate operands. */ + if (intel_syntax && i.operands > 1 + && (strcmp (mnemonic, "bound") != 0) + && !((i.types[0] & Imm) && (i.types[1] & Imm))) + swap_operands (); - if (*l != END_OF_INSN - && (! is_space_char (*l) || l[1] != END_OF_INSN) - && current_templates - && (current_templates->start->opcode_modifier & IsPrefix)) - { - /* If we are in 16-bit mode, do not allow addr16 or data16. - Similarly, in 32-bit mode, do not allow addr32 or data32. */ - if ((current_templates->start->opcode_modifier & (Size16 | Size32)) - && flag_code != CODE_64BIT - && (((current_templates->start->opcode_modifier & Size32) != 0) - ^ (flag_code == CODE_16BIT))) - { - as_bad (_("redundant %s prefix"), - current_templates->start->name); - return; - } - /* Add prefix, checking for repeated prefixes. */ - switch (add_prefix (current_templates->start->base_opcode)) - { - case 0: - return; - case 2: - expecting_string_instruction = current_templates->start->name; - break; - } - /* Skip past PREFIX_SEPARATOR and reset token_start. */ - token_start = ++l; - } - else - break; - } + if (i.imm_operands) + optimize_imm (); - if (!current_templates) - { - /* See if we can get a match by trimming off a suffix. */ - switch (mnem_p[-1]) - { - case WORD_MNEM_SUFFIX: - case BYTE_MNEM_SUFFIX: - case QWORD_MNEM_SUFFIX: - i.suffix = mnem_p[-1]; - mnem_p[-1] = '\0'; - current_templates = hash_find (op_hash, mnemonic); - break; - case SHORT_MNEM_SUFFIX: - case LONG_MNEM_SUFFIX: - if (!intel_syntax) - { - i.suffix = mnem_p[-1]; - mnem_p[-1] = '\0'; - current_templates = hash_find (op_hash, mnemonic); - } - break; + if (i.disp_operands) + optimize_disp (); - /* Intel Syntax. */ - case 'd': - if (intel_syntax) - { - if (intel_float_operand (mnemonic)) - i.suffix = SHORT_MNEM_SUFFIX; - else - i.suffix = LONG_MNEM_SUFFIX; - mnem_p[-1] = '\0'; - current_templates = hash_find (op_hash, mnemonic); - } - break; - } - if (!current_templates) - { - as_bad (_("no such instruction: `%s'"), token_start); - return; - } - } + /* Next, we find a template that matches the given insn, + making sure the overlap of the given operands types is consistent + with the template operand types. */ - if (current_templates->start->opcode_modifier & (Jump | JumpByte)) - { - /* Check for a branch hint. We allow ",pt" and ",pn" for - predict taken and predict not taken respectively. - I'm not sure that branch hints actually do anything on loop - and jcxz insns (JumpByte) for current Pentium4 chips. They - may work in the future and it doesn't hurt to accept them - now. */ - if (l[0] == ',' && l[1] == 'p') - { - if (l[2] == 't') - { - if (! add_prefix (DS_PREFIX_OPCODE)) - return; - l += 3; - } - else if (l[2] == 'n') - { - if (! add_prefix (CS_PREFIX_OPCODE)) - return; - l += 3; - } - } - } - /* Any other comma loses. */ - if (*l == ',') - { - as_bad (_("invalid character %s in mnemonic"), - output_invalid (*l)); + if (!match_template ()) + return; + + /* Undo SYSV386_COMPAT brokenness when in Intel mode. See i386.h */ + if (SYSV386_COMPAT + && intel_syntax + && (i.tm.base_opcode & 0xfffffde0) == 0xdce0) + i.tm.base_opcode ^= FloatR; + + if (i.tm.opcode_modifier & FWait) + if (!add_prefix (FWAIT_OPCODE)) + return; + + /* Check string instruction segment overrides. */ + if ((i.tm.opcode_modifier & IsString) != 0 && i.mem_operands != 0) + { + if (!check_string ()) return; - } + } - /* Check if instruction is supported on specified architecture. */ - if ((current_templates->start->cpu_flags & ~(Cpu64 | CpuNo64)) - & ~(cpu_arch_flags & ~(Cpu64 | CpuNo64))) - { - as_warn (_("`%s' is not supported on `%s'"), - current_templates->start->name, cpu_arch_name); - } - else if ((Cpu386 & ~cpu_arch_flags) && (flag_code != CODE_16BIT)) - { - as_warn (_("use .code16 to ensure correct addressing mode")); - } + if (!process_suffix ()) + return; - /* Check for rep/repne without a string instruction. */ - if (expecting_string_instruction - && !(current_templates->start->opcode_modifier & IsString)) - { - as_bad (_("expecting string instruction after `%s'"), - expecting_string_instruction); + /* Make still unresolved immediate matches conform to size of immediate + given in i.suffix. */ + if (!finalize_imm ()) + return; + + if (i.types[0] & Imm1) + i.imm_operands = 0; /* kludge for shift insns. */ + if (i.types[0] & ImplicitRegister) + i.reg_operands--; + if (i.types[1] & ImplicitRegister) + i.reg_operands--; + if (i.types[2] & ImplicitRegister) + i.reg_operands--; + + if (i.tm.opcode_modifier & ImmExt) + { + /* These AMD 3DNow! and Intel Katmai New Instructions have an + opcode suffix which is coded in the same place as an 8-bit + immediate field would be. Here we fake an 8-bit immediate + operand from the opcode suffix stored in tm.extension_opcode. */ + + expressionS *exp; + + assert (i.imm_operands == 0 && i.operands <= 2 && 2 < MAX_OPERANDS); + + exp = &im_expressions[i.imm_operands++]; + i.op[i.operands].imms = exp; + i.types[i.operands++] = Imm8; + exp->X_op = O_constant; + exp->X_add_number = i.tm.extension_opcode; + i.tm.extension_opcode = None; + } + + /* For insns with operands there are more diddles to do to the opcode. */ + if (i.operands) + { + if (!process_operands ()) return; - } + } + else if (!quiet_warnings && (i.tm.opcode_modifier & Ugh) != 0) + { + /* UnixWare fsub no args is alias for fsubp, fadd -> faddp, etc. */ + as_warn (_("translating to `%sp'"), i.tm.name); + } - /* There may be operands to parse. */ - if (*l != END_OF_INSN) - { - /* 1 if operand is pending after ','. */ - unsigned int expecting_operand = 0; + /* Handle conversion of 'int $3' --> special int3 insn. */ + if (i.tm.base_opcode == INT_OPCODE && i.op[0].imms->X_add_number == 3) + { + i.tm.base_opcode = INT3_OPCODE; + i.imm_operands = 0; + } - /* Non-zero if operand parens not balanced. */ - unsigned int paren_not_balanced; + if ((i.tm.opcode_modifier & (Jump | JumpByte | JumpDword)) + && i.op[0].disps->X_op == O_constant) + { + /* Convert "jmp constant" (and "call constant") to a jump (call) to + the absolute address given by the constant. Since ix86 jumps and + calls are pc relative, we need to generate a reloc. */ + i.op[0].disps->X_add_symbol = &abs_symbol; + i.op[0].disps->X_op = O_symbol; + } - do - { - /* Skip optional white space before operand. */ - if (is_space_char (*l)) - ++l; - if (!is_operand_char (*l) && *l != END_OF_INSN) - { - as_bad (_("invalid character %s before operand %d"), - output_invalid (*l), - i.operands + 1); - return; - } - token_start = l; /* after white space */ - paren_not_balanced = 0; - while (paren_not_balanced || *l != ',') - { - if (*l == END_OF_INSN) - { - if (paren_not_balanced) - { - if (!intel_syntax) - as_bad (_("unbalanced parenthesis in operand %d."), - i.operands + 1); - else - as_bad (_("unbalanced brackets in operand %d."), - i.operands + 1); - return; - } - else - break; /* we are done */ - } - else if (!is_operand_char (*l) && !is_space_char (*l)) - { - as_bad (_("invalid character %s in operand %d"), - output_invalid (*l), - i.operands + 1); - return; - } - if (!intel_syntax) - { - if (*l == '(') - ++paren_not_balanced; - if (*l == ')') - --paren_not_balanced; - } - else - { - if (*l == '[') - ++paren_not_balanced; - if (*l == ']') - --paren_not_balanced; - } - l++; - } - if (l != token_start) - { /* Yes, we've read in another operand. */ - unsigned int operand_ok; - this_operand = i.operands++; - if (i.operands > MAX_OPERANDS) - { - as_bad (_("spurious operands; (%d operands/instruction max)"), - MAX_OPERANDS); - return; - } - /* Now parse operand adding info to 'i' as we go along. */ - END_STRING_AND_SAVE (l); - - if (intel_syntax) - operand_ok = - i386_intel_operand (token_start, - intel_float_operand (mnemonic)); - else - operand_ok = i386_operand (token_start); - - RESTORE_END_STRING (l); - if (!operand_ok) - return; - } - else - { - if (expecting_operand) - { - expecting_operand_after_comma: - as_bad (_("expecting operand after ','; got nothing")); - return; - } - if (*l == ',') - { - as_bad (_("expecting operand before ','; got nothing")); - return; - } - } + if ((i.tm.opcode_modifier & Rex64) != 0) + i.rex |= REX_MODE64; - /* Now *l must be either ',' or END_OF_INSN. */ - if (*l == ',') - { - if (*++l == END_OF_INSN) - { - /* Just skip it, if it's \n complain. */ - goto expecting_operand_after_comma; - } - expecting_operand = 1; - } - } - while (*l != END_OF_INSN); - } - } + /* For 8 bit registers we need an empty rex prefix. Also if the + instruction already has a prefix, we need to convert old + registers to new ones. */ + + if (((i.types[0] & Reg8) != 0 + && (i.op[0].regs->reg_flags & RegRex64) != 0) + || ((i.types[1] & Reg8) != 0 + && (i.op[1].regs->reg_flags & RegRex64) != 0) + || (((i.types[0] & Reg8) != 0 || (i.types[1] & Reg8) != 0) + && i.rex != 0)) + { + int x; - /* Now we've parsed the mnemonic into a set of templates, and have the - operands at hand. + i.rex |= REX_OPCODE; + for (x = 0; x < 2; x++) + { + /* Look for 8 bit operand that uses old registers. */ + if ((i.types[x] & Reg8) != 0 + && (i.op[x].regs->reg_flags & RegRex64) == 0) + { + /* In case it is "hi" register, give up. */ + if (i.op[x].regs->reg_num > 3) + as_bad (_("can't encode register '%%%s' in an instruction requiring REX prefix.\n"), + i.op[x].regs->reg_name); - Next, we find a template that matches the given insn, - making sure the overlap of the given operands types is consistent - with the template operand types. */ + /* Otherwise it is equivalent to the extended register. + Since the encoding doesn't change this is merely + cosmetic cleanup for debug output. */ -#define MATCH(overlap, given, template) \ - ((overlap & ~JumpAbsolute) \ - && ((given) & (BaseIndex|JumpAbsolute)) == ((overlap) & (BaseIndex|JumpAbsolute))) + i.op[x].regs = i.op[x].regs + 8; + } + } + } - /* If given types r0 and r1 are registers they must be of the same type - unless the expected operand type register overlap is null. - Note that Acc in a template matches every size of reg. */ -#define CONSISTENT_REGISTER_MATCH(m0, g0, t0, m1, g1, t1) \ - ( ((g0) & Reg) == 0 || ((g1) & Reg) == 0 || \ - ((g0) & Reg) == ((g1) & Reg) || \ - ((((m0) & Acc) ? Reg : (t0)) & (((m1) & Acc) ? Reg : (t1)) & Reg) == 0 ) + if (i.rex != 0) + add_prefix (REX_OPCODE | i.rex); - { - register unsigned int overlap0, overlap1; - unsigned int overlap2; - unsigned int found_reverse_match; - int suffix_check; - - /* All intel opcodes have reversed operands except for "bound" and - "enter". We also don't reverse intersegment "jmp" and "call" - instructions with 2 immediate operands so that the immediate segment - precedes the offset, as it does when in AT&T mode. "enter" and the - intersegment "jmp" and "call" instructions are the only ones that - have two immediate operands. */ - if (intel_syntax && i.operands > 1 - && (strcmp (mnemonic, "bound") != 0) - && !((i.types[0] & Imm) && (i.types[1] & Imm))) - { - union i386_op temp_op; - unsigned int temp_type; - RELOC_ENUM temp_reloc; - int xchg1 = 0; - int xchg2 = 0; + /* We are ready to output the insn. */ + output_insn (); +} - if (i.operands == 2) - { - xchg1 = 0; - xchg2 = 1; - } - else if (i.operands == 3) - { - xchg1 = 0; - xchg2 = 2; - } - temp_type = i.types[xchg2]; - i.types[xchg2] = i.types[xchg1]; - i.types[xchg1] = temp_type; - temp_op = i.op[xchg2]; - i.op[xchg2] = i.op[xchg1]; - i.op[xchg1] = temp_op; - temp_reloc = i.reloc[xchg2]; - i.reloc[xchg2] = i.reloc[xchg1]; - i.reloc[xchg1] = temp_reloc; +static char * +parse_insn (line, mnemonic) + char *line; + char *mnemonic; +{ + char *l = line; + char *token_start = l; + char *mnem_p; - if (i.mem_operands == 2) - { - const seg_entry *temp_seg; - temp_seg = i.seg[0]; - i.seg[0] = i.seg[1]; - i.seg[1] = temp_seg; - } - } + /* Non-zero if we found a prefix only acceptable with string insns. */ + const char *expecting_string_instruction = NULL; - if (i.imm_operands) - { - /* Try to ensure constant immediates are represented in the smallest - opcode possible. */ - char guess_suffix = 0; - int op; - - if (i.suffix) - guess_suffix = i.suffix; - else if (i.reg_operands) - { - /* Figure out a suffix from the last register operand specified. - We can't do this properly yet, ie. excluding InOutPortReg, - but the following works for instructions with immediates. - In any case, we can't set i.suffix yet. */ - for (op = i.operands; --op >= 0;) - if (i.types[op] & Reg) - { - if (i.types[op] & Reg8) - guess_suffix = BYTE_MNEM_SUFFIX; - else if (i.types[op] & Reg16) - guess_suffix = WORD_MNEM_SUFFIX; - else if (i.types[op] & Reg32) - guess_suffix = LONG_MNEM_SUFFIX; - else if (i.types[op] & Reg64) - guess_suffix = QWORD_MNEM_SUFFIX; - break; - } - } - else if ((flag_code == CODE_16BIT) ^ (i.prefix[DATA_PREFIX] != 0)) - guess_suffix = WORD_MNEM_SUFFIX; + while (1) + { + mnem_p = mnemonic; + while ((*mnem_p = mnemonic_chars[(unsigned char) *l]) != 0) + { + mnem_p++; + if (mnem_p >= mnemonic + MAX_MNEM_SIZE) + { + as_bad (_("no such instruction: `%s'"), token_start); + return NULL; + } + l++; + } + if (!is_space_char (*l) + && *l != END_OF_INSN + && *l != PREFIX_SEPARATOR + && *l != ',') + { + as_bad (_("invalid character %s in mnemonic"), + output_invalid (*l)); + return NULL; + } + if (token_start == l) + { + if (*l == PREFIX_SEPARATOR) + as_bad (_("expecting prefix; got nothing")); + else + as_bad (_("expecting mnemonic; got nothing")); + return NULL; + } - for (op = i.operands; --op >= 0;) - if (i.types[op] & Imm) + /* Look up instruction (or prefix) via hash table. */ + current_templates = hash_find (op_hash, mnemonic); + + if (*l != END_OF_INSN + && (!is_space_char (*l) || l[1] != END_OF_INSN) + && current_templates + && (current_templates->start->opcode_modifier & IsPrefix)) + { + /* If we are in 16-bit mode, do not allow addr16 or data16. + Similarly, in 32-bit mode, do not allow addr32 or data32. */ + if ((current_templates->start->opcode_modifier & (Size16 | Size32)) + && flag_code != CODE_64BIT + && (((current_templates->start->opcode_modifier & Size32) != 0) + ^ (flag_code == CODE_16BIT))) { - switch (i.op[op].imms->X_op) - { - case O_constant: - /* If a suffix is given, this operand may be shortened. */ - switch (guess_suffix) - { - case LONG_MNEM_SUFFIX: - i.types[op] |= Imm32 | Imm64; - break; - case WORD_MNEM_SUFFIX: - i.types[op] |= Imm16 | Imm32S | Imm32 | Imm64; - break; - case BYTE_MNEM_SUFFIX: - i.types[op] |= Imm16 | Imm8 | Imm8S | Imm32S | Imm32 | Imm64; - break; - } + as_bad (_("redundant %s prefix"), + current_templates->start->name); + return NULL; + } + /* Add prefix, checking for repeated prefixes. */ + switch (add_prefix (current_templates->start->base_opcode)) + { + case 0: + return NULL; + case 2: + expecting_string_instruction = current_templates->start->name; + break; + } + /* Skip past PREFIX_SEPARATOR and reset token_start. */ + token_start = ++l; + } + else + break; + } - /* If this operand is at most 16 bits, convert it - to a signed 16 bit number before trying to see - whether it will fit in an even smaller size. - This allows a 16-bit operand such as $0xffe0 to - be recognised as within Imm8S range. */ - if ((i.types[op] & Imm16) - && (i.op[op].imms->X_add_number & ~(offsetT) 0xffff) == 0) - { - i.op[op].imms->X_add_number = - (((i.op[op].imms->X_add_number & 0xffff) ^ 0x8000) - 0x8000); - } - if ((i.types[op] & Imm32) - && (i.op[op].imms->X_add_number & ~(((offsetT) 2 << 31) - 1)) == 0) - { - i.op[op].imms->X_add_number = - (i.op[op].imms->X_add_number ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31); - } - i.types[op] |= smallest_imm_type (i.op[op].imms->X_add_number); - /* We must avoid matching of Imm32 templates when 64bit only immediate is available. */ - if (guess_suffix == QWORD_MNEM_SUFFIX) - i.types[op] &= ~Imm32; - break; - case O_absent: - case O_register: - abort (); - /* Symbols and expressions. */ - default: - /* Convert symbolic operand to proper sizes for matching. */ - switch (guess_suffix) - { - case QWORD_MNEM_SUFFIX: - i.types[op] = Imm64 | Imm32S; - break; - case LONG_MNEM_SUFFIX: - i.types[op] = Imm32 | Imm64; - break; - case WORD_MNEM_SUFFIX: - i.types[op] = Imm16 | Imm32 | Imm64; - break; - break; - case BYTE_MNEM_SUFFIX: - i.types[op] = Imm8 | Imm8S | Imm16 | Imm32S | Imm32; - break; - break; - } - break; - } + if (!current_templates) + { + /* See if we can get a match by trimming off a suffix. */ + switch (mnem_p[-1]) + { + case WORD_MNEM_SUFFIX: + case BYTE_MNEM_SUFFIX: + case QWORD_MNEM_SUFFIX: + i.suffix = mnem_p[-1]; + mnem_p[-1] = '\0'; + current_templates = hash_find (op_hash, mnemonic); + break; + case SHORT_MNEM_SUFFIX: + case LONG_MNEM_SUFFIX: + if (!intel_syntax) + { + i.suffix = mnem_p[-1]; + mnem_p[-1] = '\0'; + current_templates = hash_find (op_hash, mnemonic); } - } + break; - if (i.disp_operands) - { - /* Try to use the smallest displacement type too. */ - int op; + /* Intel Syntax. */ + case 'd': + if (intel_syntax) + { + if (intel_float_operand (mnemonic)) + i.suffix = SHORT_MNEM_SUFFIX; + else + i.suffix = LONG_MNEM_SUFFIX; + mnem_p[-1] = '\0'; + current_templates = hash_find (op_hash, mnemonic); + } + break; + } + if (!current_templates) + { + as_bad (_("no such instruction: `%s'"), token_start); + return NULL; + } + } - for (op = i.operands; --op >= 0;) - if ((i.types[op] & Disp) - && i.op[op].disps->X_op == O_constant) + if (current_templates->start->opcode_modifier & (Jump | JumpByte)) + { + /* Check for a branch hint. We allow ",pt" and ",pn" for + predict taken and predict not taken respectively. + I'm not sure that branch hints actually do anything on loop + and jcxz insns (JumpByte) for current Pentium4 chips. They + may work in the future and it doesn't hurt to accept them + now. */ + if (l[0] == ',' && l[1] == 'p') + { + if (l[2] == 't') { - offsetT disp = i.op[op].disps->X_add_number; + if (!add_prefix (DS_PREFIX_OPCODE)) + return NULL; + l += 3; + } + else if (l[2] == 'n') + { + if (!add_prefix (CS_PREFIX_OPCODE)) + return NULL; + l += 3; + } + } + } + /* Any other comma loses. */ + if (*l == ',') + { + as_bad (_("invalid character %s in mnemonic"), + output_invalid (*l)); + return NULL; + } - if (i.types[op] & Disp16) - { - /* We know this operand is at most 16 bits, so - convert to a signed 16 bit number before trying - to see whether it will fit in an even smaller - size. */ + /* Check if instruction is supported on specified architecture. */ + if ((current_templates->start->cpu_flags & ~(Cpu64 | CpuNo64)) + & ~(cpu_arch_flags & ~(Cpu64 | CpuNo64))) + { + as_warn (_("`%s' is not supported on `%s'"), + current_templates->start->name, cpu_arch_name); + } + else if ((Cpu386 & ~cpu_arch_flags) && (flag_code != CODE_16BIT)) + { + as_warn (_("use .code16 to ensure correct addressing mode")); + } - disp = (((disp & 0xffff) ^ 0x8000) - 0x8000); - } - else if (i.types[op] & Disp32) - { - /* We know this operand is at most 32 bits, so convert to a - signed 32 bit number before trying to see whether it will - fit in an even smaller size. */ - disp &= (((offsetT) 2 << 31) - 1); - disp = (disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31); - } - if (flag_code == CODE_64BIT) + /* Check for rep/repne without a string instruction. */ + if (expecting_string_instruction + && !(current_templates->start->opcode_modifier & IsString)) + { + as_bad (_("expecting string instruction after `%s'"), + expecting_string_instruction); + return NULL; + } + + return l; +} + +static char * +parse_operands (l, mnemonic) + char *l; + const char *mnemonic; +{ + char *token_start; + + /* 1 if operand is pending after ','. */ + unsigned int expecting_operand = 0; + + /* Non-zero if operand parens not balanced. */ + unsigned int paren_not_balanced; + + while (*l != END_OF_INSN) + { + /* Skip optional white space before operand. */ + if (is_space_char (*l)) + ++l; + if (!is_operand_char (*l) && *l != END_OF_INSN) + { + as_bad (_("invalid character %s before operand %d"), + output_invalid (*l), + i.operands + 1); + return NULL; + } + token_start = l; /* after white space */ + paren_not_balanced = 0; + while (paren_not_balanced || *l != ',') + { + if (*l == END_OF_INSN) + { + if (paren_not_balanced) { - if (fits_in_signed_long (disp)) - i.types[op] |= Disp32S; - if (fits_in_unsigned_long (disp)) - i.types[op] |= Disp32; + if (!intel_syntax) + as_bad (_("unbalanced parenthesis in operand %d."), + i.operands + 1); + else + as_bad (_("unbalanced brackets in operand %d."), + i.operands + 1); + return NULL; } - if ((i.types[op] & (Disp32 | Disp32S | Disp16)) - && fits_in_signed_byte (disp)) - i.types[op] |= Disp8; + else + break; /* we are done */ } - } + else if (!is_operand_char (*l) && !is_space_char (*l)) + { + as_bad (_("invalid character %s in operand %d"), + output_invalid (*l), + i.operands + 1); + return NULL; + } + if (!intel_syntax) + { + if (*l == '(') + ++paren_not_balanced; + if (*l == ')') + --paren_not_balanced; + } + else + { + if (*l == '[') + ++paren_not_balanced; + if (*l == ']') + --paren_not_balanced; + } + l++; + } + if (l != token_start) + { /* Yes, we've read in another operand. */ + unsigned int operand_ok; + this_operand = i.operands++; + if (i.operands > MAX_OPERANDS) + { + as_bad (_("spurious operands; (%d operands/instruction max)"), + MAX_OPERANDS); + return NULL; + } + /* Now parse operand adding info to 'i' as we go along. */ + END_STRING_AND_SAVE (l); - overlap0 = 0; - overlap1 = 0; - overlap2 = 0; - found_reverse_match = 0; - suffix_check = (i.suffix == BYTE_MNEM_SUFFIX - ? No_bSuf - : (i.suffix == WORD_MNEM_SUFFIX - ? No_wSuf - : (i.suffix == SHORT_MNEM_SUFFIX - ? No_sSuf - : (i.suffix == LONG_MNEM_SUFFIX - ? No_lSuf - : (i.suffix == QWORD_MNEM_SUFFIX - ? No_qSuf - : (i.suffix == LONG_DOUBLE_MNEM_SUFFIX ? No_xSuf : 0)))))); - - for (t = current_templates->start; - t < current_templates->end; - t++) - { - /* Must have right number of operands. */ - if (i.operands != t->operands) - continue; + if (intel_syntax) + operand_ok = + i386_intel_operand (token_start, + intel_float_operand (mnemonic)); + else + operand_ok = i386_operand (token_start); + + RESTORE_END_STRING (l); + if (!operand_ok) + return NULL; + } + else + { + if (expecting_operand) + { + expecting_operand_after_comma: + as_bad (_("expecting operand after ','; got nothing")); + return NULL; + } + if (*l == ',') + { + as_bad (_("expecting operand before ','; got nothing")); + return NULL; + } + } - /* Check the suffix, except for some instructions in intel mode. */ - if ((t->opcode_modifier & suffix_check) - && !(intel_syntax - && (t->opcode_modifier & IgnoreSize)) - && !(intel_syntax - && t->base_opcode == 0xd9 - && (t->extension_opcode == 5 /* 0xd9,5 "fldcw" */ - || t->extension_opcode == 7))) /* 0xd9,7 "f{n}stcw" */ - continue; + /* Now *l must be either ',' or END_OF_INSN. */ + if (*l == ',') + { + if (*++l == END_OF_INSN) + { + /* Just skip it, if it's \n complain. */ + goto expecting_operand_after_comma; + } + expecting_operand = 1; + } + } + return l; +} - /* Do not verify operands when there are none. */ - else if (!t->operands) - { - if (t->cpu_flags & ~cpu_arch_flags) - continue; - /* We've found a match; break out of loop. */ +static void +swap_operands () +{ + union i386_op temp_op; + unsigned int temp_type; + RELOC_ENUM temp_reloc; + int xchg1 = 0; + int xchg2 = 0; + + if (i.operands == 2) + { + xchg1 = 0; + xchg2 = 1; + } + else if (i.operands == 3) + { + xchg1 = 0; + xchg2 = 2; + } + temp_type = i.types[xchg2]; + i.types[xchg2] = i.types[xchg1]; + i.types[xchg1] = temp_type; + temp_op = i.op[xchg2]; + i.op[xchg2] = i.op[xchg1]; + i.op[xchg1] = temp_op; + temp_reloc = i.reloc[xchg2]; + i.reloc[xchg2] = i.reloc[xchg1]; + i.reloc[xchg1] = temp_reloc; + + if (i.mem_operands == 2) + { + const seg_entry *temp_seg; + temp_seg = i.seg[0]; + i.seg[0] = i.seg[1]; + i.seg[1] = temp_seg; + } +} + +/* Try to ensure constant immediates are represented in the smallest + opcode possible. */ +static void +optimize_imm () +{ + char guess_suffix = 0; + int op; + + if (i.suffix) + guess_suffix = i.suffix; + else if (i.reg_operands) + { + /* Figure out a suffix from the last register operand specified. + We can't do this properly yet, ie. excluding InOutPortReg, + but the following works for instructions with immediates. + In any case, we can't set i.suffix yet. */ + for (op = i.operands; --op >= 0;) + if (i.types[op] & Reg) + { + if (i.types[op] & Reg8) + guess_suffix = BYTE_MNEM_SUFFIX; + else if (i.types[op] & Reg16) + guess_suffix = WORD_MNEM_SUFFIX; + else if (i.types[op] & Reg32) + guess_suffix = LONG_MNEM_SUFFIX; + else if (i.types[op] & Reg64) + guess_suffix = QWORD_MNEM_SUFFIX; break; } + } + else if ((flag_code == CODE_16BIT) ^ (i.prefix[DATA_PREFIX] != 0)) + guess_suffix = WORD_MNEM_SUFFIX; - overlap0 = i.types[0] & t->operand_types[0]; - switch (t->operands) + for (op = i.operands; --op >= 0;) + if (i.types[op] & Imm) + { + switch (i.op[op].imms->X_op) { - case 1: - if (!MATCH (overlap0, i.types[0], t->operand_types[0])) - continue; - break; - case 2: - case 3: - overlap1 = i.types[1] & t->operand_types[1]; - if (!MATCH (overlap0, i.types[0], t->operand_types[0]) - || !MATCH (overlap1, i.types[1], t->operand_types[1]) - || !CONSISTENT_REGISTER_MATCH (overlap0, i.types[0], - t->operand_types[0], - overlap1, i.types[1], - t->operand_types[1])) + case O_constant: + /* If a suffix is given, this operand may be shortened. */ + switch (guess_suffix) { - /* Check if other direction is valid ... */ - if ((t->opcode_modifier & (D|FloatD)) == 0) - continue; + case LONG_MNEM_SUFFIX: + i.types[op] |= Imm32 | Imm64; + break; + case WORD_MNEM_SUFFIX: + i.types[op] |= Imm16 | Imm32S | Imm32 | Imm64; + break; + case BYTE_MNEM_SUFFIX: + i.types[op] |= Imm16 | Imm8 | Imm8S | Imm32S | Imm32 | Imm64; + break; + } - /* Try reversing direction of operands. */ - overlap0 = i.types[0] & t->operand_types[1]; - overlap1 = i.types[1] & t->operand_types[0]; - if (!MATCH (overlap0, i.types[0], t->operand_types[1]) - || !MATCH (overlap1, i.types[1], t->operand_types[0]) - || !CONSISTENT_REGISTER_MATCH (overlap0, i.types[0], - t->operand_types[1], - overlap1, i.types[1], - t->operand_types[0])) - { - /* Does not match either direction. */ - continue; - } - /* found_reverse_match holds which of D or FloatDR - we've found. */ - found_reverse_match = t->opcode_modifier & (D|FloatDR); + /* If this operand is at most 16 bits, convert it + to a signed 16 bit number before trying to see + whether it will fit in an even smaller size. + This allows a 16-bit operand such as $0xffe0 to + be recognised as within Imm8S range. */ + if ((i.types[op] & Imm16) + && (i.op[op].imms->X_add_number & ~(offsetT) 0xffff) == 0) + { + i.op[op].imms->X_add_number = + (((i.op[op].imms->X_add_number & 0xffff) ^ 0x8000) - 0x8000); } - /* Found a forward 2 operand match here. */ - else if (t->operands == 3) + if ((i.types[op] & Imm32) + && ((i.op[op].imms->X_add_number & ~(((offsetT) 2 << 31) - 1)) + == 0)) { - /* Here we make use of the fact that there are no - reverse match 3 operand instructions, and all 3 - operand instructions only need to be checked for - register consistency between operands 2 and 3. */ - overlap2 = i.types[2] & t->operand_types[2]; - if (!MATCH (overlap2, i.types[2], t->operand_types[2]) - || !CONSISTENT_REGISTER_MATCH (overlap1, i.types[1], - t->operand_types[1], - overlap2, i.types[2], - t->operand_types[2])) - - continue; + i.op[op].imms->X_add_number = ((i.op[op].imms->X_add_number + ^ ((offsetT) 1 << 31)) + - ((offsetT) 1 << 31)); } - /* Found either forward/reverse 2 or 3 operand match here: - slip through to break. */ - } - if (t->cpu_flags & ~cpu_arch_flags) - { - found_reverse_match = 0; - continue; - } - /* We've found a match; break out of loop. */ - break; - } - if (t == current_templates->end) - { - /* We found no match. */ - as_bad (_("suffix or operands invalid for `%s'"), - current_templates->start->name); - return; - } - - if (!quiet_warnings) - { - if (!intel_syntax - && ((i.types[0] & JumpAbsolute) - != (t->operand_types[0] & JumpAbsolute))) - { - as_warn (_("indirect %s without `*'"), t->name); - } + i.types[op] |= smallest_imm_type (i.op[op].imms->X_add_number); - if ((t->opcode_modifier & (IsPrefix|IgnoreSize)) - == (IsPrefix|IgnoreSize)) - { - /* Warn them that a data or address size prefix doesn't - affect assembly of the next line of code. */ - as_warn (_("stand-alone `%s' prefix"), t->name); - } - } - - /* Copy the template we found. */ - i.tm = *t; - if (found_reverse_match) - { - /* If we found a reverse match we must alter the opcode - direction bit. found_reverse_match holds bits to change - (different for int & float insns). */ + /* We must avoid matching of Imm32 templates when 64bit + only immediate is available. */ + if (guess_suffix == QWORD_MNEM_SUFFIX) + i.types[op] &= ~Imm32; + break; - i.tm.base_opcode ^= found_reverse_match; + case O_absent: + case O_register: + abort (); - i.tm.operand_types[0] = t->operand_types[1]; - i.tm.operand_types[1] = t->operand_types[0]; + /* Symbols and expressions. */ + default: + /* Convert symbolic operand to proper sizes for matching. */ + switch (guess_suffix) + { + case QWORD_MNEM_SUFFIX: + i.types[op] = Imm64 | Imm32S; + break; + case LONG_MNEM_SUFFIX: + i.types[op] = Imm32 | Imm64; + break; + case WORD_MNEM_SUFFIX: + i.types[op] = Imm16 | Imm32 | Imm64; + break; + break; + case BYTE_MNEM_SUFFIX: + i.types[op] = Imm8 | Imm8S | Imm16 | Imm32S | Imm32; + break; + break; + } + break; + } } +} - /* Undo SYSV386_COMPAT brokenness when in Intel mode. See i386.h */ - if (SYSV386_COMPAT - && intel_syntax - && (i.tm.base_opcode & 0xfffffde0) == 0xdce0) - i.tm.base_opcode ^= FloatR; - - if (i.tm.opcode_modifier & FWait) - if (! add_prefix (FWAIT_OPCODE)) - return; +/* Try to use the smallest displacement type too. */ +static void +optimize_disp () +{ + int op; - /* Check string instruction segment overrides. */ - if ((i.tm.opcode_modifier & IsString) != 0 && i.mem_operands != 0) + for (op = i.operands; --op >= 0;) + if ((i.types[op] & Disp) && i.op[op].disps->X_op == O_constant) { - int mem_op = (i.types[0] & AnyMem) ? 0 : 1; - if ((i.tm.operand_types[mem_op] & EsSeg) != 0) + offsetT disp = i.op[op].disps->X_add_number; + + if (i.types[op] & Disp16) { - if (i.seg[0] != NULL && i.seg[0] != &es) - { - as_bad (_("`%s' operand %d must use `%%es' segment"), - i.tm.name, - mem_op + 1); - return; - } - /* There's only ever one segment override allowed per instruction. - This instruction possibly has a legal segment override on the - second operand, so copy the segment to where non-string - instructions store it, allowing common code. */ - i.seg[0] = i.seg[1]; + /* We know this operand is at most 16 bits, so + convert to a signed 16 bit number before trying + to see whether it will fit in an even smaller + size. */ + + disp = (((disp & 0xffff) ^ 0x8000) - 0x8000); } - else if ((i.tm.operand_types[mem_op + 1] & EsSeg) != 0) + else if (i.types[op] & Disp32) { - if (i.seg[1] != NULL && i.seg[1] != &es) - { - as_bad (_("`%s' operand %d must use `%%es' segment"), - i.tm.name, - mem_op + 2); - return; - } + /* We know this operand is at most 32 bits, so convert to a + signed 32 bit number before trying to see whether it will + fit in an even smaller size. */ + disp &= (((offsetT) 2 << 31) - 1); + disp = (disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31); } + if (flag_code == CODE_64BIT) + { + if (fits_in_signed_long (disp)) + i.types[op] |= Disp32S; + if (fits_in_unsigned_long (disp)) + i.types[op] |= Disp32; + } + if ((i.types[op] & (Disp32 | Disp32S | Disp16)) + && fits_in_signed_byte (disp)) + i.types[op] |= Disp8; } +} - /* If matched instruction specifies an explicit instruction mnemonic - suffix, use it. */ - if (i.tm.opcode_modifier & (Size16 | Size32 | Size64)) - { - if (i.tm.opcode_modifier & Size16) - i.suffix = WORD_MNEM_SUFFIX; - else if (i.tm.opcode_modifier & Size64) - i.suffix = QWORD_MNEM_SUFFIX; - else - i.suffix = LONG_MNEM_SUFFIX; - } - else if (i.reg_operands) - { - /* If there's no instruction mnemonic suffix we try to invent one - based on register operands. */ - if (!i.suffix) - { - /* We take i.suffix from the last register operand specified, - Destination register type is more significant than source - register type. */ - int op; - for (op = i.operands; --op >= 0;) - if ((i.types[op] & Reg) - && !(i.tm.operand_types[op] & InOutPortReg)) - { - i.suffix = ((i.types[op] & Reg8) ? BYTE_MNEM_SUFFIX : - (i.types[op] & Reg16) ? WORD_MNEM_SUFFIX : - (i.types[op] & Reg64) ? QWORD_MNEM_SUFFIX : - LONG_MNEM_SUFFIX); - break; - } - } - else if (i.suffix == BYTE_MNEM_SUFFIX) - { - int op; - for (op = i.operands; --op >= 0;) - { - /* If this is an eight bit register, it's OK. If it's - the 16 or 32 bit version of an eight bit register, - we will just use the low portion, and that's OK too. */ - if (i.types[op] & Reg8) - continue; +static int +match_template () +{ + /* Points to template once we've found it. */ + const template *t; + unsigned int overlap0, overlap1, overlap2; + unsigned int found_reverse_match; + int suffix_check; + +#define MATCH(overlap, given, template) \ + ((overlap & ~JumpAbsolute) \ + && (((given) & (BaseIndex | JumpAbsolute)) \ + == ((overlap) & (BaseIndex | JumpAbsolute)))) - /* movzx and movsx should not generate this warning. */ - if (intel_syntax - && (i.tm.base_opcode == 0xfb7 - || i.tm.base_opcode == 0xfb6 - || i.tm.base_opcode == 0x63 - || i.tm.base_opcode == 0xfbe - || i.tm.base_opcode == 0xfbf)) - continue; + /* If given types r0 and r1 are registers they must be of the same type + unless the expected operand type register overlap is null. + Note that Acc in a template matches every size of reg. */ +#define CONSISTENT_REGISTER_MATCH(m0, g0, t0, m1, g1, t1) \ + (((g0) & Reg) == 0 || ((g1) & Reg) == 0 \ + || ((g0) & Reg) == ((g1) & Reg) \ + || ((((m0) & Acc) ? Reg : (t0)) & (((m1) & Acc) ? Reg : (t1)) & Reg) == 0 ) + + overlap0 = 0; + overlap1 = 0; + overlap2 = 0; + found_reverse_match = 0; + suffix_check = (i.suffix == BYTE_MNEM_SUFFIX + ? No_bSuf + : (i.suffix == WORD_MNEM_SUFFIX + ? No_wSuf + : (i.suffix == SHORT_MNEM_SUFFIX + ? No_sSuf + : (i.suffix == LONG_MNEM_SUFFIX + ? No_lSuf + : (i.suffix == QWORD_MNEM_SUFFIX + ? No_qSuf + : (i.suffix == LONG_DOUBLE_MNEM_SUFFIX + ? No_xSuf : 0)))))); + + for (t = current_templates->start; + t < current_templates->end; + t++) + { + /* Must have right number of operands. */ + if (i.operands != t->operands) + continue; + + /* Check the suffix, except for some instructions in intel mode. */ + if ((t->opcode_modifier & suffix_check) + && !(intel_syntax + && (t->opcode_modifier & IgnoreSize)) + && !(intel_syntax + && t->base_opcode == 0xd9 + && (t->extension_opcode == 5 /* 0xd9,5 "fldcw" */ + || t->extension_opcode == 7))) /* 0xd9,7 "f{n}stcw" */ + continue; - if ((i.types[op] & WordReg) && i.op[op].regs->reg_num < 4 -#if 0 - /* Check that the template allows eight bit regs - This kills insns such as `orb $1,%edx', which - maybe should be allowed. */ - && (i.tm.operand_types[op] & (Reg8|InOutPortReg)) -#endif - ) - { - /* Prohibit these changes in the 64bit mode, since - the lowering is more complicated. */ - if (flag_code == CODE_64BIT - && (i.tm.operand_types[op] & InOutPortReg) == 0) - as_bad (_("Incorrect register `%%%s' used with`%c' suffix"), - i.op[op].regs->reg_name, - i.suffix); -#if REGISTER_WARNINGS - if (!quiet_warnings - && (i.tm.operand_types[op] & InOutPortReg) == 0) - as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"), - (i.op[op].regs - + (i.types[op] & Reg16 - ? REGNAM_AL - REGNAM_AX - : REGNAM_AL - REGNAM_EAX))->reg_name, - i.op[op].regs->reg_name, - i.suffix); -#endif - continue; - } - /* Any other register is bad. */ - if (i.types[op] & (Reg | RegMMX | RegXMM - | SReg2 | SReg3 - | Control | Debug | Test - | FloatReg | FloatAcc)) - { - as_bad (_("`%%%s' not allowed with `%s%c'"), - i.op[op].regs->reg_name, - i.tm.name, - i.suffix); - return; - } - } - } - else if (i.suffix == LONG_MNEM_SUFFIX) - { - int op; + /* Do not verify operands when there are none. */ + else if (!t->operands) + { + if (t->cpu_flags & ~cpu_arch_flags) + continue; + /* We've found a match; break out of loop. */ + break; + } - for (op = i.operands; --op >= 0;) - /* Reject eight bit registers, except where the template - requires them. (eg. movzb) */ - if ((i.types[op] & Reg8) != 0 - && (i.tm.operand_types[op] & (Reg16 | Reg32 | Acc)) != 0) - { - as_bad (_("`%%%s' not allowed with `%s%c'"), - i.op[op].regs->reg_name, - i.tm.name, - i.suffix); - return; - } - /* Warn if the e prefix on a general reg is missing. */ - else if ((!quiet_warnings || flag_code == CODE_64BIT) - && (i.types[op] & Reg16) != 0 - && (i.tm.operand_types[op] & (Reg32|Acc)) != 0) - { - /* Prohibit these changes in the 64bit mode, since - the lowering is more complicated. */ - if (flag_code == CODE_64BIT) - as_bad (_("Incorrect register `%%%s' used with`%c' suffix"), - i.op[op].regs->reg_name, - i.suffix); -#if REGISTER_WARNINGS - else - as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"), - (i.op[op].regs + REGNAM_EAX - REGNAM_AX)->reg_name, - i.op[op].regs->reg_name, - i.suffix); -#endif - } - /* Warn if the r prefix on a general reg is missing. */ - else if ((i.types[op] & Reg64) != 0 - && (i.tm.operand_types[op] & (Reg32|Acc)) != 0) + overlap0 = i.types[0] & t->operand_types[0]; + switch (t->operands) + { + case 1: + if (!MATCH (overlap0, i.types[0], t->operand_types[0])) + continue; + break; + case 2: + case 3: + overlap1 = i.types[1] & t->operand_types[1]; + if (!MATCH (overlap0, i.types[0], t->operand_types[0]) + || !MATCH (overlap1, i.types[1], t->operand_types[1]) + || !CONSISTENT_REGISTER_MATCH (overlap0, i.types[0], + t->operand_types[0], + overlap1, i.types[1], + t->operand_types[1])) + { + /* Check if other direction is valid ... */ + if ((t->opcode_modifier & (D | FloatD)) == 0) + continue; + + /* Try reversing direction of operands. */ + overlap0 = i.types[0] & t->operand_types[1]; + overlap1 = i.types[1] & t->operand_types[0]; + if (!MATCH (overlap0, i.types[0], t->operand_types[1]) + || !MATCH (overlap1, i.types[1], t->operand_types[0]) + || !CONSISTENT_REGISTER_MATCH (overlap0, i.types[0], + t->operand_types[1], + overlap1, i.types[1], + t->operand_types[0])) { - as_bad (_("Incorrect register `%%%s' used with`%c' suffix"), - i.op[op].regs->reg_name, - i.suffix); + /* Does not match either direction. */ + continue; } - } - else if (i.suffix == QWORD_MNEM_SUFFIX) - { - int op; + /* found_reverse_match holds which of D or FloatDR + we've found. */ + found_reverse_match = t->opcode_modifier & (D | FloatDR); + } + /* Found a forward 2 operand match here. */ + else if (t->operands == 3) + { + /* Here we make use of the fact that there are no + reverse match 3 operand instructions, and all 3 + operand instructions only need to be checked for + register consistency between operands 2 and 3. */ + overlap2 = i.types[2] & t->operand_types[2]; + if (!MATCH (overlap2, i.types[2], t->operand_types[2]) + || !CONSISTENT_REGISTER_MATCH (overlap1, i.types[1], + t->operand_types[1], + overlap2, i.types[2], + t->operand_types[2])) - for (op = i.operands; --op >= 0; ) - /* Reject eight bit registers, except where the template - requires them. (eg. movzb) */ - if ((i.types[op] & Reg8) != 0 - && (i.tm.operand_types[op] & (Reg16|Reg32|Acc)) != 0) - { - as_bad (_("`%%%s' not allowed with `%s%c'"), - i.op[op].regs->reg_name, - i.tm.name, - i.suffix); - return; - } - /* Warn if the e prefix on a general reg is missing. */ - else if (((i.types[op] & Reg16) != 0 - || (i.types[op] & Reg32) != 0) - && (i.tm.operand_types[op] & (Reg32|Acc)) != 0) - { - /* Prohibit these changes in the 64bit mode, since - the lowering is more complicated. */ - as_bad (_("Incorrect register `%%%s' used with`%c' suffix"), - i.op[op].regs->reg_name, - i.suffix); - } - } - else if (i.suffix == WORD_MNEM_SUFFIX) - { - int op; - for (op = i.operands; --op >= 0;) - /* Reject eight bit registers, except where the template - requires them. (eg. movzb) */ - if ((i.types[op] & Reg8) != 0 - && (i.tm.operand_types[op] & (Reg16|Reg32|Acc)) != 0) - { - as_bad (_("`%%%s' not allowed with `%s%c'"), - i.op[op].regs->reg_name, - i.tm.name, - i.suffix); - return; - } - /* Warn if the e prefix on a general reg is present. */ - else if ((!quiet_warnings || flag_code == CODE_64BIT) - && (i.types[op] & Reg32) != 0 - && (i.tm.operand_types[op] & (Reg16|Acc)) != 0) - { - /* Prohibit these changes in the 64bit mode, since - the lowering is more complicated. */ - if (flag_code == CODE_64BIT) - as_bad (_("Incorrect register `%%%s' used with`%c' suffix"), - i.op[op].regs->reg_name, - i.suffix); - else + continue; + } + /* Found either forward/reverse 2 or 3 operand match here: + slip through to break. */ + } + if (t->cpu_flags & ~cpu_arch_flags) + { + found_reverse_match = 0; + continue; + } + /* We've found a match; break out of loop. */ + break; + } + + if (t == current_templates->end) + { + /* We found no match. */ + as_bad (_("suffix or operands invalid for `%s'"), + current_templates->start->name); + return 0; + } + + if (!quiet_warnings) + { + if (!intel_syntax + && ((i.types[0] & JumpAbsolute) + != (t->operand_types[0] & JumpAbsolute))) + { + as_warn (_("indirect %s without `*'"), t->name); + } + + if ((t->opcode_modifier & (IsPrefix | IgnoreSize)) + == (IsPrefix | IgnoreSize)) + { + /* Warn them that a data or address size prefix doesn't + affect assembly of the next line of code. */ + as_warn (_("stand-alone `%s' prefix"), t->name); + } + } + + /* Copy the template we found. */ + i.tm = *t; + if (found_reverse_match) + { + /* If we found a reverse match we must alter the opcode + direction bit. found_reverse_match holds bits to change + (different for int & float insns). */ + + i.tm.base_opcode ^= found_reverse_match; + + i.tm.operand_types[0] = t->operand_types[1]; + i.tm.operand_types[1] = t->operand_types[0]; + } + + return 1; +} + +static int +check_string () +{ + int mem_op = (i.types[0] & AnyMem) ? 0 : 1; + if ((i.tm.operand_types[mem_op] & EsSeg) != 0) + { + if (i.seg[0] != NULL && i.seg[0] != &es) + { + as_bad (_("`%s' operand %d must use `%%es' segment"), + i.tm.name, + mem_op + 1); + return 0; + } + /* There's only ever one segment override allowed per instruction. + This instruction possibly has a legal segment override on the + second operand, so copy the segment to where non-string + instructions store it, allowing common code. */ + i.seg[0] = i.seg[1]; + } + else if ((i.tm.operand_types[mem_op + 1] & EsSeg) != 0) + { + if (i.seg[1] != NULL && i.seg[1] != &es) + { + as_bad (_("`%s' operand %d must use `%%es' segment"), + i.tm.name, + mem_op + 2); + return 0; + } + } + return 1; +} + +static int +process_suffix () +{ + /* If matched instruction specifies an explicit instruction mnemonic + suffix, use it. */ + if (i.tm.opcode_modifier & (Size16 | Size32 | Size64)) + { + if (i.tm.opcode_modifier & Size16) + i.suffix = WORD_MNEM_SUFFIX; + else if (i.tm.opcode_modifier & Size64) + i.suffix = QWORD_MNEM_SUFFIX; + else + i.suffix = LONG_MNEM_SUFFIX; + } + else if (i.reg_operands) + { + /* If there's no instruction mnemonic suffix we try to invent one + based on register operands. */ + if (!i.suffix) + { + /* We take i.suffix from the last register operand specified, + Destination register type is more significant than source + register type. */ + int op; + for (op = i.operands; --op >= 0;) + if ((i.types[op] & Reg) + && !(i.tm.operand_types[op] & InOutPortReg)) + { + i.suffix = ((i.types[op] & Reg8) ? BYTE_MNEM_SUFFIX : + (i.types[op] & Reg16) ? WORD_MNEM_SUFFIX : + (i.types[op] & Reg64) ? QWORD_MNEM_SUFFIX : + LONG_MNEM_SUFFIX); + break; + } + } + else if (i.suffix == BYTE_MNEM_SUFFIX) + { + if (!check_byte_reg ()) + return 0; + } + else if (i.suffix == LONG_MNEM_SUFFIX) + { + if (!check_long_reg ()) + return 0; + } + else if (i.suffix == QWORD_MNEM_SUFFIX) + { + if (!check_qword_reg ()) + return 0; + } + else if (i.suffix == WORD_MNEM_SUFFIX) + { + if (!check_word_reg ()) + return 0; + } + else if (intel_syntax && (i.tm.opcode_modifier & IgnoreSize)) + /* Do nothing if the instruction is going to ignore the prefix. */ + ; + else + abort (); + } + else if ((i.tm.opcode_modifier & DefaultSize) && !i.suffix) + { + i.suffix = stackop_size; + } + + /* Change the opcode based on the operand size given by i.suffix; + We need not change things for byte insns. */ + + if (!i.suffix && (i.tm.opcode_modifier & W)) + { + as_bad (_("no instruction mnemonic suffix given and no register operands; can't size instruction")); + return 0; + } + + /* For movzx and movsx, need to check the register type. */ + if (intel_syntax + && (i.tm.base_opcode == 0xfb6 || i.tm.base_opcode == 0xfbe) + && i.suffix == BYTE_MNEM_SUFFIX) + { + unsigned int prefix = DATA_PREFIX_OPCODE; + + if ((i.op[1].regs->reg_type & Reg16) != 0) + if (!add_prefix (prefix)) + return 0; + } + + if (i.suffix && i.suffix != BYTE_MNEM_SUFFIX) + { + /* It's not a byte, select word/dword operation. */ + if (i.tm.opcode_modifier & W) + { + if (i.tm.opcode_modifier & ShortForm) + i.tm.base_opcode |= 8; + else + i.tm.base_opcode |= 1; + } + + /* Now select between word & dword operations via the operand + size prefix, except for instructions that will ignore this + prefix anyway. */ + if (i.suffix != QWORD_MNEM_SUFFIX + && (i.suffix == LONG_MNEM_SUFFIX) == (flag_code == CODE_16BIT) + && !(i.tm.opcode_modifier & IgnoreSize)) + { + unsigned int prefix = DATA_PREFIX_OPCODE; + if (i.tm.opcode_modifier & JumpByte) /* jcxz, loop */ + prefix = ADDR_PREFIX_OPCODE; + + if (!add_prefix (prefix)) + return 0; + } + + if (i.suffix != QWORD_MNEM_SUFFIX && (flag_code == CODE_64BIT) + && !(i.tm.opcode_modifier & IgnoreSize) + && (i.tm.opcode_modifier & JumpByte)) + { + if (!add_prefix (ADDR_PREFIX_OPCODE)) + return 0; + } + + /* Set mode64 for an operand. */ + if (i.suffix == QWORD_MNEM_SUFFIX + && (i.tm.opcode_modifier & NoRex64) == 0) + { + i.rex |= REX_MODE64; + if (flag_code < CODE_64BIT) + { + as_bad (_("64bit operations available only in 64bit modes.")); + return 0; + } + } + + /* Size floating point instruction. */ + if (i.suffix == LONG_MNEM_SUFFIX) + { + if (i.tm.opcode_modifier & FloatMF) + i.tm.base_opcode ^= 4; + } + } + + return 1; +} + +static int +check_byte_reg () +{ + int op; + for (op = i.operands; --op >= 0;) + { + /* If this is an eight bit register, it's OK. If it's the 16 or + 32 bit version of an eight bit register, we will just use the + low portion, and that's OK too. */ + if (i.types[op] & Reg8) + continue; + + /* movzx and movsx should not generate this warning. */ + if (intel_syntax + && (i.tm.base_opcode == 0xfb7 + || i.tm.base_opcode == 0xfb6 + || i.tm.base_opcode == 0x63 + || i.tm.base_opcode == 0xfbe + || i.tm.base_opcode == 0xfbf)) + continue; + + if ((i.types[op] & WordReg) && i.op[op].regs->reg_num < 4 +#if 0 + /* Check that the template allows eight bit regs. This + kills insns such as `orb $1,%edx', which maybe should be + allowed. */ + && (i.tm.operand_types[op] & (Reg8 | InOutPortReg)) +#endif + ) + { + /* Prohibit these changes in the 64bit mode, since the + lowering is more complicated. */ + if (flag_code == CODE_64BIT + && (i.tm.operand_types[op] & InOutPortReg) == 0) + { + as_bad (_("Incorrect register `%%%s' used with `%c' suffix"), + i.op[op].regs->reg_name, + i.suffix); + return 0; + } #if REGISTER_WARNINGS - as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"), - (i.op[op].regs + REGNAM_AX - REGNAM_EAX)->reg_name, - i.op[op].regs->reg_name, - i.suffix); + if (!quiet_warnings + && (i.tm.operand_types[op] & InOutPortReg) == 0) + as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"), + (i.op[op].regs + (i.types[op] & Reg16 + ? REGNAM_AL - REGNAM_AX + : REGNAM_AL - REGNAM_EAX))->reg_name, + i.op[op].regs->reg_name, + i.suffix); #endif - } - } - else if (intel_syntax && (i.tm.opcode_modifier & IgnoreSize)) - /* Do nothing if the instruction is going to ignore the prefix. */ - ; - else - abort (); - } - else if ((i.tm.opcode_modifier & DefaultSize) && !i.suffix) + continue; + } + /* Any other register is bad. */ + if (i.types[op] & (Reg | RegMMX | RegXMM + | SReg2 | SReg3 + | Control | Debug | Test + | FloatReg | FloatAcc)) + { + as_bad (_("`%%%s' not allowed with `%s%c'"), + i.op[op].regs->reg_name, + i.tm.name, + i.suffix); + return 0; + } + } + return 1; +} + +static int +check_long_reg () +{ + int op; + + for (op = i.operands; --op >= 0;) + /* Reject eight bit registers, except where the template requires + them. (eg. movzb) */ + if ((i.types[op] & Reg8) != 0 + && (i.tm.operand_types[op] & (Reg16 | Reg32 | Acc)) != 0) { - i.suffix = stackop_size; + as_bad (_("`%%%s' not allowed with `%s%c'"), + i.op[op].regs->reg_name, + i.tm.name, + i.suffix); + return 0; } - /* Make still unresolved immediate matches conform to size of immediate - given in i.suffix. Note: overlap2 cannot be an immediate! */ - if ((overlap0 & (Imm8 | Imm8S | Imm16 | Imm32 | Imm32S)) - && overlap0 != Imm8 && overlap0 != Imm8S - && overlap0 != Imm16 && overlap0 != Imm32S - && overlap0 != Imm32 && overlap0 != Imm64) + /* Warn if the e prefix on a general reg is missing. */ + else if ((!quiet_warnings || flag_code == CODE_64BIT) + && (i.types[op] & Reg16) != 0 + && (i.tm.operand_types[op] & (Reg32 | Acc)) != 0) { - if (i.suffix) - { - overlap0 &= (i.suffix == BYTE_MNEM_SUFFIX ? (Imm8 | Imm8S) : - (i.suffix == WORD_MNEM_SUFFIX ? Imm16 : - (i.suffix == QWORD_MNEM_SUFFIX ? Imm64 | Imm32S : Imm32))); - } - else if (overlap0 == (Imm16 | Imm32S | Imm32) - || overlap0 == (Imm16 | Imm32) - || overlap0 == (Imm16 | Imm32S)) - { - overlap0 = - ((flag_code == CODE_16BIT) ^ (i.prefix[DATA_PREFIX] != 0)) ? Imm16 : Imm32S; - } - if (overlap0 != Imm8 && overlap0 != Imm8S - && overlap0 != Imm16 && overlap0 != Imm32S - && overlap0 != Imm32 && overlap0 != Imm64) + /* Prohibit these changes in the 64bit mode, since the + lowering is more complicated. */ + if (flag_code == CODE_64BIT) { - as_bad (_("no instruction mnemonic suffix given; can't determine immediate size")); - return; + as_bad (_("Incorrect register `%%%s' used with `%c' suffix"), + i.op[op].regs->reg_name, + i.suffix); + return 0; } +#if REGISTER_WARNINGS + else + as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"), + (i.op[op].regs + REGNAM_EAX - REGNAM_AX)->reg_name, + i.op[op].regs->reg_name, + i.suffix); +#endif } - if ((overlap1 & (Imm8 | Imm8S | Imm16 | Imm32S | Imm32)) - && overlap1 != Imm8 && overlap1 != Imm8S - && overlap1 != Imm16 && overlap1 != Imm32S - && overlap1 != Imm32 && overlap1 != Imm64) + /* Warn if the r prefix on a general reg is missing. */ + else if ((i.types[op] & Reg64) != 0 + && (i.tm.operand_types[op] & (Reg32 | Acc)) != 0) { - if (i.suffix) - { - overlap1 &= (i.suffix == BYTE_MNEM_SUFFIX ? (Imm8 | Imm8S) : - (i.suffix == WORD_MNEM_SUFFIX ? Imm16 : - (i.suffix == QWORD_MNEM_SUFFIX ? Imm64 | Imm32S : Imm32))); - } - else if (overlap1 == (Imm16 | Imm32 | Imm32S) - || overlap1 == (Imm16 | Imm32) - || overlap1 == (Imm16 | Imm32S)) - { - overlap1 = - ((flag_code == CODE_16BIT) ^ (i.prefix[DATA_PREFIX] != 0)) ? Imm16 : Imm32S; - } - if (overlap1 != Imm8 && overlap1 != Imm8S - && overlap1 != Imm16 && overlap1 != Imm32S - && overlap1 != Imm32 && overlap1 != Imm64) - { - as_bad (_("no instruction mnemonic suffix given; can't determine immediate size %x %c"),overlap1, i.suffix); - return; - } + as_bad (_("Incorrect register `%%%s' used with `%c' suffix"), + i.op[op].regs->reg_name, + i.suffix); + return 0; } - assert ((overlap2 & Imm) == 0); + return 1; +} - i.types[0] = overlap0; - if (overlap0 & ImplicitRegister) - i.reg_operands--; - if (overlap0 & Imm1) - i.imm_operands = 0; /* kludge for shift insns. */ - - i.types[1] = overlap1; - if (overlap1 & ImplicitRegister) - i.reg_operands--; - - i.types[2] = overlap2; - if (overlap2 & ImplicitRegister) - i.reg_operands--; +static int +check_qword_reg () +{ + int op; - /* Finalize opcode. First, we change the opcode based on the operand - size given by i.suffix: We need not change things for byte insns. */ + for (op = i.operands; --op >= 0; ) + /* Reject eight bit registers, except where the template requires + them. (eg. movzb) */ + if ((i.types[op] & Reg8) != 0 + && (i.tm.operand_types[op] & (Reg16 | Reg32 | Acc)) != 0) + { + as_bad (_("`%%%s' not allowed with `%s%c'"), + i.op[op].regs->reg_name, + i.tm.name, + i.suffix); + return 0; + } + /* Warn if the e prefix on a general reg is missing. */ + else if (((i.types[op] & Reg16) != 0 + || (i.types[op] & Reg32) != 0) + && (i.tm.operand_types[op] & (Reg32 | Acc)) != 0) + { + /* Prohibit these changes in the 64bit mode, since the + lowering is more complicated. */ + as_bad (_("Incorrect register `%%%s' used with `%c' suffix"), + i.op[op].regs->reg_name, + i.suffix); + return 0; + } + return 1; +} - if (!i.suffix && (i.tm.opcode_modifier & W)) +static int +check_word_reg () +{ + int op; + for (op = i.operands; --op >= 0;) + /* Reject eight bit registers, except where the template requires + them. (eg. movzb) */ + if ((i.types[op] & Reg8) != 0 + && (i.tm.operand_types[op] & (Reg16 | Reg32 | Acc)) != 0) { - as_bad (_("no instruction mnemonic suffix given and no register operands; can't size instruction")); - return; + as_bad (_("`%%%s' not allowed with `%s%c'"), + i.op[op].regs->reg_name, + i.tm.name, + i.suffix); + return 0; + } + /* Warn if the e prefix on a general reg is present. */ + else if ((!quiet_warnings || flag_code == CODE_64BIT) + && (i.types[op] & Reg32) != 0 + && (i.tm.operand_types[op] & (Reg16 | Acc)) != 0) + { + /* Prohibit these changes in the 64bit mode, since the + lowering is more complicated. */ + if (flag_code == CODE_64BIT) + { + as_bad (_("Incorrect register `%%%s' used with `%c' suffix"), + i.op[op].regs->reg_name, + i.suffix); + return 0; + } + else +#if REGISTER_WARNINGS + as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"), + (i.op[op].regs + REGNAM_AX - REGNAM_EAX)->reg_name, + i.op[op].regs->reg_name, + i.suffix); +#endif } + return 1; +} - /* For movzx and movsx, need to check the register type. */ - if (intel_syntax - && (i.tm.base_opcode == 0xfb6 || i.tm.base_opcode == 0xfbe)) - if (i.suffix && i.suffix == BYTE_MNEM_SUFFIX) - { - unsigned int prefix = DATA_PREFIX_OPCODE; +static int +finalize_imm () +{ + unsigned int overlap0, overlap1, overlap2; - if ((i.op[1].regs->reg_type & Reg16) != 0) - if (!add_prefix (prefix)) - return; + overlap0 = i.types[0] & i.tm.operand_types[0]; + if ((overlap0 & (Imm8 | Imm8S | Imm16 | Imm32 | Imm32S)) + && overlap0 != Imm8 && overlap0 != Imm8S + && overlap0 != Imm16 && overlap0 != Imm32S + && overlap0 != Imm32 && overlap0 != Imm64) + { + if (i.suffix) + { + overlap0 &= (i.suffix == BYTE_MNEM_SUFFIX + ? Imm8 | Imm8S + : (i.suffix == WORD_MNEM_SUFFIX + ? Imm16 + : (i.suffix == QWORD_MNEM_SUFFIX + ? Imm64 | Imm32S + : Imm32))); } + else if (overlap0 == (Imm16 | Imm32S | Imm32) + || overlap0 == (Imm16 | Imm32) + || overlap0 == (Imm16 | Imm32S)) + { + overlap0 = ((flag_code == CODE_16BIT) ^ (i.prefix[DATA_PREFIX] != 0) + ? Imm16 : Imm32S); + } + if (overlap0 != Imm8 && overlap0 != Imm8S + && overlap0 != Imm16 && overlap0 != Imm32S + && overlap0 != Imm32 && overlap0 != Imm64) + { + as_bad (_("no instruction mnemonic suffix given; can't determine immediate size")); + return 0; + } + } + i.types[0] = overlap0; - if (i.suffix && i.suffix != BYTE_MNEM_SUFFIX) - { - /* It's not a byte, select word/dword operation. */ - if (i.tm.opcode_modifier & W) - { - if (i.tm.opcode_modifier & ShortForm) - i.tm.base_opcode |= 8; - else - i.tm.base_opcode |= 1; - } - /* Now select between word & dword operations via the operand - size prefix, except for instructions that will ignore this - prefix anyway. */ - if (i.suffix != QWORD_MNEM_SUFFIX - && (i.suffix == LONG_MNEM_SUFFIX) == (flag_code == CODE_16BIT) - && !(i.tm.opcode_modifier & IgnoreSize)) - { - unsigned int prefix = DATA_PREFIX_OPCODE; - if (i.tm.opcode_modifier & JumpByte) /* jcxz, loop */ - prefix = ADDR_PREFIX_OPCODE; + overlap1 = i.types[1] & i.tm.operand_types[1]; + if ((overlap1 & (Imm8 | Imm8S | Imm16 | Imm32S | Imm32)) + && overlap1 != Imm8 && overlap1 != Imm8S + && overlap1 != Imm16 && overlap1 != Imm32S + && overlap1 != Imm32 && overlap1 != Imm64) + { + if (i.suffix) + { + overlap1 &= (i.suffix == BYTE_MNEM_SUFFIX + ? Imm8 | Imm8S + : (i.suffix == WORD_MNEM_SUFFIX + ? Imm16 + : (i.suffix == QWORD_MNEM_SUFFIX + ? Imm64 | Imm32S + : Imm32))); + } + else if (overlap1 == (Imm16 | Imm32 | Imm32S) + || overlap1 == (Imm16 | Imm32) + || overlap1 == (Imm16 | Imm32S)) + { + overlap1 = ((flag_code == CODE_16BIT) ^ (i.prefix[DATA_PREFIX] != 0) + ? Imm16 : Imm32S); + } + if (overlap1 != Imm8 && overlap1 != Imm8S + && overlap1 != Imm16 && overlap1 != Imm32S + && overlap1 != Imm32 && overlap1 != Imm64) + { + as_bad (_("no instruction mnemonic suffix given; can't determine immediate size %x %c"),overlap1, i.suffix); + return 0; + } + } + i.types[1] = overlap1; - if (! add_prefix (prefix)) - return; - } + overlap2 = i.types[2] & i.tm.operand_types[2]; + assert ((overlap2 & Imm) == 0); + i.types[2] = overlap2; - if (i.suffix != QWORD_MNEM_SUFFIX && (flag_code == CODE_64BIT) - && !(i.tm.opcode_modifier & IgnoreSize) - && (i.tm.opcode_modifier & JumpByte)) - { - if (! add_prefix (ADDR_PREFIX_OPCODE)) - return; - } + return 1; +} - /* Set mode64 for an operand. */ - if (i.suffix == QWORD_MNEM_SUFFIX - && !(i.tm.opcode_modifier & NoRex64)) - { - i.rex.mode64 = 1; - if (flag_code < CODE_64BIT) - { - as_bad (_("64bit operations available only in 64bit modes.")); - return; - } - } +static int +process_operands () +{ + /* Default segment register this instruction will use for memory + accesses. 0 means unknown. This is only for optimizing out + unnecessary segment overrides. */ + const seg_entry *default_seg = 0; + + /* The imul $imm, %reg instruction is converted into + imul $imm, %reg, %reg, and the clr %reg instruction + is converted into xor %reg, %reg. */ + if (i.tm.opcode_modifier & regKludge) + { + unsigned int first_reg_op = (i.types[0] & Reg) ? 0 : 1; + /* Pretend we saw the extra register operand. */ + assert (i.op[first_reg_op + 1].regs == 0); + i.op[first_reg_op + 1].regs = i.op[first_reg_op].regs; + i.types[first_reg_op + 1] = i.types[first_reg_op]; + i.reg_operands = 2; + } + + if (i.tm.opcode_modifier & ShortForm) + { + /* The register or float register operand is in operand 0 or 1. */ + unsigned int op = (i.types[0] & (Reg | FloatReg)) ? 0 : 1; + /* Register goes in low 3 bits of opcode. */ + i.tm.base_opcode |= i.op[op].regs->reg_num; + if ((i.op[op].regs->reg_flags & RegRex) != 0) + i.rex |= REX_EXTZ; + if (!quiet_warnings && (i.tm.opcode_modifier & Ugh) != 0) + { + /* Warn about some common errors, but press on regardless. + The first case can be generated by gcc (<= 2.8.1). */ + if (i.operands == 2) + { + /* Reversed arguments on faddp, fsubp, etc. */ + as_warn (_("translating to `%s %%%s,%%%s'"), i.tm.name, + i.op[1].regs->reg_name, + i.op[0].regs->reg_name); + } + else + { + /* Extraneous `l' suffix on fp insn. */ + as_warn (_("translating to `%s %%%s'"), i.tm.name, + i.op[0].regs->reg_name); + } + } + } + else if (i.tm.opcode_modifier & Modrm) + { + /* The opcode is completed (modulo i.tm.extension_opcode which + must be put into the modrm byte). + Now, we make the modrm & index base bytes based on all the + info we've collected. */ - /* Size floating point instruction. */ - if (i.suffix == LONG_MNEM_SUFFIX) - { - if (i.tm.opcode_modifier & FloatMF) - i.tm.base_opcode ^= 4; - } - } + default_seg = build_modrm_byte (); + } + else if (i.tm.opcode_modifier & (Seg2ShortForm | Seg3ShortForm)) + { + if (i.tm.base_opcode == POP_SEG_SHORT + && i.op[0].regs->reg_num == 1) + { + as_bad (_("you can't `pop %%cs'")); + return 0; + } + i.tm.base_opcode |= (i.op[0].regs->reg_num << 3); + if ((i.op[0].regs->reg_flags & RegRex) != 0) + i.rex |= REX_EXTZ; + } + else if ((i.tm.base_opcode & ~(D | W)) == MOV_AX_DISP32) + { + default_seg = &ds; + } + else if ((i.tm.opcode_modifier & IsString) != 0) + { + /* For the string instructions that allow a segment override + on one of their operands, the default segment is ds. */ + default_seg = &ds; + } - if (i.tm.opcode_modifier & ImmExt) - { - /* These AMD 3DNow! and Intel Katmai New Instructions have an - opcode suffix which is coded in the same place as an 8-bit - immediate field would be. Here we fake an 8-bit immediate - operand from the opcode suffix stored in tm.extension_opcode. */ - - expressionS *exp; - - assert (i.imm_operands == 0 && i.operands <= 2 && 2 < MAX_OPERANDS); - - exp = &im_expressions[i.imm_operands++]; - i.op[i.operands].imms = exp; - i.types[i.operands++] = Imm8; - exp->X_op = O_constant; - exp->X_add_number = i.tm.extension_opcode; - i.tm.extension_opcode = None; - } + /* If a segment was explicitly specified, + and the specified segment is not the default, + use an opcode prefix to select it. + If we never figured out what the default segment is, + then default_seg will be zero at this point, + and the specified segment prefix will always be used. */ + if ((i.seg[0]) && (i.seg[0] != default_seg)) + { + if (!add_prefix (i.seg[0]->seg_prefix)) + return 0; + } + return 1; +} - /* For insns with operands there are more diddles to do to the opcode. */ - if (i.operands) - { - /* Default segment register this instruction will use - for memory accesses. 0 means unknown. - This is only for optimizing out unnecessary segment overrides. */ - const seg_entry *default_seg = 0; - - /* The imul $imm, %reg instruction is converted into - imul $imm, %reg, %reg, and the clr %reg instruction - is converted into xor %reg, %reg. */ - if (i.tm.opcode_modifier & regKludge) - { - unsigned int first_reg_op = (i.types[0] & Reg) ? 0 : 1; - /* Pretend we saw the extra register operand. */ - assert (i.op[first_reg_op + 1].regs == 0); - i.op[first_reg_op + 1].regs = i.op[first_reg_op].regs; - i.types[first_reg_op + 1] = i.types[first_reg_op]; - i.reg_operands = 2; - } +static const seg_entry * +build_modrm_byte () +{ + const seg_entry *default_seg = 0; - if (i.tm.opcode_modifier & ShortForm) - { - /* The register or float register operand is in operand 0 or 1. */ - unsigned int op = (i.types[0] & (Reg | FloatReg)) ? 0 : 1; - /* Register goes in low 3 bits of opcode. */ - i.tm.base_opcode |= i.op[op].regs->reg_num; - if (i.op[op].regs->reg_flags & RegRex) - i.rex.extZ = 1; - if (!quiet_warnings && (i.tm.opcode_modifier & Ugh) != 0) - { - /* Warn about some common errors, but press on regardless. - The first case can be generated by gcc (<= 2.8.1). */ - if (i.operands == 2) - { - /* Reversed arguments on faddp, fsubp, etc. */ - as_warn (_("translating to `%s %%%s,%%%s'"), i.tm.name, - i.op[1].regs->reg_name, - i.op[0].regs->reg_name); - } - else - { - /* Extraneous `l' suffix on fp insn. */ - as_warn (_("translating to `%s %%%s'"), i.tm.name, - i.op[0].regs->reg_name); - } - } - } - else if (i.tm.opcode_modifier & Modrm) - { - /* The opcode is completed (modulo i.tm.extension_opcode which - must be put into the modrm byte). - Now, we make the modrm & index base bytes based on all the - info we've collected. */ - - /* i.reg_operands MUST be the number of real register operands; - implicit registers do not count. */ - if (i.reg_operands == 2) - { - unsigned int source, dest; - source = ((i.types[0] - & (Reg | RegMMX | RegXMM - | SReg2 | SReg3 - | Control | Debug | Test)) - ? 0 : 1); - dest = source + 1; - - i.rm.mode = 3; - /* One of the register operands will be encoded in the - i.tm.reg field, the other in the combined i.tm.mode - and i.tm.regmem fields. If no form of this - instruction supports a memory destination operand, - then we assume the source operand may sometimes be - a memory operand and so we need to store the - destination in the i.rm.reg field. */ - if ((i.tm.operand_types[dest] & AnyMem) == 0) - { - i.rm.reg = i.op[dest].regs->reg_num; - i.rm.regmem = i.op[source].regs->reg_num; - if (i.op[dest].regs->reg_flags & RegRex) - i.rex.extX = 1; - if (i.op[source].regs->reg_flags & RegRex) - i.rex.extZ = 1; - } - else - { - i.rm.reg = i.op[source].regs->reg_num; - i.rm.regmem = i.op[dest].regs->reg_num; - if (i.op[dest].regs->reg_flags & RegRex) - i.rex.extZ = 1; - if (i.op[source].regs->reg_flags & RegRex) - i.rex.extX = 1; - } - } - else - { /* If it's not 2 reg operands... */ - if (i.mem_operands) - { - unsigned int fake_zero_displacement = 0; - unsigned int op = ((i.types[0] & AnyMem) - ? 0 - : (i.types[1] & AnyMem) ? 1 : 2); + /* i.reg_operands MUST be the number of real register operands; + implicit registers do not count. */ + if (i.reg_operands == 2) + { + unsigned int source, dest; + source = ((i.types[0] + & (Reg | RegMMX | RegXMM + | SReg2 | SReg3 + | Control | Debug | Test)) + ? 0 : 1); + dest = source + 1; + + i.rm.mode = 3; + /* One of the register operands will be encoded in the i.tm.reg + field, the other in the combined i.tm.mode and i.tm.regmem + fields. If no form of this instruction supports a memory + destination operand, then we assume the source operand may + sometimes be a memory operand and so we need to store the + destination in the i.rm.reg field. */ + if ((i.tm.operand_types[dest] & AnyMem) == 0) + { + i.rm.reg = i.op[dest].regs->reg_num; + i.rm.regmem = i.op[source].regs->reg_num; + if ((i.op[dest].regs->reg_flags & RegRex) != 0) + i.rex |= REX_EXTX; + if ((i.op[source].regs->reg_flags & RegRex) != 0) + i.rex |= REX_EXTZ; + } + else + { + i.rm.reg = i.op[source].regs->reg_num; + i.rm.regmem = i.op[dest].regs->reg_num; + if ((i.op[dest].regs->reg_flags & RegRex) != 0) + i.rex |= REX_EXTZ; + if ((i.op[source].regs->reg_flags & RegRex) != 0) + i.rex |= REX_EXTX; + } + } + else + { /* If it's not 2 reg operands... */ + if (i.mem_operands) + { + unsigned int fake_zero_displacement = 0; + unsigned int op = ((i.types[0] & AnyMem) + ? 0 + : (i.types[1] & AnyMem) ? 1 : 2); - default_seg = &ds; + default_seg = &ds; - if (! i.base_reg) - { - i.rm.mode = 0; - if (! i.disp_operands) + if (i.base_reg == 0) + { + i.rm.mode = 0; + if (!i.disp_operands) + fake_zero_displacement = 1; + if (i.index_reg == 0) + { + /* Operand is just */ + if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0) + && (flag_code != CODE_64BIT)) + { + i.rm.regmem = NO_BASE_REGISTER_16; + i.types[op] &= ~Disp; + i.types[op] |= Disp16; + } + else if (flag_code != CODE_64BIT + || (i.prefix[ADDR_PREFIX] != 0)) + { + i.rm.regmem = NO_BASE_REGISTER; + i.types[op] &= ~Disp; + i.types[op] |= Disp32; + } + else + { + /* 64bit mode overwrites the 32bit absolute + addressing by RIP relative addressing and + absolute addressing is encoded by one of the + redundant SIB forms. */ + i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING; + i.sib.base = NO_BASE_REGISTER; + i.sib.index = NO_INDEX_REGISTER; + i.types[op] &= ~Disp; + i.types[op] |= Disp32S; + } + } + else /* !i.base_reg && i.index_reg */ + { + i.sib.index = i.index_reg->reg_num; + i.sib.base = NO_BASE_REGISTER; + i.sib.scale = i.log2_scale_factor; + i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING; + i.types[op] &= ~Disp; + if (flag_code != CODE_64BIT) + i.types[op] |= Disp32; /* Must be 32 bit */ + else + i.types[op] |= Disp32S; + if ((i.index_reg->reg_flags & RegRex) != 0) + i.rex |= REX_EXTY; + } + } + /* RIP addressing for 64bit mode. */ + else if (i.base_reg->reg_type == BaseIndex) + { + i.rm.regmem = NO_BASE_REGISTER; + i.types[op] &= ~Disp; + i.types[op] |= Disp32S; + i.flags[op] = Operand_PCrel; + } + else if (i.base_reg->reg_type & Reg16) + { + switch (i.base_reg->reg_num) + { + case 3: /* (%bx) */ + if (i.index_reg == 0) + i.rm.regmem = 7; + else /* (%bx,%si) -> 0, or (%bx,%di) -> 1 */ + i.rm.regmem = i.index_reg->reg_num - 6; + break; + case 5: /* (%bp) */ + default_seg = &ss; + if (i.index_reg == 0) + { + i.rm.regmem = 6; + if ((i.types[op] & Disp) == 0) + { + /* fake (%bp) into 0(%bp) */ + i.types[op] |= Disp8; fake_zero_displacement = 1; - if (! i.index_reg) - { - /* Operand is just */ - if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0) - && (flag_code != CODE_64BIT)) - { - i.rm.regmem = NO_BASE_REGISTER_16; - i.types[op] &= ~Disp; - i.types[op] |= Disp16; - } - else if (flag_code != CODE_64BIT - || (i.prefix[ADDR_PREFIX] != 0)) - { - i.rm.regmem = NO_BASE_REGISTER; - i.types[op] &= ~Disp; - i.types[op] |= Disp32; - } - else - { - /* 64bit mode overwrites the 32bit - absolute addressing by RIP relative - addressing and absolute addressing - is encoded by one of the redundant - SIB forms. */ - - i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING; - i.sib.base = NO_BASE_REGISTER; - i.sib.index = NO_INDEX_REGISTER; - i.types[op] &= ~Disp; - i.types[op] |= Disp32S; - } - } - else /* ! i.base_reg && i.index_reg */ - { - i.sib.index = i.index_reg->reg_num; - i.sib.base = NO_BASE_REGISTER; - i.sib.scale = i.log2_scale_factor; - i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING; - i.types[op] &= ~Disp; - if (flag_code != CODE_64BIT) - i.types[op] |= Disp32; /* Must be 32 bit */ - else - i.types[op] |= Disp32S; - if (i.index_reg->reg_flags & RegRex) - i.rex.extY = 1; - } - } - /* RIP addressing for 64bit mode. */ - else if (i.base_reg->reg_type == BaseIndex) - { - i.rm.regmem = NO_BASE_REGISTER; - i.types[op] &= ~Disp; - i.types[op] |= Disp32S; - i.flags[op] = Operand_PCrel; - } - else if (i.base_reg->reg_type & Reg16) - { - switch (i.base_reg->reg_num) - { - case 3: /* (%bx) */ - if (! i.index_reg) - i.rm.regmem = 7; - else /* (%bx,%si) -> 0, or (%bx,%di) -> 1 */ - i.rm.regmem = i.index_reg->reg_num - 6; - break; - case 5: /* (%bp) */ - default_seg = &ss; - if (! i.index_reg) - { - i.rm.regmem = 6; - if ((i.types[op] & Disp) == 0) - { - /* fake (%bp) into 0(%bp) */ - i.types[op] |= Disp8; - fake_zero_displacement = 1; - } - } - else /* (%bp,%si) -> 2, or (%bp,%di) -> 3 */ - i.rm.regmem = i.index_reg->reg_num - 6 + 2; - break; - default: /* (%si) -> 4 or (%di) -> 5 */ - i.rm.regmem = i.base_reg->reg_num - 6 + 4; - } - i.rm.mode = mode_from_disp_size (i.types[op]); - } - else /* i.base_reg and 32/64 bit mode */ - { - if (flag_code == CODE_64BIT - && (i.types[op] & Disp)) - { - if (i.types[op] & Disp8) - i.types[op] = Disp8 | Disp32S; - else - i.types[op] = Disp32S; - } - i.rm.regmem = i.base_reg->reg_num; - if (i.base_reg->reg_flags & RegRex) - i.rex.extZ = 1; - i.sib.base = i.base_reg->reg_num; - /* x86-64 ignores REX prefix bit here to avoid - decoder complications. */ - if ((i.base_reg->reg_num & 7) == EBP_REG_NUM) - { - default_seg = &ss; - if (i.disp_operands == 0) - { - fake_zero_displacement = 1; - i.types[op] |= Disp8; - } - } - else if (i.base_reg->reg_num == ESP_REG_NUM) - { - default_seg = &ss; - } - i.sib.scale = i.log2_scale_factor; - if (! i.index_reg) - { - /* (%esp) becomes two byte modrm - with no index register. We've already - stored the code for esp in i.rm.regmem - ie. ESCAPE_TO_TWO_BYTE_ADDRESSING. Any - base register besides %esp will not use - the extra modrm byte. */ - i.sib.index = NO_INDEX_REGISTER; -#if ! SCALE1_WHEN_NO_INDEX - /* Another case where we force the second - modrm byte. */ - if (i.log2_scale_factor) - i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING; + } + } + else /* (%bp,%si) -> 2, or (%bp,%di) -> 3 */ + i.rm.regmem = i.index_reg->reg_num - 6 + 2; + break; + default: /* (%si) -> 4 or (%di) -> 5 */ + i.rm.regmem = i.base_reg->reg_num - 6 + 4; + } + i.rm.mode = mode_from_disp_size (i.types[op]); + } + else /* i.base_reg and 32/64 bit mode */ + { + if (flag_code == CODE_64BIT + && (i.types[op] & Disp)) + { + if (i.types[op] & Disp8) + i.types[op] = Disp8 | Disp32S; + else + i.types[op] = Disp32S; + } + i.rm.regmem = i.base_reg->reg_num; + if ((i.base_reg->reg_flags & RegRex) != 0) + i.rex |= REX_EXTZ; + i.sib.base = i.base_reg->reg_num; + /* x86-64 ignores REX prefix bit here to avoid decoder + complications. */ + if ((i.base_reg->reg_num & 7) == EBP_REG_NUM) + { + default_seg = &ss; + if (i.disp_operands == 0) + { + fake_zero_displacement = 1; + i.types[op] |= Disp8; + } + } + else if (i.base_reg->reg_num == ESP_REG_NUM) + { + default_seg = &ss; + } + i.sib.scale = i.log2_scale_factor; + if (i.index_reg == 0) + { + /* (%esp) becomes two byte modrm with no index + register. We've already stored the code for esp + in i.rm.regmem ie. ESCAPE_TO_TWO_BYTE_ADDRESSING. + Any base register besides %esp will not use the + extra modrm byte. */ + i.sib.index = NO_INDEX_REGISTER; +#if !SCALE1_WHEN_NO_INDEX + /* Another case where we force the second modrm byte. */ + if (i.log2_scale_factor) + i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING; #endif - } - else - { - i.sib.index = i.index_reg->reg_num; - i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING; - if (i.index_reg->reg_flags & RegRex) - i.rex.extY = 1; - } - i.rm.mode = mode_from_disp_size (i.types[op]); - } + } + else + { + i.sib.index = i.index_reg->reg_num; + i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING; + if ((i.index_reg->reg_flags & RegRex) != 0) + i.rex |= REX_EXTY; + } + i.rm.mode = mode_from_disp_size (i.types[op]); + } + + if (fake_zero_displacement) + { + /* Fakes a zero displacement assuming that i.types[op] + holds the correct displacement size. */ + expressionS *exp; + + assert (i.op[op].disps == 0); + exp = &disp_expressions[i.disp_operands++]; + i.op[op].disps = exp; + exp->X_op = O_constant; + exp->X_add_number = 0; + exp->X_add_symbol = (symbolS *) 0; + exp->X_op_symbol = (symbolS *) 0; + } + } + + /* Fill in i.rm.reg or i.rm.regmem field with register operand + (if any) based on i.tm.extension_opcode. Again, we must be + careful to make sure that segment/control/debug/test/MMX + registers are coded into the i.rm.reg field. */ + if (i.reg_operands) + { + unsigned int op = + ((i.types[0] + & (Reg | RegMMX | RegXMM + | SReg2 | SReg3 + | Control | Debug | Test)) + ? 0 + : ((i.types[1] + & (Reg | RegMMX | RegXMM + | SReg2 | SReg3 + | Control | Debug | Test)) + ? 1 + : 2)); + /* If there is an extension opcode to put here, the register + number must be put into the regmem field. */ + if (i.tm.extension_opcode != None) + { + i.rm.regmem = i.op[op].regs->reg_num; + if ((i.op[op].regs->reg_flags & RegRex) != 0) + i.rex |= REX_EXTZ; + } + else + { + i.rm.reg = i.op[op].regs->reg_num; + if ((i.op[op].regs->reg_flags & RegRex) != 0) + i.rex |= REX_EXTX; + } - if (fake_zero_displacement) - { - /* Fakes a zero displacement assuming that i.types[op] - holds the correct displacement size. */ - expressionS *exp; - - assert (i.op[op].disps == 0); - exp = &disp_expressions[i.disp_operands++]; - i.op[op].disps = exp; - exp->X_op = O_constant; - exp->X_add_number = 0; - exp->X_add_symbol = (symbolS *) 0; - exp->X_op_symbol = (symbolS *) 0; - } - } + /* Now, if no memory operand has set i.rm.mode = 0, 1, 2 we + must set it to 3 to indicate this is a register operand + in the regmem field. */ + if (!i.mem_operands) + i.rm.mode = 3; + } - /* Fill in i.rm.reg or i.rm.regmem field with register - operand (if any) based on i.tm.extension_opcode. - Again, we must be careful to make sure that - segment/control/debug/test/MMX registers are coded - into the i.rm.reg field. */ - if (i.reg_operands) - { - unsigned int op = - ((i.types[0] - & (Reg | RegMMX | RegXMM - | SReg2 | SReg3 - | Control | Debug | Test)) - ? 0 - : ((i.types[1] - & (Reg | RegMMX | RegXMM - | SReg2 | SReg3 - | Control | Debug | Test)) - ? 1 - : 2)); - /* If there is an extension opcode to put here, the - register number must be put into the regmem field. */ - if (i.tm.extension_opcode != None) - { - i.rm.regmem = i.op[op].regs->reg_num; - if (i.op[op].regs->reg_flags & RegRex) - i.rex.extZ = 1; - } - else - { - i.rm.reg = i.op[op].regs->reg_num; - if (i.op[op].regs->reg_flags & RegRex) - i.rex.extX = 1; - } + /* Fill in i.rm.reg field with extension opcode (if any). */ + if (i.tm.extension_opcode != None) + i.rm.reg = i.tm.extension_opcode; + } + return default_seg; +} - /* Now, if no memory operand has set i.rm.mode = 0, 1, 2 - we must set it to 3 to indicate this is a register - operand in the regmem field. */ - if (!i.mem_operands) - i.rm.mode = 3; - } - - /* Fill in i.rm.reg field with extension opcode (if any). */ - if (i.tm.extension_opcode != None) - i.rm.reg = i.tm.extension_opcode; - } - } - else if (i.tm.opcode_modifier & (Seg2ShortForm | Seg3ShortForm)) - { - if (i.tm.base_opcode == POP_SEG_SHORT - && i.op[0].regs->reg_num == 1) - { - as_bad (_("you can't `pop %%cs'")); - return; - } - i.tm.base_opcode |= (i.op[0].regs->reg_num << 3); - if (i.op[0].regs->reg_flags & RegRex) - i.rex.extZ = 1; - } - else if ((i.tm.base_opcode & ~(D|W)) == MOV_AX_DISP32) - { - default_seg = &ds; - } - else if ((i.tm.opcode_modifier & IsString) != 0) - { - /* For the string instructions that allow a segment override - on one of their operands, the default segment is ds. */ - default_seg = &ds; - } +static void +output_branch () +{ + char *p; + int code16; + int prefix; + relax_substateT subtype; + symbolS *sym; + offsetT off; + + code16 = 0; + if (flag_code == CODE_16BIT) + code16 = CODE16; + + prefix = 0; + if (i.prefix[DATA_PREFIX] != 0) + { + prefix = 1; + i.prefixes -= 1; + code16 ^= CODE16; + } + /* Pentium4 branch hints. */ + if (i.prefix[SEG_PREFIX] == CS_PREFIX_OPCODE /* not taken */ + || i.prefix[SEG_PREFIX] == DS_PREFIX_OPCODE /* taken */) + { + prefix++; + i.prefixes--; + } + if (i.prefix[REX_PREFIX] != 0) + { + prefix++; + i.prefixes--; + } + + if (i.prefixes != 0 && !intel_syntax) + as_warn (_("skipping prefixes on this instruction")); + + /* It's always a symbol; End frag & setup for relax. + Make sure there is enough room in this frag for the largest + instruction we may generate in md_convert_frag. This is 2 + bytes for the opcode and room for the prefix and largest + displacement. */ + frag_grow (prefix + 2 + 4); + /* Prefix and 1 opcode byte go in fr_fix. */ + p = frag_more (prefix + 1); + if (i.prefix[DATA_PREFIX] != 0) + *p++ = DATA_PREFIX_OPCODE; + if (i.prefix[SEG_PREFIX] == CS_PREFIX_OPCODE + || i.prefix[SEG_PREFIX] == DS_PREFIX_OPCODE) + *p++ = i.prefix[SEG_PREFIX]; + if (i.prefix[REX_PREFIX] != 0) + *p++ = i.prefix[REX_PREFIX]; + *p = i.tm.base_opcode; + + if ((unsigned char) *p == JUMP_PC_RELATIVE) + subtype = ENCODE_RELAX_STATE (UNCOND_JUMP, SMALL); + else if ((cpu_arch_flags & Cpu386) != 0) + subtype = ENCODE_RELAX_STATE (COND_JUMP, SMALL); + else + subtype = ENCODE_RELAX_STATE (COND_JUMP86, SMALL); + subtype |= code16; - /* If a segment was explicitly specified, - and the specified segment is not the default, - use an opcode prefix to select it. - If we never figured out what the default segment is, - then default_seg will be zero at this point, - and the specified segment prefix will always be used. */ - if ((i.seg[0]) && (i.seg[0] != default_seg)) - { - if (! add_prefix (i.seg[0]->seg_prefix)) - return; - } - } - else if (!quiet_warnings && (i.tm.opcode_modifier & Ugh) != 0) - { - /* UnixWare fsub no args is alias for fsubp, fadd -> faddp, etc. */ - as_warn (_("translating to `%sp'"), i.tm.name); - } - } + sym = i.op[0].disps->X_add_symbol; + off = i.op[0].disps->X_add_number; - /* Handle conversion of 'int $3' --> special int3 insn. */ - if (i.tm.base_opcode == INT_OPCODE && i.op[0].imms->X_add_number == 3) + if (i.op[0].disps->X_op != O_constant + && i.op[0].disps->X_op != O_symbol) { - i.tm.base_opcode = INT3_OPCODE; - i.imm_operands = 0; + /* Handle complex expressions. */ + sym = make_expr_symbol (i.op[0].disps); + off = 0; } - if ((i.tm.opcode_modifier & (Jump | JumpByte | JumpDword)) - && i.op[0].disps->X_op == O_constant) - { - /* Convert "jmp constant" (and "call constant") to a jump (call) to - the absolute address given by the constant. Since ix86 jumps and - calls are pc relative, we need to generate a reloc. */ - i.op[0].disps->X_add_symbol = &abs_symbol; - i.op[0].disps->X_op = O_symbol; - } + /* 1 possible extra opcode + 4 byte displacement go in var part. + Pass reloc in fr_var. */ + frag_var (rs_machine_dependent, 5, i.reloc[0], subtype, sym, off, p); +} - if (i.tm.opcode_modifier & Rex64) - i.rex.mode64 = 1; +static void +output_jump () +{ + char *p; + int size; - /* For 8bit registers we would need an empty rex prefix. - Also in the case instruction is already having prefix, - we need to convert old registers to new ones. */ - - if (((i.types[0] & Reg8) && (i.op[0].regs->reg_flags & RegRex64)) - || ((i.types[1] & Reg8) && (i.op[1].regs->reg_flags & RegRex64)) - || ((i.rex.mode64 || i.rex.extX || i.rex.extY || i.rex.extZ || i.rex.empty) - && ((i.types[0] & Reg8) || (i.types[1] & Reg8)))) + if (i.tm.opcode_modifier & JumpByte) { - int x; - i.rex.empty = 1; - for (x = 0; x < 2; x++) + /* This is a loop or jecxz type instruction. */ + size = 1; + if (i.prefix[ADDR_PREFIX] != 0) { - /* Look for 8bit operand that does use old registers. */ - if (i.types[x] & Reg8 - && !(i.op[x].regs->reg_flags & RegRex64)) - { - /* In case it is "hi" register, give up. */ - if (i.op[x].regs->reg_num > 3) - as_bad (_("Can't encode registers '%%%s' in the instruction requiring REX prefix.\n"), - i.op[x].regs->reg_name); - - /* Otherwise it is equivalent to the extended register. - Since the encoding don't change this is merely cosmetical - cleanup for debug output. */ - - i.op[x].regs = i.op[x].regs + 8; - } + FRAG_APPEND_1_CHAR (ADDR_PREFIX_OPCODE); + i.prefixes -= 1; + } + /* Pentium4 branch hints. */ + if (i.prefix[SEG_PREFIX] == CS_PREFIX_OPCODE /* not taken */ + || i.prefix[SEG_PREFIX] == DS_PREFIX_OPCODE /* taken */) + { + FRAG_APPEND_1_CHAR (i.prefix[SEG_PREFIX]); + i.prefixes--; } } + else + { + int code16; - if (i.rex.mode64 || i.rex.extX || i.rex.extY || i.rex.extZ || i.rex.empty) - add_prefix (0x40 - | (i.rex.mode64 ? 8 : 0) - | (i.rex.extX ? 4 : 0) - | (i.rex.extY ? 2 : 0) - | (i.rex.extZ ? 1 : 0)); - - /* We are ready to output the insn. */ - { - register char *p; - - /* Tie dwarf2 debug info to the address at the start of the insn. - We can't do this after the insn has been output as the current - frag may have been closed off. eg. by frag_var. */ - dwarf2_emit_insn (0); - - /* Output jumps. */ - if (i.tm.opcode_modifier & Jump) - { - int code16; - int prefix; - relax_substateT subtype; - symbolS *sym; - offsetT off; - - code16 = 0; - if (flag_code == CODE_16BIT) - code16 = CODE16; + code16 = 0; + if (flag_code == CODE_16BIT) + code16 = CODE16; - prefix = 0; - if (i.prefix[DATA_PREFIX]) - { - prefix = 1; - i.prefixes -= 1; - code16 ^= CODE16; - } - /* Pentium4 branch hints. */ - if (i.prefix[SEG_PREFIX] == CS_PREFIX_OPCODE /* not taken */ - || i.prefix[SEG_PREFIX] == DS_PREFIX_OPCODE /* taken */) - { - prefix++; - i.prefixes--; - } - if (i.prefix[REX_PREFIX]) - { - prefix++; - i.prefixes--; - } + if (i.prefix[DATA_PREFIX] != 0) + { + FRAG_APPEND_1_CHAR (DATA_PREFIX_OPCODE); + i.prefixes -= 1; + code16 ^= CODE16; + } - if (i.prefixes != 0 && !intel_syntax) - as_warn (_("skipping prefixes on this instruction")); + size = 4; + if (code16) + size = 2; + } - /* It's always a symbol; End frag & setup for relax. - Make sure there is enough room in this frag for the largest - instruction we may generate in md_convert_frag. This is 2 - bytes for the opcode and room for the prefix and largest - displacement. */ - frag_grow (prefix + 2 + 4); - /* Prefix and 1 opcode byte go in fr_fix. */ - p = frag_more (prefix + 1); - if (i.prefix[DATA_PREFIX]) - *p++ = DATA_PREFIX_OPCODE; - if (i.prefix[SEG_PREFIX] == CS_PREFIX_OPCODE - || i.prefix[SEG_PREFIX] == DS_PREFIX_OPCODE) - *p++ = i.prefix[SEG_PREFIX]; - if (i.prefix[REX_PREFIX]) - *p++ = i.prefix[REX_PREFIX]; - *p = i.tm.base_opcode; - - if ((unsigned char) *p == JUMP_PC_RELATIVE) - subtype = ENCODE_RELAX_STATE (UNCOND_JUMP, SMALL); - else if ((cpu_arch_flags & Cpu386) != 0) - subtype = ENCODE_RELAX_STATE (COND_JUMP, SMALL); - else - subtype = ENCODE_RELAX_STATE (COND_JUMP86, SMALL); - subtype |= code16; + if (i.prefix[REX_PREFIX] != 0) + { + FRAG_APPEND_1_CHAR (i.prefix[REX_PREFIX]); + i.prefixes -= 1; + } - sym = i.op[0].disps->X_add_symbol; - off = i.op[0].disps->X_add_number; + if (i.prefixes != 0 && !intel_syntax) + as_warn (_("skipping prefixes on this instruction")); - if (i.op[0].disps->X_op != O_constant - && i.op[0].disps->X_op != O_symbol) - { - /* Handle complex expressions. */ - sym = make_expr_symbol (i.op[0].disps); - off = 0; - } + p = frag_more (1 + size); + *p++ = i.tm.base_opcode; - /* 1 possible extra opcode + 4 byte displacement go in var part. - Pass reloc in fr_var. */ - frag_var (rs_machine_dependent, 5, i.reloc[0], subtype, sym, off, p); - } - else if (i.tm.opcode_modifier & (JumpByte | JumpDword)) - { - int size; + fix_new_exp (frag_now, p - frag_now->fr_literal, size, + i.op[0].disps, 1, reloc (size, 1, 1, i.reloc[0])); +} - if (i.tm.opcode_modifier & JumpByte) - { - /* This is a loop or jecxz type instruction. */ - size = 1; - if (i.prefix[ADDR_PREFIX]) - { - FRAG_APPEND_1_CHAR (ADDR_PREFIX_OPCODE); - i.prefixes -= 1; - } - /* Pentium4 branch hints. */ - if (i.prefix[SEG_PREFIX] == CS_PREFIX_OPCODE /* not taken */ - || i.prefix[SEG_PREFIX] == DS_PREFIX_OPCODE /* taken */) - { - FRAG_APPEND_1_CHAR (i.prefix[SEG_PREFIX]); - i.prefixes--; - } - } - else - { - int code16; +static void +output_interseg_jump () +{ + char *p; + int size; + int prefix; + int code16; - code16 = 0; - if (flag_code == CODE_16BIT) - code16 = CODE16; + code16 = 0; + if (flag_code == CODE_16BIT) + code16 = CODE16; - if (i.prefix[DATA_PREFIX]) - { - FRAG_APPEND_1_CHAR (DATA_PREFIX_OPCODE); - i.prefixes -= 1; - code16 ^= CODE16; - } + prefix = 0; + if (i.prefix[DATA_PREFIX] != 0) + { + prefix = 1; + i.prefixes -= 1; + code16 ^= CODE16; + } + if (i.prefix[REX_PREFIX] != 0) + { + prefix++; + i.prefixes -= 1; + } - size = 4; - if (code16) - size = 2; - } + size = 4; + if (code16) + size = 2; - if (i.prefix[REX_PREFIX]) - { - FRAG_APPEND_1_CHAR (i.prefix[REX_PREFIX]); - i.prefixes -= 1; - } + if (i.prefixes != 0 && !intel_syntax) + as_warn (_("skipping prefixes on this instruction")); - if (i.prefixes != 0 && !intel_syntax) - as_warn (_("skipping prefixes on this instruction")); + /* 1 opcode; 2 segment; offset */ + p = frag_more (prefix + 1 + 2 + size); - p = frag_more (1 + size); - *p++ = i.tm.base_opcode; + if (i.prefix[DATA_PREFIX] != 0) + *p++ = DATA_PREFIX_OPCODE; - fix_new_exp (frag_now, p - frag_now->fr_literal, size, - i.op[0].disps, 1, reloc (size, 1, 1, i.reloc[0])); - } - else if (i.tm.opcode_modifier & JumpInterSegment) - { - int size; - int prefix; - int code16; - - code16 = 0; - if (flag_code == CODE_16BIT) - code16 = CODE16; + if (i.prefix[REX_PREFIX] != 0) + *p++ = i.prefix[REX_PREFIX]; - prefix = 0; - if (i.prefix[DATA_PREFIX]) - { - prefix = 1; - i.prefixes -= 1; - code16 ^= CODE16; - } - if (i.prefix[REX_PREFIX]) - { - prefix++; - i.prefixes -= 1; - } + *p++ = i.tm.base_opcode; + if (i.op[1].imms->X_op == O_constant) + { + offsetT n = i.op[1].imms->X_add_number; - size = 4; - if (code16) - size = 2; + if (size == 2 + && !fits_in_unsigned_word (n) + && !fits_in_signed_word (n)) + { + as_bad (_("16-bit jump out of range")); + return; + } + md_number_to_chars (p, n, size); + } + else + fix_new_exp (frag_now, p - frag_now->fr_literal, size, + i.op[1].imms, 0, reloc (size, 0, 0, i.reloc[1])); + if (i.op[0].imms->X_op != O_constant) + as_bad (_("can't handle non absolute segment in `%s'"), + i.tm.name); + md_number_to_chars (p + size, (valueT) i.op[0].imms->X_add_number, 2); +} - if (i.prefixes != 0 && !intel_syntax) - as_warn (_("skipping prefixes on this instruction")); +static void +output_insn () +{ + /* Tie dwarf2 debug info to the address at the start of the insn. + We can't do this after the insn has been output as the current + frag may have been closed off. eg. by frag_var. */ + dwarf2_emit_insn (0); + + /* Output jumps. */ + if (i.tm.opcode_modifier & Jump) + output_branch (); + else if (i.tm.opcode_modifier & (JumpByte | JumpDword)) + output_jump (); + else if (i.tm.opcode_modifier & JumpInterSegment) + output_interseg_jump (); + else + { + /* Output normal instructions here. */ + char *p; + unsigned char *q; - /* 1 opcode; 2 segment; offset */ - p = frag_more (prefix + 1 + 2 + size); + /* All opcodes on i386 have either 1 or 2 bytes. We may use third + byte for the SSE instructions to specify a prefix they require. */ + if (i.tm.base_opcode & 0xff0000) + add_prefix ((i.tm.base_opcode >> 16) & 0xff); + + /* The prefix bytes. */ + for (q = i.prefix; + q < i.prefix + sizeof (i.prefix) / sizeof (i.prefix[0]); + q++) + { + if (*q) + { + p = frag_more (1); + md_number_to_chars (p, (valueT) *q, 1); + } + } - if (i.prefix[DATA_PREFIX]) - *p++ = DATA_PREFIX_OPCODE; + /* Now the opcode; be careful about word order here! */ + if (fits_in_unsigned_byte (i.tm.base_opcode)) + { + FRAG_APPEND_1_CHAR (i.tm.base_opcode); + } + else + { + p = frag_more (2); + /* Put out high byte first: can't use md_number_to_chars! */ + *p++ = (i.tm.base_opcode >> 8) & 0xff; + *p = i.tm.base_opcode & 0xff; + } - if (i.prefix[REX_PREFIX]) - *p++ = i.prefix[REX_PREFIX]; + /* Now the modrm byte and sib byte (if present). */ + if (i.tm.opcode_modifier & Modrm) + { + p = frag_more (1); + md_number_to_chars (p, + (valueT) (i.rm.regmem << 0 + | i.rm.reg << 3 + | i.rm.mode << 6), + 1); + /* If i.rm.regmem == ESP (4) + && i.rm.mode != (Register mode) + && not 16 bit + ==> need second modrm byte. */ + if (i.rm.regmem == ESCAPE_TO_TWO_BYTE_ADDRESSING + && i.rm.mode != 3 + && !(i.base_reg && (i.base_reg->reg_type & Reg16) != 0)) + { + p = frag_more (1); + md_number_to_chars (p, + (valueT) (i.sib.base << 0 + | i.sib.index << 3 + | i.sib.scale << 6), + 1); + } + } - *p++ = i.tm.base_opcode; - if (i.op[1].imms->X_op == O_constant) - { - offsetT n = i.op[1].imms->X_add_number; + if (i.disp_operands) + output_disp (); - if (size == 2 - && !fits_in_unsigned_word (n) - && !fits_in_signed_word (n)) - { - as_bad (_("16-bit jump out of range")); - return; - } - md_number_to_chars (p, n, size); - } - else - fix_new_exp (frag_now, p - frag_now->fr_literal, size, - i.op[1].imms, 0, reloc (size, 0, 0, i.reloc[1])); - if (i.op[0].imms->X_op != O_constant) - as_bad (_("can't handle non absolute segment in `%s'"), - i.tm.name); - md_number_to_chars (p + size, (valueT) i.op[0].imms->X_add_number, 2); - } - else - { - /* Output normal instructions here. */ - unsigned char *q; + if (i.imm_operands) + output_imm (); + } - /* All opcodes on i386 have eighter 1 or 2 bytes. We may use third - byte for the SSE instructions to specify prefix they require. */ - if (i.tm.base_opcode & 0xff0000) - add_prefix ((i.tm.base_opcode >> 16) & 0xff); - - /* The prefix bytes. */ - for (q = i.prefix; - q < i.prefix + sizeof (i.prefix) / sizeof (i.prefix[0]); - q++) - { - if (*q) - { - p = frag_more (1); - md_number_to_chars (p, (valueT) *q, 1); - } - } +#ifdef DEBUG386 + if (flag_debug) + { + pi (line, &i); + } +#endif /* DEBUG386 */ +} - /* Now the opcode; be careful about word order here! */ - if (fits_in_unsigned_byte (i.tm.base_opcode)) - { - FRAG_APPEND_1_CHAR (i.tm.base_opcode); - } - else - { - p = frag_more (2); - /* Put out high byte first: can't use md_number_to_chars! */ - *p++ = (i.tm.base_opcode >> 8) & 0xff; - *p = i.tm.base_opcode & 0xff; - } +static void +output_disp () +{ + char *p; + unsigned int n; - /* Now the modrm byte and sib byte (if present). */ - if (i.tm.opcode_modifier & Modrm) - { - p = frag_more (1); - md_number_to_chars (p, - (valueT) (i.rm.regmem << 0 - | i.rm.reg << 3 - | i.rm.mode << 6), - 1); - /* If i.rm.regmem == ESP (4) - && i.rm.mode != (Register mode) - && not 16 bit - ==> need second modrm byte. */ - if (i.rm.regmem == ESCAPE_TO_TWO_BYTE_ADDRESSING - && i.rm.mode != 3 - && !(i.base_reg && (i.base_reg->reg_type & Reg16) != 0)) - { - p = frag_more (1); - md_number_to_chars (p, - (valueT) (i.sib.base << 0 - | i.sib.index << 3 - | i.sib.scale << 6), - 1); - } - } + for (n = 0; n < i.operands; n++) + { + if (i.types[n] & Disp) + { + if (i.op[n].disps->X_op == O_constant) + { + int size; + offsetT val; - if (i.disp_operands) - { - register unsigned int n; + size = 4; + if (i.types[n] & (Disp8 | Disp16 | Disp64)) + { + size = 2; + if (i.types[n] & Disp8) + size = 1; + if (i.types[n] & Disp64) + size = 8; + } + val = offset_in_range (i.op[n].disps->X_add_number, + size); + p = frag_more (size); + md_number_to_chars (p, val, size); + } + else + { + int size = 4; + int sign = 0; + int pcrel = (i.flags[n] & Operand_PCrel) != 0; + + /* The PC relative address is computed relative + to the instruction boundary, so in case immediate + fields follows, we need to adjust the value. */ + if (pcrel && i.imm_operands) + { + int imm_size = 4; + unsigned int n1; - for (n = 0; n < i.operands; n++) - { - if (i.types[n] & Disp) - { - if (i.op[n].disps->X_op == O_constant) + for (n1 = 0; n1 < i.operands; n1++) + if (i.types[n1] & Imm) { - int size; - offsetT val; - - size = 4; - if (i.types[n] & (Disp8 | Disp16 | Disp64)) + if (i.types[n1] & (Imm8 | Imm8S | Imm16 | Imm64)) { - size = 2; - if (i.types[n] & Disp8) - size = 1; - if (i.types[n] & Disp64) - size = 8; + imm_size = 2; + if (i.types[n1] & (Imm8 | Imm8S)) + imm_size = 1; + if (i.types[n1] & Imm64) + imm_size = 8; } - val = offset_in_range (i.op[n].disps->X_add_number, - size); - p = frag_more (size); - md_number_to_chars (p, val, size); + break; } - else - { - int size = 4; - int sign = 0; - int pcrel = (i.flags[n] & Operand_PCrel) != 0; - - /* The PC relative address is computed relative - to the instruction boundary, so in case immediate - fields follows, we need to adjust the value. */ - if (pcrel && i.imm_operands) - { - int imm_size = 4; - register unsigned int n1; - - for (n1 = 0; n1 < i.operands; n1++) - if (i.types[n1] & Imm) - { - if (i.types[n1] & (Imm8 | Imm8S | Imm16 | Imm64)) - { - imm_size = 2; - if (i.types[n1] & (Imm8 | Imm8S)) - imm_size = 1; - if (i.types[n1] & Imm64) - imm_size = 8; - } - break; - } - /* We should find the immediate. */ - if (n1 == i.operands) - abort (); - i.op[n].disps->X_add_number -= imm_size; - } + /* We should find the immediate. */ + if (n1 == i.operands) + abort (); + i.op[n].disps->X_add_number -= imm_size; + } - if (i.types[n] & Disp32S) - sign = 1; + if (i.types[n] & Disp32S) + sign = 1; - if (i.types[n] & (Disp16 | Disp64)) - { - size = 2; - if (i.types[n] & Disp64) - size = 8; - } + if (i.types[n] & (Disp16 | Disp64)) + { + size = 2; + if (i.types[n] & Disp64) + size = 8; + } - p = frag_more (size); - fix_new_exp (frag_now, p - frag_now->fr_literal, size, - i.op[n].disps, pcrel, - reloc (size, pcrel, sign, i.reloc[n])); - } - } - } - } + p = frag_more (size); + fix_new_exp (frag_now, p - frag_now->fr_literal, size, + i.op[n].disps, pcrel, + reloc (size, pcrel, sign, i.reloc[n])); + } + } + } +} - /* Output immediate. */ - if (i.imm_operands) - { - register unsigned int n; +static void +output_imm () +{ + char *p; + unsigned int n; - for (n = 0; n < i.operands; n++) - { - if (i.types[n] & Imm) - { - if (i.op[n].imms->X_op == O_constant) - { - int size; - offsetT val; + for (n = 0; n < i.operands; n++) + { + if (i.types[n] & Imm) + { + if (i.op[n].imms->X_op == O_constant) + { + int size; + offsetT val; - size = 4; - if (i.types[n] & (Imm8 | Imm8S | Imm16 | Imm64)) - { - size = 2; - if (i.types[n] & (Imm8 | Imm8S)) - size = 1; - else if (i.types[n] & Imm64) - size = 8; - } - val = offset_in_range (i.op[n].imms->X_add_number, - size); - p = frag_more (size); - md_number_to_chars (p, val, size); - } - else - { - /* Not absolute_section. - Need a 32-bit fixup (don't support 8bit - non-absolute imms). Try to support other - sizes ... */ - RELOC_ENUM reloc_type; - int size = 4; - int sign = 0; - - if ((i.types[n] & (Imm32S)) - && i.suffix == QWORD_MNEM_SUFFIX) - sign = 1; - if (i.types[n] & (Imm8 | Imm8S | Imm16 | Imm64)) - { - size = 2; - if (i.types[n] & (Imm8 | Imm8S)) - size = 1; - if (i.types[n] & Imm64) - size = 8; - } + size = 4; + if (i.types[n] & (Imm8 | Imm8S | Imm16 | Imm64)) + { + size = 2; + if (i.types[n] & (Imm8 | Imm8S)) + size = 1; + else if (i.types[n] & Imm64) + size = 8; + } + val = offset_in_range (i.op[n].imms->X_add_number, + size); + p = frag_more (size); + md_number_to_chars (p, val, size); + } + else + { + /* Not absolute_section. + Need a 32-bit fixup (don't support 8bit + non-absolute imms). Try to support other + sizes ... */ + RELOC_ENUM reloc_type; + int size = 4; + int sign = 0; + + if ((i.types[n] & (Imm32S)) + && i.suffix == QWORD_MNEM_SUFFIX) + sign = 1; + if (i.types[n] & (Imm8 | Imm8S | Imm16 | Imm64)) + { + size = 2; + if (i.types[n] & (Imm8 | Imm8S)) + size = 1; + if (i.types[n] & Imm64) + size = 8; + } - p = frag_more (size); - reloc_type = reloc (size, 0, sign, i.reloc[n]); + p = frag_more (size); + reloc_type = reloc (size, 0, sign, i.reloc[n]); #ifdef BFD_ASSEMBLER - if (reloc_type == BFD_RELOC_32 - && GOT_symbol - && GOT_symbol == i.op[n].imms->X_add_symbol - && (i.op[n].imms->X_op == O_symbol - || (i.op[n].imms->X_op == O_add - && ((symbol_get_value_expression - (i.op[n].imms->X_op_symbol)->X_op) - == O_subtract)))) - { - /* We don't support dynamic linking on x86-64 yet. */ - if (flag_code == CODE_64BIT) - abort (); - reloc_type = BFD_RELOC_386_GOTPC; - i.op[n].imms->X_add_number += 3; - } + if (reloc_type == BFD_RELOC_32 + && GOT_symbol + && GOT_symbol == i.op[n].imms->X_add_symbol + && (i.op[n].imms->X_op == O_symbol + || (i.op[n].imms->X_op == O_add + && ((symbol_get_value_expression + (i.op[n].imms->X_op_symbol)->X_op) + == O_subtract)))) + { + /* We don't support dynamic linking on x86-64 yet. */ + if (flag_code == CODE_64BIT) + abort (); + reloc_type = BFD_RELOC_386_GOTPC; + i.op[n].imms->X_add_number += 3; + } #endif - fix_new_exp (frag_now, p - frag_now->fr_literal, size, - i.op[n].imms, 0, reloc_type); - } - } - } - } - } - -#ifdef DEBUG386 - if (flag_debug) - { - pi (line, &i); - } -#endif /* DEBUG386 */ - } + fix_new_exp (frag_now, p - frag_now->fr_literal, size, + i.op[n].imms, 0, reloc_type); + } + } + } } #ifndef LEX_AT @@ -3426,7 +3618,7 @@ input_line_pointer = save; return NULL; } - if (i.log2_scale_factor != 0 && ! i.index_reg) + if (i.log2_scale_factor != 0 && i.index_reg == 0) { as_warn (_("scale factor of %d without an index register"), 1 << i.log2_scale_factor); @@ -3446,7 +3638,7 @@ char *disp_start; char *disp_end; { - register expressionS *exp; + expressionS *exp; segT exp_seg = 0; char *save_input_line_pointer; #ifndef LEX_AT @@ -3456,8 +3648,8 @@ if (flag_code == CODE_64BIT) { - if (!i.prefix[ADDR_PREFIX]) - bigdisp = Disp64; + if (i.prefix[ADDR_PREFIX] == 0) + bigdisp = Disp64; } else if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0)) bigdisp = Disp16; @@ -3557,9 +3749,9 @@ exp->X_op = O_subtract; exp->X_op_symbol = GOT_symbol; if (i.reloc[this_operand] == BFD_RELOC_X86_64_GOTPCREL) - i.reloc[this_operand] = BFD_RELOC_32_PCREL; + i.reloc[this_operand] = BFD_RELOC_32_PCREL; else - i.reloc[this_operand] = BFD_RELOC_32; + i.reloc[this_operand] = BFD_RELOC_32; } #endif @@ -3623,8 +3815,8 @@ && (i.base_reg->reg_type != BaseIndex || i.index_reg)) || (i.index_reg - && ((i.index_reg->reg_type & (Reg64|BaseIndex)) - != (Reg64|BaseIndex)))) + && ((i.index_reg->reg_type & (Reg64 | BaseIndex)) + != (Reg64 | BaseIndex)))) ok = 0; } else @@ -3633,8 +3825,8 @@ if ((i.base_reg && (i.base_reg->reg_type & (Reg32 | RegRex)) != Reg32) || (i.index_reg - && ((i.index_reg->reg_type & (Reg32|BaseIndex|RegRex)) - != (Reg32|BaseIndex)))) + && ((i.index_reg->reg_type & (Reg32 | BaseIndex | RegRex)) + != (Reg32 | BaseIndex)))) ok = 0; } } @@ -3644,15 +3836,15 @@ { /* 16bit checks. */ if ((i.base_reg - && ((i.base_reg->reg_type & (Reg16|BaseIndex|RegRex)) - != (Reg16|BaseIndex))) + && ((i.base_reg->reg_type & (Reg16 | BaseIndex | RegRex)) + != (Reg16 | BaseIndex))) || (i.index_reg - && (((i.index_reg->reg_type & (Reg16|BaseIndex)) - != (Reg16|BaseIndex)) - || ! (i.base_reg - && i.base_reg->reg_num < 6 - && i.index_reg->reg_num >= 6 - && i.log2_scale_factor == 0)))) + && (((i.index_reg->reg_type & (Reg16 | BaseIndex)) + != (Reg16 | BaseIndex)) + || !(i.base_reg + && i.base_reg->reg_num < 6 + && i.index_reg->reg_num >= 6 + && i.log2_scale_factor == 0)))) ok = 0; } else @@ -3661,8 +3853,8 @@ if ((i.base_reg && (i.base_reg->reg_type & (Reg32 | RegRex)) != Reg32) || (i.index_reg - && ((i.index_reg->reg_type & (Reg32|BaseIndex|RegRex)) - != (Reg32|BaseIndex)))) + && ((i.index_reg->reg_type & (Reg32 | BaseIndex | RegRex)) + != (Reg32 | BaseIndex)))) ok = 0; } } @@ -3679,8 +3871,8 @@ FIXME. There doesn't seem to be any real need for separate Disp16 and Disp32 flags. The same goes for Imm16 and Imm32. Removing them would probably clean up the code quite a lot. */ - if (i.types[this_operand] & (Disp16|Disp32)) - i.types[this_operand] ^= (Disp16|Disp32); + if (i.types[this_operand] & (Disp16 | Disp32)) + i.types[this_operand] ^= (Disp16 | Disp32); fudged = 1; goto tryprefix; } @@ -3999,8 +4191,8 @@ int md_estimate_size_before_relax (fragP, segment) - register fragS *fragP; - register segT segment; + fragS *fragP; + segT segment; { /* We've already got fragP->fr_subtype right; all we have to do is check for un-relaxable symbols. On an ELF system, we can't relax @@ -4043,10 +4235,8 @@ break; case COND_JUMP86: - if (no_cond_jump_promotion) - goto relax_guess; - - if (size == 2) + if (size == 2 + && (!no_cond_jump_promotion || fragP->fr_var != NO_RELOC)) { /* Negate the condition, and branch past an unconditional jump. */ @@ -4066,8 +4256,15 @@ /* Fall through. */ case COND_JUMP: - if (no_cond_jump_promotion) - goto relax_guess; + if (no_cond_jump_promotion && fragP->fr_var == NO_RELOC) + { + fragP->fr_fix += 1; + fix_new (fragP, old_fr_fix, 1, + fragP->fr_symbol, + fragP->fr_offset, 1, + BFD_RELOC_8_PCREL); + break; + } /* This changes the byte-displacement jump 0x7N to the (d)word-displacement jump 0x0f,0x8N. */ @@ -4089,7 +4286,6 @@ return fragP->fr_fix - old_fr_fix; } - relax_guess: /* Guess size depending on current relax state. Initially the relax state will correspond to a short jump and we return 1, because the variable part of the frag (the branch offset) is one byte @@ -4113,16 +4309,16 @@ md_convert_frag (headers, sec, fragP) object_headers *headers ATTRIBUTE_UNUSED; segT sec ATTRIBUTE_UNUSED; - register fragS *fragP; + fragS *fragP; #else void md_convert_frag (abfd, sec, fragP) bfd *abfd ATTRIBUTE_UNUSED; segT sec ATTRIBUTE_UNUSED; - register fragS *fragP; + fragS *fragP; #endif { - register unsigned char *opcode; + unsigned char *opcode; unsigned char *where_to_put_displacement = NULL; offsetT target_address; offsetT opcode_address; @@ -4304,10 +4500,10 @@ if ((fseg == seg || (symbol_section_p (fixP->fx_addsy) && fseg != absolute_section)) - && ! S_IS_EXTERNAL (fixP->fx_addsy) - && ! S_IS_WEAK (fixP->fx_addsy) + && !S_IS_EXTERNAL (fixP->fx_addsy) + && !S_IS_WEAK (fixP->fx_addsy) && S_IS_DEFINED (fixP->fx_addsy) - && ! S_IS_COMMON (fixP->fx_addsy)) + && !S_IS_COMMON (fixP->fx_addsy)) { /* Yes, we add the values in twice. This is because bfd_perform_relocation subtracts them out again. I think @@ -4407,6 +4603,8 @@ else if (use_rela_relocations) { fixP->fx_no_overflow = 1; + /* Remember value for tc_gen_reloc. */ + fixP->fx_addnumber = value; value = 0; } #endif @@ -4545,7 +4743,7 @@ } if (r != NULL - && r->reg_flags & (RegRex64|RegRex) + && (r->reg_flags & (RegRex64 | RegRex)) != 0 && flag_code != CODE_64BIT) { return (const reg_entry *) NULL; @@ -4599,7 +4797,7 @@ case 's': /* -s: On i386 Solaris, this tells the native assembler to use - .stab instead of .stab.excl. We always use .stab anyhow. */ + .stab instead of .stab.excl. We always use .stab anyhow. */ break; case OPTION_64: @@ -4796,7 +4994,7 @@ s_bss (ignore) int ignore ATTRIBUTE_UNUSED; { - register int temp; + int temp; temp = get_absolute_expression (); subseg_set (bss_section, (subsegT) temp); @@ -4882,7 +5080,9 @@ case 1: code = BFD_RELOC_8; break; case 2: code = BFD_RELOC_16; break; case 4: code = BFD_RELOC_32; break; +#ifdef BFD64 case 8: code = BFD_RELOC_64; break; +#endif } } break; @@ -4918,9 +5118,23 @@ /* Use the rela in 64bit mode. */ else { - rel->addend = fixp->fx_offset; - if (fixp->fx_pcrel) - rel->addend -= fixp->fx_size; + if (!fixp->fx_pcrel) + rel->addend = fixp->fx_offset; + else + switch (code) + { + case BFD_RELOC_X86_64_PLT32: + case BFD_RELOC_X86_64_GOT32: + case BFD_RELOC_X86_64_GOTPCREL: + rel->addend = fixp->fx_offset - fixp->fx_size; + break; + default: + rel->addend = (section->vma + - fixp->fx_size + + fixp->fx_addnumber + + md_pcrel_from (fixp)); + break; + } } rel->howto = bfd_reloc_type_lookup (stdoutput, code); @@ -4937,7 +5151,7 @@ return rel; } -#else /* ! BFD_ASSEMBLER */ +#else /* !BFD_ASSEMBLER */ #if (defined(OBJ_AOUT) | defined(OBJ_BOUT)) void @@ -5003,7 +5217,7 @@ #endif /* I386COFF */ -#endif /* ! BFD_ASSEMBLER */ +#endif /* !BFD_ASSEMBLER */ /* Parse operands using Intel syntax. This implements a recursive descent parser based on the BNF grammar published in Appendix B of the MASM 6.1 diff -Nur binutils-2.12/gas/config/tc-i386.h binutils-2.12.1/gas/config/tc-i386.h --- binutils-2.12/gas/config/tc-i386.h Thu Nov 15 16:28:55 2001 +++ binutils-2.12.1/gas/config/tc-i386.h Mon Apr 1 20:29:02 2002 @@ -467,15 +467,17 @@ modrm_byte; /* x86-64 extension prefix. */ -typedef struct - { - unsigned int mode64; - unsigned int extX; /* Used to extend modrm reg field. */ - unsigned int extY; /* Used to extend SIB index field. */ - unsigned int extZ; /* Used to extend modrm reg/mem, SIB base, modrm base fields. */ - unsigned int empty; /* Used to old-style byte registers to new style. */ - } -rex_byte; +typedef int rex_byte; +#define REX_OPCODE 0x40 + +/* Indicates 64 bit operand size. */ +#define REX_MODE64 8 +/* High extension to reg field of modrm byte. */ +#define REX_EXTX 4 +/* High extension to SIB index field. */ +#define REX_EXTY 2 +/* High extension to base field of modrm or SIB, or reg field of opcode. */ +#define REX_EXTZ 1 /* 386 opcode byte to code indirect addressing. */ typedef struct diff -Nur binutils-2.12/gas/config/tc-i960.c binutils-2.12.1/gas/config/tc-i960.c --- binutils-2.12/gas/config/tc-i960.c Thu Nov 15 16:28:56 2001 +++ binutils-2.12.1/gas/config/tc-i960.c Thu May 9 10:49:39 2002 @@ -1,6 +1,6 @@ /* tc-i960.c - All the i80960-specific stuff Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001 + 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GAS. @@ -1085,7 +1085,8 @@ relax_cobr (fragP); return 4; } - return 0; + + return md_relax_table[fragP->fr_subtype].rlx_length; } /* md_estimate_size_before_relax() */ #if defined(OBJ_AOUT) | defined(OBJ_BOUT) diff -Nur binutils-2.12/gas/config/tc-ia64.c binutils-2.12.1/gas/config/tc-ia64.c --- binutils-2.12/gas/config/tc-ia64.c Fri Feb 22 06:57:38 2002 +++ binutils-2.12.1/gas/config/tc-ia64.c Mon Apr 1 20:29:03 2002 @@ -2709,7 +2709,11 @@ size = (slot_index (last_addr, last_frag, first_addr, first_frag) + dir_len); rlen = ptr->r.record.r.rlen = size; - region = ptr; + if (ptr->r.type == body) + /* End of region. */ + region = 0; + else + region = ptr; break; } case epilogue: @@ -3250,7 +3254,7 @@ size = output_unw_records (unwind.list, (void **) &unw_rec); if (size % md.pointer_size != 0) as_bad ("Unwind record is not a multiple of %d bytes.", md.pointer_size); - + /* If there are unwind records, switch sections, and output the info. */ if (size != 0) { @@ -9982,11 +9986,26 @@ break; case 8: - if (target_big_endian) - code = BFD_RELOC_IA64_DIR64MSB; - else - code = BFD_RELOC_IA64_DIR64LSB; - break; + /* In 32-bit mode, data8 could mean function descriptors too. */ + if (exp->X_op == O_pseudo_fixup + && exp->X_op_symbol + && S_GET_VALUE (exp->X_op_symbol) == FUNC_IPLT_RELOC + && !(md.flags & EF_IA_64_ABI64)) + { + if (target_big_endian) + code = BFD_RELOC_IA64_IPLTMSB; + else + code = BFD_RELOC_IA64_IPLTLSB; + exp->X_op = O_symbol; + break; + } + else { + if (target_big_endian) + code = BFD_RELOC_IA64_DIR64MSB; + else + code = BFD_RELOC_IA64_DIR64LSB; + break; + } case 16: if (exp->X_op == O_pseudo_fixup diff -Nur binutils-2.12/gas/config/tc-ia64.h binutils-2.12.1/gas/config/tc-ia64.h --- binutils-2.12/gas/config/tc-ia64.h Fri Jan 11 04:27:39 2002 +++ binutils-2.12.1/gas/config/tc-ia64.h Mon Apr 1 20:29:03 2002 @@ -124,8 +124,6 @@ #define WORKING_DOT_WORD /* don't do broken word processing for now */ #define ELF_TC_SPECIAL_SECTIONS \ -{ ".init_array",SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE }, \ -{ ".fini_array",SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE }, \ { ".sbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, \ { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, diff -Nur binutils-2.12/gas/config/tc-mips.c binutils-2.12.1/gas/config/tc-mips.c --- binutils-2.12/gas/config/tc-mips.c Tue Feb 26 17:25:38 2002 +++ binutils-2.12.1/gas/config/tc-mips.c Mon Apr 1 20:29:04 2002 @@ -12153,18 +12153,9 @@ boolean linkonce = false; if (RELAX_MIPS16_P (fragp->fr_subtype)) - { - if (mips16_extended_frag (fragp, segtype, 0)) - { - fragp->fr_subtype = RELAX_MIPS16_MARK_EXTENDED (fragp->fr_subtype); - return 4; - } - else - { - fragp->fr_subtype = RELAX_MIPS16_CLEAR_EXTENDED (fragp->fr_subtype); - return 2; - } - } + /* We don't want to modify the EXTENDED bit here; it might get us + into infinite loops. We change it only in mips_relax_frag(). */ + return (RELAX_MIPS16_EXTENDED (fragp->fr_subtype) ? 4 : 2); if (mips_pic == NO_PIC) { diff -Nur binutils-2.12/gas/config/tc-mmix.c binutils-2.12.1/gas/config/tc-mmix.c --- binutils-2.12/gas/config/tc-mmix.c Sun Feb 3 23:03:15 2002 +++ binutils-2.12.1/gas/config/tc-mmix.c Mon Apr 1 20:29:05 2002 @@ -2172,7 +2172,8 @@ #define HANDLE_RELAXABLE(state) \ case ENCODE_RELAX (state, STATE_UNDF): \ if (fragP->fr_symbol != NULL \ - && S_GET_SEGMENT (fragP->fr_symbol) == segment) \ + && S_GET_SEGMENT (fragP->fr_symbol) == segment \ + && !S_IS_WEAK (fragP->fr_symbol)) \ { \ /* The symbol lies in the same segment - a relaxable case. */ \ fragP->fr_subtype \ diff -Nur binutils-2.12/gas/config/tc-ppc.c binutils-2.12.1/gas/config/tc-ppc.c --- binutils-2.12/gas/config/tc-ppc.c Mon Feb 25 00:05:30 2002 +++ binutils-2.12.1/gas/config/tc-ppc.c Thu May 9 10:49:40 2002 @@ -1374,7 +1374,7 @@ MAP ("plt@h", (int) BFD_RELOC_HI16_PLTOFF), MAP ("plt@ha", (int) BFD_RELOC_HI16_S_PLTOFF), MAP ("sdarel", (int) BFD_RELOC_GPREL16), - MAP ("sectoff", (int) BFD_RELOC_32_BASEREL), + MAP ("sectoff", (int) BFD_RELOC_16_BASEREL), MAP ("sectoff@l", (int) BFD_RELOC_LO16_BASEREL), MAP ("sectoff@h", (int) BFD_RELOC_HI16_BASEREL), MAP ("sectoff@ha", (int) BFD_RELOC_HI16_S_BASEREL), @@ -1683,7 +1683,7 @@ && fixp->fx_r_type != BFD_RELOC_HI16_GOTOFF && fixp->fx_r_type != BFD_RELOC_LO16_GOTOFF && fixp->fx_r_type != BFD_RELOC_HI16_S_GOTOFF - && fixp->fx_r_type != BFD_RELOC_32_BASEREL + && fixp->fx_r_type != BFD_RELOC_16_BASEREL && fixp->fx_r_type != BFD_RELOC_LO16_BASEREL && fixp->fx_r_type != BFD_RELOC_HI16_BASEREL && fixp->fx_r_type != BFD_RELOC_HI16_S_BASEREL @@ -2236,7 +2236,7 @@ case BFD_RELOC_LO16_PLTOFF: reloc = BFD_RELOC_PPC64_PLT16_LO_DS; break; - case BFD_RELOC_32_BASEREL: + case BFD_RELOC_16_BASEREL: reloc = BFD_RELOC_PPC64_SECTOFF_DS; break; case BFD_RELOC_LO16_BASEREL: @@ -5280,7 +5280,6 @@ case BFD_RELOC_RVA: case BFD_RELOC_32_PCREL: - case BFD_RELOC_32_BASEREL: case BFD_RELOC_PPC_EMB_NADDR32: md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where, value, 4); @@ -5305,6 +5304,7 @@ case BFD_RELOC_LO16_GOTOFF: case BFD_RELOC_HI16_GOTOFF: case BFD_RELOC_HI16_S_GOTOFF: + case BFD_RELOC_16_BASEREL: case BFD_RELOC_LO16_BASEREL: case BFD_RELOC_HI16_BASEREL: case BFD_RELOC_HI16_S_BASEREL: diff -Nur binutils-2.12/gas/config/tc-s390.c binutils-2.12.1/gas/config/tc-s390.c --- binutils-2.12/gas/config/tc-s390.c Thu Nov 15 16:28:58 2001 +++ binutils-2.12.1/gas/config/tc-s390.c Thu May 9 10:49:40 2002 @@ -1,5 +1,5 @@ /* tc-s390.c -- Assemble for the S390 - Copyright 2000, 2001 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of GAS, the GNU Assembler. @@ -373,6 +373,12 @@ else if (arg != NULL && strcmp (arg, "warn-areg-zero") == 0) warn_areg_zero = TRUE; + else if (arg != NULL && strcmp (arg, "31") == 0) + s390_arch_size = 31; + + else if (arg != NULL && strcmp (arg, "64") == 0) + s390_arch_size = 64; + else { as_bad (_("invalid switch -m%s"), arg); @@ -382,15 +388,9 @@ case 'A': if (arg != NULL && strcmp (arg, "esa") == 0) - { - current_architecture = S390_OPCODE_ESA; - s390_arch_size = 32; - } + current_architecture = S390_OPCODE_ESA; else if (arg != NULL && strcmp (arg, "esame") == 0) - { - current_architecture = S390_OPCODE_ESAME; - s390_arch_size = 64; - } + current_architecture = S390_OPCODE_ESAME; else as_bad ("invalid architecture -A%s", arg); current_arch_mask = 1 << current_architecture; @@ -422,7 +422,9 @@ S390 options:\n\ -mregnames Allow symbolic names for registers\n\ -mwarn-areg-zero Warn about zero base/index registers\n\ - -mno-regnames Do not allow symbolic names for registers\n")); + -mno-regnames Do not allow symbolic names for registers\n\ + -m31 Set file format to 31 bit format\n\ + -m64 Set file format to 64 bit format\n")); fprintf (stream, _("\ -V print assembler version number\n\ -Qy, -Qn ignored\n")); @@ -440,6 +442,10 @@ boolean dup_insn = false; const char *retval; + /* Give a warning if the combination -m64-bit and -Aesa is used. */ + if (s390_arch_size == 64 && current_arch_mask == (1 << S390_OPCODE_ESA)) + as_warn ("The 64 bit file format is used without esame instructions."); + /* Set the ELF flags if desired. */ if (s390_flags) bfd_set_private_flags (stdoutput, s390_flags); @@ -487,9 +493,9 @@ s390_md_end () { if (s390_arch_size == 64) - bfd_set_arch_mach (stdoutput, bfd_arch_s390, bfd_mach_s390_esame); + bfd_set_arch_mach (stdoutput, bfd_arch_s390, bfd_mach_s390_64); else - bfd_set_arch_mach (stdoutput, bfd_arch_s390, bfd_mach_s390_esa); + bfd_set_arch_mach (stdoutput, bfd_arch_s390, bfd_mach_s390_31); } void @@ -1221,6 +1227,7 @@ /* Write out the instruction. */ f = frag_more (opcode->oplen); memcpy (f, insn, opcode->oplen); + dwarf2_emit_insn (opcode->oplen); /* Create any fixups. At this point we do not use a bfd_reloc_code_real_type, but instead just use the @@ -1623,6 +1630,10 @@ if (S_IS_EXTERN (fixP->fx_addsy)) return 0; if (S_IS_WEAK (fixP->fx_addsy)) + return 0; + /* Don't adjust pc-relative references to merge sections. */ + if ((S_GET_SEGMENT(fixP->fx_addsy)->flags & SEC_MERGE) != 0 + && fixP->fx_pcrel) return 0; /* adjust_reloc_syms doesn't know about the GOT. */ if ( fixP->fx_r_type == BFD_RELOC_32_GOTOFF diff -Nur binutils-2.12/gas/config/tc-sh.c binutils-2.12.1/gas/config/tc-sh.c --- binutils-2.12/gas/config/tc-sh.c Mon Feb 11 01:15:10 2002 +++ binutils-2.12.1/gas/config/tc-sh.c Sat May 11 12:45:25 2002 @@ -2453,14 +2453,14 @@ void tc_crawl_symbol_chain (headers) - object_headers *headers; + object_headers *headers ATTRIBUTE_UNUSED; { printf (_("call to tc_crawl_symbol_chain \n")); } void tc_headers_hook (headers) - object_headers *headers; + object_headers *headers ATTRIBUTE_UNUSED; { printf (_("call to tc_headers_hook \n")); } @@ -2903,7 +2903,7 @@ #ifdef BFD_ASSEMBLER bfd *headers ATTRIBUTE_UNUSED; #else - object_headers *headers; + object_headers *headers ATTRIBUTE_UNUSED; #endif segT seg; fragS *fragP; @@ -3310,7 +3310,7 @@ char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; int lowbyte = target_big_endian ? 1 : 0; int highbyte = target_big_endian ? 0 : 1; - long val = * (long *) valP; + long val = (long) *valP; long max, min; int shift; @@ -3659,6 +3659,16 @@ number_to_chars_bigendian (ptr, use, nbytes); } +/* This version is used in obj-coff.c when not using BFD_ASSEMBLER. + eg for the sh-hms target. */ + +long +md_pcrel_from (fixP) + fixS *fixP; +{ + return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address + 2; +} + long md_pcrel_from_section (fixP, sec) fixS *fixP; @@ -3677,7 +3687,7 @@ return fixP->fx_subsy ? fixP->fx_where + fixP->fx_frag->fr_address : 0; } - return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address + 2; + return md_pcrel_from (fixP); } #ifdef OBJ_COFF diff -Nur binutils-2.12/gas/config/tc-sh.h binutils-2.12.1/gas/config/tc-sh.h --- binutils-2.12/gas/config/tc-sh.h Wed Jan 23 21:59:16 2002 +++ binutils-2.12.1/gas/config/tc-sh.h Thu May 9 10:49:40 2002 @@ -68,7 +68,12 @@ /* This arranges for gas/write.c to not apply a relocation if obj_fix_adjustable() says it is not adjustable. */ -#define TC_FIX_ADJUSTABLE(fixP) obj_fix_adjustable (fixP) +/* ??? fixups with symbols in SEC_MERGE sections are marked with + obj_fix_adjustable and have a non-section symbol, as in + "vwxyz"+1 in execute/string-opt-6.c . Maybe the test of + (symbol_used_in_reloc_p should be done in the machine-independent code. */ +#define TC_FIX_ADJUSTABLE(fixP) \ + (! symbol_used_in_reloc_p (fixP->fx_addsy) && obj_fix_adjustable (fixP)) #endif #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC) diff -Nur binutils-2.12/gas/config/tc-xstormy16.h binutils-2.12.1/gas/config/tc-xstormy16.h --- binutils-2.12/gas/config/tc-xstormy16.h Fri Dec 7 22:45:55 2001 +++ binutils-2.12.1/gas/config/tc-xstormy16.h Thu May 9 10:49:40 2002 @@ -1,5 +1,5 @@ /* tc-xstormy16.h -- Header file for tc-xstormy16.c. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -67,3 +67,6 @@ extern void xstormy16_cons_fix_new PARAMS ((fragS *f, int, int, expressionS *)); #define md_cgen_record_fixup_exp xstormy16_cgen_record_fixup_exp + +/* Minimum instruction is two bytes. */ +#define DWARF2_LINE_MIN_INSN_LENGTH 2 diff -Nur binutils-2.12/gas/config.in binutils-2.12.1/gas/config.in --- binutils-2.12/gas/config.in Wed Oct 17 01:38:42 2001 +++ binutils-2.12.1/gas/config.in Mon Apr 1 20:28:59 2002 @@ -130,6 +130,9 @@ /* Define if you have the header file. */ #undef HAVE_SYS_PARAM_H +/* Define if you have the header file. */ +#undef HAVE_SYS_STAT_H + /* Define if you have the header file. */ #undef HAVE_SYS_TYPES_H diff -Nur binutils-2.12/gas/dep-in.sed binutils-2.12.1/gas/dep-in.sed --- binutils-2.12/gas/dep-in.sed Thu Jun 22 09:01:42 2000 +++ binutils-2.12.1/gas/dep-in.sed Thu Apr 4 11:21:09 2002 @@ -4,9 +4,12 @@ s! \.\./! !g s!@INCDIR@!$(INCDIR)!g +s!@TOPDIR@/include!$(INCDIR)!g s!@BFDDIR@!$(BFDDIR)!g +s!@TOPDIR@/bfd!$(BFDDIR)!g s!@SRCDIR@/config!$(srcdir)/config!g s!@SRCDIR@/\.\./opcodes!$(srcdir)/../opcodes!g +s!@TOPDIR@/opcodes!$(srcdir)/../opcodes!g s!@SRCDIR@/!!g s! \$(INCDIR)/ansidecl\.h!!g s! \$(INCDIR)/fopen-same\.h!!g diff -Nur binutils-2.12/gas/doc/Makefile.in binutils-2.12.1/gas/doc/Makefile.in --- binutils-2.12/gas/doc/Makefile.in Sun Feb 10 18:38:12 2002 +++ binutils-2.12.1/gas/doc/Makefile.in Mon Apr 1 20:29:05 2002 @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -281,7 +281,7 @@ else ii=; fi; \ list='$(INFO_DEPS)'; \ for file in $$list; do \ - test -z "$ii" \ + test -z "$$ii" \ || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \ done @$(NORMAL_UNINSTALL) diff -Nur binutils-2.12/gas/doc/as.1 binutils-2.12.1/gas/doc/as.1 --- binutils-2.12/gas/doc/as.1 Fri Mar 8 01:16:02 2002 +++ binutils-2.12.1/gas/doc/as.1 Tue May 14 19:47:18 2002 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "AS 1" -.TH AS 1 "2002-03-08" "binutils-2.12" "GNU Development Tools" +.TH AS 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools" .UC .SH "NAME" \&\s-1AS\s0 \- the portable \s-1GNU\s0 assembler. diff -Nur binutils-2.12/gas/doc/as.info binutils-2.12.1/gas/doc/as.info --- binutils-2.12/gas/doc/as.info Fri Mar 8 14:45:08 2002 +++ binutils-2.12.1/gas/doc/as.info Tue May 14 19:47:18 2002 @@ -1,4 +1,4 @@ -This is as.info, produced by makeinfo version 4.0f from as.texinfo. +This is as.info, produced by makeinfo version 4.1 from as.texinfo. START-INFO-DIR-ENTRY * As: (as). The GNU assembler. @@ -19,411 +19,411 @@  Indirect: -as.info-1: 747 -as.info-2: 50358 -as.info-3: 100149 -as.info-4: 149856 -as.info-5: 199764 -as.info-6: 249184 -as.info-7: 298854 -as.info-8: 348734 -as.info-9: 398558 -as.info-10: 444194 +as.info-1: 746 +as.info-2: 50359 +as.info-3: 100150 +as.info-4: 149857 +as.info-5: 199765 +as.info-6: 249185 +as.info-7: 298855 +as.info-8: 348735 +as.info-9: 398559 +as.info-10: 444195  Tag Table: (Indirect) -Node: Top747 -Node: Overview1667 -Node: Manual18856 -Node: GNU Assembler19795 -Node: Object Formats20961 -Node: Command Line21408 -Node: Input Files22490 -Node: Object24469 -Node: Errors25416 -Node: Invoking26606 -Node: a28512 -Node: D30271 -Node: f30491 -Node: I30994 -Node: K31533 -Node: L31832 -Node: listing32664 -Node: M34250 -Node: MD38646 -Node: o39065 -Node: R39513 -Node: statistics40529 -Node: traditional-format40929 -Node: v41395 -Node: W41663 -Node: Z42563 -Node: Syntax43078 -Node: Preprocessing43668 -Node: Whitespace45228 -Node: Comments45618 -Node: Symbol Intro47761 -Node: Statements48444 -Node: Constants50358 -Node: Characters50984 -Node: Strings51477 -Node: Chars53630 -Node: Numbers54371 -Node: Integers54902 -Node: Bignums55545 -Node: Flonums55888 -Node: Sections57621 -Node: Secs Background57995 -Node: Ld Sections63021 -Node: As Sections65417 -Node: Sub-Sections66322 -Node: bss69321 -Node: Symbols70266 -Node: Labels70913 -Node: Setting Symbols71639 -Node: Symbol Names72004 -Node: Dot76477 -Node: Symbol Attributes76919 -Node: Symbol Value77651 -Node: Symbol Type78687 -Node: a.out Symbols79066 -Node: Symbol Desc79316 -Node: Symbol Other79598 -Node: COFF Symbols79754 -Node: SOM Symbols80383 -Node: Expressions80816 -Node: Empty Exprs81564 -Node: Integer Exprs81906 -Node: Arguments82296 -Node: Operators83393 -Node: Prefix Ops83719 -Node: Infix Ops84038 -Node: Pseudo Ops86426 -Node: Abort91245 -Node: ABORT91646 -Node: Align91908 -Node: Ascii94097 -Node: Asciz94398 -Node: Balign94638 -Node: Byte96496 -Node: Comm96729 -Node: Data98088 -Node: Def98398 -Node: Desc98766 -Node: Dim99259 -Node: Double99650 -Node: Eject99981 -Node: Else100149 -Node: Elseif100439 -Node: End100723 -Node: Endef100931 -Node: Endfunc101254 -Node: Endif101422 -Node: Equ101675 -Node: Equiv101978 -Node: Err102374 -Node: Exitm102677 -Node: Extern102837 -Node: Fail103091 -Node: File103529 -Node: Fill104138 -Node: Float105095 -Node: Func105429 -Node: Global106009 -Node: Hidden106752 -Node: hword107321 -Node: Ident107642 -Node: If107942 -Node: Incbin110533 -Node: Include111221 -Node: Int111765 -Node: Internal112139 -Node: Irp112774 -Node: Irpc113573 -Node: Lcomm114392 -Node: Lflags115133 -Node: Line115320 -Node: Linkonce116343 -Node: Ln117563 -Node: MRI117711 -Node: List118038 -Node: Long118641 -Node: Macro118811 -Node: Nolist121195 -Node: Octa121611 -Node: Org121937 -Node: P2align123212 -Node: Previous125133 -Node: PopSection125820 -Node: Print126321 -Node: Protected126543 -Node: Psize127180 -Node: Purgem127857 -Node: PushSection128071 -Node: Quad128654 -Node: Rept129100 -Node: Sbttl129506 -Node: Scl129864 -Node: Section130360 -Node: Set134058 -Node: Short134610 -Node: Single134923 -Node: Size135260 -Node: Sleb128135997 -Node: Skip136312 -Node: Space136627 -Node: Stab137512 -Node: String139507 -Node: Struct139926 -Node: SubSection140642 -Node: Symver141196 -Node: Tag143580 -Node: Text144088 -Node: Title144400 -Node: Type144772 -Node: Uleb128145879 -Node: Val146194 -Node: Version146555 -Node: VTableEntry146821 -Node: VTableInherit147102 -Node: Weak147536 -Node: Word147797 -Node: Deprecated149631 -Node: Machine Dependencies149856 -Node: AMD29K-Dependent152332 -Node: AMD29K Options152715 -Node: AMD29K Syntax152889 -Node: AMD29K-Macros153153 -Node: AMD29K-Chars153404 -Node: AMD29K-Regs153667 -Node: AMD29K Floating Point154931 -Node: AMD29K Directives155137 -Node: AMD29K Opcodes156545 -Node: Alpha-Dependent156881 -Node: Alpha Notes157312 -Node: Alpha Options157584 -Node: Alpha Syntax159734 -Node: Alpha-Chars160194 -Node: Alpha-Regs160412 -Node: Alpha-Relocs160783 -Node: Alpha Floating Point164818 -Node: Alpha Directives165031 -Node: Alpha Opcodes170057 -Node: ARC-Dependent170343 -Node: ARC Options170718 -Node: ARC Syntax171770 -Node: ARC-Chars171990 -Node: ARC-Regs172109 -Node: ARC Floating Point172220 -Node: ARC Directives172522 -Node: ARC Opcodes173804 -Node: ARM-Dependent174004 -Node: ARM Options174378 -Node: ARM Syntax179513 -Node: ARM-Chars179733 -Node: ARM-Regs180244 -Node: ARM Floating Point180416 -Node: ARM Directives180606 -Node: ARM Opcodes182673 -Node: CRIS-Dependent184723 -Node: CRIS-Opts185025 -Node: CRIS-Expand186763 -Node: CRIS-Syntax187588 -Node: CRIS-Chars187914 -Node: CRIS-Pic188452 -Ref: crispic188635 -Node: CRIS-Regs192150 -Node: CRIS-Pseudos192554 -Ref: crisnous193317 -Node: D10V-Dependent194379 -Node: D10V-Opts194722 -Node: D10V-Syntax195676 -Node: D10V-Size196196 -Node: D10V-Subs197156 -Node: D10V-Chars198178 -Node: D10V-Regs199764 -Node: D10V-Addressing200795 -Node: D10V-Word201468 -Node: D10V-Float201969 -Node: D10V-Opcodes202271 -Node: D30V-Dependent202655 -Node: D30V-Opts203000 -Node: D30V-Syntax203666 -Node: D30V-Size204189 -Node: D30V-Subs205147 -Node: D30V-Chars206169 -Node: D30V-Guarded208454 -Node: D30V-Regs209122 -Node: D30V-Addressing210248 -Node: D30V-Float210903 -Node: D30V-Opcodes211205 -Node: H8/300-Dependent211589 -Node: H8/300 Options211993 -Node: H8/300 Syntax212174 -Node: H8/300-Chars212461 -Node: H8/300-Regs212745 -Node: H8/300-Addressing213649 -Node: H8/300 Floating Point214675 -Node: H8/300 Directives214991 -Node: H8/300 Opcodes215511 -Node: H8/500-Dependent223864 -Node: H8/500 Options224268 -Node: H8/500 Syntax224449 -Node: H8/500-Chars224736 -Node: H8/500-Regs225027 -Node: H8/500-Addressing225783 -Node: H8/500 Floating Point226400 -Node: H8/500 Directives226716 -Node: H8/500 Opcodes227035 -Node: HPPA-Dependent232148 -Node: HPPA Notes232573 -Node: HPPA Options233320 -Node: HPPA Syntax233504 -Node: HPPA Floating Point234763 -Node: HPPA Directives234958 -Node: HPPA Opcodes241549 -Node: ESA/390-Dependent241797 -Node: ESA/390 Notes242247 -Node: ESA/390 Options243027 -Node: ESA/390 Syntax243226 -Node: ESA/390 Floating Point245387 -Node: ESA/390 Directives245656 -Node: ESA/390 Opcodes248933 -Node: i386-Dependent249184 -Node: i386-Options250242 -Node: i386-Syntax250853 -Node: i386-Mnemonics253256 -Node: i386-Regs255710 -Node: i386-Prefixes257744 -Node: i386-Memory260492 -Node: i386-Jumps263418 -Node: i386-Float264528 -Node: i386-SIMD266346 -Node: i386-16bit267444 -Node: i386-Bugs269469 -Node: i386-Arch270208 -Node: i386-Notes272072 -Node: i860-Dependent272917 -Node: Notes-i860273303 -Node: Options-i860273797 -Node: Directives-i860274802 -Node: Opcodes for i860275464 -Node: i960-Dependent277583 -Node: Options-i960277975 -Node: Floating Point-i960281856 -Node: Directives-i960282113 -Node: Opcodes for i960284133 -Node: callj-i960284739 -Node: Compare-and-branch-i960285214 -Node: M32R-Dependent287103 -Node: M32R-Opts287366 -Node: M32R-Warnings289118 -Node: M68K-Dependent292106 -Node: M68K-Opts292563 -Node: M68K-Syntax298854 -Node: M68K-Moto-Syntax300682 -Node: M68K-Float303260 -Node: M68K-Directives303769 -Node: M68K-opcodes304364 -Node: M68K-Branch304576 -Node: M68K-Chars308762 -Node: M68HC11-Dependent309157 -Node: M68HC11-Opts309560 -Node: M68HC11-Syntax312263 -Node: M68HC11-Float313079 -Node: M68HC11-opcodes313592 -Node: M68HC11-Branch313760 -Node: M88K-Dependent316267 -Node: M88K Directives316508 -Node: MIPS-Dependent318016 -Node: MIPS Opts318917 -Node: MIPS Object324498 -Node: MIPS Stabs326053 -Node: MIPS ISA326764 -Node: MIPS autoextend327894 -Node: MIPS insn328605 -Node: MIPS option stack329091 -Node: MMIX-Dependent329804 -Node: MMIX-Opts330170 -Node: MMIX-Expand332989 -Node: MMIX-Syntax334293 -Ref: mmixsite334432 -Node: MMIX-Chars335480 -Node: MMIX-Symbols336119 -Node: MMIX-Regs338172 -Node: MMIX-Pseudos339182 -Ref: MMIX-loc339305 -Ref: MMIX-local340385 -Ref: MMIX-is340917 -Ref: MMIX-greg341188 -Ref: GREG-base341480 -Ref: MMIX-byte343424 -Ref: MMIX-constants343895 -Ref: MMIX-prefix344540 -Ref: MMIX-spec344914 -Node: MMIX-mmixal345248 -Node: PDP-11-Dependent348734 -Node: PDP-11-Options349113 -Node: PDP-11-Pseudos354110 -Node: PDP-11-Syntax354444 -Node: PDP-11-Mnemonics355184 -Node: PDP-11-Synthetic355475 -Node: PJ-Dependent355682 -Node: PJ Options355897 -Node: PPC-Dependent356164 -Node: PowerPC-Opts356380 -Node: SH-Dependent358232 -Node: SH Options358614 -Node: SH Syntax359046 -Node: SH-Chars359305 -Node: SH-Regs359584 -Node: SH-Addressing360183 -Node: SH Floating Point361077 -Node: SH Directives361373 -Node: SH Opcodes361729 -Node: SH64-Dependent365976 -Node: SH64 Options366331 -Node: SH64 Syntax367756 -Node: SH64-Chars368025 -Node: SH64-Regs368310 -Node: SH64-Addressing369391 -Node: SH64 Directives370559 -Node: SH64 Opcodes371656 -Node: Sparc-Dependent372360 -Node: Sparc-Opts372733 -Node: Sparc-Aligned-Data374979 -Node: Sparc-Float375823 -Node: Sparc-Directives376013 -Node: Z8000-Dependent377962 -Node: Z8000 Options378921 -Node: Z8000 Syntax379096 -Node: Z8000-Chars379372 -Node: Z8000-Regs379590 -Node: Z8000-Addressing380380 -Node: Z8000 Directives381323 -Node: Z8000 Opcodes382921 -Node: Vax-Dependent392857 -Node: VAX-Opts393364 -Node: VAX-float397088 -Node: VAX-directives397709 -Node: VAX-opcodes398558 -Node: VAX-branch398936 -Node: VAX-operands401432 -Node: VAX-no402184 -Node: V850-Dependent402410 -Node: V850 Options402796 -Node: V850 Syntax404609 -Node: V850-Chars404835 -Node: V850-Regs404985 -Node: V850 Floating Point406522 -Node: V850 Directives406717 -Node: V850 Opcodes407617 -Node: Reporting Bugs412902 -Node: Bug Criteria413625 -Node: Bug Reporting414385 -Node: Acknowledgements420953 -Ref: Acknowledgements-Footnote-1425744 -Node: GNU Free Documentation License425770 -Node: Index444194 +Node: Top746 +Node: Overview1668 +Node: Manual18857 +Node: GNU Assembler19796 +Node: Object Formats20962 +Node: Command Line21409 +Node: Input Files22491 +Node: Object24470 +Node: Errors25417 +Node: Invoking26607 +Node: a28513 +Node: D30272 +Node: f30492 +Node: I30995 +Node: K31534 +Node: L31833 +Node: listing32665 +Node: M34251 +Node: MD38647 +Node: o39066 +Node: R39514 +Node: statistics40530 +Node: traditional-format40930 +Node: v41396 +Node: W41664 +Node: Z42564 +Node: Syntax43079 +Node: Preprocessing43669 +Node: Whitespace45229 +Node: Comments45619 +Node: Symbol Intro47762 +Node: Statements48445 +Node: Constants50359 +Node: Characters50985 +Node: Strings51478 +Node: Chars53631 +Node: Numbers54372 +Node: Integers54903 +Node: Bignums55546 +Node: Flonums55889 +Node: Sections57622 +Node: Secs Background57996 +Node: Ld Sections63022 +Node: As Sections65418 +Node: Sub-Sections66323 +Node: bss69322 +Node: Symbols70267 +Node: Labels70914 +Node: Setting Symbols71640 +Node: Symbol Names72005 +Node: Dot76478 +Node: Symbol Attributes76920 +Node: Symbol Value77652 +Node: Symbol Type78688 +Node: a.out Symbols79067 +Node: Symbol Desc79317 +Node: Symbol Other79599 +Node: COFF Symbols79755 +Node: SOM Symbols80384 +Node: Expressions80817 +Node: Empty Exprs81565 +Node: Integer Exprs81907 +Node: Arguments82297 +Node: Operators83394 +Node: Prefix Ops83720 +Node: Infix Ops84039 +Node: Pseudo Ops86427 +Node: Abort91246 +Node: ABORT91647 +Node: Align91909 +Node: Ascii94098 +Node: Asciz94399 +Node: Balign94639 +Node: Byte96497 +Node: Comm96730 +Node: Data98089 +Node: Def98399 +Node: Desc98767 +Node: Dim99260 +Node: Double99651 +Node: Eject99982 +Node: Else100150 +Node: Elseif100440 +Node: End100724 +Node: Endef100932 +Node: Endfunc101255 +Node: Endif101423 +Node: Equ101676 +Node: Equiv101979 +Node: Err102375 +Node: Exitm102678 +Node: Extern102838 +Node: Fail103092 +Node: File103530 +Node: Fill104139 +Node: Float105096 +Node: Func105430 +Node: Global106010 +Node: Hidden106753 +Node: hword107322 +Node: Ident107643 +Node: If107943 +Node: Incbin110534 +Node: Include111222 +Node: Int111766 +Node: Internal112140 +Node: Irp112775 +Node: Irpc113574 +Node: Lcomm114393 +Node: Lflags115134 +Node: Line115321 +Node: Linkonce116344 +Node: Ln117564 +Node: MRI117712 +Node: List118039 +Node: Long118642 +Node: Macro118812 +Node: Nolist121196 +Node: Octa121612 +Node: Org121938 +Node: P2align123213 +Node: Previous125134 +Node: PopSection125821 +Node: Print126322 +Node: Protected126544 +Node: Psize127181 +Node: Purgem127858 +Node: PushSection128072 +Node: Quad128655 +Node: Rept129101 +Node: Sbttl129507 +Node: Scl129865 +Node: Section130361 +Node: Set134059 +Node: Short134611 +Node: Single134924 +Node: Size135261 +Node: Sleb128135998 +Node: Skip136313 +Node: Space136628 +Node: Stab137513 +Node: String139508 +Node: Struct139927 +Node: SubSection140643 +Node: Symver141197 +Node: Tag143581 +Node: Text144089 +Node: Title144401 +Node: Type144773 +Node: Uleb128145880 +Node: Val146195 +Node: Version146556 +Node: VTableEntry146822 +Node: VTableInherit147103 +Node: Weak147537 +Node: Word147798 +Node: Deprecated149632 +Node: Machine Dependencies149857 +Node: AMD29K-Dependent152333 +Node: AMD29K Options152716 +Node: AMD29K Syntax152890 +Node: AMD29K-Macros153154 +Node: AMD29K-Chars153405 +Node: AMD29K-Regs153668 +Node: AMD29K Floating Point154932 +Node: AMD29K Directives155138 +Node: AMD29K Opcodes156546 +Node: Alpha-Dependent156882 +Node: Alpha Notes157313 +Node: Alpha Options157585 +Node: Alpha Syntax159735 +Node: Alpha-Chars160195 +Node: Alpha-Regs160413 +Node: Alpha-Relocs160784 +Node: Alpha Floating Point164819 +Node: Alpha Directives165032 +Node: Alpha Opcodes170058 +Node: ARC-Dependent170344 +Node: ARC Options170719 +Node: ARC Syntax171771 +Node: ARC-Chars171991 +Node: ARC-Regs172110 +Node: ARC Floating Point172221 +Node: ARC Directives172523 +Node: ARC Opcodes173805 +Node: ARM-Dependent174005 +Node: ARM Options174379 +Node: ARM Syntax179514 +Node: ARM-Chars179734 +Node: ARM-Regs180245 +Node: ARM Floating Point180417 +Node: ARM Directives180607 +Node: ARM Opcodes182674 +Node: CRIS-Dependent184724 +Node: CRIS-Opts185026 +Node: CRIS-Expand186764 +Node: CRIS-Syntax187589 +Node: CRIS-Chars187915 +Node: CRIS-Pic188453 +Ref: crispic188636 +Node: CRIS-Regs192151 +Node: CRIS-Pseudos192555 +Ref: crisnous193318 +Node: D10V-Dependent194380 +Node: D10V-Opts194723 +Node: D10V-Syntax195677 +Node: D10V-Size196197 +Node: D10V-Subs197157 +Node: D10V-Chars198179 +Node: D10V-Regs199765 +Node: D10V-Addressing200796 +Node: D10V-Word201469 +Node: D10V-Float201970 +Node: D10V-Opcodes202272 +Node: D30V-Dependent202656 +Node: D30V-Opts203001 +Node: D30V-Syntax203667 +Node: D30V-Size204190 +Node: D30V-Subs205148 +Node: D30V-Chars206170 +Node: D30V-Guarded208455 +Node: D30V-Regs209123 +Node: D30V-Addressing210249 +Node: D30V-Float210904 +Node: D30V-Opcodes211206 +Node: H8/300-Dependent211590 +Node: H8/300 Options211994 +Node: H8/300 Syntax212175 +Node: H8/300-Chars212462 +Node: H8/300-Regs212746 +Node: H8/300-Addressing213650 +Node: H8/300 Floating Point214676 +Node: H8/300 Directives214992 +Node: H8/300 Opcodes215512 +Node: H8/500-Dependent223865 +Node: H8/500 Options224269 +Node: H8/500 Syntax224450 +Node: H8/500-Chars224737 +Node: H8/500-Regs225028 +Node: H8/500-Addressing225784 +Node: H8/500 Floating Point226401 +Node: H8/500 Directives226717 +Node: H8/500 Opcodes227036 +Node: HPPA-Dependent232149 +Node: HPPA Notes232574 +Node: HPPA Options233321 +Node: HPPA Syntax233505 +Node: HPPA Floating Point234764 +Node: HPPA Directives234959 +Node: HPPA Opcodes241550 +Node: ESA/390-Dependent241798 +Node: ESA/390 Notes242248 +Node: ESA/390 Options243028 +Node: ESA/390 Syntax243227 +Node: ESA/390 Floating Point245388 +Node: ESA/390 Directives245657 +Node: ESA/390 Opcodes248934 +Node: i386-Dependent249185 +Node: i386-Options250243 +Node: i386-Syntax250854 +Node: i386-Mnemonics253257 +Node: i386-Regs255711 +Node: i386-Prefixes257745 +Node: i386-Memory260493 +Node: i386-Jumps263419 +Node: i386-Float264529 +Node: i386-SIMD266347 +Node: i386-16bit267445 +Node: i386-Bugs269470 +Node: i386-Arch270209 +Node: i386-Notes272073 +Node: i860-Dependent272918 +Node: Notes-i860273304 +Node: Options-i860273798 +Node: Directives-i860274803 +Node: Opcodes for i860275465 +Node: i960-Dependent277584 +Node: Options-i960277976 +Node: Floating Point-i960281857 +Node: Directives-i960282114 +Node: Opcodes for i960284134 +Node: callj-i960284740 +Node: Compare-and-branch-i960285215 +Node: M32R-Dependent287104 +Node: M32R-Opts287367 +Node: M32R-Warnings289119 +Node: M68K-Dependent292107 +Node: M68K-Opts292564 +Node: M68K-Syntax298855 +Node: M68K-Moto-Syntax300683 +Node: M68K-Float303261 +Node: M68K-Directives303770 +Node: M68K-opcodes304365 +Node: M68K-Branch304577 +Node: M68K-Chars308763 +Node: M68HC11-Dependent309158 +Node: M68HC11-Opts309561 +Node: M68HC11-Syntax312264 +Node: M68HC11-Float313080 +Node: M68HC11-opcodes313593 +Node: M68HC11-Branch313761 +Node: M88K-Dependent316268 +Node: M88K Directives316509 +Node: MIPS-Dependent318017 +Node: MIPS Opts318918 +Node: MIPS Object324499 +Node: MIPS Stabs326054 +Node: MIPS ISA326765 +Node: MIPS autoextend327895 +Node: MIPS insn328606 +Node: MIPS option stack329092 +Node: MMIX-Dependent329805 +Node: MMIX-Opts330171 +Node: MMIX-Expand332990 +Node: MMIX-Syntax334294 +Ref: mmixsite334433 +Node: MMIX-Chars335481 +Node: MMIX-Symbols336120 +Node: MMIX-Regs338173 +Node: MMIX-Pseudos339183 +Ref: MMIX-loc339306 +Ref: MMIX-local340386 +Ref: MMIX-is340918 +Ref: MMIX-greg341189 +Ref: GREG-base341481 +Ref: MMIX-byte343425 +Ref: MMIX-constants343896 +Ref: MMIX-prefix344541 +Ref: MMIX-spec344915 +Node: MMIX-mmixal345249 +Node: PDP-11-Dependent348735 +Node: PDP-11-Options349114 +Node: PDP-11-Pseudos354111 +Node: PDP-11-Syntax354445 +Node: PDP-11-Mnemonics355185 +Node: PDP-11-Synthetic355476 +Node: PJ-Dependent355683 +Node: PJ Options355898 +Node: PPC-Dependent356165 +Node: PowerPC-Opts356381 +Node: SH-Dependent358233 +Node: SH Options358615 +Node: SH Syntax359047 +Node: SH-Chars359306 +Node: SH-Regs359585 +Node: SH-Addressing360184 +Node: SH Floating Point361078 +Node: SH Directives361374 +Node: SH Opcodes361730 +Node: SH64-Dependent365977 +Node: SH64 Options366332 +Node: SH64 Syntax367757 +Node: SH64-Chars368026 +Node: SH64-Regs368311 +Node: SH64-Addressing369392 +Node: SH64 Directives370560 +Node: SH64 Opcodes371657 +Node: Sparc-Dependent372361 +Node: Sparc-Opts372734 +Node: Sparc-Aligned-Data374980 +Node: Sparc-Float375824 +Node: Sparc-Directives376014 +Node: Z8000-Dependent377963 +Node: Z8000 Options378922 +Node: Z8000 Syntax379097 +Node: Z8000-Chars379373 +Node: Z8000-Regs379591 +Node: Z8000-Addressing380381 +Node: Z8000 Directives381324 +Node: Z8000 Opcodes382922 +Node: Vax-Dependent392858 +Node: VAX-Opts393365 +Node: VAX-float397089 +Node: VAX-directives397710 +Node: VAX-opcodes398559 +Node: VAX-branch398937 +Node: VAX-operands401433 +Node: VAX-no402185 +Node: V850-Dependent402411 +Node: V850 Options402797 +Node: V850 Syntax404610 +Node: V850-Chars404836 +Node: V850-Regs404986 +Node: V850 Floating Point406523 +Node: V850 Directives406718 +Node: V850 Opcodes407618 +Node: Reporting Bugs412903 +Node: Bug Criteria413626 +Node: Bug Reporting414386 +Node: Acknowledgements420954 +Ref: Acknowledgements-Footnote-1425745 +Node: GNU Free Documentation License425771 +Node: Index444195  End Tag Table diff -Nur binutils-2.12/gas/doc/as.info-1 binutils-2.12.1/gas/doc/as.info-1 --- binutils-2.12/gas/doc/as.info-1 Fri Mar 8 14:45:08 2002 +++ binutils-2.12.1/gas/doc/as.info-1 Tue May 14 19:47:18 2002 @@ -1,4 +1,4 @@ -This is as.info, produced by makeinfo version 4.0f from as.texinfo. +This is as.info, produced by makeinfo version 4.1 from as.texinfo. START-INFO-DIR-ENTRY * As: (as). The GNU assembler. @@ -23,7 +23,7 @@ Using as ******** - This file is a user guide to the GNU assembler `as' version 2.12. + This file is a user guide to the GNU assembler `as' version 2.12.1. This document is distributed under the terms of the GNU Free Documentation License. A copy of the license is included in the diff -Nur binutils-2.12/gas/doc/as.info-10 binutils-2.12.1/gas/doc/as.info-10 --- binutils-2.12/gas/doc/as.info-10 Fri Mar 8 14:45:08 2002 +++ binutils-2.12.1/gas/doc/as.info-10 Tue May 14 19:47:18 2002 @@ -1,4 +1,4 @@ -This is as.info, produced by makeinfo version 4.0f from as.texinfo. +This is as.info, produced by makeinfo version 4.1 from as.texinfo. START-INFO-DIR-ENTRY * As: (as). The GNU assembler. diff -Nur binutils-2.12/gas/doc/as.info-2 binutils-2.12.1/gas/doc/as.info-2 --- binutils-2.12/gas/doc/as.info-2 Fri Mar 8 14:45:08 2002 +++ binutils-2.12.1/gas/doc/as.info-2 Tue May 14 19:47:18 2002 @@ -1,4 +1,4 @@ -This is as.info, produced by makeinfo version 4.0f from as.texinfo. +This is as.info, produced by makeinfo version 4.1 from as.texinfo. START-INFO-DIR-ENTRY * As: (as). The GNU assembler. diff -Nur binutils-2.12/gas/doc/as.info-3 binutils-2.12.1/gas/doc/as.info-3 --- binutils-2.12/gas/doc/as.info-3 Fri Mar 8 14:45:08 2002 +++ binutils-2.12.1/gas/doc/as.info-3 Tue May 14 19:47:18 2002 @@ -1,4 +1,4 @@ -This is as.info, produced by makeinfo version 4.0f from as.texinfo. +This is as.info, produced by makeinfo version 4.1 from as.texinfo. START-INFO-DIR-ENTRY * As: (as). The GNU assembler. diff -Nur binutils-2.12/gas/doc/as.info-4 binutils-2.12.1/gas/doc/as.info-4 --- binutils-2.12/gas/doc/as.info-4 Fri Mar 8 14:45:08 2002 +++ binutils-2.12.1/gas/doc/as.info-4 Tue May 14 19:47:18 2002 @@ -1,4 +1,4 @@ -This is as.info, produced by makeinfo version 4.0f from as.texinfo. +This is as.info, produced by makeinfo version 4.1 from as.texinfo. START-INFO-DIR-ENTRY * As: (as). The GNU assembler. diff -Nur binutils-2.12/gas/doc/as.info-5 binutils-2.12.1/gas/doc/as.info-5 --- binutils-2.12/gas/doc/as.info-5 Fri Mar 8 14:45:08 2002 +++ binutils-2.12.1/gas/doc/as.info-5 Tue May 14 19:47:18 2002 @@ -1,4 +1,4 @@ -This is as.info, produced by makeinfo version 4.0f from as.texinfo. +This is as.info, produced by makeinfo version 4.1 from as.texinfo. START-INFO-DIR-ENTRY * As: (as). The GNU assembler. diff -Nur binutils-2.12/gas/doc/as.info-6 binutils-2.12.1/gas/doc/as.info-6 --- binutils-2.12/gas/doc/as.info-6 Fri Mar 8 14:45:08 2002 +++ binutils-2.12.1/gas/doc/as.info-6 Tue May 14 19:47:18 2002 @@ -1,4 +1,4 @@ -This is as.info, produced by makeinfo version 4.0f from as.texinfo. +This is as.info, produced by makeinfo version 4.1 from as.texinfo. START-INFO-DIR-ENTRY * As: (as). The GNU assembler. diff -Nur binutils-2.12/gas/doc/as.info-7 binutils-2.12.1/gas/doc/as.info-7 --- binutils-2.12/gas/doc/as.info-7 Fri Mar 8 14:45:08 2002 +++ binutils-2.12.1/gas/doc/as.info-7 Tue May 14 19:47:18 2002 @@ -1,4 +1,4 @@ -This is as.info, produced by makeinfo version 4.0f from as.texinfo. +This is as.info, produced by makeinfo version 4.1 from as.texinfo. START-INFO-DIR-ENTRY * As: (as). The GNU assembler. diff -Nur binutils-2.12/gas/doc/as.info-8 binutils-2.12.1/gas/doc/as.info-8 --- binutils-2.12/gas/doc/as.info-8 Fri Mar 8 14:45:08 2002 +++ binutils-2.12.1/gas/doc/as.info-8 Tue May 14 19:47:18 2002 @@ -1,4 +1,4 @@ -This is as.info, produced by makeinfo version 4.0f from as.texinfo. +This is as.info, produced by makeinfo version 4.1 from as.texinfo. START-INFO-DIR-ENTRY * As: (as). The GNU assembler. diff -Nur binutils-2.12/gas/doc/as.info-9 binutils-2.12.1/gas/doc/as.info-9 --- binutils-2.12/gas/doc/as.info-9 Fri Mar 8 14:45:08 2002 +++ binutils-2.12.1/gas/doc/as.info-9 Tue May 14 19:47:18 2002 @@ -1,4 +1,4 @@ -This is as.info, produced by makeinfo version 4.0f from as.texinfo. +This is as.info, produced by makeinfo version 4.1 from as.texinfo. START-INFO-DIR-ENTRY * As: (as). The GNU assembler. diff -Nur binutils-2.12/gas/doc/gasver.texi binutils-2.12.1/gas/doc/gasver.texi --- binutils-2.12/gas/doc/gasver.texi Fri Mar 8 14:45:08 2002 +++ binutils-2.12.1/gas/doc/gasver.texi Tue May 14 19:47:17 2002 @@ -1 +1 @@ -@set VERSION 2.12 +@set VERSION 2.12.1 diff -Nur binutils-2.12/gas/stabs.c binutils-2.12.1/gas/stabs.c --- binutils-2.12/gas/stabs.c Tue Dec 4 18:07:26 2001 +++ binutils-2.12.1/gas/stabs.c Mon May 13 09:15:50 2002 @@ -240,6 +240,14 @@ other = longint; desc = get_absolute_expression (); + + if ((desc > 0xffff) || (desc < -0x8000)) + /* This could happen for example with a source file with a huge + number of lines. The only cure is to use a different debug + format, probably DWARF. */ + as_warn (_(".stab%c: description field '%x' too big, try a different debug format"), + what, desc); + if (what == 's' || what == 'n') { if (*input_line_pointer != ',') diff -Nur binutils-2.12/gas/symbols.c binutils-2.12.1/gas/symbols.c --- binutils-2.12/gas/symbols.c Wed Sep 19 01:33:20 2001 +++ binutils-2.12.1/gas/symbols.c Thu May 9 10:49:38 2002 @@ -986,6 +986,7 @@ case O_bit_not: case O_logical_not: left = resolve_symbol_value (add_symbol); + seg_left = S_GET_SEGMENT (add_symbol); if (op == O_uminus) left = -left; @@ -996,7 +997,7 @@ final_val += left + symp->sy_frag->fr_address; if (final_seg == expr_section || final_seg == undefined_section) - final_seg = absolute_section; + final_seg = seg_left; resolved = symbol_resolved_p (add_symbol); break; @@ -1062,15 +1063,19 @@ Don't emit messages unless we're finalizing the symbol value, otherwise we may get the same message multiple times. */ - if (op != O_eq && op != O_ne - && (seg_left != absolute_section - || seg_right != absolute_section) - && ((op != O_subtract - && op != O_lt && op != O_le && op != O_ge && op != O_gt) - || seg_left != seg_right - || (seg_left == undefined_section - && add_symbol != op_symbol)) - && finalize_syms) + if ((op == O_eq || op == O_ne) + || ((op == O_subtract + || op == O_lt || op == O_le || op == O_ge || op == O_gt) + && seg_left == seg_right + && (seg_left != undefined_section + || add_symbol == op_symbol)) + || (seg_left == absolute_section + && seg_right == absolute_section)) + { + if (final_seg == expr_section || final_seg == undefined_section) + final_seg = absolute_section; + } + else if (finalize_syms) { char *file; unsigned int line; @@ -1105,6 +1110,9 @@ as_bad (_("invalid section for operation setting `%s'"), S_GET_NAME (symp)); } + /* Prevent the error propagating. */ + if (final_seg == expr_section || final_seg == undefined_section) + final_seg = absolute_section; } /* Check for division by zero. */ @@ -1160,7 +1168,15 @@ final_val += symp->sy_frag->fr_address + left; if (final_seg == expr_section || final_seg == undefined_section) - final_seg = absolute_section; + { + if (seg_left == undefined_section + || seg_right == undefined_section) + final_seg = undefined_section; + else if (seg_left == absolute_section) + final_seg = seg_right; + else + final_seg = seg_left; + } resolved = (symbol_resolved_p (add_symbol) && symbol_resolved_p (op_symbol)); break; diff -Nur binutils-2.12/gas/testsuite/ChangeLog binutils-2.12.1/gas/testsuite/ChangeLog --- binutils-2.12/gas/testsuite/ChangeLog Tue Feb 26 17:24:42 2002 +++ binutils-2.12.1/gas/testsuite/ChangeLog Thu May 9 10:49:42 2002 @@ -1,3 +1,44 @@ +2002-05-09 Alan Modra + + Merge from mainline. + 2002-04-17 matthew green + * gas/ppc/altivec.d: Fix dssall test. + * gas/ppc/altivec.s: Likewise. + +2002-04-30 Chris Demetriou + + Merge from mainline: + 2002-03-15 Chris G. Demetriou + * gas/mips/mips.exp: Use elf-rel2 and elfel-rel2 for + mipsisa32*-*-* targets, rather than e32-rel2 and e32el-rel2. + +2002-04-27 Alan Modra + + Merge from mainline. + 2002-04-23 H.J. Lu + * gas/hppa/parse/parse.exp: Don't expect failure on line separator + test on hppa*-*-linux* nor hppa*-*-netbsd*. + + 2002-03-19 Bo Thorsen + * gas/i386/x86-64-opcode.d: More test cases for x86-64 opcodes. + * gas/i386/x86-64-opcode.s: Likewise + + 2002-02-24 Hans-Peter Nilsson + * gas/mmix/bspec-1.d, gas/mmix/bspec-2.d, gas/mmix/comment-1.d: + Adjust to changes in readelf output. + + 2002-02-22 Bo Thorsen + * i386.exp: Add x86-64-opcode (checks valid opcodes) and x86-64-inval + (checks invalid opcodes) checks + * x86-64-inval.l: New file. + * x86-64-inval.s: New file. + * x86-64-opcode.d: New file. + * x86-64-opcode.s: New file. + +2002-03-17 Hans-Peter Nilsson + + * gas/mmix/weak1.d, gas/mmix/weak1.d: New test. + 2002-02-26 Chris Demetriou * gas/mips/empic2.d: Adjust for the fact that relocations on diff -Nur binutils-2.12/gas/testsuite/gas/hppa/parse/parse.exp binutils-2.12.1/gas/testsuite/gas/hppa/parse/parse.exp --- binutils-2.12/gas/testsuite/gas/hppa/parse/parse.exp Fri Nov 23 11:18:14 2001 +++ binutils-2.12.1/gas/testsuite/gas/hppa/parse/parse.exp Thu May 9 10:49:47 2002 @@ -119,8 +119,11 @@ } if [istarget hppa*-*-*] then { - # GAS-2.0 does not always parse ! as a line separator when it should. - setup_xfail hppa*-*-* + if { ![istarget hppa*-*-linux*] + && ![istarget hppa*-*-netbsd*] } { + # GAS-2.0 does not always parse ! as a line separator when it should. + setup_xfail hppa*-*-* + } gas_test "linesepbug.s" "" "" "line separator bug" # Make sure GAS accepts syntax for accessing static data. diff -Nur binutils-2.12/gas/testsuite/gas/i386/i386.exp binutils-2.12.1/gas/testsuite/gas/i386/i386.exp --- binutils-2.12/gas/testsuite/gas/i386/i386.exp Sun Sep 30 00:09:35 2001 +++ binutils-2.12.1/gas/testsuite/gas/i386/i386.exp Thu May 9 10:49:47 2002 @@ -87,6 +87,8 @@ set ASFLAGS "$ASFLAGS --64" run_dump_test "x86_64" + run_dump_test "x86-64-opcode" + run_list_test "x86-64-inval" "-al" set ASFLAGS "$old_ASFLAGS" } diff -Nur binutils-2.12/gas/testsuite/gas/i386/x86-64-inval.l binutils-2.12.1/gas/testsuite/gas/i386/x86-64-inval.l --- binutils-2.12/gas/testsuite/gas/i386/x86-64-inval.l Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/gas/testsuite/gas/i386/x86-64-inval.l Sat Apr 27 08:46:10 2002 @@ -0,0 +1,30 @@ +.*: Assembler messages: +.*:3: Error: .* +.*:4: Error: .* +.*:5: Error: .* +.*:6: Error: .* +.*:7: Error: .* +.*:8: Error: .* +.*:9: Error: .* +.*:10: Error: .* +.*:11: Error: .* +.*:12: Error: .* +.*:13: Error: .* +.*:14: Error: .* +GAS LISTING .* + + + 1 [ ]* .text + 2 [ ]*# All the following should be illegal for x86-64 + 3 [ ]*calll \*%eax # 32-bit data size not allowed + 4 [ ]*calll \*\(%ax\) # 32-bit data size not allowed + 5 [ ]*calll \*\(%eax\) # 32-bit data size not allowed + 6 [ ]*calll \*\(%r8\) # 32-bit data size not allowed + 7 [ ]*calll \*\(%rax\) # 32-bit data size not allowed + 8 [ ]*callq \*\(%ax\) # 32-bit data size not allowed + 9 [ ]*callw \*\(%ax\) # no 16-bit addressing + 10 [ ]*foo:[ ]*jcxz foo # No prefix exists to select CX as a counter + 11 [ ]*popl %eax # can\'t have 32-bit stack operands + 12 [ ]*pushl %eax # can\'t have 32-bit stack operands + 13 [ ]*pushfl # can\'t have 32-bit stack operands + 14 [ ]*popfl # can\'t have 32-bit stack operands diff -Nur binutils-2.12/gas/testsuite/gas/i386/x86-64-inval.s binutils-2.12.1/gas/testsuite/gas/i386/x86-64-inval.s --- binutils-2.12/gas/testsuite/gas/i386/x86-64-inval.s Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/gas/testsuite/gas/i386/x86-64-inval.s Sat Apr 27 08:46:10 2002 @@ -0,0 +1,14 @@ + .text +# All the following should be illegal for x86-64 + calll *%eax # 32-bit data size not allowed + calll *(%ax) # 32-bit data size not allowed + calll *(%eax) # 32-bit data size not allowed + calll *(%r8) # 32-bit data size not allowed + calll *(%rax) # 32-bit data size not allowed + callq *(%ax) # 32-bit data size not allowed + callw *(%ax) # no 16-bit addressing +foo: jcxz foo # No prefix exists to select CX as a counter + popl %eax # can't have 32-bit stack operands + pushl %eax # can't have 32-bit stack operands + pushfl # can't have 32-bit stack operands + popfl # can't have 32-bit stack operands diff -Nur binutils-2.12/gas/testsuite/gas/i386/x86-64-opcode.d binutils-2.12.1/gas/testsuite/gas/i386/x86-64-opcode.d --- binutils-2.12/gas/testsuite/gas/i386/x86-64-opcode.d Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/gas/testsuite/gas/i386/x86-64-opcode.d Sat Apr 27 08:46:10 2002 @@ -0,0 +1,271 @@ +#as: -J +#objdump: -drw +#name: x86-64 opcode + +.*: +file format elf64-x86-64 + +Disassembly of section .text: + +0+000 <.text>: +[ ]*0:[ ]+41 ff 10[ ]+callq[ ]+\*\(%r8\)[ ]*(#.*)* +[ ]*3:[ ]+ff 10[ ]+callq[ ]+\*\(%rax\)[ ]*(#.*)* +[ ]*5:[ ]+41 ff 10[ ]+callq[ ]+\*\(%r8\)[ ]*(#.*)* +[ ]*8:[ ]+ff 10[ ]+callq[ ]+\*\(%rax\)[ ]*(#.*)* +[ ]*a:[ ]+cb[ ]+lret[ ]*(#.*)* +[ ]*b:[ ]+c3[ ]+retq[ ]*(#.*)* +[ ]*c:[ ]+cf[ ]+iret[ ]*(#.*)* +[ ]*d:[ ]+66 cf[ ]+iretw[ ]*(#.*)* +[ ]*f:[ ]+48 cf[ ]+iretq[ ]*(#.*)* +[ ]*11:[ ]+66 41 8c 08[ ]+movw[ ]+%cs,\(%r8\)[ ]*(#.*)* +[ ]*15:[ ]+66 8c 08[ ]+movw[ ]+%cs,\(%rax\)[ ]*(#.*)* +[ ]*18:[ ]+66 41 8c 10[ ]+movw[ ]+%ss,\(%r8\)[ ]*(#.*)* +[ ]*1c:[ ]+66 8c 10[ ]+movw[ ]+%ss,\(%rax\)[ ]*(#.*)* +[ ]*1f:[ ]+66 41 8c 20[ ]+movw[ ]+%fs,\(%r8\)[ ]*(#.*)* +[ ]*23:[ ]+66 8c 20[ ]+movw[ ]+%fs,\(%rax\)[ ]*(#.*)* +[ ]*26:[ ]+41 8c 08[ ]+movl[ ]+%cs,\(%r8\)[ ]*(#.*)* +[ ]*29:[ ]+8c 08[ ]+movl[ ]+%cs,\(%rax\)[ ]*(#.*)* +[ ]*2b:[ ]+41 8c 10[ ]+movl[ ]+%ss,\(%r8\)[ ]*(#.*)* +[ ]*2e:[ ]+8c 10[ ]+movl[ ]+%ss,\(%rax\)[ ]*(#.*)* +[ ]*30:[ ]+41 8c 20[ ]+movl[ ]+%fs,\(%r8\)[ ]*(#.*)* +[ ]*33:[ ]+8c 20[ ]+movl[ ]+%fs,\(%rax\)[ ]*(#.*)* +[ ]*35:[ ]+41 8e 10[ ]+movl[ ]+\(%r8\),%ss[ ]*(#.*)* +[ ]*38:[ ]+8e 10[ ]+movl[ ]+\(%rax\),%ss[ ]*(#.*)* +[ ]*3a:[ ]+41 8e 20[ ]+movl[ ]+\(%r8\),%fs[ ]*(#.*)* +[ ]*3d:[ ]+8e 20[ ]+movl[ ]+\(%rax\),%fs[ ]*(#.*)* +[ ]*3f:[ ]+41 c6 00 00[ ]+movb[ ]+\$0[x0]*,\(%r8\)[ ]*(#.*)* +[ ]*43:[ ]+c6 00 00[ ]+movb[ ]+\$0[x0]*,\(%rax\)[ ]*(#.*)* +[ ]*46:[ ]+66 41 c7 00 00 70[ ]+movw[ ]+\$0x7000,\(%r8\)[ ]*(#.*)* +[ ]*4c:[ ]+66 c7 00 00 70[ ]+movw[ ]+\$0x7000,\(%rax\)[ ]*(#.*)* +[ ]*51:[ ]+41 c7 00 00 00 00 70[ ]+movl[ ]+\$0x70000000,\(%r8\)[ ]*(#.*)* +[ ]*58:[ ]+c7 00 00 00 00 70[ ]+movl[ ]+\$0x70000000,\(%rax\)[ ]*(#.*)* +[ ]*5e:[ ]+41 c6 00 00[ ]+movb[ ]+\$0[x0]*,\(%r8\)[ ]*(#.*)* +[ ]*62:[ ]+c6 00 00[ ]+movb[ ]+\$0[x0]*,\(%rax\)[ ]*(#.*)* +[ ]*65:[ ]+66 41 c7 00 00 70[ ]+movw[ ]+\$0x7000,\(%r8\)[ ]*(#.*)* +[ ]*6b:[ ]+66 c7 00 00 70[ ]+movw[ ]+\$0x7000,\(%rax\)[ ]*(#.*)* +[ ]*70:[ ]+c7 00 00 00 00 70[ ]+movl[ ]+\$0x70000000,\(%rax\)[ ]*(#.*)* +[ ]*76:[ ]+41 c6 00 00[ ]+movb[ ]+\$0[x0]*,\(%r8\)[ ]*(#.*)* +[ ]*7a:[ ]+c6 00 00[ ]+movb[ ]+\$0[x0]*,\(%rax\)[ ]*(#.*)* +[ ]*7d:[ ]+66 41 c7 00 00 70[ ]+movw[ ]+\$0x7000,\(%r8\)[ ]*(#.*)* +[ ]*83:[ ]+66 c7 00 00 70[ ]+movw[ ]+\$0x7000,\(%rax\)[ ]*(#.*)* +[ ]*88:[ ]+41 c7 00 00 00 00 70[ ]+movl[ ]+\$0x70000000,\(%r8\)[ ]*(#.*)* +[ ]*8f:[ ]+c7 00 00 00 00 70[ ]+movl[ ]+\$0x70000000,\(%rax\)[ ]*(#.*)* +[ ]*95:[ ]+49 c7 00 00 00 00 70[ ]+movq[ ]+\$0x70000000,\(%r8\)[ ]*(#.*)* +[ ]*9c:[ ]+48 c7 00 00 00 00 70[ ]+movq[ ]+\$0x70000000,\(%rax\)[ ]*(#.*)* +[ ]*a3:[ ]+41 0f c3 00[ ]+movnti[ ]+%eax,\(%r8\)[ ]*(#.*)* +[ ]*a7:[ ]+0f c3 00[ ]+movnti[ ]+%eax,\(%rax\)[ ]*(#.*)* +[ ]*aa:[ ]+49 0f c3 00[ ]+movnti[ ]+%rax,\(%r8\)[ ]*(#.*)* +[ ]*ae:[ ]+48 0f c3 00[ ]+movnti[ ]+%rax,\(%rax\)[ ]*(#.*)* +[ ]*b2:[ ]+4d 0f c3 00[ ]+movnti[ ]+%r8,\(%r8\)[ ]*(#.*)* +[ ]*b6:[ ]+4c 0f c3 00[ ]+movnti[ ]+%r8,\(%rax\)[ ]*(#.*)* +[ ]*ba:[ ]+41 f6 38[ ]+idivb[ ]+\(%r8\)[ ]*(#.*)* +[ ]*bd:[ ]+f6 38[ ]+idivb[ ]+\(%rax\)[ ]*(#.*)* +[ ]*bf:[ ]+66 41 f7 38[ ]+idivw[ ]+\(%r8\)[ ]*(#.*)* +[ ]*c3:[ ]+66 f7 38[ ]+idivw[ ]+\(%rax\)[ ]*(#.*)* +[ ]*c6:[ ]+41 f7 38[ ]+idivl[ ]+\(%r8\)[ ]*(#.*)* +[ ]*c9:[ ]+f7 38[ ]+idivl[ ]+\(%rax\)[ ]*(#.*)* +[ ]*cb:[ ]+49 f7 38[ ]+idivq[ ]+\(%r8\)[ ]*(#.*)* +[ ]*ce:[ ]+48 f7 38[ ]+idivq[ ]+\(%rax\)[ ]*(#.*)* +[ ]*d1:[ ]+41 f6 28[ ]+imulb[ ]+\(%r8\)[ ]*(#.*)* +[ ]*d4:[ ]+f6 28[ ]+imulb[ ]+\(%rax\)[ ]*(#.*)* +[ ]*d6:[ ]+66 41 f7 28[ ]+imulw[ ]+\(%r8\)[ ]*(#.*)* +[ ]*da:[ ]+66 f7 28[ ]+imulw[ ]+\(%rax\)[ ]*(#.*)* +[ ]*dd:[ ]+41 f7 28[ ]+imull[ ]+\(%r8\)[ ]*(#.*)* +[ ]*e0:[ ]+f7 28[ ]+imull[ ]+\(%rax\)[ ]*(#.*)* +[ ]*e2:[ ]+49 f7 28[ ]+imulq[ ]+\(%r8\)[ ]*(#.*)* +[ ]*e5:[ ]+48 f7 28[ ]+imulq[ ]+\(%rax\)[ ]*(#.*)* +[ ]*e8:[ ]+66 41 0f 58 00[ ]+addpd[ ]+\(%r8\),%xmm0[ ]*(#.*)* +[ ]*ed:[ ]+66 0f 58 00[ ]+addpd[ ]+\(%rax\),%xmm0[ ]*(#.*)* +[ ]*f1:[ ]+66 45 0f 58 38[ ]+addpd[ ]+\(%r8\),%xmm15[ ]*(#.*)* +[ ]*f6:[ ]+66 44 0f 58 38[ ]+addpd[ ]+\(%rax\),%xmm15[ ]*(#.*)* +[ ]*fb:[ ]+66 45 0f 58 00[ ]+addpd[ ]+\(%r8\),%xmm8[ ]*(#.*)* +[ ]*100:[ ]+66 44 0f 58 00[ ]+addpd[ ]+\(%rax\),%xmm8[ ]*(#.*)* +[ ]*105:[ ]+66 41 0f 58 38[ ]+addpd[ ]+\(%r8\),%xmm7[ ]*(#.*)* +[ ]*10a:[ ]+66 0f 58 38[ ]+addpd[ ]+\(%rax\),%xmm7[ ]*(#.*)* +[ ]*10e:[ ]+66 0f 58 c0[ ]+addpd[ ]+%xmm0,%xmm0[ ]*(#.*)* +[ ]*112:[ ]+66 45 0f 58 ff[ ]+addpd[ ]+%xmm15,%xmm15[ ]*(#.*)* +[ ]*117:[ ]+66 45 0f 58 c7[ ]+addpd[ ]+%xmm15,%xmm8[ ]*(#.*)* +[ ]*11c:[ ]+f2 49 0f 2d 00[ ]+cvtsd2siq[ ]+\(%r8\),%rax[ ]*(#.*)* +[ ]*121:[ ]+f2 48 0f 2d 00[ ]+cvtsd2siq[ ]+\(%rax\),%rax[ ]*(#.*)* +[ ]*126:[ ]+f2 4d 0f 2d 00[ ]+cvtsd2siq[ ]+\(%r8\),%r8[ ]*(#.*)* +[ ]*12b:[ ]+f2 4c 0f 2d 00[ ]+cvtsd2siq[ ]+\(%rax\),%r8[ ]*(#.*)* +[ ]*130:[ ]+f2 48 0f 2d c0[ ]+cvtsd2siq[ ]+%xmm0,%rax[ ]*(#.*)* +[ ]*135:[ ]+f2 4d 0f 2d c7[ ]+cvtsd2siq[ ]+%xmm15,%r8[ ]*(#.*)* +[ ]*13a:[ ]+f2 49 0f 2d c7[ ]+cvtsd2siq[ ]+%xmm15,%rax[ ]*(#.*)* +[ ]*13f:[ ]+f2 4d 0f 2d c0[ ]+cvtsd2siq[ ]+%xmm8,%r8[ ]*(#.*)* +[ ]*144:[ ]+f2 49 0f 2d c0[ ]+cvtsd2siq[ ]+%xmm8,%rax[ ]*(#.*)* +[ ]*149:[ ]+f2 4c 0f 2d c7[ ]+cvtsd2siq[ ]+%xmm7,%r8[ ]*(#.*)* +[ ]*14e:[ ]+f2 48 0f 2d c7[ ]+cvtsd2siq[ ]+%xmm7,%rax[ ]*(#.*)* +[ ]*153:[ ]+f2 4c 0f 2d c0[ ]+cvtsd2siq[ ]+%xmm0,%r8[ ]*(#.*)* +[ ]*158:[ ]+f2 49 0f 2c 00[ ]+cvttsd2siq[ ]+\(%r8\),%rax[ ]*(#.*)* +[ ]*15d:[ ]+f2 48 0f 2c 00[ ]+cvttsd2siq[ ]+\(%rax\),%rax[ ]*(#.*)* +[ ]*162:[ ]+f2 4d 0f 2c 00[ ]+cvttsd2siq[ ]+\(%r8\),%r8[ ]*(#.*)* +[ ]*167:[ ]+f2 4c 0f 2c 00[ ]+cvttsd2siq[ ]+\(%rax\),%r8[ ]*(#.*)* +[ ]*16c:[ ]+f2 48 0f 2c c0[ ]+cvttsd2siq[ ]+%xmm0,%rax[ ]*(#.*)* +[ ]*171:[ ]+f2 4d 0f 2c c7[ ]+cvttsd2siq[ ]+%xmm15,%r8[ ]*(#.*)* +[ ]*176:[ ]+f2 49 0f 2c c7[ ]+cvttsd2siq[ ]+%xmm15,%rax[ ]*(#.*)* +[ ]*17b:[ ]+f2 4d 0f 2c c0[ ]+cvttsd2siq[ ]+%xmm8,%r8[ ]*(#.*)* +[ ]*180:[ ]+f2 49 0f 2c c0[ ]+cvttsd2siq[ ]+%xmm8,%rax[ ]*(#.*)* +[ ]*185:[ ]+f2 4c 0f 2c c7[ ]+cvttsd2siq[ ]+%xmm7,%r8[ ]*(#.*)* +[ ]*18a:[ ]+f2 48 0f 2c c7[ ]+cvttsd2siq[ ]+%xmm7,%rax[ ]*(#.*)* +[ ]*18f:[ ]+f2 4c 0f 2c c0[ ]+cvttsd2siq[ ]+%xmm0,%r8[ ]*(#.*)* +[ ]*194:[ ]+f3 49 0f 2d 00[ ]+cvtss2siq[ ]+\(%r8\),%rax[ ]*(#.*)* +[ ]*199:[ ]+f3 48 0f 2d 00[ ]+cvtss2siq[ ]+\(%rax\),%rax[ ]*(#.*)* +[ ]*19e:[ ]+f3 4d 0f 2d 00[ ]+cvtss2siq[ ]+\(%r8\),%r8[ ]*(#.*)* +[ ]*1a3:[ ]+f3 4c 0f 2d 00[ ]+cvtss2siq[ ]+\(%rax\),%r8[ ]*(#.*)* +[ ]*1a8:[ ]+f3 48 0f 2d c0[ ]+cvtss2siq[ ]+%xmm0,%rax[ ]*(#.*)* +[ ]*1ad:[ ]+f3 4d 0f 2d c7[ ]+cvtss2siq[ ]+%xmm15,%r8[ ]*(#.*)* +[ ]*1b2:[ ]+f3 49 0f 2d c7[ ]+cvtss2siq[ ]+%xmm15,%rax[ ]*(#.*)* +[ ]*1b7:[ ]+f3 4d 0f 2d c0[ ]+cvtss2siq[ ]+%xmm8,%r8[ ]*(#.*)* +[ ]*1bc:[ ]+f3 49 0f 2d c0[ ]+cvtss2siq[ ]+%xmm8,%rax[ ]*(#.*)* +[ ]*1c1:[ ]+f3 4c 0f 2d c7[ ]+cvtss2siq[ ]+%xmm7,%r8[ ]*(#.*)* +[ ]*1c6:[ ]+f3 48 0f 2d c7[ ]+cvtss2siq[ ]+%xmm7,%rax[ ]*(#.*)* +[ ]*1cb:[ ]+f3 4c 0f 2d c0[ ]+cvtss2siq[ ]+%xmm0,%r8[ ]*(#.*)* +[ ]*1d0:[ ]+f3 49 0f 2c 00[ ]+cvttss2siq[ ]+\(%r8\),%rax[ ]*(#.*)* +[ ]*1d5:[ ]+f3 48 0f 2c 00[ ]+cvttss2siq[ ]+\(%rax\),%rax[ ]*(#.*)* +[ ]*1da:[ ]+f3 4d 0f 2c 00[ ]+cvttss2siq[ ]+\(%r8\),%r8[ ]*(#.*)* +[ ]*1df:[ ]+f3 4c 0f 2c 00[ ]+cvttss2siq[ ]+\(%rax\),%r8[ ]*(#.*)* +[ ]*1e4:[ ]+f3 48 0f 2c c0[ ]+cvttss2siq[ ]+%xmm0,%rax[ ]*(#.*)* +[ ]*1e9:[ ]+f3 4d 0f 2c c7[ ]+cvttss2siq[ ]+%xmm15,%r8[ ]*(#.*)* +[ ]*1ee:[ ]+f3 49 0f 2c c7[ ]+cvttss2siq[ ]+%xmm15,%rax[ ]*(#.*)* +[ ]*1f3:[ ]+f3 4d 0f 2c c0[ ]+cvttss2siq[ ]+%xmm8,%r8[ ]*(#.*)* +[ ]*1f8:[ ]+f3 49 0f 2c c0[ ]+cvttss2siq[ ]+%xmm8,%rax[ ]*(#.*)* +[ ]*1fd:[ ]+f3 4c 0f 2c c7[ ]+cvttss2siq[ ]+%xmm7,%r8[ ]*(#.*)* +[ ]*202:[ ]+f3 48 0f 2c c7[ ]+cvttss2siq[ ]+%xmm7,%rax[ ]*(#.*)* +[ ]*207:[ ]+f3 4c 0f 2c c0[ ]+cvttss2siq[ ]+%xmm0,%r8[ ]*(#.*)* +[ ]*20c:[ ]+f3 41 0f 2a 00[ ]+cvtsi2ss[ ]+\(%r8\),%xmm0[ ]*(#.*)* +[ ]*211:[ ]+f3 0f 2a 00[ ]+cvtsi2ss[ ]+\(%rax\),%xmm0[ ]*(#.*)* +[ ]*215:[ ]+f3 45 0f 2a 38[ ]+cvtsi2ss[ ]+\(%r8\),%xmm15[ ]*(#.*)* +[ ]*21a:[ ]+f3 44 0f 2a 38[ ]+cvtsi2ss[ ]+\(%rax\),%xmm15[ ]*(#.*)* +[ ]*21f:[ ]+f3 45 0f 2a 00[ ]+cvtsi2ss[ ]+\(%r8\),%xmm8[ ]*(#.*)* +[ ]*224:[ ]+f3 44 0f 2a 00[ ]+cvtsi2ss[ ]+\(%rax\),%xmm8[ ]*(#.*)* +[ ]*229:[ ]+f3 41 0f 2a 38[ ]+cvtsi2ss[ ]+\(%r8\),%xmm7[ ]*(#.*)* +[ ]*22e:[ ]+f3 0f 2a 38[ ]+cvtsi2ss[ ]+\(%rax\),%xmm7[ ]*(#.*)* +[ ]*232:[ ]+f3 0f 2a c0[ ]+cvtsi2ss[ ]+%eax,%xmm0[ ]*(#.*)* +[ ]*236:[ ]+f3 44 0f 2a f8[ ]+cvtsi2ss[ ]+%eax,%xmm15[ ]*(#.*)* +[ ]*23b:[ ]+f3 44 0f 2a c0[ ]+cvtsi2ss[ ]+%eax,%xmm8[ ]*(#.*)* +[ ]*240:[ ]+f3 0f 2a f8[ ]+cvtsi2ss[ ]+%eax,%xmm7[ ]*(#.*)* +[ ]*244:[ ]+f3 41 0f 2a 00[ ]+cvtsi2ss[ ]+\(%r8\),%xmm0[ ]*(#.*)* +[ ]*249:[ ]+f3 0f 2a 00[ ]+cvtsi2ss[ ]+\(%rax\),%xmm0[ ]*(#.*)* +[ ]*24d:[ ]+f3 45 0f 2a 38[ ]+cvtsi2ss[ ]+\(%r8\),%xmm15[ ]*(#.*)* +[ ]*252:[ ]+f3 44 0f 2a 38[ ]+cvtsi2ss[ ]+\(%rax\),%xmm15[ ]*(#.*)* +[ ]*257:[ ]+f3 45 0f 2a 00[ ]+cvtsi2ss[ ]+\(%r8\),%xmm8[ ]*(#.*)* +[ ]*25c:[ ]+f3 44 0f 2a 00[ ]+cvtsi2ss[ ]+\(%rax\),%xmm8[ ]*(#.*)* +[ ]*261:[ ]+f3 41 0f 2a 38[ ]+cvtsi2ss[ ]+\(%r8\),%xmm7[ ]*(#.*)* +[ ]*266:[ ]+f3 0f 2a 38[ ]+cvtsi2ss[ ]+\(%rax\),%xmm7[ ]*(#.*)* +[ ]*26a:[ ]+f2 41 0f 2a 00[ ]+cvtsi2sd[ ]+\(%r8\),%xmm0[ ]*(#.*)* +[ ]*26f:[ ]+f2 0f 2a 00[ ]+cvtsi2sd[ ]+\(%rax\),%xmm0[ ]*(#.*)* +[ ]*273:[ ]+f2 45 0f 2a 38[ ]+cvtsi2sd[ ]+\(%r8\),%xmm15[ ]*(#.*)* +[ ]*278:[ ]+f2 44 0f 2a 38[ ]+cvtsi2sd[ ]+\(%rax\),%xmm15[ ]*(#.*)* +[ ]*27d:[ ]+f2 45 0f 2a 00[ ]+cvtsi2sd[ ]+\(%r8\),%xmm8[ ]*(#.*)* +[ ]*282:[ ]+f2 44 0f 2a 00[ ]+cvtsi2sd[ ]+\(%rax\),%xmm8[ ]*(#.*)* +[ ]*287:[ ]+f2 41 0f 2a 38[ ]+cvtsi2sd[ ]+\(%r8\),%xmm7[ ]*(#.*)* +[ ]*28c:[ ]+f2 0f 2a 38[ ]+cvtsi2sd[ ]+\(%rax\),%xmm7[ ]*(#.*)* +[ ]*290:[ ]+f2 0f 2a c0[ ]+cvtsi2sd[ ]+%eax,%xmm0[ ]*(#.*)* +[ ]*294:[ ]+f2 44 0f 2a f8[ ]+cvtsi2sd[ ]+%eax,%xmm15[ ]*(#.*)* +[ ]*299:[ ]+f2 44 0f 2a c0[ ]+cvtsi2sd[ ]+%eax,%xmm8[ ]*(#.*)* +[ ]*29e:[ ]+f2 0f 2a f8[ ]+cvtsi2sd[ ]+%eax,%xmm7[ ]*(#.*)* +[ ]*2a2:[ ]+f2 41 0f 2a 00[ ]+cvtsi2sd[ ]+\(%r8\),%xmm0[ ]*(#.*)* +[ ]*2a7:[ ]+f2 0f 2a 00[ ]+cvtsi2sd[ ]+\(%rax\),%xmm0[ ]*(#.*)* +[ ]*2ab:[ ]+f2 45 0f 2a 38[ ]+cvtsi2sd[ ]+\(%r8\),%xmm15[ ]*(#.*)* +[ ]*2b0:[ ]+f2 44 0f 2a 38[ ]+cvtsi2sd[ ]+\(%rax\),%xmm15[ ]*(#.*)* +[ ]*2b5:[ ]+f2 45 0f 2a 00[ ]+cvtsi2sd[ ]+\(%r8\),%xmm8[ ]*(#.*)* +[ ]*2ba:[ ]+f2 44 0f 2a 00[ ]+cvtsi2sd[ ]+\(%rax\),%xmm8[ ]*(#.*)* +[ ]*2bf:[ ]+f2 41 0f 2a 38[ ]+cvtsi2sd[ ]+\(%r8\),%xmm7[ ]*(#.*)* +[ ]*2c4:[ ]+f2 0f 2a 38[ ]+cvtsi2sd[ ]+\(%rax\),%xmm7[ ]*(#.*)* +[ ]*2c8:[ ]+66 41 0f 6e 00[ ]+movd[ ]+\(%r8\),%xmm0[ ]*(#.*)* +[ ]*2cd:[ ]+66 0f 6e 00[ ]+movd[ ]+\(%rax\),%xmm0[ ]*(#.*)* +[ ]*2d1:[ ]+66 45 0f 6e 38[ ]+movd[ ]+\(%r8\),%xmm15[ ]*(#.*)* +[ ]*2d6:[ ]+66 44 0f 6e 38[ ]+movd[ ]+\(%rax\),%xmm15[ ]*(#.*)* +[ ]*2db:[ ]+66 45 0f 6e 00[ ]+movd[ ]+\(%r8\),%xmm8[ ]*(#.*)* +[ ]*2e0:[ ]+66 44 0f 6e 00[ ]+movd[ ]+\(%rax\),%xmm8[ ]*(#.*)* +[ ]*2e5:[ ]+66 41 0f 6e 38[ ]+movd[ ]+\(%r8\),%xmm7[ ]*(#.*)* +[ ]*2ea:[ ]+66 0f 6e 38[ ]+movd[ ]+\(%rax\),%xmm7[ ]*(#.*)* +[ ]*2ee:[ ]+66 0f 6e c0[ ]+movd[ ]+%eax,%xmm0[ ]*(#.*)* +[ ]*2f2:[ ]+66 44 0f 6e f8[ ]+movd[ ]+%eax,%xmm15[ ]*(#.*)* +[ ]*2f7:[ ]+66 44 0f 6e c0[ ]+movd[ ]+%eax,%xmm8[ ]*(#.*)* +[ ]*2fc:[ ]+66 0f 6e f8[ ]+movd[ ]+%eax,%xmm7[ ]*(#.*)* +[ ]*300:[ ]+66 41 0f 7e 00[ ]+movd[ ]+%xmm0,\(%r8\)[ ]*(#.*)* +[ ]*305:[ ]+66 0f 7e 00[ ]+movd[ ]+%xmm0,\(%rax\)[ ]*(#.*)* +[ ]*309:[ ]+66 45 0f 7e 38[ ]+movd[ ]+%xmm15,\(%r8\)[ ]*(#.*)* +[ ]*30e:[ ]+66 44 0f 7e 38[ ]+movd[ ]+%xmm15,\(%rax\)[ ]*(#.*)* +[ ]*313:[ ]+66 45 0f 7e 00[ ]+movd[ ]+%xmm8,\(%r8\)[ ]*(#.*)* +[ ]*318:[ ]+66 44 0f 7e 00[ ]+movd[ ]+%xmm8,\(%rax\)[ ]*(#.*)* +[ ]*31d:[ ]+66 41 0f 7e 38[ ]+movd[ ]+%xmm7,\(%r8\)[ ]*(#.*)* +[ ]*322:[ ]+66 0f 7e 38[ ]+movd[ ]+%xmm7,\(%rax\)[ ]*(#.*)* +[ ]*326:[ ]+66 0f 7e c0[ ]+movd[ ]+%xmm0,%eax[ ]*(#.*)* +[ ]*32a:[ ]+66 44 0f 7e f8[ ]+movd[ ]+%xmm15,%eax[ ]*(#.*)* +[ ]*32f:[ ]+66 44 0f 7e c0[ ]+movd[ ]+%xmm8,%eax[ ]*(#.*)* +[ ]*334:[ ]+66 0f 7e f8[ ]+movd[ ]+%xmm7,%eax[ ]*(#.*)* +[ ]*338:[ ]+f3 41 0f 7e 00[ ]+movq[ ]+\(%r8\),%xmm0[ ]*(#.*)* +[ ]*33d:[ ]+f3 0f 7e 00[ ]+movq[ ]+\(%rax\),%xmm0[ ]*(#.*)* +[ ]*341:[ ]+f3 45 0f 7e 38[ ]+movq[ ]+\(%r8\),%xmm15[ ]*(#.*)* +[ ]*346:[ ]+f3 44 0f 7e 38[ ]+movq[ ]+\(%rax\),%xmm15[ ]*(#.*)* +[ ]*34b:[ ]+f3 45 0f 7e 00[ ]+movq[ ]+\(%r8\),%xmm8[ ]*(#.*)* +[ ]*350:[ ]+f3 44 0f 7e 00[ ]+movq[ ]+\(%rax\),%xmm8[ ]*(#.*)* +[ ]*355:[ ]+f3 41 0f 7e 38[ ]+movq[ ]+\(%r8\),%xmm7[ ]*(#.*)* +[ ]*35a:[ ]+f3 0f 7e 38[ ]+movq[ ]+\(%rax\),%xmm7[ ]*(#.*)* +[ ]*35e:[ ]+f3 0f 7e c0[ ]+movq[ ]+%xmm0,%xmm0[ ]*(#.*)* +[ ]*362:[ ]+f3 45 0f 7e ff[ ]+movq[ ]+%xmm15,%xmm15[ ]*(#.*)* +[ ]*367:[ ]+f3 45 0f 7e c7[ ]+movq[ ]+%xmm15,%xmm8[ ]*(#.*)* +[ ]*36c:[ ]+f3 41 0f 7e ff[ ]+movq[ ]+%xmm15,%xmm7[ ]*(#.*)* +[ ]*371:[ ]+f3 41 0f 7e c7[ ]+movq[ ]+%xmm15,%xmm0[ ]*(#.*)* +[ ]*376:[ ]+f3 45 0f 7e f8[ ]+movq[ ]+%xmm8,%xmm15[ ]*(#.*)* +[ ]*37b:[ ]+f3 45 0f 7e c0[ ]+movq[ ]+%xmm8,%xmm8[ ]*(#.*)* +[ ]*380:[ ]+f3 41 0f 7e f8[ ]+movq[ ]+%xmm8,%xmm7[ ]*(#.*)* +[ ]*385:[ ]+f3 41 0f 7e c0[ ]+movq[ ]+%xmm8,%xmm0[ ]*(#.*)* +[ ]*38a:[ ]+f3 44 0f 7e ff[ ]+movq[ ]+%xmm7,%xmm15[ ]*(#.*)* +[ ]*38f:[ ]+f3 44 0f 7e c7[ ]+movq[ ]+%xmm7,%xmm8[ ]*(#.*)* +[ ]*394:[ ]+f3 0f 7e ff[ ]+movq[ ]+%xmm7,%xmm7[ ]*(#.*)* +[ ]*398:[ ]+f3 0f 7e c7[ ]+movq[ ]+%xmm7,%xmm0[ ]*(#.*)* +[ ]*39c:[ ]+f3 44 0f 7e f8[ ]+movq[ ]+%xmm0,%xmm15[ ]*(#.*)* +[ ]*3a1:[ ]+f3 44 0f 7e c0[ ]+movq[ ]+%xmm0,%xmm8[ ]*(#.*)* +[ ]*3a6:[ ]+f3 0f 7e f8[ ]+movq[ ]+%xmm0,%xmm7[ ]*(#.*)* +[ ]*3aa:[ ]+66 41 0f d6 00[ ]+movq[ ]+%xmm0,\(%r8\)[ ]*(#.*)* +[ ]*3af:[ ]+66 0f d6 00[ ]+movq[ ]+%xmm0,\(%rax\)[ ]*(#.*)* +[ ]*3b3:[ ]+66 45 0f d6 38[ ]+movq[ ]+%xmm15,\(%r8\)[ ]*(#.*)* +[ ]*3b8:[ ]+66 44 0f d6 38[ ]+movq[ ]+%xmm15,\(%rax\)[ ]*(#.*)* +[ ]*3bd:[ ]+66 45 0f d6 00[ ]+movq[ ]+%xmm8,\(%r8\)[ ]*(#.*)* +[ ]*3c2:[ ]+66 44 0f d6 00[ ]+movq[ ]+%xmm8,\(%rax\)[ ]*(#.*)* +[ ]*3c7:[ ]+66 41 0f d6 38[ ]+movq[ ]+%xmm7,\(%r8\)[ ]*(#.*)* +[ ]*3cc:[ ]+41 0f 6e 00[ ]+movd[ ]+\(%r8\),%mm0[ ]*(#.*)* +[ ]*3d0:[ ]+0f 6e 00[ ]+movd[ ]+\(%rax\),%mm0[ ]*(#.*)* +[ ]*3d3:[ ]+41 0f 6e 38[ ]+movd[ ]+\(%r8\),%mm7[ ]*(#.*)* +[ ]*3d7:[ ]+0f 6e 38[ ]+movd[ ]+\(%rax\),%mm7[ ]*(#.*)* +[ ]*3da:[ ]+0f 6e c0[ ]+movd[ ]+%eax,%mm0[ ]*(#.*)* +[ ]*3dd:[ ]+0f 6e f8[ ]+movd[ ]+%eax,%mm7[ ]*(#.*)* +[ ]*3e0:[ ]+41 0f 7e 00[ ]+movd[ ]+%mm0,\(%r8\)[ ]*(#.*)* +[ ]*3e4:[ ]+0f 7e 00[ ]+movd[ ]+%mm0,\(%rax\)[ ]*(#.*)* +[ ]*3e7:[ ]+41 0f 7e 38[ ]+movd[ ]+%mm7,\(%r8\)[ ]*(#.*)* +[ ]*3eb:[ ]+0f 7e 38[ ]+movd[ ]+%mm7,\(%rax\)[ ]*(#.*)* +[ ]*3ee:[ ]+0f 7e c0[ ]+movd[ ]+%mm0,%eax[ ]*(#.*)* +[ ]*3f1:[ ]+0f 7e f8[ ]+movd[ ]+%mm7,%eax[ ]*(#.*)* +[ ]*3f4:[ ]+41 0f 6f 00[ ]+movq[ ]+\(%r8\),%mm0[ ]*(#.*)* +[ ]*3f8:[ ]+0f 6f 00[ ]+movq[ ]+\(%rax\),%mm0[ ]*(#.*)* +[ ]*3fb:[ ]+41 0f 6f 38[ ]+movq[ ]+\(%r8\),%mm7[ ]*(#.*)* +[ ]*3ff:[ ]+0f 6f 38[ ]+movq[ ]+\(%rax\),%mm7[ ]*(#.*)* +[ ]*402:[ ]+41 0f 7f 00[ ]+movq[ ]+%mm0,\(%r8\)[ ]*(#.*)* +[ ]*406:[ ]+0f 7f 00[ ]+movq[ ]+%mm0,\(%rax\)[ ]*(#.*)* +[ ]*409:[ ]+41 0f 7f 38[ ]+movq[ ]+%mm7,\(%r8\)[ ]*(#.*)* +[ ]*40d:[ ]+0f 7f 38[ ]+movq[ ]+%mm7,\(%rax\)[ ]*(#.*)* +[ ]*410:[ ]+41 8f 00[ ]+popq[ ]+\(%r8\)[ ]*(#.*)* +[ ]*413:[ ]+8f 00[ ]+popq[ ]+\(%rax\)[ ]*(#.*)* +[ ]*415:[ ]+9d[ ]+popfq[ ]*(#.*)* +[ ]*416:[ ]+41 ff 30[ ]+pushq[ ]+\(%r8\)[ ]*(#.*)* +[ ]*419:[ ]+ff 30[ ]+pushq[ ]+\(%rax\)[ ]*(#.*)* +[ ]*41b:[ ]+9c[ ]+pushfq[ ]*(#.*)* +[ ]*41c:[ ]+0f 77[ ]+emms[ ]*(#.*)* +[ ]*41e:[ ]+0f 0e[ ]+femms[ ]*(#.*)* +[ ]*420:[ ]+0f 08[ ]+invd[ ]*(#.*)* +[ ]*422:[ ]+41 0f 01 38[ ]+invlpg[ ]+\(%r8\)[ ]*(#.*)* +[ ]*426:[ ]+0f 01 38[ ]+invlpg[ ]+\(%rax\)[ ]*(#.*)* +[ ]*429:[ ]+41 0f 01 38[ ]+invlpg[ ]+\(%r8\)[ ]*(#.*)* +[ ]*42d:[ ]+0f 01 38[ ]+invlpg[ ]+\(%rax\)[ ]*(#.*)* +[ ]*430:[ ]+41 0f 01 38[ ]+invlpg[ ]+\(%r8\)[ ]*(#.*)* +[ ]*434:[ ]+0f 01 38[ ]+invlpg[ ]+\(%rax\)[ ]*(#.*)* +[ ]*437:[ ]+0f 00 c0[ ]+sldt[ ]+%eax[ ]*(#.*)* +[ ]*43a:[ ]+e6 00[ ]+out[ ]+%al,\$0[x0]*[ ]*(#.*)* +[ ]*43c:[ ]+66 e7 00[ ]+out[ ]+%ax,\$0[x0]*[ ]*(#.*)* +[ ]*43f:[ ]+e7 00[ ]+out[ ]+%eax,\$0[x0]*[ ]*(#.*)* +.*nop.* +.*nop.* +.*nop.* diff -Nur binutils-2.12/gas/testsuite/gas/i386/x86-64-opcode.s binutils-2.12.1/gas/testsuite/gas/i386/x86-64-opcode.s --- binutils-2.12/gas/testsuite/gas/i386/x86-64-opcode.s Wed Dec 31 19:00:00 1969 +++ binutils-2.12.1/gas/testsuite/gas/i386/x86-64-opcode.s Sat Apr 27 08:46:10 2002 @@ -0,0 +1,388 @@ +.text + # Prefixes + # O16 A32 OV REX OPCODE ; NOTES + + # CALL + CALLq *(%r8) # -- -- -- 41 FF 10 ; REX to access upper reg. + CALLq *(%rax) # -- -- -- -- FF 10 + CALLq *(%r8) # -- -- -- 41 FF 10 ; REX to access upper reg. + CALLq *(%rax) # -- -- -- -- FF 10 + + # RET + lret # -- -- -- -- CB + retq # -- -- -- -- C3 + + # IRET + IRET # -- -- -- -- CF ; 32-bit operand size + IRETW # 66 -- -- -- CF ; O16 for 16-bit operand size + IRETQ # -- -- -- 48 CF ; REX for 64-bit operand size + + # CMP + + # MOV + MOVw %cs,(%r8) # 66 -- -- 41 8C 08 ; REX to access upper reg. O16 for 16-bit operand size + MOVw %cs,(%rax) # 66 -- -- -- 8C 08 ; O16 for 16-bit operand size + MOVw %ss,(%r8) # 66 -- -- 41 8C 10 ; REX to access upper reg. O16 for 16-bit operand size + MOVw %ss,(%rax) # 66 -- -- -- 8C 10 ; O16 for 16-bit operand size + MOVw %fs,(%r8) # 66 -- -- 41 8C 20 ; REX to access upper reg. O16 for 16-bit operand size + MOVw %fs,(%rax) # 66 -- -- -- 8C 20 ; O16 for 16-bit operand size + MOVl %cs,(%r8) # -- -- -- 41 8C 08 ; REX to access upper reg. + MOVl %cs,(%rax) # -- -- -- -- 8C 08 + MOVl %ss,(%r8) # -- -- -- 41 8C 10 ; REX to access upper reg. + MOVl %ss,(%rax) # -- -- -- -- 8C 10 + MOVl %fs,(%r8) # -- -- -- 41 8C 20 ; REX to access upper reg. + MOVl %fs,(%rax) # -- -- -- -- 8C 20 + MOVl (%r8),%ss # -- -- -- 41 8E 10 ; REX to access upper reg. + MOVl (%rax),%ss # -- -- -- -- 8E 10 + MOVl (%r8),%fs # -- -- -- 41 8E 20 ; REX to access upper reg. + MOVl (%rax),%fs # -- -- -- -- 8E 20 + MOVb $0,(%r8) # -- -- -- 41 C6 00 00 ; REX to access upper reg. + MOVb $0,(%rax) # -- -- -- -- C6 00 00 + MOVw $0x7000,(%r8) # 66 -- -- 41 C7 00 00 70 ; REX to access upper reg. O16 for 16-bit operand size + MOVw $0x7000,(%rax) # 66 -- -- -- C7 00 00 70 ; O16 for 16-bit operand size + MOVl $0x70000000,(%r8) # -- -- -- 41 C7 00 00 00 00 70 ; REX to access upper reg. + MOVl $0x70000000,(%rax) # -- -- -- -- C7 00 00 00 00 70 + MOVb $0,(%r8) # -- -- -- 41 C6 00 00 ; REX to access upper reg. + MOVb $0,(%rax) # -- -- -- -- C6 00 00 + MOVw $0x7000,(%r8) # 66 -- -- -- 41 C7 00 00 70 ; O16 for 16-bit operand size + MOVw $0x7000,(%rax) # 66 -- -- -- C7 00 00 70 ; O16 for 16-bit operand size + MOVl $0x70000000,(%rax) # -- -- -- -- C7 00 00 00 00 70 + MOVb $0,(%r8) # -- -- -- 41 C6 00 00 ; REX to access upper reg. + MOVb $0,(%rax) # -- -- -- -- C6 00 00 + MOVw $0x7000,(%r8) # 66 -- -- 41 C7 00 00 70 ; REX to access upper reg. O16 for 16-bit operand size + MOVw $0x7000,(%rax) # 66 -- -- -- C7 00 00 70 ; O16 for 16-bit operand size + MOVl $0x70000000,(%r8) # -- -- -- 41 C7 00 00 00 00 70 ; REX to access upper reg. + MOVl $0x70000000,(%rax) # -- -- -- -- C7 00 00 00 00 70 + MOVq $0x70000000,(%r8) # -- -- -- 49 C7 00 00 00 00 70 ; REX for 64-bit operand size. REX to access upper reg. + MOVq $0x70000000,(%rax) # -- -- -- 48 C7 00 00 00 00 70 ; REX for 64-bit operand size + + # MOVNTI + MOVNTI %eax,(%r8) # -- -- -- 41 0f c3 00 ; REX to access upper reg. + MOVNTI %eax,(%rax) # -- -- -- -- 0f c3 00 + MOVNTI %rax,(%r8) # -- -- -- 49 0F C3 00 ; REX to access upper reg. REX for 64-bit operand size + MOVNTI %rax,(%rax) # -- -- -- 48 0F C3 00 ; REX for 64-bit operand size. REX to access upper reg. + MOVNTI %r8,(%r8) # -- -- -- 4D 0F C3 00 ; REX to access upper reg. REX for 64-bit operand size + MOVNTI %r8,(%rax) # -- -- -- 4C 0F C3 00 ; REX to access upper reg. REX for 64-bit operand size + + # Conditionals + + # LOOP + + + # Jcc + # 66 -- -- -- 77 FD ; A16 override: (Addr64) = ZEXT(Addr16) + # 66 -- -- -- 0F 87 F9 FF FF FF ; A16 override: (Addr64) = ZEXT(Addr16) + + # J*CXZ + # 66 67 -- -- E3 FC ; ECX used as counter. A16 override: (Addr64) = ZEXT(Addr16) + # 66 -- -- -- E3 FD ; A16 override: (Addr64) = ZEXT(Addr16) + + + + # Integer + + # IDIV + + IDIVb (%r8) # -- -- -- 41 F6 38 ; Sign extended result. REX to access upper reg. + IDIVb (%rax) # -- -- -- -- F6 38 ; Sign extended result + IDIVw (%r8) # 66 -- -- 41 F7 38 ; Sign extended result. REX to access upper reg. O16 for 16-bit + IDIVw (%rax) # 66 -- -- -- F7 38 ; Sign extended result. O16 for 16-bit operand size + IDIVl (%r8) # -- -- -- 41 F7 38 ; Sign extended result. REX to access upper reg + IDIVl (%rax) # -- -- -- -- F7 38 ; Sign extended result + IDIVq (%r8) # -- -- -- 49 F7 38 ; Sign extended result. REX for 64-bit operand size. REX to access u + IDIVq (%rax) # -- -- -- 48 F7 38 ; Sign extended result. REX for 64-bit operand size + + # IMUL + IMULb (%r8) # -- -- -- 41 F6 28 ; Sign extended result. REX to access upper reg + IMULb (%rax) # -- -- -- -- F6 28 ; Sign extended result + IMULw (%r8) # 66 -- -- 41 F7 28 ; Sign extended result. O16 for 16-bit operand size. REX to access + IMULw (%rax) # 66 -- -- -- F7 28 ; Sign extended result. O16 for 16-bit operand size + IMULl (%r8) # -- -- -- 41 F7 28 ; Sign extended result. REX to access upper reg + IMULl (%rax) # -- -- -- -- F7 28 ; Sign extended result + IMULq (%r8) # -- -- -- 49 F7 28 ; Sign extended result. REX for 64-bit operand size. REX to access u + IMULq (%rax) # -- -- -- 48 F7 28 ; Sign extended result. REX for 64-bit operand size + + + + # SIMD/SSE + + # ADDPD + ADDPD (%r8),%xmm0 # -- -- 66 41 0F 58 00 ; REX to access upper reg. OVR 128bit MMinstr. + ADDPD (%rax),%xmm0 # -- -- 66 -- 0F 58 00 ; OVR 128bit MMinstr. + ADDPD (%r8),%xmm15 # -- -- 66 45 0F 58 38 ; REX to access upper XMM reg. REX to access upper reg. OVR 128bit MMinstr. + ADDPD (%rax),%xmm15 # -- -- 66 44 0F 58 38 ; REX to access upper XMM reg. OVR 128bit MMinstr. + ADDPD (%r8),%xmm8 # -- -- 66 45 0F 58 00 ; REX to access upper XMM reg. REX to access upper reg. OVR 128bit MMinstr. + ADDPD (%rax),%xmm8 # -- -- 66 44 0F 58 00 ; REX to access upper XMM reg. OVR 128bit MMinstr. + ADDPD (%r8),%xmm7 # -- -- 66 41 0F 58 38 ; REX to access upper reg. OVR 128bit MMinstr. + ADDPD (%rax),%xmm7 # -- -- 66 -- 0F 58 38 ; OVR 128bit MMinstr. + ADDPD %xmm0,%xmm0 # -- -- 66 -- 0F 58 C0 ; OVR 128bit MMinstr. + ADDPD %xmm15,%xmm15 # -- -- 66 45 0F 58 FF ; REX to access upper XMM reg. OVR 128bit MMinstr. + ADDPD %xmm15,%xmm8 # -- -- 66 45 0F 58 C7 ; REX to access upper XMM reg. OVR 128bit MMinstr. + + # CMPPD + + # CVTSD2SI + CVTSD2SIq (%r8),%rax # -- -- F2 49 0f 2d 00 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper reg. + CVTSD2SIq (%rax),%rax # -- -- F2 48 0f 2d 00 ; OVR 128-bit media instruction override REX for 64-bit operand size + CVTSD2SIq (%r8),%r8 # -- -- F2 4D 0f 2d 00 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper reg. + CVTSD2SIq (%rax),%r8 # -- -- F2 4C 0f 2d 00 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper reg. + CVTSD2SIq %xmm0,%rax # -- -- F2 48 0f 2d c0 ; OVR 128-bit media instruction override REX for 64-bit operand size + CVTSD2SIq %xmm15,%r8 # -- -- F2 4D 0f 2d c7 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper XMM reg REX to access upper reg. + CVTSD2SIq %xmm15,%rax # -- -- F2 49 0f 2d c7 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper XMM reg + CVTSD2SIq %xmm8,%r8 # -- -- F2 4D 0f 2d c0 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper XMM reg REX to access upper reg. + CVTSD2SIq %xmm8,%rax # -- -- F2 49 0f 2d c0 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper XMM reg + CVTSD2SIq %xmm7,%r8 # -- -- F2 4C 0f 2d c7 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper reg. + CVTSD2SIq %xmm7,%rax # -- -- F2 48 0f 2d c7 ; OVR 128-bit media instruction override REX for 64-bit operand size + CVTSD2SIq %xmm0,%r8 # -- -- F2 4C 0f 2d c0 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper reg. + + # CVTTSD2SI + CVTTSD2SIq (%r8),%rax # -- -- F2 49 0f 2c 00 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper reg. + CVTTSD2SIq (%rax),%rax # -- -- F2 48 0f 2c 00 ; OVR 128-bit media instruction override REX for 64-bit operand size + CVTTSD2SIq (%r8),%r8 # -- -- F2 4D 0f 2c 00 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper reg. + CVTTSD2SIq (%rax),%r8 # -- -- F2 4C 0f 2c 00 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper reg. + CVTTSD2SIq %xmm0,%rax # -- -- F2 48 0f 2c c0 ; OVR 128-bit media instruction override REX for 64-bit operand size + CVTTSD2SIq %xmm15,%r8 # -- -- F2 4D 0f 2c c7 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper XMM reg REX to access upper reg. + CVTTSD2SIq %xmm15,%rax # -- -- F2 49 0f 2c c7 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper XMM reg + CVTTSD2SIq %xmm8,%r8 # -- -- F2 4D 0f 2c c0 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper XMM reg REX to access upper reg. + CVTTSD2SIq %xmm8,%rax # -- -- F2 49 0f 2c c0 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper XMM reg + CVTTSD2SIq %xmm7,%r8 # -- -- F2 4C 0f 2c c7 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper reg. + CVTTSD2SIq %xmm7,%rax # -- -- F2 48 0f 2c c7 ; OVR 128-bit media instruction override REX for 64-bit operand size + CVTTSD2SIq %xmm0,%r8 # -- -- F2 4C 0f 2c c0 ; OVR 128-bit media instruction override REX for 64-bit operand size REX to access upper reg. + + # CVTSS2SI + CVTSS2SIq (%r8),%rax # -- -- F3 49 0f 2d 00 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper reg. + CVTSS2SIq (%rax),%rax # -- -- F3 48 0f 2d 00 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size + CVTSS2SIq (%r8),%r8 # -- -- F3 4D 0f 2d 00 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper reg. + CVTSS2SIq (%rax),%r8 # -- -- F3 4C 0f 2d 00 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper reg. + CVTSS2SIq %xmm0,%rax # -- -- F3 48 0f 2d c0 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size + CVTSS2SIq %xmm15,%r8 # -- -- F3 4D 0f 2d c7 ; OVR 128-bit media instruction override Result is sign extended REX to access upper XMM reg REX to access upper reg. + CVTSS2SIq %xmm15,%rax # -- -- F3 49 0f 2d c7 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper XMM reg + CVTSS2SIq %xmm8,%r8 # -- -- F3 4D 0f 2d c0 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper XMM reg REX to access upper reg. + CVTSS2SIq %xmm8,%rax # -- -- F3 49 0f 2d c0 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size + CVTSS2SIq %xmm7,%r8 # -- -- F3 4C 0f 2d c7 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper reg. + CVTSS2SIq %xmm7,%rax # -- -- F3 48 0f 2d c7 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size + CVTSS2SIq %xmm0,%r8 # -- -- F3 4C 0f 2d c0 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper reg. + + # CVTTSS2SI + CVTTSS2SIq (%r8),%rax # -- -- F3 49 0f 2c 00 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper reg. + CVTTSS2SIq (%rax),%rax # -- -- F3 48 0f 2c 00 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size + CVTTSS2SIq (%r8),%r8 # -- -- F3 4D 0f 2c 00 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper reg. + CVTTSS2SIq (%rax),%r8 # -- -- F3 4C 0f 2c 00 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper reg. + CVTTSS2SIq %xmm0,%rax # -- -- F3 48 0f 2c c0 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size + CVTTSS2SIq %xmm15,%r8 # -- -- F3 4D 0f 2c c7 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper XMM reg REX to access upper reg. + CVTTSS2SIq %xmm15,%rax # -- -- F3 49 0f 2c c7 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper XMM reg + CVTTSS2SIq %xmm8,%r8 # -- -- F3 4D 0f 2c c0 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper XMM reg REX to access upper reg. + CVTTSS2SIq %xmm8,%rax # -- -- F3 49 0f 2c c0 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size + CVTTSS2SIq %xmm7,%r8 # -- -- F3 4C 0f 2c c7 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper reg. + CVTTSS2SIq %xmm7,%rax # -- -- F3 48 0f 2c c7 ; OVR 128-bit media instruction override Result is sign extended + CVTTSS2SIq %xmm0,%r8 # -- -- F3 4C 0f 2c c0 ; OVR 128-bit media instruction override Result is sign extended REX for 64-bit operand size REX to access upper reg. + + # CVTSI2SS + CVTSI2SS (%r8),%xmm0 # -- -- F3 41 0f 2a 00 ; OVR 128-bit media instruction override REX to access upper reg. + CVTSI2SS (%rax),%xmm0 # -- -- F3 -- 0f 2a 00 ; OVR 128-bit media instruction override + CVTSI2SS (%r8),%xmm15 # -- -- F3 45 0f 2a 38 ; OVR 128-bit media instruction override REX to access upper XMM reg REX to access upper reg. + CVTSI2SS (%rax),%xmm15 # -- -- F3 44 0f 2a 38 ; OVR 128-bit media instruction override REX to access upper XMM reg + CVTSI2SS (%r8),%xmm8 # -- -- F3 45 0f 2a 00 ; OVR 128-bit media instruction override REX to access upper XMM reg REX to access upper reg. + CVTSI2SS (%rax),%xmm8 # -- -- F3 44 0f 2a 00 ; OVR 128-bit media instruction override REX to access upper XMM reg + CVTSI2SS (%r8),%xmm7 # -- -- F3 41 0f 2a 38 ; OVR 128-bit media instruction override REX to access upper reg. + CVTSI2SS (%rax),%xmm7 # -- -- F3 -- 0f 2a 38 ; OVR 128-bit media instruction override + CVTSI2SS %eax,%xmm0 # -- -- F3 -- 0f 2a c0 ; OVR 128-bit media instruction override + CVTSI2SS %eax,%xmm15 # -- -- F3 44 0f 2a f8 ; OVR 128-bit media instruction override REX to access upper XMM reg + CVTSI2SS %eax,%xmm8 # -- -- F3 44 0f 2a c0 ; OVR 128-bit media instruction override REX to access upper XMM reg + CVTSI2SS %eax,%xmm7 # -- -- F3 -- 0f 2a f8 ; OVR 128-bit media instruction override + CVTSI2SS (%r8),%xmm0 # -- -- F3 41 0f 2a 00 ; OVR 128-bit media instruction override REX to access upper reg. + CVTSI2SS (%rax),%xmm0 # -- -- F3 -- 0f 2a 00 ; OVR 128-bit media instruction override + CVTSI2SS (%r8),%xmm15 # -- -- F3 45 0f 2a 38 ; OVR 128-bit media instruction override REX to access upper XMM reg REX to access upper reg. + CVTSI2SS (%rax),%xmm15 # -- -- F3 44 0f 2a 38 ; OVR 128-bit media instruction override REX to access upper XMM reg + CVTSI2SS (%r8),%xmm8 # -- -- F3 45 0f 2a 00 ; OVR 128-bit media instruction override REX to access upper XMM reg REX to access upper reg. + CVTSI2SS (%rax),%xmm8 # -- -- F3 44 0f 2a 00 ; OVR 128-bit media instruction override REX to access upper XMM reg + CVTSI2SS (%r8),%xmm7 # -- -- F3 41 0f 2a 38 ; OVR 128-bit media instruction override REX to access upper reg. + CVTSI2SS (%rax),%xmm7 # -- -- F3 -- 0f 2a 38 ; OVR 128-bit media instruction override + + # CVTSI2SD + CVTSI2SD (%r8),%xmm0 # -- -- F2 41 0F 2A 00 ; REX to access upper reg. OVR 128bit MMinstr. + CVTSI2SD (%rax),%xmm0 # -- -- F2 -- 0F 2A 00 ; OVR 128bit MMinstr. + CVTSI2SD (%r8),%xmm15 # -- -- F2 45 0F 2A 38 ; REX to access upper XMM reg. REX to access upper reg. OVR 128bit MMinstr. + CVTSI2SD (%rax),%xmm15 # -- -- F2 44 0F 2A 38 ; REX to access upper XMM reg. OVR 128bit MMinstr. + CVTSI2SD (%r8),%xmm8 # -- -- F2 45 0F 2A 00 ; REX to access upper XMM reg. REX to access upper reg. OVR 128bit MMinstr. + CVTSI2SD (%rax),%xmm8 # -- -- F2 44 0F 2A 00 ; REX to access upper XMM reg. OVR 128bit MMinstr. + CVTSI2SD (%r8),%xmm7 # -- -- F2 41 0F 2A 38 ; REX to access upper reg. OVR 128bit MMinstr. + CVTSI2SD (%rax),%xmm7 # -- -- F2 -- 0F 2A 38 ; OVR 128bit MMinstr. + CVTSI2SD %eax,%xmm0 # -- -- F2 -- 0F 2A C0 ; OVR 128bit MMinstr. + CVTSI2SD %eax,%xmm15 # -- -- F2 44 0F 2A F8 ; REX to access upper XMM reg. OVR 128bit MMinstr. + CVTSI2SD %eax,%xmm8 # -- -- F2 44 0F 2A C0 ; REX to access upper XMM reg. OVR 128bit MMinstr. + CVTSI2SD %eax,%xmm7 # -- -- F2 -- 0F 2A F8 ; OVR 128bit MMinstr. + CVTSI2SD (%r8),%xmm0 # -- -- F2 41 0F 2A 00 ; REX to access upper reg. OVR 128bit MMinstr. + CVTSI2SD (%rax),%xmm0 # -- -- F2 -- 0F 2A 00 ; OVR 128bit MMinstr. +