diff options
author | David Carlton <carlton@bactrian.org> | 2003-12-16 00:01:26 +0000 |
---|---|---|
committer | David Carlton <carlton@bactrian.org> | 2003-12-16 00:01:26 +0000 |
commit | 5f2fbaa631ada809193f3619152ecdcd956cc63d (patch) | |
tree | 2a358a136245d1f01e08e0e00fa0a65f727bd87a | |
parent | a8970facae7aaf63d5815798879c87d3a172344b (diff) | |
download | gdb-5f2fbaa631ada809193f3619152ecdcd956cc63d.zip gdb-5f2fbaa631ada809193f3619152ecdcd956cc63d.tar.gz gdb-5f2fbaa631ada809193f3619152ecdcd956cc63d.tar.bz2 |
2003-12-15 David Carlton <carlton@kealia.com>
* Merge with mainline; tag is carlton_dictionary-20031215-merge.
* cp-support.c (class_name_from_physname): Add DMGL_PARAMS to call
to cplus_demangle.
(method_name_from_physname): Ditto.
423 files changed, 17183 insertions, 13614 deletions
diff --git a/COPYING.NEWLIB b/COPYING.NEWLIB index 08a9b3a..e0eff07 100644 --- a/COPYING.NEWLIB +++ b/COPYING.NEWLIB @@ -644,7 +644,33 @@ to the following restrictions: 4. This notice may not be removed or altered. -(26) Red Hat Incorporated +(26) Mike Barcroft + +Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +(27) Red Hat Incorporated Unless otherwise stated in each remaining newlib file, the remaining files in the newlib subdirectory default to the following copyright. @@ -1,3 +1,18 @@ +2003-12-08 Thomas Fitzsimmons <fitzsim@redhat.com> + + * configure.in (raw_libstdcxx_flags): Remove the leading space. + * configure: Regenerate. + +2003-11-27 Jeff Johnston <jjohnstn@redhat.com> + + * COPYING.NEWLIB: Add license info for long long routines added to + stdlib. + +2003-11-14 Arnaud Charlet <charlet@act-europe.fr> + + * Makefile.tpl (EXTRA_GCC_FLAGS): Pass BOOT_ADAFLAGS. + * Makefile.in: Regenerate. + 2003-10-20 Phil Edwards <phil@codesourcery.com> * configure.in (*-*-vxworks): Add target-libiberty to noconfdirs. diff --git a/Makefile.in b/Makefile.in index fc0fcc9..13d9be0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -522,7 +522,8 @@ EXTRA_GCC_FLAGS = \ "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \ "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s/.*=$$/XFOO=/`" \ "`echo 'STAGE1_CFLAGS=$(STAGE1_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" + "`echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \ + "`echo 'BOOT_ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s/.*=$$/XFOO=/`" GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 2fd5efe..bb4c9ce 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,313 @@ +2003-12-15 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru> + Nick Clifton <nickc@redhat.com> + + * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Ensure that correct flags + are set on known section types. + +2003-12-12 Nick Clifton <nickc@redhat.com> + + * po/ro.po: Updated translation. + +2003-12-12 Alan Modra <amodra@bigpond.net.au> + + * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Check for + NULL dyn_h. + +2003-12-11 Nick Clifton <nickc@redhat.com> + + * elf.c (INCLUDE_SECTION_IN_SEGMENT): Skip PT_GNU_STACK segments. + +2003-12-08 Richard Sandiford <rsandifo@redhat.com> + + * elfxx-mips.h, elfxx-mips.c, cpu-mips.c: Convert prototypes. + Remove casts that were only needed for K&R compatibility. + +2003-12-08 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (struct elf_backend_data): Remove "bfd *" and add + "elflink_hash_entry *" param to elf_backend_link_output_symbol_hook. + Add "elflink_hash_entry *" param to elf_backend_output_arch_syms. + * elflink.h (elf_link_output_sym): Add "elflink_hash_entry *" param, + and pass to output_symbol_hook. + (elf_bfd_final_link): Adjust elf_link_output_sym calls. + (elf_link_output_extsym): Likewise. + (elf_link_input_bfd): Likewise. + * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Adjust. + * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. + * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. + * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. + * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. + * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise. + * elf64-sparc.c (sparc64_elf_output_arch_syms): Likewise. + * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. + Validate dynh->h against h. + * elf64-ppc.c (struct ppc_link_hash_entry): Add adjust_done bitfield. + (link_hash_newfunc): Init it. + (adjust_opd_syms): New function. + (ppc64_elf_edit_opd): Set adjust_done when global .opd sym adjusted. + Set opd.adjust for all .opd relocs. Call adjust_opd_syms. + (ppc64_elf_tls_optimize): Adjust possible .opd sym values here. + (ppc64_elf_relocate_section): Also adjust syms not a multiple of 24. + (ppc64_elf_output_symbol_hook): New function. + (elf_backend_link_output_symbol_hook): Define. + +2003-12-07 Richard Sandiford <rsandifo@redhat.com> + + * elf32-mips.c, elfn32-mips.c, elf64-mips.c: Convert prototypes. + Remove casts that were only needed for K&R compatibility. + +2003-12-05 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru> + + * coff-arm.c (aoutarm_std_reloc_howto [ARM_WINCE]): Set + partial_inplace for these relocs to FALSE for comptability with + the MS linker. + Remap ARM_26D relocation from 5 to 0. This fixes "bad fixup" error + generated by MS linker, and brings the relocation in line the MS + PE documentation. + +2003-12-04 H.J. Lu <hongjiu.lu@intel.com> + + * elf32-ppc.c (ppc_elf_relax_section): Don't check relax_finalizing. + +2003-12-04 H.J. Lu <hongjiu.lu@intel.com> + + * elfxx-ia64.c (elfNN_ia64_relax_section): Use the + need_relax_finalize field in link_info instead of + relax_finalizing to check if the relax finalize pass is being + done. + +2003-12-04 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru> + + * coff-arm.c (coff_arm_relocate_section, bfd_arm_process_before_allocation): + Change ARM26* to ARM_26* in comments to match definitions. + (coff_arm_adjust_symndx): Replace hard-coded constants with + appropriate definitions (ARM_26*). + +2003-12-04 Alan Modra <amodra@bigpond.net.au> + + * coff-i860.c (coff_i860_reloc_nyi): Return bfd_reloc_not_supported. + * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Warning fixes. + (mn10300_elf_relax_section): Likewise. + * nlm32-alpha.c (ONES): Define. + (nlm32_alpha_howto_table): Use it to avoid warnings. + +2003-12-04 Alan Modra <amodra@bigpond.net.au> + + * elf32-i386.c (elf_i386_object_p): Delete. + (elf_backend_object_p): Don't define. + * elf32-s390.c (elf_s390_object_p): No need to alloc tdata here. + * elf32-sh.c (sh_elf_object_p): Likewise. + * elf32-sparc.c (elf32_sparc_object_p): Likewise. + * elf64-alpha.c (elf64_alpha_object_p): Likewise. + * elf64-s390.c (elf_s390_object_p): Likewise. + * elf64-x86-64.c (elf64_x86_64_elf_object_p): Likewise. + +2003-12-03 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + * archures.c (bfd_mach_m32r2): Add new machine type. + * bfd-in2.h: Regenerate. + * cpu-m32r.c : Add new machine type. + * elf32-m32r.c (m32r_elf_object_p, m32r_elf_final_write_processing, + m32r_elf_merge_private_bfd_data): Add support for new machine + type. + +2003-12-03 Dave Airlie <airlied@linux.ie> + + * config.bfd: Add vax-linux-gnu target. + * configure.in: Likewise. + * configure: Regenerate. + +2003-12-03 Alan Modra <amodra@bigpond.net.au> + + * ecoff.c (ecoff_link_add_archive_symbols): Update for renamed + bfd_link_hash_entry field "next" -> "und_next". + * linker.c (_bfd_link_hash_newfunc): Likewise. + (bfd_link_add_undef): Likewise. + (_bfd_generic_link_add_archive_symbols): Likewise. + (_bfd_generic_link_add_one_symbol): Likewise. + * xcofflink.c (xcoff_link_add_symbols): Likewise. + +2003-12-02 Nick Clifton <nickc@redhat.com> + + * configure.in (ALL_LINGUAS): Add ro. + * po/ro.po: New Romanian translation. + +2003-12-02 Alan Modra <amodra@bigpond.net.au> + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + +2003-12-01 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru> + + * coffcode.h (coff_compute_section_file_positions): Set page_size + to 1 instead of 0 in the case file alignment value is zero. + +2003-12-01 Kazu Hirata <kazu@cs.umass.edu> + + * coff-rs6000.c: Remove ARGSUSED and VARARGS. + * coff64-rs6000.c: Likewise. + * coffcode.h: Likewise. + * elf32-vax.c: Likewise. + * hash.c: Likewise. + * hppabsd-core.c: Likewise. + * hpux-core.c: Likewise. + * ihex.c: Likewise. + * netbsd-core.c: Likewise. + * osf-core.c: Likewise. + * pdp11.c: Likewise. + * ptrace-core.c: Likewise. + * sco5-core.c: Likewise. + * section.c: Likewise. + * sunos.c: Likewise. + * trad-core.c: Likewise. + +2003-12-01 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (is_elf_hash_table): Take hash tab rather than info arg. + * elf.c (_bfd_elf_merge_sections): Adjust to suit. + (_bfd_elf_link_just_syms): Likewise. + (bfd_elf_get_needed_list): Likewise. + (bfd_elf_get_runpath_list): Likewise. + (_bfd_elf_link_hash_copy_indirect): Remove unneeded parens. + * elf32-hppa.c (elf32_hppa_setup_section_lists): Don't check hash tab + creator flavour. + (elf32_hppa_set_gp): Look up output sections rather than using htab. + * elf32-i960.c: Comment fix. Formatting. + * elf32-m32r.c (m32r_elf_add_symbol_hook): Use is_elf_hash_table + rather than testing creator flavour. + * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise. + * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise. + * elflink.c (_bfd_elf_link_create_dynamic_sections): Adjust for + is_elf_hash_table change. Remove redundant test. + (bfd_elf_record_link_assignment): Use is_elf_hash_table rather than + testing creator flavour. + (elf_link_record_local_dynamic_symbol): Adjust for is_elf_hash_table. + (_bfd_elf_fix_symbol_flags): Likewise. + (_bfd_elf_adjust_dynamic_symbol): Likewise. + * elflink.h (elf_link_add_object_symbols): Likewise. Remove redundant + checks. Use is_elf_hash_table rather than testing creator flavour. + Use hash_table throughout in place of info->hash. + (elf_add_dynamic_entry): Adjust for is_elf_hash_table change. + (NAME(bfd_elf,size_dynamic_sections)): Likewise. Remove redundant + check. + (elf_bfd_final_link): Adjust for is_elf_hash_table change. + (elf_link_check_versioned_symbol): Use is_elf_hash_table rather than + testing creator flavour. + (elf_gc_sections): Add is_elf_hash_table check. + (elf_gc_common_finalize_got_offsets): Likewise. + (elf_bfd_discard_info): Adjust for is_elf_hash_table change. Remove + redundant check. + * elfxx-ia64.c (elfNN_ia64_relax_section): Use is_elf_hash_table + rather than testing creator flavour. + +2003-11-28 Christian Groessler <chris@groessler.org> + + * cpu-z8k.c: Convert to ISO C90. + * coff-z8k.c: Likewise. + +2003-11-27 Alexandre Oliva <aoliva@redhat.com> + + * elf-bfd.h (elf_backend_data::elf_backend_modify_segment_map): + Add link info argument. + * elf32-i370.c (elf_backend_modify_segment_map): Likewise. + * elf32-ppc.c (ppc_elf_modify_segment_map): Likewise. + * elf32-xtensa.c (elf_xtensa_modify_segment_map): Likewise. + * elf64-hppa.c (elf64_hppa_modify_segment_map): Likewise. + * elfxx-ia64.c (elfNN_ia64_modify_segment_map): Likewise. + * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Likewise. + * elfxx-mips.h (_bfd_mips_elf_modify_segment_map): Likewise. + * elf.c (assign_file_positions_except_relocs, + assign_file_positions_for_segments): Likewise. Adjust calls. + +2003-11-27 Mark Kettenis <kettenis@gnu.org> + + * elf.c (elfcore_grok_netbsd_procinfo): Make a pseudosection out + of the note. + +2003-11-26 Daniel Jacobowitz <drow@mvista.com> + Richard Sandiford <rsandifo@redhat.com> + + * elfxx-mips.c (mips_elf_set_global_got_offset): Don't set no_fn_stub. + (mips_elf_set_no_stub): New function. + (mips_elf_multi_got): Call it. + (_bfd_mips_elf_finish_dynamic_symbol): If a relocation is needed for + a secondary GOT entry, create an R_MIPS_32 or R_MIPS_64 relocation and + use mips_elf_create_dynamic_relocation to deal with any compatibility + issues. Store the adjusted addend in the GOT slot. + +2003-11-25 Mattias Engdegård <mattias@virtutech.se> + + * stabs.c (_bfd_link_section_stabs): Skip N_EXCL stabs when + procesing N_BINCL stabs. + +2003-11-25 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (ppc_type_of_stub): Disallow stubs other than + ppc_stub_plt_call to symbols defined in shared libs. + +2003-11-22 Jakub Jelinek <jakub@redhat.com> + + * elf-bfd.h (ELF_LINK_POINTER_EQUALITY_NEEDED): Define new flag. + * elf.c (_bfd_elf_link_hash_copy_indirect): Copy it. + * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise. + (elf_i386_check_relocs): Set it. + (elf_i386_finish_dynamic_symbol): If it is not set, + clear st_value of SHN_UNDEF symbol. + +2003-11-20 Jim Blandy <jimb@redhat.com> + + * cpu-powerpc.c (powerpc_compatible): Any ISA in the PowerPC + family is a superset of <bfd_arch_rs6000,bfd_mach_rs6k>. + +2003-11-20 Martin Schwidefsky <schwidefsky@de.ibm.com> + + * elf32-s390.c (elf_s390_relocate_section): Don't recalculate symbol + section for reloc output and subtract the output section's address + from the addend when converting a relocation into one against a + section symbol. + * elf64-s390.c (elf_s390_relocate_section): Likewise. + +2003-11-18 James E Wilson <wilson@specifixinc.com> + + * elfxx-ia64.c (get_fptr): For fptr_rel, use dynobj not abfd. + (elfNN_ia64_size_dynamic_sections): When stripping sections, check + for ia64_info->rel_fptr_sec. + +2003-11-18 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (toc_adjusting_stub_needed): Exit early if section + size is zero. + +2003-11-17 Daniel Jacobowitz <drow@mvista.com> + + * elf.c (_bfd_elf_link_hash_copy_indirect): Copy + ELF_LINK_HASH_NEEDS_PLT. Fix formatting. + * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise. + * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise. + * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Likewise. + * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise. + * elf32-sh.c (sh_elf_copy_indirect_symbol): Likewise. + * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise. + * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise. + * elf64-x86-64.c (elf64_x86_64_copy_indirect_symbol): Likewise. + * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise. + * elf32-xtensa.c (elf_xtensa_copy_indirect_symbol): Remove. + (elf_backend_copy_indirect_symbol): Don't define. + +2003-11-14 Daniel Jacobowitz <drow@mvista.com> + + * elfxx-mips.c (mips_elf_merge_gots): Weaken assert for local + GOT entries. + +2003-11-13 Martin Schwidefsky <schwidefsky@de.ibm.com> + + * elf32-s390.c (elf_s390_relocate_section): Only convert R_390_32 + to R_390_RELATIVE. Convert the other relocations against local + symbols to relocations against the start of the section. + * elf64-s390.c (elf_s390_relocate_section): Only convert R_390_64 + to R_390_RELATIVE. Convert the other relocations against local + symbols to relocations against the start of the section. + 2003-11-11 Nick Clifton <nickc@redhat.com> * elf-m10300.c (bfd_mn10300_elf_size_dynamic_sections): Use @@ -3030,7 +3340,7 @@ 2003-05-04 H.J. Lu <hjl@gnu.org> - * elflink.h (elf_merge_symbol): Correctly handle weak definiton. + * elflink.h (elf_merge_symbol): Correctly handle weak definition. 2003-05-04 H.J. Lu <hjl@gnu.org> @@ -8334,7 +8644,7 @@ * config.bfd: Added DLX configuraton. * Makefile.am: Added DLX configuraton. * configure.in: Added DLX configuraton. - * archures.c: Add DLX architecure. + * archures.c: Add DLX architecture. * reloc.c: Add DLX relocs. * targets.c: Added DLX target vector. * configure: Regenerate. diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 216b399..3a2d43e 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -1616,11 +1616,13 @@ cisco-core.lo: cisco-core.c $(INCDIR)/filenames.h elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \ + elf32-target.h elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/reloc-macros.h elf64-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \ + elf64-target.h peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \ libcoff.h $(INCDIR)/bfdlink.h libpei.h diff --git a/bfd/Makefile.in b/bfd/Makefile.in index f85a6fe..b3bf65b 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -812,7 +812,7 @@ configure.in version.h DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS) @@ -2151,11 +2151,13 @@ cisco-core.lo: cisco-core.c $(INCDIR)/filenames.h elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \ + elf32-target.h elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/reloc-macros.h elf64-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \ + elf64-target.h peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \ libcoff.h $(INCDIR)/bfdlink.h libpei.h diff --git a/bfd/aix5ppc-core.c b/bfd/aix5ppc-core.c index b0a9c5e..0351076 100644 --- a/bfd/aix5ppc-core.c +++ b/bfd/aix5ppc-core.c @@ -102,7 +102,7 @@ xcoff64_core_p (abfd) || (! (core.c_flag & LE_VALID))) goto xcoff64_core_p_error; - /* Check for trucated stack or general truncating. */ + /* Check for truncated stack or general truncating. */ if ((! (core.c_flag & USTACK_VALID)) || (core.c_flag & CORE_TRUNC)) { diff --git a/bfd/aout-arm.c b/bfd/aout-arm.c index 34a235a..38ecfab9 100644 --- a/bfd/aout-arm.c +++ b/bfd/aout-arm.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" -/* Avoid multiple defininitions from aoutx if supporting standarad a.out +/* Avoid multiple definitions from aoutx if supporting standard a.out as well as our own. */ /* Do not "beautify" the CONCAT* macro args. Traditional C will not remove whitespace added here, and thus will fail to concatenate diff --git a/bfd/aout-ns32k.c b/bfd/aout-ns32k.c index 8092705..1ac8d71 100644 --- a/bfd/aout-ns32k.c +++ b/bfd/aout-ns32k.c @@ -70,7 +70,7 @@ MY(put_reloc) PARAMS ((bfd *, int, int, bfd_vma, reloc_howto_type *, data. Of these, only the last fits into the standard relocation scheme. Immediate operands are stored huffman encoded and immediate operands are stored big endian (where as the natural byte - order is little endian for this achitecture). + order is little endian for this architecture). Note that the ns32k displacement storage method is orthogonal to whether the relocation is pc relative or not. The "displacement" diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 6c20bd0..3282f87 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -3254,7 +3254,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded) and this object file from the archive includes: int a = 5; In such a case, whether to include this object is target - dependant for backward compatability. + dependant for backward compatibility. FIXME: The SunOS 4.1.3 linker will pull in the archive element if the symbol is defined in the .data section, diff --git a/bfd/archures.c b/bfd/archures.c index 064fa55..f8aeeef 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -272,6 +272,7 @@ DESCRIPTION . bfd_arch_m32r, {* Renesas M32R (formerly Mitsubishi M32R/D) *} .#define bfd_mach_m32r 1 {* For backwards compatibility. *} .#define bfd_mach_m32rx 'x' +.#define bfd_mach_m32r2 '2' . bfd_arch_mn10200, {* Matsushita MN10200 *} . bfd_arch_mn10300, {* Matsushita MN10300 *} .#define bfd_mach_mn10300 300 @@ -865,7 +866,7 @@ bfd_default_scan (const bfd_arch_info_type *info, const char *string) } /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>; Do not - attempt to match just <mach>, it could be ambigious. This test + attempt to match just <mach>, it could be ambiguous. This test is left until later. */ /* NOTE: The below is retained for compatibility only. Please do @@ -1046,7 +1047,7 @@ SYNOPSIS (enum bfd_architecture arch, unsigned long machine); DESCRIPTION - Look for the architecure info structure which matches the + Look for the architecture info structure which matches the arguments @var{arch} and @var{machine}. A machine of 0 matches the machine/architecture structure which marks itself as the default. diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 1a67d08..ccfef1e 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -185,7 +185,7 @@ typedef unsigned char bfd_byte; typedef enum bfd_format { bfd_unknown = 0, /* File format is unknown. */ - bfd_object, /* Linker/assember/compiler output. */ + bfd_object, /* Linker/assembler/compiler output. */ bfd_archive, /* Object archive file. */ bfd_core, /* Core dump. */ bfd_type_end /* Marks the end; don't use it! */ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 5c17a7a..2afcf7f 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -192,7 +192,7 @@ typedef unsigned char bfd_byte; typedef enum bfd_format { bfd_unknown = 0, /* File format is unknown. */ - bfd_object, /* Linker/assember/compiler output. */ + bfd_object, /* Linker/assembler/compiler output. */ bfd_archive, /* Object archive file. */ bfd_core, /* Core dump. */ bfd_type_end /* Marks the end; don't use it! */ @@ -1710,6 +1710,7 @@ enum bfd_architecture bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */ #define bfd_mach_m32r 1 /* For backwards compatibility. */ #define bfd_mach_m32rx 'x' +#define bfd_mach_m32r2 '2' bfd_arch_mn10200, /* Matsushita MN10200 */ bfd_arch_mn10300, /* Matsushita MN10300 */ #define bfd_mach_mn10300 300 @@ -1932,7 +1933,7 @@ struct reloc_howto_struct /* If this field is non null, then the supplied function is called rather than the normal function. This allows really - strange relocation methods to be accomodated (e.g., i960 callj + strange relocation methods to be accommodated (e.g., i960 callj instructions). */ bfd_reloc_status_type (*special_function) (bfd *, arelent *, struct bfd_symbol *, void *, asection *, @@ -2551,7 +2552,7 @@ in the instruction. */ /* IBM 370/390 relocations */ BFD_RELOC_I370_D12, -/* The type of reloc used to build a contructor table - at the moment +/* The type of reloc used to build a constructor table - at the moment probably a 32 bit wide absolute relocation, but the target can choose. It generally does map to one of the other relocation types. */ BFD_RELOC_CTOR, @@ -2848,11 +2849,11 @@ data area pointer. */ BFD_RELOC_V850_TDA_4_4_OFFSET, /* This is a 16 bit offset from the short data area pointer, with the -bits placed non-contigously in the instruction. */ +bits placed non-contiguously in the instruction. */ BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET, /* This is a 16 bit offset from the zero data area pointer, with the -bits placed non-contigously in the instruction. */ +bits placed non-contiguously in the instruction. */ BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET, /* This is a 6 bit offset from the call table base pointer. */ @@ -3209,7 +3210,7 @@ that are not used, so that the code for those functions need not be included in the output. VTABLE_INHERIT is a zero-space relocation used to describe to the -linker the inheritence tree of a C++ virtual function table. The +linker the inheritance tree of a C++ virtual function table. The relocation's symbol should be the parent class' vtable, and the relocation should be located at the child vtable. @@ -3318,7 +3319,7 @@ This is the 3 bit of a value. */ /* Motorola 68HC11 reloc. This reloc marks the beginning of a jump/call instruction. It is used for linker relaxation to correctly identify beginning -of instruction and change some branchs to use PC-relative +of instruction and change some branches to use PC-relative addressing mode. */ BFD_RELOC_M68HC11_RL_JUMP, @@ -3530,7 +3531,7 @@ typedef struct bfd_symbol <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or <<BSF_GLOBAL>>. */ - /* The symbol is a debugging record. The value has an arbitary + /* The symbol is a debugging record. The value has an arbitrary meaning, unless BSF_DEBUGGING_RELOC is also set. */ #define BSF_DEBUGGING 0x08 @@ -396,7 +396,7 @@ SUBSECTION Some BFD functions want to print messages describing the problem. They call a BFD error handler function. This - function may be overriden by the program. + function may be overridden by the program. The BFD error handler acts like printf. diff --git a/bfd/bfdio.c b/bfd/bfdio.c index f99fddd..b196a52 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -395,7 +395,7 @@ DESCRIPTION error when it tries to read the table, or a "virtual memory exhausted" error when it tries to allocate 15 bazillon bytes of space for the 15 bazillon byte table it is about to read. - This function at least allows us to answer the quesion, "is the + This function at least allows us to answer the question, "is the size reasonable?". */ diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index 3655a30..9b26123 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -4,21 +4,21 @@ Free Software Foundation, Inc. Written by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -252,11 +252,11 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, #undef ARM_THUMB12 #undef ARM_26D +#define ARM_26D 0 #define ARM_32 1 #define ARM_RVA32 2 #define ARM_26 3 #define ARM_THUMB12 4 -#define ARM_26D 5 #define ARM_SECTION 14 #define ARM_SECREL 15 #endif @@ -264,7 +264,19 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, static reloc_howto_type aoutarm_std_reloc_howto[] = { #ifdef ARM_WINCE - EMPTY_HOWTO (-1), + HOWTO (ARM_26D, + 2, + 2, + 24, + FALSE, + 0, + complain_overflow_dont, + aoutarm_fix_pcrel_26_done, + "ARM_26D", + FALSE, + 0x00ffffff, + 0x0, + FALSE), HOWTO (ARM_32, 0, 2, @@ -274,7 +286,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = complain_overflow_bitfield, coff_arm_reloc, "ARM_32", - TRUE, + FALSE, 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -287,7 +299,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = complain_overflow_bitfield, coff_arm_reloc, "ARM_RVA32", - TRUE, + FALSE, 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -317,19 +329,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = 0x000007ff, 0x000007ff, PCRELOFFSET), - HOWTO (ARM_26D, - 2, - 2, - 24, - FALSE, - 0, - complain_overflow_dont, - aoutarm_fix_pcrel_26_done, - "ARM_26D", - TRUE, - 0x00ffffff, - 0x0, - FALSE), + EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), @@ -346,8 +346,8 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = 0, complain_overflow_bitfield, coff_arm_reloc, - "ARM_16", - TRUE, + "ARM_SECTION", + FALSE, 0x0000ffff, 0x0000ffff, PCRELOFFSET), @@ -359,8 +359,8 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = 0, complain_overflow_bitfield, coff_arm_reloc, - "ARM_32", - TRUE, + "ARM_SECREL", + FALSE, 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -921,13 +921,13 @@ struct coff_arm_link_hash_table /* The original coff_link_hash_table structure. MUST be first field. */ struct coff_link_hash_table root; - /* The size in bytes of the section containg the Thumb-to-ARM glue. */ + /* The size in bytes of the section containing the Thumb-to-ARM glue. */ bfd_size_type thumb_glue_size; - /* The size in bytes of the section containg the ARM-to-Thumb glue. */ + /* The size in bytes of the section containing the ARM-to-Thumb glue. */ bfd_size_type arm_glue_size; - /* An arbitary input BFD chosen to hold the glue sections. */ + /* An arbitrary input BFD chosen to hold the glue sections. */ bfd * bfd_of_glue_owner; /* Support interworking with old, non-interworking aware ARM code. */ @@ -991,7 +991,7 @@ arm_emit_base_file_entry (info, output_bfd, input_section, reloc_offset) instruction. It takes two thumb instructions to encode the target address. Each has - 11 bits to invest. The upper 11 bits are stored in one (identifed by + 11 bits to invest. The upper 11 bits are stored in one (identified by H-0.. see below), the lower 11 bits are stored in the other (identified by H-1). @@ -1248,7 +1248,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, /* The relocation_section function will skip pcrel_offset relocs when doing a relocatable link. However, we want to convert - ARM26 to ARM26D relocs if possible. We return a fake howto in + ARM_26 to ARM_26D relocs if possible. We return a fake howto in this case without pcrel_offset set, and adjust the addend to compensate. */ if (rel->r_type == ARM_26 @@ -1299,7 +1299,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, /* FIXME - it is not clear which targets need this next test and which do not. It is known that it is needed for the VxWorks and EPOC-PE targets, but it is also known that it - was supressed for other ARM targets. This ought to be + was suppressed for other ARM targets. This ought to be sorted out one day. */ #ifdef ARM_COFF_BUGFIX /* We must not ignore the symbol value. If the symbol is @@ -2198,8 +2198,8 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code) #define coff_bfd_copy_private_bfd_data coff_arm_copy_private_bfd_data #define coff_bfd_link_hash_table_create coff_arm_link_hash_table_create -/* When doing a relocatable link, we want to convert ARM26 relocs - into ARM26D relocs. */ +/* When doing a relocatable link, we want to convert ARM_26 relocs + into ARM_26D relocs. */ static bfd_boolean coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) @@ -2210,7 +2210,7 @@ coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) struct internal_reloc *irel; bfd_boolean *adjustedp; { - if (irel->r_type == 3) + if (irel->r_type == ARM_26) { struct coff_link_hash_entry *h; @@ -2219,7 +2219,7 @@ coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) && (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && h->root.u.def.section->output_section == sec->output_section) - irel->r_type = 7; + irel->r_type = ARM_26D; } *adjustedp = FALSE; return TRUE; @@ -2228,7 +2228,7 @@ coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) /* Called when merging the private data areas of two BFDs. This is important as it allows us to detect if we are attempting to merge binaries compiled for different ARM - targets, eg different CPUs or differents APCS's. */ + targets, eg different CPUs or different APCS's. */ static bfd_boolean coff_arm_merge_private_bfd_data (ibfd, obfd) @@ -2361,7 +2361,7 @@ coff_arm_print_private_bfd_data (abfd, ptr) if (APCS_SET (abfd)) { - /* xgettext: APCS is ARM Prodecure Call Standard, it should not be translated. */ + /* xgettext: APCS is ARM Procedure Call Standard, it should not be translated. */ fprintf (file, " [APCS-%d]", APCS_26_FLAG (abfd) ? 26 : 32); if (APCS_FLOAT_FLAG (abfd)) diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index 5cb327a..e9d1964 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -775,7 +775,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, src_address += 4; break; - /* A 16bit abolute relocation that was formerlly a 24/32bit + /* A 16bit absolute relocation that was formerly a 24/32bit absolute relocation. */ case R_MOVL2: value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); diff --git a/bfd/coff-i860.c b/bfd/coff-i860.c index 74b599c..edc9f4e 100644 --- a/bfd/coff-i860.c +++ b/bfd/coff-i860.c @@ -140,6 +140,7 @@ coff_i860_reloc_nyi (bfd *abfd ATTRIBUTE_UNUSED, { reloc_howto_type *howto = reloc_entry->howto; fprintf (stderr, _("Relocation `%s' not yet implemented\n"), howto->name); + return bfd_reloc_notsupported; } #ifndef PCRELOFFSET @@ -524,7 +525,7 @@ coff_i860_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, BFD_ASSERT (h != NULL); /* I think we *do* want to bypass this. If we don't, I have seen some data - parameters get the wrong relcation address. If I link two versions + parameters get the wrong relocation address. If I link two versions with and without this section bypassed and then do a binary comparison, the addresses which are different can be looked up in the map. The case in which this section has been bypassed has addresses which correspond diff --git a/bfd/coff-m88k.c b/bfd/coff-m88k.c index a8b2c55..bef0eab 100644 --- a/bfd/coff-m88k.c +++ b/bfd/coff-m88k.c @@ -1,4 +1,4 @@ -/* BFD back-end for Motorola 88000 COFF "Binary Compatability Standard" files. +/* BFD back-end for Motorola 88000 COFF "Binary Compatibility Standard" files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @@ -85,7 +85,7 @@ m88k_special_reloc (abfd, reloc_entry, symbol, data, asection *reloc_target_output_section; long relocation = 0; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c index c4b0735..25569e3 100644 --- a/bfd/coff-mcore.c +++ b/bfd/coff-mcore.c @@ -587,7 +587,7 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section, #include "coffcode.h" -/* Forward declaration to initialise alterbative_target field. */ +/* Forward declaration to initialise alternative_target field. */ extern const bfd_target TARGET_LITTLE_SYM; /* The transfer vectors that lead the outside world to all of the above. */ diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c index cf54942..c1c2c32 100644 --- a/bfd/coff-ppc.c +++ b/bfd/coff-ppc.c @@ -929,7 +929,7 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind) local_syms[sym] = global_toc_size; global_toc_size += 4; - /* The size must fit in a 16bit displacment. */ + /* The size must fit in a 16-bit displacement. */ if (global_toc_size > 65535) { (*_bfd_error_handler) (_("TOC overflow")); @@ -949,7 +949,7 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind) h->toc_offset = global_toc_size; global_toc_size += 4; - /* The size must fit in a 16bit displacment. */ + /* The size must fit in a 16-bit displacement. */ if (global_toc_size >= 65535) { (*_bfd_error_handler) (_("TOC overflow")); @@ -1274,7 +1274,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, our_toc_offset = val - (toc_section->output_section->vma + toc_section->output_offset); - /* The size must still fit in a 16bit displacment. */ + /* The size must still fit in a 16-bit displacement. */ if ((bfd_vma) our_toc_offset >= 65535) { (*_bfd_error_handler) @@ -1931,7 +1931,7 @@ ppc_imglue_reloc (abfd, reloc_entry, symbol, data, #define MAX_RELOC_INDEX \ (sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]) - 1) -/* FIXME: There is a possiblity that when we read in a reloc from a file, +/* FIXME: There is a possibility that when we read in a reloc from a file, that there are some bits encoded in the upper portion of the type field. Not yet implemented. */ static void ppc_coff_rtype2howto PARAMS ((arelent *, struct internal_reloc *)); diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 0b73bd5..56e34e2 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -1006,7 +1006,7 @@ xcoff_rtype2howto (relent, internal) /* Default howto layout works most of the time */ relent->howto = &xcoff_howto_table[internal->r_type]; - /* Special case some 16 bit reoloc */ + /* Special case some 16 bit reloc */ if (15 == (internal->r_size & 0x1f)) { if (R_BA == internal->r_type) @@ -1575,7 +1575,6 @@ normalize_filename (abfd) /* Write out an XCOFF armap. */ -/*ARGSUSED*/ static bfd_boolean xcoff_write_armap_old (abfd, elength, map, orl_count, stridx) bfd *abfd; diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c index 15c7f9d..cf4da77 100644 --- a/bfd/coff-z8k.c +++ b/bfd/coff-z8k.c @@ -28,11 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "coff/internal.h" #include "libcoff.h" -static void extra_case PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, bfd_byte *, unsigned int *, unsigned int *)); -static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); -static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); -static int coff_z8k_select_reloc PARAMS ((reloc_howto_type *)); - #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) static reloc_howto_type r_imm32 = @@ -74,8 +69,7 @@ HOWTO (R_CALLR, 0, 1, 12, TRUE, 0, complain_overflow_signed, 0, /* Turn a howto into a reloc number */ static int -coff_z8k_select_reloc (howto) - reloc_howto_type *howto; +coff_z8k_select_reloc (reloc_howto_type *howto) { return howto->type; } @@ -96,9 +90,7 @@ coff_z8k_select_reloc (howto) /* Code to turn a r_type into a howto ptr, uses the above howto table. */ static void -rtype2howto (internal, dst) - arelent * internal; - struct internal_reloc *dst; +rtype2howto (arelent *internal, struct internal_reloc *dst) { switch (dst->r_type) { @@ -143,12 +135,11 @@ rtype2howto (internal, dst) reloc_processing(relent, reloc, symbols, abfd, section) static void -reloc_processing (relent, reloc, symbols, abfd, section) - arelent * relent; - struct internal_reloc * reloc; - asymbol ** symbols; - bfd * abfd; - asection * section; +reloc_processing (arelent *relent, + struct internal_reloc *reloc, + asymbol **symbols, + bfd *abfd, + asection *section) { relent->address = reloc->r_vaddr; rtype2howto (relent, reloc); @@ -163,14 +154,13 @@ reloc_processing (relent, reloc, symbols, abfd, section) } static void -extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) - bfd * in_abfd; - struct bfd_link_info * link_info; - struct bfd_link_order * link_order; - arelent * reloc; - bfd_byte * data; - unsigned int * src_ptr; - unsigned int * dst_ptr; +extra_case (bfd *in_abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + arelent *reloc, + bfd_byte *data, + unsigned int *src_ptr, + unsigned int *dst_ptr) { asection * input_section = link_order->u.indirect.section; @@ -197,7 +187,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) { bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info, input_section); - /* Adresses are 23 bit, and the layout of those in a 32-bit + /* Addresses are 23 bit, and the layout of those in a 32-bit value is as follows: 1AAAAAAA xxxxxxxx AAAAAAAA AAAAAAAA (A - address bits, x - ignore). */ diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index 895f96b..ec9c695 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -1791,7 +1791,7 @@ xcoff64_rtype2howto (relent, internal) /* Default howto layout works most of the time */ relent->howto = &xcoff64_howto_table[internal->r_type]; - /* Special case some 16 bit reoloc */ + /* Special case some 16 bit reloc */ if (15 == (internal->r_size & 0x3f)) { if (R_BA == internal->r_type) @@ -2054,7 +2054,6 @@ xcoff64_openr_next_archived_file (archive, last_file) /* We can't use the usual coff_sizeof_headers routine, because AIX always uses an a.out header. */ -/*ARGSUSED*/ static int xcoff64_sizeof_headers (abfd, reloc) bfd *abfd; diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 924bb34..ccac05b 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1572,7 +1572,7 @@ coff_new_section_hook (abfd, section) return FALSE; /* We don't need to set up n_name, n_value, or n_scnum in the native - symbol information, since they'll be overriden by the BFD symbol + symbol information, since they'll be overridden by the BFD symbol anyhow. However, we do need to set the type and storage class, in case this symbol winds up getting written out. The value 0 for n_numaux is already correct. */ @@ -3014,6 +3014,11 @@ coff_compute_section_file_positions (abfd) if (coff_data (abfd)->link_info) { page_size = pe_data (abfd)->pe_opthdr.FileAlignment; + + /* If no file alignment has been set, default to one. + This repairs 'ld -r' for arm-wince-pe target. */ + if (page_size == 0) + page_size = 1; } else page_size = PE_DEF_FILE_ALIGNMENT; @@ -4681,7 +4686,7 @@ coff_slurp_symbol_table (abfd) #endif case C_REGPARM: /* Register parameter. */ case C_REG: /* register variable. */ - /* C_AUTOARG conflictes with TI COFF C_UEXT. */ + /* C_AUTOARG conflicts with TI COFF C_UEXT. */ #if !defined (TIC80COFF) && !defined (TICOFF) #ifdef C_AUTOARG case C_AUTOARG: /* 960-specific storage class. */ @@ -5122,7 +5127,6 @@ static reloc_howto_type *coff_rtype_to_howto struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *)); -/*ARGSUSED*/ static reloc_howto_type * coff_rtype_to_howto (abfd, sec, rel, h, sym, addendp) bfd *abfd ATTRIBUTE_UNUSED; diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 91a3822..4ad566c 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -2565,7 +2565,7 @@ _bfd_coff_write_global_sym (struct coff_link_hash_entry *h, void *data) isym.n_sclass = C_STAT; } - /* When a weak symbol is not overriden by a strong one, + /* When a weak symbol is not overridden by a strong one, turn it into an external symbol when not building a shared or relocatable object. */ if (! finfo->info->shared diff --git a/bfd/config.bfd b/bfd/config.bfd index 9f51538..c1ca87e 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -884,13 +884,27 @@ case "${targ}" in targ_selvecs="bfd_elf32_pjl_vec bfd_elf32_pj_vec bfd_elf32_i386_vec" ;; + powerpc-*-aix5.[01]) + targ_defvec=rs6000coff_vec + targ_selvecs="aix5coff64_vec" + want64=true + ;; +#ifdef BFD64 + powerpc64-*-aix5.[01]) + targ_defvec=aix5coff64_vec + targ_selvecs="rs6000coff_vec" + want64=true + ;; +#endif powerpc-*-aix5*) + targ_cflags=-DAIX_WEAK_SUPPORT targ_defvec=rs6000coff_vec targ_selvecs="aix5coff64_vec" want64=true ;; #ifdef BFD64 powerpc64-*-aix5*) + targ_cflags=-DAIX_WEAK_SUPPORT targ_defvec=aix5coff64_vec targ_selvecs="rs6000coff_vec" want64=true @@ -903,7 +917,6 @@ case "${targ}" in case "${targ}" in *-*-aix4.[3456789]* | *-*-aix[56789]*) want64=true;; - *) targ_cflags=-DSMALL_ARCHIVE;; esac @@ -1229,6 +1242,10 @@ case "${targ}" in targ_underscore=yes ;; + vax-*-linux-gnu*) + targ_defvec=bfd_elf32_vax_vec + ;; + vax*-*-*vms*) targ_defvec=vms_vax_vec ;; diff --git a/bfd/configure b/bfd/configure index 34d9bc5..42345bb 100755 --- a/bfd/configure +++ b/bfd/configure @@ -2708,7 +2708,7 @@ else fi -ALL_LINGUAS="fr tr ja es sv da zh_CN" +ALL_LINGUAS="fr tr ja es sv da zh_CN ro" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo "configure:2714: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. @@ -5487,6 +5487,10 @@ rm -f conftest* COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxult2.h"' ;; + vax-*-linux-gnu*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/vaxlinux.h"' + ;; vax-*-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxbsd.h"' @@ -5514,17 +5518,17 @@ rm -f conftest* do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5518: checking for $ac_hdr" >&5 +echo "configure:5522: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5523 "configure" +#line 5527 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5528: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5532: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5552,12 +5556,12 @@ done if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5556: checking for prstatus_t in sys/procfs.h" >&5 +echo "configure:5560: checking for prstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5561 "configure" +#line 5565 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5566,7 +5570,7 @@ int main() { prstatus_t avar ; return 0; } EOF -if { (eval echo configure:5570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5574: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus_t=yes else @@ -5588,12 +5592,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6 echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5592: checking for prstatus32_t in sys/procfs.h" >&5 +echo "configure:5596: checking for prstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5597 "configure" +#line 5601 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5602,7 +5606,7 @@ int main() { prstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5606: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5610: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus32_t=yes else @@ -5624,12 +5628,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6 echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5628: checking for prstatus_t.pr_who in sys/procfs.h" >&5 +echo "configure:5632: checking for prstatus_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5633 "configure" +#line 5637 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5638,7 +5642,7 @@ int main() { prstatus_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5646: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes else @@ -5660,12 +5664,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6 echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5664: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 +echo "configure:5668: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5669 "configure" +#line 5673 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5674,7 +5678,7 @@ int main() { prstatus32_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5678: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5682: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes else @@ -5696,12 +5700,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6 echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5700: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:5704: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5705 "configure" +#line 5709 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5710,7 +5714,7 @@ int main() { pstatus_t avar ; return 0; } EOF -if { (eval echo configure:5714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5718: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5732,12 +5736,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5736: checking for pxstatus_t in sys/procfs.h" >&5 +echo "configure:5740: checking for pxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5741 "configure" +#line 5745 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5746,7 +5750,7 @@ int main() { pxstatus_t avar ; return 0; } EOF -if { (eval echo configure:5750: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5754: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pxstatus_t=yes else @@ -5768,12 +5772,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6 echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5772: checking for pstatus32_t in sys/procfs.h" >&5 +echo "configure:5776: checking for pstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5777 "configure" +#line 5781 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5782,7 +5786,7 @@ int main() { pstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5790: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus32_t=yes else @@ -5804,12 +5808,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6 echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5808: checking for prpsinfo_t in sys/procfs.h" >&5 +echo "configure:5812: checking for prpsinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5813 "configure" +#line 5817 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5818,7 +5822,7 @@ int main() { prpsinfo_t avar ; return 0; } EOF -if { (eval echo configure:5822: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5826: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo_t=yes else @@ -5840,12 +5844,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6 echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5844: checking for prpsinfo32_t in sys/procfs.h" >&5 +echo "configure:5848: checking for prpsinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5849 "configure" +#line 5853 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5854,7 +5858,7 @@ int main() { prpsinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5858: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes else @@ -5876,12 +5880,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6 echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5880: checking for psinfo_t in sys/procfs.h" >&5 +echo "configure:5884: checking for psinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5885 "configure" +#line 5889 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5890,7 +5894,7 @@ int main() { psinfo_t avar ; return 0; } EOF -if { (eval echo configure:5894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5898: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo_t=yes else @@ -5912,12 +5916,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6 echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5916: checking for psinfo32_t in sys/procfs.h" >&5 +echo "configure:5920: checking for psinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5921 "configure" +#line 5925 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5926,7 +5930,7 @@ int main() { psinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5930: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo32_t=yes else @@ -5948,12 +5952,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6 echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5952: checking for lwpstatus_t in sys/procfs.h" >&5 +echo "configure:5956: checking for lwpstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5957 "configure" +#line 5961 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5962,7 +5966,7 @@ int main() { lwpstatus_t avar ; return 0; } EOF -if { (eval echo configure:5966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpstatus_t=yes else @@ -5984,12 +5988,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6 echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5988: checking for lwpxstatus_t in sys/procfs.h" >&5 +echo "configure:5992: checking for lwpxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5993 "configure" +#line 5997 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5998,7 +6002,7 @@ int main() { lwpxstatus_t avar ; return 0; } EOF -if { (eval echo configure:6002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes else @@ -6020,12 +6024,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:6024: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 +echo "configure:6028: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6029 "configure" +#line 6033 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -6034,7 +6038,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_context ; return 0; } EOF -if { (eval echo configure:6038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6042: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes else @@ -6056,12 +6060,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:6060: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 +echo "configure:6064: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6065 "configure" +#line 6069 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -6070,7 +6074,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_reg ; return 0; } EOF -if { (eval echo configure:6074: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6078: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes else @@ -6092,12 +6096,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6 echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:6096: checking for win32_pstatus_t in sys/procfs.h" >&5 +echo "configure:6100: checking for win32_pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6101 "configure" +#line 6105 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -6106,7 +6110,7 @@ int main() { win32_pstatus_t avar ; return 0; } EOF -if { (eval echo configure:6110: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes else @@ -6575,10 +6579,10 @@ case ${host64}-${target64}-${want64} in if test -n "$GCC" ; then bad_64bit_gcc=no; echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6 -echo "configure:6579: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6583: checking for gcc version with buggy 64-bit support" >&5 # Add more tests for gcc versions with non-working 64-bit support here. cat > conftest.$ac_ext <<EOF -#line 6582 "configure" +#line 6586 "configure" #include "confdefs.h" :__GNUC__:__GNUC_MINOR__:__i386__: EOF @@ -6624,17 +6628,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6628: checking for $ac_hdr" >&5 +echo "configure:6632: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6633 "configure" +#line 6637 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6638: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6642: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6663,12 +6667,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6667: checking for $ac_func" >&5 +echo "configure:6671: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6672 "configure" +#line 6676 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6691,7 +6695,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6716,7 +6720,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6720: checking for working mmap" >&5 +echo "configure:6724: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6724,7 +6728,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 6728 "configure" +#line 6732 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6864,7 +6868,7 @@ main() } EOF -if { (eval echo configure:6868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -6889,12 +6893,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6893: checking for $ac_func" >&5 +echo "configure:6897: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6898 "configure" +#line 6902 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6917,7 +6921,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/bfd/configure.in b/bfd/configure.in index 35ba4e2..72c32bd 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -103,7 +103,7 @@ bfd_default_target_size=32 AC_PROG_CC -ALL_LINGUAS="fr tr ja es sv da zh_CN" +ALL_LINGUAS="fr tr ja es sv da zh_CN ro" CY_GNU_GETTEXT # Permit host specific settings. @@ -397,6 +397,10 @@ changequote([,])dnl COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxult2.h"' ;; + vax-*-linux-gnu*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/vaxlinux.h"' + ;; vax-*-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxbsd.h"' diff --git a/bfd/cpu-alpha.c b/bfd/cpu-alpha.c index 7b1dde9..c593fc3 100644 --- a/bfd/cpu-alpha.c +++ b/bfd/cpu-alpha.c @@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define NN(index) (&arch_info_struct[index]) -/* These exist only so that we can resonably disassemble PALcode. */ +/* These exist only so that we can reasonably disassemble PALcode. */ static const bfd_arch_info_type arch_info_struct[] = { N (64, 64, bfd_mach_alpha_ev4, "alpha:ev4", FALSE, NN(1)), diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c index 9ef527c..17889f3 100644 --- a/bfd/cpu-arm.c +++ b/bfd/cpu-arm.c @@ -155,7 +155,7 @@ const bfd_arch_info_type bfd_arm_arch = /* Support functions used by both the COFF and ELF versions of the ARM port. */ -/* Handle the mergeing of the 'machine' settings of input file IBFD +/* Handle the merging of the 'machine' settings of input file IBFD and an output file OBFD. These values actually represent the different possible ARM architecture variants. Returns TRUE if they were merged successfully or FALSE otherwise. */ @@ -172,7 +172,7 @@ bfd_arm_merge_machines (ibfd, obfd) if (out == bfd_mach_arm_unknown) bfd_set_arch_mach (obfd, bfd_arch_arm, in); - /* If the input architecure is unknown, + /* If the input architecture is unknown, then so must be the output architecture. */ else if (in == bfd_mach_arm_unknown) /* FIXME: We ought to have some way to @@ -184,7 +184,7 @@ bfd_arm_merge_machines (ibfd, obfd) ; /* Otherwise the general principle that a earlier architecture can be - linked with a later architecure to produce a binary that will execute + linked with a later architecture to produce a binary that will execute on the later architecture. We fail however if we attempt to link a Cirrus EP9312 binary with an diff --git a/bfd/cpu-m32r.c b/bfd/cpu-m32r.c index bebc2ed..ee013ea 100644 --- a/bfd/cpu-m32r.c +++ b/bfd/cpu-m32r.c @@ -1,21 +1,21 @@ /* BFD support for the M32R processor. - Copyright 1996, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright 1996, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -25,15 +25,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ { 32, 32, 8, bfd_arch_m32r, number, "m32r", print, 4, default, \ bfd_default_compatible, bfd_default_scan, next } -#define NEXT NULL +#define M32R2_NEXT & arch_info_struct [1] +#define NEXT & arch_info_struct [0] static const bfd_arch_info_type arch_info_struct[] = { - N (bfd_mach_m32rx, "m32rx", FALSE, NULL) + N (bfd_mach_m32rx, "m32rx", FALSE, M32R2_NEXT) , + N (bfd_mach_m32r2, "m32r2", FALSE, NULL) }; -#undef NEXT -#define NEXT &arch_info_struct[0] - const bfd_arch_info_type bfd_m32r_arch = N (bfd_mach_m32r, "m32r", TRUE, NEXT); diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c index 1d56dff..01ecc4e 100644 --- a/bfd/cpu-mips.c +++ b/bfd/cpu-mips.c @@ -24,15 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "libbfd.h" static const bfd_arch_info_type *mips_compatible - PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); + (const bfd_arch_info_type *, const bfd_arch_info_type *); /* The default routine tests bits_per_word, which is wrong on mips as mips word size doesn't correlate with reloc size. */ static const bfd_arch_info_type * -mips_compatible (a, b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; +mips_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b) { if (a->arch != b->arch) return NULL; diff --git a/bfd/cpu-ns32k.c b/bfd/cpu-ns32k.c index aab1559..39e5b23 100644 --- a/bfd/cpu-ns32k.c +++ b/bfd/cpu-ns32k.c @@ -194,7 +194,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ @@ -678,7 +678,7 @@ _bfd_do_ns32k_reloc_contents (howto, input_bfd, relocation, location, /* For the signed case we use ADD, rather than SIGNED_ADD, to avoid warnings from SVR4 cc. This is OK since we - explictly handle the sign bits. */ + explicitly handle the sign bits. */ if (signed_add >= 0) signed_check += add >> howto->bitpos; else diff --git a/bfd/cpu-powerpc.c b/bfd/cpu-powerpc.c index 20b4909..a4e72d5 100644 --- a/bfd/cpu-powerpc.c +++ b/bfd/cpu-powerpc.c @@ -41,7 +41,7 @@ powerpc_compatible (a,b) case bfd_arch_powerpc: return bfd_default_compatible (a, b); case bfd_arch_rs6000: - if (a->mach == bfd_mach_ppc) + if (b->mach == bfd_mach_rs6k) return a; return NULL; } diff --git a/bfd/cpu-z8k.c b/bfd/cpu-z8k.c index 3ccedf6..d1ea14c 100644 --- a/bfd/cpu-z8k.c +++ b/bfd/cpu-z8k.c @@ -23,142 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "libbfd.h" -static const bfd_arch_info_type *compatible - PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); - -#if 0 /* not used currently */ -/* -Relocations for the Z8K - -*/ -static bfd_reloc_status_type -howto16_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct bfd_symbol *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - long x = bfd_get_16 (abfd, (bfd_byte *) data + addr); - - HOWTO_PREPARE (relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_16 (abfd, x, (bfd_byte *) data + addr); - return bfd_reloc_ok; -} - -static bfd_reloc_status_type -howto8_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct bfd_symbol *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - long x = bfd_get_8 (abfd, (bfd_byte *) data + addr); - - HOWTO_PREPARE (relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_8 (abfd, x, (bfd_byte *) data + addr); - return bfd_reloc_ok; -} - -static bfd_reloc_status_type -howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct bfd_symbol *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - - long x = bfd_get_8 (abfd, (bfd_byte *) data + addr); - abort (); - HOWTO_PREPARE (relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_8 (abfd, x, (bfd_byte *) data + addr); - return bfd_reloc_ok; -} - -static bfd_reloc_status_type -howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct bfd_symbol *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - long x = bfd_get_8 (abfd, (bfd_byte *) data + addr); - abort (); - HOWTO_PREPARE (relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_8 (abfd, x, (bfd_byte *) data + addr); - return bfd_reloc_ok; -} - -static reloc_howto_type howto_16 -= NEWHOWTO (howto16_callback, "abs16", 1, FALSE, FALSE); -static reloc_howto_type howto_8 -= NEWHOWTO (howto8_callback, "abs8", 0, FALSE, FALSE); - -static reloc_howto_type howto_8_FFnn -= NEWHOWTO (howto8_FFnn_callback, "ff00+abs8", 0, FALSE, FALSE); - -static reloc_howto_type howto_8_pcrel -= NEWHOWTO (howto8_pcrel_callback, "pcrel8", 0, FALSE, TRUE); - -static reloc_howto_type * -local_bfd_reloc_type_lookup (arch, code) - const struct bfd_arch_info *arch; - bfd_reloc_code_real_type code; -{ - switch (code) - { - case BFD_RELOC_16: - return &howto_16; - case BFD_RELOC_8_FFnn: - return &howto_8_FFnn; - case BFD_RELOC_8: - return &howto_8; - case BFD_RELOC_8_PCREL: - return &howto_8_pcrel; - default: - return (reloc_howto_type *) NULL; - } -} -#endif - /* This routine is provided two arch_infos and returns whether they'd be compatible */ static const bfd_arch_info_type * -compatible (a, b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; +compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b) { if (a->arch != b->arch || a->mach != b->mach) return NULL; diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 49422b2..68b3660 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -1530,7 +1530,7 @@ scan_unit_for_functions (unit) /* Parse a DWARF2 compilation unit starting at INFO_PTR. This includes the compilation unit header that proceeds the DIE's, but - does not include the length field that preceeds each compilation + does not include the length field that precedes each compilation unit header. END_PTR points one past the end of this comp unit. OFFSET_SIZE is the size of DWARF2 offsets (either 4 or 8 bytes). diff --git a/bfd/ecoff.c b/bfd/ecoff.c index b45f168..cfc5ae1 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -3566,9 +3566,9 @@ ecoff_link_add_archive_symbols (abfd, info) entry if it is the tail, because that would lose any entries we add to the list later on. */ if (*pundef != info->hash->undefs_tail) - *pundef = (*pundef)->next; + *pundef = (*pundef)->und_next; else - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; continue; } @@ -3578,7 +3578,7 @@ ecoff_link_add_archive_symbols (abfd, info) other object format. */ if (h->type != bfd_link_hash_undefined) { - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; continue; } @@ -3590,7 +3590,7 @@ ecoff_link_add_archive_symbols (abfd, info) if (file_offset == 0) { /* Nothing in this slot. */ - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; continue; } @@ -3621,7 +3621,7 @@ ecoff_link_add_archive_symbols (abfd, info) if (! found) { - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; continue; } @@ -3643,7 +3643,7 @@ ecoff_link_add_archive_symbols (abfd, info) if (! ecoff_link_add_object_symbols (element, info)) return FALSE; - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; } return TRUE; @@ -4129,7 +4129,7 @@ _bfd_ecoff_bfd_final_link (abfd, info) if (bfd_get_flavour (input_bfd) == bfd_target_ecoff_flavour) { - /* Abitrarily set the symbolic header vstamp to the vstamp + /* Arbitrarily set the symbolic header vstamp to the vstamp of the first object file in the link. */ if (symhdr->vstamp == 0) symhdr->vstamp diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c index 89edae3..9e23848 100644 --- a/bfd/ecofflink.c +++ b/bfd/ecofflink.c @@ -2007,7 +2007,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info) /* eraxxon: 'fdrtab_lookup' doesn't give what we want, at least for Compaq's C++ compiler 6.2. Consider three FDRs with starting addresses of x, y, and z, respectively, such that x < y < z. Assume further that - y < 'offset' < z. It is possble at times that the PDR for 'offset' is + y < 'offset' < z. It is possible at times that the PDR for 'offset' is associated with FDR x and *not* with FDR y. Erg!! From a binary dump of my C++ test case 'moo' using Compaq's coffobjanl @@ -2030,7 +2030,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info) Since the FDRs that are causing so much havok (in this case) 1) do not describe actual files (fdr.rss == -1), and 2) contain only compiler - genarated routines, I thought a simple fix would be to exclude them from + generated routines, I thought a simple fix would be to exclude them from the FDR table in 'mk_fdrtab'. But, besides not knowing for certain whether this would be correct, it creates an additional problem. If we happen to ask for source file info on a compiler generated (procedure) diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index d5965d3..c457a39 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -200,6 +200,9 @@ struct elf_link_hash_entry #define ELF_LINK_DYNAMIC_DEF 020000 /* Symbol is weak in all shared objects. */ #define ELF_LINK_DYNAMIC_WEAK 040000 + /* Symbol is referenced with a relocation where C/C++ pointer equality + matters. */ +#define ELF_LINK_POINTER_EQUALITY_NEEDED 0100000 }; /* Will references to this symbol always reference the symbol @@ -397,8 +400,8 @@ struct elf_link_hash_table #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash)) /* Returns TRUE if the hash table is a struct elf_link_hash_table. */ -#define is_elf_hash_table(p) \ - ((p)->hash->type == bfd_link_elf_hash_table) +#define is_elf_hash_table(htab) \ + (((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table) /* Used by bfd_section_from_r_symndx to cache a small number of local symbol to section mappings. */ @@ -623,8 +626,8 @@ struct elf_backend_data /* If this field is not NULL, it is called by the elf_link_output_sym phase of a link for each symbol which will appear in the object file. */ bfd_boolean (*elf_backend_link_output_symbol_hook) - (bfd *, struct bfd_link_info *info, const char *, Elf_Internal_Sym *, - asection *); + (struct bfd_link_info *info, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *); /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend linker the first time it encounters a dynamic object in the link. @@ -757,7 +760,7 @@ struct elf_backend_data /* This function is called to modify an existing segment map in a backend specific fashion. */ bfd_boolean (*elf_backend_modify_segment_map) - (bfd *); + (bfd *, struct bfd_link_info *); /* This function is called during section gc to discover the section a particular relocation refers to. */ @@ -785,12 +788,13 @@ struct elf_backend_data (bfd *, void *, asymbol *); /* This function, if defined, is called after all local symbols and - global symbols converted to locals are emited into the symtab + global symbols converted to locals are emitted into the symtab section. It allows the backend to emit special global symbols not handled in the hash table. */ bfd_boolean (*elf_backend_output_arch_syms) (bfd *, struct bfd_link_info *, void *, - bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *)); + bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *)); /* Copy any information related to dynamic linking from a pre-existing symbol to a newly created symbol. Also called to copy flags and diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index 0f15b0d..29579a4 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -1123,7 +1123,7 @@ elf_hppa_remark_useless_dynamic_symbols (struct elf_link_hash_entry *h, the generic code will warn that it is undefined. This behavior is undesirable on HPs since the standard shared - libraries contain reerences to undefined symbols. + libraries contain references to undefined symbols. So we twiddle the flags associated with such symbols so that they will not trigger the warning. ?!? FIXME. This is horribly fragile. @@ -1261,7 +1261,7 @@ elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info) hppa_info->data_segment_base = (bfd_vma)-1; /* HP's shared libraries have references to symbols that are not - defined anywhere. The generic ELF BFD linker code will complaim + defined anywhere. The generic ELF BFD linker code will complain about such symbols. So we detect the losing case and arrange for the flags on the symbol diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c index 7373dc0..133d2a9 100644 --- a/bfd/elf-m10200.c +++ b/bfd/elf-m10200.c @@ -469,7 +469,7 @@ mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section, /* This function handles relaxing for the mn10200. - There's quite a few relaxing opportunites available on the mn10200: + There are quite a few relaxing opportunities available on the mn10200: * jsr:24 -> jsr:16 2 bytes @@ -918,7 +918,7 @@ mn10200_elf_relax_section (abfd, sec, link_info, again) if (value & 0x8000) continue; - /* Note that we've changed the reldection contents, etc. */ + /* Note that we've changed the relocation contents, etc. */ elf_section_data (sec)->relocs = internal_relocs; elf_section_data (sec)->this_hdr.contents = contents; symtab_hdr->contents = (unsigned char *) isymbuf; @@ -957,7 +957,7 @@ mn10200_elf_relax_section (abfd, sec, link_info, again) case 0x40: case 0x44: case 0xc8: - /* Note that we've changed the reldection contents, etc. */ + /* Note that we've changed the relocation contents, etc. */ elf_section_data (sec)->relocs = internal_relocs; elf_section_data (sec)->this_hdr.contents = contents; symtab_hdr->contents = (unsigned char *) isymbuf; @@ -1040,7 +1040,7 @@ mn10200_elf_relax_section (abfd, sec, link_info, again) && (value & 0x8000) != 0) continue; - /* Note that we've changed the reldection contents, etc. */ + /* Note that we've changed the relocation contents, etc. */ elf_section_data (sec)->relocs = internal_relocs; elf_section_data (sec)->this_hdr.contents = contents; symtab_hdr->contents = (unsigned char *) isymbuf; diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 685ac9b..f628e76 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -85,7 +85,7 @@ struct elf32_mn10300_link_hash_entry { to the target when it's valid and profitable to do so. */ unsigned char movm_args; - /* For funtion symbols, the amount of stack space that would be allocated + /* For function symbols, the amount of stack space that would be allocated by the movm instruction. This is redundant with movm_args, but we add it to the hash table to avoid computing it over and over. */ unsigned char movm_stack_size; @@ -1743,13 +1743,16 @@ elf32_mn10300_finish_hash_table_entry (gen_entry, in_args) byte_count += 2; /* Count the insn to allocate stack space too. */ - if (entry->stack_size > 0 && entry->stack_size <= 128) - byte_count += 3; - else if (entry->stack_size > 0 && entry->stack_size < 256) - byte_count += 4; + if (entry->stack_size > 0) + { + if (entry->stack_size <= 128) + byte_count += 3; + else + byte_count += 4; + } /* If using "call" will result in larger code, then turn all - the associated "call" instructions into "calls" instrutions. */ + the associated "call" instructions into "calls" instructions. */ if (byte_count < entry->direct_calls) entry->flags |= MN10300_CONVERT_CALL_TO_CALLS; @@ -1759,7 +1762,7 @@ elf32_mn10300_finish_hash_table_entry (gen_entry, in_args) /* This function handles relaxing for the mn10300. - There's quite a few relaxing opportunites available on the mn10300: + There are quite a few relaxing opportunities available on the mn10300: * calls:32 -> calls:16 2 bytes * call:32 -> call:16 2 bytes @@ -2238,11 +2241,13 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) if (sym_hash->movm_args) bytes += 2; - if (sym_hash->stack_size && sym_hash->stack_size <= 128) - bytes += 3; - else if (sym_hash->stack_size - && sym_hash->stack_size < 256) - bytes += 4; + if (sym_hash->stack_size > 0) + { + if (sym_hash->stack_size <= 128) + bytes += 3; + else + bytes += 4; + } /* Note that we've deleted prologue bytes for this function. */ @@ -2290,11 +2295,13 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) if (sym_hash->movm_args) bytes += 2; - if (sym_hash->stack_size && sym_hash->stack_size <= 128) - bytes += 3; - else if (sym_hash->stack_size - && sym_hash->stack_size < 256) - bytes += 4; + if (sym_hash->stack_size > 0) + { + if (sym_hash->stack_size <= 128) + bytes += 3; + else + bytes += 4; + } /* Note that we've deleted prologue bytes for this function. */ @@ -3487,7 +3494,7 @@ compute_function_info (abfd, hash, addr, contents) } /* Now figure out how much stack space will be allocated by the movm - instruction. We need this kept separate from the funtion's normal + instruction. We need this kept separate from the function's normal stack space. */ if (hash->movm_args) { @@ -4008,7 +4015,7 @@ static const bfd_byte elf_mn10300_pic_plt_entry[PIC_PLT_ENTRY_SIZE] = /* Return offset of the GOT id in PLT0 entry. */ #define elf_mn10300_plt0_gotid_offset(info) 9 -/* Return offset of the tempoline in PLT entry */ +/* Return offset of the temporary in PLT entry */ #define elf_mn10300_plt_temp_offset(info) 8 /* Return offset of the symbol in PLT entry. */ @@ -41,7 +41,7 @@ #include "libiberty.h" static int elf_sort_sections (const void *, const void *); -static bfd_boolean assign_file_positions_except_relocs (bfd *); +static bfd_boolean assign_file_positions_except_relocs (bfd *, struct bfd_link_info *); static bfd_boolean prep_headers (bfd *); static bfd_boolean swap_out_syms (bfd *, struct bfd_strtab_hash **, int) ; static bfd_boolean elfcore_read_notes (bfd *, file_ptr, bfd_size_type) ; @@ -894,7 +894,7 @@ merge_sections_remove_hook (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean _bfd_elf_merge_sections (bfd *abfd, struct bfd_link_info *info) { - if (!is_elf_hash_table (info)) + if (!is_elf_hash_table (info->hash)) return FALSE; if (elf_hash_table (info)->merge_info) _bfd_merge_sections (abfd, elf_hash_table (info)->merge_info, @@ -907,7 +907,7 @@ _bfd_elf_link_just_syms (asection *sec, struct bfd_link_info *info) { sec->output_section = bfd_abs_section_ptr; sec->output_offset = sec->vma; - if (!is_elf_hash_table (info)) + if (!is_elf_hash_table (info->hash)) return; sec->sec_info_type = ELF_INFO_TYPE_JUST_SYMS; @@ -1354,12 +1354,13 @@ _bfd_elf_link_hash_copy_indirect (const struct elf_backend_data *bed, /* Copy down any references that we may have already seen to the symbol which just became indirect. */ - dir->elf_link_hash_flags |= - (ind->elf_link_hash_flags - & (ELF_LINK_HASH_REF_DYNAMIC - | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_NON_GOT_REF)); + dir->elf_link_hash_flags + |= ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC + | ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_NON_GOT_REF + | ELF_LINK_HASH_NEEDS_PLT + | ELF_LINK_POINTER_EQUALITY_NEEDED); if (ind->root.type != bfd_link_hash_indirect) return; @@ -1503,7 +1504,7 @@ struct bfd_link_needed_list * bfd_elf_get_needed_list (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) { - if (! is_elf_hash_table (info)) + if (! is_elf_hash_table (info->hash)) return NULL; return elf_hash_table (info)->needed; } @@ -1515,7 +1516,7 @@ struct bfd_link_needed_list * bfd_elf_get_runpath_list (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) { - if (! is_elf_hash_table (info)) + if (! is_elf_hash_table (info->hash)) return NULL; return elf_hash_table (info)->runpath; } @@ -3102,7 +3103,7 @@ _bfd_elf_compute_section_file_positions (bfd *abfd, /* sh_offset is set in assign_file_positions_except_relocs. */ shstrtab_hdr->sh_addralign = 1; - if (!assign_file_positions_except_relocs (abfd)) + if (!assign_file_positions_except_relocs (abfd, link_info)) return FALSE; if (link_info == NULL && bfd_get_symcount (abfd) > 0) @@ -3575,7 +3576,7 @@ elf_sort_sections (const void *arg1, const void *arg2) the file header, and writes out the program headers. */ static bfd_boolean -assign_file_positions_for_segments (bfd *abfd) +assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) { const struct elf_backend_data *bed = get_elf_backend_data (abfd); unsigned int count; @@ -3627,7 +3628,7 @@ assign_file_positions_for_segments (bfd *abfd) if (bed->elf_backend_modify_segment_map) { - if (! (*bed->elf_backend_modify_segment_map) (abfd)) + if (! (*bed->elf_backend_modify_segment_map) (abfd, link_info)) return FALSE; } @@ -4135,7 +4136,8 @@ get_program_header_size (bfd *abfd) We also don't set the positions of the .symtab and .strtab here. */ static bfd_boolean -assign_file_positions_except_relocs (bfd *abfd) +assign_file_positions_except_relocs (bfd *abfd, + struct bfd_link_info *link_info) { struct elf_obj_tdata * const tdata = elf_tdata (abfd); Elf_Internal_Ehdr * const i_ehdrp = elf_elfheader (abfd); @@ -4186,7 +4188,7 @@ assign_file_positions_except_relocs (bfd *abfd) /* Assign file positions for the loaded sections based on the assignment of sections to segments. */ - if (! assign_file_positions_for_segments (abfd)) + if (! assign_file_positions_for_segments (abfd, link_info)) return FALSE; /* Assign file positions for the other sections. */ @@ -4623,8 +4625,9 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) 2. It is an allocated segment, 3. There is an output section associated with it, 4. The section has not already been allocated to a previous segment. - 5. PT_TLS segment includes only SHF_TLS sections. - 6. SHF_TLS sections are only in PT_TLS or PT_LOAD segments. */ + 5. PT_GNU_STACK segments do not include any sections. + 6. PT_TLS segment includes only SHF_TLS sections. + 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments. */ #define INCLUDE_SECTION_IN_SEGMENT(section, segment, bed) \ ((((segment->p_paddr \ ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \ @@ -4632,6 +4635,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) && (section->flags & SEC_ALLOC) != 0) \ || IS_COREFILE_NOTE (segment, section)) \ && section->output_section != NULL \ + && segment->p_type != PT_GNU_STACK \ && (segment->p_type != PT_TLS \ || (section->flags & SEC_THREAD_LOCAL)) \ && (segment->p_type == PT_LOAD \ @@ -4675,7 +4679,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) if (IS_SOLARIS_PT_INTERP (segment, section)) { /* Mininal change so that the normal section to segment - assigment code will work. */ + assignment code will work. */ segment->p_vaddr = section->vma; break; } @@ -6834,7 +6838,8 @@ elfcore_grok_netbsd_procinfo (bfd *abfd, Elf_Internal_Note *note) elf_tdata (abfd)->core_command = _bfd_elfcore_strndup (abfd, note->descdata + 0x7c, 31); - return TRUE; + return elfcore_make_note_pseudosection (abfd, ".note.netbsdcore.procinfo", + note); } static bfd_boolean diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index bcc1188..d42eb27 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -235,13 +235,13 @@ struct elf32_arm_link_hash_table /* The main hash table. */ struct elf_link_hash_table root; - /* The size in bytes of the section containg the Thumb-to-ARM glue. */ + /* The size in bytes of the section containing the Thumb-to-ARM glue. */ bfd_size_type thumb_glue_size; - /* The size in bytes of the section containg the ARM-to-Thumb glue. */ + /* The size in bytes of the section containing the ARM-to-Thumb glue. */ bfd_size_type arm_glue_size; - /* An arbitary input BFD chosen to hold the glue sections. */ + /* An arbitrary input BFD chosen to hold the glue sections. */ bfd * bfd_of_glue_owner; /* A boolean indicating whether knowledge of the ARM's pipeline @@ -965,7 +965,7 @@ error_return: instruction. It takes two thumb instructions to encode the target address. Each has - 11 bits to invest. The upper 11 bits are stored in one (identifed by + 11 bits to invest. The upper 11 bits are stored in one (identified by H-0.. see below), the lower 11 bits are stored in the other (identified by H-1). @@ -2610,7 +2610,7 @@ elf32_arm_print_private_bfd_data (abfd, ptr) switch (EF_ARM_EABI_VERSION (flags)) { case EF_ARM_EABI_UNKNOWN: - /* The following flag bits are GNU extenstions and not part of the + /* The following flag bits are GNU extensions and not part of the official ARM ELF extended ABI. Hence they are only decoded if the EABI version is not set. */ if (flags & EF_ARM_INTERWORK) @@ -3985,7 +3985,7 @@ elf32_arm_finish_dynamic_sections (output_bfd, info) name = info->fini_function; get_sym: /* If it wasn't set by elf_bfd_final_link - then there is nothing to ajdust. */ + then there is nothing to adjust. */ if (dyn.d_un.d_val != 0) { struct elf_link_hash_entry * eh; diff --git a/bfd/elf32-d30v.c b/bfd/elf32-d30v.c index 4b184d6..b08977f 100644 --- a/bfd/elf32-d30v.c +++ b/bfd/elf32-d30v.c @@ -293,7 +293,7 @@ bfd_elf_d30v_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ @@ -402,7 +402,7 @@ bfd_elf_d30v_reloc_21 (abfd, reloc_entry, symbol, data, input_section, output_bf if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c index 1f380e8..6ccb9f5 100644 --- a/bfd/elf32-dlx.c +++ b/bfd/elf32-dlx.c @@ -228,7 +228,7 @@ HOWTO (R_DLX_RELOC_16_LO, /* type */ FALSE); /* pcrel_offset */ -/* The gas default beheaver is not to preform the %hi modifier so that the +/* The gas default behavior is not to preform the %hi modifier so that the GNU assembler can have the lower 16 bits offset placed in the insn, BUT we do like the gas to indicate it is %hi reloc type so when we in the link loader phase we can have the corrected hi16 vale replace the buggous lo16 @@ -493,7 +493,7 @@ elf32_dlx_relocate26 (abfd, reloc_entry, symbol, data, More about this table - for dlx elf relocation we do not really need this table, if we have a rtype defined in this table will caused tc_gen_relocate confused and die on us, but if we remove - this table it will caused more problem, so for now simple soulation + this table it will caused more problem, so for now simple solution is to remove those entries which may cause problem. */ struct elf_reloc_map { diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index 452db27..18d87d4 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -649,7 +649,7 @@ elf32_h8_merge_private_bfd_data (bfd *ibfd, bfd *obfd) /* This function handles relaxing for the H8.. - There's a few relaxing opportunites available on the H8: + There are a few relaxing opportunities available on the H8: jmp/jsr:24 -> bra/bsr:8 2 bytes The jmp may be completely eliminated if the previous insn is a @@ -1116,7 +1116,7 @@ elf32_h8_relax_section (bfd *abfd, asection *sec, /* FALLTHRU */ /* This is a 24/32bit absolute address in a "mov" insn, which may - become a 16bit absoulte address if it is in the right range. */ + become a 16-bit absolute address if it is in the right range. */ case R_H8_DIR32A16: { bfd_vma value; diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index c2e2f70..cf6c630 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1018,7 +1018,8 @@ elf32_hppa_copy_indirect_symbol (const struct elf_backend_data *bed, dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -2304,9 +2305,6 @@ elf32_hppa_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) bfd_size_type amt; struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info); - if (htab->elf.root.creator->flavour != bfd_target_elf_flavour) - return 0; - /* Count the number of input BFDs and find the top input section id. */ for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0; input_bfd != NULL; @@ -2910,21 +2908,8 @@ elf32_hppa_set_gp (bfd *abfd, struct bfd_link_info *info) } else { - asection *splt; - asection *sgot; - - if (htab->elf.root.creator->flavour == bfd_target_elf_flavour) - { - splt = htab->splt; - sgot = htab->sgot; - } - else - { - /* If we're not elf, look up the output sections in the - hope we may actually find them. */ - splt = bfd_get_section_by_name (abfd, ".plt"); - sgot = bfd_get_section_by_name (abfd, ".got"); - } + asection *splt = bfd_get_section_by_name (abfd, ".plt"); + asection *sgot = bfd_get_section_by_name (abfd, ".got"); /* Choose to point our LTP at, in this order, one of .plt, .got, or .data, if these sections exist. In the case of choosing diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index 83783ae..80c45f6 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -834,7 +834,7 @@ i370_elf_size_dynamic_sections (output_bfd, info) FIXME: We assume that there will never be relocations to locations in linker-created sections that do not have externally-visible names. Instead, we should work out precisely - which sections relocations are targetted at. */ + which sections relocations are targeted at. */ if (info->shared) { int c; @@ -1555,6 +1555,6 @@ static int i370_noop () #define elf_backend_additional_program_headers \ (int (*) PARAMS ((bfd *))) i370_noop #define elf_backend_modify_segment_map \ - (bfd_boolean (*) PARAMS ((bfd *))) i370_noop + (bfd_boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) i370_noop #include "elf32-target.h" diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index ff8aab4..876efc6 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -546,20 +546,6 @@ elf_i386_mkobject (bfd *abfd) return TRUE; } -static bfd_boolean -elf_i386_object_p (bfd *abfd) -{ - /* Allocate our special target data. */ - struct elf_i386_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct elf_i386_obj_tdata); - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; - return TRUE; -} - /* i386 ELF linker hash table. */ struct elf_i386_link_hash_table @@ -770,7 +756,9 @@ elf_i386_copy_indirect_symbol (const struct elf_backend_data *bed, dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT + | ELF_LINK_POINTER_EQUALITY_NEEDED)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -1000,6 +988,8 @@ elf_i386_check_relocs (bfd *abfd, /* We may need a .plt entry if the function this reloc refers to is in a shared lib. */ h->plt.refcount += 1; + if (r_type != R_386_PC32) + h->elf_link_hash_flags |= ELF_LINK_POINTER_EQUALITY_NEEDED; } /* If we are creating a shared library, and this is a reloc @@ -3003,11 +2993,16 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) { /* Mark the symbol as undefined, rather than as defined in - the .plt section. Leave the value alone. This is a clue + the .plt section. Leave the value if there were any + relocations where pointer equality matters (this is a clue for the dynamic linker, to make function pointer comparisons work between an application and shared - library. */ + library), otherwise set it to zero. If a function is only + called from a binary, there is no need to slow down + shared libraries because of that. */ sym->st_shndx = SHN_UNDEF; + if ((h->elf_link_hash_flags & ELF_LINK_POINTER_EQUALITY_NEEDED) == 0) + sym->st_value = 0; } } @@ -3244,7 +3239,6 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, #define elf_info_to_howto_rel elf_i386_info_to_howto_rel #define bfd_elf32_mkobject elf_i386_mkobject -#define elf_backend_object_p elf_i386_object_p #define bfd_elf32_bfd_is_local_label_name elf_i386_is_local_label_name #define bfd_elf32_bfd_link_hash_table_create elf_i386_link_hash_table_create diff --git a/bfd/elf32-i960.c b/bfd/elf32-i960.c index 6218e1a..99e5585 100644 --- a/bfd/elf32-i960.c +++ b/bfd/elf32-i960.c @@ -1,4 +1,4 @@ -/* Intel 860 specific support for 32-bit ELF +/* Intel 960 specific support for 32-bit ELF Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -107,13 +107,8 @@ elf32_i960_info_to_howto_rel (abfd, cache_ptr, dst) relocatable output against an external symbol. */ bfd_reloc_status_type -elf32_i960_relocate (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) +elf32_i960_relocate (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) bfd *abfd ATTRIBUTE_UNUSED; arelent *reloc_entry; asymbol *symbol; diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c index e8cb177..7606e0d 100644 --- a/bfd/elf32-ip2k.c +++ b/bfd/elf32-ip2k.c @@ -1007,7 +1007,7 @@ ip2k_elf_relax_section_page (abfd, sec, again, misc, page_start, page_end) int switch_table_128; int switch_table_256; - /* Walk thru the section looking for relaxation opertunities. */ + /* Walk thru the section looking for relaxation opportunities. */ for (irel = misc->irelbase; irel < irelend; irel++) { if (ELF32_R_TYPE (irel->r_info) != (int) R_IP2K_PAGE3) @@ -1388,7 +1388,7 @@ ip2k_final_link_relocate (howto, input_bfd, input_section, contents, rel, case R_IP2K_ADDR16CJP: if (BASEADDR (input_section) + rel->r_offset != page_addr + 2) { - /* No preceeding page instruction, verify that it isn't needed. */ + /* No preceding page instruction, verify that it isn't needed. */ if (PAGENO (relocation + rel->r_addend) != ip2k_nominal_page_bits (input_bfd, input_section, rel->r_offset, contents)) @@ -1398,7 +1398,7 @@ ip2k_final_link_relocate (howto, input_bfd, input_section, contents, rel, } else if (ip2k_relaxed) { - /* Preceeding page instruction. Verify that the page instruction is + /* Preceding page instruction. Verify that the page instruction is really needed. One reason for the relaxation to miss a page is if the section is not marked as executable. */ if (!ip2k_is_switch_table_128 (input_bfd, input_section, rel->r_offset - 2, contents) && diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 7500f56..2794ffb 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -2,21 +2,21 @@ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -843,7 +843,7 @@ m32r_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) if (! info->relocatable && (*namep)[0] == '_' && (*namep)[1] == 'S' && strcmp (*namep, "_SDA_BASE_") == 0 - && info->hash->creator->flavour == bfd_target_elf_flavour) + && is_elf_hash_table (info->hash)) { /* This is simpler than using _bfd_elf_create_linker_section (our needs are simpler than ppc's needs). Also @@ -1863,6 +1863,7 @@ m32r_elf_object_p (abfd) default: case E_M32R_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_m32r, bfd_mach_m32r); break; case E_M32RX_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_m32r, bfd_mach_m32rx); break; + case E_M32R2_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_m32r, bfd_mach_m32r2); break; } return TRUE; } @@ -1880,6 +1881,7 @@ m32r_elf_final_write_processing (abfd, linker) default: case bfd_mach_m32r: val = E_M32R_ARCH; break; case bfd_mach_m32rx: val = E_M32RX_ARCH; break; + case bfd_mach_m32r2: val = E_M32R2_ARCH; break; } elf_elfheader (abfd)->e_flags &=~ EF_M32R_ARCH; @@ -1946,7 +1948,9 @@ m32r_elf_merge_private_bfd_data (ibfd, obfd) if ((in_flags & EF_M32R_ARCH) != (out_flags & EF_M32R_ARCH)) { - if ((in_flags & EF_M32R_ARCH) != E_M32R_ARCH) + if ( ((in_flags & EF_M32R_ARCH) != E_M32R_ARCH) + || ((out_flags & EF_M32R_ARCH) == E_M32R_ARCH) + || ((in_flags & EF_M32R_ARCH) == E_M32R2_ARCH)) { (*_bfd_error_handler) (_("%s: Instruction set mismatch with previous modules"), @@ -1979,6 +1983,7 @@ m32r_elf_print_private_bfd_data (abfd, ptr) default: case E_M32R_ARCH: fprintf (file, _(": m32r instructions")); break; case E_M32RX_ARCH: fprintf (file, _(": m32rx instructions")); break; + case E_M32R2_ARCH: fprintf (file, _(": m32r2 instructions")); break; } fputc ('\n', file); diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 4d8f6b5..42010b0 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -954,7 +954,7 @@ m68hc11_elf_relax_section (bfd *abfd, asection *sec, { unsigned long old_sec_size = sec->_cooked_size; - /* Note that we've changed the reldection contents, etc. */ + /* Note that we've changed the relocation contents, etc. */ elf_section_data (sec)->relocs = internal_relocs; free_relocs = NULL; @@ -985,7 +985,7 @@ m68hc11_elf_relax_section (bfd *abfd, asection *sec, continue; } - /* Note that we've changed the reldection contents, etc. */ + /* Note that we've changed the relocation contents, etc. */ elf_section_data (sec)->relocs = internal_relocs; free_relocs = NULL; @@ -1030,7 +1030,7 @@ m68hc11_elf_relax_section (bfd *abfd, asection *sec, if ((offset & 0xff80) == 0 || (offset & 0xff80) == 0xff80) { - /* Note that we've changed the reldection contents, etc. */ + /* Note that we've changed the relocation contents, etc. */ elf_section_data (sec)->relocs = internal_relocs; free_relocs = NULL; diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 6992a3d..0fc9768 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -84,7 +84,7 @@ static reloc_howto_type mcore_elf_howto_raw[] = 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ - "ADDR32", /* name *//* For compatability with coff/pe port. */ + "ADDR32", /* name *//* For compatibility with coff/pe port. */ FALSE, /* partial_inplace */ 0x0, /* src_mask */ 0xffffffff, /* dst_mask */ diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index b17008e..299c395 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -48,48 +48,47 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ecoffswap.h" static bfd_reloc_status_type mips_elf_generic_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_hi16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_lo16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_got16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type gprel32_with_gp - PARAMS ((bfd *, asymbol *, arelent *, asection *, bfd_boolean, PTR, - bfd_vma)); + (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma); static bfd_reloc_status_type mips_elf_gprel32_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips32_64bit_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); + (bfd *, bfd_reloc_code_real_type); static reloc_howto_type *mips_elf32_rtype_to_howto - PARAMS ((unsigned int, bfd_boolean)); + (unsigned int, bfd_boolean); static void mips_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); static void mips_info_to_howto_rela - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); static bfd_boolean mips_elf_sym_is_global - PARAMS ((bfd *, asymbol *)); + (bfd *, asymbol *); static bfd_boolean mips_elf32_object_p - PARAMS ((bfd *)); + (bfd *); static bfd_boolean mips_elf_is_local_label_name - PARAMS ((bfd *, const char *)); + (bfd *, const char *); static bfd_reloc_status_type mips16_jump_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_gprel_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_final_gp - PARAMS ((bfd *, asymbol *, bfd_boolean, char **, bfd_vma *)); + (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *); static bfd_boolean mips_elf_assign_gp - PARAMS ((bfd *, bfd_vma *)); + (bfd *, bfd_vma *); static bfd_boolean elf32_mips_grok_prstatus - PARAMS ((bfd *, Elf_Internal_Note *)); + (bfd *, Elf_Internal_Note *); static bfd_boolean elf32_mips_grok_psinfo - PARAMS ((bfd *, Elf_Internal_Note *)); + (bfd *, Elf_Internal_Note *); static irix_compat_t elf32_mips_irix_compat - PARAMS ((bfd *)); + (bfd *); extern const bfd_target bfd_elf32_bigmips_vec; extern const bfd_target bfd_elf32_littlemips_vec; @@ -724,19 +723,14 @@ static reloc_howto_type elf_mips_gnu_vtentry_howto = /* We use this instead of bfd_elf_generic_reloc because the latter gets the handling of zero addends wrong. */ static bfd_reloc_status_type -mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -775,15 +769,9 @@ struct mips_hi16 static struct mips_hi16 *mips_hi16_list; static bfd_reloc_status_type -mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data, asection *input_section, + bfd *output_bfd, char **error_message) { bfd_reloc_status_type ret; bfd_vma relocation; @@ -791,7 +779,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -826,8 +814,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, } else { - if (bfd_is_und_section (symbol->section) - && output_bfd == (bfd *) NULL) + if (bfd_is_und_section (symbol->section) && output_bfd == NULL) ret = bfd_reloc_undefined; if (bfd_is_com_section (symbol->section)) @@ -844,7 +831,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_outofrange; /* Save the information, and let LO16 do the actual relocation. */ - n = (struct mips_hi16 *) bfd_malloc ((bfd_size_type) sizeof *n); + n = bfd_malloc (sizeof *n); if (n == NULL) return bfd_reloc_outofrange; n->addr = (bfd_byte *) data + reloc_entry->address; @@ -852,7 +839,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, n->next = mips_hi16_list; mips_hi16_list = n; - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) reloc_entry->address += input_section->output_offset; return ret; @@ -863,15 +850,9 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, R_MIPS_HI16 relocation described above. */ static bfd_reloc_status_type -mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { arelent gp_disp_relent; @@ -921,7 +902,7 @@ mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section, insn &= ~ (bfd_vma) 0xffff; insn |= val; - bfd_put_32 (abfd, (bfd_vma) insn, l->addr); + bfd_put_32 (abfd, insn, l->addr); } next = l->next; @@ -975,19 +956,13 @@ mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section, not yet know how to create global offset tables. */ static bfd_reloc_status_type -mips_elf_got16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1003,9 +978,7 @@ mips_elf_got16_reloc (abfd, reloc_entry, symbol, data, input_section, dangerous relocation. */ static bfd_boolean -mips_elf_assign_gp (output_bfd, pgp) - bfd *output_bfd; - bfd_vma *pgp; +mips_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp) { unsigned int count; asymbol **sym; @@ -1021,7 +994,7 @@ mips_elf_assign_gp (output_bfd, pgp) /* The linker script will have created a symbol named `_gp' with the appropriate value. */ - if (sym == (asymbol **) NULL) + if (sym == NULL) i = count; else { @@ -1057,12 +1030,8 @@ mips_elf_assign_gp (output_bfd, pgp) external symbol if we are producing relocatable output. */ static bfd_reloc_status_type -mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, pgp) - bfd *output_bfd; - asymbol *symbol; - bfd_boolean relocatable; - char **error_message; - bfd_vma *pgp; +mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable, + char **error_message, bfd_vma *pgp) { if (bfd_is_und_section (symbol->section) && ! relocatable) @@ -1100,15 +1069,10 @@ mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, pgp) merged. */ bfd_reloc_status_type -_bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +_bfd_mips_elf32_gprel16_reloc (bfd *abfd, arelent *reloc_entry, + asymbol *symbol, void *data, + asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1116,7 +1080,7 @@ _bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1124,7 +1088,7 @@ _bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_ok; } - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1146,15 +1110,9 @@ _bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, become the offset from the gp register. */ static bfd_reloc_status_type -mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1162,7 +1120,7 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1171,7 +1129,7 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_outofrange; } - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1189,15 +1147,9 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, } static bfd_reloc_status_type -gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocatable, data, - gp) - bfd *abfd; - asymbol *symbol; - arelent *reloc_entry; - asection *input_section; - bfd_boolean relocatable; - PTR data; - bfd_vma gp; +gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry, + asection *input_section, bfd_boolean relocatable, + void *data, bfd_vma gp) { bfd_vma relocation; bfd_vma val; @@ -1242,15 +1194,9 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocatable, data, sign extension. */ static bfd_reloc_status_type -mips32_64bit_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips32_64bit_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_reloc_status_type r; arelent reloc32; @@ -1279,7 +1225,7 @@ mips32_64bit_reloc (abfd, reloc_entry, symbol, data, input_section, addr = reloc_entry->address; if (bfd_little_endian (abfd)) addr += 4; - bfd_put_32 (abfd, (bfd_vma) val, (bfd_byte *) data + addr); + bfd_put_32 (abfd, val, (bfd_byte *) data + addr); return r; } @@ -1287,17 +1233,12 @@ mips32_64bit_reloc (abfd, reloc_entry, symbol, data, input_section, /* Handle a mips16 jump. */ static bfd_reloc_status_type -mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && reloc_entry->addend == 0) { @@ -1322,15 +1263,9 @@ mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, /* Handle a mips16 GP relative reloc. */ static bfd_reloc_status_type -mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1397,13 +1332,10 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, if (reloc_entry->howto->partial_inplace) { bfd_put_16 (abfd, - (bfd_vma) ((extend & 0xf800) - | ((val >> 11) & 0x1f) - | (val & 0x7e0)), + (extend & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0), (bfd_byte *) data + reloc_entry->address); bfd_put_16 (abfd, - (bfd_vma) ((insn & 0xffe0) - | (val & 0x1f)), + (insn & 0xffe0) | (val & 0x1f), (bfd_byte *) data + reloc_entry->address + 2); } else @@ -1453,9 +1385,7 @@ static const struct elf_reloc_map mips_reloc_map[] = /* Given a BFD reloc type, return a howto structure. */ static reloc_howto_type * -bfd_elf32_bfd_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; +bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) { unsigned int i; reloc_howto_type *howto_table = elf_mips_howto_table_rel; @@ -1507,9 +1437,8 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static reloc_howto_type * -mips_elf32_rtype_to_howto (r_type, rela_p) - unsigned int r_type; - bfd_boolean rela_p ATTRIBUTE_UNUSED; +mips_elf32_rtype_to_howto (unsigned int r_type, + bfd_boolean rela_p ATTRIBUTE_UNUSED) { switch (r_type) { @@ -1540,10 +1469,7 @@ mips_elf32_rtype_to_howto (r_type, rela_p) /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static void -mips_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) { unsigned int r_type; @@ -1563,10 +1489,7 @@ mips_info_to_howto_rel (abfd, cache_ptr, dst) /* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */ static void -mips_info_to_howto_rela (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +mips_info_to_howto_rela (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) { mips_info_to_howto_rel (abfd, cache_ptr, dst); @@ -1581,9 +1504,7 @@ mips_info_to_howto_rela (abfd, cache_ptr, dst) and externally visible symbols. */ static bfd_boolean -mips_elf_sym_is_global (abfd, sym) - bfd *abfd ATTRIBUTE_UNUSED; - asymbol *sym; +mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym) { if (SGI_COMPAT (abfd)) return (sym->flags & BSF_SECTION_SYM) == 0; @@ -1596,8 +1517,7 @@ mips_elf_sym_is_global (abfd, sym) /* Set the right machine number for a MIPS ELF file. */ static bfd_boolean -mips_elf32_object_p (abfd) - bfd *abfd; +mips_elf32_object_p (bfd *abfd) { unsigned long mach; @@ -1619,9 +1539,7 @@ mips_elf32_object_p (abfd) /* MIPS ELF local labels start with '$', not 'L'. */ static bfd_boolean -mips_elf_is_local_label_name (abfd, name) - bfd *abfd; - const char *name; +mips_elf_is_local_label_name (bfd *abfd, const char *name) { if (name[0] == '$') return TRUE; @@ -1633,9 +1551,7 @@ mips_elf_is_local_label_name (abfd, name) /* Support for core dump NOTE sections. */ static bfd_boolean -elf32_mips_grok_prstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; unsigned int raw_size; @@ -1665,9 +1581,7 @@ elf32_mips_grok_prstatus (abfd, note) } static bfd_boolean -elf32_mips_grok_psinfo (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) { switch (note->descsz) { @@ -1699,8 +1613,7 @@ elf32_mips_grok_psinfo (abfd, note) /* Depending on the target vector we generate some version of Irix executables or "normal" MIPS ELF ABI executables. */ static irix_compat_t -elf32_mips_irix_compat (abfd) - bfd *abfd; +elf32_mips_irix_compat (bfd *abfd) { if ((abfd->xvec == &bfd_elf32_bigmips_vec) || (abfd->xvec == &bfd_elf32_littlemips_vec)) @@ -1717,12 +1630,9 @@ elf32_mips_irix_compat (abfd) objects, and before the final_link entry point is called. */ bfd_boolean -bfd_mips_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) - bfd *abfd; - struct bfd_link_info *info; - asection *datasec; - asection *relsec; - char **errmsg; +bfd_mips_elf32_create_embedded_relocs (bfd *abfd, struct bfd_link_info *info, + asection *datasec, asection *relsec, + char **errmsg) { Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Sym *isymbuf = NULL; @@ -1752,13 +1662,12 @@ bfd_mips_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) } /* Get a copy of the native relocations. */ - internal_relocs = (_bfd_elf_link_read_relocs - (abfd, datasec, (PTR) NULL, (Elf_Internal_Rela *) NULL, - info->keep_memory)); + internal_relocs = _bfd_elf_link_read_relocs (abfd, datasec, NULL, NULL, + info->keep_memory); if (internal_relocs == NULL) goto error_return; - relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 12); + relsec->contents = bfd_alloc (abfd, datasec->reloc_count * 12); if (relsec->contents == NULL) goto error_return; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index e2de01e..4467eec 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -336,7 +336,8 @@ ppc_elf_copy_indirect_symbol (const struct elf_backend_data *bed, dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -1674,11 +1675,8 @@ ppc_elf_relax_section (bfd *abfd, *again = FALSE; - /* Nothing to do if there are no relocations and no need for - the relax finalize pass. */ - if ((isec->flags & SEC_RELOC) == 0 - || isec->reloc_count == 0 - || link_info->relax_finalizing) + /* Nothing to do if there are no relocations. */ + if ((isec->flags & SEC_RELOC) == 0 || isec->reloc_count == 0) return TRUE; /* If needed, initialize this section's cooked size. */ @@ -1763,7 +1761,7 @@ ppc_elf_relax_section (bfd *abfd, } isym = isymbuf + ELF32_R_SYM (irel->r_info); if (isym->st_shndx == SHN_UNDEF) - continue; /* We can't do anthing with undefined symbols. */ + continue; /* We can't do anything with undefined symbols. */ else if (isym->st_shndx == SHN_ABS) tsec = bfd_abs_section_ptr; else if (isym->st_shndx == SHN_COMMON) @@ -2738,7 +2736,8 @@ ppc_elf_additional_program_headers (bfd *abfd) /* Modify the segment map if needed. */ static bfd_boolean -ppc_elf_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED) +ppc_elf_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return TRUE; } @@ -4917,7 +4916,7 @@ ppc_elf_relocate_section (bfd *output_bfd, branch_bit = BRANCH_PREDICT_BIT; /* Fall thru */ - /* Branch not taken predicition relocations. */ + /* Branch not taken prediction relocations. */ case R_PPC_ADDR14_BRNTAKEN: case R_PPC_REL14_BRNTAKEN: insn = bfd_get_32 (output_bfd, contents + rel->r_offset); diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 80a753a..07ba23c 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -484,7 +484,7 @@ elf_s390_is_local_label_name (abfd, name) Word 1 is a pointer to a structure describing the object Word 2 is used to point to the loader entry address. - The code for position independand PLT entries looks like this: + The code for position independent PLT entries looks like this: r12 holds addr of the current GOT at entry to the PLT @@ -685,14 +685,6 @@ static bfd_boolean elf_s390_object_p (abfd) bfd *abfd; { - /* Allocate our special target data. */ - struct elf_s390_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct elf_s390_obj_tdata); - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; /* Set the right machine number for an s390 elf32 file. */ return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_31); } @@ -914,7 +906,8 @@ elf_s390_copy_indirect_symbol (bed, dir, ind) dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -2626,9 +2619,41 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, else { /* This symbol is local, or marked to become local. */ - relocate = TRUE; - outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE); outrel.r_addend = relocation + rel->r_addend; + if (r_type == R_390_32) + { + relocate = TRUE; + outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE); + } + else + { + long sindx; + + if (bfd_is_abs_section (sec)) + sindx = 0; + else if (sec == NULL || sec->owner == NULL) + { + bfd_set_error(bfd_error_bad_value); + return FALSE; + } + else + { + asection *osec; + + osec = sec->output_section; + sindx = elf_section_data (osec)->dynindx; + BFD_ASSERT (sindx > 0); + + /* We are turning this relocation into one + against a section symbol, so subtract out + the output section's address but not the + offset of the input section in the output + section. */ + + outrel.r_addend -= osec->vma; + } + outrel.r_info = ELF32_R_INFO (sindx, r_type); + } } sreloc = elf_section_data (input_section)->sreloc; diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 9ffd05b..c8a091d 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -457,7 +457,7 @@ static reloc_howto_type sh_elf_howto_table[] = TRUE), /* pcrel_offset */ /* The assembler will generate this reloc before a block of - instructions. A section should be processed as assumining it + instructions. A section should be processed as assuming it contains data, unless this reloc is seen. */ HOWTO (R_SH_CODE, /* type */ 0, /* rightshift */ @@ -2718,7 +2718,7 @@ sh_elf_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, /* The addend will be against the section symbol, thus for adjusting the addend, the relevant start is the start of the section. - N.B. If we want to abandom in-place changes here and + N.B. If we want to abandon in-place changes here and test directly using symbol + addend, we have to take into account that the addend has already been adjusted by -4. */ if (stop > addr && stop < toaddr) @@ -3412,7 +3412,7 @@ movi_shori_putval (bfd *output_bfd, unsigned long value, char *addr) #if 1 /* Note - this code has been "optimised" not to use r2. r2 is used by - GCC to return the address of large strutcures, so it should not be + GCC to return the address of large structures, so it should not be corrupted here. This does mean however, that this PLT does not conform to the SH PIC ABI. That spec says that r0 contains the type of the PLT and r2 contains the GOT id. This version stores the GOT id in r0 and @@ -3635,7 +3635,7 @@ static const bfd_byte *elf_sh_pic_plt_entry; /* Return offset of the GOT id in PLT0 entry. */ #define elf_sh_plt0_gotid_offset(info) 24 -/* Return offset of the tempoline in PLT entry */ +/* Return offset of the temporary in PLT entry */ #define elf_sh_plt_temp_offset(info) 8 /* Return offset of the symbol in PLT entry. */ @@ -6339,7 +6339,8 @@ sh_elf_copy_indirect_symbol (const struct elf_backend_data *bed, dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -6959,19 +6960,7 @@ sh_elf_merge_private_data (bfd *ibfd, bfd *obfd) static bfd_boolean sh_elf_object_p (bfd *abfd) { - struct sh_elf_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct sh_elf_obj_tdata); - - if (!sh_elf_set_mach_from_flags (abfd)) - return FALSE; - - /* Allocate our special target data. */ - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; - return TRUE; + return sh_elf_set_mach_from_flags (abfd); } /* Finish up dynamic symbol handling. We set the contents of various diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c index c3be09f..eac444a 100644 --- a/bfd/elf32-sh64.c +++ b/bfd/elf32-sh64.c @@ -59,8 +59,8 @@ static bfd_boolean sh64_elf_add_symbol_hook (bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *); static bfd_boolean sh64_elf_link_output_symbol_hook - (bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, - asection *); + (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *); static bfd_boolean sh64_backend_section_from_shdr (bfd *, Elf_Internal_Shdr *, const char *); static void sh64_elf_final_write_processing @@ -380,7 +380,7 @@ sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, { /* We want to do this for relocatable as well as final linking. */ if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL - && info->hash->creator->flavour == bfd_target_elf_flavour) + && is_elf_hash_table (info->hash)) { struct elf_link_hash_entry *h; @@ -470,11 +470,11 @@ sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, DataLabel symbol. */ bfd_boolean -sh64_elf_link_output_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +sh64_elf_link_output_symbol_hook (struct bfd_link_info *info, const char *cname, Elf_Internal_Sym *sym, - asection *input_sec ATTRIBUTE_UNUSED) + asection *input_sec ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED) { char *name = (char *) cname; diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index ea3a9b1..f77f22c 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -3340,15 +3340,6 @@ static bfd_boolean elf32_sparc_object_p (abfd) bfd *abfd; { - /* Allocate our special target data. */ - struct elf32_sparc_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct elf32_sparc_obj_tdata); - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; - if (elf_elfheader (abfd)->e_machine == EM_SPARC32PLUS) { if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US3) diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index fb290eb..45bb4f6 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -76,8 +76,8 @@ static bfd_boolean v850_elf_add_symbol_hook PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *)); static bfd_boolean v850_elf_link_output_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const char *, - Elf_Internal_Sym *, asection *)); + PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *)); static bfd_boolean v850_elf_section_from_shdr PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); static bfd_boolean v850_elf_gc_sweep_hook @@ -893,7 +893,7 @@ find_remembered_hi16s_reloc (addend, already_found) /* Extract the address. */ addr = match->address; - /* Remeber if this entry has already been used before. */ + /* Remember if this entry has already been used before. */ if (already_found) * already_found = match->found; @@ -904,7 +904,7 @@ find_remembered_hi16s_reloc (addend, already_found) } /* FIXME: The code here probably ought to be removed and the code in reloc.c - allowed to do its stuff instead. At least for most of the relocs, anwyay. */ + allowed to do its stuff instead. At least for most of the relocs, anyway. */ static bfd_reloc_status_type v850_elf_perform_relocation (abfd, r_type, addend, address) @@ -1362,7 +1362,7 @@ v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err) if (reloc->address > isection->_cooked_size) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ if (reloc->howto->pc_relative) @@ -2213,12 +2213,12 @@ v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) } static bfd_boolean -v850_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec) - bfd *abfd ATTRIBUTE_UNUSED; +v850_elf_link_output_symbol_hook (info, name, sym, input_sec, h) struct bfd_link_info *info ATTRIBUTE_UNUSED; const char *name ATTRIBUTE_UNUSED; Elf_Internal_Sym *sym; asection *input_sec; + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED; { /* If we see a common symbol, which implies a relocatable link, then if a symbol was in a special common section in an input file, mark diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 21fdd9d..c37ca00 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -1338,7 +1338,6 @@ elf_vax_size_dynamic_sections (output_bfd, info) in regular objects. We allocated space for them in the check_relocs routine, but we won't fill them in in the relocate_section routine. */ -/*ARGSUSED*/ static bfd_boolean elf_vax_discard_copies (h, ignore) struct elf_vax_link_hash_entry *h; @@ -1366,7 +1365,6 @@ elf_vax_discard_copies (h, ignore) creating a shared object or executable, space in the .got and .rela.got will be reserved for the symbol. */ -/*ARGSUSED*/ static bfd_boolean elf_vax_instantiate_got_entries (h, infoptr) struct elf_link_hash_entry *h; diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index e8c276b..44450c5 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -47,9 +47,6 @@ static bfd_boolean elf_xtensa_check_relocs const Elf_Internal_Rela *)); static void elf_xtensa_hide_symbol PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean)); -static void elf_xtensa_copy_indirect_symbol - PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *, - struct elf_link_hash_entry *)); static asection *elf_xtensa_gc_mark_hook PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *)); @@ -63,7 +60,7 @@ static bfd_boolean elf_xtensa_adjust_dynamic_symbol static bfd_boolean elf_xtensa_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static bfd_boolean elf_xtensa_modify_segment_map - PARAMS ((bfd *)); + PARAMS ((bfd *, struct bfd_link_info *)); static bfd_boolean elf_xtensa_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); @@ -796,19 +793,6 @@ elf_xtensa_hide_symbol (info, h, force_local) } -static void -elf_xtensa_copy_indirect_symbol (bed, dir, ind) - const struct elf_backend_data *bed; - struct elf_link_hash_entry *dir, *ind; -{ - _bfd_elf_link_hash_copy_indirect (bed, dir, ind); - - /* The standard function doesn't copy the NEEDS_PLT flag. */ - dir->elf_link_hash_flags |= - (ind->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT); -} - - /* Return the section that should be marked against GC for a given relocation. */ @@ -1431,8 +1415,9 @@ elf_xtensa_size_dynamic_sections (output_bfd, info) this and it probably ought to be moved into elf.c as well. */ static bfd_boolean -elf_xtensa_modify_segment_map (abfd) +elf_xtensa_modify_segment_map (abfd, info) bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; { struct elf_segment_map **m_p; @@ -1729,7 +1714,7 @@ bfd_elf_xtensa_reloc (abfd, reloc_entry, symbol, data, input_section, / bfd_octets_per_byte (abfd))) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ @@ -4186,7 +4171,7 @@ analyze_relocations (link_info) expensive and unnecessary unless the target section is actually going to be relaxed. This pass identifies all such sections by checking if they have L32Rs pointing to them. In the process, the total number - of relocations targetting each section is also counted so that we + of relocations targeting each section is also counted so that we know how much space to allocate for source_relocs against each relaxable literal section. */ @@ -5850,7 +5835,6 @@ static struct bfd_elf_special_section const elf_xtensa_special_sections[]= #define elf_backend_adjust_dynamic_symbol elf_xtensa_adjust_dynamic_symbol #define elf_backend_check_relocs elf_xtensa_check_relocs -#define elf_backend_copy_indirect_symbol elf_xtensa_copy_indirect_symbol #define elf_backend_create_dynamic_sections elf_xtensa_create_dynamic_sections #define elf_backend_discard_info elf_xtensa_discard_info #define elf_backend_ignore_discarded_relocs elf_xtensa_ignore_discarded_relocs diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index ac16fb5..6025277 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -393,15 +393,6 @@ static bfd_boolean elf64_alpha_object_p (abfd) bfd *abfd; { - /* Allocate our special target data. */ - struct alpha_elf_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata); - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; - /* Set the right machine number for an Alpha ELF file. */ return bfd_default_set_arch_mach (abfd, bfd_arch_alpha, 0); } @@ -3640,7 +3631,7 @@ elf64_alpha_size_got_sections (info) if (this_got == NULL) continue; - /* We are assuming no merging has yet ocurred. */ + /* We are assuming no merging has yet occurred. */ BFD_ASSERT (this_got == i); if (alpha_elf_tdata (this_got)->total_got_size > MAX_GOT_SIZE) diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 294d643..06aff7b 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -202,8 +202,8 @@ static bfd_boolean elf64_hppa_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static bfd_boolean elf64_hppa_link_output_symbol_hook - PARAMS ((bfd *abfd, struct bfd_link_info *, const char *, - Elf_Internal_Sym *, asection *input_sec)); + PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *)); static bfd_boolean elf64_hppa_finish_dynamic_symbol PARAMS ((bfd *, struct bfd_link_info *, @@ -213,7 +213,7 @@ static int elf64_hppa_additional_program_headers PARAMS ((bfd *)); static bfd_boolean elf64_hppa_modify_segment_map - PARAMS ((bfd *)); + PARAMS ((bfd *, struct bfd_link_info *)); static enum elf_reloc_type_class elf64_hppa_reloc_type_class PARAMS ((const Elf_Internal_Rela *)); @@ -975,7 +975,7 @@ elf64_hppa_dynamic_symbol_p (h, info) return FALSE; } -/* Mark all funtions exported by this file so that we can later allocate +/* Mark all functions exported by this file so that we can later allocate entries in .opd for them. */ static bfd_boolean @@ -1211,7 +1211,7 @@ elf64_hppa_post_process_headers (abfd, link_info) } /* Create function descriptor section (.opd). This section is called .opd - because it contains "official prodecure descriptors". The "official" + because it contains "official procedure descriptors". The "official" refers to the fact that these descriptors are used when taking the address of a procedure, thus ensuring a unique address for each procedure. */ @@ -1893,12 +1893,12 @@ elf64_hppa_size_dynamic_sections (output_bfd, info) table. Ick. */ static bfd_boolean -elf64_hppa_link_output_symbol_hook (abfd, info, name, sym, input_sec) - bfd *abfd ATTRIBUTE_UNUSED; +elf64_hppa_link_output_symbol_hook (info, name, sym, input_sec, h) struct bfd_link_info *info; const char *name; Elf_Internal_Sym *sym; asection *input_sec ATTRIBUTE_UNUSED; + struct elf_link_hash_entry *h; { struct elf64_hppa_link_hash_table *hppa_info; struct elf64_hppa_dyn_hash_entry *dyn_h; @@ -1912,6 +1912,8 @@ elf64_hppa_link_output_symbol_hook (abfd, info, name, sym, input_sec) hppa_info = elf64_hppa_hash_table (info); dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, name, FALSE, FALSE); + if (!dyn_h || dyn_h->h != h) + return TRUE; /* Function symbols for which we created .opd entries *may* have been munged by finish_dynamic_symbol and have to be un-munged here. @@ -1920,7 +1922,7 @@ elf64_hppa_link_output_symbol_hook (abfd, info, name, sym, input_sec) into non-dynamic ones, so we initialize st_shndx to -1 in mark_exported_functions and check to see if it was overwritten here instead of just checking dyn_h->h->dynindx. */ - if (dyn_h && dyn_h->want_opd && dyn_h->st_shndx != -1) + if (dyn_h->want_opd && dyn_h->st_shndx != -1) { /* Restore the saved value and section index. */ sym->st_value = dyn_h->st_value; @@ -2281,7 +2283,7 @@ elf64_hppa_finalize_dlt (dyn_h, data) bfd_put_64 (sdlt->owner, value, sdlt->contents + dyn_h->dlt_offset); } - /* Create a relocation for the DLT entry assocated with this symbol. + /* Create a relocation for the DLT entry associated with this symbol. When building a shared library the symbol does not have to be dynamic. */ if (dyn_h->want_dlt && (elf64_hppa_dynamic_symbol_p (dyn_h->h, info) || info->shared)) @@ -2609,8 +2611,9 @@ elf64_hppa_additional_program_headers (abfd) existence of a .interp section. */ static bfd_boolean -elf64_hppa_modify_segment_map (abfd) +elf64_hppa_modify_segment_map (abfd, info) bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; { struct elf_segment_map *m; asection *s; diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 11d0565..998c5df 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -62,79 +62,76 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ecoffswap.h" static void mips_elf64_swap_reloc_in - PARAMS ((bfd *, const Elf64_Mips_External_Rel *, - Elf64_Mips_Internal_Rela *)); + (bfd *, const Elf64_Mips_External_Rel *, Elf64_Mips_Internal_Rela *); static void mips_elf64_swap_reloca_in - PARAMS ((bfd *, const Elf64_Mips_External_Rela *, - Elf64_Mips_Internal_Rela *)); + (bfd *, const Elf64_Mips_External_Rela *, Elf64_Mips_Internal_Rela *); static void mips_elf64_swap_reloc_out - PARAMS ((bfd *, const Elf64_Mips_Internal_Rela *, - Elf64_Mips_External_Rel *)); + (bfd *, const Elf64_Mips_Internal_Rela *, Elf64_Mips_External_Rel *); static void mips_elf64_swap_reloca_out - PARAMS ((bfd *, const Elf64_Mips_Internal_Rela *, - Elf64_Mips_External_Rela *)); + (bfd *, const Elf64_Mips_Internal_Rela *, Elf64_Mips_External_Rela *); static void mips_elf64_be_swap_reloc_in - PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *)); + (bfd *, const bfd_byte *, Elf_Internal_Rela *); static void mips_elf64_be_swap_reloc_out - PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *)); + (bfd *, const Elf_Internal_Rela *, bfd_byte *); static void mips_elf64_be_swap_reloca_in - PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *)); + (bfd *, const bfd_byte *, Elf_Internal_Rela *); static void mips_elf64_be_swap_reloca_out - PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *)); + (bfd *, const Elf_Internal_Rela *, bfd_byte *); static reloc_howto_type *bfd_elf64_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); + (bfd *, bfd_reloc_code_real_type); static reloc_howto_type *mips_elf64_rtype_to_howto - PARAMS ((unsigned int, bfd_boolean)); + (unsigned int, bfd_boolean); static void mips_elf64_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); static void mips_elf64_info_to_howto_rela - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); static long mips_elf64_get_reloc_upper_bound - PARAMS ((bfd *, asection *)); + (bfd *, asection *); static long mips_elf64_canonicalize_reloc - PARAMS ((bfd *, asection *, arelent **, asymbol **)); -static long mips_elf64_get_dynamic_reloc_upper_bound PARAMS ((bfd *)); + (bfd *, asection *, arelent **, asymbol **); +static long mips_elf64_get_dynamic_reloc_upper_bound + (bfd *); static long mips_elf64_canonicalize_dynamic_reloc - PARAMS ((bfd *, arelent **, asymbol **)); + (bfd *, arelent **, asymbol **); static bfd_boolean mips_elf64_slurp_one_reloc_table - PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type, - arelent *, asymbol **, bfd_boolean)); + (bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type, arelent *, + asymbol **, bfd_boolean); static bfd_boolean mips_elf64_slurp_reloc_table - PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); + (bfd *, asection *, asymbol **, bfd_boolean); static void mips_elf64_write_relocs - PARAMS ((bfd *, asection *, PTR)); + (bfd *, asection *, void *); static void mips_elf64_write_rel - PARAMS((bfd *, asection *, Elf_Internal_Shdr *, int *, PTR)); + (bfd *, asection *, Elf_Internal_Shdr *, int *, void *); static void mips_elf64_write_rela - PARAMS((bfd *, asection *, Elf_Internal_Shdr *, int *, PTR)); + (bfd *, asection *, Elf_Internal_Shdr *, int *, void *); static bfd_reloc_status_type mips_elf64_hi16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_gprel16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_literal_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_gprel32_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_shift6_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf64_got16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_jump_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_gprel_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_boolean mips_elf64_assign_gp - PARAMS ((bfd *, bfd_vma *)); + (bfd *, bfd_vma *); static bfd_reloc_status_type mips_elf64_final_gp - PARAMS ((bfd *, asymbol *, bfd_boolean, char **, bfd_vma *)); + (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *); static bfd_boolean mips_elf64_object_p - PARAMS ((bfd *)); + (bfd *); static irix_compat_t elf64_mips_irix_compat - PARAMS ((bfd *)); + (bfd *); static bfd_boolean elf64_mips_grok_prstatus - PARAMS ((bfd *, Elf_Internal_Note *)); + (bfd *, Elf_Internal_Note *); static bfd_boolean elf64_mips_grok_psinfo - PARAMS ((bfd *, Elf_Internal_Note *)); + (bfd *, Elf_Internal_Note *); extern const bfd_target bfd_elf64_bigmips_vec; extern const bfd_target bfd_elf64_littlemips_vec; @@ -475,7 +472,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 64 bit substraction. */ + /* 64 bit subtraction. */ HOWTO (R_MIPS_SUB, /* type */ 0, /* rightshift */ 4, /* size (0 = byte, 1 = short, 2 = long) */ @@ -970,7 +967,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 64 bit substraction. */ + /* 64 bit subtraction. */ HOWTO (R_MIPS_SUB, /* type */ 0, /* rightshift */ 4, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1262,10 +1259,8 @@ static reloc_howto_type elf_mips_gnu_rela16_s2 = /* Swap in a MIPS 64-bit Rel reloc. */ static void -mips_elf64_swap_reloc_in (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_External_Rel *src; - Elf64_Mips_Internal_Rela *dst; +mips_elf64_swap_reloc_in (bfd *abfd, const Elf64_Mips_External_Rel *src, + Elf64_Mips_Internal_Rela *dst) { dst->r_offset = H_GET_64 (abfd, src->r_offset); dst->r_sym = H_GET_32 (abfd, src->r_sym); @@ -1279,10 +1274,8 @@ mips_elf64_swap_reloc_in (abfd, src, dst) /* Swap in a MIPS 64-bit Rela reloc. */ static void -mips_elf64_swap_reloca_in (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_External_Rela *src; - Elf64_Mips_Internal_Rela *dst; +mips_elf64_swap_reloca_in (bfd *abfd, const Elf64_Mips_External_Rela *src, + Elf64_Mips_Internal_Rela *dst) { dst->r_offset = H_GET_64 (abfd, src->r_offset); dst->r_sym = H_GET_32 (abfd, src->r_sym); @@ -1296,10 +1289,8 @@ mips_elf64_swap_reloca_in (abfd, src, dst) /* Swap out a MIPS 64-bit Rel reloc. */ static void -mips_elf64_swap_reloc_out (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_Internal_Rela *src; - Elf64_Mips_External_Rel *dst; +mips_elf64_swap_reloc_out (bfd *abfd, const Elf64_Mips_Internal_Rela *src, + Elf64_Mips_External_Rel *dst) { H_PUT_64 (abfd, src->r_offset, dst->r_offset); H_PUT_32 (abfd, src->r_sym, dst->r_sym); @@ -1312,10 +1303,8 @@ mips_elf64_swap_reloc_out (abfd, src, dst) /* Swap out a MIPS 64-bit Rela reloc. */ static void -mips_elf64_swap_reloca_out (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_Internal_Rela *src; - Elf64_Mips_External_Rela *dst; +mips_elf64_swap_reloca_out (bfd *abfd, const Elf64_Mips_Internal_Rela *src, + Elf64_Mips_External_Rela *dst) { H_PUT_64 (abfd, src->r_offset, dst->r_offset); H_PUT_32 (abfd, src->r_sym, dst->r_sym); @@ -1329,10 +1318,8 @@ mips_elf64_swap_reloca_out (abfd, src, dst) /* Swap in a MIPS 64-bit Rel reloc. */ static void -mips_elf64_be_swap_reloc_in (abfd, src, dst) - bfd *abfd; - const bfd_byte *src; - Elf_Internal_Rela *dst; +mips_elf64_be_swap_reloc_in (bfd *abfd, const bfd_byte *src, + Elf_Internal_Rela *dst) { Elf64_Mips_Internal_Rela mirel; @@ -1354,10 +1341,8 @@ mips_elf64_be_swap_reloc_in (abfd, src, dst) /* Swap in a MIPS 64-bit Rela reloc. */ static void -mips_elf64_be_swap_reloca_in (abfd, src, dst) - bfd *abfd; - const bfd_byte *src; - Elf_Internal_Rela *dst; +mips_elf64_be_swap_reloca_in (bfd *abfd, const bfd_byte *src, + Elf_Internal_Rela *dst) { Elf64_Mips_Internal_Rela mirela; @@ -1379,10 +1364,8 @@ mips_elf64_be_swap_reloca_in (abfd, src, dst) /* Swap out a MIPS 64-bit Rel reloc. */ static void -mips_elf64_be_swap_reloc_out (abfd, src, dst) - bfd *abfd; - const Elf_Internal_Rela *src; - bfd_byte *dst; +mips_elf64_be_swap_reloc_out (bfd *abfd, const Elf_Internal_Rela *src, + bfd_byte *dst) { Elf64_Mips_Internal_Rela mirel; @@ -1405,10 +1388,8 @@ mips_elf64_be_swap_reloc_out (abfd, src, dst) /* Swap out a MIPS 64-bit Rela reloc. */ static void -mips_elf64_be_swap_reloca_out (abfd, src, dst) - bfd *abfd; - const Elf_Internal_Rela *src; - bfd_byte *dst; +mips_elf64_be_swap_reloca_out (bfd *abfd, const Elf_Internal_Rela *src, + bfd_byte *dst) { Elf64_Mips_Internal_Rela mirela; @@ -1433,19 +1414,14 @@ mips_elf64_be_swap_reloca_out (abfd, src, dst) /* Do a R_MIPS_HI16 relocation. */ static bfd_reloc_status_type -mips_elf64_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf64_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1477,19 +1453,13 @@ mips_elf64_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, not yet know how to create global offset tables. */ static bfd_reloc_status_type -mips_elf64_got16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf64_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { /* If we're relocating, and this is a local symbol, we can handle it just like an R_MIPS_HI16. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && ((symbol->flags & BSF_SECTION_SYM) != 0 || (symbol->flags & BSF_LOCAL) == 0)) return mips_elf64_hi16_reloc (abfd, reloc_entry, symbol, data, @@ -1505,9 +1475,7 @@ mips_elf64_got16_reloc (abfd, reloc_entry, symbol, data, input_section, dangerous relocation. */ static bfd_boolean -mips_elf64_assign_gp (output_bfd, pgp) - bfd *output_bfd; - bfd_vma *pgp; +mips_elf64_assign_gp (bfd *output_bfd, bfd_vma *pgp) { unsigned int count; asymbol **sym; @@ -1523,7 +1491,7 @@ mips_elf64_assign_gp (output_bfd, pgp) /* The linker script will have created a symbol named `_gp' with the appropriate value. */ - if (sym == (asymbol **) NULL) + if (sym == NULL) i = count; else { @@ -1559,12 +1527,8 @@ mips_elf64_assign_gp (output_bfd, pgp) external symbol if we are producing relocatable output. */ static bfd_reloc_status_type -mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message, pgp) - bfd *output_bfd; - asymbol *symbol; - bfd_boolean relocatable; - char **error_message; - bfd_vma *pgp; +mips_elf64_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable, + char **error_message, bfd_vma *pgp) { if (bfd_is_und_section (symbol->section) && ! relocatable) @@ -1599,15 +1563,9 @@ mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message, pgp) become the offset from the gp register. */ static bfd_reloc_status_type -mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf64_gprel16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1615,7 +1573,7 @@ mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1623,7 +1581,7 @@ mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_ok; } - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1644,15 +1602,9 @@ mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, /* Do a R_MIPS_LITERAL relocation. */ static bfd_reloc_status_type -mips_elf64_literal_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf64_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1660,7 +1612,7 @@ mips_elf64_literal_reloc (abfd, reloc_entry, symbol, data, input_section, /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1669,7 +1621,7 @@ mips_elf64_literal_reloc (abfd, reloc_entry, symbol, data, input_section, } /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */ - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1691,15 +1643,9 @@ mips_elf64_literal_reloc (abfd, reloc_entry, symbol, data, input_section, become the offset from the gp register. */ static bfd_reloc_status_type -mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1709,7 +1655,7 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1718,7 +1664,7 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_outofrange; } - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1770,19 +1716,14 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, the rest is at bits 6-10. The bitpos already got right by the howto. */ static bfd_reloc_status_type -mips_elf64_shift6_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf64_shift6_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { /* If we're relocating, and this is an external symbol, we don't want to change anything. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1802,17 +1743,12 @@ mips_elf64_shift6_reloc (abfd, reloc_entry, symbol, data, input_section, /* Handle a mips16 jump. */ static bfd_reloc_status_type -mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (! reloc_entry->howto->partial_inplace || reloc_entry->addend == 0)) @@ -1838,15 +1774,9 @@ mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, /* Handle a mips16 GP relative reloc. */ static bfd_reloc_status_type -mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1913,13 +1843,10 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, if (reloc_entry->howto->partial_inplace) { bfd_put_16 (abfd, - (bfd_vma) ((extend & 0xf800) - | ((val >> 11) & 0x1f) - | (val & 0x7e0)), + (extend & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0), (bfd_byte *) data + reloc_entry->address); bfd_put_16 (abfd, - (bfd_vma) ((insn & 0xffe0) - | (val & 0x1f)), + (insn & 0xffe0) | (val & 0x1f), (bfd_byte *) data + reloc_entry->address + 2); } else @@ -1982,9 +1909,8 @@ static const struct elf_reloc_map mips_reloc_map[] = /* Given a BFD reloc type, return a howto structure. */ static reloc_howto_type * -bfd_elf64_bfd_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { unsigned int i; /* FIXME: We default to RELA here instead of choosing the right @@ -2019,9 +1945,7 @@ bfd_elf64_bfd_reloc_type_lookup (abfd, code) /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static reloc_howto_type * -mips_elf64_rtype_to_howto (r_type, rela_p) - unsigned int r_type; - bfd_boolean rela_p; +mips_elf64_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p) { switch (r_type) { @@ -2051,19 +1975,17 @@ mips_elf64_rtype_to_howto (r_type, rela_p) /* Prevent relocation handling by bfd for MIPS ELF64. */ static void -mips_elf64_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr ATTRIBUTE_UNUSED; - Elf_Internal_Rela *dst ATTRIBUTE_UNUSED; +mips_elf64_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr ATTRIBUTE_UNUSED, + Elf_Internal_Rela *dst ATTRIBUTE_UNUSED) { BFD_ASSERT (0); } static void -mips_elf64_info_to_howto_rela (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr ATTRIBUTE_UNUSED; - Elf_Internal_Rela *dst ATTRIBUTE_UNUSED; +mips_elf64_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr ATTRIBUTE_UNUSED, + Elf_Internal_Rela *dst ATTRIBUTE_UNUSED) { BFD_ASSERT (0); } @@ -2072,16 +1994,13 @@ mips_elf64_info_to_howto_rela (abfd, cache_ptr, dst) to three relocs, we must tell the user to allocate more space. */ static long -mips_elf64_get_reloc_upper_bound (abfd, sec) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec; +mips_elf64_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) { return (sec->reloc_count * 3 + 1) * sizeof (arelent *); } static long -mips_elf64_get_dynamic_reloc_upper_bound (abfd) - bfd *abfd; +mips_elf64_get_dynamic_reloc_upper_bound (bfd *abfd) { return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 3; } @@ -2092,11 +2011,8 @@ mips_elf64_get_dynamic_reloc_upper_bound (abfd) 3 to obtain the internal relocation count. */ static long -mips_elf64_canonicalize_reloc (abfd, section, relptr, symbols) - bfd *abfd; - sec_ptr section; - arelent **relptr; - asymbol **symbols; +mips_elf64_canonicalize_reloc (bfd *abfd, sec_ptr section, + arelent **relptr, asymbol **symbols) { arelent *tblptr; unsigned int i; @@ -2115,13 +2031,10 @@ mips_elf64_canonicalize_reloc (abfd, section, relptr, symbols) } static long -mips_elf64_canonicalize_dynamic_reloc (abfd, storage, syms) - bfd *abfd; - arelent **storage; - asymbol **syms; +mips_elf64_canonicalize_dynamic_reloc (bfd *abfd, arelent **storage, + asymbol **syms) { - bfd_boolean (*slurp_relocs) - PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); + bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean); asection *s; long ret; @@ -2164,24 +2077,20 @@ mips_elf64_canonicalize_dynamic_reloc (abfd, storage, syms) generic code seems to depend on this. */ static bfd_boolean -mips_elf64_slurp_one_reloc_table (abfd, asect, rel_hdr, reloc_count, - relents, symbols, dynamic) - bfd *abfd; - asection *asect; - Elf_Internal_Shdr *rel_hdr; - bfd_size_type reloc_count; - arelent *relents; - asymbol **symbols; - bfd_boolean dynamic; +mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect, + Elf_Internal_Shdr *rel_hdr, + bfd_size_type reloc_count, + arelent *relents, asymbol **symbols, + bfd_boolean dynamic) { - PTR allocated = NULL; + void *allocated; bfd_byte *native_relocs; arelent *relent; bfd_vma i; int entsize; reloc_howto_type *howto_table; - allocated = (PTR) bfd_malloc (rel_hdr->sh_size); + allocated = bfd_malloc (rel_hdr->sh_size); if (allocated == NULL) return FALSE; @@ -2190,7 +2099,7 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, rel_hdr, reloc_count, != rel_hdr->sh_size)) goto error_return; - native_relocs = (bfd_byte *) allocated; + native_relocs = allocated; entsize = rel_hdr->sh_entsize; BFD_ASSERT (entsize == sizeof (Elf64_Mips_External_Rel) @@ -2338,11 +2247,8 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, rel_hdr, reloc_count, zero before processing the relocs of a section. */ static bfd_boolean -mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic) - bfd *abfd; - asection *asect; - asymbol **symbols; - bfd_boolean dynamic; +mips_elf64_slurp_reloc_table (bfd *abfd, asection *asect, + asymbol **symbols, bfd_boolean dynamic) { struct bfd_elf_section_data * const d = elf_section_data (asect); Elf_Internal_Shdr *rel_hdr; @@ -2388,7 +2294,7 @@ mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic) /* Allocate space for 3 arelent structures for each Rel structure. */ amt = (reloc_count + reloc_count2) * 3 * sizeof (arelent); - relents = (arelent *) bfd_alloc (abfd, amt); + relents = bfd_alloc (abfd, amt); if (relents == NULL) return FALSE; @@ -2416,12 +2322,9 @@ mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic) /* Write out the relocations. */ static void -mips_elf64_write_relocs (abfd, sec, data) - bfd *abfd; - asection *sec; - PTR data; +mips_elf64_write_relocs (bfd *abfd, asection *sec, void *data) { - bfd_boolean *failedp = (bfd_boolean *) data; + bfd_boolean *failedp = data; int count; Elf_Internal_Shdr *rel_hdr; unsigned int idx; @@ -2482,21 +2385,18 @@ mips_elf64_write_relocs (abfd, sec, data) } static void -mips_elf64_write_rel (abfd, sec, rel_hdr, count, data) - bfd *abfd; - asection *sec; - Elf_Internal_Shdr *rel_hdr; - int *count; - PTR data; +mips_elf64_write_rel (bfd *abfd, asection *sec, + Elf_Internal_Shdr *rel_hdr, + int *count, void *data) { - bfd_boolean *failedp = (bfd_boolean *) data; + bfd_boolean *failedp = data; Elf64_Mips_External_Rel *ext_rel; unsigned int idx; asymbol *last_sym = 0; int last_sym_idx = 0; - rel_hdr->sh_size = (bfd_vma)(rel_hdr->sh_entsize * *count); - rel_hdr->contents = (PTR) bfd_alloc (abfd, rel_hdr->sh_size); + rel_hdr->sh_size = rel_hdr->sh_entsize * *count; + rel_hdr->contents = bfd_alloc (abfd, rel_hdr->sh_size); if (rel_hdr->contents == NULL) { *failedp = TRUE; @@ -2581,21 +2481,18 @@ mips_elf64_write_rel (abfd, sec, rel_hdr, count, data) } static void -mips_elf64_write_rela (abfd, sec, rela_hdr, count, data) - bfd *abfd; - asection *sec; - Elf_Internal_Shdr *rela_hdr; - int *count; - PTR data; +mips_elf64_write_rela (bfd *abfd, asection *sec, + Elf_Internal_Shdr *rela_hdr, + int *count, void *data) { - bfd_boolean *failedp = (bfd_boolean *) data; + bfd_boolean *failedp = data; Elf64_Mips_External_Rela *ext_rela; unsigned int idx; asymbol *last_sym = 0; int last_sym_idx = 0; - rela_hdr->sh_size = (bfd_vma)(rela_hdr->sh_entsize * *count); - rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size); + rela_hdr->sh_size = rela_hdr->sh_entsize * *count; + rela_hdr->contents = bfd_alloc (abfd, rela_hdr->sh_size); if (rela_hdr->contents == NULL) { *failedp = TRUE; @@ -2683,8 +2580,7 @@ mips_elf64_write_rela (abfd, sec, rela_hdr, count, data) /* Set the right machine number for a MIPS ELF file. */ static bfd_boolean -mips_elf64_object_p (abfd) - bfd *abfd; +mips_elf64_object_p (bfd *abfd) { unsigned long mach; @@ -2702,8 +2598,7 @@ mips_elf64_object_p (abfd) /* Depending on the target vector we generate some version of Irix executables or "normal" MIPS ELF ABI executables. */ static irix_compat_t -elf64_mips_irix_compat (abfd) - bfd *abfd; +elf64_mips_irix_compat (bfd *abfd) { if ((abfd->xvec == &bfd_elf64_bigmips_vec) || (abfd->xvec == &bfd_elf64_littlemips_vec)) @@ -2714,9 +2609,7 @@ elf64_mips_irix_compat (abfd) /* Support for core dump NOTE sections. */ static bfd_boolean -elf64_mips_grok_prstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf64_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; unsigned int raw_size; @@ -2746,9 +2639,7 @@ elf64_mips_grok_prstatus (abfd, note) } static bfd_boolean -elf64_mips_grok_psinfo (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf64_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) { switch (note->descsz) { @@ -2948,9 +2839,9 @@ const struct elf_size_info mips_elf64_size_info = /* MIPS ELF64 archive functions. */ #define bfd_elf64_archive_functions extern bfd_boolean bfd_elf64_archive_slurp_armap - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean bfd_elf64_archive_write_armap - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); + (bfd *, unsigned int, struct orl *, unsigned int, int); #define bfd_elf64_archive_slurp_extended_name_table \ _bfd_archive_coff_slurp_extended_name_table #define bfd_elf64_archive_construct_extended_name_table \ diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 6440dcb..ca627ef 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -157,8 +157,8 @@ struct bpo_greg_section_info }; static bfd_boolean mmix_elf_link_output_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const char *, - Elf_Internal_Sym *, asection *)); + PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *)); static bfd_reloc_status_type mmix_elf_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); @@ -1280,7 +1280,7 @@ mmix_elf_reloc (abfd, reloc_entry, symbol, data, input_section, if (reloc_entry->address > input_section->_cooked_size) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ @@ -2113,12 +2113,12 @@ _bfd_mmix_check_all_relocs (abfd, info) number. */ static bfd_boolean -mmix_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec) - bfd *abfd ATTRIBUTE_UNUSED; +mmix_elf_link_output_symbol_hook (info, name, sym, input_sec, h) struct bfd_link_info *info ATTRIBUTE_UNUSED; const char *name ATTRIBUTE_UNUSED; Elf_Internal_Sym *sym; asection *input_sec; + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED; { if (input_sec != NULL && input_sec->name != NULL diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 8ae3f12..3ed9042 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -92,6 +92,7 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc #define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol #define elf_backend_reloc_type_class ppc64_elf_reloc_type_class #define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections +#define elf_backend_link_output_symbol_hook ppc64_elf_output_symbol_hook #define elf_backend_special_sections ppc64_elf_special_sections /* The name of the dynamic interpreter. This is put in the .interp @@ -2641,7 +2642,7 @@ struct plt_entry pointers must reference the descriptor. Thus, a function pointer initialized to the address of a function in a shared library will either require a copy reloc, or a dynamic reloc. Using a copy reloc - redefines the function desctriptor symbol to point to the copy. This + redefines the function descriptor symbol to point to the copy. This presents a problem as a plt entry for that function is also initialized from the function descriptor symbol and the copy reloc may not be initialized first. */ @@ -2762,6 +2763,9 @@ struct ppc_link_hash_entry unsigned int is_func_descriptor:1; unsigned int is_entry:1; + /* Whether global opd sym has been adjusted or not. */ + unsigned int adjust_done:1; + /* Contexts in which symbol is used in the GOT (or TOC). TLS_GD .. TLS_EXPLICIT bits are or'd into the mask as the corresponding relocs are encountered during check_relocs. @@ -2971,6 +2975,7 @@ link_hash_newfunc (struct bfd_hash_entry *entry, eh->is_func = 0; eh->is_func_descriptor = 0; eh->is_entry = 0; + eh->adjust_done = 0; eh->tls_mask = 0; } @@ -3359,7 +3364,8 @@ ppc64_elf_copy_indirect_symbol edir->tls_mask |= eind->tls_mask; mask = (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK | ELF_LINK_NON_GOT_REF); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK | ELF_LINK_NON_GOT_REF + | ELF_LINK_HASH_NEEDS_PLT); /* If called to transfer flags for a weakdef during processing of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. We clear it ourselves for ELIMINATE_COPY_RELOCS. */ @@ -4874,10 +4880,53 @@ get_tls_mask (char **tls_maskp, unsigned long *toc_symndx, return 1; } +/* Adjust all global syms defined in opd sections. In gcc generated + code these will already have been done, but I suppose we have to + cater for all sorts of hand written assembly. */ + +static bfd_boolean +adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED) +{ + struct ppc_link_hash_entry *eh; + asection *sym_sec; + long *opd_adjust; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + return TRUE; + + eh = (struct ppc_link_hash_entry *) h; + if (eh->adjust_done) + return TRUE; + + sym_sec = eh->elf.root.u.def.section; + if (sym_sec != NULL + && elf_section_data (sym_sec) != NULL + && (opd_adjust = ppc64_elf_section_data (sym_sec)->opd.adjust) != NULL) + { + eh->elf.root.u.def.value += opd_adjust[eh->elf.root.u.def.value / 24]; + eh->adjust_done = 1; + } + return TRUE; +} + +/* Remove unused Official Procedure Descriptor entries. Currently we + only remove those associated with functions in discarded link-once + sections, or weakly defined functions that have been overridden. It + would be possible to remove many more entries for statically linked + applications. */ + bfd_boolean ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) { bfd *ibfd; + bfd_boolean some_edited = FALSE; for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) { @@ -5078,23 +5127,25 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) if (h != NULL) { - /* Redefine the function descriptor symbol - to this location in the opd section. - We've checked above that opd relocs are - ordered. */ + /* Redefine the function descriptor symbol to + this location in the opd section. It is + necessary to update the value here rather + than using an array of adjustments as we do + for local symbols, because various places + in the generic ELF code use the value + stored in u.def.value. */ fdh->elf.root.u.def.value = wptr - sec->contents; - } - else - { - /* Local syms are a bit tricky. We could - tweak them as they can be cached, but - we'd need to look through the local syms - for the function descriptor sym which we - don't have at the moment. So keep an - array of adjustments. */ - adjust[rel->r_offset / 24] = wptr - rptr; + fdh->adjust_done = 1; } + /* Local syms are a bit tricky. We could + tweak them as they can be cached, but + we'd need to look through the local syms + for the function descriptor sym which we + don't have at the moment. So keep an + array of adjustments. */ + adjust[rel->r_offset / 24] = wptr - rptr; + if (wptr != rptr) memcpy (wptr, rptr, 24); wptr += 24; @@ -5152,6 +5203,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) elf_section_data (sec)->rel_hdr.sh_size = sec->reloc_count * elf_section_data (sec)->rel_hdr.sh_entsize; BFD_ASSERT (elf_section_data (sec)->rel_hdr2 == NULL); + some_edited = TRUE; } else if (elf_section_data (sec)->relocs != relstart) free (relstart); @@ -5166,6 +5218,9 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) } } + if (some_edited) + elf_link_hash_traverse (elf_hash_table (info), adjust_opd_syms, NULL); + return TRUE; } @@ -5261,7 +5316,17 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) value = h->root.u.def.value; } else - value = sym->st_value; + { + value = sym->st_value; + + if (elf_section_data (sym_sec) != NULL) + { + long *adjust; + adjust = ppc64_elf_section_data (sym_sec)->opd.adjust; + if (adjust != NULL) + value += adjust[value / 24]; + } + } ok_tprel = FALSE; is_local = FALSE; @@ -6069,8 +6134,9 @@ ppc_type_of_stub (asection *input_sec, } } - if (h->elf.root.type != bfd_link_hash_defined - && h->elf.root.type != bfd_link_hash_defweak) + if (!(h->elf.root.type == bfd_link_hash_defined + || h->elf.root.type == bfd_link_hash_defweak) + || h->elf.root.u.def.section->output_section == NULL) return ppc_stub_none; } @@ -6565,6 +6631,9 @@ toc_adjusting_stub_needed (struct bfd_link_info *info, asection *isec) if ((isec->flags & SEC_LINKER_CREATED) != 0) return 0; + if (isec->_raw_size == 0) + return 0; + /* Hack for linux kernel. .fixup contains branches, but only back to the function that hit an exception. */ branch_ok = strcmp (isec->name, ".fixup") == 0; @@ -7397,7 +7466,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, long *opd_sym_adjust; opd_sym_adjust = ppc64_elf_section_data (sec)->opd.adjust; - if (opd_sym_adjust != NULL && sym->st_value % 24 == 0) + if (opd_sym_adjust != NULL) relocation += opd_sym_adjust[sym->st_value / 24]; } } @@ -8668,6 +8737,32 @@ ppc64_elf_relocate_section (bfd *output_bfd, return ret; } +/* Adjust the value of any local symbols in opd sections. */ + +static bfd_boolean +ppc64_elf_output_symbol_hook (struct bfd_link_info *info, + const char *name ATTRIBUTE_UNUSED, + Elf_Internal_Sym *elfsym, + asection *input_sec, + struct elf_link_hash_entry *h) +{ + long *adjust; + bfd_vma value; + + if (h != NULL + || input_sec == NULL + || ppc64_elf_section_data (input_sec) == NULL + || (adjust = ppc64_elf_section_data (input_sec)->opd.adjust) == NULL) + return TRUE; + + value = elfsym->st_value - input_sec->output_offset; + if (!info->relocatable) + value -= input_sec->output_section->vma; + + elfsym->st_value += adjust[value / 24]; + return TRUE; +} + /* Finish up dynamic symbol handling. We set the contents of various dynamic sections here. */ diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 6e72ced..2260248 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -638,14 +638,6 @@ static bfd_boolean elf_s390_object_p (abfd) bfd *abfd; { - /* Allocate our special target data. */ - struct elf_s390_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct elf_s390_obj_tdata); - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; /* Set the right machine number for an s390 elf32 file. */ return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_64); } @@ -867,7 +859,8 @@ elf_s390_copy_indirect_symbol (bed, dir, ind) dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -2605,9 +2598,41 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, else { /* This symbol is local, or marked to become local. */ - relocate = TRUE; - outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE); outrel.r_addend = relocation + rel->r_addend; + if (r_type == R_390_64) + { + relocate = TRUE; + outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE); + } + else + { + long sindx; + + if (bfd_is_abs_section (sec)) + sindx = 0; + else if (sec == NULL || sec->owner == NULL) + { + bfd_set_error(bfd_error_bad_value); + return FALSE; + } + else + { + asection *osec; + + osec = sec->output_section; + sindx = elf_section_data (osec)->dynindx; + BFD_ASSERT (sindx > 0); + + /* We are turning this relocation into one + against a section symbol, so subtract out + the output section's address but not the + offset of the input section in the output + section. */ + + outrel.r_addend -= osec->vma; + } + outrel.r_info = ELF64_R_INFO (sindx, r_type); + } } sreloc = elf_section_data (input_section)->sreloc; diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index db096a5..15c2992 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -144,8 +144,8 @@ static bfd_boolean sh64_elf64_add_symbol_hook (bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *); static bfd_boolean sh64_elf64_link_output_symbol_hook - (bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, - asection *); + (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *); static bfd_boolean sh64_elf64_fake_sections (bfd *, Elf_Internal_Shdr *, asection *); static void sh64_elf64_final_write_processing @@ -2892,7 +2892,7 @@ sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, { /* We want to do this for relocatable as well as final linking. */ if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL - && info->hash->creator->flavour == bfd_target_elf_flavour) + && is_elf_hash_table (info->hash)) { struct elf_link_hash_entry *h; @@ -2982,11 +2982,11 @@ sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, DataLabel symbol. */ static bfd_boolean -sh64_elf64_link_output_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info, +sh64_elf64_link_output_symbol_hook (struct bfd_link_info *info, const char *cname, Elf_Internal_Sym *sym, - asection *input_sec ATTRIBUTE_UNUSED) + asection *input_sec ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED) { char *name = (char *) cname; diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 92609e2..4224310 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -65,7 +65,8 @@ static bfd_boolean sparc64_elf_add_symbol_hook const char **, flagword *, asection **, bfd_vma *)); static bfd_boolean sparc64_elf_output_arch_syms PARAMS ((bfd *, struct bfd_link_info *, PTR, - bfd_boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *))); + bfd_boolean (*) (PTR, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *))); static void sparc64_elf_symbol_processing PARAMS ((bfd *, asymbol *)); @@ -1502,7 +1503,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) return TRUE; } -/* This function takes care of emiting STT_REGISTER symbols +/* This function takes care of emitting STT_REGISTER symbols which we cannot easily keep in the symbol hash table. */ static bfd_boolean @@ -1511,7 +1512,8 @@ sparc64_elf_output_arch_syms (output_bfd, info, finfo, func) struct bfd_link_info *info; PTR finfo; bfd_boolean (*func) - PARAMS ((PTR, const char *, Elf_Internal_Sym *, asection *)); + PARAMS ((PTR, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *)); { int reg; struct sparc64_elf_app_reg *app_regs = @@ -1557,7 +1559,8 @@ sparc64_elf_output_arch_syms (output_bfd, info, finfo, func) sym.st_shndx = app_regs [reg].shndx; if (! (*func) (finfo, app_regs [reg].name, &sym, sym.st_shndx == SHN_ABS - ? bfd_abs_section_ptr : bfd_und_section_ptr)) + ? bfd_abs_section_ptr : bfd_und_section_ptr, + NULL)) return FALSE; } diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 4cfcba5..a688620 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -560,7 +560,8 @@ elf64_x86_64_copy_indirect_symbol (const struct elf_backend_data *bed, dir->elf_link_hash_flags |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); else _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -578,14 +579,6 @@ elf64_x86_64_mkobject (bfd *abfd) static bfd_boolean elf64_x86_64_elf_object_p (bfd *abfd) { - /* Allocate our special target data. */ - struct elf64_x86_64_obj_tdata *new_tdata; - bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata); - new_tdata = bfd_zalloc (abfd, amt); - if (new_tdata == NULL) - return FALSE; - new_tdata->root = *abfd->tdata.elf_obj_data; - abfd->tdata.any = new_tdata; /* Set the right machine number for an x86-64 elf64 file. */ bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64); return TRUE; diff --git a/bfd/elflink.c b/bfd/elflink.c index 919de9c..f58a67a 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -117,7 +117,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) struct bfd_link_hash_entry *bh; const struct elf_backend_data *bed; - if (! is_elf_hash_table (info)) + if (! is_elf_hash_table (info->hash)) return FALSE; if (elf_hash_table (info)->dynamic_sections_created) @@ -144,8 +144,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) return FALSE; } - if (! info->traditional_format - && info->hash->creator->flavour == bfd_target_elf_flavour) + if (! info->traditional_format) { s = bfd_make_section (abfd, ".eh_frame_hdr"); if (s == NULL @@ -424,7 +423,7 @@ bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED, { struct elf_link_hash_entry *h; - if (info->hash->creator->flavour != bfd_target_elf_flavour) + if (!is_elf_hash_table (info->hash)) return TRUE; h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, TRUE, FALSE); @@ -494,7 +493,7 @@ elf_link_record_local_dynamic_symbol (struct bfd_link_info *info, Elf_External_Sym_Shndx eshndx; char esym[sizeof (Elf64_External_Sym)]; - if (! is_elf_hash_table (info)) + if (! is_elf_hash_table (info->hash)) return 0; /* See if the entry exists already. */ @@ -795,7 +794,7 @@ _bfd_elf_merge_symbol (bfd *abfd, else olddef = TRUE; - /* We need to rememeber if a symbol has a definition in a dynamic + /* We need to remember if a symbol has a definition in a dynamic object or is weak in all dynamic objects. Internal and hidden visibility will make it unavailable to dynamic objects. */ if (newdyn && (h->elf_link_hash_flags & ELF_LINK_DYNAMIC_DEF) == 0) @@ -858,7 +857,7 @@ _bfd_elf_merge_symbol (bfd *abfd, return TRUE; } - /* We need to treat weak definiton right, depending on if there is a + /* We need to treat weak definition right, depending on if there is a definition from a dynamic object. */ if (bind == STB_WEAK) { @@ -1127,7 +1126,7 @@ _bfd_elf_merge_symbol (bfd *abfd, h->size, abfd, bfd_link_hash_common, sym->st_size))) return FALSE; - /* If the predumed common symbol in the dynamic object is + /* If the presumed common symbol in the dynamic object is larger, pretend that the new symbol has its size. */ if (h->size > *pvalue) @@ -1257,7 +1256,7 @@ _bfd_elf_add_default_symbol (bfd *abfd, if (override) { - /* We are overridden by an old defition. We need to check if we + /* We are overridden by an old definition. We need to check if we need to create the indirect symbol from the default name. */ hi = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, FALSE, FALSE); @@ -1416,7 +1415,7 @@ nondefault: { /* Here SHORTNAME is a versioned name, so we don't expect to see the type of override we do in the case above unless it is - overridden by a versioned definiton. */ + overridden by a versioned definition. */ if (hi->root.type != bfd_link_hash_defined && hi->root.type != bfd_link_hash_defweak) (*_bfd_error_handler) @@ -2206,7 +2205,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, will force it local. */ if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0 && eif->info->shared - && is_elf_hash_table (eif->info) + && is_elf_hash_table (eif->info->hash) && (eif->info->symbolic || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) @@ -2276,7 +2275,7 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data) bfd *dynobj; const struct elf_backend_data *bed; - if (! is_elf_hash_table (eif->info)) + if (! is_elf_hash_table (eif->info->hash)) return FALSE; if (h->root.type == bfd_link_hash_warning) diff --git a/bfd/elflink.h b/bfd/elflink.h index 04df5d6..f558e1c 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -437,7 +437,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) /* You can't use -r against a dynamic object. Also, there's no hope of using a dynamic object which does not exactly match the format of the output file. */ - if (info->relocatable || info->hash->creator != abfd->xvec) + if (info->relocatable + || !is_elf_hash_table (hash_table) + || hash_table->root.creator != abfd->xvec) { bfd_set_error (bfd_error_invalid_operation); goto error_return; @@ -475,7 +477,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) fix is to keep track of what warnings we are supposed to emit, and then handle them all at the end of the link. */ - if (dynamic && abfd->xvec == info->hash->creator) + if (dynamic) { struct elf_link_hash_entry *h; @@ -531,15 +533,15 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) format. FIXME: If there are no input BFD's of the same format as the output, we can't make a shared library. */ if (info->shared - && is_elf_hash_table (info) - && ! hash_table->dynamic_sections_created - && abfd->xvec == info->hash->creator) + && is_elf_hash_table (hash_table) + && hash_table->root.creator == abfd->xvec + && ! hash_table->dynamic_sections_created) { if (! _bfd_elf_link_create_dynamic_sections (abfd, info)) goto error_return; } } - else if (! is_elf_hash_table (info)) + else if (!is_elf_hash_table (hash_table)) goto error_return; else { @@ -723,9 +725,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) /* If this is the first dynamic object found in the link, create the special sections required for dynamic linking. */ - if (! hash_table->dynamic_sections_created) - if (! _bfd_elf_link_create_dynamic_sections (abfd, info)) - goto error_return; + if (! _bfd_elf_link_create_dynamic_sections (abfd, info)) + goto error_return; if (add_needed) { @@ -875,7 +876,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { /* This should be impossible, since ELF requires that all global symbols follow all local symbols, and that sh_info - point to the first global symbol. Unfortunatealy, Irix 5 + point to the first global symbol. Unfortunately, Irix 5 screws this up. */ continue; } @@ -968,7 +969,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) old_alignment = 0; old_bfd = NULL; - if (info->hash->creator->flavour == bfd_target_elf_flavour) + if (is_elf_hash_table (hash_table)) { Elf_Internal_Versym iver; unsigned int vernum = 0; @@ -1131,7 +1132,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) && definition && (flags & BSF_WEAK) != 0 && ELF_ST_TYPE (isym->st_info) != STT_FUNC - && info->hash->creator->flavour == bfd_target_elf_flavour + && is_elf_hash_table (hash_table) && h->weakdef == NULL) { /* Keep a list of all weak defined non function symbols from @@ -1167,14 +1168,14 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) h->root.u.c.p->alignment_power = old_alignment; } - if (info->hash->creator->flavour == bfd_target_elf_flavour) + if (is_elf_hash_table (hash_table)) { int old_flags; bfd_boolean dynsym; int new_flag; /* Check the alignment when a common symbol is involved. This - can change when a common symbol is overriden by a normal + can change when a common symbol is overridden by a normal definition or a common symbol is ignored due to the old normal definition. We need to make sure the maximum alignment is maintained. */ @@ -1380,9 +1381,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) bfd_size_type oldsize; bfd_size_type strindex; - if (! is_elf_hash_table (info)) - goto error_free_vers; - /* The symbol from a DT_NEEDED object is referenced from the regular object to create a dynamic executable. We have to make sure there is a DT_NEEDED entry for it. */ @@ -1446,7 +1444,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) shortname[amt] = '\0'; hi = (struct elf_link_hash_entry *) - bfd_link_hash_lookup (info->hash, shortname, + bfd_link_hash_lookup (&hash_table->root, shortname, FALSE, FALSE, FALSE); if (hi != NULL && hi->root.type == h->root.type @@ -1573,7 +1571,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) different format. It probably can't be done. */ check_relocs = get_elf_backend_data (abfd)->check_relocs; if (! dynamic - && abfd->xvec == info->hash->creator + && is_elf_hash_table (hash_table) + && hash_table->root.creator == abfd->xvec && check_relocs != NULL) { asection *o; @@ -1609,8 +1608,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) of the .stab/.stabstr sections. */ if (! dynamic && ! info->traditional_format - && info->hash->creator->flavour == bfd_target_elf_flavour - && is_elf_hash_table (info) + && is_elf_hash_table (hash_table) && (info->strip != strip_all && info->strip != strip_debugger)) { asection *stabstr; @@ -1643,8 +1641,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } } - if (! info->relocatable && ! dynamic - && is_elf_hash_table (info)) + if (! info->relocatable + && ! dynamic + && is_elf_hash_table (hash_table)) { asection *s; @@ -1664,7 +1663,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } } - if (is_elf_hash_table (info)) + if (is_elf_hash_table (hash_table)) { /* Add this bfd to the loaded list. */ struct elf_link_loaded_list *n; @@ -1702,7 +1701,7 @@ elf_add_dynamic_entry (struct bfd_link_info *info, bfd_vma tag, bfd_vma val) bfd_size_type newsize; bfd_byte *newcontents; - if (! is_elf_hash_table (info)) + if (! is_elf_hash_table (info->hash)) return FALSE; dynobj = elf_hash_table (info)->dynobj; @@ -1832,7 +1831,7 @@ compute_bucket_count (struct bfd_link_info *info) # if 1 /* Variant 1: optimize for short chains. We add the squares - of all the chain lengths (which favous many small chain + of all the chain lengths (which favors many small chain over a few long chains). */ for (j = 0; j < i; ++j) max += counts[j] * counts[j]; @@ -1907,10 +1906,7 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, soname_indx = (bfd_size_type) -1; - if (info->hash->creator->flavour != bfd_target_elf_flavour) - return TRUE; - - if (! is_elf_hash_table (info)) + if (!is_elf_hash_table (info->hash)) return TRUE; if (info->execstack) @@ -2056,7 +2052,7 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, return FALSE; } - /* Make all global versions with definiton. */ + /* Make all global versions with definition. */ for (t = verdefs; t != NULL; t = t->next) for (d = t->globals.list; d != NULL; d = d->next) if (!d->symver && d->symbol) @@ -2121,7 +2117,7 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, if (!info->allow_undefined_version) { - /* Check if all global versions have a definiton. */ + /* Check if all global versions have a definition. */ all_defined = TRUE; for (t = verdefs; t != NULL; t = t->next) for (d = t->globals.list; d != NULL; d = d->next) @@ -2837,7 +2833,8 @@ struct elf_final_link_info }; static bfd_boolean elf_link_output_sym - (struct elf_final_link_info *, const char *, Elf_Internal_Sym *, asection *); + (struct elf_final_link_info *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *); static bfd_boolean elf_link_flush_output_syms (struct elf_final_link_info *); static bfd_boolean elf_link_output_extsym @@ -3112,7 +3109,7 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info) asection *reldyn = 0; bfd_size_type amt; - if (! is_elf_hash_table (info)) + if (! is_elf_hash_table (info->hash)) return FALSE; if (info->shared) @@ -3411,7 +3408,8 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info) elfsym.st_info = 0; elfsym.st_other = 0; elfsym.st_shndx = SHN_UNDEF; - if (! elf_link_output_sym (&finfo, NULL, &elfsym, bfd_und_section_ptr)) + if (! elf_link_output_sym (&finfo, NULL, &elfsym, bfd_und_section_ptr, + NULL)) goto error_return; } @@ -3427,7 +3425,7 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info) elfsym.st_other = 0; elfsym.st_shndx = SHN_ABS; if (! elf_link_output_sym (&finfo, bfd_get_filename (abfd), - &elfsym, bfd_abs_section_ptr)) + &elfsym, bfd_abs_section_ptr, NULL)) goto error_return; #endif @@ -3452,7 +3450,7 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info) elfsym.st_value = 0; else elfsym.st_value = o->vma; - if (! elf_link_output_sym (&finfo, NULL, &elfsym, o)) + if (! elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL)) goto error_return; if (i == SHN_LORESERVE - 1) i += SHN_HIRESERVE + 1 - SHN_LORESERVE; @@ -3706,7 +3704,8 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info) if (bed->elf_backend_output_arch_syms) { typedef bfd_boolean (*out_sym_func) - (void *, const char *, Elf_Internal_Sym *, asection *); + (void *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *); if (! ((*bed->elf_backend_output_arch_syms) (abfd, info, &finfo, (out_sym_func) elf_link_output_sym))) @@ -4090,20 +4089,20 @@ static bfd_boolean elf_link_output_sym (struct elf_final_link_info *finfo, const char *name, Elf_Internal_Sym *elfsym, - asection *input_sec) + asection *input_sec, + struct elf_link_hash_entry *h) { Elf_External_Sym *dest; Elf_External_Sym_Shndx *destshndx; bfd_boolean (*output_symbol_hook) - (bfd *, struct bfd_link_info *info, const char *, - Elf_Internal_Sym *, asection *); + (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *); output_symbol_hook = get_elf_backend_data (finfo->output_bfd)-> elf_backend_link_output_symbol_hook; if (output_symbol_hook != NULL) { - if (! ((*output_symbol_hook) - (finfo->output_bfd, finfo->info, name, elfsym, input_sec))) + if (! (*output_symbol_hook) (finfo->info, name, elfsym, input_sec, h)) return FALSE; } @@ -4188,7 +4187,7 @@ elf_link_check_versioned_symbol (struct bfd_link_info *info, bfd *abfd; struct elf_link_loaded_list *loaded; - if (info->hash->creator->flavour != bfd_target_elf_flavour) + if (!is_elf_hash_table (info->hash)) return FALSE; switch (h->root.type) @@ -4644,7 +4643,7 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) h->indx = bfd_get_symcount (finfo->output_bfd); - if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec)) + if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec, h)) { eoinfo->failed = TRUE; return FALSE; @@ -4849,7 +4848,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) } } - if (! elf_link_output_sym (finfo, name, &osym, isec)) + if (! elf_link_output_sym (finfo, name, &osym, isec, NULL)) return FALSE; } @@ -5211,7 +5210,8 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) finfo->indices[r_symndx] = bfd_get_symcount (output_bfd); - if (! elf_link_output_sym (finfo, name, &sym, sec)) + if (! elf_link_output_sym (finfo, name, &sym, sec, + NULL)) return FALSE; } @@ -5674,7 +5674,7 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *idxptr) return TRUE; } -/* Propogate collected vtable information. This is called through +/* Propagate collected vtable information. This is called through elf_link_hash_traverse. */ static bfd_boolean @@ -5797,7 +5797,9 @@ elf_gc_sections (bfd *abfd, struct bfd_link_info *info) struct elf_link_hash_entry *h, Elf_Internal_Sym *); if (!get_elf_backend_data (abfd)->can_gc_sections - || info->relocatable || info->emitrelocations + || info->relocatable + || info->emitrelocations + || !is_elf_hash_table (info->hash) || elf_hash_table (info)->dynamic_sections_created) return TRUE; @@ -5840,7 +5842,7 @@ elf_gc_sections (bfd *abfd, struct bfd_link_info *info) return TRUE; } -/* Called from check_relocs to record the existance of a VTINHERIT reloc. */ +/* Called from check_relocs to record the existence of a VTINHERIT reloc. */ bfd_boolean elf_gc_record_vtinherit (bfd *abfd, @@ -5896,7 +5898,7 @@ elf_gc_record_vtinherit (bfd *abfd, return TRUE; } -/* Called from check_relocs to record the existance of a VTENTRY reloc. */ +/* Called from check_relocs to record the existence of a VTENTRY reloc. */ bfd_boolean elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED, @@ -5973,6 +5975,9 @@ elf_gc_common_finalize_got_offsets (bfd *abfd, const struct elf_backend_data *bed = get_elf_backend_data (abfd); bfd_vma gotoff; + if (! is_elf_hash_table (info->hash)) + return FALSE; + /* The GOT offset is relative to the .got section, but the GOT header is put into the .got.plt section, if the backend uses it. */ if (bed->want_got_plt) @@ -6179,8 +6184,7 @@ elf_bfd_discard_info (bfd *output_bfd, struct bfd_link_info *info) bfd_boolean ret = FALSE; if (info->traditional_format - || info->hash->creator->flavour != bfd_target_elf_flavour - || ! is_elf_hash_table (info)) + || !is_elf_hash_table (info->hash)) return FALSE; for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next) diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index d944a46..49cf898 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -48,50 +48,49 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ecoffswap.h" static bfd_reloc_status_type mips_elf_generic_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_hi16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_lo16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_got16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_boolean mips_elf_assign_gp - PARAMS ((bfd *, bfd_vma *)); + (bfd *, bfd_vma *); static bfd_reloc_status_type mips_elf_final_gp - PARAMS ((bfd *, asymbol *, bfd_boolean, char **, bfd_vma *)); + (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *); static bfd_reloc_status_type mips_elf_gprel16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_literal_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips_elf_gprel32_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type gprel32_with_gp - PARAMS ((bfd *, asymbol *, arelent *, asection *, bfd_boolean, PTR, - bfd_vma)); + (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma); static bfd_reloc_status_type mips_elf_shift6_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_jump_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type mips16_gprel_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); + (bfd *, bfd_reloc_code_real_type); static reloc_howto_type *mips_elf_n32_rtype_to_howto - PARAMS ((unsigned int, bfd_boolean)); + (unsigned int, bfd_boolean); static void mips_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); static void mips_info_to_howto_rela - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); static bfd_boolean mips_elf_sym_is_global - PARAMS ((bfd *, asymbol *)); + (bfd *, asymbol *); static bfd_boolean mips_elf_n32_object_p - PARAMS ((bfd *)); + (bfd *); static bfd_boolean elf32_mips_grok_prstatus - PARAMS ((bfd *, Elf_Internal_Note *)); + (bfd *, Elf_Internal_Note *); static bfd_boolean elf32_mips_grok_psinfo - PARAMS ((bfd *, Elf_Internal_Note *)); + (bfd *, Elf_Internal_Note *); static irix_compat_t elf_n32_mips_irix_compat - PARAMS ((bfd *)); + (bfd *); extern const bfd_target bfd_elf32_nbigmips_vec; extern const bfd_target bfd_elf32_nlittlemips_vec; @@ -941,7 +940,7 @@ static reloc_howto_type elf_mips_howto_table_rela[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 64 bit substraction. */ + /* 64 bit subtraction. */ HOWTO (R_MIPS_SUB, /* type */ 0, /* rightshift */ 4, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1240,7 +1239,7 @@ static reloc_howto_type elf_mips_gnu_rela16_s2 = { \ /* If we're relocating, and this is an external symbol, we don't \ want to change anything. */ \ - if ((obfd) != (bfd *) NULL \ + if ((obfd) != NULL \ && ((sym)->flags & BSF_SECTION_SYM) == 0 \ && (! (entry)->howto->partial_inplace \ || (entry)->addend == 0)) \ @@ -1268,15 +1267,10 @@ static reloc_howto_type elf_mips_gnu_rela16_s2 = } static bfd_reloc_status_type -mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) @@ -1310,15 +1304,9 @@ struct mips_hi16 static struct mips_hi16 *mips_hi16_list; static bfd_reloc_status_type -mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data, asection *input_section, + bfd *output_bfd, char **error_message ATTRIBUTE_UNUSED) { bfd_reloc_status_type ret; bfd_vma relocation; @@ -1328,7 +1316,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, ret = bfd_reloc_ok; - if (bfd_is_und_section (symbol->section) && output_bfd == (bfd *) NULL) + if (bfd_is_und_section (symbol->section) && output_bfd == NULL) ret = bfd_reloc_undefined; if (bfd_is_com_section (symbol->section)) @@ -1344,7 +1332,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_outofrange; /* Save the information, and let LO16 do the actual relocation. */ - n = (struct mips_hi16 *) bfd_malloc ((bfd_size_type) sizeof *n); + n = bfd_malloc (sizeof *n); if (n == NULL) return bfd_reloc_outofrange; n->addr = (bfd_byte *) data + reloc_entry->address; @@ -1352,7 +1340,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, n->next = mips_hi16_list; mips_hi16_list = n; - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) reloc_entry->address += input_section->output_offset; return ret; @@ -1363,15 +1351,9 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, R_MIPS_HI16 relocation described above. */ static bfd_reloc_status_type -mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { if (mips_hi16_list != NULL) { @@ -1412,7 +1394,7 @@ mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section, insn &= ~ (bfd_vma) 0xffff; insn |= val; - bfd_put_32 (abfd, (bfd_vma) insn, l->addr); + bfd_put_32 (abfd, insn, l->addr); next = l->next; free (l); @@ -1442,19 +1424,13 @@ mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section, not yet know how to create global offset tables. */ static bfd_reloc_status_type -mips_elf_got16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { /* If we're relocating, and this is a local symbol, we can handle it just like an R_MIPS_HI16. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && ((symbol->flags & BSF_SECTION_SYM) != 0 || (symbol->flags & BSF_LOCAL) == 0)) return mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, @@ -1469,9 +1445,7 @@ mips_elf_got16_reloc (abfd, reloc_entry, symbol, data, input_section, dangerous relocation. */ static bfd_boolean -mips_elf_assign_gp (output_bfd, pgp) - bfd *output_bfd; - bfd_vma *pgp; +mips_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp) { unsigned int count; asymbol **sym; @@ -1487,7 +1461,7 @@ mips_elf_assign_gp (output_bfd, pgp) /* The linker script will have created a symbol named `_gp' with the appropriate value. */ - if (sym == (asymbol **) NULL) + if (sym == NULL) i = count; else { @@ -1523,12 +1497,8 @@ mips_elf_assign_gp (output_bfd, pgp) external symbol if we are producing relocatable output. */ static bfd_reloc_status_type -mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, pgp) - bfd *output_bfd; - asymbol *symbol; - bfd_boolean relocatable; - char **error_message; - bfd_vma *pgp; +mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable, + char **error_message, bfd_vma *pgp) { if (bfd_is_und_section (symbol->section) && ! relocatable) @@ -1563,15 +1533,10 @@ mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, pgp) become the offset from the gp register. */ static bfd_reloc_status_type -mips_elf_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf_gprel16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1579,7 +1544,7 @@ mips_elf_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1600,15 +1565,9 @@ mips_elf_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, /* Do a R_MIPS_LITERAL relocation. */ static bfd_reloc_status_type -mips_elf_literal_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1617,7 +1576,7 @@ mips_elf_literal_reloc (abfd, reloc_entry, symbol, data, input_section, GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */ - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) relocatable = TRUE; else { @@ -1639,15 +1598,9 @@ mips_elf_literal_reloc (abfd, reloc_entry, symbol, data, input_section, become the offset from the gp register. */ static bfd_reloc_status_type -mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1656,7 +1609,7 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) /* R_MIPS_GPREL32 relocations are defined for local symbols only. */ - if (output_bfd != (bfd *) NULL + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { @@ -1665,7 +1618,7 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_outofrange; } - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) { relocatable = TRUE; gp = _bfd_get_gp_value (output_bfd); @@ -1686,15 +1639,9 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, } static bfd_reloc_status_type -gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocatable, data, - gp) - bfd *abfd; - asymbol *symbol; - arelent *reloc_entry; - asection *input_section; - bfd_boolean relocatable; - PTR data; - bfd_vma gp; +gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry, + asection *input_section, bfd_boolean relocatable, + void *data, bfd_vma gp) { bfd_vma relocation; unsigned long val; @@ -1725,7 +1672,7 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocatable, data, || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; - bfd_put_32 (abfd, (bfd_vma) val, (bfd_byte *) data + reloc_entry->address); + bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address); if (relocatable) reloc_entry->address += input_section->output_offset; @@ -1737,15 +1684,10 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocatable, data, the rest is at bits 6-10. The bitpos already got right by the howto. */ static bfd_reloc_status_type -mips_elf_shift6_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips_elf_shift6_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) @@ -1763,15 +1705,10 @@ mips_elf_shift6_reloc (abfd, reloc_entry, symbol, data, input_section, /* Handle a mips16 jump. */ static bfd_reloc_status_type -mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol, void *data ATTRIBUTE_UNUSED, + asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { static bfd_boolean warned = FALSE; @@ -1790,15 +1727,9 @@ mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, /* Handle a mips16 GP relative reloc. */ static bfd_reloc_status_type -mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, bfd *output_bfd, + char **error_message) { bfd_boolean relocatable; bfd_reloc_status_type ret; @@ -1857,13 +1788,10 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, if (reloc_entry->howto->partial_inplace) { bfd_put_16 (abfd, - (bfd_vma) ((extend & 0xf800) - | ((val >> 11) & 0x1f) - | (val & 0x7e0)), + (extend & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0), (bfd_byte *) data + reloc_entry->address); bfd_put_16 (abfd, - (bfd_vma) ((insn & 0xffe0) - | (val & 0x1f)), + (insn & 0xffe0) | (val & 0x1f), (bfd_byte *) data + reloc_entry->address + 2); } else @@ -1929,9 +1857,8 @@ static const struct elf_reloc_map mips_reloc_map[] = /* Given a BFD reloc type, return a howto structure. */ static reloc_howto_type * -bfd_elf32_bfd_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { unsigned int i; /* FIXME: We default to RELA here instead of choosing the right @@ -1966,9 +1893,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static reloc_howto_type * -mips_elf_n32_rtype_to_howto (r_type, rela_p) - unsigned int r_type; - bfd_boolean rela_p; +mips_elf_n32_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p) { switch (r_type) { @@ -1998,10 +1923,7 @@ mips_elf_n32_rtype_to_howto (r_type, rela_p) /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static void -mips_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) { unsigned int r_type; @@ -2021,10 +1943,8 @@ mips_info_to_howto_rel (abfd, cache_ptr, dst) /* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */ static void -mips_info_to_howto_rela (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +mips_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, Elf_Internal_Rela *dst) { unsigned int r_type; @@ -2040,9 +1960,7 @@ mips_info_to_howto_rela (abfd, cache_ptr, dst) and externally visible symbols. */ static bfd_boolean -mips_elf_sym_is_global (abfd, sym) - bfd *abfd ATTRIBUTE_UNUSED; - asymbol *sym; +mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym) { if (SGI_COMPAT (abfd)) return (sym->flags & BSF_SECTION_SYM) == 0; @@ -2055,8 +1973,7 @@ mips_elf_sym_is_global (abfd, sym) /* Set the right machine number for a MIPS ELF file. */ static bfd_boolean -mips_elf_n32_object_p (abfd) - bfd *abfd; +mips_elf_n32_object_p (bfd *abfd) { unsigned long mach; @@ -2077,9 +1994,7 @@ mips_elf_n32_object_p (abfd) /* Support for core dump NOTE sections. */ static bfd_boolean -elf32_mips_grok_prstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; unsigned int raw_size; @@ -2109,9 +2024,7 @@ elf32_mips_grok_prstatus (abfd, note) } static bfd_boolean -elf32_mips_grok_psinfo (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) { switch (note->descsz) { @@ -2143,8 +2056,7 @@ elf32_mips_grok_psinfo (abfd, note) /* Depending on the target vector we generate some version of Irix executables or "normal" MIPS ELF ABI executables. */ static irix_compat_t -elf_n32_mips_irix_compat (abfd) - bfd *abfd; +elf_n32_mips_irix_compat (bfd *abfd) { if ((abfd->xvec == &bfd_elf32_nbigmips_vec) || (abfd->xvec == &bfd_elf32_nlittlemips_vec)) diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 24d6079..aba571a 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -53,7 +53,7 @@ descriptor for a MIN_PLT entry, and requires one IPLT reloc. MIN_PLT Created by PLTOFF entries against dynamic symbols. This - does not reqire dynamic relocations. */ + does not require dynamic relocations. */ #define NELEMS(a) ((int) (sizeof (a) / sizeof ((a)[0]))) @@ -81,7 +81,7 @@ struct elfNN_ia64_dyn_sym_info bfd_vma dtpmod_offset; bfd_vma dtprel_offset; - /* The symbol table entry, if any, that this was derrived from. */ + /* The symbol table entry, if any, that this was derived from. */ struct elf_link_hash_entry *h; /* Used to count non-got, non-plt relocations for delayed sizing @@ -194,7 +194,7 @@ static bfd_boolean elfNN_ia64_add_symbol_hook static int elfNN_ia64_additional_program_headers PARAMS ((bfd *abfd)); static bfd_boolean elfNN_ia64_modify_segment_map - PARAMS ((bfd *)); + PARAMS ((bfd *, struct bfd_link_info *)); static bfd_boolean elfNN_ia64_is_local_label_name PARAMS ((bfd *abfd, const char *name)); static bfd_boolean elfNN_ia64_dynamic_symbol_p @@ -707,14 +707,14 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) *again = FALSE; /* Don't even try to relax for non-ELF outputs. */ - if (link_info->hash->creator->flavour != bfd_target_elf_flavour) + if (!is_elf_hash_table (link_info->hash)) return FALSE; /* Nothing to do if there are no relocations or there is no need for the relax finalize pass. */ if ((sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 - || (link_info->relax_finalizing + || (!link_info->need_relax_finalize && sec->need_finalize_relax == 0)) return TRUE; @@ -765,14 +765,14 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) case R_IA64_PCREL21BI: case R_IA64_PCREL21M: case R_IA64_PCREL21F: - if (link_info->relax_finalizing) + if (!link_info->need_relax_finalize) continue; is_branch = TRUE; break; case R_IA64_LTOFF22X: case R_IA64_LDXMOV: - if (!link_info->relax_finalizing) + if (link_info->need_relax_finalize) { sec->need_finalize_relax = 1; continue; @@ -804,7 +804,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) isym = isymbuf + ELFNN_R_SYM (irel->r_info); if (isym->st_shndx == SHN_UNDEF) - continue; /* We can't do anthing with undefined symbols. */ + continue; /* We can't do anything with undefined symbols. */ else if (isym->st_shndx == SHN_ABS) tsec = bfd_abs_section_ptr; else if (isym->st_shndx == SHN_COMMON) @@ -852,7 +852,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) else { - /* We can't do anthing with undefined symbols. */ + /* We can't do anything with undefined symbols. */ if (h->root.type == bfd_link_hash_undefined || h->root.type == bfd_link_hash_undefweak) continue; @@ -1073,7 +1073,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) /* ??? Resize .rela.got too. */ } - if (link_info->relax_finalizing) + if (!link_info->need_relax_finalize) sec->need_finalize_relax = 0; *again = changed_contents || changed_relocs; @@ -1405,8 +1405,9 @@ elfNN_ia64_additional_program_headers (abfd) } static bfd_boolean -elfNN_ia64_modify_segment_map (abfd) +elfNN_ia64_modify_segment_map (abfd, info) bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; { struct elf_segment_map *m, **pm; Elf_Internal_Shdr *hdr; @@ -1592,7 +1593,8 @@ elfNN_ia64_hash_copy_indirect (bed, xdir, xind) (ind->root.elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); if (ind->root.root.type != bfd_link_hash_indirect) return; @@ -1952,7 +1954,7 @@ get_got (abfd, info, ia64_info) } /* Create function descriptor section (.opd). This section is called .opd - because it contains "official prodecure descriptors". The "official" + because it contains "official procedure descriptors". The "official" refers to the fact that these descriptors are used when taking the address of a procedure, thus ensuring a unique address for each procedure. */ @@ -1992,9 +1994,9 @@ get_fptr (abfd, info, ia64_info) if (info->pie) { asection *fptr_rel; - fptr_rel = bfd_make_section(abfd, ".rela.opd"); + fptr_rel = bfd_make_section(dynobj, ".rela.opd"); if (fptr_rel == NULL - || !bfd_set_section_flags (abfd, fptr_rel, + || !bfd_set_section_flags (dynobj, fptr_rel, (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY @@ -2927,6 +2929,15 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info) if (strip) ia64_info->fptr_sec = NULL; } + else if (sec == ia64_info->rel_fptr_sec) + { + if (strip) + ia64_info->rel_fptr_sec = NULL; + else + /* We use the reloc_count field as a counter if we need to + copy relocs into the output file. */ + sec->reloc_count = 0; + } else if (sec == ia64_info->plt_sec) { if (strip) diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index b545683..1af0f98 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -370,114 +370,137 @@ typedef struct runtime_pdr { #define rpdNil ((pRPDR) 0) static struct bfd_hash_entry *mips_elf_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); static void ecoff_swap_rpdr_out - PARAMS ((bfd *, const RPDR *, struct rpdr_ext *)); + (bfd *, const RPDR *, struct rpdr_ext *); static bfd_boolean mips_elf_create_procedure_table - PARAMS ((PTR, bfd *, struct bfd_link_info *, asection *, - struct ecoff_debug_info *)); + (void *, bfd *, struct bfd_link_info *, asection *, + struct ecoff_debug_info *); static bfd_boolean mips_elf_check_mips16_stubs - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); + (struct mips_elf_link_hash_entry *, void *); static void bfd_mips_elf32_swap_gptab_in - PARAMS ((bfd *, const Elf32_External_gptab *, Elf32_gptab *)); + (bfd *, const Elf32_External_gptab *, Elf32_gptab *); static void bfd_mips_elf32_swap_gptab_out - PARAMS ((bfd *, const Elf32_gptab *, Elf32_External_gptab *)); + (bfd *, const Elf32_gptab *, Elf32_External_gptab *); static void bfd_elf32_swap_compact_rel_out - PARAMS ((bfd *, const Elf32_compact_rel *, Elf32_External_compact_rel *)); + (bfd *, const Elf32_compact_rel *, Elf32_External_compact_rel *); static void bfd_elf32_swap_crinfo_out - PARAMS ((bfd *, const Elf32_crinfo *, Elf32_External_crinfo *)); + (bfd *, const Elf32_crinfo *, Elf32_External_crinfo *); static int sort_dynamic_relocs - PARAMS ((const void *, const void *)); + (const void *, const void *); static int sort_dynamic_relocs_64 - PARAMS ((const void *, const void *)); + (const void *, const void *); static bfd_boolean mips_elf_output_extsym - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); -static int gptab_compare PARAMS ((const void *, const void *)); -static asection * mips_elf_rel_dyn_section PARAMS ((bfd *, bfd_boolean)); -static asection * mips_elf_got_section PARAMS ((bfd *, bfd_boolean)); + (struct mips_elf_link_hash_entry *, void *); +static int gptab_compare + (const void *, const void *); +static asection *mips_elf_rel_dyn_section + (bfd *, bfd_boolean); +static asection *mips_elf_got_section + (bfd *, bfd_boolean); static struct mips_got_info *mips_elf_got_info - PARAMS ((bfd *, asection **)); -static long mips_elf_get_global_gotsym_index PARAMS ((bfd *abfd)); + (bfd *, asection **); +static long mips_elf_get_global_gotsym_index + (bfd *abfd); static bfd_vma mips_elf_local_got_index - PARAMS ((bfd *, bfd *, struct bfd_link_info *, bfd_vma)); + (bfd *, bfd *, struct bfd_link_info *, bfd_vma); static bfd_vma mips_elf_global_got_index - PARAMS ((bfd *, bfd *, struct elf_link_hash_entry *)); + (bfd *, bfd *, struct elf_link_hash_entry *); static bfd_vma mips_elf_got_page - PARAMS ((bfd *, bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *)); + (bfd *, bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *); static bfd_vma mips_elf_got16_entry - PARAMS ((bfd *, bfd *, struct bfd_link_info *, bfd_vma, bfd_boolean)); + (bfd *, bfd *, struct bfd_link_info *, bfd_vma, bfd_boolean); static bfd_vma mips_elf_got_offset_from_index - PARAMS ((bfd *, bfd *, bfd *, bfd_vma)); + (bfd *, bfd *, bfd *, bfd_vma); static struct mips_got_entry *mips_elf_create_local_got_entry - PARAMS ((bfd *, bfd *, struct mips_got_info *, asection *, bfd_vma)); + (bfd *, bfd *, struct mips_got_info *, asection *, bfd_vma); static bfd_boolean mips_elf_sort_hash_table - PARAMS ((struct bfd_link_info *, unsigned long)); + (struct bfd_link_info *, unsigned long); static bfd_boolean mips_elf_sort_hash_table_f - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); + (struct mips_elf_link_hash_entry *, void *); static bfd_boolean mips_elf_record_local_got_symbol - PARAMS ((bfd *, long, bfd_vma, struct mips_got_info *)); + (bfd *, long, bfd_vma, struct mips_got_info *); static bfd_boolean mips_elf_record_global_got_symbol - PARAMS ((struct elf_link_hash_entry *, bfd *, struct bfd_link_info *, - struct mips_got_info *)); + (struct elf_link_hash_entry *, bfd *, struct bfd_link_info *, + struct mips_got_info *); static const Elf_Internal_Rela *mips_elf_next_relocation - PARAMS ((bfd *, unsigned int, const Elf_Internal_Rela *, - const Elf_Internal_Rela *)); + (bfd *, unsigned int, const Elf_Internal_Rela *, const Elf_Internal_Rela *); static bfd_boolean mips_elf_local_relocation_p - PARAMS ((bfd *, const Elf_Internal_Rela *, asection **, bfd_boolean)); -static bfd_boolean mips_elf_overflow_p PARAMS ((bfd_vma, int)); -static bfd_vma mips_elf_high PARAMS ((bfd_vma)); -static bfd_vma mips_elf_higher PARAMS ((bfd_vma)); -static bfd_vma mips_elf_highest PARAMS ((bfd_vma)); + (bfd *, const Elf_Internal_Rela *, asection **, bfd_boolean); +static bfd_boolean mips_elf_overflow_p + (bfd_vma, int); +static bfd_vma mips_elf_high + (bfd_vma); +static bfd_vma mips_elf_higher + (bfd_vma); +static bfd_vma mips_elf_highest + (bfd_vma); static bfd_boolean mips_elf_create_compact_rel_section - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); static bfd_boolean mips_elf_create_got_section - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean)); + (bfd *, struct bfd_link_info *, bfd_boolean); static bfd_reloc_status_type mips_elf_calculate_relocation - PARAMS ((bfd *, bfd *, asection *, struct bfd_link_info *, - const Elf_Internal_Rela *, bfd_vma, reloc_howto_type *, - Elf_Internal_Sym *, asection **, bfd_vma *, const char **, - bfd_boolean *, bfd_boolean)); + (bfd *, bfd *, asection *, struct bfd_link_info *, + const Elf_Internal_Rela *, bfd_vma, reloc_howto_type *, + Elf_Internal_Sym *, asection **, bfd_vma *, const char **, + bfd_boolean *, bfd_boolean); static bfd_vma mips_elf_obtain_contents - PARAMS ((reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *)); + (reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *); static bfd_boolean mips_elf_perform_relocation - PARAMS ((struct bfd_link_info *, reloc_howto_type *, - const Elf_Internal_Rela *, bfd_vma, bfd *, asection *, bfd_byte *, - bfd_boolean)); + (struct bfd_link_info *, reloc_howto_type *, const Elf_Internal_Rela *, + bfd_vma, bfd *, asection *, bfd_byte *, bfd_boolean); static bfd_boolean mips_elf_stub_section_p - PARAMS ((bfd *, asection *)); + (bfd *, asection *); static void mips_elf_allocate_dynamic_relocations - PARAMS ((bfd *, unsigned int)); + (bfd *, unsigned int); static bfd_boolean mips_elf_create_dynamic_relocation - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Rela *, - struct mips_elf_link_hash_entry *, asection *, - bfd_vma, bfd_vma *, asection *)); -static void mips_set_isa_flags PARAMS ((bfd *)); -static INLINE char* elf_mips_abi_name PARAMS ((bfd *)); + (bfd *, struct bfd_link_info *, const Elf_Internal_Rela *, + struct mips_elf_link_hash_entry *, asection *, bfd_vma, + bfd_vma *, asection *); +static void mips_set_isa_flags + (bfd *); +static INLINE char *elf_mips_abi_name + (bfd *); static void mips_elf_irix6_finish_dynamic_symbol - PARAMS ((bfd *, const char *, Elf_Internal_Sym *)); -static bfd_boolean mips_mach_extends_p PARAMS ((unsigned long, unsigned long)); -static bfd_boolean mips_32bit_flags_p PARAMS ((flagword)); -static INLINE hashval_t mips_elf_hash_bfd_vma PARAMS ((bfd_vma)); -static hashval_t mips_elf_got_entry_hash PARAMS ((const PTR)); -static int mips_elf_got_entry_eq PARAMS ((const PTR, const PTR)); + (bfd *, const char *, Elf_Internal_Sym *); +static bfd_boolean mips_mach_extends_p + (unsigned long, unsigned long); +static bfd_boolean mips_32bit_flags_p + (flagword); +static INLINE hashval_t mips_elf_hash_bfd_vma + (bfd_vma); +static hashval_t mips_elf_got_entry_hash + (const void *); +static int mips_elf_got_entry_eq + (const void *, const void *); static bfd_boolean mips_elf_multi_got - PARAMS ((bfd *, struct bfd_link_info *, struct mips_got_info *, - asection *, bfd_size_type)); -static hashval_t mips_elf_multi_got_entry_hash PARAMS ((const PTR)); -static int mips_elf_multi_got_entry_eq PARAMS ((const PTR, const PTR)); -static hashval_t mips_elf_bfd2got_entry_hash PARAMS ((const PTR)); -static int mips_elf_bfd2got_entry_eq PARAMS ((const PTR, const PTR)); -static int mips_elf_make_got_per_bfd PARAMS ((void **, void *)); -static int mips_elf_merge_gots PARAMS ((void **, void *)); -static int mips_elf_set_global_got_offset PARAMS ((void**, void *)); -static int mips_elf_resolve_final_got_entry PARAMS ((void**, void *)); + (bfd *, struct bfd_link_info *, struct mips_got_info *, + asection *, bfd_size_type); +static hashval_t mips_elf_multi_got_entry_hash + (const void *); +static int mips_elf_multi_got_entry_eq + (const void *, const void *); +static hashval_t mips_elf_bfd2got_entry_hash + (const void *); +static int mips_elf_bfd2got_entry_eq + (const void *, const void *); +static int mips_elf_make_got_per_bfd + (void **, void *); +static int mips_elf_merge_gots + (void **, void *); +static int mips_elf_set_global_got_offset + (void **, void *); +static int mips_elf_set_no_stub + (void **, void *); +static int mips_elf_resolve_final_got_entry + (void **, void *); static void mips_elf_resolve_final_got_entries - PARAMS ((struct mips_got_info *)); + (struct mips_got_info *); static bfd_vma mips_elf_adjust_gp - PARAMS ((bfd *, struct mips_got_info *, bfd *)); + (bfd *, struct mips_got_info *, bfd *); static struct mips_got_info *mips_elf_got_for_ibfd - PARAMS ((struct mips_got_info *, bfd *)); + (struct mips_got_info *, bfd *); /* This will be used when we sort the dynamic relocation records. */ static bfd *reldyn_sorting_bfd; @@ -542,15 +565,15 @@ static bfd *reldyn_sorting_bfd; /* Add a dynamic symbol table-entry. */ #ifdef BFD64 -#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ - (ABI_64_P (elf_hash_table (info)->dynobj) \ - ? bfd_elf64_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val) \ - : bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val)) +#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ + (ABI_64_P (elf_hash_table (info)->dynobj) \ + ? bfd_elf64_add_dynamic_entry (info, tag, val) \ + : bfd_elf32_add_dynamic_entry (info, tag, val)) #else -#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ - (ABI_64_P (elf_hash_table (info)->dynobj) \ - ? (abort (), FALSE) \ - : bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val)) +#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ + (ABI_64_P (elf_hash_table (info)->dynobj) \ + ? (abort (), FALSE) \ + : bfd_elf32_add_dynamic_entry (info, tag, val)) #endif #define MIPS_ELF_RTYPE_TO_HOWTO(abfd, rtype, rela) \ @@ -680,7 +703,7 @@ static bfd *reldyn_sorting_bfd; #define mips_elf_link_hash_traverse(table, func, info) \ (elf_link_hash_traverse \ (&(table)->root, \ - (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ + (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \ (info))) /* Get the MIPS ELF linker hash table from a link_info structure. */ @@ -691,28 +714,24 @@ static bfd *reldyn_sorting_bfd; /* Create an entry in a MIPS ELF linker hash table. */ static struct bfd_hash_entry * -mips_elf_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +mips_elf_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, const char *string) { struct mips_elf_link_hash_entry *ret = (struct mips_elf_link_hash_entry *) entry; /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct mips_elf_link_hash_entry *) NULL) - ret = ((struct mips_elf_link_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct mips_elf_link_hash_entry))); - if (ret == (struct mips_elf_link_hash_entry *) NULL) + if (ret == NULL) + ret = bfd_hash_allocate (table, sizeof (struct mips_elf_link_hash_entry)); + if (ret == NULL) return (struct bfd_hash_entry *) ret; /* Call the allocation method of the superclass. */ ret = ((struct mips_elf_link_hash_entry *) _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); - if (ret != (struct mips_elf_link_hash_entry *) NULL) + if (ret != NULL) { /* Set local fields. */ memset (&ret->esym, 0, sizeof (EXTR)); @@ -733,17 +752,15 @@ mips_elf_link_hash_newfunc (entry, table, string) } bfd_boolean -_bfd_mips_elf_new_section_hook (abfd, sec) - bfd *abfd; - asection *sec; +_bfd_mips_elf_new_section_hook (bfd *abfd, asection *sec) { struct _mips_elf_section_data *sdata; bfd_size_type amt = sizeof (*sdata); - sdata = (struct _mips_elf_section_data *) bfd_zalloc (abfd, amt); + sdata = bfd_zalloc (abfd, amt); if (sdata == NULL) return FALSE; - sec->used_by_bfd = (PTR) sdata; + sec->used_by_bfd = sdata; return _bfd_elf_new_section_hook (abfd, sec); } @@ -752,23 +769,21 @@ _bfd_mips_elf_new_section_hook (abfd, sec) ecoff_debug_info structure. */ bfd_boolean -_bfd_mips_elf_read_ecoff_info (abfd, section, debug) - bfd *abfd; - asection *section; - struct ecoff_debug_info *debug; +_bfd_mips_elf_read_ecoff_info (bfd *abfd, asection *section, + struct ecoff_debug_info *debug) { HDRR *symhdr; const struct ecoff_debug_swap *swap; - char *ext_hdr = NULL; + char *ext_hdr; swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; memset (debug, 0, sizeof (*debug)); - ext_hdr = (char *) bfd_malloc (swap->external_hdr_size); + ext_hdr = bfd_malloc (swap->external_hdr_size); if (ext_hdr == NULL && swap->external_hdr_size != 0) goto error_return; - if (! bfd_get_section_contents (abfd, section, ext_hdr, (file_ptr) 0, + if (! bfd_get_section_contents (abfd, section, ext_hdr, 0, swap->external_hdr_size)) goto error_return; @@ -783,26 +798,26 @@ _bfd_mips_elf_read_ecoff_info (abfd, section, debug) else \ { \ bfd_size_type amt = (bfd_size_type) size * symhdr->count; \ - debug->ptr = (type) bfd_malloc (amt); \ + debug->ptr = bfd_malloc (amt); \ if (debug->ptr == NULL) \ goto error_return; \ - if (bfd_seek (abfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \ + if (bfd_seek (abfd, symhdr->offset, SEEK_SET) != 0 \ || bfd_bread (debug->ptr, amt, abfd) != amt) \ goto error_return; \ } READ (line, cbLineOffset, cbLine, sizeof (unsigned char), unsigned char *); - READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, PTR); - READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, PTR); - READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, PTR); - READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, PTR); + READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, void *); + READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, void *); + READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, void *); + READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, void *); READ (external_aux, cbAuxOffset, iauxMax, sizeof (union aux_ext), union aux_ext *); READ (ss, cbSsOffset, issMax, sizeof (char), char *); READ (ssext, cbSsExtOffset, issExtMax, sizeof (char), char *); - READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, PTR); - READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, PTR); - READ (external_ext, cbExtOffset, iextMax, swap->external_ext_size, PTR); + READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, void *); + READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, void *); + READ (external_ext, cbExtOffset, iextMax, swap->external_ext_size, void *); #undef READ debug->fdr = NULL; @@ -841,10 +856,7 @@ _bfd_mips_elf_read_ecoff_info (abfd, section, debug) /* Swap RPDR (runtime procedure table entry) for output. */ static void -ecoff_swap_rpdr_out (abfd, in, ex) - bfd *abfd; - const RPDR *in; - struct rpdr_ext *ex; +ecoff_swap_rpdr_out (bfd *abfd, const RPDR *in, struct rpdr_ext *ex) { H_PUT_S32 (abfd, in->adr, ex->p_adr); H_PUT_32 (abfd, in->regmask, ex->p_regmask); @@ -865,18 +877,15 @@ ecoff_swap_rpdr_out (abfd, in, ex) /* Create a runtime procedure table from the .mdebug section. */ static bfd_boolean -mips_elf_create_procedure_table (handle, abfd, info, s, debug) - PTR handle; - bfd *abfd; - struct bfd_link_info *info; - asection *s; - struct ecoff_debug_info *debug; +mips_elf_create_procedure_table (void *handle, bfd *abfd, + struct bfd_link_info *info, asection *s, + struct ecoff_debug_info *debug) { const struct ecoff_debug_swap *swap; HDRR *hdr = &debug->symbolic_header; RPDR *rpdr, *rp; struct rpdr_ext *erp; - PTR rtproc; + void *rtproc; struct pdr_ext *epdr; struct sym_ext *esym; char *ss, **sv; @@ -903,44 +912,44 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug) { size = swap->external_pdr_size; - epdr = (struct pdr_ext *) bfd_malloc (size * count); + epdr = bfd_malloc (size * count); if (epdr == NULL) goto error_return; - if (! _bfd_ecoff_get_accumulated_pdr (handle, (PTR) epdr)) + if (! _bfd_ecoff_get_accumulated_pdr (handle, (bfd_byte *) epdr)) goto error_return; size = sizeof (RPDR); - rp = rpdr = (RPDR *) bfd_malloc (size * count); + rp = rpdr = bfd_malloc (size * count); if (rpdr == NULL) goto error_return; size = sizeof (char *); - sv = (char **) bfd_malloc (size * count); + sv = bfd_malloc (size * count); if (sv == NULL) goto error_return; count = hdr->isymMax; size = swap->external_sym_size; - esym = (struct sym_ext *) bfd_malloc (size * count); + esym = bfd_malloc (size * count); if (esym == NULL) goto error_return; - if (! _bfd_ecoff_get_accumulated_sym (handle, (PTR) esym)) + if (! _bfd_ecoff_get_accumulated_sym (handle, (bfd_byte *) esym)) goto error_return; count = hdr->issMax; - ss = (char *) bfd_malloc (count); + ss = bfd_malloc (count); if (ss == NULL) goto error_return; - if (! _bfd_ecoff_get_accumulated_ss (handle, (PTR) ss)) + if (! _bfd_ecoff_get_accumulated_ss (handle, ss)) goto error_return; count = hdr->ipdMax; for (i = 0; i < (unsigned long) count; i++, rp++) { - (*swap->swap_pdr_in) (abfd, (PTR) (epdr + i), &pdr); - (*swap->swap_sym_in) (abfd, (PTR) &esym[pdr.isym], &sym); + (*swap->swap_pdr_in) (abfd, epdr + i, &pdr); + (*swap->swap_sym_in) (abfd, &esym[pdr.isym], &sym); rp->adr = sym.value; rp->regmask = pdr.regmask; rp->regoffset = pdr.regoffset; @@ -957,7 +966,7 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug) size = sizeof (struct rpdr_ext) * (count + 2) + sindex; size = BFD_ALIGN (size, 16); - rtproc = (PTR) bfd_alloc (abfd, size); + rtproc = bfd_alloc (abfd, size); if (rtproc == NULL) { mips_elf_hash_table (info)->procedure_count = 0; @@ -966,7 +975,7 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug) mips_elf_hash_table (info)->procedure_count = count + 2; - erp = (struct rpdr_ext *) rtproc; + erp = rtproc; memset (erp, 0, sizeof (struct rpdr_ext)); erp++; str = (char *) rtproc + sizeof (struct rpdr_ext) * (count + 2); @@ -982,11 +991,11 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug) /* Set the size and contents of .rtproc section. */ s->_raw_size = size; - s->contents = (bfd_byte *) rtproc; + s->contents = rtproc; /* Skip this section later on (I don't think this currently matters, but someday it might). */ - s->link_order_head = (struct bfd_link_order *) NULL; + s->link_order_head = NULL; if (epdr != NULL) free (epdr); @@ -1019,9 +1028,8 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug) discard them. */ static bfd_boolean -mips_elf_check_mips16_stubs (h, data) - struct mips_elf_link_hash_entry *h; - PTR data ATTRIBUTE_UNUSED; +mips_elf_check_mips16_stubs (struct mips_elf_link_hash_entry *h, + void *data ATTRIBUTE_UNUSED) { if (h->root.root.type == bfd_link_hash_warning) h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; @@ -1069,15 +1077,9 @@ mips_elf_check_mips16_stubs (h, data) } bfd_reloc_status_type -_bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, input_section, - relocatable, data, gp) - bfd *abfd; - asymbol *symbol; - arelent *reloc_entry; - asection *input_section; - bfd_boolean relocatable; - PTR data; - bfd_vma gp; +_bfd_mips_elf_gprel16_with_gp (bfd *abfd, asymbol *symbol, + arelent *reloc_entry, asection *input_section, + bfd_boolean relocatable, void *data, bfd_vma gp) { bfd_vma relocation; unsigned long insn = 0; @@ -1115,8 +1117,7 @@ _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, input_section, if (reloc_entry->howto->partial_inplace) { insn = (insn & ~0xffff) | (val & 0xffff); - bfd_put_32 (abfd, (bfd_vma) insn, - (bfd_byte *) data + reloc_entry->address); + bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); } else reloc_entry->addend = val; @@ -1133,30 +1134,24 @@ _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, input_section, on the equivalence of the two elements of the union. */ static void -bfd_mips_elf32_swap_gptab_in (abfd, ex, in) - bfd *abfd; - const Elf32_External_gptab *ex; - Elf32_gptab *in; +bfd_mips_elf32_swap_gptab_in (bfd *abfd, const Elf32_External_gptab *ex, + Elf32_gptab *in) { in->gt_entry.gt_g_value = H_GET_32 (abfd, ex->gt_entry.gt_g_value); in->gt_entry.gt_bytes = H_GET_32 (abfd, ex->gt_entry.gt_bytes); } static void -bfd_mips_elf32_swap_gptab_out (abfd, in, ex) - bfd *abfd; - const Elf32_gptab *in; - Elf32_External_gptab *ex; +bfd_mips_elf32_swap_gptab_out (bfd *abfd, const Elf32_gptab *in, + Elf32_External_gptab *ex) { H_PUT_32 (abfd, in->gt_entry.gt_g_value, ex->gt_entry.gt_g_value); H_PUT_32 (abfd, in->gt_entry.gt_bytes, ex->gt_entry.gt_bytes); } static void -bfd_elf32_swap_compact_rel_out (abfd, in, ex) - bfd *abfd; - const Elf32_compact_rel *in; - Elf32_External_compact_rel *ex; +bfd_elf32_swap_compact_rel_out (bfd *abfd, const Elf32_compact_rel *in, + Elf32_External_compact_rel *ex) { H_PUT_32 (abfd, in->id1, ex->id1); H_PUT_32 (abfd, in->num, ex->num); @@ -1167,10 +1162,8 @@ bfd_elf32_swap_compact_rel_out (abfd, in, ex) } static void -bfd_elf32_swap_crinfo_out (abfd, in, ex) - bfd *abfd; - const Elf32_crinfo *in; - Elf32_External_crinfo *ex; +bfd_elf32_swap_crinfo_out (bfd *abfd, const Elf32_crinfo *in, + Elf32_External_crinfo *ex) { unsigned long l; @@ -1188,10 +1181,8 @@ bfd_elf32_swap_crinfo_out (abfd, in, ex) BFD, so they are globally visible. */ void -bfd_mips_elf32_swap_reginfo_in (abfd, ex, in) - bfd *abfd; - const Elf32_External_RegInfo *ex; - Elf32_RegInfo *in; +bfd_mips_elf32_swap_reginfo_in (bfd *abfd, const Elf32_External_RegInfo *ex, + Elf32_RegInfo *in) { in->ri_gprmask = H_GET_32 (abfd, ex->ri_gprmask); in->ri_cprmask[0] = H_GET_32 (abfd, ex->ri_cprmask[0]); @@ -1202,10 +1193,8 @@ bfd_mips_elf32_swap_reginfo_in (abfd, ex, in) } void -bfd_mips_elf32_swap_reginfo_out (abfd, in, ex) - bfd *abfd; - const Elf32_RegInfo *in; - Elf32_External_RegInfo *ex; +bfd_mips_elf32_swap_reginfo_out (bfd *abfd, const Elf32_RegInfo *in, + Elf32_External_RegInfo *ex) { H_PUT_32 (abfd, in->ri_gprmask, ex->ri_gprmask); H_PUT_32 (abfd, in->ri_cprmask[0], ex->ri_cprmask[0]); @@ -1222,10 +1211,8 @@ bfd_mips_elf32_swap_reginfo_out (abfd, in, ex) without worrying about whether the 64 bit ABI has been included. */ void -bfd_mips_elf64_swap_reginfo_in (abfd, ex, in) - bfd *abfd; - const Elf64_External_RegInfo *ex; - Elf64_Internal_RegInfo *in; +bfd_mips_elf64_swap_reginfo_in (bfd *abfd, const Elf64_External_RegInfo *ex, + Elf64_Internal_RegInfo *in) { in->ri_gprmask = H_GET_32 (abfd, ex->ri_gprmask); in->ri_pad = H_GET_32 (abfd, ex->ri_pad); @@ -1237,10 +1224,8 @@ bfd_mips_elf64_swap_reginfo_in (abfd, ex, in) } void -bfd_mips_elf64_swap_reginfo_out (abfd, in, ex) - bfd *abfd; - const Elf64_Internal_RegInfo *in; - Elf64_External_RegInfo *ex; +bfd_mips_elf64_swap_reginfo_out (bfd *abfd, const Elf64_Internal_RegInfo *in, + Elf64_External_RegInfo *ex) { H_PUT_32 (abfd, in->ri_gprmask, ex->ri_gprmask); H_PUT_32 (abfd, in->ri_pad, ex->ri_pad); @@ -1254,10 +1239,8 @@ bfd_mips_elf64_swap_reginfo_out (abfd, in, ex) /* Swap in an options header. */ void -bfd_mips_elf_swap_options_in (abfd, ex, in) - bfd *abfd; - const Elf_External_Options *ex; - Elf_Internal_Options *in; +bfd_mips_elf_swap_options_in (bfd *abfd, const Elf_External_Options *ex, + Elf_Internal_Options *in) { in->kind = H_GET_8 (abfd, ex->kind); in->size = H_GET_8 (abfd, ex->size); @@ -1268,10 +1251,8 @@ bfd_mips_elf_swap_options_in (abfd, ex, in) /* Swap out an options header. */ void -bfd_mips_elf_swap_options_out (abfd, in, ex) - bfd *abfd; - const Elf_Internal_Options *in; - Elf_External_Options *ex; +bfd_mips_elf_swap_options_out (bfd *abfd, const Elf_Internal_Options *in, + Elf_External_Options *ex) { H_PUT_8 (abfd, in->kind, ex->kind); H_PUT_8 (abfd, in->size, ex->size); @@ -1283,9 +1264,7 @@ bfd_mips_elf_swap_options_out (abfd, in, ex) entries by increasing r_symndx value. */ static int -sort_dynamic_relocs (arg1, arg2) - const PTR arg1; - const PTR arg2; +sort_dynamic_relocs (const void *arg1, const void *arg2) { Elf_Internal_Rela int_reloc1; Elf_Internal_Rela int_reloc2; @@ -1299,9 +1278,7 @@ sort_dynamic_relocs (arg1, arg2) /* Like sort_dynamic_relocs, but used for elf64 relocations. */ static int -sort_dynamic_relocs_64 (arg1, arg2) - const PTR arg1; - const PTR arg2; +sort_dynamic_relocs_64 (const void *arg1, const void *arg2) { Elf_Internal_Rela int_reloc1[3]; Elf_Internal_Rela int_reloc2[3]; @@ -1331,11 +1308,9 @@ sort_dynamic_relocs_64 (arg1, arg2) when generating a final executable. */ static bfd_boolean -mips_elf_output_extsym (h, data) - struct mips_elf_link_hash_entry *h; - PTR data; +mips_elf_output_extsym (struct mips_elf_link_hash_entry *h, void *data) { - struct extsym_info *einfo = (struct extsym_info *) data; + struct extsym_info *einfo = data; bfd_boolean strip; asection *sec, *output_section; @@ -1513,12 +1488,10 @@ mips_elf_output_extsym (h, data) /* A comparison routine used to sort .gptab entries. */ static int -gptab_compare (p1, p2) - const PTR p1; - const PTR p2; +gptab_compare (const void *p1, const void *p2) { - const Elf32_gptab *a1 = (const Elf32_gptab *) p1; - const Elf32_gptab *a2 = (const Elf32_gptab *) p2; + const Elf32_gptab *a1 = p1; + const Elf32_gptab *a2 = p2; return a1->gt_entry.gt_g_value - a2->gt_entry.gt_g_value; } @@ -1529,8 +1502,7 @@ gptab_compare (p1, p2) hash number. */ static INLINE hashval_t -mips_elf_hash_bfd_vma (addr) - bfd_vma addr; +mips_elf_hash_bfd_vma (bfd_vma addr) { #ifdef BFD64 return addr + (addr >> 32); @@ -1544,8 +1516,7 @@ mips_elf_hash_bfd_vma (addr) union members. */ static hashval_t -mips_elf_got_entry_hash (entry_) - const PTR entry_; +mips_elf_got_entry_hash (const void *entry_) { const struct mips_got_entry *entry = (struct mips_got_entry *)entry_; @@ -1557,9 +1528,7 @@ mips_elf_got_entry_hash (entry_) } static int -mips_elf_got_entry_eq (entry1, entry2) - const PTR entry1; - const PTR entry2; +mips_elf_got_entry_eq (const void *entry1, const void *entry2) { const struct mips_got_entry *e1 = (struct mips_got_entry *)entry1; const struct mips_got_entry *e2 = (struct mips_got_entry *)entry2; @@ -1576,8 +1545,7 @@ mips_elf_got_entry_eq (entry1, entry2) accordingly. */ static hashval_t -mips_elf_multi_got_entry_hash (entry_) - const PTR entry_; +mips_elf_multi_got_entry_hash (const void *entry_) { const struct mips_got_entry *entry = (struct mips_got_entry *)entry_; @@ -1591,9 +1559,7 @@ mips_elf_multi_got_entry_hash (entry_) } static int -mips_elf_multi_got_entry_eq (entry1, entry2) - const PTR entry1; - const PTR entry2; +mips_elf_multi_got_entry_eq (const void *entry1, const void *entry2) { const struct mips_got_entry *e1 = (struct mips_got_entry *)entry1; const struct mips_got_entry *e2 = (struct mips_got_entry *)entry2; @@ -1608,9 +1574,7 @@ mips_elf_multi_got_entry_eq (entry1, entry2) /* Returns the dynamic relocation section for DYNOBJ. */ static asection * -mips_elf_rel_dyn_section (dynobj, create_p) - bfd *dynobj; - bfd_boolean create_p; +mips_elf_rel_dyn_section (bfd *dynobj, bfd_boolean create_p) { static const char dname[] = ".rel.dyn"; asection *sreloc; @@ -1637,9 +1601,7 @@ mips_elf_rel_dyn_section (dynobj, create_p) /* Returns the GOT section for ABFD. */ static asection * -mips_elf_got_section (abfd, maybe_excluded) - bfd *abfd; - bfd_boolean maybe_excluded; +mips_elf_got_section (bfd *abfd, bfd_boolean maybe_excluded) { asection *sgot = bfd_get_section_by_name (abfd, ".got"); if (sgot == NULL @@ -1653,9 +1615,7 @@ mips_elf_got_section (abfd, maybe_excluded) section. */ static struct mips_got_info * -mips_elf_got_info (abfd, sgotp) - bfd *abfd; - asection **sgotp; +mips_elf_got_info (bfd *abfd, asection **sgotp) { asection *sgot; struct mips_got_info *g; @@ -1675,8 +1635,7 @@ mips_elf_got_info (abfd, sgotp) /* Obtain the lowest dynamic index of a symbol that was assigned a global GOT entry. */ static long -mips_elf_get_global_gotsym_index (abfd) - bfd *abfd; +mips_elf_get_global_gotsym_index (bfd *abfd) { asection *sgot; struct mips_got_info *g; @@ -1700,10 +1659,8 @@ mips_elf_get_global_gotsym_index (abfd) -1 if no satisfactory GOT offset can be found. */ static bfd_vma -mips_elf_local_got_index (abfd, ibfd, info, value) - bfd *abfd, *ibfd; - struct bfd_link_info *info; - bfd_vma value; +mips_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, + bfd_vma value) { asection *sgot; struct mips_got_info *g; @@ -1721,9 +1678,7 @@ mips_elf_local_got_index (abfd, ibfd, info, value) /* Returns the GOT index for the global symbol indicated by H. */ static bfd_vma -mips_elf_global_got_index (abfd, ibfd, h) - bfd *abfd, *ibfd; - struct elf_link_hash_entry *h; +mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h) { bfd_vma index; asection *sgot; @@ -1744,7 +1699,7 @@ mips_elf_global_got_index (abfd, ibfd, h) e.symndx = -1; e.d.h = (struct mips_elf_link_hash_entry *)h; - p = (struct mips_got_entry *) htab_find (g->got_entries, &e); + p = htab_find (g->got_entries, &e); BFD_ASSERT (p->gotidx > 0); return p->gotidx; @@ -1773,11 +1728,8 @@ mips_elf_global_got_index (abfd, ibfd, h) OFFSETP, if it is non-NULL. */ static bfd_vma -mips_elf_got_page (abfd, ibfd, info, value, offsetp) - bfd *abfd, *ibfd; - struct bfd_link_info *info; - bfd_vma value; - bfd_vma *offsetp; +mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, + bfd_vma value, bfd_vma *offsetp) { asection *sgot; struct mips_got_info *g; @@ -1805,11 +1757,8 @@ mips_elf_got_page (abfd, ibfd, info, value, offsetp) for value. Return the index into the GOT for this entry. */ static bfd_vma -mips_elf_got16_entry (abfd, ibfd, info, value, external) - bfd *abfd, *ibfd; - struct bfd_link_info *info; - bfd_vma value; - bfd_boolean external; +mips_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, + bfd_vma value, bfd_boolean external) { asection *sgot; struct mips_got_info *g; @@ -1837,11 +1786,8 @@ mips_elf_got16_entry (abfd, ibfd, info, value, external) in the GOT. */ static bfd_vma -mips_elf_got_offset_from_index (dynobj, output_bfd, input_bfd, index) - bfd *dynobj; - bfd *output_bfd; - bfd *input_bfd; - bfd_vma index; +mips_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd, + bfd *input_bfd, bfd_vma index) { asection *sgot; bfd_vma gp; @@ -1858,11 +1804,9 @@ mips_elf_got_offset_from_index (dynobj, output_bfd, input_bfd, index) or -1 if it could not be created. */ static struct mips_got_entry * -mips_elf_create_local_got_entry (abfd, ibfd, gg, sgot, value) - bfd *abfd, *ibfd; - struct mips_got_info *gg; - asection *sgot; - bfd_vma value; +mips_elf_create_local_got_entry (bfd *abfd, bfd *ibfd, + struct mips_got_info *gg, + asection *sgot, bfd_vma value) { struct mips_got_entry entry, **loc; struct mips_got_info *g; @@ -1916,9 +1860,7 @@ mips_elf_create_local_got_entry (abfd, ibfd, gg, sgot, value) section symbols are added and the count is higher. */ static bfd_boolean -mips_elf_sort_hash_table (info, max_local) - struct bfd_link_info *info; - unsigned long max_local; +mips_elf_sort_hash_table (struct bfd_link_info *info, unsigned long max_local) { struct mips_elf_hash_sort_data hsd; struct mips_got_info *g; @@ -1963,12 +1905,9 @@ mips_elf_sort_hash_table (info, max_local) index. */ static bfd_boolean -mips_elf_sort_hash_table_f (h, data) - struct mips_elf_link_hash_entry *h; - PTR data; +mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *h, void *data) { - struct mips_elf_hash_sort_data *hsd - = (struct mips_elf_hash_sort_data *) data; + struct mips_elf_hash_sort_data *hsd = data; if (h->root.root.type == bfd_link_hash_warning) h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; @@ -2004,11 +1943,9 @@ mips_elf_sort_hash_table_f (h, data) posterity. */ static bfd_boolean -mips_elf_record_global_got_symbol (h, abfd, info, g) - struct elf_link_hash_entry *h; - bfd *abfd; - struct bfd_link_info *info; - struct mips_got_info *g; +mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h, + bfd *abfd, struct bfd_link_info *info, + struct mips_got_info *g) { struct mips_got_entry entry, **loc; @@ -2062,11 +1999,8 @@ mips_elf_record_global_got_symbol (h, abfd, info, g) SYMNDX in input bfd ABDF, plus ADDEND. */ static bfd_boolean -mips_elf_record_local_got_symbol (abfd, symndx, addend, g) - bfd *abfd; - long symndx; - bfd_vma addend; - struct mips_got_info *g; +mips_elf_record_local_got_symbol (bfd *abfd, long symndx, bfd_vma addend, + struct mips_got_info *g) { struct mips_got_entry entry, **loc; @@ -2094,8 +2028,7 @@ mips_elf_record_local_got_symbol (abfd, symndx, addend, g) /* Compute the hash value of the bfd in a bfd2got hash entry. */ static hashval_t -mips_elf_bfd2got_entry_hash (entry_) - const PTR entry_; +mips_elf_bfd2got_entry_hash (const void *entry_) { const struct mips_elf_bfd2got_hash *entry = (struct mips_elf_bfd2got_hash *)entry_; @@ -2106,9 +2039,7 @@ mips_elf_bfd2got_entry_hash (entry_) /* Check whether two hash entries have the same bfd. */ static int -mips_elf_bfd2got_entry_eq (entry1, entry2) - const PTR entry1; - const PTR entry2; +mips_elf_bfd2got_entry_eq (const void *entry1, const void *entry2) { const struct mips_elf_bfd2got_hash *e1 = (const struct mips_elf_bfd2got_hash *)entry1; @@ -2122,9 +2053,7 @@ mips_elf_bfd2got_entry_eq (entry1, entry2) be the master GOT data. */ static struct mips_got_info * -mips_elf_got_for_ibfd (g, ibfd) - struct mips_got_info *g; - bfd *ibfd; +mips_elf_got_for_ibfd (struct mips_got_info *g, bfd *ibfd) { struct mips_elf_bfd2got_hash e, *p; @@ -2132,7 +2061,7 @@ mips_elf_got_for_ibfd (g, ibfd) return g; e.bfd = ibfd; - p = (struct mips_elf_bfd2got_hash *) htab_find (g->bfd2got, &e); + p = htab_find (g->bfd2got, &e); return p ? p->g : NULL; } @@ -2141,9 +2070,7 @@ mips_elf_got_for_ibfd (g, ibfd) bfd requires. */ static int -mips_elf_make_got_per_bfd (entryp, p) - void **entryp; - void *p; +mips_elf_make_got_per_bfd (void **entryp, void *p) { struct mips_got_entry *entry = (struct mips_got_entry *)*entryp; struct mips_elf_got_per_bfd_arg *arg = (struct mips_elf_got_per_bfd_arg *)p; @@ -2187,8 +2114,7 @@ mips_elf_make_got_per_bfd (entryp, p) g->local_gotno = 0; g->assigned_gotno = -1; g->got_entries = htab_try_create (1, mips_elf_multi_got_entry_hash, - mips_elf_multi_got_entry_eq, - (htab_del) NULL); + mips_elf_multi_got_entry_eq, NULL); if (g->got_entries == NULL) { arg->obfd = 0; @@ -2222,9 +2148,7 @@ mips_elf_make_got_per_bfd (entryp, p) and then make make the new got current. */ static int -mips_elf_merge_gots (bfd2got_, p) - void **bfd2got_; - void *p; +mips_elf_merge_gots (void **bfd2got_, void *p) { struct mips_elf_bfd2got_hash *bfd2got = (struct mips_elf_bfd2got_hash *)*bfd2got_; @@ -2263,7 +2187,7 @@ mips_elf_merge_gots (bfd2got_, p) got entries, since they're all in the master got_entries hash table anyway. */ - BFD_ASSERT (old_lcount + lcount == arg->primary->local_gotno); + BFD_ASSERT (old_lcount + lcount >= arg->primary->local_gotno); BFD_ASSERT (old_gcount + gcount >= arg->primary->global_gotno); arg->primary_count = arg->primary->local_gotno @@ -2287,7 +2211,7 @@ mips_elf_merge_gots (bfd2got_, p) htab_delete (g->got_entries); - BFD_ASSERT (old_lcount + lcount == arg->current->local_gotno); + BFD_ASSERT (old_lcount + lcount >= arg->current->local_gotno); BFD_ASSERT (old_gcount + gcount >= arg->current->global_gotno); arg->current_count = arg->current->local_gotno @@ -2318,12 +2242,10 @@ mips_elf_merge_gots (bfd2got_, p) first available global GOT entry in G. VALUE must contain the size of a GOT entry in bytes. For each global GOT entry that requires a dynamic relocation, NEEDED_RELOCS is incremented, and the symbol is - marked as not elligible for lazy resolution through a function + marked as not eligible for lazy resolution through a function stub. */ static int -mips_elf_set_global_got_offset (entryp, p) - void **entryp; - void *p; +mips_elf_set_global_got_offset (void **entryp, void *p) { struct mips_got_entry *entry = (struct mips_got_entry *)*entryp; struct mips_elf_set_global_got_offset_arg *arg @@ -2338,10 +2260,6 @@ mips_elf_set_global_got_offset (entryp, p) BFD_ASSERT (g->global_gotsym == NULL); entry->gotidx = arg->value * (long) g->assigned_gotno++; - /* We can't do lazy update of GOT entries for - non-primary GOTs since the PLT entries don't use the - right offsets, so punt at it for now. */ - entry->d.h->no_fn_stub = TRUE; if (arg->info->shared || (elf_hash_table (arg->info)->dynamic_sections_created && ((entry->d.h->root.elf_link_hash_flags @@ -2357,6 +2275,21 @@ mips_elf_set_global_got_offset (entryp, p) return 1; } +/* Mark any global symbols referenced in the GOT we are iterating over + as inelligible for lazy resolution stubs. */ +static int +mips_elf_set_no_stub (void **entryp, void *p ATTRIBUTE_UNUSED) +{ + struct mips_got_entry *entry = (struct mips_got_entry *)*entryp; + + if (entry->abfd != NULL + && entry->symndx == -1 + && entry->d.h->root.dynindx != -1) + entry->d.h->no_fn_stub = TRUE; + + return 1; +} + /* Follow indirect and warning hash entries so that each got entry points to the final symbol definition. P must point to a pointer to the hash table we're traversing. Since this traversal may @@ -2364,9 +2297,7 @@ mips_elf_set_global_got_offset (entryp, p) we've made a potentially-destructive change to the hash table, so the traversal must be restarted. */ static int -mips_elf_resolve_final_got_entry (entryp, p) - void **entryp; - void *p; +mips_elf_resolve_final_got_entry (void **entryp, void *p) { struct mips_got_entry *entry = (struct mips_got_entry *)*entryp; htab_t got_entries = *(htab_t *)p; @@ -2408,8 +2339,7 @@ mips_elf_resolve_final_got_entry (entryp, p) /* Turn indirect got entries in a got_entries table into their final locations. */ static void -mips_elf_resolve_final_got_entries (g) - struct mips_got_info *g; +mips_elf_resolve_final_got_entries (struct mips_got_info *g) { htab_t got_entries; @@ -2427,10 +2357,7 @@ mips_elf_resolve_final_got_entries (g) /* Return the offset of an input bfd IBFD's GOT from the beginning of the primary GOT. */ static bfd_vma -mips_elf_adjust_gp (abfd, g, ibfd) - bfd *abfd; - struct mips_got_info *g; - bfd *ibfd; +mips_elf_adjust_gp (bfd *abfd, struct mips_got_info *g, bfd *ibfd) { if (g->bfd2got == NULL) return 0; @@ -2450,12 +2377,9 @@ mips_elf_adjust_gp (abfd, g, ibfd) a sequence of GOTs, each one 16-bit addressable. */ static bfd_boolean -mips_elf_multi_got (abfd, info, g, got, pages) - bfd *abfd; - struct bfd_link_info *info; - struct mips_got_info *g; - asection *got; - bfd_size_type pages; +mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info, + struct mips_got_info *g, asection *got, + bfd_size_type pages) { struct mips_elf_got_per_bfd_arg got_per_bfd_arg; struct mips_elf_set_global_got_offset_arg set_got_offset_arg; @@ -2463,8 +2387,7 @@ mips_elf_multi_got (abfd, info, g, got, pages) unsigned int assign; g->bfd2got = htab_try_create (1, mips_elf_bfd2got_entry_hash, - mips_elf_bfd2got_entry_eq, - (htab_del) NULL); + mips_elf_bfd2got_entry_eq, NULL); if (g->bfd2got == NULL) return FALSE; @@ -2509,7 +2432,7 @@ mips_elf_multi_got (abfd, info, g, got, pages) g->next->assigned_gotno = 0; g->next->got_entries = htab_try_create (1, mips_elf_multi_got_entry_hash, mips_elf_multi_got_entry_eq, - (htab_del) NULL); + NULL); if (g->next->got_entries == NULL) return FALSE; g->next->bfd2got = NULL; @@ -2624,6 +2547,11 @@ mips_elf_multi_got (abfd, info, g, got, pages) g->next = gg->next; gg->next = g; g = gn; + + /* Mark global symbols in every non-primary GOT as ineligible for + stubs. */ + if (g) + htab_traverse (g->got_entries, mips_elf_set_no_stub, NULL); } while (g); @@ -2638,11 +2566,9 @@ mips_elf_multi_got (abfd, info, g, got, pages) RELOCATION. RELEND is one-past-the-end of the relocation table. */ static const Elf_Internal_Rela * -mips_elf_next_relocation (abfd, r_type, relocation, relend) - bfd *abfd ATTRIBUTE_UNUSED; - unsigned int r_type; - const Elf_Internal_Rela *relocation; - const Elf_Internal_Rela *relend; +mips_elf_next_relocation (bfd *abfd ATTRIBUTE_UNUSED, unsigned int r_type, + const Elf_Internal_Rela *relocation, + const Elf_Internal_Rela *relend) { /* According to the MIPS ELF ABI, the R_MIPS_LO16 relocation must be immediately following. However, for the IRIX6 ABI, the next @@ -2666,12 +2592,10 @@ mips_elf_next_relocation (abfd, r_type, relocation, relend) /* Return whether a relocation is against a local symbol. */ static bfd_boolean -mips_elf_local_relocation_p (input_bfd, relocation, local_sections, - check_forced) - bfd *input_bfd; - const Elf_Internal_Rela *relocation; - asection **local_sections; - bfd_boolean check_forced; +mips_elf_local_relocation_p (bfd *input_bfd, + const Elf_Internal_Rela *relocation, + asection **local_sections, + bfd_boolean check_forced) { unsigned long r_symndx; Elf_Internal_Shdr *symtab_hdr; @@ -2707,9 +2631,7 @@ mips_elf_local_relocation_p (input_bfd, relocation, local_sections, /* Sign-extend VALUE, which has the indicated number of BITS. */ bfd_vma -_bfd_mips_elf_sign_extend (value, bits) - bfd_vma value; - int bits; +_bfd_mips_elf_sign_extend (bfd_vma value, int bits) { if (value & ((bfd_vma) 1 << (bits - 1))) /* VALUE is negative. */ @@ -2719,13 +2641,11 @@ _bfd_mips_elf_sign_extend (value, bits) } /* Return non-zero if the indicated VALUE has overflowed the maximum - range expressable by a signed number with the indicated number of + range expressible by a signed number with the indicated number of BITS. */ static bfd_boolean -mips_elf_overflow_p (value, bits) - bfd_vma value; - int bits; +mips_elf_overflow_p (bfd_vma value, int bits) { bfd_signed_vma svalue = (bfd_signed_vma) value; @@ -2743,8 +2663,7 @@ mips_elf_overflow_p (value, bits) /* Calculate the %high function. */ static bfd_vma -mips_elf_high (value) - bfd_vma value; +mips_elf_high (bfd_vma value) { return ((value + (bfd_vma) 0x8000) >> 16) & 0xffff; } @@ -2752,8 +2671,7 @@ mips_elf_high (value) /* Calculate the %higher function. */ static bfd_vma -mips_elf_higher (value) - bfd_vma value ATTRIBUTE_UNUSED; +mips_elf_higher (bfd_vma value ATTRIBUTE_UNUSED) { #ifdef BFD64 return ((value + (bfd_vma) 0x80008000) >> 32) & 0xffff; @@ -2766,8 +2684,7 @@ mips_elf_higher (value) /* Calculate the %highest function. */ static bfd_vma -mips_elf_highest (value) - bfd_vma value ATTRIBUTE_UNUSED; +mips_elf_highest (bfd_vma value ATTRIBUTE_UNUSED) { #ifdef BFD64 return ((value + (((bfd_vma) 0x8000 << 32) | 0x80008000)) >> 48) & 0xffff; @@ -2780,9 +2697,8 @@ mips_elf_highest (value) /* Create the .compact_rel section. */ static bfd_boolean -mips_elf_create_compact_rel_section (abfd, info) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; +mips_elf_create_compact_rel_section + (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED) { flagword flags; register asection *s; @@ -2808,10 +2724,8 @@ mips_elf_create_compact_rel_section (abfd, info) /* Create the .got section to hold the global offset table. */ static bfd_boolean -mips_elf_create_got_section (abfd, info, maybe_exclude) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean maybe_exclude; +mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info, + bfd_boolean maybe_exclude) { flagword flags; register asection *s; @@ -2849,8 +2763,7 @@ mips_elf_create_got_section (abfd, info, maybe_exclude) bh = NULL; if (! (_bfd_generic_link_add_one_symbol (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, FALSE, - get_elf_backend_data (abfd)->collect, &bh))) + 0, NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh))) return FALSE; h = (struct elf_link_hash_entry *) bh; @@ -2863,7 +2776,7 @@ mips_elf_create_got_section (abfd, info, maybe_exclude) return FALSE; amt = sizeof (struct mips_got_info); - g = (struct mips_got_info *) bfd_alloc (abfd, amt); + g = bfd_alloc (abfd, amt); if (g == NULL) return FALSE; g->global_gotsym = NULL; @@ -2873,8 +2786,7 @@ mips_elf_create_got_section (abfd, info, maybe_exclude) g->bfd2got = NULL; g->next = NULL; g->got_entries = htab_try_create (1, mips_elf_got_entry_hash, - mips_elf_got_entry_eq, - (htab_del) NULL); + mips_elf_got_entry_eq, NULL); if (g->got_entries == NULL) return FALSE; mips_elf_section_data (s)->u.got_info = g; @@ -2898,23 +2810,15 @@ mips_elf_create_got_section (abfd, info, maybe_exclude) overflow occurs, and bfd_reloc_ok to indicate success. */ static bfd_reloc_status_type -mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, - relocation, addend, howto, local_syms, - local_sections, valuep, namep, - require_jalxp, save_addend) - bfd *abfd; - bfd *input_bfd; - asection *input_section; - struct bfd_link_info *info; - const Elf_Internal_Rela *relocation; - bfd_vma addend; - reloc_howto_type *howto; - Elf_Internal_Sym *local_syms; - asection **local_sections; - bfd_vma *valuep; - const char **namep; - bfd_boolean *require_jalxp; - bfd_boolean save_addend; +mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, + asection *input_section, + struct bfd_link_info *info, + const Elf_Internal_Rela *relocation, + bfd_vma addend, reloc_howto_type *howto, + Elf_Internal_Sym *local_syms, + asection **local_sections, bfd_vma *valuep, + const char **namep, bfd_boolean *require_jalxp, + bfd_boolean save_addend) { /* The eventual value we will return. */ bfd_vma value; @@ -3518,11 +3422,9 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, /* Obtain the field relocated by RELOCATION. */ static bfd_vma -mips_elf_obtain_contents (howto, relocation, input_bfd, contents) - reloc_howto_type *howto; - const Elf_Internal_Rela *relocation; - bfd *input_bfd; - bfd_byte *contents; +mips_elf_obtain_contents (reloc_howto_type *howto, + const Elf_Internal_Rela *relocation, + bfd *input_bfd, bfd_byte *contents) { bfd_vma x; bfd_byte *location = contents + relocation->r_offset; @@ -3550,16 +3452,12 @@ mips_elf_obtain_contents (howto, relocation, input_bfd, contents) Returns FALSE if anything goes wrong. */ static bfd_boolean -mips_elf_perform_relocation (info, howto, relocation, value, input_bfd, - input_section, contents, require_jalx) - struct bfd_link_info *info; - reloc_howto_type *howto; - const Elf_Internal_Rela *relocation; - bfd_vma value; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - bfd_boolean require_jalx; +mips_elf_perform_relocation (struct bfd_link_info *info, + reloc_howto_type *howto, + const Elf_Internal_Rela *relocation, + bfd_vma value, bfd *input_bfd, + asection *input_section, bfd_byte *contents, + bfd_boolean require_jalx) { bfd_vma x; bfd_byte *location; @@ -3721,9 +3619,7 @@ mips_elf_perform_relocation (info, howto, relocation, value, input_bfd, /* Returns TRUE if SECTION is a MIPS16 stub section. */ static bfd_boolean -mips_elf_stub_section_p (abfd, section) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section; +mips_elf_stub_section_p (bfd *abfd ATTRIBUTE_UNUSED, asection *section) { const char *name = bfd_get_section_name (abfd, section); @@ -3735,9 +3631,7 @@ mips_elf_stub_section_p (abfd, section) /* Add room for N relocations to the .rel.dyn section in ABFD. */ static void -mips_elf_allocate_dynamic_relocations (abfd, n) - bfd *abfd; - unsigned int n; +mips_elf_allocate_dynamic_relocations (bfd *abfd, unsigned int n) { asection *s; @@ -3759,16 +3653,12 @@ mips_elf_allocate_dynamic_relocations (abfd, n) caller should store the result in place of the original addend. */ static bfd_boolean -mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, - symbol, addendp, input_section) - bfd *output_bfd; - struct bfd_link_info *info; - const Elf_Internal_Rela *rel; - struct mips_elf_link_hash_entry *h; - asection *sec; - bfd_vma symbol; - bfd_vma *addendp; - asection *input_section; +mips_elf_create_dynamic_relocation (bfd *output_bfd, + struct bfd_link_info *info, + const Elf_Internal_Rela *rel, + struct mips_elf_link_hash_entry *h, + asection *sec, bfd_vma symbol, + bfd_vma *addendp, asection *input_section) { Elf_Internal_Rela outrel[3]; bfd_boolean skip; @@ -3917,12 +3807,11 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, invocation if ABI_64_P, and here we should generate an additional relocation record with R_MIPS_64 by itself for a NULL symbol before this relocation record. */ - outrel[1].r_info = ELF_R_INFO (output_bfd, (unsigned long) 0, + outrel[1].r_info = ELF_R_INFO (output_bfd, 0, ABI_64_P (output_bfd) ? R_MIPS_64 : R_MIPS_NONE); - outrel[2].r_info = ELF_R_INFO (output_bfd, (unsigned long) 0, - R_MIPS_NONE); + outrel[2].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_NONE); /* Adjust the output offset of the relocation to reference the correct location in the output file. */ @@ -3993,8 +3882,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, /* Return the MACH for a MIPS e_flags value. */ unsigned long -_bfd_elf_mips_mach (flags) - flagword flags; +_bfd_elf_mips_mach (flagword flags) { switch (flags & EF_MIPS_MACH) { @@ -4073,8 +3961,7 @@ _bfd_elf_mips_mach (flags) /* Return printable name for ABI. */ static INLINE char * -elf_mips_abi_name (abfd) - bfd *abfd; +elf_mips_abi_name (bfd *abfd) { flagword flags; @@ -4121,9 +4008,7 @@ static asymbol *mips_elf_acom_symbol_ptr; This is used for both the 32-bit and the 64-bit ABI. */ void -_bfd_mips_elf_symbol_processing (abfd, asym) - bfd *abfd; - asymbol *asym; +_bfd_mips_elf_symbol_processing (bfd *abfd, asymbol *asym) { elf_symbol_type *elfsym; @@ -4199,9 +4084,7 @@ _bfd_mips_elf_symbol_processing (abfd, asym) a better way. */ bfd_boolean -_bfd_mips_elf_section_processing (abfd, hdr) - bfd *abfd; - Elf_Internal_Shdr *hdr; +_bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr) { if (hdr->sh_type == SHT_MIPS_REGINFO && hdr->sh_size > 0) @@ -4216,7 +4099,7 @@ _bfd_mips_elf_section_processing (abfd, hdr) SEEK_SET) != 0) return FALSE; H_PUT_32 (abfd, elf_gp (abfd), buf); - if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4) + if (bfd_bwrite (buf, 4, abfd) != 4) return FALSE; } @@ -4255,7 +4138,7 @@ _bfd_mips_elf_section_processing (abfd, hdr) SEEK_SET) != 0) return FALSE; H_PUT_64 (abfd, elf_gp (abfd), buf); - if (bfd_bwrite (buf, (bfd_size_type) 8, abfd) != 8) + if (bfd_bwrite (buf, 8, abfd) != 8) return FALSE; } else if (intopt.kind == ODK_REGINFO) @@ -4270,7 +4153,7 @@ _bfd_mips_elf_section_processing (abfd, hdr) SEEK_SET) != 0) return FALSE; H_PUT_32 (abfd, elf_gp (abfd), buf); - if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4) + if (bfd_bwrite (buf, 4, abfd) != 4) return FALSE; } l += intopt.size; @@ -4327,10 +4210,8 @@ _bfd_mips_elf_section_processing (abfd, hdr) how to. */ bfd_boolean -_bfd_mips_elf_section_from_shdr (abfd, hdr, name) - bfd *abfd; - Elf_Internal_Shdr *hdr; - const char *name; +_bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, + const char *name) { flagword flags = 0; @@ -4425,9 +4306,8 @@ _bfd_mips_elf_section_from_shdr (abfd, hdr, name) Elf32_External_RegInfo ext; Elf32_RegInfo s; - if (! bfd_get_section_contents (abfd, hdr->bfd_section, (PTR) &ext, - (file_ptr) 0, - (bfd_size_type) sizeof ext)) + if (! bfd_get_section_contents (abfd, hdr->bfd_section, + &ext, 0, sizeof ext)) return FALSE; bfd_mips_elf32_swap_reginfo_in (abfd, &ext, &s); elf_gp (abfd) = s.ri_gp_value; @@ -4441,11 +4321,11 @@ _bfd_mips_elf_section_from_shdr (abfd, hdr, name) { bfd_byte *contents, *l, *lend; - contents = (bfd_byte *) bfd_malloc (hdr->sh_size); + contents = bfd_malloc (hdr->sh_size); if (contents == NULL) return FALSE; if (! bfd_get_section_contents (abfd, hdr->bfd_section, contents, - (file_ptr) 0, hdr->sh_size)) + 0, hdr->sh_size)) { free (contents); return FALSE; @@ -4493,10 +4373,7 @@ _bfd_mips_elf_section_from_shdr (abfd, hdr, name) used by both the 32-bit and the 64-bit ABI. */ bfd_boolean -_bfd_mips_elf_fake_sections (abfd, hdr, sec) - bfd *abfd; - Elf_Internal_Shdr *hdr; - asection *sec; +_bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) { register const char *name; @@ -4618,10 +4495,8 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec) the .scommon section. */ bfd_boolean -_bfd_mips_elf_section_from_bfd_section (abfd, sec, retval) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec; - int *retval; +_bfd_mips_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec, int *retval) { if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) { @@ -4640,14 +4515,10 @@ _bfd_mips_elf_section_from_bfd_section (abfd, sec, retval) file. We must handle the special MIPS section numbers here. */ bfd_boolean -_bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) - bfd *abfd; - struct bfd_link_info *info; - const Elf_Internal_Sym *sym; - const char **namep; - flagword *flagsp ATTRIBUTE_UNUSED; - asection **secp; - bfd_vma *valp; +_bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, + const Elf_Internal_Sym *sym, const char **namep, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp, bfd_vma *valp) { if (SGI_COMPAT (abfd) && (abfd->flags & DYNAMIC) != 0 @@ -4769,8 +4640,7 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) /* Mark __rld_obj_head as dynamic. */ bh = NULL; if (! (_bfd_generic_link_add_one_symbol - (info, abfd, *namep, BSF_GLOBAL, *secp, - (bfd_vma) *valp, (const char *) NULL, FALSE, + (info, abfd, *namep, BSF_GLOBAL, *secp, *valp, NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh))) return FALSE; @@ -4799,12 +4669,10 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) also where we undo the increment of the value for a mips16 symbol. */ bfd_boolean -_bfd_mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - const char *name ATTRIBUTE_UNUSED; - Elf_Internal_Sym *sym; - asection *input_sec; +_bfd_mips_elf_link_output_symbol_hook + (struct bfd_link_info *info ATTRIBUTE_UNUSED, + const char *name ATTRIBUTE_UNUSED, Elf_Internal_Sym *sym, + asection *input_sec, struct elf_link_hash_entry *h ATTRIBUTE_UNUSED) { /* If we see a common symbol, which implies a relocatable link, then if a symbol was small common in an input file, mark it as small @@ -4825,9 +4693,7 @@ _bfd_mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec) /* Create dynamic sections when linking against a dynamic object. */ bfd_boolean -_bfd_mips_elf_create_dynamic_sections (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +_bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) { struct elf_link_hash_entry *h; struct bfd_link_hash_entry *bh; @@ -4887,9 +4753,8 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info) { bh = NULL; if (! (_bfd_generic_link_add_one_symbol - (info, abfd, *namep, BSF_GLOBAL, bfd_und_section_ptr, - (bfd_vma) 0, (const char *) NULL, FALSE, - get_elf_backend_data (abfd)->collect, &bh))) + (info, abfd, *namep, BSF_GLOBAL, bfd_und_section_ptr, 0, + NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh))) return FALSE; h = (struct elf_link_hash_entry *) bh; @@ -4933,9 +4798,8 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info) name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING"; bh = NULL; if (!(_bfd_generic_link_add_one_symbol - (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, - (bfd_vma) 0, (const char *) NULL, FALSE, - get_elf_backend_data (abfd)->collect, &bh))) + (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, 0, + NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh))) return FALSE; h = (struct elf_link_hash_entry *) bh; @@ -4958,8 +4822,7 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info) name = SGI_COMPAT (abfd) ? "__rld_map" : "__RLD_MAP"; bh = NULL; if (!(_bfd_generic_link_add_one_symbol - (info, abfd, name, BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, FALSE, + (info, abfd, name, BSF_GLOBAL, s, 0, NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh))) return FALSE; @@ -4980,11 +4843,8 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info) allocate space in the global offset table. */ bfd_boolean -_bfd_mips_elf_check_relocs (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; +_bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs) { const char *name; bfd *dynobj; @@ -5043,8 +4903,7 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs) continue; sec_relocs - = _bfd_elf_link_read_relocs (abfd, o, (PTR) NULL, - (Elf_Internal_Rela *) NULL, + = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, info->keep_memory); if (sec_relocs == NULL) return FALSE; @@ -5086,7 +4945,7 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs) else symcount = symtab_hdr->sh_info; amt = symcount * sizeof (asection *); - n = (asection **) bfd_zalloc (abfd, amt); + n = bfd_zalloc (abfd, amt); if (n == NULL) return FALSE; elf_tdata (abfd)->local_stubs = n; @@ -5476,11 +5335,9 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs) } bfd_boolean -_bfd_mips_relax_section (abfd, sec, link_info, again) - bfd *abfd; - asection *sec; - struct bfd_link_info *link_info; - bfd_boolean *again; +_bfd_mips_relax_section (bfd *abfd, asection *sec, + struct bfd_link_info *link_info, + bfd_boolean *again) { Elf_Internal_Rela *internal_relocs; Elf_Internal_Rela *irel, *irelend; @@ -5498,8 +5355,7 @@ _bfd_mips_relax_section (abfd, sec, link_info, again) if (link_info->relocatable) return TRUE; - internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, (PTR) NULL, - (Elf_Internal_Rela *) NULL, + internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, link_info->keep_memory); if (internal_relocs == NULL) return TRUE; @@ -5608,13 +5464,13 @@ _bfd_mips_relax_section (abfd, sec, link_info, again) contents = elf_section_data (sec)->this_hdr.contents; else { - contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + contents = bfd_malloc (sec->_raw_size); if (contents == NULL) goto relax_return; free_contents = contents; if (! bfd_get_section_contents (abfd, sec, contents, - (file_ptr) 0, sec->_raw_size)) + 0, sec->_raw_size)) goto relax_return; } } @@ -5661,9 +5517,8 @@ _bfd_mips_relax_section (abfd, sec, link_info, again) understand. */ bfd_boolean -_bfd_mips_elf_adjust_dynamic_symbol (info, h) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; +_bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) { bfd *dynobj; struct mips_elf_link_hash_entry *hmips; @@ -5764,9 +5619,8 @@ _bfd_mips_elf_adjust_dynamic_symbol (info, h) check for any mips16 stub sections that we can discard. */ bfd_boolean -_bfd_mips_elf_always_size_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; +_bfd_mips_elf_always_size_sections (bfd *output_bfd, + struct bfd_link_info *info) { asection *ri; @@ -5781,14 +5635,12 @@ _bfd_mips_elf_always_size_sections (output_bfd, info) /* The .reginfo section has a fixed size. */ ri = bfd_get_section_by_name (output_bfd, ".reginfo"); if (ri != NULL) - bfd_set_section_size (output_bfd, ri, - (bfd_size_type) sizeof (Elf32_External_RegInfo)); + bfd_set_section_size (output_bfd, ri, sizeof (Elf32_External_RegInfo)); if (! (info->relocatable || ! mips_elf_hash_table (info)->mips16_stubs_seen)) mips_elf_link_hash_traverse (mips_elf_hash_table (info), - mips_elf_check_mips16_stubs, - (PTR) NULL); + mips_elf_check_mips16_stubs, NULL); dynobj = elf_hash_table (info)->dynobj; if (dynobj == NULL) @@ -5857,9 +5709,8 @@ _bfd_mips_elf_always_size_sections (output_bfd, info) /* Set the sizes of the dynamic sections. */ bfd_boolean -_bfd_mips_elf_size_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; +_bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) { bfd *dynobj; asection *s; @@ -6028,7 +5879,7 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info) } /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + s->contents = bfd_zalloc (dynobj, s->_raw_size); if (s->contents == NULL && s->_raw_size != 0) { bfd_set_error (bfd_error_no_memory); @@ -6143,16 +5994,11 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info) /* Relocate a MIPS ELF section. */ bfd_boolean -_bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - Elf_Internal_Rela *relocs; - Elf_Internal_Sym *local_syms; - asection **local_sections; +_bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + bfd *input_bfd, asection *input_section, + bfd_byte *contents, Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) { Elf_Internal_Rela *rel; const Elf_Internal_Rela *relend; @@ -6172,7 +6018,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, REL relocation. */ bfd_boolean rela_relocation_p = TRUE; unsigned int r_type = ELF_R_TYPE (output_bfd, rel->r_info); - const char * msg = (const char *) NULL; + const char *msg; /* Find the relocation howto for this relocation. */ if (r_type == R_MIPS_64 && ! NEWABI_P (input_bfd)) @@ -6450,7 +6296,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, { BFD_ASSERT (name != NULL); if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, + (info, name, howto->name, 0, input_bfd, input_section, rel->r_offset))) return FALSE; } @@ -6531,10 +6377,8 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, adjust it appropriately now. */ static void -mips_elf_irix6_finish_dynamic_symbol (abfd, name, sym) - bfd *abfd ATTRIBUTE_UNUSED; - const char *name; - Elf_Internal_Sym *sym; +mips_elf_irix6_finish_dynamic_symbol (bfd *abfd ATTRIBUTE_UNUSED, + const char *name, Elf_Internal_Sym *sym) { /* The linker script takes care of providing names and values for these, but we must place them into the right sections. */ @@ -6583,11 +6427,10 @@ mips_elf_irix6_finish_dynamic_symbol (abfd, name, sym) dynamic sections here. */ bfd_boolean -_bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) - bfd *output_bfd; - struct bfd_link_info *info; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; +_bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, + struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { bfd *dynobj; bfd_vma gval; @@ -6660,10 +6503,8 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) if (g->next && h->dynindx != -1) { struct mips_got_entry e, *p; + bfd_vma entry; bfd_vma offset; - bfd_vma value; - Elf_Internal_Rela rel[3]; - bfd_vma addend = 0; gg = g; @@ -6671,18 +6512,6 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) e.symndx = -1; e.d.h = (struct mips_elf_link_hash_entry *)h; - if (info->shared - || h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak) - value = 0; - else if (sym->st_value) - value = sym->st_value; - else - value = h->root.u.def.value; - - memset (rel, 0, sizeof (rel)); - rel[0].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_REL32); - for (g = g->next; g->next != gg; g = g->next) { if (g->got_entries @@ -6690,22 +6519,37 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) &e))) { offset = p->gotidx; - rel[0].r_offset = rel[1].r_offset = rel[2].r_offset = offset; - - MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset); - - if ((info->shared - || (elf_hash_table (info)->dynamic_sections_created - && p->d.h != NULL - && ((p->d.h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0) - && ((p->d.h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) - && ! (mips_elf_create_dynamic_relocation - (output_bfd, info, rel, - e.d.h, NULL, value, &addend, sgot))) - return FALSE; - BFD_ASSERT (addend == 0); + if (info->shared + || (elf_hash_table (info)->dynamic_sections_created + && p->d.h != NULL + && ((p->d.h->root.elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0) + && ((p->d.h->root.elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) + { + /* Create an R_MIPS_REL32 relocation for this entry. Due to + the various compatibility problems, it's easier to mock + up an R_MIPS_32 or R_MIPS_64 relocation and leave + mips_elf_create_dynamic_relocation to calculate the + appropriate addend. */ + Elf_Internal_Rela rel[3]; + + memset (rel, 0, sizeof (rel)); + if (ABI_64_P (output_bfd)) + rel[0].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_64); + else + rel[0].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_32); + rel[0].r_offset = rel[1].r_offset = rel[2].r_offset = offset; + + entry = 0; + if (! (mips_elf_create_dynamic_relocation + (output_bfd, info, rel, + e.d.h, NULL, sym->st_value, &entry, sgot))) + return FALSE; + } + else + entry = sym->st_value; + MIPS_ELF_PUT_WORD (output_bfd, entry, sgot->contents + offset); } } } @@ -6767,7 +6611,7 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) asection *s = bfd_get_section_by_name (dynobj, ".rld_map"); BFD_ASSERT (s != NULL); sym->st_value = s->output_section->vma + s->output_offset; - bfd_put_32 (output_bfd, (bfd_vma) 0, s->contents); + bfd_put_32 (output_bfd, 0, s->contents); if (mips_elf_hash_table (info)->rld_value == 0) mips_elf_hash_table (info)->rld_value = sym->st_value; } @@ -6794,9 +6638,8 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) /* Finish up the dynamic sections. */ bfd_boolean -_bfd_mips_elf_finish_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; +_bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) { bfd *dynobj; asection *sdyn; @@ -6966,8 +6809,8 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) This isn't the case of IRIX rld. */ if (sgot != NULL && sgot->_raw_size > 0) { - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents); - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000, + MIPS_ELF_PUT_WORD (output_bfd, 0, sgot->contents); + MIPS_ELF_PUT_WORD (output_bfd, 0x80000000, sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd)); } @@ -6988,9 +6831,9 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) { bfd_vma index = g->next->local_gotno + g->next->global_gotno; - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents + MIPS_ELF_PUT_WORD (output_bfd, 0, sgot->contents + index++ * MIPS_ELF_GOT_SIZE (output_bfd)); - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000, sgot->contents + MIPS_ELF_PUT_WORD (output_bfd, 0x80000000, sgot->contents + index++ * MIPS_ELF_GOT_SIZE (output_bfd)); if (! info->shared) @@ -7056,12 +6899,10 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) reldyn_sorting_bfd = output_bfd; if (ABI_64_P (output_bfd)) - qsort ((Elf64_External_Rel *) s->contents + 1, - (size_t) s->reloc_count - 1, + qsort ((Elf64_External_Rel *) s->contents + 1, s->reloc_count - 1, sizeof (Elf64_Mips_External_Rel), sort_dynamic_relocs_64); else - qsort ((Elf32_External_Rel *) s->contents + 1, - (size_t) s->reloc_count - 1, + qsort ((Elf32_External_Rel *) s->contents + 1, s->reloc_count - 1, sizeof (Elf32_External_Rel), sort_dynamic_relocs); } } @@ -7073,8 +6914,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) /* Set ABFD's EF_MIPS_ARCH and EF_MIPS_MACH flags. */ static void -mips_set_isa_flags (abfd) - bfd *abfd; +mips_set_isa_flags (bfd *abfd) { flagword val; @@ -7171,9 +7011,8 @@ mips_set_isa_flags (abfd) number. This is used by both the 32-bit and the 64-bit ABI. */ void -_bfd_mips_elf_final_write_processing (abfd, linker) - bfd *abfd; - bfd_boolean linker ATTRIBUTE_UNUSED; +_bfd_mips_elf_final_write_processing (bfd *abfd, + bfd_boolean linker ATTRIBUTE_UNUSED) { unsigned int i; Elf_Internal_Shdr **hdrpp; @@ -7259,8 +7098,7 @@ _bfd_mips_elf_final_write_processing (abfd, linker) segments. */ int -_bfd_mips_elf_additional_program_headers (abfd) - bfd *abfd; +_bfd_mips_elf_additional_program_headers (bfd *abfd) { asection *s; int ret = 0; @@ -7288,8 +7126,8 @@ _bfd_mips_elf_additional_program_headers (abfd) /* Modify the segment map for an IRIX5 executable. */ bfd_boolean -_bfd_mips_elf_modify_segment_map (abfd) - bfd *abfd; +_bfd_mips_elf_modify_segment_map (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *s; struct elf_segment_map *m, **pm; @@ -7306,7 +7144,7 @@ _bfd_mips_elf_modify_segment_map (abfd) if (m == NULL) { amt = sizeof *m; - m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + m = bfd_zalloc (abfd, amt); if (m == NULL) return FALSE; @@ -7378,7 +7216,7 @@ _bfd_mips_elf_modify_segment_map (abfd) if (m == NULL) { amt = sizeof *m; - m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + m = bfd_zalloc (abfd, amt); if (m == NULL) return FALSE; @@ -7469,7 +7307,7 @@ _bfd_mips_elf_modify_segment_map (abfd) ++c; amt = sizeof *n + (bfd_size_type) (c - 1) * sizeof (asection *); - n = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + n = bfd_zalloc (abfd, amt); if (n == NULL) return FALSE; *n = *m; @@ -7500,12 +7338,11 @@ _bfd_mips_elf_modify_segment_map (abfd) relocation. */ asection * -_bfd_mips_elf_gc_mark_hook (sec, info, rel, h, sym) - asection *sec; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; +_bfd_mips_elf_gc_mark_hook (asection *sec, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Rela *rel, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { /* ??? Do mips16 stub sections need to be handled special? */ @@ -7541,11 +7378,10 @@ _bfd_mips_elf_gc_mark_hook (sec, info, rel, h, sym) /* Update the got entry reference counts for the section being removed. */ bfd_boolean -_bfd_mips_elf_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; - const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +_bfd_mips_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED) { #if 0 Elf_Internal_Shdr *symtab_hdr; @@ -7591,9 +7427,9 @@ _bfd_mips_elf_gc_sweep_hook (abfd, info, sec, relocs) _bfd_elf_link_hash_copy_indirect copy the flags for us. */ void -_bfd_mips_elf_copy_indirect_symbol (bed, dir, ind) - const struct elf_backend_data *bed; - struct elf_link_hash_entry *dir, *ind; +_bfd_mips_elf_copy_indirect_symbol (const struct elf_backend_data *bed, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) { struct mips_elf_link_hash_entry *dirmips, *indmips; @@ -7612,10 +7448,9 @@ _bfd_mips_elf_copy_indirect_symbol (bed, dir, ind) } void -_bfd_mips_elf_hide_symbol (info, entry, force_local) - struct bfd_link_info *info; - struct elf_link_hash_entry *entry; - bfd_boolean force_local; +_bfd_mips_elf_hide_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *entry, + bfd_boolean force_local) { bfd *dynobj; asection *got; @@ -7687,10 +7522,8 @@ _bfd_mips_elf_hide_symbol (info, entry, force_local) #define PDR_SIZE 32 bfd_boolean -_bfd_mips_elf_discard_info (abfd, cookie, info) - bfd *abfd; - struct elf_reloc_cookie *cookie; - struct bfd_link_info *info; +_bfd_mips_elf_discard_info (bfd *abfd, struct elf_reloc_cookie *cookie, + struct bfd_link_info *info) { asection *o; bfd_boolean ret = FALSE; @@ -7712,8 +7545,7 @@ _bfd_mips_elf_discard_info (abfd, cookie, info) if (! tdata) return FALSE; - cookie->rels = _bfd_elf_link_read_relocs (abfd, o, (PTR) NULL, - (Elf_Internal_Rela *) NULL, + cookie->rels = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, info->keep_memory); if (!cookie->rels) { @@ -7749,8 +7581,7 @@ _bfd_mips_elf_discard_info (abfd, cookie, info) } bfd_boolean -_bfd_mips_elf_ignore_discarded_relocs (sec) - asection *sec; +_bfd_mips_elf_ignore_discarded_relocs (asection *sec) { if (strcmp (sec->name, ".pdr") == 0) return TRUE; @@ -7758,10 +7589,8 @@ _bfd_mips_elf_ignore_discarded_relocs (sec) } bfd_boolean -_bfd_mips_elf_write_section (output_bfd, sec, contents) - bfd *output_bfd; - asection *sec; - bfd_byte *contents; +_bfd_mips_elf_write_section (bfd *output_bfd, asection *sec, + bfd_byte *contents) { bfd_byte *to, *from, *end; int i; @@ -7785,8 +7614,7 @@ _bfd_mips_elf_write_section (output_bfd, sec, contents) to += PDR_SIZE; } bfd_set_section_contents (output_bfd, sec->output_section, contents, - (file_ptr) sec->output_offset, - sec->_cooked_size); + sec->output_offset, sec->_cooked_size); return TRUE; } @@ -7800,15 +7628,11 @@ struct mips_elf_find_line }; bfd_boolean -_bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, - functionname_ptr, line_ptr) - bfd *abfd; - asection *section; - asymbol **symbols; - bfd_vma offset; - const char **filename_ptr; - const char **functionname_ptr; - unsigned int *line_ptr; +_bfd_mips_elf_find_nearest_line (bfd *abfd, asection *section, + asymbol **symbols, bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *line_ptr) { asection *msec; @@ -7819,8 +7643,7 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, filename_ptr, functionname_ptr, - line_ptr, - (unsigned) (ABI_64_P (abfd) ? 8 : 0), + line_ptr, ABI_64_P (abfd) ? 8 : 0, &elf_tdata (abfd)->dwarf2_find_line_info)) return TRUE; @@ -7848,7 +7671,7 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, struct fdr *fdr_ptr; bfd_size_type amt = sizeof (struct mips_elf_find_line); - fi = (struct mips_elf_find_line *) bfd_zalloc (abfd, amt); + fi = bfd_zalloc (abfd, amt); if (fi == NULL) { msec->flags = origflags; @@ -7863,7 +7686,7 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, /* Swap in the FDR information. */ amt = fi->d.symbolic_header.ifdMax * sizeof (struct fdr); - fi->d.fdr = (struct fdr *) bfd_alloc (abfd, amt); + fi->d.fdr = bfd_alloc (abfd, amt); if (fi->d.fdr == NULL) { msec->flags = origflags; @@ -7875,7 +7698,7 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, fraw_end = (fraw_src + fi->d.symbolic_header.ifdMax * external_fdr_size); for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++) - (*swap->swap_fdr_in) (abfd, (PTR) fraw_src, fdr_ptr); + (*swap->swap_fdr_in) (abfd, fraw_src, fdr_ptr); elf_tdata (abfd)->find_line_info = fi; @@ -7910,12 +7733,9 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, GP value in the section_processing routine. */ bfd_boolean -_bfd_mips_elf_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - const PTR location; - file_ptr offset; - bfd_size_type count; +_bfd_mips_elf_set_section_contents (bfd *abfd, sec_ptr section, + const void *location, + file_ptr offset, bfd_size_type count) { if (strcmp (section->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0) { @@ -7924,7 +7744,7 @@ _bfd_mips_elf_set_section_contents (abfd, section, location, offset, count) if (elf_section_data (section) == NULL) { bfd_size_type amt = sizeof (struct bfd_elf_section_data); - section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); + section->used_by_bfd = bfd_zalloc (abfd, amt); if (elf_section_data (section) == NULL) return FALSE; } @@ -7937,13 +7757,13 @@ _bfd_mips_elf_set_section_contents (abfd, section, location, offset, count) size = section->_cooked_size; else size = section->_raw_size; - c = (bfd_byte *) bfd_zalloc (abfd, size); + c = bfd_zalloc (abfd, size); if (c == NULL) return FALSE; mips_elf_section_data (section)->u.tdata = c; } - memcpy (c + offset, location, (size_t) count); + memcpy (c + offset, location, count); } return _bfd_elf_set_section_contents (abfd, section, location, offset, @@ -7954,14 +7774,13 @@ _bfd_mips_elf_set_section_contents (abfd, section, location, offset, count) MIPS relocations need to be handled specially. Sigh. */ bfd_byte * -_bfd_elf_mips_get_relocated_section_contents (abfd, link_info, link_order, - data, relocatable, symbols) - bfd *abfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - bfd_boolean relocatable; - asymbol **symbols; +_bfd_elf_mips_get_relocated_section_contents + (bfd *abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + bfd_boolean relocatable, + asymbol **symbols) { /* Get enough memory to hold the stuff */ bfd *input_bfd = link_order->u.indirect.section->owner; @@ -7974,15 +7793,12 @@ _bfd_elf_mips_get_relocated_section_contents (abfd, link_info, link_order, if (reloc_size < 0) goto error_return; - reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); + reloc_vector = bfd_malloc (reloc_size); if (reloc_vector == NULL && reloc_size != 0) goto error_return; /* read in the section */ - if (!bfd_get_section_contents (input_bfd, - input_section, - (PTR) data, - (file_ptr) 0, + if (!bfd_get_section_contents (input_bfd, input_section, data, 0, input_section->_raw_size)) goto error_return; @@ -8045,10 +7861,9 @@ _bfd_elf_mips_get_relocated_section_contents (abfd, link_info, link_order, gp_found = 0; } /* end mips */ - for (parent = reloc_vector; *parent != (arelent *) NULL; - parent++) + for (parent = reloc_vector; *parent != NULL; parent++) { - char *error_message = (char *) NULL; + char *error_message = NULL; bfd_reloc_status_type r; /* Specific to MIPS: Deal with relocation types that require @@ -8069,16 +7884,13 @@ _bfd_elf_mips_get_relocated_section_contents (abfd, link_info, link_order, /* bypass special_function call */ r = _bfd_mips_elf_gprel16_with_gp (input_bfd, sym, *parent, input_section, relocatable, - (PTR) data, gp); + data, gp); goto skip_bfd_perform_relocation; } /* end mips specific stuff */ - r = bfd_perform_relocation (input_bfd, - *parent, - (PTR) data, - input_section, - relocatable ? abfd : (bfd *) NULL, + r = bfd_perform_relocation (input_bfd, *parent, data, input_section, + relocatable ? abfd : NULL, &error_message); skip_bfd_perform_relocation: @@ -8103,7 +7915,7 @@ _bfd_elf_mips_get_relocated_section_contents (abfd, link_info, link_order, goto error_return; break; case bfd_reloc_dangerous: - BFD_ASSERT (error_message != (char *) NULL); + BFD_ASSERT (error_message != NULL); if (!((*link_info->callbacks->reloc_dangerous) (link_info, error_message, input_bfd, input_section, (*parent)->address))) @@ -8138,14 +7950,13 @@ error_return: /* Create a MIPS ELF linker hash table. */ struct bfd_link_hash_table * -_bfd_mips_elf_link_hash_table_create (abfd) - bfd *abfd; +_bfd_mips_elf_link_hash_table_create (bfd *abfd) { struct mips_elf_link_hash_table *ret; bfd_size_type amt = sizeof (struct mips_elf_link_hash_table); - ret = (struct mips_elf_link_hash_table *) bfd_malloc (amt); - if (ret == (struct mips_elf_link_hash_table *) NULL) + ret = bfd_malloc (amt); + if (ret == NULL) return NULL; if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, @@ -8174,9 +7985,7 @@ _bfd_mips_elf_link_hash_table_create (abfd) sections together, not write them all out sequentially. */ bfd_boolean -_bfd_mips_elf_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +_bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) { asection **secpp; asection *o; @@ -8188,7 +7997,7 @@ _bfd_mips_elf_final_link (abfd, info) const struct ecoff_debug_swap *swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; HDRR *symhdr = &debug.symbolic_header; - PTR mdebug_handle = NULL; + void *mdebug_handle = NULL; asection *s; EXTR esym; unsigned int i; @@ -8284,8 +8093,7 @@ _bfd_mips_elf_final_link (abfd, info) struct bfd_link_hash_entry *h; h = bfd_link_hash_lookup (info->hash, "_gp", FALSE, FALSE, TRUE); - if (h != (struct bfd_link_hash_entry *) NULL - && h->type == bfd_link_hash_defined) + if (h != NULL && h->type == bfd_link_hash_defined) elf_gp (abfd) = (h->u.def.value + h->u.def.section->output_section->vma + h->u.def.section->output_offset); @@ -8294,7 +8102,7 @@ _bfd_mips_elf_final_link (abfd, info) bfd_vma lo = MINUS_ONE; /* Find the GP-relative section with the lowest offset. */ - for (o = abfd->sections; o != (asection *) NULL; o = o->next) + for (o = abfd->sections; o != NULL; o = o->next) if (o->vma < lo && (elf_section_data (o)->this_hdr.sh_flags & SHF_MIPS_GPREL)) lo = o->vma; @@ -8316,7 +8124,7 @@ _bfd_mips_elf_final_link (abfd, info) mdebug_sec = NULL; gptab_data_sec = NULL; gptab_bss_sec = NULL; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) + for (o = abfd->sections; o != NULL; o = o->next) { if (strcmp (o->name, ".reginfo") == 0) { @@ -8325,9 +8133,7 @@ _bfd_mips_elf_final_link (abfd, info) /* We have found the .reginfo section in the output file. Look through all the link_orders comprising it and merge the information together. */ - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) + for (p = o->link_order_head; p != NULL; p = p->next) { asection *input_section; bfd *input_bfd; @@ -8350,9 +8156,7 @@ _bfd_mips_elf_final_link (abfd, info) input_section->_raw_size = sizeof (Elf32_External_RegInfo); if (! bfd_get_section_contents (input_bfd, input_section, - (PTR) &ext, - (file_ptr) 0, - (bfd_size_type) sizeof ext)) + &ext, 0, sizeof ext)) return FALSE; bfd_mips_elf32_swap_reginfo_in (input_bfd, &ext, &sub); @@ -8377,7 +8181,7 @@ _bfd_mips_elf_final_link (abfd, info) /* Skip this section later on (I don't think this currently matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; + o->link_order_head = NULL; reginfo_sec = o; } @@ -8421,7 +8225,7 @@ _bfd_mips_elf_final_link (abfd, info) debug.external_ext = debug.external_ext_end = NULL; mdebug_handle = bfd_ecoff_debug_init (abfd, &debug, swap, info); - if (mdebug_handle == (PTR) NULL) + if (mdebug_handle == NULL) return FALSE; esym.jmptbl = 0; @@ -8450,9 +8254,7 @@ _bfd_mips_elf_final_link (abfd, info) return FALSE; } - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) + for (p = o->link_order_head; p != NULL; p = p->next) { asection *input_section; bfd *input_bfd; @@ -8514,7 +8316,7 @@ _bfd_mips_elf_final_link (abfd, info) const char *name; struct mips_elf_link_hash_entry *h; - (*input_swap->swap_ext_in) (input_bfd, (PTR) eraw_src, &ext); + (*input_swap->swap_ext_in) (input_bfd, eraw_src, &ext); if (ext.asym.sc == scNil || ext.asym.sc == scUndefined || ext.asym.sc == scSUndefined) @@ -8583,8 +8385,7 @@ _bfd_mips_elf_final_link (abfd, info) einfo.swap = swap; einfo.failed = FALSE; mips_elf_link_hash_traverse (mips_elf_hash_table (info), - mips_elf_output_extsym, - (PTR) &einfo); + mips_elf_output_extsym, &einfo); if (einfo.failed) return FALSE; @@ -8593,7 +8394,7 @@ _bfd_mips_elf_final_link (abfd, info) /* Skip this section later on (I don't think this currently matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; + o->link_order_head = NULL; mdebug_sec = o; } @@ -8612,9 +8413,7 @@ _bfd_mips_elf_final_link (abfd, info) not used in executables files. */ if (! info->relocatable) { - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) + for (p = o->link_order_head; p != NULL; p = p->next) { asection *input_section; @@ -8634,7 +8433,7 @@ _bfd_mips_elf_final_link (abfd, info) /* Skip this section later on (I don't think this currently matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; + o->link_order_head = NULL; /* Really remove the section. */ for (secpp = &abfd->sections; @@ -8681,16 +8480,14 @@ _bfd_mips_elf_final_link (abfd, info) /* Set up the first entry. */ c = 1; amt = c * sizeof (Elf32_gptab); - tab = (Elf32_gptab *) bfd_malloc (amt); + tab = bfd_malloc (amt); if (tab == NULL) return FALSE; tab[0].gt_header.gt_current_g_value = elf_gp_size (abfd); tab[0].gt_header.gt_unused = 0; /* Combine the input sections. */ - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) + for (p = o->link_order_head; p != NULL; p = p->next) { asection *input_section; bfd *input_bfd; @@ -8725,9 +8522,8 @@ _bfd_mips_elf_final_link (abfd, info) unsigned int look; if (! (bfd_get_section_contents - (input_bfd, input_section, (PTR) &ext_gptab, - (file_ptr) gpentry, - (bfd_size_type) sizeof (Elf32_External_gptab)))) + (input_bfd, input_section, &ext_gptab, gpentry, + sizeof (Elf32_External_gptab)))) { free (tab); return FALSE; @@ -8755,7 +8551,7 @@ _bfd_mips_elf_final_link (abfd, info) /* We need a new table entry. */ amt = (bfd_size_type) (c + 1) * sizeof (Elf32_gptab); - new_tab = (Elf32_gptab *) bfd_realloc ((PTR) tab, amt); + new_tab = bfd_realloc (tab, amt); if (new_tab == NULL) { free (tab); @@ -8798,7 +8594,7 @@ _bfd_mips_elf_final_link (abfd, info) /* Swap out the table. */ amt = (bfd_size_type) c * sizeof (Elf32_External_gptab); - ext_tab = (Elf32_External_gptab *) bfd_alloc (abfd, amt); + ext_tab = bfd_alloc (abfd, amt); if (ext_tab == NULL) { free (tab); @@ -8814,7 +8610,7 @@ _bfd_mips_elf_final_link (abfd, info) /* Skip this section later on (I don't think this currently matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; + o->link_order_head = NULL; } } @@ -8824,18 +8620,16 @@ _bfd_mips_elf_final_link (abfd, info) /* Now write out the computed sections. */ - if (reginfo_sec != (asection *) NULL) + if (reginfo_sec != NULL) { Elf32_External_RegInfo ext; bfd_mips_elf32_swap_reginfo_out (abfd, ®info, &ext); - if (! bfd_set_section_contents (abfd, reginfo_sec, (PTR) &ext, - (file_ptr) 0, - (bfd_size_type) sizeof ext)) + if (! bfd_set_section_contents (abfd, reginfo_sec, &ext, 0, sizeof ext)) return FALSE; } - if (mdebug_sec != (asection *) NULL) + if (mdebug_sec != NULL) { BFD_ASSERT (abfd->output_has_begun); if (! bfd_ecoff_write_accumulated_debug (mdebug_handle, abfd, &debug, @@ -8846,21 +8640,19 @@ _bfd_mips_elf_final_link (abfd, info) bfd_ecoff_debug_free (mdebug_handle, abfd, &debug, swap, info); } - if (gptab_data_sec != (asection *) NULL) + if (gptab_data_sec != NULL) { if (! bfd_set_section_contents (abfd, gptab_data_sec, gptab_data_sec->contents, - (file_ptr) 0, - gptab_data_sec->_raw_size)) + 0, gptab_data_sec->_raw_size)) return FALSE; } - if (gptab_bss_sec != (asection *) NULL) + if (gptab_bss_sec != NULL) { if (! bfd_set_section_contents (abfd, gptab_bss_sec, gptab_bss_sec->contents, - (file_ptr) 0, - gptab_bss_sec->_raw_size)) + 0, gptab_bss_sec->_raw_size)) return FALSE; } @@ -8871,8 +8663,7 @@ _bfd_mips_elf_final_link (abfd, info) { if (! bfd_set_section_contents (abfd, rtproc_sec, rtproc_sec->contents, - (file_ptr) 0, - rtproc_sec->_raw_size)) + 0, rtproc_sec->_raw_size)) return FALSE; } } @@ -8944,8 +8735,7 @@ static const struct mips_mach_extension mips_mach_extensions[] = { /* Return true if bfd machine EXTENSION is an extension of machine BASE. */ static bfd_boolean -mips_mach_extends_p (base, extension) - unsigned long base, extension; +mips_mach_extends_p (unsigned long base, unsigned long extension) { size_t i; @@ -8960,8 +8750,7 @@ mips_mach_extends_p (base, extension) /* Return true if the given ELF header flags describe a 32-bit binary. */ static bfd_boolean -mips_32bit_flags_p (flags) - flagword flags; +mips_32bit_flags_p (flagword flags) { return ((flags & EF_MIPS_32BITMODE) != 0 || (flags & EF_MIPS_ABI) == E_MIPS_ABI_O32 @@ -8977,9 +8766,7 @@ mips_32bit_flags_p (flags) object file when linking. */ bfd_boolean -_bfd_mips_elf_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; +_bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { flagword old_flags; flagword new_flags; @@ -9184,9 +8971,7 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd) /* Function to keep MIPS specific file flags like as EF_MIPS_PIC. */ bfd_boolean -_bfd_mips_elf_set_private_flags (abfd, flags) - bfd *abfd; - flagword flags; +_bfd_mips_elf_set_private_flags (bfd *abfd, flagword flags) { BFD_ASSERT (!elf_flags_init (abfd) || elf_elfheader (abfd)->e_flags == flags); @@ -9197,11 +8982,9 @@ _bfd_mips_elf_set_private_flags (abfd, flags) } bfd_boolean -_bfd_mips_elf_print_private_bfd_data (abfd, ptr) - bfd *abfd; - PTR ptr; +_bfd_mips_elf_print_private_bfd_data (bfd *abfd, void *ptr) { - FILE *file = (FILE *) ptr; + FILE *file = ptr; BFD_ASSERT (abfd != NULL && ptr != NULL); diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index b4230eb..aef4e7b 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -21,97 +21,94 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "elf/internal.h" extern bfd_boolean _bfd_mips_elf_new_section_hook - PARAMS ((bfd *, asection *)); + (bfd *, asection *); extern void _bfd_mips_elf_symbol_processing - PARAMS ((bfd *, asymbol *)); + (bfd *, asymbol *); extern bfd_boolean _bfd_mips_elf_section_processing - PARAMS ((bfd *, Elf_Internal_Shdr *)); + (bfd *, Elf_Internal_Shdr *); extern bfd_boolean _bfd_mips_elf_section_from_shdr - PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); + (bfd *, Elf_Internal_Shdr *, const char *); extern bfd_boolean _bfd_mips_elf_fake_sections - PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); + (bfd *, Elf_Internal_Shdr *, asection *); extern bfd_boolean _bfd_mips_elf_section_from_bfd_section - PARAMS ((bfd *, asection *, int *)); + (bfd *, asection *, int *); extern bfd_boolean _bfd_mips_elf_add_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, - const char **, flagword *, asection **, bfd_vma *)); + (bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, + const char **, flagword *, asection **, bfd_vma *); extern bfd_boolean _bfd_mips_elf_link_output_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, - asection *)); + (struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *); extern bfd_boolean _bfd_mips_elf_create_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_check_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); + (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); extern bfd_boolean _bfd_mips_elf_adjust_dynamic_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); + (struct bfd_link_info *, struct elf_link_hash_entry *); extern bfd_boolean _bfd_mips_elf_always_size_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); + (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); extern bfd_boolean _bfd_mips_elf_finish_dynamic_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - Elf_Internal_Sym *)); + (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *); extern bfd_boolean _bfd_mips_elf_finish_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern void _bfd_mips_elf_final_write_processing - PARAMS ((bfd *, bfd_boolean)); + (bfd *, bfd_boolean); extern int _bfd_mips_elf_additional_program_headers - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean _bfd_mips_elf_modify_segment_map - PARAMS ((bfd *)); + (bfd *, struct bfd_link_info *); extern asection * _bfd_mips_elf_gc_mark_hook - PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *)); + (asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *); extern bfd_boolean _bfd_mips_elf_gc_sweep_hook - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); + (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); extern void _bfd_mips_elf_copy_indirect_symbol - PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *, - struct elf_link_hash_entry *)); + (const struct elf_backend_data *, struct elf_link_hash_entry *, + struct elf_link_hash_entry *); extern void _bfd_mips_elf_hide_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean)); + (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean); extern bfd_boolean _bfd_mips_elf_ignore_discarded_relocs - PARAMS ((asection *)); + (asection *); extern bfd_boolean _bfd_mips_elf_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, - const char **, unsigned int *)); + (bfd *, asection *, asymbol **, bfd_vma, const char **, + const char **, unsigned int *); extern bfd_boolean _bfd_mips_elf_set_section_contents - PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); + (bfd *, asection *, const void *, file_ptr, bfd_size_type); extern bfd_byte *_bfd_elf_mips_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, bfd_boolean, asymbol **)); + (bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, bfd_boolean, asymbol **); extern struct bfd_link_hash_table *_bfd_mips_elf_link_hash_table_create - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean _bfd_mips_elf_final_link - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_merge_private_bfd_data - PARAMS ((bfd *, bfd *)); + (bfd *, bfd *); extern bfd_boolean _bfd_mips_elf_set_private_flags - PARAMS ((bfd *, flagword)); + (bfd *, flagword); extern bfd_boolean _bfd_mips_elf_print_private_bfd_data - PARAMS ((bfd *, PTR)); + (bfd *, void *); extern bfd_boolean _bfd_mips_elf_discard_info - PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *)); + (bfd *, struct elf_reloc_cookie *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_write_section - PARAMS ((bfd *, asection *, bfd_byte *)); + (bfd *, asection *, bfd_byte *); extern bfd_boolean _bfd_mips_elf_read_ecoff_info - PARAMS ((bfd *, asection *, struct ecoff_debug_info *)); + (bfd *, asection *, struct ecoff_debug_info *); extern bfd_reloc_status_type _bfd_mips_elf_gprel16_with_gp - PARAMS ((bfd *, asymbol *, arelent *, asection *, bfd_boolean, PTR, - bfd_vma)); + (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma); extern bfd_reloc_status_type _bfd_mips_elf32_gprel16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); extern unsigned long _bfd_elf_mips_mach - PARAMS ((flagword)); + (flagword); extern bfd_boolean _bfd_mips_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); + (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); extern bfd_vma _bfd_mips_elf_sign_extend - PARAMS ((bfd_vma, int)); + (bfd_vma, int); extern struct bfd_elf_special_section const _bfd_mips_elf_special_sections[]; #define elf_backend_special_sections _bfd_mips_elf_special_sections diff --git a/bfd/format.c b/bfd/format.c index 256ec0e..9d9ee86 100644 --- a/bfd/format.c +++ b/bfd/format.c @@ -425,7 +425,7 @@ bfd_format_string (bfd_format format) switch (format) { case bfd_object: - return "object"; /* Linker/assember/compiler output. */ + return "object"; /* Linker/assembler/compiler output. */ case bfd_archive: return "archive"; /* Object archive file. */ case bfd_core: @@ -446,7 +446,6 @@ bfd_hash_replace (table, old, nw) /* Base method for creating a new hash table entry. */ -/*ARGSUSED*/ struct bfd_hash_entry * bfd_hash_newfunc (entry, table, string) struct bfd_hash_entry *entry; diff --git a/bfd/hp300hpux.c b/bfd/hp300hpux.c index e5a567d..f6cdd19 100644 --- a/bfd/hp300hpux.c +++ b/bfd/hp300hpux.c @@ -475,7 +475,7 @@ NAME (aout,swap_exec_header_in) (abfd, raw_bytes, execp) /***************************************************************/ /* check the header to see if it was generated by a bfd output */ - /* this is detected rather bizarely by requiring a bunch of */ + /* this is detected rather bizarrely by requiring a bunch of */ /* header fields to be zero and an old unused field (now used) */ /* to be set. */ /***************************************************************/ @@ -588,7 +588,7 @@ MY (slurp_symbol_table) (abfd) assignment to the strings pointer is done after we're thru using the nlist so we don't overwrite anything important. */ - /* OK, now walk the new symtable, cacheing symbol properties */ + /* OK, now walk the new symtable, caching symbol properties */ { aout_symbol_type *cache_ptr = cached; aout_symbol_type cache_save; @@ -611,7 +611,7 @@ MY (slurp_symbol_table) (abfd) return FALSE; /********************************************************/ - /* for hpux, the 'lenght' value indicates the length of */ + /* for hpux, the 'length' value indicates the length of */ /* the symbol name which follows the nlist entry. */ /********************************************************/ if (length) diff --git a/bfd/hppabsd-core.c b/bfd/hppabsd-core.c index 31aa2f1..4d17ba5 100644 --- a/bfd/hppabsd-core.c +++ b/bfd/hppabsd-core.c @@ -213,7 +213,6 @@ hppabsd_core_core_file_failing_command (abfd) return core_command (abfd); } -/* ARGSUSED */ static int hppabsd_core_core_file_failing_signal (abfd) bfd *abfd; @@ -221,7 +220,6 @@ hppabsd_core_core_file_failing_signal (abfd) return core_signal (abfd); } -/* ARGSUSED */ static bfd_boolean hppabsd_core_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd, *exec_bfd; diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c index b4869fc..04d2911 100644 --- a/bfd/hpux-core.c +++ b/bfd/hpux-core.c @@ -327,7 +327,6 @@ hpux_core_core_file_failing_command (abfd) return core_command (abfd); } -/* ARGSUSED */ static int hpux_core_core_file_failing_signal (abfd) bfd *abfd; @@ -335,7 +334,6 @@ hpux_core_core_file_failing_signal (abfd) return core_signal (abfd); } -/* ARGSUSED */ static bfd_boolean hpux_core_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd ATTRIBUTE_UNUSED; diff --git a/bfd/i386linux.c b/bfd/i386linux.c index 84ae477..da36e75 100644 --- a/bfd/i386linux.c +++ b/bfd/i386linux.c @@ -112,7 +112,7 @@ i386linux_write_object_contents (abfd) #endif /* This special symbol is a set vector that contains a list of - pointers to fixup tables. It will be present in any dynamicly + pointers to fixup tables. It will be present in any dynamically linked file. The linker generated fixup table should also be added to the list, and it should always appear in the second slot (the first one is a dummy with a magic number that is defined in @@ -1043,7 +1043,7 @@ ieee_slurp_external_symbols (abfd) (void) must_parse_int (&(ieee->h)); /* Fetch the default size if not resolved. */ size = must_parse_int (&(ieee->h)); - /* Fetch the defautlt value if available. */ + /* Fetch the default value if available. */ if (! parse_int (&(ieee->h), &value)) { value = 0; @@ -1639,7 +1639,7 @@ ieee_object_p (abfd) const bfd_arch_info_type *arch; char family[10]; - /* IEEE does not specify the format of the processor identificaton + /* IEEE does not specify the format of the processor identification string, so the compiler is free to put in it whatever it wants. We try here to recognize different processors belonging to the m68k family. Code for other processors can be added here. */ @@ -948,7 +948,6 @@ ihex_set_arch_mach (abfd, arch, mach) /* Get the size of the headers, for the linker. */ -/*ARGSUSED*/ static int ihex_sizeof_headers (abfd, exec) bfd *abfd ATTRIBUTE_UNUSED; diff --git a/bfd/linker.c b/bfd/linker.c index a1a8a4c..c55fb93 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -455,7 +455,7 @@ _bfd_link_hash_newfunc (struct bfd_hash_entry *entry, /* Initialize the local fields. */ h->type = bfd_link_hash_new; - h->next = NULL; + h->und_next = NULL; } return entry; @@ -614,9 +614,9 @@ void bfd_link_add_undef (struct bfd_link_hash_table *table, struct bfd_link_hash_entry *h) { - BFD_ASSERT (h->next == NULL); + BFD_ASSERT (h->und_next == NULL); if (table->undefs_tail != NULL) - table->undefs_tail->next = h; + table->undefs_tail->und_next = h; if (table->undefs == NULL) table->undefs = h; table->undefs_tail = h; @@ -988,9 +988,9 @@ _bfd_generic_link_add_archive_symbols us to lose track of whether the symbol has been referenced). */ if (*pundef != info->hash->undefs_tail) - *pundef = (*pundef)->next; + *pundef = (*pundef)->und_next; else - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; continue; } @@ -1013,7 +1013,7 @@ _bfd_generic_link_add_archive_symbols } if (arh == NULL) { - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; continue; } } @@ -1062,7 +1062,7 @@ _bfd_generic_link_add_archive_symbols } } - pundef = &(*pundef)->next; + pundef = &(*pundef)->und_next; } archive_hash_table_free (&arsym_hash); @@ -1692,8 +1692,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, case REF: /* A reference to a defined symbol. */ - if (h->next == NULL && info->hash->undefs_tail != h) - h->next = h; + if (h->und_next == NULL && info->hash->undefs_tail != h) + h->und_next = h; break; case BIG: @@ -1879,8 +1879,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, case REFC: /* A reference to an indirect symbol. */ - if (h->next == NULL && info->hash->undefs_tail != h) - h->next = h; + if (h->und_next == NULL && info->hash->undefs_tail != h) + h->und_next = h; h = h->u.i.link; cycle = TRUE; break; @@ -1895,10 +1895,10 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, case CWARN: /* Warn if this symbol has been referenced already, otherwise add a warning. A symbol has been referenced if - the next field is not NULL, or it is the tail of the + the und_next field is not NULL, or it is the tail of the undefined symbol list. The REF case above helps to ensure this. */ - if (h->next != NULL || info->hash->undefs_tail == h) + if (h->und_next != NULL || info->hash->undefs_tail == h) { if (! (*info->callbacks->warning) (info, string, h->root.string, hash_entry_bfd (h), NULL, 0)) diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c index 90f342c..996e516 100644 --- a/bfd/m68klinux.c +++ b/bfd/m68klinux.c @@ -113,7 +113,7 @@ m68klinux_write_object_contents (abfd) #endif /* This special symbol is a set vector that contains a list of - pointers to fixup tables. It will be present in any dynamicly + pointers to fixup tables. It will be present in any dynamically linked file. The linker generated fixup table should also be added to the list, and it should always appear in the second slot (the first one is a dummy with a magic number that is defined in diff --git a/bfd/mach-o.h b/bfd/mach-o.h index c94f01d..1f7dd60 100644 --- a/bfd/mach-o.h +++ b/bfd/mach-o.h @@ -74,11 +74,11 @@ typedef enum bfd_mach_o_load_command_type BFD_MACH_O_LC_FVMFILE = 0x9, /* Fixed VM file inclusion. */ BFD_MACH_O_LC_PREPAGE = 0xa, /* Prepage command (internal use). */ BFD_MACH_O_LC_DYSYMTAB = 0xb, /* Dynamic link-edit symbol table info. */ - BFD_MACH_O_LC_LOAD_DYLIB = 0xc, /* Load a dynamicly linked shared library. */ - BFD_MACH_O_LC_ID_DYLIB = 0xd, /* Dynamicly linked shared lib identification. */ + BFD_MACH_O_LC_LOAD_DYLIB = 0xc, /* Load a dynamically linked shared library. */ + BFD_MACH_O_LC_ID_DYLIB = 0xd, /* Dynamically linked shared lib identification. */ BFD_MACH_O_LC_LOAD_DYLINKER = 0xe, /* Load a dynamic linker. */ BFD_MACH_O_LC_ID_DYLINKER = 0xf, /* Dynamic linker identification. */ - BFD_MACH_O_LC_PREBOUND_DYLIB = 0x10,/* Modules prebound for a dynamicly. */ + BFD_MACH_O_LC_PREBOUND_DYLIB = 0x10,/* Modules prebound for a dynamically. */ BFD_MACH_O_LC_ROUTINES = 0x11, /* Image routines. */ BFD_MACH_O_LC_SUB_FRAMEWORK = 0x12, /* Sub framework. */ BFD_MACH_O_LC_SUB_UMBRELLA = 0x13, /* Sub umbrella. */ @@ -86,7 +86,7 @@ typedef enum bfd_mach_o_load_command_type BFD_MACH_O_LC_SUB_LIBRARY = 0x15, /* Sub library. */ BFD_MACH_O_LC_TWOLEVEL_HINTS = 0x16,/* Two-level namespace lookup hints. */ BFD_MACH_O_LC_PREBIND_CKSUM = 0x17, /* Prebind checksum. */ - /* Load a dynamicly linked shared library that is allowed to be + /* Load a dynamically linked shared library that is allowed to be missing (weak). */ BFD_MACH_O_LC_LOAD_WEAK_DYLIB = 0x18 } @@ -231,7 +231,7 @@ typedef struct bfd_mach_o_symtab_command bfd_mach_o_symtab_command; /* This is the second set of the symbolic information which is used to support - the data structures for the dynamicly link editor. + the data structures for the dynamically link editor. The original set of symbolic information in the symtab_command which contains the symbol and string tables must also be present when this load command is @@ -250,7 +250,7 @@ bfd_mach_o_symtab_command; reference symbol table indirect symbol table The first three tables above (the table of contents, module table and - reference symbol table) are only present if the file is a dynamicly linked + reference symbol table) are only present if the file is a dynamically linked shared library. For executable and object modules, which are files containing only one module, the information that would be in these three tables is determined as follows: @@ -259,7 +259,7 @@ bfd_mach_o_symtab_command; file is part of the module. reference symbol table - is the defined and undefined external symbols - For dynamicly linked shared library files this load command also contains + For dynamically linked shared library files this load command also contains offsets and sizes to the pool of relocation entries for all sections separated into two groups: external relocation entries @@ -281,7 +281,7 @@ typedef struct bfd_mach_o_dysymtab_command The last two groups are used by the dynamic binding process to do the binding (indirectly through the module table and the reference symbol - table when this is a dynamicly linked shared library file). */ + table when this is a dynamically linked shared library file). */ unsigned long ilocalsym; /* Index to local symbols. */ unsigned long nlocalsym; /* Number of local symbols. */ @@ -293,7 +293,7 @@ typedef struct bfd_mach_o_dysymtab_command /* For the for the dynamic binding process to find which module a symbol is defined in the table of contents is used (analogous to the ranlib structure in an archive) which maps defined external symbols to modules - they are defined in. This exists only in a dynamicly linked shared + they are defined in. This exists only in a dynamically linked shared library file. For executable and object modules the defined external symbols are sorted by name and is use as the table of contents. */ @@ -304,7 +304,7 @@ typedef struct bfd_mach_o_dysymtab_command table must reflect the modules that the file was created from. This is done by having a module table that has indexes and counts into the merged tables for each module. The module structure that these two entries - refer to is described below. This exists only in a dynamicly linked + refer to is described below. This exists only in a dynamically linked shared library file. For executable and object modules the file only contains one module so everything in the file belongs to the module. */ @@ -315,7 +315,7 @@ typedef struct bfd_mach_o_dysymtab_command indicates the external references (defined and undefined) each module makes. For each module there is an offset and a count into the reference symbol table for the symbols that the module references. - This exists only in a dynamicly linked shared library file. For + This exists only in a dynamically linked shared library file. For executable and object modules the defined external symbols and the undefined external symbols indicates the external references. */ @@ -363,7 +363,7 @@ typedef struct bfd_mach_o_dysymtab_command /* All the local relocation entries are grouped together (they are not grouped by their module since they are only used if the object is moved - from it staticly link edited address). */ + from it statically link edited address). */ unsigned long locreloff; /* Offset to local relocation entries. */ unsigned long nlocrel; /* Number of local relocation entries. */ diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c index 59f231b..cb2050f 100644 --- a/bfd/mipsbsd.c +++ b/bfd/mipsbsd.c @@ -220,7 +220,7 @@ mips_fix_jmp_addr (abfd, reloc_entry, symbol, data, input_section, output_bfd, && (symbol->flags & BSF_WEAK) == 0) return bfd_reloc_undefined; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ if (bfd_is_com_section (symbol->section)) relocation = 0; @@ -271,7 +271,7 @@ mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section, && (symbol->flags & BSF_WEAK) == 0) return bfd_reloc_undefined; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ if (bfd_is_com_section (symbol->section)) relocation = 0; diff --git a/bfd/netbsd-core.c b/bfd/netbsd-core.c index a9f1260..7498990 100644 --- a/bfd/netbsd-core.c +++ b/bfd/netbsd-core.c @@ -53,7 +53,6 @@ static void swap_abort /* Handle NetBSD-style core dump file. */ -/* ARGSUSED */ static const bfd_target * netbsd_core_file_p (abfd) bfd *abfd; @@ -179,7 +178,6 @@ netbsd_core_file_failing_command (abfd) return abfd->tdata.netbsd_core_data->core.c_name; } -/* ARGSUSED */ static int netbsd_core_file_failing_signal (abfd) bfd *abfd; @@ -188,7 +186,6 @@ netbsd_core_file_failing_signal (abfd) return abfd->tdata.netbsd_core_data->core.c_signo; } -/* ARGSUSED */ static bfd_boolean netbsd_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd ATTRIBUTE_UNUSED; diff --git a/bfd/nlm32-alpha.c b/bfd/nlm32-alpha.c index bcaa6ab..990ce8d 100644 --- a/bfd/nlm32-alpha.c +++ b/bfd/nlm32-alpha.c @@ -97,6 +97,8 @@ nlm_alpha_write_prefix (abfd) return TRUE; } +#define ONES(n) (((bfd_vma) 1 << ((n) - 1) << 1) - 1) + /* How to process the various reloc types. */ static reloc_howto_type nlm32_alpha_howto_table[] = @@ -144,8 +146,8 @@ static reloc_howto_type nlm32_alpha_howto_table[] = 0, /* special_function */ "REFQUAD", /* name */ TRUE, /* partial_inplace */ - 0xffffffffffffffff, /* src_mask */ - 0xffffffffffffffff, /* dst_mask */ + ONES (64), /* src_mask */ + ONES (64), /* dst_mask */ FALSE), /* pcrel_offset */ /* A 32 bit GP relative offset. This is just like REFLONG except @@ -304,8 +306,8 @@ static reloc_howto_type nlm32_alpha_howto_table[] = 0, /* special_function */ "SREL64", /* name */ TRUE, /* partial_inplace */ - 0xffffffffffffffff, /* src_mask */ - 0xffffffffffffffff, /* dst_mask */ + ONES (64), /* src_mask */ + ONES (64), /* dst_mask */ FALSE), /* pcrel_offset */ /* Push a value on the reloc evaluation stack. */ @@ -336,7 +338,7 @@ static reloc_howto_type nlm32_alpha_howto_table[] = "OP_STORE", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ - 0xffffffffffffffff, /* dst_mask */ + ONES (64), /* dst_mask */ FALSE), /* pcrel_offset */ /* Subtract the reloc address from the value on the top of the diff --git a/bfd/oasys.c b/bfd/oasys.c index 8c30197..be6a8d9 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -324,7 +324,7 @@ oasys_archive_p (abfd) /* There isn't a magic number in an Oasys archive, so the best we - can do to verify reasnableness is to make sure that the values in + can do to verify reasonableness is to make sure that the values in the header are too weird */ diff --git a/bfd/opncls.c b/bfd/opncls.c index 34b39ae..96f1e14 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -201,7 +201,7 @@ DESCRIPTION descriptors for other opens), with the supplied @var{fd} used as an initial file descriptor (but subject to closure at any time), call bfd_set_cacheable(bfd, 1) on the returned BFD. The default - is to assume no cacheing; the file descriptor will remain open + is to assume no caching; the file descriptor will remain open until <<bfd_close>>, and will not be affected by BFD operations on other files. diff --git a/bfd/osf-core.c b/bfd/osf-core.c index 95292a3..9ba0d18 100644 --- a/bfd/osf-core.c +++ b/bfd/osf-core.c @@ -164,7 +164,6 @@ osf_core_core_file_failing_command (abfd) return core_command (abfd); } -/* ARGSUSED */ static int osf_core_core_file_failing_signal (abfd) bfd *abfd; @@ -172,7 +171,6 @@ osf_core_core_file_failing_signal (abfd) return core_signal (abfd); } -/* ARGSUSED */ static bfd_boolean osf_core_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd ATTRIBUTE_UNUSED; diff --git a/bfd/pdp11.c b/bfd/pdp11.c index 3d009ba..a4af824 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -2469,7 +2469,6 @@ NAME(aout,get_symbol_info) (abfd, symbol, ret) } } -/*ARGSUSED*/ void NAME(aout,print_symbol) (abfd, afile, symbol, how) bfd * abfd; diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index f3b3a96..2fe294f 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -645,7 +645,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) if (extra->DataDirectory[1].VirtualAddress == 0) /* Until other .idata fixes are made (pending patch), the entry for - .idata is needed for backwards compatability. FIXME. */ + .idata is needed for backwards compatibility. FIXME. */ add_data_entry (abfd, extra, 1, ".idata", ib); /* For some reason, the virtual size (which is what's set by @@ -943,23 +943,59 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, scnhdr_ext->s_lnnoptr); - /* Extra flags must be set when dealing with NT. All sections should also - have the IMAGE_SCN_MEM_READ (0x40000000) flag set. In addition, the - .text section must have IMAGE_SCN_MEM_EXECUTE (0x20000000) and the data - sections (.idata, .data, .bss, .CRT) must have IMAGE_SCN_MEM_WRITE set - (this is especially important when dealing with the .idata section since - the addresses for routines from .dlls must be overwritten). If .reloc - section data is ever generated, we must add IMAGE_SCN_MEM_DISCARDABLE - (0x02000000). Also, the resource data should also be read and - writable. */ - - /* FIXME: alignment is also encoded in this field, at least on ppc (krk) */ - /* FIXME: even worse, I don't see how to get the original alignment field*/ - /* back... */ - { + /* Extra flags must be set when dealing with PE. All sections should also + have the IMAGE_SCN_MEM_READ (0x40000000) flag set. In addition, the + .text section must have IMAGE_SCN_MEM_EXECUTE (0x20000000) and the data + sections (.idata, .data, .bss, .CRT) must have IMAGE_SCN_MEM_WRITE set + (this is especially important when dealing with the .idata section since + the addresses for routines from .dlls must be overwritten). If .reloc + section data is ever generated, we must add IMAGE_SCN_MEM_DISCARDABLE + (0x02000000). Also, the resource data should also be read and + writable. */ + + /* FIXME: Alignment is also encoded in this field, at least on PPC and + ARM-WINCE. Although - how do we get the original alignment field + back ? */ + + typedef struct + { + const char * section_name; + unsigned long must_have; + } + pe_required_section_flags; + + pe_required_section_flags known_sections [] = + { + { ".arch", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE | IMAGE_SCN_ALIGN_8BYTES }, + { ".bss", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".data", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".edata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, + { ".idata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".pdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, + { ".rdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, + { ".reloc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE }, + { ".rsrc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".text" , IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE }, + { ".tls", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE }, + { ".xdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA }, + { NULL, 0} + }; + + pe_required_section_flags * p; int flags = scnhdr_int->s_flags; + for (p = known_sections; p->section_name; p++) + if (strcmp (scnhdr_int->s_name, p->section_name) == 0) + { + /* We have defaulted to adding the IMAGE_SCN_MEM_WRITE flag, but now + we know exactly what this specific section wants so we remove it + and then allow the must_have field to add it back in if necessary. */ + flags &= ~IMAGE_SCN_MEM_WRITE; + flags |= p->must_have; + break; + } + H_PUT_32 (abfd, flags, scnhdr_ext->s_flags); } @@ -969,7 +1005,7 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) && strcmp (scnhdr_int->s_name, ".text") == 0) { /* By inference from looking at MS output, the 32 bit field - which is the combintion of the number_of_relocs and + which is the combination of the number_of_relocs and number_of_linenos is used for the line number count in executables. A 16-bit field won't do for cc1. The MS document says that the number of relocs is zero for diff --git a/bfd/ptrace-core.c b/bfd/ptrace-core.c index 23bc8de..4f441ce 100644 --- a/bfd/ptrace-core.c +++ b/bfd/ptrace-core.c @@ -55,7 +55,6 @@ bfd_boolean ptrace_unix_core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd)); static void swap_abort PARAMS ((void)); -/* ARGSUSED */ const bfd_target * ptrace_unix_core_file_p (abfd) bfd *abfd; @@ -146,7 +145,6 @@ ptrace_unix_core_file_failing_command (abfd) return 0; } -/* ARGSUSED */ int ptrace_unix_core_file_failing_signal (abfd) bfd *abfd; @@ -154,7 +152,6 @@ ptrace_unix_core_file_failing_signal (abfd) return abfd->tdata.trad_core_data->u.pt_sigframe.sig_num; } -/* ARGSUSED */ bfd_boolean ptrace_unix_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd, *exec_bfd; diff --git a/bfd/reloc.c b/bfd/reloc.c index 8fdca41..ad4963f 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -319,7 +319,7 @@ CODE_FRAGMENT . . {* If this field is non null, then the supplied function is . called rather than the normal function. This allows really -. strange relocation methods to be accomodated (e.g., i960 callj +. strange relocation methods to be accommodated (e.g., i960 callj . instructions). *} . bfd_reloc_status_type (*special_function) . (bfd *, arelent *, struct bfd_symbol *, void *, asection *, @@ -627,7 +627,7 @@ bfd_perform_relocation (bfd *abfd, / bfd_octets_per_byte (abfd))) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ @@ -1017,7 +1017,7 @@ bfd_install_relocation (bfd *abfd, / bfd_octets_per_byte (abfd))) return bfd_reloc_outofrange; - /* Work out which section the relocation is targetted at and the + /* Work out which section the relocation is targeted at and the initial relocation command value. */ /* Get symbol value. (Common symbols are special.) */ @@ -2507,7 +2507,7 @@ ENUMDOC ENUM BFD_RELOC_CTOR ENUMDOC - The type of reloc used to build a contructor table - at the moment + The type of reloc used to build a constructor table - at the moment probably a 32 bit wide absolute relocation, but the target can choose. It generally does map to one of the other relocation types. @@ -2971,12 +2971,12 @@ ENUM BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET ENUMDOC This is a 16 bit offset from the short data area pointer, with the - bits placed non-contigously in the instruction. + bits placed non-contiguously in the instruction. ENUM BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET ENUMDOC This is a 16 bit offset from the zero data area pointer, with the - bits placed non-contigously in the instruction. + bits placed non-contiguously in the instruction. ENUM BFD_RELOC_V850_CALLT_6_7_OFFSET ENUMDOC @@ -3482,7 +3482,7 @@ ENUMDOC included in the output. VTABLE_INHERIT is a zero-space relocation used to describe to the - linker the inheritence tree of a C++ virtual function table. The + linker the inheritance tree of a C++ virtual function table. The relocation's symbol should be the parent class' vtable, and the relocation should be located at the child vtable. @@ -3675,7 +3675,7 @@ ENUMDOC Motorola 68HC11 reloc. This reloc marks the beginning of a jump/call instruction. It is used for linker relaxation to correctly identify beginning - of instruction and change some branchs to use PC-relative + of instruction and change some branches to use PC-relative addressing mode. ENUM BFD_RELOC_M68HC11_RL_GROUP diff --git a/bfd/reloc16.c b/bfd/reloc16.c index 3a4c3d3..720e2d6 100644 --- a/bfd/reloc16.c +++ b/bfd/reloc16.c @@ -193,7 +193,7 @@ bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again) bfd_size_type amt; /* Allocate and initialize the shrinks array for this section. - The last element is used as an accumlator of shrinks. */ + The last element is used as an accumulator of shrinks. */ amt = reloc_count + 1; amt *= sizeof (unsigned); shrinks = (unsigned *) bfd_zmalloc (amt); diff --git a/bfd/sco5-core.c b/bfd/sco5-core.c index 4928622..311de70 100644 --- a/bfd/sco5-core.c +++ b/bfd/sco5-core.c @@ -110,7 +110,6 @@ read_uarea(abfd, filepos) return &rawptr->u; } -/* ARGSUSED */ const bfd_target * sco5_core_file_p (abfd) bfd *abfd; @@ -338,7 +337,6 @@ sco5_core_file_failing_command (abfd) return NULL; } -/* ARGSUSED */ int sco5_core_file_failing_signal (ignore_abfd) bfd *ignore_abfd; @@ -348,7 +346,6 @@ sco5_core_file_failing_signal (ignore_abfd) : -1); } -/* ARGSUSED */ bfd_boolean sco5_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd ATTRIBUTE_UNUSED; diff --git a/bfd/section.c b/bfd/section.c index e99062a..fce8e1e 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -1025,7 +1025,6 @@ DESCRIPTION */ -/*ARGSUSED*/ bfd_boolean bfd_set_section_flags (bfd *abfd ATTRIBUTE_UNUSED, sec_ptr section, @@ -1065,7 +1064,7 @@ DESCRIPTION | func (abfd, the_section, obj); - This is the prefered method for iterating over sections; an + This is the preferred method for iterating over sections; an alternative would be to use a loop: | section *p; @@ -1074,7 +1073,6 @@ DESCRIPTION */ -/*VARARGS2*/ void bfd_map_over_sections (bfd *abfd, void (*operation) (bfd *, asection *, void *), diff --git a/bfd/simple.c b/bfd/simple.c index afed604..4b597a4 100644 --- a/bfd/simple.c +++ b/bfd/simple.c @@ -211,7 +211,7 @@ bfd_simple_get_relocated_section_contents (bfd *abfd, /* The sections in ABFD may already have output sections and offsets set. Because this function is primarily for debug sections, and GCC uses the - knowledge that debug sections will generally have VMA 0 when emiting + knowledge that debug sections will generally have VMA 0 when emitting relocations between DWARF-2 sections (which are supposed to be section-relative offsets anyway), we need to reset the output offsets to zero. We also need to arrange for section->output_section->vma plus @@ -1715,7 +1715,7 @@ hppa_som_gen_reloc_type (abfd, base_type, format, field, sym_diff, sym) #ifndef NO_PCREL_MODES /* If we have short and long pcrel modes, then generate the proper mode selector, then the pcrel relocation. Redundant selectors - will be eliminted as the relocs are sized and emitted. */ + will be eliminated as the relocs are sized and emitted. */ bfd_size_type amt = sizeof (int); final_types[0] = (int *) bfd_alloc (abfd, amt); if (!final_types[0]) @@ -2480,7 +2480,7 @@ som_is_subspace (section) return TRUE; } -/* Return TRUE if the given space containins the given subspace. It +/* Return TRUE if the given space contains the given subspace. It is safe to assume space really is a space, and subspace really is a subspace. */ @@ -2734,7 +2734,7 @@ som_write_fixups (abfd, current_offset, total_reloc_sizep) continue; /* If this subspace does not have real data, then we are - finised with it. */ + finished with it. */ if ((subsection->flags & SEC_HAS_CONTENTS) == 0) { som_section_data (subsection)->subspace_dict->fixup_request_index @@ -3200,7 +3200,7 @@ som_write_symbol_strings (abfd, current_offset, syms, num_syms, string_sizep, /* This gets a bit gruesome because of the compilation unit. The strings within the compilation unit are part of the symbol strings, but don't have symbol_dictionary entries. So, manually - write them and update the compliation unit header. On input, the + write them and update the compilation unit header. On input, the compilation unit header contains local copies of the strings. Move them aside. */ if (compilation_unit) @@ -3906,7 +3906,7 @@ som_finish_writing (abfd) section = section->next; } - /* All the subspace dictiondary records are written, and all the + /* All the subspace dictionary records are written, and all the fields are set up in the space dictionary records. Seek to the right location and start writing the space @@ -3978,7 +3978,7 @@ som_finish_writing (abfd) exec_header->exec_flags = obj_som_exec_data (abfd)->exec_flags; /* Oh joys. Ram some of the BSS data into the DATA section - to be compatable with how the hp linker makes objects + to be compatible with how the hp linker makes objects (saves memory space). */ tmp = exec_header->exec_dsize; tmp = SOM_ALIGN (tmp, PA_PAGESIZE); @@ -5780,7 +5780,7 @@ som_slurp_armap (abfd) + sizeof (struct lst_header)), SEEK_SET) != 0) return FALSE; - /* Initializae the cache and allocate space for the library symbols. */ + /* Initialize the cache and allocate space for the library symbols. */ ardata->cache = 0; amt = ardata->symdef_count; amt *= sizeof (carsym); @@ -210,7 +210,7 @@ struct som_section_data_struct should be internal to the BFD backend. The idea is both SOM and ELF define these basic relocation - types so they map into a SOM or ELF specific reloation as + types so they map into a SOM or ELF specific relocation as appropriate. This allows GAS to share much more code between the two object formats. */ diff --git a/bfd/sparclinux.c b/bfd/sparclinux.c index 0a936b1..ecaaa0f 100644 --- a/bfd/sparclinux.c +++ b/bfd/sparclinux.c @@ -113,7 +113,7 @@ sparclinux_write_object_contents (abfd) #endif /* This special symbol is a set vector that contains a list of - pointers to fixup tables. It will be present in any dynamicly + pointers to fixup tables. It will be present in any dynamically linked file. The linker generated fixup table should also be added to the list, and it should always appear in the second slot (the first one is a dummy with a magic number that is defined in @@ -1009,7 +1009,7 @@ srec_write_header (abfd) { unsigned int len = strlen (abfd->filename); - /* I'll put an arbitary 40 char limit on header size. */ + /* I'll put an arbitrary 40 char limit on header size. */ if (len > 40) len = 40; diff --git a/bfd/stabs.c b/bfd/stabs.c index 193fc58..42944a4 100644 --- a/bfd/stabs.c +++ b/bfd/stabs.c @@ -3,21 +3,21 @@ Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This file contains support for linking stabs in sections, as used on COFF and ELF. */ @@ -358,6 +358,8 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of incl_type = incl_sym[TYPEOFF]; if (incl_type == 0) break; + else if (incl_type == (int) N_EXCL) + continue; else if (incl_type == (int) N_EINCL) { if (nest == 0) diff --git a/bfd/sunos.c b/bfd/sunos.c index fb8e17b..5b1b18b 100644 --- a/bfd/sunos.c +++ b/bfd/sunos.c @@ -1246,7 +1246,6 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string, /* Return the list of objects needed by BFD. */ -/*ARGSUSED*/ struct bfd_link_needed_list * bfd_sunos_get_needed_list (abfd, info) bfd *abfd ATTRIBUTE_UNUSED; @@ -2165,7 +2164,6 @@ sunos_scan_dynamic_symbol (h, data) this point. This entry point exists to prevent the regular linker code from doing anything with the object. */ -/*ARGSUSED*/ static bfd_boolean sunos_link_dynamic_object (info, abfd) struct bfd_link_info *info ATTRIBUTE_UNUSED; @@ -2410,7 +2408,6 @@ sunos_write_dynamic_symbol (output_bfd, info, harg) copy it over, and tell the caller to not bother processing this reloc. */ -/*ARGSUSED*/ static bfd_boolean sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc, contents, skip, relocationp) @@ -133,9 +133,9 @@ SUBSECTION | nm foo | 00012345 A dummy_symbol - Many formats cannot represent arbitary symbol information; for + Many formats cannot represent arbitrary symbol information; for instance, the <<a.out>> object format does not allow an - arbitary number of sections. A symbol pointing to a section + arbitrary number of sections. A symbol pointing to a section which is not one of <<.text>>, <<.data>> or <<.bss>> cannot be described. @@ -222,7 +222,7 @@ CODE_FRAGMENT . <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or . <<BSF_GLOBAL>>. *} . -. {* The symbol is a debugging record. The value has an arbitary +. {* The symbol is a debugging record. The value has an arbitrary . meaning, unless BSF_DEBUGGING_RELOC is also set. *} .#define BSF_DEBUGGING 0x08 . @@ -1222,7 +1222,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, long low, high; long mid = -1; - /* Cache non-existant or invalid. Do binary search on + /* Cache non-existent or invalid. Do binary search on indextable. */ indexentry = NULL; diff --git a/bfd/targets.c b/bfd/targets.c index a173857..488e8e4 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -30,7 +30,7 @@ SECTION Targets DESCRIPTION - Each port of BFD to a different machine requries the creation + Each port of BFD to a different machine requires the creation of a target back end. All the back end provides to the root part of BFD is a structure containing pointers to functions which perform certain low level operations on files. BFD diff --git a/bfd/tekhex.c b/bfd/tekhex.c index 32c3d97..f828fe7 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -29,7 +29,7 @@ DESCRIPTION relocations. Their main application is communication with devices like PROM programmers and ICE equipment. - It seems that the sections are descibed as being really big, + It seems that the sections are described as being really big, the example I have says that the text section is 0..ffffffff. BFD would barf with this, many apps would try to alloc 4GB to read in the file. diff --git a/bfd/trad-core.c b/bfd/trad-core.c index 958ce11..0603150 100644 --- a/bfd/trad-core.c +++ b/bfd/trad-core.c @@ -71,7 +71,6 @@ static void swap_abort PARAMS ((void)); /* Handle 4.2-style (and perhaps also sysV-style) core dump file. */ -/* ARGSUSED */ const bfd_target * trad_unix_core_file_p (abfd) bfd *abfd; @@ -248,7 +247,6 @@ trad_unix_core_file_failing_command (abfd) return 0; } -/* ARGSUSED */ int trad_unix_core_file_failing_signal (ignore_abfd) bfd *ignore_abfd ATTRIBUTE_UNUSED; @@ -260,7 +258,6 @@ trad_unix_core_file_failing_signal (ignore_abfd) #endif } -/* ARGSUSED */ bfd_boolean trad_unix_core_file_matches_executable_p (core_bfd, exec_bfd) bfd *core_bfd ATTRIBUTE_UNUSED; diff --git a/bfd/versados.c b/bfd/versados.c index b978312..19df300 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -32,9 +32,9 @@ A VERSAdos file looks like contains - o Indentification Record + o Identification Record o External Symbol Definition Record - o Object Text Recrod + o Object Text Record o End Record */ diff --git a/bfd/version.h b/bfd/version.h index 339535c..33474d8 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20031111 +#define BFD_VERSION_DATE 20031215 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c index 7bb7a77..660c06c 100644 --- a/bfd/vms-gsd.c +++ b/bfd/vms-gsd.c @@ -788,7 +788,7 @@ _bfd_vms_write_gsd (abfd, objtype) last_index++; } - /* Don't know if this is neccesary for the linker but for now it keeps + /* Don't know if this is necessary for the linker but for now it keeps vms_slurp_gsd happy */ sname = (char *)section->name; diff --git a/bfd/vms-hdr.c b/bfd/vms-hdr.c index adbecac..c261111 100644 --- a/bfd/vms-hdr.c +++ b/bfd/vms-hdr.c @@ -206,7 +206,7 @@ _bfd_vms_slurp_hdr (abfd, objtype) /*-----------------------------------------------------------------------------*/ /* Output routines. */ -/* Manufacure a VMS like time on a unix based system. +/* Manufacture a VMS like time on a unix based system. stolen from obj-vms.c */ static unsigned char * diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c index b6f3042..d0a24c7 100644 --- a/bfd/vms-misc.c +++ b/bfd/vms-misc.c @@ -49,7 +49,7 @@ static asymbol *new_symbol PARAMS ((bfd *, char *)); ... 9 almost everything - level is also identation level. Indentation is performed + level is also indentation level. Indentation is performed if level > 0 */ @@ -668,7 +668,7 @@ _bfd_vms_output_begin (abfd, rectype, rechead) _bfd_vms_output_short (abfd, (unsigned int) rectype); - /* save current output position to fill in lenght later */ + /* save current output position to fill in length later */ if (PRIV (push_level) > 0) PRIV (length_pos) = PRIV (output_size); diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 6f94029..ccd82be 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -1248,7 +1248,7 @@ xcoff_link_add_symbols (abfd, info) } linoff = (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr - enclosing->line_filepos); - /* explict cast to bfd_signed_vma for compiler */ + /* explicit cast to bfd_signed_vma for compiler */ if (linoff < (bfd_signed_vma) (enclosing->lineno_count * linesz)) { struct internal_lineno lin; @@ -1827,7 +1827,7 @@ xcoff_link_add_symbols (abfd, info) section = bfd_und_section_ptr; value = 0; } - else if ((*sym_hash)->root.next != NULL + else if ((*sym_hash)->root.und_next != NULL || info->hash->undefs_tail == &(*sym_hash)->root) { /* This symbol has been referenced. In this @@ -2898,7 +2898,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, xcoff_mark_symbol (info, hsym); hsym->flags |= (XCOFF_DEF_REGULAR | XCOFF_RTINIT); - /* __rtinit initalized */ + /* __rtinit initialized */ amt = sizeof (struct internal_ldsym); ldsym = (struct internal_ldsym *) bfd_malloc (amt); @@ -133,7 +133,7 @@ typedef struct bfd_sym_resources_table_entry bfd_sym_resources_table_entry; (Note that having a single module copied into two resources is not possible). Modules map back to their resource via an index into the resource table and an offset into the resource. Modules also point - to their source files, both the definition module and implemention + to their source files, both the definition module and implementation module. Because modules can be textually nested within other modules, a link to the parent (containing) module is required. This module can textually contain other modules. A link to the contiguous @@ -2724,7 +2724,7 @@ GCJ_FOR_TARGET=$GCJ_FOR_TARGET' $(FLAGS_FOR_TARGET)' # Don't use libstdc++-v3's flags to configure/build itself. libstdcxx_flags='`test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' -raw_libstdcxx_flags=' -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' +raw_libstdcxx_flags='-L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' if test "x${CXX_FOR_TARGET+set}" = xset; then if test "x${RAW_CXX_FOR_TARGET+set}" != xset; then diff --git a/configure.in b/configure.in index f849e26..539a7f9 100644 --- a/configure.in +++ b/configure.in @@ -1962,7 +1962,7 @@ GCJ_FOR_TARGET=$GCJ_FOR_TARGET' $(FLAGS_FOR_TARGET)' # Don't use libstdc++-v3's flags to configure/build itself. libstdcxx_flags='`test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' -raw_libstdcxx_flags=' -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' +raw_libstdcxx_flags='-L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' if test "x${CXX_FOR_TARGET+set}" = xset; then if test "x${RAW_CXX_FOR_TARGET+set}" != xset; then diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c3825b8..36bff52 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,928 @@ 2003-12-15 David Carlton <carlton@kealia.com> + * Merge with mainline; tag is carlton_dictionary-20031215-merge. + * cp-support.c (class_name_from_physname): Add DMGL_PARAMS to call + to cplus_demangle. + (method_name_from_physname): Ditto. + +2003-12-14 Mark Kettenis <kettenis@gnu.org> + + * proc-api.c (procfs_note): Add format string to fprintf call. + + * i386-tdep.c (i386_analyze_frame_setup): Add missing encodings + for `subl' and `xorl' instructions. + +2003-12-13 Jim Blandy <jimb@redhat.com> + + * dwarf2read.c (dwarf2_add_member_fn, read_structure_scope): + Replace uses of DEPRECATED_STREQ and DEPRECATED_STREQN with calls + to strcmp and strncmp. + + * osabi.c (gdbarch_init_osabi): Reformat error message with better + line breaks. + +2003-12-13 Mark Kettenis <kettenis@gnu.org> + + * blockframe.c (inside_main_func): Reformat. Introduce new local + variables to prevent long lines. Update comments to reflect + reality. + +2003-12-12 Kevin Buettner <kevinb@redhat.com> + + From David Mosberger <davidm@hpl.hp.com>: + * libunwind-frame.c (unw_find_dyn_list_p): Replace most arguments + with a single unw_dyn_info_t pointer. + (libunwind_find_dyn_list): Likewise. + * libunwind-frame.h: Likewise. + * ia64-tdep.c (ia64_find_unwind_table): Switch to using + UNW_INFO_FORMAT_REMOTE_TABLE so we can avoid having to read in the + entire unwind-table at once. Support for this table format has + been added to libunwind v0.95. + (ia64_find_proc_info_x): Adjust for remote-unwind-table changes. + (ia64_get_dyn_info_list): Adjust for interface change for + libunwind_find_dyn_list(). + +2003-12-12 Jeff Johnston <jjohnstn@redhat.com> + + * breakpoint.c (breakpoint_enabled): New function to test whether + breakpoint is active and enabled. + (insert_bp_location, insert_breakpoints): Call new function to test + for enabled breakpoint. + (remove_breakpoint, breakpoint_here_p, breakpoint_thread_match) + (bpstat_should_step, bpstat_have_active_hw_watchpoints) + (disable_breakpoints_in_shlibs, hw_watchpoint_used_count) + (disable_watchpoints_before_interactive_call_start) + (breakpoint_re_set_one): Ditto. + (bpstat_stop_status): Use new function and simplify test. + +2003-12-11 Mark Kettenis <kettenis@gnu.org> + + * observer.c (observer_test_first_observer) + (observer_test_second_observer, observer_test_third_observer): + Don't define as `static'. + (observer_test_first_notification_function) + (observer_test_second_notification_function) + (observer_test_third_notification_function): Likewise. + +2003-12-10 Mark Kettenis <kettenis@gnu.org> + + * solib.h (SOLIB_UNLOADED_LIBRARY_PATHNAME): Define as "" instead + of (0). + +2003-12-11 Dhananjay Deshpande <dhananjayd@kpitcummins.com> + + * MAINTAINERS (write after approval): Add myself. + +2003-12-11 Dhananjay Deshpande <dhananjayd@kpitcummins.com> + + * config/h8300/tm-h8300.h (h8300hmode): Remove. + (h8300hmode): Likewise. + (h8300smode): Likewise. + (h8300sxmode): Likewise. + (h8300_normal_mode): Likewise. + (GDB_TARGET_IS_H8300): Likewise. + (NUM_REALREGS): Use TARGET_ARCHITECTURE->mach instead of global. + * h8300-tdep.c (is_h8300hmode): New function. + (is_h8300smode): New function. + (is_h8300sxmode): New function. + (is_h8300_normal_mode): New function. + (BINWORD): Use new functions. + (h8300_examine_prologue): Likewise. + (h8300_print_register): Likewise. + (h8300_print_registers_info): Likewise. + (h8300_register_type): Likewise. + (h8300_gdbarch_init): Remove use of globals like h8300hmode. + * remote-e7000.c (e7000_open): Remove use of GDB_TARGET_IS_H8300. + (e7000_fetch_registers): Use TARGET_ARCHITECTURE->mach instead. + (e7000_wait): Use TARGET_ARCHITECTURE->mach instead of global. + +2003-12-10 J. Brobecker <brobecker@gnat.com> + + * frame.c (select_frame): Get the current frame PC using + get_frame_address_in_block() instead of get_frame_pc(). + * stack.c (get_frame_language): Likewise. + +2003-12-08 Kevin Buettner <kevinb@redhat.com> + + * remote.c (remote_open_1, remote_cisco_open): Avoid closing + remote_desc more than once. + +2003-12-07 Andrew Cagney <cagney@redhat.com> + + * defs.h (DEPRECATED_STREQN, DEPRECATED_STREQ): Simplify by + directly calling strcmp equivalents. Add disclaimer. + +2003-12-06 Andrew Cagney <cagney@redhat.com> + + * remote.c (remote_fetch_registers): For short packets, explicitly + supply a zero value. Use regcache_raw_supply. Fix suggested by + Jonathan Larmour. + +2003-12-05 Jeff Johnston <jjohnstn@redhat.com> + + * ia64-tdep.c (ia64_gdbarch_init): Set up the gdbarch long double + format to be the i387 extended float format which is used for + long doubles stored in memory. + +2003-12-05 Mark Kettenis <kettenis@gnu.org> + + From Ulrich Weigand <weigand@informatik.uni-erlangen.de>: + * dwarf2-frame.c (dwarf2_frame_cache): Use the untranslated RA + column instead of translating it. + +2003-12-04 Michael Chastain <mec.gnu@mindspring.com> + + Partial fix for PR c++/1465. + Fix for PR c++/1377. + * cp-support.h (cp_lookup_rtti_type): New function. + * cp-support.c (cp_lookup_rtti_type): New function. + * gnu-v2-abi.c: Update copyright years. + (gnuv2_rtti_type): Call cp_lookup_rtti_type. + * gnu-v3-abi.c: Update copyright years. + (gnuv3_rtti_type): Call cp_lookup_rtti_type. + +2003-12-04 J. Brobecker <brobecker@gnat.com> + + * stabsread.c (read_type): Save a reference to types that are defined + as cross references to other types. + +2003-12-02 Roland McGrath <roland@redhat.com> + + * thread-db.c (enable_thread_event): Change return type to + td_err_e. Return TD_OK or error code. + (enable_thread_event_reporting): Update callers. + +2003-12-03 Ian Lance Taylor <ian@wasabisystems.com> + + * NEWS: Mention new C++ demangler code. + +2003-12-03 Andrew Cagney <cagney@redhat.com> + + * ppc-linux-nat.c (store_register, fetch_register): Convert + between ptrace and regcache's wordsize. + (ppc_register_u_addr): Use the ptrace wordsize. + +2003-12-02 Kevin Buettner <kevinb@redhat.com> + + * frv-tdep.c (frv_gdbarch_init): Add case for fr550. + +2003-12-02 Daniel Jacobowitz <drow@mvista.com> + + * dwarf2read.c (dwarf_info_offset, dwarf_abbrev_offset) + (dwarf_line_offset, dwarf_pubnames_offset, dwarf_aranges_offset) + (dwarf_loc_offset, dwarf_macinfo_offset, dwarf_str_offset) + (dwarf_ranges_offset, dwarf_frame_offset, dwarf_eh_frame_offset): + Delete. + (dwarf2_read_section): Remove offset and size arguments. Use + bfd_get_section_size_before_reloc and sectp->filepos. + (dwarf2_has_info): Clear section variables instead of offsets. + (dwarf2_locate_sections): Don't initialize the deleted variables. + (dwarf2_build_psymtabs): Update calls to dwarf2_read_section. + (dwarf2_build_psymtabs_easy): Likewise. + * dwarf2-frame.c (dwarf_frame_offset, dwarf_frame_size) + (dwarf_eh_frame_offset, dwarf_eh_frame_size): Remove extern + declarations. + (dwarf2_read_section): Update prototype. + (dwarf2_build_frame_info): Update calls to dwarf2_read_section. + Use bfd_get_section_size_before_reloc instead of global size + variables. + +2003-12-01 Michael Chastain <mec.gnu@mindspring.com> + + * dwarfread.c: Update documentation on the state of dwarf-1. + +2003-12-01 Andrew Cagney <cagney@redhat.com> + + Obsolete old MIPS SVr3 and SVr4 systems. + * NEWS: Mention obsoleted systems. + * configure.tgt: Mark mips*-*-sysv4* as obsolete. + * configure.host: Mark mips-dec-*, mips-little-*, mips-sony-*, + mips-*-sysv4*, mips-*-sysv*, mips-*-riscos* and mips-*-mach3* as + obsolete. + * config/mips/decstation.mh: Mark as obsolete. + * config/mips/littlemips.mh: Mark as obsolete. + * config/mips/nm-mips.h: Mark as obsolete. + * config/mips/xm-mips.h: Mark as obsolete. + * config/mips/news-mips.mh: Mark as obsolete. + * config/mips/nm-news-mips.h: Mark as obsolete. + * config/mips/riscos.mh: Mark as obsolete. + * config/mips/nm-riscos.h: Mark as obsolete. + * config/mips/xm-riscos.h: Mark as obsolete. + * config/mips/mipsv4.mt: Mark as obsolete. + * config/mips/tm-mipsv4.h: Mark as obsolete. + * config/mips/xm-mipsv4.h: Mark as obsolete. + + Obsolete old m68k systems. + * configure.host: Mark m68*-sun-*, m68*-sun-sunos4*, + m68*-sun-sunos3*, m68*-motorola-*, m68*-*-sysv4*, m68*-*-lynxos*, + m68*-bull*-sysv*, m68*-att-*, m680[01]0-sun-sunos4*, and + m680[01]0-sun-sunos3* as obsolete. + * configure.tgt: Mark m68*-*-lynxos*, m68*-*-sunos3*, + m68*-*-sunos4*, m68*-*-sysv4*, m68000-*-sunos3*, m68000-*-sunos4*, + m68*-bull-sysv*, m68*-att-*, and m68*-motorola-*, as obsolete. + * config/m68k/sun3os4.mh: Mark file obsolete. + * config/m68k/xm-sun3os4.h: Mark file obsolete. + * config/m68k/sun3os3.mh: Mark file obsolete. + * config/m68k/nm-sun3.h: Mark file obsolete. + * config/m68k/xm-sun3.h: Mark file obsolete. + * config/m68k/sun2os4.mh: Mark file obsolete. + * config/m68k/sun2os3.mh: Mark file obsolete. + * config/m68k/nm-sun2.h: Mark file obsolete. + * config/m68k/xm-sun2.h: Mark file obsolete. + * config/m68k/m68kv4.mh: Mark file obsolete. + * config/m68k/nm-sysv4.h: Mark file obsolete. + * config/m68k/xm-m68kv4.h: Mark file obsolete. + * config/m68k/m68klynx.mh: Mark file obsolete. + * config/m68k/nm-m68klynx.h: Mark file obsolete. + * config/m68k/dpx2.mh: Mark file obsolete. + * config/m68k/xm-dpx2.h: Mark file obsolete. + * config/m68k/nm-dpx2.h: Mark file obsolete. + * config/m68k/delta68.mh: Mark file obsolete. + * config/m68k/xm-delta68.h: Mark file obsolete. + * config/m68k/nm-delta68.h: Mark file obsolete. + * config/m68k/3b1.mh: Mark file obsolete. + * config/m68k/xm-3b1.h: Mark file obsolete. + * config/m68k/sun3os4.mt: Mark file obsolete. + * config/m68k/tm-sun3os4.h: Mark file obsolete. + * config/m68k/sun3os3.mt: Mark file obsolete. + * config/m68k/tm-sun3.h: Mark file obsolete. + * config/m68k/sun2os4.mt: Mark file obsolete. + * config/m68k/tm-sun2os4.h: Mark file obsolete. + * config/m68k/sun2os3.mt: Mark file obsolete. + * config/m68k/tm-sun2.h: Mark file obsolete. + * config/m68k/m68kv4.mt: Mark file obsolete. + * config/m68k/tm-m68kv4.h: Mark file obsolete. + * config/m68k/m68klynx.mt: Mark file obsolete. + * config/m68k/tm-m68klynx.h: Mark file obsolete. + * config/m68k/dpx2.mt: Mark file obsolete. + * config/m68k/tm-dpx2.h: Mark file obsolete. + * config/m68k/delta68.mt: Mark file obsolete. + * config/m68k/tm-delta68.h: Mark file obsolete. + * config/m68k/3b1.mt: Mark file obsolete. + * config/m68k/tm-3b1.h: Mark file obsolete. + +2003-11-29 Mark Kettenis <kettenis@gnu.org> + + * x86-64-tdep.c (MAX_CLASSES): Remove macro. + (x86_64_reg_class): Remove enum. + (merge_classes, classify_argument, examine_argument): Remove + functions. + (INT_REGS, SSE_REGS): Remove macros. + (x86_64_push_arguments): Remove function. + (amd64_push_arguments): New function. + (x86_64_push_dummy_call): Call amd64_push_arguments instead of + x86_64_push_arguments. + +2003-11-28 Mark Kettenis <kettenis@gnu.org> + + * x86-64-tdep.c (x86_64_frame_cache): Don't bail out if %rbp is + zero. Reorganize code a bit. + +2003-11-27 Mark Kettenis <kettenis@gnu.org> + + * dwarf2-frame.c: Fix another comment. + + * x86-64-tdep.c (RET_INT_REGS, RET_SSE_REGS): Remove defines. + (x86_64_use_struct_convention, x86_64_extract_return_value, + x86_64_store_return_value): Remove. + (amd64_reg_class): New enum. + (amd64_merge_classes, amd64_classify_aggregate, amd64_classify, + amd64_return_value): New functions. + (x86_64_init_abi): Don't set extract_return_value, + store_return_value and use_struct_convention. Set return_value to + amd64_return_value. + * i387-tdep.h (i387_return_value): New prototype. + * i387-tdep.c (i387_return_value): New function. + + * dwarf2-frame.c: Fix some comments and whitespace problems. + + * i386nbsd-tdep.c: Don't include "gdbtypes.h". Include + "gdb_assert.h" and "gdb_string.h". + (i386nbsd_r_reg_offset): Rename from regmap. + (SIZEOF_STRUCT_REG): Remove. + (i386nbsd_supply_reg, fetch_core_registers, + fetch_elfcore_registers, i386nbsd_core_fns, i386nbsd_elfcore_fns): + Remove. + (i386nbsd_aout_supply_regset, + i386nbsd_aout_regset_from_core_section): New functions. + (i386nbsd_sc_reg_offset): Don't explicitly specify size of array. + (i386nbsd_init_abi): Initialize TDEP->gregset_reg_offset, + TDEP->gregset_num_regs amd sizeof_gregset. Use ARRAY_SIZE to + initialize TDEP->sc_num_regs. + (i386nbsdaout_init_abi): New function. + (i386nbsdelf_init_abi): Remove initialization of + TDEP->num_xmm_regs. Don't set num_regs here. + (_initialize_i386nbsd_tdep): Don't call add_core_fns. Use + i386nbsd_aout_init to register NetBSD a.out OS/ABI. + + * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Use + .note.netbsdcore.procinfo section to recognize NetBSD core files. + +2003-11-26 Michael Chastain <mec.gnu@mindspring.com> + + * cp-abi.c: Update copyright years. + +2003-11-25 Andrew Cagney <cagney@redhat.com> + + * thread-db.c (enable_thread_event): New function. Ensure that BP + is a code address. + (enable_thread_event_reporting): Use enable_thread_event. + +2003-11-25 Michael Snyder <msnyder@redhat.com> + + * mips-tdep.c (mips_o64_extract_return_value): Correct for + NUM_REGS (see changes 2003-06-21). + (mips_eabi_extract_return_value): Ditto. + +2003-11-25 Andrew Cagney <cagney@redhat.com> + + * infrun.c: Don't include "exec.h". + (handle_inferior_event): Pass current_target, instead of exec_ops, + to SOLIB_ADD. Add comments. + * Makefile.in (infrun.o): Update dependencies. + +2003-11-24 Daniel Jacobowitz <drow@mvista.com> + + * NEWS: Mention improved location expression support. + +2003-11-23 Andrew Cagney <cagney@redhat.com> + + * Makefile.in (infrun.o): Update dependencies. + * infrun.c: Include "exec.h". + (handle_inferior_event): Pass exec_ops to SOLIB_ADD. + +2003-11-23 Andrew Cagney <cagney@redhat.com> + + * frame.c (frame_unwind_signed_register): Delete function. + * frame.h (frame_unwind_register_signed): Delete declaration. + * mips-tdep.c (mips_frame_saved_pc): Use frame_unwind_register_signed. + + * arch-utils.h (generic_cannot_extract_struct_value_address): + Delete declaration. + + * defs.h (DEPRECATED_STREQN): Rename STREQN. + (DEPRECATED_STREQ): Rename STREQ. + * ada-exp.y, ada-lang.c, ada-lex.l, coffread.c: Update. + * config/mips/tm-irix5.h, config/mips/tm-irix6.h: Update. + * config/mips/tm-mipsv4.h, config/sparc/tm-sun4sol2.h: Update. + * dbxread.c, dwarf2read.c, dwarfread.c, environ.c: Update. + * eval.c, exec.c, f-lang.c, hppa-tdep.c, hpread.c: Update. + * jv-exp.y, language.c, m2-exp.y, mcore-rom.c: Update. + * mdebugread.c, mipsread.c, objc-exp.y, objfiles.c: Update. + * p-exp.y, p-typeprint.c, p-valprint.c, rs6000-nat.c: Update. + * source.c, sparc-tdep.c, stack.c, target.c: Update. + + * symfile.c (symbol_file_command): Replace STREQ with strcmp. + * elfread.c (elf_symtab_read): Delete STREQ from comment. + +2003-11-22 Andrew Cagney <cagney@redhat.com> + + * frame.c (deprecated_frame_xmalloc): Delete function. + (deprecated_set_frame_extra_info_hack): Delete function. + (deprecated_set_frame_saved_regs_hack): Delete function. + * frame.h (deprecated_frame_xmalloc): Delete declaration. + (deprecated_set_frame_extra_info_hack): Delete declaration. + (deprecated_set_frame_saved_regs_hack): Delete declaration. + * mcore-tdep.c (analyze_dummy_frame): Instead of + deprecated_frame_xmalloc, deprecated_set_frame_saved_regs_hack, + and deprecated_set_frame_extra_info_hack use + deprecated_frame_xmalloc_with_cleanup. + * mn10300-tdep.c (analyze_dummy_frame): Ditto. + * mips-tdep.c (mips_init_extra_frame_info): Delete call to + deprecated_set_frame_saved_regs_hack. + + * mips-tdep.c (mips_frame_chain): Delete call to + deprecated_inside_entry_file. + + * frame.h (deprecated_set_frame_next_hack): Delete declaration. + (deprecated_set_frame_prev_hack): Delete declaration. + * frame.c (deprecated_set_frame_next_hack): Delete function. + (deprecated_set_frame_prev_hack): Delete function. + * mcore-tdep.c (analyze_dummy_frame): Delete calls to + "deprecated_set_frame_next_hack" and + "deprecated_set_frame_prev_hack". + * mn10300-tdep.c (analyze_dummy_frame): Ditto. + + * mips-tdep.c (mips_register_convertible): Delete function. + (mips_register_convert_to_virtual): Delete function. + (mips_register_convert_to_raw): Delete function. + (mips_gdbarch_init): Do not set "deprecated_register_convertible", + "deprecated_register_convert_to_virtual", or + "deprecated_register_convert_to_raw". + (mips_pseudo_register_write, mips_pseudo_register_read): Handle + 32/64 cooked to raw register conversions. + + * frame.c (deprecated_get_frame_context): Delete function. + (deprecated_set_frame_context): Delete function. + (struct frame_info): Delete member "context". + * frame.h (deprecated_get_frame_context): Delete declaration. + (deprecated_set_frame_context): Delete declaration. + + * procfs.c (procfs_wait): Delete FAULTED_USE_SIGINFO comment. + * config/sparc/tm-sun4sol2.h (FAULTED_USE_SIGINFO): Delete macro. + * config/i386/tm-i386sol2.h (FAULTED_USE_SIGINFO): Delete macro. + * config/alpha/nm-osf2.h (FAULTED_USE_SIGINFO): Delete macro. + + * mips-tdep.c (SIGFRAME_REG_SIZE): Delete macro. + (mips_find_saved_regs): Replace SIGFRAME_REG_SIZE with + mips_regsize. + (mips_dump_tdep): Do not print SIGFRAME_REG_SIZE. + * config/mips/tm-irix6.h (SIGFRAME_REG_SIZE): Delete macro. + * config/mips/tm-irix5.h: Update copyright. + (SIGFRAME_REG_SIZE): Delete macro. + + * hppa-tdep.c (hppa_value_returned_from_stack): Delete function. + * config/pa/tm-hppa.h (hppa_value_returned_from_stack): Delete + declaration. + (DEPRECATED_VALUE_RETURNED_FROM_STACK): Delete macro. + * infcall.c (call_function_by_hand): Delete #ifdef + DEPRECATED_VALUE_RETURNED_FROM_STACK code. + * infcmd.c (print_return_value): Ditto. + + * mips-tdep.c (skip_prologue_using_sal): New function. + (mips32_skip_prologue, mips16_skip_prologue): Use + skip_prologue_using_sal to get an upper bound on the search. + + * config/powerpc/tm-linux.h (PROLOGUE_FIRSTLINE_OVERLAP): Delete + #if 0'ed macro. + * infrun.c (step_into_function): Delete #ifdef + PROLOGUE_FIRSTLINE_OVERLAP code. + * symtab.c (find_function_start_sal): Ditto. + + * remote-rdp.c: Update copyright. + (rdp_init): #if 0 references to "target_byte_order". + + * mips-tdep.c (mips_o32_store_return_value): Delete function. + (mips_o32_return_value): Replace mips_o32_xfer_return_value. + (mips_o32_extract_return_value): Delete function. + (mips_n32n64_return_value): Replace mips_n32n64_xfer_return_value. + (mips_n32n64_extract_return_value): Delete function. + (mips_n32n64_store_return_value): Delete function. + (mips_gdbarch_init): For o32 and n32n64, set "return_value" + instead of "store_return_value", "extract_return_value", and + "use_struct_convention". + (mips_n32n64_use_struct_convention): Delete function. + +2003-11-21 Kevin Buettner <kevinb@redhat.com> + + * frv-tdep.c (frv_frame_this_id): Eliminate call to + inside_entry_func(). + +2003-11-20 Mark Kettenis <kettenis@gnu.org> + + * i386-tdep.c (i386_extract_return_value, + i386_store_return_value): Add gdbarch argument. Use it instead of + determining it from REGCACHE. Remove recursive call for + structures with a single member. + (i386_use_struct_convention): Remove. + (i386_reg_struct_return_p): New function. + (i386_return_value): New function. + (i386_gdbarch_init): Set return_value, don't set + extract_return_value, store_return_value and + use_struct_convention. + * x86-64-tdep.c (x86_64_init_abi): Set return_value to NULL. + +2003-11-20 Jim Blandy <jimb@redhat.com> + + * osabi.c (_initialize_gdb_osabi): Don't return before registering + the 'set osabi' and 'show osabi' commands. + +2003-11-19 Mark Kettenis <kettenis@gnu.org> + + * frame.c (get_prev_frame): Use result from + get_frame_address_in_block instead of get_frame_pc as argument to + inside_main_func. Fixes PR backtrace/1435. + +2003-11-19 Andrew Cagney <cagney@redhat.com> + + * stack.c (return_command): Handle "void", "legacy" and "unknown + location" return values separatly. + * values.c (using_struct_return): Return 0 for a "void" return + type. Mention "register_value_being_returned". + (register_value_being_returned): Mention "using_struct_return". + +2003-11-19 Daniel Jacobowitz <drow@mvista.com> + + * dwarf2read.c (offreg, basereg, isderef, frame_base_reg) + (frame_base_offset): Delete. + (read_func_scope): Delete call to decode_locdesc. + (decode_locdesc): Update comments. Don't set the removed variables. + Complain for DW_OP_reg* not at the end. Remove DW_OP_breg* and + DW_OP_fbreg support. + +2003-11-18 Daniel Jacobowitz <drow@mvista.com> + + * dwarf2read.c (optimized_out, islocal): Remove. + (decode_locdesc): Update comments. Don't set optimized_out + or islocal. + +2003-11-17 Jeff Johnston <jjohnstn@redhat.com> + David Mosberger <davidm@hpl.hp.com> + + * ia64-tdep.c: Include elf.h. + [HAVE_LIBUNWIND_IA64_H]: Include libunwind-frame.h and + libunwind-ia64.h. + (ia64_rse_slot_num, ia64_rse_skip_regs): New for libunwind support. + (ia64_gdb2uw_regnum, ia64_uw2gdb_regnum): Ditto. + (ia64_is_fpreg, ia64_access_reg): Ditto. + (ia64_access_fpreg, ia64_access_mem): Ditto. + (get_kernel_table): Ditto. + (ia64_find_unwind_table): Ditto. + (ia64_find_proc_info_x, ia64_put_unwind_info): Ditto. + (ia64_get_dyn_info_list, ia64_libunwind_frame_this_id): Ditto. + (ia64_libunwind_frame_prev_register): Ditto. + (ia64_libunwind_frame_sniffer): Ditto. + (ia64_gdbarch_init)[HAVE_LIBUNWIND_IA64_H]: Add libunwind frame + sniffer. Register libunwind functions needed by generic + libunwind frame code using libunwind_frame_set_descr(). + +2003-11-16 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.c (re_enable_breakpoints_in_shlibs): Only re-enable a + bp_shlib_disabled breakpoint if there is a shared library mapped + at its expected address. + +2003-11-16 Andrew Cagney <cagney@redhat.com> + + * configure.tgt: Delete mips*tx39*-elf*. + * config/mips/tm-tx39.h: Delete file. + * config/mips/tx39.mt: Delete file. + * config/mips/tx39.mt: Delete file. + + * mips-tdep.h (deprecated_mips_set_processor_regs_hack): Declare. + * remote-mips.c (common_open): Instead of + "mips_read_register_type" and "mips_set_processor_type_command" + call "deprecated_mips_set_processor_regs_hack". + * config/mips/tm-mips.h (mips_read_processor_type): Delete + declaration. + (mips_set_processor_type_command): Delete declaration. + * mips-tdep.c (mips_gdbarch_init): Update comment. + (mips_dump_tdep): Do not print MIPS_REGISTER_NAMES. + (mips_set_processor_type): Delete function. + (NUM_MIPS_PROCESSOR_REGS): Define. + (mips_show_processor_type_command): Delete function. + (mips_set_processor_type_command): Delete function. + (tmp_mips_processor_type): Delete. + (mips_processor_type): Delete. + (mips_processor_type_table): Delete. + (mips_r3051_reg_names): Delete. + (mips_r3081_reg_names): Delete. + (mips_lsi33k_reg_names): Delete. + (mips_processor_reg_names): Delete. + (mips_read_processor_type): Delete function. + (deprecated_mips_set_processor_regs_hack): New function. + (struct gdbarch_tdep): Add member "mips_processor_reg_names". + (mips_register_name): Get the processor names from the tdep. + (mips_tx39_reg_names): New array. + (mips_generic_reg_names): Wire to a standard set of names. + (mips_gdbarch_init): Set "mips_processor_reg_names". + * config/mips/tm-irix5.h (MIPS_REGISTER_NAMES): Delete macro. + * config/mips/tm-mips.h (MIPS_REGISTER_NAMES): Delete macro. + * config/mips/tm-tx39.h (MIPS_REGISTER_NAMES): Delete macro. + +2003-11-16 Andrew Cagney <cagney@redhat.com> + + * mips-tdep.c (struct gdbarch_tdep): Add field "regnum". + (mips_fpa0_regnum, mips_regnum): New function. + (mips_gdbarch_init): Fill in the "regnum" fields. + * mips-tdep.h (struct mips_regnum): Define. + (mips_regnum): Declare. + * config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro. + (LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto. + (CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto. + (FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto. + * config/mips/tm-irix6.h (FP0_REGNUM): Delete macro. + (PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto. + (HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto. + * config/mips/tm-irix5.h (FP0_REGNUM): Delete macro. + (PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto. + (HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto. + * remote-mips.c: Include "mips-tdep.h". Update. + * mipsnbsd-tdep.c: Update. + * mipsv4-nat.c: Update. + * mips-tdep.c: Update. + * mips-nat.c: Update. + * mips-linux-tdep.c: Update. + * mips-linux-nat.c: Update. + * irix5-nat.c: Update. + * dve3900-rom.c: Include "mips-tdep.h". Update. + (ignore_packet): Supress GCC warning. + * config/mips/nm-riscos.h: Update. + +2003-11-16 Andrew Cagney <cagney@redhat.com> + + * mips-tdep.c: Replace DEPRECATED_REGISTER_RAW_SIZE with + register_size. + (mips_register_raw_size): Delete function. + (mips_register_type): Handle "mips64_transfers_32bit_regs_p". + (mips_gdbarch_init): Do not set "deprecated_register_raw_size". + Check and set "mips64_transfers_32bit_regs_p". + (struct gdbarch_tdep): Add "mips64_transfers_32bit_regs_p". + (mips_register_convertible): Check the architecture's + "mips64_transfers_32bit_regs_p". + (set_mips64_transfers_32bit_regs): New function. + (_initialize_mips_tdep): Use "add_setshow_cmd" when adding the + "set remote-mips64-transfers-32bit-regs" command. Specify + set_mips64_transfers_32bit_regs as the set function. + * Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies. + +2003-11-16 Mark Kettenis <kettenis@gnu.org> + + * i386-tdep.h (i386_supply_gregset): Provide prototype. + * i386-tdep.c (i386_supply_gregset): Make public. + +2003-11-16 Andrew Cagney <cagney@redhat.com> + + * mips-tdep.c (mips_register_byte): Delete function. + (mips_gdbarch_init): Do not set "deprecated_register_byte". + * config/mips/tm-mips.h (MIPS_REGISTER_BYTE): Delete macro. + * config/mips/tm-irix6.h (MIPS_REGISTER_BYTE): Delete macro. + * config/mips/tm-irix5.h (MIPS_REGISTER_BYTE): Delete macro. + +2003-11-16 Mark Kettenis <kettenis@gnu.org> + + * i386-tdep.c (i386_extract_return_value): Don't use bfd_byte. + +2003-11-16 Andrew Cagney <cagney@redhat.com> + + * config/mips/linux64.mt: Delete file. + * config/mips/tm-linux64.h: Delete file. + * config/mips/tm-mips64.h: Delete file. + * config/mips/embed64.mt: Delete file. + * config/djgpp/fnchange.lst: Update. + * configure.tgt: Delete explicit patterns for mipsisa64*-*-linux*, + mips64*-*-linux*, mips64*-*-*, and mipsisa64*-*-*. + * config/mips/tm-irix6.h: Update copyright. Include + "mips/tm-mips.h" instead of "mips/tm-mips64.h". + * mips-tdep.c (mips_dump_tdep): Do not print "OP_LDFPR" or + "OP_LDGPR". + +2003-11-15 Andrew Cagney <cagney@redhat.com> + + * mips-tdep.c (mips_register_type): Simplify. Eliminate reference + to MIPS_REGISTER_TYPE. Make integer registers signed. Make IRIX + n32 registers 64 bit. + (mips_register_raw_size, mips_register_byte): For pseudo + registers, use the register's pseudo size and not the + corresponding raw register's size. + * config/mips/tm-mips64.h (MIPS_REGISTER_TYPE): Delete macro. + * config/mips/tm-mips.h (MIPS_REGISTER_TYPE): Delete macro. + * config/mips/tm-irix6.h: Don't #undef MIPS_REGISTER_TYPE. + * config/mips/tm-irix5.h (MIPS_REGISTER_TYPE): Delete macro. + +2003-11-15 Andrew Cagney <cagney@redhat.com> + + * mips-tdep.c (struct gdbarch_tdep): Delete member + gdb_target_is_mips64. + (GDB_TARGET_IS_MIPS64): Delete macro. + (mips_gdbarch_init): Do not set tdep's gdb_target_is_mips64. + (mips_dump_tdep): Do not print GDB_TARGET_IS_MIPS64. + (mips_addr_bits_remove): Simplify. + + * mips-tdep.c: Replace DEPRECATED_REGISTER_VIRTUAL_SIZE with + register_size. + + Replace MIPS_REGSIZE with mips_regsize. + * mips-tdep.c (mips_regsize): New function. + * mips-tdep.h (mips_regsize): Declare. + * mipsnbsd-tdep.h (SIZEOF_STRUCT_FPREG): Update. + (SIZEOF_STRUCT_REG): Update. + * mipsnbsd-tdep.c (mipsnbsd_supply_reg): Update. + (mipsnbsd_fill_reg): Update. + (mipsnbsd_supply_fpreg): Update. + (mipsnbsd_fill_fpreg): Update. + (NBSD_MIPS_JB_ELEMENT_SIZE): Update. + * mips-tdep.c (mips_register_raw_size): Update. + (mips_register_type): Update. + (SIGFRAME_BASE): Update. + (SIGFRAME_PC_OFF): Update. + (SIGFRAME_REGSAVE_OFF): Update. + (SIGFRAME_FPREGSAVE_OFF): Update. + (SIGFRAME_REG_SIZE): Update. + (mips32_heuristic_proc_desc): Update. + (print_gp_register_row): Update. + (mips_dump_tdep): Do not print MIPS_REGSIZE. + * irix5-nat.c (supply_gregset): Update. + (fetch_core_registers): Update. + * config/mips/tm-mips64.h (MIPS_REGSIZE): Delete macro. + * config/mips/tm-irix6.h (MIPS_REGISTER_BYTE): Update. + * config/mips/tm-mips.h (MIPS_REGSIZE): Delete macro. + (MIPS_REGISTER_BYTE): Update. + * config/mips/tm-irix5.h (MIPS_REGISTER_BYTE): Update. + +2003-11-15 Andrew Cagney <cagney@redhat.com> + + * config/sparc/tm-sparc.h (DEPRECATE_USE_REGISTER_NOT_ARG): Rename + USE_REGISTER_NOT_ARG. + * stabsread.c (define_symbol): Update. + +2003-11-15 Andrew Cagney <cagney@redhat.com> + + * bcache.h (deprecated_bcache): Declare. + (bcache): Make returned buffer constant. + * bcache.c (deprecated_bcache): New function. + (bcache_data): New function. + (bcache): Call bcache data. + * symfile.c (add_psymbol_to_list): Use deprecated_bcache. + (add_psymbol_with_dem_name_to_list): Ditto. + +2003-11-15 Mark Kettenis <kettenis@gnu.org> + + * glibc-tdep.h (struct gdbarch): Declare opaque. + (glibc_skip_solib_resolver): Adjust prototype. + * glibc-tdep.c (glibc_skip_solib_resolver): Adjust. + * arm-linux-tdep.c (arm_linux_skip_solib_resolver): Remove. + (arm_linux_init_abi): Set skip_solib_resolver. + * i386-linux-tdep.c (i386_linux_skip_solib_resolver): Remove. + (i386_linux_init_abi): Set skip_solib_resolver. + * config/arm/tm-linux.h (SKIP_SOLIB_RESOLVER): Remove. + (arm_linux_skip_solib_resolver): Remove prototype. + * config/i386/tm-linux.h (SKIP_SOLIB_RESOLVER): Remove. + (i386_linux_skip_solib_resolver): Remove prototype. + +2003-11-14 Mark Kettenis <kettenis@gnu.org> + + * gdbarch.sh (skip_solib_resolver): Change into a multi-arch + function. + * gdbarch.c, gdbarch.h: Regenerate. + * infrun.c (handle_inferior_event): Call + gdbarch_skip_solib_resolver instead of SKIP_SOLIB_RESOLVER. + * arch-utils.c (generic_in_solib_call_trampoline): Adjust function + definition. + * arch-utils.h (generic_in_solib_call_trampoline): Adjust function + prototype. + +2003-11-14 Jeff Johnston <jjohnstn@redhat.com> + + * libunwind-frame.c: New file. + * libunwind-frame.h: New file. + * acconfig.h (HAVE_LIBUNWIND): #undef reference added. + * configure.in: Add --with-libunwind option support. Define + HAVE_LIBUNWIND if libunwind support selected / defaulted. + Also check for libunwind.h and libunwind-ia64.h headers. + * configure: Regenerated. + * Makefile.in: Add support for libunwind-frame.o. + * config.in: Regenerated. + +2003-11-14 Jeff Johnston <jjohnstn@redhat.com> + + * config/ia64/nm-linux.h (NATIVE_XFER_UNWIND_TABLE): New macro to + set up the ia64 linux native target method for getting the kernel + unwind table. + * ia64-linux-nat.c (ia64_linux_xfer_unwind_table): New function. + * inftarg.c (child_xfer_partial): Enable section of code to + handle TARGET_OBJECT_UNWIND_TABLE. + * target.h (target_object): Add new TARGET_OBJECT_UNWIND_TABLE macro. + +2003-11-14 Ian Lance Taylor <ian@wasabisystems.com> + + * config/arm/nbsd.mt (TM_FILE): Define. + * config/arm/tm-nbsd.h: New file. + +2003-11-14 Andrew Cagney <cagney@redhat.com> + + * Makefile.in (ppc-sysv-tdep.o): Update dependencies. + * ppc-sysv-tdep.c: Include "objfiles.h". + (ppc64_sysv_abi_push_dummy_call): Provide the + the FN's objfile when looking for the descriptor. + + * ppc-linux-tdep.c (ppc_linux_init_abi): Set PPC64's + "name_of_malloc" to ".malloc". + +2003-11-13 Mark Kettenis <kettenis@gnu.org> + + * config/i386/x86-64linux.mt (TDEPFILES): Add glibc-tdep.o. + +2003-11-13 David Carlton <carlton@kealia.com> + + * cp-namespace.c (lookup_namespace_scope): Fix typo in comment. + +2003-11-13 Andrew Cagney <cagney@redhat.com> + + * arch-utils.h (selected_architecture_name): Declare. + (selected_byte_order): Declare. + * arch-utils.c (selected_byte_order): New function. + (selected_architecture_name): New function. + (target_architecture_auto): Make static. + (set_architecture_string): Make static. + (target_byte_order): Make static. + (target_byte_order_auto): Make static. + * gdbarch.sh (TARGET_BYTE_ORDER, TARGET_ARCHITECTURE): Delete + non-multi-arch definition. + (TARGET_ARCHITECTURE_AUTO, TARGET_BYTE_ORDER_AUTO): Delete. + (target_byte_order, target_architecture): Delete declaration. + (target_byte_order_auto, target_architecture_auto): Ditto. + * gdbarch.h: Re-generate. + * remote-sim.c (gdbsim_open): Use "selected_architecture_name" and + "selected_byte_order". + +2003-11-13 Andrew Cagney <cagney@redhat.com> + + * ppc-linux-tdep.c (ppc_linux_return_value): Fix parameter order. + +2003-11-13 Jim Blandy <jimb@redhat.com> + + * cp-namespace.c: Doc fix. + +2003-11-12 Michael Snyder <msnyder@redhat.com> + + * sh64_tdep.c: Regularize some names. + (sh_sh64_register_name): Rename to sh64_register_name. + (sh_sh64_breakpoint_from_pc): Rename to sh64_breakpoint_from_pc. + (sh_sh64_register_byte): Rename to sh64_register_byte. + (sh_sh64_build_float_register_type): + Rename to sh64_build_float_register_type. + (sh_sh64_register_convert_to_virtual): + Rename to sh64_register_convert_to_virtual. + (sh_sh64_register_convert_to_raw): + Rename to sh64_register_convert_to_raw. + + * sh64-tdep.c (translate_insn_rn, is_media_pseudo, + sh64_media_reg_base_num, sh64_compact_reg_base_num, + sh64_nofp_frame_init_saved_regs, sh64_push_arguments, + sh64_extract_return_value, sh64_show_media_regs, + sh64_show_compact_regs, sh_sh64_register_byte, sh64_register_type, + sh_sh64_register_convert_to_virtual, sh_sh64_register_convert_to_raw, + sh64_pseudo_register_read, sh64_pseudo_register_write, + sh64_do_pseudo_register, sh_compact_print_registers_info): + Delete unused variable 'tdep'. + + * sh64-tdep.c: Coding standard and spelling comment fixes. + (sh64_extract_return_value): Replace deprecated_store_floating + with store_typed_floating. + (sh_sh64_register_convert_to_raw): Replace + deprecated_store_floating with store_typed_floating. + (sh_sh64_register_virtual_type): Convert to sh64_register_type. + (sh64_frame_chain, sh64_get_saved_pr, sh64_get_saved_register, + sh64_nofp_frame_init_saved_regs, sh64_push_arguments, + sh64_extract_struct_value_address, sh64_pop_frame, + sh64_extract_return_value, sh64_store_return_value, + sh_sh64_register_convert_to_virtual, sh64_pseudo_register_read, + sh_sh64_register_convert_to_raw, sh_pseudo_register_write): + Replace DEPRECATED_REGISTER_RAW_SIZE with register_size. + Replace DEPRECATED_REGISTER_VIRTUAL_TYPE with register_type. + (sh64_gdbarch_init): Don't set deprecated_register_bytes, + deprecated_register_virtual_type, deprecated_register_raw_size, + deprecated_max_register_raw_size, or + deprecated_max_register_virtual_size. Instead, just set + gdbarch_register_type. + (sh_sh64_register_raw_size): Delete. + (sh_sh64_register_virtual_size): Delete. + +2003-11-12 Daniel Jacobowitz <drow@mvista.com> + + * dwarf2read.c (struct dwarf2_cu): New type. + + (dwarf2_build_psymtabs_hard, psymtab_to_symtab_1): Create a + dwarf2_cu structure to pass down. + + (scan_partial_symbols, add_partial_symbol, add_partial_namespace) + (add_partial_enumeration, locate_pdi_sibling, process_die) + (read_file_scope, read_func_scope) + (read_lexical_block_scope, dwarf2_get_pc_bounds) + (dwarf2_add_field, dwarf2_attach_fields_to_type) + (dwarf2_add_member_fn, dwarf2_attach_fn_fields_to_type) + (read_structure_scope, read_enumeration, read_array_type) + (read_common_block, read_namespace, read_tag_pointer_type) + (read_tag_ptr_to_member_type, read_tag_reference_type) + (read_tag_const_type, read_tag_volatile_type, read_tag_string_type) + (read_subroutine_type, read_typedef, read_base_type, read_comp_unit) + (read_die_and_children, read_die_and_siblings, dwarf2_read_section) + (dwarf2_read_abbrevs, dwarf2_lookup_abbrev, read_partial_die) + (read_full_die. read_attribute_value, read_attribute) + (read_address, dwarf_decode_line_header, dwarf_decode_lines) + (var_decode_location, new_symbol, dwarf2_const_value, die_type) + (die_containing_type, type_at_offset, tag_type_to_type) + (read_type_die, dwarf_base_type, decode_locdesc, dwarf_decode_macros) + (dwarf2_symbol_mark_computed): Accept and use a dwarf2_cu object. + +2003-11-12 Daniel Jacobowitz <drow@mvista.com> + + PR breakpoints/1450 + * breakpoint.c (insert_bp_location): Fix a logic error by returning + 0 after a catchpoint fails. + +2003-11-11 Michael Chastain <mec.gnu@mindspring.com> + + * mips-tdep.c (msymbol_size): Delete. + +2003-11-07 Michael Chastain <mec@shout.net> + + * symtab.h (struct minimal_symbol): Add size. + * dbxread.c: Use it. + * elfread.c: (record_minimal_symbol_and_info): Do not use info. + Rename to record_minimal_symbol. + (elf_symtab_read): Set MSYMBOL_SIZE explicitly. + * minsyms.c (prim_record_minimal_symbol_and_info): Initialize MSYMBOL_SIZE. + (install_minimal_symbols): Ditto. + * objfiles.c (terminate_minimal_symbol_table): Ditto. + * arm-tdep.c: Delete unused MSYMBOL_SIZE. + * m68hc11-tdep.c: Ditto. + * mips-tdep.c: Ditto. + * sh64-tdep.c: Ditto. + +2003-12-15 David Carlton <carlton@kealia.com> + * dwarf2read.c (get_scope_pc_bounds): New. (psymtab_to_symtab_1): Use get_scope_pc_bounds. (read_file_scope): Ditto. @@ -79,7 +1002,7 @@ (TARGET_FLOAT_FORMAT: Pass "current_gdbarch" to default_double_format. (TARGET_DOUBLE_FORMAT,TARGET_LONG_DOUBLE_FORMAT): Ditto. * gdbarch.c: Re-generate. - + * config/s390/s390.mh (XM_FILE, XM_CLIBS): Delete macros. * config/s390/nm-linux.h (KERNEL_U_ADDR): Define. * config/s390/xm-linux.h: Delete file. @@ -434,10 +1357,10 @@ 2003-11-05 Jeff Johnston <jjohnstn@redhat.com> * ia64-tdep.c (struct gdbarch_tdep): Remove os_ident field. - (ia64_gdbarch_init): Don't bother calculating the os. - Instead use the gdbarch_info struct and look at the osabi field. - Also use gdbarch_list_lookup_by_info() to look for a - candidate gdbarch. + (ia64_gdbarch_init): Don't bother calculating the os. + Instead use the gdbarch_info struct and look at the osabi field. + Also use gdbarch_list_lookup_by_info() to look for a + candidate gdbarch. 2003-11-05 Kevin Buettner <kevinb@redhat.com> @@ -490,7 +1413,7 @@ 2003-11-04 Michael Snyder <msnyder@redhat.com> - * MAINTAINERS: Remove myself as owner of breakpoints and + * MAINTAINERS: Remove myself as owner of breakpoints and of sparc/solaris. 2003-11-03 Corinna Vinschen <vinschen@redhat.com> @@ -680,7 +1603,7 @@ * symfile.c (reread_symbols): Clear per-objfile data. 2003-10-28 Jeff Johnston <jjohnstn@redhat.com> - + * symfile.c (symbol_file_add_with_addrs_or_offsets): Switch to use printf_unfiltered instead of printf_filtered for output messages. (add_symbol_file_command): Ditto. @@ -851,7 +1774,7 @@ * gdbarch.sh (convert_from_func_ptr_addr): Convert to a pure multi-arch method, add "targ" parameter. - (struct target_ops): Declare. + (struct target_ops): Declare. * gdbarch.h, gdbarch.c: Re-generate. * Makefile.in (c-valprint.o): Update dependencies. * arch-utils.h: Update copyright. @@ -1116,8 +2039,8 @@ (frame_id_build_special): New prototype. * frame.c (frame_id_build_special): New function. (frame_id_build): Change to call frame_id_build_special(). - (frame_id_eq): Change to also test special_addr field. - (frame_id_inner): Update comment. + (frame_id_eq): Change to also test special_addr field. + (frame_id_inner): Update comment. 2003-10-17 Andrew Cagney <cagney@redhat.com> @@ -1189,7 +2112,7 @@ (IA64_LINUX_SIGCONTEXT_OFFSET): Magic constant removed. (ia64_linux_sigcontext_register_addr): Find the address of the sigcontext area stored in the sigframe instead of using - a magic offset constant. + a magic offset constant. 2003-10-15 Andrew Cagney <cagney@redhat.com> @@ -1728,7 +2651,7 @@ 2003-09-29 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (DEPRECATED_REGISTER_VIRTUAL_TYPE): Rename - DEPRECATED_REGISTER_VIRTUAL_TYPE. + REGISTER_VIRTUAL_TYPE. * gdbarch.h, gdbarch.c: Regenerate. * arch-utils.c, hppa-tdep.c, regcache.c, regcache.h: Update. * sh64-tdep.c, sparc-tdep.c: Update. @@ -8224,7 +9147,7 @@ Fri Aug 8 00:28:38 UTC 2003 Brendan Conoboy <blc@redhat.com> for 32-bit targets. Set extract_return_value and store_return_value instead. * config/sparc/tm-sparc.h (DEPRECATED_STORE_RETURN_VALUE, - DEPRECTAED_EXTRACT_RETURN_VALUE, + DEPRECATED_EXTRACT_RETURN_VALUE, DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS): Don't define these. (STORE_RETURN_VALUE, EXTRACT_RETURN_VALUE, EXTRACT_STRUCT_VALUE_ADDRESS): Define these instead. diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index ecf0df0..7b99764 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -327,6 +327,7 @@ Brendan Conoboy blc@redhat.com DJ Delorie dj@redhat.com Chris G. Demetriou cgd@broadcom.com Philippe De Muyter phdm@macqel.be +Dhananjay Deshpande dhananjayd@kpitcummins.com Klee Dienes kdienes@apple.com Richard Earnshaw rearnsha@arm.com Frank Ch. Eigler fche@redhat.com diff --git a/gdb/Makefile.in b/gdb/Makefile.in index dac5496..7eeca76 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -708,6 +708,7 @@ interps_h = interps.h jv_lang_h = jv-lang.h kod_h = kod.h language_h = language.h +libunwind_frame_h = libunwind-frame.h linespec_h = linespec.h linux_nat_h = linux-nat.h m2_lang_h = m2-lang.h @@ -1281,6 +1282,7 @@ ALLDEPFILES = \ i386gnu-nat.c i386gnu-tdep.c \ ia64-linux-nat.c ia64-linux-tdep.c ia64-tdep.c \ infptrace.c inftarg.c irix4-nat.c irix5-nat.c \ + libunwind-frame.c \ lynx-nat.c m3-nat.c \ m68hc11-tdep.c \ m68k-tdep.c \ @@ -1724,7 +1726,8 @@ dummy-frame.o: dummy-frame.c $(defs_h) $(dummy_frame_h) $(regcache_h) \ $(frame_h) $(inferior_h) $(gdb_assert_h) $(frame_unwind_h) \ $(command_h) $(gdbcmd_h) dve3900-rom.o: dve3900-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ - $(serial_h) $(inferior_h) $(command_h) $(gdb_string_h) $(regcache_h) + $(serial_h) $(inferior_h) $(command_h) $(gdb_string_h) $(regcache_h) \ + $(mips_tdep_h) dwarf2expr.o: dwarf2expr.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(value_h) \ $(gdbcore_h) $(elf_dwarf2_h) $(dwarf2expr_h) dwarf2-frame.o: dwarf2-frame.c $(defs_h) $(dwarf2expr_h) $(elf_dwarf2_h) \ @@ -1912,7 +1915,7 @@ ia64-tdep.o: ia64-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \ $(arch_utils_h) $(floatformat_h) $(regcache_h) $(reggroups_h) \ $(frame_h) $(frame_base_h) $(frame_unwind_h) $(doublest_h) \ $(value_h) $(gdb_assert_h) $(objfiles_h) $(elf_common_h) \ - $(elf_bfd_h) $(dis_asm_h) + $(elf_bfd_h) $(dis_asm_h) $(libunwind_frame_h) infcall.o: infcall.c $(defs_h) $(breakpoint_h) $(target_h) $(regcache_h) \ $(inferior_h) $(gdb_assert_h) $(block_h) $(gdbcore_h) $(language_h) \ $(symfile_h) $(gdbcmd_h) $(command_h) $(gdb_string_h) $(infcall_h) @@ -1960,6 +1963,10 @@ kod-cisco.o: kod-cisco.c $(defs_h) $(gdb_string_h) $(kod_h) language.o: language.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(value_h) $(gdbcmd_h) $(expression_h) $(language_h) $(target_h) \ $(parser_defs_h) $(jv_lang_h) $(demangle_h) +libunwind-frame.o: libunwind-frame.c $(defs_h) \ + $(frame_h) $(frame_base_h) $(frame_unwind_h) $(gdbcore_h) \ + $(gdbtypes_h) $(symtab_h) $(objfiles_h) $(regcache_h) \ + $(gdb_assert_h) $(gdb_string_h) $(complaints_h) $(libunwind_frame_h) linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \ $(symfile_h) $(objfiles_h) $(source_h) $(demangle_h) $(value_h) \ $(completer_h) $(cp_abi_h) $(parser_defs_h) $(block_h) \ @@ -2188,7 +2195,7 @@ remote-m32r-sdi.o: remote-m32r-sdi.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ $(inferior_h) $(target_h) $(regcache_h) $(gdb_string_h) $(serial_h) remote-mips.o: remote-mips.c $(defs_h) $(inferior_h) $(bfd_h) $(symfile_h) \ $(gdbcmd_h) $(gdbcore_h) $(serial_h) $(target_h) $(remote_utils_h) \ - $(gdb_string_h) $(gdb_stat_h) $(regcache_h) + $(gdb_string_h) $(gdb_stat_h) $(regcache_h) $(mips_tdep_h) remote-rdi.o: remote-rdi.c $(defs_h) $(gdb_string_h) $(frame_h) \ $(inferior_h) $(bfd_h) $(symfile_h) $(target_h) $(gdbcmd_h) \ $(objfiles_h) $(gdb_stabs_h) $(gdbthread_h) $(gdbcore_h) \ @@ -3,6 +3,19 @@ *** Changes since GDB 6.0: +* New C++ demangler + +GDB has a new C++ demangler which does a better job on the mangled +names generated by current versions of g++. It also runs faster, so +with this and other changes gdb should now start faster on large C++ +programs. + +* DWARF 2 Location Expressions + +GDB support for location expressions has been extended to support function +arguments and frame bases. Older versions of GDB could crash when they +encountered these. + * New native configurations NetBSD/amd64 x86_64-*-netbsd* @@ -17,6 +30,25 @@ The command "set prompt-escape-char" has been deleted. This command, and its very obscure effet on GDB's prompt, was never documented, tested, nor mentioned in the NEWS file. +* OBSOLETE configurations and files + +Configurations that have been declared obsolete in this release have +been commented out. Unless there is activity to revive these +configurations, the next release of GDB will have their sources +permanently REMOVED. + +Sun 3, running SunOS 3 m68*-*-sunos3* +Sun 3, running SunOS 4 m68*-*-sunos4* +Sun 2, running SunOS 3 m68000-*-sunos3* +Sun 2, running SunOS 4 m68000-*-sunos4* +Motorola 680x0 running LynxOS m68*-*-lynxos* +AT&T 3b1/Unix pc m68*-att-* +Bull DPX2 (68k, System V release 3) m68*-bull-sysv* +decstation mips-dec-* mips-little-* +riscos mips-*-riscos* mips-*-sysv* +sonymips mips-sony-* +sysv mips*-*-sysv4* (IRIX 5/6 not included) + * REMOVED configurations and files SGI Irix-4.x mips-sgi-irix4 or iris4 diff --git a/gdb/acconfig.h b/gdb/acconfig.h index a7d25e8..f3b8bf1 100644 --- a/gdb/acconfig.h +++ b/gdb/acconfig.h @@ -157,6 +157,9 @@ /* Define if <sys/ptrace.h> defines the PT_GETXMMREGS request. */ #undef HAVE_PT_GETXMMREGS +/* Define if libunwind library is being used. */ +#undef HAVE_LIBUNWIND + /* Multi-arch enabled. */ #undef GDB_MULTI_ARCH diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 8d9bc04..f4cbb37 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -823,7 +823,7 @@ write_object_renaming (orig_left_context, renaming) simple_tail += 1; break; } - else if (STREQN (simple_tail, "__", 2)) + else if (DEPRECATED_STREQN (simple_tail, "__", 2)) { simple_tail += 2; break; @@ -962,7 +962,7 @@ convert_char_literal (struct type* type, LONGEST val) sprintf (name, "QU%02x", (int) val); for (f = 0; f < TYPE_NFIELDS (type); f += 1) { - if (STREQ (name, TYPE_FIELD_NAME (type, f))) + if (DEPRECATED_STREQ (name, TYPE_FIELD_NAME (type, f))) return TYPE_FIELD_BITPOS (type, f); } return val; diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 4ebbf44..81be6dd 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -254,10 +254,10 @@ field_name_match (const char *field_name, const char *target) { int len = strlen (target); return - STREQN (field_name, target, len) + DEPRECATED_STREQN (field_name, target, len) && (field_name[len] == '\0' - || (STREQN (field_name + len, "___", 3) - && !STREQ (field_name + strlen (field_name) - 6, "___XVN"))); + || (DEPRECATED_STREQN (field_name + len, "___", 3) + && !DEPRECATED_STREQ (field_name + strlen (field_name) - 6, "___XVN"))); } @@ -287,7 +287,7 @@ is_suffix (const char *str, const char *suffix) return 0; len1 = strlen (str); len2 = strlen (suffix); - return (len1 >= len2 && STREQ (str + len1 - len2, suffix)); + return (len1 >= len2 && DEPRECATED_STREQ (str + len1 - len2, suffix)); } /* Create a value of type TYPE whose contents come from VALADDR, if it @@ -438,7 +438,7 @@ const struct ada_opname_map ada_opname_table[] = { static int is_suppressed_name (const char *str) { - if (STREQN (str, "_ada_", 5)) + if (DEPRECATED_STREQN (str, "_ada_", 5)) str += 5; if (str[0] == '_' || str[0] == '\000') return 1; @@ -459,7 +459,7 @@ is_suppressed_name (const char *str) if (*p != 'O') return 1; for (i = 0; ada_opname_table[i].mangled != NULL; i += 1) - if (STREQN (ada_opname_table[i].mangled, p, + if (DEPRECATED_STREQN (ada_opname_table[i].mangled, p, strlen (ada_opname_table[i].mangled))) goto OK; return 1; @@ -499,7 +499,7 @@ ada_mangle (const char *demangled) for (mapping = ada_opname_table; mapping->mangled != NULL && - !STREQN (mapping->demangled, p, strlen (mapping->demangled)); + !DEPRECATED_STREQN (mapping->demangled, p, strlen (mapping->demangled)); p += 1) ; if (mapping->mangled == NULL) @@ -570,7 +570,7 @@ ada_demangle (const char *mangled) static char *demangling_buffer = NULL; static size_t demangling_buffer_size = 0; - if (STREQN (mangled, "_ada_", 5)) + if (DEPRECATED_STREQN (mangled, "_ada_", 5)) mangled += 5; if (mangled[0] == '_' || mangled[0] == '<') @@ -586,9 +586,9 @@ ada_demangle (const char *mangled) else goto Suppress; } - if (len0 > 3 && STREQ (mangled + len0 - 3, "TKB")) + if (len0 > 3 && DEPRECATED_STREQ (mangled + len0 - 3, "TKB")) len0 -= 3; - if (len0 > 1 && STREQ (mangled + len0 - 1, "B")) + if (len0 > 1 && DEPRECATED_STREQ (mangled + len0 - 1, "B")) len0 -= 1; /* Make demangled big enough for possible expansion by operator name. */ @@ -617,7 +617,7 @@ ada_demangle (const char *mangled) for (k = 0; ada_opname_table[k].mangled != NULL; k += 1) { int op_len = strlen (ada_opname_table[k].mangled); - if (STREQN + if (DEPRECATED_STREQN (ada_opname_table[k].mangled + 1, mangled + i + 1, op_len - 1) && !isalnum (mangled[i + op_len])) { @@ -633,7 +633,7 @@ ada_demangle (const char *mangled) } at_start_name = 0; - if (i < len0 - 4 && STREQN (mangled + i, "TK__", 4)) + if (i < len0 - 4 && DEPRECATED_STREQN (mangled + i, "TK__", 4)) i += 2; if (mangled[i] == 'X' && i != 0 && isalnum (mangled[i - 1])) { @@ -693,10 +693,10 @@ ada_match_name (const char *sym_name, const char *name, int wild) else { int len_name = strlen (name); - return (STREQN (sym_name, name, len_name) + return (DEPRECATED_STREQN (sym_name, name, len_name) && is_name_suffix (sym_name + len_name)) - || (STREQN (sym_name, "_ada_", 5) - && STREQN (sym_name + 5, name, len_name) + || (DEPRECATED_STREQN (sym_name, "_ada_", 5) + && DEPRECATED_STREQN (sym_name + 5, name, len_name) && is_name_suffix (sym_name + len_name + 5)); } } @@ -1237,7 +1237,7 @@ decode_packed_array_type (struct type *type) VAR_DOMAIN, &syms, &blocks); for (i = 0; i < n; i += 1) if (syms[i] != NULL && SYMBOL_CLASS (syms[i]) == LOC_TYPEDEF - && STREQ (name, ada_type_name (SYMBOL_TYPE (syms[i])))) + && DEPRECATED_STREQ (name, ada_type_name (SYMBOL_TYPE (syms[i])))) break; if (i >= n) { @@ -2546,7 +2546,7 @@ mangled_ordered_before (char *N0, char *N1) n1 = k1; while (N1[n1] == '_' && n1 > 0 && N1[n1 - 1] == '_') n1 -= 1; - if (n0 == n1 && STREQN (N0, N1, n0)) + if (n0 == n1 && DEPRECATED_STREQN (N0, N1, n0)) return (atoi (N0 + k0 + 1) < atoi (N1 + k1 + 1)); } return (strcmp (N0, N1) < 0); @@ -3218,7 +3218,7 @@ equiv_types (struct type *type0, struct type *type1) if ((TYPE_CODE (type0) == TYPE_CODE_STRUCT || TYPE_CODE (type0) == TYPE_CODE_ENUM) && ada_type_name (type0) != NULL && ada_type_name (type1) != NULL - && STREQ (ada_type_name (type0), ada_type_name (type1))) + && DEPRECATED_STREQ (ada_type_name (type0), ada_type_name (type1))) return 1; return 0; @@ -3250,8 +3250,8 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) return TYPE_CODE (type0) == TYPE_CODE (type1) && (equiv_types (type0, type1) - || (len0 < strlen (name1) && STREQN (name0, name1, len0) - && STREQN (name1 + len0, "___XV", 5))); + || (len0 < strlen (name1) && DEPRECATED_STREQN (name0, name1, len0) + && DEPRECATED_STREQN (name1 + len0, "___XV", 5))); } case LOC_CONST: return SYMBOL_VALUE (sym0) == SYMBOL_VALUE (sym1) @@ -3584,7 +3584,7 @@ static int is_nondebugging_type (struct type *type) { char *name = ada_type_name (type); - return (name != NULL && STREQ (name, "<variable, no debug info>")); + return (name != NULL && DEPRECATED_STREQ (name, "<variable, no debug info>")); } /* Remove any non-debugging symbols in SYMS[0 .. NSYMS-1] that definitely @@ -3611,7 +3611,7 @@ remove_extra_symbols (struct symbol **syms, struct block **blocks, int nsyms) { if (i != j && DEPRECATED_SYMBOL_NAME (syms[j]) != NULL - && STREQ (DEPRECATED_SYMBOL_NAME (syms[i]), DEPRECATED_SYMBOL_NAME (syms[j])) + && DEPRECATED_STREQ (DEPRECATED_SYMBOL_NAME (syms[i]), DEPRECATED_SYMBOL_NAME (syms[j])) && SYMBOL_CLASS (syms[i]) == SYMBOL_CLASS (syms[j]) && SYMBOL_VALUE_ADDRESS (syms[i]) == SYMBOL_VALUE_ADDRESS (syms[j])) @@ -3864,7 +3864,7 @@ is_name_suffix (const char *str) return 0; if (str[2] == '_') { - if (STREQ (str + 3, "LJM")) + if (DEPRECATED_STREQ (str + 3, "LJM")) return 1; if (str[3] != 'X') return 0; @@ -3901,14 +3901,14 @@ wild_match (const char *patn, int patn_len, const char *name) int s, e; name_len = strlen (name); - if (name_len >= patn_len + 5 && STREQN (name, "_ada_", 5) - && STREQN (patn, name + 5, patn_len) + if (name_len >= patn_len + 5 && DEPRECATED_STREQN (name, "_ada_", 5) + && DEPRECATED_STREQN (patn, name + 5, patn_len) && is_name_suffix (name + patn_len + 5)) return 1; while (name_len >= patn_len) { - if (STREQN (patn, name, patn_len) && is_name_suffix (name + patn_len)) + if (DEPRECATED_STREQN (patn, name, patn_len) && is_name_suffix (name + patn_len)) return 1; do { @@ -4455,7 +4455,7 @@ find_sal_from_funcs_and_line (const char *filename, int line_num, QUIT; - if (!STREQ (filename, s->filename)) + if (!DEPRECATED_STREQ (filename, s->filename)) continue; l = LINETABLE (s); ind = find_line_in_linetable (l, line_num, symbols, nsyms, &exact); @@ -4753,7 +4753,7 @@ read_all_symtabs (const char *filename) { QUIT; - if (STREQ (filename, ps->filename)) + if (DEPRECATED_STREQ (filename, ps->filename)) PSYMTAB_TO_SYMTAB (ps); } } @@ -4784,7 +4784,7 @@ all_sals_for_line (const char *filename, int line_num, char ***canonical) QUIT; - if (!STREQ (s->filename, filename)) + if (!DEPRECATED_STREQ (s->filename, filename)) continue; target_line_num = @@ -4962,9 +4962,9 @@ begin_command (char *args, int from_tty) int is_ada_runtime_file (char *filename) { - return (STREQN (filename, "s-", 2) || - STREQN (filename, "a-", 2) || - STREQN (filename, "g-", 2) || STREQN (filename, "i-", 2)); + return (DEPRECATED_STREQN (filename, "s-", 2) || + DEPRECATED_STREQN (filename, "a-", 2) || + DEPRECATED_STREQN (filename, "g-", 2) || DEPRECATED_STREQN (filename, "i-", 2)); } /* find the first frame that contains debugging information and that is not @@ -4985,7 +4985,7 @@ find_printable_frame (struct frame_info *fi, int level) from finding the right frame */ if (sal.symtab->objfile && - STREQ (sal.symtab->objfile->name, "/usr/shlib/libpthread.so")) + DEPRECATED_STREQ (sal.symtab->objfile->name, "/usr/shlib/libpthread.so")) continue; #endif deprecated_selected_frame = fi; @@ -5046,7 +5046,7 @@ ada_is_exception_sym (struct symbol *sym) return (SYMBOL_CLASS (sym) != LOC_TYPEDEF && SYMBOL_CLASS (sym) != LOC_BLOCK && SYMBOL_CLASS (sym) != LOC_CONST - && type_name != NULL && STREQ (type_name, "exception")); + && type_name != NULL && DEPRECATED_STREQ (type_name, "exception")); } int @@ -5069,7 +5069,7 @@ ada_breakpoint_rewrite (char *arg, int *break_on_exceptionp) *break_on_exceptionp = 0; /* FIXME: language_ada should be defined in defs.h */ /* if (current_language->la_language == language_ada - && STREQN (arg, "exception", 9) && + && DEPRECATED_STREQN (arg, "exception", 9) && (arg[9] == ' ' || arg[9] == '\t' || arg[9] == '\0')) { char *tok, *end_tok; @@ -5094,7 +5094,7 @@ ada_breakpoint_rewrite (char *arg, int *break_on_exceptionp) make_cleanup (xfree, arg); if (toklen == 0) strcpy (arg, "__gnat_raise_nodefer_with_msg"); - else if (STREQN (tok, "unhandled", toklen)) + else if (DEPRECATED_STREQN (tok, "unhandled", toklen)) { *break_on_exceptionp = 2; strcpy (arg, "__gnat_unhandled_exception"); @@ -5107,7 +5107,7 @@ ada_breakpoint_rewrite (char *arg, int *break_on_exceptionp) } } else if (current_language->la_language == language_ada - && STREQN (arg, "assert", 6) && + && DEPRECATED_STREQN (arg, "assert", 6) && (arg[6] == ' ' || arg[6] == '\t' || arg[6] == '\0')) { char *tok = arg + 6; @@ -5139,7 +5139,7 @@ ada_is_ignored_field (struct type *type, int field_num) { const char *name = TYPE_FIELD_NAME (type, field_num); return (name == NULL - || (name[0] == '_' && !STREQN (name, "_parent", 7))); + || (name[0] == '_' && !DEPRECATED_STREQN (name, "_parent", 7))); } } @@ -5198,7 +5198,7 @@ ada_is_parent_field (struct type *type, int field_num) { const char *name = TYPE_FIELD_NAME (check_typedef (type), field_num); return (name != NULL && - (STREQN (name, "PARENT", 6) || STREQN (name, "_parent", 7))); + (DEPRECATED_STREQN (name, "PARENT", 6) || DEPRECATED_STREQN (name, "_parent", 7))); } /* True iff field number FIELD_NUM of structure type TYPE is a @@ -5212,8 +5212,8 @@ ada_is_wrapper_field (struct type *type, int field_num) { const char *name = TYPE_FIELD_NAME (type, field_num); return (name != NULL - && (STREQN (name, "PARENT", 6) || STREQ (name, "REP") - || STREQN (name, "_parent", 7) + && (DEPRECATED_STREQN (name, "PARENT", 6) || DEPRECATED_STREQ (name, "REP") + || DEPRECATED_STREQN (name, "_parent", 7) || name[0] == 'S' || name[0] == 'R' || name[0] == 'O')); } @@ -5284,7 +5284,7 @@ ada_variant_discrim_name (struct type *type0) for (discrim_end = name + strlen (name) - 6; discrim_end != name; discrim_end -= 1) { - if (STREQN (discrim_end, "___XVN", 6)) + if (DEPRECATED_STREQN (discrim_end, "___XVN", 6)) break; } if (discrim_end == name) @@ -5295,7 +5295,7 @@ ada_variant_discrim_name (struct type *type0) { if (discrim_start == name + 1) return ""; - if ((discrim_start > name + 3 && STREQN (discrim_start - 3, "___", 3)) + if ((discrim_start > name + 3 && DEPRECATED_STREQN (discrim_start - 3, "___", 3)) || discrim_start[-1] == '.') break; } @@ -5779,7 +5779,7 @@ field_alignment (struct type *type, int f) else align_offset = len - 1; - if (align_offset < 7 || !STREQN ("___XV", name + align_offset - 6, 5)) + if (align_offset < 7 || !DEPRECATED_STREQN ("___XV", name + align_offset - 6, 5)) return TARGET_CHAR_BIT; return atoi (name + align_offset) * TARGET_CHAR_BIT; @@ -5883,7 +5883,7 @@ dynamic_template_type (struct type *type) else { int len = strlen (ada_type_name (type)); - if (len > 6 && STREQ (ada_type_name (type) + len - 6, "___XVE")) + if (len > 6 && DEPRECATED_STREQ (ada_type_name (type) + len - 6, "___XVE")) return type; else return ada_find_parallel_type (type, "___XVE"); @@ -6548,8 +6548,8 @@ ada_is_character_type (struct type *type) && (TYPE_CODE (type) == TYPE_CODE_CHAR || TYPE_CODE (type) == TYPE_CODE_INT || TYPE_CODE (type) == TYPE_CODE_RANGE) - && (STREQ (name, "character") || STREQ (name, "wide_character") - || STREQ (name, "unsigned char")); + && (DEPRECATED_STREQ (name, "character") || DEPRECATED_STREQ (name, "wide_character") + || DEPRECATED_STREQ (name, "unsigned char")); } /* True if TYPE appears to be an Ada string type. */ @@ -6582,7 +6582,7 @@ ada_is_aligner_type (struct type *type) CHECK_TYPEDEF (type); return (TYPE_CODE (type) == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1 - && STREQ (TYPE_FIELD_NAME (type, 0), "F")); + && DEPRECATED_STREQ (TYPE_FIELD_NAME (type, 0), "F")); } /* If there is an ___XVS-convention type parallel to SUBTYPE, return @@ -7669,7 +7669,7 @@ ada_is_vax_floating_type (struct type *type) name_len > 6 && (TYPE_CODE (type) == TYPE_CODE_INT || TYPE_CODE (type) == TYPE_CODE_RANGE) - && STREQN (ada_type_name (type) + name_len - 6, "___XF", 5); + && DEPRECATED_STREQN (ada_type_name (type) + name_len - 6, "___XF", 5); } /* The type of special VAX floating-point type this is, assuming diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l index d8bc789..139e3aa 100644 --- a/gdb/ada-lex.l +++ b/gdb/ada-lex.l @@ -759,7 +759,7 @@ name_lookup (name0, err_name, token_type) if (segments == 0) { type = lookup_primitive_typename (name); - if (type == NULL && STREQ ("system__address", name)) + if (type == NULL && DEPRECATED_STREQ ("system__address", name)) type = builtin_type_ada_system_address; if (type != NULL) { diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 8d5720c..a5d8a1c 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -103,7 +103,7 @@ generic_skip_trampoline_code (CORE_ADDR pc) } CORE_ADDR -generic_skip_solib_resolver (CORE_ADDR pc) +generic_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) { return 0; } @@ -380,8 +380,17 @@ default_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type) The choice of initial value is entirely arbitrary. During startup, the function initialize_current_architecture() updates this value based on default byte-order information extracted from BFD. */ -int target_byte_order = BFD_ENDIAN_BIG; -int target_byte_order_auto = 1; +static int target_byte_order = BFD_ENDIAN_BIG; +static int target_byte_order_auto = 1; + +enum bfd_endian +selected_byte_order (void) +{ + if (target_byte_order_auto) + return BFD_ENDIAN_UNKNOWN; + else + return target_byte_order; +} static const char endian_big[] = "big"; static const char endian_little[] = "little"; @@ -400,7 +409,7 @@ static const char *set_endian_string; static void show_endian (char *args, int from_tty) { - if (TARGET_BYTE_ORDER_AUTO) + if (target_byte_order_auto) printf_unfiltered ("The target endianness is set automatically (currently %s endian)\n", (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? "big" : "little")); else @@ -443,9 +452,18 @@ set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c) enum set_arch { set_arch_auto, set_arch_manual }; -int target_architecture_auto = 1; +static int target_architecture_auto = 1; + +static const char *set_architecture_string; -const char *set_architecture_string; +const char * +selected_architecture_name (void) +{ + if (target_architecture_auto) + return NULL; + else + return set_architecture_string; +} /* Called if the user enters ``show architecture'' without an argument. */ diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index fbc7aa2..f8bd5bb 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -35,8 +35,6 @@ extern int gdbarch_debug; /* Fallback for register convertible. */ extern gdbarch_deprecated_register_convertible_ftype deprecated_register_convertible_not; -extern CORE_ADDR generic_cannot_extract_struct_value_address (char *dummy); - /* Implementation of extract return value that grubs around in the register cache. */ extern gdbarch_extract_return_value_ftype legacy_extract_return_value; @@ -110,7 +108,8 @@ extern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer; extern CORE_ADDR generic_skip_trampoline_code (CORE_ADDR pc); -extern CORE_ADDR generic_skip_solib_resolver (CORE_ADDR pc); +extern CORE_ADDR generic_skip_solib_resolver (struct gdbarch *gdbarch, + CORE_ADDR pc); extern int generic_in_solib_call_trampoline (CORE_ADDR pc, char *name); @@ -149,9 +148,21 @@ extern int default_stabs_argument_has_addr (struct gdbarch *gdbarch, extern int legacy_register_sim_regno (int regnum); +/* Return the selected byte order, or BFD_ENDIAN_UNKNOWN if no byte + order was explicitly selected. */ +extern enum bfd_endian selected_byte_order (void); + +/* Return the selected architecture's name, or NULL if no architecture + was explicitly selected. */ +extern const char *selected_architecture_name (void); + /* Initialize a ``struct info''. Can't use memset(0) since some - default values are not zero. */ + default values are not zero. "fill" takes all available + information and fills in any unspecified fields. */ + extern void gdbarch_info_init (struct gdbarch_info *info); +extern void gdbarch_info_fill (struct gdbarch *gdbarch, + struct gdbarch_info *info); /* Similar to init, but this time fill in the blanks. Information is obtained from the specified architecture, global "set ..." options, diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index c91c0fd..42d4438 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -387,12 +387,6 @@ arm_linux_svr4_fetch_link_map_offsets (void) return lmp; } -CORE_ADDR -arm_linux_skip_solib_resolver (CORE_ADDR pc) -{ - return glibc_skip_solib_resolver (pc); -} - /* The constants below were determined by examining the following files in the linux kernel sources: @@ -506,6 +500,7 @@ arm_linux_init_abi (struct gdbarch_info info, /* Shared library handling. */ set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section); set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); + set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); } void diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 6faca9f..e7aef4a 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -81,15 +81,10 @@ static int arm_debug; /* Macros for setting and testing a bit in a minimal symbol that marks it as Thumb function. The MSB of the minimal symbol's "info" field - is used for this purpose. This field is already being used to store - the symbol size, so the assumption is that the symbol size cannot - exceed 2^31. + is used for this purpose. MSYMBOL_SET_SPECIAL Actually sets the "special" bit. - MSYMBOL_IS_SPECIAL Tests the "special" bit in a minimal symbol. - MSYMBOL_SIZE Returns the size of the minimal symbol, - i.e. the "info" field with the "special" bit - masked out. */ + MSYMBOL_IS_SPECIAL Tests the "special" bit in a minimal symbol. */ #define MSYMBOL_SET_SPECIAL(msym) \ MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) \ @@ -98,9 +93,6 @@ static int arm_debug; #define MSYMBOL_IS_SPECIAL(msym) \ (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0) -#define MSYMBOL_SIZE(msym) \ - ((long) MSYMBOL_INFO (msym) & 0x7fffffff) - /* The list of available "set arm ..." and "show arm ..." commands. */ static struct cmd_list_element *setarmcmdlist = NULL; static struct cmd_list_element *showarmcmdlist = NULL; diff --git a/gdb/bcache.c b/gdb/bcache.c index ec8b777..b1d9de8 100644 --- a/gdb/bcache.c +++ b/gdb/bcache.c @@ -195,8 +195,8 @@ expand_hash_table (struct bcache *bcache) /* Find a copy of the LENGTH bytes at ADDR in BCACHE. If BCACHE has never seen those bytes before, add a copy of them to BCACHE. In either case, return a pointer to BCACHE's copy of that string. */ -void * -bcache (const void *addr, int length, struct bcache *bcache) +static void * +bcache_data (const void *addr, int length, struct bcache *bcache) { unsigned long full_hash; unsigned short half_hash; @@ -247,6 +247,17 @@ bcache (const void *addr, int length, struct bcache *bcache) } } +void * +deprecated_bcache (const void *addr, int length, struct bcache *bcache) +{ + return bcache_data (addr, length, bcache); +} + +const void * +bcache (const void *addr, int length, struct bcache *bcache) +{ + return bcache_data (addr, length, bcache); +} /* Allocating and freeing bcaches. */ diff --git a/gdb/bcache.h b/gdb/bcache.h index 6c3a63d..bf69853 100644 --- a/gdb/bcache.h +++ b/gdb/bcache.h @@ -143,8 +143,13 @@ struct bcache; /* Find a copy of the LENGTH bytes at ADDR in BCACHE. If BCACHE has never seen those bytes before, add a copy of them to BCACHE. In - either case, return a pointer to BCACHE's copy of that string. */ -extern void *bcache (const void *addr, int length, struct bcache *bcache); + either case, return a pointer to BCACHE's copy of that string. + Since the cached value is ment to be read-only, return a const + buffer. */ +extern void *deprecated_bcache (const void *addr, int length, + struct bcache *bcache); +extern const void *bcache (const void *addr, int length, + struct bcache *bcache); /* Free all the storage used by BCACHE. */ extern void bcache_xfree (struct bcache *bcache); diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 381a61a..4602f5c 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -72,13 +72,10 @@ deprecated_inside_entry_file (CORE_ADDR addr) addr < symfile_objfile->ei.deprecated_entry_file_highpc); } -/* Test a specified PC value to see if it is in the range of addresses - that correspond to the main() function. See comments above for why - we might want to do this. - - Typically called from DEPRECATED_FRAME_CHAIN_VALID. +/* Test whether PC is in the range of addresses that corresponds to + the "main" function. - A PC of zero is always considered to be the bottom of the stack. */ + A PC of zero is always considered to be the bottom of the stack. */ int inside_main_func (CORE_ADDR pc) @@ -87,30 +84,30 @@ inside_main_func (CORE_ADDR pc) if (pc == 0) return 1; + if (symfile_objfile == 0) return 0; msymbol = lookup_minimal_symbol (main_name (), NULL, symfile_objfile); - /* If the addr range is not set up at symbol reading time, set it up - now. This is for DEPRECATED_FRAME_CHAIN_VALID_ALTERNATE. I do - this for coff, because it is unable to set it up and symbol - reading time. */ + /* If the address range hasn't been set up at symbol reading time, + set it up now. */ if (msymbol != NULL && symfile_objfile->ei.main_func_lowpc == INVALID_ENTRY_LOWPC && symfile_objfile->ei.main_func_highpc == INVALID_ENTRY_HIGHPC) { - /* brobecker/2003-10-10: We used to rely on lookup_symbol() to search - the symbol associated to the main function. Unfortunately, - lookup_symbol() uses the current-language la_lookup_symbol_nonlocal - function to do the global symbol search. Depending on the language, - this can introduce certain side-effects, because certain languages - such as Ada for instance may find more than one match. So we prefer - to search the main function symbol using its address rather than - its name. */ - struct symbol *mainsym - = find_pc_function (SYMBOL_VALUE_ADDRESS (msymbol)); + /* brobecker/2003-10-10: We used to rely on lookup_symbol() to + search the symbol associated to the "main" function. + Unfortunately, lookup_symbol() uses the current-language + la_lookup_symbol_nonlocal function to do the global symbol + search. Depending on the language, this can introduce + certain side-effects, because certain languages, for instance + Ada, may find more than one match. Therefore we prefer to + search the "main" function symbol using its address rather + than its name. */ + struct symbol *mainsym = + find_pc_function (SYMBOL_VALUE_ADDRESS (msymbol)); if (mainsym && SYMBOL_CLASS (mainsym) == LOC_BLOCK) { @@ -123,44 +120,45 @@ inside_main_func (CORE_ADDR pc) /* Not in the normal symbol tables, see if "main" is in the partial symbol table. If it's not, then give up. */ - { - if (msymbol != NULL && MSYMBOL_TYPE (msymbol) == mst_text) - { - struct obj_section *osect - = find_pc_sect_section (SYMBOL_VALUE_ADDRESS (msymbol), - msymbol->ginfo.bfd_section); - if (osect != NULL) - { - int i; - /* Step over other symbols at this same address, and - symbols in other sections, to find the next symbol in - this section with a different address. */ - for (i = 1; SYMBOL_LINKAGE_NAME (msymbol + i) != NULL; i++) - { - if (SYMBOL_VALUE_ADDRESS (msymbol + i) != SYMBOL_VALUE_ADDRESS (msymbol) - && SYMBOL_BFD_SECTION (msymbol + i) == SYMBOL_BFD_SECTION (msymbol)) - break; - } - - symfile_objfile->ei.main_func_lowpc = SYMBOL_VALUE_ADDRESS (msymbol); - - /* Use the lesser of the next minimal symbol in the same - section, or the end of the section, as the end of the - function. */ - if (SYMBOL_LINKAGE_NAME (msymbol + i) != NULL - && SYMBOL_VALUE_ADDRESS (msymbol + i) < osect->endaddr) - symfile_objfile->ei.main_func_highpc = SYMBOL_VALUE_ADDRESS (msymbol + i); - else - /* We got the start address from the last msymbol in the - objfile. So the end address is the end of the - section. */ - symfile_objfile->ei.main_func_highpc = osect->endaddr; - } - } - } - - return (symfile_objfile->ei.main_func_lowpc <= pc && - symfile_objfile->ei.main_func_highpc > pc); + if (msymbol != NULL && MSYMBOL_TYPE (msymbol) == mst_text) + { + CORE_ADDR maddr = SYMBOL_VALUE_ADDRESS (msymbol); + asection *msect = SYMBOL_BFD_SECTION (msymbol); + struct obj_section *osect = find_pc_sect_section (maddr, msect); + + if (osect != NULL) + { + int i; + + /* Step over other symbols at this same address, and symbols + in other sections, to find the next symbol in this + section with a different address. */ + for (i = 1; SYMBOL_LINKAGE_NAME (msymbol + i) != NULL; i++) + { + if (SYMBOL_VALUE_ADDRESS (msymbol + i) != maddr + && SYMBOL_BFD_SECTION (msymbol + i) == msect) + break; + } + + symfile_objfile->ei.main_func_lowpc = maddr; + + /* Use the lesser of the next minimal symbol in the same + section, or the end of the section, as the end of the + function. */ + if (SYMBOL_LINKAGE_NAME (msymbol + i) != NULL + && SYMBOL_VALUE_ADDRESS (msymbol + i) < osect->endaddr) + symfile_objfile->ei.main_func_highpc = + SYMBOL_VALUE_ADDRESS (msymbol + i); + else + /* We got the start address from the last msymbol in the + objfile. So the end address is the end of the + section. */ + symfile_objfile->ei.main_func_highpc = osect->endaddr; + } + } + + return (symfile_objfile->ei.main_func_lowpc <= pc + && symfile_objfile->ei.main_func_highpc > pc); } /* Test a specified PC value to see if it is in the range of addresses diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 1cbd006..8471352 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -332,6 +332,13 @@ int exception_support_initialized = 0; error ("catch of library unloads not yet implemented on this platform") #endif +/* Return whether a breakpoint is an active enabled breakpoint. */ +static int +breakpoint_enabled (struct breakpoint *b) +{ + return b->enable_state == bp_enabled; +} + /* Set breakpoint count to NUM. */ void @@ -757,7 +764,7 @@ insert_bp_location (struct bp_location *bpt, /* Permanent breakpoints cannot be inserted or removed. Disabled breakpoints should not be inserted. */ - if (bpt->owner->enable_state != bp_enabled) + if (!breakpoint_enabled (bpt->owner)) return 0; if (bpt->inserted || bpt->duplicate) @@ -1071,7 +1078,11 @@ insert_bp_location (struct bp_location *bpt, bpt->owner->enable_state = bp_disabled; else bpt->inserted = 1; - return val; + + /* We've already printed an error message if there was a problem + inserting this catchpoint, and we've disabled the catchpoint, + so just return success. */ + return 0; } return 0; @@ -1103,7 +1114,7 @@ insert_breakpoints (void) { /* Permanent breakpoints cannot be inserted or removed. Disabled breakpoints should not be inserted. */ - if (b->owner->enable_state != bp_enabled) + if (!breakpoint_enabled (b->owner)) continue; /* FIXME drow/2003-10-07: This code should be pushed elsewhere when @@ -1453,7 +1464,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) b->inserted = (is == mark_inserted); } else if (b->loc_type == bp_loc_hardware_watchpoint - && b->owner->enable_state == bp_enabled + && breakpoint_enabled (b->owner) && !b->duplicate) { struct value *v; @@ -1509,7 +1520,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) else if ((b->owner->type == bp_catch_fork || b->owner->type == bp_catch_vfork || b->owner->type == bp_catch_exec) - && b->owner->enable_state == bp_enabled + && breakpoint_enabled (b->owner) && !b->duplicate) { val = -1; @@ -1534,7 +1545,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) } else if ((b->owner->type == bp_catch_catch || b->owner->type == bp_catch_throw) - && b->owner->enable_state == bp_enabled + && breakpoint_enabled (b->owner) && !b->duplicate) { @@ -1545,7 +1556,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) } else if (ep_is_exception_catchpoint (b->owner) && b->inserted /* sometimes previous insert doesn't happen */ - && b->owner->enable_state == bp_enabled + && breakpoint_enabled (b->owner) && !b->duplicate) { @@ -1671,7 +1682,7 @@ breakpoint_here_p (CORE_ADDR pc) && bpt->loc_type != bp_loc_hardware_breakpoint) continue; - if ((bpt->owner->enable_state == bp_enabled + if ((breakpoint_enabled (bpt->owner) || bpt->owner->enable_state == bp_permanent) && bpt->address == pc) /* bp is enabled and matches pc */ { @@ -1768,7 +1779,7 @@ breakpoint_thread_match (CORE_ADDR pc, ptid_t ptid) && bpt->loc_type != bp_loc_hardware_breakpoint) continue; - if ((bpt->owner->enable_state == bp_enabled + if ((breakpoint_enabled (bpt->owner) || bpt->owner->enable_state == bp_permanent) && bpt->address == pc && (bpt->owner->thread == -1 || bpt->owner->thread == thread)) @@ -2570,9 +2581,7 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint) ALL_BREAKPOINTS_SAFE (b, temp) { - if (b->enable_state == bp_disabled - || b->enable_state == bp_shlib_disabled - || b->enable_state == bp_call_disabled) + if (!breakpoint_enabled (b) && b->enable_state != bp_permanent) continue; if (b->type != bp_watchpoint @@ -3175,7 +3184,7 @@ bpstat_should_step (void) { struct breakpoint *b; ALL_BREAKPOINTS (b) - if (b->enable_state == bp_enabled && b->type == bp_watchpoint) + if (breakpoint_enabled (b) && b->type == bp_watchpoint) return 1; return 0; } @@ -3186,7 +3195,7 @@ bpstat_have_active_hw_watchpoints (void) { struct bp_location *bpt; ALL_BP_LOCATIONS (bpt) - if ((bpt->owner->enable_state == bp_enabled) + if (breakpoint_enabled (bpt->owner) && bpt->inserted && bpt->loc_type == bp_loc_hardware_watchpoint) return 1; @@ -4264,7 +4273,7 @@ disable_breakpoints_in_shlibs (int silent) #if defined (PC_SOLIB) if (((b->type == bp_breakpoint) || (b->type == bp_hardware_breakpoint)) && - b->enable_state == bp_enabled && + breakpoint_enabled (b) && !b->loc->duplicate && PC_SOLIB (b->loc->address)) { @@ -4293,11 +4302,12 @@ re_enable_breakpoints_in_shlibs (void) ALL_BREAKPOINTS (b) if (b->enable_state == bp_shlib_disabled) { - char buf[1]; + char buf[1], *lib; /* Do not reenable the breakpoint if the shared library is still not mapped in. */ - if (target_read_memory (b->loc->address, buf, 1) == 0) + lib = PC_SOLIB (b->loc->address); + if (lib != NULL && target_read_memory (b->loc->address, buf, 1) == 0) b->enable_state = bp_enabled; } } @@ -4486,14 +4496,13 @@ hw_watchpoint_used_count (enum bptype type, int *other_type_used) *other_type_used = 0; ALL_BREAKPOINTS (b) { - if (b->enable_state == bp_enabled) + if (breakpoint_enabled (b)) { if (b->type == type) i++; else if ((b->type == bp_hardware_watchpoint || b->type == bp_read_watchpoint || - b->type == bp_access_watchpoint) - && b->enable_state == bp_enabled) + b->type == bp_access_watchpoint)) *other_type_used = 1; } } @@ -4535,7 +4544,7 @@ disable_watchpoints_before_interactive_call_start (void) || (b->type == bp_read_watchpoint) || (b->type == bp_access_watchpoint) || ep_is_exception_catchpoint (b)) - && (b->enable_state == bp_enabled)) + && breakpoint_enabled (b)) { b->enable_state = bp_call_disabled; check_duplicates (b); @@ -7058,7 +7067,7 @@ breakpoint_re_set_one (void *bint) value_free (b->val); b->val = evaluate_expression (b->exp); release_value (b->val); - if (VALUE_LAZY (b->val) && b->enable_state == bp_enabled) + if (VALUE_LAZY (b->val) && breakpoint_enabled (b)) value_fetch_lazy (b->val); if (b->cond_string != NULL) @@ -7068,7 +7077,7 @@ breakpoint_re_set_one (void *bint) xfree (b->cond); b->cond = parse_exp_1 (&s, (struct block *) 0, 0); } - if (b->enable_state == bp_enabled) + if (breakpoint_enabled (b)) mention (b); value_free_to_mark (mark); break; diff --git a/gdb/coffread.c b/gdb/coffread.c index 0a983f0..7712437 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -207,7 +207,7 @@ coff_locate_sections (bfd *abfd, asection *sectp, void *csip) csi = (struct coff_symfile_info *) csip; name = bfd_get_section_name (abfd, sectp); - if (STREQ (name, ".text")) + if (DEPRECATED_STREQ (name, ".text")) { csi->textaddr = bfd_section_vma (abfd, sectp); csi->textsize += bfd_section_size (abfd, sectp); @@ -216,7 +216,7 @@ coff_locate_sections (bfd *abfd, asection *sectp, void *csip) { csi->textsize += bfd_section_size (abfd, sectp); } - else if (STREQ (name, ".stabstr")) + else if (DEPRECATED_STREQ (name, ".stabstr")) { csi->stabstrsect = sectp; } @@ -828,7 +828,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, case C_THUMBSTATFUNC: if (cs->c_name[0] == '.') { - if (STREQ (cs->c_name, ".text")) + if (DEPRECATED_STREQ (cs->c_name, ".text")) { /* FIXME: don't wire in ".text" as section name or symbol name! */ @@ -953,7 +953,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, break; case C_FCN: - if (STREQ (cs->c_name, ".bf")) + if (DEPRECATED_STREQ (cs->c_name, ".bf")) { within_function = 1; @@ -975,7 +975,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, new->name = process_coff_symbol (&fcn_cs_saved, &fcn_aux_saved, objfile); } - else if (STREQ (cs->c_name, ".ef")) + else if (DEPRECATED_STREQ (cs->c_name, ".ef")) { if (!within_function) error ("Bad coff function information\n"); @@ -1051,13 +1051,13 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, break; case C_BLOCK: - if (STREQ (cs->c_name, ".bb")) + if (DEPRECATED_STREQ (cs->c_name, ".bb")) { tmpaddr = cs->c_value; tmpaddr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); push_context (++depth, tmpaddr); } - else if (STREQ (cs->c_name, ".eb")) + else if (DEPRECATED_STREQ (cs->c_name, ".eb")) { if (context_stack_depth <= 0) { /* We attempted to pop an empty context stack */ diff --git a/gdb/config.in b/gdb/config.in index 4acf3e7..a3edf86 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -167,6 +167,9 @@ /* Define if <sys/ptrace.h> defines the PT_GETXMMREGS request. */ #undef HAVE_PT_GETXMMREGS +/* Define if libunwind library is being used. */ +#undef HAVE_LIBUNWIND + /* hostfile */ #undef GDB_XM_FILE @@ -269,6 +272,12 @@ /* Define if you have the <dirent.h> header file. */ #undef HAVE_DIRENT_H +/* Define if you have the <libunwind-ia64.h> header file. */ +#undef HAVE_LIBUNWIND_IA64_H + +/* Define if you have the <libunwind.h> header file. */ +#undef HAVE_LIBUNWIND_H + /* Define if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H diff --git a/gdb/config/alpha/nm-osf2.h b/gdb/config/alpha/nm-osf2.h index 4b225af..1f3932d 100644 --- a/gdb/config/alpha/nm-osf2.h +++ b/gdb/config/alpha/nm-osf2.h @@ -25,9 +25,6 @@ #define USE_PROC_FS #define HAVE_OPTIONAL_PROC_FS -/* OSF/1 doesn't provide the standard fault definitions, so don't use them. */ -#define FAULTED_USE_SIGINFO - /* Don't trace faults under OSF/1, rely on the posting of the appropriate signal if fault tracing is disabled. Tracing T_IFAULT under Alpha OSF/1 causes a `floating point enable' diff --git a/gdb/config/arm/nbsd.mt b/gdb/config/arm/nbsd.mt index 9497136..1e7d4fa 100644 --- a/gdb/config/arm/nbsd.mt +++ b/gdb/config/arm/nbsd.mt @@ -1,2 +1,3 @@ # Target: ARM running NetBSD TDEPFILES= arm-tdep.o armnbsd-tdep.o solib.o solib-svr4.o nbsd-tdep.o +TM_FILE=tm-nbsd.h diff --git a/gdb/config/arm/tm-linux.h b/gdb/config/arm/tm-linux.h index 995ba73..dd41540 100644 --- a/gdb/config/arm/tm-linux.h +++ b/gdb/config/arm/tm-linux.h @@ -44,14 +44,6 @@ need to skip over the dynamic linker call. This function decides when to skip, and where to skip to. See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c. */ -extern CORE_ADDR arm_linux_skip_solib_resolver (CORE_ADDR pc); -#define SKIP_SOLIB_RESOLVER arm_linux_skip_solib_resolver - -/* When we call a function in a shared library, and the PLT sends us - into the dynamic linker to find the function's real address, we - need to skip over the dynamic linker call. This function decides - when to skip, and where to skip to. See the comments for - SKIP_SOLIB_RESOLVER at the top of infrun.c. */ #if 0 #undef IN_SOLIB_DYNSYM_RESOLVE_CODE extern CORE_ADDR arm_in_solib_dynsym_resolve_code (CORE_ADDR pc, char *name); diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst index 2bcb5f9..61d9014 100644 --- a/gdb/config/djgpp/fnchange.lst +++ b/gdb/config/djgpp/fnchange.lst @@ -88,7 +88,6 @@ @V@/gdb/config/i386/xm-i386v4.h @V@/gdb/config/i386/xm-v4.h @V@/gdb/config/m88k/xm-delta88v4.h @V@/gdb/config/m88k/xm-d88v4.h @V@/gdb/config/mips/tm-linux.h @V@/gdb/config/mips/tm-lx.h -@V@/gdb/config/mips/tm-linux64.h @V@/gdb/config/mips/tm-lx64.h @V@/gdb/config/pa/nm-hppah11.h @V@/gdb/config/pa/nm-hppa11.h @V@/gdb/config/powerpc/tm-ppcle-sim.h @V@/gdb/config/powerpc/tm-ppcl-sim.h @V@/gdb/config/rs6000/nm-rs6000ly.h @V@/gdb/config/rs6000/nm-rs6kly.h diff --git a/gdb/config/h8300/tm-h8300.h b/gdb/config/h8300/tm-h8300.h index 807d7c0..a1c337e 100644 --- a/gdb/config/h8300/tm-h8300.h +++ b/gdb/config/h8300/tm-h8300.h @@ -20,20 +20,13 @@ Boston, MA 02111-1307, USA. */ /* Contributed by Steve Chamberlain sac@cygnus.com */ -/* NOTE: ezannoni 2000-07-18: these variables are part of sim, defined - in sim/h8300/compile.c. They really should not be used this - way. Because of this we cannot get rid of the macro - GDB_TARGET_IS_H8300 in remote-e7000.c */ -extern int h8300hmode; -extern int h8300smode; -extern int h8300_normal_mode; /* 1 - Normal Mode , 0 - Advanced mode */ -extern int h8300sxmode; -#define GDB_TARGET_IS_H8300 - /* Needed for remote.c */ #define DEPRECATED_REMOTE_BREAKPOINT { 0x57, 0x30} /* trapa #3 */ /* Needed for remote-hms.c */ #define CCR_REGNUM 8 /* Needed for remote-e7000.c */ -#define NUM_REALREGS (h8300smode?11:10) +#define NUM_REALREGS ((TARGET_ARCHITECTURE->mach == bfd_mach_h8300s || \ + TARGET_ARCHITECTURE->mach == bfd_mach_h8300sn || \ + TARGET_ARCHITECTURE->mach == bfd_mach_h8300sx || \ + TARGET_ARCHITECTURE->mach == bfd_mach_h8300sxn) ? 11 : 10) diff --git a/gdb/config/i386/tm-i386sol2.h b/gdb/config/i386/tm-i386sol2.h index 5a79f67..921df26 100644 --- a/gdb/config/i386/tm-i386sol2.h +++ b/gdb/config/i386/tm-i386sol2.h @@ -31,6 +31,4 @@ extern char *sunpro_static_transform_name (char *); #define STATIC_TRANSFORM_NAME(x) sunpro_static_transform_name (x) #define IS_STATIC_TRANSFORM_NAME(name) ((name)[0] == '.') -#define FAULTED_USE_SIGINFO - #endif /* ifndef TM_I386SOL2_H */ diff --git a/gdb/config/i386/tm-linux.h b/gdb/config/i386/tm-linux.h index 799678e..83440a8 100644 --- a/gdb/config/i386/tm-linux.h +++ b/gdb/config/i386/tm-linux.h @@ -29,14 +29,6 @@ /* The following works around a problem with /usr/include/sys/procfs.h */ #define sys_quotactl 1 -/* When we call a function in a shared library, and the PLT sends us - into the dynamic linker to find the function's real address, we - need to skip over the dynamic linker call. This function decides - when to skip, and where to skip to. See the comments for - SKIP_SOLIB_RESOLVER at the top of infrun.c. */ -#define SKIP_SOLIB_RESOLVER i386_linux_skip_solib_resolver -extern CORE_ADDR i386_linux_skip_solib_resolver (CORE_ADDR pc); - /* N_FUN symbols in shared libaries have 0 for their values and need to be relocated. */ #define SOFUN_ADDRESS_MAYBE_MISSING diff --git a/gdb/config/i386/x86-64linux.mt b/gdb/config/i386/x86-64linux.mt index 9ef5938..8bc4adb 100644 --- a/gdb/config/i386/x86-64linux.mt +++ b/gdb/config/i386/x86-64linux.mt @@ -1,6 +1,6 @@ # Target: AMD x86-64 running GNU/Linux TDEPFILES= x86-64-tdep.o x86-64-linux-tdep.o \ - i386-tdep.o i387-tdep.o i386-linux-tdep.o \ + i386-tdep.o i387-tdep.o i386-linux-tdep.o glibc-tdep.o \ solib.o solib-svr4.o solib-legacy.o corelow.o TM_FILE=tm-x86-64linux.h diff --git a/gdb/config/ia64/nm-linux.h b/gdb/config/ia64/nm-linux.h index 0418495..01c9807 100644 --- a/gdb/config/ia64/nm-linux.h +++ b/gdb/config/ia64/nm-linux.h @@ -69,4 +69,15 @@ extern int ia64_linux_insert_watchpoint (ptid_t ptid, CORE_ADDR addr, extern int ia64_linux_remove_watchpoint (ptid_t ptid, CORE_ADDR addr, int len); +#include "target.h" + +#define NATIVE_XFER_UNWIND_TABLE ia64_linux_xfer_unwind_table +extern LONGEST ia64_linux_xfer_unwind_table (struct target_ops *ops, + enum target_object object, + const char *annex, + void *readbuf, + const void *writebuf, + ULONGEST offset, + LONGEST len); + #endif /* #ifndef NM_LINUX_H */ diff --git a/gdb/config/m68k/3b1.mh b/gdb/config/m68k/3b1.mh index e305e67..1ebba27 100644 --- a/gdb/config/m68k/3b1.mh +++ b/gdb/config/m68k/3b1.mh @@ -1,12 +1,12 @@ -# Host: AT&T 3b1/Unix pc -# I don't think cc has been tried. -traditional for <sys/ioctl.h> -# (not sure whether necessary). -CC= gcc -traditional -# GCC runs out of virtual memory. -# A separate CC for pinsn routines is no longer supported, though. -# FIXME -- someone unlucky enough to have a 3B1, let bug-gcc@prep.ai.mit.edu -# know what works and what fails on the 3B1. -#PINSN_CC= cc - -NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o -XM_FILE= xm-3b1.h +# OBSOLETE # Host: AT&T 3b1/Unix pc +# OBSOLETE # I don't think cc has been tried. -traditional for <sys/ioctl.h> +# OBSOLETE # (not sure whether necessary). +# OBSOLETE CC= gcc -traditional +# OBSOLETE # GCC runs out of virtual memory. +# OBSOLETE # A separate CC for pinsn routines is no longer supported, though. +# OBSOLETE # FIXME -- someone unlucky enough to have a 3B1, let bug-gcc@prep.ai.mit.edu +# OBSOLETE # know what works and what fails on the 3B1. +# OBSOLETE #PINSN_CC= cc +# OBSOLETE +# OBSOLETE NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o +# OBSOLETE XM_FILE= xm-3b1.h diff --git a/gdb/config/m68k/3b1.mt b/gdb/config/m68k/3b1.mt index 4c5d9d4..7459187 100644 --- a/gdb/config/m68k/3b1.mt +++ b/gdb/config/m68k/3b1.mt @@ -1,3 +1,3 @@ -# Target: AT&T 3b1/Unix pc -TDEPFILES= m68k-tdep.o -TM_FILE= tm-3b1.h +# OBSOLETE # Target: AT&T 3b1/Unix pc +# OBSOLETE TDEPFILES= m68k-tdep.o +# OBSOLETE TM_FILE= tm-3b1.h diff --git a/gdb/config/m68k/delta68.mh b/gdb/config/m68k/delta68.mh index 5492af0..cfa14ba 100644 --- a/gdb/config/m68k/delta68.mh +++ b/gdb/config/m68k/delta68.mh @@ -1,5 +1,5 @@ -# Host: Motorola Delta Series sysV68 R3V7.1 - -XM_FILE= xm-delta68.h -NAT_FILE= nm-delta68.h -NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o delta68-nat.o +# OBSOLETE # Host: Motorola Delta Series sysV68 R3V7.1 +# OBSOLETE +# OBSOLETE XM_FILE= xm-delta68.h +# OBSOLETE NAT_FILE= nm-delta68.h +# OBSOLETE NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o delta68-nat.o diff --git a/gdb/config/m68k/delta68.mt b/gdb/config/m68k/delta68.mt index 2761329..743a92a 100644 --- a/gdb/config/m68k/delta68.mt +++ b/gdb/config/m68k/delta68.mt @@ -1,3 +1,3 @@ -# Motorola Delta Series sysV68 R3V7.1 -TDEPFILES= m68k-tdep.o -TM_FILE= tm-delta68.h +# OBSOLETE # Motorola Delta Series sysV68 R3V7.1 +# OBSOLETE TDEPFILES= m68k-tdep.o +# OBSOLETE TM_FILE= tm-delta68.h diff --git a/gdb/config/m68k/dpx2.mh b/gdb/config/m68k/dpx2.mh index 25ed85e..e9c5b68 100644 --- a/gdb/config/m68k/dpx2.mh +++ b/gdb/config/m68k/dpx2.mh @@ -1,6 +1,6 @@ -# Host: Bull DPX2 (68k, System V release 3) - -XM_FILE= xm-dpx2.h - -NAT_FILE= nm-dpx2.h -NATDEPFILES= infptrace.o corelow.o core-aout.o inftarg.o dpx2-nat.o fork-child.o +# OBSOLETE # Host: Bull DPX2 (68k, System V release 3) +# OBSOLETE +# OBSOLETE XM_FILE= xm-dpx2.h +# OBSOLETE +# OBSOLETE NAT_FILE= nm-dpx2.h +# OBSOLETE NATDEPFILES= infptrace.o corelow.o core-aout.o inftarg.o dpx2-nat.o fork-child.o diff --git a/gdb/config/m68k/dpx2.mt b/gdb/config/m68k/dpx2.mt index 5bbbbe6..7cecda6 100644 --- a/gdb/config/m68k/dpx2.mt +++ b/gdb/config/m68k/dpx2.mt @@ -1,3 +1,3 @@ -# Target: Bull DPX2 (68k, System V release 3) -TDEPFILES= m68k-tdep.o -TM_FILE= tm-dpx2.h +# OBSOLETE # Target: Bull DPX2 (68k, System V release 3) +# OBSOLETE TDEPFILES= m68k-tdep.o +# OBSOLETE TM_FILE= tm-dpx2.h diff --git a/gdb/config/m68k/m68klynx.mh b/gdb/config/m68k/m68klynx.mh index 3838012..c76dcce 100644 --- a/gdb/config/m68k/m68klynx.mh +++ b/gdb/config/m68k/m68klynx.mh @@ -1,6 +1,6 @@ -# Host: Motorola 680x0 running LynxOS - -XM_CLIBS= -lbsd - -NAT_FILE= nm-m68klynx.h -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o lynx-nat.o +# OBSOLETE # Host: Motorola 680x0 running LynxOS +# OBSOLETE +# OBSOLETE XM_CLIBS= -lbsd +# OBSOLETE +# OBSOLETE NAT_FILE= nm-m68klynx.h +# OBSOLETE NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o lynx-nat.o diff --git a/gdb/config/m68k/m68klynx.mt b/gdb/config/m68k/m68klynx.mt index 4aeac96..e3a3c79 100644 --- a/gdb/config/m68k/m68klynx.mt +++ b/gdb/config/m68k/m68klynx.mt @@ -1,4 +1,4 @@ -# Target: Motorola 680x0 running LynxOS -TDEPFILES= coff-solib.o m68k-tdep.o -# m68kly-tdep.o -TM_FILE= tm-m68klynx.h +# OBSOLETE # Target: Motorola 680x0 running LynxOS +# OBSOLETE TDEPFILES= coff-solib.o m68k-tdep.o +# OBSOLETE # m68kly-tdep.o +# OBSOLETE TM_FILE= tm-m68klynx.h diff --git a/gdb/config/m68k/m68kv4.mh b/gdb/config/m68k/m68kv4.mh index 7deb130..23c64fa 100644 --- a/gdb/config/m68k/m68kv4.mh +++ b/gdb/config/m68k/m68kv4.mh @@ -1,7 +1,7 @@ -# Host: Motorola 680x0 running SVR4 (Commodore Amiga amix or Atari TT ASV) - -XM_FILE= xm-m68kv4.h - -NAT_FILE= nm-sysv4.h -NATDEPFILES= corelow.o core-regset.o solib.o solib-svr4.o solib-legacy.o \ - fork-child.o procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o +# OBSOLETE # Host: Motorola 680x0 running SVR4 (Commodore Amiga amix or Atari TT ASV) +# OBSOLETE +# OBSOLETE XM_FILE= xm-m68kv4.h +# OBSOLETE +# OBSOLETE NAT_FILE= nm-sysv4.h +# OBSOLETE NATDEPFILES= corelow.o core-regset.o solib.o solib-svr4.o solib-legacy.o \ +# OBSOLETE fork-child.o procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o diff --git a/gdb/config/m68k/m68kv4.mt b/gdb/config/m68k/m68kv4.mt index fcabb17..0a9ad08 100644 --- a/gdb/config/m68k/m68kv4.mt +++ b/gdb/config/m68k/m68kv4.mt @@ -1,3 +1,3 @@ -# Target: Motorola 680x0 running SVR4 (Commodore Amiga amix or Atari TT ASV) -TDEPFILES= m68k-tdep.o -TM_FILE= tm-m68kv4.h +# OBSOLETE # Target: Motorola 680x0 running SVR4 (Commodore Amiga amix or Atari TT ASV) +# OBSOLETE TDEPFILES= m68k-tdep.o +# OBSOLETE TM_FILE= tm-m68kv4.h diff --git a/gdb/config/m68k/nm-delta68.h b/gdb/config/m68k/nm-delta68.h index 78871a0..e27bb69 100644 --- a/gdb/config/m68k/nm-delta68.h +++ b/gdb/config/m68k/nm-delta68.h @@ -1,22 +1,22 @@ -/* Macro definitions for a Motorola Delta Series sysV68 R3V7.1. - Copyright 1993, 1998 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - - -#define KERNEL_U_SIZE kernel_u_size() +// OBSOLETE /* Macro definitions for a Motorola Delta Series sysV68 R3V7.1. +// OBSOLETE Copyright 1993, 1998 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE +// OBSOLETE #define KERNEL_U_SIZE kernel_u_size() diff --git a/gdb/config/m68k/nm-dpx2.h b/gdb/config/m68k/nm-dpx2.h index 4c88a6c..f6cce8a 100644 --- a/gdb/config/m68k/nm-dpx2.h +++ b/gdb/config/m68k/nm-dpx2.h @@ -1,29 +1,29 @@ -/* Native support for a Bull DPX2. - Copyright 1986, 1987, 1989, 1993, 2000 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* KERNEL_U_ADDR is determined upon startup in dpx2-xdep.c. */ - -#define REGISTER_U_ADDR(addr, blockend, regno) \ - (addr) = dpx2_register_u_addr ((blockend),(regno)); - -extern int dpx2_register_u_addr (int, int); - -/* Kernel is a bit tenacious about sharing text segments, disallowing bpts. */ -#define ONE_PROCESS_WRITETEXT +// OBSOLETE /* Native support for a Bull DPX2. +// OBSOLETE Copyright 1986, 1987, 1989, 1993, 2000 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* KERNEL_U_ADDR is determined upon startup in dpx2-xdep.c. */ +// OBSOLETE +// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ +// OBSOLETE (addr) = dpx2_register_u_addr ((blockend),(regno)); +// OBSOLETE +// OBSOLETE extern int dpx2_register_u_addr (int, int); +// OBSOLETE +// OBSOLETE /* Kernel is a bit tenacious about sharing text segments, disallowing bpts. */ +// OBSOLETE #define ONE_PROCESS_WRITETEXT diff --git a/gdb/config/m68k/nm-m68klynx.h b/gdb/config/m68k/nm-m68klynx.h index 9d95d37..88b1260 100644 --- a/gdb/config/m68k/nm-m68klynx.h +++ b/gdb/config/m68k/nm-m68klynx.h @@ -1,26 +1,26 @@ -/* Native-dependent definitions for Motorola 680x0 running LynxOS. - Copyright 1993 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef NM_M68KLYNX_H -#define NM_M68KLYNX_H - -#include "config/nm-lynx.h" - -#endif /* NM_M68KLYNX_H */ +// OBSOLETE /* Native-dependent definitions for Motorola 680x0 running LynxOS. +// OBSOLETE Copyright 1993 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #ifndef NM_M68KLYNX_H +// OBSOLETE #define NM_M68KLYNX_H +// OBSOLETE +// OBSOLETE #include "config/nm-lynx.h" +// OBSOLETE +// OBSOLETE #endif /* NM_M68KLYNX_H */ diff --git a/gdb/config/m68k/nm-sun2.h b/gdb/config/m68k/nm-sun2.h index 5d55caf..cce4a3e 100644 --- a/gdb/config/m68k/nm-sun2.h +++ b/gdb/config/m68k/nm-sun2.h @@ -1,34 +1,34 @@ -/* Parameters for execution on a Sun2, for GDB, the GNU debugger. - Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* Do implement the attach and detach commands. */ - -#define ATTACH_DETACH - -/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ -#define FETCH_INFERIOR_REGISTERS - -/* This is a piece of magic that is given a register number REGNO - and as BLOCKEND the address in the system of the end of the user structure - and stores in ADDR the address in the kernel or core dump - of that register. */ - -#define REGISTER_U_ADDR(addr, blockend, regno) \ -{ addr = blockend + regno * 4; } +// OBSOLETE /* Parameters for execution on a Sun2, for GDB, the GNU debugger. +// OBSOLETE Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* Do implement the attach and detach commands. */ +// OBSOLETE +// OBSOLETE #define ATTACH_DETACH +// OBSOLETE +// OBSOLETE /* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ +// OBSOLETE #define FETCH_INFERIOR_REGISTERS +// OBSOLETE +// OBSOLETE /* This is a piece of magic that is given a register number REGNO +// OBSOLETE and as BLOCKEND the address in the system of the end of the user structure +// OBSOLETE and stores in ADDR the address in the kernel or core dump +// OBSOLETE of that register. */ +// OBSOLETE +// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ +// OBSOLETE { addr = blockend + regno * 4; } diff --git a/gdb/config/m68k/nm-sun3.h b/gdb/config/m68k/nm-sun3.h index 3c5d47e..9e50707b 100644 --- a/gdb/config/m68k/nm-sun3.h +++ b/gdb/config/m68k/nm-sun3.h @@ -1,34 +1,34 @@ -/* Native-only definitions for Sun-3 for GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1991, 1992, 1996 - Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "regcache.h" - -/* Do implement the attach and detach commands. */ - -#define ATTACH_DETACH - -/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ - -#define FETCH_INFERIOR_REGISTERS - -/* We have to grab the regs since we store all regs at once. */ - -#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, DEPRECATED_REGISTER_BYTES) +// OBSOLETE /* Native-only definitions for Sun-3 for GDB, the GNU debugger. +// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1996 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE /* Do implement the attach and detach commands. */ +// OBSOLETE +// OBSOLETE #define ATTACH_DETACH +// OBSOLETE +// OBSOLETE /* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ +// OBSOLETE +// OBSOLETE #define FETCH_INFERIOR_REGISTERS +// OBSOLETE +// OBSOLETE /* We have to grab the regs since we store all regs at once. */ +// OBSOLETE +// OBSOLETE #define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, DEPRECATED_REGISTER_BYTES) diff --git a/gdb/config/m68k/nm-sysv4.h b/gdb/config/m68k/nm-sysv4.h index b9cb591..6e3a452 100644 --- a/gdb/config/m68k/nm-sysv4.h +++ b/gdb/config/m68k/nm-sysv4.h @@ -1,23 +1,23 @@ -/* Native-dependent definitions for Motorola 680x0 running SVR4. - Copyright 1994 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* Include the generic SVR4 definitions. */ - -#include "config/nm-sysv4.h" +// OBSOLETE /* Native-dependent definitions for Motorola 680x0 running SVR4. +// OBSOLETE Copyright 1994 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* Include the generic SVR4 definitions. */ +// OBSOLETE +// OBSOLETE #include "config/nm-sysv4.h" diff --git a/gdb/config/m68k/sun2os3.mh b/gdb/config/m68k/sun2os3.mh index 3d868da..2243a28 100644 --- a/gdb/config/m68k/sun2os3.mh +++ b/gdb/config/m68k/sun2os3.mh @@ -1,4 +1,4 @@ -# Host: Sun 2, running SunOS 3 -XM_FILE= xm-sun2.h -NAT_FILE= nm-sun2.h -NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o sun3-nat.o +# OBSOLETE # Host: Sun 2, running SunOS 3 +# OBSOLETE XM_FILE= xm-sun2.h +# OBSOLETE NAT_FILE= nm-sun2.h +# OBSOLETE NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o sun3-nat.o diff --git a/gdb/config/m68k/sun2os3.mt b/gdb/config/m68k/sun2os3.mt index 12b7c7f..343bccd 100644 --- a/gdb/config/m68k/sun2os3.mt +++ b/gdb/config/m68k/sun2os3.mt @@ -1,7 +1,7 @@ -# Target: Sun 2, running SunOS 3 -# The system-supplied assembler re-orders the symbols so that gdb -# can't find "gcc_compiled.". -#msg If you compile your program with GCC, use the GNU assembler. -#msg -TDEPFILES= m68k-tdep.o -TM_FILE= tm-sun2.h +# OBSOLETE # Target: Sun 2, running SunOS 3 +# OBSOLETE # The system-supplied assembler re-orders the symbols so that gdb +# OBSOLETE # can't find "gcc_compiled.". +# OBSOLETE #msg If you compile your program with GCC, use the GNU assembler. +# OBSOLETE #msg +# OBSOLETE TDEPFILES= m68k-tdep.o +# OBSOLETE TM_FILE= tm-sun2.h diff --git a/gdb/config/m68k/sun2os4.mh b/gdb/config/m68k/sun2os4.mh index 29fe1e8..ab9c720 100644 --- a/gdb/config/m68k/sun2os4.mh +++ b/gdb/config/m68k/sun2os4.mh @@ -1,4 +1,4 @@ -# Host: Sun 2, running SunOS 4 -XM_FILE= xm-sun2.h -NAT_FILE= nm-sun2.h -NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o sun3-nat.o +# OBSOLETE # Host: Sun 2, running SunOS 4 +# OBSOLETE XM_FILE= xm-sun2.h +# OBSOLETE NAT_FILE= nm-sun2.h +# OBSOLETE NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o sun3-nat.o diff --git a/gdb/config/m68k/sun2os4.mt b/gdb/config/m68k/sun2os4.mt index 4d8e6de..30ff4e3 100644 --- a/gdb/config/m68k/sun2os4.mt +++ b/gdb/config/m68k/sun2os4.mt @@ -1,3 +1,3 @@ -# Target: Sun 2, running SunOS 4 -TDEPFILES= solib.o solib-sunos.o m68k-tdep.o -TM_FILE= tm-sun2os4.h +# OBSOLETE # Target: Sun 2, running SunOS 4 +# OBSOLETE TDEPFILES= solib.o solib-sunos.o m68k-tdep.o +# OBSOLETE TM_FILE= tm-sun2os4.h diff --git a/gdb/config/m68k/sun3os3.mh b/gdb/config/m68k/sun3os3.mh index bf03622..e7c820f 100644 --- a/gdb/config/m68k/sun3os3.mh +++ b/gdb/config/m68k/sun3os3.mh @@ -1,4 +1,4 @@ -# Host: Sun 3, running SunOS 3 -XM_FILE= xm-sun3.h -NAT_FILE= nm-sun3.h -NATDEPFILES= fork-child.o inftarg.o infptrace.o corelow.o sun3-nat.o +# OBSOLETE # Host: Sun 3, running SunOS 3 +# OBSOLETE XM_FILE= xm-sun3.h +# OBSOLETE NAT_FILE= nm-sun3.h +# OBSOLETE NATDEPFILES= fork-child.o inftarg.o infptrace.o corelow.o sun3-nat.o diff --git a/gdb/config/m68k/sun3os3.mt b/gdb/config/m68k/sun3os3.mt index 8f9dac8..4ea0d27 100644 --- a/gdb/config/m68k/sun3os3.mt +++ b/gdb/config/m68k/sun3os3.mt @@ -1,8 +1,8 @@ -# Target: Sun 3, running SunOS 3 -# The system-supplied assembler re-orders the symbols so that gdb -# can't find "gcc_compiled.". -#msg If you compile your program with GCC, use the GNU assembler. -#msg - -TDEPFILES= m68k-tdep.o -TM_FILE= tm-sun3.h +# OBSOLETE # Target: Sun 3, running SunOS 3 +# OBSOLETE # The system-supplied assembler re-orders the symbols so that gdb +# OBSOLETE # can't find "gcc_compiled.". +# OBSOLETE #msg If you compile your program with GCC, use the GNU assembler. +# OBSOLETE #msg +# OBSOLETE +# OBSOLETE TDEPFILES= m68k-tdep.o +# OBSOLETE TM_FILE= tm-sun3.h diff --git a/gdb/config/m68k/sun3os4.mh b/gdb/config/m68k/sun3os4.mh index 18b1f08..dc3f9af 100644 --- a/gdb/config/m68k/sun3os4.mh +++ b/gdb/config/m68k/sun3os4.mh @@ -1,4 +1,4 @@ -# Host: Sun 3, running SunOS 4 -XM_FILE= xm-sun3os4.h -NAT_FILE= nm-sun3.h -NATDEPFILES= fork-child.o inftarg.o infptrace.o corelow.o sun3-nat.o +# OBSOLETE # Host: Sun 3, running SunOS 4 +# OBSOLETE XM_FILE= xm-sun3os4.h +# OBSOLETE NAT_FILE= nm-sun3.h +# OBSOLETE NATDEPFILES= fork-child.o inftarg.o infptrace.o corelow.o sun3-nat.o diff --git a/gdb/config/m68k/sun3os4.mt b/gdb/config/m68k/sun3os4.mt index 64f1a30..decf0b3 100644 --- a/gdb/config/m68k/sun3os4.mt +++ b/gdb/config/m68k/sun3os4.mt @@ -1,3 +1,3 @@ -# Target: Sun 3, running SunOS 4, as a target system -TDEPFILES= solib.o solib-sunos.o m68k-tdep.o -TM_FILE= tm-sun3os4.h +# OBSOLETE # Target: Sun 3, running SunOS 4, as a target system +# OBSOLETE TDEPFILES= solib.o solib-sunos.o m68k-tdep.o +# OBSOLETE TM_FILE= tm-sun3os4.h diff --git a/gdb/config/m68k/tm-3b1.h b/gdb/config/m68k/tm-3b1.h index 90888c6..df845bd 100644 --- a/gdb/config/m68k/tm-3b1.h +++ b/gdb/config/m68k/tm-3b1.h @@ -1,33 +1,33 @@ -/* Parameters for targeting GDB to a 3b1. - Copyright 1986, 1987, 1989, 1991, 1993 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* The child target can't deal with floating registers. */ -#define CANNOT_STORE_REGISTER(regno) ((regno) >= FP0_REGNUM) - -/* Define BPT_VECTOR if it is different than the default. - This is the vector number used by traps to indicate a breakpoint. */ - -#define BPT_VECTOR 0x1 - -/* Address of end of stack space. */ - -#define STACK_END_ADDR 0x300000 - -#include "m68k/tm-m68k.h" +// OBSOLETE /* Parameters for targeting GDB to a 3b1. +// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1993 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* The child target can't deal with floating registers. */ +// OBSOLETE #define CANNOT_STORE_REGISTER(regno) ((regno) >= FP0_REGNUM) +// OBSOLETE +// OBSOLETE /* Define BPT_VECTOR if it is different than the default. +// OBSOLETE This is the vector number used by traps to indicate a breakpoint. */ +// OBSOLETE +// OBSOLETE #define BPT_VECTOR 0x1 +// OBSOLETE +// OBSOLETE /* Address of end of stack space. */ +// OBSOLETE +// OBSOLETE #define STACK_END_ADDR 0x300000 +// OBSOLETE +// OBSOLETE #include "m68k/tm-m68k.h" diff --git a/gdb/config/m68k/tm-delta68.h b/gdb/config/m68k/tm-delta68.h index a360a78..c041060 100644 --- a/gdb/config/m68k/tm-delta68.h +++ b/gdb/config/m68k/tm-delta68.h @@ -1,109 +1,109 @@ -/* Target definitions for delta68. - Copyright 1993, 1994, 1998, 1999, 2000 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -struct frame_info; - -#include "regcache.h" - -/* Define BPT_VECTOR if it is different than the default. - This is the vector number used by traps to indicate a breakpoint. */ - -#define BPT_VECTOR 0x1 - -#define GCC_COMPILED_FLAG_SYMBOL "gcc_compiled%" -#define GCC2_COMPILED_FLAG_SYMBOL "gcc2_compiled%" - -/* Amount PC must be decremented by after a breakpoint. - On the Delta, the kernel decrements it for us. */ - -#define DECR_PC_AFTER_BREAK 0 - -/* Not sure what happens if we try to store this register, but - phdm@info.ucl.ac.be says we need this define. */ - -#define CANNOT_STORE_REGISTER(regno) (regno == FPI_REGNUM) - -/* Extract from an array REGBUF containing the (raw) register state - a function return value of type TYPE, and copy that, in virtual format, - into VALBUF. */ - -/* When it returns a float/double value, use fp0 in sysV68. */ -/* When it returns a pointer value, use a0 in sysV68. */ - -#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ - if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ - DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM, TYPE, \ - ®BUF[DEPRECATED_REGISTER_BYTE (FP0_REGNUM)], \ - VALBUF); \ - else \ - memcpy ((VALBUF), \ - (char *) ((REGBUF) + \ - (TYPE_CODE(TYPE) == TYPE_CODE_PTR ? 8 * 4 : \ - (TYPE_LENGTH(TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH(TYPE)))), \ - TYPE_LENGTH(TYPE)) - -/* Write into appropriate registers a function return value - of type TYPE, given in virtual format. */ - -/* When it returns a float/double value, use fp0 in sysV68. */ -/* When it returns a pointer value, use a0 in sysV68. */ - -#define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ - if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ - { \ - char raw_buf[DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM)]; \ - DEPRECATED_REGISTER_CONVERT_TO_RAW (TYPE, FP0_REGNUM, VALBUF, raw_buf); \ - deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (FP0_REGNUM), \ - raw_buf, DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM)); \ - } \ - else \ - deprecated_write_register_bytes ((TYPE_CODE(TYPE) == TYPE_CODE_PTR ? 8 * 4 : 0), \ - VALBUF, TYPE_LENGTH (TYPE)) - -/* Return number of args passed to a frame. - Can return -1, meaning no way to tell. */ - -extern int delta68_frame_num_args (struct frame_info *fi); -#define FRAME_NUM_ARGS(fi) (delta68_frame_num_args ((fi))) - -/* On M68040 versions of sysV68 R3V7.1, ptrace(PT_WRITE_I) does not clear - the processor's instruction cache as it should. */ -#define CLEAR_INSN_CACHE() clear_insn_cache() - -#include "m68k/tm-m68k.h" - -/* Extract from an array REGBUF containing the (raw) register state - the address in which a function should return its structure value, - as a CORE_ADDR (or an expression that can be used as one). */ - -#undef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS -#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF)\ - (*(CORE_ADDR *)((char*)(REGBUF) + 8 * 4)) - -extern int delta68_in_sigtramp (CORE_ADDR pc, char *name); -#define IN_SIGTRAMP(pc,name) delta68_in_sigtramp (pc, name) - -extern CORE_ADDR delta68_frame_saved_pc (struct frame_info *fi); -#undef DEPRECATED_FRAME_SAVED_PC -#define DEPRECATED_FRAME_SAVED_PC(fi) delta68_frame_saved_pc (fi) - -extern CORE_ADDR delta68_frame_args_address (struct frame_info *fi); -#undef DEPRECATED_FRAME_ARGS_ADDRESS -#define DEPRECATED_FRAME_ARGS_ADDRESS(fi) delta68_frame_args_address (fi) +// OBSOLETE /* Target definitions for delta68. +// OBSOLETE Copyright 1993, 1994, 1998, 1999, 2000 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE struct frame_info; +// OBSOLETE +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE /* Define BPT_VECTOR if it is different than the default. +// OBSOLETE This is the vector number used by traps to indicate a breakpoint. */ +// OBSOLETE +// OBSOLETE #define BPT_VECTOR 0x1 +// OBSOLETE +// OBSOLETE #define GCC_COMPILED_FLAG_SYMBOL "gcc_compiled%" +// OBSOLETE #define GCC2_COMPILED_FLAG_SYMBOL "gcc2_compiled%" +// OBSOLETE +// OBSOLETE /* Amount PC must be decremented by after a breakpoint. +// OBSOLETE On the Delta, the kernel decrements it for us. */ +// OBSOLETE +// OBSOLETE #define DECR_PC_AFTER_BREAK 0 +// OBSOLETE +// OBSOLETE /* Not sure what happens if we try to store this register, but +// OBSOLETE phdm@info.ucl.ac.be says we need this define. */ +// OBSOLETE +// OBSOLETE #define CANNOT_STORE_REGISTER(regno) (regno == FPI_REGNUM) +// OBSOLETE +// OBSOLETE /* Extract from an array REGBUF containing the (raw) register state +// OBSOLETE a function return value of type TYPE, and copy that, in virtual format, +// OBSOLETE into VALBUF. */ +// OBSOLETE +// OBSOLETE /* When it returns a float/double value, use fp0 in sysV68. */ +// OBSOLETE /* When it returns a pointer value, use a0 in sysV68. */ +// OBSOLETE +// OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +// OBSOLETE if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ +// OBSOLETE DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM, TYPE, \ +// OBSOLETE ®BUF[DEPRECATED_REGISTER_BYTE (FP0_REGNUM)], \ +// OBSOLETE VALBUF); \ +// OBSOLETE else \ +// OBSOLETE memcpy ((VALBUF), \ +// OBSOLETE (char *) ((REGBUF) + \ +// OBSOLETE (TYPE_CODE(TYPE) == TYPE_CODE_PTR ? 8 * 4 : \ +// OBSOLETE (TYPE_LENGTH(TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH(TYPE)))), \ +// OBSOLETE TYPE_LENGTH(TYPE)) +// OBSOLETE +// OBSOLETE /* Write into appropriate registers a function return value +// OBSOLETE of type TYPE, given in virtual format. */ +// OBSOLETE +// OBSOLETE /* When it returns a float/double value, use fp0 in sysV68. */ +// OBSOLETE /* When it returns a pointer value, use a0 in sysV68. */ +// OBSOLETE +// OBSOLETE #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ +// OBSOLETE if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ +// OBSOLETE { \ +// OBSOLETE char raw_buf[DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM)]; \ +// OBSOLETE DEPRECATED_REGISTER_CONVERT_TO_RAW (TYPE, FP0_REGNUM, VALBUF, raw_buf); \ +// OBSOLETE deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (FP0_REGNUM), \ +// OBSOLETE raw_buf, DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM)); \ +// OBSOLETE } \ +// OBSOLETE else \ +// OBSOLETE deprecated_write_register_bytes ((TYPE_CODE(TYPE) == TYPE_CODE_PTR ? 8 * 4 : 0), \ +// OBSOLETE VALBUF, TYPE_LENGTH (TYPE)) +// OBSOLETE +// OBSOLETE /* Return number of args passed to a frame. +// OBSOLETE Can return -1, meaning no way to tell. */ +// OBSOLETE +// OBSOLETE extern int delta68_frame_num_args (struct frame_info *fi); +// OBSOLETE #define FRAME_NUM_ARGS(fi) (delta68_frame_num_args ((fi))) +// OBSOLETE +// OBSOLETE /* On M68040 versions of sysV68 R3V7.1, ptrace(PT_WRITE_I) does not clear +// OBSOLETE the processor's instruction cache as it should. */ +// OBSOLETE #define CLEAR_INSN_CACHE() clear_insn_cache() +// OBSOLETE +// OBSOLETE #include "m68k/tm-m68k.h" +// OBSOLETE +// OBSOLETE /* Extract from an array REGBUF containing the (raw) register state +// OBSOLETE the address in which a function should return its structure value, +// OBSOLETE as a CORE_ADDR (or an expression that can be used as one). */ +// OBSOLETE +// OBSOLETE #undef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS +// OBSOLETE #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF)\ +// OBSOLETE (*(CORE_ADDR *)((char*)(REGBUF) + 8 * 4)) +// OBSOLETE +// OBSOLETE extern int delta68_in_sigtramp (CORE_ADDR pc, char *name); +// OBSOLETE #define IN_SIGTRAMP(pc,name) delta68_in_sigtramp (pc, name) +// OBSOLETE +// OBSOLETE extern CORE_ADDR delta68_frame_saved_pc (struct frame_info *fi); +// OBSOLETE #undef DEPRECATED_FRAME_SAVED_PC +// OBSOLETE #define DEPRECATED_FRAME_SAVED_PC(fi) delta68_frame_saved_pc (fi) +// OBSOLETE +// OBSOLETE extern CORE_ADDR delta68_frame_args_address (struct frame_info *fi); +// OBSOLETE #undef DEPRECATED_FRAME_ARGS_ADDRESS +// OBSOLETE #define DEPRECATED_FRAME_ARGS_ADDRESS(fi) delta68_frame_args_address (fi) diff --git a/gdb/config/m68k/tm-dpx2.h b/gdb/config/m68k/tm-dpx2.h index 96b1c32..f641ad3 100644 --- a/gdb/config/m68k/tm-dpx2.h +++ b/gdb/config/m68k/tm-dpx2.h @@ -1,35 +1,35 @@ -/* Parameters for targeting to a Bull DPX2. - Copyright 1986, 1987, 1989, 1991, 1993, 1994 - Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* Define BPT_VECTOR if it is different than the default. - This is the vector number used by traps to indicate a breakpoint. */ - -#define BPT_VECTOR 0xe - -/* Need to get function ends by adding this to epilogue address from .bf - record, not using x_fsize field. */ -#define FUNCTION_EPILOGUE_SIZE 4 - -/* The child target can't deal with writing floating registers. */ -#define CANNOT_STORE_REGISTER(regno) ((regno) >= FP0_REGNUM) - -#include <sys/types.h> -#include "m68k/tm-m68k.h" +// OBSOLETE /* Parameters for targeting to a Bull DPX2. +// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1993, 1994 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* Define BPT_VECTOR if it is different than the default. +// OBSOLETE This is the vector number used by traps to indicate a breakpoint. */ +// OBSOLETE +// OBSOLETE #define BPT_VECTOR 0xe +// OBSOLETE +// OBSOLETE /* Need to get function ends by adding this to epilogue address from .bf +// OBSOLETE record, not using x_fsize field. */ +// OBSOLETE #define FUNCTION_EPILOGUE_SIZE 4 +// OBSOLETE +// OBSOLETE /* The child target can't deal with writing floating registers. */ +// OBSOLETE #define CANNOT_STORE_REGISTER(regno) ((regno) >= FP0_REGNUM) +// OBSOLETE +// OBSOLETE #include <sys/types.h> +// OBSOLETE #include "m68k/tm-m68k.h" diff --git a/gdb/config/m68k/tm-m68klynx.h b/gdb/config/m68k/tm-m68klynx.h index 71ed690..e82fbee 100644 --- a/gdb/config/m68k/tm-m68klynx.h +++ b/gdb/config/m68k/tm-m68klynx.h @@ -1,39 +1,39 @@ -/* Macro definitions for Motorola 680x0 running under LynxOS. - Copyright 1993 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef TM_M68KLYNX_H -#define TM_M68KLYNX_H - -#include "config/tm-lynx.h" - -/* If PC-2 contains this instruction, then we know what we are in a system - call stub, and the return PC is is at SP+4, instead of SP. */ - -#define SYSCALL_TRAP 0x4e4a /* trap #10 */ -#define SYSCALL_TRAP_OFFSET 2 /* PC is after trap instruction */ - -/* Use the generic 68k definitions. */ - -#include "m68k/tm-m68k.h" - -/* Disable dumbshit alternate breakpoint mechanism needed by 68k stub. */ -#undef DEPRECATED_REMOTE_BREAKPOINT - -#endif /* TM_M68KLYNX_H */ +// OBSOLETE /* Macro definitions for Motorola 680x0 running under LynxOS. +// OBSOLETE Copyright 1993 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #ifndef TM_M68KLYNX_H +// OBSOLETE #define TM_M68KLYNX_H +// OBSOLETE +// OBSOLETE #include "config/tm-lynx.h" +// OBSOLETE +// OBSOLETE /* If PC-2 contains this instruction, then we know what we are in a system +// OBSOLETE call stub, and the return PC is is at SP+4, instead of SP. */ +// OBSOLETE +// OBSOLETE #define SYSCALL_TRAP 0x4e4a /* trap #10 */ +// OBSOLETE #define SYSCALL_TRAP_OFFSET 2 /* PC is after trap instruction */ +// OBSOLETE +// OBSOLETE /* Use the generic 68k definitions. */ +// OBSOLETE +// OBSOLETE #include "m68k/tm-m68k.h" +// OBSOLETE +// OBSOLETE /* Disable dumbshit alternate breakpoint mechanism needed by 68k stub. */ +// OBSOLETE #undef DEPRECATED_REMOTE_BREAKPOINT +// OBSOLETE +// OBSOLETE #endif /* TM_M68KLYNX_H */ diff --git a/gdb/config/m68k/tm-m68kv4.h b/gdb/config/m68k/tm-m68kv4.h index 11bb122..95696b6 100644 --- a/gdb/config/m68k/tm-m68kv4.h +++ b/gdb/config/m68k/tm-m68kv4.h @@ -1,67 +1,67 @@ -/* Target definitions for GDB on a Motorola 680x0 running SVR4. - (Commodore Amiga with amix or Atari TT with ASV) - Copyright 1991, 1994, 1995, 1996, 1998, 1999, 2000, 2003 - Free Software Foundation, Inc. - Written by Fred Fish at Cygnus Support (fnf@cygint) - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* Define BPT_VECTOR if it is different than the default. - This is the vector number used by traps to indicate a breakpoint. */ - -#define BPT_VECTOR 0x1 - -/* How much to decrement the PC after a trap. Depends on kernel. */ - -#define DECR_PC_AFTER_BREAK 0 /* No decrement required */ - -#include "config/tm-sysv4.h" -#include "m68k/tm-m68k.h" - -/* Offsets (in target ints) into jmp_buf. Not defined in any system header - file, so we have to step through setjmp/longjmp with a debugger and figure - them out. As a double check, note that <setjmp> defines _JBLEN as 13, - which matches the number of elements we see saved by setjmp(). */ - -#define JB_ELEMENT_SIZE sizeof(int) /* jmp_buf[_JBLEN] is array of ints */ - -#define JB_D2 0 -#define JB_D3 1 -#define JB_D4 2 -#define JB_D5 3 -#define JB_D6 4 -#define JB_D7 5 -#define JB_A1 6 -#define JB_A2 7 -#define JB_A3 8 -#define JB_A4 9 -#define JB_A5 10 -#define JB_A6 11 -#define JB_A7 12 - -#define JB_PC JB_A1 /* Setjmp()'s return PC saved in A1 */ - -/* Figure out where the longjmp will land. Slurp the args out of the stack. - We expect the first arg to be a pointer to the jmp_buf structure from which - we extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. - This routine returns true on success */ - -#define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR) - -/* Convert a DWARF register number to a gdb REGNUM. */ -#define DWARF_REG_TO_REGNUM(num) ((num) < 16 ? (num) : (num)+FP0_REGNUM-16) +// OBSOLETE /* Target definitions for GDB on a Motorola 680x0 running SVR4. +// OBSOLETE (Commodore Amiga with amix or Atari TT with ASV) +// OBSOLETE Copyright 1991, 1994, 1995, 1996, 1998, 1999, 2000, 2003 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE Written by Fred Fish at Cygnus Support (fnf@cygint) +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* Define BPT_VECTOR if it is different than the default. +// OBSOLETE This is the vector number used by traps to indicate a breakpoint. */ +// OBSOLETE +// OBSOLETE #define BPT_VECTOR 0x1 +// OBSOLETE +// OBSOLETE /* How much to decrement the PC after a trap. Depends on kernel. */ +// OBSOLETE +// OBSOLETE #define DECR_PC_AFTER_BREAK 0 /* No decrement required */ +// OBSOLETE +// OBSOLETE #include "config/tm-sysv4.h" +// OBSOLETE #include "m68k/tm-m68k.h" +// OBSOLETE +// OBSOLETE /* Offsets (in target ints) into jmp_buf. Not defined in any system header +// OBSOLETE file, so we have to step through setjmp/longjmp with a debugger and figure +// OBSOLETE them out. As a double check, note that <setjmp> defines _JBLEN as 13, +// OBSOLETE which matches the number of elements we see saved by setjmp(). */ +// OBSOLETE +// OBSOLETE #define JB_ELEMENT_SIZE sizeof(int) /* jmp_buf[_JBLEN] is array of ints */ +// OBSOLETE +// OBSOLETE #define JB_D2 0 +// OBSOLETE #define JB_D3 1 +// OBSOLETE #define JB_D4 2 +// OBSOLETE #define JB_D5 3 +// OBSOLETE #define JB_D6 4 +// OBSOLETE #define JB_D7 5 +// OBSOLETE #define JB_A1 6 +// OBSOLETE #define JB_A2 7 +// OBSOLETE #define JB_A3 8 +// OBSOLETE #define JB_A4 9 +// OBSOLETE #define JB_A5 10 +// OBSOLETE #define JB_A6 11 +// OBSOLETE #define JB_A7 12 +// OBSOLETE +// OBSOLETE #define JB_PC JB_A1 /* Setjmp()'s return PC saved in A1 */ +// OBSOLETE +// OBSOLETE /* Figure out where the longjmp will land. Slurp the args out of the stack. +// OBSOLETE We expect the first arg to be a pointer to the jmp_buf structure from which +// OBSOLETE we extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. +// OBSOLETE This routine returns true on success */ +// OBSOLETE +// OBSOLETE #define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR) +// OBSOLETE +// OBSOLETE /* Convert a DWARF register number to a gdb REGNUM. */ +// OBSOLETE #define DWARF_REG_TO_REGNUM(num) ((num) < 16 ? (num) : (num)+FP0_REGNUM-16) diff --git a/gdb/config/m68k/tm-sun2.h b/gdb/config/m68k/tm-sun2.h index e839bea..199530a 100644 --- a/gdb/config/m68k/tm-sun2.h +++ b/gdb/config/m68k/tm-sun2.h @@ -1,24 +1,24 @@ -/* Parameters for execution on a Sun, for GDB, the GNU debugger. - Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* The child target can't deal with floating registers. */ -#define CANNOT_STORE_REGISTER(regno) ((regno) >= FP0_REGNUM) - -#include "m68k/tm-m68k.h" +// OBSOLETE /* Parameters for execution on a Sun, for GDB, the GNU debugger. +// OBSOLETE Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* The child target can't deal with floating registers. */ +// OBSOLETE #define CANNOT_STORE_REGISTER(regno) ((regno) >= FP0_REGNUM) +// OBSOLETE +// OBSOLETE #include "m68k/tm-m68k.h" diff --git a/gdb/config/m68k/tm-sun2os4.h b/gdb/config/m68k/tm-sun2os4.h index d5fe531..83beb6c 100644 --- a/gdb/config/m68k/tm-sun2os4.h +++ b/gdb/config/m68k/tm-sun2os4.h @@ -1,21 +1,21 @@ -/* Copyright (C) 1990, Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "m68k/tm-sun2.h" -#include "config/tm-sunos.h" +// OBSOLETE /* Copyright (C) 1990, Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "m68k/tm-sun2.h" +// OBSOLETE #include "config/tm-sunos.h" diff --git a/gdb/config/m68k/tm-sun3.h b/gdb/config/m68k/tm-sun3.h index 93fea35..f51666d 100644 --- a/gdb/config/m68k/tm-sun3.h +++ b/gdb/config/m68k/tm-sun3.h @@ -1,89 +1,89 @@ -/* Parameters for execution on a Sun, for GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1996, 2000 - Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef TM_SUN3_H -#define TM_SUN3_H - -/* Sun3 status includes fpflags, which shows whether the FPU has been used - by the process, and whether the FPU was done with an instruction or - was interrupted in the middle of a long instruction. See - <machine/reg.h>. */ -/* a&d, pc,sr, fp, fpstat, fpflags */ - -#define DEPRECATED_REGISTER_BYTES (16*4 + 8 + 8*12 + 3*4 + 4) - -#define NUM_REGS 31 - -#define REGISTER_BYTES_OK(b) \ - ((b) == DEPRECATED_REGISTER_BYTES \ - || (b) == REGISTER_BYTES_FP \ - || (b) == REGISTER_BYTES_NOFP) - -/* If PC contains this instruction, then we know what we are in a system - call stub, and the return PC is is at SP+4, instead of SP. */ - -#define SYSCALL_TRAP 0x4e40 /* trap #0 */ -#define SYSCALL_TRAP_OFFSET 0 /* PC points at trap instruction */ - -#include "m68k/tm-m68k.h" - -/* Disable alternate breakpoint mechanism needed by 68k stub. */ -#undef DEPRECATED_REMOTE_BREAKPOINT - -/* Offsets (in target ints) into jmp_buf. Not defined by Sun, but at least - documented in a comment in <machine/setjmp.h>! */ - -#define JB_ELEMENT_SIZE 4 - -#define JB_ONSSTACK 0 -#define JB_SIGMASK 1 -#define JB_SP 2 -#define JB_PC 3 -#define JB_PSL 4 -#define JB_D2 5 -#define JB_D3 6 -#define JB_D4 7 -#define JB_D5 8 -#define JB_D6 9 -#define JB_D7 10 -#define JB_A2 11 -#define JB_A3 12 -#define JB_A4 13 -#define JB_A5 14 -#define JB_A6 15 - -/* Figure out where the longjmp will land. Slurp the args out of the stack. - We expect the first arg to be a pointer to the jmp_buf structure from which - we extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. - This routine returns true on success */ - -#define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR) - -/* If sun3 pcc says that a parameter is a short, it's a short. */ -#define BELIEVE_PCC_PROMOTION_TYPE 1 - -/* Can't define BELIEVE_PCC_PROMOTION for SunOS /bin/cc of SunOS 4.1.1. - Apparently Sun fixed this for the sparc but not the sun3. */ - -/* The code which tries to deal with this bug is never harmful on a sun3. */ -#define SUN_FIXED_LBRAC_BUG (0) - -#endif /* TM_SUN3_H */ +// OBSOLETE /* Parameters for execution on a Sun, for GDB, the GNU debugger. +// OBSOLETE Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1996, 2000 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #ifndef TM_SUN3_H +// OBSOLETE #define TM_SUN3_H +// OBSOLETE +// OBSOLETE /* Sun3 status includes fpflags, which shows whether the FPU has been used +// OBSOLETE by the process, and whether the FPU was done with an instruction or +// OBSOLETE was interrupted in the middle of a long instruction. See +// OBSOLETE <machine/reg.h>. */ +// OBSOLETE /* a&d, pc,sr, fp, fpstat, fpflags */ +// OBSOLETE +// OBSOLETE #define DEPRECATED_REGISTER_BYTES (16*4 + 8 + 8*12 + 3*4 + 4) +// OBSOLETE +// OBSOLETE #define NUM_REGS 31 +// OBSOLETE +// OBSOLETE #define REGISTER_BYTES_OK(b) \ +// OBSOLETE ((b) == DEPRECATED_REGISTER_BYTES \ +// OBSOLETE || (b) == REGISTER_BYTES_FP \ +// OBSOLETE || (b) == REGISTER_BYTES_NOFP) +// OBSOLETE +// OBSOLETE /* If PC contains this instruction, then we know what we are in a system +// OBSOLETE call stub, and the return PC is is at SP+4, instead of SP. */ +// OBSOLETE +// OBSOLETE #define SYSCALL_TRAP 0x4e40 /* trap #0 */ +// OBSOLETE #define SYSCALL_TRAP_OFFSET 0 /* PC points at trap instruction */ +// OBSOLETE +// OBSOLETE #include "m68k/tm-m68k.h" +// OBSOLETE +// OBSOLETE /* Disable alternate breakpoint mechanism needed by 68k stub. */ +// OBSOLETE #undef DEPRECATED_REMOTE_BREAKPOINT +// OBSOLETE +// OBSOLETE /* Offsets (in target ints) into jmp_buf. Not defined by Sun, but at least +// OBSOLETE documented in a comment in <machine/setjmp.h>! */ +// OBSOLETE +// OBSOLETE #define JB_ELEMENT_SIZE 4 +// OBSOLETE +// OBSOLETE #define JB_ONSSTACK 0 +// OBSOLETE #define JB_SIGMASK 1 +// OBSOLETE #define JB_SP 2 +// OBSOLETE #define JB_PC 3 +// OBSOLETE #define JB_PSL 4 +// OBSOLETE #define JB_D2 5 +// OBSOLETE #define JB_D3 6 +// OBSOLETE #define JB_D4 7 +// OBSOLETE #define JB_D5 8 +// OBSOLETE #define JB_D6 9 +// OBSOLETE #define JB_D7 10 +// OBSOLETE #define JB_A2 11 +// OBSOLETE #define JB_A3 12 +// OBSOLETE #define JB_A4 13 +// OBSOLETE #define JB_A5 14 +// OBSOLETE #define JB_A6 15 +// OBSOLETE +// OBSOLETE /* Figure out where the longjmp will land. Slurp the args out of the stack. +// OBSOLETE We expect the first arg to be a pointer to the jmp_buf structure from which +// OBSOLETE we extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. +// OBSOLETE This routine returns true on success */ +// OBSOLETE +// OBSOLETE #define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR) +// OBSOLETE +// OBSOLETE /* If sun3 pcc says that a parameter is a short, it's a short. */ +// OBSOLETE #define BELIEVE_PCC_PROMOTION_TYPE 1 +// OBSOLETE +// OBSOLETE /* Can't define BELIEVE_PCC_PROMOTION for SunOS /bin/cc of SunOS 4.1.1. +// OBSOLETE Apparently Sun fixed this for the sparc but not the sun3. */ +// OBSOLETE +// OBSOLETE /* The code which tries to deal with this bug is never harmful on a sun3. */ +// OBSOLETE #define SUN_FIXED_LBRAC_BUG (0) +// OBSOLETE +// OBSOLETE #endif /* TM_SUN3_H */ diff --git a/gdb/config/m68k/tm-sun3os4.h b/gdb/config/m68k/tm-sun3os4.h index ced4376..7e1ffb2 100644 --- a/gdb/config/m68k/tm-sun3os4.h +++ b/gdb/config/m68k/tm-sun3os4.h @@ -1,22 +1,22 @@ -/* Target machine parameters for Sun-3 under SunOS 4.x, for GDB. - Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "m68k/tm-sun3.h" -#include "config/tm-sunos.h" +// OBSOLETE /* Target machine parameters for Sun-3 under SunOS 4.x, for GDB. +// OBSOLETE Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "m68k/tm-sun3.h" +// OBSOLETE #include "config/tm-sunos.h" diff --git a/gdb/config/m68k/xm-3b1.h b/gdb/config/m68k/xm-3b1.h index acf72e9..7257b69 100644 --- a/gdb/config/m68k/xm-3b1.h +++ b/gdb/config/m68k/xm-3b1.h @@ -1,82 +1,82 @@ -/* Parameters for execution on a 3b1. - Copyright 1986, 1987, 1989, 1999 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define HAVE_TERMIO -#define USG - -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ - -#define KERNEL_U_ADDR 0x70000 - -#define REGISTER_U_ADDR(addr, blockend, regno) \ -{ addr = blockend + regno * 4; } - -/* Interface definitions for kernel debugger KDB. */ - -/* Map machine fault codes into signal numbers. - First subtract 0, divide by 4, then index in a table. - Faults for which the entry in this table is 0 - are not handled by KDB; the program's own trap handler - gets to handle then. */ - -#define FAULT_CODE_ORIGIN 0 -#define FAULT_CODE_UNITS 4 -#define FAULT_TABLE \ -{ 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \ - 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - SIGILL } - -/* Start running with a stack stretching from BEG to END. - BEG and END should be symbols meaningful to the assembler. - This is used only for kdb. */ - -#define INIT_STACK(beg, end) \ -{ asm (".globl end"); \ - asm ("movel $ end, sp"); \ - asm ("clrl fp"); } - -/* Push the frame pointer register on the stack. */ -#define PUSH_FRAME_PTR \ - asm ("movel fp, -(sp)"); - -/* Copy the top-of-stack to the frame pointer register. */ -#define POP_FRAME_PTR \ - asm ("movl (sp), fp"); - -/* After KDB is entered by a fault, push all registers - that GDB thinks about (all NUM_REGS of them), - so that they appear in order of ascending GDB register number. - The fault code will be on the stack beyond the last register. */ - -#define PUSH_REGISTERS \ -{ asm ("clrw -(sp)"); \ - asm ("pea 10(sp)"); \ - asm ("movem $ 0xfffe,-(sp)"); } - -/* Assuming the registers (including processor status) have been - pushed on the stack in order of ascending GDB register number, - restore them and return to the address in the saved PC register. */ - -#define POP_REGISTERS \ -{ asm ("subil $8,28(sp)"); \ - asm ("movem (sp),$ 0xffff"); \ - asm ("rte"); } +// OBSOLETE /* Parameters for execution on a 3b1. +// OBSOLETE Copyright 1986, 1987, 1989, 1999 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #define HAVE_TERMIO +// OBSOLETE #define USG +// OBSOLETE +// OBSOLETE /* This is the amount to subtract from u.u_ar0 +// OBSOLETE to get the offset in the core file of the register values. */ +// OBSOLETE +// OBSOLETE #define KERNEL_U_ADDR 0x70000 +// OBSOLETE +// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ +// OBSOLETE { addr = blockend + regno * 4; } +// OBSOLETE +// OBSOLETE /* Interface definitions for kernel debugger KDB. */ +// OBSOLETE +// OBSOLETE /* Map machine fault codes into signal numbers. +// OBSOLETE First subtract 0, divide by 4, then index in a table. +// OBSOLETE Faults for which the entry in this table is 0 +// OBSOLETE are not handled by KDB; the program's own trap handler +// OBSOLETE gets to handle then. */ +// OBSOLETE +// OBSOLETE #define FAULT_CODE_ORIGIN 0 +// OBSOLETE #define FAULT_CODE_UNITS 4 +// OBSOLETE #define FAULT_TABLE \ +// OBSOLETE { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \ +// OBSOLETE 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \ +// OBSOLETE 0, 0, 0, 0, 0, 0, 0, 0, \ +// OBSOLETE SIGILL } +// OBSOLETE +// OBSOLETE /* Start running with a stack stretching from BEG to END. +// OBSOLETE BEG and END should be symbols meaningful to the assembler. +// OBSOLETE This is used only for kdb. */ +// OBSOLETE +// OBSOLETE #define INIT_STACK(beg, end) \ +// OBSOLETE { asm (".globl end"); \ +// OBSOLETE asm ("movel $ end, sp"); \ +// OBSOLETE asm ("clrl fp"); } +// OBSOLETE +// OBSOLETE /* Push the frame pointer register on the stack. */ +// OBSOLETE #define PUSH_FRAME_PTR \ +// OBSOLETE asm ("movel fp, -(sp)"); +// OBSOLETE +// OBSOLETE /* Copy the top-of-stack to the frame pointer register. */ +// OBSOLETE #define POP_FRAME_PTR \ +// OBSOLETE asm ("movl (sp), fp"); +// OBSOLETE +// OBSOLETE /* After KDB is entered by a fault, push all registers +// OBSOLETE that GDB thinks about (all NUM_REGS of them), +// OBSOLETE so that they appear in order of ascending GDB register number. +// OBSOLETE The fault code will be on the stack beyond the last register. */ +// OBSOLETE +// OBSOLETE #define PUSH_REGISTERS \ +// OBSOLETE { asm ("clrw -(sp)"); \ +// OBSOLETE asm ("pea 10(sp)"); \ +// OBSOLETE asm ("movem $ 0xfffe,-(sp)"); } +// OBSOLETE +// OBSOLETE /* Assuming the registers (including processor status) have been +// OBSOLETE pushed on the stack in order of ascending GDB register number, +// OBSOLETE restore them and return to the address in the saved PC register. */ +// OBSOLETE +// OBSOLETE #define POP_REGISTERS \ +// OBSOLETE { asm ("subil $8,28(sp)"); \ +// OBSOLETE asm ("movem (sp),$ 0xffff"); \ +// OBSOLETE asm ("rte"); } diff --git a/gdb/config/m68k/xm-delta68.h b/gdb/config/m68k/xm-delta68.h index f691c38..9b8f0af 100644 --- a/gdb/config/m68k/xm-delta68.h +++ b/gdb/config/m68k/xm-delta68.h @@ -1,35 +1,35 @@ -/* Macro definitions for a Delta. - Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* I'm running gdb 4.9 under sysV68 R3V7.1. - - On some machines, gdb crashes when it's starting up while calling the - vendor's termio tgetent() routine. It always works when run under - itself (actually, under 3.2, it's not an infinitely recursive bug.) - After some poking around, it appears that depending on the environment - size, or whether you're running YP, or the phase of the moon or something, - the stack is not always long-aligned when main() is called, and tgetent() - takes strong offense at that. On some machines this bug never appears, but - on those where it does, it occurs quite reliably. */ -#define ALIGN_STACK_ON_STARTUP - -#define USG - -#define HAVE_TERMIO +// OBSOLETE /* Macro definitions for a Delta. +// OBSOLETE Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* I'm running gdb 4.9 under sysV68 R3V7.1. +// OBSOLETE +// OBSOLETE On some machines, gdb crashes when it's starting up while calling the +// OBSOLETE vendor's termio tgetent() routine. It always works when run under +// OBSOLETE itself (actually, under 3.2, it's not an infinitely recursive bug.) +// OBSOLETE After some poking around, it appears that depending on the environment +// OBSOLETE size, or whether you're running YP, or the phase of the moon or something, +// OBSOLETE the stack is not always long-aligned when main() is called, and tgetent() +// OBSOLETE takes strong offense at that. On some machines this bug never appears, but +// OBSOLETE on those where it does, it occurs quite reliably. */ +// OBSOLETE #define ALIGN_STACK_ON_STARTUP +// OBSOLETE +// OBSOLETE #define USG +// OBSOLETE +// OBSOLETE #define HAVE_TERMIO diff --git a/gdb/config/m68k/xm-dpx2.h b/gdb/config/m68k/xm-dpx2.h index 4083c9d..0a42203 100644 --- a/gdb/config/m68k/xm-dpx2.h +++ b/gdb/config/m68k/xm-dpx2.h @@ -1,22 +1,22 @@ -/* Parameters for execution on a Bull DPX2. - Copyright 1986, 1987, 1989, 1993 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define HAVE_TERMIOS -#define USG +// OBSOLETE /* Parameters for execution on a Bull DPX2. +// OBSOLETE Copyright 1986, 1987, 1989, 1993 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #define HAVE_TERMIOS +// OBSOLETE #define USG diff --git a/gdb/config/m68k/xm-m68kv4.h b/gdb/config/m68k/xm-m68kv4.h index 542cd10..044371c 100644 --- a/gdb/config/m68k/xm-m68kv4.h +++ b/gdb/config/m68k/xm-m68kv4.h @@ -1,29 +1,29 @@ -/* Host definitions for GDB on a Motorola 680x0 running SVR4. - (Commodore Amiga with amix or Atari TT with ASV) - Copyright 1991, 1992, 1994, 1996 Free Software Foundation, Inc. - Written by Fred Fish at Cygnus Support (fnf@cygnus.com) - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* Pick up most of what we need from the generic m68k host include file. */ - -#include "m68k/xm-m68k.h" - -/* Pick up more stuff from the generic SVR4 host include file. */ - -#include "config/xm-sysv4.h" +// OBSOLETE /* Host definitions for GDB on a Motorola 680x0 running SVR4. +// OBSOLETE (Commodore Amiga with amix or Atari TT with ASV) +// OBSOLETE Copyright 1991, 1992, 1994, 1996 Free Software Foundation, Inc. +// OBSOLETE Written by Fred Fish at Cygnus Support (fnf@cygnus.com) +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* Pick up most of what we need from the generic m68k host include file. */ +// OBSOLETE +// OBSOLETE #include "m68k/xm-m68k.h" +// OBSOLETE +// OBSOLETE /* Pick up more stuff from the generic SVR4 host include file. */ +// OBSOLETE +// OBSOLETE #include "config/xm-sysv4.h" diff --git a/gdb/config/m68k/xm-sun2.h b/gdb/config/m68k/xm-sun2.h index cf84619..f17ad3c 100644 --- a/gdb/config/m68k/xm-sun2.h +++ b/gdb/config/m68k/xm-sun2.h @@ -1,77 +1,77 @@ -/* Parameters for execution on a Sun, for GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1996 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ - -#define KERNEL_U_ADDR 0x2800 - - -/* Interface definitions for kernel debugger KDB. */ - -/* Map machine fault codes into signal numbers. - First subtract 0, divide by 4, then index in a table. - Faults for which the entry in this table is 0 - are not handled by KDB; the program's own trap handler - gets to handle then. */ - -#define FAULT_CODE_ORIGIN 0 -#define FAULT_CODE_UNITS 4 -#define FAULT_TABLE \ -{ 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \ - 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - SIGILL } - -/* Start running with a stack stretching from BEG to END. - BEG and END should be symbols meaningful to the assembler. - This is used only for kdb. */ - -#define INIT_STACK(beg, end) \ -{ asm (".globl end"); \ - asm ("movel $ end, sp"); \ - asm ("clrl fp"); } - -/* Push the frame pointer register on the stack. */ -#define PUSH_FRAME_PTR \ - asm ("movel fp, -(sp)"); - -/* Copy the top-of-stack to the frame pointer register. */ -#define POP_FRAME_PTR \ - asm ("movl (sp), fp"); - -/* After KDB is entered by a fault, push all registers - that GDB thinks about (all NUM_REGS of them), - so that they appear in order of ascending GDB register number. - The fault code will be on the stack beyond the last register. */ - -#define PUSH_REGISTERS \ -{ asm ("clrw -(sp)"); \ - asm ("pea 10(sp)"); \ - asm ("movem $ 0xfffe,-(sp)"); } - -/* Assuming the registers (including processor status) have been - pushed on the stack in order of ascending GDB register number, - restore them and return to the address in the saved PC register. */ - -#define POP_REGISTERS \ -{ asm ("subil $8,28(sp)"); \ - asm ("movem (sp),$ 0xffff"); \ - asm ("rte"); } +// OBSOLETE /* Parameters for execution on a Sun, for GDB, the GNU debugger. +// OBSOLETE Copyright 1986, 1987, 1989, 1996 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* This is the amount to subtract from u.u_ar0 +// OBSOLETE to get the offset in the core file of the register values. */ +// OBSOLETE +// OBSOLETE #define KERNEL_U_ADDR 0x2800 +// OBSOLETE +// OBSOLETE +// OBSOLETE /* Interface definitions for kernel debugger KDB. */ +// OBSOLETE +// OBSOLETE /* Map machine fault codes into signal numbers. +// OBSOLETE First subtract 0, divide by 4, then index in a table. +// OBSOLETE Faults for which the entry in this table is 0 +// OBSOLETE are not handled by KDB; the program's own trap handler +// OBSOLETE gets to handle then. */ +// OBSOLETE +// OBSOLETE #define FAULT_CODE_ORIGIN 0 +// OBSOLETE #define FAULT_CODE_UNITS 4 +// OBSOLETE #define FAULT_TABLE \ +// OBSOLETE { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \ +// OBSOLETE 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \ +// OBSOLETE 0, 0, 0, 0, 0, 0, 0, 0, \ +// OBSOLETE SIGILL } +// OBSOLETE +// OBSOLETE /* Start running with a stack stretching from BEG to END. +// OBSOLETE BEG and END should be symbols meaningful to the assembler. +// OBSOLETE This is used only for kdb. */ +// OBSOLETE +// OBSOLETE #define INIT_STACK(beg, end) \ +// OBSOLETE { asm (".globl end"); \ +// OBSOLETE asm ("movel $ end, sp"); \ +// OBSOLETE asm ("clrl fp"); } +// OBSOLETE +// OBSOLETE /* Push the frame pointer register on the stack. */ +// OBSOLETE #define PUSH_FRAME_PTR \ +// OBSOLETE asm ("movel fp, -(sp)"); +// OBSOLETE +// OBSOLETE /* Copy the top-of-stack to the frame pointer register. */ +// OBSOLETE #define POP_FRAME_PTR \ +// OBSOLETE asm ("movl (sp), fp"); +// OBSOLETE +// OBSOLETE /* After KDB is entered by a fault, push all registers +// OBSOLETE that GDB thinks about (all NUM_REGS of them), +// OBSOLETE so that they appear in order of ascending GDB register number. +// OBSOLETE The fault code will be on the stack beyond the last register. */ +// OBSOLETE +// OBSOLETE #define PUSH_REGISTERS \ +// OBSOLETE { asm ("clrw -(sp)"); \ +// OBSOLETE asm ("pea 10(sp)"); \ +// OBSOLETE asm ("movem $ 0xfffe,-(sp)"); } +// OBSOLETE +// OBSOLETE /* Assuming the registers (including processor status) have been +// OBSOLETE pushed on the stack in order of ascending GDB register number, +// OBSOLETE restore them and return to the address in the saved PC register. */ +// OBSOLETE +// OBSOLETE #define POP_REGISTERS \ +// OBSOLETE { asm ("subil $8,28(sp)"); \ +// OBSOLETE asm ("movem (sp),$ 0xffff"); \ +// OBSOLETE asm ("rte"); } diff --git a/gdb/config/m68k/xm-sun3.h b/gdb/config/m68k/xm-sun3.h index 6a5a560..5f04e02 100644 --- a/gdb/config/m68k/xm-sun3.h +++ b/gdb/config/m68k/xm-sun3.h @@ -1,71 +1,71 @@ -/* Parameters for execution on a Sun, for GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1996 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* Interface definitions for kernel debugger KDB. */ - -/* Map machine fault codes into signal numbers. - First subtract 0, divide by 4, then index in a table. - Faults for which the entry in this table is 0 - are not handled by KDB; the program's own trap handler - gets to handle then. */ - -#define FAULT_CODE_ORIGIN 0 -#define FAULT_CODE_UNITS 4 -#define FAULT_TABLE \ -{ 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \ - 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - SIGILL } - -/* Start running with a stack stretching from BEG to END. - BEG and END should be symbols meaningful to the assembler. - This is used only for kdb. */ - -#define INIT_STACK(beg, end) \ -{ asm (".globl end"); \ - asm ("movel #end, sp"); \ - asm ("movel #0,a6"); } - -/* Push the frame pointer register on the stack. */ -#define PUSH_FRAME_PTR \ - asm ("movel a6,sp@-"); - -/* Copy the top-of-stack to the frame pointer register. */ -#define POP_FRAME_PTR \ - asm ("movl sp@,a6"); - -/* After KDB is entered by a fault, push all registers - that GDB thinks about (all NUM_REGS of them), - so that they appear in order of ascending GDB register number. - The fault code will be on the stack beyond the last register. */ - -#define PUSH_REGISTERS \ -{ asm ("clrw -(sp)"); \ - asm ("pea sp@(10)"); \ - asm ("movem #0xfffe,sp@-"); } - -/* Assuming the registers (including processor status) have been - pushed on the stack in order of ascending GDB register number, - restore them and return to the address in the saved PC register. */ - -#define POP_REGISTERS \ -{ asm ("subil #8,sp@(28)"); \ - asm ("movem sp@,#0xffff"); \ - asm ("rte"); } +// OBSOLETE /* Parameters for execution on a Sun, for GDB, the GNU debugger. +// OBSOLETE Copyright 1986, 1987, 1989, 1996 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* Interface definitions for kernel debugger KDB. */ +// OBSOLETE +// OBSOLETE /* Map machine fault codes into signal numbers. +// OBSOLETE First subtract 0, divide by 4, then index in a table. +// OBSOLETE Faults for which the entry in this table is 0 +// OBSOLETE are not handled by KDB; the program's own trap handler +// OBSOLETE gets to handle then. */ +// OBSOLETE +// OBSOLETE #define FAULT_CODE_ORIGIN 0 +// OBSOLETE #define FAULT_CODE_UNITS 4 +// OBSOLETE #define FAULT_TABLE \ +// OBSOLETE { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \ +// OBSOLETE 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \ +// OBSOLETE 0, 0, 0, 0, 0, 0, 0, 0, \ +// OBSOLETE SIGILL } +// OBSOLETE +// OBSOLETE /* Start running with a stack stretching from BEG to END. +// OBSOLETE BEG and END should be symbols meaningful to the assembler. +// OBSOLETE This is used only for kdb. */ +// OBSOLETE +// OBSOLETE #define INIT_STACK(beg, end) \ +// OBSOLETE { asm (".globl end"); \ +// OBSOLETE asm ("movel #end, sp"); \ +// OBSOLETE asm ("movel #0,a6"); } +// OBSOLETE +// OBSOLETE /* Push the frame pointer register on the stack. */ +// OBSOLETE #define PUSH_FRAME_PTR \ +// OBSOLETE asm ("movel a6,sp@-"); +// OBSOLETE +// OBSOLETE /* Copy the top-of-stack to the frame pointer register. */ +// OBSOLETE #define POP_FRAME_PTR \ +// OBSOLETE asm ("movl sp@,a6"); +// OBSOLETE +// OBSOLETE /* After KDB is entered by a fault, push all registers +// OBSOLETE that GDB thinks about (all NUM_REGS of them), +// OBSOLETE so that they appear in order of ascending GDB register number. +// OBSOLETE The fault code will be on the stack beyond the last register. */ +// OBSOLETE +// OBSOLETE #define PUSH_REGISTERS \ +// OBSOLETE { asm ("clrw -(sp)"); \ +// OBSOLETE asm ("pea sp@(10)"); \ +// OBSOLETE asm ("movem #0xfffe,sp@-"); } +// OBSOLETE +// OBSOLETE /* Assuming the registers (including processor status) have been +// OBSOLETE pushed on the stack in order of ascending GDB register number, +// OBSOLETE restore them and return to the address in the saved PC register. */ +// OBSOLETE +// OBSOLETE #define POP_REGISTERS \ +// OBSOLETE { asm ("subil #8,sp@(28)"); \ +// OBSOLETE asm ("movem sp@,#0xffff"); \ +// OBSOLETE asm ("rte"); } diff --git a/gdb/config/m68k/xm-sun3os4.h b/gdb/config/m68k/xm-sun3os4.h index 1a819c3..5062071 100644 --- a/gdb/config/m68k/xm-sun3os4.h +++ b/gdb/config/m68k/xm-sun3os4.h @@ -1,22 +1,22 @@ -/* Macro definitions for a sun 3 running os 4. - Copyright 1989, 1996, 1998 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "m68k/xm-sun3.h" -#define FPU +// OBSOLETE /* Macro definitions for a sun 3 running os 4. +// OBSOLETE Copyright 1989, 1996, 1998 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "m68k/xm-sun3.h" +// OBSOLETE #define FPU diff --git a/gdb/config/mips/decstation.mh b/gdb/config/mips/decstation.mh index 89ce310..63de3da 100644 --- a/gdb/config/mips/decstation.mh +++ b/gdb/config/mips/decstation.mh @@ -1,4 +1,4 @@ -# Host: Little-endian MIPS machine such as DECstation. -XM_FILE= xm-mips.h -NAT_FILE= nm-mips.h -NATDEPFILES= infptrace.o inftarg.o corelow.o mips-nat.o fork-child.o +# OBSOLETE # Host: Little-endian MIPS machine such as DECstation. +# OBSOLETE XM_FILE= xm-mips.h +# OBSOLETE NAT_FILE= nm-mips.h +# OBSOLETE NATDEPFILES= infptrace.o inftarg.o corelow.o mips-nat.o fork-child.o diff --git a/gdb/config/mips/embed64.mt b/gdb/config/mips/embed64.mt deleted file mode 100644 index 2944be1..0000000 --- a/gdb/config/mips/embed64.mt +++ /dev/null @@ -1,4 +0,0 @@ -TDEPFILES= mips-tdep.o remote-mips.o -TM_FILE= tm-mips64.h -SIM_OBS = remote-sim.o -SIM = ../sim/mips/libsim.a diff --git a/gdb/config/mips/linux64.mt b/gdb/config/mips/linux64.mt deleted file mode 100644 index 985d8f5..0000000 --- a/gdb/config/mips/linux64.mt +++ /dev/null @@ -1,7 +0,0 @@ -# Target: Linux/MIPS w/ support for 64-bit ABIs -TDEPFILES= mips-tdep.o mips-linux-tdep.o corelow.o \ - solib.o solib-svr4.o -TM_FILE= tm-linux64.h - -SIM_OBS = remote-sim.o -SIM = ../sim/mips/libsim.a diff --git a/gdb/config/mips/littlemips.mh b/gdb/config/mips/littlemips.mh index 581a908..30c40ad 100644 --- a/gdb/config/mips/littlemips.mh +++ b/gdb/config/mips/littlemips.mh @@ -1,3 +1,3 @@ -# Host: Little-endian MIPS machine such as DECstation. -NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o -XM_FILE= xm-mips.h +# OBSOLETE # Host: Little-endian MIPS machine such as DECstation. +# OBSOLETE NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o +# OBSOLETE XM_FILE= xm-mips.h diff --git a/gdb/config/mips/mipsv4.mt b/gdb/config/mips/mipsv4.mt index 6d3b47d..13320c20 100644 --- a/gdb/config/mips/mipsv4.mt +++ b/gdb/config/mips/mipsv4.mt @@ -1,3 +1,3 @@ -# Target: MIPS running SVR4 -TDEPFILES= mips-tdep.o -TM_FILE= tm-mipsv4.h +# OBSOLETE # Target: MIPS running SVR4 +# OBSOLETE TDEPFILES= mips-tdep.o +# OBSOLETE TM_FILE= tm-mipsv4.h diff --git a/gdb/config/mips/news-mips.mh b/gdb/config/mips/news-mips.mh index 5cc138f..f2c7f89 100644 --- a/gdb/config/mips/news-mips.mh +++ b/gdb/config/mips/news-mips.mh @@ -1,3 +1,3 @@ -# Host: Big-endian MIPS machine such as Sony News -NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o mips-nat.o -NAT_FILE= nm-news-mips.h +# OBSOLETE # Host: Big-endian MIPS machine such as Sony News +# OBSOLETE NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o mips-nat.o +# OBSOLETE NAT_FILE= nm-news-mips.h diff --git a/gdb/config/mips/nm-mips.h b/gdb/config/mips/nm-mips.h index 7b61d83..f20ddf1 100644 --- a/gdb/config/mips/nm-mips.h +++ b/gdb/config/mips/nm-mips.h @@ -1,34 +1,34 @@ -/* Native definitions for GDB on DECstations, Sony News. and MIPS Riscos systems - Copyright 1986, 1987, 1989, 1992, 1995, 1996, 2000 - Free Software Foundation, Inc. - Contributed by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin - and by Alessandro Forin(af@cs.cmu.edu) at CMU - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ -#define FETCH_INFERIOR_REGISTERS - -/* Figure out where the longjmp will land. We expect that we have just entered - longjmp and haven't yet setup the stack frame, so the args are still in the - argument regs. a0 (CALL_ARG0) points at the jmp_buf structure from which we - extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. - This routine returns true on success */ - -#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) -extern int get_longjmp_target (CORE_ADDR *); +// OBSOLETE /* Native definitions for GDB on DECstations, Sony News. and MIPS Riscos systems +// OBSOLETE Copyright 1986, 1987, 1989, 1992, 1995, 1996, 2000 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE Contributed by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin +// OBSOLETE and by Alessandro Forin(af@cs.cmu.edu) at CMU +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ +// OBSOLETE #define FETCH_INFERIOR_REGISTERS +// OBSOLETE +// OBSOLETE /* Figure out where the longjmp will land. We expect that we have just entered +// OBSOLETE longjmp and haven't yet setup the stack frame, so the args are still in the +// OBSOLETE argument regs. a0 (CALL_ARG0) points at the jmp_buf structure from which we +// OBSOLETE extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. +// OBSOLETE This routine returns true on success */ +// OBSOLETE +// OBSOLETE #define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) +// OBSOLETE extern int get_longjmp_target (CORE_ADDR *); diff --git a/gdb/config/mips/nm-news-mips.h b/gdb/config/mips/nm-news-mips.h index 9f80eb5..15d9b7b 100644 --- a/gdb/config/mips/nm-news-mips.h +++ b/gdb/config/mips/nm-news-mips.h @@ -1,43 +1,43 @@ -/* Definitions to make GDB run on a mips box under 4.3bsd. - Copyright 1986, 1987, 1989, 1993, 1996 Free Software Foundation, Inc. - Contributed by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin - and by Alessandro Forin(af@cs.cmu.edu) at CMU - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef NM_NEWS_MIPS_H -#define NM_NEWS_MIPS_H 1 - -/* Needed for RISC NEWS core files. */ -#include <machine/machparam.h> -#include <sys/types.h> -#define KERNEL_U_ADDR UADDR - -#define REGISTER_U_ADDR(addr, blockend, regno) \ - if (regno < 38) addr = (NBPG*UPAGES) + (regno - 38)*sizeof(int);\ - else addr = 0; /* ..somewhere in the pcb */ - -/* Kernel is a bit tenacious about sharing text segments, disallowing bpts. */ -#define ONE_PROCESS_WRITETEXT - -#include "mips/nm-mips.h" - -/* Apparently not in <sys/types.h> */ -typedef int pid_t; - -#endif /* NM_NEWS_MIPS_H */ +// OBSOLETE /* Definitions to make GDB run on a mips box under 4.3bsd. +// OBSOLETE Copyright 1986, 1987, 1989, 1993, 1996 Free Software Foundation, Inc. +// OBSOLETE Contributed by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin +// OBSOLETE and by Alessandro Forin(af@cs.cmu.edu) at CMU +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #ifndef NM_NEWS_MIPS_H +// OBSOLETE #define NM_NEWS_MIPS_H 1 +// OBSOLETE +// OBSOLETE /* Needed for RISC NEWS core files. */ +// OBSOLETE #include <machine/machparam.h> +// OBSOLETE #include <sys/types.h> +// OBSOLETE #define KERNEL_U_ADDR UADDR +// OBSOLETE +// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ +// OBSOLETE if (regno < 38) addr = (NBPG*UPAGES) + (regno - 38)*sizeof(int);\ +// OBSOLETE else addr = 0; /* ..somewhere in the pcb */ +// OBSOLETE +// OBSOLETE /* Kernel is a bit tenacious about sharing text segments, disallowing bpts. */ +// OBSOLETE #define ONE_PROCESS_WRITETEXT +// OBSOLETE +// OBSOLETE #include "mips/nm-mips.h" +// OBSOLETE +// OBSOLETE /* Apparently not in <sys/types.h> */ +// OBSOLETE typedef int pid_t; +// OBSOLETE +// OBSOLETE #endif /* NM_NEWS_MIPS_H */ diff --git a/gdb/config/mips/nm-riscos.h b/gdb/config/mips/nm-riscos.h index 7f68b67..dba51b2 100644 --- a/gdb/config/mips/nm-riscos.h +++ b/gdb/config/mips/nm-riscos.h @@ -1,60 +1,60 @@ -/* This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* MIPS running RISC/os 4.52C. */ - -#define PCB_OFFSET(FIELD) ((int)&((struct user*)0)->u_pcb.FIELD) - -/* RISC/os 5.0 defines this in machparam.h. */ -#include <bsd43/machine/machparam.h> -#define NBPG BSD43_NBPG -#define UPAGES BSD43_UPAGES - -/* Where is this used? I don't see any uses in mips-nat.c, and I don't think - the uses in infptrace.c are used if FETCH_INFERIOR_REGISTERS is defined. - Does the compiler react badly to "extern CORE_ADDR kernel_u_addr" (even - if never referenced)? */ -#define KERNEL_U_ADDR BSD43_UADDR - -#define REGISTER_U_ADDR(addr, blockend, regno) \ - if (regno < FP0_REGNUM) \ - addr = UPAGES*NBPG-EF_SIZE+4*((regno)+EF_AT-1); \ - else if (regno < PC_REGNUM) \ - addr = PCB_OFFSET(pcb_fpregs[0]) + 4*(regno-FP0_REGNUM); \ - else if (regno == PS_REGNUM) \ - addr = UPAGES*NBPG-EF_SIZE+4*EF_SR; \ - else if (regno == BADVADDR_REGNUM) \ - addr = UPAGES*NBPG-EF_SIZE+4*EF_BADVADDR; \ - else if (regno == LO_REGNUM) \ - addr = UPAGES*NBPG-EF_SIZE+4*EF_MDLO; \ - else if (regno == HI_REGNUM) \ - addr = UPAGES*NBPG-EF_SIZE+4*EF_MDHI; \ - else if (regno == CAUSE_REGNUM) \ - addr = UPAGES*NBPG-EF_SIZE+4*EF_CAUSE; \ - else if (regno == PC_REGNUM) \ - addr = UPAGES*NBPG-EF_SIZE+4*EF_EPC; \ - else if (regno < FCRCS_REGNUM) \ - addr = PCB_OFFSET(pcb_fpregs[0]) + 4*(regno-FP0_REGNUM); \ - else if (regno == FCRCS_REGNUM) \ - addr = PCB_OFFSET(pcb_fpc_csr); \ - else if (regno == FCRIR_REGNUM) \ - addr = PCB_OFFSET(pcb_fpc_eir); \ - else \ - addr = 0; - -#include "mips/nm-mips.h" - -/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ -#define FETCH_INFERIOR_REGISTERS +// OBSOLETE /* This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* MIPS running RISC/os 4.52C. */ +// OBSOLETE +// OBSOLETE #define PCB_OFFSET(FIELD) ((int)&((struct user*)0)->u_pcb.FIELD) +// OBSOLETE +// OBSOLETE /* RISC/os 5.0 defines this in machparam.h. */ +// OBSOLETE #include <bsd43/machine/machparam.h> +// OBSOLETE #define NBPG BSD43_NBPG +// OBSOLETE #define UPAGES BSD43_UPAGES +// OBSOLETE +// OBSOLETE /* Where is this used? I don't see any uses in mips-nat.c, and I don't think +// OBSOLETE the uses in infptrace.c are used if FETCH_INFERIOR_REGISTERS is defined. +// OBSOLETE Does the compiler react badly to "extern CORE_ADDR kernel_u_addr" (even +// OBSOLETE if never referenced)? */ +// OBSOLETE #define KERNEL_U_ADDR BSD43_UADDR +// OBSOLETE +// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ +// OBSOLETE if (regno < FP0_REGNUM) \ +// OBSOLETE addr = UPAGES*NBPG-EF_SIZE+4*((regno)+EF_AT-1); \ +// OBSOLETE else if (regno < PC_REGNUM) \ +// OBSOLETE addr = PCB_OFFSET(pcb_fpregs[0]) + 4*(regno-FP0_REGNUM); \ +// OBSOLETE else if (regno == PS_REGNUM) \ +// OBSOLETE addr = UPAGES*NBPG-EF_SIZE+4*EF_SR; \ +// OBSOLETE else if (regno == mips_regnum (current_gdbarch)->badvaddr) \ +// OBSOLETE addr = UPAGES*NBPG-EF_SIZE+4*EF_BADVADDR; \ +// OBSOLETE else if (regno == mips_regnum (current_gdbarch)->lo) \ +// OBSOLETE addr = UPAGES*NBPG-EF_SIZE+4*EF_MDLO; \ +// OBSOLETE else if (regno == mips_regnum (current_gdbarch)->hi) \ +// OBSOLETE addr = UPAGES*NBPG-EF_SIZE+4*EF_MDHI; \ +// OBSOLETE else if (regno == mips_regnum (current_gdbarch)->cause) \ +// OBSOLETE addr = UPAGES*NBPG-EF_SIZE+4*EF_CAUSE; \ +// OBSOLETE else if (regno == mips_regnum (current_gdbarch)->pc) \ +// OBSOLETE addr = UPAGES*NBPG-EF_SIZE+4*EF_EPC; \ +// OBSOLETE else if (regno < mips_regnum (current_gdbarch)->fp_control_status) \ +// OBSOLETE addr = PCB_OFFSET(pcb_fpregs[0]) + 4*(regno-FP0_REGNUM); \ +// OBSOLETE else if (regno == mips_regnum (current_gdbarch)->fp_control_status) \ +// OBSOLETE addr = PCB_OFFSET(pcb_fpc_csr); \ +// OBSOLETE else if (regno == mips_regnum (current_gdbarch)->fp_implementation_revision) \ +// OBSOLETE addr = PCB_OFFSET(pcb_fpc_eir); \ +// OBSOLETE else \ +// OBSOLETE addr = 0; +// OBSOLETE +// OBSOLETE #include "mips/nm-mips.h" +// OBSOLETE +// OBSOLETE /* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ +// OBSOLETE #define FETCH_INFERIOR_REGISTERS diff --git a/gdb/config/mips/riscos.mh b/gdb/config/mips/riscos.mh index 6a3192f..0a1c31c 100644 --- a/gdb/config/mips/riscos.mh +++ b/gdb/config/mips/riscos.mh @@ -1,16 +1,16 @@ -# Host: MIPS running RISC/os - -XM_FILE= xm-riscos.h - -NAT_FILE= nm-riscos.h -NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o mips-nat.o - -MH_CFLAGS=-Wf,-XNh10000 - -# ptrace(2) apparently has problems in the BSD environment. No workaround is -# known except to select the sysv environment. Could we use /proc instead? -# These "sysv environments" and "bsd environments" often end up being a pain. -# -# This is not part of CFLAGS because perhaps not all C compilers have this -# option. -CC= cc -systype sysv +# OBSOLETE # Host: MIPS running RISC/os +# OBSOLETE +# OBSOLETE XM_FILE= xm-riscos.h +# OBSOLETE +# OBSOLETE NAT_FILE= nm-riscos.h +# OBSOLETE NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o mips-nat.o +# OBSOLETE +# OBSOLETE MH_CFLAGS=-Wf,-XNh10000 +# OBSOLETE +# OBSOLETE # ptrace(2) apparently has problems in the BSD environment. No workaround is +# OBSOLETE # known except to select the sysv environment. Could we use /proc instead? +# OBSOLETE # These "sysv environments" and "bsd environments" often end up being a pain. +# OBSOLETE # +# OBSOLETE # This is not part of CFLAGS because perhaps not all C compilers have this +# OBSOLETE # option. +# OBSOLETE CC= cc -systype sysv diff --git a/gdb/config/mips/tm-irix5.h b/gdb/config/mips/tm-irix5.h index 61e809d..fdc1756 100644 --- a/gdb/config/mips/tm-irix5.h +++ b/gdb/config/mips/tm-irix5.h @@ -1,6 +1,7 @@ /* Target machine description for SGI Iris under Irix 5, for GDB. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000 - Free Software Foundation, Inc. + + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2003 Free + Software Foundation, Inc. This file is part of GDB. @@ -21,45 +22,6 @@ #include "mips/tm-mips.h" -/* Redefine register numbers for SGI. */ - -#undef MIPS_REGISTER_NAMES -#undef FP0_REGNUM -#undef PC_REGNUM -#undef HI_REGNUM -#undef LO_REGNUM -#undef CAUSE_REGNUM -#undef BADVADDR_REGNUM -#undef FCRCS_REGNUM -#undef FCRIR_REGNUM - -/* Initializer for an array of names for registers 32 and above. - There should be NUM_REGS-32 strings in this initializer. */ - -#define MIPS_REGISTER_NAMES \ - { "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ - "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ - "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",\ - "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",\ - "pc", "cause", "bad", "hi", "lo", "fsr", "fir" \ - } - -/* Register numbers of various important registers. - Note that some of these values are "real" register numbers, - and correspond to the general registers of the machine, - and some are "phony" register numbers which are too large - to be actual register numbers as far as the user is concerned - but do serve to get the desired values when passed to read_register. */ - -#define FP0_REGNUM 32 /* Floating point register 0 (single float) */ -#define PC_REGNUM 64 /* Contains program counter */ -#define CAUSE_REGNUM 65 /* describes last exception */ -#define BADVADDR_REGNUM 66 /* bad vaddr for addressing exception */ -#define HI_REGNUM 67 /* Multiple/divide temp */ -#define LO_REGNUM 68 /* ... */ -#define FCRCS_REGNUM 69 /* FP control/status */ -#define FCRIR_REGNUM 70 /* FP implementation/revision */ - /* Offsets for register values in _sigtramp frame. sigcontext is immediately above the _sigtramp frame on Irix. */ #define SIGFRAME_BASE 0x0 @@ -67,36 +29,9 @@ #define SIGFRAME_REGSAVE_OFF (SIGFRAME_BASE + 3 * 4) #define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_BASE + 3 * 4 + 32 * 4 + 4) -/* FIXME: cagney/2000-04-04: Testing the _MIPS_SIM_NABI32 and - _MIPS_SIM in a tm-*.h file is simply wrong! Those are - host-dependant macros (provided by /usr/include) and stop any - chance of the target being cross compiled */ -#if defined (_MIPS_SIM_NABI32) && _MIPS_SIM == _MIPS_SIM_NABI32 -/* - * Irix 6 (n32 ABI) has 32-bit GP regs and 64-bit FP regs - */ - -#undef MIPS_REGISTER_BYTE -#define MIPS_REGISTER_BYTE(N) \ - (((N) < FP0_REGNUM) ? (N) * MIPS_REGSIZE : \ - ((N) < FP0_REGNUM + 32) ? \ - FP0_REGNUM * MIPS_REGSIZE + \ - ((N) - FP0_REGNUM) * sizeof(double) : \ - 32 * sizeof(double) + ((N) - 32) * MIPS_REGSIZE) - -#undef MIPS_REGISTER_TYPE -#define MIPS_REGISTER_TYPE(N) \ - (((N) >= FP0_REGNUM && (N) < FP0_REGNUM+32) ? builtin_type_double \ - : ((N) == 32 /*SR*/) ? builtin_type_uint32 \ - : ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \ - : builtin_type_int) - -#endif /* N32 */ - - /* The signal handler trampoline is called _sigtramp. */ #undef IN_SIGTRAMP -#define IN_SIGTRAMP(pc, name) ((name) && STREQ ("_sigtramp", name)) +#define IN_SIGTRAMP(pc, name) ((name) && DEPRECATED_STREQ ("_sigtramp", name)) /* Irix 5 saves a full 64 bits for each register. We skip 2 * 4 to get to the saved PC (the register mask and status register are both @@ -110,4 +45,3 @@ #define SIGFRAME_REGSAVE_OFF (SIGFRAME_BASE + 2 * 4 + 8 + 4) #undef SIGFRAME_FPREGSAVE_OFF #define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_BASE + 2 * 4 + 8 + 32 * 8 + 4) -#define SIGFRAME_REG_SIZE 8 diff --git a/gdb/config/mips/tm-irix6.h b/gdb/config/mips/tm-irix6.h index 0d4fc0c..272cafe 100644 --- a/gdb/config/mips/tm-irix6.h +++ b/gdb/config/mips/tm-irix6.h @@ -1,6 +1,6 @@ /* Target machine description for SGI Iris under Irix 6.x, for GDB. - Copyright 2001, 2002 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -19,60 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "mips/tm-mips64.h" +#include "mips/tm-mips.h" #include "solib.h" -/* Redefine register numbers for SGI. */ - -#undef MIPS_REGISTER_NAMES -#undef FP0_REGNUM -#undef PC_REGNUM -#undef HI_REGNUM -#undef LO_REGNUM -#undef CAUSE_REGNUM -#undef BADVADDR_REGNUM -#undef FCRCS_REGNUM -#undef FCRIR_REGNUM - -/* Initializer for an array of names for registers 32 and above. - There should be NUM_REGS-32 strings in this initializer. */ - -#define MIPS_REGISTER_NAMES \ - { "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ - "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ - "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",\ - "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",\ - "pc", "cause", "bad", "hi", "lo", "fsr", "fir" \ - } - -/* Register numbers of various important registers. - Note that some of these values are "real" register numbers, - and correspond to the general registers of the machine, - and some are "phony" register numbers which are too large - to be actual register numbers as far as the user is concerned - but do serve to get the desired values when passed to read_register. */ - -#define FP0_REGNUM 32 /* Floating point register 0 (single float) */ -#define PC_REGNUM 64 /* Contains program counter */ -#define CAUSE_REGNUM 65 /* describes last exception */ -#define BADVADDR_REGNUM 66 /* bad vaddr for addressing exception */ -#define HI_REGNUM 67 /* Multiple/divide temp */ -#define LO_REGNUM 68 /* ... */ -#define FCRCS_REGNUM 69 /* FP control/status */ -#define FCRIR_REGNUM 70 /* FP implementation/revision */ - - -#undef MIPS_REGISTER_BYTE -#define MIPS_REGISTER_BYTE(N) \ - (((N) < FP0_REGNUM) ? (N) * MIPS_REGSIZE : \ - ((N) < FP0_REGNUM + 32) ? \ - FP0_REGNUM * MIPS_REGSIZE + \ - ((N) - FP0_REGNUM) * sizeof(double) : \ - 32 * sizeof(double) + ((N) - 32) * MIPS_REGSIZE) - /* The signal handler trampoline is called _sigtramp. */ #undef IN_SIGTRAMP -#define IN_SIGTRAMP(pc, name) ((name) && STREQ ("_sigtramp", name)) +#define IN_SIGTRAMP(pc, name) ((name) && DEPRECATED_STREQ ("_sigtramp", name)) /* Offsets for register values in _sigtramp frame. sigcontext is immediately above the _sigtramp frame on Irix. */ @@ -91,11 +43,3 @@ #define SIGFRAME_REGSAVE_OFF (SIGFRAME_BASE + 2 * 4 + 8 + 4) #undef SIGFRAME_FPREGSAVE_OFF #define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_BASE + 2 * 4 + 8 + 32 * 8 + 4) -#define SIGFRAME_REG_SIZE 8 - -/* Undefine those methods which have been multiarched. */ - -/* Undefine MIPS_REGISTER_TYPE, so that GDB uses real C code in - mips_register_type() to return the register type, instead of - relying on this macro. */ -#undef MIPS_REGISTER_TYPE diff --git a/gdb/config/mips/tm-linux64.h b/gdb/config/mips/tm-linux64.h deleted file mode 100644 index 92226d7..0000000 --- a/gdb/config/mips/tm-linux64.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Target-dependent definitions for 64-bit GNU/Linux MIPS. - - Copyright 2002 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef TM_MIPS64LINUX_H -#define TM_MIPS64LINUX_H - -#include "mips/tm-mips64.h" -#include "mips/tm-linux.h" - -#endif /* TM_MIPS64LINUX_H */ diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index 59aeb5d..be0d6b7 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -45,28 +45,6 @@ extern int mips_step_skips_delay (CORE_ADDR); #define STEP_SKIPS_DELAY_P (1) #define STEP_SKIPS_DELAY(pc) (mips_step_skips_delay (pc)) -/* The size of a register. This is predefined in tm-mips64.h. */ - -#ifndef MIPS_REGSIZE -#define MIPS_REGSIZE 4 -#endif - -/* Initializer for an array of names for registers 32 and above. - There should be NUM_REGS-32 strings in this initializer. */ - -#ifndef MIPS_REGISTER_NAMES -#define MIPS_REGISTER_NAMES \ - { "sr", "lo", "hi", "bad", "cause","pc", \ - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ - "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ - "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",\ - "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",\ - "fsr", "fir", ""/*"fp"*/, "", \ - "", "", "", "", "", "", "", "", \ - "", "", "", "", "", "", "", "", \ - } -#endif - /* Register numbers of various important registers. Note that some of these values are "real" register numbers, and correspond to the general registers of the machine, @@ -81,36 +59,11 @@ extern int mips_step_skips_delay (CORE_ADDR); #define SP_REGNUM 29 /* Contains address of top of stack */ #define RA_REGNUM 31 /* Contains return address value */ #define PS_REGNUM 32 /* Contains processor status */ -#define HI_REGNUM 34 /* Multiple/divide temp */ -#define LO_REGNUM 33 /* ... */ -#define BADVADDR_REGNUM 35 /* bad vaddr for addressing exception */ -#define CAUSE_REGNUM 36 /* describes last exception */ -#define PC_REGNUM 37 /* Contains program counter */ -#define FP0_REGNUM 38 /* Floating point register 0 (single float) */ -#define FPA0_REGNUM (FP0_REGNUM+12) /* First float argument register */ -#define FCRCS_REGNUM 70 /* FP control/status */ -#define FCRIR_REGNUM 71 /* FP implementation/revision */ #define UNUSED_REGNUM 73 /* Never used, FIXME */ #define FIRST_EMBED_REGNUM 74 /* First CP0 register for embedded use */ #define PRID_REGNUM 89 /* Processor ID */ #define LAST_EMBED_REGNUM 89 /* Last one */ -/* Index within `registers' of the first byte of the space for - register N. */ - -#define MIPS_REGISTER_BYTE(N) ((N) * MIPS_REGSIZE) - -/* Return the GDB type object for the "standard" data type of data in - register N. */ - -#ifndef MIPS_REGISTER_TYPE -#define MIPS_REGISTER_TYPE(N) \ - (((N) >= FP0_REGNUM && (N) < FP0_REGNUM+32) ? builtin_type_float \ - : ((N) == 32 /*SR*/) ? builtin_type_uint32 \ - : ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \ - : builtin_type_int) -#endif - /* Special symbol found in blocks associated with routines. We can hang mips_extra_func_info_t's off of this. */ @@ -150,9 +103,6 @@ extern struct frame_info *setup_arbitrary_frame (int, CORE_ADDR *); extern CORE_ADDR sigtramp_address, sigtramp_end; extern void fixup_sigtramp (void); -/* Defined in mips-tdep.c and used in remote-mips.c */ -extern char *mips_read_processor_type (void); - /* Functions for dealing with MIPS16 call and return stubs. */ #define IGNORE_HELPER_CALL(pc) mips_ignore_helper (pc) extern int mips_ignore_helper (CORE_ADDR pc); @@ -165,8 +115,5 @@ typedef unsigned long t_inst; /* Integer big enough to hold an instruction */ #endif /* TM_MIPS_H */ -/* Command to set the processor type. */ -extern void mips_set_processor_type_command (char *, int); - /* Single step based on where the current instruction will take us. */ extern void mips_software_single_step (enum target_signal, int); diff --git a/gdb/config/mips/tm-mips64.h b/gdb/config/mips/tm-mips64.h deleted file mode 100644 index 2547e86..0000000 --- a/gdb/config/mips/tm-mips64.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Target machine parameters for MIPS r4000 - Copyright 1994, 1996, 1997, 1998, 2000 Free Software Foundation, Inc. - Contributed by Ian Lance Taylor (ian@cygnus.com) - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* Use eight byte registers. */ -#define MIPS_REGSIZE 8 - -/* define 8 byte register type */ -#define MIPS_REGISTER_TYPE(N) \ - (((N) >= FP0_REGNUM && (N) < FP0_REGNUM+32) ? builtin_type_double \ - : ((N) == 32 /*SR*/) ? builtin_type_uint32 \ - : ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \ - : builtin_type_long_long) - -/* Load double words in CALL_DUMMY. */ -#define OP_LDFPR 065 /* ldc1 */ -#define OP_LDGPR 067 /* ld */ - -/* Get the basic MIPS definitions. */ -#include "mips/tm-mips.h" diff --git a/gdb/config/mips/tm-mipsv4.h b/gdb/config/mips/tm-mipsv4.h index 37f9e46..9460741 100644 --- a/gdb/config/mips/tm-mipsv4.h +++ b/gdb/config/mips/tm-mipsv4.h @@ -1,37 +1,37 @@ -/* Target machine description for MIPS running SVR4, for GDB. - Copyright 1994, 1995, 1998, 1999, 2000 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "mips/tm-mips.h" -#include "config/tm-sysv4.h" - -/* The signal handler trampoline is called _sigtramp. */ -#undef IN_SIGTRAMP -#define IN_SIGTRAMP(pc, name) ((name) && STREQ ("_sigtramp", name)) - -/* On entry to the signal handler trampoline, an ucontext is already - pushed on the stack. We can get at the saved registers via the - mcontext which is contained within the ucontext. */ -#define SIGFRAME_BASE 0 -#define SIGFRAME_REGSAVE_OFF (SIGFRAME_BASE + 40) -#define SIGFRAME_PC_OFF (SIGFRAME_BASE + 40 + 35 * 4) -#define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_BASE + 40 + 36 * 4) - -/* Convert a DWARF register number to a gdb REGNUM. */ -#define DWARF_REG_TO_REGNUM(num) ((num) < 32 ? (num) : (num)+FP0_REGNUM-32) +// OBSOLETE /* Target machine description for MIPS running SVR4, for GDB. +// OBSOLETE Copyright 1994, 1995, 1998, 1999, 2000 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "mips/tm-mips.h" +// OBSOLETE #include "config/tm-sysv4.h" +// OBSOLETE +// OBSOLETE /* The signal handler trampoline is called _sigtramp. */ +// OBSOLETE #undef IN_SIGTRAMP +// OBSOLETE #define IN_SIGTRAMP(pc, name) ((name) && DEPRECATED_STREQ ("_sigtramp", name)) +// OBSOLETE +// OBSOLETE /* On entry to the signal handler trampoline, an ucontext is already +// OBSOLETE pushed on the stack. We can get at the saved registers via the +// OBSOLETE mcontext which is contained within the ucontext. */ +// OBSOLETE #define SIGFRAME_BASE 0 +// OBSOLETE #define SIGFRAME_REGSAVE_OFF (SIGFRAME_BASE + 40) +// OBSOLETE #define SIGFRAME_PC_OFF (SIGFRAME_BASE + 40 + 35 * 4) +// OBSOLETE #define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_BASE + 40 + 36 * 4) +// OBSOLETE +// OBSOLETE /* Convert a DWARF register number to a gdb REGNUM. */ +// OBSOLETE #define DWARF_REG_TO_REGNUM(num) ((num) < 32 ? (num) : (num)+FP0_REGNUM-32) diff --git a/gdb/config/mips/tm-tx39.h b/gdb/config/mips/tm-tx39.h deleted file mode 100644 index 81f3b6d..0000000 --- a/gdb/config/mips/tm-tx39.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 1993, 1997, 1999, 2000 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "mips/tm-mips.h" - -#undef MIPS_REGISTER_NAMES -#define MIPS_REGISTER_NAMES \ - { "sr", "lo", "hi", "bad", "cause","pc", \ - "", "", "", "", "", "", "", "", \ - "", "", "", "", "", "", "", "", \ - "", "", "", "", "", "", "", "", \ - "", "", "", "", "", "", "", "", \ - "", "", "", "", \ - "", "", "", "", "", "", "", "", \ - "", "", "config", "cache", "debug", "depc", "epc", "" \ - } diff --git a/gdb/config/mips/tx39.mt b/gdb/config/mips/tx39.mt deleted file mode 100644 index 8b4c1a9..0000000 --- a/gdb/config/mips/tx39.mt +++ /dev/null @@ -1,5 +0,0 @@ -# Target: Big-endian mips board, typically an IDT. -TDEPFILES= mips-tdep.o remote-mips.o dve3900-rom.o monitor.o dsrec.o -TM_FILE= tm-tx39.h -SIM_OBS = remote-sim.o -SIM = ../sim/mips/libsim.a diff --git a/gdb/config/mips/tx39l.mt b/gdb/config/mips/tx39l.mt deleted file mode 100644 index 8b4c1a9..0000000 --- a/gdb/config/mips/tx39l.mt +++ /dev/null @@ -1,5 +0,0 @@ -# Target: Big-endian mips board, typically an IDT. -TDEPFILES= mips-tdep.o remote-mips.o dve3900-rom.o monitor.o dsrec.o -TM_FILE= tm-tx39.h -SIM_OBS = remote-sim.o -SIM = ../sim/mips/libsim.a diff --git a/gdb/config/mips/xm-mips.h b/gdb/config/mips/xm-mips.h index c1f53b5..bc3aa6e 100644 --- a/gdb/config/mips/xm-mips.h +++ b/gdb/config/mips/xm-mips.h @@ -1,59 +1,59 @@ -/* Definitions to make GDB run on a mips box under 4.3bsd. - Copyright 1986, 1987, 1989, 1993, 1994, 1995, 1996, 1998 - Free Software Foundation, Inc. - Contributed by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin - and by Alessandro Forin(af@cs.cmu.edu) at CMU - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifdef ultrix -/* Needed for DECstation core files. */ -#include <machine/param.h> -#define KERNEL_U_ADDR UADDR - -/* Native Ultrix cc has broken long long support. */ -#ifndef __GNUC__ -#undef CC_HAS_LONG_LONG -#endif -#endif - -#if ! defined (__GNUC__) && ! defined (offsetof) -#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) -#endif - -/* Only used for core files on DECstations. - First four registers at u.u_ar0 are saved arguments, and - there is no r0 saved. Float registers are saved - in u_pcb.pcb_fpregs, not relative to u.u_ar0. */ - -#define REGISTER_U_ADDR(addr, blockend, regno) \ - { \ - if (regno < FP0_REGNUM) \ - addr = blockend + sizeof(int) * (4 + regno - 1); \ - else \ - addr = offsetof (struct user, u_pcb.pcb_fpregs[0]) + \ - sizeof (int) * (regno - FP0_REGNUM); \ - } - -/* Kernel is a bit tenacious about sharing text segments, disallowing bpts. */ -#define ONE_PROCESS_WRITETEXT - -/* HAVE_SGTTY also works, last we tried. - - But we have termios, at least as of Ultrix 4.2A, so use it. */ -#define HAVE_TERMIOS +// OBSOLETE /* Definitions to make GDB run on a mips box under 4.3bsd. +// OBSOLETE Copyright 1986, 1987, 1989, 1993, 1994, 1995, 1996, 1998 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE Contributed by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin +// OBSOLETE and by Alessandro Forin(af@cs.cmu.edu) at CMU +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #ifdef ultrix +// OBSOLETE /* Needed for DECstation core files. */ +// OBSOLETE #include <machine/param.h> +// OBSOLETE #define KERNEL_U_ADDR UADDR +// OBSOLETE +// OBSOLETE /* Native Ultrix cc has broken long long support. */ +// OBSOLETE #ifndef __GNUC__ +// OBSOLETE #undef CC_HAS_LONG_LONG +// OBSOLETE #endif +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE #if ! defined (__GNUC__) && ! defined (offsetof) +// OBSOLETE #define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE /* Only used for core files on DECstations. +// OBSOLETE First four registers at u.u_ar0 are saved arguments, and +// OBSOLETE there is no r0 saved. Float registers are saved +// OBSOLETE in u_pcb.pcb_fpregs, not relative to u.u_ar0. */ +// OBSOLETE +// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ +// OBSOLETE { \ +// OBSOLETE if (regno < FP0_REGNUM) \ +// OBSOLETE addr = blockend + sizeof(int) * (4 + regno - 1); \ +// OBSOLETE else \ +// OBSOLETE addr = offsetof (struct user, u_pcb.pcb_fpregs[0]) + \ +// OBSOLETE sizeof (int) * (regno - FP0_REGNUM); \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Kernel is a bit tenacious about sharing text segments, disallowing bpts. */ +// OBSOLETE #define ONE_PROCESS_WRITETEXT +// OBSOLETE +// OBSOLETE /* HAVE_SGTTY also works, last we tried. +// OBSOLETE +// OBSOLETE But we have termios, at least as of Ultrix 4.2A, so use it. */ +// OBSOLETE #define HAVE_TERMIOS diff --git a/gdb/config/mips/xm-mipsv4.h b/gdb/config/mips/xm-mipsv4.h index eccb296..1f39e31 100644 --- a/gdb/config/mips/xm-mipsv4.h +++ b/gdb/config/mips/xm-mipsv4.h @@ -1,22 +1,22 @@ -/* Definitions for MIPS running SVR4 hosting support. - - Copyright 1994 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "config/xm-sysv4.h" +// OBSOLETE /* Definitions for MIPS running SVR4 hosting support. +// OBSOLETE +// OBSOLETE Copyright 1994 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "config/xm-sysv4.h" diff --git a/gdb/config/mips/xm-riscos.h b/gdb/config/mips/xm-riscos.h index 1f03c5a..d8a6533 100644 --- a/gdb/config/mips/xm-riscos.h +++ b/gdb/config/mips/xm-riscos.h @@ -1,25 +1,25 @@ -/* Copyright 1993, 1994, 1995 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define HAVE_TERMIO - -#define USG 1 - -/* setjmp.h requires uid_t. */ -#include <sys/types.h> +// OBSOLETE /* Copyright 1993, 1994, 1995 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #define HAVE_TERMIO +// OBSOLETE +// OBSOLETE #define USG 1 +// OBSOLETE +// OBSOLETE /* setjmp.h requires uid_t. */ +// OBSOLETE #include <sys/types.h> diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index 9d4b134..b8c971c 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -109,24 +109,6 @@ extern int hppa_instruction_nullified (void); #define INSTRUCTION_NULLIFIED hppa_instruction_nullified () #endif -/* elz: Return a large value, which is stored on the stack at addr. - This is defined only for the hppa, at this moment. The above macro - DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS is not called anymore, - because it assumes that on exit from a called function which - returns a large structure on the stack, the address of the ret - structure is still in register 28. Unfortunately this register is - usually overwritten by the called function itself, on hppa. This is - specified in the calling convention doc. As far as I know, the only - way to get the return value is to have the caller tell us where it - told the callee to put it, rather than have the callee tell us. */ -struct value *hppa_value_returned_from_stack (struct type *valtype, - CORE_ADDR addr); -/* FIXME: cagney/2003-09-27: This method should now be redundant. - Instead, when "struct return convention", the inferior function - call code always saves and uses the struct return's stack address. */ -#define DEPRECATED_VALUE_RETURNED_FROM_STACK(valtype,addr) \ - hppa_value_returned_from_stack (valtype, addr) - extern void hppa_frame_init_saved_regs (struct frame_info *); #define DEPRECATED_FRAME_INIT_SAVED_REGS(FI) \ hppa_frame_init_saved_regs (FI) diff --git a/gdb/config/powerpc/tm-linux.h b/gdb/config/powerpc/tm-linux.h index 25b9904..364e1f9 100644 --- a/gdb/config/powerpc/tm-linux.h +++ b/gdb/config/powerpc/tm-linux.h @@ -43,13 +43,6 @@ extern int ppc_linux_in_sigtramp (CORE_ADDR pc, char *func_name); #define CANNOT_STORE_REGISTER(regno) ((regno) >= MQ_REGNUM) #endif -#if 0 /* If skip_prologue() isn't too greedy, we don't need this */ -/* There is some problem with the debugging symbols generated by the - compiler such that the debugging symbol for the first line of a - function overlap with the function prologue. */ -#define PROLOGUE_FIRSTLINE_OVERLAP -#endif - /* N_FUN symbols in shared libaries have 0 for their values and need to be relocated. */ #define SOFUN_ADDRESS_MAYBE_MISSING diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index e8deebc..af8fecc 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -143,7 +143,7 @@ extern CORE_ADDR sparc_pc_adjust (CORE_ADDR); never saving it onto the stack. So we better not believe the "p" symbol descriptor stab. */ -#define USE_REGISTER_NOT_ARG +#define DEPRECATE_USE_REGISTER_NOT_ARG /* For acc, there's no need to correct LBRAC entries by guessing how they should work. In fact, this is harmful because the LBRAC diff --git a/gdb/config/sparc/tm-sun4sol2.h b/gdb/config/sparc/tm-sun4sol2.h index 506e937..2247914 100644 --- a/gdb/config/sparc/tm-sun4sol2.h +++ b/gdb/config/sparc/tm-sun4sol2.h @@ -30,7 +30,7 @@ /* There are two different signal handler trampolines in Solaris2. */ #define IN_SIGTRAMP(pc, name) \ ((name) \ - && (STREQ ("sigacthandler", name) || STREQ ("ucbsigvechandler", name))) + && (DEPRECATED_STREQ ("sigacthandler", name) || DEPRECATED_STREQ ("ucbsigvechandler", name))) /* The signal handler gets a pointer to an ucontext as third argument if it is called from sigacthandler. This is the offset to the saved @@ -74,7 +74,5 @@ extern char *sunpro_static_transform_name (char *); #define STATIC_TRANSFORM_NAME(x) sunpro_static_transform_name (x) #define IS_STATIC_TRANSFORM_NAME(name) ((name)[0] == '$') -#define FAULTED_USE_SIGINFO - /* Enable handling of shared libraries for a.out executables. */ #define HANDLE_SVR4_EXEC_EMULATORS diff --git a/gdb/configure b/gdb/configure index cb1d915..be034a6 100755 --- a/gdb/configure +++ b/gdb/configure @@ -29,6 +29,8 @@ ac_help="$ac_help ac_help="$ac_help --enable-gdbtk enable gdbtk graphical user interface (GUI)" ac_help="$ac_help + --with-libunwind Use libunwind frame unwinding support" +ac_help="$ac_help --enable-profiling enable profiling of GDB" ac_help="$ac_help --without-included-regex don't use included regex; this is the default @@ -585,7 +587,7 @@ fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:589: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:591: 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" @@ -611,7 +613,7 @@ 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:615: checking for $ac_word" >&5 +echo "configure:617: 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 @@ -641,7 +643,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:645: checking for $ac_word" >&5 +echo "configure:647: 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 @@ -692,7 +694,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:696: checking for $ac_word" >&5 +echo "configure:698: 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 @@ -724,7 +726,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:728: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:730: 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. @@ -735,12 +737,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 739 "configure" +#line 741 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:746: \"$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 @@ -766,12 +768,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:770: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:772: 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:775: checking whether we are using GNU C" >&5 +echo "configure:777: 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 @@ -780,7 +782,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:784: \"$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:786: \"$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 @@ -799,7 +801,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:803: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:805: 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 @@ -836,7 +838,7 @@ EOF echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:840: checking how to run the C preprocessor" >&5 +echo "configure:842: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -851,13 +853,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 855 "configure" +#line 857 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:861: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:863: \"$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 : @@ -868,13 +870,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 872 "configure" +#line 874 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:878: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:880: \"$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 : @@ -885,13 +887,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 889 "configure" +#line 891 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:895: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:897: \"$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 : @@ -916,9 +918,9 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:920: checking for AIX" >&5 +echo "configure:922: checking for AIX" >&5 cat > conftest.$ac_ext <<EOF -#line 922 "configure" +#line 924 "configure" #include "confdefs.h" #ifdef _AIX yes @@ -940,7 +942,7 @@ rm -f conftest* echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:944: checking for POSIXized ISC" >&5 +echo "configure:946: 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 @@ -964,7 +966,7 @@ fi echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 -echo "configure:968: checking for ${CC-cc} option to accept ANSI C" >&5 +echo "configure:970: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -981,7 +983,7 @@ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIO do CC="$ac_save_CC $ac_arg" cat > conftest.$ac_ext <<EOF -#line 985 "configure" +#line 987 "configure" #include "confdefs.h" #include <stdarg.h> #include <stdio.h> @@ -1018,7 +1020,7 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } EOF -if { (eval echo configure:1022: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1024: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_prog_cc_stdc="$ac_arg"; break else @@ -1089,7 +1091,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:1093: checking host system type" >&5 +echo "configure:1095: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -1110,7 +1112,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:1114: checking target system type" >&5 +echo "configure:1116: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -1128,7 +1130,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1132: checking build system type" >&5 +echo "configure:1134: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -1166,7 +1168,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1170: checking for $ac_word" >&5 +echo "configure:1172: 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 @@ -1198,7 +1200,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1202: checking for $ac_word" >&5 +echo "configure:1204: 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 @@ -1233,7 +1235,7 @@ fi ALL_LINGUAS= echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1237: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1239: 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 @@ -1262,7 +1264,7 @@ fi # 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:1266: checking for $ac_word" >&5 +echo "configure:1268: 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 @@ -1290,12 +1292,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1294: checking for ANSI C header files" >&5 +echo "configure:1296: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1299 "configure" +#line 1301 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1303,7 +1305,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1309: \"$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* @@ -1320,7 +1322,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1324 "configure" +#line 1326 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1338,7 +1340,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1342 "configure" +#line 1344 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1359,7 +1361,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1363 "configure" +#line 1365 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1370,7 +1372,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1374: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1376: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1394,12 +1396,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1398: checking for working const" >&5 +echo "configure:1400: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1403 "configure" +#line 1405 "configure" #include "confdefs.h" int main() { @@ -1448,7 +1450,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:1452: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1469,21 +1471,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1473: checking for inline" >&5 +echo "configure:1475: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 1480 "configure" +#line 1482 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:1487: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1489: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1509,12 +1511,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:1513: checking for off_t" >&5 +echo "configure:1515: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1518 "configure" +#line 1520 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1542,12 +1544,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1546: checking for size_t" >&5 +echo "configure:1548: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1551 "configure" +#line 1553 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1577,19 +1579,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1581: checking for working alloca.h" >&5 +echo "configure:1583: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1586 "configure" +#line 1588 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1595: \"$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 @@ -1610,12 +1612,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1614: checking for alloca" >&5 +echo "configure:1616: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1619 "configure" +#line 1621 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -1643,7 +1645,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:1647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1649: \"$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 @@ -1675,12 +1677,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1679: checking whether alloca needs Cray hooks" >&5 +echo "configure:1681: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1684 "configure" +#line 1686 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -1705,12 +1707,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1709: checking for $ac_func" >&5 +echo "configure:1711: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1714 "configure" +#line 1716 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1733,7 +1735,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1739: \"$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 @@ -1760,7 +1762,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:1764: checking stack direction for C alloca" >&5 +echo "configure:1766: 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 @@ -1768,7 +1770,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 1772 "configure" +#line 1774 "configure" #include "confdefs.h" find_stack_direction () { @@ -1787,7 +1789,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:1791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1793: \"$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 @@ -1812,17 +1814,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1816: checking for $ac_hdr" >&5 +echo "configure:1818: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1821 "configure" +#line 1823 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1826: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1828: \"$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* @@ -1851,12 +1853,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1855: checking for $ac_func" >&5 +echo "configure:1857: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1860 "configure" +#line 1862 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1879,7 +1881,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1885: \"$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 @@ -1904,7 +1906,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:1908: checking for working mmap" >&5 +echo "configure:1910: 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 @@ -1912,7 +1914,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 1916 "configure" +#line 1918 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -2052,7 +2054,7 @@ main() } EOF -if { (eval echo configure:2056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2058: \"$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 @@ -2080,17 +2082,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2084: checking for $ac_hdr" >&5 +echo "configure:2086: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2089 "configure" +#line 2091 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2094: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2096: \"$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* @@ -2120,12 +2122,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2124: checking for $ac_func" >&5 +echo "configure:2126: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2129 "configure" +#line 2131 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2148,7 +2150,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2154: \"$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 @@ -2177,12 +2179,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2181: checking for $ac_func" >&5 +echo "configure:2183: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2186 "configure" +#line 2188 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2205,7 +2207,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2211: \"$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 @@ -2239,19 +2241,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:2243: checking for LC_MESSAGES" >&5 +echo "configure:2245: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2248 "configure" +#line 2250 "configure" #include "confdefs.h" #include <locale.h> int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:2255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2257: \"$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 @@ -2272,7 +2274,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:2276: checking whether NLS is requested" >&5 +echo "configure:2278: 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" @@ -2292,7 +2294,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:2296: checking whether included gettext is requested" >&5 +echo "configure:2298: 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" @@ -2311,17 +2313,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:2315: checking for libintl.h" >&5 +echo "configure:2317: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2320 "configure" +#line 2322 "configure" #include "confdefs.h" #include <libintl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2325: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2327: \"$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* @@ -2338,19 +2340,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:2342: checking for gettext in libc" >&5 +echo "configure:2344: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2347 "configure" +#line 2349 "configure" #include "confdefs.h" #include <libintl.h> int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:2354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2356: \"$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 @@ -2366,7 +2368,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:2370: checking for bindtextdomain in -lintl" >&5 +echo "configure:2372: 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 @@ -2374,7 +2376,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <<EOF -#line 2378 "configure" +#line 2380 "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 @@ -2385,7 +2387,7 @@ int main() { bindtextdomain() ; return 0; } EOF -if { (eval echo configure:2389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2391: \"$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 @@ -2401,19 +2403,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:2405: checking for gettext in libintl" >&5 +echo "configure:2407: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2410 "configure" +#line 2412 "configure" #include "confdefs.h" int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:2417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2419: \"$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 @@ -2441,7 +2443,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2445: checking for $ac_word" >&5 +echo "configure:2447: 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 @@ -2475,12 +2477,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2479: checking for $ac_func" >&5 +echo "configure:2481: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2484 "configure" +#line 2486 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2503,7 +2505,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2509: \"$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 @@ -2530,7 +2532,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2534: checking for $ac_word" >&5 +echo "configure:2536: 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 @@ -2566,7 +2568,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2570: checking for $ac_word" >&5 +echo "configure:2572: 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 @@ -2598,7 +2600,7 @@ else fi cat > conftest.$ac_ext <<EOF -#line 2602 "configure" +#line 2604 "configure" #include "confdefs.h" int main() { @@ -2606,7 +2608,7 @@ extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:2610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -2638,7 +2640,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2642: checking for $ac_word" >&5 +echo "configure:2644: 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 @@ -2672,7 +2674,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2676: checking for $ac_word" >&5 +echo "configure:2678: 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 @@ -2708,7 +2710,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2712: checking for $ac_word" >&5 +echo "configure:2714: 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 @@ -2798,7 +2800,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:2802: checking for catalogs to be installed" >&5 +echo "configure:2804: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -2826,17 +2828,17 @@ echo "configure:2802: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:2830: checking for linux/version.h" >&5 +echo "configure:2832: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2835 "configure" +#line 2837 "configure" #include "confdefs.h" #include <linux/version.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2840: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2842: \"$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* @@ -3095,6 +3097,194 @@ case $host_os in enable_gdbtk=no ;; esac +# Libunwind support. +# Check whether --with-libunwind or --without-libunwind was given. +if test "${with_libunwind+set}" = set; then + withval="$with_libunwind" + case "${withval}" in + yes) enable_libunwind=yes ;; + no) enable_libunwind=no ;; + *) { echo "configure: error: bad value ${withval} for GDB with-libunwind option" 1>&2; exit 1; } ;; +esac +else + + for ac_hdr in libunwind.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3116: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3121 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3126: \"$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* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + for ac_hdr in libunwind-ia64.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3156: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3161 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3166: \"$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* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + if test x"$ac_cv_header_libunwind_h" = xyes -a x"$ac_cv_header_libunwind_ia64_h" = xyes; then + enable_libunwind=yes; + fi + +fi + + +if test x"$enable_libunwind" = xyes; then + for ac_hdr in libunwind.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3204: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3209 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3214: \"$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* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + for ac_hdr in libunwind-ia64.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3244: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3249 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3254: \"$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* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + cat >> confdefs.h <<\EOF +#define HAVE_LIBUNWIND 1 +EOF + + CONFIG_OBS="$CONFIG_OBS libunwind-frame.o" + CONFIG_DEPS="$CONFIG_DEPS libunwind-frame.o" + CONFIG_SRCS="$CONFIG_SRCS libunwind-frame.c" +fi + # Profiling support. # Check whether --enable-profiling or --disable-profiling was given. if test "${enable_profiling+set}" = set; then @@ -3113,12 +3303,12 @@ fi for ac_func in monstartup _mcleanup do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3117: checking for $ac_func" >&5 +echo "configure:3307: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3122 "configure" +#line 3312 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3141,7 +3331,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3335: \"$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 @@ -3166,12 +3356,12 @@ fi done echo $ac_n "checking for _etext""... $ac_c" 1>&6 -echo "configure:3170: checking for _etext" >&5 +echo "configure:3360: checking for _etext" >&5 if eval "test \"`echo '$''{'ac_cv_var__etext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3175 "configure" +#line 3365 "configure" #include "confdefs.h" #include <stdlib.h> extern char _etext; @@ -3180,7 +3370,7 @@ int main() { free (&_etext); ; return 0; } EOF -if { (eval echo configure:3184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3374: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var__etext=yes else @@ -3208,19 +3398,19 @@ if test "$enable_profiling" = yes ; then CFLAGS="$CFLAGS $PROFILE_CFLAGS" echo $ac_n "checking whether $CC supports -pg""... $ac_c" 1>&6 -echo "configure:3212: checking whether $CC supports -pg" >&5 +echo "configure:3402: checking whether $CC supports -pg" >&5 if eval "test \"`echo '$''{'ac_cv_cc_supports_pg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3217 "configure" +#line 3407 "configure" #include "confdefs.h" int main() { int x; ; return 0; } EOF -if { (eval echo configure:3224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3414: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cc_supports_pg=yes else @@ -3250,7 +3440,7 @@ do # 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:3254: checking for $ac_word" >&5 +echo "configure:3444: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3291,7 +3481,7 @@ done # 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:3295: checking for a BSD compatible install" >&5 +echo "configure:3485: 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 @@ -3344,7 +3534,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:3348: checking whether ln -s works" >&5 +echo "configure:3538: 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 @@ -3367,7 +3557,7 @@ fi # 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:3371: checking for $ac_word" >&5 +echo "configure:3561: 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 @@ -3399,7 +3589,7 @@ do # 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:3403: checking for $ac_word" >&5 +echo "configure:3593: 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 @@ -3433,7 +3623,7 @@ test -n "$YACC" || YACC="yacc" # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3437: checking for $ac_word" >&5 +echo "configure:3627: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3465,7 +3655,7 @@ fi # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3469: checking for $ac_word" >&5 +echo "configure:3659: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3497,7 +3687,7 @@ fi # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. set dummy ${ac_tool_prefix}windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3501: checking for $ac_word" >&5 +echo "configure:3691: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3531,7 +3721,7 @@ fi # Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args. set dummy ${ac_tool_prefix}mig; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3535: checking for $ac_word" >&5 +echo "configure:3725: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3567,7 +3757,7 @@ fi # We might need to link with -lm; most simulators need it. echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:3571: checking for main in -lm" >&5 +echo "configure:3761: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3575,14 +3765,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 3579 "configure" +#line 3769 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:3586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3776: \"$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 @@ -3615,12 +3805,12 @@ fi # libw that some versions of the GNU linker cannot hanle (GNU ld 2.9.1 # is known to have this problem). Therefore we avoid libw if we can. echo $ac_n "checking for wctype""... $ac_c" 1>&6 -echo "configure:3619: checking for wctype" >&5 +echo "configure:3809: checking for wctype" >&5 if eval "test \"`echo '$''{'ac_cv_func_wctype'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3624 "configure" +#line 3814 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char wctype(); below. */ @@ -3643,7 +3833,7 @@ wctype(); ; return 0; } EOF -if { (eval echo configure:3647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_wctype=yes" else @@ -3661,7 +3851,7 @@ if eval "test \"`echo '$ac_cv_func_'wctype`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for wctype in -lw""... $ac_c" 1>&6 -echo "configure:3665: checking for wctype in -lw" >&5 +echo "configure:3855: checking for wctype in -lw" >&5 ac_lib_var=`echo w'_'wctype | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3669,7 +3859,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lw $LIBS" cat > conftest.$ac_ext <<EOF -#line 3673 "configure" +#line 3863 "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 @@ -3680,7 +3870,7 @@ int main() { wctype() ; return 0; } EOF -if { (eval echo configure:3684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3874: \"$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 @@ -3713,14 +3903,14 @@ fi # Some systems (e.g. Solaris) have `gethostbyname' in libnsl. echo $ac_n "checking for library containing gethostbyname""... $ac_c" 1>&6 -echo "configure:3717: checking for library containing gethostbyname" >&5 +echo "configure:3907: checking for library containing gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_search_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_gethostbyname="no" cat > conftest.$ac_ext <<EOF -#line 3724 "configure" +#line 3914 "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 @@ -3731,7 +3921,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:3735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_gethostbyname="none required" else @@ -3742,7 +3932,7 @@ rm -f conftest* test "$ac_cv_search_gethostbyname" = "no" && for i in nsl; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 3746 "configure" +#line 3936 "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 @@ -3753,7 +3943,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:3757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_gethostbyname="-l$i" break @@ -3777,14 +3967,14 @@ fi # Some systems (e.g. Solaris) have `socketpair' in libsocket. echo $ac_n "checking for library containing socketpair""... $ac_c" 1>&6 -echo "configure:3781: checking for library containing socketpair" >&5 +echo "configure:3971: checking for library containing socketpair" >&5 if eval "test \"`echo '$''{'ac_cv_search_socketpair'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_socketpair="no" cat > conftest.$ac_ext <<EOF -#line 3788 "configure" +#line 3978 "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 @@ -3795,7 +3985,7 @@ int main() { socketpair() ; return 0; } EOF -if { (eval echo configure:3799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socketpair="none required" else @@ -3806,7 +3996,7 @@ rm -f conftest* test "$ac_cv_search_socketpair" = "no" && for i in socket; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 3810 "configure" +#line 4000 "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 @@ -3817,7 +4007,7 @@ int main() { socketpair() ; return 0; } EOF -if { (eval echo configure:3821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socketpair="-l$i" break @@ -3853,14 +4043,14 @@ fi if test "$need_curses" = yes; then echo $ac_n "checking for library containing initscr""... $ac_c" 1>&6 -echo "configure:3857: checking for library containing initscr" >&5 +echo "configure:4047: checking for library containing initscr" >&5 if eval "test \"`echo '$''{'ac_cv_search_initscr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_initscr="no" cat > conftest.$ac_ext <<EOF -#line 3864 "configure" +#line 4054 "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 @@ -3871,7 +4061,7 @@ int main() { initscr() ; return 0; } EOF -if { (eval echo configure:3875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_initscr="none required" else @@ -3882,7 +4072,7 @@ rm -f conftest* test "$ac_cv_search_initscr" = "no" && for i in ncurses Hcurses curses; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 3886 "configure" +#line 4076 "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 @@ -3893,7 +4083,7 @@ int main() { initscr() ; return 0; } EOF -if { (eval echo configure:3897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_initscr="-l$i" break @@ -3930,14 +4120,14 @@ case $host_os in # ??? Why? echo $ac_n "checking for library containing tgetent""... $ac_c" 1>&6 -echo "configure:3934: checking for library containing tgetent" >&5 +echo "configure:4124: checking for library containing tgetent" >&5 if eval "test \"`echo '$''{'ac_cv_search_tgetent'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_tgetent="no" cat > conftest.$ac_ext <<EOF -#line 3941 "configure" +#line 4131 "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 @@ -3948,7 +4138,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:3952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetent="none required" else @@ -3959,7 +4149,7 @@ rm -f conftest* test "$ac_cv_search_tgetent" = "no" && for i in tinfo ncurses curses termcap; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 3963 "configure" +#line 4153 "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 @@ -3970,7 +4160,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:3974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetent="-l$i" break @@ -3997,14 +4187,14 @@ esac # Readline doesn't, so I think we're safe with leaving them out. echo $ac_n "checking for library containing tgetent""... $ac_c" 1>&6 -echo "configure:4001: checking for library containing tgetent" >&5 +echo "configure:4191: checking for library containing tgetent" >&5 if eval "test \"`echo '$''{'ac_cv_search_tgetent'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_tgetent="no" cat > conftest.$ac_ext <<EOF -#line 4008 "configure" +#line 4198 "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 @@ -4015,7 +4205,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:4019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetent="none required" else @@ -4026,7 +4216,7 @@ rm -f conftest* test "$ac_cv_search_tgetent" = "no" && for i in termcap tinfo ncurses Hcurses curses; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 4030 "configure" +#line 4220 "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 @@ -4037,7 +4227,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:4041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetent="-l$i" break @@ -4071,12 +4261,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:4075: checking for $ac_hdr that defines DIR" >&5 +echo "configure:4265: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4080 "configure" +#line 4270 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -4084,7 +4274,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:4088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4278: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -4109,7 +4299,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:4113: checking for opendir in -ldir" >&5 +echo "configure:4303: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4117,7 +4307,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 4121 "configure" +#line 4311 "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 @@ -4128,7 +4318,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4132: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4322: \"$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 @@ -4150,7 +4340,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:4154: checking for opendir in -lx" >&5 +echo "configure:4344: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4158,7 +4348,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 4162 "configure" +#line 4352 "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 @@ -4169,7 +4359,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4363: \"$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 @@ -4192,12 +4382,12 @@ fi fi echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:4196: checking whether stat file-mode macros are broken" >&5 +echo "configure:4386: checking whether stat file-mode macros are broken" >&5 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4201 "configure" +#line 4391 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -4248,12 +4438,12 @@ EOF fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:4252: checking for ANSI C header files" >&5 +echo "configure:4442: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4257 "configure" +#line 4447 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -4261,7 +4451,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4265: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4455: \"$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* @@ -4278,7 +4468,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 4282 "configure" +#line 4472 "configure" #include "confdefs.h" #include <string.h> EOF @@ -4296,7 +4486,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 4300 "configure" +#line 4490 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -4317,7 +4507,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 4321 "configure" +#line 4511 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -4328,7 +4518,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:4332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -4355,17 +4545,17 @@ for ac_hdr in link.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4359: checking for $ac_hdr" >&5 +echo "configure:4549: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4364 "configure" +#line 4554 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4369: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4559: \"$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* @@ -4395,17 +4585,17 @@ for ac_hdr in nlist.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4399: checking for $ac_hdr" >&5 +echo "configure:4589: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4404 "configure" +#line 4594 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4409: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4599: \"$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* @@ -4435,17 +4625,17 @@ for ac_hdr in poll.h sys/poll.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4439: checking for $ac_hdr" >&5 +echo "configure:4629: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4444 "configure" +#line 4634 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4639: \"$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* @@ -4475,17 +4665,17 @@ for ac_hdr in proc_service.h thread_db.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4479: checking for $ac_hdr" >&5 +echo "configure:4669: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4484 "configure" +#line 4674 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4489: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4679: \"$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* @@ -4515,17 +4705,17 @@ for ac_hdr in stddef.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4519: checking for $ac_hdr" >&5 +echo "configure:4709: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4524 "configure" +#line 4714 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4529: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4719: \"$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* @@ -4555,17 +4745,17 @@ for ac_hdr in stdlib.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4559: checking for $ac_hdr" >&5 +echo "configure:4749: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4564 "configure" +#line 4754 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4759: \"$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* @@ -4595,17 +4785,17 @@ for ac_hdr in stdint.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4599: checking for $ac_hdr" >&5 +echo "configure:4789: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4604 "configure" +#line 4794 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4609: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4799: \"$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* @@ -4635,17 +4825,17 @@ for ac_hdr in string.h memory.h strings.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4639: checking for $ac_hdr" >&5 +echo "configure:4829: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4644 "configure" +#line 4834 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4649: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4839: \"$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* @@ -4675,17 +4865,17 @@ for ac_hdr in sys/fault.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4679: checking for $ac_hdr" >&5 +echo "configure:4869: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4684 "configure" +#line 4874 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4689: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4879: \"$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* @@ -4715,17 +4905,17 @@ for ac_hdr in sys/file.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4719: checking for $ac_hdr" >&5 +echo "configure:4909: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4724 "configure" +#line 4914 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4919: \"$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* @@ -4755,17 +4945,17 @@ for ac_hdr in sys/filio.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4759: checking for $ac_hdr" >&5 +echo "configure:4949: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4764 "configure" +#line 4954 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4769: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4959: \"$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* @@ -4795,17 +4985,17 @@ for ac_hdr in sys/ioctl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4799: checking for $ac_hdr" >&5 +echo "configure:4989: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4804 "configure" +#line 4994 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4809: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4999: \"$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* @@ -4835,17 +5025,17 @@ for ac_hdr in sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4839: checking for $ac_hdr" >&5 +echo "configure:5029: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4844 "configure" +#line 5034 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4849: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5039: \"$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* @@ -4875,17 +5065,17 @@ for ac_hdr in sys/proc.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4879: checking for $ac_hdr" >&5 +echo "configure:5069: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4884 "configure" +#line 5074 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4889: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5079: \"$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* @@ -4915,17 +5105,17 @@ for ac_hdr in sys/procfs.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4919: checking for $ac_hdr" >&5 +echo "configure:5109: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4924 "configure" +#line 5114 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4929: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5119: \"$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* @@ -4955,17 +5145,17 @@ for ac_hdr in sys/ptrace.h ptrace.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4959: checking for $ac_hdr" >&5 +echo "configure:5149: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4964 "configure" +#line 5154 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4969: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5159: \"$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* @@ -4995,17 +5185,17 @@ for ac_hdr in sys/reg.h sys/debugreg.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4999: checking for $ac_hdr" >&5 +echo "configure:5189: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5004 "configure" +#line 5194 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5009: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5199: \"$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* @@ -5035,17 +5225,17 @@ for ac_hdr in sys/select.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5039: checking for $ac_hdr" >&5 +echo "configure:5229: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5044 "configure" +#line 5234 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5049: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5239: \"$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* @@ -5075,17 +5265,17 @@ for ac_hdr in sys/syscall.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5079: checking for $ac_hdr" >&5 +echo "configure:5269: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5084 "configure" +#line 5274 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5089: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5279: \"$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* @@ -5115,17 +5305,17 @@ for ac_hdr in sys/user.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5119: checking for $ac_hdr" >&5 +echo "configure:5309: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5124 "configure" +#line 5314 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5129: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5319: \"$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* @@ -5155,17 +5345,17 @@ for ac_hdr in sys/wait.h wait.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5159: checking for $ac_hdr" >&5 +echo "configure:5349: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5164 "configure" +#line 5354 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5169: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5359: \"$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* @@ -5195,17 +5385,17 @@ for ac_hdr in termios.h termio.h sgtty.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5199: checking for $ac_hdr" >&5 +echo "configure:5389: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5204 "configure" +#line 5394 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5209: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5399: \"$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* @@ -5235,17 +5425,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5239: checking for $ac_hdr" >&5 +echo "configure:5429: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5244 "configure" +#line 5434 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5249: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5439: \"$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* @@ -5288,17 +5478,17 @@ for ac_hdr in curses.h ncurses.h term.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5292: checking for $ac_hdr" >&5 +echo "configure:5482: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5297 "configure" +#line 5487 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5492: \"$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* @@ -5331,17 +5521,17 @@ for ac_hdr in ctype.h time.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5335: checking for $ac_hdr" >&5 +echo "configure:5525: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5340 "configure" +#line 5530 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5345: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5535: \"$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* @@ -5376,12 +5566,12 @@ for ac_func in getopt do ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` echo $ac_n "checking whether $ac_func is declared""... $ac_c" 1>&6 -echo "configure:5380: checking whether $ac_func is declared" >&5 +echo "configure:5570: checking whether $ac_func is declared" >&5 if eval "test \"`echo '$''{'gcc_cv_have_decl_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5385 "configure" +#line 5575 "configure" #include "confdefs.h" #undef $ac_tr_decl #define $ac_tr_decl 1 @@ -5393,7 +5583,7 @@ char *(*pfn) = (char *(*)) $ac_func ; #endif ; return 0; } EOF -if { (eval echo configure:5397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5587: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "gcc_cv_have_decl_$ac_func=yes" else @@ -5430,12 +5620,12 @@ fi # ------------------ # echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:5434: checking return type of signal handlers" >&5 +echo "configure:5624: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5439 "configure" +#line 5629 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -5452,7 +5642,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:5456: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5646: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -5476,12 +5666,12 @@ EOF # ------------------------------------- # echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:5480: checking for working const" >&5 +echo "configure:5670: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5485 "configure" +#line 5675 "configure" #include "confdefs.h" int main() { @@ -5530,7 +5720,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:5534: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5724: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -5551,21 +5741,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:5555: checking for inline" >&5 +echo "configure:5745: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 5562 "configure" +#line 5752 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:5569: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -5598,19 +5788,19 @@ esac # 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:5602: checking for working alloca.h" >&5 +echo "configure:5792: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5607 "configure" +#line 5797 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:5614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5804: \"$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 @@ -5631,12 +5821,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:5635: checking for alloca" >&5 +echo "configure:5825: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5640 "configure" +#line 5830 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -5664,7 +5854,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:5668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5858: \"$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 @@ -5696,12 +5886,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:5700: checking whether alloca needs Cray hooks" >&5 +echo "configure:5890: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5705 "configure" +#line 5895 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -5726,12 +5916,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5730: checking for $ac_func" >&5 +echo "configure:5920: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5735 "configure" +#line 5925 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5754,7 +5944,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5948: \"$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 @@ -5781,7 +5971,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:5785: checking stack direction for C alloca" >&5 +echo "configure:5975: 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 @@ -5789,7 +5979,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 5793 "configure" +#line 5983 "configure" #include "confdefs.h" find_stack_direction () { @@ -5808,7 +5998,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:5812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6002: \"$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 @@ -5833,17 +6023,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5837: checking for $ac_hdr" >&5 +echo "configure:6027: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5842 "configure" +#line 6032 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5847: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6037: \"$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* @@ -5872,12 +6062,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5876: checking for $ac_func" >&5 +echo "configure:6066: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5881 "configure" +#line 6071 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5900,7 +6090,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6094: \"$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 @@ -5925,7 +6115,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:5929: checking for working mmap" >&5 +echo "configure:6119: 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 @@ -5933,7 +6123,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 5937 "configure" +#line 6127 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6073,7 +6263,7 @@ main() } EOF -if { (eval echo configure:6077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6267: \"$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 @@ -6096,12 +6286,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:6100: checking for pid_t" >&5 +echo "configure:6290: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6105 "configure" +#line 6295 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -6130,17 +6320,17 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:6134: checking for vfork.h" >&5 +echo "configure:6324: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6139 "configure" +#line 6329 "configure" #include "confdefs.h" #include <vfork.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6144: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6334: \"$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* @@ -6165,18 +6355,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:6169: checking for working vfork" >&5 +echo "configure:6359: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:6175: checking for vfork" >&5 +echo "configure:6365: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6180 "configure" +#line 6370 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vfork(); below. */ @@ -6199,7 +6389,7 @@ vfork(); ; return 0; } EOF -if { (eval echo configure:6203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -6221,7 +6411,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext <<EOF -#line 6225 "configure" +#line 6415 "configure" #include "confdefs.h" /* Thanks to Paul Eggert for this test. */ #include <stdio.h> @@ -6316,7 +6506,7 @@ main() { } } EOF -if { (eval echo configure:6320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -6341,12 +6531,12 @@ fi for ac_func in canonicalize_file_name realpath do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6345: checking for $ac_func" >&5 +echo "configure:6535: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6350 "configure" +#line 6540 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6369,7 +6559,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6563: \"$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 @@ -6396,12 +6586,12 @@ done for ac_func in poll do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6400: checking for $ac_func" >&5 +echo "configure:6590: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6405 "configure" +#line 6595 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6424,7 +6614,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6618: \"$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 @@ -6451,12 +6641,12 @@ done for ac_func in pread64 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6455: checking for $ac_func" >&5 +echo "configure:6645: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6460 "configure" +#line 6650 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6479,7 +6669,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6483: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6673: \"$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 @@ -6506,12 +6696,12 @@ done for ac_func in sbrk do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6510: checking for $ac_func" >&5 +echo "configure:6700: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6515 "configure" +#line 6705 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6534,7 +6724,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6728: \"$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 @@ -6561,12 +6751,12 @@ done for ac_func in setpgid setpgrp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6565: checking for $ac_func" >&5 +echo "configure:6755: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6570 "configure" +#line 6760 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6589,7 +6779,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6783: \"$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 @@ -6616,12 +6806,12 @@ done for ac_func in sigaction sigprocmask sigsetmask do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6620: checking for $ac_func" >&5 +echo "configure:6810: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6625 "configure" +#line 6815 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6644,7 +6834,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6838: \"$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 @@ -6671,12 +6861,12 @@ done for ac_func in socketpair do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6675: checking for $ac_func" >&5 +echo "configure:6865: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6680 "configure" +#line 6870 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6699,7 +6889,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6893: \"$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 @@ -6726,12 +6916,12 @@ done for ac_func in syscall do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6730: checking for $ac_func" >&5 +echo "configure:6920: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6735 "configure" +#line 6925 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6754,7 +6944,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6948: \"$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 @@ -6781,7 +6971,7 @@ done if test "$cross_compiling" = no; then echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:6785: checking whether setpgrp takes no argument" >&5 +echo "configure:6975: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6789,7 +6979,7 @@ else { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 6793 "configure" +#line 6983 "configure" #include "confdefs.h" #ifdef HAVE_UNISTD_H @@ -6809,7 +6999,7 @@ main() } EOF -if { (eval echo configure:6813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setpgrp_void=no else @@ -6834,12 +7024,12 @@ fi else echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:6838: checking whether setpgrp takes no argument" >&5 +echo "configure:7028: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6843 "configure" +#line 7033 "configure" #include "confdefs.h" #include <unistd.h> @@ -6853,7 +7043,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6857: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7047: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_func_setpgrp_void=no else @@ -6877,12 +7067,12 @@ fi # Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do # since sigsetjmp might only be defined as a macro. echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6 -echo "configure:6881: checking for sigsetjmp" >&5 +echo "configure:7071: checking for sigsetjmp" >&5 if eval "test \"`echo '$''{'gdb_cv_func_sigsetjmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6886 "configure" +#line 7076 "configure" #include "confdefs.h" #include <setjmp.h> @@ -6891,7 +7081,7 @@ int main() { sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1); ; return 0; } EOF -if { (eval echo configure:6895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_func_sigsetjmp=yes else @@ -6917,12 +7107,12 @@ gdb_use_included_regex=yes # However, if the system regex is GNU regex, then default to *not* # using the included regex. echo $ac_n "checking for GNU regex""... $ac_c" 1>&6 -echo "configure:6921: checking for GNU regex" >&5 +echo "configure:7111: checking for GNU regex" >&5 if eval "test \"`echo '$''{'gdb_cv_have_gnu_regex'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6926 "configure" +#line 7116 "configure" #include "confdefs.h" #include <gnu-versions.h> int main() { @@ -6932,7 +7122,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:6936: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7126: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_gnu_regex=yes else @@ -6967,19 +7157,19 @@ fi # See if <machine/reg.h> supports the %fs and %gs i386 segment registers. # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'. echo $ac_n "checking for r_fs in struct reg""... $ac_c" 1>&6 -echo "configure:6971: checking for r_fs in struct reg" >&5 +echo "configure:7161: checking for r_fs in struct reg" >&5 if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_fs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6976 "configure" +#line 7166 "configure" #include "confdefs.h" #include <machine/reg.h> int main() { struct reg r; r.r_fs; ; return 0; } EOF -if { (eval echo configure:6983: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_struct_reg_r_fs=yes else @@ -6999,19 +7189,19 @@ EOF fi echo $ac_n "checking for r_gs in struct reg""... $ac_c" 1>&6 -echo "configure:7003: checking for r_gs in struct reg" >&5 +echo "configure:7193: checking for r_gs in struct reg" >&5 if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_gs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7008 "configure" +#line 7198 "configure" #include "confdefs.h" #include <machine/reg.h> int main() { struct reg r; r.r_gs; ; return 0; } EOF -if { (eval echo configure:7015: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7205: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_struct_reg_r_gs=yes else @@ -7033,19 +7223,19 @@ fi # See if <sys/ptrace.h> provides the PTRACE_GETREGS request. echo $ac_n "checking for PTRACE_GETREGS""... $ac_c" 1>&6 -echo "configure:7037: checking for PTRACE_GETREGS" >&5 +echo "configure:7227: checking for PTRACE_GETREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7042 "configure" +#line 7232 "configure" #include "confdefs.h" #include <sys/ptrace.h> int main() { PTRACE_GETREGS; ; return 0; } EOF -if { (eval echo configure:7049: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_ptrace_getregs=yes else @@ -7067,19 +7257,19 @@ fi # See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request. echo $ac_n "checking for PTRACE_GETFPXREGS""... $ac_c" 1>&6 -echo "configure:7071: checking for PTRACE_GETFPXREGS" >&5 +echo "configure:7261: checking for PTRACE_GETFPXREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getfpxregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7076 "configure" +#line 7266 "configure" #include "confdefs.h" #include <sys/ptrace.h> int main() { PTRACE_GETFPXREGS; ; return 0; } EOF -if { (eval echo configure:7083: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7273: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_ptrace_getfpxregs=yes else @@ -7101,12 +7291,12 @@ fi # See if <sys/ptrace.h> provides the PT_GETDBREGS request. echo $ac_n "checking for PT_GETDBREGS""... $ac_c" 1>&6 -echo "configure:7105: checking for PT_GETDBREGS" >&5 +echo "configure:7295: checking for PT_GETDBREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_pt_getdbregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7110 "configure" +#line 7300 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ptrace.h> @@ -7114,7 +7304,7 @@ int main() { PT_GETDBREGS; ; return 0; } EOF -if { (eval echo configure:7118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7308: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_pt_getdbregs=yes else @@ -7136,12 +7326,12 @@ fi # See if <sys/ptrace.h> provides the PT_GETXMMREGS request. echo $ac_n "checking for PT_GETXMMREGS""... $ac_c" 1>&6 -echo "configure:7140: checking for PT_GETXMMREGS" >&5 +echo "configure:7330: checking for PT_GETXMMREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_pt_getxmmregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7145 "configure" +#line 7335 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ptrace.h> @@ -7149,7 +7339,7 @@ int main() { PT_GETXMMREGS; ; return 0; } EOF -if { (eval echo configure:7153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7343: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_pt_getxmmregs=yes else @@ -7172,19 +7362,19 @@ fi # See if stdint.h provides the uintptr_t type. # Autoconf 2.5X has an improved AC_CHECK_TYPE which will simplify this. echo $ac_n "checking for uintptr_t in stdint.h""... $ac_c" 1>&6 -echo "configure:7176: checking for uintptr_t in stdint.h" >&5 +echo "configure:7366: checking for uintptr_t in stdint.h" >&5 if eval "test \"`echo '$''{'gdb_cv_have_uintptr_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7181 "configure" +#line 7371 "configure" #include "confdefs.h" #include <stdint.h> int main() { uintptr_t foo = 0; ; return 0; } EOF -if { (eval echo configure:7188: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_uintptr_t=yes else @@ -7205,12 +7395,12 @@ EOF fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:7209: checking whether malloc must be declared" >&5 +echo "configure:7399: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7214 "configure" +#line 7404 "configure" #include "confdefs.h" #include <stdio.h> @@ -7231,7 +7421,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:7235: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7425: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -7252,12 +7442,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:7256: checking whether realloc must be declared" >&5 +echo "configure:7446: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7261 "configure" +#line 7451 "configure" #include "confdefs.h" #include <stdio.h> @@ -7278,7 +7468,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:7282: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7472: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -7299,12 +7489,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:7303: checking whether free must be declared" >&5 +echo "configure:7493: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7308 "configure" +#line 7498 "configure" #include "confdefs.h" #include <stdio.h> @@ -7325,7 +7515,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:7329: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7519: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -7346,12 +7536,12 @@ EOF fi echo $ac_n "checking whether strerror must be declared""... $ac_c" 1>&6 -echo "configure:7350: checking whether strerror must be declared" >&5 +echo "configure:7540: checking whether strerror must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7355 "configure" +#line 7545 "configure" #include "confdefs.h" #include <stdio.h> @@ -7372,7 +7562,7 @@ int main() { char *(*pfn) = (char *(*)) strerror ; return 0; } EOF -if { (eval echo configure:7376: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strerror=no else @@ -7393,12 +7583,12 @@ EOF fi echo $ac_n "checking whether strdup must be declared""... $ac_c" 1>&6 -echo "configure:7397: checking whether strdup must be declared" >&5 +echo "configure:7587: checking whether strdup must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strdup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7402 "configure" +#line 7592 "configure" #include "confdefs.h" #include <stdio.h> @@ -7419,7 +7609,7 @@ int main() { char *(*pfn) = (char *(*)) strdup ; return 0; } EOF -if { (eval echo configure:7423: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strdup=no else @@ -7440,12 +7630,12 @@ EOF fi echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:7444: checking whether strstr must be declared" >&5 +echo "configure:7634: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7449 "configure" +#line 7639 "configure" #include "confdefs.h" #include <stdio.h> @@ -7466,7 +7656,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:7470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7660: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -7487,12 +7677,12 @@ EOF fi echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6 -echo "configure:7491: checking whether canonicalize_file_name must be declared" >&5 +echo "configure:7681: checking whether canonicalize_file_name must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_canonicalize_file_name'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7496 "configure" +#line 7686 "configure" #include "confdefs.h" #include <stdio.h> @@ -7513,7 +7703,7 @@ int main() { char *(*pfn) = (char *(*)) canonicalize_file_name ; return 0; } EOF -if { (eval echo configure:7517: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7707: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_canonicalize_file_name=no else @@ -7539,9 +7729,9 @@ fi # could be expunged. --jsm 1999-03-22 echo $ac_n "checking for HPUX save_state structure""... $ac_c" 1>&6 -echo "configure:7543: checking for HPUX save_state structure" >&5 +echo "configure:7733: checking for HPUX save_state structure" >&5 cat > conftest.$ac_ext <<EOF -#line 7545 "configure" +#line 7735 "configure" #include "confdefs.h" #include <machine/save_state.h> EOF @@ -7556,7 +7746,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 7560 "configure" +#line 7750 "configure" #include "confdefs.h" #include <machine/save_state.h> EOF @@ -7626,12 +7816,12 @@ fi if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7630: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:7820: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7635 "configure" +#line 7825 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -7640,7 +7830,7 @@ int main() { pstatus_t avar ; return 0; } EOF -if { (eval echo configure:7644: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7834: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -7662,12 +7852,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for prrun_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7666: checking for prrun_t in sys/procfs.h" >&5 +echo "configure:7856: checking for prrun_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prrun_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7671 "configure" +#line 7861 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -7676,7 +7866,7 @@ int main() { prrun_t avar ; return 0; } EOF -if { (eval echo configure:7680: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7870: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prrun_t=yes else @@ -7698,12 +7888,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prrun_t" 1>&6 echo $ac_n "checking for gregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7702: checking for gregset_t in sys/procfs.h" >&5 +echo "configure:7892: checking for gregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_gregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7707 "configure" +#line 7897 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -7712,7 +7902,7 @@ int main() { gregset_t avar ; return 0; } EOF -if { (eval echo configure:7716: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_gregset_t=yes else @@ -7734,12 +7924,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_gregset_t" 1>&6 echo $ac_n "checking for fpregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7738: checking for fpregset_t in sys/procfs.h" >&5 +echo "configure:7928: checking for fpregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_fpregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7743 "configure" +#line 7933 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -7748,7 +7938,7 @@ int main() { fpregset_t avar ; return 0; } EOF -if { (eval echo configure:7752: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7942: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_fpregset_t=yes else @@ -7770,12 +7960,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_fpregset_t" 1>&6 echo $ac_n "checking for prgregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7774: checking for prgregset_t in sys/procfs.h" >&5 +echo "configure:7964: checking for prgregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7779 "configure" +#line 7969 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -7784,7 +7974,7 @@ int main() { prgregset_t avar ; return 0; } EOF -if { (eval echo configure:7788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7978: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prgregset_t=yes else @@ -7806,12 +7996,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prgregset_t" 1>&6 echo $ac_n "checking for prfpregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7810: checking for prfpregset_t in sys/procfs.h" >&5 +echo "configure:8000: checking for prfpregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7815 "configure" +#line 8005 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -7820,7 +8010,7 @@ int main() { prfpregset_t avar ; return 0; } EOF -if { (eval echo configure:7824: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prfpregset_t=yes else @@ -7842,12 +8032,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset_t" 1>&6 echo $ac_n "checking for prgregset32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7846: checking for prgregset32_t in sys/procfs.h" >&5 +echo "configure:8036: checking for prgregset32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7851 "configure" +#line 8041 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -7856,7 +8046,7 @@ int main() { prgregset32_t avar ; return 0; } EOF -if { (eval echo configure:7860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prgregset32_t=yes else @@ -7878,12 +8068,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prgregset32_t" 1>&6 echo $ac_n "checking for prfpregset32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7882: checking for prfpregset32_t in sys/procfs.h" >&5 +echo "configure:8072: checking for prfpregset32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7887 "configure" +#line 8077 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -7892,7 +8082,7 @@ int main() { prfpregset32_t avar ; return 0; } EOF -if { (eval echo configure:7896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prfpregset32_t=yes else @@ -7914,12 +8104,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset32_t" 1>&6 echo $ac_n "checking for lwpid_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7918: checking for lwpid_t in sys/procfs.h" >&5 +echo "configure:8108: checking for lwpid_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7923 "configure" +#line 8113 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -7928,7 +8118,7 @@ int main() { lwpid_t avar ; return 0; } EOF -if { (eval echo configure:7932: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpid_t=yes else @@ -7950,12 +8140,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpid_t" 1>&6 echo $ac_n "checking for psaddr_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7954: checking for psaddr_t in sys/procfs.h" >&5 +echo "configure:8144: checking for psaddr_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psaddr_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7959 "configure" +#line 8149 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -7964,7 +8154,7 @@ int main() { psaddr_t avar ; return 0; } EOF -if { (eval echo configure:7968: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psaddr_t=yes else @@ -7986,12 +8176,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psaddr_t" 1>&6 echo $ac_n "checking for prsysent_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7990: checking for prsysent_t in sys/procfs.h" >&5 +echo "configure:8180: checking for prsysent_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prsysent_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7995 "configure" +#line 8185 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8000,7 +8190,7 @@ int main() { prsysent_t avar ; return 0; } EOF -if { (eval echo configure:8004: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8194: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prsysent_t=yes else @@ -8022,12 +8212,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prsysent_t" 1>&6 echo $ac_n "checking for pr_sigset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:8026: checking for pr_sigset_t in sys/procfs.h" >&5 +echo "configure:8216: checking for pr_sigset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8031 "configure" +#line 8221 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8036,7 +8226,7 @@ int main() { pr_sigset_t avar ; return 0; } EOF -if { (eval echo configure:8040: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8230: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_sigset_t=yes else @@ -8058,12 +8248,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pr_sigset_t" 1>&6 echo $ac_n "checking for pr_sigaction64_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:8062: checking for pr_sigaction64_t in sys/procfs.h" >&5 +echo "configure:8252: checking for pr_sigaction64_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigaction64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8067 "configure" +#line 8257 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8072,7 +8262,7 @@ int main() { pr_sigaction64_t avar ; return 0; } EOF -if { (eval echo configure:8076: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8266: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_sigaction64_t=yes else @@ -8094,12 +8284,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pr_sigaction64_t" 1>&6 echo $ac_n "checking for pr_siginfo64_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:8098: checking for pr_siginfo64_t in sys/procfs.h" >&5 +echo "configure:8288: checking for pr_siginfo64_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_siginfo64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8103 "configure" +#line 8293 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -8108,7 +8298,7 @@ int main() { pr_siginfo64_t avar ; return 0; } EOF -if { (eval echo configure:8112: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8302: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_siginfo64_t=yes else @@ -8135,7 +8325,7 @@ EOF if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then echo $ac_n "checking whether prfpregset_t type is broken""... $ac_c" 1>&6 -echo "configure:8139: checking whether prfpregset_t type is broken" >&5 +echo "configure:8329: checking whether prfpregset_t type is broken" >&5 if eval "test \"`echo '$''{'gdb_cv_prfpregset_t_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8143,7 +8333,7 @@ else gdb_cv_prfpregset_t_broken=yes else cat > conftest.$ac_ext <<EOF -#line 8147 "configure" +#line 8337 "configure" #include "confdefs.h" #include <sys/procfs.h> int main () @@ -8153,7 +8343,7 @@ else return 0; } EOF -if { (eval echo configure:8157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8347: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_prfpregset_t_broken=no else @@ -8178,12 +8368,12 @@ EOF echo $ac_n "checking for PIOCSET ioctl entry in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:8182: checking for PIOCSET ioctl entry in sys/procfs.h" >&5 +echo "configure:8372: checking for PIOCSET ioctl entry in sys/procfs.h" >&5 if eval "test \"`echo '$''{'gdb_cv_have_procfs_piocset'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8187 "configure" +#line 8377 "configure" #include "confdefs.h" #include <unistd.h> #include <sys/types.h> @@ -8196,7 +8386,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8200: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_procfs_piocset=yes else @@ -8220,19 +8410,19 @@ fi if test ${host} = ${target} ; then echo $ac_n "checking for member l_addr in struct link_map""... $ac_c" 1>&6 -echo "configure:8224: checking for member l_addr in struct link_map" >&5 +echo "configure:8414: checking for member l_addr in struct link_map" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_l_members'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8229 "configure" +#line 8419 "configure" #include "confdefs.h" #include <link.h> int main() { struct link_map lm; (void) lm.l_addr; ; return 0; } EOF -if { (eval echo configure:8236: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map_with_l_members=yes else @@ -8254,12 +8444,12 @@ EOF echo $ac_n "checking for member lm_addr in struct link_map""... $ac_c" 1>&6 -echo "configure:8258: checking for member lm_addr in struct link_map" >&5 +echo "configure:8448: checking for member lm_addr in struct link_map" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_lm_members'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8263 "configure" +#line 8453 "configure" #include "confdefs.h" #include <sys/types.h> #include <link.h> @@ -8267,7 +8457,7 @@ int main() { struct link_map lm; (void) lm.lm_addr; ; return 0; } EOF -if { (eval echo configure:8271: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8461: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map_with_lm_members=yes else @@ -8289,12 +8479,12 @@ EOF echo $ac_n "checking for member som_addr in struct so_map""... $ac_c" 1>&6 -echo "configure:8293: checking for member som_addr in struct so_map" >&5 +echo "configure:8483: checking for member som_addr in struct so_map" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_so_map_with_som_members'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8298 "configure" +#line 8488 "configure" #include "confdefs.h" #include <sys/types.h> #ifdef HAVE_NLIST_H @@ -8305,7 +8495,7 @@ int main() { struct so_map lm; (void) lm.som_addr; ; return 0; } EOF -if { (eval echo configure:8309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8499: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_so_map_with_som_members=yes else @@ -8327,12 +8517,12 @@ EOF echo $ac_n "checking for struct link_map32 in sys/link.h""... $ac_c" 1>&6 -echo "configure:8331: checking for struct link_map32 in sys/link.h" >&5 +echo "configure:8521: checking for struct link_map32 in sys/link.h" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8336 "configure" +#line 8526 "configure" #include "confdefs.h" #define _SYSCALL32 #include <sys/link.h> @@ -8340,7 +8530,7 @@ int main() { struct link_map32 l; ; return 0; } EOF -if { (eval echo configure:8344: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8534: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map32=yes else @@ -8367,12 +8557,12 @@ fi echo $ac_n "checking for long long support in compiler""... $ac_c" 1>&6 -echo "configure:8371: checking for long long support in compiler" >&5 +echo "configure:8561: checking for long long support in compiler" >&5 if eval "test \"`echo '$''{'gdb_cv_c_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8376 "configure" +#line 8566 "configure" #include "confdefs.h" int main() { @@ -8382,7 +8572,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8386: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_c_long_long=yes else @@ -8404,7 +8594,7 @@ fi echo $ac_n "checking for long long support in printf""... $ac_c" 1>&6 -echo "configure:8408: checking for long long support in printf" >&5 +echo "configure:8598: checking for long long support in printf" >&5 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8412,7 +8602,7 @@ else gdb_cv_printf_has_long_long=no else cat > conftest.$ac_ext <<EOF -#line 8416 "configure" +#line 8606 "configure" #include "confdefs.h" int main () { @@ -8426,7 +8616,7 @@ int main () { return (strcmp ("0x0123456789abcdef", buf)); } EOF -if { (eval echo configure:8430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_printf_has_long_long=yes else @@ -8450,19 +8640,19 @@ echo "$ac_t""$gdb_cv_printf_has_long_long" 1>&6 echo $ac_n "checking for long double support in compiler""... $ac_c" 1>&6 -echo "configure:8454: checking for long double support in compiler" >&5 +echo "configure:8644: checking for long double support in compiler" >&5 if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8459 "configure" +#line 8649 "configure" #include "confdefs.h" int main() { long double foo; ; return 0; } EOF -if { (eval echo configure:8466: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_long_double=yes else @@ -8484,7 +8674,7 @@ fi echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6 -echo "configure:8488: checking for long double support in printf" >&5 +echo "configure:8678: checking for long double support in printf" >&5 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8492,7 +8682,7 @@ else gdb_cv_printf_has_long_double=no else cat > conftest.$ac_ext <<EOF -#line 8496 "configure" +#line 8686 "configure" #include "confdefs.h" int main () { @@ -8502,7 +8692,7 @@ int main () { return (strncmp ("3.14159", buf, 7)); } EOF -if { (eval echo configure:8506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_printf_has_long_double=yes else @@ -8526,7 +8716,7 @@ echo "$ac_t""$gdb_cv_printf_has_long_double" 1>&6 echo $ac_n "checking for long double support in scanf""... $ac_c" 1>&6 -echo "configure:8530: checking for long double support in scanf" >&5 +echo "configure:8720: checking for long double support in scanf" >&5 if eval "test \"`echo '$''{'gdb_cv_scanf_has_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8534,7 +8724,7 @@ else gdb_cv_scanf_has_long_double=no else cat > conftest.$ac_ext <<EOF -#line 8538 "configure" +#line 8728 "configure" #include "confdefs.h" int main () { @@ -8544,7 +8734,7 @@ int main () { return !(f > 3.14159 && f < 3.14160); } EOF -if { (eval echo configure:8548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_scanf_has_long_double=yes else @@ -8569,7 +8759,7 @@ echo "$ac_t""$gdb_cv_scanf_has_long_double" 1>&6 case ${host_os} in aix*) echo $ac_n "checking for -bbigtoc option""... $ac_c" 1>&6 -echo "configure:8573: checking for -bbigtoc option" >&5 +echo "configure:8763: checking for -bbigtoc option" >&5 if eval "test \"`echo '$''{'gdb_cv_bigtoc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8583,14 +8773,14 @@ else LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc cat > conftest.$ac_ext <<EOF -#line 8587 "configure" +#line 8777 "configure" #include "confdefs.h" int main() { int i; ; return 0; } EOF -if { (eval echo configure:8594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -8613,7 +8803,7 @@ if test ${build} = ${host} -a ${host} = ${target} ; then case ${host_os} in hpux*) echo $ac_n "checking for HPUX/OSF thread support""... $ac_c" 1>&6 -echo "configure:8617: checking for HPUX/OSF thread support" >&5 +echo "configure:8807: checking for HPUX/OSF thread support" >&5 if test -f /usr/include/dce/cma_config.h ; then if test "$GCC" = "yes" ; then echo "$ac_t""yes" 1>&6 @@ -8636,7 +8826,7 @@ EOF # because version 0 (present on Solaris 2.4 or earlier) doesn't have # the same API. echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6 -echo "configure:8640: checking for Solaris thread debugging library" >&5 +echo "configure:8830: checking for Solaris thread debugging library" >&5 if test -f /usr/lib/libthread_db.so.1 ; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -8646,7 +8836,7 @@ EOF CONFIG_LIB_OBS="${CONFIG_LIB_OBS} sol-thread.o" CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:8650: checking for dlopen in -ldl" >&5 +echo "configure:8840: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8654,7 +8844,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 8658 "configure" +#line 8848 "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 @@ -8665,7 +8855,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:8669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8859: \"$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 @@ -8697,17 +8887,17 @@ fi # all symbols visible in the dynamic symbol table. hold_ldflags=$LDFLAGS echo $ac_n "checking for the ld -export-dynamic flag""... $ac_c" 1>&6 -echo "configure:8701: checking for the ld -export-dynamic flag" >&5 +echo "configure:8891: checking for the ld -export-dynamic flag" >&5 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" cat > conftest.$ac_ext <<EOF -#line 8704 "configure" +#line 8894 "configure" #include "confdefs.h" int main() { int i; ; return 0; } EOF -if { (eval echo configure:8711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* found=yes else @@ -8726,13 +8916,13 @@ rm -f conftest* # Sun randomly tweaked the prototypes in <proc_service.h> # at one point. echo $ac_n "checking if <proc_service.h> is old""... $ac_c" 1>&6 -echo "configure:8730: checking if <proc_service.h> is old" >&5 +echo "configure:8920: checking if <proc_service.h> is old" >&5 if eval "test \"`echo '$''{'gdb_cv_proc_service_is_old'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8736 "configure" +#line 8926 "configure" #include "confdefs.h" #include <proc_service.h> @@ -8743,7 +8933,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8747: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8937: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_proc_service_is_old=no else @@ -8769,12 +8959,12 @@ EOF ;; aix*) echo $ac_n "checking for AiX thread debugging library""... $ac_c" 1>&6 -echo "configure:8773: checking for AiX thread debugging library" >&5 +echo "configure:8963: checking for AiX thread debugging library" >&5 if eval "test \"`echo '$''{'gdb_cv_have_aix_thread_debug'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8778 "configure" +#line 8968 "configure" #include "confdefs.h" #include <sys/pthdebug.h> int main() { @@ -8783,7 +8973,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:8787: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_aix_thread_debug=yes else @@ -8808,19 +8998,19 @@ fi if test "x$ac_cv_header_thread_db_h" = "xyes"; then echo $ac_n "checking whether <thread_db.h> has TD_NOTALLOC""... $ac_c" 1>&6 -echo "configure:8812: checking whether <thread_db.h> has TD_NOTALLOC" >&5 +echo "configure:9002: checking whether <thread_db.h> has TD_NOTALLOC" >&5 if eval "test \"`echo '$''{'gdb_cv_thread_db_h_has_td_notalloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8817 "configure" +#line 9007 "configure" #include "confdefs.h" #include <thread_db.h> int main() { int i = TD_NOTALLOC; ; return 0; } EOF -if { (eval echo configure:8824: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_thread_db_h_has_td_notalloc=yes else @@ -8845,19 +9035,19 @@ fi if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then echo $ac_n "checking whether <sys/syscall.h> has __NR_tkill""... $ac_c" 1>&6 -echo "configure:8849: checking whether <sys/syscall.h> has __NR_tkill" >&5 +echo "configure:9039: checking whether <sys/syscall.h> has __NR_tkill" >&5 if eval "test \"`echo '$''{'gdb_cv_sys_syscall_h_has_tkill'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8854 "configure" +#line 9044 "configure" #include "confdefs.h" #include <sys/syscall.h> int main() { int i = __NR_tkill; ; return 0; } EOF -if { (eval echo configure:8861: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9051: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_sys_syscall_h_has_tkill=yes else @@ -8968,7 +9158,7 @@ WERROR_CFLAGS="" if test "x${build_warnings}" != x -a "x$GCC" = xyes then echo $ac_n "checking compiler warning flags""... $ac_c" 1>&6 -echo "configure:8972: checking compiler warning flags" >&5 +echo "configure:9162: checking compiler warning flags" >&5 # Separate out the -Werror flag as some files just cannot be # compiled with it enabled. for w in ${build_warnings}; do @@ -8978,14 +9168,14 @@ echo "configure:8972: checking compiler warning flags" >&5 saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $w" cat > conftest.$ac_ext <<EOF -#line 8982 "configure" +#line 9172 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:8989: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* WARN_CFLAGS="${WARN_CFLAGS} $w" else @@ -9033,12 +9223,12 @@ fi # In the Cygwin environment, we need some additional flags. echo $ac_n "checking for cygwin""... $ac_c" 1>&6 -echo "configure:9037: checking for cygwin" >&5 +echo "configure:9227: checking for cygwin" >&5 if eval "test \"`echo '$''{'gdb_cv_os_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9042 "configure" +#line 9232 "configure" #include "confdefs.h" #if defined (__CYGWIN__) || defined (__CYGWIN32__) @@ -9116,7 +9306,7 @@ if test "${with_tclconfig+set}" = set; then fi echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6 -echo "configure:9120: checking for Tcl configuration" >&5 +echo "configure:9310: checking for Tcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9225,7 +9415,7 @@ if test "${with_tkconfig+set}" = set; then fi echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6 -echo "configure:9229: checking for Tk configuration" >&5 +echo "configure:9419: checking for Tk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9334,7 +9524,7 @@ fi no_tcl=true echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6 -echo "configure:9338: checking for Tcl private headers. dir=${configdir}" >&5 +echo "configure:9528: checking for Tcl private headers. dir=${configdir}" >&5 # Check whether --with-tclinclude or --without-tclinclude was given. if test "${with_tclinclude+set}" = set; then withval="$with_tclinclude" @@ -9400,17 +9590,17 @@ fi if test x"${ac_cv_c_tclh}" = x ; then ac_safe=`echo "tclInt.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tclInt.h""... $ac_c" 1>&6 -echo "configure:9404: checking for tclInt.h" >&5 +echo "configure:9594: checking for tclInt.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9409 "configure" +#line 9599 "configure" #include "confdefs.h" #include <tclInt.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9414: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9604: \"$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* @@ -9470,7 +9660,7 @@ fi # no_tk=true echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 -echo "configure:9474: checking for Tk private headers" >&5 +echo "configure:9664: checking for Tk private headers" >&5 # Check whether --with-tkinclude or --without-tkinclude was given. if test "${with_tkinclude+set}" = set; then withval="$with_tkinclude" @@ -9536,17 +9726,17 @@ fi if test x"${ac_cv_c_tkh}" = x ; then ac_safe=`echo "tk.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tk.h""... $ac_c" 1>&6 -echo "configure:9540: checking for tk.h" >&5 +echo "configure:9730: checking for tk.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9545 "configure" +#line 9735 "configure" #include "confdefs.h" #include <tk.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9550: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9740: \"$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* @@ -9592,7 +9782,7 @@ fi echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:9596: checking for Itcl private headers. srcdir=${srcdir}" >&5 +echo "configure:9786: checking for Itcl private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_itclh}" = x ; then for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do if test -f $i/generic/itcl.h ; then @@ -9615,7 +9805,7 @@ fi echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:9619: checking for Itk private headers. srcdir=${srcdir}" >&5 +echo "configure:9809: checking for Itk private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_itkh}" = x ; then for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do if test -f $i/generic/itk.h ; then @@ -9670,7 +9860,7 @@ if test "${with_itclconfig+set}" = set; then fi echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6 -echo "configure:9674: checking for Itcl configuration" >&5 +echo "configure:9864: checking for Itcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_itclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9773,7 +9963,7 @@ if test "${with_itkconfig+set}" = set; then fi echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6 -echo "configure:9777: checking for Itk configuration" >&5 +echo "configure:9967: checking for Itk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_itkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9916,7 +10106,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:9920: checking for X" >&5 +echo "configure:10110: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -9978,12 +10168,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext <<EOF -#line 9982 "configure" +#line 10172 "configure" #include "confdefs.h" #include <$x_direct_test_include> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9987: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10177: \"$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* @@ -10052,14 +10242,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <<EOF -#line 10056 "configure" +#line 10246 "configure" #include "confdefs.h" int main() { ${x_direct_test_function}() ; return 0; } EOF -if { (eval echo configure:10063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -10273,7 +10463,7 @@ fi # We only build gdbserver automatically if host and target are the same. if test "x$target" = "x$host"; then echo $ac_n "checking whether gdbserver is supported on this host""... $ac_c" 1>&6 -echo "configure:10277: checking whether gdbserver is supported on this host" >&5 +echo "configure:10467: checking whether gdbserver is supported on this host" >&5 if test "x$build_gdbserver" = xyes; then configdirs="$configdirs gdbserver" echo "$ac_t""yes" 1>&6 @@ -10337,12 +10527,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:10341: checking for Cygwin environment" >&5 +echo "configure:10531: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10346 "configure" +#line 10536 "configure" #include "confdefs.h" int main() { @@ -10353,7 +10543,7 @@ int main() { return __CYGWIN__; ; return 0; } EOF -if { (eval echo configure:10357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10547: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -10370,19 +10560,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:10374: checking for mingw32 environment" >&5 +echo "configure:10564: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10379 "configure" +#line 10569 "configure" #include "confdefs.h" int main() { return __MINGW32__; ; return 0; } EOF -if { (eval echo configure:10386: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -10401,7 +10591,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:10405: checking for executable suffix" >&5 +echo "configure:10595: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10411,7 +10601,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:10415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:10605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; @@ -10453,7 +10643,7 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:10457: checking for iconv" >&5 +echo "configure:10647: checking for iconv" >&5 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10461,7 +10651,7 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat > conftest.$ac_ext <<EOF -#line 10465 "configure" +#line 10655 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> @@ -10471,7 +10661,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:10475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_func_iconv=yes else @@ -10483,7 +10673,7 @@ rm -f conftest* am_save_LIBS="$LIBS" LIBS="$LIBS -liconv" cat > conftest.$ac_ext <<EOF -#line 10487 "configure" +#line 10677 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> @@ -10493,7 +10683,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:10497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_lib_iconv=yes am_cv_func_iconv=yes @@ -10514,13 +10704,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6 EOF echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:10518: checking for iconv declaration" >&5 +echo "configure:10708: checking for iconv declaration" >&5 if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10524 "configure" +#line 10714 "configure" #include "confdefs.h" #include <stdlib.h> @@ -10539,7 +10729,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:10543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_proto_iconv_arg1="" else diff --git a/gdb/configure.host b/gdb/configure.host index 1c0f9c7..723d87c 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -77,31 +77,31 @@ i[34567]86-*-cygwin*) gdb_host=cygwin ;; ia64-*-aix*) gdb_host=aix ;; ia64-*-linux*) gdb_host=linux ;; -m680[01]0-sun-sunos3*) gdb_host=sun2os3 ;; -m680[01]0-sun-sunos4*) gdb_host=sun2os4 ;; +# OBSOLETE m680[01]0-sun-sunos3*) gdb_host=sun2os3 ;; +# OBSOLETE m680[01]0-sun-sunos4*) gdb_host=sun2os4 ;; -m68*-att-*) gdb_host=3b1 ;; -m68*-bull*-sysv*) gdb_host=dpx2 ;; +# OBSOLETE m68*-att-*) gdb_host=3b1 ;; +# OBSOLETE m68*-bull*-sysv*) gdb_host=dpx2 ;; m68*-*-linux*) gdb_host=linux ;; -m68*-*-lynxos*) gdb_host=m68klynx ;; +# OBSOLETE m68*-*-lynxos*) gdb_host=m68klynx ;; m68*-*-netbsd*) gdb_host=nbsdaout ;; -m68*-*-sysv4*) gdb_host=m68kv4 ;; -m68*-motorola-*) gdb_host=delta68 ;; -m68*-sun-sunos3*) gdb_host=sun3os3 ;; -m68*-sun-sunos4*) gdb_host=sun3os4 ;; -m68*-sun-*) gdb_host=sun3os4 ;; - -mips-dec-*) gdb_host=decstation ;; -mips-little-*) gdb_host=littlemips ;; +# OBSOLETE m68*-*-sysv4*) gdb_host=m68kv4 ;; +# OBSOLETE m68*-motorola-*) gdb_host=delta68 ;; +# OBSOLETE m68*-sun-sunos3*) gdb_host=sun3os3 ;; +# OBSOLETE m68*-sun-sunos4*) gdb_host=sun3os4 ;; +# OBSOLETE m68*-sun-*) gdb_host=sun3os4 ;; + +# OBSOLETE mips-dec-*) gdb_host=decstation ;; +# OBSOLETE mips-little-*) gdb_host=littlemips ;; mips-sgi-irix5*) gdb_host=irix5 ;; mips-sgi-irix6*) gdb_host=irix6 ;; -mips-sony-*) gdb_host=news-mips ;; +# OBSOLETE mips-sony-*) gdb_host=news-mips ;; mips*-*-linux*) gdb_host=linux ;; mips*-*-netbsd*) gdb_host=nbsd ;; -mips-*-mach3*) gdb_host=mipsm3 ;; -mips-*-sysv4*) gdb_host=mipsv4 ;; -mips-*-sysv*) gdb_host=riscos ;; -mips-*-riscos*) gdb_host=riscos ;; +# OBSOLETE mips-*-mach3*) gdb_host=mipsm3 ;; +# OBSOLETE mips-*-sysv4*) gdb_host=mipsv4 ;; +# OBSOLETE mips-*-sysv*) gdb_host=riscos ;; +# OBSOLETE mips-*-riscos*) gdb_host=riscos ;; none-*-*) gdb_host=none ;; diff --git a/gdb/configure.in b/gdb/configure.in index e5bccdf..da44f30 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -192,6 +192,30 @@ case $host_os in enable_gdbtk=no ;; esac +# Libunwind support. +AC_ARG_WITH(libunwind, +[ --with-libunwind Use libunwind frame unwinding support], +[case "${withval}" in + yes) enable_libunwind=yes ;; + no) enable_libunwind=no ;; + *) AC_MSG_ERROR(bad value ${withval} for GDB with-libunwind option) ;; +esac],[ + AC_CHECK_HEADERS(libunwind.h) + AC_CHECK_HEADERS(libunwind-ia64.h) + if test x"$ac_cv_header_libunwind_h" = xyes -a x"$ac_cv_header_libunwind_ia64_h" = xyes; then + enable_libunwind=yes; + fi +]) + +if test x"$enable_libunwind" = xyes; then + AC_CHECK_HEADERS(libunwind.h) + AC_CHECK_HEADERS(libunwind-ia64.h) + AC_DEFINE(HAVE_LIBUNWIND, 1) + CONFIG_OBS="$CONFIG_OBS libunwind-frame.o" + CONFIG_DEPS="$CONFIG_DEPS libunwind-frame.o" + CONFIG_SRCS="$CONFIG_SRCS libunwind-frame.c" +fi + # Profiling support. AC_ARG_ENABLE(profiling, [ --enable-profiling enable profiling of GDB], diff --git a/gdb/configure.tgt b/gdb/configure.tgt index fdaf9ec..d150ccf 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -108,13 +108,13 @@ m32r-*-*) gdb_target=m32r ;; m68hc11*-*-*|m6811*-*-*) gdb_target=m68hc11 ;; -m68000-*-sunos3*) gdb_target=sun2os3 ;; -m68000-*-sunos4*) gdb_target=sun2os4 ;; +# OBSOLETE m68000-*-sunos3*) gdb_target=sun2os3 ;; +# OBSOLETE m68000-*-sunos4*) gdb_target=sun2os4 ;; -m68*-bull-sysv*) gdb_target=dpx2 ;; -m68*-att-*) gdb_target=3b1 ;; +# OBSOLETE m68*-bull-sysv*) gdb_target=dpx2 ;; +# OBSOLETE m68*-att-*) gdb_target=3b1 ;; m68*-cisco*-*) gdb_target=cisco ;; -m68*-motorola-*) gdb_target=delta68 ;; +# OBSOLETE m68*-motorola-*) gdb_target=delta68 ;; m68*-netx-*) gdb_target=vxworks68 ;; m68*-tandem-*) gdb_target=st2000 ;; m68*-*-aout*) gdb_target=monitor ;; @@ -123,33 +123,25 @@ m68*-*-elf*) gdb_target=monitor ;; m68*-*-linux*) gdb_target=linux build_gdbserver=yes ;; -m68*-*-lynxos*) gdb_target=m68klynx ;; +# OBSOLETE m68*-*-lynxos*) gdb_target=m68klynx ;; m68*-*-netbsd*) gdb_target=nbsdaout ;; m68*-*-os68k*) gdb_target=os68k ;; -m68*-*-sunos3*) gdb_target=sun3os3 ;; -m68*-*-sunos4*) gdb_target=sun3os4 ;; -m68*-*-sysv4*) gdb_target=m68kv4 ;; +# OBSOLETE m68*-*-sunos3*) gdb_target=sun3os3 ;; +# OBSOLETE m68*-*-sunos4*) gdb_target=sun3os4 ;; +# OBSOLETE m68*-*-sysv4*) gdb_target=m68kv4 ;; m68*-*-vxworks*) gdb_target=vxworks68 ;; mcore*-*-*) gdb_target=mcore ;; -# "mipsisa64" targets are 64-bit MIPS, MIPS64 ISA. They need these -# special cases because otherwise they (obviously) are not matched by -# the "mips64" target cases, and would therefore be treated as 32-bit. -mipsisa64*-*-linux*) gdb_target=linux64 ;; -mipsisa64*-*-*) gdb_target=embed64 ;; mips*-*-pe) gdb_target=wince ;; -mips*tx39*-elf*) gdb_target=tx39 ;; -mips64*-*-linux*) gdb_target=linux64 ;; mips*-sgi-irix5*) gdb_target=irix5 ;; mips*-sgi-irix6*) gdb_target=irix6 ;; mips*-*-linux*) gdb_target=linux build_gdbserver=yes ;; mips*-*-netbsd*) gdb_target=nbsd ;; -mips*-*-sysv4*) gdb_target=mipsv4 ;; +# OBSOLETE mips*-*-sysv4*) gdb_target=mipsv4 ;; mips*-*-vxworks*) gdb_target=vxmips ;; -mips64*-*-*) gdb_target=embed64 ;; mips*-*-*) gdb_target=embed ;; mn10300-*-*) gdb_target=mn10300 ;; diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c index 43361fc..a853020 100644 --- a/gdb/cp-abi.c +++ b/gdb/cp-abi.c @@ -1,5 +1,5 @@ /* Generic code for supporting multiple C++ ABI's - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index f7ec530..d7714ef 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -349,7 +349,7 @@ cp_lookup_symbol_nonlocal (const char *name, cp_lookup_symbol_nonlocal. For example, if we're within a function A::B::f and looking for a - symbol f, this will get called with NAME = "f", SCOPE = "A::B", and + symbol x, this will get called with NAME = "x", SCOPE = "A::B", and SCOPE_LEN = 0. It then calls itself with NAME and SCOPE the same, but with SCOPE_LEN = 1. And then it calls itself with NAME and SCOPE the same, but with SCOPE_LEN = 4. This third call looks for diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 037f355..662df37 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -34,6 +34,7 @@ #include "symtab.h" #include "block.h" #include "complaints.h" +#include "gdbtypes.h" /* Functions related to demangled name parsing. */ @@ -153,7 +154,7 @@ class_name_from_physname (const char *physname) char *ret = NULL; const char *end; int depth = 0; - char *demangled_name = cplus_demangle (physname, DMGL_ANSI); + char *demangled_name = cplus_demangle (physname, DMGL_ANSI | DMGL_PARAMS); if (demangled_name == NULL) return NULL; @@ -178,7 +179,7 @@ method_name_from_physname (const char *physname) char *ret = NULL; const char *end; int depth = 0; - char *demangled_name = cplus_demangle (physname, DMGL_ANSI); + char *demangled_name = cplus_demangle (physname, DMGL_ANSI | DMGL_PARAMS); if (demangled_name == NULL) return NULL; @@ -687,6 +688,49 @@ read_in_psymtabs (const char *func_name) } } +/* Lookup the rtti type for a class name. */ + +struct type * +cp_lookup_rtti_type (const char *name, struct block *block) +{ + struct symbol * rtti_sym; + struct type * rtti_type; + + rtti_sym = lookup_symbol (name, block, STRUCT_DOMAIN, NULL, NULL); + + if (rtti_sym == NULL) + { + warning ("RTTI symbol not found for class '%s'", name); + return NULL; + } + + if (SYMBOL_CLASS (rtti_sym) != LOC_TYPEDEF) + { + warning ("RTTI symbol for class '%s' is not a type", name); + return NULL; + } + + rtti_type = SYMBOL_TYPE (rtti_sym); + + switch (TYPE_CODE (rtti_type)) + { + case TYPE_CODE_CLASS: + break; + case TYPE_CODE_NAMESPACE: + /* chastain/2003-11-26: the symbol tables often contain fake + symbols for namespaces with the same name as the struct. + This warning is an indication of a bug in the lookup order + or a bug in the way that the symbol tables are populated. */ + warning ("RTTI symbol for class '%s' is a namespace", name); + return NULL; + default: + warning ("RTTI symbol for class '%s' has bad type", name); + return NULL; + } + + return rtti_type; +} + /* Don't allow just "maintenance cplus". */ static void diff --git a/gdb/cp-support.h b/gdb/cp-support.h index a4edf0c..ed31592 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -34,6 +34,7 @@ struct symbol; struct obstack; struct block; struct objfile; +struct type; /* This struct is designed to store data from using directives. It says that names from namespace INNER should be visible within @@ -66,6 +67,9 @@ extern char *remove_params (const char *demangled_name); extern struct symbol **make_symbol_overload_list (const char *, const char *); +extern struct type *cp_lookup_rtti_type (const char *name, + struct block *block); + /* Functions/variables from cp-namespace.c. */ extern unsigned char processing_has_namespace_info; diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 59c5d79..5d02367 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -64,14 +64,6 @@ #include "aout/stab_gnu.h" /* We always use GNU stabs, not native, now */ -/* This macro returns the size field of a minimal symbol, which is normally - stored in the "info" field. The macro can be overridden for specific - targets (e.g. MIPS16) that use the info field for other purposes. */ -#ifndef MSYMBOL_SIZE -#define MSYMBOL_SIZE(msym) ((long) MSYMBOL_INFO (msym)) -#endif - - /* We put a pointer to this structure in the read_symtab_private field of the psymtab. */ @@ -491,7 +483,7 @@ record_minimal_symbol (char *name, CORE_ADDR address, int type, Record it as global even if it's local, not global, so lookup_minimal_symbol can find it. We don't check symbol_leading_char because for SunOS4 it always is '_'. */ - if (name[8] == 'C' && STREQ ("__DYNAMIC", name)) + if (name[8] == 'C' && DEPRECATED_STREQ ("__DYNAMIC", name)) ms_type = mst_data; /* Same with virtual function tables, both global and static. */ @@ -2519,13 +2511,13 @@ read_ofile_symtab (struct partial_symtab *pst) { const char *tempstring = namestring; - if (STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL)) + if (DEPRECATED_STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL)) processing_gcc_compilation = 1; - else if (STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL)) + else if (DEPRECATED_STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL)) processing_gcc_compilation = 2; if (tempstring[0] == bfd_get_symbol_leading_char (symfile_bfd)) ++tempstring; - if (STREQN (tempstring, "__gnu_compiled", 14)) + if (DEPRECATED_STREQN (tempstring, "__gnu_compiled", 14)) processing_gcc_compilation = 2; } @@ -2591,9 +2583,9 @@ read_ofile_symtab (struct partial_symtab *pst) However, there is no reason not to accept the GCC_COMPILED_FLAG_SYMBOL anywhere. */ - if (STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL)) + if (DEPRECATED_STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL)) processing_gcc_compilation = 1; - else if (STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL)) + else if (DEPRECATED_STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL)) processing_gcc_compilation = 2; #if 0 @@ -154,8 +154,19 @@ typedef bfd_vma CORE_ADDR; issue is found that we spend the effort on algorithmic optimizations than micro-optimizing.'' J.T. */ -#define STREQ(a,b) (*(a) == *(b) ? !strcmp ((a), (b)) : 0) -#define STREQN(a,b,c) (*(a) == *(b) ? !strncmp ((a), (b), (c)) : 0) +/* NOTE: cagney/2003-11-23: All instances of STREQ[N] covered by + testing GDB on a stabs system have been replaced by equivalent + str[n]cmp calls. To avoid the possability of introducing bugs when + making untested changes, the remaining references were deprecated + rather than replaced. */ + +/* DISCLAIMER: cagney/2003-11-23: Simplified definition of these + macros so that they just map directly onto strcmp equivalent. I'm + not responsible for any breakage due to code that relied on the old + underlying implementation. */ + +#define DEPRECATED_STREQ(a,b) (strcmp ((a), (b)) == 0) +#define DEPRECATED_STREQN(a,b,c) (strncmp ((a), (b), (c)) == 0) /* Check if a character is one of the commonly used C++ marker characters. */ extern int is_cplus_marker (int); diff --git a/gdb/dve3900-rom.c b/gdb/dve3900-rom.c index 665179f..fe2fced 100644 --- a/gdb/dve3900-rom.c +++ b/gdb/dve3900-rom.c @@ -29,6 +29,7 @@ #include "gdb_string.h" #include <time.h> #include "regcache.h" +#include "mips-tdep.h" /* Type of function passed to bfd_map_over_sections. */ @@ -121,11 +122,11 @@ static char *r3900_regnames[] = "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", "S", /* PS_REGNUM */ - "l", /* LO_REGNUM */ - "h", /* HI_REGNUM */ - "B", /* BADVADDR_REGNUM */ - "Pcause", /* CAUSE_REGNUM */ - "p" /* PC_REGNUM */ + "l", /* MIPS_EMBED_LO_REGNUM */ + "h", /* MIPS_EMBED_HI_REGNUM */ + "B", /* MIPS_EMBED_BADVADDR_REGNUM */ + "Pcause", /* MIPS_EMBED_CAUSE_REGNUM */ + "p" /* MIPS_EMBED_PC_REGNUM */ }; @@ -267,19 +268,19 @@ reg_table[] = } , { - "HI", HI_REGNUM + "HI", MIPS_EMBED_HI_REGNUM } , { - "LO", LO_REGNUM + "LO", MIPS_EMBED_LO_REGNUM } , { - "PC", PC_REGNUM + "PC", MIPS_EMBED_PC_REGNUM } , { - "BadV", BADVADDR_REGNUM + "BadV", MIPS_EMBED_BADVADDR_REGNUM } , { @@ -420,7 +421,7 @@ fetch_bad_vaddr (void) monitor_printf ("xB\r"); monitor_expect ("BadV=", NULL, 0); monitor_expect_prompt (buf, sizeof (buf)); - monitor_supply_register (BADVADDR_REGNUM, buf); + monitor_supply_register (mips_regnum (current_gdbarch)->badvaddr, buf); } @@ -485,20 +486,15 @@ fetch_bitmapped_register (int regno, struct bit_field *bf) static void r3900_fetch_registers (int regno) { - switch (regno) - { - case BADVADDR_REGNUM: - fetch_bad_vaddr (); - return; - case PS_REGNUM: - fetch_bitmapped_register (PS_REGNUM, status_fields); - return; - case CAUSE_REGNUM: - fetch_bitmapped_register (CAUSE_REGNUM, cause_fields); - return; - default: - orig_monitor_fetch_registers (regno); - } + if (regno == mips_regnum (current_gdbarch)->badvaddr) + fetch_bad_vaddr (); + else if (regno == PS_REGNUM) + fetch_bitmapped_register (PS_REGNUM, status_fields); + else if (regno == mips_regnum (current_gdbarch)->cause) + fetch_bitmapped_register (mips_regnum (current_gdbarch)->cause, + cause_fields); + else + orig_monitor_fetch_registers (regno); } @@ -544,17 +540,13 @@ store_bitmapped_register (int regno, struct bit_field *bf) static void r3900_store_registers (int regno) { - switch (regno) - { - case PS_REGNUM: - store_bitmapped_register (PS_REGNUM, status_fields); - return; - case CAUSE_REGNUM: - store_bitmapped_register (CAUSE_REGNUM, cause_fields); - return; - default: - orig_monitor_store_registers (regno); - } + if (regno == PS_REGNUM) + store_bitmapped_register (PS_REGNUM, status_fields); + else if (regno == mips_regnum (current_gdbarch)->cause) + store_bitmapped_register (mips_regnum (current_gdbarch)->cause, + cause_fields); + else + orig_monitor_store_registers (regno); } @@ -648,7 +640,7 @@ debug_write (unsigned char *buf, int buflen) static void ignore_packet (void) { - int c; + int c = -1; int len; /* Ignore lots of trash (messages about section addresses, for example) diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index 6e420cd..59f4481 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -99,19 +99,18 @@ static struct dwarf2_fde *dwarf2_frame_find_fde (CORE_ADDR *pc); enum dwarf2_reg_rule { - /* Make certain that 0 maps onto the correct enum value - the + /* Make certain that 0 maps onto the correct enum value; the corresponding structure is being initialized using memset zero. This indicates that CFI didn't provide any information at all - about a register - leaving how to obtain it's value totally + about a register, leaving how to obtain its value totally unspecified. */ REG_UNSPECIFIED = 0, /* The term "undefined" comes from the DWARF2 CFI spec which this - code is moddeling - it indicates that the register's value is - "undefined". */ - /* NOTE: cagney/2003-09-08: GCC uses the less formal term "unsaved" - - it's definition is a combination of REG_UNDEFINED and - REG_UNSPECIFIED - the failure to differentiate the two helps - explain a few problems with the CFI GCC outputs. */ + code is moddeling; it indicates that the register's value is + "undefined". GCC uses the less formal term "unsaved". Its + definition is a combination of REG_UNDEFINED and REG_UNSPECIFIED. + The failure to differentiate the two helps explain a few problems + with the CFI generated by GCC. */ REG_UNDEFINED, REG_SAVED_OFFSET, REG_SAVED_REG, @@ -500,18 +499,15 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) to abort), the compiler might optimize away the instruction at NEXT_FRAME's return address. As a result the return address will point at some random instruction, and the CFI for that - instruction is probably wortless to us. GCC's unwinder solves + instruction is probably worthless to us. GCC's unwinder solves this problem by substracting 1 from the return address to get an address in the middle of a presumed call instruction (or the instruction in the associated delay slot). This should only be done for "normal" frames and not for resume-type frames (signal - handlers, sentinel frames, dummy frames). - - frame_unwind_address_in_block does just this. - - It's not clear how reliable the method is though - there is the - potential for the register state pre-call being different to that - on return. */ + handlers, sentinel frames, dummy frames). The function + frame_unwind_address_in_block does just this. It's not clear how + reliable the method is though; there is the potential for the + register state pre-call being different to that on return. */ fs->pc = frame_unwind_address_in_block (next_frame); /* Find the correct FDE. */ @@ -555,6 +551,7 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) unspecified. */ { int regnum; + for (regnum = 0; regnum < num_regs; regnum++) cache->reg[regnum].how = REG_UNSPECIFIED; } @@ -563,6 +560,7 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) location information in the cache. */ { int column; /* CFI speak for "register number". */ + for (column = 0; column < fs->regs.num_regs; column++) { int regnum; @@ -573,9 +571,10 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) RETADDR_COLUMN corresponds to a real register (and, worse, that isn't the PC_REGNUM)? I'm guessing that the PC_REGNUM further down is trying to handle this. That - can't be right though - PC_REGNUM may not be valid (it - can be -ve). I think, instead when RETADDR_COLUM isn't a - real register, it should map itself onto frame_pc_unwind. */ + can't be right though; PC_REGNUM may not be valid (it can + be negative). I think, instead when RETADDR_COLUM isn't + a real register, it should map itself onto + frame_pc_unwind. */ continue; /* Use the GDB register number as the destination index. */ @@ -586,15 +585,15 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) continue; /* NOTE: cagney/2003-09-05: CFI should specify the disposition - of all debug info registers. If it doesn't complain (but - not too loudly). It turns out that GCC, assumes that an + of all debug info registers. If it doesn't, complain (but + not too loudly). It turns out that GCC assumes that an unspecified register implies "same value" when CFI (draft 7) specifies nothing at all. Such a register could equally be interpreted as "undefined". Also note that this check - isn't sufficient - it only checks that all registers in the - range [0 .. max column] are specified - and won't detect + isn't sufficient; it only checks that all registers in the + range [0 .. max column] are specified, and won't detect problems when a debug info register falls outside of the - table. Need a way of iterating through all the valid + table. We need a way of iterating through all the valid DWARF2 register numbers. */ if (fs->regs.reg[column].how == REG_UNSPECIFIED) complaint (&symfile_complaints, @@ -606,27 +605,26 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) } /* Store the location of the return addess. If the return address - column (adjusted) is not the same as gdb's PC_REGNUM, then this - implies a copy from the ra column register. */ + column (adjusted) is not the same as GDB's PC_REGNUM, then this + implies a copy from the return address column register. */ if (fs->retaddr_column < fs->regs.num_regs && fs->regs.reg[fs->retaddr_column].how != REG_UNDEFINED) { - /* See comment above about a possibly -ve PC_REGNUM. If this - assertion fails, it's a problem with this code and not the - architecture. */ + /* See comment above about a possibly negative PC_REGNUM. If + this assertion fails, it's a problem with this code and not + the architecture. */ gdb_assert (PC_REGNUM >= 0); cache->reg[PC_REGNUM] = fs->regs.reg[fs->retaddr_column]; } else { - int reg = DWARF2_REG_TO_REGNUM (fs->retaddr_column); - if (reg != PC_REGNUM) + if (DWARF2_REG_TO_REGNUM (fs->retaddr_column) != PC_REGNUM) { - /* See comment above about PC_REGNUM being -ve. If this - assertion fails, it's a problem with this code and not - the architecture. */ + /* See comment above about PC_REGNUM being negative. If + this assertion fails, it's a problem with this code and + not the architecture. */ gdb_assert (PC_REGNUM >= 0); - cache->reg[PC_REGNUM].loc.reg = reg; + cache->reg[PC_REGNUM].loc.reg = fs->retaddr_column; cache->reg[PC_REGNUM].how = REG_SAVED_REG; } } @@ -660,7 +658,7 @@ dwarf2_frame_prev_register (struct frame_info *next_frame, void **this_cache, { case REG_UNDEFINED: /* If CFI explicitly specified that the value isn't defined, - mark it as optimized away - the value isn't available. */ + mark it as optimized away; the value isn't available. */ *optimizedp = 1; *lvalp = not_lval; *addrp = 0; @@ -681,8 +679,8 @@ dwarf2_frame_prev_register (struct frame_info *next_frame, void **this_cache, /* FIXME: cagney/2003-07-07: I don't understand this. The CFI info should have provided unwind information for the SP register and then pointed ->cfa_reg at it, not the - reverse. Assuming that SP_REGNUM is !-ve, there is a - very real posibility that CFA is an offset from some + reverse. Assuming that SP_REGNUM isn't negative, there + is a very real posibility that CFA is an offset from some other register, having nothing to do with the unwound SP value. */ /* FIXME: cagney/2003-09-05: I think I understand. GDB was @@ -770,7 +768,7 @@ dwarf2_frame_prev_register (struct frame_info *next_frame, void **this_cache, defines the rule which computes the CFA value; it may be either a register and a signed offset that are added together or a DWARF expression that is evaluated. */ - /* NOTE: cagney/2003-09-05: Should issue a complain. + /* NOTE: cagney/2003-09-05: Should issue a complaint. Unfortunately it turns out that DWARF2 CFI has a problem. Since CFI specifies the location at which a register was saved (not its value) it isn't possible to specify @@ -1508,16 +1506,11 @@ decode_frame_entry (struct comp_unit *unit, char *start, int eh_frame_p) dwarf2read.c in a better way. */ /* Imported from dwarf2read.c. */ -extern file_ptr dwarf_frame_offset; -extern unsigned int dwarf_frame_size; extern asection *dwarf_frame_section; -extern file_ptr dwarf_eh_frame_offset; -extern unsigned int dwarf_eh_frame_size; extern asection *dwarf_eh_frame_section; /* Imported from dwarf2read.c. */ -extern char *dwarf2_read_section (struct objfile *objfile, file_ptr offset, - unsigned int size, asection *sectp); +extern char *dwarf2_read_section (struct objfile *objfile, asection *sectp); void dwarf2_build_frame_info (struct objfile *objfile) @@ -1534,17 +1527,16 @@ dwarf2_build_frame_info (struct objfile *objfile) /* First add the information from the .eh_frame section. That way, the FDEs from that section are searched last. */ - if (dwarf_eh_frame_offset) + if (dwarf_eh_frame_section) { asection *got, *txt; unit.cie = NULL; unit.dwarf_frame_buffer = dwarf2_read_section (objfile, - dwarf_eh_frame_offset, - dwarf_eh_frame_size, dwarf_eh_frame_section); - unit.dwarf_frame_size = dwarf_eh_frame_size; + unit.dwarf_frame_size + = bfd_get_section_size_before_reloc (dwarf_eh_frame_section); unit.dwarf_frame_section = dwarf_eh_frame_section; /* FIXME: kettenis/20030602: This is the DW_EH_PE_datarel base @@ -1566,14 +1558,13 @@ dwarf2_build_frame_info (struct objfile *objfile) frame_ptr = decode_frame_entry (&unit, frame_ptr, 1); } - if (dwarf_frame_offset) + if (dwarf_frame_section) { unit.cie = NULL; unit.dwarf_frame_buffer = dwarf2_read_section (objfile, - dwarf_frame_offset, - dwarf_frame_size, dwarf_frame_section); - unit.dwarf_frame_size = dwarf_frame_size; + unit.dwarf_frame_size + = bfd_get_section_size_before_reloc (dwarf_frame_section); unit.dwarf_frame_section = dwarf_frame_section; frame_ptr = unit.dwarf_frame_buffer; diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 33146a8..8074324 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -128,18 +128,6 @@ _STATEMENT_PROLOGUE; /* offsets and sizes of debugging sections */ -static file_ptr dwarf_info_offset; -static file_ptr dwarf_abbrev_offset; -static file_ptr dwarf_line_offset; -static file_ptr dwarf_pubnames_offset; -static file_ptr dwarf_aranges_offset; -static file_ptr dwarf_loc_offset; -static file_ptr dwarf_macinfo_offset; -static file_ptr dwarf_str_offset; -static file_ptr dwarf_ranges_offset; -file_ptr dwarf_frame_offset; -file_ptr dwarf_eh_frame_offset; - static unsigned int dwarf_info_size; static unsigned int dwarf_abbrev_size; static unsigned int dwarf_line_size; @@ -230,6 +218,20 @@ struct comp_unit_head int base_known; }; +/* Internal state when decoding a particular compilation unit. */ +struct dwarf2_cu +{ + /* The objfile containing this compilation unit. */ + struct objfile *objfile; + + /* The header of the compilation unit. + + FIXME drow/2003-11-10: Some of the things from the comp_unit_head + should be moved to the dwarf2_cu structure; for instance the abbrevs + hash table. */ + struct comp_unit_head header; +}; + /* The line number information for a compilation unit (found in the .debug_line section) begins with a "statement program header", which contains the following information. */ @@ -429,31 +431,9 @@ static struct pending **list_in_scope = &file_symbols; none of the flags are set, the object lives at the address returned by decode_locdesc. */ -static int optimized_out; /* No ops in location in expression, - so object was optimized out. */ static int isreg; /* Object lives in register. decode_locdesc's return value is the register number. */ -static int offreg; /* Object's address is the sum of the - register specified by basereg, plus - the offset returned. */ -static int basereg; /* See `offreg'. */ -static int isderef; /* Value described by flags above is - the address of a pointer to the object. */ -static int islocal; /* Variable is at the returned offset - from the frame start, but there's - no identified frame pointer for - this function, so we can't say - which register it's relative to; - use LOC_LOCAL. */ - -/* DW_AT_frame_base values for the current function. - frame_base_reg is -1 if DW_AT_frame_base is missing, otherwise it - contains the register number for the frame register. - frame_base_offset is the offset from the frame register to the - virtual stack frame. */ -static int frame_base_reg; -static CORE_ADDR frame_base_offset; /* This value is added to each symbol value. FIXME: Generalize to the section_offsets structure used by dbxread (once this is done, @@ -678,67 +658,60 @@ static void dwarf2_build_psymtabs_easy (struct objfile *, int); static void dwarf2_build_psymtabs_hard (struct objfile *, int); -static char *scan_partial_symbols (char *, struct objfile *, - CORE_ADDR *, CORE_ADDR *, - const struct comp_unit_head *, +static char *scan_partial_symbols (char *, CORE_ADDR *, CORE_ADDR *, + struct dwarf2_cu *, const char *namespace); -static void add_partial_symbol (struct partial_die_info *, struct objfile *, - const struct comp_unit_head *, +static void add_partial_symbol (struct partial_die_info *, struct dwarf2_cu *, const char *namespace); static int pdi_needs_namespace (enum dwarf_tag tag, const char *namespace); static char *add_partial_namespace (struct partial_die_info *pdi, char *info_ptr, - struct objfile *objfile, CORE_ADDR *lowpc, CORE_ADDR *highpc, - const struct comp_unit_head *cu_header, + struct dwarf2_cu *cu, const char *namespace); static char *add_partial_structure (struct partial_die_info *struct_pdi, char *info_ptr, - struct objfile *objfile, - const struct comp_unit_head *cu_header, + struct dwarf2_cu *cu, const char *namespace); static char *add_partial_enumeration (struct partial_die_info *enum_pdi, char *info_ptr, - struct objfile *objfile, - const struct comp_unit_head *cu_header, + struct dwarf2_cu *cu, const char *namespace); static char *locate_pdi_sibling (struct partial_die_info *orig_pdi, char *info_ptr, bfd *abfd, - const struct comp_unit_head *cu_header); + struct dwarf2_cu *cu); static void dwarf2_psymtab_to_symtab (struct partial_symtab *); static void psymtab_to_symtab_1 (struct partial_symtab *); -char *dwarf2_read_section (struct objfile *, file_ptr, unsigned int, - asection *); +char *dwarf2_read_section (struct objfile *, asection *); -static void dwarf2_read_abbrevs (bfd *abfd, struct comp_unit_head *cu_header); +static void dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu); static void dwarf2_empty_abbrev_table (void *); static struct abbrev_info *dwarf2_lookup_abbrev (unsigned int, - const struct comp_unit_head *cu_header); + struct dwarf2_cu *); static char *read_partial_die (struct partial_die_info *, - bfd *, char *, - const struct comp_unit_head *); + bfd *, char *, struct dwarf2_cu *); static char *read_full_die (struct die_info **, bfd *, char *, - const struct comp_unit_head *, int *); + struct dwarf2_cu *, int *); static char *read_attribute (struct attribute *, struct attr_abbrev *, - bfd *, char *, const struct comp_unit_head *); + bfd *, char *, struct dwarf2_cu *); static char *read_attribute_value (struct attribute *, unsigned, - bfd *, char *, const struct comp_unit_head *); + bfd *, char *, struct dwarf2_cu *); static unsigned int read_1_byte (bfd *, char *); @@ -750,7 +723,7 @@ static unsigned int read_4_bytes (bfd *, char *); static unsigned long read_8_bytes (bfd *, char *); -static CORE_ADDR read_address (bfd *, char *ptr, const struct comp_unit_head *, +static CORE_ADDR read_address (bfd *, char *ptr, struct dwarf2_cu *, int *bytes_read); static LONGEST read_initial_length (bfd *, char *, @@ -782,39 +755,35 @@ static void free_line_header (struct line_header *lh); static struct line_header *(dwarf_decode_line_header (unsigned int offset, - bfd *abfd, - const struct comp_unit_head *cu_header)); + bfd *abfd, struct dwarf2_cu *cu)); static void dwarf_decode_lines (struct line_header *, char *, bfd *, - const struct comp_unit_head *); + struct dwarf2_cu *); static void dwarf2_start_subfile (char *, char *); static struct symbol *new_symbol (struct die_info *, struct type *, - struct objfile *, const struct comp_unit_head *); + struct dwarf2_cu *); static void dwarf2_const_value (struct attribute *, struct symbol *, - struct objfile *, const struct comp_unit_head *); + struct dwarf2_cu *); static void dwarf2_const_value_data (struct attribute *attr, struct symbol *sym, int bits); -static struct type *die_type (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static struct type *die_type (struct die_info *, struct dwarf2_cu *); -static struct type *die_containing_type (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static struct type *die_containing_type (struct die_info *, + struct dwarf2_cu *); #if 0 static struct type *type_at_offset (unsigned int, struct objfile *); #endif -static struct type *tag_type_to_type (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static struct type *tag_type_to_type (struct die_info *, struct dwarf2_cu *); -static void read_type_die (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_type_die (struct die_info *, struct dwarf2_cu *); static char *determine_prefix (struct die_info *die); @@ -822,95 +791,77 @@ static char *typename_concat (const char *prefix, const char *suffix); static char *class_name (struct die_info *die); -static void read_typedef (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_typedef (struct die_info *, struct dwarf2_cu *); -static void read_base_type (struct die_info *, struct objfile *); +static void read_base_type (struct die_info *, struct dwarf2_cu *); -static void read_file_scope (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_file_scope (struct die_info *, struct dwarf2_cu *); -static void read_func_scope (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_func_scope (struct die_info *, struct dwarf2_cu *); -static void read_lexical_block_scope (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_lexical_block_scope (struct die_info *, struct dwarf2_cu *); static int dwarf2_get_pc_bounds (struct die_info *, - CORE_ADDR *, CORE_ADDR *, struct objfile *, - const struct comp_unit_head *); + CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *); static void get_scope_pc_bounds (struct die_info *, - CORE_ADDR *, CORE_ADDR *, struct objfile *, - const struct comp_unit_head *); + CORE_ADDR *, CORE_ADDR *, + struct dwarf2_cu *); static void dwarf2_add_field (struct field_info *, struct die_info *, - struct objfile *, const struct comp_unit_head *); + struct dwarf2_cu *); static void dwarf2_attach_fields_to_type (struct field_info *, - struct type *, struct objfile *); + struct type *, struct dwarf2_cu *); static void dwarf2_add_member_fn (struct field_info *, struct die_info *, struct type *, - struct objfile *objfile, - const struct comp_unit_head *); + struct dwarf2_cu *); static void dwarf2_attach_fn_fields_to_type (struct field_info *, - struct type *, struct objfile *); + struct type *, struct dwarf2_cu *); -static void read_structure_scope (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_structure_scope (struct die_info *, struct dwarf2_cu *); -static void read_common_block (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_common_block (struct die_info *, struct dwarf2_cu *); -static void read_namespace (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header); +static void read_namespace (struct die_info *die, struct dwarf2_cu *); static const char *namespace_name (struct die_info *die, int *is_anonymous); -static void read_enumeration (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_enumeration (struct die_info *, struct dwarf2_cu *); -static struct type *dwarf_base_type (int, int, struct objfile *); +static struct type *dwarf_base_type (int, int, struct dwarf2_cu *); -static CORE_ADDR decode_locdesc (struct dwarf_block *, struct objfile *, - const struct comp_unit_head *); +static CORE_ADDR decode_locdesc (struct dwarf_block *, struct dwarf2_cu *); -static void read_array_type (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_array_type (struct die_info *, struct dwarf2_cu *); -static void read_tag_pointer_type (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_tag_pointer_type (struct die_info *, struct dwarf2_cu *); -static void read_tag_ptr_to_member_type (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_tag_ptr_to_member_type (struct die_info *, + struct dwarf2_cu *); -static void read_tag_reference_type (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_tag_reference_type (struct die_info *, struct dwarf2_cu *); -static void read_tag_const_type (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_tag_const_type (struct die_info *, struct dwarf2_cu *); -static void read_tag_volatile_type (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_tag_volatile_type (struct die_info *, struct dwarf2_cu *); -static void read_tag_string_type (struct die_info *, struct objfile *); +static void read_tag_string_type (struct die_info *, struct dwarf2_cu *); -static void read_subroutine_type (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void read_subroutine_type (struct die_info *, struct dwarf2_cu *); -static struct die_info *read_comp_unit (char *, bfd *, - const struct comp_unit_head *); +static struct die_info *read_comp_unit (char *, bfd *, struct dwarf2_cu *); static struct die_info *read_die_and_children (char *info_ptr, bfd *abfd, - const struct comp_unit_head *, + struct dwarf2_cu *, char **new_info_ptr, struct die_info *parent); static struct die_info *read_die_and_siblings (char *info_ptr, bfd *abfd, - const struct comp_unit_head *, + struct dwarf2_cu *, char **new_info_ptr, struct die_info *parent); @@ -918,8 +869,7 @@ static void free_die_list (struct die_info *); static struct cleanup *make_cleanup_free_die_list (struct die_info *); -static void process_die (struct die_info *, struct objfile *, - const struct comp_unit_head *); +static void process_die (struct die_info *, struct dwarf2_cu *); static char *dwarf2_linkage_name (struct die_info *); @@ -976,15 +926,13 @@ static void initialize_cu_func_list (void); static void add_to_cu_func_list (char *, CORE_ADDR, CORE_ADDR); static void dwarf_decode_macros (struct line_header *, unsigned int, - char *, bfd *, const struct comp_unit_head *, - struct objfile *); + char *, bfd *, struct dwarf2_cu *); static int attr_form_is_block (struct attribute *); static void dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, - const struct comp_unit_head *, - struct objfile *objfile); + struct dwarf2_cu *cu); /* Try to locate the sections we need for DWARF 2 debugging information and return true if we have enough to do something. */ @@ -992,25 +940,18 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, int dwarf2_has_info (bfd *abfd) { - dwarf_info_offset = 0; - dwarf_abbrev_offset = 0; - dwarf_line_offset = 0; - dwarf_str_offset = 0; - dwarf_macinfo_offset = 0; - dwarf_frame_offset = 0; - dwarf_eh_frame_offset = 0; - dwarf_ranges_offset = 0; - dwarf_loc_offset = 0; + dwarf_info_section = 0; + dwarf_abbrev_section = 0; + dwarf_line_section = 0; + dwarf_str_section = 0; + dwarf_macinfo_section = 0; + dwarf_frame_section = 0; + dwarf_eh_frame_section = 0; + dwarf_ranges_section = 0; + dwarf_loc_section = 0; bfd_map_over_sections (abfd, dwarf2_locate_sections, NULL); - if (dwarf_info_offset && dwarf_abbrev_offset) - { - return 1; - } - else - { - return 0; - } + return (dwarf_info_section != NULL && dwarf_abbrev_section != NULL); } /* This function is mapped across the sections and remembers the @@ -1022,55 +963,46 @@ dwarf2_locate_sections (bfd *ignore_abfd, asection *sectp, void *ignore_ptr) { if (strcmp (sectp->name, INFO_SECTION) == 0) { - dwarf_info_offset = sectp->filepos; dwarf_info_size = bfd_get_section_size_before_reloc (sectp); dwarf_info_section = sectp; } else if (strcmp (sectp->name, ABBREV_SECTION) == 0) { - dwarf_abbrev_offset = sectp->filepos; dwarf_abbrev_size = bfd_get_section_size_before_reloc (sectp); dwarf_abbrev_section = sectp; } else if (strcmp (sectp->name, LINE_SECTION) == 0) { - dwarf_line_offset = sectp->filepos; dwarf_line_size = bfd_get_section_size_before_reloc (sectp); dwarf_line_section = sectp; } else if (strcmp (sectp->name, PUBNAMES_SECTION) == 0) { - dwarf_pubnames_offset = sectp->filepos; dwarf_pubnames_size = bfd_get_section_size_before_reloc (sectp); dwarf_pubnames_section = sectp; } else if (strcmp (sectp->name, ARANGES_SECTION) == 0) { - dwarf_aranges_offset = sectp->filepos; dwarf_aranges_size = bfd_get_section_size_before_reloc (sectp); dwarf_aranges_section = sectp; } else if (strcmp (sectp->name, LOC_SECTION) == 0) { - dwarf_loc_offset = sectp->filepos; dwarf_loc_size = bfd_get_section_size_before_reloc (sectp); dwarf_loc_section = sectp; } else if (strcmp (sectp->name, MACINFO_SECTION) == 0) { - dwarf_macinfo_offset = sectp->filepos; dwarf_macinfo_size = bfd_get_section_size_before_reloc (sectp); dwarf_macinfo_section = sectp; } else if (strcmp (sectp->name, STR_SECTION) == 0) { - dwarf_str_offset = sectp->filepos; dwarf_str_size = bfd_get_section_size_before_reloc (sectp); dwarf_str_section = sectp; } else if (strcmp (sectp->name, FRAME_SECTION) == 0) { - dwarf_frame_offset = sectp->filepos; dwarf_frame_size = bfd_get_section_size_before_reloc (sectp); dwarf_frame_section = sectp; } @@ -1079,14 +1011,12 @@ dwarf2_locate_sections (bfd *ignore_abfd, asection *sectp, void *ignore_ptr) flagword aflag = bfd_get_section_flags (ignore_abfd, sectp); if (aflag & SEC_HAS_CONTENTS) { - dwarf_eh_frame_offset = sectp->filepos; dwarf_eh_frame_size = bfd_get_section_size_before_reloc (sectp); dwarf_eh_frame_section = sectp; } } else if (strcmp (sectp->name, RANGES_SECTION) == 0) { - dwarf_ranges_offset = sectp->filepos; dwarf_ranges_size = bfd_get_section_size_before_reloc (sectp); dwarf_ranges_section = sectp; } @@ -1100,52 +1030,32 @@ dwarf2_build_psymtabs (struct objfile *objfile, int mainline) /* We definitely need the .debug_info and .debug_abbrev sections */ - dwarf_info_buffer = dwarf2_read_section (objfile, - dwarf_info_offset, - dwarf_info_size, - dwarf_info_section); - dwarf_abbrev_buffer = dwarf2_read_section (objfile, - dwarf_abbrev_offset, - dwarf_abbrev_size, - dwarf_abbrev_section); - - if (dwarf_line_offset) - dwarf_line_buffer = dwarf2_read_section (objfile, - dwarf_line_offset, - dwarf_line_size, - dwarf_line_section); + dwarf_info_buffer = dwarf2_read_section (objfile, dwarf_info_section); + dwarf_abbrev_buffer = dwarf2_read_section (objfile, dwarf_abbrev_section); + + if (dwarf_line_section) + dwarf_line_buffer = dwarf2_read_section (objfile, dwarf_line_section); else dwarf_line_buffer = NULL; - if (dwarf_str_offset) - dwarf_str_buffer = dwarf2_read_section (objfile, - dwarf_str_offset, - dwarf_str_size, - dwarf_str_section); + if (dwarf_str_section) + dwarf_str_buffer = dwarf2_read_section (objfile, dwarf_str_section); else dwarf_str_buffer = NULL; - if (dwarf_macinfo_offset) + if (dwarf_macinfo_section) dwarf_macinfo_buffer = dwarf2_read_section (objfile, - dwarf_macinfo_offset, - dwarf_macinfo_size, dwarf_macinfo_section); else dwarf_macinfo_buffer = NULL; - if (dwarf_ranges_offset) - dwarf_ranges_buffer = dwarf2_read_section (objfile, - dwarf_ranges_offset, - dwarf_ranges_size, - dwarf_ranges_section); + if (dwarf_ranges_section) + dwarf_ranges_buffer = dwarf2_read_section (objfile, dwarf_ranges_section); else dwarf_ranges_buffer = NULL; - if (dwarf_loc_offset) - dwarf_loc_buffer = dwarf2_read_section (objfile, - dwarf_loc_offset, - dwarf_loc_size, - dwarf_loc_section); + if (dwarf_loc_section) + dwarf_loc_buffer = dwarf2_read_section (objfile, dwarf_loc_section); else dwarf_loc_buffer = NULL; @@ -1186,8 +1096,6 @@ dwarf2_build_psymtabs_easy (struct objfile *objfile, int mainline) unsigned int entry_length, version, info_offset, info_size; pubnames_buffer = dwarf2_read_section (objfile, - dwarf_pubnames_offset, - dwarf_pubnames_size, dwarf_pubnames_section); pubnames_ptr = pubnames_buffer; while ((pubnames_ptr - pubnames_buffer) < dwarf_pubnames_size) @@ -1207,8 +1115,6 @@ dwarf2_build_psymtabs_easy (struct objfile *objfile, int mainline) } aranges_buffer = dwarf2_read_section (objfile, - dwarf_aranges_offset, - dwarf_aranges_size, dwarf_aranges_section); } @@ -1306,44 +1212,46 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) left at all should be sufficient. */ while (info_ptr < dwarf_info_buffer + dwarf_info_size) { - struct comp_unit_head cu_header; + struct dwarf2_cu cu; beg_of_comp_unit = info_ptr; - info_ptr = read_comp_unit_head (&cu_header, info_ptr, abfd); - if (cu_header.version != 2) + cu.objfile = objfile; + info_ptr = read_comp_unit_head (&cu.header, info_ptr, abfd); + + if (cu.header.version != 2) { - error ("Dwarf Error: wrong version in compilation unit header (is %d, should be %d) [in module %s]", cu_header.version, 2, bfd_get_filename (abfd)); + error ("Dwarf Error: wrong version in compilation unit header (is %d, should be %d) [in module %s]", cu.header.version, 2, bfd_get_filename (abfd)); return; } - if (cu_header.abbrev_offset >= dwarf_abbrev_size) + if (cu.header.abbrev_offset >= dwarf_abbrev_size) { error ("Dwarf Error: bad offset (0x%lx) in compilation unit header (offset 0x%lx + 6) [in module %s]", - (long) cu_header.abbrev_offset, + (long) cu.header.abbrev_offset, (long) (beg_of_comp_unit - dwarf_info_buffer), bfd_get_filename (abfd)); return; } - if (beg_of_comp_unit + cu_header.length + cu_header.initial_length_size + if (beg_of_comp_unit + cu.header.length + cu.header.initial_length_size > dwarf_info_buffer + dwarf_info_size) { error ("Dwarf Error: bad length (0x%lx) in compilation unit header (offset 0x%lx + 0) [in module %s]", - (long) cu_header.length, + (long) cu.header.length, (long) (beg_of_comp_unit - dwarf_info_buffer), bfd_get_filename (abfd)); return; } /* Complete the cu_header */ - cu_header.offset = beg_of_comp_unit - dwarf_info_buffer; - cu_header.first_die_ptr = info_ptr; - cu_header.cu_head_ptr = beg_of_comp_unit; + cu.header.offset = beg_of_comp_unit - dwarf_info_buffer; + cu.header.first_die_ptr = info_ptr; + cu.header.cu_head_ptr = beg_of_comp_unit; /* Read the abbrevs for this compilation unit into a table */ - dwarf2_read_abbrevs (abfd, &cu_header); - make_cleanup (dwarf2_empty_abbrev_table, cu_header.dwarf2_abbrevs); + dwarf2_read_abbrevs (abfd, &cu); + make_cleanup (dwarf2_empty_abbrev_table, cu.header.dwarf2_abbrevs); /* Read the compilation unit die */ info_ptr = read_partial_die (&comp_unit_die, abfd, info_ptr, - &cu_header); + &cu); /* Set the language we're debugging */ set_cu_language (comp_unit_die.language); @@ -1385,8 +1293,8 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) lowpc = ((CORE_ADDR) -1); highpc = ((CORE_ADDR) 0); - info_ptr = scan_partial_symbols (info_ptr, objfile, &lowpc, &highpc, - &cu_header, NULL); + info_ptr = scan_partial_symbols (info_ptr, &lowpc, &highpc, + &cu, NULL); /* If we didn't find a lowpc, set it to highpc to avoid complaints from `maint check'. */ @@ -1415,8 +1323,8 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) also happen.) This happens in VxWorks. */ free_named_symtabs (pst->filename); - info_ptr = beg_of_comp_unit + cu_header.length - + cu_header.initial_length_size; + info_ptr = beg_of_comp_unit + cu.header.length + + cu.header.initial_length_size; } do_cleanups (back_to); } @@ -1429,11 +1337,11 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) previously encountered a DW_TAG_namespace. */ static char * -scan_partial_symbols (char *info_ptr, struct objfile *objfile, - CORE_ADDR *lowpc, CORE_ADDR *highpc, - const struct comp_unit_head *cu_header, +scan_partial_symbols (char *info_ptr, CORE_ADDR *lowpc, + CORE_ADDR *highpc, struct dwarf2_cu *cu, const char *namespace) { + struct objfile *objfile = cu->objfile; bfd *abfd = objfile->obfd; struct partial_die_info pdi; @@ -1447,7 +1355,7 @@ scan_partial_symbols (char *info_ptr, struct objfile *objfile, inside the loop. */ int info_ptr_updated = 0; - info_ptr = read_partial_die (&pdi, abfd, info_ptr, cu_header); + info_ptr = read_partial_die (&pdi, abfd, info_ptr, cu); /* Anonymous namespaces have no name but have interesting children, so we need to look at them. Ditto for anonymous @@ -1471,7 +1379,7 @@ scan_partial_symbols (char *info_ptr, struct objfile *objfile, } if (!pdi.is_declaration) { - add_partial_symbol (&pdi, objfile, cu_header, namespace); + add_partial_symbol (&pdi, cu, namespace); } } break; @@ -1480,15 +1388,14 @@ scan_partial_symbols (char *info_ptr, struct objfile *objfile, case DW_TAG_union_type: if (!pdi.is_declaration) { - add_partial_symbol (&pdi, objfile, cu_header, namespace); + add_partial_symbol (&pdi, cu, namespace); } break; case DW_TAG_class_type: case DW_TAG_structure_type: if (!pdi.is_declaration) { - info_ptr = add_partial_structure (&pdi, info_ptr, - objfile, cu_header, + info_ptr = add_partial_structure (&pdi, info_ptr, cu, namespace); info_ptr_updated = 1; } @@ -1496,8 +1403,7 @@ scan_partial_symbols (char *info_ptr, struct objfile *objfile, case DW_TAG_enumeration_type: if (!pdi.is_declaration) { - info_ptr = add_partial_enumeration (&pdi, info_ptr, - objfile, cu_header, + info_ptr = add_partial_enumeration (&pdi, info_ptr, cu, namespace); info_ptr_updated = 1; } @@ -1505,7 +1411,7 @@ scan_partial_symbols (char *info_ptr, struct objfile *objfile, case DW_TAG_base_type: /* File scope base type definitions are added to the partial symbol table. */ - add_partial_symbol (&pdi, objfile, cu_header, namespace); + add_partial_symbol (&pdi, cu, namespace); break; case DW_TAG_namespace: /* We've hit a DW_TAG_namespace entry, so we know this @@ -1513,9 +1419,8 @@ scan_partial_symbols (char *info_ptr, struct objfile *objfile, generates them; update NAMESPACE to reflect that. */ if (namespace == NULL) namespace = ""; - info_ptr = add_partial_namespace (&pdi, info_ptr, objfile, - lowpc, highpc, cu_header, - namespace); + info_ptr = add_partial_namespace (&pdi, info_ptr, lowpc, highpc, + cu, namespace); info_ptr_updated = 1; break; default: @@ -1535,17 +1440,17 @@ scan_partial_symbols (char *info_ptr, struct objfile *objfile, this seems like the easiest way to handle the issue. */ if (!info_ptr_updated) - info_ptr = locate_pdi_sibling (&pdi, info_ptr, abfd, cu_header); + info_ptr = locate_pdi_sibling (&pdi, info_ptr, abfd, cu); } return info_ptr; } static void -add_partial_symbol (struct partial_die_info *pdi, struct objfile *objfile, - const struct comp_unit_head *cu_header, - const char *namespace) +add_partial_symbol (struct partial_die_info *pdi, + struct dwarf2_cu *cu, const char *namespace) { + struct objfile *objfile = cu->objfile; CORE_ADDR addr = 0; char *actual_name = pdi->name; const struct partial_symbol *psym = NULL; @@ -1602,7 +1507,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct objfile *objfile, table building. */ if (pdi->locdesc) - addr = decode_locdesc (pdi->locdesc, objfile, cu_header); + addr = decode_locdesc (pdi->locdesc, cu); if (pdi->locdesc || pdi->has_type) psym = add_psymbol_to_list (actual_name, strlen (actual_name), VAR_DOMAIN, LOC_STATIC, @@ -1615,7 +1520,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct objfile *objfile, /* Static Variable. Skip symbols without location descriptors. */ if (pdi->locdesc == NULL) return; - addr = decode_locdesc (pdi->locdesc, objfile, cu_header); + addr = decode_locdesc (pdi->locdesc, cu); /*prim_record_minimal_symbol (actual_name, addr + baseaddr, mst_file_data, objfile); */ psym = add_psymbol_to_list (actual_name, strlen (actual_name), @@ -1714,16 +1619,15 @@ pdi_needs_namespace (enum dwarf_tag tag, const char *namespace) static char * add_partial_namespace (struct partial_die_info *pdi, char *info_ptr, - struct objfile *objfile, CORE_ADDR *lowpc, CORE_ADDR *highpc, - const struct comp_unit_head *cu_header, - const char *namespace) + struct dwarf2_cu *cu, const char *namespace) { - /* Calculate the full name of the namespace that we just entered. */ - + struct objfile *objfile = cu->objfile; const char *new_name = pdi->name; char *full_name; + /* Calculate the full name of the namespace that we just entered. */ + if (new_name == NULL) new_name = "(anonymous namespace)"; full_name = alloca (strlen (namespace) + 2 + strlen (new_name) + 1); @@ -1743,9 +1647,7 @@ add_partial_namespace (struct partial_die_info *pdi, char *info_ptr, /* Now scan partial symbols in that namespace. */ if (pdi->has_children) - info_ptr = scan_partial_symbols (info_ptr, objfile, - lowpc, highpc, - cu_header, full_name); + info_ptr = scan_partial_symbols (info_ptr, lowpc, highpc, cu, full_name); return info_ptr; } @@ -1754,10 +1656,10 @@ add_partial_namespace (struct partial_die_info *pdi, char *info_ptr, static char * add_partial_structure (struct partial_die_info *struct_pdi, char *info_ptr, - struct objfile *objfile, - const struct comp_unit_head *cu_header, + struct dwarf2_cu *cu, const char *namespace) { + struct objfile *objfile = cu->objfile; bfd *abfd = objfile->obfd; char *actual_class_name = NULL; @@ -1783,8 +1685,7 @@ add_partial_structure (struct partial_die_info *struct_pdi, char *info_ptr, { struct partial_die_info child_pdi; - next_child = read_partial_die (&child_pdi, abfd, next_child, - cu_header); + next_child = read_partial_die (&child_pdi, abfd, next_child, cu); if (!child_pdi.tag) break; if (child_pdi.tag == DW_TAG_subprogram) @@ -1797,40 +1698,39 @@ add_partial_structure (struct partial_die_info *struct_pdi, char *info_ptr, else { next_child = locate_pdi_sibling (&child_pdi, next_child, - abfd, cu_header); + abfd, cu); } } } - add_partial_symbol (struct_pdi, objfile, cu_header, namespace); + add_partial_symbol (struct_pdi, cu, namespace); xfree(actual_class_name); - return locate_pdi_sibling (struct_pdi, info_ptr, abfd, cu_header); + return locate_pdi_sibling (struct_pdi, info_ptr, abfd, cu); } /* Read a partial die corresponding to an enumeration type. */ static char * add_partial_enumeration (struct partial_die_info *enum_pdi, char *info_ptr, - struct objfile *objfile, - const struct comp_unit_head *cu_header, - const char *namespace) + struct dwarf2_cu *cu, const char *namespace) { + struct objfile *objfile = cu->objfile; bfd *abfd = objfile->obfd; struct partial_die_info pdi; if (enum_pdi->name != NULL) - add_partial_symbol (enum_pdi, objfile, cu_header, namespace); + add_partial_symbol (enum_pdi, cu, namespace); while (1) { - info_ptr = read_partial_die (&pdi, abfd, info_ptr, cu_header); + info_ptr = read_partial_die (&pdi, abfd, info_ptr, cu); if (pdi.tag == 0) break; if (pdi.tag != DW_TAG_enumerator || pdi.name == NULL) complaint (&symfile_complaints, "malformed enumerator DIE ignored"); else - add_partial_symbol (&pdi, objfile, cu_header, namespace); + add_partial_symbol (&pdi, cu, namespace); } return info_ptr; @@ -1841,7 +1741,7 @@ add_partial_enumeration (struct partial_die_info *enum_pdi, char *info_ptr, static char * locate_pdi_sibling (struct partial_die_info *orig_pdi, char *info_ptr, - bfd *abfd, const struct comp_unit_head *cu_header) + bfd *abfd, struct dwarf2_cu *cu) { /* Do we know the sibling already? */ @@ -1861,12 +1761,12 @@ locate_pdi_sibling (struct partial_die_info *orig_pdi, char *info_ptr, { struct partial_die_info pdi; - info_ptr = read_partial_die (&pdi, abfd, info_ptr, cu_header); + info_ptr = read_partial_die (&pdi, abfd, info_ptr, cu); if (pdi.tag == 0) return info_ptr; else - info_ptr = locate_pdi_sibling (&pdi, info_ptr, abfd, cu_header); + info_ptr = locate_pdi_sibling (&pdi, info_ptr, abfd, cu); } } @@ -1904,7 +1804,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) { struct objfile *objfile = pst->objfile; bfd *abfd = objfile->obfd; - struct comp_unit_head cu_header; + struct dwarf2_cu cu; struct die_info *dies; unsigned long offset; CORE_ADDR lowpc, highpc; @@ -1942,14 +1842,16 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) buildsym_init (); make_cleanup (really_free_pendings, NULL); + cu.objfile = objfile; + /* read in the comp_unit header */ - info_ptr = read_comp_unit_head (&cu_header, info_ptr, abfd); + info_ptr = read_comp_unit_head (&cu.header, info_ptr, abfd); /* Read the abbrevs for this compilation unit */ - dwarf2_read_abbrevs (abfd, &cu_header); - make_cleanup (dwarf2_empty_abbrev_table, cu_header.dwarf2_abbrevs); + dwarf2_read_abbrevs (abfd, &cu); + make_cleanup (dwarf2_empty_abbrev_table, cu.header.dwarf2_abbrevs); - dies = read_comp_unit (info_ptr, abfd, &cu_header); + dies = read_comp_unit (info_ptr, abfd, &cu); make_cleanup_free_die_list (dies); @@ -1959,29 +1861,29 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) DW_AT_entry_pc. It's been removed, but GCC still uses this for compilation units with discontinuous ranges. */ - cu_header.base_known = 0; - cu_header.base_address = 0; + cu.header.base_known = 0; + cu.header.base_address = 0; attr = dwarf_attr (dies, DW_AT_entry_pc); if (attr) { - cu_header.base_address = DW_ADDR (attr); - cu_header.base_known = 1; + cu.header.base_address = DW_ADDR (attr); + cu.header.base_known = 1; } else { attr = dwarf_attr (dies, DW_AT_low_pc); if (attr) { - cu_header.base_address = DW_ADDR (attr); - cu_header.base_known = 1; + cu.header.base_address = DW_ADDR (attr); + cu.header.base_known = 1; } } /* Do line number decoding in read_file_scope () */ - process_die (dies, objfile, &cu_header); + process_die (dies, &cu); - get_scope_pc_bounds (dies, &lowpc, &highpc, objfile, &cu_header); + get_scope_pc_bounds (dies, &lowpc, &highpc, &cu); symtab = end_symtab (highpc + baseaddr, objfile, SECT_OFF_TEXT (objfile)); /* Set symtab language to language from DW_AT_language. @@ -2001,19 +1903,18 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) /* Process a die and its children. */ static void -process_die (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +process_die (struct die_info *die, struct dwarf2_cu *cu) { switch (die->tag) { case DW_TAG_padding: break; case DW_TAG_compile_unit: - read_file_scope (die, objfile, cu_header); + read_file_scope (die, cu); break; case DW_TAG_subprogram: - read_subroutine_type (die, objfile, cu_header); - read_func_scope (die, objfile, cu_header); + read_subroutine_type (die, cu); + read_func_scope (die, cu); break; case DW_TAG_inlined_subroutine: /* FIXME: These are ignored for now. @@ -2023,50 +1924,50 @@ process_die (struct die_info *die, struct objfile *objfile, case DW_TAG_lexical_block: case DW_TAG_try_block: case DW_TAG_catch_block: - read_lexical_block_scope (die, objfile, cu_header); + read_lexical_block_scope (die, cu); break; case DW_TAG_class_type: case DW_TAG_structure_type: case DW_TAG_union_type: - read_structure_scope (die, objfile, cu_header); + read_structure_scope (die, cu); break; case DW_TAG_enumeration_type: - read_enumeration (die, objfile, cu_header); + read_enumeration (die, cu); break; case DW_TAG_subroutine_type: - read_subroutine_type (die, objfile, cu_header); + read_subroutine_type (die, cu); break; case DW_TAG_array_type: - read_array_type (die, objfile, cu_header); + read_array_type (die, cu); break; case DW_TAG_pointer_type: - read_tag_pointer_type (die, objfile, cu_header); + read_tag_pointer_type (die, cu); break; case DW_TAG_ptr_to_member_type: - read_tag_ptr_to_member_type (die, objfile, cu_header); + read_tag_ptr_to_member_type (die, cu); break; case DW_TAG_reference_type: - read_tag_reference_type (die, objfile, cu_header); + read_tag_reference_type (die, cu); break; case DW_TAG_string_type: - read_tag_string_type (die, objfile); + read_tag_string_type (die, cu); break; case DW_TAG_base_type: - read_base_type (die, objfile); + read_base_type (die, cu); if (dwarf_attr (die, DW_AT_name)) { /* Add a typedef symbol for the base type definition. */ - new_symbol (die, die->type, objfile, cu_header); + new_symbol (die, die->type, cu); } break; case DW_TAG_common_block: - read_common_block (die, objfile, cu_header); + read_common_block (die, cu); break; case DW_TAG_common_inclusion: break; case DW_TAG_namespace: processing_has_namespace_info = 1; - read_namespace (die, objfile, cu_header); + read_namespace (die, cu); break; case DW_TAG_imported_declaration: case DW_TAG_imported_module: @@ -2080,7 +1981,7 @@ process_die (struct die_info *die, struct objfile *objfile, gdb_assert (die->child == NULL); break; default: - new_symbol (die, NULL, objfile, cu_header); + new_symbol (die, NULL, cu); break; } } @@ -2092,9 +1993,10 @@ initialize_cu_func_list (void) } static void -read_file_scope (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_file_scope (struct die_info *die, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; + struct comp_unit_head *cu_header = &cu->header; struct cleanup *back_to = make_cleanup (null_cleanup, 0); CORE_ADDR lowpc = ((CORE_ADDR) -1); CORE_ADDR highpc = ((CORE_ADDR) 0); @@ -2105,7 +2007,7 @@ read_file_scope (struct die_info *die, struct objfile *objfile, bfd *abfd = objfile->obfd; struct line_header *line_header = 0; - get_scope_pc_bounds (die, &lowpc, &highpc, objfile, cu_header); + get_scope_pc_bounds (die, &lowpc, &highpc, cu); /* If we didn't find a lowpc, set it to highpc to avoid complaints from finish_block. */ @@ -2170,7 +2072,7 @@ read_file_scope (struct die_info *die, struct objfile *objfile, child_die = die->child; while (child_die && child_die->tag) { - process_die (child_die, objfile, cu_header); + process_die (child_die, cu); child_die = sibling_die (child_die); } } @@ -2180,13 +2082,12 @@ read_file_scope (struct die_info *die, struct objfile *objfile, if (attr) { unsigned int line_offset = DW_UNSND (attr); - line_header = dwarf_decode_line_header (line_offset, - abfd, cu_header); + line_header = dwarf_decode_line_header (line_offset, abfd, cu); if (line_header) { make_cleanup ((make_cleanup_ftype *) free_line_header, (void *) line_header); - dwarf_decode_lines (line_header, comp_dir, abfd, cu_header); + dwarf_decode_lines (line_header, comp_dir, abfd, cu); } } @@ -2199,7 +2100,7 @@ read_file_scope (struct die_info *die, struct objfile *objfile, { unsigned int macro_offset = DW_UNSND (attr); dwarf_decode_macros (line_header, macro_offset, - comp_dir, abfd, cu_header, objfile); + comp_dir, abfd, cu); } do_cleanups (back_to); } @@ -2226,9 +2127,9 @@ add_to_cu_func_list (char *name, CORE_ADDR lowpc, CORE_ADDR highpc) } static void -read_func_scope (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_func_scope (struct die_info *die, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; struct context_stack *new; CORE_ADDR lowpc; CORE_ADDR highpc; @@ -2240,7 +2141,7 @@ read_func_scope (struct die_info *die, struct objfile *objfile, /* Ignore functions with missing or empty names and functions with missing or invalid low and high pc attributes. */ - if (name == NULL || !dwarf2_get_pc_bounds (die, &lowpc, &highpc, objfile, cu_header)) + if (name == NULL || !dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu)) return; lowpc += baseaddr; @@ -2256,52 +2157,14 @@ read_func_scope (struct die_info *die, struct objfile *objfile, objfile->ei.entry_func_highpc = highpc; } - /* Decode DW_AT_frame_base location descriptor if present, keep result - for DW_OP_fbreg operands in decode_locdesc. */ - frame_base_reg = -1; - frame_base_offset = 0; - attr = dwarf_attr (die, DW_AT_frame_base); - if (attr) - { - CORE_ADDR addr; - - /* Support the .debug_loc offsets */ - if (attr_form_is_block (attr)) - { - addr = decode_locdesc (DW_BLOCK (attr), objfile, cu_header); - } - else if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8) - { - dwarf2_complex_location_expr_complaint (); - addr = 0; - } - else - { - dwarf2_invalid_attrib_class_complaint ("DW_AT_frame_base", name); - addr = 0; - } - - if (isderef) - dwarf2_unsupported_at_frame_base_complaint (name); - else if (isreg) - frame_base_reg = addr; - else if (offreg) - { - frame_base_reg = basereg; - frame_base_offset = addr; - } - else - dwarf2_unsupported_at_frame_base_complaint (name); - } - new = push_context (0, lowpc); - new->name = new_symbol (die, die->type, objfile, cu_header); + new->name = new_symbol (die, die->type, cu); - /* If there was a location expression for DW_AT_frame_base above, - record it. We still need to decode it above because not all - symbols use location expressions exclusively. */ + /* If there is a location expression for DW_AT_frame_base, record + it. */ + attr = dwarf_attr (die, DW_AT_frame_base); if (attr) - dwarf2_symbol_mark_computed (attr, new->name, cu_header, objfile); + dwarf2_symbol_mark_computed (attr, new->name, cu); list_in_scope = &local_symbols; @@ -2310,7 +2173,7 @@ read_func_scope (struct die_info *die, struct objfile *objfile, child_die = die->child; while (child_die && child_die->tag) { - process_die (child_die, objfile, cu_header); + process_die (child_die, cu); child_die = sibling_die (child_die); } } @@ -2337,9 +2200,9 @@ read_func_scope (struct die_info *die, struct objfile *objfile, a new scope, process the dies, and then close the scope. */ static void -read_lexical_block_scope (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; struct context_stack *new; CORE_ADDR lowpc, highpc; struct die_info *child_die; @@ -2349,7 +2212,7 @@ read_lexical_block_scope (struct die_info *die, struct objfile *objfile, as multiple lexical blocks? Handling children in a sane way would be nasty. Might be easier to properly extend generic blocks to describe ranges. */ - if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, objfile, cu_header)) + if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu)) return; lowpc += baseaddr; highpc += baseaddr; @@ -2360,7 +2223,7 @@ read_lexical_block_scope (struct die_info *die, struct objfile *objfile, child_die = die->child; while (child_die && child_die->tag) { - process_die (child_die, objfile, cu_header); + process_die (child_die, cu); child_die = sibling_die (child_die); } } @@ -2379,9 +2242,10 @@ read_lexical_block_scope (struct die_info *die, struct objfile *objfile, discontinuous, i.e. derived from DW_AT_ranges information. */ static int dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, - CORE_ADDR *highpc, struct objfile *objfile, - const struct comp_unit_head *cu_header) + CORE_ADDR *highpc, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; + struct comp_unit_head *cu_header = &cu->header; struct attribute *attr; bfd *obfd = objfile->obfd; CORE_ADDR low = 0; @@ -2416,7 +2280,6 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, CORE_ADDR base; int found_base; int dummy; - unsigned int i; char *buffer; CORE_ADDR marker; int low_set; @@ -2434,13 +2297,12 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, buffer = dwarf_ranges_buffer + offset; /* Read in the largest possible address. */ - marker = read_address (obfd, buffer, cu_header, &dummy); + marker = read_address (obfd, buffer, cu, &dummy); if ((marker & mask) == mask) { /* If we found the largest possible address, then read the base address. */ - base = read_address (obfd, buffer + addr_size, - cu_header, &dummy); + base = read_address (obfd, buffer + addr_size, cu, &dummy); buffer += 2 * addr_size; offset += 2 * addr_size; found_base = 1; @@ -2452,10 +2314,9 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, { CORE_ADDR range_beginning, range_end; - range_beginning = read_address (obfd, buffer, - cu_header, &dummy); + range_beginning = read_address (obfd, buffer, cu, &dummy); buffer += addr_size; - range_end = read_address (obfd, buffer, cu_header, &dummy); + range_end = read_address (obfd, buffer, cu, &dummy); buffer += addr_size; offset += 2 * addr_size; @@ -2471,8 +2332,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, { /* If we found the largest possible address, then read the base address. */ - base = read_address (obfd, buffer + addr_size, - cu_header, &dummy); + base = read_address (obfd, buffer + addr_size, cu, &dummy); found_base = 1; continue; } @@ -2542,15 +2402,13 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, static void get_scope_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, CORE_ADDR *highpc, - struct objfile *objfile, - const struct comp_unit_head *cu_header) + struct dwarf2_cu *cu) { CORE_ADDR best_low = (CORE_ADDR) -1; CORE_ADDR best_high = (CORE_ADDR) 0; CORE_ADDR current_low, current_high; - if (dwarf2_get_pc_bounds (die, ¤t_low, ¤t_high, - objfile, cu_header)) + if (dwarf2_get_pc_bounds (die, ¤t_low, ¤t_high, cu)) { best_low = current_low; best_high = current_high; @@ -2563,8 +2421,7 @@ get_scope_pc_bounds (struct die_info *die, { switch (child->tag) { case DW_TAG_subprogram: - if (dwarf2_get_pc_bounds (child, ¤t_low, ¤t_high, - objfile, cu_header)); + if (dwarf2_get_pc_bounds (child, ¤t_low, ¤t_high, cu)) { best_low = min (best_low, current_low); best_high = max (best_high, current_high); @@ -2579,8 +2436,7 @@ get_scope_pc_bounds (struct die_info *die, the DIEs giving the declarations, which could be anywhere). But I don't see any reason why they have to be there. */ - get_scope_pc_bounds (child, ¤t_low, ¤t_high, - objfile, cu_header); + get_scope_pc_bounds (child, ¤t_low, ¤t_high, cu); if (current_low != ((CORE_ADDR) -1)) { @@ -2605,9 +2461,9 @@ get_scope_pc_bounds (struct die_info *die, static void dwarf2_add_field (struct field_info *fip, struct die_info *die, - struct objfile *objfile, - const struct comp_unit_head *cu_header) -{ + struct dwarf2_cu *cu) +{ + struct objfile *objfile = cu->objfile; struct nextfield *new_field; struct attribute *attr; struct field *fp; @@ -2646,7 +2502,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, /* Data member other than a C++ static data member. */ /* Get type of field. */ - fp->type = die_type (die, objfile, cu_header); + fp->type = die_type (die, cu); FIELD_STATIC_KIND (*fp) = 0; @@ -2666,7 +2522,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, if (attr) { FIELD_BITPOS (*fp) = - decode_locdesc (DW_BLOCK (attr), objfile, cu_header) * bits_per_byte; + decode_locdesc (DW_BLOCK (attr), cu) * bits_per_byte; } else FIELD_BITPOS (*fp) = 0; @@ -2750,7 +2606,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, SET_FIELD_PHYSNAME (*fp, obsavestring (physname, strlen (physname), &objfile->type_obstack)); - FIELD_TYPE (*fp) = die_type (die, objfile, cu_header); + FIELD_TYPE (*fp) = die_type (die, cu); FIELD_NAME (*fp) = obsavestring (fieldname, strlen (fieldname), &objfile->type_obstack); } @@ -2759,11 +2615,11 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, /* C++ base class field. */ attr = dwarf_attr (die, DW_AT_data_member_location); if (attr) - FIELD_BITPOS (*fp) = (decode_locdesc (DW_BLOCK (attr), objfile, cu_header) + FIELD_BITPOS (*fp) = (decode_locdesc (DW_BLOCK (attr), cu) * bits_per_byte); FIELD_BITSIZE (*fp) = 0; FIELD_STATIC_KIND (*fp) = 0; - FIELD_TYPE (*fp) = die_type (die, objfile, cu_header); + FIELD_TYPE (*fp) = die_type (die, cu); FIELD_NAME (*fp) = type_name_no_tag (fp->type); fip->nbaseclasses++; } @@ -2773,7 +2629,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, static void dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type, - struct objfile *objfile) + struct dwarf2_cu *cu) { int nfields = fip->nfields; @@ -2860,9 +2716,9 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type, static void dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, - struct type *type, struct objfile *objfile, - const struct comp_unit_head *cu_header) + struct type *type, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; struct attribute *attr; struct fnfieldlist *flp; int i; @@ -2883,7 +2739,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, /* Look up member function name in fieldlist. */ for (i = 0; i < fip->nfnfields; i++) { - if (STREQ (fip->fnfieldlists[i].name, fieldname)) + if (strcmp (fip->fnfieldlists[i].name, fieldname) == 0) break; } @@ -2924,7 +2780,6 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, fnp->type = alloc_type (objfile); if (die->type && TYPE_CODE (die->type) == TYPE_CODE_FUNC) { - struct type *return_type = TYPE_TARGET_TYPE (die->type); int nparams = TYPE_NFIELDS (die->type); /* TYPE is the domain of this method, and DIE->TYPE is the type @@ -2950,7 +2805,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, /* Get fcontext from DW_AT_containing_type if present. */ if (dwarf_attr (die, DW_AT_containing_type) != NULL) - fnp->fcontext = die_containing_type (die, objfile, cu_header); + fnp->fcontext = die_containing_type (die, cu); /* dwarf2 doesn't have stubbed physical names, so the setting of is_const and is_volatile is irrelevant, as it is needed by gdb_mangle_name only. */ @@ -2982,7 +2837,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, /* Support the .debug_loc offsets */ if (attr_form_is_block (attr)) { - fnp->voffset = decode_locdesc (DW_BLOCK (attr), objfile, cu_header) + 2; + fnp->voffset = decode_locdesc (DW_BLOCK (attr), cu) + 2; } else if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8) { @@ -3000,7 +2855,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, static void dwarf2_attach_fn_fields_to_type (struct field_info *fip, struct type *type, - struct objfile *objfile) + struct dwarf2_cu *cu) { struct fnfieldlist *flp; int total_length = 0; @@ -3047,9 +2902,9 @@ dwarf2_attach_fn_fields_to_type (struct field_info *fip, struct type *type, suppresses creating a symbol table entry itself). */ static void -read_structure_scope (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_structure_scope (struct die_info *die, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; struct type *type; struct attribute *attr; const char *name; @@ -3151,13 +3006,13 @@ read_structure_scope (struct die_info *die, struct objfile *objfile, all versions of G++ as of this writing (so through at least 3.2.1) incorrectly generate DW_TAG_variable tags for them instead. */ - dwarf2_add_field (&fi, child_die, objfile, cu_header); + dwarf2_add_field (&fi, child_die, cu); } else if (child_die->tag == DW_TAG_subprogram) { /* C++ member function. */ - process_die (child_die, objfile, cu_header); - dwarf2_add_member_fn (&fi, child_die, type, objfile, cu_header); + process_die (child_die, cu); + dwarf2_add_member_fn (&fi, child_die, type, cu); if (need_to_update_name) { /* The demangled names of member functions contain @@ -3197,21 +3052,21 @@ read_structure_scope (struct die_info *die, struct objfile *objfile, else if (child_die->tag == DW_TAG_inheritance) { /* C++ base class field. */ - dwarf2_add_field (&fi, child_die, objfile, cu_header); + dwarf2_add_field (&fi, child_die, cu); } else { - process_die (child_die, objfile, cu_header); + process_die (child_die, cu); } child_die = sibling_die (child_die); } /* Attach fields and member functions to the type. */ if (fi.nfields) - dwarf2_attach_fields_to_type (&fi, type, objfile); + dwarf2_attach_fields_to_type (&fi, type, cu); if (fi.nfnfields) { - dwarf2_attach_fn_fields_to_type (&fi, type, objfile); + dwarf2_attach_fn_fields_to_type (&fi, type, cu); /* Get the type which refers to the base class (possibly this class itself) which contains the vtable pointer for the current @@ -3219,7 +3074,7 @@ read_structure_scope (struct die_info *die, struct objfile *objfile, if (dwarf_attr (die, DW_AT_containing_type) != NULL) { - struct type *t = die_containing_type (die, objfile, cu_header); + struct type *t = die_containing_type (die, cu); TYPE_VPTR_BASETYPE (type) = t; if (type == t) @@ -3235,7 +3090,9 @@ read_structure_scope (struct die_info *die, struct objfile *objfile, { char *fieldname = TYPE_FIELD_NAME (t, i); - if (STREQN (fieldname, vptr_name, strlen (vptr_name) - 1) + if ((strncmp (fieldname, vptr_name, + strlen (vptr_name) - 1) + == 0) && is_cplus_marker (fieldname[strlen (vptr_name)])) { TYPE_VPTR_FIELDNO (type) = i; @@ -3257,7 +3114,7 @@ read_structure_scope (struct die_info *die, struct objfile *objfile, } } - new_symbol (die, type, objfile, cu_header); + new_symbol (die, type, cu); do_cleanups (back_to); } @@ -3282,9 +3139,9 @@ read_structure_scope (struct die_info *die, struct objfile *objfile, NOTE: We reverse the order of the element list. */ static void -read_enumeration (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_enumeration (struct die_info *die, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; struct die_info *child_die; struct type *type; struct field *fields; @@ -3334,14 +3191,14 @@ read_enumeration (struct die_info *die, struct objfile *objfile, { if (child_die->tag != DW_TAG_enumerator) { - process_die (child_die, objfile, cu_header); + process_die (child_die, cu); } else { attr = dwarf_attr (child_die, DW_AT_name); if (attr) { - sym = new_symbol (child_die, type, objfile, cu_header); + sym = new_symbol (child_die, type, cu); if (SYMBOL_VALUE (sym) < 0) unsigned_enum = 0; @@ -3379,7 +3236,7 @@ read_enumeration (struct die_info *die, struct objfile *objfile, TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED; } die->type = type; - new_symbol (die, type, objfile, cu_header); + new_symbol (die, type, cu); } /* Extract all information from a DW_TAG_array_type DIE and put it in @@ -3387,9 +3244,9 @@ read_enumeration (struct die_info *die, struct objfile *objfile, arrays. */ static void -read_array_type (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_array_type (struct die_info *die, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; struct die_info *child_die; struct type *type = NULL; struct type *element_type, *range_type, *index_type; @@ -3404,7 +3261,7 @@ read_array_type (struct die_info *die, struct objfile *objfile, return; } - element_type = die_type (die, objfile, cu_header); + element_type = die_type (die, cu); /* Irix 6.2 native cc creates array types without children for arrays with unspecified length. */ @@ -3433,7 +3290,7 @@ read_array_type (struct die_info *die, struct objfile *objfile, low = 1; } - index_type = die_type (child_die, objfile, cu_header); + index_type = die_type (child_die, cu); attr = dwarf_attr (child_die, DW_AT_lower_bound); if (attr) { @@ -3543,8 +3400,7 @@ read_array_type (struct die_info *die, struct objfile *objfile, /* First cut: install each common block member as a global variable. */ static void -read_common_block (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_common_block (struct die_info *die, struct dwarf2_cu *cu) { struct die_info *child_die; struct attribute *attr; @@ -3557,7 +3413,7 @@ read_common_block (struct die_info *die, struct objfile *objfile, /* Support the .debug_loc offsets */ if (attr_form_is_block (attr)) { - base = decode_locdesc (DW_BLOCK (attr), objfile, cu_header); + base = decode_locdesc (DW_BLOCK (attr), cu); } else if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8) { @@ -3574,12 +3430,12 @@ read_common_block (struct die_info *die, struct objfile *objfile, child_die = die->child; while (child_die && child_die->tag) { - sym = new_symbol (child_die, NULL, objfile, cu_header); + sym = new_symbol (child_die, NULL, cu); attr = dwarf_attr (child_die, DW_AT_data_member_location); if (attr) { SYMBOL_VALUE_ADDRESS (sym) = - base + decode_locdesc (DW_BLOCK (attr), objfile, cu_header); + base + decode_locdesc (DW_BLOCK (attr), cu); add_symbol_to_list (sym, &global_symbols); } child_die = sibling_die (child_die); @@ -3590,9 +3446,9 @@ read_common_block (struct die_info *die, struct objfile *objfile, /* Read a C++ namespace. */ static void -read_namespace (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_namespace (struct die_info *die, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; const char *previous_prefix = processing_current_prefix; const char *name; int is_anonymous; @@ -3634,7 +3490,7 @@ read_namespace (struct die_info *die, struct objfile *objfile, objfile); TYPE_TAG_NAME (type) = TYPE_NAME (type); - new_symbol (die, type, objfile, cu_header); + new_symbol (die, type, cu); if (is_anonymous) cp_add_using_directive (processing_current_prefix, @@ -3648,7 +3504,7 @@ read_namespace (struct die_info *die, struct objfile *objfile, while (child_die && child_die->tag) { - process_die (child_die, objfile, cu_header); + process_die (child_die, cu); child_die = sibling_die (child_die); } } @@ -3686,9 +3542,9 @@ namespace_name (struct die_info *die, int *is_anonymous) the user defined type vector. */ static void -read_tag_pointer_type (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu) { + struct comp_unit_head *cu_header = &cu->header; struct type *type; struct attribute *attr_byte_size; struct attribute *attr_address_class; @@ -3699,7 +3555,7 @@ read_tag_pointer_type (struct die_info *die, struct objfile *objfile, return; } - type = lookup_pointer_type (die_type (die, objfile, cu_header)); + type = lookup_pointer_type (die_type (die, cu)); attr_byte_size = dwarf_attr (die, DW_AT_byte_size); if (attr_byte_size) @@ -3743,9 +3599,9 @@ read_tag_pointer_type (struct die_info *die, struct objfile *objfile, the user defined type vector. */ static void -read_tag_ptr_to_member_type (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_tag_ptr_to_member_type (struct die_info *die, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; struct type *type; struct type *to_type; struct type *domain; @@ -3756,8 +3612,8 @@ read_tag_ptr_to_member_type (struct die_info *die, struct objfile *objfile, } type = alloc_type (objfile); - to_type = die_type (die, objfile, cu_header); - domain = die_containing_type (die, objfile, cu_header); + to_type = die_type (die, cu); + domain = die_containing_type (die, cu); smash_to_member_type (type, domain, to_type); die->type = type; @@ -3767,9 +3623,9 @@ read_tag_ptr_to_member_type (struct die_info *die, struct objfile *objfile, the user defined type vector. */ static void -read_tag_reference_type (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_tag_reference_type (struct die_info *die, struct dwarf2_cu *cu) { + struct comp_unit_head *cu_header = &cu->header; struct type *type; struct attribute *attr; @@ -3778,7 +3634,7 @@ read_tag_reference_type (struct die_info *die, struct objfile *objfile, return; } - type = lookup_reference_type (die_type (die, objfile, cu_header)); + type = lookup_reference_type (die_type (die, cu)); attr = dwarf_attr (die, DW_AT_byte_size); if (attr) { @@ -3792,8 +3648,7 @@ read_tag_reference_type (struct die_info *die, struct objfile *objfile, } static void -read_tag_const_type (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_tag_const_type (struct die_info *die, struct dwarf2_cu *cu) { struct type *base_type; @@ -3802,13 +3657,12 @@ read_tag_const_type (struct die_info *die, struct objfile *objfile, return; } - base_type = die_type (die, objfile, cu_header); + base_type = die_type (die, cu); die->type = make_cv_type (1, TYPE_VOLATILE (base_type), base_type, 0); } static void -read_tag_volatile_type (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_tag_volatile_type (struct die_info *die, struct dwarf2_cu *cu) { struct type *base_type; @@ -3817,7 +3671,7 @@ read_tag_volatile_type (struct die_info *die, struct objfile *objfile, return; } - base_type = die_type (die, objfile, cu_header); + base_type = die_type (die, cu); die->type = make_cv_type (TYPE_CONST (base_type), 1, base_type, 0); } @@ -3827,8 +3681,9 @@ read_tag_volatile_type (struct die_info *die, struct objfile *objfile, attribute to reference it. */ static void -read_tag_string_type (struct die_info *die, struct objfile *objfile) +read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; struct type *type, *range_type, *index_type, *char_type; struct attribute *attr; unsigned int length; @@ -3884,8 +3739,7 @@ read_tag_string_type (struct die_info *die, struct objfile *objfile) */ static void -read_subroutine_type (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu) { struct type *type; /* Type that this function returns */ struct type *ftype; /* Function that returns above type */ @@ -3896,7 +3750,7 @@ read_subroutine_type (struct die_info *die, struct objfile *objfile, { return; } - type = die_type (die, objfile, cu_header); + type = die_type (die, cu); ftype = lookup_function_type (type); /* All functions in C++ have prototypes. */ @@ -3944,8 +3798,7 @@ read_subroutine_type (struct die_info *die, struct objfile *objfile, TYPE_FIELD_ARTIFICIAL (ftype, iparams) = DW_UNSND (attr); else TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0; - TYPE_FIELD_TYPE (ftype, iparams) = die_type (child_die, objfile, - cu_header); + TYPE_FIELD_TYPE (ftype, iparams) = die_type (child_die, cu); iparams++; } child_die = sibling_die (child_die); @@ -3956,9 +3809,9 @@ read_subroutine_type (struct die_info *die, struct objfile *objfile, } static void -read_typedef (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_typedef (struct die_info *die, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; struct attribute *attr; char *name = NULL; @@ -3967,7 +3820,7 @@ read_typedef (struct die_info *die, struct objfile *objfile, name = dwarf2_name (die); die->type = init_type (TYPE_CODE_TYPEDEF, 0, TYPE_FLAG_TARGET_STUB, name, objfile); - TYPE_TARGET_TYPE (die->type) = die_type (die, objfile, cu_header); + TYPE_TARGET_TYPE (die->type) = die_type (die, cu); } } @@ -3975,8 +3828,9 @@ read_typedef (struct die_info *die, struct objfile *objfile, it in the TYPE field of the die. */ static void -read_base_type (struct die_info *die, struct objfile *objfile) +read_base_type (struct die_info *die, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; struct type *type; struct attribute *attr; int encoding = 0, size = 0; @@ -4050,7 +3904,7 @@ read_base_type (struct die_info *die, struct objfile *objfile) } else { - type = dwarf_base_type (encoding, size, objfile); + type = dwarf_base_type (encoding, size, cu); } die->type = type; } @@ -4058,14 +3912,13 @@ read_base_type (struct die_info *die, struct objfile *objfile) /* Read a whole compilation unit into a linked list of dies. */ static struct die_info * -read_comp_unit (char *info_ptr, bfd *abfd, - const struct comp_unit_head *cu_header) +read_comp_unit (char *info_ptr, bfd *abfd, struct dwarf2_cu *cu) { /* Reset die reference table; we are building new ones now. */ dwarf2_empty_hash_tables (); - return read_die_and_children (info_ptr, abfd, cu_header, &info_ptr, NULL); + return read_die_and_children (info_ptr, abfd, cu, &info_ptr, NULL); } /* Read a single die and all its descendents. Set the die's sibling @@ -4076,7 +3929,7 @@ read_comp_unit (char *info_ptr, bfd *abfd, static struct die_info * read_die_and_children (char *info_ptr, bfd *abfd, - const struct comp_unit_head *cu_header, + struct dwarf2_cu *cu, char **new_info_ptr, struct die_info *parent) { @@ -4084,12 +3937,12 @@ read_die_and_children (char *info_ptr, bfd *abfd, char *cur_ptr; int has_children; - cur_ptr = read_full_die (&die, abfd, info_ptr, cu_header, &has_children); + cur_ptr = read_full_die (&die, abfd, info_ptr, cu, &has_children); store_in_ref_table (die->offset, die); if (has_children) { - die->child = read_die_and_siblings (cur_ptr, abfd, cu_header, + die->child = read_die_and_siblings (cur_ptr, abfd, cu, new_info_ptr, die); } else @@ -4109,7 +3962,7 @@ read_die_and_children (char *info_ptr, bfd *abfd, static struct die_info * read_die_and_siblings (char *info_ptr, bfd *abfd, - const struct comp_unit_head *cu_header, + struct dwarf2_cu *cu, char **new_info_ptr, struct die_info *parent) { @@ -4122,8 +3975,7 @@ read_die_and_siblings (char *info_ptr, bfd *abfd, while (1) { struct die_info *die - = read_die_and_children (cur_ptr, abfd, cu_header, - &cur_ptr, parent); + = read_die_and_children (cur_ptr, abfd, cu, &cur_ptr, parent); if (!first_die) { @@ -4182,11 +4034,11 @@ make_cleanup_free_die_list (struct die_info *dies) object file specified by OBJFILE into the psymbol_obstack and return it. */ char * -dwarf2_read_section (struct objfile *objfile, file_ptr offset, - unsigned int size, asection *sectp) +dwarf2_read_section (struct objfile *objfile, asection *sectp) { bfd *abfd = objfile->obfd; char *buf, *retbuf; + bfd_size_type size = bfd_get_section_size_before_reloc (sectp); if (size == 0) return NULL; @@ -4197,13 +4049,11 @@ dwarf2_read_section (struct objfile *objfile, file_ptr offset, if (retbuf != NULL) return retbuf; - if ((bfd_seek (abfd, offset, SEEK_SET) != 0) || - (bfd_bread (buf, size, abfd) != size)) - { - buf = NULL; - error ("Dwarf Error: Can't read DWARF data from '%s'", - bfd_get_filename (abfd)); - } + if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 + || bfd_bread (buf, size, abfd) != size) + error ("Dwarf Error: Can't read DWARF data from '%s'", + bfd_get_filename (abfd)); + return buf; } @@ -4213,8 +4063,9 @@ dwarf2_read_section (struct objfile *objfile, file_ptr offset, in a hash table. */ static void -dwarf2_read_abbrevs (bfd *abfd, struct comp_unit_head *cu_header) +dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu) { + struct comp_unit_head *cu_header = &cu->header; char *abbrev_ptr; struct abbrev_info *cur_abbrev; unsigned int abbrev_number, bytes_read, abbrev_name; @@ -4278,7 +4129,7 @@ dwarf2_read_abbrevs (bfd *abfd, struct comp_unit_head *cu_header) break; abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); abbrev_ptr += bytes_read; - if (dwarf2_lookup_abbrev (abbrev_number, cu_header) != NULL) + if (dwarf2_lookup_abbrev (abbrev_number, cu) != NULL) break; } } @@ -4312,8 +4163,9 @@ dwarf2_empty_abbrev_table (void *ptr_to_abbrevs_table) /* Lookup an abbrev_info structure in the abbrev hash table. */ static struct abbrev_info * -dwarf2_lookup_abbrev (unsigned int number, const struct comp_unit_head *cu_header) +dwarf2_lookup_abbrev (unsigned int number, struct dwarf2_cu *cu) { + struct comp_unit_head *cu_header = &cu->header; unsigned int hash_number; struct abbrev_info *abbrev; @@ -4334,7 +4186,7 @@ dwarf2_lookup_abbrev (unsigned int number, const struct comp_unit_head *cu_heade static char * read_partial_die (struct partial_die_info *part_die, bfd *abfd, - char *info_ptr, const struct comp_unit_head *cu_header) + char *info_ptr, struct dwarf2_cu *cu) { unsigned int abbrev_number, bytes_read, i; struct abbrev_info *abbrev; @@ -4350,7 +4202,7 @@ read_partial_die (struct partial_die_info *part_die, bfd *abfd, if (!abbrev_number) return info_ptr; - abbrev = dwarf2_lookup_abbrev (abbrev_number, cu_header); + abbrev = dwarf2_lookup_abbrev (abbrev_number, cu); if (!abbrev) { error ("Dwarf Error: Could not find abbrev number %d [in module %s]", abbrev_number, @@ -4363,8 +4215,7 @@ read_partial_die (struct partial_die_info *part_die, bfd *abfd, for (i = 0; i < abbrev->num_attrs; ++i) { - info_ptr = read_attribute (&attr, &abbrev->attrs[i], abfd, - info_ptr, cu_header); + info_ptr = read_attribute (&attr, &abbrev->attrs[i], abfd, info_ptr, cu); /* Store the data if it is of an attribute we want to keep in a partial symbol table. */ @@ -4441,10 +4292,9 @@ read_partial_die (struct partial_die_info *part_die, bfd *abfd, { struct partial_die_info spec_die; char *spec_ptr; - int dummy; spec_ptr = dwarf_info_buffer + dwarf2_get_ref_die_offset (&spec_attr); - read_partial_die (&spec_die, abfd, spec_ptr, cu_header); + read_partial_die (&spec_die, abfd, spec_ptr, cu); if (spec_die.name) { part_die->name = spec_die.name; @@ -4478,7 +4328,7 @@ read_partial_die (struct partial_die_info *part_die, bfd *abfd, static char * read_full_die (struct die_info **diep, bfd *abfd, char *info_ptr, - const struct comp_unit_head *cu_header, int *has_children) + struct dwarf2_cu *cu, int *has_children) { unsigned int abbrev_number, bytes_read, i, offset; struct abbrev_info *abbrev; @@ -4498,7 +4348,7 @@ read_full_die (struct die_info **diep, bfd *abfd, char *info_ptr, return info_ptr; } - abbrev = dwarf2_lookup_abbrev (abbrev_number, cu_header); + abbrev = dwarf2_lookup_abbrev (abbrev_number, cu); if (!abbrev) { error ("Dwarf Error: could not find abbrev number %d [in module %s]", @@ -4518,7 +4368,7 @@ read_full_die (struct die_info **diep, bfd *abfd, char *info_ptr, for (i = 0; i < abbrev->num_attrs; ++i) { info_ptr = read_attribute (&die->attrs[i], &abbrev->attrs[i], - abfd, info_ptr, cu_header); + abfd, info_ptr, cu); } *diep = die; @@ -4530,9 +4380,10 @@ read_full_die (struct die_info **diep, bfd *abfd, char *info_ptr, static char * read_attribute_value (struct attribute *attr, unsigned form, - bfd *abfd, char *info_ptr, - const struct comp_unit_head *cu_header) + bfd *abfd, char *info_ptr, + struct dwarf2_cu *cu) { + struct comp_unit_head *cu_header = &cu->header; unsigned int bytes_read; struct dwarf_block *blk; @@ -4541,7 +4392,7 @@ read_attribute_value (struct attribute *attr, unsigned form, { case DW_FORM_addr: case DW_FORM_ref_addr: - DW_ADDR (attr) = read_address (abfd, info_ptr, cu_header, &bytes_read); + DW_ADDR (attr) = read_address (abfd, info_ptr, cu, &bytes_read); info_ptr += bytes_read; break; case DW_FORM_block2: @@ -4636,7 +4487,7 @@ read_attribute_value (struct attribute *attr, unsigned form, case DW_FORM_indirect: form = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; - info_ptr = read_attribute_value (attr, form, abfd, info_ptr, cu_header); + info_ptr = read_attribute_value (attr, form, abfd, info_ptr, cu); break; default: error ("Dwarf Error: Cannot handle %s in DWARF reader [in module %s]", @@ -4650,11 +4501,10 @@ read_attribute_value (struct attribute *attr, unsigned form, static char * read_attribute (struct attribute *attr, struct attr_abbrev *abbrev, - bfd *abfd, char *info_ptr, - const struct comp_unit_head *cu_header) + bfd *abfd, char *info_ptr, struct dwarf2_cu *cu) { attr->name = abbrev->name; - return read_attribute_value (attr, abbrev->form, abfd, info_ptr, cu_header); + return read_attribute_value (attr, abbrev->form, abfd, info_ptr, cu); } /* read dwarf information from a buffer */ @@ -4702,9 +4552,9 @@ read_8_bytes (bfd *abfd, char *buf) } static CORE_ADDR -read_address (bfd *abfd, char *buf, const struct comp_unit_head *cu_header, - int *bytes_read) +read_address (bfd *abfd, char *buf, struct dwarf2_cu *cu, int *bytes_read) { + struct comp_unit_head *cu_header = &cu->header; CORE_ADDR retval = 0; if (cu_header->signed_addr_p) @@ -5149,7 +4999,7 @@ add_file_name (struct line_header *lh, freed. */ static struct line_header * dwarf_decode_line_header (unsigned int offset, bfd *abfd, - const struct comp_unit_head *cu_header) + struct dwarf2_cu *cu) { struct cleanup *back_to; struct line_header *lh; @@ -5190,7 +5040,7 @@ dwarf_decode_line_header (unsigned int offset, bfd *abfd, lh->statement_program_end = line_ptr + lh->total_length; lh->version = read_2_bytes (abfd, line_ptr); line_ptr += 2; - lh->header_length = read_offset (abfd, line_ptr, cu_header, &bytes_read); + lh->header_length = read_offset (abfd, line_ptr, &cu->header, &bytes_read); line_ptr += bytes_read; lh->minimum_instruction_length = read_1_byte (abfd, line_ptr); line_ptr += 1; @@ -5298,12 +5148,11 @@ check_cu_functions (CORE_ADDR address) static void dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, - const struct comp_unit_head *cu_header) + struct dwarf2_cu *cu) { char *line_ptr; char *line_end; - unsigned int i, bytes_read; - char *cur_dir; + unsigned int bytes_read; unsigned char op_code, extended_op, adj_opcode; line_ptr = lh->statement_program_start; @@ -5366,7 +5215,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, record_line (current_subfile, 0, address); break; case DW_LNE_set_address: - address = read_address (abfd, line_ptr, cu_header, &bytes_read); + address = read_address (abfd, line_ptr, cu, &bytes_read); line_ptr += bytes_read; address += baseaddr; break; @@ -5510,9 +5359,11 @@ dwarf2_start_subfile (char *filename, char *dirname) static void var_decode_location (struct attribute *attr, struct symbol *sym, - struct objfile *objfile, - const struct comp_unit_head *cu_header) + struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; + struct comp_unit_head *cu_header = &cu->header; + /* NOTE drow/2003-01-30: There used to be a comment and some special code here to turn a symbol with DW_AT_external and a SYMBOL_VALUE_ADDRESS of 0 into a LOC_UNRESOLVED symbol. This was @@ -5543,8 +5394,7 @@ var_decode_location (struct attribute *attr, struct symbol *sym, int dummy; SYMBOL_VALUE_ADDRESS (sym) = - read_address (objfile->obfd, DW_BLOCK (attr)->data + 1, cu_header, - &dummy); + read_address (objfile->obfd, DW_BLOCK (attr)->data + 1, cu, &dummy); fixup_symbol_section (sym, objfile); SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SYMBOL_SECTION (sym)); @@ -5559,7 +5409,7 @@ var_decode_location (struct attribute *attr, struct symbol *sym, not be worthwhile. I'm assuming that it isn't unless performance or memory numbers show me otherwise. */ - dwarf2_symbol_mark_computed (attr, sym, cu_header, objfile); + dwarf2_symbol_mark_computed (attr, sym, cu); SYMBOL_CLASS (sym) = LOC_COMPUTED; } @@ -5570,14 +5420,13 @@ var_decode_location (struct attribute *attr, struct symbol *sym, used the passed type. */ static struct symbol * -new_symbol (struct die_info *die, struct type *type, struct objfile *objfile, - const struct comp_unit_head *cu_header) +new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; struct symbol *sym = NULL; char *name; struct attribute *attr = NULL; struct attribute *attr2 = NULL; - CORE_ADDR addr = 0; if (die->tag != DW_TAG_namespace) name = dwarf2_linkage_name (die); @@ -5602,7 +5451,7 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile, if (type != NULL) SYMBOL_TYPE (sym) = type; else - SYMBOL_TYPE (sym) = die_type (die, objfile, cu_header); + SYMBOL_TYPE (sym) = die_type (die, cu); attr = dwarf_attr (die, DW_AT_decl_line); if (attr) { @@ -5644,7 +5493,7 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile, attr = dwarf_attr (die, DW_AT_const_value); if (attr) { - dwarf2_const_value (attr, sym, objfile, cu_header); + dwarf2_const_value (attr, sym, cu); attr2 = dwarf_attr (die, DW_AT_external); if (attr2 && (DW_UNSND (attr2) != 0)) add_symbol_to_list (sym, &global_symbols); @@ -5655,7 +5504,7 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile, attr = dwarf_attr (die, DW_AT_location); if (attr) { - var_decode_location (attr, sym, objfile, cu_header); + var_decode_location (attr, sym, cu); attr2 = dwarf_attr (die, DW_AT_external); if (attr2 && (DW_UNSND (attr2) != 0)) add_symbol_to_list (sym, &global_symbols); @@ -5683,7 +5532,7 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile, attr = dwarf_attr (die, DW_AT_location); if (attr) { - var_decode_location (attr, sym, objfile, cu_header); + var_decode_location (attr, sym, cu); /* FIXME drow/2003-07-31: Is LOC_COMPUTED_ARG necessary? */ if (SYMBOL_CLASS (sym) == LOC_COMPUTED) SYMBOL_CLASS (sym) = LOC_COMPUTED_ARG; @@ -5691,7 +5540,7 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile, attr = dwarf_attr (die, DW_AT_const_value); if (attr) { - dwarf2_const_value (attr, sym, objfile, cu_header); + dwarf2_const_value (attr, sym, cu); } add_symbol_to_list (sym, list_in_scope); break; @@ -5794,7 +5643,7 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile, attr = dwarf_attr (die, DW_AT_const_value); if (attr) { - dwarf2_const_value (attr, sym, objfile, cu_header); + dwarf2_const_value (attr, sym, cu); } { /* NOTE: carlton/2002-11-29: See comment above in the @@ -5830,9 +5679,10 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile, static void dwarf2_const_value (struct attribute *attr, struct symbol *sym, - struct objfile *objfile, - const struct comp_unit_head *cu_header) + struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; + struct comp_unit_head *cu_header = &cu->header; struct dwarf_block *blk; switch (attr->form) @@ -5931,8 +5781,7 @@ dwarf2_const_value_data (struct attribute *attr, /* Return the type of the die in question using its DW_AT_type attribute. */ static struct type * -die_type (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +die_type (struct die_info *die, struct dwarf2_cu *cu) { struct type *type; struct attribute *type_attr; @@ -5943,7 +5792,7 @@ die_type (struct die_info *die, struct objfile *objfile, if (!type_attr) { /* A missing DW_AT_type represents a void type. */ - return dwarf2_fundamental_type (objfile, FT_VOID); + return dwarf2_fundamental_type (cu->objfile, FT_VOID); } else { @@ -5952,16 +5801,16 @@ die_type (struct die_info *die, struct objfile *objfile, if (!type_die) { error ("Dwarf Error: Cannot find referent at offset %d [in module %s]", - ref, objfile->name); + ref, cu->objfile->name); return NULL; } } - type = tag_type_to_type (type_die, objfile, cu_header); + type = tag_type_to_type (type_die, cu); if (!type) { dump_die (type_die); error ("Dwarf Error: Problem turning type die at offset into gdb type [in module %s]", - objfile->name); + cu->objfile->name); } return type; } @@ -5970,8 +5819,7 @@ die_type (struct die_info *die, struct objfile *objfile, DW_AT_containing_type attribute. */ static struct type * -die_containing_type (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +die_containing_type (struct die_info *die, struct dwarf2_cu *cu) { struct type *type = NULL; struct attribute *type_attr; @@ -5986,24 +5834,24 @@ die_containing_type (struct die_info *die, struct objfile *objfile, if (!type_die) { error ("Dwarf Error: Cannot find referent at offset %d [in module %s]", ref, - objfile->name); + cu->objfile->name); return NULL; } - type = tag_type_to_type (type_die, objfile, cu_header); + type = tag_type_to_type (type_die, cu); } if (!type) { if (type_die) dump_die (type_die); error ("Dwarf Error: Problem turning containing type into gdb type [in module %s]", - objfile->name); + cu->objfile->name); } return type; } #if 0 static struct type * -type_at_offset (unsigned int offset, struct objfile *objfile) +type_at_offset (unsigned int offset, struct dwarf2_cu *cu) { struct die_info *die; struct type *type; @@ -6014,14 +5862,13 @@ type_at_offset (unsigned int offset, struct objfile *objfile) error ("Dwarf Error: Cannot find type referent at offset %d.", offset); return NULL; } - type = tag_type_to_type (die, objfile); + type = tag_type_to_type (die, cu); return type; } #endif static struct type * -tag_type_to_type (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +tag_type_to_type (struct die_info *die, struct dwarf2_cu *cu) { if (die->type) { @@ -6029,20 +5876,19 @@ tag_type_to_type (struct die_info *die, struct objfile *objfile, } else { - read_type_die (die, objfile, cu_header); + read_type_die (die, cu); if (!die->type) { dump_die (die); error ("Dwarf Error: Cannot find type of die [in module %s]", - objfile->name); + cu->objfile->name); } return die->type; } } static void -read_type_die (struct die_info *die, struct objfile *objfile, - const struct comp_unit_head *cu_header) +read_type_die (struct die_info *die, struct dwarf2_cu *cu) { char *prefix = determine_prefix (die); const char *old_prefix = processing_current_prefix; @@ -6054,41 +5900,41 @@ read_type_die (struct die_info *die, struct objfile *objfile, case DW_TAG_class_type: case DW_TAG_structure_type: case DW_TAG_union_type: - read_structure_scope (die, objfile, cu_header); + read_structure_scope (die, cu); break; case DW_TAG_enumeration_type: - read_enumeration (die, objfile, cu_header); + read_enumeration (die, cu); break; case DW_TAG_subprogram: case DW_TAG_subroutine_type: - read_subroutine_type (die, objfile, cu_header); + read_subroutine_type (die, cu); break; case DW_TAG_array_type: - read_array_type (die, objfile, cu_header); + read_array_type (die, cu); break; case DW_TAG_pointer_type: - read_tag_pointer_type (die, objfile, cu_header); + read_tag_pointer_type (die, cu); break; case DW_TAG_ptr_to_member_type: - read_tag_ptr_to_member_type (die, objfile, cu_header); + read_tag_ptr_to_member_type (die, cu); break; case DW_TAG_reference_type: - read_tag_reference_type (die, objfile, cu_header); + read_tag_reference_type (die, cu); break; case DW_TAG_const_type: - read_tag_const_type (die, objfile, cu_header); + read_tag_const_type (die, cu); break; case DW_TAG_volatile_type: - read_tag_volatile_type (die, objfile, cu_header); + read_tag_volatile_type (die, cu); break; case DW_TAG_string_type: - read_tag_string_type (die, objfile); + read_tag_string_type (die, cu); break; case DW_TAG_typedef: - read_typedef (die, objfile, cu_header); + read_typedef (die, cu); break; case DW_TAG_base_type: - read_base_type (die, objfile); + read_base_type (die, cu); break; default: complaint (&symfile_complaints, "unexepected tag in read_type_die: '%s'", @@ -6206,8 +6052,10 @@ class_name (struct die_info *die) } static struct type * -dwarf_base_type (int encoding, int size, struct objfile *objfile) +dwarf_base_type (int encoding, int size, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; + /* FIXME - this should not produce a new (struct type *) every time. It should cache base types. */ struct type *type; @@ -7346,34 +7194,32 @@ dwarf2_fundamental_type (struct objfile *objfile, int typeid) Given a pointer to a dwarf block that defines a location, compute the location and return the value. - FIXME: This is a kludge until we figure out a better - way to handle the location descriptions. - Gdb's design does not mesh well with the DWARF2 notion of a location - computing interpreter, which is a shame because the flexibility goes unused. - FIXME: Implement more operations as necessary. + NOTE drow/2003-11-18: This function is called in two situations + now: for the address of static or global variables (partial symbols + only) and for offsets into structures which are expected to be + (more or less) constant. The partial symbol case should go away, + and only the constant case should remain. That will let this + function complain more accurately. A few special modes are allowed + without complaint for global variables (for instance, global + register values and thread-local values). A location description containing no operations indicates that the - object is optimized out. The global optimized_out flag is set for - those, the return value is meaningless. + object is optimized out. The return value is 0 for that case. + FIXME drow/2003-11-16: No callers check for this case any more; soon all + callers will only want a very basic result and this can become a + complaint. When the result is a register number, the global isreg flag is set, otherwise it is cleared. - When the result is a base register offset, the global offreg flag is set - and the register number is returned in basereg, otherwise it is cleared. - - When the DW_OP_fbreg operation is encountered without a corresponding - DW_AT_frame_base attribute, the global islocal flag is set. - Hopefully the machine dependent code knows how to set up a virtual - frame pointer for the local references. - Note that stack[0] is unused except as a default error return. Note that stack overflow is not yet handled. */ static CORE_ADDR -decode_locdesc (struct dwarf_block *blk, struct objfile *objfile, - const struct comp_unit_head *cu_header) +decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu) { + struct objfile *objfile = cu->objfile; + struct comp_unit_head *cu_header = &cu->header; int i; int size = blk->size; char *data = blk->data; @@ -7386,14 +7232,9 @@ decode_locdesc (struct dwarf_block *blk, struct objfile *objfile, stacki = 0; stack[stacki] = 0; isreg = 0; - offreg = 0; - isderef = 0; - islocal = 0; - optimized_out = 1; while (i < size) { - optimized_out = 0; op = data[i++]; switch (op) { @@ -7466,6 +7307,8 @@ decode_locdesc (struct dwarf_block *blk, struct objfile *objfile, case DW_OP_reg31: isreg = 1; stack[++stacki] = op - DW_OP_reg0; + if (i < size) + dwarf2_complex_location_expr_complaint (); break; case DW_OP_regx: @@ -7473,74 +7316,13 @@ decode_locdesc (struct dwarf_block *blk, struct objfile *objfile, unsnd = read_unsigned_leb128 (NULL, (data + i), &bytes_read); i += bytes_read; stack[++stacki] = unsnd; - break; - - case DW_OP_breg0: - case DW_OP_breg1: - case DW_OP_breg2: - case DW_OP_breg3: - case DW_OP_breg4: - case DW_OP_breg5: - case DW_OP_breg6: - case DW_OP_breg7: - case DW_OP_breg8: - case DW_OP_breg9: - case DW_OP_breg10: - case DW_OP_breg11: - case DW_OP_breg12: - case DW_OP_breg13: - case DW_OP_breg14: - case DW_OP_breg15: - case DW_OP_breg16: - case DW_OP_breg17: - case DW_OP_breg18: - case DW_OP_breg19: - case DW_OP_breg20: - case DW_OP_breg21: - case DW_OP_breg22: - case DW_OP_breg23: - case DW_OP_breg24: - case DW_OP_breg25: - case DW_OP_breg26: - case DW_OP_breg27: - case DW_OP_breg28: - case DW_OP_breg29: - case DW_OP_breg30: - case DW_OP_breg31: - offreg = 1; - basereg = op - DW_OP_breg0; - stack[++stacki] = read_signed_leb128 (NULL, (data + i), &bytes_read); - i += bytes_read; - break; - - case DW_OP_bregx: - offreg = 1; - basereg = read_unsigned_leb128 (NULL, (data + i), &bytes_read); - i += bytes_read; - stack[++stacki] = read_signed_leb128 (NULL, (data + i), &bytes_read); - i += bytes_read; - break; - - case DW_OP_fbreg: - stack[++stacki] = read_signed_leb128 (NULL, (data + i), &bytes_read); - i += bytes_read; - if (frame_base_reg >= 0) - { - offreg = 1; - basereg = frame_base_reg; - stack[stacki] += frame_base_offset; - } - else - { - complaint (&symfile_complaints, - "DW_AT_frame_base missing for DW_OP_fbreg"); - islocal = 1; - } + if (i < size) + dwarf2_complex_location_expr_complaint (); break; case DW_OP_addr: stack[++stacki] = read_address (objfile->obfd, &data[i], - cu_header, &bytes_read); + cu, &bytes_read); i += bytes_read; break; @@ -7606,9 +7388,10 @@ decode_locdesc (struct dwarf_block *blk, struct objfile *objfile, break; case DW_OP_deref: - isderef = 1; /* If we're not the last op, then we definitely can't encode - this using GDB's address_class enum. */ + this using GDB's address_class enum. This is valid for partial + global symbols, although the variable's address will be bogus + in the psymtab. */ if (i < size) dwarf2_complex_location_expr_complaint (); break; @@ -7618,6 +7401,8 @@ decode_locdesc (struct dwarf_block *blk, struct objfile *objfile, of the thread control block at which the variable is located. */ /* Nothing should follow this operator, so the top of stack would be returned. */ + /* This is valid for partial global symbols, but the variable's + address will be bogus in the psymtab. */ if (i < size) dwarf2_complex_location_expr_complaint (); break; @@ -7912,8 +7697,7 @@ parse_macro_definition (struct macro_source_file *file, int line, static void dwarf_decode_macros (struct line_header *lh, unsigned int offset, char *comp_dir, bfd *abfd, - const struct comp_unit_head *cu_header, - struct objfile *objfile) + struct dwarf2_cu *cu) { char *mac_ptr, *mac_end; struct macro_source_file *current_file = 0; @@ -7989,7 +7773,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, current_file = macro_start_file (file, line, current_file, comp_dir, - lh, objfile); + lh, cu->objfile); } break; @@ -8060,23 +7844,22 @@ attr_form_is_block (struct attribute *attr) static void dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, - const struct comp_unit_head *cu_header, - struct objfile *objfile) + struct dwarf2_cu *cu) { if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8) { struct dwarf2_loclist_baton *baton; - baton = obstack_alloc (&objfile->symbol_obstack, + baton = obstack_alloc (&cu->objfile->symbol_obstack, sizeof (struct dwarf2_loclist_baton)); - baton->objfile = objfile; + baton->objfile = cu->objfile; /* We don't know how long the location list is, but make sure we don't run off the edge of the section. */ baton->size = dwarf_loc_size - DW_UNSND (attr); baton->data = dwarf_loc_buffer + DW_UNSND (attr); - baton->base_address = cu_header->base_address; - if (cu_header->base_known == 0) + baton->base_address = cu->header.base_address; + if (cu->header.base_known == 0) complaint (&symfile_complaints, "Location list used without specifying the CU base address."); @@ -8087,9 +7870,9 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, { struct dwarf2_locexpr_baton *baton; - baton = obstack_alloc (&objfile->symbol_obstack, + baton = obstack_alloc (&cu->objfile->symbol_obstack, sizeof (struct dwarf2_locexpr_baton)); - baton->objfile = objfile; + baton->objfile = cu->objfile; if (attr_form_is_block (attr)) { diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 5c18487..5d1518d 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -24,42 +24,60 @@ /* If you are looking for DWARF-2 support, you are in the wrong file. - Go look in dwarf2read.c. This file is for the original DWARF. - - DWARF (also known as DWARF-1) is headed for obsoletion. - - In gcc 3.2.1, these targets prefer dwarf-1: - - i[34567]86-sequent-ptx4* # TD-R2 - i[34567]86-sequent-sysv4* # TD-R2 - i[34567]86-dg-dgux* # obsolete in gcc 3.2.1, to be removed in 3.3 - m88k-dg-dgux* # TD-R2 - mips-sni-sysv4 # TD-R2 - sparc-hal-solaris2* # TD-R2 - - Configurations marked with "# TD-R2" are on Zach Weinberg's list - of "Target Deprecation, Round 2". This is a candidate list of - targets to be deprecated in gcc 3.3 and removed in gcc 3.4. - - http://gcc.gnu.org/ml/gcc/2002-12/msg00702.html - - gcc 2.95.3 had many configurations which prefer dwarf-1. - We may have to support dwarf-1 as long as we support gcc 2.95.3. - This could use more analysis. - - DG/UX (Data General Unix) used dwarf-1 for its native format. - DG/UX uses gcc for its system C compiler, but they have their - own linker and their own debuggers. - - Takis Psarogiannakopoulos has a complete gnu toolchain for DG/UX - with gcc 2.95.3, gdb 5.1, and debug formats of dwarf-2 and stabs. - For more info, see PR gdb/979 and PR gdb/1013; also: - - http://sources.redhat.com/ml/gdb/2003-02/msg00074.html - - There may be non-gcc compilers that still emit dwarf-1. - - -- chastain 2003-02-04 + Go look in dwarf2read.c. This file is for the original DWARF, + also known as DWARF-1. + + DWARF-1 is slowly headed for obsoletion. + + In gcc HEAD 2003-11-29 16:28:31 UTC, no targets prefer dwarf-1. + + In gcc 3.3.2, these targets prefer dwarf-1: + + i[34567]86-sequent-ptx4* + i[34567]86-sequent-sysv4* + mips-sni-sysv4 + sparc-hal-solaris2* + + In gcc 3.2.2, these targets prefer dwarf-1: + + i[34567]86-dg-dgux* + i[34567]86-sequent-ptx4* + i[34567]86-sequent-sysv4* + m88k-dg-dgux* + mips-sni-sysv4 + sparc-hal-solaris2* + + In gcc 2.95.3, these targets prefer dwarf-1: + + i[34567]86-dg-dgux* + i[34567]86-ncr-sysv4* + i[34567]86-sequent-ptx4* + i[34567]86-sequent-sysv4* + i[34567]86-*-osf1* + i[34567]86-*-sco3.2v5* + i[34567]86-*-sysv4* + i860-alliant-* + i860-*-sysv4* + m68k-atari-sysv4* + m68k-cbm-sysv4* + m68k-*-sysv4* + m88k-dg-dgux* + m88k-*-sysv4* + mips-sni-sysv4 + mips-*-gnu* + sh-*-elf* + sh-*-rtemself* + sparc-hal-solaris2* + sparc-*-sysv4* + + Some non-gcc compilers produce dwarf-1: + + PR gdb/1179 was from a user with Diab C++ 4.3. + Other users have also reported using Diab compilers with dwarf-1. + On 2003-06-09 the gdb list received a report from a user + with Absoft ProFortran f77 which is dwarf-1. + + -- chastain 2003-12-01 */ /* @@ -1802,7 +1820,7 @@ handle_producer (char *producer) /* If this compilation unit was compiled with g++ or gcc, then set the processing_gcc_compilation flag. */ - if (STREQN (producer, GCC_PRODUCER, strlen (GCC_PRODUCER))) + if (DEPRECATED_STREQN (producer, GCC_PRODUCER, strlen (GCC_PRODUCER))) { char version = producer[strlen (GCC_PRODUCER)]; processing_gcc_compilation = (version == '2' ? 2 : 1); @@ -1820,7 +1838,7 @@ handle_producer (char *producer) if (AUTO_DEMANGLING) { - if (STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER))) + if (DEPRECATED_STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER))) { #if 0 /* For now, stay with AUTO_DEMANGLING for g++ output, as we don't @@ -1828,7 +1846,7 @@ handle_producer (char *producer) set_demangling_style (GNU_DEMANGLING_STYLE_STRING); #endif } - else if (STREQN (producer, LCC_PRODUCER, strlen (LCC_PRODUCER))) + else if (DEPRECATED_STREQN (producer, LCC_PRODUCER, strlen (LCC_PRODUCER))) { set_demangling_style (LUCID_DEMANGLING_STYLE_STRING); } diff --git a/gdb/elfread.c b/gdb/elfread.c index 8814f89..d3779c0 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -105,15 +105,15 @@ elf_locate_sections (bfd *ignore_abfd, asection *sectp, void *eip) } static struct minimal_symbol * -record_minimal_symbol_and_info (char *name, CORE_ADDR address, - enum minimal_symbol_type ms_type, char *info, /* FIXME, is this really char *? */ - asection *bfd_section, struct objfile *objfile) +record_minimal_symbol (char *name, CORE_ADDR address, + enum minimal_symbol_type ms_type, + asection *bfd_section, struct objfile *objfile) { if (ms_type == mst_text || ms_type == mst_file_text) address = SMASH_TEXT_ADDRESS (address); return prim_record_minimal_symbol_and_info - (name, address, ms_type, info, bfd_section->index, bfd_section, objfile); + (name, address, ms_type, NULL, bfd_section->index, bfd_section, objfile); } /* @@ -163,7 +163,6 @@ elf_symtab_read (struct objfile *objfile, int dynamic) char *filesymname = obsavestring ("", 0, &objfile->symbol_obstack); #endif struct dbx_symfile_info *dbx = objfile->sym_stab_info; - unsigned long size; int stripped = (bfd_get_symcount (objfile->obfd) == 0); if (dynamic) @@ -223,9 +222,9 @@ elf_symtab_read (struct objfile *objfile, int dynamic) if (symaddr == 0) continue; symaddr += offset; - msym = record_minimal_symbol_and_info + msym = record_minimal_symbol ((char *) sym->name, symaddr, - mst_solib_trampoline, NULL, sym->section, objfile); + mst_solib_trampoline, sym->section, objfile); #ifdef SOFUN_ADDRESS_MAYBE_MISSING if (msym != NULL) msym->filename = filesymname; @@ -343,10 +342,7 @@ elf_symtab_read (struct objfile *objfile, int dynamic) else if (sym->flags & BSF_LOCAL) { /* Named Local variable in a Data section. - Check its name for stabs-in-elf. The STREQ - macro checks the first character inline, so - we only actually do a strcmp function call on - names that start with 'B' or 'D'. */ + Check its name for stabs-in-elf. */ int special_local_sect; if (strcmp ("Bbss.bss", sym->name) == 0) special_local_sect = SECT_OFF_BSS (objfile); @@ -436,11 +432,15 @@ elf_symtab_read (struct objfile *objfile, int dynamic) /* ms_type = mst_unknown; */ continue; /* Skip this symbol. */ } - /* Pass symbol size field in via BFD. FIXME!!! */ - size = ((elf_symbol_type *) sym)->internal_elf_sym.st_size; - msym = record_minimal_symbol_and_info + msym = record_minimal_symbol ((char *) sym->name, symaddr, - ms_type, (void *) size, sym->section, objfile); + ms_type, sym->section, objfile); + if (msym) + { + /* Pass symbol size field in via BFD. FIXME!!! */ + unsigned long size = ((elf_symbol_type *) sym)->internal_elf_sym.st_size; + MSYMBOL_SIZE(msym) = size; + } #ifdef SOFUN_ADDRESS_MAYBE_MISSING if (msym != NULL) msym->filename = filesymname; diff --git a/gdb/environ.c b/gdb/environ.c index 01eb57a..b629388 100644 --- a/gdb/environ.c +++ b/gdb/environ.c @@ -170,7 +170,7 @@ unset_in_environ (struct environ *e, char *var) for (; (s = *vector) != NULL; vector++) { - if (STREQN (s, var, len) && s[len] == '=') + if (DEPRECATED_STREQN (s, var, len) && s[len] == '=') { xfree (s); /* Walk through the vector, shuffling args down by one, including @@ -227,7 +227,7 @@ evaluate_struct_tuple (struct value *struct_val, fieldno++) { char *field_name = TYPE_FIELD_NAME (struct_type, fieldno); - if (field_name != NULL && STREQ (field_name, label)) + if (field_name != NULL && DEPRECATED_STREQ (field_name, label)) { variantno = -1; subfieldno = fieldno; @@ -255,7 +255,7 @@ evaluate_struct_tuple (struct value *struct_val, subfieldno < TYPE_NFIELDS (substruct_type); subfieldno++) { - if (STREQ (TYPE_FIELD_NAME (substruct_type, + if (DEPRECATED_STREQ (TYPE_FIELD_NAME (substruct_type, subfieldno), label)) { @@ -384,14 +384,14 @@ bfdsec_to_vmap (struct bfd *abfd, struct bfd_section *sect, void *arg3) if ((bfd_get_section_flags (abfd, sect) & SEC_LOAD) == 0) return; - if (STREQ (bfd_section_name (abfd, sect), ".text")) + if (DEPRECATED_STREQ (bfd_section_name (abfd, sect), ".text")) { vp->tstart = bfd_section_vma (abfd, sect); vp->tend = vp->tstart + bfd_section_size (abfd, sect); vp->tvma = bfd_section_vma (abfd, sect); vp->toffs = sect->filepos; } - else if (STREQ (bfd_section_name (abfd, sect), ".data")) + else if (DEPRECATED_STREQ (bfd_section_name (abfd, sect), ".data")) { vp->dstart = bfd_section_vma (abfd, sect); vp->dend = vp->dstart + bfd_section_size (abfd, sect); diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 9ad4792..37ca92c 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -799,7 +799,8 @@ find_common_for_function (char *name, char *funcname) while (tmp != NULL) { - if (STREQ (tmp->name, name) && STREQ (tmp->owning_function, funcname)) + if (DEPRECATED_STREQ (tmp->name, name) + && DEPRECATED_STREQ (tmp->owning_function, funcname)) return (tmp); else tmp = tmp->next; diff --git a/gdb/frame.c b/gdb/frame.c index a405a6b..1d37891 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -86,10 +86,6 @@ struct frame_info initialized by DEPRECATED_INIT_EXTRA_FRAME_INFO */ struct frame_extra_info *extra_info; - /* If dwarf2 unwind frame informations is used, this structure holds - all related unwind data. */ - struct context *context; - /* The frame's low-level unwinder and corresponding cache. The low-level unwinder is responsible for unwinding register values for the previous frame. The low-level unwind methods are @@ -668,15 +664,6 @@ get_frame_register_unsigned (struct frame_info *frame, int regnum) } void -frame_unwind_signed_register (struct frame_info *frame, int regnum, - LONGEST *val) -{ - char buf[MAX_REGISTER_SIZE]; - frame_unwind_register (frame, regnum, buf); - (*val) = extract_signed_integer (buf, DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum)); -} - -void frame_unwind_unsigned_register (struct frame_info *frame, int regnum, ULONGEST *val) { @@ -930,7 +917,13 @@ select_frame (struct frame_info *fi) source language of this frame, and switch to it if desired. */ if (fi) { - s = find_pc_symtab (get_frame_pc (fi)); + /* We retrieve the frame's symtab by using the frame PC. However + we cannot use the frame pc as is, because it usually points to + the instruction following the "call", which is sometimes the + first instruction of another function. So we rely on + get_frame_address_in_block() which provides us with a PC which + is guaranteed to be inside the frame's code block. */ + s = find_pc_symtab (get_frame_address_in_block (fi)); if (s && s->language != current_language->la_language && s->language != language_unknown @@ -1790,9 +1783,13 @@ get_prev_frame (struct frame_info *this_frame) get_current_frame(). */ gdb_assert (this_frame != NULL); + /* Make sure we pass an address within THIS_FRAME's code block to + inside_main_func. Otherwise, we might stop unwinding at a + function which has a call instruction as its last instruction if + that function immediately precedes main(). */ if (this_frame->level >= 0 && !backtrace_past_main - && inside_main_func (get_frame_pc (this_frame))) + && inside_main_func (get_frame_address_in_block (this_frame))) /* Don't unwind past main(), bug always unwind the sentinel frame. Note, this is done _before_ the frame has been marked as previously unwound. That way if the user later decides to @@ -2223,61 +2220,13 @@ deprecated_update_frame_base_hack (struct frame_info *frame, CORE_ADDR base) frame->this_id.value.stack_addr = base; } -void -deprecated_set_frame_saved_regs_hack (struct frame_info *frame, - CORE_ADDR *saved_regs) -{ - frame->saved_regs = saved_regs; -} - -void -deprecated_set_frame_extra_info_hack (struct frame_info *frame, - struct frame_extra_info *extra_info) -{ - frame->extra_info = extra_info; -} - -void -deprecated_set_frame_next_hack (struct frame_info *fi, - struct frame_info *next) -{ - fi->next = next; -} - -void -deprecated_set_frame_prev_hack (struct frame_info *fi, - struct frame_info *prev) -{ - fi->prev = prev; -} - -struct context * -deprecated_get_frame_context (struct frame_info *fi) -{ - return fi->context; -} - -void -deprecated_set_frame_context (struct frame_info *fi, - struct context *context) -{ - fi->context = context; -} - struct frame_info * -deprecated_frame_xmalloc (void) +deprecated_frame_xmalloc_with_cleanup (long sizeof_saved_regs, + long sizeof_extra_info) { struct frame_info *frame = XMALLOC (struct frame_info); memset (frame, 0, sizeof (*frame)); frame->this_id.p = 1; - return frame; -} - -struct frame_info * -deprecated_frame_xmalloc_with_cleanup (long sizeof_saved_regs, - long sizeof_extra_info) -{ - struct frame_info *frame = deprecated_frame_xmalloc (); make_cleanup (xfree, frame); if (sizeof_saved_regs > 0) { diff --git a/gdb/frame.h b/gdb/frame.h index c31f41e..982c81e 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -408,10 +408,6 @@ extern ULONGEST get_frame_register_unsigned (struct frame_info *frame, /* Use frame_unwind_register_signed. */ -extern void frame_unwind_signed_register (struct frame_info *frame, - int regnum, LONGEST *val); - -/* Use frame_unwind_register_signed. */ extern void frame_unwind_unsigned_register (struct frame_info *frame, int regnum, ULONGEST *val); @@ -572,9 +568,7 @@ extern void show_frame_info (struct frame_info *, int, int, int); extern struct frame_info *block_innermost_frame (const struct block *); -/* NOTE: cagney/2002-09-13: There is no need for this function. - Instead either of frame_unwind_signed_register() or - frame_unwind_unsigned_register() can be used. */ +/* NOTE: cagney/2002-09-13: There is no need for this function. */ extern CORE_ADDR deprecated_read_register_dummy (CORE_ADDR pc, CORE_ADDR fp, int); extern void generic_push_dummy_frame (void); @@ -702,25 +696,6 @@ extern void deprecated_update_frame_pc_hack (struct frame_info *frame, extern void deprecated_update_frame_base_hack (struct frame_info *frame, CORE_ADDR base); -/* FIXME: cagney/2003-01-04: Explicitly set the frame's saved_regs - and/or extra_info. Target code is allocating a fake frame and than - initializing that to get around the problem of, when creating the - inner most frame, there is no where to cache information such as - the prologue analysis. This is fixed by the new unwind mechanism - - even the inner most frame has somewhere to store things like the - prolog analysis (or at least will once the frame overhaul is - finished). */ -extern void deprecated_set_frame_saved_regs_hack (struct frame_info *frame, - CORE_ADDR *saved_regs); -extern void deprecated_set_frame_extra_info_hack (struct frame_info *frame, - struct frame_extra_info *extra_info); - -/* FIXME: cagney/2003-01-04: Allocate a frame from the heap (rather - than the frame obstack). Targets do this as a way of saving the - prologue analysis from the inner most frame before that frame has - been created. By always creating a frame, this problem goes away. */ -extern struct frame_info *deprecated_frame_xmalloc (void); - /* FIXME: cagney/2003-01-05: Allocate a frame, along with the saved_regs and extra_info. Set up cleanups for all three. Same as for deprecated_frame_xmalloc, targets are calling this when @@ -730,26 +705,6 @@ extern struct frame_info *deprecated_frame_xmalloc (void); extern struct frame_info *deprecated_frame_xmalloc_with_cleanup (long sizeof_saved_regs, long sizeof_extra_info); -/* FIXME: cagney/2003-01-07: These are just nasty. Code shouldn't be - doing this. I suspect it dates back to the days when every field - of an allocated structure was explicitly initialized. */ -extern void deprecated_set_frame_next_hack (struct frame_info *fi, - struct frame_info *next); -extern void deprecated_set_frame_prev_hack (struct frame_info *fi, - struct frame_info *prev); - -/* FIXME: cagney/2003-01-07: Instead of the dwarf2cfi having its own - dedicated `struct frame_info . context' field, the code should use - the per frame `unwind_cache' that is passed to the - frame_pc_unwind(), frame_register_unwind() and frame_id_unwind() - methods. - - See "dummy-frame.c" for an example of how a cfi-frame object can be - implemented using this. */ -extern struct context *deprecated_get_frame_context (struct frame_info *fi); -extern void deprecated_set_frame_context (struct frame_info *fi, - struct context *context); - /* Return non-zero if the architecture is relying on legacy frame code. */ extern int legacy_frame_p (struct gdbarch *gdbarch); diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index e08ebe4..4fc8740 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -1101,11 +1101,6 @@ frv_frame_this_id (struct frame_info *next_frame, /* The FUNC is easy. */ func = frame_func_unwind (next_frame); - /* This is meant to halt the backtrace at "_start". Make sure we - don't halt it at a generic dummy frame. */ - if (inside_entry_func (func)) - return; - /* Check if the stack is empty. */ msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL); if (msym_stack && info->base == SYMBOL_VALUE_ADDRESS (msym_stack)) @@ -1212,6 +1207,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) case bfd_mach_frvsimple: case bfd_mach_fr500: case bfd_mach_frvtomcat: + case bfd_mach_fr550: set_variant_num_gprs (var, 64); set_variant_num_fprs (var, 64); break; diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index f73a4f6..bac577b 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -420,7 +420,7 @@ struct gdbarch startup_gdbarch = 0, /* software_single_step */ 0, /* print_insn */ 0, /* skip_trampoline_code */ - 0, /* skip_solib_resolver */ + generic_skip_solib_resolver, /* skip_solib_resolver */ 0, /* in_solib_call_trampoline */ 0, /* in_solib_return_trampoline */ 0, /* pc_in_sigtramp */ @@ -2217,16 +2217,9 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) (long) current_gdbarch->skip_prologue /*SKIP_PROLOGUE ()*/); #endif -#ifdef SKIP_SOLIB_RESOLVER fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "SKIP_SOLIB_RESOLVER(pc)", - XSTRING (SKIP_SOLIB_RESOLVER (pc))); - fprintf_unfiltered (file, - "gdbarch_dump: SKIP_SOLIB_RESOLVER = <0x%08lx>\n", - (long) current_gdbarch->skip_solib_resolver - /*SKIP_SOLIB_RESOLVER ()*/); -#endif + "gdbarch_dump: skip_solib_resolver = 0x%08lx\n", + (long) current_gdbarch->skip_solib_resolver); #ifdef SKIP_TRAMPOLINE_CODE fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -5220,7 +5213,7 @@ gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) gdb_assert (gdbarch->skip_solib_resolver != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_solib_resolver called\n"); - return gdbarch->skip_solib_resolver (pc); + return gdbarch->skip_solib_resolver (gdbarch, pc); } void diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 3affac5..a9df675 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -2138,15 +2138,9 @@ extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_s evaluates non-zero, this is the address where the debugger will place a step-resume breakpoint to get us past the dynamic linker. */ -typedef CORE_ADDR (gdbarch_skip_solib_resolver_ftype) (CORE_ADDR pc); +typedef CORE_ADDR (gdbarch_skip_solib_resolver_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc); extern CORE_ADDR gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc); extern void set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, gdbarch_skip_solib_resolver_ftype *skip_solib_resolver); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SKIP_SOLIB_RESOLVER) -#error "Non multi-arch definition of SKIP_SOLIB_RESOLVER" -#endif -#if !defined (SKIP_SOLIB_RESOLVER) -#define SKIP_SOLIB_RESOLVER(pc) (gdbarch_skip_solib_resolver (current_gdbarch, pc)) -#endif /* For SVR4 shared libraries, each call goes through a small piece of trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates @@ -2609,6 +2603,7 @@ extern void set_gdbarch_data (struct gdbarch *gdbarch, extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *); + /* Register per-architecture memory region. Provide a memory-region swap mechanism. Per-architecture memory @@ -2627,33 +2622,6 @@ extern void register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ -/* The target-system-dependent byte order is dynamic */ - -extern int target_byte_order; -#ifndef TARGET_BYTE_ORDER -#define TARGET_BYTE_ORDER (target_byte_order + 0) -#endif - -extern int target_byte_order_auto; -#ifndef TARGET_BYTE_ORDER_AUTO -#define TARGET_BYTE_ORDER_AUTO (target_byte_order_auto + 0) -#endif - - - -/* The target-system-dependent BFD architecture is dynamic */ - -extern int target_architecture_auto; -#ifndef TARGET_ARCHITECTURE_AUTO -#define TARGET_ARCHITECTURE_AUTO (target_architecture_auto + 0) -#endif - -extern const struct bfd_arch_info *target_architecture; -#ifndef TARGET_ARCHITECTURE -#define TARGET_ARCHITECTURE (target_architecture + 0) -#endif - - /* Set the dynamic target-system-dependent parameters (architecture, byte-order, ...) using information found in the BFD */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 95db711..eb015b3 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -704,7 +704,7 @@ f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generi # If IN_SOLIB_DYNSYM_RESOLVE_CODE returns true, and SKIP_SOLIB_RESOLVER # evaluates non-zero, this is the address where the debugger will place # a step-resume breakpoint to get us past the dynamic linker. -f:2:SKIP_SOLIB_RESOLVER:CORE_ADDR:skip_solib_resolver:CORE_ADDR pc:pc:::generic_skip_solib_resolver::0 +m:2:SKIP_SOLIB_RESOLVER:CORE_ADDR:skip_solib_resolver:CORE_ADDR pc:pc:::generic_skip_solib_resolver::0 # For SVR4 shared libraries, each call goes through a small piece of # trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates # to nonzero if we are currently stopped in one of these. @@ -1215,6 +1215,7 @@ extern void set_gdbarch_data (struct gdbarch *gdbarch, extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *); + /* Register per-architecture memory region. Provide a memory-region swap mechanism. Per-architecture memory @@ -1233,33 +1234,6 @@ extern void register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ -/* The target-system-dependent byte order is dynamic */ - -extern int target_byte_order; -#ifndef TARGET_BYTE_ORDER -#define TARGET_BYTE_ORDER (target_byte_order + 0) -#endif - -extern int target_byte_order_auto; -#ifndef TARGET_BYTE_ORDER_AUTO -#define TARGET_BYTE_ORDER_AUTO (target_byte_order_auto + 0) -#endif - - - -/* The target-system-dependent BFD architecture is dynamic */ - -extern int target_architecture_auto; -#ifndef TARGET_ARCHITECTURE_AUTO -#define TARGET_ARCHITECTURE_AUTO (target_architecture_auto + 0) -#endif - -extern const struct bfd_arch_info *target_architecture; -#ifndef TARGET_ARCHITECTURE -#define TARGET_ARCHITECTURE (target_architecture + 0) -#endif - - /* Set the dynamic target-system-dependent parameters (architecture, byte-order, ...) using information found in the BFD */ diff --git a/gdb/glibc-tdep.c b/gdb/glibc-tdep.c index 46aa749..04bb683 100644 --- a/gdb/glibc-tdep.c +++ b/gdb/glibc-tdep.c @@ -66,7 +66,7 @@ find_minsym_and_objfile (char *name, struct objfile **objfile_p) trigger when the dynamic linker is done. */ CORE_ADDR -glibc_skip_solib_resolver (CORE_ADDR pc) +glibc_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) { /* The GNU dynamic linker is part of the GNU C library, and is used by all GNU systems (GNU/Hurd, GNU/Linux). An unresolved PLT diff --git a/gdb/glibc-tdep.h b/gdb/glibc-tdep.h index 31c77b9..75598d5 100644 --- a/gdb/glibc-tdep.h +++ b/gdb/glibc-tdep.h @@ -22,6 +22,9 @@ #ifndef GLIBC_TDEP_H #define GLIBC_TDEP_H -extern CORE_ADDR glibc_skip_solib_resolver (CORE_ADDR); +struct gdbarch; + +extern CORE_ADDR glibc_skip_solib_resolver (struct gdbarch *gdbarch, + CORE_ADDR); #endif /* glibc-tdep.h */ diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c index 2234d3b..8cb2a7e 100644 --- a/gdb/gnu-v2-abi.c +++ b/gdb/gnu-v2-abi.c @@ -1,6 +1,6 @@ /* Abstraction of GNU v2 abi. - Copyright 2001, 2003 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Daniel Berlin <dberlin@redhat.com> @@ -30,6 +30,7 @@ #include "value.h" #include "demangle.h" #include "cp-abi.h" +#include "cp-support.h" #include <ctype.h> @@ -259,9 +260,9 @@ gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc) *(strchr(demangled_name,' '))=0; /* Lookup the type for the name */ - rtti_type=lookup_typename(demangled_name, (struct block *)0,1); - - if (rtti_type==NULL) + /* FIXME: chastain/2003-11-26: block=NULL is bogus. See pr gdb/1465. */ + rtti_type = cp_lookup_rtti_type (demangled_name, NULL); + if (rtti_type == NULL) return NULL; if (TYPE_N_BASECLASSES(rtti_type) > 1 && full && (*full) != 1) diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index b18e644..0fbdd6e 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -1,7 +1,7 @@ /* Abstraction of GNU v3 abi. Contributed by Jim Blandy <jimb@redhat.com> - Copyright 2001, 2002 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -23,6 +23,7 @@ #include "defs.h" #include "value.h" #include "cp-abi.h" +#include "cp-support.h" #include "demangle.h" #include "gdb_assert.h" #include "gdb_string.h" @@ -196,7 +197,6 @@ gnuv3_rtti_type (struct value *value, struct minimal_symbol *vtable_symbol; const char *vtable_symbol_name; const char *class_name; - struct symbol *class_symbol; struct type *run_time_type; struct type *base_type; LONGEST offset_to_top; @@ -255,26 +255,10 @@ gnuv3_rtti_type (struct value *value, class_name = vtable_symbol_name + 11; /* Try to look up the class name as a type name. */ - class_symbol = lookup_symbol (class_name, 0, STRUCT_DOMAIN, 0, 0); - if (! class_symbol) - { - warning ("can't find class named `%s', as given by C++ RTTI", class_name); - return NULL; - } - - /* Make sure the type symbol is sane. (An earlier version of this - code would find constructor functions, who have the same name as - the class.) */ - if (SYMBOL_CLASS (class_symbol) != LOC_TYPEDEF - || TYPE_CODE (SYMBOL_TYPE (class_symbol)) != TYPE_CODE_CLASS) - { - warning ("C++ RTTI gives a class name of `%s', but that isn't a type name", - class_name); - return NULL; - } - - /* This is the object's run-time type! */ - run_time_type = SYMBOL_TYPE (class_symbol); + /* FIXME: chastain/2003-11-26: block=NULL is bogus. See pr gdb/1465. */ + run_time_type = cp_lookup_rtti_type (class_name, NULL); + if (run_time_type == NULL) + return NULL; /* Get the offset from VALUE to the top of the complete object. NOTE: this is the reverse of the meaning of *TOP_P. */ diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index ec05f01..4a66d80 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -49,7 +49,14 @@ enum h8300h_reg_size = 4, h8300_max_reg_size = 4, }; -#define BINWORD (h8300hmode && !h8300_normal_mode ? h8300h_reg_size : h8300_reg_size) + +static int is_h8300hmode (struct gdbarch *gdbarch); +static int is_h8300smode (struct gdbarch *gdbarch); +static int is_h8300sxmode (struct gdbarch *gdbarch); +static int is_h8300_normal_mode (struct gdbarch *gdbarch); + +#define BINWORD (is_h8300hmode (current_gdbarch) && \ + !is_h8300_normal_mode (current_gdbarch) ? h8300h_reg_size : h8300_reg_size) enum gdb_regnum { @@ -350,7 +357,8 @@ h8300_examine_prologue (CORE_ADDR ip, CORE_ADDR limit, } /* If the PC isn't valid, quit now. */ - if (ip == 0 || ip & (h8300hmode && !h8300_normal_mode ? ~0xffffff : ~0xffff)) + if (ip == 0 || ip & (is_h8300hmode (current_gdbarch) && + !is_h8300_normal_mode (current_gdbarch) ? ~0xffffff : ~0xffff)) return 0; next_ip = h8300_next_prologue_insn (ip, limit, &insn_word); @@ -947,7 +955,8 @@ h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file, rval = get_frame_register_signed (frame, regno); fprintf_filtered (file, "%-14s ", name); - if (regno == E_PSEUDO_CCR_REGNUM || (regno == E_PSEUDO_EXR_REGNUM && h8300smode)) + if (regno == E_PSEUDO_CCR_REGNUM || + (regno == E_PSEUDO_EXR_REGNUM && is_h8300smode (current_gdbarch))) { fprintf_filtered (file, "0x%02x ", (unsigned char)rval); print_longest (file, 'u', 1, rval); @@ -996,7 +1005,7 @@ h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file, if ((Z | (N ^ V)) == 1) fprintf_filtered (file, "<= "); } - else if (regno == E_PSEUDO_EXR_REGNUM && h8300smode) + else if (regno == E_PSEUDO_EXR_REGNUM && is_h8300smode (current_gdbarch)) { /* EXR register */ unsigned char l = rval & 0xff; @@ -1019,10 +1028,10 @@ h8300_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, h8300_print_register (gdbarch, file, frame, regno); h8300_print_register (gdbarch, file, frame, E_PSEUDO_CCR_REGNUM); h8300_print_register (gdbarch, file, frame, E_PC_REGNUM); - if (h8300smode) + if (is_h8300smode (current_gdbarch)) { h8300_print_register (gdbarch, file, frame, E_PSEUDO_EXR_REGNUM); - if (h8300sxmode) + if (is_h8300sxmode (current_gdbarch)) { h8300_print_register (gdbarch, file, frame, E_SBR_REGNUM); h8300_print_register (gdbarch, file, frame, E_VBR_REGNUM); @@ -1044,7 +1053,7 @@ h8300_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, { if (regno == E_CCR_REGNUM) h8300_print_register (gdbarch, file, frame, E_PSEUDO_CCR_REGNUM); - else if (regno == E_PSEUDO_EXR_REGNUM && h8300smode) + else if (regno == E_PSEUDO_EXR_REGNUM && is_h8300smode (current_gdbarch)) h8300_print_register (gdbarch, file, frame, E_PSEUDO_EXR_REGNUM); else h8300_print_register (gdbarch, file, frame, regno); @@ -1078,7 +1087,7 @@ h8300_register_type (struct gdbarch *gdbarch, int regno) return builtin_type_uint8; else if (regno == E_PSEUDO_EXR_REGNUM) return builtin_type_uint8; - else if (h8300hmode) + else if (is_h8300hmode (current_gdbarch)) return builtin_type_int32; else return builtin_type_int16; @@ -1192,9 +1201,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) switch (info.bfd_arch_info->mach) { case bfd_mach_h8300: - h8300sxmode = 0; - h8300smode = 0; - h8300hmode = 0; set_gdbarch_num_regs (gdbarch, 13); set_gdbarch_num_pseudo_regs (gdbarch, 1); set_gdbarch_ecoff_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum); @@ -1210,9 +1216,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) break; case bfd_mach_h8300h: case bfd_mach_h8300hn: - h8300sxmode = 0; - h8300smode = 0; - h8300hmode = 1; set_gdbarch_num_regs (gdbarch, 13); set_gdbarch_num_pseudo_regs (gdbarch, 1); set_gdbarch_ecoff_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum); @@ -1222,13 +1225,11 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_name (gdbarch, h8300_register_name); if(info.bfd_arch_info->mach != bfd_mach_h8300hn) { - h8300_normal_mode = 0; set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); } else { - h8300_normal_mode = 1; set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); } @@ -1238,9 +1239,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) break; case bfd_mach_h8300s: case bfd_mach_h8300sn: - h8300sxmode = 0; - h8300smode = 1; - h8300hmode = 1; set_gdbarch_num_regs (gdbarch, 16); set_gdbarch_num_pseudo_regs (gdbarch, 2); set_gdbarch_ecoff_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum); @@ -1250,13 +1248,11 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_name (gdbarch, h8300s_register_name); if(info.bfd_arch_info->mach != bfd_mach_h8300sn) { - h8300_normal_mode = 0; set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); } else { - h8300_normal_mode = 1; set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); } @@ -1266,9 +1262,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) break; case bfd_mach_h8300sx: case bfd_mach_h8300sxn: - h8300sxmode = 1; - h8300smode = 1; - h8300hmode = 1; set_gdbarch_num_regs (gdbarch, 18); set_gdbarch_num_pseudo_regs (gdbarch, 2); set_gdbarch_ecoff_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum); @@ -1278,13 +1271,11 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_name (gdbarch, h8300sx_register_name); if(info.bfd_arch_info->mach != bfd_mach_h8300sxn) { - h8300_normal_mode = 0; set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); } else { - h8300_normal_mode = 1; set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); } @@ -1370,3 +1361,39 @@ _initialize_h8300_tdep (void) { register_gdbarch_init (bfd_arch_h8300, h8300_gdbarch_init); } + +static int +is_h8300hmode (struct gdbarch *gdbarch) +{ + return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sx + || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn + || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300s + || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn + || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300h + || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300hn; +} + +static int +is_h8300smode (struct gdbarch *gdbarch) +{ + return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sx + || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn + || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300s + || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn; +} + +static int +is_h8300sxmode (struct gdbarch *gdbarch) +{ + return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sx + || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn; +} + +static int +is_h8300_normal_mode (struct gdbarch *gdbarch) +{ + return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn + || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn + || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300hn; +} + diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 7386e49..57579bc 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -2060,30 +2060,6 @@ hppa_push_arguments (int nargs, struct value **args, CORE_ADDR sp, #endif -/* elz: this function returns a value which is built looking at the given address. - It is called from call_function_by_hand, in case we need to return a - value which is larger than 64 bits, and it is stored in the stack rather than - in the registers r28 and r29 or fr4. - This function does the same stuff as value_being_returned in values.c, but - gets the value from the stack rather than from the buffer where all the - registers were saved when the function called completed. */ -/* FIXME: cagney/2003-09-27: This function is no longer needed. The - inferior function call code now directly handles the case described - above. */ -struct value * -hppa_value_returned_from_stack (struct type *valtype, CORE_ADDR addr) -{ - struct value *val; - - val = allocate_value (valtype); - CHECK_TYPEDEF (valtype); - target_read_memory (addr, VALUE_CONTENTS_RAW (val), TYPE_LENGTH (valtype)); - - return val; -} - - - /* elz: Used to lookup a symbol in the shared libraries. This function calls shl_findsym, indirectly through a call to __d_shl_get. __d_shl_get is in end.c, which is always @@ -3402,7 +3378,7 @@ hppa_skip_trampoline_code (CORE_ADDR pc) ALL_MSYMBOLS (objfile, msymbol) { if (MSYMBOL_TYPE (msymbol) == mst_text - && STREQ (DEPRECATED_SYMBOL_NAME (msymbol), DEPRECATED_SYMBOL_NAME (msym))) + && DEPRECATED_STREQ (DEPRECATED_SYMBOL_NAME (msymbol), DEPRECATED_SYMBOL_NAME (msym))) { function_found = 1; break; diff --git a/gdb/hpread.c b/gdb/hpread.c index daa5d5e..40875f7 100644 --- a/gdb/hpread.c +++ b/gdb/hpread.c @@ -3897,7 +3897,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, fn_p = fn_list; while (fn_p) { - if (STREQ (fn_p->field.name, method_name)) + if (DEPRECATED_STREQ (fn_p->field.name, method_name)) break; fn_p = fn_p->next; } @@ -6303,7 +6303,7 @@ hpread_get_next_skip_over_anon_unions (int skip_fields, dnttpointer field, /* Do we have another anonymous union? If so, adjust the bitoffsets of its members and skip over its members. */ if ((TYPE_CODE (anon_type) == TYPE_CODE_UNION) && - (!name || STREQ (name, ""))) + (!name || DEPRECATED_STREQ (name, ""))) { hpread_adjust_bitoffsets (anon_type, bitoffset); field = hpread_get_next_skip_over_anon_unions (TYPE_NFIELDS (anon_type), field, fieldp, objfile); diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 48caf4d..50073b1 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -306,14 +306,6 @@ i386_linux_write_pc (CORE_ADDR pc, ptid_t ptid) write_register_pid (I386_LINUX_ORIG_EAX_REGNUM, -1, ptid); } -/* Calling functions in shared libraries. */ - -CORE_ADDR -i386_linux_skip_solib_resolver (CORE_ADDR pc) -{ - return glibc_skip_solib_resolver (pc); -} - /* Fetch (and possibly build) an appropriate link_map_offsets structure for native GNU/Linux x86 targets using the struct offsets defined in link.h (but without actual reference to that file). @@ -453,6 +445,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) to support backtracing through calls to signal handlers. */ set_gdbarch_pc_in_sigtramp (gdbarch, i386_linux_pc_in_sigtramp); + set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); set_solib_svr4_fetch_link_map_offsets (gdbarch, i386_linux_svr4_fetch_link_map_offsets); } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 69db1fa..4ee9fa4 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -508,9 +508,13 @@ i386_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR current_pc, subl %edx, %edx subl %eax, %eax + Because of the symmetry, there are actually two ways to + encode these instructions; with opcode bytes 0x29 and 0x2b + for `subl' and opcode bytes 0x31 and 0x33 for `xorl'. + Make sure we only skip these instructions if we later see the `movl %esp, %ebp' that actually sets up the frame. */ - while (op == 0x29 || op == 0x31) + while (op == 0x29 || op == 0x2b || op == 0x31 || op == 0x33) { op = read_memory_unsigned_integer (pc + skip + 2, 1); switch (op) @@ -1151,26 +1155,17 @@ i386_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, #define LOW_RETURN_REGNUM I386_EAX_REGNUM /* %eax */ #define HIGH_RETURN_REGNUM I386_EDX_REGNUM /* %edx */ -/* Extract from an array REGBUF containing the (raw) register state, a - function return value of TYPE, and copy that, in virtual format, - into VALBUF. */ +/* Read, for architecture GDBARCH, a function return value of TYPE + from REGCACHE, and copy that into VALBUF. */ static void -i386_extract_return_value (struct type *type, struct regcache *regcache, - void *dst) +i386_extract_return_value (struct gdbarch *gdbarch, struct type *type, + struct regcache *regcache, void *valbuf) { - struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); - bfd_byte *valbuf = dst; + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int len = TYPE_LENGTH (type); char buf[I386_MAX_REGISTER_SIZE]; - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - && TYPE_NFIELDS (type) == 1) - { - i386_extract_return_value (TYPE_FIELD_TYPE (type, 0), regcache, valbuf); - return; - } - if (TYPE_CODE (type) == TYPE_CODE_FLT) { if (tdep->st0_regnum < 0) @@ -1202,7 +1197,7 @@ i386_extract_return_value (struct type *type, struct regcache *regcache, regcache_raw_read (regcache, LOW_RETURN_REGNUM, buf); memcpy (valbuf, buf, low_size); regcache_raw_read (regcache, HIGH_RETURN_REGNUM, buf); - memcpy (valbuf + low_size, buf, len - low_size); + memcpy ((char *) valbuf + low_size, buf, len - low_size); } else internal_error (__FILE__, __LINE__, @@ -1210,27 +1205,20 @@ i386_extract_return_value (struct type *type, struct regcache *regcache, } } -/* Write into the appropriate registers a function return value stored - in VALBUF of type TYPE, given in virtual format. */ +/* Write, for architecture GDBARCH, a function return value of TYPE + from VALBUF into REGCACHE. */ static void -i386_store_return_value (struct type *type, struct regcache *regcache, - const void *valbuf) +i386_store_return_value (struct gdbarch *gdbarch, struct type *type, + struct regcache *regcache, const void *valbuf) { - struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int len = TYPE_LENGTH (type); /* Define I387_ST0_REGNUM such that we use the proper definitions for the architecture. */ #define I387_ST0_REGNUM I386_ST0_REGNUM - if (TYPE_CODE (type) == TYPE_CODE_STRUCT - && TYPE_NFIELDS (type) == 1) - { - i386_store_return_value (TYPE_FIELD_TYPE (type, 0), regcache, valbuf); - return; - } - if (TYPE_CODE (type) == TYPE_CODE_FLT) { ULONGEST fstat; @@ -1315,20 +1303,62 @@ static const char *valid_conventions[] = }; static const char *struct_convention = default_struct_convention; +/* Return non-zero if TYPE, which is assumed to be a structure or + union type, should be returned in registers for architecture + GDBARCH. */ + static int -i386_use_struct_convention (int gcc_p, struct type *type) +i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) { - enum struct_return struct_return; + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + enum type_code code = TYPE_CODE (type); + int len = TYPE_LENGTH (type); - if (struct_convention == default_struct_convention) - struct_return = gdbarch_tdep (current_gdbarch)->struct_return; - else if (struct_convention == pcc_struct_convention) - struct_return = pcc_struct_return; - else - struct_return = reg_struct_return; + gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION); + + if (struct_convention == pcc_struct_convention + || (struct_convention == default_struct_convention + && tdep->struct_return == pcc_struct_return)) + return 0; - return generic_use_struct_convention (struct_return == reg_struct_return, - type); + return (len == 1 || len == 2 || len == 4 || len == 8); +} + +/* Determine, for architecture GDBARCH, how a return value of TYPE + should be returned. If it is supposed to be returned in registers, + and READBUF is non-zero, read the appropriate value from REGCACHE, + and copy it into READBUF. If WRITEBUF is non-zero, write the value + from WRITEBUF into REGCACHE. */ + +static enum return_value_convention +i386_return_value (struct gdbarch *gdbarch, struct type *type, + struct regcache *regcache, void *readbuf, + const void *writebuf) +{ + enum type_code code = TYPE_CODE (type); + + if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION) + && !i386_reg_struct_return_p (gdbarch, type)) + return RETURN_VALUE_STRUCT_CONVENTION; + + /* This special case is for structures consisting of a single + `float' or `double' member. These structures are returned in + %st(0). For these structures, we call ourselves recursively, + changing TYPE into the type of the first member of the structure. + Since that should work for all structures that have only one + member, we don't bother to check the member's type here. */ + if (code == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1) + { + type = check_typedef (TYPE_FIELD_TYPE (type, 0)); + return i386_return_value (gdbarch, type, regcache, readbuf, writebuf); + } + + if (readbuf) + i386_extract_return_value (gdbarch, type, regcache, readbuf); + if (writebuf) + i386_store_return_value (gdbarch, type, regcache, writebuf); + + return RETURN_VALUE_REGISTER_CONVENTION; } @@ -1548,7 +1578,7 @@ i386_value_to_register (struct frame_info *frame, int regnum, to register cache REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ -static void +void i386_supply_gregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *gregs, size_t len) { @@ -1964,11 +1994,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_to_value (gdbarch, i386_register_to_value); set_gdbarch_value_to_register (gdbarch, i386_value_to_register); - set_gdbarch_extract_return_value (gdbarch, i386_extract_return_value); - set_gdbarch_store_return_value (gdbarch, i386_store_return_value); + set_gdbarch_return_value (gdbarch, i386_return_value); set_gdbarch_extract_struct_value_address (gdbarch, i386_extract_struct_value_address); - set_gdbarch_use_struct_convention (gdbarch, i386_use_struct_convention); set_gdbarch_skip_prologue (gdbarch, i386_skip_prologue); diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index 2c48979..c261e38 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -188,6 +188,13 @@ extern char const *i386_register_name (int reg); extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *group); +/* Supply register REGNUM from the general-purpose register set REGSET + to register cache REGCACHE. If REGNUM is -1, do this for all + registers in REGSET. */ +extern void i386_supply_gregset (const struct regset *regset, + struct regcache *regcache, int regnum, + const void *gregs, size_t len); + /* Return the appropriate register set for the core section identified by SECT_NAME and SECT_SIZE. */ extern const struct regset * diff --git a/gdb/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c index dae0a1d..c3efd1e 100644 --- a/gdb/i386nbsd-tdep.c +++ b/gdb/i386nbsd-tdep.c @@ -21,129 +21,80 @@ Boston, MA 02111-1307, USA. */ #include "defs.h" -#include "gdbtypes.h" +#include "arch-utils.h" #include "gdbcore.h" #include "regcache.h" -#include "arch-utils.h" +#include "regset.h" #include "osabi.h" +#include "gdb_assert.h" +#include "gdb_string.h" + #include "i386-tdep.h" #include "i387-tdep.h" #include "nbsd-tdep.h" #include "solib-svr4.h" -/* Map a GDB register number to an offset in the reg structure. */ -static int regmap[] = +/* From <machine/reg.h>. */ +static int i386nbsd_r_reg_offset[] = { - ( 0 * 4), /* %eax */ - ( 1 * 4), /* %ecx */ - ( 2 * 4), /* %edx */ - ( 3 * 4), /* %ebx */ - ( 4 * 4), /* %esp */ - ( 5 * 4), /* %epb */ - ( 6 * 4), /* %esi */ - ( 7 * 4), /* %edi */ - ( 8 * 4), /* %eip */ - ( 9 * 4), /* %eflags */ - (10 * 4), /* %cs */ - (11 * 4), /* %ss */ - (12 * 4), /* %ds */ - (13 * 4), /* %es */ - (14 * 4), /* %fs */ - (15 * 4), /* %gs */ + 0 * 4, /* %eax */ + 1 * 4, /* %ecx */ + 2 * 4, /* %edx */ + 3 * 4, /* %ebx */ + 4 * 4, /* %esp */ + 5 * 4, /* %ebp */ + 6 * 4, /* %esi */ + 7 * 4, /* %edi */ + 8 * 4, /* %eip */ + 9 * 4, /* %eflags */ + 10 * 4, /* %cs */ + 11 * 4, /* %ss */ + 12 * 4, /* %ds */ + 13 * 4, /* %es */ + 14 * 4, /* %fs */ + 15 * 4 /* %gs */ }; -#define SIZEOF_STRUCT_REG (16 * 4) - static void -i386nbsd_supply_reg (char *regs, int regno) +i386nbsd_aout_supply_regset (const struct regset *regset, + struct regcache *regcache, int regnum, + const void *regs, size_t len) { - int i; + const struct gdbarch_tdep *tdep = regset->descr; + + gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE); - for (i = 0; i <= 15; i++) - if (regno == i || regno == -1) - supply_register (i, regs + regmap[i]); + i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset); + i387_supply_fsave (regcache, regnum, (char *) regs + tdep->sizeof_gregset); } -static void -fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, - CORE_ADDR ignore) +const struct regset * +i386nbsd_aout_regset_from_core_section (struct gdbarch *gdbarch, + const char *sect_name, + size_t sect_size) { - char *regs, *fsave; + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - /* We get everything from one section. */ - if (which != 0) - return; + /* NetBSD a.out core dumps don't use seperate register sets for the + general-purpose and floating-point registers. */ - if (core_reg_size < (SIZEOF_STRUCT_REG + 108)) + if (strcmp (sect_name, ".reg") == 0 + && sect_size >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE) { - warning ("Wrong size register set in core file."); - return; + if (tdep->gregset == NULL) + { + tdep->gregset = XMALLOC (struct regset); + tdep->gregset->descr = tdep; + tdep->gregset->supply_regset = i386nbsd_aout_supply_regset; + } + return tdep->gregset; } - regs = core_reg_sect; - fsave = core_reg_sect + SIZEOF_STRUCT_REG; - - /* Integer registers. */ - i386nbsd_supply_reg (regs, -1); - - /* Floating point registers. */ - i387_supply_fsave (current_regcache, -1, fsave); -} - -static void -fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, - int which, CORE_ADDR ignore) -{ - switch (which) - { - case 0: /* Integer registers. */ - if (core_reg_size != SIZEOF_STRUCT_REG) - warning ("Wrong size register set in core file."); - else - i386nbsd_supply_reg (core_reg_sect, -1); - break; - - case 2: /* Floating point registers. */ - if (core_reg_size != 108) - warning ("Wrong size FP register set in core file."); - else - i387_supply_fsave (current_regcache, -1, core_reg_sect); - break; - - case 3: /* "Extended" floating point registers. This is gdb-speak - for SSE/SSE2. */ - if (core_reg_size != 512) - warning ("Wrong size XMM register set in core file."); - else - i387_supply_fxsave (current_regcache, -1, core_reg_sect); - break; - - default: - /* Don't know what kind of register request this is; just ignore it. */ - break; - } + return NULL; } -static struct core_fns i386nbsd_core_fns = -{ - bfd_target_unknown_flavour, /* core_flavour */ - default_check_format, /* check_format */ - default_core_sniffer, /* core_sniffer */ - fetch_core_registers, /* core_read_registers */ - NULL /* next */ -}; - -static struct core_fns i386nbsd_elfcore_fns = -{ - bfd_target_elf_flavour, /* core_flavour */ - default_check_format, /* check_format */ - default_core_sniffer, /* core_sniffer */ - fetch_elfcore_registers, /* core_read_registers */ - NULL /* next */ -}; - /* Under NetBSD/i386, signal handler invocations can be identified by the designated code sequence that is used to return from a signal handler. In particular, the return address of a signal handler points to the @@ -240,7 +191,7 @@ i386nbsd_pc_in_sigtramp (CORE_ADDR pc, char *name) } /* From <machine/signal.h>. */ -int i386nbsd_sc_reg_offset[I386_NUM_GREGS] = +int i386nbsd_sc_reg_offset[] = { 10 * 4, /* %eax */ 9 * 4, /* %ecx */ @@ -268,6 +219,11 @@ i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* Obviously NetBSD is BSD-based. */ i386bsd_init_abi (info, gdbarch); + /* NetBSD has a different `struct reg'. */ + tdep->gregset_reg_offset = i386nbsd_r_reg_offset; + tdep->gregset_num_regs = ARRAY_SIZE (i386nbsd_r_reg_offset); + tdep->sizeof_gregset = 16 * 4; + /* NetBSD has different signal trampoline conventions. */ set_gdbarch_pc_in_sigtramp (gdbarch, i386nbsd_pc_in_sigtramp); /* FIXME: kettenis/20020906: We should probably provide @@ -282,10 +238,23 @@ i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* NetBSD has a `struct sigcontext' that's different from the origional 4.3 BSD. */ tdep->sc_reg_offset = i386nbsd_sc_reg_offset; - tdep->sc_num_regs = I386_NUM_GREGS; + tdep->sc_num_regs = ARRAY_SIZE (i386nbsd_sc_reg_offset); +} + +/* NetBSD a.out. */ + +static void +i386nbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + i386nbsd_init_abi (info, gdbarch); + + /* NetBSD a.out has a single register set. */ + set_gdbarch_regset_from_core_section + (gdbarch, i386nbsd_aout_regset_from_core_section); } /* NetBSD ELF. */ + static void i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { @@ -300,26 +269,18 @@ i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* NetBSD ELF uses SVR4-style shared libraries. */ set_gdbarch_in_solib_call_trampoline (gdbarch, generic_in_solib_call_trampoline); - set_solib_svr4_fetch_link_map_offsets (gdbarch, - nbsd_ilp32_solib_svr4_fetch_link_map_offsets); + set_solib_svr4_fetch_link_map_offsets + (gdbarch, nbsd_ilp32_solib_svr4_fetch_link_map_offsets); /* NetBSD ELF uses -fpcc-struct-return by default. */ tdep->struct_return = pcc_struct_return; - - /* We support the SSE registers on NetBSD ELF. */ - tdep->num_xmm_regs = I386_NUM_XREGS - 1; - set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS - + I386_NUM_XREGS); } void _initialize_i386nbsd_tdep (void) { - add_core_fns (&i386nbsd_core_fns); - add_core_fns (&i386nbsd_elfcore_fns); - gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD_AOUT, - i386nbsd_init_abi); + i386nbsdaout_init_abi); gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD_ELF, i386nbsdelf_init_abi); } diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index ff369f9..1552565 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -734,3 +734,31 @@ i387_tag (const unsigned char *raw) } } } + +/* Prepare the FPU stack in REGCACHE for a function return. */ + +void +i387_return_value (struct gdbarch *gdbarch, struct regcache *regcache) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ULONGEST fstat; + + /* Define I387_ST0_REGNUM such that we use the proper + definitions for the architecture. */ +#define I387_ST0_REGNUM tdep->st0_regnum + + /* Set the top of the floating-point register stack to 7. The + actual value doesn't really matter, but 7 is what a normal + function return would end up with if the program started out with + a freshly initialized FPU. */ + regcache_raw_read_unsigned (regcache, I387_FSTAT_REGNUM, &fstat); + fstat |= (7 << 11); + regcache_raw_write_unsigned (regcache, I387_FSTAT_REGNUM, fstat); + + /* Mark %st(1) through %st(7) as empty. Since we set the top of the + floating-point register stack to 7, the appropriate value for the + tag word is 0x3fff. */ + regcache_raw_write_unsigned (regcache, I387_FTAG_REGNUM, 0x3fff); + +#undef I387_ST0_REGNUM +} diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h index 377e17a..fa94a48 100644 --- a/gdb/i387-tdep.h +++ b/gdb/i387-tdep.h @@ -102,4 +102,9 @@ extern void i387_supply_fxsave (struct regcache *regcache, int regnum, extern void i387_fill_fxsave (void *fxsave, int regnum); +/* Prepare the FPU stack in REGCACHE for a function return. */ + +extern void i387_return_value (struct gdbarch *gdbarch, + struct regcache *regcache); + #endif /* i387-tdep.h */ diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index a2ca8fa..00f66fb 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -34,6 +34,7 @@ #ifdef HAVE_SYS_REG_H #include <sys/reg.h> #endif +#include <sys/syscall.h> #include <sys/user.h> #include <asm/ptrace_offsets.h> @@ -645,3 +646,13 @@ ia64_linux_stopped_by_watchpoint (ptid_t ptid) return (CORE_ADDR) siginfo.si_addr; } + +LONGEST +ia64_linux_xfer_unwind_table (struct target_ops *ops, + enum target_object object, + const char *annex, + void *readbuf, const void *writebuf, + ULONGEST offset, LONGEST len) +{ + return syscall (__NR_getunwind, readbuf, len); +} diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 4d0f8a8..88e0e20 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -36,8 +36,14 @@ #include "objfiles.h" #include "elf/common.h" /* for DT_PLTGOT value */ #include "elf-bfd.h" +#include "elf.h" /* for PT_IA64_UNWIND value */ #include "dis-asm.h" +#ifdef HAVE_LIBUNWIND_IA64_H +#include "libunwind-frame.h" +#include "libunwind-ia64.h" +#endif + /* Hook for determining the global pointer when calling functions in the inferior under AIX. The initialization code in ia64-aix-nat.c sets this hook to the address of a function which will find the @@ -87,6 +93,7 @@ typedef enum instruction_type /* FIXME: These extern declarations should go in ia64-tdep.h. */ extern CORE_ADDR ia64_linux_sigcontext_register_address (CORE_ADDR, int); extern CORE_ADDR ia64_aix_sigcontext_register_address (CORE_ADDR, int); +extern unsigned long ia64_linux_getunwind_table (void *, size_t); static gdbarch_init_ftype ia64_gdbarch_init; @@ -2099,6 +2106,609 @@ static const struct frame_base ia64_frame_base = ia64_frame_base_address }; +#ifdef HAVE_LIBUNWIND_IA64_H + +struct ia64_unwind_table_entry + { + unw_word_t start_offset; + unw_word_t end_offset; + unw_word_t info_offset; + }; + +static __inline__ uint64_t +ia64_rse_slot_num (uint64_t addr) +{ + return (addr >> 3) & 0x3f; +} + +/* Skip over a designated number of registers in the backing + store, remembering every 64th position is for NAT. */ +static __inline__ uint64_t +ia64_rse_skip_regs (uint64_t addr, long num_regs) +{ + long delta = ia64_rse_slot_num(addr) + num_regs; + + if (num_regs < 0) + delta -= 0x3e; + return addr + ((num_regs + delta/0x3f) << 3); +} + +/* Gdb libunwind-frame callback function to convert from an ia64 gdb register + number to a libunwind register number. */ +static int +ia64_gdb2uw_regnum (int regnum) +{ + if (regnum == sp_regnum) + return UNW_IA64_SP; + else if (regnum == IA64_BSP_REGNUM) + return UNW_IA64_BSP; + else if ((unsigned) (regnum - IA64_GR0_REGNUM) < 128) + return UNW_IA64_GR + (regnum - IA64_GR0_REGNUM); + else if ((unsigned) (regnum - V32_REGNUM) < 95) + return UNW_IA64_GR + 32 + (regnum - V32_REGNUM); + else if ((unsigned) (regnum - IA64_FR0_REGNUM) < 128) + return UNW_IA64_FR + (regnum - IA64_FR0_REGNUM); + else if ((unsigned) (regnum - IA64_PR0_REGNUM) < 64) + return -1; + else if ((unsigned) (regnum - IA64_BR0_REGNUM) < 8) + return UNW_IA64_BR + (regnum - IA64_BR0_REGNUM); + else if (regnum == IA64_PR_REGNUM) + return UNW_IA64_PR; + else if (regnum == IA64_IP_REGNUM) + return UNW_REG_IP; + else if (regnum == IA64_CFM_REGNUM) + return UNW_IA64_CFM; + else if ((unsigned) (regnum - IA64_AR0_REGNUM) < 128) + return UNW_IA64_AR + (regnum - IA64_AR0_REGNUM); + else if ((unsigned) (regnum - IA64_NAT0_REGNUM) < 128) + return UNW_IA64_NAT + (regnum - IA64_NAT0_REGNUM); + else + return -1; +} + +/* Gdb libunwind-frame callback function to convert from a libunwind register + number to a ia64 gdb register number. */ +static int +ia64_uw2gdb_regnum (int uw_regnum) +{ + if (uw_regnum == UNW_IA64_SP) + return sp_regnum; + else if (uw_regnum == UNW_IA64_BSP) + return IA64_BSP_REGNUM; + else if ((unsigned) (uw_regnum - UNW_IA64_GR) < 32) + return IA64_GR0_REGNUM + (uw_regnum - UNW_IA64_GR); + else if ((unsigned) (uw_regnum - UNW_IA64_GR) < 128) + return V32_REGNUM + (uw_regnum - (IA64_GR0_REGNUM + 32)); + else if ((unsigned) (uw_regnum - UNW_IA64_FR) < 128) + return IA64_FR0_REGNUM + (uw_regnum - UNW_IA64_FR); + else if ((unsigned) (uw_regnum - UNW_IA64_BR) < 8) + return IA64_BR0_REGNUM + (uw_regnum - UNW_IA64_BR); + else if (uw_regnum == UNW_IA64_PR) + return IA64_PR_REGNUM; + else if (uw_regnum == UNW_REG_IP) + return IA64_IP_REGNUM; + else if (uw_regnum == UNW_IA64_CFM) + return IA64_CFM_REGNUM; + else if ((unsigned) (uw_regnum - UNW_IA64_AR) < 128) + return IA64_AR0_REGNUM + (uw_regnum - UNW_IA64_AR); + else if ((unsigned) (uw_regnum - UNW_IA64_NAT) < 128) + return IA64_NAT0_REGNUM + (uw_regnum - UNW_IA64_NAT); + else + return -1; +} + +/* Gdb libunwind-frame callback function to reveal if register is a float + register or not. */ +static int +ia64_is_fpreg (int uw_regnum) +{ + return unw_is_fpreg (uw_regnum); +} + +/* Libunwind callback accessor function for general registers. */ +static int +ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val, + int write, void *arg) +{ + int regnum = ia64_uw2gdb_regnum (uw_regnum); + unw_word_t bsp, sof, sol, cfm, psr, ip; + struct frame_info *next_frame = arg; + long new_sof, old_sof; + char buf[MAX_REGISTER_SIZE]; + + if (write) + { + if (regnum < 0) + /* ignore writes to pseudo-registers such as UNW_IA64_PROC_STARTI. */ + return 0; + + switch (uw_regnum) + { + case UNW_REG_IP: + ia64_write_pc (*val, inferior_ptid); + break; + + case UNW_IA64_AR_BSPSTORE: + write_register (IA64_BSP_REGNUM, *val); + break; + + case UNW_IA64_AR_BSP: + case UNW_IA64_BSP: + /* Account for the fact that ptrace() expects bsp to point + after the current register frame. */ + cfm = read_register (IA64_CFM_REGNUM); + sof = (cfm & 0x7f); + bsp = ia64_rse_skip_regs (*val, sof); + write_register (IA64_BSP_REGNUM, bsp); + break; + + case UNW_IA64_CFM: + /* If we change CFM, we need to adjust ptrace's notion of + bsp accordingly, so that the real bsp remains + unchanged. */ + bsp = read_register (IA64_BSP_REGNUM); + cfm = read_register (IA64_CFM_REGNUM); + old_sof = (cfm & 0x7f); + new_sof = (*val & 0x7f); + if (old_sof != new_sof) + { + bsp = ia64_rse_skip_regs (bsp, -old_sof + new_sof); + write_register (IA64_BSP_REGNUM, bsp); + } + write_register (IA64_CFM_REGNUM, *val); + break; + + default: + write_register (regnum, *val); + break; + } + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, + " access_reg: to cache: %4s=%016lx\n", + (((unsigned) regnum <= IA64_NAT127_REGNUM) + ? ia64_register_names[regnum] : "r??"), *val); + } + else + { + switch (uw_regnum) + { + case UNW_REG_IP: + /* Libunwind expects to see the pc value which means the slot number + from the psr must be merged with the ip word address. */ + frame_unwind_register (next_frame, IA64_IP_REGNUM, buf); + ip = extract_unsigned_integer (buf, 8); + frame_unwind_register (next_frame, IA64_PSR_REGNUM, buf); + psr = extract_unsigned_integer (buf, 8); + *val = ip | ((psr >> 41) & 0x3); + break; + + case UNW_IA64_AR_BSP: + /* Libunwind expects to see the beginning of the current register + frame so we must account for the fact that ptrace() will return a value + for bsp that points *after* the current register frame. */ + frame_unwind_register (next_frame, IA64_BSP_REGNUM, buf); + bsp = extract_unsigned_integer (buf, 8); + frame_unwind_register (next_frame, IA64_CFM_REGNUM, buf); + cfm = extract_unsigned_integer (buf, 8); + sof = (cfm & 0x7f); + *val = ia64_rse_skip_regs (bsp, -sof); + break; + + case UNW_IA64_AR_BSPSTORE: + /* Libunwind wants bspstore to be after the current register frame. + This is what ptrace() and gdb treats as the regular bsp value. */ + frame_unwind_register (next_frame, IA64_BSP_REGNUM, buf); + *val = extract_unsigned_integer (buf, 8); + break; + + default: + /* For all other registers, just unwind the value directly. */ + frame_unwind_register (next_frame, regnum, buf); + *val = extract_unsigned_integer (buf, 8); + break; + } + + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, + " access_reg: from cache: %4s=%016lx\n", + (((unsigned) regnum <= IA64_NAT127_REGNUM) + ? ia64_register_names[regnum] : "r??"), *val); + } + return 0; +} + +/* Libunwind callback accessor function for floating-point registers. */ +static int +ia64_access_fpreg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_fpreg_t *val, + int write, void *arg) +{ + int regnum = ia64_uw2gdb_regnum (uw_regnum); + + if (write) + regcache_cooked_write (current_regcache, regnum, (char *) val); + else + regcache_cooked_read (current_regcache, regnum, (char *) val); + return 0; +} + +/* Libunwind callback accessor function for accessing memory. */ +static int +ia64_access_mem (unw_addr_space_t as, + unw_word_t addr, unw_word_t *val, + int write, void *arg) +{ + /* XXX do we need to normalize byte-order here? */ + if (write) + return target_write_memory (addr, (char *) val, sizeof (unw_word_t)); + else + return target_read_memory (addr, (char *) val, sizeof (unw_word_t)); +} + +/* Call low-level function to access the kernel unwind table. */ +static int +getunwind_table (void *buf, size_t len) +{ + LONGEST x; + x = target_read_partial (¤t_target, TARGET_OBJECT_UNWIND_TABLE, NULL, + buf, 0, len); + + return (int)x; +} + +/* Get the kernel unwind table. */ +static int +get_kernel_table (unw_word_t ip, unw_dyn_info_t *di) +{ + size_t size; + struct ia64_table_entry + { + uint64_t start_offset; + uint64_t end_offset; + uint64_t info_offset; + }; + static struct ia64_table_entry *ktab = NULL, *etab; + + if (!ktab) + { + size = getunwind_table (NULL, 0); + if ((int)size < 0) + return -UNW_ENOINFO; + ktab = xmalloc (size); + getunwind_table (ktab, size); + + /* Determine length of kernel's unwind table and relocate + it's entries. */ + for (etab = ktab; etab->start_offset; ++etab) + etab->info_offset += (uint64_t) ktab; + } + + if (ip < ktab[0].start_offset || ip >= etab[-1].end_offset) + return -UNW_ENOINFO; + + di->format = UNW_INFO_FORMAT_TABLE; + di->gp = 0; + di->start_ip = ktab[0].start_offset; + di->end_ip = etab[-1].end_offset; + di->u.ti.name_ptr = (unw_word_t) "<kernel>"; + di->u.ti.segbase = 0; + di->u.ti.table_len = ((char *) etab - (char *) ktab) / sizeof (unw_word_t); + di->u.ti.table_data = (unw_word_t *) ktab; + + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, "get_kernel_table: found table `%s': " + "segbase=%lx, length=%lu, gp=%lx\n", + (char *) di->u.ti.name_ptr, di->u.ti.segbase, + di->u.ti.table_len, di->gp); + return 0; +} + +/* Find the unwind table entry for a specified address. */ +static int +ia64_find_unwind_table (struct objfile *objfile, unw_word_t ip, + unw_dyn_info_t *dip, void **buf) +{ + Elf_Internal_Phdr *phdr, *p_text = NULL, *p_unwind = NULL; + Elf_Internal_Ehdr *ehdr; + unw_word_t segbase = 0; + CORE_ADDR load_base; + bfd *bfd; + int i; + + bfd = objfile->obfd; + + ehdr = elf_tdata (bfd)->elf_header; + phdr = elf_tdata (bfd)->phdr; + + load_base = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); + + for (i = 0; i < ehdr->e_phnum; ++i) + { + switch (phdr[i].p_type) + { + case PT_LOAD: + if ((unw_word_t) (ip - load_base - phdr[i].p_vaddr) + < phdr[i].p_memsz) + p_text = phdr + i; + break; + + case PT_IA_64_UNWIND: + p_unwind = phdr + i; + break; + + default: + break; + } + } + + if (!p_text || !p_unwind + /* Verify that the segment that contains the IP also contains + the static unwind table. If not, we are dealing with + runtime-generated code, for which we have no info here. */ + || (p_unwind->p_vaddr - p_text->p_vaddr) >= p_text->p_memsz) + return -UNW_ENOINFO; + + segbase = p_text->p_vaddr + load_base; + + dip->start_ip = segbase; + dip->end_ip = dip->start_ip + p_text->p_memsz; + dip->gp = FIND_GLOBAL_POINTER (ip); + dip->format = UNW_INFO_FORMAT_REMOTE_TABLE; + dip->u.rti.name_ptr = (unw_word_t) bfd_get_filename (bfd); + dip->u.rti.segbase = segbase; + dip->u.rti.table_len = p_unwind->p_memsz / sizeof (unw_word_t); + dip->u.rti.table_data = p_unwind->p_vaddr + load_base; + + return 0; +} + +/* Libunwind callback accessor function to acquire procedure unwind-info. */ +static int +ia64_find_proc_info_x (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, + int need_unwind_info, void *arg) +{ + struct obj_section *sec = find_pc_section (ip); + unw_dyn_info_t di; + int ret; + void *buf = NULL; + + if (!sec) + { + /* XXX This only works if the host and the target architecture are + both ia64 and if the have (more or less) the same kernel + version. */ + if (get_kernel_table (ip, &di) < 0) + return -UNW_ENOINFO; + + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, "%s: %lx -> " + "(name=`%s',segbase=%lx,start=%lx,end=%lx,gp=%lx," + "length=%lu,data=%p)\n", __FUNCTION__, + ip, (char *)di.u.ti.name_ptr, + di.u.ti.segbase, di.start_ip, di.end_ip, + di.gp, di.u.ti.table_len, di.u.ti.table_data); + } + else + { + ret = ia64_find_unwind_table (sec->objfile, ip, &di, &buf); + if (ret < 0) + return ret; + + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, "%s: %lx -> " + "(name=`%s',segbase=%lx,start=%lx,end=%lx,gp=%lx," + "length=%lu,data=%lx)\n", __FUNCTION__, + ip, (char *)di.u.rti.name_ptr, + di.u.rti.segbase, di.start_ip, di.end_ip, + di.gp, di.u.rti.table_len, di.u.rti.table_data); + } + + ret = libunwind_search_unwind_table (&as, ip, &di, pi, need_unwind_info, + arg); + + /* We no longer need the dyn info storage so free it. */ + xfree (buf); + + return ret; +} + +/* Libunwind callback accessor function for cleanup. */ +static void +ia64_put_unwind_info (unw_addr_space_t as, + unw_proc_info_t *pip, void *arg) +{ + /* Nothing required for now. */ +} + +/* Libunwind callback accessor function to get head of the dynamic + unwind-info registration list. */ +static int +ia64_get_dyn_info_list (unw_addr_space_t as, + unw_word_t *dilap, void *arg) +{ + struct obj_section *text_sec; + struct objfile *objfile; + unw_word_t ip, addr; + unw_dyn_info_t di; + int ret; + + if (!libunwind_is_initialized ()) + return -UNW_ENOINFO; + + for (objfile = object_files; objfile; objfile = objfile->next) + { + void *buf = NULL; + + text_sec = objfile->sections + SECT_OFF_TEXT (objfile); + ip = text_sec->addr; + ret = ia64_find_unwind_table (objfile, ip, &di, &buf); + if (ret >= 0) + { + addr = libunwind_find_dyn_list (as, &di, arg); + /* We no longer need the dyn info storage so free it. */ + xfree (buf); + + if (addr) + { + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, + "dynamic unwind table in objfile %s " + "at %lx (gp=%lx)\n", + bfd_get_filename (objfile->obfd), + addr, di.gp); + *dilap = addr; + return 0; + } + } + } + return -UNW_ENOINFO; +} + + +/* Frame interface functions for libunwind. */ + +static void +ia64_libunwind_frame_this_id (struct frame_info *next_frame, void **this_cache, + struct frame_id *this_id) +{ + char buf[8]; + CORE_ADDR bsp; + struct frame_id id; + + libunwind_frame_this_id (next_frame, this_cache, &id); + + /* We must add the bsp as the special address for frame comparison purposes. */ + frame_unwind_register (next_frame, IA64_BSP_REGNUM, buf); + bsp = extract_unsigned_integer (buf, 8); + + (*this_id) = frame_id_build_special (id.stack_addr, id.code_addr, bsp); + + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, + "libunwind frame id: code %lx, stack %lx, special %lx, next_frame %p\n", + id.code_addr, id.stack_addr, bsp, next_frame); +} + +static void +ia64_libunwind_frame_prev_register (struct frame_info *next_frame, + void **this_cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, void *valuep) +{ + int reg = regnum; + + if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM) + reg = IA64_PR_REGNUM; + else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM) + reg = IA64_UNAT_REGNUM; + + /* Let libunwind do most of the work. */ + libunwind_frame_prev_register (next_frame, this_cache, reg, + optimizedp, lvalp, addrp, realnump, valuep); + + if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM) + { + ULONGEST prN_val; + + if (VP16_REGNUM <= regnum && regnum <= VP63_REGNUM) + { + int rrb_pr = 0; + ULONGEST cfm; + unsigned char buf[MAX_REGISTER_SIZE]; + + /* Fetch predicate register rename base from current frame + marker for this frame. */ + frame_unwind_register (next_frame, IA64_CFM_REGNUM, buf); + cfm = extract_unsigned_integer (buf, 8); + rrb_pr = (cfm >> 32) & 0x3f; + + /* Adjust the register number to account for register rotation. */ + regnum = VP16_REGNUM + + ((regnum - VP16_REGNUM) + rrb_pr) % 48; + } + prN_val = extract_bit_field ((unsigned char *) valuep, + regnum - VP0_REGNUM, 1); + store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), prN_val); + } + else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM) + { + ULONGEST unatN_val; + + unatN_val = extract_bit_field ((unsigned char *) valuep, + regnum - IA64_NAT0_REGNUM, 1); + store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), + unatN_val); + } + else if (regnum == IA64_BSP_REGNUM) + { + char cfm_valuep[MAX_REGISTER_SIZE]; + int cfm_optim; + int cfm_realnum; + enum lval_type cfm_lval; + CORE_ADDR cfm_addr; + CORE_ADDR bsp, prev_cfm, prev_bsp; + + /* We want to calculate the previous bsp as the end of the previous register stack frame. + This corresponds to what the hardware bsp register will be if we pop the frame + back which is why we might have been called. We know that libunwind will pass us back + the beginning of the current frame so we should just add sof to it. */ + prev_bsp = extract_unsigned_integer (valuep, 8); + libunwind_frame_prev_register (next_frame, this_cache, IA64_CFM_REGNUM, + &cfm_optim, &cfm_lval, &cfm_addr, &cfm_realnum, cfm_valuep); + prev_cfm = extract_unsigned_integer (cfm_valuep, 8); + prev_bsp = rse_address_add (prev_bsp, (prev_cfm & 0x7f)); + + store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), + prev_bsp); + } + + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, + "libunwind prev register <%s> is %lx\n", + (((unsigned) regnum <= IA64_NAT127_REGNUM) + ? ia64_register_names[regnum] : "r??"), extract_unsigned_integer (valuep, 8)); +} + +static const struct frame_unwind ia64_libunwind_frame_unwind = +{ + NORMAL_FRAME, + ia64_libunwind_frame_this_id, + ia64_libunwind_frame_prev_register +}; + +static const struct frame_unwind * +ia64_libunwind_frame_sniffer (struct frame_info *next_frame) +{ + if (libunwind_is_initialized () && libunwind_frame_sniffer (next_frame)) + return &ia64_libunwind_frame_unwind; + + return NULL; +} + +/* Set of libunwind callback acccessor functions. */ +static unw_accessors_t ia64_unw_accessors = +{ + ia64_find_proc_info_x, + ia64_put_unwind_info, + ia64_get_dyn_info_list, + ia64_access_mem, + ia64_access_reg, + ia64_access_fpreg, + /* resume */ + /* get_proc_name */ +}; + +/* Set of ia64 gdb libunwind-frame callbacks and data for generic libunwind-frame code to use. */ +static struct libunwind_descr ia64_libunwind_descr = +{ + ia64_gdb2uw_regnum, + ia64_uw2gdb_regnum, + ia64_is_fpreg, + &ia64_unw_accessors, +}; + +#endif /* HAVE_LIBUNWIND_IA64_H */ + /* Should we use EXTRACT_STRUCT_VALUE_ADDRESS instead of EXTRACT_RETURN_VALUE? GCC_P is true if compiled with gcc and TYPE is the type (which is known to be struct, union or array). */ @@ -2746,6 +3356,14 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 0, "builtin_type_ia64_ext", NULL); TYPE_FLOATFORMAT (builtin_type_ia64_ext) = &floatformat_ia64_ext; + /* According to the ia64 specs, instructions that store long double floats + in memory use a long-double format different than that used in the floating + registers. The memory format matches the x86 extended float format which is + 80 bits. An OS may choose to use this format (e.g. Linux) or choose to use + a different format for storing long doubles (e.g. HPUX). In the latter case, + the setting of the format may be moved/overridden in an OS-specific tdep file. */ + set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext); + set_gdbarch_short_bit (gdbarch, 16); set_gdbarch_int_bit (gdbarch, 32); set_gdbarch_long_bit (gdbarch, 64); @@ -2795,6 +3413,10 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_unwind_pc (gdbarch, ia64_unwind_pc); frame_unwind_append_sniffer (gdbarch, ia64_sigtramp_frame_sniffer); +#ifdef HAVE_LIBUNWIND_IA64_H + frame_unwind_append_sniffer (gdbarch, ia64_libunwind_frame_sniffer); + libunwind_frame_set_descr (gdbarch, &ia64_libunwind_descr); +#endif frame_unwind_append_sniffer (gdbarch, ia64_frame_sniffer); frame_base_set_default (gdbarch, &ia64_frame_base); diff --git a/gdb/infcall.c b/gdb/infcall.c index 7695c6a..0956f34 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -1075,22 +1075,6 @@ the function call).", name); do_cleanups (inf_status_cleanup); /* Figure out the value returned by the function. */ - /* elz: I defined this new macro for the hppa architecture only. - this gives us a way to get the value returned by the function - from the stack, at the same address we told the function to put - it. We cannot assume on the pa that r28 still contains the - address of the returned structure. Usually this will be - overwritten by the callee. I don't know about other - architectures, so I defined this macro */ - /* FIXME: cagney/2003-09-27: This is no longer needed. The problem - is now handled directly be by the code below. */ -#ifdef DEPRECATED_VALUE_RETURNED_FROM_STACK - if (struct_return) - { - do_cleanups (retbuf_cleanup); - return DEPRECATED_VALUE_RETURNED_FROM_STACK (value_type, struct_addr); - } -#endif if (struct_return) { /* NOTE: cagney/2003-09-27: This assumes that PUSH_DUMMY_CALL diff --git a/gdb/infcmd.c b/gdb/infcmd.c index a7e0e15..2c8631e 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1086,13 +1086,7 @@ print_return_value (int structure_return, struct type *value_type) a more complicated case of what is already being done in in the inferior function call code. In fact, when inferior function calls are made async, this will likely be made the norm. */ -#ifdef DEPRECATED_VALUE_RETURNED_FROM_STACK -#define DEPRECATED_VALUE_RETURNED_FROM_STACK_P 1 -#else -#define DEPRECATED_VALUE_RETURNED_FROM_STACK_P 0 -#endif - else if (gdbarch_return_value_p (current_gdbarch) - || DEPRECATED_VALUE_RETURNED_FROM_STACK_P) + else if (gdbarch_return_value_p (current_gdbarch)) /* We cannot determine the contents of the structure because it is on the stack, and we don't know where, since we did not initiate the call, as opposed to the call_function_by_hand diff --git a/gdb/infrun.c b/gdb/infrun.c index 6bc22a6..b16cc62 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1362,7 +1362,22 @@ handle_inferior_event (struct execution_control_state *ecs) terminal for any messages produced by breakpoint_re_set. */ target_terminal_ours_for_output (); - SOLIB_ADD (NULL, 0, NULL, auto_solib_add); + /* NOTE: cagney/2003-11-25: Make certain that the target + stack's section table is kept up-to-date. Architectures, + (e.g., PPC64), use the section table to perform + operations such as address => section name and hence + require the table to contain all sections (including + those found in shared libraries). */ + /* NOTE: cagney/2003-11-25: Pass current_target and not + exec_ops to SOLIB_ADD. This is because current GDB is + only tooled to propagate section_table changes out from + the "current_target" (see target_resize_to_sections), and + not up from the exec stratum. This, of course, isn't + right. "infrun.c" should only interact with the + exec/process stratum, instead relying on the target stack + to propagate relevant changes (stop, section table + changed, ...) up to other layers. */ + SOLIB_ADD (NULL, 0, ¤t_target, auto_solib_add); target_terminal_inferior (); /* Reinsert breakpoints and continue. */ @@ -2185,7 +2200,22 @@ process_event_stop_test: terminal for any messages produced by breakpoint_re_set. */ target_terminal_ours_for_output (); - SOLIB_ADD (NULL, 0, NULL, auto_solib_add); + /* NOTE: cagney/2003-11-25: Make certain that the target + stack's section table is kept up-to-date. Architectures, + (e.g., PPC64), use the section table to perform + operations such as address => section name and hence + require the table to contain all sections (including + those found in shared libraries). */ + /* NOTE: cagney/2003-11-25: Pass current_target and not + exec_ops to SOLIB_ADD. This is because current GDB is + only tooled to propagate section_table changes out from + the "current_target" (see target_resize_to_sections), and + not up from the exec stratum. This, of course, isn't + right. "infrun.c" should only interact with the + exec/process stratum, instead relying on the target stack + to propagate relevant changes (stop, section table + changed, ...) up to other layers. */ + SOLIB_ADD (NULL, 0, ¤t_target, auto_solib_add); target_terminal_inferior (); /* Try to reenable shared library breakpoints, additional @@ -2331,7 +2361,8 @@ process_event_stop_test: if (step_over_calls == STEP_OVER_UNDEBUGGABLE && IN_SOLIB_DYNSYM_RESOLVE_CODE (stop_pc)) { - CORE_ADDR pc_after_resolver = SKIP_SOLIB_RESOLVER (stop_pc); + CORE_ADDR pc_after_resolver = + gdbarch_skip_solib_resolver (current_gdbarch, stop_pc); if (pc_after_resolver) { @@ -2726,15 +2757,10 @@ step_into_function (struct execution_control_state *ecs) /* If the prologue ends in the middle of a source line, continue to the end of that source line (if it is still within the function). Otherwise, just go to end of prologue. */ -#ifdef PROLOGUE_FIRSTLINE_OVERLAP - /* no, don't either. It skips any code that's legitimately on the - first line. */ -#else if (ecs->sal.end && ecs->sal.pc != ecs->stop_func_start && ecs->sal.end < ecs->stop_func_end) ecs->stop_func_start = ecs->sal.end; -#endif if (ecs->stop_func_start == stop_pc) { diff --git a/gdb/inftarg.c b/gdb/inftarg.c index 6829400..a20c39f 100644 --- a/gdb/inftarg.c +++ b/gdb/inftarg.c @@ -571,14 +571,12 @@ child_xfer_partial (struct target_ops *ops, enum target_object object, NULL, ops); return -1; -#if 0 case TARGET_OBJECT_UNWIND_TABLE: #ifndef NATIVE_XFER_UNWIND_TABLE #define NATIVE_XFER_UNWIND_TABLE(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1) #endif return NATIVE_XFER_UNWIND_TABLE (ops, object, annex, readbuf, writebuf, offset, len); -#endif #if 0 case TARGET_OBJECT_AUXV: diff --git a/gdb/irix5-nat.c b/gdb/irix5-nat.c index 224d376..a447389 100644 --- a/gdb/irix5-nat.c +++ b/gdb/irix5-nat.c @@ -55,19 +55,23 @@ supply_gregset (gregset_t *gregsetp) { int regi; greg_t *regp = &(*gregsetp)[0]; - int gregoff = sizeof (greg_t) - MIPS_REGSIZE; + int gregoff = sizeof (greg_t) - mips_regsize (current_gdbarch); static char zerobuf[32] = {0}; for (regi = 0; regi <= CTX_RA; regi++) supply_register (regi, (char *) (regp + regi) + gregoff); - supply_register (PC_REGNUM, (char *) (regp + CTX_EPC) + gregoff); - supply_register (HI_REGNUM, (char *) (regp + CTX_MDHI) + gregoff); - supply_register (LO_REGNUM, (char *) (regp + CTX_MDLO) + gregoff); - supply_register (CAUSE_REGNUM, (char *) (regp + CTX_CAUSE) + gregoff); + supply_register (mips_regnum (current_gdbarch)->pc, + (char *) (regp + CTX_EPC) + gregoff); + supply_register (mips_regnum (current_gdbarch)->hi, + (char *) (regp + CTX_MDHI) + gregoff); + supply_register (mips_regnum (current_gdbarch)->lo, + (char *) (regp + CTX_MDLO) + gregoff); + supply_register (mips_regnum (current_gdbarch)->cause, + (char *) (regp + CTX_CAUSE) + gregoff); /* Fill inaccessible registers with zero. */ - supply_register (BADVADDR_REGNUM, zerobuf); + supply_register (mips_regnum (current_gdbarch)->badvaddr, zerobuf); } void @@ -88,23 +92,24 @@ fill_gregset (gregset_t *gregsetp, int regno) if ((regno == -1) || (regno == PC_REGNUM)) *(regp + CTX_EPC) = - extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (PC_REGNUM)], - DEPRECATED_REGISTER_RAW_SIZE (PC_REGNUM)); + extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->pc)], + DEPRECATED_REGISTER_RAW_SIZE (mips_regnum (current_gdbarch)->pc)); - if ((regno == -1) || (regno == CAUSE_REGNUM)) + if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->cause)) *(regp + CTX_CAUSE) = - extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (CAUSE_REGNUM)], - DEPRECATED_REGISTER_RAW_SIZE (CAUSE_REGNUM)); + extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->cause)], + DEPRECATED_REGISTER_RAW_SIZE (mips_regnum (current_gdbarch)->cause)); - if ((regno == -1) || (regno == HI_REGNUM)) + if ((regno == -1) + || (regno == mips_regnum (current_gdbarch)->hi)) *(regp + CTX_MDHI) = - extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (HI_REGNUM)], - DEPRECATED_REGISTER_RAW_SIZE (HI_REGNUM)); + extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->hi)], + DEPRECATED_REGISTER_RAW_SIZE (mips_regnum (current_gdbarch)->hi)); - if ((regno == -1) || (regno == LO_REGNUM)) + if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->lo)) *(regp + CTX_MDLO) = - extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (LO_REGNUM)], - DEPRECATED_REGISTER_RAW_SIZE (LO_REGNUM)); + extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->lo)], + DEPRECATED_REGISTER_RAW_SIZE (mips_regnum (current_gdbarch)->lo)); } /* @@ -127,10 +132,12 @@ supply_fpregset (fpregset_t *fpregsetp) supply_register (FP0_REGNUM + regi, (char *) &fpregsetp->fp_r.fp_regs[regi]); - supply_register (FCRCS_REGNUM, (char *) &fpregsetp->fp_csr); + supply_register (mips_regnum (current_gdbarch)->fp_control_status, + (char *) &fpregsetp->fp_csr); - /* FIXME: how can we supply FCRIR_REGNUM? SGI doesn't tell us. */ - supply_register (FCRIR_REGNUM, zerobuf); + /* FIXME: how can we supply FCRIR? SGI doesn't tell us. */ + supply_register (mips_regnum (current_gdbarch)->fp_implementation_revision, + zerobuf); } void @@ -151,8 +158,9 @@ fill_fpregset (fpregset_t *fpregsetp, int regno) } } - if ((regno == -1) || (regno == FCRCS_REGNUM)) - fpregsetp->fp_csr = *(unsigned *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (FCRCS_REGNUM)]; + if ((regno == -1) + || (regno == mips_regnum (current_gdbarch)->fp_control_status)) + fpregsetp->fp_csr = *(unsigned *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->fp_control_status)]; } @@ -200,8 +208,8 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, { memcpy ((char *) deprecated_registers, core_reg_sect, core_reg_size); } - else if (MIPS_REGSIZE == 4 && - core_reg_size == (2 * MIPS_REGSIZE) * NUM_REGS) + else if (mips_regsize (current_gdbarch) == 4 && + core_reg_size == (2 * mips_regsize (current_gdbarch)) * NUM_REGS) { /* This is a core file from a N32 executable, 64 bits are saved for all registers. */ diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y index 0def55f..dbd5879 100644 --- a/gdb/jv-exp.y +++ b/gdb/jv-exp.y @@ -1133,34 +1133,34 @@ yylex () switch (namelen) { case 7: - if (STREQN (tokstart, "boolean", 7)) + if (DEPRECATED_STREQN (tokstart, "boolean", 7)) return BOOLEAN; break; case 6: - if (STREQN (tokstart, "double", 6)) + if (DEPRECATED_STREQN (tokstart, "double", 6)) return DOUBLE; break; case 5: - if (STREQN (tokstart, "short", 5)) + if (DEPRECATED_STREQN (tokstart, "short", 5)) return SHORT; - if (STREQN (tokstart, "false", 5)) + if (DEPRECATED_STREQN (tokstart, "false", 5)) { yylval.lval = 0; return BOOLEAN_LITERAL; } - if (STREQN (tokstart, "super", 5)) + if (DEPRECATED_STREQN (tokstart, "super", 5)) return SUPER; - if (STREQN (tokstart, "float", 5)) + if (DEPRECATED_STREQN (tokstart, "float", 5)) return FLOAT; break; case 4: - if (STREQN (tokstart, "long", 4)) + if (DEPRECATED_STREQN (tokstart, "long", 4)) return LONG; - if (STREQN (tokstart, "byte", 4)) + if (DEPRECATED_STREQN (tokstart, "byte", 4)) return BYTE; - if (STREQN (tokstart, "char", 4)) + if (DEPRECATED_STREQN (tokstart, "char", 4)) return CHAR; - if (STREQN (tokstart, "true", 4)) + if (DEPRECATED_STREQN (tokstart, "true", 4)) { yylval.lval = 1; return BOOLEAN_LITERAL; diff --git a/gdb/language.c b/gdb/language.c index cc89482..c1dd2ae 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -344,17 +344,17 @@ show_case_command (char *ignore, int from_tty) static void set_case_command (char *ignore, int from_tty) { - if (STREQ (case_sensitive, "on")) + if (DEPRECATED_STREQ (case_sensitive, "on")) { case_sensitivity = case_sensitive_on; case_mode = case_mode_manual; } - else if (STREQ (case_sensitive, "off")) + else if (DEPRECATED_STREQ (case_sensitive, "off")) { case_sensitivity = case_sensitive_off; case_mode = case_mode_manual; } - else if (STREQ (case_sensitive, "auto")) + else if (DEPRECATED_STREQ (case_sensitive, "auto")) { case_mode = case_mode_auto; set_type_range_case (); @@ -1060,7 +1060,7 @@ language_enum (char *str) int i; for (i = 0; i < languages_size; i++) - if (STREQ (languages[i]->la_name, str)) + if (DEPRECATED_STREQ (languages[i]->la_name, str)) return languages[i]->la_language; return language_unknown; diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index df4a809..8de2a01 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -835,7 +835,7 @@ yylex () /* See if it is a special token of length 2 */ for( i = 0 ; i < (int) (sizeof tokentab2 / sizeof tokentab2[0]) ; i++) - if(STREQN(tokentab2[i].name, tokstart, 2)) + if(DEPRECATED_STREQN(tokentab2[i].name, tokstart, 2)) { lexptr += 2; return tokentab2[i].token; @@ -992,7 +992,7 @@ yylex () /* Lookup special keywords */ for(i = 0 ; i < (int) (sizeof(keytab) / sizeof(keytab[0])) ; i++) - if(namelen == strlen(keytab[i].keyw) && STREQN(tokstart,keytab[i].keyw,namelen)) + if(namelen == strlen(keytab[i].keyw) && DEPRECATED_STREQN(tokstart,keytab[i].keyw,namelen)) return keytab[i].token; yylval.sval.ptr = tokstart; @@ -1066,12 +1066,12 @@ yylex () else { /* Built-in BOOLEAN type. This is sort of a hack. */ - if(STREQN(tokstart,"TRUE",4)) + if(DEPRECATED_STREQN(tokstart,"TRUE",4)) { yylval.ulval = 1; return M2_TRUE; } - else if(STREQN(tokstart,"FALSE",5)) + else if(DEPRECATED_STREQN(tokstart,"FALSE",5)) { yylval.ulval = 0; return M2_FALSE; diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index e821722..cc0ad71 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -50,16 +50,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ analysis to compute correct stack frame layout. The MSB of the minimal symbol's "info" field is used for this purpose. - This field is already being used to store the symbol size, so the - assumption is that the symbol size cannot exceed 2^30. MSYMBOL_SET_RTC Actually sets the "RTC" bit. MSYMBOL_SET_RTI Actually sets the "RTI" bit. MSYMBOL_IS_RTC Tests the "RTC" bit in a minimal symbol. - MSYMBOL_IS_RTI Tests the "RTC" bit in a minimal symbol. - MSYMBOL_SIZE Returns the size of the minimal symbol, - i.e. the "info" field with the "special" bit - masked out. */ + MSYMBOL_IS_RTI Tests the "RTC" bit in a minimal symbol. */ #define MSYMBOL_SET_RTC(msym) \ MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) \ @@ -75,9 +70,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define MSYMBOL_IS_RTI(msym) \ (((long) MSYMBOL_INFO (msym) & 0x40000000) != 0) -#define MSYMBOL_SIZE(msym) \ - ((long) MSYMBOL_INFO (msym) & 0x3fffffff) - enum insn_return_kind { RETURN_RTS, RETURN_RTC, diff --git a/gdb/mcore-rom.c b/gdb/mcore-rom.c index 339c640..dcc2cfb 100644 --- a/gdb/mcore-rom.c +++ b/gdb/mcore-rom.c @@ -102,7 +102,7 @@ picobug_dumpregs (void) if (strchr (p, '-')) { /* got a range. either r0-r7, r8-r15 or ss0-ss4 */ - if (STREQN (p, "r0", 2) || STREQN (p, "r8", 2)) + if (DEPRECATED_STREQN (p, "r0", 2) || DEPRECATED_STREQN (p, "r8", 2)) { int rn = (p[1] == '0' ? 0 : 8); int i = 0; @@ -116,7 +116,7 @@ picobug_dumpregs (void) i++; } } - else if (STREQN (p, "ss", 2)) + else if (DEPRECATED_STREQN (p, "ss", 2)) { /* get the next five values, ignoring the first */ int rn; @@ -145,7 +145,7 @@ picobug_dumpregs (void) { for (i = 0; i < NUM_REGS; i++) { - if (picobug_regnames[i] && STREQ (picobug_regnames[i], name)) + if (picobug_regnames[i] && DEPRECATED_STREQ (picobug_regnames[i], name)) break; } diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index 0977984..598a0ac 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -246,27 +246,16 @@ mcore_reg_struct_has_addr (int gcc_p, struct type *type) static struct frame_info * analyze_dummy_frame (CORE_ADDR pc, CORE_ADDR frame) { - static struct frame_info *dummy = NULL; - - if (dummy == NULL) - { - struct frame_extra_info *extra_info; - CORE_ADDR *saved_regs; - dummy = deprecated_frame_xmalloc (); - saved_regs = (CORE_ADDR *) xmalloc (SIZEOF_FRAME_SAVED_REGS); - deprecated_set_frame_saved_regs_hack (dummy, saved_regs); - extra_info = XMALLOC (struct frame_extra_info); - deprecated_set_frame_extra_info_hack (dummy, extra_info); - } - - deprecated_set_frame_next_hack (dummy, NULL); - deprecated_set_frame_prev_hack (dummy, NULL); + struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); + struct frame_info *dummy + = deprecated_frame_xmalloc_with_cleanup (SIZEOF_FRAME_SAVED_REGS, + sizeof (struct frame_extra_info)); deprecated_update_frame_pc_hack (dummy, pc); deprecated_update_frame_base_hack (dummy, frame); get_frame_extra_info (dummy)->status = 0; get_frame_extra_info (dummy)->framesize = 0; - memset (deprecated_get_frame_saved_regs (dummy), '\000', SIZEOF_FRAME_SAVED_REGS); mcore_analyze_prologue (dummy, 0, 0); + do_cleanups (old_chain); return dummy; } diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index b5c7446..0415f75 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -793,7 +793,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, else { t = parse_type (cur_fd, ax, sh->index + 1, 0, bigend, name); - if (STREQ (name, "malloc") && TYPE_CODE (t) == TYPE_CODE_VOID) + if (DEPRECATED_STREQ (name, "malloc") && TYPE_CODE (t) == TYPE_CODE_VOID) { /* I don't know why, but, at least under Alpha GNU/Linux, when linking against a malloc without debugging @@ -1667,7 +1667,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, bad_tag_guess_complaint (sym_name); TYPE_CODE (tp) = type_code; } - if (TYPE_NAME (tp) == NULL || !STREQ (TYPE_NAME (tp), name)) + if (TYPE_NAME (tp) == NULL || !DEPRECATED_STREQ (TYPE_NAME (tp), name)) TYPE_NAME (tp) = obsavestring (name, strlen (name), ¤t_objfile->type_obstack); } @@ -1987,7 +1987,7 @@ parse_procedure (PDR *pr, struct symtab *search_symtab, /* Correct incorrect setjmp procedure descriptor from the library to make backtrace through setjmp work. */ - if (e->pdr.pcreg == 0 && STREQ (sh_name, "setjmp")) + if (e->pdr.pcreg == 0 && DEPRECATED_STREQ (sh_name, "setjmp")) { complaint (&symfile_complaints, "fixing bad setjmp PDR from libc"); e->pdr.pcreg = RA_REGNUM; @@ -2608,7 +2608,7 @@ parse_partial_symbols (struct objfile *objfile) ((char *) debug_info->external_sym + (fh->isymBase + 1) * external_sym_size), &sh); - if (STREQ (debug_info->ss + fh->issBase + sh.iss, stabs_symbol)) + if (DEPRECATED_STREQ (debug_info->ss + fh->issBase + sh.iss, stabs_symbol)) processing_gcc_compilation = 2; } @@ -2929,12 +2929,12 @@ parse_partial_symbols (struct objfile *objfile) things like "break c-exp.y:435" need to work (I suppose the psymtab_include_list could be hashed or put in a binary tree, if profiling shows this is a major hog). */ - if (pst && STREQ (namestring, pst->filename)) + if (pst && DEPRECATED_STREQ (namestring, pst->filename)) continue; { int i; for (i = 0; i < includes_used; i++) - if (STREQ (namestring, psymtab_include_list[i])) + if (DEPRECATED_STREQ (namestring, psymtab_include_list[i])) { i = -1; break; @@ -3861,7 +3861,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) ((char *) debug_info->external_sym + (fh->isymBase + 1) * external_sym_size), &sh); - if (STREQ (debug_info->ss + fh->issBase + sh.iss, + if (DEPRECATED_STREQ (debug_info->ss + fh->issBase + sh.iss, stabs_symbol)) { /* We indicate that this is a GCC compilation so that certain diff --git a/gdb/minsyms.c b/gdb/minsyms.c index c6930e9..5921e31 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -659,6 +659,7 @@ prim_record_minimal_symbol_and_info (const char *name, CORE_ADDR address, MSYMBOL_TYPE (msymbol) = ms_type; /* FIXME: This info, if it remains, needs its own field. */ MSYMBOL_INFO (msymbol) = info; /* FIXME! */ + MSYMBOL_SIZE (msymbol) = 0; /* The hash pointers must be cleared! If they're not, add_minsym_to_hash_table will NOT add this msymbol to the hash table. */ @@ -938,6 +939,7 @@ install_minimal_symbols (struct objfile *objfile) SYMBOL_LINKAGE_NAME (&msymbols[mcount]) = NULL; SYMBOL_VALUE_ADDRESS (&msymbols[mcount]) = 0; MSYMBOL_INFO (&msymbols[mcount]) = NULL; + MSYMBOL_SIZE (&msymbols[mcount]) = 0; MSYMBOL_TYPE (&msymbols[mcount]) = mst_unknown; SYMBOL_INIT_LANGUAGE_SPECIFIC (&msymbols[mcount], language_unknown); diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 6d58055..197f7e9 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -31,22 +31,19 @@ mips_linux_cannot_fetch_register (int regno) { if (regno > ZERO_REGNUM && regno < ZERO_REGNUM + 32) return 0; - else if (regno >= FP0_REGNUM && regno <= FP0_REGNUM + 32) + else if (regno >= mips_regnum (current_gdbarch)->fp0 + && regno <= mips_regnum (current_gdbarch)->fp0 + 32) return 0; - - switch (regno) - { - case LO_REGNUM: - case HI_REGNUM: - case BADVADDR_REGNUM: - case CAUSE_REGNUM: - case PC_REGNUM: - case FCRCS_REGNUM: - case FCRIR_REGNUM: - return 0; - } - - return 1; + else if (regno == mips_regnum (current_gdbarch)->lo + || regno == mips_regnum (current_gdbarch)->hi + || regno == mips_regnum (current_gdbarch)->badvaddr + || regno == mips_regnum (current_gdbarch)->cause + || regno == mips_regnum (current_gdbarch)->pc + || regno == mips_regnum (current_gdbarch)->fp_control_status + || regno == mips_regnum (current_gdbarch)->fp_implementation_revision) + return 0; + else + return 1; } int @@ -56,15 +53,11 @@ mips_linux_cannot_store_register (int regno) return 0; else if (regno >= FP0_REGNUM && regno <= FP0_REGNUM + 32) return 0; - - switch (regno) - { - case LO_REGNUM: - case HI_REGNUM: - case PC_REGNUM: - case FCRCS_REGNUM: - return 0; - } - - return 1; + else if (regno == mips_regnum (current_gdbarch)->lo + || regno == mips_regnum (current_gdbarch)->hi + || regno == mips_regnum (current_gdbarch)->pc + || regno == mips_regnum (current_gdbarch)->fp_control_status) + return 0; + else + return 1; } diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 20ada7b..a7ee145 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -85,8 +85,8 @@ mips_linux_get_longjmp_target (CORE_ADDR *pc) return 1; } -/* Transform the bits comprising a 32-bit register to the right - size for supply_register(). This is needed when MIPS_REGSIZE is 8. */ +/* Transform the bits comprising a 32-bit register to the right size + for supply_register(). This is needed when mips_regsize() is 8. */ static void supply_32bit_reg (int regnum, const void *addr) @@ -111,13 +111,18 @@ supply_gregset (elf_gregset_t *gregsetp) for (regi = EF_REG0; regi <= EF_REG31; regi++) supply_32bit_reg ((regi - EF_REG0), (char *)(regp + regi)); - supply_32bit_reg (LO_REGNUM, (char *)(regp + EF_LO)); - supply_32bit_reg (HI_REGNUM, (char *)(regp + EF_HI)); + supply_32bit_reg (mips_regnum (current_gdbarch)->lo, + (char *)(regp + EF_LO)); + supply_32bit_reg (mips_regnum (current_gdbarch)->hi, + (char *)(regp + EF_HI)); - supply_32bit_reg (PC_REGNUM, (char *)(regp + EF_CP0_EPC)); - supply_32bit_reg (BADVADDR_REGNUM, (char *)(regp + EF_CP0_BADVADDR)); + supply_32bit_reg (mips_regnum (current_gdbarch)->pc, + (char *)(regp + EF_CP0_EPC)); + supply_32bit_reg (mips_regnum (current_gdbarch)->badvaddr, + (char *)(regp + EF_CP0_BADVADDR)); supply_32bit_reg (PS_REGNUM, (char *)(regp + EF_CP0_STATUS)); - supply_32bit_reg (CAUSE_REGNUM, (char *)(regp + EF_CP0_CAUSE)); + supply_32bit_reg (mips_regnum (current_gdbarch)->cause, + (char *)(regp + EF_CP0_CAUSE)); /* Fill inaccessible registers with zero. */ supply_register (UNUSED_REGNUM, zerobuf); @@ -139,12 +144,12 @@ fill_gregset (elf_gregset_t *gregsetp, int regno) memset (regp, 0, sizeof (elf_gregset_t)); for (regi = 0; regi < 32; regi++) fill_gregset (gregsetp, regi); - fill_gregset (gregsetp, LO_REGNUM); - fill_gregset (gregsetp, HI_REGNUM); - fill_gregset (gregsetp, PC_REGNUM); - fill_gregset (gregsetp, BADVADDR_REGNUM); + fill_gregset (gregsetp, mips_regnum (current_gdbarch)->lo); + fill_gregset (gregsetp, mips_regnum (current_gdbarch)->hi); + fill_gregset (gregsetp, mips_regnum (current_gdbarch)->pc); + fill_gregset (gregsetp, mips_regnum (current_gdbarch)->badvaddr); fill_gregset (gregsetp, PS_REGNUM); - fill_gregset (gregsetp, CAUSE_REGNUM); + fill_gregset (gregsetp, mips_regnum (current_gdbarch)->cause); return; } @@ -156,28 +161,20 @@ fill_gregset (elf_gregset_t *gregsetp, int regno) return; } - regaddr = -1; - switch (regno) - { - case LO_REGNUM: - regaddr = EF_LO; - break; - case HI_REGNUM: - regaddr = EF_HI; - break; - case PC_REGNUM: - regaddr = EF_CP0_EPC; - break; - case BADVADDR_REGNUM: - regaddr = EF_CP0_BADVADDR; - break; - case PS_REGNUM: - regaddr = EF_CP0_STATUS; - break; - case CAUSE_REGNUM: - regaddr = EF_CP0_CAUSE; - break; - } + if (regno == mips_regnum (current_gdbarch)->lo) + regaddr = EF_LO; + else if (regno == mips_regnum (current_gdbarch)->hi) + regaddr = EF_HI; + else if (regno == mips_regnum (current_gdbarch)->pc) + regaddr = EF_CP0_EPC; + else if (regno == mips_regnum (current_gdbarch)->badvaddr) + regaddr = EF_CP0_BADVADDR; + else if (regno == PS_REGNUM) + regaddr = EF_CP0_STATUS; + else if (regno == mips_regnum (current_gdbarch)->cause) + regaddr = EF_CP0_CAUSE; + else + regaddr = -1; if (regaddr != -1) { @@ -200,10 +197,12 @@ supply_fpregset (elf_fpregset_t *fpregsetp) supply_register (FP0_REGNUM + regi, (char *)(*fpregsetp + regi)); - supply_register (FCRCS_REGNUM, (char *)(*fpregsetp + 32)); + supply_register (mips_regnum (current_gdbarch)->fp_control_status, + (char *)(*fpregsetp + 32)); - /* FIXME: how can we supply FCRIR_REGNUM? The ABI doesn't tell us. */ - supply_register (FCRIR_REGNUM, zerobuf); + /* FIXME: how can we supply FCRIR? The ABI doesn't tell us. */ + supply_register (mips_regnum (current_gdbarch)->fp_implementation_revision, + zerobuf); } /* Likewise, pack one or all floating point registers into an @@ -220,7 +219,7 @@ fill_fpregset (elf_fpregset_t *fpregsetp, int regno) to = (char *) (*fpregsetp + regno - FP0_REGNUM); memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regno - FP0_REGNUM)); } - else if (regno == FCRCS_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->fp_control_status) { from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)]; to = (char *) (*fpregsetp + 32); @@ -232,7 +231,7 @@ fill_fpregset (elf_fpregset_t *fpregsetp, int regno) for (regi = 0; regi < 32; regi++) fill_fpregset (fpregsetp, FP0_REGNUM + regi); - fill_fpregset(fpregsetp, FCRCS_REGNUM); + fill_fpregset(fpregsetp, mips_regnum (current_gdbarch)->fp_control_status); } } @@ -249,21 +248,22 @@ mips_linux_register_addr (int regno, CORE_ADDR blockend) if (regno < 32) regaddr = regno; - else if ((regno >= FP0_REGNUM) && (regno < FP0_REGNUM + 32)) - regaddr = FPR_BASE + (regno - FP0_REGNUM); - else if (regno == PC_REGNUM) + else if ((regno >= mips_regnum (current_gdbarch)->fp0) + && (regno < mips_regnum (current_gdbarch)->fp0 + 32)) + regaddr = FPR_BASE + (regno - mips_regnum (current_gdbarch)->fp0); + else if (regno == mips_regnum (current_gdbarch)->pc) regaddr = PC; - else if (regno == CAUSE_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->cause) regaddr = CAUSE; - else if (regno == BADVADDR_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->badvaddr) regaddr = BADVADDR; - else if (regno == LO_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->lo) regaddr = MMLO; - else if (regno == HI_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->hi) regaddr = MMHI; - else if (regno == FCRCS_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->fp_control_status) regaddr = FPC_CSR; - else if (regno == FCRIR_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->fp_implementation_revision) regaddr = FPC_EIR; else error ("Unknowable register number %d.", regno); @@ -386,13 +386,18 @@ mips64_supply_gregset (mips64_elf_gregset_t *gregsetp) for (regi = MIPS64_EF_REG0; regi <= MIPS64_EF_REG31; regi++) supply_register ((regi - MIPS64_EF_REG0), (char *)(regp + regi)); - supply_register (LO_REGNUM, (char *)(regp + MIPS64_EF_LO)); - supply_register (HI_REGNUM, (char *)(regp + MIPS64_EF_HI)); + supply_register (mips_regnum (current_gdbarch)->lo, + (char *)(regp + MIPS64_EF_LO)); + supply_register (mips_regnum (current_gdbarch)->hi, + (char *)(regp + MIPS64_EF_HI)); - supply_register (PC_REGNUM, (char *)(regp + MIPS64_EF_CP0_EPC)); - supply_register (BADVADDR_REGNUM, (char *)(regp + MIPS64_EF_CP0_BADVADDR)); + supply_register (mips_regnum (current_gdbarch)->pc, + (char *)(regp + MIPS64_EF_CP0_EPC)); + supply_register (mips_regnum (current_gdbarch)->badvaddr, + (char *)(regp + MIPS64_EF_CP0_BADVADDR)); supply_register (PS_REGNUM, (char *)(regp + MIPS64_EF_CP0_STATUS)); - supply_register (CAUSE_REGNUM, (char *)(regp + MIPS64_EF_CP0_CAUSE)); + supply_register (mips_regnum (current_gdbarch)->cause, + (char *)(regp + MIPS64_EF_CP0_CAUSE)); /* Fill inaccessible registers with zero. */ supply_register (UNUSED_REGNUM, zerobuf); @@ -414,12 +419,12 @@ mips64_fill_gregset (mips64_elf_gregset_t *gregsetp, int regno) memset (regp, 0, sizeof (mips64_elf_gregset_t)); for (regi = 0; regi < 32; regi++) mips64_fill_gregset (gregsetp, regi); - mips64_fill_gregset (gregsetp, LO_REGNUM); - mips64_fill_gregset (gregsetp, HI_REGNUM); - mips64_fill_gregset (gregsetp, PC_REGNUM); - mips64_fill_gregset (gregsetp, BADVADDR_REGNUM); + mips64_fill_gregset (gregsetp, mips_regnum (current_gdbarch)->lo); + mips64_fill_gregset (gregsetp, mips_regnum (current_gdbarch)->hi); + mips64_fill_gregset (gregsetp, mips_regnum (current_gdbarch)->pc); + mips64_fill_gregset (gregsetp, mips_regnum (current_gdbarch)->badvaddr); mips64_fill_gregset (gregsetp, PS_REGNUM); - mips64_fill_gregset (gregsetp, CAUSE_REGNUM); + mips64_fill_gregset (gregsetp, mips_regnum (current_gdbarch)->cause); return; } @@ -431,28 +436,20 @@ mips64_fill_gregset (mips64_elf_gregset_t *gregsetp, int regno) return; } - regaddr = -1; - switch (regno) - { - case LO_REGNUM: - regaddr = MIPS64_EF_LO; - break; - case HI_REGNUM: - regaddr = MIPS64_EF_HI; - break; - case PC_REGNUM: - regaddr = MIPS64_EF_CP0_EPC; - break; - case BADVADDR_REGNUM: - regaddr = MIPS64_EF_CP0_BADVADDR; - break; - case PS_REGNUM: - regaddr = MIPS64_EF_CP0_STATUS; - break; - case CAUSE_REGNUM: - regaddr = MIPS64_EF_CP0_CAUSE; - break; - } + if (regno == mips_regnum (current_gdbarch)->lo) + regaddr = MIPS64_EF_LO; + else if (regno == mips_regnum (current_gdbarch)->hi) + regaddr = MIPS64_EF_HI; + else if (regno == mips_regnum (current_gdbarch)->pc) + regaddr = MIPS64_EF_CP0_EPC; + else if (regno == mips_regnum (current_gdbarch)->badvaddr) + regaddr = MIPS64_EF_CP0_BADVADDR; + else if (regno == PS_REGNUM) + regaddr = MIPS64_EF_CP0_STATUS; + else if (regno == mips_regnum (current_gdbarch)->cause) + regaddr = MIPS64_EF_CP0_CAUSE; + else + regaddr = -1; if (regaddr != -1) { @@ -475,10 +472,12 @@ mips64_supply_fpregset (mips64_elf_fpregset_t *fpregsetp) supply_register (FP0_REGNUM + regi, (char *)(*fpregsetp + regi)); - supply_register (FCRCS_REGNUM, (char *)(*fpregsetp + 32)); + supply_register (mips_regnum (current_gdbarch)->fp_control_status, + (char *)(*fpregsetp + 32)); - /* FIXME: how can we supply FCRIR_REGNUM? The ABI doesn't tell us. */ - supply_register (FCRIR_REGNUM, zerobuf); + /* FIXME: how can we supply FCRIR? The ABI doesn't tell us. */ + supply_register (mips_regnum (current_gdbarch)->fp_implementation_revision, + zerobuf); } /* Likewise, pack one or all floating point registers into an @@ -495,7 +494,7 @@ mips64_fill_fpregset (mips64_elf_fpregset_t *fpregsetp, int regno) to = (char *) (*fpregsetp + regno - FP0_REGNUM); memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regno - FP0_REGNUM)); } - else if (regno == FCRCS_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->fp_control_status) { from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)]; to = (char *) (*fpregsetp + 32); @@ -507,7 +506,8 @@ mips64_fill_fpregset (mips64_elf_fpregset_t *fpregsetp, int regno) for (regi = 0; regi < 32; regi++) mips64_fill_fpregset (fpregsetp, FP0_REGNUM + regi); - mips64_fill_fpregset(fpregsetp, FCRCS_REGNUM); + mips64_fill_fpregset(fpregsetp, + mips_regnum (current_gdbarch)->fp_control_status); } } @@ -525,21 +525,22 @@ mips64_linux_register_addr (int regno, CORE_ADDR blockend) if (regno < 32) regaddr = regno; - else if ((regno >= FP0_REGNUM) && (regno < FP0_REGNUM + 32)) + else if ((regno >= mips_regnum (current_gdbarch)->fp0) + && (regno < mips_regnum (current_gdbarch)->fp0 + 32)) regaddr = MIPS64_FPR_BASE + (regno - FP0_REGNUM); - else if (regno == PC_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->pc) regaddr = MIPS64_PC; - else if (regno == CAUSE_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->cause) regaddr = MIPS64_CAUSE; - else if (regno == BADVADDR_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->badvaddr) regaddr = MIPS64_BADVADDR; - else if (regno == LO_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->lo) regaddr = MIPS64_MMLO; - else if (regno == HI_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->hi) regaddr = MIPS64_MMHI; - else if (regno == FCRCS_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->fp_control_status) regaddr = MIPS64_FPC_CSR; - else if (regno == FCRIR_REGNUM) + else if (regno == mips_regnum (current_gdbarch)->fp_implementation_revision) regaddr = MIPS64_FPC_EIR; else error ("Unknowable register number %d.", regno); diff --git a/gdb/mips-nat.c b/gdb/mips-nat.c index 4c35986..626f770 100644 --- a/gdb/mips-nat.c +++ b/gdb/mips-nat.c @@ -55,12 +55,12 @@ static int register_ptrace_addr (int regno) { return (regno < 32 ? GPR_BASE + regno - : regno == PC_REGNUM ? PC - : regno == CAUSE_REGNUM ? CAUSE - : regno == HI_REGNUM ? MMHI - : regno == LO_REGNUM ? MMLO - : regno == FCRCS_REGNUM ? FPC_CSR - : regno == FCRIR_REGNUM ? FPC_EIR + : regno == mips_regnum (current_gdbarch)->pc ? PC + : regno == mips_regnum (current_gdbarch)->cause ? CAUSE + : regno == mips_regnum (current_gdbarch)->hi ? MMHI + : regno == mips_regnum (current_gdbarch)->lo ? MMLO + : regno == mips_regnum (current_gdbarch)->fp_control_status ? FPC_CSR + : regno == mips_regnum (current_gdbarch)->fp_implementation_revision ? FPC_EIR : regno >= FP0_REGNUM ? FPR_BASE + (regno - FP0_REGNUM) : 0); } @@ -110,8 +110,10 @@ store_inferior_registers (int regno) if (regno > 0) { if (regno == ZERO_REGNUM || regno == PS_REGNUM - || regno == BADVADDR_REGNUM || regno == CAUSE_REGNUM - || regno == FCRIR_REGNUM || regno == DEPRECATED_FP_REGNUM + || regno == mips_regnum (current_gdbarch)->badvaddr + || regno == mips_regnum (current_gdbarch)->cause + || regno == mips_regnum (current_gdbarch)->fp_implementation_revision + || regno == DEPRECATED_FP_REGNUM || (regno >= FIRST_EMBED_REGNUM && regno <= LAST_EMBED_REGNUM)) return; regaddr = register_ptrace_addr (regno); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index c0d8b08..2c3e8c2 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -134,10 +134,30 @@ struct gdbarch_tdep int mips_default_saved_regsize; int mips_fp_register_double; int mips_default_stack_argsize; - int gdb_target_is_mips64; int default_mask_address_p; + /* Is the target using 64-bit raw integer registers but only + storing a left-aligned 32-bit value in each? */ + int mips64_transfers_32bit_regs_p; + /* Indexes for various registers. IRIX and embedded have + different values. This contains the "public" fields. Don't + add any that do not need to be public. */ + const struct mips_regnum *regnum; + /* Register names table for the current register set. */ + const char **mips_processor_reg_names; }; +const struct mips_regnum * +mips_regnum (struct gdbarch *gdbarch) +{ + return gdbarch_tdep (gdbarch)->regnum; +} + +static int +mips_fpa0_regnum (struct gdbarch *gdbarch) +{ + return mips_regnum (gdbarch)->fp0 + 12; +} + #define MIPS_EABI (gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI32 \ || gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI64) @@ -181,9 +201,9 @@ unmake_mips16_addr (CORE_ADDR addr) static LONGEST read_signed_register (int regnum) { - void *buf = alloca (DEPRECATED_REGISTER_RAW_SIZE (regnum)); + void *buf = alloca (register_size (current_gdbarch, regnum)); deprecated_read_register_gen (regnum, buf); - return (extract_signed_integer (buf, DEPRECATED_REGISTER_RAW_SIZE (regnum))); + return (extract_signed_integer (buf, register_size (current_gdbarch, regnum))); } static LONGEST @@ -213,6 +233,13 @@ mips_abi (struct gdbarch *gdbarch) return gdbarch_tdep (gdbarch)->mips_abi; } +int +mips_regsize (struct gdbarch *gdbarch) +{ + return (gdbarch_bfd_arch_info (gdbarch)->bits_per_word + / gdbarch_bfd_arch_info (gdbarch)->bits_per_byte); +} + static unsigned int mips_saved_regsize (void) { @@ -226,17 +253,13 @@ mips_saved_regsize (void) /* Functions for setting and testing a bit in a minimal symbol that marks it as 16-bit function. The MSB of the minimal symbol's - "info" field is used for this purpose. This field is already - being used to store the symbol size, so the assumption is - that the symbol size cannot exceed 2^31. + "info" field is used for this purpose. ELF_MAKE_MSYMBOL_SPECIAL tests whether an ELF symbol is "special", i.e. refers to a 16-bit function, and sets a "special" bit in a minimal symbol to mark it as a 16-bit function - MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol - MSYMBOL_SIZE returns the size of the minimal symbol, i.e. - the "info" field with the "special" bit masked out */ + MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol */ static void mips_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) @@ -255,12 +278,6 @@ msymbol_is_special (struct minimal_symbol *msym) return (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0); } -static long -msymbol_size (struct minimal_symbol *msym) -{ - return ((long) MSYMBOL_INFO (msym) & 0x7fffffff); -} - /* XFER a value from the big/little/left end of the register. Depending on the size of the value it might occupy the entire register or just part of it. Make an allowance for this, aligning @@ -279,7 +296,7 @@ mips_xfer_register (struct regcache *regcache, int reg_num, int length, switch (endian) { case BFD_ENDIAN_BIG: - reg_offset = DEPRECATED_REGISTER_RAW_SIZE (reg_num) - length; + reg_offset = register_size (current_gdbarch, reg_num) - length; break; case BFD_ENDIAN_LITTLE: reg_offset = 0; @@ -325,7 +342,7 @@ mips2_fp_compat (void) { /* MIPS1 and MIPS2 have only 32 bit FPRs, and the FR bit is not meaningful. */ - if (DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM) == 4) + if (register_size (current_gdbarch, mips_regnum (current_gdbarch)->fp0) == 4) return 0; #if 0 @@ -343,9 +360,7 @@ mips2_fp_compat (void) /* Indicate that the ABI makes use of double-precision registers provided by the FPU (rather than combining pairs of registers to - form double-precision values). Do not use "TARGET_IS_MIPS64" to - determine if the ABI is using double-precision registers. See also - MIPS_FPU_TYPE. */ + form double-precision values). See also MIPS_FPU_TYPE. */ #define FP_REGISTER_DOUBLE (gdbarch_tdep (current_gdbarch)->mips_fp_register_double) /* The amount of space reserved on the stack for registers. This is @@ -369,8 +384,6 @@ mips_stack_argsize (void) return 4; } -#define GDB_TARGET_IS_MIPS64 (gdbarch_tdep (current_gdbarch)->gdb_target_is_mips64 + 0) - #define MIPS_DEFAULT_MASK_ADDRESS_P (gdbarch_tdep (current_gdbarch)->default_mask_address_p) #define VM_MIN_ADDRESS (CORE_ADDR)0x400000 @@ -382,10 +395,6 @@ static CORE_ADDR heuristic_proc_start (CORE_ADDR); static CORE_ADDR read_next_frame_reg (struct frame_info *, int); -static int mips_set_processor_type (char *); - -static void mips_show_processor_type_command (char *, int); - static void reinit_frame_cache_sfunc (char *, int, struct cmd_list_element *); static mips_extra_func_info_t find_proc_desc (CORE_ADDR pc, @@ -398,32 +407,71 @@ static CORE_ADDR after_prologue (CORE_ADDR pc, static struct type *mips_float_register_type (void); static struct type *mips_double_register_type (void); -/* This value is the model of MIPS in use. It is derived from the value - of the PrID register. */ - -char *mips_processor_type; - -char *tmp_mips_processor_type; - /* The list of available "set mips " and "show mips " commands */ static struct cmd_list_element *setmipscmdlist = NULL; static struct cmd_list_element *showmipscmdlist = NULL; -/* A set of original names, to be used when restoring back to generic - registers from a specific set. */ -static char *mips_generic_reg_names[] = MIPS_REGISTER_NAMES; - /* Integer registers 0 thru 31 are handled explicitly by mips_register_name(). Processor specific registers 32 and above - are listed in the sets of register names assigned to - mips_processor_reg_names. */ -static char **mips_processor_reg_names = mips_generic_reg_names; + are listed in the followign tables. */ + +enum { NUM_MIPS_PROCESSOR_REGS = (90 - 32) }; + +/* Generic MIPS. */ + +static const char *mips_generic_reg_names[NUM_MIPS_PROCESSOR_REGS] = { + "sr", "lo", "hi", "bad", "cause","pc", + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", + "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", + "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", + "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", + "fsr", "fir", ""/*"fp"*/, "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", +}; + +/* Names of IDT R3041 registers. */ + +static const char *mips_r3041_reg_names[] = { + "sr", "lo", "hi", "bad", "cause","pc", + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", + "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", + "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", + "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", + "fsr", "fir", "",/*"fp"*/ "", + "", "", "bus", "ccfg", "", "", "", "", + "", "", "port", "cmp", "", "", "epc", "prid", +}; + +/* Names of tx39 registers. */ + +static const char *mips_tx39_reg_names[NUM_MIPS_PROCESSOR_REGS] = { + "sr", "lo", "hi", "bad", "cause","pc", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "config", "cache", "debug", "depc", "epc", "" +}; + +/* Names of IRIX registers. */ +static const char *mips_irix_reg_names[NUM_MIPS_PROCESSOR_REGS] = { + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", + "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", + "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", + "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", + "pc", "cause", "bad", "hi", "lo", "fsr", "fir" +}; + /* Return the name of the register corresponding to REGNO. */ static const char * mips_register_name (int regno) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); /* GPR names for all ABIs other than n32/n64. */ static char *mips_gpr_names[] = { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", @@ -459,79 +507,15 @@ mips_register_name (int regno) return mips_gpr_names[rawnum]; } else if (32 <= rawnum && rawnum < NUM_REGS) - return mips_processor_reg_names[rawnum - 32]; + { + gdb_assert (rawnum - 32 < NUM_MIPS_PROCESSOR_REGS); + return tdep->mips_processor_reg_names[rawnum - 32]; + } else internal_error (__FILE__, __LINE__, "mips_register_name: bad register number %d", rawnum); } -/* *INDENT-OFF* */ -/* Names of IDT R3041 registers. */ - -char *mips_r3041_reg_names[] = { - "sr", "lo", "hi", "bad", "cause","pc", - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", - "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", - "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", - "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", - "fsr", "fir", "",/*"fp"*/ "", - "", "", "bus", "ccfg", "", "", "", "", - "", "", "port", "cmp", "", "", "epc", "prid", -}; - -/* Names of IDT R3051 registers. */ - -char *mips_r3051_reg_names[] = { - "sr", "lo", "hi", "bad", "cause","pc", - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", - "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", - "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", - "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", - "fsr", "fir", ""/*"fp"*/, "", - "inx", "rand", "elo", "", "ctxt", "", "", "", - "", "", "ehi", "", "", "", "epc", "prid", -}; - -/* Names of IDT R3081 registers. */ - -char *mips_r3081_reg_names[] = { - "sr", "lo", "hi", "bad", "cause","pc", - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", - "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", - "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", - "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", - "fsr", "fir", ""/*"fp"*/, "", - "inx", "rand", "elo", "cfg", "ctxt", "", "", "", - "", "", "ehi", "", "", "", "epc", "prid", -}; - -/* Names of LSI 33k registers. */ - -char *mips_lsi33k_reg_names[] = { - "epc", "hi", "lo", "sr", "cause","badvaddr", - "dcic", "bpc", "bda", "", "", "", "", "", - "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", - "", "", "", "", - "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", -}; - -struct { - char *name; - char **regnames; -} mips_processor_type_table[] = { - { "generic", mips_generic_reg_names }, - { "r3041", mips_r3041_reg_names }, - { "r3051", mips_r3051_reg_names }, - { "r3071", mips_r3081_reg_names }, - { "r3081", mips_r3081_reg_names }, - { "lsi33k", mips_lsi33k_reg_names }, - { NULL, NULL } -}; -/* *INDENT-ON* */ - /* Return the groups that a MIPS register can be categorised into. */ static int @@ -572,22 +556,46 @@ mips_register_reggroup_p (struct gdbarch *gdbarch, int regnum, /* Map the symbol table registers which live in the range [1 * NUM_REGS .. 2 * NUM_REGS) back onto the corresponding raw - registers. */ + registers. Take care of alignment and size problems. */ static void mips_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, void *buf) { + int rawnum = cookednum % NUM_REGS; gdb_assert (cookednum >= NUM_REGS && cookednum < 2 * NUM_REGS); - return regcache_raw_read (regcache, cookednum % NUM_REGS, buf); + if (register_size (gdbarch, rawnum) == register_size (gdbarch, cookednum)) + return regcache_raw_read (regcache, rawnum, buf); + else if (register_size (gdbarch, rawnum) > register_size (gdbarch, cookednum)) + { + if (gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p + || TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + regcache_raw_read_part (regcache, rawnum, 0, 4, buf); + else + regcache_raw_read_part (regcache, rawnum, 4, 4, buf); + } + else + internal_error (__FILE__, __LINE__, "bad register size"); } static void mips_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const void *buf) { + int rawnum = cookednum % NUM_REGS; gdb_assert (cookednum >= NUM_REGS && cookednum < 2 * NUM_REGS); - return regcache_raw_write (regcache, cookednum % NUM_REGS, buf); + if (register_size (gdbarch, rawnum) == register_size (gdbarch, cookednum)) + return regcache_raw_write (regcache, rawnum, buf); + else if (register_size (gdbarch, rawnum) > register_size (gdbarch, cookednum)) + { + if (gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p + || TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + regcache_raw_write_part (regcache, rawnum, 0, 4, buf); + else + regcache_raw_write_part (regcache, rawnum, 4, 4, buf); + } + else + internal_error (__FILE__, __LINE__, "bad register size"); } /* Table to translate MIPS16 register field to actual register number. */ @@ -625,124 +633,35 @@ struct linked_proc_info *linked_proc_desc_table = NULL; /* Number of bytes of storage in the actual machine representation for - register N. NOTE: This indirectly defines the register size - transfered by the GDB protocol. */ + register N. NOTE: This defines the pseudo register type so need to + rebuild the architecture vector. */ static int mips64_transfers_32bit_regs_p = 0; -static int -mips_register_raw_size (int regnum) -{ - gdb_assert (regnum >= 0); - if (regnum < NUM_REGS) - { - /* For compatibility with old code, implemnt the broken register raw - size map for the raw registers. - - NOTE: cagney/2003-06-15: This is so bogus. The register's - raw size is changing according to the ABI - (FP_REGISTER_DOUBLE). Also, GDB's protocol is defined by a - combination of DEPRECATED_REGISTER_RAW_SIZE and DEPRECATED_REGISTER_BYTE. */ - if (mips64_transfers_32bit_regs_p) - return DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum); - else if (regnum >= FP0_REGNUM && regnum < FP0_REGNUM + 32 - && FP_REGISTER_DOUBLE) - /* For MIPS_ABI_N32 (for example) we need 8 byte floating point - registers. */ - return 8; - else - return MIPS_REGSIZE; - } - else if (regnum < 2 * NUM_REGS) - { - /* For the moment map [NUM_REGS .. 2*NUM_REGS) onto the same raw - registers, but always return the virtual size. */ - int rawnum = regnum % NUM_REGS; - return TYPE_LENGTH (gdbarch_register_type (current_gdbarch, rawnum)); - } - else - internal_error (__FILE__, __LINE__, "Register %d out of range", regnum); -} - -/* Register offset in a buffer for each register. - - FIXME: cagney/2003-06-15: This is so bogus. Instead REGISTER_TYPE - should strictly return the layout of the buffer. Unfortunately - remote.c and the MIPS have come to rely on a custom layout that - doesn't 1:1 map onto the register type. */ - -static int -mips_register_byte (int regnum) +static void +set_mips64_transfers_32bit_regs (char *args, int from_tty, + struct cmd_list_element *c) { - gdb_assert (regnum >= 0); - if (regnum < NUM_REGS) - /* Pick up the relevant per-tm file register byte method. */ - return MIPS_REGISTER_BYTE (regnum); - else if (regnum < 2 * NUM_REGS) + struct gdbarch_info info; + gdbarch_info_init (&info); + /* FIXME: cagney/2003-11-15: Should be setting a field in "info" + instead of relying on globals. Doing that would let generic code + handle the search for this specific architecture. */ + if (!gdbarch_update_p (info)) { - int reg; - int byte; - /* Start with the end of the raw register buffer - assum that - MIPS_REGISTER_BYTE (NUM_REGS) returns that end. */ - byte = MIPS_REGISTER_BYTE (NUM_REGS); - /* Add space for all the proceeding registers based on their - real size. */ - for (reg = NUM_REGS; reg < regnum; reg++) - byte += TYPE_LENGTH (gdbarch_register_type (current_gdbarch, - (reg % NUM_REGS))); - return byte; + mips64_transfers_32bit_regs_p = 0; + error ("32-bit compatibility mode not supported"); } - else - internal_error (__FILE__, __LINE__, "Register %d out of range", regnum); } -/* Convert between RAW and VIRTUAL registers. The RAW register size - defines the remote-gdb packet. */ - -static int -mips_register_convertible (int reg_nr) -{ - if (mips64_transfers_32bit_regs_p) - return 0; - else - return (DEPRECATED_REGISTER_RAW_SIZE (reg_nr) > DEPRECATED_REGISTER_VIRTUAL_SIZE (reg_nr)); -} - -static void -mips_register_convert_to_virtual (int n, struct type *virtual_type, - char *raw_buf, char *virt_buf) -{ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - memcpy (virt_buf, - raw_buf + (DEPRECATED_REGISTER_RAW_SIZE (n) - TYPE_LENGTH (virtual_type)), - TYPE_LENGTH (virtual_type)); - else - memcpy (virt_buf, - raw_buf, - TYPE_LENGTH (virtual_type)); -} - -static void -mips_register_convert_to_raw (struct type *virtual_type, int n, - const char *virt_buf, char *raw_buf) -{ - memset (raw_buf, 0, DEPRECATED_REGISTER_RAW_SIZE (n)); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - memcpy (raw_buf + (DEPRECATED_REGISTER_RAW_SIZE (n) - TYPE_LENGTH (virtual_type)), - virt_buf, - TYPE_LENGTH (virtual_type)); - else - memcpy (raw_buf, - virt_buf, - TYPE_LENGTH (virtual_type)); -} +/* Convert to/from a register and the corresponding memory value. */ static int mips_convert_register_p (int regnum, struct type *type) { return (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG - && DEPRECATED_REGISTER_RAW_SIZE (regnum) == 4 - && (regnum) >= FP0_REGNUM && (regnum) < FP0_REGNUM + 32 + && register_size (current_gdbarch, regnum) == 4 + && (regnum) >= mips_regnum (current_gdbarch)->fp0 && (regnum) < mips_regnum (current_gdbarch)->fp0 + 32 && TYPE_CODE(type) == TYPE_CODE_FLT && TYPE_LENGTH(type) == 8); } @@ -769,35 +688,46 @@ mips_value_to_register (struct frame_info *frame, int regnum, static struct type * mips_register_type (struct gdbarch *gdbarch, int regnum) { - /* For moment, map [NUM_REGS .. 2*NUM_REGS) onto the same raw - registers. Even return the same type. */ - int rawnum = regnum % NUM_REGS; - gdb_assert (rawnum >= 0 && rawnum < NUM_REGS); -#ifdef MIPS_REGISTER_TYPE - return MIPS_REGISTER_TYPE (rawnum); -#else - if (FP0_REGNUM <= rawnum && rawnum < FP0_REGNUM + 32) + gdb_assert (regnum >= 0 && regnum < 2 * NUM_REGS); + if ((regnum % NUM_REGS) >= mips_regnum (current_gdbarch)->fp0 + && (regnum % NUM_REGS) < mips_regnum (current_gdbarch)->fp0 + 32) { - /* Floating point registers... */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - return builtin_type_ieee_double_big; - else - return builtin_type_ieee_double_little; + /* The floating-point registers raw, or cooked, always match + mips_regsize(), and also map 1:1, byte for byte. */ + switch (gdbarch_byte_order (gdbarch)) + { + case BFD_ENDIAN_BIG: + if (mips_regsize (gdbarch) == 4) + return builtin_type_ieee_single_big; + else + return builtin_type_ieee_double_big; + case BFD_ENDIAN_LITTLE: + if (mips_regsize (gdbarch) == 4) + return builtin_type_ieee_single_little; + else + return builtin_type_ieee_double_little; + case BFD_ENDIAN_UNKNOWN: + default: + internal_error (__FILE__, __LINE__, "bad switch"); + } } - else if (rawnum == PS_REGNUM /* CR */) - return builtin_type_uint32; - else if (FCRCS_REGNUM <= rawnum && rawnum <= LAST_EMBED_REGNUM) - return builtin_type_uint32; + else if (regnum >= (NUM_REGS + mips_regnum (current_gdbarch)->fp_control_status) + && regnum <= NUM_REGS + LAST_EMBED_REGNUM) + /* The pseudo/cooked view of the embedded registers is always + 32-bit. The raw view is handled below. */ + return builtin_type_int32; + else if (regnum >= NUM_REGS && mips_regsize (gdbarch) + && gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p) + /* The target, while using a 64-bit register buffer, is only + transfering 32-bits of each integer register. Reflect this in + the cooked/pseudo register value. */ + return builtin_type_int32; + else if (mips_regsize (gdbarch) == 8) + /* 64-bit ISA. */ + return builtin_type_int64; else - { - /* Everything else... - Return type appropriate for width of register. */ - if (MIPS_REGSIZE == TYPE_LENGTH (builtin_type_uint64)) - return builtin_type_uint64; - else - return builtin_type_uint32; - } -#endif + /* 32-bit ISA. */ + return builtin_type_int32; } /* TARGET_READ_SP -- Remove useless bits from the stack pointer. */ @@ -860,12 +790,6 @@ mips_eabi_use_struct_convention (int gcc_p, struct type *type) return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE); } -static int -mips_n32n64_use_struct_convention (int gcc_p, struct type *type) -{ - return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE); -} - /* Should call_function pass struct by reference? For each architecture, structs are passed either by value or by reference, depending on their size. */ @@ -1109,7 +1033,7 @@ mips32_next_pc (CORE_ADDR pc) { int tf = itype_rt (inst) & 0x01; int cnum = itype_rt (inst) >> 2; - int fcrcs = read_signed_register (FCRCS_REGNUM); + int fcrcs = read_signed_register (mips_regnum (current_gdbarch)->fp_control_status); int cond = ((fcrcs >> 24) & 0x0e) | ((fcrcs >> 23) & 0x01); if (((cond >> cnum) & 0x01) == tf) @@ -1569,31 +1493,27 @@ mips_find_saved_regs (struct frame_info *fci) #ifndef SIGFRAME_BASE /* To satisfy alignment restrictions, sigcontext is located 4 bytes above the sigtramp frame. */ -#define SIGFRAME_BASE MIPS_REGSIZE +#define SIGFRAME_BASE mips_regsize (current_gdbarch) /* FIXME! Are these correct?? */ -#define SIGFRAME_PC_OFF (SIGFRAME_BASE + 2 * MIPS_REGSIZE) -#define SIGFRAME_REGSAVE_OFF (SIGFRAME_BASE + 3 * MIPS_REGSIZE) +#define SIGFRAME_PC_OFF (SIGFRAME_BASE + 2 * mips_regsize (current_gdbarch)) +#define SIGFRAME_REGSAVE_OFF (SIGFRAME_BASE + 3 * mips_regsize (current_gdbarch)) #define SIGFRAME_FPREGSAVE_OFF \ - (SIGFRAME_REGSAVE_OFF + MIPS_NUMREGS * MIPS_REGSIZE + 3 * MIPS_REGSIZE) -#endif -#ifndef SIGFRAME_REG_SIZE - /* FIXME! Is this correct?? */ -#define SIGFRAME_REG_SIZE MIPS_REGSIZE + (SIGFRAME_REGSAVE_OFF + MIPS_NUMREGS * mips_regsize (current_gdbarch) + 3 * mips_regsize (current_gdbarch)) #endif if ((get_frame_type (fci) == SIGTRAMP_FRAME)) { for (ireg = 0; ireg < MIPS_NUMREGS; ireg++) { CORE_ADDR reg_position = (get_frame_base (fci) + SIGFRAME_REGSAVE_OFF - + ireg * SIGFRAME_REG_SIZE); + + ireg * mips_regsize (current_gdbarch)); set_reg_offset (saved_regs, ireg, reg_position); } for (ireg = 0; ireg < MIPS_NUMREGS; ireg++) { CORE_ADDR reg_position = (get_frame_base (fci) + SIGFRAME_FPREGSAVE_OFF - + ireg * SIGFRAME_REG_SIZE); - set_reg_offset (saved_regs, FP0_REGNUM + ireg, reg_position); + + ireg * mips_regsize (current_gdbarch)); + set_reg_offset (saved_regs, mips_regnum (current_gdbarch)->fp0 + ireg, reg_position); } set_reg_offset (saved_regs, PC_REGNUM, get_frame_base (fci) + SIGFRAME_PC_OFF); @@ -1741,14 +1661,14 @@ mips_find_saved_regs (struct frame_info *fci) reg_position is decremented each time through the loop). */ if ((ireg & 1)) - set_reg_offset (saved_regs, FP0_REGNUM + ireg, + set_reg_offset (saved_regs, mips_regnum (current_gdbarch)->fp0 + ireg, reg_position - MIPS_SAVED_REGSIZE); else - set_reg_offset (saved_regs, FP0_REGNUM + ireg, + set_reg_offset (saved_regs, mips_regnum (current_gdbarch)->fp0 + ireg, reg_position + MIPS_SAVED_REGSIZE); } else - set_reg_offset (saved_regs, FP0_REGNUM + ireg, reg_position); + set_reg_offset (saved_regs, mips_regnum (current_gdbarch)->fp0 + ireg, reg_position); reg_position -= MIPS_SAVED_REGSIZE; } @@ -1786,40 +1706,26 @@ read_next_frame_reg (struct frame_info *fi, int regno) static CORE_ADDR mips_addr_bits_remove (CORE_ADDR addr) { - if (GDB_TARGET_IS_MIPS64) - { - if (mips_mask_address_p () && (addr >> 32 == (CORE_ADDR) 0xffffffff)) - { - /* This hack is a work-around for existing boards using - PMON, the simulator, and any other 64-bit targets that - doesn't have true 64-bit addressing. On these targets, - the upper 32 bits of addresses are ignored by the - hardware. Thus, the PC or SP are likely to have been - sign extended to all 1s by instruction sequences that - load 32-bit addresses. For example, a typical piece of - code that loads an address is this: - lui $r2, <upper 16 bits> - ori $r2, <lower 16 bits> - But the lui sign-extends the value such that the upper 32 - bits may be all 1s. The workaround is simply to mask off - these bits. In the future, gcc may be changed to support - true 64-bit addressing, and this masking will have to be - disabled. */ - addr &= (CORE_ADDR) 0xffffffff; - } - } - else if (mips_mask_address_p ()) - { - /* FIXME: This is wrong! mips_addr_bits_remove() shouldn't be - masking off bits, instead, the actual target should be asking - for the address to be converted to a valid pointer. */ - /* Even when GDB is configured for some 32-bit targets - (e.g. mips-elf), BFD is configured to handle 64-bit targets, - so CORE_ADDR is 64 bits. So we still have to mask off - useless bits from addresses. */ - addr &= (CORE_ADDR) 0xffffffff; - } - return addr; + if (mips_mask_address_p () + && (((ULONGEST) addr) >> 32 == 0xffffffffUL)) + /* This hack is a work-around for existing boards using PMON, the + simulator, and any other 64-bit targets that doesn't have true + 64-bit addressing. On these targets, the upper 32 bits of + addresses are ignored by the hardware. Thus, the PC or SP are + likely to have been sign extended to all 1s by instruction + sequences that load 32-bit addresses. For example, a typical + piece of code that loads an address is this: + + lui $r2, <upper 16 bits> + ori $r2, <lower 16 bits> + + But the lui sign-extends the value such that the upper 32 bits + may be all 1s. The workaround is simply to mask off these + bits. In the future, gcc may be changed to support true 64-bit + addressing, and this masking will have to be disabled. */ + return addr &= 0xffffffffUL; + else + return addr; } /* mips_software_single_step() is called just before we want to resume @@ -1871,10 +1777,8 @@ mips_frame_saved_pc (struct frame_info *frame) if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), 0, 0)) { - LONGEST tmp; /* Always unwind the cooked PC register value. */ - frame_unwind_signed_register (frame, NUM_REGS + PC_REGNUM, &tmp); - saved_pc = tmp; + saved_pc = frame_unwind_register_signed (frame, NUM_REGS + PC_REGNUM); } else { @@ -2262,7 +2166,7 @@ restart: but the register size used is only 32 bits. Make the address for the saved register point to the lower 32 bits. */ PROC_REG_MASK (&temp_proc_desc) |= 1 << reg; - set_reg_offset (temp_saved_regs, reg, sp + low_word + 8 - MIPS_REGSIZE); + set_reg_offset (temp_saved_regs, reg, sp + low_word + 8 - mips_regsize (current_gdbarch)); } else if (high_word == 0x27be) /* addiu $30,$sp,size */ { @@ -2611,9 +2515,6 @@ mips_frame_chain (struct frame_info *frame) CORE_ADDR tmp; CORE_ADDR saved_pc = DEPRECATED_FRAME_SAVED_PC (frame); - if (saved_pc == 0 || deprecated_inside_entry_file (saved_pc)) - return 0; - /* Check if the PC is inside a call stub. If it is, fetch the PC of the caller of that stub. */ if ((tmp = SKIP_TRAMPOLINE_CODE (saved_pc)) != 0) @@ -2672,7 +2573,6 @@ mips_init_extra_frame_info (int fromleaf, struct frame_info *fci) frame_extra_info_zalloc (fci, sizeof (struct frame_extra_info)); - deprecated_set_frame_saved_regs_hack (fci, NULL); get_frame_extra_info (fci)->proc_desc = proc_desc == &temp_proc_desc ? 0 : proc_desc; if (proc_desc) @@ -2862,7 +2762,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, /* Initialize the integer and float register pointers. */ argreg = A0_REGNUM; - float_argreg = FPA0_REGNUM; + float_argreg = mips_fpa0_regnum (current_gdbarch); /* The struct_return pointer occupies the first parameter-passing reg. */ if (struct_return) @@ -2970,10 +2870,11 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, /* Copy the argument to general registers or the stack in register-sized pieces. Large arguments are split between registers and stack. */ - /* Note: structs whose size is not a multiple of MIPS_REGSIZE - are treated specially: Irix cc passes them in registers - where gcc sometimes puts them on the stack. For maximum - compatibility, we will put them in both places. */ + /* Note: structs whose size is not a multiple of + mips_regsize() are treated specially: Irix cc passes them + in registers where gcc sometimes puts them on the stack. + For maximum compatibility, we will put them in both + places. */ int odd_sized_struct = ((len > MIPS_SAVED_REGSIZE) && (len % MIPS_SAVED_REGSIZE != 0)); @@ -3122,7 +3023,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, /* Initialize the integer and float register pointers. */ argreg = A0_REGNUM; - float_argreg = FPA0_REGNUM; + float_argreg = mips_fpa0_regnum (current_gdbarch); /* The struct_return pointer occupies the first parameter-passing reg. */ if (struct_return) @@ -3177,10 +3078,11 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, /* Copy the argument to general registers or the stack in register-sized pieces. Large arguments are split between registers and stack. */ - /* Note: structs whose size is not a multiple of MIPS_REGSIZE - are treated specially: Irix cc passes them in registers - where gcc sometimes puts them on the stack. For maximum - compatibility, we will put them in both places. */ + /* Note: structs whose size is not a multiple of + mips_regsize() are treated specially: Irix cc passes them + in registers where gcc sometimes puts them on the stack. + For maximum compatibility, we will put them in both + places. */ int odd_sized_struct = ((len > MIPS_SAVED_REGSIZE) && (len % MIPS_SAVED_REGSIZE != 0)); /* Note: Floating-point values that didn't fit into an FP @@ -3353,7 +3255,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, /* Initialize the integer and float register pointers. */ argreg = A0_REGNUM; - float_argreg = FPA0_REGNUM; + float_argreg = mips_fpa0_regnum (current_gdbarch); /* The struct_return pointer occupies the first parameter-passing reg. */ if (struct_return) @@ -3467,10 +3369,11 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, /* Copy the argument to general registers or the stack in register-sized pieces. Large arguments are split between registers and stack. */ - /* Note: structs whose size is not a multiple of MIPS_REGSIZE - are treated specially: Irix cc passes them in registers - where gcc sometimes puts them on the stack. For maximum - compatibility, we will put them in both places. */ + /* Note: structs whose size is not a multiple of + mips_regsize() are treated specially: Irix cc passes them + in registers where gcc sometimes puts them on the stack. + For maximum compatibility, we will put them in both + places. */ int odd_sized_struct = ((len > MIPS_SAVED_REGSIZE) && (len % MIPS_SAVED_REGSIZE != 0)); /* Structures should be aligned to eight bytes (even arg registers) @@ -3546,8 +3449,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, && !fp_register_arg_p (typecode, arg_type)) { LONGEST regval = extract_signed_integer (val, partial_len); - /* Value may need to be sign extended, because - MIPS_REGSIZE != MIPS_SAVED_REGSIZE. */ + /* Value may need to be sign extended, because + mips_regsize() != MIPS_SAVED_REGSIZE. */ /* A non-floating-point argument being passed in a general register. If a struct or union, and if @@ -3661,7 +3564,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, /* Initialize the integer and float register pointers. */ argreg = A0_REGNUM; - float_argreg = FPA0_REGNUM; + float_argreg = mips_fpa0_regnum (current_gdbarch); /* The struct_return pointer occupies the first parameter-passing reg. */ if (struct_return) @@ -3775,10 +3678,11 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, /* Copy the argument to general registers or the stack in register-sized pieces. Large arguments are split between registers and stack. */ - /* Note: structs whose size is not a multiple of MIPS_REGSIZE - are treated specially: Irix cc passes them in registers - where gcc sometimes puts them on the stack. For maximum - compatibility, we will put them in both places. */ + /* Note: structs whose size is not a multiple of + mips_regsize() are treated specially: Irix cc passes them + in registers where gcc sometimes puts them on the stack. + For maximum compatibility, we will put them in both + places. */ int odd_sized_struct = ((len > MIPS_SAVED_REGSIZE) && (len % MIPS_SAVED_REGSIZE != 0)); /* Structures should be aligned to eight bytes (even arg registers) @@ -3854,8 +3758,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, && !fp_register_arg_p (typecode, arg_type)) { LONGEST regval = extract_signed_integer (val, partial_len); - /* Value may need to be sign extended, because - MIPS_REGSIZE != MIPS_SAVED_REGSIZE. */ + /* Value may need to be sign extended, because + mips_regsize() != MIPS_SAVED_REGSIZE. */ /* A non-floating-point argument being passed in a general register. If a struct or union, and if @@ -3950,7 +3854,7 @@ mips_pop_frame (void) /* Floating point registers must not be sign extended, in case MIPS_SAVED_REGSIZE = 4 but sizeof (FP0_REGNUM) == 8. */ - if (FP0_REGNUM <= regnum && regnum < FP0_REGNUM + 32) + if (mips_regnum (current_gdbarch)->fp0 <= regnum && regnum < mips_regnum (current_gdbarch)->fp0 + 32) write_register (regnum, read_memory_unsigned_integer (deprecated_get_frame_saved_regs (frame)[regnum], MIPS_SAVED_REGSIZE)); @@ -3985,14 +3889,14 @@ mips_pop_frame (void) xfree (pi_ptr); - write_register (HI_REGNUM, + write_register (mips_regnum (current_gdbarch)->hi, read_memory_integer (new_sp - 2 * MIPS_SAVED_REGSIZE, MIPS_SAVED_REGSIZE)); - write_register (LO_REGNUM, + write_register (mips_regnum (current_gdbarch)->lo, read_memory_integer (new_sp - 3 * MIPS_SAVED_REGSIZE, MIPS_SAVED_REGSIZE)); if (MIPS_FPU_TYPE != MIPS_FPU_NONE) - write_register (FCRCS_REGNUM, + write_register (mips_regnum (current_gdbarch)->fp_control_status, read_memory_integer (new_sp - 4 * MIPS_SAVED_REGSIZE, MIPS_SAVED_REGSIZE)); } @@ -4053,7 +3957,7 @@ static void mips_read_fp_register_single (struct frame_info *frame, int regno, char *rare_buffer) { - int raw_size = DEPRECATED_REGISTER_RAW_SIZE (regno); + int raw_size = register_size (current_gdbarch, regno); char *raw_buffer = alloca (raw_size); if (!frame_register_read (frame, regno, raw_buffer)) @@ -4085,7 +3989,7 @@ static void mips_read_fp_register_double (struct frame_info *frame, int regno, char *rare_buffer) { - int raw_size = DEPRECATED_REGISTER_RAW_SIZE (regno); + int raw_size = register_size (current_gdbarch, regno); if (raw_size == 8 && !mips2_fp_compat ()) { @@ -4096,7 +4000,7 @@ mips_read_fp_register_double (struct frame_info *frame, int regno, } else { - if ((regno - FP0_REGNUM) & 1) + if ((regno - mips_regnum (current_gdbarch)->fp0) & 1) internal_error (__FILE__, __LINE__, "mips_read_fp_register_double: bad access to " "odd-numbered FP register"); @@ -4124,13 +4028,13 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame, double doub, flt1, flt2; /* doubles extracted from raw hex data */ int inv1, inv2, namelen; - raw_buffer = (char *) alloca (2 * DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM)); + raw_buffer = (char *) alloca (2 * register_size (current_gdbarch, mips_regnum (current_gdbarch)->fp0)); fprintf_filtered (file, "%s:", REGISTER_NAME (regnum)); fprintf_filtered (file, "%*s", 4 - (int) strlen (REGISTER_NAME (regnum)), ""); - if (DEPRECATED_REGISTER_RAW_SIZE (regnum) == 4 || mips2_fp_compat ()) + if (register_size (current_gdbarch, regnum) == 4 || mips2_fp_compat ()) { /* 4-byte registers: Print hex and floating. Also print even numbered registers as doubles. */ @@ -4217,7 +4121,7 @@ mips_print_register (struct ui_file *file, struct frame_info *frame, fprintf_filtered (file, ": "); if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - offset = DEPRECATED_REGISTER_RAW_SIZE (regnum) - DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum); + offset = register_size (current_gdbarch, regnum) - register_size (current_gdbarch, regnum); else offset = 0; @@ -4248,7 +4152,7 @@ print_gp_register_row (struct ui_file *file, struct frame_info *frame, struct gdbarch *gdbarch = get_frame_arch (frame); /* do values for GP (int) regs */ char raw_buffer[MAX_REGISTER_SIZE]; - int ncols = (MIPS_REGSIZE == 8 ? 4 : 8); /* display cols per row */ + int ncols = (mips_regsize (gdbarch) == 8 ? 4 : 8); /* display cols per row */ int col, byte; int regnum; @@ -4262,7 +4166,7 @@ print_gp_register_row (struct ui_file *file, struct frame_info *frame, continue; /* unused register */ if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT) break; /* end the row: reached FP register */ - fprintf_filtered (file, MIPS_REGSIZE == 8 ? "%17s" : "%9s", + fprintf_filtered (file, mips_regsize (current_gdbarch) == 8 ? "%17s" : "%9s", REGISTER_NAME (regnum)); col++; } @@ -4285,16 +4189,19 @@ print_gp_register_row (struct ui_file *file, struct frame_info *frame, if (!frame_register_read (frame, regnum, raw_buffer)) error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum)); /* pad small registers */ - for (byte = 0; byte < (MIPS_REGSIZE - DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum)); byte++) + for (byte = 0; + byte < (mips_regsize (current_gdbarch) + - register_size (current_gdbarch, regnum)); + byte++) printf_filtered (" "); /* Now print the register value in hex, endian order. */ if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - for (byte = DEPRECATED_REGISTER_RAW_SIZE (regnum) - DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum); - byte < DEPRECATED_REGISTER_RAW_SIZE (regnum); + for (byte = register_size (current_gdbarch, regnum) - register_size (current_gdbarch, regnum); + byte < register_size (current_gdbarch, regnum); byte++) fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[byte]); else - for (byte = DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum) - 1; + for (byte = register_size (current_gdbarch, regnum) - 1; byte >= 0; byte--) fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[byte]); @@ -4375,6 +4282,61 @@ mips_step_skips_delay (CORE_ADDR pc) } +/* Given PC at the function's start address, attempt to find the + prologue end using SAL information. Return zero if the skip fails. + + A non-optimized prologue traditionally has one SAL for the function + and a second for the function body. A single line function has + them both pointing at the same line. + + An optimized prologue is similar but the prologue may contain + instructions (SALs) from the instruction body. Need to skip those + while not getting into the function body. + + The functions end point and an increasing SAL line are used as + indicators of the prologue's endpoint. + + This code is based on the function refine_prologue_limit (versions + found in both ia64 and ppc). */ + +static CORE_ADDR +skip_prologue_using_sal (CORE_ADDR func_addr) +{ + struct symtab_and_line prologue_sal; + CORE_ADDR start_pc; + CORE_ADDR end_pc; + + /* Get an initial range for the function. */ + find_pc_partial_function (func_addr, NULL, &start_pc, &end_pc); + start_pc += FUNCTION_START_OFFSET; + + prologue_sal = find_pc_line (start_pc, 0); + if (prologue_sal.line != 0) + { + while (prologue_sal.end < end_pc) + { + struct symtab_and_line sal; + + sal = find_pc_line (prologue_sal.end, 0); + if (sal.line == 0) + break; + /* Assume that a consecutive SAL for the same (or larger) + line mark the prologue -> body transition. */ + if (sal.line >= prologue_sal.line) + break; + /* The case in which compiler's optimizer/scheduler has + moved instructions into the prologue. We look ahead in + the function looking for address ranges whose + corresponding line number is less the first one that we + found for the function. This is more conservative then + refine_prologue_limit which scans a large number of SALs + looking for any in the prologue */ + prologue_sal = sal; + } + } + return prologue_sal.end; +} + /* Skip the PC past function prologue instructions (32-bit version). This is a helper function for mips_skip_prologue. */ @@ -4386,10 +4348,15 @@ mips32_skip_prologue (CORE_ADDR pc) int seen_sp_adjust = 0; int load_immediate_bytes = 0; + /* Find an upper bound on the prologue. */ + end_pc = skip_prologue_using_sal (pc); + if (end_pc == 0) + end_pc = pc + 100; /* Magic. */ + /* Skip the typical prologue instructions. These are the stack adjustment instruction and the instructions that save registers on the stack or in the gcc frame. */ - for (end_pc = pc + 100; pc < end_pc; pc += MIPS_INSTLEN) + for (; pc < end_pc; pc += MIPS_INSTLEN) { unsigned long high_word; @@ -4531,10 +4498,15 @@ mips16_skip_prologue (CORE_ADDR pc) } /* end of table marker */ }; + /* Find an upper bound on the prologue. */ + end_pc = skip_prologue_using_sal (pc); + if (end_pc == 0) + end_pc = pc + 100; /* Magic. */ + /* Skip the typical prologue instructions. These are the stack adjustment instruction and the instructions that save registers on the stack or in the gcc frame. */ - for (end_pc = pc + 100; pc < end_pc; pc += MIPS16_INSTLEN) + for (; pc < end_pc; pc += MIPS16_INSTLEN) { unsigned short inst; int i; @@ -4629,11 +4601,11 @@ return_value_location (struct type *valtype, lo->buf_offset = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? 4 : 0; hi->buf_offset = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? 0 : 4; lo->reg_offset = ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG - && DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM) == 8) + && register_size (current_gdbarch, mips_regnum (current_gdbarch)->fp0) == 8) ? 4 : 0); hi->reg_offset = lo->reg_offset; - lo->reg = FP0_REGNUM + 0; - hi->reg = FP0_REGNUM + 1; + lo->reg = mips_regnum (current_gdbarch)->fp0 + 0; + hi->reg = mips_regnum (current_gdbarch)->fp0 + 1; lo->len = 4; hi->len = 4; } @@ -4642,10 +4614,10 @@ return_value_location (struct type *valtype, /* The floating point value fits in a single floating-point register. */ lo->reg_offset = ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG - && DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM) == 8 + && register_size (current_gdbarch, mips_regnum (current_gdbarch)->fp0) == 8 && len == 4) ? 4 : 0); - lo->reg = FP0_REGNUM; + lo->reg = mips_regnum (current_gdbarch)->fp0; lo->len = len; lo->buf_offset = 0; hi->len = 0; @@ -4698,7 +4670,7 @@ return_value_location (struct type *valtype, } } if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG - && DEPRECATED_REGISTER_RAW_SIZE (regnum) == 8 + && register_size (current_gdbarch, regnum) == 8 && MIPS_SAVED_REGSIZE == 4) { /* Account for the fact that only the least-signficant part @@ -4724,12 +4696,12 @@ mips_eabi_extract_return_value (struct type *valtype, return_value_location (valtype, &hi, &lo); memcpy (valbuf + lo.buf_offset, - regbuf + DEPRECATED_REGISTER_BYTE (lo.reg) + lo.reg_offset, + regbuf + DEPRECATED_REGISTER_BYTE (NUM_REGS + lo.reg) + lo.reg_offset, lo.len); if (hi.len > 0) memcpy (valbuf + hi.buf_offset, - regbuf + DEPRECATED_REGISTER_BYTE (hi.reg) + hi.reg_offset, + regbuf + DEPRECATED_REGISTER_BYTE (NUM_REGS + hi.reg) + hi.reg_offset, hi.len); } @@ -4743,12 +4715,12 @@ mips_o64_extract_return_value (struct type *valtype, return_value_location (valtype, &hi, &lo); memcpy (valbuf + lo.buf_offset, - regbuf + DEPRECATED_REGISTER_BYTE (lo.reg) + lo.reg_offset, + regbuf + DEPRECATED_REGISTER_BYTE (NUM_REGS + lo.reg) + lo.reg_offset, lo.len); if (hi.len > 0) memcpy (valbuf + hi.buf_offset, - regbuf + DEPRECATED_REGISTER_BYTE (hi.reg) + hi.reg_offset, + regbuf + DEPRECATED_REGISTER_BYTE (NUM_REGS + hi.reg) + hi.reg_offset, hi.len); } @@ -4766,14 +4738,14 @@ mips_eabi_store_return_value (struct type *valtype, char *valbuf) memset (raw_buffer, 0, sizeof (raw_buffer)); memcpy (raw_buffer + lo.reg_offset, valbuf + lo.buf_offset, lo.len); deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (lo.reg), raw_buffer, - DEPRECATED_REGISTER_RAW_SIZE (lo.reg)); + register_size (current_gdbarch, lo.reg)); if (hi.len > 0) { memset (raw_buffer, 0, sizeof (raw_buffer)); memcpy (raw_buffer + hi.reg_offset, valbuf + hi.buf_offset, hi.len); deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (hi.reg), raw_buffer, - DEPRECATED_REGISTER_RAW_SIZE (hi.reg)); + register_size (current_gdbarch, hi.reg)); } } @@ -4788,35 +4760,43 @@ mips_o64_store_return_value (struct type *valtype, char *valbuf) memset (raw_buffer, 0, sizeof (raw_buffer)); memcpy (raw_buffer + lo.reg_offset, valbuf + lo.buf_offset, lo.len); deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (lo.reg), raw_buffer, - DEPRECATED_REGISTER_RAW_SIZE (lo.reg)); + register_size (current_gdbarch, lo.reg)); if (hi.len > 0) { memset (raw_buffer, 0, sizeof (raw_buffer)); memcpy (raw_buffer + hi.reg_offset, valbuf + hi.buf_offset, hi.len); deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (hi.reg), raw_buffer, - DEPRECATED_REGISTER_RAW_SIZE (hi.reg)); + register_size (current_gdbarch, hi.reg)); } } /* O32 ABI stuff. */ -static void -mips_o32_xfer_return_value (struct type *type, - struct regcache *regcache, - bfd_byte *in, const bfd_byte *out) +static enum return_value_convention +mips_o32_return_value (struct gdbarch *gdbarch, struct type *type, + struct regcache *regcache, + void *readbuf, const void *writebuf) { struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - if (TYPE_CODE (type) == TYPE_CODE_FLT - && TYPE_LENGTH (type) == 4 - && tdep->mips_fpu_type != MIPS_FPU_NONE) + + if (TYPE_CODE (type)== TYPE_CODE_STRUCT + || TYPE_CODE (type)== TYPE_CODE_UNION + || TYPE_CODE (type)== TYPE_CODE_ARRAY) + return RETURN_VALUE_STRUCT_CONVENTION; + else if (TYPE_CODE (type) == TYPE_CODE_FLT + && TYPE_LENGTH (type) == 4 + && tdep->mips_fpu_type != MIPS_FPU_NONE) { /* A single-precision floating-point value. It fits in the least significant part of FP0. */ if (mips_debug) fprintf_unfiltered (gdb_stderr, "Return float in $fp0\n"); - mips_xfer_register (regcache, NUM_REGS + FP0_REGNUM, TYPE_LENGTH (type), - TARGET_BYTE_ORDER, in, out, 0); + mips_xfer_register (regcache, + NUM_REGS + mips_regnum (current_gdbarch)->fp0, + TYPE_LENGTH (type), + TARGET_BYTE_ORDER, readbuf, writebuf, 0); + return RETURN_VALUE_REGISTER_CONVENTION; } else if (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8 @@ -4830,20 +4810,25 @@ mips_o32_xfer_return_value (struct type *type, switch (TARGET_BYTE_ORDER) { case BFD_ENDIAN_LITTLE: - mips_xfer_register (regcache, NUM_REGS + FP0_REGNUM + 0, 4, - TARGET_BYTE_ORDER, in, out, 0); - mips_xfer_register (regcache, NUM_REGS + FP0_REGNUM + 1, 4, - TARGET_BYTE_ORDER, in, out, 4); + mips_xfer_register (regcache, + NUM_REGS + mips_regnum (current_gdbarch)->fp0 + 0, + 4, TARGET_BYTE_ORDER, readbuf, writebuf, 0); + mips_xfer_register (regcache, + NUM_REGS + mips_regnum (current_gdbarch)->fp0 + 1, + 4, TARGET_BYTE_ORDER, readbuf, writebuf, 4); break; case BFD_ENDIAN_BIG: - mips_xfer_register (regcache, NUM_REGS + FP0_REGNUM + 1, 4, - TARGET_BYTE_ORDER, in, out, 0); - mips_xfer_register (regcache, NUM_REGS + FP0_REGNUM + 0, 4, - TARGET_BYTE_ORDER, in, out, 4); + mips_xfer_register (regcache, + NUM_REGS + mips_regnum (current_gdbarch)->fp0 + 1, + 4, TARGET_BYTE_ORDER, readbuf, writebuf, 0); + mips_xfer_register (regcache, + NUM_REGS + mips_regnum (current_gdbarch)->fp0 + 0, + 4, TARGET_BYTE_ORDER, readbuf, writebuf, 4); break; default: internal_error (__FILE__, __LINE__, "bad switch"); } + return RETURN_VALUE_REGISTER_CONVENTION; } #if 0 else if (TYPE_CODE (type) == TYPE_CODE_STRUCT @@ -4865,7 +4850,7 @@ mips_o32_xfer_return_value (struct type *type, bfd_byte reg[MAX_REGISTER_SIZE]; int regnum; int field; - for (field = 0, regnum = FP0_REGNUM; + for (field = 0, regnum = mips_regnum (current_gdbarch)->fp0; field < TYPE_NFIELDS (type); field++, regnum += 2) { @@ -4875,8 +4860,9 @@ mips_o32_xfer_return_value (struct type *type, fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n", offset); mips_xfer_register (regcache, NUM_REGS + regnum, TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)), - TARGET_BYTE_ORDER, in, out, offset); + TARGET_BYTE_ORDER, readbuf, writebuf, offset); } + return RETURN_VALUE_REGISTER_CONVENTION; } #endif #if 0 @@ -4890,17 +4876,18 @@ mips_o32_xfer_return_value (struct type *type, int regnum; for (offset = 0, regnum = V0_REGNUM; offset < TYPE_LENGTH (type); - offset += DEPRECATED_REGISTER_RAW_SIZE (regnum), regnum++) + offset += register_size (current_gdbarch, regnum), regnum++) { - int xfer = DEPRECATED_REGISTER_RAW_SIZE (regnum); + int xfer = register_size (current_gdbarch, regnum); if (offset + xfer > TYPE_LENGTH (type)) xfer = TYPE_LENGTH (type) - offset; if (mips_debug) fprintf_unfiltered (gdb_stderr, "Return struct+%d:%d in $%d\n", offset, xfer, regnum); mips_xfer_register (regcache, NUM_REGS + regnum, xfer, - BFD_ENDIAN_UNKNOWN, in, out, offset); + BFD_ENDIAN_UNKNOWN, readbuf, writebuf, offset); } + return RETURN_VALUE_REGISTER_CONVENTION; } #endif else @@ -4922,42 +4909,37 @@ mips_o32_xfer_return_value (struct type *type, fprintf_unfiltered (gdb_stderr, "Return scalar+%d:%d in $%d\n", offset, xfer, regnum); mips_xfer_register (regcache, NUM_REGS + regnum, xfer, - TARGET_BYTE_ORDER, in, out, offset); + TARGET_BYTE_ORDER, readbuf, writebuf, offset); } + return RETURN_VALUE_REGISTER_CONVENTION; } } -static void -mips_o32_extract_return_value (struct type *type, - struct regcache *regcache, - void *valbuf) -{ - mips_o32_xfer_return_value (type, regcache, valbuf, NULL); -} - -static void -mips_o32_store_return_value (struct type *type, char *valbuf) -{ - mips_o32_xfer_return_value (type, current_regcache, NULL, valbuf); -} - /* N32/N44 ABI stuff. */ -static void -mips_n32n64_xfer_return_value (struct type *type, - struct regcache *regcache, - bfd_byte *in, const bfd_byte *out) +static enum return_value_convention +mips_n32n64_return_value (struct gdbarch *gdbarch, + struct type *type, struct regcache *regcache, + void *readbuf, const void *writebuf) { struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - if (TYPE_CODE (type) == TYPE_CODE_FLT - && tdep->mips_fpu_type != MIPS_FPU_NONE) + if (TYPE_CODE (type)== TYPE_CODE_STRUCT + || TYPE_CODE (type)== TYPE_CODE_UNION + || TYPE_CODE (type)== TYPE_CODE_ARRAY + || TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE) + return RETURN_VALUE_STRUCT_CONVENTION; + else if (TYPE_CODE (type) == TYPE_CODE_FLT + && tdep->mips_fpu_type != MIPS_FPU_NONE) { /* A floating-point value belongs in the least significant part of FP0. */ if (mips_debug) fprintf_unfiltered (gdb_stderr, "Return float in $fp0\n"); - mips_xfer_register (regcache, NUM_REGS + FP0_REGNUM, TYPE_LENGTH (type), - TARGET_BYTE_ORDER, in, out, 0); + mips_xfer_register (regcache, + NUM_REGS + mips_regnum (current_gdbarch)->fp0, + TYPE_LENGTH (type), + TARGET_BYTE_ORDER, readbuf, writebuf, 0); + return RETURN_VALUE_REGISTER_CONVENTION; } else if (TYPE_CODE (type) == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) <= 2 @@ -4978,7 +4960,7 @@ mips_n32n64_xfer_return_value (struct type *type, bfd_byte reg[MAX_REGISTER_SIZE]; int regnum; int field; - for (field = 0, regnum = FP0_REGNUM; + for (field = 0, regnum = mips_regnum (current_gdbarch)->fp0; field < TYPE_NFIELDS (type); field++, regnum += 2) { @@ -4988,8 +4970,9 @@ mips_n32n64_xfer_return_value (struct type *type, fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n", offset); mips_xfer_register (regcache, NUM_REGS + regnum, TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)), - TARGET_BYTE_ORDER, in, out, offset); + TARGET_BYTE_ORDER, readbuf, writebuf, offset); } + return RETURN_VALUE_REGISTER_CONVENTION; } else if (TYPE_CODE (type) == TYPE_CODE_STRUCT || TYPE_CODE (type) == TYPE_CODE_UNION) @@ -5001,17 +4984,18 @@ mips_n32n64_xfer_return_value (struct type *type, int regnum; for (offset = 0, regnum = V0_REGNUM; offset < TYPE_LENGTH (type); - offset += DEPRECATED_REGISTER_RAW_SIZE (regnum), regnum++) + offset += register_size (current_gdbarch, regnum), regnum++) { - int xfer = DEPRECATED_REGISTER_RAW_SIZE (regnum); + int xfer = register_size (current_gdbarch, regnum); if (offset + xfer > TYPE_LENGTH (type)) xfer = TYPE_LENGTH (type) - offset; if (mips_debug) fprintf_unfiltered (gdb_stderr, "Return struct+%d:%d in $%d\n", offset, xfer, regnum); mips_xfer_register (regcache, NUM_REGS + regnum, xfer, - BFD_ENDIAN_UNKNOWN, in, out, offset); + BFD_ENDIAN_UNKNOWN, readbuf, writebuf, offset); } + return RETURN_VALUE_REGISTER_CONVENTION; } else { @@ -5021,9 +5005,9 @@ mips_n32n64_xfer_return_value (struct type *type, int regnum; for (offset = 0, regnum = V0_REGNUM; offset < TYPE_LENGTH (type); - offset += DEPRECATED_REGISTER_RAW_SIZE (regnum), regnum++) + offset += register_size (current_gdbarch, regnum), regnum++) { - int xfer = DEPRECATED_REGISTER_RAW_SIZE (regnum); + int xfer = register_size (current_gdbarch, regnum); int pos = 0; if (offset + xfer > TYPE_LENGTH (type)) xfer = TYPE_LENGTH (type) - offset; @@ -5031,25 +5015,12 @@ mips_n32n64_xfer_return_value (struct type *type, fprintf_unfiltered (gdb_stderr, "Return scalar+%d:%d in $%d\n", offset, xfer, regnum); mips_xfer_register (regcache, NUM_REGS + regnum, xfer, - TARGET_BYTE_ORDER, in, out, offset); + TARGET_BYTE_ORDER, readbuf, writebuf, offset); } + return RETURN_VALUE_REGISTER_CONVENTION; } } -static void -mips_n32n64_extract_return_value (struct type *type, - struct regcache *regcache, - void *valbuf) -{ - mips_n32n64_xfer_return_value (type, regcache, valbuf, NULL); -} - -static void -mips_n32n64_store_return_value (struct type *type, char *valbuf) -{ - mips_n32n64_xfer_return_value (type, current_regcache, NULL, valbuf); -} - static CORE_ADDR mips_extract_struct_value_address (struct regcache *regcache) { @@ -5154,76 +5125,22 @@ set_mipsfpu_auto_command (char *args, int from_tty) mips_fpu_type_auto = 1; } -/* Command to set the processor type. */ - -void -mips_set_processor_type_command (char *args, int from_tty) -{ - int i; - - if (tmp_mips_processor_type == NULL || *tmp_mips_processor_type == '\0') - { - printf_unfiltered ("The known MIPS processor types are as follows:\n\n"); - for (i = 0; mips_processor_type_table[i].name != NULL; ++i) - printf_unfiltered ("%s\n", mips_processor_type_table[i].name); - - /* Restore the value. */ - tmp_mips_processor_type = xstrdup (mips_processor_type); - - return; - } - - if (!mips_set_processor_type (tmp_mips_processor_type)) - { - error ("Unknown processor type `%s'.", tmp_mips_processor_type); - /* Restore its value. */ - tmp_mips_processor_type = xstrdup (mips_processor_type); - } -} - -static void -mips_show_processor_type_command (char *args, int from_tty) -{ -} - -/* Modify the actual processor type. */ - -static int -mips_set_processor_type (char *str) -{ - int i; - - if (str == NULL) - return 0; - - for (i = 0; mips_processor_type_table[i].name != NULL; ++i) - { - if (strcasecmp (str, mips_processor_type_table[i].name) == 0) - { - mips_processor_type = str; - mips_processor_reg_names = mips_processor_type_table[i].regnames; - return 1; - /* FIXME tweak fpu flag too */ - } - } - - return 0; -} - /* Attempt to identify the particular processor model by reading the - processor id. */ + processor id. NOTE: cagney/2003-11-15: Firstly it isn't clear that + the relevant processor still exists (it dates back to '94) and + secondly this is not the way to do this. The processor type should + be set by forcing an architecture change. */ -char * -mips_read_processor_type (void) +void +deprecated_mips_set_processor_regs_hack (void) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); CORE_ADDR prid; prid = read_register (PRID_REGNUM); if ((prid & ~0xf) == 0x700) - return savestring ("r3041", strlen ("r3041")); - - return NULL; + tdep->mips_processor_reg_names = mips_r3041_reg_names; } /* Just like reinit_frame_cache, but with the right arguments to be @@ -5612,11 +5529,11 @@ mips_stab_reg_to_regnum (int num) if (num >= 0 && num < 32) regnum = num; else if (num >= 38 && num < 70) - regnum = num + FP0_REGNUM - 38; + regnum = num + mips_regnum (current_gdbarch)->fp0 - 38; else if (num == 70) - regnum = HI_REGNUM; + regnum = mips_regnum (current_gdbarch)->hi; else if (num == 71) - regnum = LO_REGNUM; + regnum = mips_regnum (current_gdbarch)->lo; else /* This will hopefully (eventually) provoke a warning. Should we be calling complaint() here? */ @@ -5635,11 +5552,11 @@ mips_dwarf_dwarf2_ecoff_reg_to_regnum (int num) if (num >= 0 && num < 32) regnum = num; else if (num >= 32 && num < 64) - regnum = num + FP0_REGNUM - 32; + regnum = num + mips_regnum (current_gdbarch)->fp0 - 32; else if (num == 64) - regnum = HI_REGNUM; + regnum = mips_regnum (current_gdbarch)->hi; else if (num == 65) - regnum = LO_REGNUM; + regnum = mips_regnum (current_gdbarch)->lo; else /* This will hopefully (eventually) provoke a warning. Should we be calling complaint() here? */ @@ -5831,6 +5748,11 @@ mips_gdbarch_init (struct gdbarch_info info, continue; if (gdbarch_tdep (arches->gdbarch)->mips_abi != mips_abi) continue; + /* Need to be pedantic about which register virtual size is + used. */ + if (gdbarch_tdep (arches->gdbarch)->mips64_transfers_32bit_regs_p + != mips64_transfers_32bit_regs_p) + continue; return arches->gdbarch; } @@ -5838,6 +5760,7 @@ mips_gdbarch_init (struct gdbarch_info info, tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep)); gdbarch = gdbarch_alloc (&info, tdep); tdep->elf_flags = elf_flags; + tdep->mips64_transfers_32bit_regs_p = mips64_transfers_32bit_regs_p; /* Initially set everything according to the default ABI/ISA. */ set_gdbarch_short_bit (gdbarch, 16); @@ -5845,8 +5768,6 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_float_bit (gdbarch, 32); set_gdbarch_double_bit (gdbarch, 64); set_gdbarch_long_double_bit (gdbarch, 64); - set_gdbarch_deprecated_register_raw_size (gdbarch, mips_register_raw_size); - set_gdbarch_deprecated_register_byte (gdbarch, mips_register_byte); set_gdbarch_register_reggroup_p (gdbarch, mips_register_reggroup_p); set_gdbarch_pseudo_register_read (gdbarch, mips_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, mips_pseudo_register_write); @@ -5856,34 +5777,59 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_elf_make_msymbol_special (gdbarch, mips_elf_make_msymbol_special); - - if (info.osabi == GDB_OSABI_IRIX) - num_regs = 71; - else - num_regs = 90; - set_gdbarch_num_regs (gdbarch, num_regs); - set_gdbarch_num_pseudo_regs (gdbarch, num_regs); + /* Fill in the OS dependant register numbers. */ + { + struct mips_regnum *regnum = GDBARCH_OBSTACK_ZALLOC (gdbarch, + struct mips_regnum); + tdep->regnum = regnum; + if (info.osabi == GDB_OSABI_IRIX) + { + regnum->fp0 = 32; + regnum->pc = 64; + regnum->cause = 65; + regnum->badvaddr = 66; + regnum->hi = 67; + regnum->lo = 68; + regnum->fp_control_status = 69; + regnum->fp_implementation_revision = 70; + num_regs = 71; + } + else + { + regnum->lo = MIPS_EMBED_LO_REGNUM; + regnum->hi = MIPS_EMBED_HI_REGNUM; + regnum->badvaddr = MIPS_EMBED_BADVADDR_REGNUM; + regnum->cause = MIPS_EMBED_CAUSE_REGNUM; + regnum->pc = MIPS_EMBED_PC_REGNUM; + regnum->fp0 = MIPS_EMBED_FP0_REGNUM; + regnum->fp_control_status = 70; + regnum->fp_implementation_revision = 71; + num_regs = 90; + } + /* FIXME: cagney/2003-11-15: For MIPS, hasn't PC_REGNUM been + replaced by read_pc? */ + set_gdbarch_pc_regnum (gdbarch, regnum->pc); + set_gdbarch_fp0_regnum (gdbarch, regnum->fp0); + set_gdbarch_num_regs (gdbarch, num_regs); + set_gdbarch_num_pseudo_regs (gdbarch, num_regs); + } switch (mips_abi) { case MIPS_ABI_O32: set_gdbarch_push_dummy_call (gdbarch, mips_o32_push_dummy_call); - set_gdbarch_deprecated_store_return_value (gdbarch, mips_o32_store_return_value); - set_gdbarch_extract_return_value (gdbarch, mips_o32_extract_return_value); + set_gdbarch_return_value (gdbarch, mips_o32_return_value); tdep->mips_default_saved_regsize = 4; tdep->mips_default_stack_argsize = 4; tdep->mips_fp_register_double = 0; tdep->mips_last_arg_regnum = A0_REGNUM + 4 - 1; - tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 4 - 1; - tdep->gdb_target_is_mips64 = 0; + tdep->mips_last_fp_arg_regnum = tdep->regnum->fp0 + 12 + 4 - 1; tdep->default_mask_address_p = 0; set_gdbarch_long_bit (gdbarch, 32); set_gdbarch_ptr_bit (gdbarch, 32); set_gdbarch_long_long_bit (gdbarch, 64); set_gdbarch_deprecated_reg_struct_has_addr (gdbarch, mips_o32_reg_struct_has_addr); - set_gdbarch_use_struct_convention (gdbarch, - always_use_struct_convention); break; case MIPS_ABI_O64: set_gdbarch_push_dummy_call (gdbarch, mips_o64_push_dummy_call); @@ -5893,8 +5839,7 @@ mips_gdbarch_init (struct gdbarch_info info, tdep->mips_default_stack_argsize = 8; tdep->mips_fp_register_double = 1; tdep->mips_last_arg_regnum = A0_REGNUM + 4 - 1; - tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 4 - 1; - tdep->gdb_target_is_mips64 = 1; + tdep->mips_last_fp_arg_regnum = tdep->regnum->fp0 + 12 + 4 - 1; tdep->default_mask_address_p = 0; set_gdbarch_long_bit (gdbarch, 32); set_gdbarch_ptr_bit (gdbarch, 32); @@ -5911,8 +5856,7 @@ mips_gdbarch_init (struct gdbarch_info info, tdep->mips_default_stack_argsize = 4; tdep->mips_fp_register_double = 0; tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1; - tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1; - tdep->gdb_target_is_mips64 = 0; + tdep->mips_last_fp_arg_regnum = tdep->regnum->fp0 + 12 + 8 - 1; tdep->default_mask_address_p = 0; set_gdbarch_long_bit (gdbarch, 32); set_gdbarch_ptr_bit (gdbarch, 32); @@ -5930,8 +5874,7 @@ mips_gdbarch_init (struct gdbarch_info info, tdep->mips_default_stack_argsize = 8; tdep->mips_fp_register_double = 1; tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1; - tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1; - tdep->gdb_target_is_mips64 = 1; + tdep->mips_last_fp_arg_regnum = tdep->regnum->fp0 + 12 + 8 - 1; tdep->default_mask_address_p = 0; set_gdbarch_long_bit (gdbarch, 64); set_gdbarch_ptr_bit (gdbarch, 64); @@ -5943,39 +5886,31 @@ mips_gdbarch_init (struct gdbarch_info info, break; case MIPS_ABI_N32: set_gdbarch_push_dummy_call (gdbarch, mips_n32n64_push_dummy_call); - set_gdbarch_deprecated_store_return_value (gdbarch, mips_n32n64_store_return_value); - set_gdbarch_extract_return_value (gdbarch, mips_n32n64_extract_return_value); + set_gdbarch_return_value (gdbarch, mips_n32n64_return_value); tdep->mips_default_saved_regsize = 8; tdep->mips_default_stack_argsize = 8; tdep->mips_fp_register_double = 1; tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1; - tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1; - tdep->gdb_target_is_mips64 = 1; + tdep->mips_last_fp_arg_regnum = tdep->regnum->fp0 + 12 + 8 - 1; tdep->default_mask_address_p = 0; set_gdbarch_long_bit (gdbarch, 32); set_gdbarch_ptr_bit (gdbarch, 32); set_gdbarch_long_long_bit (gdbarch, 64); - set_gdbarch_use_struct_convention (gdbarch, - mips_n32n64_use_struct_convention); set_gdbarch_deprecated_reg_struct_has_addr (gdbarch, mips_n32n64_reg_struct_has_addr); break; case MIPS_ABI_N64: set_gdbarch_push_dummy_call (gdbarch, mips_n32n64_push_dummy_call); - set_gdbarch_deprecated_store_return_value (gdbarch, mips_n32n64_store_return_value); - set_gdbarch_extract_return_value (gdbarch, mips_n32n64_extract_return_value); + set_gdbarch_return_value (gdbarch, mips_n32n64_return_value); tdep->mips_default_saved_regsize = 8; tdep->mips_default_stack_argsize = 8; tdep->mips_fp_register_double = 1; tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1; - tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1; - tdep->gdb_target_is_mips64 = 1; + tdep->mips_last_fp_arg_regnum = tdep->regnum->fp0 + 12 + 8 - 1; tdep->default_mask_address_p = 0; set_gdbarch_long_bit (gdbarch, 64); set_gdbarch_ptr_bit (gdbarch, 64); set_gdbarch_long_long_bit (gdbarch, 64); - set_gdbarch_use_struct_convention (gdbarch, - mips_n32n64_use_struct_convention); set_gdbarch_deprecated_reg_struct_has_addr (gdbarch, mips_n32n64_reg_struct_has_addr); break; @@ -6027,11 +5962,14 @@ mips_gdbarch_init (struct gdbarch_info info, else tdep->mips_fpu_type = MIPS_FPU_DOUBLE; - /* MIPS version of register names. NOTE: At present the MIPS - register name management is part way between the old - - #undef/#define MIPS_REGISTER_NAMES and the new REGISTER_NAME(nr). - Further work on it is required. */ + /* MIPS version of register names. */ set_gdbarch_register_name (gdbarch, mips_register_name); + if (info.osabi == GDB_OSABI_IRIX) + tdep->mips_processor_reg_names = mips_irix_reg_names; + else if (info.bfd_arch_info != NULL && info.bfd_arch_info->mach == bfd_mach_mips3900) + tdep->mips_processor_reg_names = mips_tx39_reg_names; + else + tdep->mips_processor_reg_names = mips_generic_reg_names; set_gdbarch_read_pc (gdbarch, mips_read_pc); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); set_gdbarch_deprecated_target_read_fp (gdbarch, mips_read_sp); /* Draft FRAME base. */ @@ -6065,9 +6003,6 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_deprecated_pop_frame (gdbarch, mips_pop_frame); set_gdbarch_frame_align (gdbarch, mips_frame_align); set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); - set_gdbarch_deprecated_register_convertible (gdbarch, mips_register_convertible); - set_gdbarch_deprecated_register_convert_to_virtual (gdbarch, mips_register_convert_to_virtual); - set_gdbarch_deprecated_register_convert_to_raw (gdbarch, mips_register_convert_to_raw); set_gdbarch_deprecated_frame_chain (gdbarch, mips_frame_chain); set_gdbarch_frameless_function_invocation (gdbarch, @@ -6224,10 +6159,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) "mips_dump_tdep: MIPS_EABI = %d\n", MIPS_EABI); fprintf_unfiltered (file, - "mips_dump_tdep: MIPS_LAST_FP_ARG_REGNUM = %d (%d regs)\n", - MIPS_LAST_FP_ARG_REGNUM, - MIPS_LAST_FP_ARG_REGNUM - FPA0_REGNUM + 1); - fprintf_unfiltered (file, "mips_dump_tdep: MIPS_FPU_TYPE = %d (%s)\n", MIPS_FPU_TYPE, (MIPS_FPU_TYPE == MIPS_FPU_NONE ? "none" @@ -6247,9 +6178,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) "mips_dump_tdep: MIPS_STACK_ARGSIZE = %d\n", MIPS_STACK_ARGSIZE); fprintf_unfiltered (file, - "mips_dump_tdep: MIPS_REGSIZE = %d\n", - MIPS_REGSIZE); - fprintf_unfiltered (file, "mips_dump_tdep: A0_REGNUM = %d\n", A0_REGNUM); fprintf_unfiltered (file, @@ -6259,36 +6187,15 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) "mips_dump_tdep: ATTACH_DETACH # %s\n", XSTRING (ATTACH_DETACH)); fprintf_unfiltered (file, - "mips_dump_tdep: BADVADDR_REGNUM = %d\n", - BADVADDR_REGNUM); - fprintf_unfiltered (file, - "mips_dump_tdep: CAUSE_REGNUM = %d\n", - CAUSE_REGNUM); - fprintf_unfiltered (file, "mips_dump_tdep: DWARF_REG_TO_REGNUM # %s\n", XSTRING (DWARF_REG_TO_REGNUM (REGNUM))); fprintf_unfiltered (file, "mips_dump_tdep: ECOFF_REG_TO_REGNUM # %s\n", XSTRING (ECOFF_REG_TO_REGNUM (REGNUM))); fprintf_unfiltered (file, - "mips_dump_tdep: FCRCS_REGNUM = %d\n", - FCRCS_REGNUM); - fprintf_unfiltered (file, - "mips_dump_tdep: FCRIR_REGNUM = %d\n", - FCRIR_REGNUM); - fprintf_unfiltered (file, "mips_dump_tdep: FIRST_EMBED_REGNUM = %d\n", FIRST_EMBED_REGNUM); fprintf_unfiltered (file, - "mips_dump_tdep: FPA0_REGNUM = %d\n", - FPA0_REGNUM); - fprintf_unfiltered (file, - "mips_dump_tdep: GDB_TARGET_IS_MIPS64 = %d\n", - GDB_TARGET_IS_MIPS64); - fprintf_unfiltered (file, - "mips_dump_tdep: HI_REGNUM = %d\n", - HI_REGNUM); - fprintf_unfiltered (file, "mips_dump_tdep: IGNORE_HELPER_CALL # %s\n", XSTRING (IGNORE_HELPER_CALL (PC))); fprintf_unfiltered (file, @@ -6300,9 +6207,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "mips_dump_tdep: LAST_EMBED_REGNUM = %d\n", LAST_EMBED_REGNUM); - fprintf_unfiltered (file, - "mips_dump_tdep: LO_REGNUM = %d\n", - LO_REGNUM); #ifdef MACHINE_CPROC_FP_OFFSET fprintf_unfiltered (file, "mips_dump_tdep: MACHINE_CPROC_FP_OFFSET = %d\n", @@ -6336,15 +6240,9 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) "mips_dump_tdep: MIPS_NUMREGS = %d\n", MIPS_NUMREGS); fprintf_unfiltered (file, - "mips_dump_tdep: MIPS_REGISTER_NAMES = delete?\n"); - fprintf_unfiltered (file, "mips_dump_tdep: MIPS_SAVED_REGSIZE = %d\n", MIPS_SAVED_REGSIZE); fprintf_unfiltered (file, - "mips_dump_tdep: OP_LDFPR = used?\n"); - fprintf_unfiltered (file, - "mips_dump_tdep: OP_LDGPR = used?\n"); - fprintf_unfiltered (file, "mips_dump_tdep: PRID_REGNUM = %d\n", PRID_REGNUM); fprintf_unfiltered (file, @@ -6410,9 +6308,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) "mips_dump_tdep: SIGFRAME_REGSAVE_OFF = %d\n", SIGFRAME_REGSAVE_OFF); fprintf_unfiltered (file, - "mips_dump_tdep: SIGFRAME_REG_SIZE = %d\n", - SIGFRAME_REG_SIZE); - fprintf_unfiltered (file, "mips_dump_tdep: SKIP_TRAMPOLINE_CODE # %s\n", XSTRING (SKIP_TRAMPOLINE_CODE (PC))); fprintf_unfiltered (file, @@ -6614,16 +6509,18 @@ Show zeroing of upper 32 bits of 64-bit addresses.", /* Allow the user to control the size of 32 bit registers within the raw remote packet. */ - add_show_from_set (add_set_cmd ("remote-mips64-transfers-32bit-regs", - class_obscure, - var_boolean, - (char *)&mips64_transfers_32bit_regs_p, "\ -Set compatibility with MIPS targets that transfers 32 and 64 bit quantities.\n\ + add_setshow_cmd ("remote-mips64-transfers-32bit-regs", class_obscure, + var_boolean, &mips64_transfers_32bit_regs_p, "\ +Set compatibility with 64-bit MIPS targets that transfer 32-bit quantities.\n\ +Use \"on\" to enable backward compatibility with older MIPS 64 GDB+target\n\ +that would transfer 32 bits for some registers (e.g. SR, FSR) and\n\ +64 bits for others. Use \"off\" to disable compatibility mode", "\ +Show compatibility with 64-bit MIPS targets that transfer 32-bit quantities.\n\ Use \"on\" to enable backward compatibility with older MIPS 64 GDB+target\n\ that would transfer 32 bits for some registers (e.g. SR, FSR) and\n\ 64 bits for others. Use \"off\" to disable compatibility mode", - &setlist), - &showlist); + set_mips64_transfers_32bit_regs, NULL, + &setlist, &showlist); /* Debug this files internals. */ add_show_from_set (add_set_cmd ("mips", class_maintenance, var_zinteger, diff --git a/gdb/mips-tdep.h b/gdb/mips-tdep.h index 5d3aa85..7a00ffa 100644 --- a/gdb/mips-tdep.h +++ b/gdb/mips-tdep.h @@ -1,6 +1,6 @@ /* Target-dependent header for the MIPS architecture, for GDB, the GNU Debugger. - Copyright 2002 Free Software Foundation, Inc. + Copyright 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -43,4 +43,35 @@ enum mips_abi mips_abi (struct gdbarch *gdbarch); /* For wince :-(. */ extern CORE_ADDR mips_next_pc (CORE_ADDR pc); +/* Return the "MIPS" register size. Just a short cut to the BFD + architecture's word size. */ +extern int mips_regsize (struct gdbarch *gdbarch); + +/* Return the current index for various MIPS registers. */ +struct mips_regnum +{ + int pc; + int fp0; + int fp_implementation_revision; + int fp_control_status; + int badvaddr; /* Bad vaddr for addressing exception. */ + int cause; /* Describes last exception. */ + int hi; /* Multiply/divide temp. */ + int lo; /* ... */ +}; +extern const struct mips_regnum *mips_regnum (struct gdbarch *gdbarch); + +enum { + MIPS_EMBED_LO_REGNUM = 33, + MIPS_EMBED_HI_REGNUM = 34, + MIPS_EMBED_BADVADDR_REGNUM = 35, + MIPS_EMBED_CAUSE_REGNUM = 36, + MIPS_EMBED_PC_REGNUM = 37, + MIPS_EMBED_FP0_REGNUM = 38 +}; + +/* Defined in mips-tdep.c and used in remote-mips.c */ +extern void deprecated_mips_set_processor_regs_hack (void); + + #endif /* MIPS_TDEP_H */ diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c index 62ec8f3..01d8262 100644 --- a/gdb/mipsnbsd-tdep.c +++ b/gdb/mipsnbsd-tdep.c @@ -46,7 +46,7 @@ mipsnbsd_supply_reg (char *regs, int regno) if (CANNOT_FETCH_REGISTER (i)) supply_register (i, NULL); else - supply_register (i, regs + (i * MIPS_REGSIZE)); + supply_register (i, regs + (i * mips_regsize (current_gdbarch))); } } } @@ -58,7 +58,7 @@ mipsnbsd_fill_reg (char *regs, int regno) for (i = 0; i <= PC_REGNUM; i++) if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i)) - regcache_collect (i, regs + (i * MIPS_REGSIZE)); + regcache_collect (i, regs + (i * mips_regsize (current_gdbarch))); } void @@ -66,14 +66,16 @@ mipsnbsd_supply_fpreg (char *fpregs, int regno) { int i; - for (i = FP0_REGNUM; i <= FCRIR_REGNUM; i++) + for (i = FP0_REGNUM; + i <= mips_regnum (current_gdbarch)->fp_implementation_revision; + i++) { if (regno == i || regno == -1) { if (CANNOT_FETCH_REGISTER (i)) supply_register (i, NULL); else - supply_register (i, fpregs + ((i - FP0_REGNUM) * MIPS_REGSIZE)); + supply_register (i, fpregs + ((i - FP0_REGNUM) * mips_regsize (current_gdbarch))); } } } @@ -83,9 +85,10 @@ mipsnbsd_fill_fpreg (char *fpregs, int regno) { int i; - for (i = FP0_REGNUM; i <= FCRCS_REGNUM; i++) + for (i = FP0_REGNUM; i <= mips_regnum (current_gdbarch)->fp_control_status; + i++) if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i)) - regcache_collect (i, fpregs + ((i - FP0_REGNUM) * MIPS_REGSIZE)); + regcache_collect (i, fpregs + ((i - FP0_REGNUM) * mips_regsize (current_gdbarch))); } static void @@ -232,7 +235,7 @@ mipsnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) success. */ #define NBSD_MIPS_JB_PC (2 * 4) -#define NBSD_MIPS_JB_ELEMENT_SIZE MIPS_REGSIZE +#define NBSD_MIPS_JB_ELEMENT_SIZE mips_regsize (current_gdbarch) #define NBSD_MIPS_JB_OFFSET (NBSD_MIPS_JB_PC * \ NBSD_MIPS_JB_ELEMENT_SIZE) @@ -259,14 +262,14 @@ static int mipsnbsd_cannot_fetch_register (int regno) { return (regno == ZERO_REGNUM - || regno == FCRIR_REGNUM); + || regno == mips_regnum (current_gdbarch)->fp_implementation_revision); } static int mipsnbsd_cannot_store_register (int regno) { return (regno == ZERO_REGNUM - || regno == FCRIR_REGNUM); + || regno == mips_regnum (current_gdbarch)->fp_implementation_revision); } /* NetBSD/mips uses a slightly different link_map structure from the diff --git a/gdb/mipsnbsd-tdep.h b/gdb/mipsnbsd-tdep.h index 6e9f50e..0feca87 100644 --- a/gdb/mipsnbsd-tdep.h +++ b/gdb/mipsnbsd-tdep.h @@ -27,7 +27,7 @@ void mipsnbsd_fill_reg (char *, int); void mipsnbsd_supply_fpreg (char *, int); void mipsnbsd_fill_fpreg (char *, int); -#define SIZEOF_STRUCT_REG (38 * MIPS_REGSIZE) -#define SIZEOF_STRUCT_FPREG (33 * MIPS_REGSIZE) +#define SIZEOF_STRUCT_REG (38 * mips_regsize (current_gdbarch)) +#define SIZEOF_STRUCT_FPREG (33 * mips_regsize (current_gdbarch)) #endif /* MIPSNBSD_TDEP_H */ diff --git a/gdb/mipsread.c b/gdb/mipsread.c index 2ea18d7..a6506f2 100644 --- a/gdb/mipsread.c +++ b/gdb/mipsread.c @@ -197,19 +197,19 @@ alphacoff_locate_sections (bfd *ignore_abfd, asection *sectp, void *sip) si = (struct alphacoff_dynsecinfo *) sip; - if (STREQ (sectp->name, ".dynsym")) + if (DEPRECATED_STREQ (sectp->name, ".dynsym")) { si->sym_sect = sectp; } - else if (STREQ (sectp->name, ".dynstr")) + else if (DEPRECATED_STREQ (sectp->name, ".dynstr")) { si->str_sect = sectp; } - else if (STREQ (sectp->name, ".dynamic")) + else if (DEPRECATED_STREQ (sectp->name, ".dynamic")) { si->dyninfo_sect = sectp; } - else if (STREQ (sectp->name, ".got")) + else if (DEPRECATED_STREQ (sectp->name, ".got")) { si->got_sect = sectp; } diff --git a/gdb/mipsv4-nat.c b/gdb/mipsv4-nat.c index 686d256..3a3e732 100644 --- a/gdb/mipsv4-nat.c +++ b/gdb/mipsv4-nat.c @@ -53,14 +53,18 @@ supply_gregset (gregset_t *gregsetp) for (regi = 0; regi <= CXT_RA; regi++) supply_register (regi, (char *) (regp + regi)); - supply_register (PC_REGNUM, (char *) (regp + CXT_EPC)); - supply_register (HI_REGNUM, (char *) (regp + CXT_MDHI)); - supply_register (LO_REGNUM, (char *) (regp + CXT_MDLO)); - supply_register (CAUSE_REGNUM, (char *) (regp + CXT_CAUSE)); + supply_register (mips_regnum (current_gdbarch)->pc, + (char *) (regp + CXT_EPC)); + supply_register (mips_regnum (current_gdbarch)->hi, + (char *) (regp + CXT_MDHI)); + supply_register (mips_regnum (current_gdbarch)->lo, + (char *) (regp + CXT_MDLO)); + supply_register (mips_regnum (current_gdbarch)->cause, + (char *) (regp + CXT_CAUSE)); /* Fill inaccessible registers with zero. */ supply_register (PS_REGNUM, zerobuf); - supply_register (BADVADDR_REGNUM, zerobuf); + supply_register (mips_regnum (current_gdbarch)->badvaddr, zerobuf); supply_register (DEPRECATED_FP_REGNUM, zerobuf); supply_register (UNUSED_REGNUM, zerobuf); for (regi = FIRST_EMBED_REGNUM; regi <= LAST_EMBED_REGNUM; regi++) @@ -77,22 +81,22 @@ fill_gregset (gregset_t *gregsetp, int regno) if ((regno == -1) || (regno == regi)) *(regp + regi) = *(greg_t *) & deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)]; - if ((regno == -1) || (regno == PC_REGNUM)) - *(regp + CXT_EPC) = *(greg_t *) & deprecated_registers[DEPRECATED_REGISTER_BYTE (PC_REGNUM)]; + if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->pc)) + *(regp + CXT_EPC) = *(greg_t *) & deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->pc)]; - if ((regno == -1) || (regno == CAUSE_REGNUM)) - *(regp + CXT_CAUSE) = *(greg_t *) & deprecated_registers[DEPRECATED_REGISTER_BYTE (CAUSE_REGNUM)]; + if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->cause)) + *(regp + CXT_CAUSE) = *(greg_t *) & deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->cause)]; - if ((regno == -1) || (regno == HI_REGNUM)) - *(regp + CXT_MDHI) = *(greg_t *) & deprecated_registers[DEPRECATED_REGISTER_BYTE (HI_REGNUM)]; + if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->hi)) + *(regp + CXT_MDHI) = *(greg_t *) & deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->hi)]; - if ((regno == -1) || (regno == LO_REGNUM)) - *(regp + CXT_MDLO) = *(greg_t *) & deprecated_registers[DEPRECATED_REGISTER_BYTE (LO_REGNUM)]; + if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->lo)) + *(regp + CXT_MDLO) = *(greg_t *) & deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->lo)]; } /* * Now we do the same thing for floating-point registers. - * We don't bother to condition on FP0_REGNUM since any + * We don't bother to condition on FP0 regnum since any * reasonable MIPS configuration has an R3010 in it. * * Again, see the comments in m68k-tdep.c. @@ -106,13 +110,15 @@ supply_fpregset (fpregset_t *fpregsetp) memset (zerobuf, 0, MAX_REGISTER_SIZE); for (regi = 0; regi < 32; regi++) - supply_register (FP0_REGNUM + regi, + supply_register (mips_regnum (current_gdbarch)->fp0 + regi, (char *) &fpregsetp->fp_r.fp_regs[regi]); - supply_register (FCRCS_REGNUM, (char *) &fpregsetp->fp_csr); + supply_register (mips_regnum (current_gdbarch)->fp_control_status, + (char *) &fpregsetp->fp_csr); - /* FIXME: how can we supply FCRIR_REGNUM? The ABI doesn't tell us. */ - supply_register (FCRIR_REGNUM, zerobuf); + /* FIXME: how can we supply FCRIR? The ABI doesn't tell us. */ + supply_register (mips_regnum (current_gdbarch)->fp_implementation_revision, + zerobuf); } void @@ -121,18 +127,20 @@ fill_fpregset (fpregset_t *fpregsetp, int regno) int regi; char *from, *to; - for (regi = FP0_REGNUM; regi < FP0_REGNUM + 32; regi++) + for (regi = mips_regnum (current_gdbarch)->fp0; + regi < mips_regnum (current_gdbarch)->fp0 + 32; regi++) { if ((regno == -1) || (regno == regi)) { from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)]; - to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]); + to = (char *) &(fpregsetp->fp_r.fp_regs[regi - mips_regnum (current_gdbarch)->fp0]); memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regi)); } } - if ((regno == -1) || (regno == FCRCS_REGNUM)) - fpregsetp->fp_csr = *(unsigned *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (FCRCS_REGNUM)]; + if ((regno == -1) + || (regno == mips_regnum (current_gdbarch)->fp_control_status)) + fpregsetp->fp_csr = *(unsigned *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->fp_control_status)]; } diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 42c54fc..fdc3530 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -152,25 +152,16 @@ static struct frame_info *analyze_dummy_frame (CORE_ADDR, CORE_ADDR); static struct frame_info * analyze_dummy_frame (CORE_ADDR pc, CORE_ADDR frame) { - static struct frame_info *dummy = NULL; - if (dummy == NULL) - { - struct frame_extra_info *extra_info; - CORE_ADDR *saved_regs; - dummy = deprecated_frame_xmalloc (); - saved_regs = xmalloc (SIZEOF_FRAME_SAVED_REGS); - deprecated_set_frame_saved_regs_hack (dummy, saved_regs); - extra_info = XMALLOC (struct frame_extra_info); - deprecated_set_frame_extra_info_hack (dummy, extra_info); - } - deprecated_set_frame_next_hack (dummy, NULL); - deprecated_set_frame_prev_hack (dummy, NULL); + struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); + struct frame_info *dummy + = deprecated_frame_xmalloc_with_cleanup (SIZEOF_FRAME_SAVED_REGS, + sizeof (struct frame_extra_info)); deprecated_update_frame_pc_hack (dummy, pc); deprecated_update_frame_base_hack (dummy, frame); get_frame_extra_info (dummy)->status = 0; get_frame_extra_info (dummy)->stack_size = 0; - memset (deprecated_get_frame_saved_regs (dummy), '\000', SIZEOF_FRAME_SAVED_REGS); mn10300_analyze_prologue (dummy, pc); + do_cleanups (old_chain); return dummy; } diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y index 057833b..f1ba494 100644 --- a/gdb/objc-exp.y +++ b/gdb/objc-exp.y @@ -680,7 +680,7 @@ qualified_name: typebase COLONCOLON name error ("`%s' is not defined as an aggregate type.", TYPE_NAME (type)); - if (!STREQ (type_name_no_tag (type), $4.ptr)) + if (!DEPRECATED_STREQ (type_name_no_tag (type), $4.ptr)) error ("invalid destructor `%s::~%s'", type_name_no_tag (type), $4.ptr); @@ -1266,7 +1266,7 @@ yylex () tokstart = lexptr; /* See if it is a special token of length 3. */ for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) - if (STREQN (tokstart, tokentab3[i].operator, 3)) + if (DEPRECATED_STREQN (tokstart, tokentab3[i].operator, 3)) { lexptr += 3; yylval.opcode = tokentab3[i].opcode; @@ -1275,7 +1275,7 @@ yylex () /* See if it is a special token of length 2. */ for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) - if (STREQN (tokstart, tokentab2[i].operator, 2)) + if (DEPRECATED_STREQN (tokstart, tokentab2[i].operator, 2)) { lexptr += 2; yylval.opcode = tokentab2[i].opcode; @@ -1590,43 +1590,43 @@ yylex () switch (namelen) { case 8: - if (STREQN (tokstart, "unsigned", 8)) + if (DEPRECATED_STREQN (tokstart, "unsigned", 8)) return UNSIGNED; if (current_language->la_language == language_cplus && strncmp (tokstart, "template", 8) == 0) return TEMPLATE; - if (STREQN (tokstart, "volatile", 8)) + if (DEPRECATED_STREQN (tokstart, "volatile", 8)) return VOLATILE_KEYWORD; break; case 6: - if (STREQN (tokstart, "struct", 6)) + if (DEPRECATED_STREQN (tokstart, "struct", 6)) return STRUCT; - if (STREQN (tokstart, "signed", 6)) + if (DEPRECATED_STREQN (tokstart, "signed", 6)) return SIGNED_KEYWORD; - if (STREQN (tokstart, "sizeof", 6)) + if (DEPRECATED_STREQN (tokstart, "sizeof", 6)) return SIZEOF; - if (STREQN (tokstart, "double", 6)) + if (DEPRECATED_STREQN (tokstart, "double", 6)) return DOUBLE_KEYWORD; break; case 5: if ((current_language->la_language == language_cplus) && strncmp (tokstart, "class", 5) == 0) return CLASS; - if (STREQN (tokstart, "union", 5)) + if (DEPRECATED_STREQN (tokstart, "union", 5)) return UNION; - if (STREQN (tokstart, "short", 5)) + if (DEPRECATED_STREQN (tokstart, "short", 5)) return SHORT; - if (STREQN (tokstart, "const", 5)) + if (DEPRECATED_STREQN (tokstart, "const", 5)) return CONST_KEYWORD; break; case 4: - if (STREQN (tokstart, "enum", 4)) + if (DEPRECATED_STREQN (tokstart, "enum", 4)) return ENUM; - if (STREQN (tokstart, "long", 4)) + if (DEPRECATED_STREQN (tokstart, "long", 4)) return LONG; break; case 3: - if (STREQN (tokstart, "int", 3)) + if (DEPRECATED_STREQN (tokstart, "int", 3)) return INT_KEYWORD; break; default: diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 0a5ed81..923d59b 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -386,6 +386,7 @@ terminate_minimal_symbol_table (struct objfile *objfile) DEPRECATED_SYMBOL_NAME (m) = NULL; SYMBOL_VALUE_ADDRESS (m) = 0; MSYMBOL_INFO (m) = NULL; + MSYMBOL_SIZE (m) = 0; MSYMBOL_TYPE (m) = mst_unknown; SYMBOL_INIT_LANGUAGE_SPECIFIC (m, language_unknown); } @@ -1103,7 +1104,7 @@ is_in_import_list (char *name, struct objfile *objfile) return 0; for (i = 0; i < objfile->import_list_size; i++) - if (objfile->import_list[i] && STREQ (name, objfile->import_list[i])) + if (objfile->import_list[i] && DEPRECATED_STREQ (name, objfile->import_list[i])) return 1; return 0; } diff --git a/gdb/observer.c b/gdb/observer.c index 6815d0f..fce5f92 100644 --- a/gdb/observer.c +++ b/gdb/observer.c @@ -191,30 +191,30 @@ observer_notify_normal_stop (void) generic_observer_notify (normal_stop_subject, NULL); } -/* The following code is only used to unit-test the observers from - our testsuite. DO NOT USE IT within observer.c! */ +/* The following code is only used to unit-test the observers from our + testsuite. DO NOT USE IT within observer.c (or anywhere else for + that matter)! */ -/* Since this code will not be used within GDB, it will trigger - a warning if we decide to compile with -Wunused-function. - This is ok for now. (brobecker 2003-03-18) */ +/* If we define these variables and functions as `static', the + compiler will optimize them out. */ -static int observer_test_first_observer = 0; -static int observer_test_second_observer = 0; -static int observer_test_third_observer = 0; +int observer_test_first_observer = 0; +int observer_test_second_observer = 0; +int observer_test_third_observer = 0; -static void +void observer_test_first_notification_function (void) { observer_test_first_observer++; } -static void +void observer_test_second_notification_function (void) { observer_test_second_observer++; } -static void +void observer_test_third_notification_function (void) { observer_test_third_observer++; diff --git a/gdb/osabi.c b/gdb/osabi.c index ee13277..4c94c5e 100644 --- a/gdb/osabi.c +++ b/gdb/osabi.c @@ -347,11 +347,11 @@ gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch) } } - warning ("A handler for the OS ABI \"%s\" is not built into this " - "configuration of GDB. " - "Attempting to continue with the default %s settings", - gdbarch_osabi_name (info.osabi), - info.bfd_arch_info->printable_name); + warning + ("A handler for the OS ABI \"%s\" is not built into this configuration\n" + "of GDB. Attempting to continue with the default %s settings.\n", + gdbarch_osabi_name (info.osabi), + info.bfd_arch_info->printable_name); } @@ -462,6 +462,13 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, void *obj) } return; } + + /* .note.netbsdcore.procinfo notes, used by NetBSD. */ + if (strcmp (name, ".note.netbsdcore.procinfo") == 0 && sectsize > 0) + { + *os_ident_ptr = GDB_OSABI_NETBSD_ELF; + return; + } } static enum gdb_osabi @@ -593,8 +600,6 @@ _initialize_gdb_osabi (void) bfd_target_elf_flavour, generic_elf_osabi_sniffer); - return; - /* Register the "set osabi" command. */ c = add_set_enum_cmd ("osabi", class_support, gdb_osabi_available_names, &set_osabi_string, "Set OS ABI of target.", &setlist); diff --git a/gdb/p-exp.y b/gdb/p-exp.y index b03241f..287f682 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -1370,29 +1370,29 @@ yylex () switch (namelen) { case 6: - if (STREQ (uptokstart, "OBJECT")) + if (DEPRECATED_STREQ (uptokstart, "OBJECT")) return CLASS; - if (STREQ (uptokstart, "RECORD")) + if (DEPRECATED_STREQ (uptokstart, "RECORD")) return STRUCT; - if (STREQ (uptokstart, "SIZEOF")) + if (DEPRECATED_STREQ (uptokstart, "SIZEOF")) return SIZEOF; break; case 5: - if (STREQ (uptokstart, "CLASS")) + if (DEPRECATED_STREQ (uptokstart, "CLASS")) return CLASS; - if (STREQ (uptokstart, "FALSE")) + if (DEPRECATED_STREQ (uptokstart, "FALSE")) { yylval.lval = 0; return FALSEKEYWORD; } break; case 4: - if (STREQ (uptokstart, "TRUE")) + if (DEPRECATED_STREQ (uptokstart, "TRUE")) { yylval.lval = 1; return TRUEKEYWORD; } - if (STREQ (uptokstart, "SELF")) + if (DEPRECATED_STREQ (uptokstart, "SELF")) { /* here we search for 'this' like inserted in FPC stabs debug info */ diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index 085a6cf..0eb371a 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -140,8 +140,8 @@ void pascal_type_print_method_args (char *physname, const char *methodname, struct ui_file *stream) { - int is_constructor = STREQN (physname, "__ct__", 6); - int is_destructor = STREQN (physname, "__dt__", 6); + int is_constructor = DEPRECATED_STREQN (physname, "__ct__", 6); + int is_destructor = DEPRECATED_STREQN (physname, "__dt__", 6); if (is_constructor || is_destructor) { @@ -560,7 +560,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, { QUIT; /* Don't print out virtual function table. */ - if (STREQN (TYPE_FIELD_NAME (type, i), "_vptr", 5) + if (DEPRECATED_STREQN (TYPE_FIELD_NAME (type, i), "_vptr", 5) && is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5])) continue; @@ -638,8 +638,8 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, { char *physname = TYPE_FN_FIELD_PHYSNAME (f, j); - int is_constructor = STREQN (physname, "__ct__", 6); - int is_destructor = STREQN (physname, "__dt__", 6); + int is_constructor = DEPRECATED_STREQN (physname, "__ct__", 6); + int is_destructor = DEPRECATED_STREQN (physname, "__dt__", 6); QUIT; if (TYPE_FN_FIELD_PROTECTED (f, j)) diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index c45a167..e565f09 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -650,7 +650,7 @@ pascal_object_print_class_method (char *valaddr, struct type *type, check_stub_method_group (domain, i); for (j = 0; j < len2; j++) { - if (STREQ (DEPRECATED_SYMBOL_NAME (sym), TYPE_FN_FIELD_PHYSNAME (f, j))) + if (DEPRECATED_STREQ (DEPRECATED_SYMBOL_NAME (sym), TYPE_FN_FIELD_PHYSNAME (f, j))) goto common; } } diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 8227aa8..372ad0c 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -127,7 +127,9 @@ ppc_register_u_addr (int regno) { int u_addr = -1; struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - int wordsize = tdep->wordsize; + /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace + interface, and not the wordsize of the program's ABI. */ + int wordsize = sizeof (PTRACE_XFER_TYPE); /* General purpose registers occupy 1 slot each in the buffer */ if (regno >= tdep->ppc_gp0_regnum && regno <= tdep->ppc_gplast_regnum ) @@ -235,6 +237,9 @@ fetch_register (int tid, int regno) return; } + /* Read the raw register using PTRACE_XFER_TYPE sized chunks. On a + 32-bit platform, 64-bit floating-point registers will require two + transfers. */ for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) { errno = 0; @@ -248,7 +253,19 @@ fetch_register (int tid, int regno) perror_with_name (mess); } } - supply_register (regno, buf); + + /* Now supply the register. Be careful to map between ptrace's and + the current_regcache's idea of the current wordsize. */ + if ((regno >= FP0_REGNUM && regno < FP0_REGNUM +32) + || gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) + /* FPs are always 64 bits. Little endian values are always found + at the left-hand end of the register. */ + regcache_raw_supply (current_regcache, regno, buf); + else + /* Big endian register, need to fetch the right-hand end. */ + regcache_raw_supply (current_regcache, regno, + (buf + sizeof (PTRACE_XFER_TYPE) + - register_size (current_gdbarch, regno))); } static void @@ -380,7 +397,21 @@ store_register (int tid, int regno) if (regaddr == -1) return; - regcache_collect (regno, buf); + /* First collect the register value from the regcache. Be careful + to to convert the regcache's wordsize into ptrace's wordsize. */ + memset (buf, 0, sizeof buf); + if ((regno >= FP0_REGNUM && regno < FP0_REGNUM + 32) + || TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + /* Floats are always 64-bit. Little endian registers are always + at the left-hand end of the register cache. */ + regcache_raw_collect (current_regcache, regno, buf); + else + /* Big-endian registers belong at the right-hand end of the + buffer. */ + regcache_raw_collect (current_regcache, regno, + (buf + sizeof (PTRACE_XFER_TYPE) + - register_size (current_gdbarch, regno))); + for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) { errno = 0; diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index c094efe..a0bb760 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -598,7 +598,8 @@ ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache) static enum return_value_convention ppc_linux_return_value (struct gdbarch *gdbarch, struct type *valtype, - struct regcache *regcache, const void *inval, void *outval) + struct regcache *regcache, void *readbuf, + const void *writebuf) { if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT || TYPE_CODE (valtype) == TYPE_CODE_UNION) @@ -606,7 +607,8 @@ ppc_linux_return_value (struct gdbarch *gdbarch, struct type *valtype, && TYPE_VECTOR (valtype))) return RETURN_VALUE_STRUCT_CONVENTION; else - return ppc_sysv_abi_return_value (gdbarch, valtype, regcache, inval, outval); + return ppc_sysv_abi_return_value (gdbarch, valtype, regcache, readbuf, + writebuf); } /* Fetch (and possibly build) an appropriate link_map_offsets @@ -1081,6 +1083,9 @@ ppc_linux_init_abi (struct gdbarch_info info, set_gdbarch_in_solib_call_trampoline (gdbarch, ppc64_in_solib_call_trampoline); set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code); + + /* PPC64 malloc's entry-point is called ".malloc". */ + set_gdbarch_name_of_malloc (gdbarch, ".malloc"); } } diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 01438c1..60cf986 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -29,6 +29,7 @@ #include "gdb_assert.h" #include "ppc-tdep.h" #include "target.h" +#include "objfiles.h" /* Pass the arguments in either registers, or in the stack. Using the ppc sysv ABI, the first eight words of the argument list (that might @@ -790,27 +791,38 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, ".FN" and "FN" in the minimal symbol table. "FN" points at the FN's descriptor, while ".FN" points at the entry point (which matches FUNC_ADDR). Need to reverse from FUNC_ADDR back to the - FN's descriptor address. */ + FN's descriptor address (while at the same time being careful to + find "FN" in the same object file as ".FN"). */ { /* Find the minimal symbol that corresponds to FUNC_ADDR (should have the name ".FN"). */ struct minimal_symbol *dot_fn = lookup_minimal_symbol_by_pc (func_addr); if (dot_fn != NULL && SYMBOL_LINKAGE_NAME (dot_fn)[0] == '.') { - /* Now find the corresponding "FN" (dropping ".") minimal - symbol's address. */ - struct minimal_symbol *fn = - lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (dot_fn) + 1, NULL, - NULL); - if (fn != NULL) + /* Get the section that contains FUNC_ADR. Need this for the + "objfile" that it contains. */ + struct obj_section *dot_fn_section = find_pc_section (func_addr); + if (dot_fn_section != NULL && dot_fn_section->objfile != NULL) { - /* Got the address of that descriptor. The TOC is the - second double word. */ - CORE_ADDR toc = - read_memory_unsigned_integer (SYMBOL_VALUE_ADDRESS (fn) + - tdep->wordsize, tdep->wordsize); - regcache_cooked_write_unsigned (regcache, - tdep->ppc_gp0_regnum + 2, toc); + /* Now find the corresponding "FN" (dropping ".") minimal + symbol's address. Only look for the minimal symbol in + ".FN"'s object file - avoids problems when two object + files (i.e., shared libraries) contain a minimal symbol + with the same name. */ + struct minimal_symbol *fn = + lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (dot_fn) + 1, NULL, + dot_fn_section->objfile); + if (fn != NULL) + { + /* Got the address of that descriptor. The TOC is the + second double word. */ + CORE_ADDR toc = + read_memory_unsigned_integer (SYMBOL_VALUE_ADDRESS (fn) + + tdep->wordsize, + tdep->wordsize); + regcache_cooked_write_unsigned (regcache, + tdep->ppc_gp0_regnum + 2, toc); + } } } } diff --git a/gdb/proc-api.c b/gdb/proc-api.c index 208b984..1e4a2dc 100644 --- a/gdb/proc-api.c +++ b/gdb/proc-api.c @@ -747,7 +747,7 @@ procfs_note (char *msg, char *file, int line) if (info_verbose) fprintf (procfs_file ? procfs_file : stdout, "%s:%d -- ", file, line); - fprintf (procfs_file ? procfs_file : stdout, msg); + fprintf (procfs_file ? procfs_file : stdout, "%s", msg); if (procfs_file) fflush (procfs_file); } diff --git a/gdb/procfs.c b/gdb/procfs.c index a92b849..72ad202 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -4163,7 +4163,7 @@ wait_again: wstat = (what << 8) | 0177; break; case PR_FAULTED: - switch (what) { /* FIXME: FAULTED_USE_SIGINFO */ + switch (what) { #ifdef FLTWATCH case FLTWATCH: wstat = (SIGTRAP << 8) | 0177; diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c index 10d7362..c422c94 100644 --- a/gdb/remote-e7000.c +++ b/gdb/remote-e7000.c @@ -657,10 +657,6 @@ e7000_open (char *args, int from_tty) } serial_raw (e7000_desc); -#ifdef GDB_TARGET_IS_H8300 - h8300hmode = 1; -#endif - /* Start the remote connection; if error (0), discard this target. In particular, if the user quits, be sure to discard it (we'd be in an inconsistent state otherwise). */ @@ -909,15 +905,18 @@ e7000_fetch_registers (void) wanted = want_sh3; } } -#ifdef GDB_TARGET_IS_H8300 if (TARGET_ARCHITECTURE->arch == bfd_arch_h8300) { - if (h8300smode) - wanted = want_h8300s; - else - wanted = want_h8300h; + wanted = want_h8300h; + switch (TARGET_ARCHITECTURE->mach) + { + case bfd_mach_h8300s: + case bfd_mach_h8300sn: + case bfd_mach_h8300sx: + case bfd_mach_h8300sxn: + wanted = want_h8300s; + } } -#endif fetch_regs_from_dump (gch, wanted); @@ -2046,15 +2045,18 @@ e7000_wait (ptid_t ptid, struct target_waitstatus *status) wanted_nopc = want_nopc_sh3; } } -#ifdef GDB_TARGET_IS_H8300 if (TARGET_ARCHITECTURE->arch == bfd_arch_h8300) { - if (h8300smode) - wanted_nopc = want_nopc_h8300s; - else - wanted_nopc = want_nopc_h8300h; + wanted_nopc = want_nopc_h8300h; + switch (TARGET_ARCHITECTURE->mach) + { + case bfd_mach_h8300s: + case bfd_mach_h8300sn: + case bfd_mach_h8300sx: + case bfd_mach_h8300sxn: + wanted_nopc = want_nopc_h8300s; + } } -#endif fetch_regs_from_dump (gch, wanted_nopc); /* And supply the extra ones the simulator uses */ diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 8512e444..71e2bef 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -36,6 +36,7 @@ #include "gdb_stat.h" #include "regcache.h" #include <ctype.h> +#include "mips-tdep.h" /* Breakpoint types. Values 0, 1, and 2 must agree with the watch @@ -1606,9 +1607,7 @@ device is attached to the target board (e.g., /dev/ttya).\n" /* FIXME: Should we call start_remote here? */ /* Try to figure out the processor model if possible. */ - ptype = mips_read_processor_type (); - if (ptype) - mips_set_processor_type_command (xstrdup (ptype), 0); + deprecated_mips_set_processor_regs_hack (); /* This is really the job of start_remote however, that makes an assumption that the target is about to print out a status message @@ -1902,26 +1901,24 @@ mips_map_regno (int regno) { if (regno < 32) return regno; - if (regno >= FP0_REGNUM && regno < FP0_REGNUM + 32) - return regno - FP0_REGNUM + 32; - switch (regno) - { - case PC_REGNUM: - return REGNO_OFFSET + 0; - case CAUSE_REGNUM: - return REGNO_OFFSET + 1; - case HI_REGNUM: - return REGNO_OFFSET + 2; - case LO_REGNUM: - return REGNO_OFFSET + 3; - case FCRCS_REGNUM: - return REGNO_OFFSET + 4; - case FCRIR_REGNUM: - return REGNO_OFFSET + 5; - default: - /* FIXME: Is there a way to get the status register? */ - return 0; - } + if (regno >= mips_regnum (current_gdbarch)->fp0 + && regno < mips_regnum (current_gdbarch)->fp0 + 32) + return regno - mips_regnum (current_gdbarch)->fp0 + 32; + else if (regno == mips_regnum (current_gdbarch)->pc) + return REGNO_OFFSET + 0; + else if (regno == mips_regnum (current_gdbarch)->cause) + return REGNO_OFFSET + 1; + else if (regno == mips_regnum (current_gdbarch)->hi) + return REGNO_OFFSET + 2; + else if (regno == mips_regnum (current_gdbarch)->lo) + return REGNO_OFFSET + 3; + else if (regno == mips_regnum (current_gdbarch)->fp_control_status) + return REGNO_OFFSET + 4; + else if (regno == mips_regnum (current_gdbarch)->fp_implementation_revision) + return REGNO_OFFSET + 5; + else + /* FIXME: Is there a way to get the status register? */ + return 0; } /* Fetch the remote registers. */ diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c index 6cbf73c..2db0a91 100644 --- a/gdb/remote-rdp.c +++ b/gdb/remote-rdp.c @@ -1,7 +1,7 @@ /* Remote debugging for the ARM RDP interface. - Copyright 1994, 1995, 1998, 1999, 2000, 2001, 2002 Free Software - Foundation, Inc. + Copyright 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003 Free + Software Foundation, Inc. This file is part of GDB. @@ -352,11 +352,29 @@ rdp_init (int cold, int tty) case SERIAL_TIMEOUT: break; case RDP_RES_VALUE_LITTLE_ENDIAN: +#if 0 + /* FIXME: cagney/2003-11-22: Ever since the ARM + was multi-arched (in 2002-02-08), this + assignment has had no effect. There needs to + be some sort of check/decision based on the + current architecture's byte-order vs the remote + target's byte order. For the moment disable + the assignment to keep things building. */ target_byte_order = BFD_ENDIAN_LITTLE; +#endif sync = 1; break; case RDP_RES_VALUE_BIG_ENDIAN: +#if 0 + /* FIXME: cagney/2003-11-22: Ever since the ARM + was multi-arched (in 2002-02-08), this + assignment has had no effect. There needs to + be some sort of check/decision based on the + current architecture's byte-order vs the remote + target's byte order. For the moment disable + the assignment to keep things building. */ target_byte_order = BFD_ENDIAN_BIG; +#endif sync = 1; break; default: diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 538f8a4..b1dc94e 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -42,6 +42,7 @@ #include "regcache.h" #include "gdb_assert.h" #include "sim-regno.h" +#include "arch-utils.h" /* Prototypes */ @@ -504,27 +505,23 @@ gdbsim_open (char *args, int from_tty) strcpy (arg_buf, "gdbsim"); /* 7 */ /* Specify the byte order for the target when it is both selectable and explicitly specified by the user (not auto detected). */ - if (!TARGET_BYTE_ORDER_AUTO) + switch (selected_byte_order ()) { - switch (TARGET_BYTE_ORDER) - { - case BFD_ENDIAN_BIG: - strcat (arg_buf, " -E big"); - break; - case BFD_ENDIAN_LITTLE: - strcat (arg_buf, " -E little"); - break; - default: - internal_error (__FILE__, __LINE__, - "Value of TARGET_BYTE_ORDER unknown"); - } + case BFD_ENDIAN_BIG: + strcat (arg_buf, " -E big"); + break; + case BFD_ENDIAN_LITTLE: + strcat (arg_buf, " -E little"); + break; + case BFD_ENDIAN_UNKNOWN: + break; } /* Specify the architecture of the target when it has been explicitly specified */ - if (!TARGET_ARCHITECTURE_AUTO) + if (selected_architecture_name () != NULL) { strcat (arg_buf, " --architecture="); - strcat (arg_buf, TARGET_ARCHITECTURE->printable_name); + strcat (arg_buf, selected_architecture_name ()); } /* finally, any explicit args */ if (args) diff --git a/gdb/remote-vxmips.c b/gdb/remote-vxmips.c index 6cc7ca5..55ba49b 100644 --- a/gdb/remote-vxmips.c +++ b/gdb/remote-vxmips.c @@ -111,11 +111,11 @@ vx_read_register (int regno) bcopy (&mips_greg_packet[MIPS_R_SR], &deprecated_registers[DEPRECATED_REGISTER_BYTE (PS_REGNUM)], MIPS_GREG_SIZE); bcopy (&mips_greg_packet[MIPS_R_LO], - &deprecated_registers[DEPRECATED_REGISTER_BYTE (LO_REGNUM)], MIPS_GREG_SIZE); + &deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->lo)], MIPS_GREG_SIZE); bcopy (&mips_greg_packet[MIPS_R_HI], - &deprecated_registers[DEPRECATED_REGISTER_BYTE (HI_REGNUM)], MIPS_GREG_SIZE); + &deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->hi)], MIPS_GREG_SIZE); bcopy (&mips_greg_packet[MIPS_R_PC], - &deprecated_registers[DEPRECATED_REGISTER_BYTE (PC_REGNUM)], MIPS_GREG_SIZE); + &deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->pc)], MIPS_GREG_SIZE); /* If the target has floating point registers, fetch them. Otherwise, zero the floating point register values in @@ -136,15 +136,15 @@ vx_read_register (int regno) /* Copy the floating point control/status register (fpcsr). */ bcopy (&mips_fpreg_packet[MIPS_R_FPCSR], - &deprecated_registers[DEPRECATED_REGISTER_BYTE (FCRCS_REGNUM)], - DEPRECATED_REGISTER_RAW_SIZE (FCRCS_REGNUM)); + &deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->fp_control_status)], + DEPRECATED_REGISTER_RAW_SIZE (mips_regnum (current_gdbarch)->fp_control_status)); } else { memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM)], 0, DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM) * 32); - memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FCRCS_REGNUM)], - 0, DEPRECATED_REGISTER_RAW_SIZE (FCRCS_REGNUM)); + memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->fp_control_status)], + 0, DEPRECATED_REGISTER_RAW_SIZE (mips_regnum (current_gdbarch)->fp_control_status)); } /* Mark the register cache valid. */ @@ -170,11 +170,11 @@ vx_write_register (int regno) bcopy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (PS_REGNUM)], &mips_greg_packet[MIPS_R_SR], MIPS_GREG_SIZE); - bcopy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (LO_REGNUM)], + bcopy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->lo)], &mips_greg_packet[MIPS_R_LO], MIPS_GREG_SIZE); - bcopy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (HI_REGNUM)], + bcopy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->hi)], &mips_greg_packet[MIPS_R_HI], MIPS_GREG_SIZE); - bcopy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (PC_REGNUM)], + bcopy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->pc)], &mips_greg_packet[MIPS_R_PC], MIPS_GREG_SIZE); net_write_registers (mips_greg_packet, MIPS_GREG_PLEN, PTRACE_SETREGS); @@ -191,9 +191,9 @@ vx_write_register (int regno) /* Copy the floating point control/status register (fpcsr). */ - bcopy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FCRCS_REGNUM)], + bcopy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->fp_control_status)], &mips_fpreg_packet[MIPS_R_FPCSR], - DEPRECATED_REGISTER_RAW_SIZE (FCRCS_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (mips_regnum (current_gdbarch)->fp_control_status)); net_write_registers (mips_fpreg_packet, MIPS_FPREG_PLEN, PTRACE_SETFPREGS); diff --git a/gdb/remote.c b/gdb/remote.c index 80726bc..29ab011 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2302,7 +2302,12 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, { if (serial_setbaudrate (remote_desc, baud_rate)) { + /* The requested speed could not be set. Error out to + top level after closing remote_desc. Take care to + set remote_desc to NULL to avoid closing remote_desc + more than once. */ serial_close (remote_desc); + remote_desc = NULL; perror_with_name (name); } } @@ -3561,9 +3566,23 @@ remote_fetch_registers (int regnum) struct packet_reg *r = &rs->regs[i]; if (r->in_g_packet) { - supply_register (r->regnum, regs + r->offset); - if (buf[r->offset * 2] == 'x') - set_register_cached (i, -1); + if (r->offset * 2 >= strlen (buf)) + /* A short packet that didn't include the register's + value, this implies that the register is zero (and + not that the register is unavailable). Supply that + zero value. */ + regcache_raw_supply (current_regcache, r->regnum, NULL); + else if (buf[r->offset * 2] == 'x') + { + gdb_assert (r->offset * 2 < strlen (buf)); + /* The register isn't available, mark it as such (at + the same time setting the value to zero). */ + regcache_raw_supply (current_regcache, r->regnum, NULL); + set_register_cached (i, -1); + } + else + regcache_raw_supply (current_regcache, r->regnum, + regs + r->offset); } } } @@ -5555,7 +5574,12 @@ remote_cisco_open (char *name, int from_tty) baud_rate = (baud_rate > 0) ? baud_rate : 9600; if (serial_setbaudrate (remote_desc, baud_rate)) { + /* The requested speed could not be set. Error out to + top level after closing remote_desc. Take care to + set remote_desc to NULL to avoid closing remote_desc + more than once. */ serial_close (remote_desc); + remote_desc = NULL; perror_with_name (name); } diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 6f96c17..7878984 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -759,7 +759,7 @@ add_vmap (LdInfo *ldi) last = 0; /* FIXME??? am I tossing BFDs? bfd? */ while ((last = bfd_openr_next_archived_file (abfd, last))) - if (STREQ (mem, last->filename)) + if (DEPRECATED_STREQ (mem, last->filename)) break; if (!last) @@ -843,8 +843,8 @@ vmap_ldinfo (LdInfo *ldi) /* The filenames are not always sufficient to match on. */ - if ((name[0] == '/' && !STREQ (name, vp->name)) - || (memb[0] && !STREQ (memb, vp->member))) + if ((name[0] == '/' && !DEPRECATED_STREQ (name, vp->name)) + || (memb[0] && !DEPRECATED_STREQ (memb, vp->member))) continue; /* See if we are referring to the same file. @@ -941,17 +941,17 @@ vmap_exec (void) for (i = 0; &exec_ops.to_sections[i] < exec_ops.to_sections_end; i++) { - if (STREQ (".text", exec_ops.to_sections[i].the_bfd_section->name)) + if (DEPRECATED_STREQ (".text", exec_ops.to_sections[i].the_bfd_section->name)) { exec_ops.to_sections[i].addr += vmap->tstart - vmap->tvma; exec_ops.to_sections[i].endaddr += vmap->tstart - vmap->tvma; } - else if (STREQ (".data", exec_ops.to_sections[i].the_bfd_section->name)) + else if (DEPRECATED_STREQ (".data", exec_ops.to_sections[i].the_bfd_section->name)) { exec_ops.to_sections[i].addr += vmap->dstart - vmap->dvma; exec_ops.to_sections[i].endaddr += vmap->dstart - vmap->dvma; } - else if (STREQ (".bss", exec_ops.to_sections[i].the_bfd_section->name)) + else if (DEPRECATED_STREQ (".bss", exec_ops.to_sections[i].the_bfd_section->name)) { exec_ops.to_sections[i].addr += vmap->dstart - vmap->dvma; exec_ops.to_sections[i].endaddr += vmap->dstart - vmap->dvma; diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index ca87b8e..ac080ac 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -49,7 +49,7 @@ /* registers numbers shared with the simulator */ #include "gdb/sim-sh.h" -/* Information that is dependent on the processor variant. */ +/* Information that is dependent on the processor variant. */ enum sh_abi { SH_ABI_UNKNOWN, @@ -78,7 +78,7 @@ enum /* FPP stands for Floating Point Pair, to avoid confusion with GDB's FP0_REGNUM, which is the number of the first Floating point register. Unfortunately on the sh5, the floating point - registers are called FR, and the floating point pairs are called FP. */ + registers are called FR, and the floating point pairs are called FP. */ FPP0_REGNUM = 173, FPP_LAST_REGNUM = 204, FV0_REGNUM = 205, @@ -119,7 +119,7 @@ struct frame_extra_info }; static const char * -sh_sh64_register_name (int reg_nr) +sh64_register_name (int reg_nr) { static char *register_names[] = { @@ -197,17 +197,13 @@ sh_sh64_register_name (int reg_nr) /* Macros and functions for setting and testing a bit in a minimal symbol that marks it as 32-bit function. The MSB of the minimal - symbol's "info" field is used for this purpose. This field is - already being used to store the symbol size, so the assumption is - that the symbol size cannot exceed 2^31. + symbol's "info" field is used for this purpose. ELF_MAKE_MSYMBOL_SPECIAL tests whether an ELF symbol is "special", i.e. refers to a 32-bit function, and sets a "special" bit in a minimal symbol to mark it as a 32-bit function - MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol - MSYMBOL_SIZE returns the size of the minimal symbol, i.e. - the "info" field with the "special" bit masked out */ + MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol */ #define MSYMBOL_IS_SPECIAL(msym) \ (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0) @@ -237,7 +233,7 @@ pc_is_isa32 (bfd_vma memaddr) struct minimal_symbol *sym; /* If bit 0 of the address is set, assume this is a - ISA32 (shmedia) address. */ + ISA32 (shmedia) address. */ if (IS_ISA32_ADDR (memaddr)) return 1; @@ -252,7 +248,7 @@ pc_is_isa32 (bfd_vma memaddr) } static const unsigned char * -sh_sh64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) +sh64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) { /* The BRK instruction for shmedia is 01101111 11110101 11111111 11110000 @@ -396,14 +392,14 @@ sh_sh64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) #define IS_MOV_R14_R0(x) ((x) == 0x20e6) /* ADD Rm,R63,Rn Rm+R63-->Rn 0000 00mm mmmm 1001 1111 11nn nnnn 0000 - where Rm is one of r2-r9 which are the argument registers. */ + where Rm is one of r2-r9 which are the argument registers. */ /* FIXME: Recognize the float and double register moves too! */ #define IS_MEDIA_IND_ARG_MOV(x) \ ((((x) & 0xfc0ffc0f) == 0x0009fc00) && (((x) & 0x03f00000) >= 0x00200000 && ((x) & 0x03f00000) <= 0x00900000)) /* ST.Q Rn,0,Rm Rm-->Rn+0 1010 11nn nnnn 0000 0000 00mm mmmm 0000 or ST.L Rn,0,Rm Rm-->Rn+0 1010 10nn nnnn 0000 0000 00mm mmmm 0000 - where Rm is one of r2-r9 which are the argument registers. */ + where Rm is one of r2-r9 which are the argument registers. */ #define IS_MEDIA_ARG_MOV(x) \ (((((x) & 0xfc0ffc0f) == 0xac000000) || (((x) & 0xfc0ffc0f) == 0xa8000000)) \ && (((x) & 0x000003f0) >= 0x00000020 && ((x) & 0x000003f0) <= 0x00000090)) @@ -449,8 +445,8 @@ sh_sh64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) /* Skip any prologue before the guts of a function */ -/* Skip the prologue using the debug information. If this fails we'll - fall back on the 'guess' method below. */ +/* Skip the prologue using the debug information. If this fails we'll + fall back on the 'guess' method below. */ static CORE_ADDR after_prologue (CORE_ADDR pc) { @@ -494,7 +490,7 @@ look_for_args_moves (CORE_ADDR start_pc, int media_mode) { /* This must be followed by a store to r14, so the argument is where the debug info says it is. This can happen after - the SP has been saved, unfortunately. */ + the SP has been saved, unfortunately. */ int next_insn = read_memory_integer (UNMAKE_ISA32_ADDR (here), insn_size); @@ -504,7 +500,7 @@ look_for_args_moves (CORE_ADDR start_pc, int media_mode) } else if (IS_MEDIA_ARG_MOV (w)) { - /* These instructions store directly the argument in r14. */ + /* These instructions store directly the argument in r14. */ start_pc = here; } else @@ -519,7 +515,7 @@ look_for_args_moves (CORE_ADDR start_pc, int media_mode) { /* This must be followed by a store to r14, so the argument is where the debug info says it is. This can happen after - the SP has been saved, unfortunately. */ + the SP has been saved, unfortunately. */ int next_insn = 0xffff & read_memory_integer (here, insn_size); here += insn_size; @@ -528,7 +524,7 @@ look_for_args_moves (CORE_ADDR start_pc, int media_mode) } else if (IS_COMPACT_ARG_MOV (w)) { - /* These instructions store directly the argument in r14. */ + /* These instructions store directly the argument in r14. */ start_pc = here; } else if (IS_MOVL_R0 (w)) @@ -549,7 +545,7 @@ look_for_args_moves (CORE_ADDR start_pc, int media_mode) stack slot in the register. GCC thinks the argument is just passed by transparent reference, but this is only true after the argument decoder is called. Such a call - needs to be considered part of the prologue. */ + needs to be considered part of the prologue. */ /* This must be followed by a JSR @r0 instruction and by a NOP instruction. After these, the prologue is over! */ @@ -613,7 +609,7 @@ sh64_skip_prologue_hard_way (CORE_ADDR start_pc) { /* Don't bail out yet, we may have arguments stored in registers here, according to the debug info, so that - gdb can print the frames correctly. */ + gdb can print the frames correctly. */ start_pc = look_for_args_moves (here - insn_size, media_mode); break; } @@ -639,7 +635,7 @@ sh64_skip_prologue_hard_way (CORE_ADDR start_pc) { /* Don't bail out yet, we may have arguments stored in registers here, according to the debug info, so that - gdb can print the frames correctly. */ + gdb can print the frames correctly. */ start_pc = look_for_args_moves (here - insn_size, media_mode); break; } @@ -660,7 +656,7 @@ sh_skip_prologue (CORE_ADDR pc) post_prologue_pc = after_prologue (pc); /* If after_prologue returned a useful address, then use it. Else - fall back on the instruction skipping code. */ + fall back on the instruction skipping code. */ if (post_prologue_pc != 0) return max (pc, post_prologue_pc); else @@ -706,20 +702,18 @@ gdb_print_insn_sh (bfd_vma memaddr, disassemble_info *info) /* Given a register number RN as it appears in an assembly instruction, find the corresponding register number in the GDB - scheme. */ + scheme. */ static int translate_insn_rn (int rn, int media_mode) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - /* FIXME: this assumes that the number rn is for a not pseudo - register only. */ + register only. */ if (media_mode) return rn; else { - /* These registers don't have a corresponding compact one. */ - /* FIXME: This is probably not enough. */ + /* These registers don't have a corresponding compact one. */ + /* FIXME: This is probably not enough. */ #if 0 if ((rn >= 16 && rn <= 63) || (rn >= 93 && rn <= 140)) return rn; @@ -744,7 +738,7 @@ sh64_frame_chain (struct frame_info *frame) if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), get_frame_base (frame), get_frame_base (frame))) - return get_frame_base (frame); /* dummy frame same as caller's frame */ + return get_frame_base (frame); /* dummy frame same as caller's frame */ if (get_frame_pc (frame) && !deprecated_inside_entry_file (get_frame_pc (frame))) { @@ -753,7 +747,9 @@ sh64_frame_chain (struct frame_info *frame) if (gdbarch_tdep (current_gdbarch)->sh_abi == SH_ABI_32) size = 4; else - size = DEPRECATED_REGISTER_RAW_SIZE (translate_insn_rn (DEPRECATED_FP_REGNUM, media_mode)); + size = register_size (current_gdbarch, + translate_insn_rn (DEPRECATED_FP_REGNUM, + media_mode)); return read_memory_integer (get_frame_base (frame) + get_frame_extra_info (frame)->f_offset, size); @@ -770,8 +766,9 @@ sh64_get_saved_pr (struct frame_info *fi, int pr_regnum) for (; fi; fi = get_next_frame (fi)) if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), get_frame_base (fi))) - /* When the caller requests PR from the dummy frame, we return PC because - that's where the previous routine appears to have done a call from. */ + /* When the caller requests PR from the dummy frame, we return + PC because that's where the previous routine appears to have + done a call from. */ return deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), pr_regnum); else @@ -787,14 +784,14 @@ sh64_get_saved_pr (struct frame_info *fi, int pr_regnum) int gdb_reg_num = translate_insn_rn (pr_regnum, media_mode); int size = ((gdbarch_tdep (current_gdbarch)->sh_abi == SH_ABI_32) ? 4 - : DEPRECATED_REGISTER_RAW_SIZE (gdb_reg_num)); + : register_size (current_gdbarch, gdb_reg_num)); return read_memory_integer (deprecated_get_frame_saved_regs (fi)[pr_regnum], size); } } return read_register (pr_regnum); } -/* For vectors of 4 floating point registers. */ +/* For vectors of 4 floating point registers. */ static int fv_reg_base_num (int fv_regnum) { @@ -830,10 +827,7 @@ fpp_reg_base_num (int fpp_regnum) static int is_media_pseudo (int rn) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - - return (rn >= DR0_REGNUM - && rn <= FV_LAST_REGNUM); + return (rn >= DR0_REGNUM && rn <= FV_LAST_REGNUM); } static int @@ -846,7 +840,6 @@ static int sh64_media_reg_base_num (int reg_nr) { int base_regnum = -1; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM) @@ -929,7 +922,6 @@ static int sh64_compact_reg_base_num (int reg_nr) { int base_regnum = -1; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); /* general register N maps to general register N */ if (reg_nr >= R0_C_REGNUM @@ -970,7 +962,7 @@ sh64_compact_reg_base_num (int reg_nr) base_regnum = 19; else if (reg_nr == FPSCR_C_REGNUM) - base_regnum = FPSCR_REGNUM; /*???? this register is a mess. */ + base_regnum = FPSCR_REGNUM; /*???? this register is a mess. */ else if (reg_nr == FPUL_C_REGNUM) base_regnum = FP0_REGNUM + 32; @@ -981,7 +973,7 @@ sh64_compact_reg_base_num (int reg_nr) /* Given a register number RN (according to the gdb scheme) , return its corresponding architectural register. In media mode, only a subset of the registers is pseudo registers. For compact mode, all - the registers are pseudo. */ + the registers are pseudo. */ static int translate_rn_to_arch_reg_num (int rn, int media_mode) { @@ -994,7 +986,7 @@ translate_rn_to_arch_reg_num (int rn, int media_mode) return sh64_media_reg_base_num (rn); } else - /* All compact registers are pseudo. */ + /* All compact registers are pseudo. */ return sh64_compact_reg_base_num (rn); } @@ -1024,8 +1016,9 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) int insn_size; int gdb_register_number; int register_number; - char *dummy_regs = deprecated_generic_find_dummy_frame (get_frame_pc (fi), get_frame_base (fi)); - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + char *dummy_regs = deprecated_generic_find_dummy_frame (get_frame_pc (fi), + get_frame_base (fi)); + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); if (deprecated_get_frame_saved_regs (fi) == NULL) frame_saved_regs_zalloc (fi); @@ -1051,7 +1044,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) /* Loop around examining the prologue insns until we find something that does not appear to be part of the prologue. But give up - after 20 of them, since we're getting silly then. */ + after 20 of them, since we're getting silly then. */ pc = get_frame_func (fi); if (!pc) @@ -1073,7 +1066,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) /* The frame pointer register is general register 14 in shmedia and shcompact modes. In sh compact it is a pseudo register. Same goes - for the stack pointer register, which is register 15. */ + for the stack pointer register, which is register 15. */ fp_regnum = translate_insn_rn (DEPRECATED_FP_REGNUM, media_mode); sp_regnum = translate_insn_rn (SP_REGNUM, media_mode); @@ -1112,7 +1105,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) else if (IS_ADD_SP_R0 (insn)) { /* This instruction still prepares r0, but we don't care. - We already have the offset in r0_val. */ + We already have the offset in r0_val. */ } else if (IS_STS_R0 (insn)) { @@ -1173,7 +1166,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) } } - /* Now we know how deep things are, we can work out their addresses. */ + /* Now we know how deep things are, we can work out their addresses. */ for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++) { register_number = translate_rn_to_arch_reg_num (rn, media_mode); @@ -1184,34 +1177,36 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) have_fp = 1; /* Watch out! saved_regs is only for the real registers, and - doesn't include space for the pseudo registers. */ - deprecated_get_frame_saved_regs (fi)[register_number]= get_frame_base (fi) - where[rn] + depth; - + doesn't include space for the pseudo registers. */ + deprecated_get_frame_saved_regs (fi)[register_number] + = get_frame_base (fi) - where[rn] + depth; } else - deprecated_get_frame_saved_regs (fi)[register_number] = 0; + deprecated_get_frame_saved_regs (fi)[register_number] = 0; } if (have_fp) { /* SP_REGNUM is 15. For shmedia 15 is the real register. For shcompact 15 is the arch register corresponding to the pseudo - register r15 which still is the SP register. */ + register r15 which still is the SP register. */ /* The place on the stack where fp is stored contains the sp of - the caller. */ + the caller. */ /* Again, saved_registers contains only space for the real registers, so we store in DEPRECATED_FP_REGNUM position. */ int size; if (tdep->sh_abi == SH_ABI_32) size = 4; else - size = DEPRECATED_REGISTER_RAW_SIZE (fp_regnum); - deprecated_get_frame_saved_regs (fi)[sp_regnum] = read_memory_integer (deprecated_get_frame_saved_regs (fi)[fp_regnum], size); + size = register_size (current_gdbarch, fp_regnum); + deprecated_get_frame_saved_regs (fi)[sp_regnum] + = read_memory_integer (deprecated_get_frame_saved_regs (fi)[fp_regnum], + size); } else deprecated_get_frame_saved_regs (fi)[sp_regnum] = get_frame_base (fi); - get_frame_extra_info (fi)->f_offset = depth - where[fp_regnum]; + get_frame_extra_info (fi)->f_offset = depth - where[fp_regnum]; } /* Initialize the extra info saved in a FRAME */ @@ -1253,7 +1248,7 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, { int media_mode; int live_regnum = regnum; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); if (!target_has_registers) error ("No registers."); @@ -1293,7 +1288,7 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, memcpy (raw_buffer, (deprecated_generic_find_dummy_frame (get_frame_pc (frame), get_frame_base (frame)) + DEPRECATED_REGISTER_BYTE (regnum)), - DEPRECATED_REGISTER_RAW_SIZE (regnum)); + register_size (current_gdbarch, regnum)); return; } @@ -1306,7 +1301,9 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, if (regnum == SP_REGNUM) { if (raw_buffer) /* SP register treated specially */ - store_unsigned_integer (raw_buffer, DEPRECATED_REGISTER_RAW_SIZE (regnum), + store_unsigned_integer (raw_buffer, + register_size (current_gdbarch, + regnum), deprecated_get_frame_saved_regs (frame)[regnum]); } else @@ -1322,13 +1319,14 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, || live_regnum == PR_REGNUM)) size = 4; else - size = DEPRECATED_REGISTER_RAW_SIZE (live_regnum); + size = register_size (current_gdbarch, live_regnum); if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) - read_memory (deprecated_get_frame_saved_regs (frame)[regnum], raw_buffer, size); + read_memory (deprecated_get_frame_saved_regs (frame)[regnum], + raw_buffer, size); else read_memory (deprecated_get_frame_saved_regs (frame)[regnum], raw_buffer - + DEPRECATED_REGISTER_RAW_SIZE (live_regnum) + + register_size (current_gdbarch, live_regnum) - size, size); } @@ -1352,7 +1350,8 @@ static CORE_ADDR sh64_extract_struct_value_address (char *regbuf) { return (extract_unsigned_integer ((regbuf + DEPRECATED_REGISTER_BYTE (STRUCT_RETURN_REGNUM)), - DEPRECATED_REGISTER_RAW_SIZE (STRUCT_RETURN_REGNUM))); + register_size (current_gdbarch, + STRUCT_RETURN_REGNUM))); } static CORE_ADDR @@ -1362,14 +1361,14 @@ sh_frame_saved_pc (struct frame_info *frame) } /* Discard from the stack the innermost frame, restoring all saved registers. - Used in the 'return' command. */ + Used in the 'return' command. */ static void sh64_pop_frame (void) { struct frame_info *frame = get_current_frame (); CORE_ADDR fp; int regnum; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int media_mode = pc_is_isa32 (get_frame_pc (frame)); @@ -1392,8 +1391,8 @@ sh64_pop_frame (void) || regnum == PR_REGNUM)) size = 4; else - size = DEPRECATED_REGISTER_RAW_SIZE (translate_insn_rn (regnum, - media_mode)); + size = register_size (current_gdbarch, + translate_insn_rn (regnum, media_mode)); write_register (regnum, read_memory_integer (deprecated_get_frame_saved_regs (frame)[regnum], size)); @@ -1471,7 +1470,7 @@ sh_frame_align (struct gdbarch *ignore, CORE_ADDR sp) I.e. there is hole in the stack. Different rules apply for variable arguments functions, and for functions - for which the prototype is not known. */ + for which the prototype is not known. */ static CORE_ADDR sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, @@ -1492,7 +1491,6 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int len; int argreg_size; int fp_args[12]; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); memset (fp_args, 0, sizeof (fp_args)); @@ -1526,7 +1524,7 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, if (TYPE_CODE (type) != TYPE_CODE_FLT) { - argreg_size = DEPRECATED_REGISTER_RAW_SIZE (int_argreg); + argreg_size = register_size (current_gdbarch, int_argreg); if (len < argreg_size) { @@ -1562,7 +1560,7 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, /* Store the value 8 bytes at a time. This means that things larger than 8 bytes may go partly in registers and partly on the stack. FIXME: argreg is incremented - before we use its size. */ + before we use its size. */ len -= argreg_size; val += argreg_size; int_argreg++; @@ -1586,13 +1584,13 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, deprecated_write_register_gen (FP0_REGNUM + float_arg_index, val); fp_args[float_arg_index] = 1; - /* Skip the corresponding general argument register. */ + /* Skip the corresponding general argument register. */ int_argreg ++; } else ; /* Store it as the integers, 8 bytes at the time, if - necessary spilling on the stack. */ + necessary spilling on the stack. */ } else if (len == 8) @@ -1607,7 +1605,7 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, { /* Goes in DR0...DR10 */ /* The numbering of the DRi registers is consecutive, - i.e. includes odd numbers. */ + i.e. includes odd numbers. */ int double_register_offset = double_arg_index / 2; int regnum = DR0_REGNUM + double_register_offset; @@ -1627,17 +1625,17 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, registers, not pseudo. write_register_gen will call the gdbarch function to do register writes, and that will properly know how to deal - with pseudoregs. */ + with pseudoregs. */ deprecated_write_register_gen (regnum, val); fp_args[double_arg_index] = 1; fp_args[double_arg_index + 1] = 1; - /* Skip the corresponding general argument register. */ + /* Skip the corresponding general argument register. */ int_argreg ++; } else ; /* Store it as the integers, 8 bytes at the time, if - necessary spilling on the stack. */ + necessary spilling on the stack. */ } } } @@ -1665,7 +1663,6 @@ sh64_extract_return_value (struct type *type, char *regbuf, char *valbuf) int offset; int return_register; int len = TYPE_LENGTH (type); - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); if (TYPE_CODE (type) == TYPE_CODE_FLT) { @@ -1674,7 +1671,7 @@ sh64_extract_return_value (struct type *type, char *regbuf, char *valbuf) /* Return value stored in FP0_REGNUM */ return_register = FP0_REGNUM; offset = DEPRECATED_REGISTER_BYTE (return_register); - memcpy (valbuf, (char *) regbuf + offset, len); + memcpy (valbuf, (char *) regbuf + offset, len); } else if (len == 8) { @@ -1690,7 +1687,7 @@ sh64_extract_return_value (struct type *type, char *regbuf, char *valbuf) else floatformat_to_doublest (&floatformat_ieee_double_big, (char *) regbuf + offset, &val); - deprecated_store_floating (valbuf, len, val); + store_typed_floating (valbuf, type, val); } } else @@ -1698,11 +1695,11 @@ sh64_extract_return_value (struct type *type, char *regbuf, char *valbuf) if (len <= 8) { /* Result is in register 2. If smaller than 8 bytes, it is padded - at the most significant end. */ + at the most significant end. */ return_register = DEFAULT_RETURN_REGNUM; if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) offset = DEPRECATED_REGISTER_BYTE (return_register) + - DEPRECATED_REGISTER_RAW_SIZE (return_register) - len; + register_size (current_gdbarch, return_register) - len; else offset = DEPRECATED_REGISTER_BYTE (return_register); memcpy (valbuf, (char *) regbuf + offset, len); @@ -1717,12 +1714,12 @@ sh64_extract_return_value (struct type *type, char *regbuf, char *valbuf) If the architecture is sh4 or sh3e, store a function's return value in the R0 general register or in the FP0 floating point register, depending on the type of the return value. In all the other cases - the result is stored in r0, left-justified. */ + the result is stored in r0, left-justified. */ static void sh64_store_return_value (struct type *type, char *valbuf) { - char buf[64]; /* more than enough... */ + char buf[64]; /* more than enough... */ int len = TYPE_LENGTH (type); if (TYPE_CODE (type) == TYPE_CODE_FLT) @@ -1743,14 +1740,15 @@ sh64_store_return_value (struct type *type, char *valbuf) int return_register = DEFAULT_RETURN_REGNUM; int offset = 0; - if (len <= DEPRECATED_REGISTER_RAW_SIZE (return_register)) + if (len <= register_size (current_gdbarch, return_register)) { - /* Pad with zeros. */ - memset (buf, 0, DEPRECATED_REGISTER_RAW_SIZE (return_register)); + /* Pad with zeros. */ + memset (buf, 0, register_size (current_gdbarch, return_register)); if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) - offset = 0; /*DEPRECATED_REGISTER_RAW_SIZE (return_register) - len;*/ + offset = 0; /*register_size (current_gdbarch, + return_register) - len;*/ else - offset = DEPRECATED_REGISTER_RAW_SIZE (return_register) - len; + offset = register_size (current_gdbarch, return_register) - len; memcpy (buf + offset, valbuf, len); deprecated_write_register_gen (return_register, buf); @@ -1764,7 +1762,6 @@ static void sh64_show_media_regs (void) { int i; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); printf_filtered ("PC=%s SR=%016llx \n", paddr (read_register (PC_REGNUM)), @@ -1803,7 +1800,6 @@ static void sh64_show_compact_regs (void) { int i; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); printf_filtered ("PC=%s \n", paddr (read_register (PC_C_REGNUM))); @@ -1841,8 +1837,8 @@ sh64_show_compact_regs (void) (long) read_register (FP0_REGNUM + i + 7)); } -/*FIXME!!! This only shows the registers for shmedia, excluding the - pseudo registers. */ +/* FIXME!!! This only shows the registers for shmedia, excluding the + pseudo registers. */ void sh64_show_regs (void) { @@ -1922,13 +1918,12 @@ REGISTER_BYTE returns the register byte for the base register. */ /* *INDENT-ON* */ static int -sh_sh64_register_byte (int reg_nr) +sh64_register_byte (int reg_nr) { int base_regnum = -1; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); /* If it is a pseudo register, get the number of the first floating - point register that is part of it. */ + point register that is part of it. */ if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM) base_regnum = dr_reg_base_num (reg_nr); @@ -1942,14 +1937,14 @@ sh_sh64_register_byte (int reg_nr) base_regnum = fv_reg_base_num (reg_nr); /* sh compact pseudo register. FPSCR is a pathological case, need to - treat it as special. */ + treat it as special. */ else if ((reg_nr >= R0_C_REGNUM && reg_nr <= FV_LAST_C_REGNUM) && reg_nr != FPSCR_C_REGNUM) base_regnum = sh64_compact_reg_base_num (reg_nr); - /* Now return the offset in bytes within the register cache. */ - /* sh media pseudo register, i.e. any of DR, FFP, FV registers. */ + /* Now return the offset in bytes within the register cache. */ + /* sh media pseudo register, i.e. any of DR, FFP, FV registers. */ if (reg_nr >= DR0_REGNUM && reg_nr <= FV_LAST_REGNUM) return (base_regnum - FP0_REGNUM + 1) * 4 @@ -1985,19 +1980,19 @@ sh_sh64_register_byte (int reg_nr) else if (reg_nr == FPSCR_C_REGNUM) /* This is complicated, for now return the beginning of the - architectural FPSCR register. */ + architectural FPSCR register. */ return (TR7_REGNUM + 1) * 8; else if (reg_nr == FPUL_C_REGNUM) return ((base_regnum - FP0_REGNUM) * 4 + (TR7_REGNUM + 1) * 8 + 4); - /* It is not a pseudo register. */ - /* It is a 64 bit register. */ + /* It is not a pseudo register. */ + /* It is a 64 bit register. */ else if (reg_nr <= TR7_REGNUM) return reg_nr * 8; - /* It is a 32 bit register. */ + /* It is a 32 bit register. */ else if (reg_nr == FPSCR_REGNUM) return (FPSCR_REGNUM * 8); @@ -2007,43 +2002,8 @@ sh_sh64_register_byte (int reg_nr) + (reg_nr - FP0_REGNUM + 1) * 4); } -static int -sh_sh64_register_raw_size (int reg_nr) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - - if ((reg_nr >= DR0_REGNUM - && reg_nr <= DR_LAST_REGNUM) - || (reg_nr >= FPP0_REGNUM - && reg_nr <= FPP_LAST_REGNUM) - || (reg_nr >= DR0_C_REGNUM - && reg_nr <= DR_LAST_C_REGNUM) - || (reg_nr <= TR7_REGNUM)) - return 8; - - else if ((reg_nr >= FV0_REGNUM - && reg_nr <= FV_LAST_REGNUM) - || (reg_nr >= FV0_C_REGNUM - && reg_nr <= FV_LAST_C_REGNUM)) - return 16; - - else /* this covers also the 32-bit SH compact registers. */ - return 4; -} - -/* ??????? FIXME */ -static int -sh_sh64_register_virtual_size (int reg_nr) -{ - if (reg_nr >= FP0_REGNUM - && reg_nr <= FP_LAST_REGNUM) - return 4; - else - return 8; -} - static struct type * -sh_sh64_build_float_register_type (int high) +sh64_build_float_register_type (int high) { struct type *temp; @@ -2051,11 +2011,11 @@ sh_sh64_build_float_register_type (int high) return create_array_type (NULL, builtin_type_float, temp); } +/* Return the GDB type object for the "standard" data type + of data in register REG_NR. */ static struct type * -sh_sh64_register_virtual_type (int reg_nr) +sh64_register_type (struct gdbarch *gdbarch, int reg_nr) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - if ((reg_nr >= FP0_REGNUM && reg_nr <= FP_LAST_REGNUM) || (reg_nr >= FP0_C_REGNUM @@ -2068,12 +2028,12 @@ sh_sh64_register_virtual_type (int reg_nr) return builtin_type_double; else if (reg_nr >= FPP0_REGNUM && reg_nr <= FPP_LAST_REGNUM) - return sh_sh64_build_float_register_type (1); + return sh64_build_float_register_type (1); else if ((reg_nr >= FV0_REGNUM && reg_nr <= FV_LAST_REGNUM) ||(reg_nr >= FV0_C_REGNUM && reg_nr <= FV_LAST_C_REGNUM)) - return sh_sh64_build_float_register_type (3); + return sh64_build_float_register_type (3); else if (reg_nr == FPSCR_REGNUM) return builtin_type_int; else if (reg_nr >= R0_C_REGNUM @@ -2084,15 +2044,13 @@ sh_sh64_register_virtual_type (int reg_nr) } static void -sh_sh64_register_convert_to_virtual (int regnum, struct type *type, +sh64_register_convert_to_virtual (int regnum, struct type *type, char *from, char *to) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - if (TARGET_BYTE_ORDER != BFD_ENDIAN_LITTLE) { - /* It is a no-op. */ - memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regnum)); + /* It is a no-op. */ + memcpy (to, from, register_size (current_gdbarch, regnum)); return; } @@ -2102,23 +2060,22 @@ sh_sh64_register_convert_to_virtual (int regnum, struct type *type, && regnum <= DR_LAST_C_REGNUM)) { DOUBLEST val; - floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, from, &val); - deprecated_store_floating(to, TYPE_LENGTH(type), val); + floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, + from, &val); + store_typed_floating (to, type, val); } else - error("sh_register_convert_to_virtual called with non DR register number"); + error ("sh64_register_convert_to_virtual called with non DR register number"); } static void -sh_sh64_register_convert_to_raw (struct type *type, int regnum, +sh64_register_convert_to_raw (struct type *type, int regnum, const void *from, void *to) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - if (TARGET_BYTE_ORDER != BFD_ENDIAN_LITTLE) { - /* It is a no-op. */ - memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regnum)); + /* It is a no-op. */ + memcpy (to, from, register_size (current_gdbarch, regnum)); return; } @@ -2128,10 +2085,11 @@ sh_sh64_register_convert_to_raw (struct type *type, int regnum, && regnum <= DR_LAST_C_REGNUM)) { DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type)); - floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to); + floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, + &val, to); } else - error("sh_register_convert_to_raw called with non DR register number"); + error ("sh64_register_convert_to_raw called with non DR register number"); } static void @@ -2142,24 +2100,25 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int portion; int offset = 0; char temp_buffer[MAX_REGISTER_SIZE]; - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM) { base_regnum = dr_reg_base_num (reg_nr); - /* Build the value in the provided buffer. */ + /* Build the value in the provided buffer. */ /* DR regs are double precision registers obtained by - concatenating 2 single precision floating point registers. */ + concatenating 2 single precision floating point registers. */ for (portion = 0; portion < 2; portion++) regcache_raw_read (regcache, base_regnum + portion, (temp_buffer - + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); + + register_size (gdbarch, base_regnum) * portion)); - /* We must pay attention to the endiannes. */ - sh_sh64_register_convert_to_virtual (reg_nr, DEPRECATED_REGISTER_VIRTUAL_TYPE (reg_nr), - temp_buffer, buffer); + /* We must pay attention to the endianness. */ + sh64_register_convert_to_virtual (reg_nr, + gdbarch_register_type (gdbarch, + reg_nr), + temp_buffer, buffer); } @@ -2168,13 +2127,13 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, { base_regnum = fpp_reg_base_num (reg_nr); - /* Build the value in the provided buffer. */ + /* Build the value in the provided buffer. */ /* FPP regs are pairs of single precision registers obtained by - concatenating 2 single precision floating point registers. */ + concatenating 2 single precision floating point registers. */ for (portion = 0; portion < 2; portion++) regcache_raw_read (regcache, base_regnum + portion, ((char *) buffer - + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); + + register_size (gdbarch, base_regnum) * portion)); } else if (reg_nr >= FV0_REGNUM @@ -2182,13 +2141,13 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, { base_regnum = fv_reg_base_num (reg_nr); - /* Build the value in the provided buffer. */ + /* Build the value in the provided buffer. */ /* FV regs are vectors of single precision registers obtained by - concatenating 4 single precision floating point registers. */ + concatenating 4 single precision floating point registers. */ for (portion = 0; portion < 4; portion++) regcache_raw_read (regcache, base_regnum + portion, ((char *) buffer - + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); + + register_size (gdbarch, base_regnum) * portion)); } /* sh compact pseudo registers. 1-to-1 with a shmedia register */ @@ -2197,7 +2156,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, { base_regnum = sh64_compact_reg_base_num (reg_nr); - /* Build the value in the provided buffer. */ + /* Build the value in the provided buffer. */ regcache_raw_read (regcache, base_regnum, temp_buffer); if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) offset = 4; @@ -2209,9 +2168,9 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, { base_regnum = sh64_compact_reg_base_num (reg_nr); - /* Build the value in the provided buffer. */ + /* Build the value in the provided buffer. */ /* Floating point registers map 1-1 to the media fp regs, - they have the same size and endienness. */ + they have the same size and endianness. */ regcache_raw_read (regcache, base_regnum, buffer); } @@ -2221,15 +2180,17 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, base_regnum = sh64_compact_reg_base_num (reg_nr); /* DR_C regs are double precision registers obtained by - concatenating 2 single precision floating point registers. */ + concatenating 2 single precision floating point registers. */ for (portion = 0; portion < 2; portion++) regcache_raw_read (regcache, base_regnum + portion, (temp_buffer - + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); + + register_size (gdbarch, base_regnum) * portion)); - /* We must pay attention to the endiannes. */ - sh_sh64_register_convert_to_virtual (reg_nr, DEPRECATED_REGISTER_VIRTUAL_TYPE (reg_nr), - temp_buffer, buffer); + /* We must pay attention to the endianness. */ + sh64_register_convert_to_virtual (reg_nr, + gdbarch_register_type (gdbarch, + reg_nr), + temp_buffer, buffer); } else if (reg_nr >= FV0_C_REGNUM @@ -2237,13 +2198,13 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, { base_regnum = sh64_compact_reg_base_num (reg_nr); - /* Build the value in the provided buffer. */ + /* Build the value in the provided buffer. */ /* FV_C regs are vectors of single precision registers obtained by - concatenating 4 single precision floating point registers. */ + concatenating 4 single precision floating point registers. */ for (portion = 0; portion < 4; portion++) regcache_raw_read (regcache, base_regnum + portion, ((char *) buffer - + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); + + register_size (gdbarch, base_regnum) * portion)); } else if (reg_nr == FPSCR_C_REGNUM) @@ -2259,7 +2220,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, fpscr_base_regnum = FPSCR_REGNUM; sr_base_regnum = SR_REGNUM; - /* Build the value in the provided buffer. */ + /* Build the value in the provided buffer. */ /* FPSCR_C is a very weird register that contains sparse bits from the FPSCR and the SR architectural registers. Specifically: */ @@ -2275,19 +2236,19 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, /* *INDENT-ON* */ /* Get FPSCR into a local buffer */ regcache_raw_read (regcache, fpscr_base_regnum, temp_buffer); - /* Get value as an int. */ + /* Get value as an int. */ fpscr_value = extract_unsigned_integer (temp_buffer, 4); /* Get SR into a local buffer */ regcache_raw_read (regcache, sr_base_regnum, temp_buffer); - /* Get value as an int. */ + /* Get value as an int. */ sr_value = extract_unsigned_integer (temp_buffer, 4); - /* Build the new value. */ + /* Build the new value. */ fpscr_c_part1_value = fpscr_value & 0x3fffd; fpscr_c_part2_value = (sr_value & 0x7000) << 6; fpscr_c_value = fpscr_c_part1_value | fpscr_c_part2_value; /* Store that in out buffer!!! */ store_unsigned_integer (buffer, 4, fpscr_c_value); - /* FIXME There is surely an endianness gotcha here. */ + /* FIXME There is surely an endianness gotcha here. */ } else if (reg_nr == FPUL_C_REGNUM) @@ -2295,7 +2256,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, base_regnum = sh64_compact_reg_base_num (reg_nr); /* FPUL_C register is floating point register 32, - same size, same endianness. */ + same size, same endianness. */ regcache_raw_read (regcache, base_regnum, buffer); } } @@ -2307,22 +2268,22 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int base_regnum, portion; int offset; char temp_buffer[MAX_REGISTER_SIZE]; - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM) { base_regnum = dr_reg_base_num (reg_nr); - /* We must pay attention to the endiannes. */ - sh_sh64_register_convert_to_raw (DEPRECATED_REGISTER_VIRTUAL_TYPE (reg_nr), reg_nr, - buffer, temp_buffer); - + /* We must pay attention to the endianness. */ + sh64_register_convert_to_raw (gdbarch_register_type (gdbarch, reg_nr), + reg_nr, + buffer, temp_buffer); /* Write the real regs for which this one is an alias. */ for (portion = 0; portion < 2; portion++) regcache_raw_write (regcache, base_regnum + portion, (temp_buffer - + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); + + register_size (gdbarch, + base_regnum) * portion)); } else if (reg_nr >= FPP0_REGNUM @@ -2334,7 +2295,8 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, for (portion = 0; portion < 2; portion++) regcache_raw_write (regcache, base_regnum + portion, ((char *) buffer - + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); + + register_size (gdbarch, + base_regnum) * portion)); } else if (reg_nr >= FV0_REGNUM @@ -2346,7 +2308,8 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, for (portion = 0; portion < 4; portion++) regcache_raw_write (regcache, base_regnum + portion, ((char *) buffer - + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); + + register_size (gdbarch, + base_regnum) * portion)); } /* sh compact general pseudo registers. 1-to-1 with a shmedia @@ -2355,14 +2318,14 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, && reg_nr <= T_C_REGNUM) { base_regnum = sh64_compact_reg_base_num (reg_nr); - /* reg_nr is 32 bit here, and base_regnum is 64 bits. */ + /* reg_nr is 32 bit here, and base_regnum is 64 bits. */ if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) offset = 4; else offset = 0; /* Let's read the value of the base register into a temporary buffer, so that overwriting the last four bytes with the new - value of the pseudo will leave the upper 4 bytes unchanged. */ + value of the pseudo will leave the upper 4 bytes unchanged. */ regcache_raw_read (regcache, base_regnum, temp_buffer); /* Write as an 8 byte quantity */ memcpy (temp_buffer + offset, buffer, 4); @@ -2370,7 +2333,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, } /* sh floating point compact pseudo registers. 1-to-1 with a shmedia - registers. Both are 4 bytes. */ + registers. Both are 4 bytes. */ else if (reg_nr >= FP0_C_REGNUM && reg_nr <= FP_LAST_C_REGNUM) { @@ -2384,13 +2347,16 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, base_regnum = sh64_compact_reg_base_num (reg_nr); for (portion = 0; portion < 2; portion++) { - /* We must pay attention to the endiannes. */ - sh_sh64_register_convert_to_raw (DEPRECATED_REGISTER_VIRTUAL_TYPE (reg_nr), reg_nr, - buffer, temp_buffer); + /* We must pay attention to the endianness. */ + sh64_register_convert_to_raw (gdbarch_register_type (gdbarch, + reg_nr), + reg_nr, + buffer, temp_buffer); regcache_raw_write (regcache, base_regnum + portion, (temp_buffer - + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); + + register_size (gdbarch, + base_regnum) * portion)); } } @@ -2403,7 +2369,8 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, { regcache_raw_write (regcache, base_regnum + portion, ((char *) buffer - + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); + + register_size (gdbarch, + base_regnum) * portion)); } } @@ -2435,10 +2402,10 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, 21-31 reserved */ /* *INDENT-ON* */ - /* Get value as an int. */ + /* Get value as an int. */ fpscr_c_value = extract_unsigned_integer (buffer, 4); - /* Build the new values. */ + /* Build the new values. */ fpscr_mask = 0x0003fffd; sr_mask = 0x001c0000; @@ -2467,7 +2434,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, } } -/* Floating point vector of 4 float registers. */ +/* Floating point vector of 4 float registers. */ static void do_fv_register_info (struct gdbarch *gdbarch, struct ui_file *file, int fv_regnum) @@ -2481,7 +2448,7 @@ do_fv_register_info (struct gdbarch *gdbarch, struct ui_file *file, (int) read_register (first_fp_reg_num + 3)); } -/* Floating point vector of 4 float registers, compact mode. */ +/* Floating point vector of 4 float registers, compact mode. */ static void do_fv_c_register_info (int fv_regnum) { @@ -2495,7 +2462,7 @@ do_fv_c_register_info (int fv_regnum) } /* Pairs of single regs. The DR are instead double precision - registers. */ + registers. */ static void do_fpp_register_info (int fpp_regnum) { @@ -2507,7 +2474,7 @@ do_fpp_register_info (int fpp_regnum) (int) read_register (first_fp_reg_num + 1)); } -/* Double precision registers. */ +/* Double precision registers. */ static void do_dr_register_info (struct gdbarch *gdbarch, struct ui_file *file, int dr_regnum) @@ -2520,7 +2487,7 @@ do_dr_register_info (struct gdbarch *gdbarch, struct ui_file *file, (int) read_register (first_fp_reg_num + 1)); } -/* Double precision registers, compact mode. */ +/* Double precision registers, compact mode. */ static void do_dr_c_register_info (int dr_regnum) { @@ -2532,7 +2499,7 @@ do_dr_c_register_info (int dr_regnum) (int) read_register (first_fp_reg_num +1)); } -/* General register in compact mode. */ +/* General register in compact mode. */ static void do_r_c_register_info (int r_c_regnum) { @@ -2544,8 +2511,8 @@ do_r_c_register_info (int r_c_regnum) } /* FIXME:!! THIS SHOULD TAKE CARE OF GETTING THE RIGHT PORTION OF THE - shmedia REGISTERS. */ -/* Control registers, compact mode. */ + shmedia REGISTERS. */ +/* Control registers, compact mode. */ static void do_cr_c_register_info (int cr_c_regnum) { @@ -2578,7 +2545,7 @@ sh_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum) int inv; int j; - /* Allocate space for the float. */ + /* Allocate space for the float. */ raw_buffer = (char *) alloca (register_size (gdbarch, FP0_REGNUM)); /* Get the data in raw format. */ @@ -2588,17 +2555,17 @@ sh_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum) /* Get the register as a number */ flt = unpack_double (builtin_type_float, raw_buffer, &inv); - /* Print the name and some spaces. */ + /* Print the name and some spaces. */ fputs_filtered (REGISTER_NAME (regnum), file); print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), file); - /* Print the value. */ + /* Print the value. */ if (inv) fprintf_filtered (file, "<invalid float>"); else fprintf_filtered (file, "%-10.9g", flt); - /* Print the fp register as hex. */ + /* Print the fp register as hex. */ fprintf_filtered (file, "\t(raw 0x"); for (j = 0; j < register_size (gdbarch, regnum); j++) { @@ -2613,8 +2580,7 @@ sh_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum) static void sh64_do_pseudo_register (int regnum) { - /* All the sh64-compact mode registers are pseudo registers. */ - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + /* All the sh64-compact mode registers are pseudo registers. */ if (regnum < NUM_REGS || regnum >= NUM_REGS + NUM_PSEUDO_REGS_SH_MEDIA + NUM_PSEUDO_REGS_SH_COMPACT) @@ -2643,16 +2609,15 @@ sh64_do_pseudo_register (int regnum) else if (regnum >= R0_C_REGNUM && regnum <= R_LAST_C_REGNUM) - do_r_c_register_info (regnum); /* FIXME, this function will not print the right format */ - + /* FIXME, this function will not print the right format. */ + do_r_c_register_info (regnum); else if (regnum >= FP0_C_REGNUM && regnum <= FP_LAST_C_REGNUM) - sh_do_fp_register (current_gdbarch, gdb_stdout, regnum); /* this should work also for pseudoregs */ - + /* This should work also for pseudoregs. */ + sh_do_fp_register (current_gdbarch, gdb_stdout, regnum); else if (regnum >= PC_C_REGNUM && regnum <= FPUL_C_REGNUM) do_cr_c_register_info (regnum); - } static void @@ -2750,7 +2715,6 @@ sh_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, static void sh_compact_do_registers_info (int regnum, int fpregs) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); if (regnum != -1) /* do one specified register */ { if (*(REGISTER_NAME (regnum)) == '\0') @@ -2780,7 +2744,7 @@ sh64_do_registers_info (int regnum, int fpregs) sh_print_registers_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, regnum, fpregs); else - sh_compact_do_registers_info (regnum, fpregs); + sh_compact_do_registers_info (regnum, fpregs); } #ifdef SVR4_SHARED_LIBS @@ -2842,7 +2806,7 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return arches->gdbarch; /* None found, create a new architecture from the information - provided. */ + provided. */ tdep = XMALLOC (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); @@ -2853,7 +2817,7 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Determine the ABI */ if (info.abfd && bfd_get_arch_size (info.abfd) == 64) { - /* If the ABI is the 64-bit one, it can only be sh-media. */ + /* If the ABI is the 64-bit one, it can only be sh-media. */ tdep->sh_abi = SH_ABI_64; set_gdbarch_ptr_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_long_bit (gdbarch, 8 * TARGET_CHAR_BIT); @@ -2861,7 +2825,7 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) else { /* If the ABI is the 32-bit one it could be either media or - compact. */ + compact. */ tdep->sh_abi = SH_ABI_32; set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); @@ -2899,33 +2863,23 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_fp0_regnum (gdbarch, SIM_SH64_FR0_REGNUM); set_gdbarch_pc_regnum (gdbarch, 64); - /* the number of real registers is the same whether we are in - ISA16(compact) or ISA32(media). */ + /* The number of real registers is the same whether we are in + ISA16(compact) or ISA32(media). */ set_gdbarch_num_regs (gdbarch, SIM_SH64_NR_REGS); - set_gdbarch_deprecated_register_size (gdbarch, 8); /*????*/ set_gdbarch_deprecated_register_bytes (gdbarch, ((SIM_SH64_NR_FP_REGS + 1) * 4) + (SIM_SH64_NR_REGS - SIM_SH64_NR_FP_REGS -1) * 8); - set_gdbarch_register_name (gdbarch, sh_sh64_register_name); - set_gdbarch_deprecated_register_virtual_type (gdbarch, sh_sh64_register_virtual_type); + set_gdbarch_register_name (gdbarch, sh64_register_name); + set_gdbarch_register_type (gdbarch, sh64_register_type); set_gdbarch_deprecated_store_return_value (gdbarch, sh64_store_return_value); - set_gdbarch_deprecated_register_raw_size (gdbarch, sh_sh64_register_raw_size); - set_gdbarch_deprecated_register_virtual_size (gdbarch, sh_sh64_register_raw_size); - set_gdbarch_deprecated_register_byte (gdbarch, sh_sh64_register_byte); - /* This seems awfully wrong!*/ - /*set_gdbarch_deprecated_max_register_raw_size (gdbarch, 8);*/ - /* should include the size of the pseudo regs. */ - set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4 * 4); - /* Or should that go in the virtual_size? */ - /*set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8);*/ - set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4 * 4); + set_gdbarch_deprecated_register_byte (gdbarch, sh64_register_byte); set_gdbarch_pseudo_register_read (gdbarch, sh64_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, sh64_pseudo_register_write); set_gdbarch_deprecated_do_registers_info (gdbarch, sh64_do_registers_info); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs); - set_gdbarch_breakpoint_from_pc (gdbarch, sh_sh64_breakpoint_from_pc); + set_gdbarch_breakpoint_from_pc (gdbarch, sh64_breakpoint_from_pc); set_gdbarch_deprecated_call_dummy_words (gdbarch, sh64_call_dummy_words); set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (sh64_call_dummy_words)); diff --git a/gdb/solib.h b/gdb/solib.h index 936f037..01971f4 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -149,7 +149,7 @@ extern void solib_create_inferior_hook (void); /* solib.c */ */ #define SOLIB_UNLOADED_LIBRARY_PATHNAME(pid) \ -(0) +"" /* This function returns TRUE if pc is the address of an instruction that lies within the dynamic linker (such as the event hook, or the dld diff --git a/gdb/source.c b/gdb/source.c index 0ed3b3e..2b8d3a3 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -260,7 +260,7 @@ select_source_symtab (struct symtab *s) { char *name = s->filename; int len = strlen (name); - if (!(len > 2 && (STREQ (&name[len - 2], ".h")))) + if (!(len > 2 && (DEPRECATED_STREQ (&name[len - 2], ".h")))) { current_source_symtab = s; } @@ -277,7 +277,7 @@ select_source_symtab (struct symtab *s) { char *name = ps->filename; int len = strlen (name); - if (!(len > 2 && (STREQ (&name[len - 2], ".h")))) + if (!(len > 2 && (DEPRECATED_STREQ (&name[len - 2], ".h")))) { cs_pst = ps; } diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index c32d302..d3b2418 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -433,7 +433,7 @@ sparc_frame_saved_pc (struct frame_info *frame) as the third parameter. The offset to the saved pc is 12. */ find_pc_partial_function (get_frame_pc (frame), &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL); - if (name && STREQ (name, "ucbsigvechandler")) + if (name && DEPRECATED_STREQ (name, "ucbsigvechandler")) saved_pc_offset = 12; /* The sigcontext address is contained in register O2. */ diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 7d04cc7..a4143e8 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1118,7 +1118,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, if (local_symbols && local_symbols->nsyms > 0 -#ifndef USE_REGISTER_NOT_ARG +#ifndef DEPRECATED_USE_REGISTER_NOT_ARG + /* DEPRECATED_USE_REGISTER_NOT_ARG is only defined by + the SPARC. */ && gdbarch_stabs_argument_has_addr (current_gdbarch, SYMBOL_TYPE (sym)) #endif @@ -1562,11 +1564,9 @@ again: *pp = from + 1; } - /* Now check to see whether the type has already been - declared. This was written for arrays of cross-referenced - types before we had TYPE_CODE_TARGET_STUBBED, so I'm pretty - sure it is not necessary anymore. But it might be a good - idea, to save a little memory. */ + /* If this type has already been declared, then reuse the same + type, rather than allocating a new one. This saves some + memory. */ for (ppt = file_symbols; ppt; ppt = ppt->next) for (i = 0; i < ppt->nsyms; i++) @@ -1580,6 +1580,8 @@ again: { obstack_free (&objfile->type_obstack, type_name); type = SYMBOL_TYPE (sym); + if (typenums[0] != -1) + *dbx_lookup_type (typenums) = type; return type; } } diff --git a/gdb/stack.c b/gdb/stack.c index 82820aa..28ff09d 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1356,7 +1356,7 @@ print_block_frame_labels (struct block *b, int *have_default, ALL_BLOCK_SYMBOLS (b, iter, sym) { - if (STREQ (DEPRECATED_SYMBOL_NAME (sym), "default")) + if (DEPRECATED_STREQ (DEPRECATED_SYMBOL_NAME (sym), "default")) { if (*have_default) continue; @@ -1854,33 +1854,33 @@ return_command (char *retval_exp, int from_tty) if (VALUE_LAZY (return_value)) value_fetch_lazy (return_value); - /* Check that this architecture can handle the function's return - type. In the case of "struct convention", still do the - "return", just also warn the user. */ - if (gdbarch_return_value_p (current_gdbarch)) + if (TYPE_CODE (return_type) == TYPE_CODE_VOID) + /* If the return-type is "void", don't try to find the + return-value's location. However, do still evaluate the + return expression so that, even when the expression result + is discarded, side effects such as "return i++" still + occure. */ + return_value = NULL; + else if (!gdbarch_return_value_p (current_gdbarch) + && (TYPE_CODE (return_type) == TYPE_CODE_STRUCT + || TYPE_CODE (return_type) == TYPE_CODE_UNION)) { - if (gdbarch_return_value (current_gdbarch, return_type, - NULL, NULL, NULL) - == RETURN_VALUE_STRUCT_CONVENTION) - return_value = NULL; + /* NOTE: cagney/2003-10-20: Compatibility hack for legacy + code. Old architectures don't expect STORE_RETURN_VALUE + to be called with with a small struct that needs to be + stored in registers. Don't start doing it now. */ + query_prefix = "\ +A structure or union return type is not supported by this architecture.\n\ +If you continue, the return value that you specified will be ignored.\n"; + return_value = NULL; } - else + else if (using_struct_return (return_type, 0)) { - /* NOTE: cagney/2003-10-20: The double check is to ensure - that the STORE_RETURN_VALUE call, further down, is not - applied to a struct or union return-value. It wasn't - allowed previously, so don't start allowing it now. An - ABI that uses "register convention" to return small - structures and should implement the "return_value" - architecture method. */ - if (using_struct_return (return_type, 0) - || TYPE_CODE (return_type) == TYPE_CODE_STRUCT - || TYPE_CODE (return_type) == TYPE_CODE_UNION) - return_value = NULL; + query_prefix = "\ +The location at which to store the function's return value is unknown.\n\ +If you continue, the return value that you specified will be ignored.\n"; + return_value = NULL; } - if (return_value == NULL) - query_prefix = "\ -The location at which to store the function's return value is unknown.\n"; } /* Does an interactive user really want to do this? Include @@ -2036,7 +2036,14 @@ get_frame_language (void) if (deprecated_selected_frame) { - s = find_pc_symtab (get_frame_pc (deprecated_selected_frame)); + /* We determine the current frame language by looking up its + associated symtab. To retrieve this symtab, we use the frame PC. + However we cannot use the frame pc as is, because it usually points + to the instruction following the "call", which is sometimes the first + instruction of another function. So we rely on + get_frame_address_in_block(), it provides us with a PC which is + guaranteed to be inside the frame's code block. */ + s = find_pc_symtab (get_frame_address_in_block (deprecated_selected_frame)); if (s) flang = s->language; else diff --git a/gdb/symfile.c b/gdb/symfile.c index f2656fb..d58a8ec 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1226,7 +1226,7 @@ symbol_file_command (char *args, int from_tty) if (strcmp (*argv, "-mapped") == 0) flags |= OBJF_MAPPED; else - if (STREQ (*argv, "-readnow")) + if (strcmp (*argv, "-readnow") == 0) flags |= OBJF_READNOW; else if (**argv == '-') @@ -2682,7 +2682,8 @@ add_psymbol_to_list (char *name, int namelength, domain_enum domain, SYMBOL_SET_NAMES (&psymbol, buf, namelength, objfile); /* Stash the partial symbol away in the cache */ - psym = bcache (&psymbol, sizeof (struct partial_symbol), objfile->psymbol_cache); + psym = deprecated_bcache (&psymbol, sizeof (struct partial_symbol), + objfile->psymbol_cache); /* Save pointer to partial symbol in psymtab, growing symtab if needed. */ if (list->next >= list->list + list->size) @@ -2719,7 +2720,8 @@ add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name, memcpy (buf, name, namelength); buf[namelength] = '\0'; - DEPRECATED_SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, objfile->psymbol_cache); + DEPRECATED_SYMBOL_NAME (&psymbol) = deprecated_bcache (buf, namelength + 1, + objfile->psymbol_cache); buf = alloca (dem_namelength + 1); memcpy (buf, dem_name, dem_namelength); @@ -2730,7 +2732,7 @@ add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name, case language_c: case language_cplus: SYMBOL_CPLUS_DEMANGLED_NAME (&psymbol) = - bcache (buf, dem_namelength + 1, objfile->psymbol_cache); + deprecated_bcache (buf, dem_namelength + 1, objfile->psymbol_cache); break; /* FIXME What should be done for the default case? Ignoring for now. */ } @@ -2751,7 +2753,8 @@ add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name, SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language); /* Stash the partial symbol away in the cache */ - psym = bcache (&psymbol, sizeof (struct partial_symbol), objfile->psymbol_cache); + psym = deprecated_bcache (&psymbol, sizeof (struct partial_symbol), + objfile->psymbol_cache); /* Save pointer to partial symbol in psymtab, growing symtab if needed. */ if (list->next >= list->list + list->size) diff --git a/gdb/symtab.c b/gdb/symtab.c index ed024d6..f959970 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2389,10 +2389,6 @@ find_function_start_sal (struct symbol *sym, int funfirstline) } sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0); -#ifdef PROLOGUE_FIRSTLINE_OVERLAP - /* Convex: no need to suppress code on first line, if any */ - sal.pc = pc; -#else /* Check if SKIP_PROLOGUE left us in mid-line, and the next line is still part of the same function. */ if (sal.pc != pc @@ -2405,7 +2401,6 @@ find_function_start_sal (struct symbol *sym, int funfirstline) sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0); } sal.pc = pc; -#endif return sal; } diff --git a/gdb/symtab.h b/gdb/symtab.h index 40ce11e..aa188e9 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -326,6 +326,12 @@ struct minimal_symbol char *info; + /* Size of this symbol. end_psymtab in dbxread.c uses this + information to calculate the end of the partial symtab based on the + address of the last symbol plus the size of the last symbol. */ + + unsigned long size; + #ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Which source file is this symbol in? Only relevant for mst_file_*. */ char *filename; @@ -347,6 +353,7 @@ struct minimal_symbol }; #define MSYMBOL_INFO(msymbol) (msymbol)->info +#define MSYMBOL_SIZE(msymbol) (msymbol)->size #define MSYMBOL_TYPE(msymbol) (msymbol)->type diff --git a/gdb/target.c b/gdb/target.c index 7e088b9..4c12bda 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1284,7 +1284,7 @@ target_disconnect (char *args, int from_tty) void target_link (char *modname, CORE_ADDR *t_reloc) { - if (STREQ (current_target.to_shortname, "rombug")) + if (DEPRECATED_STREQ (current_target.to_shortname, "rombug")) { (current_target.to_lookup_symbol) (modname, t_reloc); if (*t_reloc == 0) diff --git a/gdb/target.h b/gdb/target.h index 42b9596..21956df 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -223,8 +223,10 @@ enum target_object /* AVR target specific transfer. See "avr-tdep.c" and "remote.c". */ TARGET_OBJECT_AVR, /* Transfer up-to LEN bytes of memory starting at OFFSET. */ - TARGET_OBJECT_MEMORY - /* Possible future ojbects: TARGET_OJBECT_FILE, TARGET_OBJECT_PROC, + TARGET_OBJECT_MEMORY, + /* Kernel Unwind Table. See "ia64-tdep.c". */ + TARGET_OBJECT_UNWIND_TABLE, + /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC, TARGET_OBJECT_AUXV, ... */ }; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 88f8c23..f7b3a30 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,242 @@ +2003-12-13 Jim Blandy <jimb@redhat.com> + + * gdb.base/freebpcmd.exp, gdb.base/freebpcmd.c: New test. + +2003-12-12 Kevin Buettner <kevinb@redhat.com> + + * gdb.asm/frv.inc: New file. + * gdb.asm/asm-source.exp: Add frv-*-* as a supported target. + +2003-12-09 Fred Fish <fnf@redhat.com> + + * gdb.base/break.c (marker1, marker2, marker3, marker4): Move + functions to break1.c and leave prototypes behind. Add more + "set breakpoint NN here" comments. + * gdb.base/break1.c: New file. + + * gdb.base/break.exp: Handle compiling test case from multiple + source files and change source file references as needed. + * gdb.base/completion.exp: Ditto. + * gdb.base/condbreak.exp: Ditto. + * gdb.base/define.exp: Ditto. + * gdb.base/ena-dis-br.exp: Ditto. + * gdb.base/info-proc.exp: Ditto. + * gdb.base/maint.exp: Ditto. + * gdb.base/until.exp: Ditto. + + * gdb.base/condbreak.exp: Use bp_locationNN variables instead of + hardcoded line numbers. + * gdb.base/define.exp: Ditto. + * gdb.base/ena-dis-br.exp: Ditto. + * gdb.base/maint.exp: Ditto. + * gdb.base/until.exp: Ditto. + + * gdb.base/completion.exp: Use "break1" for completion tests since + "break" is no longer a unique prefix. + +2003-12-06 Andrew Cagney <cagney@redhat.com> + + * gdb.base/structs.exp (test_struct_returns): When applicable, set + "return_value_unimplemented". When an unimplemented struct return + architecture, report incorrect values as a KFAIL + +2003-12-05 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.cp/rtti.exp: Accept new wording of warning from + cp_lookup_rtti_type. + +2003-12-05 Michael Chastain <mec.gnu@mindspring.com> + + Partial fix for PR testsuite/1456. + * gdb.base/scope.exp (test_at_main): Replace references to + gcc_compiled with calls to test_compiler_info. + (test_at_foo): Likewise. + (test_at_bar): Likewise. + +2003-12-04 Michael Chastain <mec.gnu@mindspring.com> + + Partial fix for PR testsuite/1456. + * gdb.base/so-impl-ld.exp: Replace reference to gcc_compiled with call + to test_compiler_info. + +2003-12-03 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.base/so-impl-ld.exp: Update copyright notice. + +2003-12-02 Michael Chastain <mec.gnu@mindspring.com> + + Partial fix for PR testsuite/1456. + * gdb.base/mips_pro.exp: Replace references to gcc_compiled with calls + to test_compiler_info. + +2003-11-28 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.objc/objcdecode.exp: Match and KFAIL the output that comes + from current versions of gdb. Clean up regular expressions. + Delete redundant timeout case. + +2003-11-28 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.objc/nondebug.exp: Match and KFAIL the output that comes + from current versions of gdb. Clean up regular expressions. + Delete redundant timeout case. + +2003-12-01 Michael Chastain <mec.gnu@mindspring.com> + + Partial fix for PR testsuite/1456. + * gdb.base/callfuncs.exp (do_function_calls): Replace reference to + gcc_compiled with call to test_compiler_info. + +2003-11-30 Michael Chastain <mec.gnu@mindspring.com> + + Partial fix for PR testsuite/1456. + * gdb.base/list.exp (test_list_function): Delete unused declaration + of gcc_compiled. + +2003-11-29 Michael Chastain <mec.gnu@mindspring.com> + + Partial fix for PR testsuite/1456. + * gdb.base/complex.exp: Replace reference to gcc_compiled with + call to test_compiler_info. + +2003-11-29 Mark Kettenis <kettenis@gnu.org> + + * gdb.asm/asm-source.exp: Initialize asm-note to "empty". Set + asm-note to "netbsd" for *-*-netbsdelf* and x86_64-*-netbsd*. Use + it to create the appropriate note.inc. + * gdb.asm/asmsrc1.s: Include "note.inc". + * gdb.asm/netbsd.inc: New file. + * gdb.asm/empty.inc: New file. + +2003-11-28 Michael Chastain <mec.gnu@mindspring.com> + + Partial fix for PR testsuite/1456. + * gdb.base/constvars.exp: Replace references to gcc_compiled with + calls to test_compiler_info. + +2003-11-27 Michael Chastain <mec.gnu@mindspring.com> + + Partial fix for PR testsuite/1456. + * gdb.base/volatile.exp: Replace references to gcc_compiled with + calls to test_compiler_info. + +2003-11-27 Mark Kettenis <kettenis@gnu.org> + + * gdb.base/structs.exp: Use i*86-*-* instead of i686-*-* as a + pattern for the KFAILs. + +2003-11-25 Adam Fedor <fedor@gnu.org> + + * gdb.objc/objcdecode.exp: Test for PR objc/1238. + * gdb.objc/objcdecode.m: New file. + +2003-11-25 Adam Fedor <fedor@gnu.org> + + * gdb.objc/nondebug.exp: Test for PR objc/1236. + * gdb.objc/nondebug.m: New file. + +2003-11-26 Ben Elliston <bje@wasabisystems.com> + + * gdb.asm/asm-source.exp: Make sure the final link succeeds on + NetBSD as it does on FreeBSD. Modelled on a similar change by + Mark Kettenis on 2003-05-30. + (link-flags): Set to "--entry _start" regardless of target. + Special linker flags are to be appended to $link-flags. + * gdb.asm/mips.inc (gdbasm_startup): Remove __start label. + +2003-11-25 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.cp/method.exp: Accept output of new demangler. + +2003-11-25 Michael Chastain <mec.gnu@mindspring.com> + + * gdb/class2.exp: New file. + * gdb/class2.cc: New file. + +2003-11-25 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.cp/templates.exp (test_ptype_of_templates): Accept output + of new demangler. + +2003-11-23 Mark Kettenis <kettenis@gnu.org> + + * gdb.arch/i386-unwind.exp: Use gdb_run_cmd and gdb_expect instead + of gdb_test "run". + +2003-11-23 Mark Kettenis <kettenis@gnu.org> + + * gdb.arch/i386-unwind.exp: Don't use runto_main. Change + "continue" into "run". + +2003-11-23 Michael Chastain <mec.gnu@mindspring.com> + + Partial fix for PR testsuite/1456. + * gdb.cp/ambiguous.exp: Replace reference to gcc_compiled with + call to test_compiler_info. + * gdb.cp/ctti.exp: Likewise. + * gdb.cp/derivation.exp: Likewise. + * gdb.cp/member-ptr.exp: Likewise. + * gdb.cp/virtfunc.exp (test_virtual_calls): Remove unused + reference to gcc_compiled. + +2003-11-23 Michael Chastain <mec.gnu@mindspring.com> + + Fix PR testsuite/1463. + * gdb.base/structs.exp (start_structs_test): Call + get_debug_format before using the debug format. + +2003-11-22 Andrew Cagney <cagney@redhat.com> + + * lib/gdb.exp (gdb_test_multiple): Add simple example. + * gdb.base/structs.exp: Use gdb_test_multiple. + +2003-11-20 Andrew Cagney <cagney@redhat.com> + + * gdb.base/structs.exp: Handle and recover from internal errors. + Replace "foo${n}" with "foo<n>" in test messages. + + * gdb.base/structs.exp: Update copyright. Rewrite. + * gdb.base/structs.c: Update copyright. Rewrite. + + * lib/gdb.exp (gdb_internal_error_resync): Issue a perror when the + resync count exceeded. + + * gdb.base/maint.exp: Use gdb_internal_error_resync to recover + from the internal error. + * lib/gdb.exp (gdb_internal_error_resync): New procedure. + Original from Jim Blandy. + (gdb_test_multiple): Use gdb_internal_error_resync. + +2003-11-19 Andrew Cagney <cagney@redhat.com> + + * gdb.base/callfuncs.exp: Change the XFAILed descriptor test to a + KFAIL. + +2003-11-17 Mark Kettenis <kettenis@gnu.org> + + New testcase for PR backtrace/1435. + * gdb.arch/i386-unwind.exp: New file. + * gdb.arch/i386-unwind.c: New file. + +2003-11-17 Andrew Cagney <cagney@redhat.com> + + * lib/gdb.exp (compiler_info): New global. + (test_compiler_info): New function. + (get_compiler_info): Set compiler_info. + * lib/compiler.c, lib/compiler.cc: Add copyright. When GNUC, set + "compiler_info" to gcc-<major>-<minor>. + +2003-11-15 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.trace/configure: Remove. + +2003-11-13 Elena Zannoni <ezannoni@redhat.com> + + * gdb.base/break.c: Add comments to aid finding line numbers for + breakpoints. + * gdb.base/break.exp: Remove all references to explicit line + numbers. + 2003-11-11 David Carlton <carlton@kealia.com> * gdb.cp/namespace.exp: KFAIL various tests with respect to PR diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index 8b0df38..e41bfec 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -32,8 +32,9 @@ set prms_id 0 set bug_id 0 set asm-arch "" +set asm-note "empty" set asm-flags "" -set link-flags "" +set link-flags "--entry _start" switch -glob -- [istarget] { "alpha*-*-*" { @@ -51,6 +52,9 @@ switch -glob -- [istarget] { "d10v-*-*" { set asm-arch d10v } + "frv-*-*" { + set asm-arch frv + } "s390-*-*" { set asm-arch s390 } @@ -63,13 +67,10 @@ switch -glob -- [istarget] { } "i\[3456\]86-*-*" { set asm-arch i386 - if [istarget "*-*-cygwin*"] then { - set link-flags "--entry _start" - } } "m32r*-*" { set asm-arch m32r - set link-flags "-Wl,--whole-archive -lgloss -Wl,--no-whole-archive" + append link-flags " -Wl,--whole-archive -lgloss -Wl,--no-whole-archive" } "m6811-*-*" { set asm-arch m68hc11 @@ -88,7 +89,6 @@ switch -glob -- [istarget] { "sh*-*-*" { set asm-arch sh set asm-flags "-gdwarf2 -I${srcdir}/${subdir} -I${objdir}/${subdir}" - set link-flags "--entry _start" } "sparc-*-*" { set asm-arch sparc @@ -118,13 +118,20 @@ if { "${asm-arch}" == "" } { gdb_suppress_entire_file "Assembly source test -- not implemented for this target." } -# On FreeBSD, crt1.o the final link will fail because of unresolved -# symbols. It turns out that libc.so references symbols that are -# normally provided by crt1.o, which isn't linked in since we specify -# -nostartfiles. Using -nostdlib doesn't help since target_compile -# automatically adds -lm. Linking statically avoids this mess. -if [istarget "*-*-freebsd*"] then { - set link-flags "-static" +# On FreeBSD and NetBSD, crt1.o the final link will fail because of +# unresolved symbols. It turns out that libc.so references symbols +# that are normally provided by crt1.o, which isn't linked in since we +# specify -nostartfiles. Using -nostdlib doesn't help since +# target_compile automatically adds -lm. Linking statically avoids +# this mess. +if {[istarget "*-*-freebsd*"] || [istarget "*-*-netbsd*"]} then { + append link-flags " -static" +} + +# On NetBSD/ELF we need a special NetBSD-identifying note section. +if { [istarget "*-*-netbsdelf*"] + || [istarget "x86_64-*-netbsd*"] } then { + set asm-note "netbsd" } # Watch out, we are invoking the assembler, but the testsuite sets multilib @@ -149,6 +156,8 @@ set srcfile2 asmsrc2.s remote_exec build "rm -f ${subdir}/arch.inc" remote_download host ${srcdir}/${subdir}/${asm-arch}.inc ${subdir}/arch.inc +remote_exec build "rm -f ${subdir}/note.inc" +remote_download host ${srcdir}/${subdir}/${asm-note}.inc ${subdir}/note.inc if { "${asm-flags}" == "" } { #set asm-flags "-Wa,-gstabs,-I${srcdir}/${subdir},-I${objdir}/${subdir}" @@ -362,3 +371,4 @@ gdb_test "disassem foostatic" ".*<foostatic\\+0>:.*End of assembler dump." \ "look at static function" remote_exec build "rm -f ${subdir}/arch.inc" +remote_exec build "rm -f ${subdir}/note.inc" diff --git a/gdb/testsuite/gdb.asm/asmsrc1.s b/gdb/testsuite/gdb.asm/asmsrc1.s index cba0e90..48bfb86 100644 --- a/gdb/testsuite/gdb.asm/asmsrc1.s +++ b/gdb/testsuite/gdb.asm/asmsrc1.s @@ -65,3 +65,5 @@ gdbasm_datavar globalvar 11 comment "A static variable" gdbasm_datavar staticvar 5 + + .include "note.inc" diff --git a/gdb/testsuite/gdb.asm/mips.inc b/gdb/testsuite/gdb.asm/mips.inc index 751f73f..a0992bb 100644 --- a/gdb/testsuite/gdb.asm/mips.inc +++ b/gdb/testsuite/gdb.asm/mips.inc @@ -58,7 +58,5 @@ comment "crt0 startup" .macro gdbasm_startup - .global __start -__start: move $fp, $sp .endm diff --git a/gdb/testsuite/gdb.base/break.c b/gdb/testsuite/gdb.base/break.c index 9e458b3..bf398fc 100644 --- a/gdb/testsuite/gdb.base/break.c +++ b/gdb/testsuite/gdb.base/break.c @@ -1,3 +1,25 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003 Free Software + Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@prep.ai.mit.edu */ + #ifdef vxworks # include <stdio.h> @@ -32,23 +54,16 @@ char *arg; # include <stdlib.h> #endif /* ! vxworks */ -/* - * The following functions do nothing useful. They are included simply - * as places to try setting breakpoints at. They are explicitly - * "one-line functions" to verify that this case works (some versions - * of gcc have or have had problems with this). - */ - #ifdef PROTOTYPES -int marker1 (void) { return (0); } -int marker2 (int a) { return (1); } -void marker3 (char *a, char *b) {} -void marker4 (long d) {} +extern int marker1 (void); +extern int marker2 (int a); +extern void marker3 (char *a, char *b); +extern void marker4 (long d); #else -int marker1 () { return (0); } -int marker2 (a) int a; { return (1); } -void marker3 (a, b) char *a, *b; {} -void marker4 (d) long d; {} +extern int marker1 (); +extern int marker2 (); +extern void marker3 (); +extern void marker4 (); #endif /* @@ -69,21 +84,21 @@ char *argv[], **envp; #endif { #ifdef usestubs - set_debug_traps(); + set_debug_traps(); /* set breakpoint 5 here */ breakpoint(); #endif - if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ + if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */ fprintf (stderr, "usage: factorial <number>\n"); return 1; } - printf ("%d\n", factorial (atoi ("6"))); - - marker1 (); - marker2 (43); - marker3 ("stack", "trace"); + printf ("%d\n", factorial (atoi ("6"))); /* set breakpoint 1 here */ + /* set breakpoint 12 here */ + marker1 (); /* set breakpoint 11 here */ + marker2 (43); /* set breakpoint 20 here */ + marker3 ("stack", "trace"); /* set breakpoint 21 here */ marker4 (177601976L); - argc = (argc == 12345); /* This is silly, but we can step off of it */ - return argc; + argc = (argc == 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */ + return argc; /* set breakpoint 10 here */ } #ifdef PROTOTYPES @@ -93,10 +108,10 @@ int factorial (value) int value; #endif { - if (value > 1) { + if (value > 1) { /* set breakpoint 7 here */ value *= factorial (value - 1); } - return (value); + return (value); /* set breakpoint 19 here */ } #ifdef PROTOTYPES @@ -106,7 +121,7 @@ int multi_line_if_conditional (a, b, c) int a, b, c; #endif { - if (a + if (a /* set breakpoint 3 here */ && b && c) return 0; @@ -121,7 +136,7 @@ int multi_line_while_conditional (a, b, c) int a, b, c; #endif { - while (a + while (a /* set breakpoint 4 here */ && b && c) { diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 38820ec..c425d14 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -34,10 +34,19 @@ set bug_id 0 set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } if [get_compiler_info ${binfile}] { @@ -87,7 +96,7 @@ gdb_test "break main" \ # test break at quoted function # gdb_test "break \"marker2\"" \ - "Breakpoint.*at.* file .*$srcfile, line.*" \ + "Breakpoint.*at.* file .*$srcfile1, line.*" \ "breakpoint quoted function" # @@ -97,6 +106,8 @@ gdb_test "break $srcfile:factorial" \ "Breakpoint.*at.* file .*$srcfile, line.*" \ "breakpoint function in file" +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] + # # test break at line number # @@ -109,44 +120,51 @@ gdb_test "break $srcfile:factorial" \ gdb_test "list main" \ ".*main \\(argc, argv, envp\\).*" \ "use `list' to establish default source file" -gdb_test "break 79" \ - "Breakpoint.*at.* file .*$srcfile, line 79\\." \ +gdb_test "break $bp_location1" \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." \ "breakpoint line number" # # test duplicate breakpoint # -gdb_test "break 79" \ - "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line 79\\." \ +gdb_test "break $bp_location1" \ + "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line $bp_location1\\." \ "breakpoint duplicate" +set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] + # # test break at line number in file # -gdb_test "break $srcfile:85" \ - "Breakpoint.*at.* file .*$srcfile, line 85\\." \ +gdb_test "break $srcfile:$bp_location2" \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location2\\." \ "breakpoint line number in file" +set bp_location3 [gdb_get_line_number "set breakpoint 3 here"] +set bp_location4 [gdb_get_line_number "set breakpoint 4 here"] # # Test putting a break at the start of a multi-line if conditional. # Verify the breakpoint was put at the start of the conditional. # gdb_test "break multi_line_if_conditional" \ - "Breakpoint.*at.* file .*$srcfile, line 109\\." \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location3\\." \ "breakpoint at start of multi line if conditional" gdb_test "break multi_line_while_conditional" \ - "Breakpoint.*at.* file .*$srcfile, line 124\\." \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ "breakpoint at start of multi line while conditional" +set bp_location5 [gdb_get_line_number "set breakpoint 5 here"] +set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] + # # check to see what breakpoints are set # if [target_info exists gdb_stub] { - set main_line 72 + set main_line $bp_location5 } else { - set main_line 75 + set main_line $bp_location6 } if {$hp_aCC_compiler} { @@ -155,16 +173,20 @@ if {$hp_aCC_compiler} { set proto "" } +set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] +set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] +set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] + gdb_test "info break" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* -\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile:4\[49\].* -\[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:96.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:85.* -\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_if_conditional at .*$srcfile:109.* -\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:124" \ +\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:($bp_location8|$bp_location9).* +\[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:$bp_location7.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location2.* +\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_if_conditional at .*$srcfile:$bp_location3.* +\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:$bp_location4" \ "breakpoint info" # FIXME: The rest of this test doesn't work with anything that can't @@ -191,52 +213,53 @@ if ![target_info exists use_gdb_stub] { send_gdb "y\n" exp_continue } - -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:75.*75\[\t \]+if .argc.* \{.*$gdb_prompt $"\ + -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\ { pass "run until function breakpoint" } -re ".*$gdb_prompt $" { fail "run until function breakpoint" } timeout { fail "run until function breakpoint (timeout)" } } } else { if ![target_info exists gdb_stub] { - gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:75.*75\[\t \]+if .argc.*\{.*" "stub continue" + gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue" } } # # run until the breakpoint at a line number # -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:79.*79\[\t \]+printf.*factorial.*" \ +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.*" \ "run until breakpoint set at a line number" # # Run until the breakpoint set in a function in a file # for {set i 6} {$i >= 1} {incr i -1} { - gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:96.*96\[\t \]+.*if .value > 1. \{.*" \ + gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:$bp_location7.*$bp_location7\[\t \]+.*if .value > 1. \{.*" \ "run until file:function($i) breakpoint" } # # Run until the breakpoint set at a quoted function # -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile:4\[49\].*" \ +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*" \ "run until quoted breakpoint" # # run until the file:function breakpoint at a line number in a file # -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:85.*85\[\t \]+argc = \\(argc == 12345\\);.*" \ +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location2.*$bp_location2\[\t \]+argc = \\(argc == 12345\\);.*" \ "run until file:linenum breakpoint" # Test break at offset +1 +set bp_location10 [gdb_get_line_number "set breakpoint 10 here"] gdb_test "break +1" \ - "Breakpoint.*at.* file .*$srcfile, line 86\\." \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location10\\." \ "breakpoint offset +1" # Check to see if breakpoint is hit when stepped onto gdb_test "step" \ - ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:86.*86\[\t \]+return argc;" \ + ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10.*$bp_location10\[\t \]+return argc;.*breakpoint 10 here.*" \ "step onto breakpoint" # @@ -260,37 +283,38 @@ gdb_test "tbreak $srcfile:factorial" "Breakpoint.*at.* file .*$srcfile, line.*" # # test break at line number # -send_gdb "tbreak 79\n" +send_gdb "tbreak $bp_location1\n" gdb_expect { - -re "Breakpoint.*at.* file .*$srcfile, line 79.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } + -re "Breakpoint.*at.* file .*$srcfile, line $bp_location1.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } timeout { fail "breakpoint line number #1 (timeout)" } } -gdb_test "tbreak 75" "Breakpoint.*at.* file .*$srcfile, line 75.*" "Temporary breakpoint line number #2" +gdb_test "tbreak $bp_location6" "Breakpoint.*at.* file .*$srcfile, line $bp_location6.*" "Temporary breakpoint line number #2" # # test break at line number in file # -send_gdb "tbreak $srcfile:85\n" +send_gdb "tbreak $srcfile:$bp_location2\n" gdb_expect { - -re "Breakpoint.*at.* file .*$srcfile, line 85.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } + -re "Breakpoint.*at.* file .*$srcfile, line $bp_location2.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } timeout { fail "Temporary breakpoint line number in file #1 (timeout)" } } -gdb_test "tbreak $srcfile:81" "Breakpoint.*at.* file .*$srcfile, line 81.*" "Temporary breakpoint line number in file #2" +set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] +gdb_test "tbreak $srcfile:$bp_location11" "Breakpoint.*at.* file .*$srcfile, line $bp_location11.*" "Temporary breakpoint line number in file #2" # # check to see what breakpoints are set (temporary this time) # gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\] \[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial$proto at .*$srcfile:96.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:79.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:75.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:85.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:81.*" \ +\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial$proto at .*$srcfile:$bp_location7.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location1.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location6.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location2.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location11.*" \ "Temporary breakpoint info" @@ -378,7 +402,7 @@ gdb_expect { # Run to the desired default location. If not positioned here, the # tests below don't work. # -gdb_test "until 79" "main .* at .*:79.*" "until 79" +gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until bp_location1" # Verify that GDB allows one to just say "break", which is treated @@ -427,13 +451,13 @@ gdb_expect { # if ![runto_main] then { fail "break tests suppressed" } -send_gdb "break 79\n" +send_gdb "break $bp_location1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 79.*$gdb_prompt $"\ - {pass "set to-be-silent break 79"} + -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $"\ + {pass "set to-be-silent break bp_location1"} -re "$gdb_prompt $"\ - {fail "set to-be-silent break 79"} - timeout {fail "(timeout) set to-be-silent break 79"} + {fail "set to-be-silent break bp_location1"} + timeout {fail "(timeout) set to-be-silent break bp_location1"} } send_gdb "commands $expect_out(1,string)\n" @@ -441,33 +465,33 @@ send_gdb "silent\n" send_gdb "end\n" gdb_expect { -re ".*$gdb_prompt $"\ - {pass "set silent break 79"} - timeout {fail "(timeout) set silent break 79"} + {pass "set silent break bp_location1"} + timeout {fail "(timeout) set silent break bp_location1"} } send_gdb "info break $expect_out(1,string)\n" gdb_expect { - -re "\[0-9\]*\[ \t\]*breakpoint.*:79\r\n\[ \t\]*silent.*$gdb_prompt $"\ - {pass "info silent break 79"} + -re "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*$gdb_prompt $"\ + {pass "info silent break bp_location1"} -re "$gdb_prompt $"\ - {fail "info silent break 79"} - timeout {fail "(timeout) info silent break 79"} + {fail "info silent break bp_location1"} + timeout {fail "(timeout) info silent break bp_location1"} } send_gdb "continue\n" gdb_expect { -re "Continuing.\r\n$gdb_prompt $"\ - {pass "hit silent break 79"} + {pass "hit silent break bp_location1"} -re "$gdb_prompt $"\ - {fail "hit silent break 79"} - timeout {fail "(timeout) hit silent break 79"} + {fail "hit silent break bp_location1"} + timeout {fail "(timeout) hit silent break bp_location1"} } send_gdb "bt\n" gdb_expect { - -re "#0 main .* at .*:79.*$gdb_prompt $"\ - {pass "stopped for silent break 79"} + -re "#0 main .* at .*:$bp_location1.*$gdb_prompt $"\ + {pass "stopped for silent break bp_location1"} -re "$gdb_prompt $"\ - {fail "stopped for silent break 79"} - timeout {fail "(timeout) stopped for silent break 79"} + {fail "stopped for silent break bp_location1"} + timeout {fail "(timeout) stopped for silent break bp_location1"} } # Verify that GDB can at least parse a breakpoint with the @@ -475,7 +499,8 @@ gdb_expect { # thread-specific breakpoint really triggers appropriately. # The gdb.threads subdirectory contains tests for that.) # -send_gdb "break 80 thread 999\n" +set bp_location12 [gdb_get_line_number "set breakpoint 12 here"] +send_gdb "break $bp_location12 thread 999\n" gdb_expect { -re "Unknown thread 999.*$gdb_prompt $"\ {pass "thread-specific breakpoint on non-existent thread disallowed"} @@ -483,7 +508,7 @@ gdb_expect { {fail "thread-specific breakpoint on non-existent thread disallowed"} timeout {fail "(timeout) thread-specific breakpoint on non-existent thread disallowed"} } -send_gdb "break 80 thread foo\n" +send_gdb "break $bp_location12 thread foo\n" gdb_expect { -re "Junk after thread keyword..*$gdb_prompt $"\ {pass "thread-specific breakpoint on bogus thread ID disallowed"} @@ -495,7 +520,7 @@ gdb_expect { # Verify that GDB responds gracefully to a breakpoint command with # trailing garbage. # -send_gdb "break 80 foo\n" +send_gdb "break $bp_location12 foo\n" gdb_expect { -re "Junk at end of arguments..*$gdb_prompt $"\ {pass "breakpoint with trailing garbage disallowed"} @@ -542,15 +567,15 @@ gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*} # Verify that a breakpoint can be set via a convenience variable. # -send_gdb "set \$foo=81\n" +send_gdb "set \$foo=$bp_location11\n" gdb_expect { -re "$gdb_prompt $"\ - {pass "set convenience variable \$foo to 81"} - timeout {fail "(timeout) set convenience variable \$foo to 81"} + {pass "set convenience variable \$foo to bp_location11"} + timeout {fail "(timeout) set convenience variable \$foo to bp_location11"} } send_gdb "break \$foo\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 81.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line $bp_location11.*$gdb_prompt $"\ {pass "set breakpoint via convenience variable"} -re "$gdb_prompt $"\ {fail "set breakpoint via convenience variable"} @@ -579,7 +604,7 @@ gdb_expect { # send_gdb "break marker2\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 4\[49\].*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\ {pass "set breakpoint on to-be-called function"} -re "$gdb_prompt $"\ {fail "set breakpoint on to-be-called function"} @@ -602,9 +627,9 @@ gdb_expect { # send_gdb "bt\n" gdb_expect { - -re "#0\[ \t\]*($hex in )?marker2.*:4\[49\]\r\n#1.*_sr4export.*$gdb_prompt $"\ + -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*_sr4export.*$gdb_prompt $"\ {pass "backtrace while in called function"} - -re "#0\[ \t\]*($hex in )?marker2.*:4\[49\]\r\n#1.*function called from gdb.*$gdb_prompt $"\ + -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*function called from gdb.*$gdb_prompt $"\ {pass "backtrace while in called function"} -re "$gdb_prompt $"\ {fail "backtrace while in called function"} @@ -617,11 +642,11 @@ gdb_expect { # send_gdb "finish\n" gdb_expect { - -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.* in _sr4export.*$gdb_prompt $"\ + -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.* in _sr4export.*$gdb_prompt $"\ {pass "finish from called function"} - -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.*function called from gdb.*$gdb_prompt $"\ + -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*function called from gdb.*$gdb_prompt $"\ {pass "finish from called function"} - -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.*Value returned.*$gdb_prompt $"\ + -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*Value returned.*$gdb_prompt $"\ {pass "finish from called function"} -re "$gdb_prompt $"\ {fail "finish from called function"} @@ -833,8 +858,16 @@ test_next_with_recursion set binfileo2 ${objdir}/${subdir}/${testfile}o2 -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfileo2}" executable {debug additional_flags="-O2" }] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}O0.o" object {debug "additional_flags=-w -O2"}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}O1.o" object {debug "additional_flags=-w -O2"}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}O0.o ${binfile}O1.o" "${binfileo2}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } if [get_compiler_info ${binfileo2}] { @@ -861,7 +894,7 @@ gdb_test "break main" \ # test break at function # gdb_test "break marker4" \ - "Breakpoint.*at.* file .*$srcfile, line.*" \ + "Breakpoint.*at.* file .*$srcfile1, line.*" \ "breakpoint small function, optimized file" # @@ -880,7 +913,7 @@ if ![target_info exists use_gdb_stub] { send_gdb "y\n" exp_continue } - -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:75.*75\[\t \]+if .argc.* \{.*$gdb_prompt $"\ + -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\ { pass "run until function breakpoint, optimized file" } -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $"\ { pass "run until function breakpoint, optimized file (code motion)" } @@ -889,7 +922,7 @@ if ![target_info exists use_gdb_stub] { } } else { if ![target_info exists gdb_stub] { - gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:75.*75\[\t \]+if .argc.*\{.*" "stub continue, optimized file" + gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue, optimized file" } } @@ -906,17 +939,19 @@ if ![target_info exists use_gdb_stub] { # has no exactly matching line symbol, and GDB reports the breakpoint # as if it were in the middle of a line rather than at the beginning. +set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1] +set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1] send_gdb "continue\n" gdb_expect { - -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:51\[\r\n\]+51\[\t \]+void marker4.*" { + -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { pass "run until breakpoint set at small function, optimized file" } - -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile:51\[\r\n\]+51\[\t \]+void marker4.*" { + -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { pass "run until breakpoint set at small function, optimized file" } - -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:46\[\r\n\]+46\[\t \]+void marker4.*" { + -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" { # marker4() is defined at line 46 when compiled with -DPROTOTYPES - pass "run until breakpoint set at small function, optimized file (line 46)" + pass "run until breakpoint set at small function, optimized file (line bp_location14)" } -re ".*$gdb_prompt " { fail "run until breakpoint set at small function, optimized file" diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp index 7a5f143..4446058 100644 --- a/gdb/testsuite/gdb.base/callfuncs.exp +++ b/gdb/testsuite/gdb.base/callfuncs.exp @@ -95,7 +95,6 @@ proc set_lang_c {} { proc do_function_calls {} { global prototypes - global gcc_compiled global gdb_prompt # We need to up this because this can be really slow on some boards. @@ -149,7 +148,7 @@ proc do_function_calls {} { # to be a generic problem on quite a few platforms. if $prototypes then { setup_xfail "sparc-*-*" "mips*-*-*" 5318 - if {!$gcc_compiled} then { + if { ! [test_compiler_info gcc-*-*] } then { setup_xfail "alpha-dec-osf2*" "i*86-*-sysv4*" 5318 } } @@ -182,30 +181,27 @@ proc do_function_calls {} { gdb_test "p t_func_values(func_val2,func_val1)" " = 0" gdb_test "p t_func_values(func_val1,func_val2)" " = 1" - # On the rs6000, we need to pass the address of the trampoline routine, - # not the address of add itself. I don't know how to go from add to - # the address of the trampoline. Similar problems exist on the HPPA, - # and in fact can present an unsolvable problem as the stubs may not - # even exist in the user's program. We've slightly recoded t_func_values - # to avoid such problems in the common case. This may or may not help - # the RS6000. - setup_xfail "rs6000*-*-*" - setup_xfail "powerpc*-*-*" - if {![istarget hppa*-*-hpux*]} then { - gdb_test "p t_func_values(add,func_val2)" " = 1" - } - - setup_xfail "rs6000*-*-*" - setup_xfail "powerpc*-*-*" - if {![istarget hppa*-*-hpux*]} then { - gdb_test "p t_func_values(func_val1,doubleit)" " = 1" - } - - setup_xfail "rs6000*-*-*" - setup_xfail "powerpc*-*-*" - if {![istarget hppa*-*-hpux*]} then { - gdb_test "p t_call_add(add,3,4)" " = 7" - } + # GDB currently screws up the passing of function parameters for + # ABIs that use function descriptors. Instead of passing the + # address of te function descriptor, GDB passes the address of the + # function body. This results in the called function treating the + # first few instructions of the function proper as a descriptor + # and attempting a jump through that (a totally random address). + setup_kfail "rs6000*-*-aix*" gdb/1457 + setup_kfail "powerpc*-*-aix*" gdb/1457 + setup_kfail "powerpc64*-*-*" gdb/1457 + setup_kfail hppa*-*-hpux* gdb/1457 + gdb_test "p t_func_values(add,func_val2)" " = 1" + setup_kfail "rs6000*-*-aix*" gdb/1457 + setup_kfail "powerpc*-*-aix*" gdb/1457 + setup_kfail "powerpc64*-*-*" gdb/1457 + setup_kfail hppa*-*-hpux* gdb/1457 + gdb_test "p t_func_values(func_val1,doubleit)" " = 1" + setup_kfail "rs6000*-*-aix*" gdb/1457 + setup_kfail "powerpc*-*-aix*" gdb/1457 + setup_kfail "powerpc64*-*-*" gdb/1457 + setup_kfail hppa*-*-hpux* gdb/1457 + gdb_test "p t_call_add(add,3,4)" " = 7" gdb_test "p t_call_add(func_val1,3,4)" " = 7" gdb_test "p t_enum_value1(enumval1)" " = 1" diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index a1ff58a..9f5435d 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -38,8 +38,8 @@ # "info ajksdlfk " no completions # "info" " " # "info " ambiguous (all info commands) -# "p \"break" unambiguous (completes to filename "break.c") -# "p \"break." unambiguous (should complete to "break.c" but does not, +# "p \"break1" unambiguous (completes to filename "break1.c") +# "p \"break1." unambiguous (should complete to "break1.c" but does not, # due to readline limitations) # "p 'a" ambiguous (all symbols starting with a) # "p b-a" ambiguous (all symbols starting with a) @@ -64,9 +64,19 @@ set bug_id 0 set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } if [get_compiler_info ${binfile}] { @@ -351,61 +361,61 @@ gdb_expect { } -send_gdb "p \"break\t" +send_gdb "p \"break1\t" sleep 1 gdb_expect { - -re "^p \"break\\\x07$"\ + -re "^p \"break1\\\x07$"\ { send_gdb "\n" gdb_expect { - -re ".*$gdb_prompt $" { fail "complete 'p \"break'"} - timeout {fail "(timeout) complete 'p \"break'"} + -re ".*$gdb_prompt $" { fail "complete 'p \"break1'"} + timeout {fail "(timeout) complete 'p \"break1'"} } } - -re "^p \"break\\.c\"$"\ + -re "^p \"break1\\.c\"$"\ { send_gdb "\n" gdb_expect { - -re ".*$gdb_prompt $" { pass "complete 'p \"break'"} - timeout {fail "(timeout) complete 'p \"break'"} + -re ".*$gdb_prompt $" { pass "complete 'p \"break1'"} + timeout {fail "(timeout) complete 'p \"break1'"} } } - -re "^p \"break.*$" + -re "^p \"break1.*$" { send_gdb "\n" gdb_expect { - -re ".*$gdb_prompt $" { fail "complete 'p \"break'"} - timeout {fail "(timeout) complete 'p \"break'"} + -re ".*$gdb_prompt $" { fail "complete 'p \"break1'"} + timeout {fail "(timeout) complete 'p \"break1'"} } } - -re ".*$gdb_prompt $" { fail "complete 'p \"break'" } - timeout { fail "(timeout) complete 'p \"break'" } + -re ".*$gdb_prompt $" { fail "complete 'p \"break1'" } + timeout { fail "(timeout) complete 'p \"break1'" } } setup_xfail "*-*-*" -send_gdb "p \"break.\t" +send_gdb "p \"break1.\t" sleep 1 gdb_expect { - -re "^p \"break\\.\\\x07$"\ + -re "^p \"break1\\.\\\x07$"\ { send_gdb "\n" gdb_expect { - -re ".*$gdb_prompt $" { fail "complete 'p \"break.'"} - timeout {fail "(timeout) complete 'p \"break.'"} + -re ".*$gdb_prompt $" { fail "complete 'p \"break1.'"} + timeout {fail "(timeout) complete 'p \"break1.'"} } } - -re "^p \"break\\.c\"$"\ + -re "^p \"break1\\.c\"$"\ { send_gdb "\n" gdb_expect { - -re ".*$gdb_prompt $" { pass "complete 'p \"break.'"} - timeout {fail "(timeout) complete 'p \"break.'"} + -re ".*$gdb_prompt $" { pass "complete 'p \"break1.'"} + timeout {fail "(timeout) complete 'p \"break1.'"} } } - -re "^p \"break\\..*$" + -re "^p \"break1\\..*$" { send_gdb "\n" gdb_expect { - -re ".*$gdb_prompt $" { fail "complete 'p \"break.'"} - timeout {fail "(timeout) complete 'p \"break.'"} + -re ".*$gdb_prompt $" { fail "complete 'p \"break1.'"} + timeout {fail "(timeout) complete 'p \"break1.'"} } } - -re ".*$gdb_prompt $" { fail "complete 'p \"break.'" } - timeout { fail "(timeout) complete 'p \"break.'" } + -re ".*$gdb_prompt $" { fail "complete 'p \"break1.'" } + timeout { fail "(timeout) complete 'p \"break1.'" } } send_gdb "p 'a\t" @@ -682,7 +692,7 @@ gdb_expect { -re "marker1.*$gdb_prompt info func marker$"\ { send_gdb "\n" gdb_expect { - -re "All functions matching regular expression \"marker\":.*File.*break.c:\r\nint marker1\\((void|)\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\).*marker4\\(long int\\);.*$gdb_prompt $"\ + -re "All functions matching regular expression \"marker\":.*File.*break1.c:\r\nint marker1\\((void|)\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\).*marker4\\(long int\\);.*$gdb_prompt $"\ { pass "complete 'info func marke'"} -re ".*$gdb_prompt $" { fail "complete 'info func marke'"} timeout {fail "(timeout) complete 'info func marke'"} diff --git a/gdb/testsuite/gdb.base/complex.exp b/gdb/testsuite/gdb.base/complex.exp index f3f25e5..fac7f4f 100644 --- a/gdb/testsuite/gdb.base/complex.exp +++ b/gdb/testsuite/gdb.base/complex.exp @@ -48,7 +48,7 @@ gdb_load $binfile if [runto f2] then { get_debug_format - if {$gcc_compiled == 2 && [test_debug_format "DWARF 2"]} then { + if { [test_compiler_info gcc-2-*] && [test_debug_format "DWARF 2"] } then { setup_xfail "*-*-*" } gdb_test "p *y" "\\\$\[0-9\]* = \{c = 42 '\\*', f = 1 \\+ 0 \\* I\}" \ diff --git a/gdb/testsuite/gdb.base/condbreak.exp b/gdb/testsuite/gdb.base/condbreak.exp index c234431..dc4df21 100644 --- a/gdb/testsuite/gdb.base/condbreak.exp +++ b/gdb/testsuite/gdb.base/condbreak.exp @@ -1,4 +1,4 @@ -# Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +# Copyright 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu @@ -35,10 +35,19 @@ set bug_id 0 set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } if [get_compiler_info ${binfile}] { @@ -55,6 +64,13 @@ if [target_info exists gdb_stub] { gdb_step_for_stub; } +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] +set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] +set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] +set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] +set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1] +set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1] + # # test break at function # @@ -66,15 +82,15 @@ gdb_test "break main" \ # test conditional break at function # gdb_test "break marker1 if 1==1" \ - "Breakpoint.*at.* file .*$srcfile, line.*" + "Breakpoint.*at.* file .*$srcfile1, line.*" gdb_test "delete 2" "" # # test conditional break at line number # -gdb_test "break 79 if 1==1" \ - "Breakpoint.*at.* file .*$srcfile, line 79\\." +gdb_test "break $srcfile:$bp_location1 if 1==1" \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." gdb_test "delete 3" "" @@ -82,16 +98,16 @@ gdb_test "delete 3" "" # test conditional break at function # gdb_test "break marker1 if (1==1)" \ - "Breakpoint.*at.* file .*$srcfile, line.*" + "Breakpoint.*at.* file .*$srcfile1, line.*" # # test conditional break at line number # -gdb_test "break 79 if (1==1)" \ - "Breakpoint.*at.* file .*$srcfile, line 79\\." +gdb_test "break $srcfile:$bp_location1 if (1==1)" \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." gdb_test "break marker2 if (a==43)" \ - "Breakpoint.*at.* file .*$srcfile, line.*" + "Breakpoint.*at.* file .*$srcfile1, line.*" # # check to see what breakpoints are set @@ -105,15 +121,14 @@ if {$hp_aCC_compiler} { set marker2_proto "" } -set main_line 75 gdb_test "info break" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* -\[0-9\]+\[\t \]+breakpoint keep y.* in marker1$marker1_proto at .*$srcfile:4\[38\].* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location6.* +\[0-9\]+\[\t \]+breakpoint keep y.* in marker1$marker1_proto at .*$srcfile1:($bp_location15|$bp_location16).* \[\t \]+stop only if 1 == 1.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* \[\t \]+stop only if 1 == 1.* -\[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile:4\[49\].* +\[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile1:($bp_location8|$bp_location9).* \[\t \]+stop only if a == 43.*" \ "breakpoint info" @@ -128,7 +143,7 @@ rerun_to_main # # run until the breakpoint at a line number # -gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:79.*79\[\t \]+printf.*factorial.*" \ +gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.*" \ "run until breakpoint set at a line number" # @@ -173,10 +188,10 @@ gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=. # Until the Dwarf2 writer gets fixed, I'm going to XFAIL its behavior. send_gdb "continue\n" gdb_expect { - -re "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile:4\[38\].*4\[38\]\[\t \]+.*$gdb_prompt $" { + -re "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile1:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" { pass "run until breakpoint at marker1" } - -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker1 \\(\\) at .*$srcfile:4\[38\].*4\[38\]\[\t \]+.*$gdb_prompt $" { + -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker1 \\(\\) at .*$srcfile1:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" { xfail "run until breakpoint at marker1" } -re "$gdb_prompt $" { @@ -192,10 +207,10 @@ gdb_expect { setup_xfail hppa2.0w-*-* 11512CLLbs send_gdb "continue\n" gdb_expect { - -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile:4\[49\].*4\[49\]\[\t \]+.*" { + -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" { pass "run until breakpoint at marker2" } - -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile:4\[49\].*4\[49\]\[\t \]+.*" { + -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" { xfail "run until breakpoint at marker2" } -re "$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.base/constvars.exp b/gdb/testsuite/gdb.base/constvars.exp index 8a6b60b..9008624 100644 --- a/gdb/testsuite/gdb.base/constvars.exp +++ b/gdb/testsuite/gdb.base/constvars.exp @@ -82,9 +82,7 @@ if ![runto_main] then { get_debug_format proc local_compiler_xfail_check { } { - global gcc_compiled; - - if {$gcc_compiled == 2} then { + if { [test_compiler_info gcc-2-*] } then { if { ![test_debug_format "HP"] \ && ![test_debug_format "DWARF 2"] } then { setup_xfail "*-*-*" @@ -128,7 +126,7 @@ send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" # test function parameters local_compiler_xfail_check -if {$gcc_compiled == 3 && [test_debug_format "stabs"]} then { +if { [test_compiler_info gcc-3-*] && [test_debug_format "stabs"] } then { # With stabs, even GCC 3 does not get the const char arguments correct. setup_xfail "*-*-*" } @@ -144,8 +142,6 @@ gdb_expect { # test vars and pointers proc do_constvar_tests {} { - global gcc_compiled - gdb_test "print lave" " = 66 'B'" gdb_test "ptype lave" "type = char" gdb_test "print lavish" " = 10 '\\\\n'" @@ -285,7 +281,7 @@ proc do_constvar_tests {} { gdb_test "ptype locust" "type = double \\* const" local_compiler_xfail_check - if {$gcc_compiled == 3 && [test_debug_format "stabs"]} then { + if { [test_compiler_info gcc-3-*] && [test_debug_format "stabs"] } then { # With stabs, even GCC 3 does not get the constant structure member # correct. setup_xfail "*-*-*" diff --git a/gdb/testsuite/gdb.base/define.exp b/gdb/testsuite/gdb.base/define.exp index 06ea1c0..7e948f1 100644 --- a/gdb/testsuite/gdb.base/define.exp +++ b/gdb/testsuite/gdb.base/define.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999, 2001 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2001, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu @@ -34,10 +34,19 @@ set bug_id 0 set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } gdb_exit @@ -45,6 +54,9 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] +set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] + if ![runto_main] then { fail "define tests suppressed" } # Verify that GDB allows a user to define their very own commands. @@ -68,7 +80,7 @@ gdb_expect { # send_gdb "nextwhere\n" gdb_expect { - -re ".*79\[ \t\]*printf.*#0\[ \t\]*main.*:79.*$gdb_prompt $"\ + -re ".*$bp_location1\[ \t\]*printf.*#0\[ \t\]*main.*:$bp_location1.*$gdb_prompt $"\ {pass "use user command: nextwhere"} -re "$gdb_prompt $"\ {fail "use user command: nextwhere"} @@ -224,7 +236,7 @@ gdb_expect { send_gdb "next\n" gdb_expect { - -re "#0\[ \t\]*main.*:81.*$gdb_prompt $"\ + -re "#0\[ \t\]*main.*:$bp_location11.*$gdb_prompt $"\ {pass "use hook-stop command"} -re "$gdb_prompt $"\ {fail "use hook-stop command"} diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp index 93f6707..b0e3c1d 100644 --- a/gdb/testsuite/gdb.base/ena-dis-br.exp +++ b/gdb/testsuite/gdb.base/ena-dis-br.exp @@ -1,5 +1,4 @@ -# Copyright 1997, 1998, 1999 Free Software Foundation, Inc. - +# Copyright 1997, 1998, 1999, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu @@ -32,9 +31,18 @@ set bug_id 0 set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -43,6 +51,17 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] +set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] +set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] +set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] +set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1] +set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1] +set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1] +set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1] +set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile1] +set bp_location18 [gdb_get_line_number "set breakpoint 18 here" $srcfile1] + if ![runto_main] then { fail "enable/disable break tests suppressed" } # Verify that we can set a breakpoint (the location is irrelevant), @@ -50,7 +69,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } # send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -98,7 +117,7 @@ gdb_expect { # send_gdb "break marker2\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 4\[49\].*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\ {pass "break marker2"} -re "$gdb_prompt $"\ {fail "break marker2"} @@ -156,7 +175,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker3\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line (45|50).*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location17|$bp_location18).*$gdb_prompt $"\ {pass "break marker3"} -re "$gdb_prompt $"\ {fail "break marker3"} @@ -181,7 +200,7 @@ gdb_expect { send_gdb "continue\n" gdb_expect { - -re ".*marker3 .*:(45|50).*$gdb_prompt $"\ + -re ".*marker3 .*:($bp_location17|$bp_location18).*$gdb_prompt $"\ {pass "continue to auto-deleted break marker3"} -re "Breakpoint \[0-9\]*, marker3.*$gdb_prompt $"\ {fail "continue to auto-deleted break marker3"} @@ -206,7 +225,7 @@ gdb_expect { # send_gdb "break marker4\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line (46|51).*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location14|$bp_location13).*$gdb_prompt $"\ {pass "break marker4"} -re "$gdb_prompt $"\ {fail "break marker4"} @@ -237,7 +256,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -328,7 +347,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -365,7 +384,7 @@ rerun_to_main send_gdb "continue\n" gdb_expect { - -re ".*marker1 .*:4\[38\].*$gdb_prompt $"\ + -re ".*marker1 .*:($bp_location15|$bp_location16).*$gdb_prompt $"\ {pass "continue to ignored & auto-deleted break marker1"} -re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $"\ {fail "continue to ignored & auto-deleted break marker1"} @@ -381,7 +400,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -423,9 +442,9 @@ gdb_expect { # if ![runto_main] then { fail "enable/disable break tests suppressed" } -send_gdb "break 79\n" +send_gdb "break $bp_location1\n" gdb_expect { - -re "Breakpoint \[0-9\]*.*, line 79.*$gdb_prompt $"\ + -re "Breakpoint \[0-9\]*.*, line $bp_location1.*$gdb_prompt $"\ {pass "prepare to continue with ignore count"} -re "$gdb_prompt $"\ {fail "prepare to continue with ignore count"} @@ -442,7 +461,7 @@ gdb_expect { send_gdb "next\n" gdb_expect { - -re ".*81\[ \t\]*marker1.*$gdb_prompt $"\ + -re ".*$bp_location11\[ \t\]*marker1.*$gdb_prompt $"\ {pass "step after continue with ignore count"} -re "$gdb_prompt $"\ {fail "step after continue with ignore count"} diff --git a/gdb/testsuite/gdb.base/info-proc.exp b/gdb/testsuite/gdb.base/info-proc.exp index 2a9a4b0..d0da68f 100644 --- a/gdb/testsuite/gdb.base/info-proc.exp +++ b/gdb/testsuite/gdb.base/info-proc.exp @@ -1,4 +1,4 @@ -# Copyright 2002 Free Software Foundation, Inc. +# Copyright 2002, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,12 +27,22 @@ if $tracelevel then { set prms_id 0 set bug_id 0 -set testfile "break" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} set ws "\[ \t\]+" -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { +set testfile "break" +set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index 84a15cf..b38995c 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -222,7 +222,6 @@ proc test_list_filename_and_number {} { proc test_list_function {} { global gdb_prompt - global gcc_compiled # gcc appears to generate incorrect debugging information for code # in include files, which breaks this test. diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index f82bf02..4864164 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -65,10 +65,19 @@ set bug_id 0 set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" - } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -412,11 +421,13 @@ gdb_expect { timeout { fail "(timeout) maint info sections DATA" } } +set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] + send_gdb "maint info breakpoints\n" gdb_expect { - -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex\[ \t\]+in main at.*break.c:75\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\ + -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex\[ \t\]+in main at.*break.c:$bp_location6\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\ { pass "maint info breakpoints" } - -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex in main at.*break.c:75\r\n\[ \t\]+breakpoint already hit 1 time\r\n-1\[ \t\]+shlib events\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex.*breakpoint already hit.*$gdb_prompt $"\ + -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex in main at.*break.c:$bp_location6\r\n\[ \t\]+breakpoint already hit 1 time\r\n-1\[ \t\]+shlib events\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex.*breakpoint already hit.*$gdb_prompt $"\ { pass "maint info breakpoints (with shlib events)" } -re ".*$gdb_prompt $" { fail "maint info breakpoints" } timeout { fail "(timeout) maint info breakpoints" } @@ -650,34 +661,22 @@ gdb_expect { } send_gdb "maint internal-error\n" -gdb_expect { - -re "Quit this debugging session.*\\(y or n\\) $" { - send_gdb "n\n" - gdb_expect { - -re "Create a core file.*\\(y or n\\) $" { - send_gdb "n\n" - gdb_expect { - -re ".*$gdb_prompt $" { - pass "maint internal-error" - } - timeout { - fail "(timeout) maint internal-error" - } - } - } - -re ".*$gdb_prompt $" { - fail "maint internal-error" - } - timeout { - fail "(timeout) maint internal-error" - } +gdb_expect { + -re "A problem internal to GDB has been detected" { + pass "maint internal-error" + if [gdb_internal_error_resync] { + pass "internal-error resync" + } else { + fail "internal-error resync" } } -re ".*$gdb_prompt $" { fail "maint internal-error" + untested "internal-error resync" } timeout { - fail "(timeout) maint internal-error" + fail "maint internal-error (timeout)" + untested "internal-error resync" } } diff --git a/gdb/testsuite/gdb.base/mips_pro.exp b/gdb/testsuite/gdb.base/mips_pro.exp index a860e63..53ea9fd 100644 --- a/gdb/testsuite/gdb.base/mips_pro.exp +++ b/gdb/testsuite/gdb.base/mips_pro.exp @@ -37,7 +37,7 @@ if [get_compiler_info ${binfile}] { # This test must be compiled with -O2 if using gcc. -if {$gcc_compiled} then { +if { [test_compiler_info gcc-*-*] } then { if { [gdb_compile "${srcdir}/$subdir/${srcfile}" "${binfile}" executable {debug additional_flags=-O2}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -56,7 +56,7 @@ if [runto middle] then { # PR 3016 # warning: Hit heuristic-fence-post without finding # warning: enclosing function for pc 0x1006ead0 - if {$gcc_compiled} then { + if { [test_compiler_info gcc-*-*] } then { setup_xfail "mips*-sgi-irix4*" "mips64*-*-elf" } # The call chain is main -> top -> middle. But gcc can optimize a tail diff --git a/gdb/testsuite/gdb.base/scope.exp b/gdb/testsuite/gdb.base/scope.exp index db2c7ea..266e0e3 100644 --- a/gdb/testsuite/gdb.base/scope.exp +++ b/gdb/testsuite/gdb.base/scope.exp @@ -1,5 +1,5 @@ -# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002 Free -# Software Foundation, Inc. +# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003 +# Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -59,7 +59,6 @@ proc test_at_main {} { global det_file global srcdir global subdir - global gcc_compiled global hp_cc_compiler # skip past init. There may be a call to __main at the start of @@ -97,13 +96,13 @@ proc test_at_main {} { # No clue why the powerpc fails this test. setup_xfail "powerpc-*-*" - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if [gdb_test "print filelocal_ro" "\\\$$decimal = 201" "print filelocal_ro in test_at_main" ] { gdb_suppress_tests ; } - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } setup_xfail "powerpc-*-*" if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro"] { gdb_suppress_tests ; @@ -112,7 +111,7 @@ proc test_at_main {} { # Print scope1.c::filelocal, which is 2 - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs} if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal"] { gdb_suppress_tests ; @@ -121,7 +120,7 @@ proc test_at_main {} { # Print scope1.c::filelocal_bss, which is 102 - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs} if [gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss"] { gdb_suppress_tests ; @@ -130,7 +129,7 @@ proc test_at_main {} { # Print scope1.c::filelocal_ro, which is 202 - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs} if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro"] { gdb_suppress_tests ; @@ -144,7 +143,7 @@ proc test_at_main {} { } - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if [gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal"] { gdb_suppress_tests ; } @@ -157,7 +156,7 @@ proc test_at_main {} { } - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if [gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"] { gdb_suppress_tests ; } @@ -170,7 +169,7 @@ proc test_at_main {} { } - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if [gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal"] { gdb_suppress_tests ; } @@ -184,7 +183,6 @@ proc test_at_foo {} { global det_file global srcdir global subdir - global gcc_compiled if [gdb_test "next" ".*bar \\(\\);" "" ] { gdb_suppress_tests ; @@ -207,7 +205,7 @@ proc test_at_foo {} { # Print scope0.c::filelocal_ro, which is 201 - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } setup_xfail "powerpc-*-*" if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro"] { gdb_suppress_tests ; @@ -218,7 +216,7 @@ proc test_at_foo {} { # Print scope1.c::filelocal, which is 2 - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal"] { gdb_suppress_tests ; } @@ -227,14 +225,14 @@ proc test_at_foo {} { gdb_test "print filelocal_bss" "\\\$$decimal = 102" \ "print filelocal_bss at foo" - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss" gdb_test "print filelocal_ro" "\\\$$decimal = 202" \ "print filelocal_ro at foo" - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro" @@ -245,7 +243,7 @@ proc test_at_foo {} { gdb_test "print foo::funclocal" "\\\$$decimal = 3" \ "print foo::funclocal at foo" - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal" @@ -257,7 +255,7 @@ proc test_at_foo {} { gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \ "print foo::funclocal_bss at foo" - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss" @@ -269,7 +267,7 @@ proc test_at_foo {} { gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \ "print foo::funclocal_ro at foo" - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro" @@ -278,7 +276,7 @@ proc test_at_foo {} { gdb_test "print bar::funclocal" "\\\$$decimal = 4" \ "print bar::funclocal at foo" - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal" gdb_stop_suppressing_tests; @@ -290,7 +288,6 @@ proc test_at_bar {} { global det_file global srcdir global subdir - global gcc_compiled if [gdb_test "next" ".*" "" ] { gdb_suppress_tests ; @@ -313,7 +310,7 @@ proc test_at_bar {} { # Print scope0.c::filelocal_ro, which is 201 - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } setup_xfail "powerpc-*-*" if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro at bar" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro"] { gdb_suppress_tests ; @@ -327,7 +324,7 @@ proc test_at_bar {} { } - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal"] { gdb_suppress_tests ; } @@ -340,7 +337,7 @@ proc test_at_bar {} { } - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if [gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss"] { gdb_suppress_tests ; } @@ -353,7 +350,7 @@ proc test_at_bar {} { } - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro"] { gdb_suppress_tests ; } @@ -366,7 +363,7 @@ proc test_at_bar {} { } - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if [gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal"] { gdb_suppress_tests ; } @@ -379,7 +376,7 @@ proc test_at_bar {} { } - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if [gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss"] { gdb_suppress_tests ; } @@ -392,7 +389,7 @@ proc test_at_bar {} { } - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if [gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"] { gdb_suppress_tests ; } @@ -410,7 +407,7 @@ proc test_at_bar {} { } - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if [gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal"] { gdb_suppress_tests ; } @@ -428,7 +425,7 @@ proc test_at_bar {} { } - if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } if [gdb_test "print 'scope1.c'::bar::funclocal_bss" "\\\$$decimal = 104" "print 'scope1.c'::bar::funclocal_bss at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss"] { gdb_suppress_tests ; } diff --git a/gdb/testsuite/gdb.base/so-impl-ld.exp b/gdb/testsuite/gdb.base/so-impl-ld.exp index 68a1bf4..bcc7120 100644 --- a/gdb/testsuite/gdb.base/so-impl-ld.exp +++ b/gdb/testsuite/gdb.base/so-impl-ld.exp @@ -1,4 +1,4 @@ -# Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +# Copyright 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -55,15 +55,15 @@ if [get_compiler_info ${binfile}] { #remote_exec build "$CC -g +z -c ${libfile}1.c -o ${libfile}1.o" -if {$gcc_compiled == 0} { +if { [test_compiler_info gcc-*-*] } then { + set additional_flags "additional_flags=-fpic" +} else { if [istarget "hppa*-hp-hpux*"] then { set additional_flags "additional_flags=+z" } else { # don't know that the compiler is, hope for the best... set additional_flags "" } -} else { - set additional_flags "additional_flags=-fpic" } if {[gdb_compile "${srcdir}/${subdir}/${libfile}1.c" "${libfile}1.o" object [list debug $additional_flags]] != ""} { diff --git a/gdb/testsuite/gdb.base/structs.c b/gdb/testsuite/gdb.base/structs.c index 356f072..f7124da 100644 --- a/gdb/testsuite/gdb.base/structs.c +++ b/gdb/testsuite/gdb.base/structs.c @@ -1,4 +1,6 @@ -/* Copyright 1996, 1999 Free Software Foundation, Inc. +/* This testcase is part of GDB, the GNU debugger. + + Copyright 1996, 1999, 2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,37 +19,110 @@ Please email any bugs, comments, and/or additions to this file to: bug-gdb@prep.ai.mit.edu */ -struct struct1 { char a;}; -struct struct2 { char a, b;}; -struct struct3 { char a, b, c; }; -struct struct4 { char a, b, c, d; }; -struct struct5 { char a, b, c, d, e; }; -struct struct6 { char a, b, c, d, e, f; }; -struct struct7 { char a, b, c, d, e, f, g; }; -struct struct8 { char a, b, c, d, e, f, g, h; }; -struct struct9 { char a, b, c, d, e, f, g, h, i; }; -struct struct10 { char a, b, c, d, e, f, g, h, i, j; }; -struct struct11 { char a, b, c, d, e, f, g, h, i, j, k; }; -struct struct12 { char a, b, c, d, e, f, g, h, i, j, k, l; }; -struct struct16 { char a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p; }; - -struct struct1 foo1 = {'1'}, L1; -struct struct2 foo2 = { 'a', 'b'}, L2; -struct struct3 foo3 = { 'A', 'B', 'C'}, L3; -struct struct4 foo4 = {'1', '2', '3', '4'}, L4; -struct struct5 foo5 = {'a', 'b', 'c', 'd', 'e'}, L5; -struct struct6 foo6 = {'A', 'B', 'C', 'D', 'E', 'F'}, L6; -struct struct7 foo7 = {'1', '2', '3', '4', '5', '6', '7'}, L7; -struct struct8 foo8 = {'1', '2', '3', '4', '5', '6', '7', '8'}, L8; -struct struct9 foo9 = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}, L9; -struct struct10 foo10 = { - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'}, L10; -struct struct11 foo11 = { - '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B'}, L11; -struct struct12 foo12 = { - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L'}, L12; -struct struct16 foo16 = { - 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p'}, L16; +/* Useful abreviations. */ +typedef void t; +typedef char tc; +typedef short ts; +typedef int ti; +typedef long tl; +typedef long long tll; +typedef float tf; +typedef double td; +typedef long double tld; + +/* Force the type of each field. */ +#ifndef tA +typedef t tA; +#endif +#ifndef tB +typedef tA tB; +#endif +#ifndef tC +typedef tB tC; +#endif +#ifndef tD +typedef tC tD; +#endif +#ifndef tE +typedef tD tE; +#endif +#ifndef tF +typedef tE tF; +#endif +#ifndef tG +typedef tF tG; +#endif +#ifndef tH +typedef tG tH; +#endif +#ifndef tI +typedef tH tI; +#endif +#ifndef tJ +typedef tI tJ; +#endif +#ifndef tK +typedef tJ tK; +#endif +#ifndef tL +typedef tK tL; +#endif +#ifndef tM +typedef tL tM; +#endif +#ifndef tN +typedef tM tN; +#endif +#ifndef tO +typedef tN tO; +#endif +#ifndef tP +typedef tO tP; +#endif +#ifndef tQ +typedef tP tQ; +#endif +#ifndef tR +typedef tQ tR; +#endif + +struct struct1 {tA a;}; +struct struct2 {tA a; tB b;}; +struct struct3 {tA a; tB b; tC c; }; +struct struct4 {tA a; tB b; tC c; tD d; }; +struct struct5 {tA a; tB b; tC c; tD d; tE e; }; +struct struct6 {tA a; tB b; tC c; tD d; tE e; tF f; }; +struct struct7 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; }; +struct struct8 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; }; +struct struct9 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; }; +struct struct10 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; }; +struct struct11 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; }; +struct struct12 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; }; +struct struct13 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; }; +struct struct14 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; }; +struct struct15 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; tO o; }; +struct struct16 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; tO o; tP p; }; +struct struct17 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; tO o; tP p; tQ q; }; +struct struct18 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; tO o; tP p; tQ q; tR r; }; + +struct struct1 foo1 = {'1'}, L1; +struct struct2 foo2 = {'a','2'}, L2; +struct struct3 foo3 = {'1','b','3'}, L3; +struct struct4 foo4 = {'a','2','c','4'}, L4; +struct struct5 foo5 = {'1','b','3','d','5'}, L5; +struct struct6 foo6 = {'a','2','c','4','e','6'}, L6; +struct struct7 foo7 = {'1','b','3','d','5','f','7'}, L7; +struct struct8 foo8 = {'a','2','c','4','e','6','g','8'}, L8; +struct struct9 foo9 = {'1','b','3','d','5','f','7','h','9'}, L9; +struct struct10 foo10 = {'a','2','c','4','e','6','g','8','i','A'}, L10; +struct struct11 foo11 = {'1','b','3','d','5','f','7','h','9','j','B'}, L11; +struct struct12 foo12 = {'a','2','c','4','e','6','g','8','i','A','k','C'}, L12; +struct struct13 foo13 = {'1','b','3','d','5','f','7','h','9','j','B','l','D'}, L13; +struct struct14 foo14 = {'a','2','c','4','e','6','g','8','i','A','k','C','m','E'}, L14; +struct struct15 foo15 = {'1','b','3','d','5','f','7','h','9','j','B','l','D','n','F'}, L15; +struct struct16 foo16 = {'a','2','c','4','e','6','g','8','i','A','k','C','m','E','o','G'}, L16; +struct struct17 foo17 = {'1','b','3','d','5','f','7','h','9','j','B','l','D','n','F','p','H'}, L17; +struct struct18 foo18 = {'a','2','c','4','e','6','g','8','i','A','k','C','m','E','o','G','q','I'}, L18; struct struct1 fun1() { @@ -97,10 +172,30 @@ struct struct12 fun12() { return foo12; } +struct struct13 fun13() +{ + return foo13; +} +struct struct14 fun14() +{ + return foo14; +} +struct struct15 fun15() +{ + return foo15; +} struct struct16 fun16() { return foo16; } +struct struct17 fun17() +{ + return foo17; +} +struct struct18 fun18() +{ + return foo18; +} #ifdef PROTOTYPES void Fun1(struct struct1 foo1) @@ -211,6 +306,33 @@ void Fun12(foo12) L12 = foo12; } #ifdef PROTOTYPES +void Fun13(struct struct13 foo13) +#else +void Fun13(foo13) + struct struct13 foo13; +#endif +{ + L13 = foo13; +} +#ifdef PROTOTYPES +void Fun14(struct struct14 foo14) +#else +void Fun14(foo14) + struct struct14 foo14; +#endif +{ + L14 = foo14; +} +#ifdef PROTOTYPES +void Fun15(struct struct15 foo15) +#else +void Fun15(foo15) + struct struct15 foo15; +#endif +{ + L15 = foo15; +} +#ifdef PROTOTYPES void Fun16(struct struct16 foo16) #else void Fun16(foo16) @@ -219,6 +341,64 @@ void Fun16(foo16) { L16 = foo16; } +#ifdef PROTOTYPES +void Fun17(struct struct17 foo17) +#else +void Fun17(foo17) + struct struct17 foo17; +#endif +{ + L17 = foo17; +} +#ifdef PROTOTYPES +void Fun18(struct struct18 foo18) +#else +void Fun18(foo18) + struct struct18 foo18; +#endif +{ + L18 = foo18; +} + +zed () +{ + + L1.a = L2.a = L3.a = L4.a = L5.a = L6.a = L7.a = L8.a = L9.a = L10.a = L11.a = L12.a = L13.a = L14.a = L15.a = L16.a = L17.a = L18.a = 'Z'; + + L2.b = L3.b = L4.b = L5.b = L6.b = L7.b = L8.b = L9.b = L10.b = L11.b = L12.b = L13.b = L14.b = L15.b = L16.b = L17.b = L18.b = 'Z'; + + L3.c = L4.c = L5.c = L6.c = L7.c = L8.c = L9.c = L10.c = L11.c = L12.c = L13.c = L14.c = L15.c = L16.c = L17.c = L18.c = 'Z'; + + L4.d = L5.d = L6.d = L7.d = L8.d = L9.d = L10.d = L11.d = L12.d = L13.d = L14.d = L15.d = L16.d = L17.d = L18.d = 'Z'; + + L5.e = L6.e = L7.e = L8.e = L9.e = L10.e = L11.e = L12.e = L13.e = L14.e = L15.e = L16.e = L17.e = L18.e = 'Z'; + + L6.f = L7.f = L8.f = L9.f = L10.f = L11.f = L12.f = L13.f = L14.f = L15.f = L16.f = L17.f = L18.f = 'Z'; + + L7.g = L8.g = L9.g = L10.g = L11.g = L12.g = L13.g = L14.g = L15.g = L16.g = L17.g = L18.g = 'Z'; + + L8.h = L9.h = L10.h = L11.h = L12.h = L13.h = L14.h = L15.h = L16.h = L17.h = L18.h = 'Z'; + + L9.i = L10.i = L11.i = L12.i = L13.i = L14.i = L15.i = L16.i = L17.i = L18.i = 'Z'; + + L10.j = L11.j = L12.j = L13.j = L14.j = L15.j = L16.j = L17.j = L18.j = 'Z'; + + L11.k = L12.k = L13.k = L14.k = L15.k = L16.k = L17.k = L18.k = 'Z'; + + L12.l = L13.l = L14.l = L15.l = L16.l = L17.l = L18.l = 'Z'; + + L13.m = L14.m = L15.m = L16.m = L17.m = L18.m = 'Z'; + + L14.n = L15.n = L16.n = L17.n = L18.n = 'Z'; + + L15.o = L16.o = L17.o = L18.o = 'Z'; + + L16.p = L17.p = L18.p = 'Z'; + + L17.q = L18.q = 'Z'; + + L18.r = 'Z'; +} int main() { @@ -226,24 +406,7 @@ int main() set_debug_traps(); breakpoint(); #endif - - /* TEST C FUNCTIONS */ - L1 = fun1(); - L2 = fun2(); - L3 = fun3(); - L4 = fun4(); - L5 = fun5(); - L6 = fun6(); - L7 = fun7(); - L8 = fun8(); - L9 = fun9(); - L10 = fun10(); - L11 = fun11(); - L12 = fun12(); - L16 = fun16(); - - foo1.a = foo2.a = foo3.a = foo4.a = foo5.a = foo6.a = foo7.a = foo8.a = - foo9.a = foo10.a = foo11.a = foo12.a = foo16.a = '$'; + int i; Fun1(foo1); Fun2(foo2); @@ -257,7 +420,40 @@ int main() Fun10(foo10); Fun11(foo11); Fun12(foo12); + Fun13(foo13); + Fun14(foo14); + Fun15(foo15); Fun16(foo16); + Fun17(foo17); + Fun18(foo18); + + /* An infinite loop that first clears all the variables and then + calls each function. This "hack" is to make testing random + functions easier - "advance funN" is guaranteed to have always + been preceeded by a global variable clearing zed call. */ + + while (1) + { + zed (); + L1 = fun1(); + L2 = fun2(); + L3 = fun3(); + L4 = fun4(); + L5 = fun5(); + L6 = fun6(); + L7 = fun7(); + L8 = fun8(); + L9 = fun9(); + L10 = fun10(); + L11 = fun11(); + L12 = fun12(); + L13 = fun13(); + L14 = fun14(); + L15 = fun15(); + L16 = fun16(); + L17 = fun17(); + L18 = fun18(); + } return 0; } diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp index ed91c86..7ff54c9 100644 --- a/gdb/testsuite/gdb.base/structs.exp +++ b/gdb/testsuite/gdb.base/structs.exp @@ -1,4 +1,6 @@ -# Copyright 1996, 1997, 1999 Free Software Foundation, Inc. +# This testcase is part of GDB, the GNU debugger. + +# Copyright 1996, 1997, 1999, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,8 +19,6 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu -# This file was written by Jeff Law. (law@cygnus.com) - if $tracelevel then { strace $tracelevel } @@ -26,142 +26,642 @@ if $tracelevel then { set prms_id 0 set bug_id 0 -set prototypes 1 +# Some targets can't call functions, so don't even bother with this +# test. + +if [target_info exists gdb,cannot_call_functions] { + setup_xfail "*-*-*" + fail "This target can not call functions" + continue +} + set testfile "structs" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} -# build the first test case -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - # built the second test case since we can't use prototypes - warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES" -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DNO_PROTOTYPES}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." - } - set prototypes 0 -} +# Create and source the file that provides information about the +# compiler used to compile the test case. -# Create and source the file that provides information about the compiler -# used to compile the test case. if [get_compiler_info ${binfile}] { return -1; } +# Compile a variant of structs.c using TYPES to specify the type of +# the first N struct elements (the remaining elements take the type of +# the last TYPES field). Run the compmiled program up to "main". +# Also updates the global "testfile" to reflect the most recent build. -# Some targets can't call functions, so don't even bother with this -# test. -if [target_info exists gdb,cannot_call_functions] { - setup_xfail "*-*-*" 2416 - fail "This target can not call functions" - continue +proc start_structs_test { types } { + global testfile + global srcfile + global binfile + global objdir + global subdir + global srcdir + global gdb_prompt + + # Create the additional flags + set flags "debug" + set testfile "structs" + set n 0 + for {set n 0} {$n<[llength ${types}]} {incr n} { + set m [I2A ${n}] + set t [lindex ${types} $n] + lappend flags "additional_flags=-Dt${m}=${t}" + append testfile "-" "$t" + } + + set binfile ${objdir}/${subdir}/${testfile} + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags}"] != "" } { + # built the second test case since we can't use prototypes + warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES" + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags} additional_flags=-DNO_PROTOTYPES"] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." + } + } + + # Start with a fresh gdb. + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load ${binfile} + + # Make certain that the output is consistent + gdb_test "set print sevenbit-strings" "" \ + "set print sevenbit-strings; ${testfile}" + gdb_test "set print address off" "" \ + "set print address off; ${testfile}" + gdb_test "set width 0" "" \ + "set width 0; ${testfile}" + + # Advance to main + if { ![runto_main] } then { + gdb_suppress_tests; + } + + # Get the debug format + get_debug_format + + # check that at the struct containing all the relevant types is correct + set foo_t "type = struct struct[llength ${types}] \{" + for {set n 0} {$n<[llength ${types}]} {incr n} { + append foo_t "\[\r\n \]+[lindex ${types} $n] [i2a $n];" + } + append foo_t "\[\r\n \]+\}" + gdb_test "ptype foo[llength ${types}]" "${foo_t}" \ + "ptype foo[llength ${types}]; ${testfile}" } +# The expected value for fun${n}, L${n} and foo${n}. First element is +# empty to make indexing easier. "foo" returns the modified value, +# "zed" returns the invalid value. -# Call FUNC with no arguments, and expect to see the regexp RESULT in -# the output. If we get back the error message "Function return value -# unknown", call that an unsupported test; on some architectures, it's -# impossible to find structs returned by value reliably. -proc call_struct_func { func result } { - global gdb_prompt - - set command "p ${func}()" - send_gdb "${command}\n" - gdb_expect { - -re "$result\[\r\n\]+$gdb_prompt $" { - pass "$command" - } - -re "Function return value unknown.\[\r\n\]+$gdb_prompt $" { - unsupported "$command" - } - -re "$gdb_prompt $" { - fail "$command" - } - timeout { - fail "$command (timeout)" - } +proc foo { n } { + return [lindex { + "{}" + "{a = 49 '1'}" + "{a = 97 'a', b = 50 '2'}" + "{a = 49 '1', b = 98 'b', c = 51 '3'}" + "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4'}" + "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5'}" + "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4', e = 101 'e', f = 54 '6'}" + "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5', f = 102 'f', g = 55 '7'}" + "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4', e = 101 'e', f = 54 '6', g = 103 'g', h = 56 '8'}" + "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5', f = 102 'f', g = 55 '7', h = 104 'h', i = 57 '9'}" + "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4', e = 101 'e', f = 54 '6', g = 103 'g', h = 56 '8', i = 105 'i', j = 65 'A'}" + "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5', f = 102 'f', g = 55 '7', h = 104 'h', i = 57 '9', j = 106 'j', k = 66 'B'}" + "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4', e = 101 'e', f = 54 '6', g = 103 'g', h = 56 '8', i = 105 'i', j = 65 'A', k = 107 'k', l = 67 'C'}" + "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5', f = 102 'f', g = 55 '7', h = 104 'h', i = 57 '9', j = 106 'j', k = 66 'B', l = 108 'l', m = 68 'D'}" + "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4', e = 101 'e', f = 54 '6', g = 103 'g', h = 56 '8', i = 105 'i', j = 65 'A', k = 107 'k', l = 67 'C', m = 109 'm', n = 69 'E'}" + "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5', f = 102 'f', g = 55 '7', h = 104 'h', i = 57 '9', j = 106 'j', k = 66 'B', l = 108 'l', m = 68 'D', n = 110 'n', o = 70 'F'}" + "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4', e = 101 'e', f = 54 '6', g = 103 'g', h = 56 '8', i = 105 'i', j = 65 'A', k = 107 'k', l = 67 'C', m = 109 'm', n = 69 'E', o = 111 'o', p = 71 'G'}" + "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5', f = 102 'f', g = 55 '7', h = 104 'h', i = 57 '9', j = 106 'j', k = 66 'B', l = 108 'l', m = 68 'D', n = 110 'n', o = 70 'F', p = 112 'p', q = 72 'H'}" + } $n] +} + +proc zed { n } { + return [lindex { + "{}" + "{a = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z', l = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z', l = 90 'Z', m = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z', l = 90 'Z', m = 90 'Z', n = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z', l = 90 'Z', m = 90 'Z', n = 90 'Z', o = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z', l = 90 'Z', m = 90 'Z', n = 90 'Z', o = 90 'Z', p = 90 'Z'}" + "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z', l = 90 'Z', m = 90 'Z', n = 90 'Z', o = 90 'Z', p = 90 'Z', q = 90 'Z'}" + } $n] +} + +# Given N (0..25), return the corresponding alphabetic letter in lower +# or upper case. This is ment to be i18n proof. + +proc i2a { n } { + return [string range "abcdefghijklmnopqrstuvwxyz" $n $n] +} + +proc I2A { n } { + return [string toupper [i2a $n]] +} + + +# Use the file name, compiler and tuples to set up any needed KFAILs. + +proc setup_kfails { file tuples bug } { + global testfile + if [string match $file $testfile] { + foreach f $tuples { setup_kfail $f $bug } + } +} + +proc setup_compiler_kfails { file compiler format tuples bug } { + global testfile + if {[string match $file $testfile] && [test_compiler_info $compiler] && [test_debug_format $format]} { + foreach f $tuples { setup_kfail $f $bug } } } -# FIXME: Before calling this proc, we should probably verify that -# we can call inferior functions and get a valid integral value -# returned. -# Note that it is OK to check for 0 or 1 as the returned values, because C -# specifies that the numeric value of a relational or logical expression -# (computed in the inferior) is 1 for true and 0 for false. +# Test GDB's ability to make inferior function calls to functions +# returning (or passing in a single structs. -proc do_function_calls {} { - global prototypes - global gcc_compiled +# N identifies the number of elements in the struct that will be used +# for the test case. FAILS is a list of target tuples that will fail +# this test. + +# start_structs_test() will have previously built a program with a +# specified combination of types for those elements. To ensure +# robustness of the output, "p/c" is used. + +# This tests the code paths "which return-value convention?" and +# "extract return-value from registers" called by "infcall.c". + +proc test_struct_calls { n } { + global testfile global gdb_prompt - # First, call the "fun" functions and examine the value they return. - call_struct_func "fun1" " = {a = 49 '1'}" - call_struct_func "fun2" " = {a = 97 'a', b = 98 'b'}" - call_struct_func "fun3" " = {a = 65 'A', b = 66 'B', c = 67 'C'}" - call_struct_func "fun4" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4'}" - call_struct_func "fun5" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e'}" - call_struct_func "fun6" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F'}" - call_struct_func "fun7" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7'}" - call_struct_func "fun8" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8'}" - call_struct_func "fun9" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i'}" - call_struct_func "fun10" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J'}" - call_struct_func "fun11" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8', i = 57 '9', j = 65 'A', k = 66 'B'}" - call_struct_func "fun12" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J', k = 75 'K', l = 76 'L'}" - call_struct_func "fun16" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i', j = 106 'j', k = 107 'k', l = 108 'l', m = 109 'm', n = 110 'n', o = 111 'o', p = 112 'p'}" - - # Now call the Fun functions to set the L* variables. This - # tests that gdb properly passes structures to functions. - gdb_test "p Fun1(foo1)" " = (void|0)" - gdb_test "p Fun2(foo2)" " = (void|0)" - gdb_test "p Fun3(foo3)" " = (void|0)" - gdb_test "p Fun4(foo4)" " = (void|0)" - gdb_test "p Fun5(foo5)" " = (void|0)" - gdb_test "p Fun6(foo6)" " = (void|0)" - gdb_test "p Fun7(foo7)" " = (void|0)" - gdb_test "p Fun8(foo8)" " = (void|0)" - gdb_test "p Fun9(foo9)" " = (void|0)" - gdb_test "p Fun10(foo10)" " = (void|0)" - gdb_test "p Fun11(foo11)" " = (void|0)" - gdb_test "p Fun12(foo12)" " = (void|0)" - gdb_test "p Fun16(foo16)" " = (void|0)" - - # Now print the L* variables and examine their values. - gdb_test "p L1" " = {a = 49 '1'}" - gdb_test "p L2" " = {a = 97 'a', b = 98 'b'}" - gdb_test "p L3" " = {a = 65 'A', b = 66 'B', c = 67 'C'}" - gdb_test "p L4" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4'}" - gdb_test "p L5" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e'}" - gdb_test "p L6" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F'}" - gdb_test "p L7" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7'}" - gdb_test "p L8" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8'}" - gdb_test "p L9" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i'}" - gdb_test "p L10" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J'}" - gdb_test "p L11" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8', i = 57 '9', j = 65 'A', k = 66 'B'}" - gdb_test "p L12" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J', k = 75 'K', l = 76 'L'}" - gdb_test "p L16" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i', j = 106 'j', k = 107 'k', l = 108 'l', m = 109 'm', n = 110 'n', o = 111 'o', p = 112 'p'}" -} -# Start with a fresh gdb. + # Check that GDB can always extract a struct-return value from an + # inferior function call. Since GDB always knows the location of an + # inferior function call's return value these should never fail + + # Implemented by calling the parameterless function "fun$N" and then + # examining the return value printed by GDB. -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} + set tests "call $n ${testfile}" -gdb_test "set print sevenbit-strings" "" -gdb_test "set print address off" "" -gdb_test "set width 0" "" + # Call fun${n}, checking the printed return-value. + setup_kfails structs-*tld* i*86-*-* gdb/1447 + setup_compiler_kfails structs-tc-* gcc-3-3 "DWARF 2" i*86-*-* gdb/1455 + gdb_test "p/c fun${n}()" "[foo ${n}]" "p/c fun<n>(); ${tests}" -if [target_info exists gdb,cannot_call_functions] { - setup_xfail "*-*-*" 2416 - fail "This target can not call functions" - return 0 + # Check that GDB can always pass a structure to an inferior function. + # This test can never fail. + + # Implemented by calling the one parameter function "Fun$N" which + # stores its parameter in the global variable "L$N". GDB then + # examining that global to confirm that the value is as expected. + + gdb_test "call Fun${n}(foo${n})" "" "call Fun<n>(foo<n>); ${tests}" + setup_kfails structs-*tld* i*86-*-* gdb/1447 + setup_compiler_kfails structs-tc-* gcc-3-3 "DWARF 2" i*86-*-* gdb/1455 + gdb_test "p/c L${n}" [foo ${n}] "p/c L<n>; ${tests}" } -if { ![runto_main] } then { - gdb_suppress_tests; +# Test GDB's ability to both return a function (with "return" or +# "finish") and correctly extract/store any corresponding +# return-value. + +# Check that GDB can consistently extract/store structure return +# values. There are two cases - returned in registers and returned in +# memory. For the latter case, the return value can't be found and a +# failure is "expected". However GDB must still both return the +# function and display the final source and line information. + +# N identifies the number of elements in the struct that will be used +# for the test case. FAILS is a list of target tuples that will fail +# this test. + +# This tests the code paths "which return-value convention?", "extract +# return-value from registers", and "store return-value in registers". +# Unlike "test struct calls", this test is expected to "fail" when the +# return-value is in memory (GDB can't find the location). The test +# is in three parts: test "return"; test "finish"; check that the two +# are consistent. GDB can sometimes work for one command and not the +# other. + +proc test_struct_returns { n } { + global gdb_prompt + global testfile + + set tests "return $n ${testfile}" + + + # Check that "return" works. + + # GDB must always force the return of a function that has + # a struct result. Dependant on the ABI, it may, or may not be + # possible to store the return value in a register. + + # The relevant code looks like "L{n} = fun{n}()". The test forces + # "fun{n}" to "return" with an explicit value. Since that code + # snippet will store the the returned value in "L{n}" the return + # is tested by examining "L{n}". This assumes that the + # compiler implemented this as fun{n}(&L{n}) and hence that when + # the value isn't stored "L{n}" remains unchanged. Also check for + # consistency between this and the "finish" case. + + # Get into a call of fun${n} + gdb_test "advance fun${n}" \ + "fun${n} .*\[\r\n\]+\[0-9\].*return foo${n}.*" \ + "advance to fun<n> for return; ${tests}" + + # Check that the program invalidated the relevant global. + setup_kfails structs-tld i*86-*-* gdb/1447 + gdb_test "p/c L${n}" " = [zed $n]" "zed L<n> for return; ${tests} .${testfile}." + + # Force the "return". This checks that the return is always + # performed, and that GDB correctly reported this to the user. + # GDB 6.0 and earlier, when the return-value's location wasn't + # known, both failed to print a final "source and line" and misplaced + # the frame ("No frame"). + + # The test is writen so that it only reports one FAIL/PASS for the + # entire operation. The value returned is checked further down. + # "return_value_unknown", if non-empty, records why GDB realised + # that it didn't know where the return value was. + + set test "return foo<n>; ${tests}" + set return_value_unknown 0 + set return_value_unimplemented 0 + gdb_test_multiple "return foo${n}" "${test}" { + -re "The location" { + # Ulgh, a struct return, remember this (still need prompt). + set return_value_unknown 1 + exp_continue + } + -re "A structure or union" { + # Ulgh, a struct return, remember this (still need prompt). + set return_value_unknown 1 + # Double ulgh. Architecture doesn't use return_value and + # hence hasn't implemented small structure return. + set return_value_unimplemented 1 + exp_continue + } + -re "Make fun${n} return now.*y or n. $" { + gdb_test_multiple "y" "${test}" { + -re "L${n} *= fun${n}.*${gdb_prompt} $" { + # Need to step off the function call + gdb_test "next" "L.* *= fun.*" "${test}" + } + -re "L[expr ${n} + 1] *= fun[expr ${n} + 1].*${gdb_prompt} $" { + pass "${test}" + } + } + } + } + + # Check that the return-value is as expected. At this stage we're + # just checking that GDB has returned a value consistent with + # "return_value_unknown" set above. + + set test "value foo<n> returned; ${tests}" + setup_kfails structs-*tld* i*86-*-* gdb/1447 + gdb_test_multiple "p/c L${n}" "${test}" { + -re " = [foo ${n}].*${gdb_prompt} $" { + if $return_value_unknown { + # This contradicts the above claim that GDB didn't + # know the location of the return-value. + fail "${test}" + } else { + pass "${test}" + } + } + -re " = [zed ${n}].*${gdb_prompt} $" { + if $return_value_unknown { + # The struct return case. Since any modification + # would be by reference, and that can't happen, the + # value should be unmodified and hence Z is expected. + # Is this a reasonable assumption? + pass "${test}" + } else { + # This contradicts the above claim that GDB knew + # the location of the return-value. + fail "${test}" + } + } + -re ".*${gdb_prompt} $" { + if $return_value_unimplemented { + # What a suprize. The architecture hasn't implemented + # return_value, and hence has to fail. + kfail "$test" gdb/1444 + } else { + fail "$test" + } + } + } + + # Check that a "finish" works. + + # This is almost but not quite the same as "call struct funcs". + # Architectures can have subtle differences in the two code paths. + + # The relevant code snippet is "L{n} = fun{n}()". The program is + # advanced into a call to "fun{n}" and then that function is + # finished. The returned value that GDB prints, reformatted using + # "p/c", is checked. + + # Get into "fun${n}()". + gdb_test "advance fun${n}" \ + "fun${n} .*\[\r\n\]+\[0-9\].*return foo${n}.*" \ + "advance to fun<n> for finish; ${tests}" + + # Check that the program invalidated the relevant global. + setup_kfails structs-tld i*86-*-* gdb/1447 + gdb_test "p/c L${n}" " = [zed $n]" "zed L<n> for finish; ${tests}" + + # Finish the function, set 'finish_value_unknown" to non-empty if the + # return-value was not found. + set test "finish foo<n>; ${tests}" + set finish_value_unknown 0 + gdb_test_multiple "finish" "${test}" { + -re "Value returned is .*${gdb_prompt} $" { + pass "${test}" + } + -re "Cannot determine contents.*${gdb_prompt} $" { + # Expected bad value. For the moment this is ok. + set finish_value_unknown 1 + pass "${test}" + } + } + + # Re-print the last (return-value) using the more robust + # "p/c". If no return value was found, the 'Z' from the previous + # check that the variable was cleared, is printed. + set test "value foo<n> finished; ${tests}" + setup_kfails structs-*tld* i*86-*-* gdb/1447 + gdb_test_multiple "p/c" "${test}" { + -re "[foo ${n}]\[\r\n\]+${gdb_prompt} $" { + if $finish_value_unknown { + # This contradicts the above claim that GDB didn't + # know the location of the return-value. + fail "${test}" + } else { + pass "${test}" + } + } + -re "[zed ${n}]\[\r\n\]+${gdb_prompt} $" { + # The value didn't get found. This is "expected". + if $finish_value_unknown { + pass "${test}" + } else { + # This contradicts the above claim that GDB did + # know the location of the return-value. + fail "${test}" + } + } + } + + # Finally, check that "return" and finish" have consistent + # behavior. + + # Since both "return" and "finish" use equivalent "which + # return-value convention" logic, both commands should have + # identical can/can-not find return-value messages. + + # Note that since "call" and "finish" use common code paths, a + # failure here is a strong indicator of problems with "store + # return-value" code paths. Suggest looking at "return_value" + # when investigating a fix. + + set test "return and finish use same convention; ${tests}" + if {$finish_value_unknown == $return_value_unknown} { + pass "${test}" + } else { + kfail gdb/1444 "${test}" + } } -do_function_calls; +# ABIs pass anything >8 or >16 bytes in memory but below that things +# randomly use register and/and structure conventions. Check all +# possible sized char structs in that range. But only a restricted +# range of the other types. + +# NetBSD/PPC returns "unnatural" (3, 5, 6, 7) sized structs in memory. + +# d10v is weird. 5/6 byte structs go in memory. 2 or more char +# structs go in memory. Everything else is in a register! + +# Test every single char struct from 1..17 in size. This is what the +# original "structs" test was doing. + +start_structs_test { tc } +test_struct_calls 1 +test_struct_calls 2 +test_struct_calls 3 +test_struct_calls 4 +test_struct_calls 5 +test_struct_calls 6 +test_struct_calls 7 +test_struct_calls 8 +test_struct_calls 9 +test_struct_calls 10 +test_struct_calls 11 +test_struct_calls 12 +test_struct_calls 13 +test_struct_calls 14 +test_struct_calls 15 +test_struct_calls 16 +test_struct_calls 17 +test_struct_returns 1 +test_struct_returns 2 +test_struct_returns 3 +test_struct_returns 4 +test_struct_returns 5 +test_struct_returns 6 +test_struct_returns 7 +test_struct_returns 8 + + +# Let the fun begin. + +# Assuming that any integer struct larger than 8 bytes goes in memory, +# come up with many and varied combinations of a return struct. For +# "struct calls" test just beyond that 8 byte boundary, for "struct +# returns" test up to that boundary. + +# For floats, assumed that up to two struct elements can be stored in +# floating point registers, regardless of their size. + +# The approx size of each structure it is computed assumed that tc=1, +# ts=2, ti=4, tl=4, tll=8, tf=4, td=8, tld=16, and that all fields are +# naturally aligned. Padding being added where needed. Note that +# these numbers are just approx, the d10v has ti=2, a 64-bit has has +# tl=8. + +# Approx size: 2, 4, ... +start_structs_test { ts } +test_struct_calls 1 +test_struct_calls 2 +test_struct_calls 3 +test_struct_calls 4 +test_struct_calls 5 +test_struct_returns 1 +test_struct_returns 2 +test_struct_returns 3 +test_struct_returns 4 + +# Approx size: 4, 8, ... +start_structs_test { ti } +test_struct_calls 1 +test_struct_calls 2 +test_struct_calls 3 +test_struct_returns 1 +test_struct_returns 2 + +# Approx size: 4, 8, ... +start_structs_test { tl } +test_struct_calls 1 +test_struct_calls 2 +test_struct_calls 3 +test_struct_returns 1 +test_struct_returns 2 + +# Approx size: 8, 16, ... +start_structs_test { tll } +test_struct_calls 1 +test_struct_calls 2 +test_struct_returns 1 + +# Approx size: 4, 8, ... +start_structs_test { tf } +test_struct_calls 1 +test_struct_calls 2 +test_struct_calls 3 +test_struct_returns 1 +test_struct_returns 2 + +# Approx size: 8, 16, ... +start_structs_test { td } +test_struct_calls 1 +test_struct_calls 2 +test_struct_returns 1 + +# Approx size: 16, 32, ... +start_structs_test { tld } +test_struct_calls 1 +test_struct_calls 2 +test_struct_returns 1 + +# Approx size: 2+1=3, 4, ... +start_structs_test { ts tc } +test_struct_calls 2 +test_struct_calls 3 +test_struct_calls 4 +test_struct_calls 5 +test_struct_calls 6 +test_struct_calls 7 +test_struct_calls 8 +test_struct_returns 2 + +# Approx size: 4+1=5, 6, ... +start_structs_test { ti tc } +test_struct_calls 2 +test_struct_calls 3 +test_struct_calls 4 +test_struct_calls 5 +test_struct_calls 6 +test_struct_returns 2 + +# Approx size: 4+1=5, 6, ... +start_structs_test { tl tc } +test_struct_calls 2 +test_struct_calls 3 +test_struct_calls 4 +test_struct_calls 5 +test_struct_calls 6 +test_struct_returns 2 + +# Approx size: 8+1=9, 10, ... +start_structs_test { tll tc } +test_struct_calls 2 + +# Approx size: 4+1=5, 6, ... +start_structs_test { tf tc } +test_struct_calls 2 +test_struct_calls 3 +test_struct_calls 4 +test_struct_calls 5 +test_struct_calls 6 +test_struct_returns 2 + +# Approx size: 8+1=9, 10, ... +start_structs_test { td tc } +test_struct_calls 2 + +# Approx size: 16+1=17, 18, ... +start_structs_test { tld tc } +test_struct_calls 2 + +# Approx size: (1+1)+2=4, 6, ... +start_structs_test { tc ts } +test_struct_calls 2 +test_struct_calls 3 +test_struct_calls 4 +test_struct_calls 5 +test_struct_calls 6 +test_struct_returns 2 + +# Approx size: (1+3)+4=8, 12, ... +start_structs_test { tc ti } +test_struct_calls 2 +test_struct_calls 3 +test_struct_calls 4 +test_struct_returns 2 + +# Approx size: (1+3)+4=8, 12, ... +start_structs_test { tc tl } +test_struct_calls 2 +test_struct_calls 3 +test_struct_calls 4 +test_struct_returns 2 + +# Approx size: (1+7)+8=16, 24, ... +start_structs_test { tc tll } +test_struct_calls 2 + +# Approx size: (1+3)+4=8, 12, ... +start_structs_test { tc tf } +test_struct_calls 2 +test_struct_calls 3 +test_struct_calls 4 + +# Approx size: (1+7)+8=16, 24, ... +start_structs_test { tc td } +test_struct_calls 2 + +# Approx size: (1+15)+16=32, 48, ... +start_structs_test { tc tld } +test_struct_calls 2 + +# Some float combinations + +# Approx size: 8+4=12, 16, ... +# d10v: 4+4=8, 12, ... +start_structs_test { td tf } +test_struct_calls 2 +test_struct_returns 2 -gdb_stop_suppressing_tests; +# Approx size: (4+4)+8=16, 32, ... +# d10v: 4+4=8, 12, ... +start_structs_test { tf td } +test_struct_calls 2 +test_struct_returns 2 return 0 diff --git a/gdb/testsuite/gdb.base/until.exp b/gdb/testsuite/gdb.base/until.exp index f646c6d..033005d 100644 --- a/gdb/testsuite/gdb.base/until.exp +++ b/gdb/testsuite/gdb.base/until.exp @@ -23,13 +23,21 @@ if $tracelevel then { strace $tracelevel } -set testfile break +set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -remote_exec build "rm -f ${binfile}" -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } gdb_exit @@ -37,6 +45,11 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] +set bp_location19 [gdb_get_line_number "set breakpoint 19 here"] +set bp_location20 [gdb_get_line_number "set breakpoint 20 here"] +set bp_location21 [gdb_get_line_number "set breakpoint 21 here"] + if ![runto_main] then { fail "Can't run to main" return 0 @@ -45,8 +58,8 @@ if ![runto_main] then { # Verify that "until <location>" works. (This is really just syntactic # sugar for "tbreak <location>; continue".) # -gdb_test "until 79" \ - "main .* at .*:79.*" \ +gdb_test "until $bp_location1" \ + "main .* at .*:$bp_location1.*" \ "until line number" # Verify that a malformed "advance" is gracefully caught. @@ -62,8 +75,8 @@ delete_breakpoints # inner invocations of factorial() are completed and we are back at this # frame. # -gdb_test "until 99" \ - "factorial.*value=720.*at.*${srcfile}:99.*return \\(value\\)." \ +gdb_test "until $bp_location19" \ + "factorial.*value=720.*at.*${srcfile}:$bp_location19.*return \\(value\\).*" \ "until factorial, recursive function" # Run to a function called by main @@ -76,6 +89,6 @@ delete_breakpoints # stop at main, the caller, where we put the 'guard' breakpoint. # gdb_test "until marker3" \ - "($hex in |)main.*argc.*argv.*envp.*at.*${srcfile}:(82.*marker2 \\(43\\)|83.*marker3 \\(.stack., .trace.\\))." \ + "($hex in |)main.*argc.*argv.*envp.*at.*${srcfile}:($bp_location20.*marker2 \\(43\\)|$bp_location21.*marker3 \\(.stack., .trace.\\)).*" \ "until func, not called by current frame" diff --git a/gdb/testsuite/gdb.base/volatile.exp b/gdb/testsuite/gdb.base/volatile.exp index 7043696..faf62b9 100644 --- a/gdb/testsuite/gdb.base/volatile.exp +++ b/gdb/testsuite/gdb.base/volatile.exp @@ -88,9 +88,7 @@ if ![runto_main] then { get_debug_format proc local_compiler_xfail_check { } { - global gcc_compiled; - - if {$gcc_compiled == 2} then { + if { [test_compiler_info gcc-2-*] } then { if { ![test_debug_format "HP"] \ && ![test_debug_format "DWARF 2"] } then { setup_xfail "*-*-*" @@ -258,7 +256,7 @@ gdb_test "ptype vendor" "type = const volatile unsigned char \\* const volatile. # test function parameters local_compiler_xfail_check -if {$gcc_compiled == 3 && [test_debug_format "stabs"]} then { +if { [test_compiler_info gcc-3-*] && [test_debug_format "stabs"] } then { # For reasons unknown, GCC 3 with stabs mangles several cv-qualified # arguments to this function. setup_xfail "*-*-*" diff --git a/gdb/testsuite/gdb.cp/ambiguous.exp b/gdb/testsuite/gdb.cp/ambiguous.exp index 4224b2d..6385dcb 100644 --- a/gdb/testsuite/gdb.cp/ambiguous.exp +++ b/gdb/testsuite/gdb.cp/ambiguous.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -45,7 +45,7 @@ if [get_compiler_info ${binfile} "c++"] { return -1; } -if { $gcc_compiled } then { continue } +if { [test_compiler_info gcc-*] } then { continue } if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." diff --git a/gdb/testsuite/gdb.cp/ctti.exp b/gdb/testsuite/gdb.cp/ctti.exp index 96e9fcf..1bc005a 100644 --- a/gdb/testsuite/gdb.cp/ctti.exp +++ b/gdb/testsuite/gdb.cp/ctti.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999, 2001 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2001, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ if [get_compiler_info ${binfile} "c++"] { return -1; } -if { $gcc_compiled } then { continue } +if { [test_compiler_info gcc-*] } then { continue } #if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}" "${binfile}" executable {debug c++}] != "" } { # gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." diff --git a/gdb/testsuite/gdb.cp/derivation.exp b/gdb/testsuite/gdb.cp/derivation.exp index 38a46a2..39acf25 100644 --- a/gdb/testsuite/gdb.cp/derivation.exp +++ b/gdb/testsuite/gdb.cp/derivation.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -109,7 +109,7 @@ gdb_expect { timeout { fail "(timeout) print value of d_instance" } } - if {$gcc_compiled} then { + if { [test_compiler_info gcc-*] } then { send_gdb "ptype d_instance\n" gdb_expect { -re "type = class D : private A, public B, (protected|private) C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t ]+D & operator=\\(D const ?&\\);\[\r\n\t ]+D\\((D const|const D) ?&\\);\[\r\n\t \]+D\\((void|)\\);\r\n\[\t \]*int dfoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" } @@ -140,7 +140,7 @@ gdb_expect { timeout { fail "(timeout) print value of e_instance" } } - if {$gcc_compiled} { + if { [test_compiler_info gcc-*] } then { send_gdb "ptype e_instance\n" gdb_expect { -re "type = class E : public A, private B, (protected|private) C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t ]+E & operator=\\(E const ?&\\);\[\r\n\t ]+E\\((E const|const E) ?&\\);\[\r\n\t \]+E\\((void|)\\);\r\n\[\t \]*int efoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" } diff --git a/gdb/testsuite/gdb.cp/member-ptr.exp b/gdb/testsuite/gdb.cp/member-ptr.exp index f21cd15..8243785 100644 --- a/gdb/testsuite/gdb.cp/member-ptr.exp +++ b/gdb/testsuite/gdb.cp/member-ptr.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -54,7 +54,7 @@ if [get_compiler_info ${binfile} "c++"] { # Nearly all of these tests fail when compiled with G++, so just give up # until GDB gets enhanced. -sts 1999-06-22 -if {$gcc_compiled} { +if { [test_compiler_info gcc-*] } then { continue } diff --git a/gdb/testsuite/gdb.cp/method.exp b/gdb/testsuite/gdb.cp/method.exp index a085b14..729b930 100644 --- a/gdb/testsuite/gdb.cp/method.exp +++ b/gdb/testsuite/gdb.cp/method.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999, 2001, 2002 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -96,7 +96,7 @@ gdb_test "break A::bar" \ "Breakpoint \[0-9\]* at $hex.*file .*method.cc, line 44\\." gdb_test "continue" \ - "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, A::bar(\\(int\\) const|) \\(this=$hex, arg=15\\) at .*method\\.cc:44\r\n44\[\t \]*return arg \\+ 2 \\* x;" \ + "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, A::bar(|\\(int\\) const| const) \\(this=$hex, arg=15\\) at .*method\\.cc:44\r\n44\[\t \]*return arg \\+ 2 \\* x;" \ "continue to A::bar" # Check ability to access this-relative stuff. diff --git a/gdb/testsuite/gdb.cp/rtti.exp b/gdb/testsuite/gdb.cp/rtti.exp index 3eba24b..eaf1c17 100644 --- a/gdb/testsuite/gdb.cp/rtti.exp +++ b/gdb/testsuite/gdb.cp/rtti.exp @@ -82,6 +82,10 @@ gdb_breakpoint [gdb_get_line_number "constructs-done"] gdb_continue_to_breakpoint "end of constructors" gdb_test_multiple "print *e1" "print *e1" { + -re "warning: RTTI symbol not found for class 'n1::D1'.*$gdb_prompt $" { + # gdb HEAD 2003-12-05 + kfail "gdb/488" "print *e1" + } -re "warning: can't find class named `n1::D1', as given by C\\+\\+ RTTI.*$gdb_prompt $" { #kfail "gdb/488" "print *e1" fail "print *e1" @@ -102,6 +106,10 @@ gdb_test_multiple "print *e1" "print *e1" { # that fail branch to an xfail. gdb_test_multiple "print *e2" "print *e2" { + -re "warning: RTTI symbol not found for class 'n2::D2'.*$gdb_prompt $" { + # gdb HEAD 2003-12-05 + kfail "gdb/488" "print *e2" + } -re "warning: can't find class named `n2::D2', as given by C\\+\\+ RTTI.*$gdb_prompt $" { #kfail "gdb/488" "print *e2" fail "print *e2" diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp index 0b8357d..55fedd2 100644 --- a/gdb/testsuite/gdb.cp/templates.exp +++ b/gdb/testsuite/gdb.cp/templates.exp @@ -61,7 +61,7 @@ proc test_ptype_of_templates {} { -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5<int> & operator=\\(T5<int> const ?&\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\((T5<int> const|const T5<int>) ?&\\);)|(${ws}~T5\\((void|)\\);)|(${ws}static void \\* operator new\\(unsigned( int| long)?\\);)|(${ws}static void operator delete\\(void ?\\*\\);)|(${ws}int value\\((void|)\\);))*${ws}\}\r\n$gdb_prompt $" { pass "ptype T5<int> (obsolescent gcc or gdb)" } - -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned( long|)\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" { + -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned( int| long|)\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" { # This also triggers gdb/1113... kfail "gdb/1111" "ptype T5<int>" } @@ -87,7 +87,7 @@ proc test_ptype_of_templates {} { -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5<int> & operator=\\(T5<int> const ?&\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\(T5<int> const ?&\\);)|(${ws}~T5\\((void|)\\);)|(${ws}static void \\* operator new\\(unsigned( int| long)?\\);)|(${ws}static void operator delete\\(void ?\\*\\);)|(${ws}int value\\((void|)\\);))*${ws}\}\r\n$gdb_prompt $" { pass "ptype t5i (obsolescent gcc or gdb)" } - -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned( long|)\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" { + -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned( int| long|)\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" { # This also triggers gdb/1113... kfail "gdb/1111" "ptype T5<int>" } diff --git a/gdb/testsuite/gdb.cp/virtfunc.exp b/gdb/testsuite/gdb.cp/virtfunc.exp index dbd575c..ff36c27 100644 --- a/gdb/testsuite/gdb.cp/virtfunc.exp +++ b/gdb/testsuite/gdb.cp/virtfunc.exp @@ -734,7 +734,6 @@ proc test_virtual_calls {} { global gdb_prompt global GDB global nl - global gcc_compiled if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 diff --git a/gdb/testsuite/gdb.trace/configure b/gdb/testsuite/gdb.trace/configure deleted file mode 100755 index 4176205..0000000 --- a/gdb/testsuite/gdb.trace/configure +++ /dev/null @@ -1,899 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12.1 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12.1" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=collection.c - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - -CC=${CC-cc} - -ac_aux_dir= -for ac_dir in `cd $srcdir;pwd`/../../.. $srcdir/`cd $srcdir;pwd`/../../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in `cd $srcdir;pwd`/../../.. $srcdir/`cd $srcdir;pwd`/../../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - - -# Do some error checking and defaulting for the host and target type. -# The inputs are: -# configure --host=HOST --target=TARGET --build=BUILD NONOPT -# -# The rules are: -# 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. -# 2. Host defaults to nonopt. -# 3. If nonopt is not specified, then host defaults to the current host, -# as determined by config.guess. -# 4. Target and build default to nonopt. -# 5. If nonopt is not specified, then target and build default to host. - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -case $host---$target---$nonopt in -NONE---*---* | *---NONE---* | *---*---NONE) ;; -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; -esac - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:573: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:594: checking target system type" >&5 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$target" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:612: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -test "$host_alias" != "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12.1" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@CC@%$CC%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@target@%$target%g -s%@target_alias@%$target_alias%g -s%@target_cpu@%$target_cpu%g -s%@target_vendor@%$target_vendor%g -s%@target_os@%$target_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c index 8eb0d47..b0f557c 100644 --- a/gdb/testsuite/lib/compiler.c +++ b/gdb/testsuite/lib/compiler.c @@ -1,3 +1,24 @@ +/* This test file is part of GDB, the GNU debugger. + + Copyright 1995, 1997, 1999, 2003 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@prep.ai.mit.edu */ + /* Often the behavior of any particular test depends upon what compiler was used to compile the test. As each test is compiled, this file is preprocessed by the same compiler used to compile that specific test @@ -24,8 +45,10 @@ set signed_keyword_not_used 1 #if defined (__GNUC__) set gcc_compiled __GNUC__ +set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -] #else set gcc_compiled 0 +set compiler_info "" #endif return 0 diff --git a/gdb/testsuite/lib/compiler.cc b/gdb/testsuite/lib/compiler.cc index 5cb00f6..719b62b 100644 --- a/gdb/testsuite/lib/compiler.cc +++ b/gdb/testsuite/lib/compiler.cc @@ -1,3 +1,24 @@ +/* This test file is part of GDB, the GNU debugger. + + Copyright 1995, 1999, 2003 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@prep.ai.mit.edu */ + /* Often the behavior of any particular test depends upon what compiler was used to compile the test. As each test is compiled, this file is preprocessed by the same compiler used to compile that specific test @@ -27,8 +48,10 @@ set supports_template_debugging 0 #if defined (__GNUC__) set gcc_compiled __GNUC__ +set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -] #else set gcc_compiled 0 +set compiler_info "" #endif return 0 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index a16b0fa..136f68c 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -360,6 +360,57 @@ proc gdb_continue_to_breakpoint {name} { } +# gdb_internal_error_resync: +# +# Answer the questions GDB asks after it reports an internal error +# until we get back to a GDB prompt. Decline to quit the debugging +# session, and decline to create a core file. Return non-zero if the +# resync succeeds. +# +# This procedure just answers whatever questions come up until it sees +# a GDB prompt; it doesn't require you to have matched the input up to +# any specific point. However, it only answers questions it sees in +# the output itself, so if you've matched a question, you had better +# answer it yourself before calling this. +# +# You can use this function thus: +# +# gdb_expect { +# ... +# -re ".*A problem internal to GDB has been detected" { +# gdb_internal_error_resync +# } +# ... +# } +# +proc gdb_internal_error_resync {} { + global gdb_prompt + + set count 0 + while {$count < 10} { + gdb_expect { + -re "Quit this debugging session\\? \\(y or n\\) $" { + send_gdb "n\n" + incr count + } + -re "Create a core file of GDB\\? \\(y or n\\) $" { + send_gdb "n\n" + incr count + } + -re "$gdb_prompt $" { + # We're resynchronized. + return 1 + } + timeout { + perror "Could not resync from internal error (timeout)" + return 0 + } + } + } + perror "Could not resync from internal error (resync count exceeded)" + return 0 +} + # gdb_test_multiple COMMAND MESSAGE EXPECT_ARGUMENTS # Send a command to gdb; test the result. @@ -379,6 +430,20 @@ proc gdb_continue_to_breakpoint {name} { # 0 if only user-supplied patterns matched # -1 if there was an internal error. # +# You can use this function thus: +# +# gdb_test_multiple "print foo" "test foo" { +# -re "expected output 1" { +# pass "print foo" +# } +# -re "expected output 2" { +# fail "print foo" +# } +# } +# +# The standard patterns, such as "Program exited..." and "A problem +# ...", all being implicitly appended to that list. +# proc gdb_test_multiple { command message user_code } { global verbose global gdb_prompt @@ -511,6 +576,10 @@ proc gdb_test_multiple { command message user_code } { } set code { + -re ".*A problem internal to GDB has been detected" { + fail "$message (GDB internal error)" + gdb_internal_error_resync + } -re "\\*\\*\\* DOSEXIT code.*" { if { $message != "" } { fail "$message"; @@ -1025,6 +1094,9 @@ proc skip_hp_tests {} { return $skip_hp } +global compiler_info +set compiler_info unknown + proc get_compiler_info {binfile args} { # Create and source the file that provides information about the compiler # used to compile the test case. @@ -1034,6 +1106,7 @@ proc get_compiler_info {binfile args} { # These two come from compiler.c. global signed_keyword_not_used global gcc_compiled + global compiler_info if {![istarget "hppa*-*-hpux*"] && ![istarget "mips*-*-irix*"]} { if { [llength $args] > 0 } { @@ -1106,6 +1179,11 @@ proc get_compiler_info {binfile args} { return 0; } +proc test_compiler_info { compiler } { + global compiler_info + return [string match $compiler $compiler_info] +} + proc get_compiler {args} { global CC CC_FOR_TARGET CXX CXX_FOR_TARGET F77_FOR_TARGET diff --git a/gdb/thread-db.c b/gdb/thread-db.c index efd0d33..b135c39 100644 --- a/gdb/thread-db.c +++ b/gdb/thread-db.c @@ -240,7 +240,7 @@ thread_db_state_str (td_thr_state_e state) } /* A callback function for td_ta_thr_iter, which we use to map all - threads to LWPs. + threads to LWPs. THP is a handle to the current thread; if INFOP is not NULL, the struct thread_info associated with this thread is returned in @@ -465,6 +465,26 @@ thread_db_load (void) return 1; } +static td_err_e +enable_thread_event (td_thragent_t *thread_agent, int event, CORE_ADDR *bp) +{ + td_notify_t notify; + td_err_e err; + + /* Get the breakpoint address for thread EVENT. */ + err = td_ta_event_addr_p (thread_agent, event, ¬ify); + if (err != TD_OK) + return err; + + /* Set up the breakpoint. */ + (*bp) = gdbarch_convert_from_func_ptr_addr (current_gdbarch, + (CORE_ADDR) notify.u.bptaddr, + ¤t_target); + create_thread_event_breakpoint ((*bp)); + + return TD_OK; +} + static void enable_thread_event_reporting (void) { @@ -498,9 +518,11 @@ enable_thread_event_reporting (void) /* Delete previous thread event breakpoints, if any. */ remove_thread_event_breakpoints (); + td_create_bp_addr = 0; + td_death_bp_addr = 0; - /* Get address for thread creation breakpoint. */ - err = td_ta_event_addr_p (thread_agent, TD_CREATE, ¬ify); + /* Set up the thread creation event. */ + err = enable_thread_event (thread_agent, TD_CREATE, &td_create_bp_addr); if (err != TD_OK) { warning ("Unable to get location for thread creation breakpoint: %s", @@ -508,22 +530,14 @@ enable_thread_event_reporting (void) return; } - /* Set up the breakpoint. */ - td_create_bp_addr = (CORE_ADDR) notify.u.bptaddr; - create_thread_event_breakpoint (td_create_bp_addr); - - /* Get address for thread death breakpoint. */ - err = td_ta_event_addr_p (thread_agent, TD_DEATH, ¬ify); + /* Set up the thread death event. */ + err = enable_thread_event (thread_agent, TD_DEATH, &td_death_bp_addr); if (err != TD_OK) { warning ("Unable to get location for thread death breakpoint: %s", thread_db_err_str (err)); return; } - - /* Set up the breakpoint. */ - td_death_bp_addr = (CORE_ADDR) notify.u.bptaddr; - create_thread_event_breakpoint (td_death_bp_addr); } static void @@ -821,10 +835,10 @@ check_event (ptid_t ptid) was created and cannot specifically locate the event message for it. We have to call td_ta_event_getmsg() to get the latest message. Since we have no way of correlating whether - the event message we get back corresponds to our breakpoint, we must + the event message we get back corresponds to our breakpoint, we must loop and read all event messages, processing them appropriately. - This guarantees we will process the correct message before continuing - from the breakpoint. + This guarantees we will process the correct message before continuing + from the breakpoint. Currently, death events are not enabled. If they are enabled, the death event can use the td_thr_event_getmsg() interface to diff --git a/gdb/values.c b/gdb/values.c index 27524eb..1d72a72 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -1223,7 +1223,7 @@ register_value_being_returned (struct type *valtype, struct regcache *retbuf) struct value *val = allocate_value (valtype); /* If the function returns void, don't bother fetching the return - value. */ + value. See also "using_struct_return". */ if (TYPE_CODE (valtype) == TYPE_CODE_VOID) return val; @@ -1285,6 +1285,11 @@ using_struct_return (struct type *value_type, int gcc_p) if (code == TYPE_CODE_ERROR) error ("Function return type unknown."); + if (code == TYPE_CODE_VOID) + /* A void return value is never in memory. See also corresponding + code in "register_value_being_returned". */ + return 0; + if (!gdbarch_return_value_p (current_gdbarch)) { /* FIXME: cagney/2003-10-01: The below is dead. Instead an diff --git a/gdb/version.in b/gdb/version.in index 71700c2..a6451cd 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2003-11-11-cvs +2003-12-15-cvs diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 5e6a7e1..b4d590e 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -209,31 +209,25 @@ x86_64_convert_register_p (int regnum, struct type *type) } -/* The returning of values is done according to the special algorithm. - Some types are returned in registers an some (big structures) in - memory. See the System V psABI for details. */ +/* Register classes as defined in the psABI. */ -#define MAX_CLASSES 4 - -enum x86_64_reg_class +enum amd64_reg_class { - X86_64_NO_CLASS, - X86_64_INTEGER_CLASS, - X86_64_INTEGERSI_CLASS, - X86_64_SSE_CLASS, - X86_64_SSESF_CLASS, - X86_64_SSEDF_CLASS, - X86_64_SSEUP_CLASS, - X86_64_X87_CLASS, - X86_64_X87UP_CLASS, - X86_64_MEMORY_CLASS + AMD64_INTEGER, + AMD64_SSE, + AMD64_SSEUP, + AMD64_X87, + AMD64_X87UP, + AMD64_COMPLEX_X87, + AMD64_NO_CLASS, + AMD64_MEMORY }; -/* Return the union class of CLASS1 and CLASS2. - See the System V psABI for details. */ +/* Return the union class of CLASS1 and CLASS2. See the psABI for + details. */ -static enum x86_64_reg_class -merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2) +static enum amd64_reg_class +amd64_merge_classes (enum amd64_reg_class class1, enum amd64_reg_class class2) { /* Rule (a): If both classes are equal, this is the resulting class. */ if (class1 == class2) @@ -241,579 +235,361 @@ merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2) /* Rule (b): If one of the classes is NO_CLASS, the resulting class is the other class. */ - if (class1 == X86_64_NO_CLASS) + if (class1 == AMD64_NO_CLASS) return class2; - if (class2 == X86_64_NO_CLASS) + if (class2 == AMD64_NO_CLASS) return class1; /* Rule (c): If one of the classes is MEMORY, the result is MEMORY. */ - if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS) - return X86_64_MEMORY_CLASS; + if (class1 == AMD64_MEMORY || class2 == AMD64_MEMORY) + return AMD64_MEMORY; /* Rule (d): If one of the classes is INTEGER, the result is INTEGER. */ - if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS) - || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS)) - return X86_64_INTEGERSI_CLASS; - if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS - || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS) - return X86_64_INTEGER_CLASS; - - /* Rule (e): If one of the classes is X87 or X87UP class, MEMORY is - used as class. */ - if (class1 == X86_64_X87_CLASS || class1 == X86_64_X87UP_CLASS - || class2 == X86_64_X87_CLASS || class2 == X86_64_X87UP_CLASS) - return X86_64_MEMORY_CLASS; + if (class1 == AMD64_INTEGER || class2 == AMD64_INTEGER) + return AMD64_INTEGER; + + /* Rule (e): If one of the classes is X87, X87UP, COMPLEX_X87 class, + MEMORY is used as class. */ + if (class1 == AMD64_X87 || class1 == AMD64_X87UP + || class1 == AMD64_COMPLEX_X87 || class2 == AMD64_X87 + || class2 == AMD64_X87UP || class2 == AMD64_COMPLEX_X87) + return AMD64_MEMORY; /* Rule (f): Otherwise class SSE is used. */ - return X86_64_SSE_CLASS; + return AMD64_SSE; } -/* Classify the argument type. CLASSES will be filled by the register - class used to pass each word of the operand. The number of words - is returned. In case the parameter should be passed in memory, 0 - is returned. As a special case for zero sized containers, - classes[0] will be NO_CLASS and 1 is returned. +static void amd64_classify (struct type *type, enum amd64_reg_class class[2]); - See the System V psABI for details. */ +/* Classify TYPE according to the rules for aggregate (structures and + arrays) and union types, and store the result in CLASS. */ -static int -classify_argument (struct type *type, - enum x86_64_reg_class classes[MAX_CLASSES], int bit_offset) +static void +amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2]) { - int bytes = TYPE_LENGTH (type); - int words = (bytes + 8 - 1) / 8; + int len = TYPE_LENGTH (type); - switch (TYPE_CODE (type)) + /* 1. If the size of an object is larger than two eightbytes, or in + C++, is a non-POD structure or union type, or contains + unaligned fields, it has class memory. */ + if (len > 16) { - case TYPE_CODE_ARRAY: - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - { - int i; - enum x86_64_reg_class subclasses[MAX_CLASSES]; - - /* On x86-64 we pass structures larger than 16 bytes on the stack. */ - if (bytes > 16) - return 0; - - for (i = 0; i < words; i++) - classes[i] = X86_64_NO_CLASS; - - /* Zero sized arrays or structures are NO_CLASS. We return 0 - to signalize memory class, so handle it as special case. */ - if (!words) - { - classes[0] = X86_64_NO_CLASS; - return 1; - } - switch (TYPE_CODE (type)) - { - case TYPE_CODE_STRUCT: - { - int j; - for (j = 0; j < TYPE_NFIELDS (type); ++j) - { - int num = classify_argument (TYPE_FIELDS (type)[j].type, - subclasses, - (TYPE_FIELDS (type)[j].loc. - bitpos + bit_offset) % 256); - if (!num) - return 0; - for (i = 0; i < num; i++) - { - int pos = - (TYPE_FIELDS (type)[j].loc.bitpos + - bit_offset) / 8 / 8; - classes[i + pos] = - merge_classes (subclasses[i], classes[i + pos]); - } - } - } - break; - case TYPE_CODE_ARRAY: - { - int num; + class[0] = class[1] = AMD64_MEMORY; + return; + } - num = classify_argument (TYPE_TARGET_TYPE (type), - subclasses, bit_offset); - if (!num) - return 0; + /* 2. Both eightbytes get initialized to class NO_CLASS. */ + class[0] = class[1] = AMD64_NO_CLASS; - /* The partial classes are now full classes. */ - if (subclasses[0] == X86_64_SSESF_CLASS && bytes != 4) - subclasses[0] = X86_64_SSE_CLASS; - if (subclasses[0] == X86_64_INTEGERSI_CLASS && bytes != 4) - subclasses[0] = X86_64_INTEGER_CLASS; + /* 3. Each field of an object is classified recursively so that + always two fields are considered. The resulting class is + calculated according to the classes of the fields in the + eightbyte: */ - for (i = 0; i < words; i++) - classes[i] = subclasses[i % num]; - } - break; - case TYPE_CODE_UNION: - { - int j; - { - for (j = 0; j < TYPE_NFIELDS (type); ++j) - { - int num; - num = classify_argument (TYPE_FIELDS (type)[j].type, - subclasses, bit_offset); - if (!num) - return 0; - for (i = 0; i < num; i++) - classes[i] = merge_classes (subclasses[i], classes[i]); - } - } - } - break; - default: - break; - } - /* Final merger cleanup. */ - for (i = 0; i < words; i++) - { - /* If one class is MEMORY, everything should be passed in - memory. */ - if (classes[i] == X86_64_MEMORY_CLASS) - return 0; - - /* The X86_64_SSEUP_CLASS should be always preceeded by - X86_64_SSE_CLASS. */ - if (classes[i] == X86_64_SSEUP_CLASS - && (i == 0 || classes[i - 1] != X86_64_SSE_CLASS)) - classes[i] = X86_64_SSE_CLASS; - - /* X86_64_X87UP_CLASS should be preceeded by X86_64_X87_CLASS. */ - if (classes[i] == X86_64_X87UP_CLASS - && (i == 0 || classes[i - 1] != X86_64_X87_CLASS)) - classes[i] = X86_64_SSE_CLASS; - } - return words; - } - break; - case TYPE_CODE_FLT: - switch (bytes) - { - case 4: - if (!(bit_offset % 64)) - classes[0] = X86_64_SSESF_CLASS; - else - classes[0] = X86_64_SSE_CLASS; - return 1; - case 8: - classes[0] = X86_64_SSEDF_CLASS; - return 1; - case 16: - classes[0] = X86_64_X87_CLASS; - classes[1] = X86_64_X87UP_CLASS; - return 2; - } - break; - case TYPE_CODE_ENUM: - case TYPE_CODE_REF: - case TYPE_CODE_INT: - case TYPE_CODE_PTR: - switch (bytes) + if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + { + struct type *subtype = check_typedef (TYPE_TARGET_TYPE (type)); + + /* All fields in an array have the same type. */ + amd64_classify (subtype, class); + if (len > 8 && class[1] == AMD64_NO_CLASS) + class[1] = class[0]; + } + else + { + int i; + + /* Structure or union. */ + gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT + || TYPE_CODE (type) == TYPE_CODE_UNION); + + for (i = 0; i < TYPE_NFIELDS (type); i++) { - case 1: - case 2: - case 4: - case 8: - if (bytes * 8 + bit_offset <= 32) - classes[0] = X86_64_INTEGERSI_CLASS; - else - classes[0] = X86_64_INTEGER_CLASS; - return 1; - case 16: - classes[0] = classes[1] = X86_64_INTEGER_CLASS; - return 2; - default: - break; + struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); + int pos = TYPE_FIELD_BITPOS (type, i) / 64; + enum amd64_reg_class subclass[2]; + + gdb_assert (pos == 0 || pos == 1); + + amd64_classify (subtype, subclass); + class[pos] = amd64_merge_classes (class[pos], subclass[0]); + if (pos == 0) + class[1] = amd64_merge_classes (class[1], subclass[1]); } - case TYPE_CODE_VOID: - return 0; - default: /* Avoid warning. */ - break; } - internal_error (__FILE__, __LINE__, - "classify_argument: unknown argument type"); + + /* 4. Then a post merger cleanup is done: */ + + /* Rule (a): If one of the classes is MEMORY, the whole argument is + passed in memory. */ + if (class[0] == AMD64_MEMORY || class[1] == AMD64_MEMORY) + class[0] = class[1] = AMD64_MEMORY; + + /* Rule (b): If SSEUP is not preceeded by SSE, it is converted to + SSE. */ + if (class[0] == AMD64_SSEUP) + class[0] = AMD64_SSE; + if (class[1] == AMD64_SSEUP && class[0] != AMD64_SSE) + class[1] = AMD64_SSE; } -/* Examine the argument and set *INT_NREGS and *SSE_NREGS to the - number of registers required based on the information passed in - CLASSES. Return 0 if parameter should be passed in memory. */ +/* Classify TYPE, and store the result in CLASS. */ -static int -examine_argument (enum x86_64_reg_class classes[MAX_CLASSES], - int n, int *int_nregs, int *sse_nregs) +static void +amd64_classify (struct type *type, enum amd64_reg_class class[2]) { - *int_nregs = 0; - *sse_nregs = 0; - if (!n) - return 0; - for (n--; n >= 0; n--) - switch (classes[n]) - { - case X86_64_INTEGER_CLASS: - case X86_64_INTEGERSI_CLASS: - (*int_nregs)++; - break; - case X86_64_SSE_CLASS: - case X86_64_SSESF_CLASS: - case X86_64_SSEDF_CLASS: - (*sse_nregs)++; - break; - case X86_64_NO_CLASS: - case X86_64_SSEUP_CLASS: - case X86_64_X87_CLASS: - case X86_64_X87UP_CLASS: - break; - case X86_64_MEMORY_CLASS: - internal_error (__FILE__, __LINE__, - "examine_argument: unexpected memory class"); - } - return 1; + enum type_code code = TYPE_CODE (type); + int len = TYPE_LENGTH (type); + + class[0] = class[1] = AMD64_NO_CLASS; + + /* Arguments of types (signed and unsigned) _Bool, char, short, int, + long, long long, and pointers are in the INTEGER class. */ + if ((code == TYPE_CODE_INT || code == TYPE_CODE_ENUM + || code == TYPE_CODE_PTR || code == TYPE_CODE_REF) + && (len == 1 || len == 2 || len == 4 || len == 8)) + class[0] = AMD64_INTEGER; + + /* Arguments of types float, double and __m64 are in class SSE. */ + else if (code == TYPE_CODE_FLT && (len == 4 || len == 8)) + /* FIXME: __m64 . */ + class[0] = AMD64_SSE; + + /* Arguments of types __float128 and __m128 are split into two + halves. The least significant ones belong to class SSE, the most + significant one to class SSEUP. */ + /* FIXME: __float128, __m128. */ + + /* The 64-bit mantissa of arguments of type long double belongs to + class X87, the 16-bit exponent plus 6 bytes of padding belongs to + class X87UP. */ + else if (code == TYPE_CODE_FLT && len == 16) + /* Class X87 and X87UP. */ + class[0] = AMD64_X87, class[1] = AMD64_X87UP; + + /* Aggregates. */ + else if (code == TYPE_CODE_ARRAY || code == TYPE_CODE_STRUCT + || code == TYPE_CODE_UNION) + amd64_classify_aggregate (type, class); } -#define RET_INT_REGS 2 -#define RET_SSE_REGS 2 +static enum return_value_convention +amd64_return_value (struct gdbarch *gdbarch, struct type *type, + struct regcache *regcache, + void *readbuf, const void *writebuf) +{ + enum amd64_reg_class class[2]; + int len = TYPE_LENGTH (type); + static int integer_regnum[] = { X86_64_RAX_REGNUM, X86_64_RDX_REGNUM }; + static int sse_regnum[] = { X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM }; + int integer_reg = 0; + int sse_reg = 0; + int i; -/* Check if the structure in value_type is returned in registers or in - memory. If this function returns 1, GDB will call - STORE_STRUCT_RETURN and EXTRACT_STRUCT_VALUE_ADDRESS else - STORE_RETURN_VALUE and EXTRACT_RETURN_VALUE will be used. */ + gdb_assert (!(readbuf && writebuf)); -static int -x86_64_use_struct_convention (int gcc_p, struct type *value_type) -{ - enum x86_64_reg_class class[MAX_CLASSES]; - int n = classify_argument (value_type, class, 0); - int needed_intregs; - int needed_sseregs; - - return (!n || - !examine_argument (class, n, &needed_intregs, &needed_sseregs) || - needed_intregs > RET_INT_REGS || needed_sseregs > RET_SSE_REGS); -} + /* 1. Classify the return type with the classification algorithm. */ + amd64_classify (type, class); -/* Extract from an array REGBUF containing the (raw) register state, a - function return value of TYPE, and copy that, in virtual format, - into VALBUF. */ + /* 2. If the type has class MEMORY, then the caller provides space + for the return value and passes the address of this storage in + %rdi as if it were the first argument to the function. In + effect, this address becomes a hidden first argument. */ + if (class[0] == AMD64_MEMORY) + return RETURN_VALUE_STRUCT_CONVENTION; -static void -x86_64_extract_return_value (struct type *type, struct regcache *regcache, - void *valbuf) -{ - enum x86_64_reg_class class[MAX_CLASSES]; - int n = classify_argument (type, class, 0); - int needed_intregs; - int needed_sseregs; - int intreg = 0; - int ssereg = 0; - int offset = 0; - int ret_int_r[RET_INT_REGS] = { X86_64_RAX_REGNUM, X86_64_RDX_REGNUM }; - int ret_sse_r[RET_SSE_REGS] = { X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM }; - - if (!n || - !examine_argument (class, n, &needed_intregs, &needed_sseregs) || - needed_intregs > RET_INT_REGS || needed_sseregs > RET_SSE_REGS) - { /* memory class */ - CORE_ADDR addr; - regcache_cooked_read (regcache, X86_64_RAX_REGNUM, &addr); - read_memory (addr, valbuf, TYPE_LENGTH (type)); - return; - } - else + gdb_assert (class[1] != AMD64_MEMORY); + gdb_assert (len <= 16); + + for (i = 0; len > 0; i++, len -= 8) { - int i; - for (i = 0; i < n; i++) + int regnum = -1; + int offset = 0; + + switch (class[i]) { - switch (class[i]) - { - case X86_64_NO_CLASS: - break; - case X86_64_INTEGER_CLASS: - regcache_cooked_read (regcache, ret_int_r[(intreg + 1) / 2], - (char *) valbuf + offset); - offset += 8; - intreg += 2; - break; - case X86_64_INTEGERSI_CLASS: - regcache_cooked_read_part (regcache, ret_int_r[intreg / 2], - 0, 4, (char *) valbuf + offset); - offset += 8; - intreg++; - break; - case X86_64_SSEDF_CLASS: - case X86_64_SSESF_CLASS: - case X86_64_SSE_CLASS: - regcache_cooked_read_part (regcache, - ret_sse_r[(ssereg + 1) / 2], 0, 8, - (char *) valbuf + offset); - offset += 8; - ssereg += 2; - break; - case X86_64_SSEUP_CLASS: - regcache_cooked_read_part (regcache, ret_sse_r[ssereg / 2], - 0, 8, (char *) valbuf + offset); - offset += 8; - ssereg++; - break; - case X86_64_X87_CLASS: - regcache_cooked_read_part (regcache, X86_64_ST0_REGNUM, - 0, 8, (char *) valbuf + offset); - offset += 8; - break; - case X86_64_X87UP_CLASS: - regcache_cooked_read_part (regcache, X86_64_ST0_REGNUM, - 8, 2, (char *) valbuf + offset); - offset += 8; - break; - case X86_64_MEMORY_CLASS: - default: - internal_error (__FILE__, __LINE__, - "Unexpected argument class"); - } + case AMD64_INTEGER: + /* 3. If the class is INTEGER, the next available register + of the sequence %rax, %rdx is used. */ + regnum = integer_regnum[integer_reg++]; + break; + + case AMD64_SSE: + /* 4. If the class is SSE, the next available SSE register + of the sequence %xmm0, %xmm1 is used. */ + regnum = sse_regnum[sse_reg++]; + break; + + case AMD64_SSEUP: + /* 5. If the class is SSEUP, the eightbyte is passed in the + upper half of the last used SSE register. */ + gdb_assert (sse_reg > 0); + regnum = sse_regnum[sse_reg - 1]; + offset = 8; + break; + + case AMD64_X87: + /* 6. If the class is X87, the value is returned on the X87 + stack in %st0 as 80-bit x87 number. */ + regnum = X86_64_ST0_REGNUM; + if (writebuf) + i387_return_value (gdbarch, regcache); + break; + + case AMD64_X87UP: + /* 7. If the class is X87UP, the value is returned together + with the previous X87 value in %st0. */ + gdb_assert (i > 0 && class[0] == AMD64_X87); + regnum = X86_64_ST0_REGNUM; + offset = 8; + len = 2; + break; + + case AMD64_NO_CLASS: + continue; + + default: + gdb_assert (!"Unexpected register class."); } + + gdb_assert (regnum != -1); + + if (readbuf) + regcache_raw_read_part (regcache, regnum, offset, min (len, 8), + (char *) readbuf + i * 8); + if (writebuf) + regcache_raw_write_part (regcache, regnum, offset, min (len, 8), + (const char *) writebuf + i * 8); } -} -#define INT_REGS 6 -#define SSE_REGS 8 + return RETURN_VALUE_REGISTER_CONVENTION; +} + static CORE_ADDR -x86_64_push_arguments (struct regcache *regcache, int nargs, - struct value **args, CORE_ADDR sp) +amd64_push_arguments (struct regcache *regcache, int nargs, + struct value **args, CORE_ADDR sp) { - int intreg = 0; - int ssereg = 0; - /* For varargs functions we have to pass the total number of SSE - registers used in %rax. So, let's count this number. */ - int total_sse_args = 0; - /* Once an SSE/int argument is passed on the stack, all subsequent - arguments are passed there. */ - int sse_stack = 0; - int int_stack = 0; - unsigned total_sp; - int i; - char buf[8]; - static int int_parameter_registers[INT_REGS] = + static int integer_regnum[] = { X86_64_RDI_REGNUM, 4, /* %rdi, %rsi */ X86_64_RDX_REGNUM, 2, /* %rdx, %rcx */ 8, 9 /* %r8, %r9 */ }; - /* %xmm0 - %xmm7 */ - static int sse_parameter_registers[SSE_REGS] = + static int sse_regnum[] = { + /* %xmm0 ... %xmm7 */ X86_64_XMM0_REGNUM + 0, X86_64_XMM1_REGNUM, X86_64_XMM0_REGNUM + 2, X86_64_XMM0_REGNUM + 3, X86_64_XMM0_REGNUM + 4, X86_64_XMM0_REGNUM + 5, X86_64_XMM0_REGNUM + 6, X86_64_XMM0_REGNUM + 7, }; - int stack_values_count = 0; - int *stack_values; - stack_values = alloca (nargs * sizeof (int)); + struct value **stack_args = alloca (nargs * sizeof (struct value *)); + int num_stack_args = 0; + int num_elements = 0; + int element = 0; + int integer_reg = 0; + int sse_reg = 0; + int i; for (i = 0; i < nargs; i++) { - enum x86_64_reg_class class[MAX_CLASSES]; - int n = classify_argument (args[i]->type, class, 0); - int needed_intregs; - int needed_sseregs; - - if (!n || - !examine_argument (class, n, &needed_intregs, &needed_sseregs)) - { /* memory class */ - stack_values[stack_values_count++] = i; + struct type *type = VALUE_TYPE (args[i]); + int len = TYPE_LENGTH (type); + enum amd64_reg_class class[2]; + int needed_integer_regs = 0; + int needed_sse_regs = 0; + int j; + + /* Classify argument. */ + amd64_classify (type, class); + + /* Calculate the number of integer and SSE registers needed for + this argument. */ + for (j = 0; j < 2; j++) + { + if (class[j] == AMD64_INTEGER) + needed_integer_regs++; + else if (class[j] == AMD64_SSE) + needed_sse_regs++; + } + + /* Check whether enough registers are available, and if the + argument should be passed in registers at all. */ + if (integer_reg + needed_integer_regs > ARRAY_SIZE (integer_regnum) + || sse_reg + needed_sse_regs > ARRAY_SIZE (sse_regnum) + || (needed_integer_regs == 0 && needed_sse_regs == 0)) + { + /* The argument will be passed on the stack. */ + num_elements += ((len + 7) / 8); + stack_args[num_stack_args++] = args[i]; } else { - int j; - int offset = 0; + /* The argument will be passed in registers. */ + char *valbuf = VALUE_CONTENTS (args[i]); + char buf[8]; - if (intreg / 2 + needed_intregs > INT_REGS) - int_stack = 1; - if (ssereg / 2 + needed_sseregs > SSE_REGS) - sse_stack = 1; - if (!sse_stack) - total_sse_args += needed_sseregs; + gdb_assert (len <= 16); - for (j = 0; j < n; j++) + for (j = 0; len > 0; j++, len -= 8) { + int regnum = -1; + int offset = 0; + switch (class[j]) { - case X86_64_NO_CLASS: - break; - case X86_64_INTEGER_CLASS: - if (int_stack) - stack_values[stack_values_count++] = i; - else - { - regcache_cooked_write - (regcache, int_parameter_registers[(intreg + 1) / 2], - VALUE_CONTENTS_ALL (args[i]) + offset); - offset += 8; - intreg += 2; - } - break; - case X86_64_INTEGERSI_CLASS: - if (int_stack) - stack_values[stack_values_count++] = i; - else - { - LONGEST val = extract_signed_integer - (VALUE_CONTENTS_ALL (args[i]) + offset, 4); - regcache_cooked_write_signed - (regcache, int_parameter_registers[intreg / 2], val); - - offset += 8; - intreg++; - } - break; - case X86_64_SSEDF_CLASS: - case X86_64_SSESF_CLASS: - case X86_64_SSE_CLASS: - if (sse_stack) - stack_values[stack_values_count++] = i; - else - { - regcache_cooked_write - (regcache, sse_parameter_registers[(ssereg + 1) / 2], - VALUE_CONTENTS_ALL (args[i]) + offset); - offset += 8; - ssereg += 2; - } - break; - case X86_64_SSEUP_CLASS: - if (sse_stack) - stack_values[stack_values_count++] = i; - else - { - regcache_cooked_write - (regcache, sse_parameter_registers[ssereg / 2], - VALUE_CONTENTS_ALL (args[i]) + offset); - offset += 8; - ssereg++; - } + case AMD64_INTEGER: + regnum = integer_regnum[integer_reg++]; break; - case X86_64_X87_CLASS: - case X86_64_MEMORY_CLASS: - stack_values[stack_values_count++] = i; + + case AMD64_SSE: + regnum = sse_regnum[sse_reg++]; break; - case X86_64_X87UP_CLASS: + + case AMD64_SSEUP: + gdb_assert (sse_reg > 0); + regnum = sse_regnum[sse_reg - 1]; + offset = 8; break; + default: - internal_error (__FILE__, __LINE__, - "Unexpected argument class"); + gdb_assert (!"Unexpected register class."); } - intreg += intreg % 2; - ssereg += ssereg % 2; + + gdb_assert (regnum != -1); + memset (buf, 0, sizeof buf); + memcpy (buf, valbuf + j * 8, min (len, 8)); + regcache_raw_write_part (regcache, regnum, offset, 8, buf); } } } - /* We have to make sure that the stack is 16-byte aligned after the - setup. Let's calculate size of arguments first, align stack and - then fill in the arguments. */ - total_sp = 0; - for (i = 0; i < stack_values_count; i++) - { - struct value *arg = args[stack_values[i]]; - int len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg)); - total_sp += (len + 7) & ~7; - } - /* total_sp is now a multiple of 8, if it is not a multiple of 16, - change the stack pointer so that it will be afterwards correctly - aligned. */ - if (total_sp & 15) - sp -= 8; - - /* Push any remaining arguments onto the stack. */ - while (--stack_values_count >= 0) - { - struct value *arg = args[stack_values[stack_values_count]]; - int len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg)); - - /* Make sure the stack is 8-byte-aligned. */ - sp -= (len + 7) & ~7; - write_memory (sp, VALUE_CONTENTS_ALL (arg), len); - } - - /* Write number of SSE type arguments to RAX to take care of varargs - functions. */ - store_unsigned_integer (buf, 8, total_sse_args); - regcache_cooked_write (regcache, X86_64_RAX_REGNUM, buf); - - return sp; -} + /* Allocate space for the arguments on the stack. */ + sp -= num_elements * 8; -/* Write into the appropriate registers a function return value stored - in VALBUF of type TYPE, given in virtual format. */ + /* The psABI says that "The end of the input argument area shall be + aligned on a 16 byte boundary." */ + sp &= ~0xf; -static void -x86_64_store_return_value (struct type *type, struct regcache *regcache, - const void *valbuf) -{ - int len = TYPE_LENGTH (type); - - /* First handle long doubles. */ - if (TYPE_CODE_FLT == TYPE_CODE (type) && len == 16) - { - ULONGEST fstat; - char buf[I386_MAX_REGISTER_SIZE]; - - /* Returning floating-point values is a bit tricky. Apart from - storing the return value in %st(0), we have to simulate the - state of the FPU at function return point. */ - - /* Convert the value found in VALBUF to the extended - floating-point format used by the FPU. This is probably - not exactly how it would happen on the target itself, but - it is the best we can do. */ - convert_typed_floating (valbuf, type, buf, builtin_type_i387_ext); - regcache_raw_write (regcache, X86_64_ST0_REGNUM, buf); - - /* Set the top of the floating-point register stack to 7. The - actual value doesn't really matter, but 7 is what a normal - function return would end up with if the program started out - with a freshly initialized FPU. */ - regcache_raw_read_unsigned (regcache, FSTAT_REGNUM, &fstat); - fstat |= (7 << 11); - regcache_raw_write_unsigned (regcache, FSTAT_REGNUM, fstat); - - /* Mark %st(1) through %st(7) as empty. Since we set the top of - the floating-point register stack to 7, the appropriate value - for the tag word is 0x3fff. */ - regcache_raw_write_unsigned (regcache, FTAG_REGNUM, 0x3fff); - } - else if (TYPE_CODE_FLT == TYPE_CODE (type)) + /* Write out the arguments to the stack. */ + for (i = 0; i < num_stack_args; i++) { - /* Handle double and float variables. */ - regcache_cooked_write_part (regcache, X86_64_XMM0_REGNUM, - 0, len, valbuf); - } - /* XXX: What about complex floating point types? */ - else - { - int low_size = register_size (current_gdbarch, X86_64_RAX_REGNUM); - int high_size = register_size (current_gdbarch, X86_64_RDX_REGNUM); + struct type *type = VALUE_TYPE (stack_args[i]); + char *valbuf = VALUE_CONTENTS (stack_args[i]); + int len = TYPE_LENGTH (type); - if (len <= low_size) - regcache_cooked_write_part (regcache, 0, 0, len, valbuf); - else if (len <= (low_size + high_size)) - { - regcache_cooked_write_part (regcache, 0, 0, low_size, valbuf); - regcache_cooked_write_part (regcache, 1, 0, - len - low_size, - (const char *) valbuf + low_size); - } - else - internal_error (__FILE__, __LINE__, - "Cannot store return value of %d bytes long.", len); + write_memory (sp + element * 8, valbuf, len); + element += ((len + 7) / 8); } + + /* The psABI says that "For calls that may call functions that use + varargs or stdargs (prototype-less calls or calls to functions + containing ellipsis (...) in the declaration) %al is used as + hidden argument to specify the number of SSE registers used. */ + regcache_raw_write_unsigned (regcache, X86_64_RAX_REGNUM, sse_reg); + return sp; } - static CORE_ADDR x86_64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, @@ -824,7 +600,7 @@ x86_64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, char buf[8]; /* Pass arguments. */ - sp = x86_64_push_arguments (regcache, nargs, args, sp); + sp = amd64_push_arguments (regcache, nargs, args, sp); /* Pass "hidden" argument". */ if (struct_return) @@ -974,14 +750,6 @@ x86_64_frame_cache (struct frame_info *next_frame, void **this_cache) cache = x86_64_alloc_frame_cache (); *this_cache = cache; - frame_unwind_register (next_frame, X86_64_RBP_REGNUM, buf); - cache->base = extract_unsigned_integer (buf, 8); - if (cache->base == 0) - return cache; - - /* For normal frames, %rip is stored at 8(%rbp). */ - cache->saved_regs[X86_64_RIP_REGNUM] = 8; - cache->pc = frame_func_unwind (next_frame); if (cache->pc != 0) x86_64_analyze_prologue (cache->pc, frame_pc_unwind (next_frame), cache); @@ -999,11 +767,21 @@ x86_64_frame_cache (struct frame_info *next_frame, void **this_cache) frame_unwind_register (next_frame, X86_64_RSP_REGNUM, buf); cache->base = extract_unsigned_integer (buf, 8) + cache->sp_offset; } + else + { + frame_unwind_register (next_frame, X86_64_RBP_REGNUM, buf); + cache->base = extract_unsigned_integer (buf, 8); + } /* Now that we have the base address for the stack frame we can calculate the value of %rsp in the calling frame. */ cache->saved_sp = cache->base + 16; + /* For normal frames, %rip is stored at 8(%rbp). If we don't have a + frame we find it at the same offset from the reconstructed base + address. */ + cache->saved_regs[X86_64_RIP_REGNUM] = 8; + /* Adjust all the saved registers such that they contain addresses instead of offsets. */ for (i = 0; i < X86_64_NUM_SAVED_REGS; i++) @@ -1300,11 +1078,9 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_register_to_value (gdbarch, i387_register_to_value); set_gdbarch_value_to_register (gdbarch, i387_value_to_register); - set_gdbarch_extract_return_value (gdbarch, x86_64_extract_return_value); - set_gdbarch_store_return_value (gdbarch, x86_64_store_return_value); + set_gdbarch_return_value (gdbarch, amd64_return_value); /* Override, since this is handled by x86_64_extract_return_value. */ set_gdbarch_extract_struct_value_address (gdbarch, NULL); - set_gdbarch_use_struct_convention (gdbarch, x86_64_use_struct_convention); set_gdbarch_skip_prologue (gdbarch, x86_64_skip_prologue); diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 6183785..4375d18 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1251,7 +1251,7 @@ read_xcoff_symtab (struct partial_symtab *pst) break; case C_FCN: - if (STREQ (cs->c_name, ".bf")) + if (DEPRECATED_STREQ (cs->c_name, ".bf")) { CORE_ADDR off = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); @@ -1268,7 +1268,7 @@ read_xcoff_symtab (struct partial_symtab *pst) if (new->name != NULL) SYMBOL_SECTION (new->name) = SECT_OFF_TEXT (objfile); } - else if (STREQ (cs->c_name, ".ef")) + else if (DEPRECATED_STREQ (cs->c_name, ".ef")) { bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass, @@ -1362,7 +1362,7 @@ read_xcoff_symtab (struct partial_symtab *pst) break; case C_BLOCK: - if (STREQ (cs->c_name, ".bb")) + if (DEPRECATED_STREQ (cs->c_name, ".bb")) { depth++; new = push_context (depth, @@ -1370,7 +1370,7 @@ read_xcoff_symtab (struct partial_symtab *pst) + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)))); } - else if (STREQ (cs->c_name, ".eb")) + else if (DEPRECATED_STREQ (cs->c_name, ".eb")) { if (context_stack_depth <= 0) { /* We attempted to pop an empty context stack */ @@ -1671,7 +1671,7 @@ read_symbol_lineno (int symno) if (symbol->n_sclass == C_FCN) { char *name = xcoff64 ? strtbl + symbol->n_offset : symbol->n_name; - if (STREQ (name, ".bf")) + if (DEPRECATED_STREQ (name, ".bf")) goto gotit; } symno += symbol->n_numaux + 1; @@ -1705,7 +1705,7 @@ find_linenos (struct bfd *abfd, struct bfd_section *asect, void *vpinfo) count = asect->lineno_count; - if (!STREQ (asect->name, ".text") || count == 0) + if (!DEPRECATED_STREQ (asect->name, ".text") || count == 0) return; size = count * coff_data (abfd)->local_linesz; @@ -2530,12 +2530,12 @@ scan_xcoff_symtab (struct objfile *objfile) things like "break c-exp.y:435" need to work (I suppose the psymtab_include_list could be hashed or put in a binary tree, if profiling shows this is a major hog). */ - if (pst && STREQ (namestring, pst->filename)) + if (pst && DEPRECATED_STREQ (namestring, pst->filename)) continue; { int i; for (i = 0; i < includes_used; i++) - if (STREQ (namestring, psymtab_include_list[i])) + if (DEPRECATED_STREQ (namestring, psymtab_include_list[i])) { i = -1; break; diff --git a/include/ChangeLog b/include/ChangeLog index 9fa8373..4328b98 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,31 @@ +2003-12-04 H.J. Lu <hongjiu.lu@intel.com> + + * bfdlink.h (bfd_link_info): Change relax_finalizing to + need_relax_finalize. + +2003-12-03 Alan Modra <amodra@bigpond.net.au> + + * bfdlink.h (struct bfd_link_hash_entry): Rename "next" to "und_next". + +2003-12-02 Alan Modra <amodra@bigpond.net.au> + + * bfdlink.h (struct bfd_link_info): Remove mpc860c0 field. + +2003-11-18 Maciej W. Rozycki <macro@ds2.pg.gda.pl> + + * opcode/mips.h: Define new enum members, M_LCA_AB and M_DLCA_AB. + +2003-11-14 Nick Clifton <nickc@redhat.com> + + * dis-asm.h (struct disassemble_info): Add new field + 'symbol_is_valid' which is a function which can tell the + disassembler to skip certain symbols as they should not be + displayed to the user. + (arm_symbol_is_valid): New prototype. This is the ARM + specific function for the symbol_is_valid field. + (generic_symbol_is_valid): New prototype. This is the default + function pointed to by the symbol_is_valid field. + 2003-11-06 Bruno Rohee <bruno@rohee.com> * hp-symtab.h: Fix "the the" typo. @@ -67,11 +95,11 @@ * bfdlink.h (enum report_method): New enum. Describes how to report something. - (struct bfd_link_info): Delete fields 'no_undefined' and + (struct bfd_link_info): Delete fields 'no_undefined' and 'allow_shlib_undefined'. Replace with 'unresolved_symbols_in_objects' and 'unresolved_symbols_in_shared_libs'. - + 2003-08-07 Alan Modra <amodra@bigpond.net.au> * bfdlink.h: Remove PARAMS macro. Replace PTR with void *. @@ -175,10 +203,10 @@ 2003-04-01 Bob Wilson <bob.wilson@acm.org> - * dis-asm.h (print_insn_xtensa): Declare. - * xtensa-config.h: New file. - * xtensa-isa-internal.h: Likewise. - * xtensa-isa.h: Likewise. + * dis-asm.h (print_insn_xtensa): Declare. + * xtensa-config.h: New file. + * xtensa-isa-internal.h: Likewise. + * xtensa-isa.h: Likewise. 2003-03-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> @@ -206,7 +234,7 @@ 2003-01-31 Grant Grundler <grundler@dsl2.external.hp.com> - * hppa.h (ldwa, ldda): Add ordered opcodes. + * hppa.h (ldwa, ldda): Add ordered opcodes. 2003-01-26 Daniel Jacobowitz <drow@mvista.com> @@ -421,7 +449,7 @@ * elf/dwarf2.h (DW_CFA_low_user, DW_CFA_high_user): Renamed to DW_CFA_lo_user, DW_CFA_hi_user respectively. - + 2002-05-28 Kuang Hwa Lin <kuang@sbcglobal.net> * dis-asm.h: Prototype print_insn_dlx. @@ -660,8 +688,8 @@ 2001-08-02 Charles Wilson <cwilson@ece.gatech.edu> - * bfdlink.h (struct bfd_link_info): add new boolean - field pei386_auto_import. + * bfdlink.h (struct bfd_link_info): add new boolean + field pei386_auto_import. 2001-07-18 Andreas Jaeger <aj@suse.de> @@ -697,7 +725,7 @@ 2001-04-27 Johan Rydberg <jrydberg@opencores.org> - * dis-asm.h (print_insn_openrisc): Add prototype. + * dis-asm.h (print_insn_openrisc): Add prototype. 2001-04-15 Daniel Berlin <dan@cgsoftware.com> @@ -933,7 +961,7 @@ Tue May 30 16:53:34 2000 Andrew Cagney <cagney@b1.cygnus.com> * libiberty.h (basename): Likewise. 2000-05-17 S. Bharadwaj Yadavalli <sby@scrugs.lkg.dec.com> - Rick Gorton <gorton@scrugs.lkg.dec.com> + Rick Gorton <gorton@scrugs.lkg.dec.com> * bfdlink.h (struct bfd_link_info): Add emitrelocations flag. @@ -943,8 +971,8 @@ Tue May 30 16:53:34 2000 Andrew Cagney <cagney@b1.cygnus.com> 2000-05-06 Zack Weinberg <zack@wolery.cumb.org> - * ansidecl.h: #define __extension__ to nothing if - GCC_VERSION < 2008. + * ansidecl.h: #define __extension__ to nothing if + GCC_VERSION < 2008. 2000-05-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> @@ -962,9 +990,9 @@ Thu May 4 17:15:26 2000 Philippe De Muyter <phdm@macqel.be> 2000-04-28 Kenneth Block <block@zk3.dec.com> Jason Merrill <jason@casey.cygnus.com> - * demangle.h (libiberty_demanglers): new table for different styles. - (cplus_demangle_set_style): New function for setting style. - (cplus_demangle_name_to_style): New function to translate name. + * demangle.h (libiberty_demanglers): new table for different styles. + (cplus_demangle_set_style): New function for setting style. + (cplus_demangle_name_to_style): New function to translate name. 2000-04-24 Mark Mitchell <mark@codesourcery.com> @@ -1242,8 +1270,8 @@ Wed Mar 24 12:46:29 1999 Andrew Cagney <cagney@amy.cygnus.com> Mon Feb 1 21:05:46 1999 Catherine Moore <clm@cygnus.com> - * dis-asm.h (print_insn_i386_att): Declare. - (print_insn_i386_intel): Declare. + * dis-asm.h (print_insn_i386_att): Declare. + (print_insn_i386_intel): Declare. 1998-12-30 Michael Meissner <meissner@cygnus.com> @@ -1262,9 +1290,9 @@ Mon Dec 14 09:53:31 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> Tue Dec 8 00:30:31 1998 Elena Zannoni <ezannoni@kwikemart.cygnus.com> The following changes were made by Elena Zannoni - <ezannoni@kwikemart.cygnus.com> and Edith Epstein - <eepstein@sophia.cygnus.com> as part of a project to merge in - changes made by HP; HP did not create ChangeLog entries. + <ezannoni@kwikemart.cygnus.com> and Edith Epstein + <eepstein@sophia.cygnus.com> as part of a project to merge in + changes made by HP; HP did not create ChangeLog entries. * dis-asm.h (struct disassemble_info): change the type of stream from FILE* to void*, for use with gdb's new type GDB_FILE. @@ -1351,8 +1379,8 @@ Tue Feb 24 13:05:02 1998 Doug Evans <devans@canuck.cygnus.com> Tue Feb 17 12:32:18 1998 Andrew Cagney <cagney@b1.cygnus.com> * remote-sim.h (sim_fetch_register, sim_store_register): Add - register length parameter. Functions return actual length of - register. + register length parameter. Functions return actual length of + register. Thu Feb 12 16:29:01 1998 Ian Lance Taylor <ian@cygnus.com> @@ -1406,7 +1434,7 @@ Tue Nov 25 01:35:52 1997 Doug Evans <devans@seba.cygnus.com> Sat Nov 22 23:34:15 1997 Andrew Cagney <cagney@b1.cygnus.com> * remote-sim.h (sim_stop_reason): Clarify sim_signalled SIGRC - argument. + argument. Mon Nov 17 14:00:51 1997 Doug Evans <devans@seba.cygnus.com> @@ -1486,12 +1514,12 @@ Fri May 23 13:43:41 1997 Fred Fish <fnf@cygnus.com> Thu May 22 11:32:49 1997 Andrew Cagney <cagney@b1.cygnus.com> * remote-sim.h: Review documentation. Clarify restrictions on - when functions can be called. + when functions can be called. Wed May 21 16:47:53 1997 Andrew Cagney <cagney@b1.cygnus.com> * remote-sim.h (sim_set_profile_size): Add prototype, document as - depreciated. + depreciated. Tue May 20 09:32:22 1997 Andrew Cagney <cagney@b1.cygnus.com> @@ -1517,16 +1545,16 @@ Tue Apr 22 10:24:34 1997 Fred Fish <fnf@cygnus.com> Fri Apr 18 13:04:49 1997 Andrew Cagney <cagney@b1.cygnus.com> * remote-sim.h (sim_stop): New interface - asynchronous - notification of a request to stop / suspend the running - simulation. + notification of a request to stop / suspend the running + simulation. * remote-sim.h (enum sim_stop): Add sim_running and sim_polling as - states for use internal to simulators. + states for use internal to simulators. * callback.h (struct host_callback_strut): Put a magic number at - the end of the struct to allow basic checking. + the end of the struct to allow basic checking. (struct host_callback_struct ): Add poll_quit - so - that the console etc can be polled at regular intervals. + that the console etc can be polled at regular intervals. Thu Apr 17 02:17:12 1997 Doug Evans <dje@canuck.cygnus.com> @@ -1537,7 +1565,7 @@ Thu Apr 17 02:17:12 1997 Doug Evans <dje@canuck.cygnus.com> Wed Apr 2 17:09:12 1997 Andrew Cagney <cagney@kremvax.cygnus.com> * remote-sim.h (sim_trace, sim_size): Make these global. They - will go away shortly. + will go away shortly. Wed Apr 2 15:23:49 1997 Doug Evans <dje@canuck.cygnus.com> @@ -1567,7 +1595,7 @@ Mon Mar 17 19:22:12 1997 Ian Lance Taylor <ian@cygnus.com> Mon Mar 17 14:57:55 1997 Andrew Cagney <cagney@kremvax.cygnus.com> * remote-sim.h: New file, copied in from gdb/remote-sim.h. One - day this will be placed in a directory of its own. + day this will be placed in a directory of its own. Sat Mar 15 19:00:14 1997 Ian Lance Taylor <ian@cygnus.com> @@ -1576,8 +1604,8 @@ Sat Mar 15 19:00:14 1997 Ian Lance Taylor <ian@cygnus.com> Thu Mar 6 15:46:59 1997 Andrew Cagney <cagney@kremvax.cygnus.com> * callback.h (struct host_callback_struct): Add callbacks - - flush_stdout, write_stderr, flush_stderr, vprintf_filtered, - evprintf_filtered. Delete redundant callbacks - printf_filtered. + flush_stdout, write_stderr, flush_stderr, vprintf_filtered, + evprintf_filtered. Delete redundant callbacks - printf_filtered. Thu Feb 27 23:18:27 1997 Ian Lance Taylor <ian@cygnus.com> @@ -1693,7 +1721,7 @@ Tue Jul 23 17:37:58 1996 Fred Fish <fnf@cygnus.com> can define PRIVATE_XMALLOC and then define xmalloc and xrealloc anyway they want. (basename): Document in source that we can't declare the - parameter type because it is declared inconsistently across + parameter type because it is declared inconsistently across different systems. Mon Jul 22 13:16:13 1996 Richard Henderson <rth@tamu.edu> diff --git a/include/bfdlink.h b/include/bfdlink.h index 75ea39d..a989f64 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -81,6 +81,7 @@ struct bfd_link_hash_entry { /* Base hash table entry structure. */ struct bfd_hash_entry root; + /* Type of this entry. */ enum bfd_link_hash_type type; @@ -102,7 +103,8 @@ struct bfd_link_hash_entry symbol is undefined and becomes defined, this field will automatically be non-NULL since the symbol will have been on the undefined symbol list. */ - struct bfd_link_hash_entry *next; + struct bfd_link_hash_entry *und_next; + /* A union of information depending upon the type. */ union { @@ -283,8 +285,8 @@ struct bfd_link_info /* TRUE if global symbols in discarded sections should be stripped. */ unsigned int strip_discarded: 1; - /* TRUE if relaxation is being finalized. */ - unsigned int relax_finalizing: 1; + /* TRUE if the final relax pass is needed. */ + unsigned int need_relax_finalize: 1; /* TRUE if generating a position independent executable. */ unsigned int pie: 1; @@ -366,11 +368,6 @@ struct bfd_link_info unloaded. */ const char *fini_function; - /* If non-zero, specifies that branches which are problematic for the - MPC860 C0 (or earlier) should be checked for and modified. It gives the - number of bytes that should be checked at the end of each text page. */ - int mpc860c0; - /* Non-zero if auto-import thunks for DATA items in pei386 DLLs should be generated/linked against. Set to 1 if this feature is explicitly requested by the user, -1 if enabled by default. */ diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog index 75a7ff8..d18113d 100644 --- a/include/coff/ChangeLog +++ b/include/coff/ChangeLog @@ -1,3 +1,8 @@ +2003-12-02 Graham Reed <grahamr@algorithmics.com> + + * internal.h (C_WEAKEXT): Add alternative value for AIX 5.2 + based targets. + 2003-08-23 Jason Eckhardt <jle@rice.edu> * coff/i860.h (COFF860_R_PAIR, COFF860_R_LOW0, COFF860_R_LOW1, diff --git a/include/coff/internal.h b/include/coff/internal.h index b9b6368..2d41bf9 100644 --- a/include/coff/internal.h +++ b/include/coff/internal.h @@ -235,7 +235,11 @@ struct internal_aouthdr #define C_ALIAS 105 /* duplicate tag */ #define C_HIDDEN 106 /* ext symbol in dmert public lib */ -#define C_WEAKEXT 127 /* weak symbol -- GNU extension */ +#if defined _AIX52 || defined AIX_WEAK_SUPPORT +#define C_WEAKEXT 111 /* weak symbol -- AIX standard. */ +#else +#define C_WEAKEXT 127 /* weak symbol -- GNU extension. */ +#endif /* New storage classes for TI COFF */ #define C_UEXT 19 /* Tentative external definition */ diff --git a/include/dis-asm.h b/include/dis-asm.h index 6bdd751..3670c51 100644 --- a/include/dis-asm.h +++ b/include/dis-asm.h @@ -130,6 +130,12 @@ typedef struct disassemble_info { int (* symbol_at_address_func) (bfd_vma addr, struct disassemble_info * info); + /* Function called to check if a SYMBOL is can be displayed to the user. + This is used by some ports that want to hide special symbols when + displaying debugging outout. */ + bfd_boolean (* symbol_is_valid) + (asymbol *, struct disassemble_info * info); + /* These are for buffer_read_memory. */ bfd_byte *buffer; bfd_vma buffer_vma; @@ -141,7 +147,7 @@ typedef struct disassemble_info { the same value in order to get reasonable looking output. */ int bytes_per_line; - /* the next two variables control the way objdump displays the raw data */ + /* The next two variables control the way objdump displays the raw data. */ /* For example, if bytes_per_line is 8 and bytes_per_chunk is 4, the */ /* output will look like this: 00: 00000000 00000000 @@ -251,12 +257,16 @@ extern void print_arm_disassembler_options (FILE *); extern void parse_arm_disassembler_option (char *); extern int get_arm_regname_num_options (void); extern int set_arm_regname_option (int); -extern int get_arm_regnames - (int, const char **, const char **, const char ***); +extern int get_arm_regnames (int, const char **, const char **, const char ***); +extern bfd_boolean arm_symbol_is_valid (asymbol *, struct disassemble_info *); /* Fetch the disassembler for a given BFD, if that support is available. */ extern disassembler_ftype disassembler (bfd *); +/* Amend the disassemble_info structure as necessary for the target architecture. + Should only be called after initialising the info->arch field. */ +extern void disassemble_init_for_target (struct disassemble_info * info); + /* Document any target specific options available from the disassembler. */ extern void disassembler_usage (FILE *); @@ -284,6 +294,10 @@ extern void generic_print_address extern int generic_symbol_at_address (bfd_vma, struct disassemble_info *); +/* Also always true. */ +extern bfd_boolean generic_symbol_is_valid + (asymbol *, struct disassemble_info *); + /* Method to initialize a disassemble_info struct. This should be called by all applications creating such a struct. */ extern void init_disassemble_info (struct disassemble_info *info, void *stream, diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index c8e4d95..9fc3b58 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,12 @@ +2003-12-06 Alan Modra <amodra@bigpond.net.au> + + From Jan Beulich <JBeulich@novell.com> + * common.h (DT_HIOS): Correct value. + +2003-12-03 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + * elf/m32r.h: Add new machine type m32r2 and instruction modes. + 2003-11-06 Alan Modra <amodra@bigpond.net.au> * ppc.h (R_PPC_RELAX32PC): Define. diff --git a/include/elf/common.h b/include/elf/common.h index 1a84339..3c4fabe 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -533,7 +533,7 @@ values outside of the new range (see below). */ #define OLD_DT_LOOS 0x60000000 #define DT_LOOS 0x6000000d -#define DT_HIOS 0x6fff0000 +#define DT_HIOS 0x6ffff000 #define OLD_DT_HIOS 0x6fffffff #define DT_LOPROC 0x70000000 diff --git a/include/elf/m32r.h b/include/elf/m32r.h index 2cb308d..2663f3a 100644 --- a/include/elf/m32r.h +++ b/include/elf/m32r.h @@ -1,21 +1,21 @@ /* M32R ELF support for BFD. - Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _ELF_M32R_H #define _ELF_M32R_H @@ -62,6 +62,25 @@ END_RELOC_NUMBERS (R_M32R_max) /* m32r code. */ #define E_M32R_ARCH 0x00000000 /* m32rx code. */ -#define E_M32RX_ARCH 0x10000000 +#define E_M32RX_ARCH 0x10000000 +/* m32r2 code. */ +#define E_M32R2_ARCH 0x20000000 + +/* 12 bit m32r new instructions field. */ +#define EF_M32R_INST 0x0FFF0000 +/* Parallel instructions. */ +#define E_M32R_HAS_PARALLEL 0x00010000 +/* Hidden instructions for m32rx: + jc, jnc, macwhi-a, macwlo-a, mulwhi-a, mulwlo-a, sth+, shb+, sat, pcmpbz, + sc, snc. */ +#define E_M32R_HAS_HIDDEN_INST 0x00020000 +/* New bit instructions: + clrpsw, setpsw, bset, bclr, btst. */ +#define E_M32R_HAS_BIT_INST 0x00040000 +/* Floating point instructions. */ +#define E_M32R_HAS_FLOAT_INST 0x00080000 + +/* 4 bit m32r ignore to check field. */ +#define EF_M32R_IGNORE 0x0000000F #endif diff --git a/include/opcode/mips.h b/include/opcode/mips.h index 9dab620..5c3ddfc 100644 --- a/include/opcode/mips.h +++ b/include/opcode/mips.h @@ -567,6 +567,7 @@ enum M_DIVU_3, M_DIVU_3I, M_DLA_AB, + M_DLCA_AB, M_DLI, M_DMUL, M_DMUL_I, @@ -592,6 +593,7 @@ enum M_LB_AB, M_LBU_A, M_LBU_AB, + M_LCA_AB, M_LD_A, M_LD_OB, M_LD_AB, diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index c9b048e..cd7200d 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,9 +1,183 @@ +2003-12-15 Brendan Kehoe <brendan@zen.org> + + * libiberty/Makefile.in (floatformat.o): Add dependency on + config.h to accompany change of 2003-12-03. + +2003-12-15 Ian Lance Taylor <ian@wasabisystems.com> + + Fix handling of constructor/destructor of standard substitution: + * cp-demangle.c (struct d_standard_sub_info): Define. + (d_substitution): Add prefix argument. Change all callers. + Rework handling of standard substitutions to print full name when + qualifying a constructor/destructor, or when DMGL_VERBOSE is set. + * testsuite/demangle-expected: Add test case. + + Fix handling of negative literal constants: + * cp-demangle.c (enum d_comp_type): Add D_COMP_LITERAL_NEG. + (d_dump, d_make_comp): Handle D_COMP_LITERAL_NEG. + (d_expr_primary): Use D_COMP_LITERAL_NEG for a negative number. + (d_print_comp): Handle D_COMP_LITERAL_NEG. + * testsuite/demangle-expected: Add test case. + +2003-12-04 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (IS_UPPER, IS_LOWER): Define. + (d_last_char): Define new macro. + (d_make_name): Reject an empty name. + (d_prefix, d_unqualified_name, d_type): Use new IS_* macros. + (d_substitution, d_print_identifier): Likewise. + (d_print_comp) [D_COMP_OPERATOR]: Likewise. + (d_print_comp) [D_COMP_TEMPLATE]: Use new d_last_char macro. + (d_print_mod) Use new d_last_char macro. + (d_print_cast): Use new d_last_char macro. + (is_ctor_or_dtor): Don't leak memory. + + Fix handling of member function modifiers: + * cp-demangle.c (enum d_comp_type): Add D_COMP_RESTRICT_THIS, + D_COMP_VOLATILE_THIS, and D_COMP_CONST_THIS. + (d_dump): Dump new d_comp_type values. + (d_make_comp): Accept new d_comp_type values. + (has_return_type): Only accept _THIS variants of qualifiers. + (d_encoding): Without DMGL_PARAMS, only remove _THIS variants of + qualifiers. + (d_cv_qualifiers): Add member_fn parameter. Change all callers. + (d_print_comp) [D_COMP_TYPED_NAME]: Rather than removing + qualifiers and printing them at the end, add _THIS qualifiers to + the modifier list. + (d_print_comp) [D_COMP_*_THIS]: New cases. + (d_print_comp) [D_COMP_PTRMEM_TYPE]: Remove special handling of + qualifiers. + (d_print_mod_list): Add suffix parameter. Change all callers. + Keep walking the list even if the current modifier has been + printed. + (d_print_mod): Handle new _THIS qualifiers. + (d_print_function_type): Handle new _THIS qualifiers when deciding + whether to print a parenthesis. Put a space before the + parenthesis in some cases. Call d_print_mod_list again at the + end, passing suffix as 1. + (is_ctor_or_dtor): Look for new _THIS qualifiers. + * testsuite/demangle-expected: Add test case. + + Fix for PR gcc/13304: + * cp-demangle.c (d_print_comp) [D_COMP_TEMPLATE]: If the character + before the '<' is itself a '<', insert a space. + (d_print_cast): Likewise. + * testsuite/demangle-expected: Add test case. + + Fix for PR gcc/13244: + * cp-demangle.c (d_print_comp) [D_COMP_BINARY]: Wrap an expression + which uses the '>' operator in an extra layer of parens. + * testsuite/demangle-expected: Add test case. + +2003-12-03 Ian Lance Taylor <ian@wasabisystems.com> + + * floatformat.c: Include "config.h" and <string.h> if available. + (INFINITY, NAN): Define if not defined by <math.h>. + (floatformat_to_double): Handle NaN, infinity, and denormalized + numbers. + (floatformat_from_double): Likewise. + (ieee_test): In debugging code, use little endian rather than big + endian. Correct tests to handle NaN and to check correct sign of + zero. Omit m68k extended test. + (main): Add more debugging cases. + +2003-11-29 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (d_demangle): Only return success if we consumed + the entire demangled string. + (is_ctor_or_dtor): Likewise. + + * testsuite/demangle-expected: Revert one part of 2003-06-26 patch + to restore expected result of EDG test case to original expected + result. + +2003-11-26 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (struct d_print_mod): Add templates field. + (d_make_builtin_type): Check for NULL type. + (d_make_extended_operator): Check for NULL name. + (d_make_ctor, d_make_dtor): Likewise. + (d_mangled_name): Add top_level parameter. Change all callers. + (d_encoding): If DMGL_PARAMS is not set, strip off initial + CV-qualifiers. + (d_type): Check some return values we rely on. + (d_bare_function_type, d_array_type): Likewise. + (d_pointer_to_member_type, d_template_args): Likewise. + (d_add_substitution): Fail if argument is NULL. + (d_print_resize): Check whether buf is NULL. + (d_print_comp): Save current templates list with each modifier. + Don't pass the modifier list down when printing a template. + (d_print_cast): Don't pass the modifier list down when printing a + template. + (d_print_mod_list): Temporarily set templates list while printing + a modifier. + (d_print_mod): Check that buf is not NULL before using it. + (d_print_function_type): Print parens if there is no modifier. + (d_init_info): Permit as many substitutions as there are + characters in the mangled name. + * testsuite/demangle-expected: Add two new test cases. + +2003-11-25 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (java_demangle_v3): Pass DMGL_PARAMS to + d_demangle. + +2003-11-22 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (d_encoding): Add top_level parameter. Change all + callers. + (print_usage): Display new -p option. + (long_options): Add --no-params. + (main): Accept and handle -p. + +2003-11-21 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (has_return_type): Skip qualifiers when checking + whether we have a template. + * testsuite/demangle-expected: Add four new tests. + +2003-11-20 Ian Lance Taylor <ian@wasabisystems.com> + + * testsuite/demangle-expected: Minor changes to match output of + new demangler: adjust whitespace in four tests, and change order + of qualifiers in one test. + + * cp-demangle.c: Complete rewrite. + +2003-11-19 Mark Mitchell <mark@codesourcery.com> + + * cp-demangle.c (demangle_type): Correct thinko in substitution + processing. + +2003-11-18 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (demangle_operator_name): Remove space before + "sizeof". + (demangle_type_ptr): Put qualifiers in the right place. Handle + qualifiers in pointer to member specially. + (demangle_type): Handle qualifiers for pointer or reference + specially. Handle function type. + (demangle_local_name): Save and restore caret around demangling of + initial encoding. + + * testsuite/test-demangle.c (main): Don't pass DMGL_VERBOSE to + cplus_demangle. + + * testsuite/Makefile.in (test-demangle): Depend upon libiberty.a. + 2003-10-31 Andreas Jaeger <aj@suse.de> * floatformat.c (floatformat_always_valid): Add unused attribute. 2003-10-30 Josef Zlomek <zlomekj@suse.cz> + Jan Hubicka <jh@suse.cz> + * vasprintf.c (int_vasprintf): Pass va_list by value. + Use va_copy for copying va_list. + (vasprintf): Pass va_list by value. + +2003-10-30 Josef Zlomek <zlomekj@suse.cz> + * hashtab.c (htab_find_slot_with_hash): Decrease n_deleted instead of increasing n_elements when inserting to deleted slot. diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index 5d2dc3c..5fff39b 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -437,7 +437,8 @@ dyn-string.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/dyn-string.h \ fdmatch.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h fibheap.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/fibheap.h \ $(INCDIR)/libiberty.h -floatformat.o: $(INCDIR)/ansidecl.h $(INCDIR)/floatformat.h +floatformat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/floatformat.h \ + $(INCDIR)/libiberty.h fnmatch.o: config.h $(INCDIR)/fnmatch.h $(INCDIR)/safe-ctype.h getcwd.o: config.h getopt.o: config.h $(INCDIR)/getopt.h diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index bd48822..7a806dc 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -1,6 +1,6 @@ -/* Demangler for IA64 / g++ V3 ABI. - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. - Written by Alex Samuel <samuel@codesourcery.com>. +/* Demangler for g++ V3 ABI. + Copyright (C) 2003 Free Software Foundation, Inc. + Written by Ian Lance Taylor <ian@wasabisystems.com>. This file is part of the libiberty library, which is part of GCC. @@ -28,3643 +28,3654 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* This file implements demangling of C++ names mangled according to - the IA64 / g++ V3 ABI. Use the cp_demangle function to - demangle a mangled name, or compile with the preprocessor macro - STANDALONE_DEMANGLER defined to create a demangling filter - executable (functionally similar to c++filt, but includes this - demangler only). */ +/* This code implements a demangler for the g++ V3 ABI. The ABI is + described on this web page: + http://www.codesourcery.com/cxx-abi/abi.html#mangling + + This code was written while looking at the demangler written by + Alex Samuel <samuel@codesourcery.com>. + + This code first pulls the mangled name apart into a list of + components, and then walks the list generating the demangled + name. + + This file will normally define the following functions, q.v.: + char *cplus_demangle_v3(const char *mangled, int options) + char *java_demangle_v3(const char *mangled) + enum gnu_v3_ctor_kinds is_gnu_v3_mangled_ctor (const char *name) + enum gnu_v3_dtor_kinds is_gnu_v3_mangled_dtor (const char *name) + + Preprocessor macros you can define while compiling this file: + + IN_LIBGCC2 + If defined, this file defines the following function, q.v.: + char *__cxa_demangle (const char *mangled, char *buf, size_t *len, + int *status) + instead of cplus_demangle_v3() and java_demangle_v3(). + + IN_GLIBCPP_V3 + If defined, this file defines only __cxa_demangle(). + + STANDALONE_DEMANGLER + If defined, this file defines a main() function which demangles + any arguments, or, if none, demangles stdin. + + CP_DEMANGLE_DEBUG + If defined, turns on debugging mode, which prints information on + stdout about the mangled string. This is not generally useful. +*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include <sys/types.h> +#include <stdio.h> #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif - -#include <stdio.h> - #ifdef HAVE_STRING_H #include <string.h> #endif -#include <ctype.h> - #include "ansidecl.h" #include "libiberty.h" -#include "dyn-string.h" #include "demangle.h" -/* If CP_DEMANGLE_DEBUG is defined, a trace of the grammar evaluation, - and other debugging output, will be generated. */ -#ifdef CP_DEMANGLE_DEBUG -#define DEMANGLE_TRACE(PRODUCTION, DM) \ - fprintf (stderr, " -> %-24s at position %3d\n", \ - (PRODUCTION), current_position (DM)); -#else -#define DEMANGLE_TRACE(PRODUCTION, DM) -#endif +/* We avoid pulling in the ctype tables, to prevent pulling in + additional unresolved symbols when this code is used in a library. + FIXME: Is this really a valid reason? This comes from the original + V3 demangler code. -/* Don't include <ctype.h>, to prevent additional unresolved symbols - from being dragged into the C++ runtime library. */ -#define IS_DIGIT(CHAR) ((CHAR) >= '0' && (CHAR) <= '9') -#define IS_ALPHA(CHAR) \ - (((CHAR) >= 'a' && (CHAR) <= 'z') \ - || ((CHAR) >= 'A' && (CHAR) <= 'Z')) + As of this writing this file has the following undefined references + when compiled with -DIN_GLIBCPP_V3: malloc, realloc, free, memcpy, + strcpy, strcat, strlen. */ + +#define IS_DIGIT(c) ((c) >= '0' && (c) <= '9') +#define IS_UPPER(c) ((c) >= 'A' && (c) <= 'Z') +#define IS_LOWER(c) ((c) >= 'a' && (c) <= 'z') /* The prefix prepended by GCC to an identifier represnting the anonymous namespace. */ #define ANONYMOUS_NAMESPACE_PREFIX "_GLOBAL_" +#define ANONYMOUS_NAMESPACE_PREFIX_LEN \ + (sizeof (ANONYMOUS_NAMESPACE_PREFIX) - 1) -/* Character(s) to use for namespace separation in demangled output */ -#define NAMESPACE_SEPARATOR (dm->style == DMGL_JAVA ? "." : "::") - -/* If flag_verbose is zero, some simplifications will be made to the - output to make it easier to read and supress details that are - generally not of interest to the average C++ programmer. - Otherwise, the demangled representation will attempt to convey as - much information as the mangled form. */ -static int flag_verbose; - -/* If flag_strict is non-zero, demangle strictly according to the - specification -- don't demangle special g++ manglings. */ -static int flag_strict; +/* Information we keep for operators. */ -/* String_list_t is an extended form of dyn_string_t which provides a - link field and a caret position for additions to the string. A - string_list_t may safely be cast to and used as a dyn_string_t. */ - -struct string_list_def +struct d_operator_info { - /* The dyn_string; must be first. */ - struct dyn_string string; + /* Mangled name. */ + const char *code; + /* Real name. */ + const char *name; + /* Number of arguments. */ + int args; +}; - /* The position at which additional text is added to this string - (using the result_add* macros). This value is an offset from the - end of the string, not the beginning (and should be - non-positive). */ - int caret_position; +/* How to print the value of a builtin type. */ - /* The next string in the list. */ - struct string_list_def *next; +enum d_builtin_type_print +{ + /* Print as (type)val. */ + D_PRINT_DEFAULT, + /* Print as integer. */ + D_PRINT_INT, + /* Print as long, with trailing `l'. */ + D_PRINT_LONG, + /* Print as bool. */ + D_PRINT_BOOL, + /* Print in usual way, but here to detect void. */ + D_PRINT_VOID }; -typedef struct string_list_def *string_list_t; +/* Information we keep for a builtin type. */ -/* Data structure representing a potential substitution. */ - -struct substitution_def +struct d_builtin_type_info { - /* The demangled text of the substitution. */ - dyn_string_t text; + /* Type name. */ + const char *name; + /* Type name when using Java. */ + const char *java_name; + /* How to print a value of this type. */ + enum d_builtin_type_print print; +}; + +/* Information we keep for the standard substitutions. */ + +struct d_standard_sub_info +{ + /* The code for this substitution. */ + char code; + /* The simple string it expands to. */ + const char *simple_expansion; + /* The results of a full, verbose, expansion. This is used when + qualifying a constructor/destructor, or when in verbose mode. */ + const char *full_expansion; + /* What to set the last_name field of d_info to; NULL if we should + not set it. This is only relevant when qualifying a + constructor/destructor. */ + const char *set_last_name; +}; - /* Whether this substitution represents a template item. */ - int template_p : 1; +/* Component types found in mangled names. */ + +enum d_comp_type +{ + /* A name. */ + D_COMP_NAME, + /* A qualified name. */ + D_COMP_QUAL_NAME, + /* A typed name. */ + D_COMP_TYPED_NAME, + /* A template. */ + D_COMP_TEMPLATE, + /* A template parameter. */ + D_COMP_TEMPLATE_PARAM, + /* A constructor. */ + D_COMP_CTOR, + /* A destructor. */ + D_COMP_DTOR, + /* A vtable. */ + D_COMP_VTABLE, + /* A VTT structure. */ + D_COMP_VTT, + /* A construction vtable. */ + D_COMP_CONSTRUCTION_VTABLE, + /* A typeinfo structure. */ + D_COMP_TYPEINFO, + /* A typeinfo name. */ + D_COMP_TYPEINFO_NAME, + /* A typeinfo function. */ + D_COMP_TYPEINFO_FN, + /* A thunk. */ + D_COMP_THUNK, + /* A virtual thunk. */ + D_COMP_VIRTUAL_THUNK, + /* A covariant thunk. */ + D_COMP_COVARIANT_THUNK, + /* A Java class. */ + D_COMP_JAVA_CLASS, + /* A guard variable. */ + D_COMP_GUARD, + /* A reference temporary. */ + D_COMP_REFTEMP, + /* A standard substitution. */ + D_COMP_SUB_STD, + /* The restrict qualifier. */ + D_COMP_RESTRICT, + /* The volatile qualifier. */ + D_COMP_VOLATILE, + /* The const qualifier. */ + D_COMP_CONST, + /* The restrict qualifier modifying a member function. */ + D_COMP_RESTRICT_THIS, + /* The volatile qualifier modifying a member function. */ + D_COMP_VOLATILE_THIS, + /* The const qualifier modifying a member function. */ + D_COMP_CONST_THIS, + /* A vendor qualifier. */ + D_COMP_VENDOR_TYPE_QUAL, + /* A pointer. */ + D_COMP_POINTER, + /* A reference. */ + D_COMP_REFERENCE, + /* A complex type. */ + D_COMP_COMPLEX, + /* An imaginary type. */ + D_COMP_IMAGINARY, + /* A builtin type. */ + D_COMP_BUILTIN_TYPE, + /* A vendor's builtin type. */ + D_COMP_VENDOR_TYPE, + /* A function type. */ + D_COMP_FUNCTION_TYPE, + /* An array type. */ + D_COMP_ARRAY_TYPE, + /* A pointer to member type. */ + D_COMP_PTRMEM_TYPE, + /* An argument list. */ + D_COMP_ARGLIST, + /* A template argument list. */ + D_COMP_TEMPLATE_ARGLIST, + /* An operator. */ + D_COMP_OPERATOR, + /* An extended operator. */ + D_COMP_EXTENDED_OPERATOR, + /* A typecast. */ + D_COMP_CAST, + /* A unary expression. */ + D_COMP_UNARY, + /* A binary expression. */ + D_COMP_BINARY, + /* Arguments to a binary expression. */ + D_COMP_BINARY_ARGS, + /* A trinary expression. */ + D_COMP_TRINARY, + /* Arguments to a trinary expression. */ + D_COMP_TRINARY_ARG1, + D_COMP_TRINARY_ARG2, + /* A literal. */ + D_COMP_LITERAL, + /* A negative literal. */ + D_COMP_LITERAL_NEG }; -/* Data structure representing a template argument list. */ +/* A component of the mangled name. */ -struct template_arg_list_def +struct d_comp { - /* The next (lower) template argument list in the stack of currently - active template arguments. */ - struct template_arg_list_def *next; + /* The type of this component. */ + enum d_comp_type type; + union + { + /* For D_COMP_NAME. */ + struct + { + /* A pointer to the name (not NULL terminated) and it's + length. */ + const char *s; + int len; + } s_name; - /* The first element in the list of template arguments in - left-to-right order. */ - string_list_t first_argument; + /* For D_COMP_OPERATOR. */ + struct + { + /* Operator. */ + const struct d_operator_info *op; + } s_operator; - /* The last element in the arguments lists. */ - string_list_t last_argument; -}; + /* For D_COMP_EXTENDED_OPERATOR. */ + struct + { + /* Number of arguments. */ + int args; + /* Name. */ + struct d_comp *name; + } s_extended_operator; -typedef struct template_arg_list_def *template_arg_list_t; + /* For D_COMP_CTOR. */ + struct + { + enum gnu_v3_ctor_kinds kind; + struct d_comp *name; + } s_ctor; -/* Data structure to maintain the state of the current demangling. */ + /* For D_COMP_DTOR. */ + struct + { + enum gnu_v3_dtor_kinds kind; + struct d_comp *name; + } s_dtor; -struct demangling_def -{ - /* The full mangled name being mangled. */ - const char *name; + /* For D_COMP_BUILTIN_TYPE. */ + struct + { + const struct d_builtin_type_info *type; + } s_builtin; - /* Pointer into name at the current position. */ - const char *next; + /* For D_COMP_SUB_STD. */ + struct + { + const char* string; + } s_string; - /* Stack for strings containing demangled result generated so far. - Text is emitted to the topmost (first) string. */ - string_list_t result; + /* For D_COMP_TEMPLATE_PARAM. */ + struct + { + long number; + } s_number; - /* The number of presently available substitutions. */ - int num_substitutions; + /* For other types. */ + struct + { + struct d_comp *left; + struct d_comp *right; + } s_binary; - /* The allocated size of the substitutions array. */ - int substitutions_allocated; + } u; +}; - /* An array of available substitutions. The number of elements in - the array is given by num_substitions, and the allocated array - size in substitutions_size. +#define d_left(dc) ((dc)->u.s_binary.left) +#define d_right(dc) ((dc)->u.s_binary.right) + +/* The information structure we pass around. */ + +struct d_info +{ + /* The string we are demangling. */ + const char *s; + /* The options passed to the demangler. */ + int options; + /* The next character in the string to consider. */ + const char *n; + /* The array of components. */ + struct d_comp *comps; + /* The index of the next available component. */ + int next_comp; + /* The number of available component structures. */ + int num_comps; + /* The array of substitutions. */ + struct d_comp **subs; + /* The index of the next substitution. */ + int next_sub; + /* The number of available entries in the subs array. */ + int num_subs; + /* The last name we saw, for constructors and destructors. */ + struct d_comp *last_name; +}; - The most recent substition is at the end, so +#define d_peek_char(di) (*((di)->n)) +#define d_peek_next_char(di) ((di)->n[1]) +#define d_advance(di, i) ((di)->n += (i)) +#define d_next_char(di) (*((di)->n++)) +#define d_str(di) ((di)->n) - - `S_' corresponds to substititutions[num_substitutions - 1] - - `S0_' corresponds to substititutions[num_substitutions - 2] +/* A list of templates. This is used while printing. */ - etc. */ - struct substitution_def *substitutions; +struct d_print_template +{ + /* Next template on the list. */ + struct d_print_template *next; + /* This template. */ + const struct d_comp *template; +}; - /* The stack of template argument lists. */ - template_arg_list_t template_arg_lists; +/* A list of type modifiers. This is used while printing. */ - /* The most recently demangled source-name. */ - dyn_string_t last_source_name; - - /* Language style to use for demangled output. */ - int style; +struct d_print_mod +{ + /* Next modifier on the list. These are in the reverse of the order + in which they appeared in the mangled string. */ + struct d_print_mod *next; + /* The modifier. */ + const struct d_comp *mod; + /* Whether this modifier was printed. */ + int printed; + /* The list of templates which applies to this modifier. */ + struct d_print_template *templates; +}; - /* Set to non-zero iff this name is a constructor. The actual value - indicates what sort of constructor this is; see demangle.h. */ - enum gnu_v3_ctor_kinds is_constructor; +/* We use this structure to hold information during printing. */ + +struct d_print_info +{ + /* The options passed to the demangler. */ + int options; + /* Buffer holding the result. */ + char *buf; + /* Current length of data in buffer. */ + size_t len; + /* Allocated size of buffer. */ + size_t alc; + /* The current list of templates, if any. */ + struct d_print_template *templates; + /* The current list of modifiers (e.g., pointer, reference, etc.), + if any. */ + struct d_print_mod *modifiers; + /* Set to 1 if we had a memory allocation failure. */ + int allocation_failure; +}; - /* Set to non-zero iff this name is a destructor. The actual value - indicates what sort of destructor this is; see demangle.h. */ - enum gnu_v3_dtor_kinds is_destructor; +#define d_print_saw_error(dpi) ((dpi)->buf == NULL) -}; +#define d_append_char(dpi, c) \ + do \ + { \ + if ((dpi)->buf != NULL && (dpi)->len < (dpi)->alc) \ + (dpi)->buf[(dpi)->len++] = (c); \ + else \ + d_print_append_char ((dpi), (c)); \ + } \ + while (0) -typedef struct demangling_def *demangling_t; - -/* This type is the standard return code from most functions. Values - other than STATUS_OK contain descriptive messages. */ -typedef const char *status_t; - -/* Special values that can be used as a status_t. */ -#define STATUS_OK NULL -#define STATUS_ERROR "Error." -#define STATUS_UNIMPLEMENTED "Unimplemented." -#define STATUS_INTERNAL_ERROR "Internal error." - -/* This status code indicates a failure in malloc or realloc. */ -static const char *const status_allocation_failed = "Allocation failed."; -#define STATUS_ALLOCATION_FAILED status_allocation_failed - -/* Non-zero if STATUS indicates that no error has occurred. */ -#define STATUS_NO_ERROR(STATUS) ((STATUS) == STATUS_OK) - -/* Evaluate EXPR, which must produce a status_t. If the status code - indicates an error, return from the current function with that - status code. */ -#define RETURN_IF_ERROR(EXPR) \ - do \ - { \ - status_t s = EXPR; \ - if (!STATUS_NO_ERROR (s)) \ - return s; \ - } \ +#define d_append_buffer(dpi, s, l) \ + do \ + { \ + if ((dpi)->buf != NULL && (dpi)->len + (l) <= (dpi)->alc) \ + { \ + memcpy ((dpi)->buf + (dpi)->len, (s), (l)); \ + (dpi)->len += l; \ + } \ + else \ + d_print_append_buffer ((dpi), (s), (l)); \ + } \ while (0) -static status_t int_to_dyn_string - PARAMS ((int, dyn_string_t)); -static string_list_t string_list_new - PARAMS ((int)); -static void string_list_delete - PARAMS ((string_list_t)); -static status_t result_add_separated_char - PARAMS ((demangling_t, int)); -static status_t result_push - PARAMS ((demangling_t)); -static string_list_t result_pop - PARAMS ((demangling_t)); -static int substitution_start - PARAMS ((demangling_t)); -static status_t substitution_add - PARAMS ((demangling_t, int, int)); -static dyn_string_t substitution_get - PARAMS ((demangling_t, int, int *)); +#define d_append_string(dpi, s) \ + do \ + { \ + size_t d_append_string_len = strlen (s); \ + d_append_buffer ((dpi), (s), d_append_string_len); \ + } \ + while (0) + +#define d_last_char(dpi) \ + ((dpi)->buf == NULL || (dpi)->len == 0 ? '\0' : (dpi)->buf[(dpi)->len - 1]) + #ifdef CP_DEMANGLE_DEBUG -static void substitutions_print - PARAMS ((demangling_t, FILE *)); +static void d_dump PARAMS ((struct d_comp *, int)); #endif -static template_arg_list_t template_arg_list_new - PARAMS ((void)); -static void template_arg_list_delete - PARAMS ((template_arg_list_t)); -static void template_arg_list_add_arg - PARAMS ((template_arg_list_t, string_list_t)); -static string_list_t template_arg_list_get_arg - PARAMS ((template_arg_list_t, int)); -static void push_template_arg_list - PARAMS ((demangling_t, template_arg_list_t)); -static void pop_to_template_arg_list - PARAMS ((demangling_t, template_arg_list_t)); +static struct d_comp *d_make_empty PARAMS ((struct d_info *, + enum d_comp_type)); +static struct d_comp *d_make_comp PARAMS ((struct d_info *, enum d_comp_type, + struct d_comp *, struct d_comp *)); +static struct d_comp *d_make_name PARAMS ((struct d_info *, const char *, + int)); +static struct d_comp *d_make_builtin_type PARAMS ((struct d_info *, + const struct d_builtin_type_info *)); +static struct d_comp *d_make_operator PARAMS ((struct d_info *, + const struct d_operator_info *)); +static struct d_comp *d_make_extended_operator PARAMS ((struct d_info *, + int, + struct d_comp *)); +static struct d_comp *d_make_ctor PARAMS ((struct d_info *, + enum gnu_v3_ctor_kinds, + struct d_comp *)); +static struct d_comp *d_make_dtor PARAMS ((struct d_info *, + enum gnu_v3_dtor_kinds, + struct d_comp *)); +static struct d_comp *d_make_template_param PARAMS ((struct d_info *, long)); +static struct d_comp *d_make_sub PARAMS ((struct d_info *, const char *)); +static struct d_comp *d_mangled_name PARAMS ((struct d_info *, int)); +static int has_return_type PARAMS ((struct d_comp *)); +static int is_ctor_dtor_or_conversion PARAMS ((struct d_comp *)); +static struct d_comp *d_encoding PARAMS ((struct d_info *, int)); +static struct d_comp *d_name PARAMS ((struct d_info *)); +static struct d_comp *d_nested_name PARAMS ((struct d_info *)); +static struct d_comp *d_prefix PARAMS ((struct d_info *)); +static struct d_comp *d_unqualified_name PARAMS ((struct d_info *)); +static struct d_comp *d_source_name PARAMS ((struct d_info *)); +static long d_number PARAMS ((struct d_info *)); +static struct d_comp *d_identifier PARAMS ((struct d_info *, int)); +static struct d_comp *d_operator_name PARAMS ((struct d_info *)); +static struct d_comp *d_special_name PARAMS ((struct d_info *)); +static int d_call_offset PARAMS ((struct d_info *, int)); +static struct d_comp *d_ctor_dtor_name PARAMS ((struct d_info *)); +static struct d_comp *d_type PARAMS ((struct d_info *)); +static struct d_comp **d_cv_qualifiers PARAMS ((struct d_info *, + struct d_comp **, int)); +static struct d_comp *d_function_type PARAMS ((struct d_info *)); +static struct d_comp *d_bare_function_type PARAMS ((struct d_info *, int)); +static struct d_comp *d_class_enum_type PARAMS ((struct d_info *)); +static struct d_comp *d_array_type PARAMS ((struct d_info *)); +static struct d_comp *d_pointer_to_member_type PARAMS ((struct d_info *)); +static struct d_comp *d_template_param PARAMS ((struct d_info *)); +static struct d_comp *d_template_args PARAMS ((struct d_info *)); +static struct d_comp *d_template_arg PARAMS ((struct d_info *)); +static struct d_comp *d_expression PARAMS ((struct d_info *)); +static struct d_comp *d_expr_primary PARAMS ((struct d_info *)); +static struct d_comp *d_local_name PARAMS ((struct d_info *)); +static int d_discriminator PARAMS ((struct d_info *)); +static int d_add_substitution PARAMS ((struct d_info *, struct d_comp *)); +static struct d_comp *d_substitution PARAMS ((struct d_info *, int)); +static void d_print_resize PARAMS ((struct d_print_info *, size_t)); +static void d_print_append_char PARAMS ((struct d_print_info *, int)); +static void d_print_append_buffer PARAMS ((struct d_print_info *, const char *, + size_t)); +static void d_print_error PARAMS ((struct d_print_info *)); +static char *d_print PARAMS ((int, const struct d_comp *, size_t *)); +static void d_print_comp PARAMS ((struct d_print_info *, + const struct d_comp *)); +static void d_print_identifier PARAMS ((struct d_print_info *, const char *, + int)); +static void d_print_mod_list PARAMS ((struct d_print_info *, + struct d_print_mod *, int)); +static void d_print_mod PARAMS ((struct d_print_info *, + const struct d_comp *)); +static void d_print_function_type PARAMS ((struct d_print_info *, + const struct d_comp *, + struct d_print_mod *)); +static void d_print_array_type PARAMS ((struct d_print_info *, + const struct d_comp *, + struct d_print_mod *)); +static void d_print_expr_op PARAMS ((struct d_print_info *, + const struct d_comp *)); +static void d_print_cast PARAMS ((struct d_print_info *, + const struct d_comp *)); +static int d_init_info PARAMS ((const char *, int, size_t, struct d_info *)); +static char *d_demangle PARAMS ((const char *, int, size_t *)); + #ifdef CP_DEMANGLE_DEBUG -static void template_arg_list_print - PARAMS ((template_arg_list_t, FILE *)); -#endif -static template_arg_list_t current_template_arg_list - PARAMS ((demangling_t)); -static demangling_t demangling_new - PARAMS ((const char *, int)); -static void demangling_delete - PARAMS ((demangling_t)); - -/* The last character of DS. Warning: DS is evaluated twice. */ -#define dyn_string_last_char(DS) \ - (dyn_string_buf (DS)[dyn_string_length (DS) - 1]) - -/* Append a space character (` ') to DS if it does not already end - with one. Evaluates to 1 on success, or 0 on allocation failure. */ -#define dyn_string_append_space(DS) \ - ((dyn_string_length (DS) > 0 \ - && dyn_string_last_char (DS) != ' ') \ - ? dyn_string_append_char ((DS), ' ') \ - : 1) - -/* Returns the index of the current position in the mangled name. */ -#define current_position(DM) ((DM)->next - (DM)->name) - -/* Returns the character at the current position of the mangled name. */ -#define peek_char(DM) (*((DM)->next)) - -/* Returns the character one past the current position of the mangled - name. */ -#define peek_char_next(DM) \ - (peek_char (DM) == '\0' ? '\0' : (*((DM)->next + 1))) - -/* Returns the character at the current position, and advances the - current position to the next character. */ -#define next_char(DM) (*((DM)->next)++) - -/* Returns non-zero if the current position is the end of the mangled - name, i.e. one past the last character. */ -#define end_of_name_p(DM) (peek_char (DM) == '\0') - -/* Advances the current position by one character. */ -#define advance_char(DM) (++(DM)->next) - -/* Returns the string containing the current demangled result. */ -#define result_string(DM) (&(DM)->result->string) - -/* Returns the position at which new text is inserted into the - demangled result. */ -#define result_caret_pos(DM) \ - (result_length (DM) + \ - ((string_list_t) result_string (DM))->caret_position) - -/* Adds a dyn_string_t to the demangled result. */ -#define result_add_string(DM, STRING) \ - (dyn_string_insert (&(DM)->result->string, \ - result_caret_pos (DM), (STRING)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* Adds NUL-terminated string CSTR to the demangled result. */ -#define result_add(DM, CSTR) \ - (dyn_string_insert_cstr (&(DM)->result->string, \ - result_caret_pos (DM), (CSTR)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* Adds character CHAR to the demangled result. */ -#define result_add_char(DM, CHAR) \ - (dyn_string_insert_char (&(DM)->result->string, \ - result_caret_pos (DM), (CHAR)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* Inserts a dyn_string_t to the demangled result at position POS. */ -#define result_insert_string(DM, POS, STRING) \ - (dyn_string_insert (&(DM)->result->string, (POS), (STRING)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* Inserts NUL-terminated string CSTR to the demangled result at - position POS. */ -#define result_insert(DM, POS, CSTR) \ - (dyn_string_insert_cstr (&(DM)->result->string, (POS), (CSTR)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* Inserts character CHAR to the demangled result at position POS. */ -#define result_insert_char(DM, POS, CHAR) \ - (dyn_string_insert_char (&(DM)->result->string, (POS), (CHAR)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* The length of the current demangled result. */ -#define result_length(DM) \ - dyn_string_length (&(DM)->result->string) - -/* Appends a (less-than, greater-than) character to the result in DM - to (open, close) a template argument or parameter list. Appends a - space first if necessary to prevent spurious elision of angle - brackets with the previous character. */ -#define result_open_template_list(DM) result_add_separated_char(DM, '<') -#define result_close_template_list(DM) result_add_separated_char(DM, '>') - -/* Appends a base 10 representation of VALUE to DS. STATUS_OK on - success. On failure, deletes DS and returns an error code. */ - -static status_t -int_to_dyn_string (value, ds) - int value; - dyn_string_t ds; + +static void +d_dump (dc, indent) + struct d_comp *dc; + int indent; { int i; - int mask = 1; - /* Handle zero up front. */ - if (value == 0) - { - if (!dyn_string_append_char (ds, '0')) - return STATUS_ALLOCATION_FAILED; - return STATUS_OK; + if (dc == NULL) + return; + + for (i = 0; i < indent; ++i) + putchar (' '); + + switch (dc->type) + { + case D_COMP_NAME: + printf ("name '%.*s'\n", dc->u.s_name.len, dc->u.s_name.s); + return; + case D_COMP_TEMPLATE_PARAM: + printf ("template parameter %ld\n", dc->u.s_number.number); + return; + case D_COMP_CTOR: + printf ("constructor %d\n", (int) dc->u.s_ctor.kind); + d_dump (dc->u.s_ctor.name, indent + 2); + return; + case D_COMP_DTOR: + printf ("destructor %d\n", (int) dc->u.s_dtor.kind); + d_dump (dc->u.s_dtor.name, indent + 2); + return; + case D_COMP_SUB_STD: + printf ("standard substitution %s\n", dc->u.s_string.string); + return; + case D_COMP_BUILTIN_TYPE: + printf ("builtin type %s\n", dc->u.s_builtin.type->name); + return; + case D_COMP_OPERATOR: + printf ("operator %s\n", dc->u.s_operator.op->name); + return; + case D_COMP_EXTENDED_OPERATOR: + printf ("extended operator with %d args\n", + dc->u.s_extended_operator.args); + d_dump (dc->u.s_extended_operator.name, indent + 2); + return; + + case D_COMP_QUAL_NAME: + printf ("qualified name\n"); + break; + case D_COMP_TYPED_NAME: + printf ("typed name\n"); + break; + case D_COMP_TEMPLATE: + printf ("template\n"); + break; + case D_COMP_VTABLE: + printf ("vtable\n"); + break; + case D_COMP_VTT: + printf ("VTT\n"); + break; + case D_COMP_CONSTRUCTION_VTABLE: + printf ("construction vtable\n"); + break; + case D_COMP_TYPEINFO: + printf ("typeinfo\n"); + break; + case D_COMP_TYPEINFO_NAME: + printf ("typeinfo name\n"); + break; + case D_COMP_TYPEINFO_FN: + printf ("typeinfo function\n"); + break; + case D_COMP_THUNK: + printf ("thunk\n"); + break; + case D_COMP_VIRTUAL_THUNK: + printf ("virtual thunk\n"); + break; + case D_COMP_COVARIANT_THUNK: + printf ("covariant thunk\n"); + break; + case D_COMP_JAVA_CLASS: + printf ("java class\n"); + break; + case D_COMP_GUARD: + printf ("guard\n"); + break; + case D_COMP_REFTEMP: + printf ("reference temporary\n"); + break; + case D_COMP_RESTRICT: + printf ("restrict\n"); + break; + case D_COMP_VOLATILE: + printf ("volatile\n"); + break; + case D_COMP_CONST: + printf ("const\n"); + break; + case D_COMP_RESTRICT_THIS: + printf ("restrict this\n"); + break; + case D_COMP_VOLATILE_THIS: + printf ("volatile this\n"); + break; + case D_COMP_CONST_THIS: + printf ("const this\n"); + break; + case D_COMP_VENDOR_TYPE_QUAL: + printf ("vendor type qualifier\n"); + break; + case D_COMP_POINTER: + printf ("pointer\n"); + break; + case D_COMP_REFERENCE: + printf ("reference\n"); + break; + case D_COMP_COMPLEX: + printf ("complex\n"); + break; + case D_COMP_IMAGINARY: + printf ("imaginary\n"); + break; + case D_COMP_VENDOR_TYPE: + printf ("vendor type\n"); + break; + case D_COMP_FUNCTION_TYPE: + printf ("function type\n"); + break; + case D_COMP_ARRAY_TYPE: + printf ("array type\n"); + break; + case D_COMP_PTRMEM_TYPE: + printf ("pointer to member type\n"); + break; + case D_COMP_ARGLIST: + printf ("argument list\n"); + break; + case D_COMP_TEMPLATE_ARGLIST: + printf ("template argument list\n"); + break; + case D_COMP_CAST: + printf ("cast\n"); + break; + case D_COMP_UNARY: + printf ("unary operator\n"); + break; + case D_COMP_BINARY: + printf ("binary operator\n"); + break; + case D_COMP_BINARY_ARGS: + printf ("binary operator arguments\n"); + break; + case D_COMP_TRINARY: + printf ("trinary operator\n"); + break; + case D_COMP_TRINARY_ARG1: + printf ("trinary operator arguments 1\n"); + break; + case D_COMP_TRINARY_ARG2: + printf ("trinary operator arguments 1\n"); + break; + case D_COMP_LITERAL: + printf ("literal\n"); + break; + case D_COMP_LITERAL_NEG: + printf ("negative literal\n"); + break; } - /* For negative numbers, emit a minus sign. */ - if (value < 0) - { - if (!dyn_string_append_char (ds, '-')) - return STATUS_ALLOCATION_FAILED; - value = -value; + d_dump (d_left (dc), indent + 2); + d_dump (d_right (dc), indent + 2); +} + +#endif /* CP_DEMANGLE_DEBUG */ + +/* Add a new component. */ + +static struct d_comp * +d_make_empty (di, type) + struct d_info *di; + enum d_comp_type type; +{ + struct d_comp *p; + + if (di->next_comp >= di->num_comps) + return NULL; + p = &di->comps[di->next_comp]; + p->type = type; + ++di->next_comp; + return p; +} + +/* Add a new generic component. */ + +static struct d_comp * +d_make_comp (di, type, left, right) + struct d_info *di; + enum d_comp_type type; + struct d_comp *left; + struct d_comp *right; +{ + struct d_comp *p; + + /* We check for errors here. A typical error would be a NULL return + from a subroutine. We catch those here, and return NULL + upward. */ + switch (type) + { + /* These types require two parameters. */ + case D_COMP_QUAL_NAME: + case D_COMP_TYPED_NAME: + case D_COMP_TEMPLATE: + case D_COMP_VENDOR_TYPE_QUAL: + case D_COMP_PTRMEM_TYPE: + case D_COMP_UNARY: + case D_COMP_BINARY: + case D_COMP_BINARY_ARGS: + case D_COMP_TRINARY: + case D_COMP_TRINARY_ARG1: + case D_COMP_TRINARY_ARG2: + case D_COMP_LITERAL: + case D_COMP_LITERAL_NEG: + if (left == NULL || right == NULL) + return NULL; + break; + + /* These types only require one parameter. */ + case D_COMP_VTABLE: + case D_COMP_VTT: + case D_COMP_CONSTRUCTION_VTABLE: + case D_COMP_TYPEINFO: + case D_COMP_TYPEINFO_NAME: + case D_COMP_TYPEINFO_FN: + case D_COMP_THUNK: + case D_COMP_VIRTUAL_THUNK: + case D_COMP_COVARIANT_THUNK: + case D_COMP_JAVA_CLASS: + case D_COMP_GUARD: + case D_COMP_REFTEMP: + case D_COMP_POINTER: + case D_COMP_REFERENCE: + case D_COMP_COMPLEX: + case D_COMP_IMAGINARY: + case D_COMP_VENDOR_TYPE: + case D_COMP_ARGLIST: + case D_COMP_TEMPLATE_ARGLIST: + case D_COMP_CAST: + if (left == NULL) + return NULL; + break; + + /* This needs a right parameter, but the left parameter can be + empty. */ + case D_COMP_ARRAY_TYPE: + if (right == NULL) + return NULL; + break; + + /* These are allowed to have no parameters--in some cases they + will be filled in later. */ + case D_COMP_FUNCTION_TYPE: + case D_COMP_RESTRICT: + case D_COMP_VOLATILE: + case D_COMP_CONST: + case D_COMP_RESTRICT_THIS: + case D_COMP_VOLATILE_THIS: + case D_COMP_CONST_THIS: + break; + + /* Other types should not be seen here. */ + default: + return NULL; } - - /* Find the power of 10 of the first digit. */ - i = value; - while (i > 9) + + p = d_make_empty (di, type); + if (p != NULL) { - mask *= 10; - i /= 10; + p->u.s_binary.left = left; + p->u.s_binary.right = right; } + return p; +} - /* Write the digits. */ - while (mask > 0) - { - int digit = value / mask; +/* Add a new name component. */ - if (!dyn_string_append_char (ds, '0' + digit)) - return STATUS_ALLOCATION_FAILED; +static struct d_comp * +d_make_name (di, s, len) + struct d_info *di; + const char *s; + int len; +{ + struct d_comp *p; - value -= digit * mask; - mask /= 10; + if (s == NULL || len == 0) + return NULL; + p = d_make_empty (di, D_COMP_NAME); + if (p != NULL) + { + p->u.s_name.s = s; + p->u.s_name.len = len; } - - return STATUS_OK; + return p; } -/* Creates a new string list node. The contents of the string are - empty, but the initial buffer allocation is LENGTH. The string - list node should be deleted with string_list_delete. Returns NULL - if allocation fails. */ +/* Add a new builtin type component. */ -static string_list_t -string_list_new (length) - int length; +static struct d_comp * +d_make_builtin_type (di, type) + struct d_info *di; + const struct d_builtin_type_info *type; { - string_list_t s = (string_list_t) malloc (sizeof (struct string_list_def)); - s->caret_position = 0; - if (s == NULL) - return NULL; - if (!dyn_string_init ((dyn_string_t) s, length)) + struct d_comp *p; + + if (type == NULL) return NULL; - return s; -} + p = d_make_empty (di, D_COMP_BUILTIN_TYPE); + if (p != NULL) + p->u.s_builtin.type = type; + return p; +} -/* Deletes the entire string list starting at NODE. */ +/* Add a new operator component. */ -static void -string_list_delete (node) - string_list_t node; +static struct d_comp * +d_make_operator (di, op) + struct d_info *di; + const struct d_operator_info *op; { - while (node != NULL) - { - string_list_t next = node->next; - dyn_string_delete ((dyn_string_t) node); - node = next; - } + struct d_comp *p; + + p = d_make_empty (di, D_COMP_OPERATOR); + if (p != NULL) + p->u.s_operator.op = op; + return p; } -/* Appends CHARACTER to the demangled result. If the current trailing - character of the result is CHARACTER, a space is inserted first. */ +/* Add a new extended operator component. */ -static status_t -result_add_separated_char (dm, character) - demangling_t dm; - int character; +static struct d_comp * +d_make_extended_operator (di, args, name) + struct d_info *di; + int args; + struct d_comp *name; { - char *result = dyn_string_buf (result_string (dm)); - int caret_pos = result_caret_pos (dm); + struct d_comp *p; - /* Add a space if the last character is already the character we - want to add. */ - if (caret_pos > 0 && result[caret_pos - 1] == character) - RETURN_IF_ERROR (result_add_char (dm, ' ')); - /* Add the character. */ - RETURN_IF_ERROR (result_add_char (dm, character)); - - return STATUS_OK; + if (name == NULL) + return NULL; + p = d_make_empty (di, D_COMP_EXTENDED_OPERATOR); + if (p != NULL) + { + p->u.s_extended_operator.args = args; + p->u.s_extended_operator.name = name; + } + return p; } -/* Allocates and pushes a new string onto the demangled results stack - for DM. Subsequent demangling with DM will emit to the new string. - Returns STATUS_OK on success, STATUS_ALLOCATION_FAILED on - allocation failure. */ +/* Add a new constructor component. */ -static status_t -result_push (dm) - demangling_t dm; +static struct d_comp * +d_make_ctor (di, kind, name) + struct d_info *di; + enum gnu_v3_ctor_kinds kind; + struct d_comp *name; { - string_list_t new_string = string_list_new (0); - if (new_string == NULL) - /* Allocation failed. */ - return STATUS_ALLOCATION_FAILED; - - /* Link the new string to the front of the list of result strings. */ - new_string->next = (string_list_t) dm->result; - dm->result = new_string; - return STATUS_OK; + struct d_comp *p; + + if (name == NULL) + return NULL; + p = d_make_empty (di, D_COMP_CTOR); + if (p != NULL) + { + p->u.s_ctor.kind = kind; + p->u.s_ctor.name = name; + } + return p; } -/* Removes and returns the topmost element on the demangled results - stack for DM. The caller assumes ownership for the returned - string. */ +/* Add a new destructor component. */ -static string_list_t -result_pop (dm) - demangling_t dm; +static struct d_comp * +d_make_dtor (di, kind, name) + struct d_info *di; + enum gnu_v3_dtor_kinds kind; + struct d_comp *name; { - string_list_t top = dm->result; - dm->result = top->next; - return top; + struct d_comp *p; + + if (name == NULL) + return NULL; + p = d_make_empty (di, D_COMP_DTOR); + if (p != NULL) + { + p->u.s_dtor.kind = kind; + p->u.s_dtor.name = name; + } + return p; } -/* Returns the current value of the caret for the result string. The - value is an offet from the end of the result string. */ +/* Add a new template parameter. */ -static int -result_get_caret (dm) - demangling_t dm; +static struct d_comp * +d_make_template_param (di, i) + struct d_info *di; + long i; { - return ((string_list_t) result_string (dm))->caret_position; + struct d_comp *p; + + p = d_make_empty (di, D_COMP_TEMPLATE_PARAM); + if (p != NULL) + p->u.s_number.number = i; + return p; } -/* Sets the value of the caret for the result string, counted as an - offet from the end of the result string. */ +/* Add a new standard substitution component. */ -static void -result_set_caret (dm, position) - demangling_t dm; - int position; +static struct d_comp * +d_make_sub (di, name) + struct d_info *di; + const char *name; { - ((string_list_t) result_string (dm))->caret_position = position; + struct d_comp *p; + + p = d_make_empty (di, D_COMP_SUB_STD); + if (p != NULL) + p->u.s_string.string = name; + return p; } -/* Shifts the position of the next addition to the result by - POSITION_OFFSET. A negative value shifts the caret to the left. */ +/* <mangled-name> ::= _Z <encoding> -static void -result_shift_caret (dm, position_offset) - demangling_t dm; - int position_offset; + TOP_LEVEL is non-zero when called at the top level. */ + +static struct d_comp * +d_mangled_name (di, top_level) + struct d_info *di; + int top_level; { - ((string_list_t) result_string (dm))->caret_position += position_offset; + if (d_next_char (di) != '_') + return NULL; + if (d_next_char (di) != 'Z') + return NULL; + return d_encoding (di, top_level); } -/* Returns non-zero if the character that comes right before the place - where text will be added to the result is a space. In this case, - the caller should supress adding another space. */ +/* Return whether a function should have a return type. The argument + is the function name, which may be qualified in various ways. The + rules are that template functions have return types with some + exceptions, function types which are not part of a function name + mangling have return types with some exceptions, and non-template + function names do not have return types. The exceptions are that + constructors, destructors, and conversion operators do not have + return types. */ static int -result_previous_char_is_space (dm) - demangling_t dm; +has_return_type (dc) + struct d_comp *dc; { - char *result = dyn_string_buf (result_string (dm)); - int pos = result_caret_pos (dm); - return pos > 0 && result[pos - 1] == ' '; + if (dc == NULL) + return 0; + switch (dc->type) + { + default: + return 0; + case D_COMP_TEMPLATE: + return ! is_ctor_dtor_or_conversion (d_left (dc)); + case D_COMP_RESTRICT_THIS: + case D_COMP_VOLATILE_THIS: + case D_COMP_CONST_THIS: + return has_return_type (d_left (dc)); + } } -/* Returns the start position of a fragment of the demangled result - that will be a substitution candidate. Should be called at the - start of productions that can add substitutions. */ +/* Return whether a name is a constructor, a destructor, or a + conversion operator. */ static int -substitution_start (dm) - demangling_t dm; +is_ctor_dtor_or_conversion (dc) + struct d_comp *dc; { - return result_caret_pos (dm); + if (dc == NULL) + return 0; + switch (dc->type) + { + default: + return 0; + case D_COMP_QUAL_NAME: + return is_ctor_dtor_or_conversion (d_right (dc)); + case D_COMP_CTOR: + case D_COMP_DTOR: + case D_COMP_CAST: + return 1; + } } -/* Adds the suffix of the current demangled result of DM starting at - START_POSITION as a potential substitution. If TEMPLATE_P is - non-zero, this potential substitution is a template-id. */ +/* <encoding> ::= <(function) name> <bare-function-type> + ::= <(data) name> + ::= <special-name> -static status_t -substitution_add (dm, start_position, template_p) - demangling_t dm; - int start_position; - int template_p; -{ - dyn_string_t result = result_string (dm); - dyn_string_t substitution = dyn_string_new (0); - int i; + TOP_LEVEL is non-zero when called at the top level, in which case + if DMGL_PARAMS is not set we do not demangle the function + parameters. We only set this at the top level, because otherwise + we would not correctly demangle names in local scopes. */ - if (substitution == NULL) - return STATUS_ALLOCATION_FAILED; +static struct d_comp * +d_encoding (di, top_level) + struct d_info *di; + int top_level; +{ + char peek = d_peek_char (di); - /* Extract the substring of the current demangling result that - represents the subsitution candidate. */ - if (!dyn_string_substring (substitution, - result, start_position, result_caret_pos (dm))) + if (peek == 'G' || peek == 'T') + return d_special_name (di); + else { - dyn_string_delete (substitution); - return STATUS_ALLOCATION_FAILED; - } + struct d_comp *dc; - /* If there's no room for the new entry, grow the array. */ - if (dm->substitutions_allocated == dm->num_substitutions) - { - size_t new_array_size; - if (dm->substitutions_allocated > 0) - dm->substitutions_allocated *= 2; - else - dm->substitutions_allocated = 2; - new_array_size = - sizeof (struct substitution_def) * dm->substitutions_allocated; - - dm->substitutions = (struct substitution_def *) - realloc (dm->substitutions, new_array_size); - if (dm->substitutions == NULL) - /* Realloc failed. */ + dc = d_name (di); + + if (dc != NULL && top_level && (di->options & DMGL_PARAMS) == 0) { - dyn_string_delete (substitution); - return STATUS_ALLOCATION_FAILED; + /* Strip off any initial CV-qualifiers, as they really apply + to the `this' parameter, and they were not output by the + v2 demangler without DMGL_PARAMS. */ + while (dc->type == D_COMP_RESTRICT_THIS + || dc->type == D_COMP_VOLATILE_THIS + || dc->type == D_COMP_CONST_THIS) + dc = d_left (dc); + return dc; } + + peek = d_peek_char (di); + if (peek == '\0' || peek == 'E') + return dc; + return d_make_comp (di, D_COMP_TYPED_NAME, dc, + d_bare_function_type (di, has_return_type (dc))); } +} - /* Add the substitution to the array. */ - i = dm->num_substitutions++; - dm->substitutions[i].text = substitution; - dm->substitutions[i].template_p = template_p; +/* <name> ::= <nested-name> + ::= <unscoped-name> + ::= <unscoped-template-name> <template-args> + ::= <local-name> -#ifdef CP_DEMANGLE_DEBUG - substitutions_print (dm, stderr); -#endif + <unscoped-name> ::= <unqualified-name> + ::= St <unqualified-name> + + <unscoped-template-name> ::= <unscoped-name> + ::= <substitution> +*/ + +static struct d_comp * +d_name (di) + struct d_info *di; +{ + char peek = d_peek_char (di); + struct d_comp *dc; + + switch (peek) + { + case 'N': + return d_nested_name (di); + + case 'Z': + return d_local_name (di); - return STATUS_OK; + case 'S': + { + int subst; + + if (d_peek_next_char (di) != 't') + { + dc = d_substitution (di, 0); + subst = 1; + } + else + { + d_advance (di, 2); + dc = d_make_comp (di, D_COMP_QUAL_NAME, d_make_name (di, "std", 3), + d_unqualified_name (di)); + subst = 0; + } + + if (d_peek_char (di) != 'I') + { + /* The grammar does not permit this case to occur if we + called d_substitution() above (i.e., subst == 1). We + don't bother to check. */ + } + else + { + /* This is <template-args>, which means that we just saw + <unscoped-template-name>, which is a substitution + candidate if we didn't just get it from a + substitution. */ + if (! subst) + { + if (! d_add_substitution (di, dc)) + return NULL; + } + dc = d_make_comp (di, D_COMP_TEMPLATE, dc, d_template_args (di)); + } + + return dc; + } + + default: + dc = d_unqualified_name (di); + if (d_peek_char (di) == 'I') + { + /* This is <template-args>, which means that we just saw + <unscoped-template-name>, which is a substitution + candidate. */ + if (! d_add_substitution (di, dc)) + return NULL; + dc = d_make_comp (di, D_COMP_TEMPLATE, dc, d_template_args (di)); + } + return dc; + } } -/* Returns the Nth-most-recent substitution. Sets *TEMPLATE_P to - non-zero if the substitution is a template-id, zero otherwise. - N is numbered from zero. DM retains ownership of the returned - string. If N is negative, or equal to or greater than the current - number of substitution candidates, returns NULL. */ - -static dyn_string_t -substitution_get (dm, n, template_p) - demangling_t dm; - int n; - int *template_p; +/* <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E + ::= N [<CV-qualifiers>] <template-prefix> <template-args> E +*/ + +static struct d_comp * +d_nested_name (di) + struct d_info *di; { - struct substitution_def *sub; + struct d_comp *ret; + struct d_comp **pret; - /* Make sure N is in the valid range. */ - if (n < 0 || n >= dm->num_substitutions) + if (d_next_char (di) != 'N') return NULL; - sub = &(dm->substitutions[n]); - *template_p = sub->template_p; - return sub->text; + pret = d_cv_qualifiers (di, &ret, 1); + if (pret == NULL) + return NULL; + + *pret = d_prefix (di); + if (*pret == NULL) + return NULL; + + if (d_next_char (di) != 'E') + return NULL; + + return ret; } -#ifdef CP_DEMANGLE_DEBUG -/* Debugging routine to print the current substitutions to FP. */ +/* <prefix> ::= <prefix> <unqualified-name> + ::= <template-prefix> <template-args> + ::= <template-param> + ::= + ::= <substitution> -static void -substitutions_print (dm, fp) - demangling_t dm; - FILE *fp; + <template-prefix> ::= <prefix> <(template) unqualified-name> + ::= <template-param> + ::= <substitution> +*/ + +static struct d_comp * +d_prefix (di) + struct d_info *di; { - int seq_id; - int num = dm->num_substitutions; + struct d_comp *ret = NULL; - fprintf (fp, "SUBSTITUTIONS:\n"); - for (seq_id = -1; seq_id < num - 1; ++seq_id) + while (1) { - int template_p; - dyn_string_t text = substitution_get (dm, seq_id + 1, &template_p); + char peek; + enum d_comp_type comb_type; + struct d_comp *dc; + + peek = d_peek_char (di); + if (peek == '\0') + return NULL; + + /* The older code accepts a <local-name> here, but I don't see + that in the grammar. The older code does not accept a + <template-param> here. */ + + comb_type = D_COMP_QUAL_NAME; + if (IS_DIGIT (peek) + || IS_LOWER (peek) + || peek == 'C' + || peek == 'D') + dc = d_unqualified_name (di); + else if (peek == 'S') + dc = d_substitution (di, 1); + else if (peek == 'I') + { + if (ret == NULL) + return NULL; + comb_type = D_COMP_TEMPLATE; + dc = d_template_args (di); + } + else if (peek == 'T') + dc = d_template_param (di); + else if (peek == 'E') + return ret; + else + return NULL; - if (seq_id == -1) - fprintf (fp, " S_ "); + if (ret == NULL) + ret = dc; else - fprintf (fp, " S%d_", seq_id); - fprintf (fp, " %c: %s\n", template_p ? '*' : ' ', dyn_string_buf (text)); + ret = d_make_comp (di, comb_type, ret, dc); + + if (peek != 'S' && d_peek_char (di) != 'E') + { + if (! d_add_substitution (di, ret)) + return NULL; + } } } -#endif /* CP_DEMANGLE_DEBUG */ - -/* Creates a new template argument list. Returns NULL if allocation - fails. */ +/* <unqualified-name> ::= <operator-name> + ::= <ctor-dtor-name> + ::= <source-name> +*/ -static template_arg_list_t -template_arg_list_new () +static struct d_comp * +d_unqualified_name (di) + struct d_info *di; { - template_arg_list_t new_list = - (template_arg_list_t) malloc (sizeof (struct template_arg_list_def)); - if (new_list == NULL) + char peek; + + peek = d_peek_char (di); + if (IS_DIGIT (peek)) + return d_source_name (di); + else if (IS_LOWER (peek)) + return d_operator_name (di); + else if (peek == 'C' || peek == 'D') + return d_ctor_dtor_name (di); + else return NULL; - /* Initialize the new list to have no arguments. */ - new_list->first_argument = NULL; - new_list->last_argument = NULL; - /* Return the new list. */ - return new_list; } -/* Deletes a template argument list and the template arguments it - contains. */ +/* <source-name> ::= <(positive length) number> <identifier> */ -static void -template_arg_list_delete (list) - template_arg_list_t list; +static struct d_comp * +d_source_name (di) + struct d_info *di; { - /* If there are any arguments on LIST, delete them. */ - if (list->first_argument != NULL) - string_list_delete (list->first_argument); - /* Delete LIST. */ - free (list); + long len; + struct d_comp *ret; + + len = d_number (di); + if (len <= 0) + return NULL; + ret = d_identifier (di, len); + di->last_name = ret; + return ret; } -/* Adds ARG to the template argument list ARG_LIST. */ +/* number ::= [n] <(non-negative decimal integer)> */ -static void -template_arg_list_add_arg (arg_list, arg) - template_arg_list_t arg_list; - string_list_t arg; +static long +d_number (di) + struct d_info *di; { - if (arg_list->first_argument == NULL) - /* If there were no arguments before, ARG is the first one. */ - arg_list->first_argument = arg; - else - /* Make ARG the last argument on the list. */ - arg_list->last_argument->next = arg; - /* Make ARG the last on the list. */ - arg_list->last_argument = arg; - arg->next = NULL; -} + int sign; + char peek; + long ret; -/* Returns the template arugment at position INDEX in template - argument list ARG_LIST. */ + sign = 1; + peek = d_peek_char (di); + if (peek == 'n') + { + sign = -1; + d_advance (di, 1); + peek = d_peek_char (di); + } -static string_list_t -template_arg_list_get_arg (arg_list, index) - template_arg_list_t arg_list; - int index; -{ - string_list_t arg = arg_list->first_argument; - /* Scan down the list of arguments to find the one at position - INDEX. */ - while (index--) + ret = 0; + while (1) { - arg = arg->next; - if (arg == NULL) - /* Ran out of arguments before INDEX hit zero. That's an - error. */ - return NULL; + if (! IS_DIGIT (peek)) + return ret * sign; + ret = ret * 10 + peek - '0'; + d_advance (di, 1); + peek = d_peek_char (di); } - /* Return the argument at position INDEX. */ - return arg; } -/* Pushes ARG_LIST onto the top of the template argument list stack. */ +/* identifier ::= <(unqualified source code identifier)> */ -static void -push_template_arg_list (dm, arg_list) - demangling_t dm; - template_arg_list_t arg_list; +static struct d_comp * +d_identifier (di, len) + struct d_info *di; + int len; { - arg_list->next = dm->template_arg_lists; - dm->template_arg_lists = arg_list; -#ifdef CP_DEMANGLE_DEBUG - fprintf (stderr, " ** pushing template arg list\n"); - template_arg_list_print (arg_list, stderr); -#endif -} + const char *name; -/* Pops and deletes elements on the template argument list stack until - arg_list is the topmost element. If arg_list is NULL, all elements - are popped and deleted. */ + name = d_str (di); + d_advance (di, len); -static void -pop_to_template_arg_list (dm, arg_list) - demangling_t dm; - template_arg_list_t arg_list; -{ - while (dm->template_arg_lists != arg_list) + /* Look for something which looks like a gcc encoding of an + anonymous namespace, and replace it with a more user friendly + name. */ + if (len >= (int) ANONYMOUS_NAMESPACE_PREFIX_LEN + 2 + && memcmp (name, ANONYMOUS_NAMESPACE_PREFIX, + ANONYMOUS_NAMESPACE_PREFIX_LEN) == 0) { - template_arg_list_t top = dm->template_arg_lists; - /* Disconnect the topmost element from the list. */ - dm->template_arg_lists = top->next; - /* Delete the popped element. */ - template_arg_list_delete (top); -#ifdef CP_DEMANGLE_DEBUG - fprintf (stderr, " ** removing template arg list\n"); -#endif + const char *s; + + s = name + ANONYMOUS_NAMESPACE_PREFIX_LEN; + if ((*s == '.' || *s == '_' || *s == '$') + && s[1] == 'N') + return d_make_name (di, "(anonymous namespace)", + sizeof "(anonymous namespace)" - 1); } + + return d_make_name (di, name, len); } -#ifdef CP_DEMANGLE_DEBUG +/* operator_name ::= many different two character encodings. + ::= cv <type> + ::= v <digit> <source-name> +*/ -/* Prints the contents of ARG_LIST to FP. */ +static const struct d_operator_info d_operators[] = +{ + { "aN", "&=", 2 }, + { "aS", "=", 2 }, + { "aa", "&&", 2 }, + { "ad", "&", 1 }, + { "an", "&", 2 }, + { "cl", "()", 0 }, + { "cm", ",", 2 }, + { "co", "~", 1 }, + { "dV", "/=", 2 }, + { "da", "delete[]", 1 }, + { "de", "*", 1 }, + { "dl", "delete", 1 }, + { "dv", "/", 2 }, + { "eO", "^=", 2 }, + { "eo", "^", 2 }, + { "eq", "==", 2 }, + { "ge", ">=", 2 }, + { "gt", ">", 2 }, + { "ix", "[]", 2 }, + { "lS", "<<=", 2 }, + { "le", "<=", 2 }, + { "ls", "<<", 2 }, + { "lt", "<", 2 }, + { "mI", "-=", 2 }, + { "mL", "*=", 2 }, + { "mi", "-", 2 }, + { "ml", "*", 2 }, + { "mm", "--", 1 }, + { "na", "new[]", 1 }, + { "ne", "!=", 2 }, + { "ng", "-", 1 }, + { "nt", "!", 1 }, + { "nw", "new", 1 }, + { "oR", "|=", 2 }, + { "oo", "||", 2 }, + { "or", "|", 2 }, + { "pL", "+=", 2 }, + { "pl", "+", 2 }, + { "pm", "->*", 2 }, + { "pp", "++", 1 }, + { "ps", "+", 1 }, + { "pt", "->", 2 }, + { "qu", "?", 3 }, + { "rM", "%=", 2 }, + { "rS", ">>=", 2 }, + { "rm", "%", 2 }, + { "rs", ">>", 2 }, + { "st", "sizeof ", 1 }, + { "sz", "sizeof ", 1 } +}; -static void -template_arg_list_print (arg_list, fp) - template_arg_list_t arg_list; - FILE *fp; +static struct d_comp * +d_operator_name (di) + struct d_info *di; { - string_list_t arg; - int index = -1; + char c1; + char c2; - fprintf (fp, "TEMPLATE ARGUMENT LIST:\n"); - for (arg = arg_list->first_argument; arg != NULL; arg = arg->next) + c1 = d_next_char (di); + c2 = d_next_char (di); + if (c1 == 'v' && IS_DIGIT (c2)) + return d_make_extended_operator (di, c2 - '0', d_source_name (di)); + else if (c1 == 'c' && c2 == 'v') + return d_make_comp (di, D_COMP_CAST, d_type (di), NULL); + else { - if (index == -1) - fprintf (fp, " T_ : "); - else - fprintf (fp, " T%d_ : ", index); - ++index; - fprintf (fp, "%s\n", dyn_string_buf ((dyn_string_t) arg)); - } -} + int low = 0; + int high = sizeof (d_operators) / sizeof (d_operators[0]); -#endif /* CP_DEMANGLE_DEBUG */ + while (1) + { + int i; + const struct d_operator_info *p; -/* Returns the topmost element on the stack of template argument - lists. If there is no list of template arguments, returns NULL. */ + i = low + (high - low) / 2; + p = d_operators + i; -static template_arg_list_t -current_template_arg_list (dm) - demangling_t dm; -{ - return dm->template_arg_lists; + if (c1 == p->code[0] && c2 == p->code[1]) + return d_make_operator (di, p); + + if (c1 < p->code[0] || (c1 == p->code[0] && c2 < p->code[1])) + high = i; + else + low = i + 1; + if (low == high) + return NULL; + } + } } -/* Allocates a demangling_t object for demangling mangled NAME. A new - result must be pushed before the returned object can be used. - Returns NULL if allocation fails. */ +/* <special-name> ::= TV <type> + ::= TT <type> + ::= TI <type> + ::= TS <type> + ::= GV <(object) name> + ::= T <call-offset> <(base) encoding> + ::= Tc <call-offset> <call-offset> <(base) encoding> + Also g++ extensions: + ::= TC <type> <(offset) number> _ <(base) type> + ::= TF <type> + ::= TJ <type> + ::= GR <name> +*/ -static demangling_t -demangling_new (name, style) - const char *name; - int style; +static struct d_comp * +d_special_name (di) + struct d_info *di; { - demangling_t dm; - dm = (demangling_t) malloc (sizeof (struct demangling_def)); - if (dm == NULL) - return NULL; + char c; - dm->name = name; - dm->next = name; - dm->result = NULL; - dm->num_substitutions = 0; - dm->substitutions_allocated = 10; - dm->template_arg_lists = NULL; - dm->last_source_name = dyn_string_new (0); - if (dm->last_source_name == NULL) - return NULL; - dm->substitutions = (struct substitution_def *) - malloc (dm->substitutions_allocated * sizeof (struct substitution_def)); - if (dm->substitutions == NULL) + c = d_next_char (di); + if (c == 'T') { - dyn_string_delete (dm->last_source_name); - return NULL; - } - dm->style = style; - dm->is_constructor = (enum gnu_v3_ctor_kinds) 0; - dm->is_destructor = (enum gnu_v3_dtor_kinds) 0; + switch (d_next_char (di)) + { + case 'V': + return d_make_comp (di, D_COMP_VTABLE, d_type (di), NULL); + case 'T': + return d_make_comp (di, D_COMP_VTT, d_type (di), NULL); + case 'I': + return d_make_comp (di, D_COMP_TYPEINFO, d_type (di), NULL); + case 'S': + return d_make_comp (di, D_COMP_TYPEINFO_NAME, d_type (di), NULL); - return dm; -} + case 'h': + if (! d_call_offset (di, 'h')) + return NULL; + return d_make_comp (di, D_COMP_THUNK, d_encoding (di, 0), NULL); -/* Deallocates a demangling_t object and all memory associated with - it. */ + case 'v': + if (! d_call_offset (di, 'v')) + return NULL; + return d_make_comp (di, D_COMP_VIRTUAL_THUNK, d_encoding (di, 0), + NULL); -static void -demangling_delete (dm) - demangling_t dm; -{ - int i; - template_arg_list_t arg_list = dm->template_arg_lists; + case 'c': + if (! d_call_offset (di, '\0')) + return NULL; + if (! d_call_offset (di, '\0')) + return NULL; + return d_make_comp (di, D_COMP_COVARIANT_THUNK, d_encoding (di, 0), + NULL); - /* Delete the stack of template argument lists. */ - while (arg_list != NULL) - { - template_arg_list_t next = arg_list->next; - template_arg_list_delete (arg_list); - arg_list = next; - } - /* Delete the list of substitutions. */ - for (i = dm->num_substitutions; --i >= 0; ) - dyn_string_delete (dm->substitutions[i].text); - free (dm->substitutions); - /* Delete the demangled result. */ - string_list_delete (dm->result); - /* Delete the stored identifier name. */ - dyn_string_delete (dm->last_source_name); - /* Delete the context object itself. */ - free (dm); -} + case 'C': + { + struct d_comp *derived_type; + long offset; + struct d_comp *base_type; + + derived_type = d_type (di); + offset = d_number (di); + if (offset < 0) + return NULL; + if (d_next_char (di) != '_') + return NULL; + base_type = d_type (di); + /* We don't display the offset. FIXME: We should display + it in verbose mode. */ + return d_make_comp (di, D_COMP_CONSTRUCTION_VTABLE, base_type, + derived_type); + } -/* These functions demangle an alternative of the corresponding - production in the mangling spec. The first argument of each is a - demangling context structure for the current demangling - operation. Most emit demangled text directly to the topmost result - string on the result string stack in the demangling context - structure. */ - -static status_t demangle_char - PARAMS ((demangling_t, int)); -static status_t demangle_mangled_name - PARAMS ((demangling_t)); -static status_t demangle_encoding - PARAMS ((demangling_t)); -static status_t demangle_name - PARAMS ((demangling_t, int *)); -static status_t demangle_nested_name - PARAMS ((demangling_t, int *)); -static status_t demangle_prefix - PARAMS ((demangling_t, int *)); -static status_t demangle_unqualified_name - PARAMS ((demangling_t, int *)); -static status_t demangle_source_name - PARAMS ((demangling_t)); -static status_t demangle_number - PARAMS ((demangling_t, int *, int, int)); -static status_t demangle_number_literally - PARAMS ((demangling_t, dyn_string_t, int, int)); -static status_t demangle_identifier - PARAMS ((demangling_t, int, dyn_string_t)); -static status_t demangle_operator_name - PARAMS ((demangling_t, int, int *, int *)); -static status_t demangle_nv_offset - PARAMS ((demangling_t)); -static status_t demangle_v_offset - PARAMS ((demangling_t)); -static status_t demangle_call_offset - PARAMS ((demangling_t)); -static status_t demangle_special_name - PARAMS ((demangling_t)); -static status_t demangle_ctor_dtor_name - PARAMS ((demangling_t)); -static status_t demangle_type_ptr - PARAMS ((demangling_t, int *, int)); -static status_t demangle_type - PARAMS ((demangling_t)); -static status_t demangle_CV_qualifiers - PARAMS ((demangling_t, dyn_string_t)); -static status_t demangle_builtin_type - PARAMS ((demangling_t)); -static status_t demangle_function_type - PARAMS ((demangling_t, int *)); -static status_t demangle_bare_function_type - PARAMS ((demangling_t, int *)); -static status_t demangle_class_enum_type - PARAMS ((demangling_t, int *)); -static status_t demangle_array_type - PARAMS ((demangling_t, int *)); -static status_t demangle_template_param - PARAMS ((demangling_t)); -static status_t demangle_template_args - PARAMS ((demangling_t)); -static status_t demangle_literal - PARAMS ((demangling_t)); -static status_t demangle_template_arg - PARAMS ((demangling_t)); -static status_t demangle_expression - PARAMS ((demangling_t)); -static status_t demangle_scope_expression - PARAMS ((demangling_t)); -static status_t demangle_expr_primary - PARAMS ((demangling_t)); -static status_t demangle_substitution - PARAMS ((demangling_t, int *)); -static status_t demangle_local_name - PARAMS ((demangling_t)); -static status_t demangle_discriminator - PARAMS ((demangling_t, int)); -static status_t cp_demangle - PARAMS ((const char *, dyn_string_t, int)); -static status_t cp_demangle_type - PARAMS ((const char*, dyn_string_t)); - -/* When passed to demangle_bare_function_type, indicates that the - function's return type is not encoded before its parameter types. */ -#define BFT_NO_RETURN_TYPE NULL - -/* Check that the next character is C. If so, consume it. If not, - return an error. */ - -static status_t -demangle_char (dm, c) - demangling_t dm; - int c; -{ - static char *error_message = NULL; + case 'F': + return d_make_comp (di, D_COMP_TYPEINFO_FN, d_type (di), NULL); + case 'J': + return d_make_comp (di, D_COMP_JAVA_CLASS, d_type (di), NULL); - if (peek_char (dm) == c) - { - advance_char (dm); - return STATUS_OK; + default: + return NULL; + } } - else + else if (c == 'G') { - if (error_message == NULL) - error_message = (char *) strdup ("Expected ?"); - error_message[9] = c; - return error_message; + switch (d_next_char (di)) + { + case 'V': + return d_make_comp (di, D_COMP_GUARD, d_name (di), NULL); + + case 'R': + return d_make_comp (di, D_COMP_REFTEMP, d_name (di), NULL); + + default: + return NULL; + } } + else + return NULL; } -/* Demangles and emits a <mangled-name>. +/* <call-offset> ::= h <nv-offset> _ + ::= v <v-offset> _ - <mangled-name> ::= _Z <encoding> */ + <nv-offset> ::= <(offset) number> -static status_t -demangle_mangled_name (dm) - demangling_t dm; -{ - DEMANGLE_TRACE ("mangled-name", dm); - RETURN_IF_ERROR (demangle_char (dm, '_')); - RETURN_IF_ERROR (demangle_char (dm, 'Z')); - RETURN_IF_ERROR (demangle_encoding (dm)); - return STATUS_OK; -} + <v-offset> ::= <(offset) number> _ <(virtual offset) number> -/* Demangles and emits an <encoding>. + The C parameter, if not '\0', is a character we just read which is + the start of the <call-offset>. - <encoding> ::= <function name> <bare-function-type> - ::= <data name> - ::= <special-name> */ + We don't display the offset information anywhere. FIXME: We should + display it in verbose mode. */ -static status_t -demangle_encoding (dm) - demangling_t dm; +static int +d_call_offset (di, c) + struct d_info *di; + int c; { - int encode_return_type; - int start_position; - template_arg_list_t old_arg_list = current_template_arg_list (dm); - char peek = peek_char (dm); + long offset; + long virtual_offset; - DEMANGLE_TRACE ("encoding", dm); - - /* Remember where the name starts. If it turns out to be a template - function, we'll have to insert the return type here. */ - start_position = result_caret_pos (dm); + if (c == '\0') + c = d_next_char (di); - if (peek == 'G' || peek == 'T') - RETURN_IF_ERROR (demangle_special_name (dm)); - else + if (c == 'h') + offset = d_number (di); + else if (c == 'v') { - /* Now demangle the name. */ - RETURN_IF_ERROR (demangle_name (dm, &encode_return_type)); - - /* If there's anything left, the name was a function name, with - maybe its return type, and its parameter types, following. */ - if (!end_of_name_p (dm) - && peek_char (dm) != 'E') - { - if (encode_return_type) - /* Template functions have their return type encoded. The - return type should be inserted at start_position. */ - RETURN_IF_ERROR - (demangle_bare_function_type (dm, &start_position)); - else - /* Non-template functions don't have their return type - encoded. */ - RETURN_IF_ERROR - (demangle_bare_function_type (dm, BFT_NO_RETURN_TYPE)); - } + offset = d_number (di); + if (d_next_char (di) != '_') + return 0; + virtual_offset = d_number (di); } + else + return 0; - /* Pop off template argument lists that were built during the - mangling of this name, to restore the old template context. */ - pop_to_template_arg_list (dm, old_arg_list); + if (d_next_char (di) != '_') + return 0; - return STATUS_OK; + return 1; } -/* Demangles and emits a <name>. +/* <ctor-dtor-name> ::= C1 + ::= C2 + ::= C3 + ::= D0 + ::= D1 + ::= D2 +*/ + +static struct d_comp * +d_ctor_dtor_name (di) + struct d_info *di; +{ + switch (d_next_char (di)) + { + case 'C': + { + enum gnu_v3_ctor_kinds kind; - <name> ::= <unscoped-name> - ::= <unscoped-template-name> <template-args> - ::= <nested-name> - ::= <local-name> + switch (d_next_char (di)) + { + case '1': + kind = gnu_v3_complete_object_ctor; + break; + case '2': + kind = gnu_v3_base_object_ctor; + break; + case '3': + kind = gnu_v3_complete_object_allocating_ctor; + break; + default: + return NULL; + } + return d_make_ctor (di, kind, di->last_name); + } - <unscoped-name> ::= <unqualified-name> - ::= St <unqualified-name> # ::std:: + case 'D': + { + enum gnu_v3_dtor_kinds kind; - <unscoped-template-name> - ::= <unscoped-name> - ::= <substitution> */ + switch (d_next_char (di)) + { + case '0': + kind = gnu_v3_deleting_dtor; + break; + case '1': + kind = gnu_v3_complete_object_dtor; + break; + case '2': + kind = gnu_v3_base_object_dtor; + break; + default: + return NULL; + } + return d_make_dtor (di, kind, di->last_name); + } -static status_t -demangle_name (dm, encode_return_type) - demangling_t dm; - int *encode_return_type; + default: + return NULL; + } +} + +/* <type> ::= <builtin-type> + ::= <function-type> + ::= <class-enum-type> + ::= <array-type> + ::= <pointer-to-member-type> + ::= <template-param> + ::= <template-template-param> <template-args> + ::= <substitution> + ::= <CV-qualifiers> <type> + ::= P <type> + ::= R <type> + ::= C <type> + ::= G <type> + ::= U <source-name> <type> + + <builtin-type> ::= various one letter codes + ::= u <source-name> +*/ + +static const struct d_builtin_type_info d_builtin_types[26] = +{ + /* a */ { "signed char", "signed char", D_PRINT_INT }, + /* b */ { "bool", "boolean", D_PRINT_BOOL }, + /* c */ { "char", "byte", D_PRINT_INT }, + /* d */ { "double", "double", D_PRINT_DEFAULT }, + /* e */ { "long double", "long double", D_PRINT_DEFAULT }, + /* f */ { "float", "float", D_PRINT_DEFAULT }, + /* g */ { "__float128", "__float128", D_PRINT_DEFAULT }, + /* h */ { "unsigned char", "unsigned char", D_PRINT_INT }, + /* i */ { "int", "int", D_PRINT_INT }, + /* j */ { "unsigned int", "unsigned", D_PRINT_INT }, + /* k */ { NULL, NULL, D_PRINT_DEFAULT }, + /* l */ { "long", "long", D_PRINT_LONG }, + /* m */ { "unsigned long", "unsigned long", D_PRINT_LONG }, + /* n */ { "__int128", "__int128", D_PRINT_DEFAULT }, + /* o */ { "unsigned __int128", "unsigned __int128", D_PRINT_DEFAULT }, + /* p */ { NULL, NULL, D_PRINT_DEFAULT }, + /* q */ { NULL, NULL, D_PRINT_DEFAULT }, + /* r */ { NULL, NULL, D_PRINT_DEFAULT }, + /* s */ { "short", "short", D_PRINT_INT }, + /* t */ { "unsigned short", "unsigned short", D_PRINT_INT }, + /* u */ { NULL, NULL, D_PRINT_DEFAULT }, + /* v */ { "void", "void", D_PRINT_VOID }, + /* w */ { "wchar_t", "char", D_PRINT_INT }, + /* x */ { "long long", "long", D_PRINT_DEFAULT }, + /* y */ { "unsigned long long", "unsigned long long", D_PRINT_DEFAULT }, + /* z */ { "...", "...", D_PRINT_DEFAULT }, +}; + +static struct d_comp * +d_type (di) + struct d_info *di; { - int start = substitution_start (dm); - char peek = peek_char (dm); - int is_std_substitution = 0; + char peek; + struct d_comp *ret; + int can_subst; + + /* The ABI specifies that when CV-qualifiers are used, the base type + is substitutable, and the fully qualified type is substitutable, + but the base type with a strict subset of the CV-qualifiers is + not substitutable. The natural recursive implementation of the + CV-qualifiers would cause subsets to be substitutable, so instead + we pull them all off now. + + FIXME: The ABI says that order-insensitive vendor qualifiers + should be handled in the same way, but we have no way to tell + which vendor qualifiers are order-insensitive and which are + order-sensitive. So we just assume that they are all + order-sensitive. g++ 3.4 supports only one vendor qualifier, + __vector, and it treats it as order-sensitive when mangling + names. */ + + peek = d_peek_char (di); + if (peek == 'r' || peek == 'V' || peek == 'K') + { + struct d_comp **pret; - /* Generally, the return type is encoded if the function is a - template-id, and suppressed otherwise. There are a few cases, - though, in which the return type is not encoded even for a - templated function. In these cases, this flag is set. */ - int suppress_return_type = 0; + pret = d_cv_qualifiers (di, &ret, 0); + if (pret == NULL) + return NULL; + *pret = d_type (di); + if (! d_add_substitution (di, ret)) + return NULL; + return ret; + } - DEMANGLE_TRACE ("name", dm); + can_subst = 1; switch (peek) { - case 'N': - /* This is a <nested-name>. */ - RETURN_IF_ERROR (demangle_nested_name (dm, encode_return_type)); + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': + case 'h': case 'i': case 'j': case 'l': case 'm': case 'n': + case 'o': case 's': case 't': + case 'v': case 'w': case 'x': case 'y': case 'z': + ret = d_make_builtin_type (di, &d_builtin_types[peek - 'a']); + can_subst = 0; + d_advance (di, 1); + break; + + case 'u': + d_advance (di, 1); + ret = d_make_comp (di, D_COMP_VENDOR_TYPE, d_source_name (di), NULL); break; + case 'F': + ret = d_function_type (di); + break; + + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case 'N': case 'Z': - RETURN_IF_ERROR (demangle_local_name (dm)); - *encode_return_type = 0; + ret = d_class_enum_type (di); break; - case 'S': - /* The `St' substitution allows a name nested in std:: to appear - without being enclosed in a nested name. */ - if (peek_char_next (dm) == 't') - { - (void) next_char (dm); - (void) next_char (dm); - RETURN_IF_ERROR (result_add (dm, "std::")); - RETURN_IF_ERROR - (demangle_unqualified_name (dm, &suppress_return_type)); - is_std_substitution = 1; - } - else - RETURN_IF_ERROR (demangle_substitution (dm, encode_return_type)); - /* Check if a template argument list immediately follows. - If so, then we just demangled an <unqualified-template-name>. */ - if (peek_char (dm) == 'I') + case 'A': + ret = d_array_type (di); + break; + + case 'M': + ret = d_pointer_to_member_type (di); + break; + + case 'T': + ret = d_template_param (di); + if (d_peek_char (di) == 'I') { - /* A template name of the form std::<unqualified-name> is a - substitution candidate. */ - if (is_std_substitution) - RETURN_IF_ERROR (substitution_add (dm, start, 0)); - /* Demangle the <template-args> here. */ - RETURN_IF_ERROR (demangle_template_args (dm)); - *encode_return_type = !suppress_return_type; + /* This is <template-template-param> <template-args>. The + <template-template-param> part is a substitution + candidate. */ + if (! d_add_substitution (di, ret)) + return NULL; + ret = d_make_comp (di, D_COMP_TEMPLATE, ret, d_template_args (di)); } - else - *encode_return_type = 0; + break; + case 'S': + /* If this is a special substitution, then it is the start of + <class-enum-type>. */ + { + char peek_next; + + peek_next = d_peek_next_char (di); + if (IS_DIGIT (peek_next) + || peek_next == '_' + || IS_UPPER (peek_next)) + { + ret = d_substitution (di, 0); + /* The substituted name may have been a template name and + may be followed by tepmlate args. */ + if (d_peek_char (di) == 'I') + ret = d_make_comp (di, D_COMP_TEMPLATE, ret, + d_template_args (di)); + else + can_subst = 0; + } + else + { + ret = d_class_enum_type (di); + /* If the substitution was a complete type, then it is not + a new substitution candidate. However, if the + substitution was followed by template arguments, then + the whole thing is a substitution candidate. */ + if (ret != NULL && ret->type == D_COMP_SUB_STD) + can_subst = 0; + } + } break; - default: - /* This is an <unscoped-name> or <unscoped-template-name>. */ - RETURN_IF_ERROR (demangle_unqualified_name (dm, &suppress_return_type)); + case 'P': + d_advance (di, 1); + ret = d_make_comp (di, D_COMP_POINTER, d_type (di), NULL); + break; - /* If the <unqualified-name> is followed by template args, this - is an <unscoped-template-name>. */ - if (peek_char (dm) == 'I') - { - /* Add a substitution for the unqualified template name. */ - RETURN_IF_ERROR (substitution_add (dm, start, 0)); + case 'R': + d_advance (di, 1); + ret = d_make_comp (di, D_COMP_REFERENCE, d_type (di), NULL); + break; - RETURN_IF_ERROR (demangle_template_args (dm)); - *encode_return_type = !suppress_return_type; - } - else - *encode_return_type = 0; + case 'C': + d_advance (di, 1); + ret = d_make_comp (di, D_COMP_COMPLEX, d_type (di), NULL); + break; + case 'G': + d_advance (di, 1); + ret = d_make_comp (di, D_COMP_IMAGINARY, d_type (di), NULL); break; + + case 'U': + d_advance (di, 1); + ret = d_source_name (di); + ret = d_make_comp (di, D_COMP_VENDOR_TYPE_QUAL, d_type (di), ret); + break; + + default: + return NULL; } - return STATUS_OK; -} + if (can_subst) + { + if (! d_add_substitution (di, ret)) + return NULL; + } -/* Demangles and emits a <nested-name>. + return ret; +} - <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqulified-name> E */ +/* <CV-qualifiers> ::= [r] [V] [K] */ -static status_t -demangle_nested_name (dm, encode_return_type) - demangling_t dm; - int *encode_return_type; +static struct d_comp ** +d_cv_qualifiers (di, pret, member_fn) + struct d_info *di; + struct d_comp **pret; + int member_fn; { char peek; - DEMANGLE_TRACE ("nested-name", dm); - - RETURN_IF_ERROR (demangle_char (dm, 'N')); - - peek = peek_char (dm); - if (peek == 'r' || peek == 'V' || peek == 'K') + peek = d_peek_char (di); + while (peek == 'r' || peek == 'V' || peek == 'K') { - dyn_string_t cv_qualifiers; - status_t status; - - /* Snarf up CV qualifiers. */ - cv_qualifiers = dyn_string_new (24); - if (cv_qualifiers == NULL) - return STATUS_ALLOCATION_FAILED; - demangle_CV_qualifiers (dm, cv_qualifiers); - - /* Emit them, preceded by a space. */ - status = result_add_char (dm, ' '); - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, cv_qualifiers); - /* The CV qualifiers that occur in a <nested-name> will be - qualifiers for member functions. These are placed at the end - of the function. Therefore, shift the caret to the left by - the length of the qualifiers, so other text is inserted - before them and they stay at the end. */ - result_shift_caret (dm, -dyn_string_length (cv_qualifiers) - 1); - /* Clean up. */ - dyn_string_delete (cv_qualifiers); - RETURN_IF_ERROR (status); - } + enum d_comp_type t; - RETURN_IF_ERROR (demangle_prefix (dm, encode_return_type)); - /* No need to demangle the final <unqualified-name>; demangle_prefix - will handle it. */ - RETURN_IF_ERROR (demangle_char (dm, 'E')); + d_advance (di, 1); + if (peek == 'r') + t = member_fn ? D_COMP_RESTRICT_THIS: D_COMP_RESTRICT; + else if (peek == 'V') + t = member_fn ? D_COMP_VOLATILE_THIS : D_COMP_VOLATILE; + else + t = member_fn ? D_COMP_CONST_THIS: D_COMP_CONST; - return STATUS_OK; -} + *pret = d_make_comp (di, t, NULL, NULL); + if (*pret == NULL) + return NULL; + pret = &d_left (*pret); -/* Demangles and emits a <prefix>. + peek = d_peek_char (di); + } - <prefix> ::= <prefix> <unqualified-name> - ::= <template-prefix> <template-args> - ::= # empty - ::= <substitution> + return pret; +} - <template-prefix> ::= <prefix> - ::= <substitution> */ +/* <function-type> ::= F [Y] <bare-function-type> E */ -static status_t -demangle_prefix (dm, encode_return_type) - demangling_t dm; - int *encode_return_type; +static struct d_comp * +d_function_type (di) + struct d_info *di; { - int start = substitution_start (dm); - int nested = 0; + struct d_comp *ret; - /* ENCODE_RETURN_TYPE is updated as we decend the nesting chain. - After <template-args>, it is set to non-zero; after everything - else it is set to zero. */ + if (d_next_char (di) != 'F') + return NULL; + if (d_peek_char (di) == 'Y') + { + /* Function has C linkage. We don't print this information. + FIXME: We should print it in verbose mode. */ + d_advance (di, 1); + } + ret = d_bare_function_type (di, 1); + if (d_next_char (di) != 'E') + return NULL; + return ret; +} - /* Generally, the return type is encoded if the function is a - template-id, and suppressed otherwise. There are a few cases, - though, in which the return type is not encoded even for a - templated function. In these cases, this flag is set. */ - int suppress_return_type = 0; +/* <bare-function-type> ::= <type>+ */ - DEMANGLE_TRACE ("prefix", dm); +static struct d_comp * +d_bare_function_type (di, has_return_type) + struct d_info *di; + int has_return_type; +{ + struct d_comp *return_type; + struct d_comp *tl; + struct d_comp **ptl; + return_type = NULL; + tl = NULL; + ptl = &tl; while (1) { char peek; + struct d_comp *type; - if (end_of_name_p (dm)) - return "Unexpected end of name in <compound-name>."; - - peek = peek_char (dm); - - /* We'll initialize suppress_return_type to false, and set it to true - if we end up demangling a constructor name. However, make - sure we're not actually about to demangle template arguments - -- if so, this is the <template-args> following a - <template-prefix>, so we'll want the previous flag value - around. */ - if (peek != 'I') - suppress_return_type = 0; - - if (IS_DIGIT ((unsigned char) peek) - || (peek >= 'a' && peek <= 'z') - || peek == 'C' || peek == 'D' - || peek == 'S') + peek = d_peek_char (di); + if (peek == '\0' || peek == 'E') + break; + type = d_type (di); + if (type == NULL) + return NULL; + if (has_return_type) { - /* We have another level of scope qualification. */ - if (nested) - RETURN_IF_ERROR (result_add (dm, NAMESPACE_SEPARATOR)); - else - nested = 1; - - if (peek == 'S') - /* The substitution determines whether this is a - template-id. */ - RETURN_IF_ERROR (demangle_substitution (dm, encode_return_type)); - else - { - /* It's just a name. */ - RETURN_IF_ERROR - (demangle_unqualified_name (dm, &suppress_return_type)); - *encode_return_type = 0; - } + return_type = type; + has_return_type = 0; } - else if (peek == 'Z') - RETURN_IF_ERROR (demangle_local_name (dm)); - else if (peek == 'I') + else { - RETURN_IF_ERROR (demangle_template_args (dm)); - - /* Now we want to indicate to the caller that we've - demangled template arguments, thus the prefix was a - <template-prefix>. That's so that the caller knows to - demangle the function's return type, if this turns out to - be a function name. But, if it's a member template - constructor or a templated conversion operator, report it - as untemplated. Those never get encoded return types. */ - *encode_return_type = !suppress_return_type; + *ptl = d_make_comp (di, D_COMP_ARGLIST, type, NULL); + if (*ptl == NULL) + return NULL; + ptl = &d_right (*ptl); } - else if (peek == 'E') - /* All done. */ - return STATUS_OK; - else - return "Unexpected character in <compound-name>."; - - if (peek != 'S' - && peek_char (dm) != 'E') - /* Add a new substitution for the prefix thus far. */ - RETURN_IF_ERROR (substitution_add (dm, start, *encode_return_type)); } -} -/* Demangles and emits an <unqualified-name>. If this - <unqualified-name> is for a special function type that should never - have its return type encoded (particularly, a constructor or - conversion operator), *SUPPRESS_RETURN_TYPE is set to 1; otherwise, - it is set to zero. + /* There should be at least one parameter type besides the optional + return type. A function which takes no arguments will have a + single parameter type void. */ + if (tl == NULL) + return NULL; - <unqualified-name> ::= <operator-name> - ::= <special-name> - ::= <source-name> */ + /* If we have a single parameter type void, omit it. */ + if (d_right (tl) == NULL + && d_left (tl)->type == D_COMP_BUILTIN_TYPE + && d_left (tl)->u.s_builtin.type->print == D_PRINT_VOID) + tl = NULL; -static status_t -demangle_unqualified_name (dm, suppress_return_type) - demangling_t dm; - int *suppress_return_type; -{ - char peek = peek_char (dm); + return d_make_comp (di, D_COMP_FUNCTION_TYPE, return_type, tl); +} - DEMANGLE_TRACE ("unqualified-name", dm); +/* <class-enum-type> ::= <name> */ - /* By default, don't force suppression of the return type (though - non-template functions still don't get a return type encoded). */ - *suppress_return_type = 0; +static struct d_comp * +d_class_enum_type (di) + struct d_info *di; +{ + return d_name (di); +} - if (IS_DIGIT ((unsigned char) peek)) - RETURN_IF_ERROR (demangle_source_name (dm)); - else if (peek >= 'a' && peek <= 'z') - { - int num_args; +/* <array-type> ::= A <(positive dimension) number> _ <(element) type> + ::= A [<(dimension) expression>] _ <(element) type> +*/ - /* Conversion operators never have a return type encoded. */ - if (peek == 'c' && peek_char_next (dm) == 'v') - *suppress_return_type = 1; +static struct d_comp * +d_array_type (di) + struct d_info *di; +{ + char peek; + struct d_comp *dim; - RETURN_IF_ERROR (demangle_operator_name (dm, 0, &num_args, NULL)); - } - else if (peek == 'C' || peek == 'D') + if (d_next_char (di) != 'A') + return NULL; + + peek = d_peek_char (di); + if (peek == '_') + dim = NULL; + else if (IS_DIGIT (peek)) { - /* Constructors never have a return type encoded. */ - if (peek == 'C') - *suppress_return_type = 1; + const char *s; - RETURN_IF_ERROR (demangle_ctor_dtor_name (dm)); + s = d_str (di); + do + { + d_advance (di, 1); + peek = d_peek_char (di); + } + while (IS_DIGIT (peek)); + dim = d_make_name (di, s, d_str (di) - s); + if (dim == NULL) + return NULL; } else - return "Unexpected character in <unqualified-name>."; + { + dim = d_expression (di); + if (dim == NULL) + return NULL; + } - return STATUS_OK; -} + if (d_next_char (di) != '_') + return NULL; -/* Demangles and emits <source-name>. + return d_make_comp (di, D_COMP_ARRAY_TYPE, dim, d_type (di)); +} - <source-name> ::= <length number> <identifier> */ +/* <pointer-to-member-type> ::= M <(class) type> <(member) type> */ -static status_t -demangle_source_name (dm) - demangling_t dm; +static struct d_comp * +d_pointer_to_member_type (di) + struct d_info *di; { - int length; - - DEMANGLE_TRACE ("source-name", dm); - - /* Decode the length of the identifier. */ - RETURN_IF_ERROR (demangle_number (dm, &length, 10, 0)); - if (length == 0) - return "Zero length in <source-name>."; + struct d_comp *cl; + struct d_comp *mem; + struct d_comp **pmem; - /* Now the identifier itself. It's placed into last_source_name, - where it can be used to build a constructor or destructor name. */ - RETURN_IF_ERROR (demangle_identifier (dm, length, - dm->last_source_name)); + if (d_next_char (di) != 'M') + return NULL; - /* Emit it. */ - RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name)); + cl = d_type (di); + + /* The ABI specifies that any type can be a substitution source, and + that M is followed by two types, and that when a CV-qualified + type is seen both the base type and the CV-qualified types are + substitution sources. The ABI also specifies that for a pointer + to a CV-qualified member function, the qualifiers are attached to + the second type. Given the grammar, a plain reading of the ABI + suggests that both the CV-qualified member function and the + non-qualified member function are substitution sources. However, + g++ does not work that way. g++ treats only the CV-qualified + member function as a substitution source. FIXME. So to work + with g++, we need to pull off the CV-qualifiers here, in order to + avoid calling add_substitution() in d_type(). */ + + pmem = d_cv_qualifiers (di, &mem, 1); + if (pmem == NULL) + return NULL; + *pmem = d_type (di); - return STATUS_OK; + return d_make_comp (di, D_COMP_PTRMEM_TYPE, cl, mem); } -/* Demangles a number, either a <number> or a <positive-number> at the - current position, consuming all consecutive digit characters. Sets - *VALUE to the resulting numberand returns STATUS_OK. The number is - interpreted as BASE, which must be either 10 or 36. If IS_SIGNED - is non-zero, negative numbers -- prefixed with `n' -- are accepted. - - <number> ::= [n] <positive-number> - - <positive-number> ::= <decimal integer> */ +/* <template-param> ::= T_ + ::= T <(parameter-2 non-negative) number> _ +*/ -static status_t -demangle_number (dm, value, base, is_signed) - demangling_t dm; - int *value; - int base; - int is_signed; +static struct d_comp * +d_template_param (di) + struct d_info *di; { - dyn_string_t number = dyn_string_new (10); + long param; - DEMANGLE_TRACE ("number", dm); + if (d_next_char (di) != 'T') + return NULL; - if (number == NULL) - return STATUS_ALLOCATION_FAILED; + if (d_peek_char (di) == '_') + param = 0; + else + { + param = d_number (di); + if (param < 0) + return NULL; + param += 1; + } - demangle_number_literally (dm, number, base, is_signed); - *value = strtol (dyn_string_buf (number), NULL, base); - dyn_string_delete (number); + if (d_next_char (di) != '_') + return NULL; - return STATUS_OK; + return d_make_template_param (di, param); } -/* Demangles a number at the current position. The digits (and minus - sign, if present) that make up the number are appended to STR. - Only base-BASE digits are accepted; BASE must be either 10 or 36. - If IS_SIGNED, negative numbers -- prefixed with `n' -- are - accepted. Does not consume a trailing underscore or other - terminating character. */ - -static status_t -demangle_number_literally (dm, str, base, is_signed) - demangling_t dm; - dyn_string_t str; - int base; - int is_signed; +/* <template-args> ::= I <template-arg>+ E */ + +static struct d_comp * +d_template_args (di) + struct d_info *di; { - DEMANGLE_TRACE ("number*", dm); + struct d_comp *hold_last_name; + struct d_comp *al; + struct d_comp **pal; - if (base != 10 && base != 36) - return STATUS_INTERNAL_ERROR; + /* Preserve the last name we saw--don't let the template arguments + clobber it, as that would give us the wrong name for a subsequent + constructor or destructor. */ + hold_last_name = di->last_name; - /* An `n' denotes a negative number. */ - if (is_signed && peek_char (dm) == 'n') - { - /* Skip past the n. */ - advance_char (dm); - /* The normal way to write a negative number is with a minus - sign. */ - if (!dyn_string_append_char (str, '-')) - return STATUS_ALLOCATION_FAILED; - } + if (d_next_char (di) != 'I') + return NULL; - /* Loop until we hit a non-digit. */ + al = NULL; + pal = &al; while (1) { - char peek = peek_char (dm); - if (IS_DIGIT ((unsigned char) peek) - || (base == 36 && peek >= 'A' && peek <= 'Z')) + struct d_comp *a; + + a = d_template_arg (di); + if (a == NULL) + return NULL; + + *pal = d_make_comp (di, D_COMP_TEMPLATE_ARGLIST, a, NULL); + if (*pal == NULL) + return NULL; + pal = &d_right (*pal); + + if (d_peek_char (di) == 'E') { - /* Accumulate digits. */ - if (!dyn_string_append_char (str, next_char (dm))) - return STATUS_ALLOCATION_FAILED; + d_advance (di, 1); + break; } - else - /* Not a digit? All done. */ - break; } - return STATUS_OK; + di->last_name = hold_last_name; + + return al; } -/* Demangles an identifier at the current position of LENGTH - characters and places it in IDENTIFIER. */ +/* <template-arg> ::= <type> + ::= X <expression> E + ::= <expr-primary> +*/ -static status_t -demangle_identifier (dm, length, identifier) - demangling_t dm; - int length; - dyn_string_t identifier; +static struct d_comp * +d_template_arg (di) + struct d_info *di; { - DEMANGLE_TRACE ("identifier", dm); - - dyn_string_clear (identifier); - if (!dyn_string_resize (identifier, length)) - return STATUS_ALLOCATION_FAILED; + struct d_comp *ret; - while (length-- > 0) + switch (d_peek_char (di)) { - int ch; - if (end_of_name_p (dm)) - return "Unexpected end of name in <identifier>."; - ch = next_char (dm); - - /* Handle extended Unicode characters. We encode them as __U{hex}_, - where {hex} omits leading 0's. For instance, '$' is encoded as - "__U24_". */ - if (ch == '_' - && peek_char (dm) == '_' - && peek_char_next (dm) == 'U') - { - char buf[10]; - int pos = 0; - advance_char (dm); advance_char (dm); length -= 2; - while (length-- > 0) - { - ch = next_char (dm); - if (!isxdigit (ch)) - break; - buf[pos++] = ch; - } - if (ch != '_' || length < 0) - return STATUS_ERROR; - if (pos == 0) - { - /* __U_ just means __U. */ - if (!dyn_string_append_cstr (identifier, "__U")) - return STATUS_ALLOCATION_FAILED; - continue; - } - else - { - buf[pos] = '\0'; - ch = strtol (buf, 0, 16); - } - } + case 'X': + d_advance (di, 1); + ret = d_expression (di); + if (d_next_char (di) != 'E') + return NULL; + return ret; - if (!dyn_string_append_char (identifier, ch)) - return STATUS_ALLOCATION_FAILED; - } + case 'L': + return d_expr_primary (di); - /* GCC encodes anonymous namespaces using a `_GLOBAL_[_.$]N.' - followed by the source file name and some random characters. - Unless we're in strict mode, decipher these names appropriately. */ - if (!flag_strict) - { - char *name = dyn_string_buf (identifier); - int prefix_length = strlen (ANONYMOUS_NAMESPACE_PREFIX); - - /* Compare the first, fixed part. */ - if (strncmp (name, ANONYMOUS_NAMESPACE_PREFIX, prefix_length) == 0) - { - name += prefix_length; - /* The next character might be a period, an underscore, or - dollar sign, depending on the target architecture's - assembler's capabilities. After that comes an `N'. */ - if ((*name == '.' || *name == '_' || *name == '$') - && *(name + 1) == 'N') - /* This looks like the anonymous namespace identifier. - Replace it with something comprehensible. */ - dyn_string_copy_cstr (identifier, "(anonymous namespace)"); - } + default: + return d_type (di); } - - return STATUS_OK; } -/* Demangles and emits an <operator-name>. If SHORT_NAME is non-zero, - the short form is emitted; otherwise the full source form - (`operator +' etc.) is emitted. *NUM_ARGS is set to the number of - operands that the operator takes. If TYPE_ARG is non-NULL, - *TYPE_ARG is set to 1 if the first argument is a type and 0 - otherwise. - - <operator-name> - ::= nw # new - ::= na # new[] - ::= dl # delete - ::= da # delete[] - ::= ps # + (unary) - ::= ng # - (unary) - ::= ad # & (unary) - ::= de # * (unary) - ::= co # ~ - ::= pl # + - ::= mi # - - ::= ml # * - ::= dv # / - ::= rm # % - ::= an # & - ::= or # | - ::= eo # ^ - ::= aS # = - ::= pL # += - ::= mI # -= - ::= mL # *= - ::= dV # /= - ::= rM # %= - ::= aN # &= - ::= oR # |= - ::= eO # ^= - ::= ls # << - ::= rs # >> - ::= lS # <<= - ::= rS # >>= - ::= eq # == - ::= ne # != - ::= lt # < - ::= gt # > - ::= le # <= - ::= ge # >= - ::= nt # ! - ::= aa # && - ::= oo # || - ::= pp # ++ - ::= mm # -- - ::= cm # , - ::= pm # ->* - ::= pt # -> - ::= cl # () - ::= ix # [] - ::= qu # ? - ::= st # sizeof (a type) - ::= sz # sizeof (an expression) - ::= cv <type> # cast - ::= v [0-9] <source-name> # vendor extended operator */ - -static status_t -demangle_operator_name (dm, short_name, num_args, type_arg) - demangling_t dm; - int short_name; - int *num_args; - int *type_arg; +/* <expression> ::= <(unary) operator-name> <expression> + ::= <(binary) operator-name> <expression> <expression> + ::= <(trinary) operator-name> <expression> <expression> <expression> + ::= st <type> + ::= <template-param> + ::= sr <type> <unqualified-name> + ::= sr <type> <unqualified-name> <template-args> + ::= <expr-primary> +*/ + +static struct d_comp * +d_expression (di) + struct d_info *di; { - struct operator_code - { - /* The mangled code for this operator. */ - const char *const code; - /* The source name of this operator. */ - const char *const name; - /* The number of arguments this operator takes. */ - const int num_args; - }; - - static const struct operator_code operators[] = - { - { "aN", "&=" , 2 }, - { "aS", "=" , 2 }, - { "aa", "&&" , 2 }, - { "ad", "&" , 1 }, - { "an", "&" , 2 }, - { "cl", "()" , 0 }, - { "cm", "," , 2 }, - { "co", "~" , 1 }, - { "dV", "/=" , 2 }, - { "da", " delete[]", 1 }, - { "de", "*" , 1 }, - { "dl", " delete" , 1 }, - { "dv", "/" , 2 }, - { "eO", "^=" , 2 }, - { "eo", "^" , 2 }, - { "eq", "==" , 2 }, - { "ge", ">=" , 2 }, - { "gt", ">" , 2 }, - { "ix", "[]" , 2 }, - { "lS", "<<=" , 2 }, - { "le", "<=" , 2 }, - { "ls", "<<" , 2 }, - { "lt", "<" , 2 }, - { "mI", "-=" , 2 }, - { "mL", "*=" , 2 }, - { "mi", "-" , 2 }, - { "ml", "*" , 2 }, - { "mm", "--" , 1 }, - { "na", " new[]" , 1 }, - { "ne", "!=" , 2 }, - { "ng", "-" , 1 }, - { "nt", "!" , 1 }, - { "nw", " new" , 1 }, - { "oR", "|=" , 2 }, - { "oo", "||" , 2 }, - { "or", "|" , 2 }, - { "pL", "+=" , 2 }, - { "pl", "+" , 2 }, - { "pm", "->*" , 2 }, - { "pp", "++" , 1 }, - { "ps", "+" , 1 }, - { "pt", "->" , 2 }, - { "qu", "?" , 3 }, - { "rM", "%=" , 2 }, - { "rS", ">>=" , 2 }, - { "rm", "%" , 2 }, - { "rs", ">>" , 2 }, - { "sz", " sizeof" , 1 } - }; - - const int num_operators = - sizeof (operators) / sizeof (struct operator_code); - - int c0 = next_char (dm); - int c1 = next_char (dm); - const struct operator_code* p1 = operators; - const struct operator_code* p2 = operators + num_operators; - - DEMANGLE_TRACE ("operator-name", dm); - - /* Assume the first argument is not a type. */ - if (type_arg) - *type_arg = 0; - - /* Is this a vendor-extended operator? */ - if (c0 == 'v' && IS_DIGIT (c1)) - { - RETURN_IF_ERROR (result_add (dm, "operator ")); - RETURN_IF_ERROR (demangle_source_name (dm)); - *num_args = 0; - return STATUS_OK; - } + char peek; - /* Is this a conversion operator? */ - if (c0 == 'c' && c1 == 'v') + peek = d_peek_char (di); + if (peek == 'L') + return d_expr_primary (di); + else if (peek == 'T') + return d_template_param (di); + else if (peek == 's' && d_peek_next_char (di) == 'r') { - RETURN_IF_ERROR (result_add (dm, "operator ")); - /* Demangle the converted-to type. */ - RETURN_IF_ERROR (demangle_type (dm)); - *num_args = 0; - return STATUS_OK; - } + struct d_comp *type; + struct d_comp *name; - /* Is it the sizeof variant that takes a type? */ - if (c0 == 's' && c1 == 't') - { - RETURN_IF_ERROR (result_add (dm, " sizeof")); - *num_args = 1; - if (type_arg) - *type_arg = 1; - return STATUS_OK; + d_advance (di, 2); + type = d_type (di); + name = d_unqualified_name (di); + if (d_peek_char (di) != 'I') + return d_make_comp (di, D_COMP_QUAL_NAME, type, name); + else + return d_make_comp (di, D_COMP_QUAL_NAME, type, + d_make_comp (di, D_COMP_TEMPLATE, name, + d_template_args (di))); } - - /* Perform a binary search for the operator code. */ - while (1) + else { - const struct operator_code* p = p1 + (p2 - p1) / 2; - char match0 = p->code[0]; - char match1 = p->code[1]; + struct d_comp *op; + int args; - if (c0 == match0 && c1 == match1) - /* Found it. */ - { - if (!short_name) - RETURN_IF_ERROR (result_add (dm, "operator")); - RETURN_IF_ERROR (result_add (dm, p->name)); - *num_args = p->num_args; + op = d_operator_name (di); + if (op == NULL) + return NULL; - return STATUS_OK; + if (op->type == D_COMP_OPERATOR + && strcmp (op->u.s_operator.op->code, "st") == 0) + return d_make_comp (di, D_COMP_UNARY, op, d_type (di)); + + switch (op->type) + { + default: + return NULL; + case D_COMP_OPERATOR: + args = op->u.s_operator.op->args; + break; + case D_COMP_EXTENDED_OPERATOR: + args = op->u.s_extended_operator.args; + break; + case D_COMP_CAST: + args = 1; + break; } - if (p == p1) - /* Couldn't find it. */ - return "Unknown code in <operator-name>."; + switch (args) + { + case 1: + return d_make_comp (di, D_COMP_UNARY, op, d_expression (di)); + case 2: + { + struct d_comp *left; - /* Try again. */ - if (c0 < match0 || (c0 == match0 && c1 < match1)) - p2 = p; - else - p1 = p; + left = d_expression (di); + return d_make_comp (di, D_COMP_BINARY, op, + d_make_comp (di, D_COMP_BINARY_ARGS, left, + d_expression (di))); + } + case 3: + { + struct d_comp *first; + struct d_comp *second; + + first = d_expression (di); + second = d_expression (di); + return d_make_comp (di, D_COMP_TRINARY, op, + d_make_comp (di, D_COMP_TRINARY_ARG1, first, + d_make_comp (di, + D_COMP_TRINARY_ARG2, + second, + d_expression (di)))); + } + default: + return NULL; + } } } -/* Demangles and omits an <nv-offset>. - - <nv-offset> ::= <offset number> # non-virtual base override */ +/* <expr-primary> ::= L <type> <(value) number> E + ::= L <type> <(value) float> E + ::= L <mangled-name> E +*/ -static status_t -demangle_nv_offset (dm) - demangling_t dm; +static struct d_comp * +d_expr_primary (di) + struct d_info *di; { - dyn_string_t number; - status_t status = STATUS_OK; - - DEMANGLE_TRACE ("h-offset", dm); - - /* Demangle the offset. */ - number = dyn_string_new (4); - if (number == NULL) - return STATUS_ALLOCATION_FAILED; - demangle_number_literally (dm, number, 10, 1); + struct d_comp *ret; - /* Don't display the offset unless in verbose mode. */ - if (flag_verbose) + if (d_next_char (di) != 'L') + return NULL; + if (d_peek_char (di) == '_') + ret = d_mangled_name (di, 0); + else { - status = result_add (dm, " [nv:"); - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, number); - if (STATUS_NO_ERROR (status)) - status = result_add_char (dm, ']'); + struct d_comp *type; + enum d_comp_type t; + const char *s; + + type = d_type (di); + + /* Rather than try to interpret the literal value, we just + collect it as a string. Note that it's possible to have a + floating point literal here. The ABI specifies that the + format of such literals is machine independent. That's fine, + but what's not fine is that versions of g++ up to 3.2 with + -fabi-version=1 used upper case letters in the hex constant, + and dumped out gcc's internal representation. That makes it + hard to tell where the constant ends, and hard to dump the + constant in any readable form anyhow. We don't attempt to + handle these cases. */ + + t = D_COMP_LITERAL; + if (d_peek_char (di) == 'n') + { + t = D_COMP_LITERAL_NEG; + d_advance (di, 1); + } + s = d_str (di); + while (d_peek_char (di) != 'E') + d_advance (di, 1); + ret = d_make_comp (di, t, type, d_make_name (di, s, d_str (di) - s)); } - - /* Clean up. */ - dyn_string_delete (number); - RETURN_IF_ERROR (status); - return STATUS_OK; + if (d_next_char (di) != 'E') + return NULL; + return ret; } -/* Demangles and emits a <v-offset>. - - <v-offset> ::= <offset number> _ <virtual offset number> - # virtual base override, with vcall offset */ +/* <local-name> ::= Z <(function) encoding> E <(entity) name> [<discriminator>] + ::= Z <(function) encoding> E s [<discriminator>] +*/ -static status_t -demangle_v_offset (dm) - demangling_t dm; +static struct d_comp * +d_local_name (di) + struct d_info *di; { - dyn_string_t number; - status_t status = STATUS_OK; - - DEMANGLE_TRACE ("v-offset", dm); + struct d_comp *function; - /* Demangle the offset. */ - number = dyn_string_new (4); - if (number == NULL) - return STATUS_ALLOCATION_FAILED; - demangle_number_literally (dm, number, 10, 1); - - /* Don't display the offset unless in verbose mode. */ - if (flag_verbose) - { - status = result_add (dm, " [v:"); - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, number); - if (STATUS_NO_ERROR (status)) - result_add_char (dm, ','); - } - dyn_string_delete (number); - RETURN_IF_ERROR (status); + if (d_next_char (di) != 'Z') + return NULL; - /* Demangle the separator. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); + function = d_encoding (di, 0); - /* Demangle the vcall offset. */ - number = dyn_string_new (4); - if (number == NULL) - return STATUS_ALLOCATION_FAILED; - demangle_number_literally (dm, number, 10, 1); + if (d_next_char (di) != 'E') + return NULL; - /* Don't display the vcall offset unless in verbose mode. */ - if (flag_verbose) + if (d_peek_char (di) == 's') { - status = result_add_string (dm, number); - if (STATUS_NO_ERROR (status)) - status = result_add_char (dm, ']'); + d_advance (di, 1); + if (! d_discriminator (di)) + return NULL; + return d_make_comp (di, D_COMP_QUAL_NAME, function, + d_make_name (di, "string literal", + sizeof "string literal" - 1)); } - dyn_string_delete (number); - RETURN_IF_ERROR (status); - - return STATUS_OK; -} - -/* Demangles and emits a <call-offset>. - - <call-offset> ::= h <nv-offset> _ - ::= v <v-offset> _ */ - -static status_t -demangle_call_offset (dm) - demangling_t dm; -{ - DEMANGLE_TRACE ("call-offset", dm); - - switch (peek_char (dm)) + else { - case 'h': - advance_char (dm); - /* Demangle the offset. */ - RETURN_IF_ERROR (demangle_nv_offset (dm)); - /* Demangle the separator. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); - break; - - case 'v': - advance_char (dm); - /* Demangle the offset. */ - RETURN_IF_ERROR (demangle_v_offset (dm)); - /* Demangle the separator. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); - break; + struct d_comp *name; - default: - return "Unrecognized <call-offset>."; + name = d_name (di); + if (! d_discriminator (di)) + return NULL; + return d_make_comp (di, D_COMP_QUAL_NAME, function, name); } - - return STATUS_OK; } -/* Demangles and emits a <special-name>. - - <special-name> ::= GV <object name> # Guard variable - ::= TV <type> # virtual table - ::= TT <type> # VTT - ::= TI <type> # typeinfo structure - ::= TS <type> # typeinfo name +/* <discriminator> ::= _ <(non-negative) number> - Other relevant productions include thunks: + We demangle the discriminator, but we don't print it out. FIXME: + We should print it out in verbose mode. */ - <special-name> ::= T <call-offset> <base encoding> - # base is the nominal target function of thunk - - <special-name> ::= Tc <call-offset> <call-offset> <base encoding> - # base is the nominal target function of thunk - # first call-offset is 'this' adjustment - # second call-offset is result adjustment +static int +d_discriminator (di) + struct d_info *di; +{ + long discrim; - where + if (d_peek_char (di) != '_') + return 1; + d_advance (di, 1); + discrim = d_number (di); + if (discrim < 0) + return 0; + return 1; +} - <call-offset> ::= h <nv-offset> _ - ::= v <v-offset> _ +/* Add a new substitution. */ - Also demangles the special g++ manglings, +static int +d_add_substitution (di, dc) + struct d_info *di; + struct d_comp *dc; +{ + if (dc == NULL) + return 0; + if (di->next_sub >= di->num_subs) + return 0; + di->subs[di->next_sub] = dc; + ++di->next_sub; + return 1; +} + +/* <substitution> ::= S <seq-id> _ + ::= S_ + ::= St + ::= Sa + ::= Sb + ::= Ss + ::= Si + ::= So + ::= Sd + + If PREFIX is non-zero, then this type is being used as a prefix in + a qualified name. In this case, for the standard substitutions, we + need to check whether we are being used as a prefix for a + constructor or destructor, and return a full template name. + Otherwise we will get something like std::iostream::~iostream() + which does not correspond particularly well to any function which + actually appears in the source. +*/ - <special-name> ::= TC <type> <offset number> _ <base type> - # construction vtable - ::= TF <type> # typeinfo function (old ABI only) - ::= TJ <type> # java Class structure */ +static const struct d_standard_sub_info standard_subs[] = +{ + { 't', "std", "std", NULL }, + { 'a', "std::allocator", "std::allocator", "allocator" }, + { 'b', "std::basic_string", "std::basic_string", "basic_string" }, + { 's', "std::string", + "std::basic_string<char, std::char_traits<char>, std::allocator<char> >", + "basic_string" }, + { 'i', "std::istream", + "std::basic_istream<char, std::char_traits<char> >", + "basic_istream" }, + { 'o', "std::ostream", + "std::basic_ostream<char, std::char_traits<char> >", + "basic_ostream" }, + { 'd', "std::iostream", + "std::basic_iostream<char, std::char_traits<char> >", + "basic_iostream" } +}; -static status_t -demangle_special_name (dm) - demangling_t dm; +static struct d_comp * +d_substitution (di, prefix) + struct d_info *di; + int prefix; { - dyn_string_t number; - int unused; - char peek = peek_char (dm); + char c; - DEMANGLE_TRACE ("special-name", dm); + if (d_next_char (di) != 'S') + return NULL; - if (peek == 'G') + c = d_next_char (di); + if (c == '_' || IS_DIGIT (c) || IS_UPPER (c)) { - /* Consume the G. */ - advance_char (dm); - switch (peek_char (dm)) + int id; + + id = 0; + if (c != '_') { - case 'V': - /* A guard variable name. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "guard variable for ")); - RETURN_IF_ERROR (demangle_name (dm, &unused)); - break; + do + { + if (IS_DIGIT (c)) + id = id * 36 + c - '0'; + else if (IS_UPPER (c)) + id = id * 36 + c - 'A' + 10; + else + return NULL; + c = d_next_char (di); + } + while (c != '_'); - case 'R': - /* A reference temporary. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "reference temporary for ")); - RETURN_IF_ERROR (demangle_name (dm, &unused)); - break; - - default: - return "Unrecognized <special-name>."; + ++id; } + + if (id >= di->next_sub) + return NULL; + + return di->subs[id]; } - else if (peek == 'T') + else { - status_t status = STATUS_OK; - - /* Other C++ implementation miscellania. Consume the T. */ - advance_char (dm); + int verbose; + const struct d_standard_sub_info *p; + const struct d_standard_sub_info *pend; - switch (peek_char (dm)) + verbose = (di->options & DMGL_VERBOSE) != 0; + if (! verbose && prefix) { - case 'V': - /* Virtual table. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "vtable for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; + char peek; - case 'T': - /* VTT structure. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "VTT for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'I': - /* Typeinfo structure. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "typeinfo for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'F': - /* Typeinfo function. Used only in old ABI with new mangling. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "typeinfo fn for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'S': - /* Character string containing type name, used in typeinfo. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "typeinfo name for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'J': - /* The java Class variable corresponding to a C++ class. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "java Class for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'h': - /* Non-virtual thunk. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "non-virtual thunk")); - RETURN_IF_ERROR (demangle_nv_offset (dm)); - /* Demangle the separator. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); - /* Demangle and emit the target name and function type. */ - RETURN_IF_ERROR (result_add (dm, " to ")); - RETURN_IF_ERROR (demangle_encoding (dm)); - break; - - case 'v': - /* Virtual thunk. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "virtual thunk")); - RETURN_IF_ERROR (demangle_v_offset (dm)); - /* Demangle the separator. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); - /* Demangle and emit the target function. */ - RETURN_IF_ERROR (result_add (dm, " to ")); - RETURN_IF_ERROR (demangle_encoding (dm)); - break; - - case 'c': - /* Covariant return thunk. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "covariant return thunk")); - RETURN_IF_ERROR (demangle_call_offset (dm)); - RETURN_IF_ERROR (demangle_call_offset (dm)); - /* Demangle and emit the target function. */ - RETURN_IF_ERROR (result_add (dm, " to ")); - RETURN_IF_ERROR (demangle_encoding (dm)); - break; + peek = d_peek_char (di); + if (peek == 'C' || peek == 'D') + verbose = 1; + } - case 'C': - /* TC is a special g++ mangling for a construction vtable. */ - if (!flag_strict) + pend = (&standard_subs[0] + + sizeof standard_subs / sizeof standard_subs[0]); + for (p = &standard_subs[0]; p < pend; ++p) + { + if (c == p->code) { - dyn_string_t derived_type; - - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "construction vtable for ")); - - /* Demangle the derived type off to the side. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_type (dm)); - derived_type = (dyn_string_t) result_pop (dm); - - /* Demangle the offset. */ - number = dyn_string_new (4); - if (number == NULL) - { - dyn_string_delete (derived_type); - return STATUS_ALLOCATION_FAILED; - } - demangle_number_literally (dm, number, 10, 1); - /* Demangle the underscore separator. */ - status = demangle_char (dm, '_'); - - /* Demangle the base type. */ - if (STATUS_NO_ERROR (status)) - status = demangle_type (dm); - - /* Emit the derived type. */ - if (STATUS_NO_ERROR (status)) - status = result_add (dm, "-in-"); - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, derived_type); - dyn_string_delete (derived_type); - - /* Don't display the offset unless in verbose mode. */ - if (flag_verbose) - { - status = result_add_char (dm, ' '); - if (STATUS_NO_ERROR (status)) - result_add_string (dm, number); - } - dyn_string_delete (number); - RETURN_IF_ERROR (status); - break; + if (p->set_last_name != NULL) + di->last_name = d_make_sub (di, p->set_last_name); + if (verbose) + return d_make_sub (di, p->full_expansion); + else + return d_make_sub (di, p->simple_expansion); } - /* If flag_strict, fall through. */ - - default: - return "Unrecognized <special-name>."; } - } - else - return STATUS_ERROR; - return STATUS_OK; + return NULL; + } } -/* Demangles and emits a <ctor-dtor-name>. - - <ctor-dtor-name> - ::= C1 # complete object (in-charge) ctor - ::= C2 # base object (not-in-charge) ctor - ::= C3 # complete object (in-charge) allocating ctor - ::= D0 # deleting (in-charge) dtor - ::= D1 # complete object (in-charge) dtor - ::= D2 # base object (not-in-charge) dtor */ - -static status_t -demangle_ctor_dtor_name (dm) - demangling_t dm; -{ - static const char *const ctor_flavors[] = - { - "in-charge", - "not-in-charge", - "allocating" - }; - static const char *const dtor_flavors[] = - { - "in-charge deleting", - "in-charge", - "not-in-charge" - }; +/* Resize the print buffer. */ - int flavor; - char peek = peek_char (dm); +static void +d_print_resize (dpi, add) + struct d_print_info *dpi; + size_t add; +{ + size_t need; - DEMANGLE_TRACE ("ctor-dtor-name", dm); - - if (peek == 'C') + if (dpi->buf == NULL) + return; + need = dpi->len + add; + while (need > dpi->alc) { - /* A constructor name. Consume the C. */ - advance_char (dm); - flavor = next_char (dm); - if (flavor < '1' || flavor > '3') - return "Unrecognized constructor."; - RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name)); - switch (flavor) - { - case '1': dm->is_constructor = gnu_v3_complete_object_ctor; - break; - case '2': dm->is_constructor = gnu_v3_base_object_ctor; - break; - case '3': dm->is_constructor = gnu_v3_complete_object_allocating_ctor; - break; - } - /* Print the flavor of the constructor if in verbose mode. */ - if (flag_verbose) + size_t newalc; + char *newbuf; + + newalc = dpi->alc * 2; + newbuf = realloc (dpi->buf, newalc); + if (newbuf == NULL) { - RETURN_IF_ERROR (result_add (dm, "[")); - RETURN_IF_ERROR (result_add (dm, ctor_flavors[flavor - '1'])); - RETURN_IF_ERROR (result_add_char (dm, ']')); + free (dpi->buf); + dpi->buf = NULL; + dpi->allocation_failure = 1; + return; } + dpi->buf = newbuf; + dpi->alc = newalc; } - else if (peek == 'D') +} + +/* Append a character to the print buffer. */ + +static void +d_print_append_char (dpi, c) + struct d_print_info *dpi; + int c; +{ + if (dpi->buf != NULL) { - /* A destructor name. Consume the D. */ - advance_char (dm); - flavor = next_char (dm); - if (flavor < '0' || flavor > '2') - return "Unrecognized destructor."; - RETURN_IF_ERROR (result_add_char (dm, '~')); - RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name)); - switch (flavor) + if (dpi->len >= dpi->alc) { - case '0': dm->is_destructor = gnu_v3_deleting_dtor; - break; - case '1': dm->is_destructor = gnu_v3_complete_object_dtor; - break; - case '2': dm->is_destructor = gnu_v3_base_object_dtor; - break; + d_print_resize (dpi, 1); + if (dpi->buf == NULL) + return; } - /* Print the flavor of the destructor if in verbose mode. */ - if (flag_verbose) + + dpi->buf[dpi->len] = c; + ++dpi->len; + } +} + +/* Append a buffer to the print buffer. */ + +static void +d_print_append_buffer (dpi, s, l) + struct d_print_info *dpi; + const char *s; + size_t l; +{ + if (dpi->buf != NULL) + { + if (dpi->len + l > dpi->alc) { - RETURN_IF_ERROR (result_add (dm, " [")); - RETURN_IF_ERROR (result_add (dm, dtor_flavors[flavor - '0'])); - RETURN_IF_ERROR (result_add_char (dm, ']')); + d_print_resize (dpi, l); + if (dpi->buf == NULL) + return; } + + memcpy (dpi->buf + dpi->len, s, l); + dpi->len += l; } - else - return STATUS_ERROR; +} - return STATUS_OK; +/* Indicate that an error occurred during printing. */ + +static void +d_print_error (dpi) + struct d_print_info *dpi; +{ + free (dpi->buf); + dpi->buf = NULL; } -/* Handle pointer, reference, and pointer-to-member cases for - demangle_type. All consecutive `P's, `R's, and 'M's are joined to - build a pointer/reference type. We snarf all these, plus the - following <type>, all at once since we need to know whether we have - a pointer to data or pointer to function to construct the right - output syntax. C++'s pointer syntax is hairy. - - This function adds substitution candidates for every nested - pointer/reference type it processes, including the outermost, final - type, assuming the substitution starts at SUBSTITUTION_START in the - demangling result. For example, if this function demangles - `PP3Foo', it will add a substitution for `Foo', `Foo*', and - `Foo**', in that order. - - *INSERT_POS is a quantity used internally, when this function calls - itself recursively, to figure out where to insert pointer - punctuation on the way up. On entry to this function, INSERT_POS - should point to a temporary value, but that value need not be - initialized. - - <type> ::= P <type> - ::= R <type> - ::= <pointer-to-member-type> - - <pointer-to-member-type> ::= M </class/ type> </member/ type> */ - -static status_t -demangle_type_ptr (dm, insert_pos, substitution_start) - demangling_t dm; - int *insert_pos; - int substitution_start; +/* Turn components into a human readable string. Returns a string + allocated by malloc, or NULL on error. On success, this sets *PALC + to the size of the allocated buffer. On failure, this sets *PALC + to 0 for a bad parse, or to 1 for a memory allocation failure. */ + +static char * +d_print (options, dc, palc) + int options; + const struct d_comp *dc; + size_t *palc; { - status_t status; - int is_substitution_candidate = 1; + struct d_print_info dpi; - DEMANGLE_TRACE ("type*", dm); + dpi.options = options; - /* Scan forward, collecting pointers and references into symbols, - until we hit something else. Then emit the type. */ - switch (peek_char (dm)) + dpi.alc = 64; + dpi.buf = malloc (dpi.alc); + if (dpi.buf == NULL) { - case 'P': - /* A pointer. Snarf the `P'. */ - advance_char (dm); - /* Demangle the underlying type. */ - RETURN_IF_ERROR (demangle_type_ptr (dm, insert_pos, - substitution_start)); - /* Insert an asterisk where we're told to; it doesn't - necessarily go at the end. If we're doing Java style output, - there is no pointer symbol. */ - if (dm->style != DMGL_JAVA) - RETURN_IF_ERROR (result_insert_char (dm, *insert_pos, '*')); - /* The next (outermost) pointer or reference character should go - after this one. */ - ++(*insert_pos); - break; + *palc = 1; + return NULL; + } - case 'R': - /* A reference. Snarf the `R'. */ - advance_char (dm); - /* Demangle the underlying type. */ - RETURN_IF_ERROR (demangle_type_ptr (dm, insert_pos, - substitution_start)); - /* Insert an ampersand where we're told to; it doesn't - necessarily go at the end. */ - RETURN_IF_ERROR (result_insert_char (dm, *insert_pos, '&')); - /* The next (outermost) pointer or reference character should go - after this one. */ - ++(*insert_pos); - break; + dpi.len = 0; + dpi.templates = NULL; + dpi.modifiers = NULL; - case 'M': - { - /* A pointer-to-member. */ - dyn_string_t class_type; - - /* Eat the 'M'. */ - advance_char (dm); - - /* Capture the type of which this is a pointer-to-member. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_type (dm)); - class_type = (dyn_string_t) result_pop (dm); - - if (peek_char (dm) == 'F') - /* A pointer-to-member function. We want output along the - lines of `void (C::*) (int, int)'. Demangle the function - type, which would in this case give `void () (int, int)' - and set *insert_pos to the spot between the first - parentheses. */ - status = demangle_type_ptr (dm, insert_pos, substitution_start); - else if (peek_char (dm) == 'A') - /* A pointer-to-member array variable. We want output that - looks like `int (Klass::*) [10]'. Demangle the array type - as `int () [10]', and set *insert_pos to the spot between - the parentheses. */ - status = demangle_array_type (dm, insert_pos); - else - { - /* A pointer-to-member variable. Demangle the type of the - pointed-to member. */ - status = demangle_type (dm); - /* Make it pretty. */ - if (STATUS_NO_ERROR (status) - && !result_previous_char_is_space (dm)) - status = result_add_char (dm, ' '); - /* The pointer-to-member notation (e.g. `C::*') follows the - member's type. */ - *insert_pos = result_caret_pos (dm); - } + dpi.allocation_failure = 0; - /* Build the pointer-to-member notation. */ - if (STATUS_NO_ERROR (status)) - status = result_insert (dm, *insert_pos, "::*"); - if (STATUS_NO_ERROR (status)) - status = result_insert_string (dm, *insert_pos, class_type); - /* There may be additional levels of (pointer or reference) - indirection in this type. If so, the `*' and `&' should be - added after the pointer-to-member notation (e.g. `C::*&' for - a reference to a pointer-to-member of class C). */ - *insert_pos += dyn_string_length (class_type) + 3; - - /* Clean up. */ - dyn_string_delete (class_type); - - RETURN_IF_ERROR (status); - } - break; + d_print_comp (&dpi, dc); - case 'F': - /* Ooh, tricky, a pointer-to-function. When we demangle the - function type, the return type should go at the very - beginning. */ - *insert_pos = result_caret_pos (dm); - /* The parentheses indicate this is a function pointer or - reference type. */ - RETURN_IF_ERROR (result_add (dm, "()")); - /* Now demangle the function type. The return type will be - inserted before the `()', and the argument list will go after - it. */ - RETURN_IF_ERROR (demangle_function_type (dm, insert_pos)); - /* We should now have something along the lines of - `void () (int, int)'. The pointer or reference characters - have to inside the first set of parentheses. *insert_pos has - already been updated to point past the end of the return - type. Move it one character over so it points inside the - `()'. */ - ++(*insert_pos); - break; + d_append_char (&dpi, '\0'); - case 'A': - /* An array pointer or reference. demangle_array_type will figure - out where the asterisks and ampersands go. */ - RETURN_IF_ERROR (demangle_array_type (dm, insert_pos)); - break; + if (dpi.buf != NULL) + *palc = dpi.alc; + else + *palc = dpi.allocation_failure; - default: - /* No more pointer or reference tokens; this is therefore a - pointer to data. Finish up by demangling the underlying - type. */ - RETURN_IF_ERROR (demangle_type (dm)); - /* The pointer or reference characters follow the underlying - type, as in `int*&'. */ - *insert_pos = result_caret_pos (dm); - /* Because of the production <type> ::= <substitution>, - demangle_type will already have added the underlying type as - a substitution candidate. Don't do it again. */ - is_substitution_candidate = 0; - break; - } - - if (is_substitution_candidate) - RETURN_IF_ERROR (substitution_add (dm, substitution_start, 0)); - - return STATUS_OK; + return dpi.buf; } -/* Demangles and emits a <type>. - - <type> ::= <builtin-type> - ::= <function-type> - ::= <class-enum-type> - ::= <array-type> - ::= <pointer-to-member-type> - ::= <template-param> - ::= <template-template-param> <template-args> - ::= <CV-qualifiers> <type> - ::= P <type> # pointer-to - ::= R <type> # reference-to - ::= C <type> # complex pair (C 2000) - ::= G <type> # imaginary (C 2000) - ::= U <source-name> <type> # vendor extended type qualifier - ::= <substitution> */ - -static status_t -demangle_type (dm) - demangling_t dm; +/* Subroutine to handle components. */ + +static void +d_print_comp (dpi, dc) + struct d_print_info *dpi; + const struct d_comp *dc; { - int start = substitution_start (dm); - char peek = peek_char (dm); - char peek_next; - int encode_return_type = 0; - template_arg_list_t old_arg_list = current_template_arg_list (dm); - int insert_pos; - - /* A <type> can be a <substitution>; therefore, this <type> is a - substitution candidate unless a special condition holds (see - below). */ - int is_substitution_candidate = 1; - - DEMANGLE_TRACE ("type", dm); - - /* A <class-enum-type> can start with a digit (a <source-name>), an - N (a <nested-name>), or a Z (a <local-name>). */ - if (IS_DIGIT ((unsigned char) peek) || peek == 'N' || peek == 'Z') - RETURN_IF_ERROR (demangle_class_enum_type (dm, &encode_return_type)); - /* Lower-case letters begin <builtin-type>s, except for `r', which - denotes restrict. */ - else if (peek >= 'a' && peek <= 'z' && peek != 'r') + if (dc == NULL) { - RETURN_IF_ERROR (demangle_builtin_type (dm)); - /* Built-in types are not substitution candidates. */ - is_substitution_candidate = 0; + d_print_error (dpi); + return; } - else - switch (peek) - { - case 'r': - case 'V': - case 'K': - /* CV-qualifiers (including restrict). We have to demangle - them off to the side, since C++ syntax puts them in a funny - place for qualified pointer and reference types. */ - { - status_t status; - dyn_string_t cv_qualifiers = dyn_string_new (24); - int old_caret_position = result_get_caret (dm); - - if (cv_qualifiers == NULL) - return STATUS_ALLOCATION_FAILED; - - /* Decode all adjacent CV qualifiers. */ - demangle_CV_qualifiers (dm, cv_qualifiers); - /* Emit them, and shift the caret left so that the - underlying type will be emitted before the qualifiers. */ - status = result_add_string (dm, cv_qualifiers); - result_shift_caret (dm, -dyn_string_length (cv_qualifiers)); - /* Clean up. */ - dyn_string_delete (cv_qualifiers); - RETURN_IF_ERROR (status); - /* Also prepend a blank, if needed. */ - RETURN_IF_ERROR (result_add_char (dm, ' ')); - result_shift_caret (dm, -1); - - /* Demangle the underlying type. It will be emitted before - the CV qualifiers, since we moved the caret. */ - RETURN_IF_ERROR (demangle_type (dm)); - - /* Put the caret back where it was previously. */ - result_set_caret (dm, old_caret_position); - } - break; + if (d_print_saw_error (dpi)) + return; - case 'F': - return "Non-pointer or -reference function type."; - - case 'A': - RETURN_IF_ERROR (demangle_array_type (dm, NULL)); - break; + switch (dc->type) + { + case D_COMP_NAME: + d_print_identifier (dpi, dc->u.s_name.s, dc->u.s_name.len); + return; - case 'T': - /* It's either a <template-param> or a - <template-template-param>. In either case, demangle the - `T' token first. */ - RETURN_IF_ERROR (demangle_template_param (dm)); + case D_COMP_QUAL_NAME: + d_print_comp (dpi, d_left (dc)); + d_append_string (dpi, (dpi->options & DMGL_JAVA) == 0 ? "::" : "."); + d_print_comp (dpi, d_right (dc)); + return; - /* Check for a template argument list; if one is found, it's a - <template-template-param> ::= <template-param> - ::= <substitution> */ - if (peek_char (dm) == 'I') + case D_COMP_TYPED_NAME: + { + struct d_print_mod *hold_modifiers; + struct d_comp *typed_name; + struct d_print_mod adpm[4]; + unsigned int i; + struct d_print_template dpt; + + /* Pass the name down to the type so that it can be printed in + the right place for the type. We also have to pass down + any CV-qualifiers, which apply to the this parameter. */ + hold_modifiers = dpi->modifiers; + i = 0; + typed_name = d_left (dc); + while (typed_name != NULL) { - /* Add a substitution candidate. The template parameter - `T' token is a substitution candidate by itself, - without the template argument list. */ - RETURN_IF_ERROR (substitution_add (dm, start, encode_return_type)); - - /* Now demangle the template argument list. */ - RETURN_IF_ERROR (demangle_template_args (dm)); - /* The entire type, including the template template - parameter and its argument list, will be added as a - substitution candidate below. */ - } - - break; + if (i >= sizeof adpm / sizeof adpm[0]) + { + d_print_error (dpi); + return; + } + + adpm[i].next = dpi->modifiers; + dpi->modifiers = &adpm[i]; + adpm[i].mod = typed_name; + adpm[i].printed = 0; + adpm[i].templates = dpi->templates; + ++i; + + if (typed_name->type != D_COMP_RESTRICT_THIS + && typed_name->type != D_COMP_VOLATILE_THIS + && typed_name->type != D_COMP_CONST_THIS) + break; - case 'S': - /* First check if this is a special substitution. If it is, - this is a <class-enum-type>. Special substitutions have a - letter following the `S'; other substitutions have a digit - or underscore. */ - peek_next = peek_char_next (dm); - if (IS_DIGIT (peek_next) || peek_next == '_') - { - RETURN_IF_ERROR (demangle_substitution (dm, &encode_return_type)); - - /* The substituted name may have been a template name. - Check if template arguments follow, and if so, demangle - them. */ - if (peek_char (dm) == 'I') - RETURN_IF_ERROR (demangle_template_args (dm)); - else - /* A substitution token is not itself a substitution - candidate. (However, if the substituted template is - instantiated, the resulting type is.) */ - is_substitution_candidate = 0; + typed_name = d_left (typed_name); } - else + + /* If typed_name is a template, then it applies to the + function type as well. */ + if (typed_name->type == D_COMP_TEMPLATE) { - /* Now some trickiness. We have a special substitution - here. Often, the special substitution provides the - name of a template that's subsequently instantiated, - for instance `SaIcE' => std::allocator<char>. In these - cases we need to add a substitution candidate for the - entire <class-enum-type> and thus don't want to clear - the is_substitution_candidate flag. - - However, it's possible that what we have here is a - substitution token representing an entire type, such as - `Ss' => std::string. In this case, we mustn't add a - new substitution candidate for this substitution token. - To detect this case, remember where the start of the - substitution token is. */ - const char *next = dm->next; - /* Now demangle the <class-enum-type>. */ - RETURN_IF_ERROR - (demangle_class_enum_type (dm, &encode_return_type)); - /* If all that was just demangled is the two-character - special substitution token, supress the addition of a - new candidate for it. */ - if (dm->next == next + 2) - is_substitution_candidate = 0; + dpt.next = dpi->templates; + dpi->templates = &dpt; + dpt.template = typed_name; } - break; - - case 'P': - case 'R': - case 'M': - RETURN_IF_ERROR (demangle_type_ptr (dm, &insert_pos, start)); - /* demangle_type_ptr adds all applicable substitution - candidates. */ - is_substitution_candidate = 0; - break; + d_print_comp (dpi, d_right (dc)); - case 'C': - /* A C99 complex type. */ - RETURN_IF_ERROR (result_add (dm, "complex ")); - advance_char (dm); - RETURN_IF_ERROR (demangle_type (dm)); - break; + if (typed_name->type == D_COMP_TEMPLATE) + dpi->templates = dpt.next; - case 'G': - /* A C99 imaginary type. */ - RETURN_IF_ERROR (result_add (dm, "imaginary ")); - advance_char (dm); - RETURN_IF_ERROR (demangle_type (dm)); - break; + /* If the modifiers didn't get printed by the type, print them + now. */ + while (i > 0) + { + --i; + if (! adpm[i].printed) + { + d_append_char (dpi, ' '); + d_print_mod (dpi, adpm[i].mod); + } + } - case 'U': - /* Vendor-extended type qualifier. */ - advance_char (dm); - RETURN_IF_ERROR (demangle_source_name (dm)); - RETURN_IF_ERROR (result_add_char (dm, ' ')); - RETURN_IF_ERROR (demangle_type (dm)); - break; + dpi->modifiers = hold_modifiers; - default: - return "Unexpected character in <type>."; + return; } - if (is_substitution_candidate) - /* Add a new substitution for the type. If this type was a - <template-param>, pass its index since from the point of - substitutions; a <template-param> token is a substitution - candidate distinct from the type that is substituted for it. */ - RETURN_IF_ERROR (substitution_add (dm, start, encode_return_type)); - - /* Pop off template argument lists added during mangling of this - type. */ - pop_to_template_arg_list (dm, old_arg_list); - - return STATUS_OK; -} + case D_COMP_TEMPLATE: + { + struct d_print_mod *hold_dpm; -/* C++ source names of builtin types, indexed by the mangled code - letter's position in the alphabet ('a' -> 0, 'b' -> 1, etc). */ -static const char *const builtin_type_names[26] = -{ - "signed char", /* a */ - "bool", /* b */ - "char", /* c */ - "double", /* d */ - "long double", /* e */ - "float", /* f */ - "__float128", /* g */ - "unsigned char", /* h */ - "int", /* i */ - "unsigned", /* j */ - NULL, /* k */ - "long", /* l */ - "unsigned long", /* m */ - "__int128", /* n */ - "unsigned __int128", /* o */ - NULL, /* p */ - NULL, /* q */ - NULL, /* r */ - "short", /* s */ - "unsigned short", /* t */ - NULL, /* u */ - "void", /* v */ - "wchar_t", /* w */ - "long long", /* x */ - "unsigned long long", /* y */ - "..." /* z */ -}; + /* Don't push modifiers into a template definition. Doing so + could give the wrong definition for a template argument. + Instead, treat the template essentially as a name. */ -/* Java source names of builtin types. Types that arn't valid in Java - are also included here - we don't fail if someone attempts to demangle a - C++ symbol in Java style. */ -static const char *const java_builtin_type_names[26] = -{ - "signed char", /* a */ - "boolean", /* C++ "bool" */ /* b */ - "byte", /* C++ "char" */ /* c */ - "double", /* d */ - "long double", /* e */ - "float", /* f */ - "__float128", /* g */ - "unsigned char", /* h */ - "int", /* i */ - "unsigned", /* j */ - NULL, /* k */ - "long", /* l */ - "unsigned long", /* m */ - "__int128", /* n */ - "unsigned __int128", /* o */ - NULL, /* p */ - NULL, /* q */ - NULL, /* r */ - "short", /* s */ - "unsigned short", /* t */ - NULL, /* u */ - "void", /* v */ - "char", /* C++ "wchar_t" */ /* w */ - "long", /* C++ "long long" */ /* x */ - "unsigned long long", /* y */ - "..." /* z */ -}; - -/* Demangles and emits a <builtin-type>. - - <builtin-type> ::= v # void - ::= w # wchar_t - ::= b # bool - ::= c # char - ::= a # signed char - ::= h # unsigned char - ::= s # short - ::= t # unsigned short - ::= i # int - ::= j # unsigned int - ::= l # long - ::= m # unsigned long - ::= x # long long, __int64 - ::= y # unsigned long long, __int64 - ::= n # __int128 - ::= o # unsigned __int128 - ::= f # float - ::= d # double - ::= e # long double, __float80 - ::= g # __float128 - ::= z # ellipsis - ::= u <source-name> # vendor extended type */ - -static status_t -demangle_builtin_type (dm) - demangling_t dm; -{ + hold_dpm = dpi->modifiers; + dpi->modifiers = NULL; - char code = peek_char (dm); + d_print_comp (dpi, d_left (dc)); + if (d_last_char (dpi) == '<') + d_append_char (dpi, ' '); + d_append_char (dpi, '<'); + d_print_comp (dpi, d_right (dc)); + /* Avoid generating two consecutive '>' characters, to avoid + the C++ syntactic ambiguity. */ + if (d_last_char (dpi) == '>') + d_append_char (dpi, ' '); + d_append_char (dpi, '>'); - DEMANGLE_TRACE ("builtin-type", dm); + dpi->modifiers = hold_dpm; - if (code == 'u') - { - advance_char (dm); - RETURN_IF_ERROR (demangle_source_name (dm)); - return STATUS_OK; - } - else if (code >= 'a' && code <= 'z') - { - const char *type_name; - /* Java uses different names for some built-in types. */ - if (dm->style == DMGL_JAVA) - type_name = java_builtin_type_names[code - 'a']; - else - type_name = builtin_type_names[code - 'a']; - if (type_name == NULL) - return "Unrecognized <builtin-type> code."; + return; + } - RETURN_IF_ERROR (result_add (dm, type_name)); - advance_char (dm); - return STATUS_OK; - } - else - return "Non-alphabetic <builtin-type> code."; -} + case D_COMP_TEMPLATE_PARAM: + { + long i; + struct d_comp *a; + struct d_print_template *hold_dpt; -/* Demangles all consecutive CV-qualifiers (const, volatile, and - restrict) at the current position. The qualifiers are appended to - QUALIFIERS. Returns STATUS_OK. */ + if (dpi->templates == NULL) + { + d_print_error (dpi); + return; + } + i = dc->u.s_number.number; + for (a = d_right (dpi->templates->template); + a != NULL; + a = d_right (a)) + { + if (a->type != D_COMP_TEMPLATE_ARGLIST) + { + d_print_error (dpi); + return; + } + if (i <= 0) + break; + --i; + } + if (i != 0 || a == NULL) + { + d_print_error (dpi); + return; + } -static status_t -demangle_CV_qualifiers (dm, qualifiers) - demangling_t dm; - dyn_string_t qualifiers; -{ - DEMANGLE_TRACE ("CV-qualifiers", dm); + /* While processing this parameter, we need to pop the list of + templates. This is because the template parameter may + itself be a reference to a parameter of an outer + template. */ - while (1) - { - switch (peek_char (dm)) - { - case 'r': - if (!dyn_string_append_space (qualifiers)) - return STATUS_ALLOCATION_FAILED; - if (!dyn_string_append_cstr (qualifiers, "restrict")) - return STATUS_ALLOCATION_FAILED; - break; + hold_dpt = dpi->templates; + dpi->templates = hold_dpt->next; - case 'V': - if (!dyn_string_append_space (qualifiers)) - return STATUS_ALLOCATION_FAILED; - if (!dyn_string_append_cstr (qualifiers, "volatile")) - return STATUS_ALLOCATION_FAILED; - break; + d_print_comp (dpi, d_left (a)); - case 'K': - if (!dyn_string_append_space (qualifiers)) - return STATUS_ALLOCATION_FAILED; - if (!dyn_string_append_cstr (qualifiers, "const")) - return STATUS_ALLOCATION_FAILED; - break; + dpi->templates = hold_dpt; - default: - return STATUS_OK; - } + return; + } - advance_char (dm); - } -} + case D_COMP_CTOR: + d_print_comp (dpi, dc->u.s_ctor.name); + return; + + case D_COMP_DTOR: + d_append_char (dpi, '~'); + d_print_comp (dpi, dc->u.s_dtor.name); + return; + + case D_COMP_VTABLE: + d_append_string (dpi, "vtable for "); + d_print_comp (dpi, d_left (dc)); + return; + + case D_COMP_VTT: + d_append_string (dpi, "VTT for "); + d_print_comp (dpi, d_left (dc)); + return; + + case D_COMP_CONSTRUCTION_VTABLE: + d_append_string (dpi, "construction vtable for "); + d_print_comp (dpi, d_left (dc)); + d_append_string (dpi, "-in-"); + d_print_comp (dpi, d_right (dc)); + return; + + case D_COMP_TYPEINFO: + d_append_string (dpi, "typeinfo for "); + d_print_comp (dpi, d_left (dc)); + return; + + case D_COMP_TYPEINFO_NAME: + d_append_string (dpi, "typeinfo name for "); + d_print_comp (dpi, d_left (dc)); + return; + + case D_COMP_TYPEINFO_FN: + d_append_string (dpi, "typeinfo fn for "); + d_print_comp (dpi, d_left (dc)); + return; + + case D_COMP_THUNK: + d_append_string (dpi, "non-virtual thunk to "); + d_print_comp (dpi, d_left (dc)); + return; + + case D_COMP_VIRTUAL_THUNK: + d_append_string (dpi, "virtual thunk to "); + d_print_comp (dpi, d_left (dc)); + return; + + case D_COMP_COVARIANT_THUNK: + d_append_string (dpi, "covariant return thunk to "); + d_print_comp (dpi, d_left (dc)); + return; + + case D_COMP_JAVA_CLASS: + d_append_string (dpi, "java Class for "); + d_print_comp (dpi, d_left (dc)); + return; + + case D_COMP_GUARD: + d_append_string (dpi, "guard variable for "); + d_print_comp (dpi, d_left (dc)); + return; + + case D_COMP_REFTEMP: + d_append_string (dpi, "reference temporary for "); + d_print_comp (dpi, d_left (dc)); + return; + + case D_COMP_SUB_STD: + d_append_string (dpi, dc->u.s_string.string); + return; + + case D_COMP_RESTRICT: + case D_COMP_VOLATILE: + case D_COMP_CONST: + case D_COMP_RESTRICT_THIS: + case D_COMP_VOLATILE_THIS: + case D_COMP_CONST_THIS: + case D_COMP_VENDOR_TYPE_QUAL: + case D_COMP_POINTER: + case D_COMP_REFERENCE: + case D_COMP_COMPLEX: + case D_COMP_IMAGINARY: + { + /* We keep a list of modifiers on the stack. */ + struct d_print_mod dpm; -/* Demangles and emits a <function-type>. *FUNCTION_NAME_POS is the - position in the result string of the start of the function - identifier, at which the function's return type will be inserted; - *FUNCTION_NAME_POS is updated to position past the end of the - function's return type. + dpm.next = dpi->modifiers; + dpi->modifiers = &dpm; + dpm.mod = dc; + dpm.printed = 0; + dpm.templates = dpi->templates; - <function-type> ::= F [Y] <bare-function-type> E */ + d_print_comp (dpi, d_left (dc)); -static status_t -demangle_function_type (dm, function_name_pos) - demangling_t dm; - int *function_name_pos; -{ - DEMANGLE_TRACE ("function-type", dm); - RETURN_IF_ERROR (demangle_char (dm, 'F')); - if (peek_char (dm) == 'Y') - { - /* Indicate this function has C linkage if in verbose mode. */ - if (flag_verbose) - RETURN_IF_ERROR (result_add (dm, " [extern \"C\"] ")); - advance_char (dm); - } - RETURN_IF_ERROR (demangle_bare_function_type (dm, function_name_pos)); - RETURN_IF_ERROR (demangle_char (dm, 'E')); - return STATUS_OK; -} + /* If the modifier didn't get printed by the type, print it + now. */ + if (! dpm.printed) + d_print_mod (dpi, dc); -/* Demangles and emits a <bare-function-type>. RETURN_TYPE_POS is the - position in the result string at which the function return type - should be inserted. If RETURN_TYPE_POS is BFT_NO_RETURN_TYPE, the - function's return type is assumed not to be encoded. + dpi->modifiers = dpm.next; - <bare-function-type> ::= <signature type>+ */ + return; + } -static status_t -demangle_bare_function_type (dm, return_type_pos) - demangling_t dm; - int *return_type_pos; -{ - /* Sequence is the index of the current function parameter, counting - from zero. The value -1 denotes the return type. */ - int sequence = - (return_type_pos == BFT_NO_RETURN_TYPE ? 0 : -1); + case D_COMP_BUILTIN_TYPE: + if ((dpi->options & DMGL_JAVA) == 0) + d_append_string (dpi, dc->u.s_builtin.type->name); + else + d_append_string (dpi, dc->u.s_builtin.type->java_name); + return; - DEMANGLE_TRACE ("bare-function-type", dm); + case D_COMP_VENDOR_TYPE: + d_print_comp (dpi, d_left (dc)); + return; - RETURN_IF_ERROR (result_add_char (dm, '(')); - while (!end_of_name_p (dm) && peek_char (dm) != 'E') - { - if (sequence == -1) - /* We're decoding the function's return type. */ - { - dyn_string_t return_type; - status_t status = STATUS_OK; - - /* Decode the return type off to the side. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_type (dm)); - return_type = (dyn_string_t) result_pop (dm); - - /* Add a space to the end of the type. Insert the return - type where we've been asked to. */ - if (!dyn_string_append_space (return_type)) - status = STATUS_ALLOCATION_FAILED; - if (STATUS_NO_ERROR (status)) - { - if (!dyn_string_insert (result_string (dm), *return_type_pos, - return_type)) - status = STATUS_ALLOCATION_FAILED; - else - *return_type_pos += dyn_string_length (return_type); - } + case D_COMP_FUNCTION_TYPE: + { + if (d_left (dc) != NULL) + { + struct d_print_mod dpm; - dyn_string_delete (return_type); - RETURN_IF_ERROR (status); - } - else - { - /* Skip `void' parameter types. One should only occur as - the only type in a parameter list; in that case, we want - to print `foo ()' instead of `foo (void)'. */ - if (peek_char (dm) == 'v') - /* Consume the v. */ - advance_char (dm); - else - { - /* Separate parameter types by commas. */ - if (sequence > 0) - RETURN_IF_ERROR (result_add (dm, ", ")); - /* Demangle the type. */ - RETURN_IF_ERROR (demangle_type (dm)); - } - } + /* We must pass this type down as a modifier in order to + print it in the right location. */ - ++sequence; - } - RETURN_IF_ERROR (result_add_char (dm, ')')); + dpm.next = dpi->modifiers; + dpi->modifiers = &dpm; + dpm.mod = dc; + dpm.printed = 0; + dpm.templates = dpi->templates; - /* We should have demangled at least one parameter type (which would - be void, for a function that takes no parameters), plus the - return type, if we were supposed to demangle that. */ - if (sequence == -1) - return "Missing function return type."; - else if (sequence == 0) - return "Missing function parameter."; + d_print_comp (dpi, d_left (dc)); - return STATUS_OK; -} + dpi->modifiers = dpm.next; -/* Demangles and emits a <class-enum-type>. *ENCODE_RETURN_TYPE is set to - non-zero if the type is a template-id, zero otherwise. + if (dpm.printed) + return; - <class-enum-type> ::= <name> */ + d_append_char (dpi, ' '); + } -static status_t -demangle_class_enum_type (dm, encode_return_type) - demangling_t dm; - int *encode_return_type; -{ - DEMANGLE_TRACE ("class-enum-type", dm); + d_print_function_type (dpi, dc, dpi->modifiers); - RETURN_IF_ERROR (demangle_name (dm, encode_return_type)); - return STATUS_OK; -} + return; + } -/* Demangles and emits an <array-type>. + case D_COMP_ARRAY_TYPE: + { + struct d_print_mod dpm; - If PTR_INSERT_POS is not NULL, the array type is formatted as a - pointer or reference to an array, except that asterisk and - ampersand punctuation is omitted (since it's not know at this - point). *PTR_INSERT_POS is set to the position in the demangled - name at which this punctuation should be inserted. For example, - `A10_i' is demangled to `int () [10]' and *PTR_INSERT_POS points - between the parentheses. + /* We must pass this type down as a modifier in order to print + multi-dimensional arrays correctly. */ - If PTR_INSERT_POS is NULL, the array type is assumed not to be - pointer- or reference-qualified. Then, for example, `A10_i' is - demangled simply as `int[10]'. + dpm.next = dpi->modifiers; + dpi->modifiers = &dpm; + dpm.mod = dc; + dpm.printed = 0; + dpm.templates = dpi->templates; - <array-type> ::= A [<dimension number>] _ <element type> - ::= A <dimension expression> _ <element type> */ + d_print_comp (dpi, d_right (dc)); -static status_t -demangle_array_type (dm, ptr_insert_pos) - demangling_t dm; - int *ptr_insert_pos; -{ - status_t status = STATUS_OK; - dyn_string_t array_size = NULL; - char peek; + dpi->modifiers = dpm.next; - DEMANGLE_TRACE ("array-type", dm); + if (dpm.printed) + return; - RETURN_IF_ERROR (demangle_char (dm, 'A')); + d_print_array_type (dpi, dc, dpi->modifiers); - /* Demangle the array size into array_size. */ - peek = peek_char (dm); - if (peek == '_') - /* Array bound is omitted. This is a C99-style VLA. */ - ; - else if (IS_DIGIT (peek_char (dm))) - { - /* It looks like a constant array bound. */ - array_size = dyn_string_new (10); - if (array_size == NULL) - return STATUS_ALLOCATION_FAILED; - status = demangle_number_literally (dm, array_size, 10, 0); - } - else - { - /* Anything is must be an expression for a nont-constant array - bound. This happens if the array type occurs in a template - and the array bound references a template parameter. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_expression (dm)); - array_size = (dyn_string_t) result_pop (dm); - } - /* array_size may have been allocated by now, so we can't use - RETURN_IF_ERROR until it's been deallocated. */ + return; + } - /* Demangle the base type of the array. */ - if (STATUS_NO_ERROR (status)) - status = demangle_char (dm, '_'); - if (STATUS_NO_ERROR (status)) - status = demangle_type (dm); + case D_COMP_PTRMEM_TYPE: + { + struct d_print_mod dpm; - if (ptr_insert_pos != NULL) - { - /* This array is actually part of an pointer- or - reference-to-array type. Format appropriately, except we - don't know which and how much punctuation to use. */ - if (STATUS_NO_ERROR (status)) - status = result_add (dm, " () "); - /* Let the caller know where to insert the punctuation. */ - *ptr_insert_pos = result_caret_pos (dm) - 2; - } + dpm.next = dpi->modifiers; + dpi->modifiers = &dpm; + dpm.mod = dc; + dpm.printed = 0; + dpm.templates = dpi->templates; - /* Emit the array dimension syntax. */ - if (STATUS_NO_ERROR (status)) - status = result_add_char (dm, '['); - if (STATUS_NO_ERROR (status) && array_size != NULL) - status = result_add_string (dm, array_size); - if (STATUS_NO_ERROR (status)) - status = result_add_char (dm, ']'); - if (array_size != NULL) - dyn_string_delete (array_size); - - RETURN_IF_ERROR (status); - - return STATUS_OK; -} + d_print_comp (dpi, d_right (dc)); -/* Demangles and emits a <template-param>. + /* If the modifier didn't get printed by the type, print it + now. */ + if (! dpm.printed) + { + d_append_char (dpi, ' '); + d_print_comp (dpi, d_left (dc)); + d_append_string (dpi, "::*"); + } - <template-param> ::= T_ # first template parameter - ::= T <parameter-2 number> _ */ + dpi->modifiers = dpm.next; -static status_t -demangle_template_param (dm) - demangling_t dm; -{ - int parm_number; - template_arg_list_t current_arg_list = current_template_arg_list (dm); - string_list_t arg; + return; + } - DEMANGLE_TRACE ("template-param", dm); + case D_COMP_ARGLIST: + case D_COMP_TEMPLATE_ARGLIST: + d_print_comp (dpi, d_left (dc)); + if (d_right (dc) != NULL) + { + d_append_string (dpi, ", "); + d_print_comp (dpi, d_right (dc)); + } + return; - /* Make sure there is a template argmust list in which to look up - this parameter reference. */ - if (current_arg_list == NULL) - return "Template parameter outside of template."; + case D_COMP_OPERATOR: + { + char c; + + d_append_string (dpi, "operator"); + c = dc->u.s_operator.op->name[0]; + if (IS_LOWER (c)) + d_append_char (dpi, ' '); + d_append_string (dpi, dc->u.s_operator.op->name); + return; + } - RETURN_IF_ERROR (demangle_char (dm, 'T')); - if (peek_char (dm) == '_') - parm_number = 0; - else - { - RETURN_IF_ERROR (demangle_number (dm, &parm_number, 10, 0)); - ++parm_number; - } - RETURN_IF_ERROR (demangle_char (dm, '_')); + case D_COMP_EXTENDED_OPERATOR: + d_append_string (dpi, "operator "); + d_print_comp (dpi, dc->u.s_extended_operator.name); + return; - arg = template_arg_list_get_arg (current_arg_list, parm_number); - if (arg == NULL) - /* parm_number exceeded the number of arguments in the current - template argument list. */ - return "Template parameter number out of bounds."; - RETURN_IF_ERROR (result_add_string (dm, (dyn_string_t) arg)); + case D_COMP_CAST: + d_append_string (dpi, "operator "); + d_print_cast (dpi, dc); + return; - return STATUS_OK; -} + case D_COMP_UNARY: + if (d_left (dc)->type != D_COMP_CAST) + d_print_expr_op (dpi, d_left (dc)); + else + { + d_append_string (dpi, "(("); + d_print_cast (dpi, d_left (dc)); + d_append_char (dpi, ')'); + } + d_append_char (dpi, '('); + d_print_comp (dpi, d_right (dc)); + d_append_char (dpi, ')'); + if (d_left (dc)->type == D_COMP_CAST) + d_append_char (dpi, ')'); + return; + + case D_COMP_BINARY: + if (d_right (dc)->type != D_COMP_BINARY_ARGS) + { + d_print_error (dpi); + return; + } -/* Demangles and emits a <template-args>. + /* We wrap an expression which uses the greater-than operator in + an extra layer of parens so that it does not get confused + with the '>' which ends the template parameters. */ + if (d_left (dc)->type == D_COMP_OPERATOR + && strcmp (d_left (dc)->u.s_operator.op->name, ">") == 0) + d_append_char (dpi, '('); + + d_append_char (dpi, '('); + d_print_comp (dpi, d_left (d_right (dc))); + d_append_string (dpi, ") "); + d_print_expr_op (dpi, d_left (dc)); + d_append_string (dpi, " ("); + d_print_comp (dpi, d_right (d_right (dc))); + d_append_char (dpi, ')'); + + if (d_left (dc)->type == D_COMP_OPERATOR + && strcmp (d_left (dc)->u.s_operator.op->name, ">") == 0) + d_append_char (dpi, ')'); + + return; + + case D_COMP_BINARY_ARGS: + /* We should only see this as part of D_COMP_BINARY. */ + d_print_error (dpi); + return; + + case D_COMP_TRINARY: + if (d_right (dc)->type != D_COMP_TRINARY_ARG1 + || d_right (d_right (dc))->type != D_COMP_TRINARY_ARG2) + { + d_print_error (dpi); + return; + } + d_append_char (dpi, '('); + d_print_comp (dpi, d_left (d_right (dc))); + d_append_string (dpi, ") "); + d_print_expr_op (dpi, d_left (dc)); + d_append_string (dpi, " ("); + d_print_comp (dpi, d_left (d_right (d_right (dc)))); + d_append_string (dpi, ") : ("); + d_print_comp (dpi, d_right (d_right (d_right (dc)))); + d_append_char (dpi, ')'); + return; + + case D_COMP_TRINARY_ARG1: + case D_COMP_TRINARY_ARG2: + /* We should only see these are part of D_COMP_TRINARY. */ + d_print_error (dpi); + return; + + case D_COMP_LITERAL: + case D_COMP_LITERAL_NEG: + /* For some builtin types, produce simpler output. */ + if (d_left (dc)->type == D_COMP_BUILTIN_TYPE) + { + switch (d_left (dc)->u.s_builtin.type->print) + { + case D_PRINT_INT: + if (d_right (dc)->type == D_COMP_NAME) + { + if (dc->type == D_COMP_LITERAL_NEG) + d_append_char (dpi, '-'); + d_print_comp (dpi, d_right (dc)); + return; + } + break; - <template-args> ::= I <template-arg>+ E */ + case D_PRINT_LONG: + if (d_right (dc)->type == D_COMP_NAME) + { + if (dc->type == D_COMP_LITERAL_NEG) + d_append_char (dpi, '-'); + d_print_comp (dpi, d_right (dc)); + d_append_char (dpi, 'l'); + return; + } + break; -static status_t -demangle_template_args (dm) - demangling_t dm; -{ - int first = 1; - dyn_string_t old_last_source_name; - template_arg_list_t arg_list = template_arg_list_new (); + case D_PRINT_BOOL: + if (d_right (dc)->type == D_COMP_NAME + && d_right (dc)->u.s_name.len == 1 + && dc->type == D_COMP_LITERAL) + { + switch (d_right (dc)->u.s_name.s[0]) + { + case '0': + d_append_string (dpi, "false"); + return; + case '1': + d_append_string (dpi, "true"); + return; + default: + break; + } + } + break; - if (arg_list == NULL) - return STATUS_ALLOCATION_FAILED; + default: + break; + } + } - /* Preserve the most recently demangled source name. */ - old_last_source_name = dm->last_source_name; - dm->last_source_name = dyn_string_new (0); + d_append_char (dpi, '('); + d_print_comp (dpi, d_left (dc)); + d_append_char (dpi, ')'); + if (dc->type == D_COMP_LITERAL_NEG) + d_append_char (dpi, '-'); + d_print_comp (dpi, d_right (dc)); + return; - DEMANGLE_TRACE ("template-args", dm); + default: + d_print_error (dpi); + return; + } +} - if (dm->last_source_name == NULL) - return STATUS_ALLOCATION_FAILED; +/* Print an identifier. */ - RETURN_IF_ERROR (demangle_char (dm, 'I')); - RETURN_IF_ERROR (result_open_template_list (dm)); - do +static void +d_print_identifier (dpi, name, len) + struct d_print_info *dpi; + const char *name; + int len; +{ + if ((dpi->options & DMGL_JAVA) == 0) + d_append_buffer (dpi, name, len); + else { - string_list_t arg; - - if (first) - first = 0; - else - RETURN_IF_ERROR (result_add (dm, ", ")); + const char *p; + const char *end; - /* Capture the template arg. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_template_arg (dm)); - arg = result_pop (dm); + /* For Java we try to handle encoded extended Unicode + characters. The C++ ABI doesn't mention Unicode encoding, so + we don't it for C++. Characters are encoded as + __U<hex-char>+_. */ + end = name + len; + for (p = name; p < end; ++p) + { + if (end - p > 3 + && p[0] == '_' + && p[1] == '_' + && p[2] == 'U') + { + unsigned long c; + const char *q; - /* Emit it in the demangled name. */ - RETURN_IF_ERROR (result_add_string (dm, (dyn_string_t) arg)); + c = 0; + for (q = p + 3; q < end; ++q) + { + int dig; + + if (IS_DIGIT (*q)) + dig = *q - '0'; + else if (*q >= 'A' && *q <= 'F') + dig = *q - 'A' + 10; + else if (*q >= 'a' && *q <= 'f') + dig = *q - 'a' + 10; + else + break; + + c = c * 16 + dig; + } + /* If the Unicode character is larger than 256, we don't + try to deal with it here. FIXME. */ + if (q < end && *q == '_' && c < 256) + { + d_append_char (dpi, c); + p = q; + continue; + } + } - /* Save it for use in expanding <template-param>s. */ - template_arg_list_add_arg (arg_list, arg); + d_append_char (dpi, *p); + } } - while (peek_char (dm) != 'E'); - /* Append the '>'. */ - RETURN_IF_ERROR (result_close_template_list (dm)); - - /* Consume the 'E'. */ - advance_char (dm); - - /* Restore the most recent demangled source name. */ - dyn_string_delete (dm->last_source_name); - dm->last_source_name = old_last_source_name; - - /* Push the list onto the top of the stack of template argument - lists, so that arguments from it are used from now on when - expanding <template-param>s. */ - push_template_arg_list (dm, arg_list); - - return STATUS_OK; } -/* This function, which does not correspond to a production in the - mangling spec, handles the `literal' production for both - <template-arg> and <expr-primary>. It does not expect or consume - the initial `L' or final `E'. The demangling is given by: +/* Print a list of modifiers. SUFFIX is 1 if we are printing + qualifiers on this after printing a function. */ - <literal> ::= <type> </value/ number> - - and the emitted output is `(type)number'. */ - -static status_t -demangle_literal (dm) - demangling_t dm; +static void +d_print_mod_list (dpi, mods, suffix) + struct d_print_info *dpi; + struct d_print_mod *mods; + int suffix; { - char peek = peek_char (dm); - dyn_string_t value_string; - status_t status; + struct d_print_template *hold_dpt; - DEMANGLE_TRACE ("literal", dm); + if (mods == NULL || d_print_saw_error (dpi)) + return; - if (!flag_verbose && peek >= 'a' && peek <= 'z') + if (mods->printed + || (! suffix + && (mods->mod->type == D_COMP_RESTRICT_THIS + || mods->mod->type == D_COMP_VOLATILE_THIS + || mods->mod->type == D_COMP_CONST_THIS))) { - /* If not in verbose mode and this is a builtin type, see if we - can produce simpler numerical output. In particular, for - integer types shorter than `long', just write the number - without type information; for bools, write `true' or `false'. - Other refinements could be made here too. */ - - /* This constant string is used to map from <builtin-type> codes - (26 letters of the alphabet) to codes that determine how the - value will be displayed. The codes are: - b: display as bool - i: display as int - l: display as long - A space means the value will be represented using cast - notation. */ - static const char *const code_map = "ibi iii ll ii i "; - - char code = code_map[peek - 'a']; - /* FIXME: Implement demangling of floats and doubles. */ - if (code == 'u') - return STATUS_UNIMPLEMENTED; - if (code == 'b') - { - /* It's a boolean. */ - char value; - - /* Consume the b. */ - advance_char (dm); - /* Look at the next character. It should be 0 or 1, - corresponding to false or true, respectively. */ - value = peek_char (dm); - if (value == '0') - RETURN_IF_ERROR (result_add (dm, "false")); - else if (value == '1') - RETURN_IF_ERROR (result_add (dm, "true")); - else - return "Unrecognized bool constant."; - /* Consume the 0 or 1. */ - advance_char (dm); - return STATUS_OK; - } - else if (code == 'i' || code == 'l') - { - /* It's an integer or long. */ - - /* Consume the type character. */ - advance_char (dm); - - /* Demangle the number and write it out. */ - value_string = dyn_string_new (0); - status = demangle_number_literally (dm, value_string, 10, 1); - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, value_string); - /* For long integers, append an l. */ - if (code == 'l' && STATUS_NO_ERROR (status)) - status = result_add_char (dm, code); - dyn_string_delete (value_string); - - RETURN_IF_ERROR (status); - return STATUS_OK; - } - /* ...else code == ' ', so fall through to represent this - literal's type explicitly using cast syntax. */ + d_print_mod_list (dpi, mods->next, suffix); + return; } - RETURN_IF_ERROR (result_add_char (dm, '(')); - RETURN_IF_ERROR (demangle_type (dm)); - RETURN_IF_ERROR (result_add_char (dm, ')')); - - value_string = dyn_string_new (0); - if (value_string == NULL) - return STATUS_ALLOCATION_FAILED; + mods->printed = 1; - status = demangle_number_literally (dm, value_string, 10, 1); - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, value_string); - dyn_string_delete (value_string); - RETURN_IF_ERROR (status); + hold_dpt = dpi->templates; + dpi->templates = mods->templates; - return STATUS_OK; -} - -/* Demangles and emits a <template-arg>. - - <template-arg> ::= <type> # type - ::= L <type> <value number> E # literal - ::= LZ <encoding> E # external name - ::= X <expression> E # expression */ + if (mods->mod->type == D_COMP_FUNCTION_TYPE) + { + d_print_function_type (dpi, mods->mod, mods->next); + dpi->templates = hold_dpt; + return; + } + else if (mods->mod->type == D_COMP_ARRAY_TYPE) + { + d_print_array_type (dpi, mods->mod, mods->next); + dpi->templates = hold_dpt; + return; + } -static status_t -demangle_template_arg (dm) - demangling_t dm; -{ - DEMANGLE_TRACE ("template-arg", dm); + d_print_mod (dpi, mods->mod); - switch (peek_char (dm)) - { - case 'L': - advance_char (dm); + dpi->templates = hold_dpt; - if (peek_char (dm) == 'Z') - { - /* External name. */ - advance_char (dm); - /* FIXME: Standard is contradictory here. */ - RETURN_IF_ERROR (demangle_encoding (dm)); - } - else - RETURN_IF_ERROR (demangle_literal (dm)); - RETURN_IF_ERROR (demangle_char (dm, 'E')); - break; + d_print_mod_list (dpi, mods->next, suffix); +} - case 'X': - /* Expression. */ - advance_char (dm); - RETURN_IF_ERROR (demangle_expression (dm)); - RETURN_IF_ERROR (demangle_char (dm, 'E')); - break; +/* Print a modifier. */ +static void +d_print_mod (dpi, mod) + struct d_print_info *dpi; + const struct d_comp *mod; +{ + switch (mod->type) + { + case D_COMP_RESTRICT: + case D_COMP_RESTRICT_THIS: + d_append_string (dpi, " restrict"); + return; + case D_COMP_VOLATILE: + case D_COMP_VOLATILE_THIS: + d_append_string (dpi, " volatile"); + return; + case D_COMP_CONST: + case D_COMP_CONST_THIS: + d_append_string (dpi, " const"); + return; + case D_COMP_VENDOR_TYPE_QUAL: + d_append_char (dpi, ' '); + d_print_comp (dpi, d_right (mod)); + return; + case D_COMP_POINTER: + /* There is no pointer symbol in Java. */ + if ((dpi->options & DMGL_JAVA) == 0) + d_append_char (dpi, '*'); + return; + case D_COMP_REFERENCE: + d_append_char (dpi, '&'); + return; + case D_COMP_COMPLEX: + d_append_string (dpi, "complex "); + return; + case D_COMP_IMAGINARY: + d_append_string (dpi, "imaginary "); + return; + case D_COMP_PTRMEM_TYPE: + if (d_last_char (dpi) != '(') + d_append_char (dpi, ' '); + d_print_comp (dpi, d_left (mod)); + d_append_string (dpi, "::*"); + return; + case D_COMP_TYPED_NAME: + d_print_comp (dpi, d_left (mod)); + return; default: - RETURN_IF_ERROR (demangle_type (dm)); - break; + /* Otherwise, we have something that won't go back on the + modifier stack, so we can just print it. */ + d_print_comp (dpi, mod); + return; } - - return STATUS_OK; } -/* Demangles and emits an <expression>. - - <expression> ::= <unary operator-name> <expression> - ::= <binary operator-name> <expression> <expression> - ::= <expr-primary> - ::= <scope-expression> */ +/* Print a function type, except for the return type. */ -static status_t -demangle_expression (dm) - demangling_t dm; +static void +d_print_function_type (dpi, dc, mods) + struct d_print_info *dpi; + const struct d_comp *dc; + struct d_print_mod *mods; { - char peek = peek_char (dm); - - DEMANGLE_TRACE ("expression", dm); + int need_paren; + int saw_mod; + struct d_print_mod *p; - if (peek == 'L' || peek == 'T') - RETURN_IF_ERROR (demangle_expr_primary (dm)); - else if (peek == 's' && peek_char_next (dm) == 'r') - RETURN_IF_ERROR (demangle_scope_expression (dm)); - else - /* An operator expression. */ + need_paren = 0; + saw_mod = 0; + for (p = mods; p != NULL; p = p->next) { - int num_args; - int type_arg; - status_t status = STATUS_OK; - dyn_string_t operator_name; - - /* We have an operator name. Since we want to output binary - operations in infix notation, capture the operator name - first. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_operator_name (dm, 1, &num_args, - &type_arg)); - operator_name = (dyn_string_t) result_pop (dm); - - /* If it's binary, do an operand first. */ - if (num_args > 1) - { - status = result_add_char (dm, '('); - if (STATUS_NO_ERROR (status)) - status = demangle_expression (dm); - if (STATUS_NO_ERROR (status)) - status = result_add_char (dm, ')'); - } - - /* Emit the operator. */ - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, operator_name); - dyn_string_delete (operator_name); - RETURN_IF_ERROR (status); - - /* Emit its second (if binary) or only (if unary) operand. */ - RETURN_IF_ERROR (result_add_char (dm, '(')); - if (type_arg) - RETURN_IF_ERROR (demangle_type (dm)); - else - RETURN_IF_ERROR (demangle_expression (dm)); - RETURN_IF_ERROR (result_add_char (dm, ')')); + if (p->printed) + break; - /* The ternary operator takes a third operand. */ - if (num_args == 3) + saw_mod = 1; + switch (p->mod->type) { - RETURN_IF_ERROR (result_add (dm, ":(")); - RETURN_IF_ERROR (demangle_expression (dm)); - RETURN_IF_ERROR (result_add_char (dm, ')')); + case D_COMP_RESTRICT: + case D_COMP_VOLATILE: + case D_COMP_CONST: + case D_COMP_VENDOR_TYPE_QUAL: + case D_COMP_POINTER: + case D_COMP_REFERENCE: + case D_COMP_COMPLEX: + case D_COMP_IMAGINARY: + case D_COMP_PTRMEM_TYPE: + need_paren = 1; + break; + case D_COMP_RESTRICT_THIS: + case D_COMP_VOLATILE_THIS: + case D_COMP_CONST_THIS: + break; + default: + break; } + if (need_paren) + break; } - return STATUS_OK; -} - -/* Demangles and emits a <scope-expression>. + if (d_left (dc) != NULL && ! saw_mod) + need_paren = 1; - <scope-expression> ::= sr <qualifying type> <source-name> - ::= sr <qualifying type> <encoding> */ - -static status_t -demangle_scope_expression (dm) - demangling_t dm; -{ - RETURN_IF_ERROR (demangle_char (dm, 's')); - RETURN_IF_ERROR (demangle_char (dm, 'r')); - RETURN_IF_ERROR (demangle_type (dm)); - RETURN_IF_ERROR (result_add (dm, "::")); - RETURN_IF_ERROR (demangle_encoding (dm)); - return STATUS_OK; -} + if (need_paren) + { + switch (d_last_char (dpi)) + { + case ' ': + case '(': + case '*': + break; -/* Demangles and emits an <expr-primary>. + default: + d_append_char (dpi, ' '); + break; + } - <expr-primary> ::= <template-param> - ::= L <type> <value number> E # literal - ::= L <mangled-name> E # external name */ + d_append_char (dpi, '('); + } -static status_t -demangle_expr_primary (dm) - demangling_t dm; -{ - char peek = peek_char (dm); + d_print_mod_list (dpi, mods, 0); - DEMANGLE_TRACE ("expr-primary", dm); + if (need_paren) + d_append_char (dpi, ')'); - if (peek == 'T') - RETURN_IF_ERROR (demangle_template_param (dm)); - else if (peek == 'L') - { - /* Consume the `L'. */ - advance_char (dm); - peek = peek_char (dm); + d_append_char (dpi, '('); - if (peek == '_') - RETURN_IF_ERROR (demangle_mangled_name (dm)); - else - RETURN_IF_ERROR (demangle_literal (dm)); + if (d_right (dc) != NULL) + d_print_comp (dpi, d_right (dc)); - RETURN_IF_ERROR (demangle_char (dm, 'E')); - } - else - return STATUS_ERROR; + d_append_char (dpi, ')'); - return STATUS_OK; + d_print_mod_list (dpi, mods, 1); } -/* Demangles and emits a <substitution>. Sets *TEMPLATE_P to non-zero - if the substitution is the name of a template, zero otherwise. - - <substitution> ::= S <seq-id> _ - ::= S_ - - ::= St # ::std:: - ::= Sa # ::std::allocator - ::= Sb # ::std::basic_string - ::= Ss # ::std::basic_string<char, - ::std::char_traits<char>, - ::std::allocator<char> > - ::= Si # ::std::basic_istream<char, - std::char_traits<char> > - ::= So # ::std::basic_ostream<char, - std::char_traits<char> > - ::= Sd # ::std::basic_iostream<char, - std::char_traits<char> > -*/ +/* Print an array type, except for the element type. */ -static status_t -demangle_substitution (dm, template_p) - demangling_t dm; - int *template_p; +static void +d_print_array_type (dpi, dc, mods) + struct d_print_info *dpi; + const struct d_comp *dc; + struct d_print_mod *mods; { - int seq_id; - int peek; - dyn_string_t text; + int need_space; - DEMANGLE_TRACE ("substitution", dm); - - RETURN_IF_ERROR (demangle_char (dm, 'S')); - - /* Scan the substitution sequence index. A missing number denotes - the first index. */ - peek = peek_char (dm); - if (peek == '_') - seq_id = -1; - /* If the following character is 0-9 or a capital letter, interpret - the sequence up to the next underscore as a base-36 substitution - index. */ - else if (IS_DIGIT ((unsigned char) peek) - || (peek >= 'A' && peek <= 'Z')) - RETURN_IF_ERROR (demangle_number (dm, &seq_id, 36, 0)); - else + need_space = 1; + if (mods != NULL) { - const char *new_last_source_name = NULL; + int need_paren; + struct d_print_mod *p; - switch (peek) + need_paren = 0; + for (p = mods; p != NULL; p = p->next) { - case 't': - RETURN_IF_ERROR (result_add (dm, "std")); - break; - - case 'a': - RETURN_IF_ERROR (result_add (dm, "std::allocator")); - new_last_source_name = "allocator"; - *template_p = 1; - break; + if (p->printed) + break; - case 'b': - RETURN_IF_ERROR (result_add (dm, "std::basic_string")); - new_last_source_name = "basic_string"; - *template_p = 1; - break; - - case 's': - if (!flag_verbose) + if (p->mod->type == D_COMP_ARRAY_TYPE) { - RETURN_IF_ERROR (result_add (dm, "std::string")); - new_last_source_name = "string"; + need_space = 0; + break; } else { - RETURN_IF_ERROR (result_add (dm, "std::basic_string<char, std::char_traits<char>, std::allocator<char> >")); - new_last_source_name = "basic_string"; + need_paren = 1; + need_space = 1; + break; } - *template_p = 0; - break; + } - case 'i': - if (!flag_verbose) - { - RETURN_IF_ERROR (result_add (dm, "std::istream")); - new_last_source_name = "istream"; - } - else - { - RETURN_IF_ERROR (result_add (dm, "std::basic_istream<char, std::char_traits<char> >")); - new_last_source_name = "basic_istream"; - } - *template_p = 0; - break; + if (need_paren) + d_append_string (dpi, " ("); - case 'o': - if (!flag_verbose) - { - RETURN_IF_ERROR (result_add (dm, "std::ostream")); - new_last_source_name = "ostream"; - } - else - { - RETURN_IF_ERROR (result_add (dm, "std::basic_ostream<char, std::char_traits<char> >")); - new_last_source_name = "basic_ostream"; - } - *template_p = 0; - break; + d_print_mod_list (dpi, mods, 0); - case 'd': - if (!flag_verbose) - { - RETURN_IF_ERROR (result_add (dm, "std::iostream")); - new_last_source_name = "iostream"; - } - else - { - RETURN_IF_ERROR (result_add (dm, "std::basic_iostream<char, std::char_traits<char> >")); - new_last_source_name = "basic_iostream"; - } - *template_p = 0; - break; + if (need_paren) + d_append_char (dpi, ')'); + } - default: - return "Unrecognized <substitution>."; - } - - /* Consume the character we just processed. */ - advance_char (dm); + if (need_space) + d_append_char (dpi, ' '); - if (new_last_source_name != NULL) - { - if (!dyn_string_copy_cstr (dm->last_source_name, - new_last_source_name)) - return STATUS_ALLOCATION_FAILED; - } + d_append_char (dpi, '['); - return STATUS_OK; - } + if (d_left (dc) != NULL) + d_print_comp (dpi, d_left (dc)); - /* Look up the substitution text. Since `S_' is the most recent - substitution, `S0_' is the second-most-recent, etc., shift the - numbering by one. */ - text = substitution_get (dm, seq_id + 1, template_p); - if (text == NULL) - return "Substitution number out of range."; + d_append_char (dpi, ']'); +} - /* Emit the substitution text. */ - RETURN_IF_ERROR (result_add_string (dm, text)); +/* Print an operator in an expression. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); - return STATUS_OK; +static void +d_print_expr_op (dpi, dc) + struct d_print_info *dpi; + const struct d_comp *dc; +{ + if (dc->type == D_COMP_OPERATOR) + d_append_string (dpi, dc->u.s_operator.op->name); + else + d_print_comp (dpi, dc); } -/* Demangles and emits a <local-name>. - - <local-name> := Z <function encoding> E <entity name> [<discriminator>] - := Z <function encoding> E s [<discriminator>] */ +/* Print a cast. */ -static status_t -demangle_local_name (dm) - demangling_t dm; +static void +d_print_cast (dpi, dc) + struct d_print_info *dpi; + const struct d_comp *dc; { - DEMANGLE_TRACE ("local-name", dm); + if (d_left (dc)->type != D_COMP_TEMPLATE) + d_print_comp (dpi, d_left (dc)); + else + { + struct d_print_mod *hold_dpm; + struct d_print_template dpt; - RETURN_IF_ERROR (demangle_char (dm, 'Z')); - RETURN_IF_ERROR (demangle_encoding (dm)); - RETURN_IF_ERROR (demangle_char (dm, 'E')); - RETURN_IF_ERROR (result_add (dm, "::")); + /* It appears that for a templated cast operator, we need to put + the template parameters in scope for the operator name, but + not for the parameters. The effect is that we need to handle + the template printing here. */ - if (peek_char (dm) == 's') - { - /* Local character string literal. */ - RETURN_IF_ERROR (result_add (dm, "string literal")); - /* Consume the s. */ - advance_char (dm); - RETURN_IF_ERROR (demangle_discriminator (dm, 0)); + hold_dpm = dpi->modifiers; + dpi->modifiers = NULL; + + dpt.next = dpi->templates; + dpi->templates = &dpt; + dpt.template = d_left (dc); + + d_print_comp (dpi, d_left (d_left (dc))); + + dpi->templates = dpt.next; + + if (d_last_char (dpi) == '<') + d_append_char (dpi, ' '); + d_append_char (dpi, '<'); + d_print_comp (dpi, d_right (d_left (dc))); + /* Avoid generating two consecutive '>' characters, to avoid + the C++ syntactic ambiguity. */ + if (d_last_char (dpi) == '>') + d_append_char (dpi, ' '); + d_append_char (dpi, '>'); + + dpi->modifiers = hold_dpm; } - else - { - int unused; - /* Local name for some other entity. Demangle its name. */ - RETURN_IF_ERROR (demangle_name (dm, &unused)); - RETURN_IF_ERROR (demangle_discriminator (dm, 1)); - } - - return STATUS_OK; - } - - /* Optimonally demangles and emits a <discriminator>. If there is no - <discriminator> at the current position in the mangled string, the - descriminator is assumed to be zero. Emit the discriminator number - in parentheses, unless SUPPRESS_FIRST is non-zero and the - discriminator is zero. - - <discriminator> ::= _ <number> */ - -static status_t -demangle_discriminator (dm, suppress_first) - demangling_t dm; - int suppress_first; +} + +/* Initialize the information structure we use to pass around + information. */ + +static int +d_init_info (mangled, options, len, di) + const char *mangled; + int options; + size_t len; + struct d_info *di; { - /* Output for <discriminator>s to the demangled name is completely - suppressed if not in verbose mode. */ + di->s = mangled; + di->options = options; - if (peek_char (dm) == '_') - { - /* Consume the underscore. */ - advance_char (dm); - if (flag_verbose) - RETURN_IF_ERROR (result_add (dm, " [#")); - /* Check if there's a number following the underscore. */ - if (IS_DIGIT ((unsigned char) peek_char (dm))) - { - int discriminator; - /* Demangle the number. */ - RETURN_IF_ERROR (demangle_number (dm, &discriminator, 10, 0)); - if (flag_verbose) - /* Write the discriminator. The mangled number is two - less than the discriminator ordinal, counting from - zero. */ - RETURN_IF_ERROR (int_to_dyn_string (discriminator + 1, - (dyn_string_t) dm->result)); - } - else - return STATUS_ERROR; - if (flag_verbose) - RETURN_IF_ERROR (result_add_char (dm, ']')); - } - else if (!suppress_first) + di->n = mangled; + + /* We can not need more components than twice the number of chars in + the mangled string. Most components correspond directly to + chars, but the ARGLIST types are exceptions. */ + di->num_comps = 2 * len; + di->comps = (struct d_comp *) malloc (di->num_comps + * sizeof (struct d_comp)); + di->next_comp = 0; + + /* Similarly, we can not need more substitutions than there are + chars in the mangled string. */ + di->num_subs = len; + di->subs = (struct d_comp **) malloc (di->num_subs + * sizeof (struct d_comp *)); + di->next_sub = 0; + + di->last_name = NULL; + + if (di->comps == NULL || di->subs == NULL) { - if (flag_verbose) - RETURN_IF_ERROR (result_add (dm, " [#0]")); + if (di->comps != NULL) + free (di->comps); + if (di->subs != NULL) + free (di->subs); + return 0; } - return STATUS_OK; + return 1; } -/* Demangle NAME into RESULT, which must be an initialized - dyn_string_t. On success, returns STATUS_OK. On failure, returns - an error message, and the contents of RESULT are unchanged. */ +/* Entry point for the demangler. If MANGLED is a g++ v3 ABI mangled + name, return a buffer allocated with malloc holding the demangled + name. OPTIONS is the usual libiberty demangler options. On + success, this sets *PALC to the allocated size of the returned + buffer. On failure, this sets *PALC to 0 for a bad name, or 1 for + a memory allocation failure. On failure, this returns NULL. */ -static status_t -cp_demangle (name, result, style) - const char *name; - dyn_string_t result; - int style; +static char * +d_demangle (mangled, options, palc) + const char* mangled; + int options; + size_t *palc; { - status_t status; - int length = strlen (name); + size_t len; + int type; + struct d_info di; + struct d_comp *dc; + char *ret; - if (length > 2 && name[0] == '_' && name[1] == 'Z') - { - demangling_t dm = demangling_new (name, style); - if (dm == NULL) - return STATUS_ALLOCATION_FAILED; + *palc = 0; - status = result_push (dm); - if (status != STATUS_OK) - { - demangling_delete (dm); - return status; - } + len = strlen (mangled); + + if (mangled[0] == '_' && mangled[1] == 'Z') + type = 0; + else if (strncmp (mangled, "_GLOBAL_", 8) == 0 + && (mangled[8] == '.' || mangled[8] == '_' || mangled[8] == '$') + && (mangled[9] == 'D' || mangled[9] == 'I') + && mangled[10] == '_') + { + char *r; - status = demangle_mangled_name (dm); - if (STATUS_NO_ERROR (status)) + r = malloc (40 + len - 11); + if (r == NULL) + *palc = 1; + else { - dyn_string_t demangled = (dyn_string_t) result_pop (dm); - if (!dyn_string_copy (result, demangled)) - return STATUS_ALLOCATION_FAILED; - dyn_string_delete (demangled); + if (mangled[9] == 'I') + strcpy (r, "global constructors keyed to "); + else + strcpy (r, "global destructors keyed to "); + strcat (r, mangled + 11); } - - demangling_delete (dm); + return r; } else { - /* It's evidently not a mangled C++ name. It could be the name - of something with C linkage, though, so just copy NAME into - RESULT. */ - if (!dyn_string_copy_cstr (result, name)) - return STATUS_ALLOCATION_FAILED; - status = STATUS_OK; + if ((options & DMGL_TYPES) == 0) + return NULL; + type = 1; } - return status; -} - -/* Demangle TYPE_NAME into RESULT, which must be an initialized - dyn_string_t. On success, returns STATUS_OK. On failiure, returns - an error message, and the contents of RESULT are unchanged. */ - -static status_t -cp_demangle_type (type_name, result) - const char* type_name; - dyn_string_t result; -{ - status_t status; - demangling_t dm = demangling_new (type_name, DMGL_GNU_V3); - - if (dm == NULL) - return STATUS_ALLOCATION_FAILED; - - /* Demangle the type name. The demangled name is stored in dm. */ - status = result_push (dm); - if (status != STATUS_OK) + if (! d_init_info (mangled, options, len, &di)) { - demangling_delete (dm); - return status; + *palc = 1; + return NULL; } - status = demangle_type (dm); + if (! type) + dc = d_mangled_name (&di, 1); + else + dc = d_type (&di); - if (STATUS_NO_ERROR (status)) - { - /* The demangling succeeded. Pop the result out of dm and copy - it into RESULT. */ - dyn_string_t demangled = (dyn_string_t) result_pop (dm); - if (!dyn_string_copy (result, demangled)) - return STATUS_ALLOCATION_FAILED; - dyn_string_delete (demangled); - } + /* If DMGL_PARAMS is set, then if we didn't consume the entire + mangled string, then we didn't successfully demangle it. If + DMGL_PARAMS is not set, we didn't look at the trailing + parameters. */ + if (((options & DMGL_PARAMS) != 0) && d_peek_char (&di) != '\0') + dc = NULL; + +#ifdef CP_DEMANGLE_DEBUG + if (dc == NULL) + printf ("failed demangling\n"); + else + d_dump (dc, 0); +#endif + + free (di.subs); + di.subs = NULL; - /* Clean up. */ - demangling_delete (dm); + ret = NULL; + if (dc != NULL) + ret = d_print (options, dc, palc); - return status; + free (di.comps); + + return ret; } #if defined(IN_LIBGCC2) || defined(IN_GLIBCPP_V3) + extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *)); -/* ia64 ABI-mandated entry point in the C++ runtime library for performing - demangling. MANGLED_NAME is a NUL-terminated character string - containing the name to be demangled. +/* ia64 ABI-mandated entry point in the C++ runtime library for + performing demangling. MANGLED_NAME is a NUL-terminated character + string containing the name to be demangled. OUTPUT_BUFFER is a region of memory, allocated with malloc, of *LENGTH bytes, into which the demangled name is stored. If OUTPUT_BUFFER is not long enough, it is expanded using realloc. OUTPUT_BUFFER may instead be NULL; in that case, the demangled name - is placed in a region of memory allocated with malloc. + is placed in a region of memory allocated with malloc. If LENGTH is non-NULL, the length of the buffer conaining the - demangled name, is placed in *LENGTH. + demangled name, is placed in *LENGTH. The return value is a pointer to the start of the NUL-terminated demangled name, or NULL if the demangling fails. The caller is - responsible for deallocating this memory using free. + responsible for deallocating this memory using free. *STATUS is set to one of the following values: 0: The demangling operation succeeded. - -1: A memory allocation failiure occurred. + -1: A memory allocation failure occurred. -2: MANGLED_NAME is not a valid name under the C++ ABI mangling rules. -3: One of the arguments is invalid. - The demagling is performed using the C++ ABI mangling rules, with + The demangling is performed using the C++ ABI mangling rules, with GNU extensions. */ char * @@ -3674,137 +3685,74 @@ __cxa_demangle (mangled_name, output_buffer, length, status) size_t *length; int *status; { - struct dyn_string demangled_name; - status_t result; + char *demangled; + size_t alc; if (status == NULL) return NULL; - if (mangled_name == NULL) { - *status = -3; - return NULL; - } - - /* Did the caller provide a buffer for the demangled name? */ - if (output_buffer == NULL) { - /* No; dyn_string will malloc a buffer for us. */ - if (!dyn_string_init (&demangled_name, 0)) - { - *status = -1; - return NULL; - } - } - else { - /* Yes. Check that the length was provided. */ - if (length == NULL) { + if (mangled_name == NULL) + { *status = -3; return NULL; } - /* Install the buffer into a dyn_string. */ - demangled_name.allocated = *length; - demangled_name.length = 0; - demangled_name.s = output_buffer; - } - - if (mangled_name[0] == '_' && mangled_name[1] == 'Z') - /* MANGLED_NAME apprears to be a function or variable name. - Demangle it accordingly. */ - result = cp_demangle (mangled_name, &demangled_name, 0); - else - /* Try to demangled MANGLED_NAME as the name of a type. */ - result = cp_demangle_type (mangled_name, &demangled_name); - if (result == STATUS_OK) - /* The demangling succeeded. */ + if (output_buffer != NULL && length == NULL) { - /* If LENGTH isn't NULL, store the allocated buffer length - there; the buffer may have been realloced by dyn_string - functions. */ - if (length != NULL) - *length = demangled_name.allocated; - /* The operation was a success. */ - *status = 0; - return dyn_string_buf (&demangled_name); + *status = -3; + return NULL; } - else if (result == STATUS_ALLOCATION_FAILED) - /* A call to malloc or realloc failed during the demangling - operation. */ + + demangled = d_demangle (mangled_name, DMGL_TYPES, &alc); + + if (demangled == NULL) { - *status = -1; + if (alc == 1) + *status = -1; + else + *status = -2; return NULL; } + + if (output_buffer == NULL) + { + if (length != NULL) + *length = alc; + } else - /* The demangling failed for another reason, most probably because - MANGLED_NAME isn't a valid mangled name. */ { - /* If the buffer containing the demangled name wasn't provided - by the caller, free it. */ - if (output_buffer == NULL) - free (dyn_string_buf (&demangled_name)); - *status = -2; - return NULL; + if (strlen (demangled) < *length) + { + strcpy (output_buffer, demangled); + free (demangled); + demangled = output_buffer; + } + else + { + free (output_buffer); + *length = alc; + } } + + *status = 0; + + return demangled; } #else /* ! (IN_LIBGCC2 || IN_GLIBCPP_V3) */ -/* Variant entry point for integration with the existing cplus-dem - demangler. Attempts to demangle MANGLED. If the demangling - succeeds, returns a buffer, allocated with malloc, containing the - demangled name. The caller must deallocate the buffer using free. - If the demangling failes, returns NULL. */ +/* Entry point for libiberty demangler. If MANGLED is a g++ v3 ABI + mangled name, return a buffer allocated with malloc holding the + demangled name. Otherwise, return NULL. */ char * cplus_demangle_v3 (mangled, options) const char* mangled; int options; { - dyn_string_t demangled; - status_t status; - int type = !!(options & DMGL_TYPES); + size_t alc; - if (mangled[0] == '_' && mangled[1] == 'Z') - /* It is not a type. */ - type = 0; - else - { - /* It is a type. Stop if we don't want to demangle types. */ - if (!type) - return NULL; - } - - flag_verbose = !!(options & DMGL_VERBOSE); - - /* Create a dyn_string to hold the demangled name. */ - demangled = dyn_string_new (0); - /* Attempt the demangling. */ - if (!type) - /* Appears to be a function or variable name. */ - status = cp_demangle (mangled, demangled, 0); - else - /* Try to demangle it as the name of a type. */ - status = cp_demangle_type (mangled, demangled); - - if (STATUS_NO_ERROR (status)) - /* Demangling succeeded. */ - { - /* Grab the demangled result from the dyn_string. It was - allocated with malloc, so we can return it directly. */ - char *return_value = dyn_string_release (demangled); - /* Hand back the demangled name. */ - return return_value; - } - else if (status == STATUS_ALLOCATION_FAILED) - { - fprintf (stderr, "Memory allocation failed.\n"); - abort (); - } - else - /* Demangling failed. */ - { - dyn_string_delete (demangled); - return NULL; - } + return d_demangle (mangled, options, &alc); } /* Demangle a Java symbol. Java uses a subset of the V3 ABI C++ mangling @@ -3818,195 +3766,154 @@ char * java_demangle_v3 (mangled) const char* mangled; { - dyn_string_t demangled; - char *next; - char *end; - int len; - status_t status; - int nesting = 0; - char *cplus_demangled; - char *return_value; - - /* Create a dyn_string to hold the demangled name. */ - demangled = dyn_string_new (0); - - /* Attempt the demangling. */ - status = cp_demangle ((char *) mangled, demangled, DMGL_JAVA); - - if (STATUS_NO_ERROR (status)) - /* Demangling succeeded. */ - { - /* Grab the demangled result from the dyn_string. */ - cplus_demangled = dyn_string_release (demangled); - } - else if (status == STATUS_ALLOCATION_FAILED) - { - fprintf (stderr, "Memory allocation failed.\n"); - abort (); - } - else - /* Demangling failed. */ - { - dyn_string_delete (demangled); - return NULL; - } - - len = strlen (cplus_demangled); - next = cplus_demangled; - end = next + len; - demangled = NULL; - - /* Replace occurances of JArray<TYPE> with TYPE[]. */ - while (next < end) + size_t alc; + char *demangled; + int nesting; + char *from; + char *to; + + demangled = d_demangle (mangled, DMGL_JAVA | DMGL_PARAMS, &alc); + + if (demangled == NULL) + return NULL; + + nesting = 0; + from = demangled; + to = from; + while (*from != '\0') { - char *open_str = strstr (next, "JArray<"); - char *close_str = NULL; - if (nesting > 0) - close_str = strchr (next, '>'); - - if (open_str != NULL && (close_str == NULL || close_str > open_str)) - { + if (strncmp (from, "JArray<", 7) == 0) + { + from += 7; ++nesting; - - if (!demangled) - demangled = dyn_string_new(len); - - /* Copy prepending symbols, if any. */ - if (open_str > next) - { - open_str[0] = 0; - dyn_string_append_cstr (demangled, next); - } - next = open_str + 7; } - else if (close_str != NULL) - { + else if (nesting > 0 && *from == '>') + { + while (to > demangled && to[-1] == ' ') + --to; + *to++ = '['; + *to++ = ']'; --nesting; - - /* Copy prepending type symbol, if any. Squash any spurious - whitespace. */ - if (close_str > next && next[0] != ' ') - { - close_str[0] = 0; - dyn_string_append_cstr (demangled, next); - } - dyn_string_append_cstr (demangled, "[]"); - next = close_str + 1; + ++from; } else - { - /* There are no more arrays. Copy the rest of the symbol, or - simply return the original symbol if no changes were made. */ - if (next == cplus_demangled) - return cplus_demangled; - - dyn_string_append_cstr (demangled, next); - next = end; - } + *to++ = *from++; } - free (cplus_demangled); - - if (demangled) - return_value = dyn_string_release (demangled); - else - return_value = NULL; + *to = '\0'; - return return_value; + return demangled; } #endif /* IN_LIBGCC2 || IN_GLIBCPP_V3 */ - #ifndef IN_GLIBCPP_V3 -/* Demangle NAME in the G++ V3 ABI demangling style, and return either - zero, indicating that some error occurred, or a demangling_t - holding the results. */ -static demangling_t -demangle_v3_with_details (name) - const char *name; + +/* Demangle a string in order to find out whether it is a constructor + or destructor. Return non-zero on success. Set *CTOR_KIND and + *DTOR_KIND appropriately. */ + +static int +is_ctor_or_dtor (mangled, ctor_kind, dtor_kind) + const char *mangled; + enum gnu_v3_ctor_kinds *ctor_kind; + enum gnu_v3_dtor_kinds *dtor_kind; { - demangling_t dm; - status_t status; + struct d_info di; + struct d_comp *dc; + int ret; + + *ctor_kind = (enum gnu_v3_ctor_kinds) 0; + *dtor_kind = (enum gnu_v3_dtor_kinds) 0; - if (strncmp (name, "_Z", 2)) + if (! d_init_info (mangled, DMGL_GNU_V3, strlen (mangled), &di)) return 0; - dm = demangling_new (name, DMGL_GNU_V3); - if (dm == NULL) - { - fprintf (stderr, "Memory allocation failed.\n"); - abort (); - } + dc = d_mangled_name (&di, 1); - status = result_push (dm); - if (! STATUS_NO_ERROR (status)) + /* Note that because we did not pass DMGL_PARAMS, we don't expect to + demangle the entire string. */ + + ret = 0; + while (dc != NULL) { - demangling_delete (dm); - fprintf (stderr, "%s\n", status); - abort (); + switch (dc->type) + { + default: + dc = NULL; + break; + case D_COMP_TYPED_NAME: + case D_COMP_TEMPLATE: + case D_COMP_RESTRICT_THIS: + case D_COMP_VOLATILE_THIS: + case D_COMP_CONST_THIS: + dc = d_left (dc); + break; + case D_COMP_QUAL_NAME: + dc = d_right (dc); + break; + case D_COMP_CTOR: + *ctor_kind = dc->u.s_ctor.kind; + ret = 1; + dc = NULL; + break; + case D_COMP_DTOR: + *dtor_kind = dc->u.s_dtor.kind; + ret = 1; + dc = NULL; + break; + } } - status = demangle_mangled_name (dm); - if (STATUS_NO_ERROR (status)) - return dm; + free (di.subs); + free (di.comps); - demangling_delete (dm); - return 0; + return ret; } +/* Return whether NAME is the mangled form of a g++ V3 ABI constructor + name. A non-zero return indicates the type of constructor. */ -/* Return non-zero iff NAME is the mangled form of a constructor name - in the G++ V3 ABI demangling style. Specifically, return: - - '1' if NAME is a complete object constructor, - - '2' if NAME is a base object constructor, or - - '3' if NAME is a complete object allocating constructor. */ enum gnu_v3_ctor_kinds is_gnu_v3_mangled_ctor (name) const char *name; { - demangling_t dm = demangle_v3_with_details (name); + enum gnu_v3_ctor_kinds ctor_kind; + enum gnu_v3_dtor_kinds dtor_kind; - if (dm) - { - enum gnu_v3_ctor_kinds result = dm->is_constructor; - demangling_delete (dm); - return result; - } - else + if (! is_ctor_or_dtor (name, &ctor_kind, &dtor_kind)) return (enum gnu_v3_ctor_kinds) 0; + return ctor_kind; } -/* Return non-zero iff NAME is the mangled form of a destructor name - in the G++ V3 ABI demangling style. Specifically, return: - - '0' if NAME is a deleting destructor, - - '1' if NAME is a complete object destructor, or - - '2' if NAME is a base object destructor. */ +/* Return whether NAME is the mangled form of a g++ V3 ABI destructor + name. A non-zero return indicates the type of destructor. */ + enum gnu_v3_dtor_kinds is_gnu_v3_mangled_dtor (name) const char *name; { - demangling_t dm = demangle_v3_with_details (name); + enum gnu_v3_ctor_kinds ctor_kind; + enum gnu_v3_dtor_kinds dtor_kind; - if (dm) - { - enum gnu_v3_dtor_kinds result = dm->is_destructor; - demangling_delete (dm); - return result; - } - else + if (! is_ctor_or_dtor (name, &ctor_kind, &dtor_kind)) return (enum gnu_v3_dtor_kinds) 0; + return dtor_kind; } -#endif /* IN_GLIBCPP_V3 */ +#endif /* IN_GLIBCPP_V3 */ #ifdef STANDALONE_DEMANGLER #include "getopt.h" +#include "dyn-string.h" -static void print_usage - PARAMS ((FILE* fp, int exit_value)); +static void print_usage PARAMS ((FILE* fp, int exit_value)); + +#define IS_ALPHA(CHAR) \ + (((CHAR) >= 'a' && (CHAR) <= 'z') \ + || ((CHAR) >= 'A' && (CHAR) <= 'Z')) /* Non-zero if CHAR is a character than can occur in a mangled name. */ #define is_mangled_char(CHAR) \ @@ -4026,7 +3933,7 @@ print_usage (fp, exit_value) fprintf (fp, "Usage: %s [options] [names ...]\n", program_name); fprintf (fp, "Options:\n"); fprintf (fp, " -h,--help Display this message.\n"); - fprintf (fp, " -s,--strict Demangle standard names only.\n"); + fprintf (fp, " -p,--no-params Don't display function parameters\n"); fprintf (fp, " -v,--verbose Produce verbose demanglings.\n"); fprintf (fp, "If names are provided, they are demangled. Otherwise filters standard input.\n"); @@ -4036,10 +3943,10 @@ print_usage (fp, exit_value) /* Option specification for getopt_long. */ static const struct option long_options[] = { - { "help", no_argument, NULL, 'h' }, - { "strict", no_argument, NULL, 's' }, - { "verbose", no_argument, NULL, 'v' }, - { NULL, no_argument, NULL, 0 }, + { "help", no_argument, NULL, 'h' }, + { "no-params", no_argument, NULL, 'p' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, no_argument, NULL, 0 }, }; /* Main entry for a demangling filter executable. It will demangle @@ -4052,9 +3959,9 @@ main (argc, argv) int argc; char *argv[]; { - status_t status; int i; int opt_char; + int options = DMGL_PARAMS | DMGL_ANSI | DMGL_TYPES; /* Use the program name of this program, as invoked. */ program_name = argv[0]; @@ -4062,7 +3969,7 @@ main (argc, argv) /* Parse options. */ do { - opt_char = getopt_long (argc, argv, "hsv", long_options, NULL); + opt_char = getopt_long (argc, argv, "hpv", long_options, NULL); switch (opt_char) { case '?': /* Unrecognized option. */ @@ -4073,12 +3980,12 @@ main (argc, argv) print_usage (stdout, 0); break; - case 's': - flag_strict = 1; + case 'p': + options &= ~ DMGL_PARAMS; break; case 'v': - flag_verbose = 1; + options |= DMGL_VERBOSE; break; } } @@ -4088,41 +3995,12 @@ main (argc, argv) /* No command line arguments were provided. Filter stdin. */ { dyn_string_t mangled = dyn_string_new (3); - dyn_string_t demangled = dyn_string_new (0); - status_t status; + char *s; /* Read all of input. */ while (!feof (stdin)) { - char c = getchar (); - - /* The first character of a mangled name is an underscore. */ - if (feof (stdin)) - break; - if (c != '_') - { - /* It's not a mangled name. Print the character and go - on. */ - putchar (c); - continue; - } - c = getchar (); - - /* The second character of a mangled name is a capital `Z'. */ - if (feof (stdin)) - break; - if (c != 'Z') - { - /* It's not a mangled name. Print the previous - underscore, the `Z', and go on. */ - putchar ('_'); - putchar (c); - continue; - } - - /* Start keeping track of the candidate mangled name. */ - dyn_string_append_char (mangled, '_'); - dyn_string_append_char (mangled, 'Z'); + char c; /* Pile characters into mangled until we hit one that can't occur in a mangled name. */ @@ -4135,62 +4013,53 @@ main (argc, argv) c = getchar (); } - /* Attempt to demangle the name. */ - status = cp_demangle (dyn_string_buf (mangled), demangled, 0); - - /* If the demangling succeeded, great! Print out the - demangled version. */ - if (STATUS_NO_ERROR (status)) - fputs (dyn_string_buf (demangled), stdout); - /* Abort on allocation failures. */ - else if (status == STATUS_ALLOCATION_FAILED) + if (dyn_string_length (mangled) > 0) { - fprintf (stderr, "Memory allocation failed.\n"); - abort (); + s = cplus_demangle_v3 (dyn_string_buf (mangled), options); + + if (s != NULL) + { + fputs (s, stdout); + free (s); + } + else + { + /* It might not have been a mangled name. Print the + original text. */ + fputs (dyn_string_buf (mangled), stdout); + } + + dyn_string_clear (mangled); } - /* Otherwise, it might not have been a mangled name. Just - print out the original text. */ - else - fputs (dyn_string_buf (mangled), stdout); /* If we haven't hit EOF yet, we've read one character that can't occur in a mangled name, so print it out. */ if (!feof (stdin)) putchar (c); - - /* Clear the candidate mangled name, to start afresh next - time we hit a `_Z'. */ - dyn_string_clear (mangled); } dyn_string_delete (mangled); - dyn_string_delete (demangled); } else /* Demangle command line arguments. */ { - dyn_string_t result = dyn_string_new (0); - /* Loop over command line arguments. */ for (i = optind; i < argc; ++i) { + char *s; + /* Attempt to demangle. */ - status = cp_demangle (argv[i], result, 0); + s = cplus_demangle_v3 (argv[i], options); /* If it worked, print the demangled name. */ - if (STATUS_NO_ERROR (status)) - printf ("%s\n", dyn_string_buf (result)); - /* Abort on allocaiton failures. */ - else if (status == STATUS_ALLOCATION_FAILED) + if (s != NULL) { - fprintf (stderr, "Memory allocation failed.\n"); - abort (); + printf ("%s\n", s); + free (s); } - /* If not, print the error message to stderr instead. */ - else - fprintf (stderr, "%s\n", status); + else + fprintf (stderr, "Failed: %s\n", argv[i]); } - dyn_string_delete (result); } return 0; diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c index daac661..a0f6535 100644 --- a/libiberty/floatformat.c +++ b/libiberty/floatformat.c @@ -17,16 +17,33 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* This is needed to pick up the NAN macro on some systems. */ +#define _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <math.h> + +#ifdef HAVE_STRING_H +#include <string.h> +#endif + #include "ansidecl.h" +#include "libiberty.h" #include "floatformat.h" -#include <math.h> /* ldexp */ -#ifdef ANSI_PROTOTYPES -#include <stddef.h> -extern void *memcpy (void *s1, const void *s2, size_t n); -extern void *memset (void *s, int c, size_t n); + +#ifndef INFINITY +#ifdef HUGE_VAL +#define INFINITY HUGE_VAL #else -extern char *memcpy (); -extern char *memset (); +#define INFINITY (1.0 / 0.0) +#endif +#endif + +#ifndef NAN +#define NAN (0.0 / 0.0) #endif static unsigned long get_field PARAMS ((const unsigned char *, @@ -271,9 +288,45 @@ floatformat_to_double (fmt, from, to) exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->exp_start, fmt->exp_len); - /* Note that if exponent indicates a NaN, we can't really do anything useful - (not knowing if the host has NaN's, or how to build one). So it will - end up as an infinity or something close; that is OK. */ + + /* If the exponent indicates a NaN, we don't have information to + decide what to do. So we handle it like IEEE, except that we + don't try to preserve the type of NaN. FIXME. */ + if ((unsigned long) exponent == fmt->exp_nan) + { + int nan; + + mant_off = fmt->man_start; + mant_bits_left = fmt->man_len; + nan = 0; + while (mant_bits_left > 0) + { + mant_bits = min (mant_bits_left, 32); + + if (get_field (ufrom, fmt->byteorder, fmt->totalsize, + mant_off, mant_bits) != 0) + { + /* This is a NaN. */ + nan = 1; + break; + } + + mant_off += mant_bits; + mant_bits_left -= mant_bits; + } + + if (nan) + dto = NAN; + else + dto = INFINITY; + + if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1)) + dto = -dto; + + *to = dto; + + return; + } mant_bits_left = fmt->man_len; mant_off = fmt->man_start; @@ -306,8 +359,18 @@ floatformat_to_double (fmt, from, to) mant = get_field (ufrom, fmt->byteorder, fmt->totalsize, mant_off, mant_bits); - dto += ldexp ((double)mant, exponent - mant_bits); - exponent -= mant_bits; + /* Handle denormalized numbers. FIXME: What should we do for + non-IEEE formats? */ + if (exponent == 0 && mant != 0) + dto += ldexp ((double)mant, + (- fmt->exp_bias + - mant_bits + - (mant_off - fmt->man_start) + + 1)); + else + dto += ldexp ((double)mant, exponent - mant_bits); + if (exponent != 0) + exponent -= mant_bits; mant_off += mant_bits; mant_bits_left -= mant_bits; } @@ -392,33 +455,54 @@ floatformat_from_double (fmt, from, to) int mant_bits_left; unsigned char *uto = (unsigned char *)to; - memcpy (&dfrom, from, sizeof (dfrom)); + dfrom = *from; memset (uto, 0, fmt->totalsize / FLOATFORMAT_CHAR_BIT); + + /* If negative, set the sign bit. */ + if (dfrom < 0) + { + put_field (uto, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1, 1); + dfrom = -dfrom; + } + if (dfrom == 0) - return; /* Result is zero */ + { + /* 0.0. */ + return; + } + if (dfrom != dfrom) { - /* From is NaN */ + /* NaN. */ put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, fmt->exp_len, fmt->exp_nan); - /* Be sure it's not infinity, but NaN value is irrel */ + /* Be sure it's not infinity, but NaN value is irrelevant. */ put_field (uto, fmt->byteorder, fmt->totalsize, fmt->man_start, 32, 1); return; } - /* If negative, set the sign bit. */ - if (dfrom < 0) + if (dfrom + dfrom == dfrom) { - put_field (uto, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1, 1); - dfrom = -dfrom; + /* This can only happen for an infinite value (or zero, which we + already handled above). */ + put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, + fmt->exp_len, fmt->exp_nan); + return; } - /* How to tell an infinity from an ordinary number? FIXME-someday */ - mant = frexp (dfrom, &exponent); - put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, fmt->exp_len, - exponent + fmt->exp_bias - 1); + if (exponent + fmt->exp_bias - 1 > 0) + put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, + fmt->exp_len, exponent + fmt->exp_bias - 1); + else + { + /* Handle a denormalized number. FIXME: What should we do for + non-IEEE formats? */ + put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, + fmt->exp_len, 0); + mant = ldexp (mant, exponent + fmt->exp_bias - 1); + } mant_bits_left = fmt->man_len; mant_off = fmt->man_start; @@ -431,12 +515,11 @@ floatformat_from_double (fmt, from, to) mant_long = (unsigned long)mant; mant -= mant_long; - /* If the integer bit is implicit, then we need to discard it. - If we are discarding a zero, we should be (but are not) creating - a denormalized number which means adjusting the exponent - (I think). */ + /* If the integer bit is implicit, and we are not creating a + denormalized number, then we need to discard it. */ if ((unsigned int) mant_bits_left == fmt->man_len - && fmt->intbit == floatformat_intbit_no) + && fmt->intbit == floatformat_intbit_no + && exponent + fmt->exp_bias - 1 > 0) { mant_long &= 0x7fffffff; mant_bits -= 1; @@ -468,6 +551,8 @@ floatformat_is_valid (fmt, from) #ifdef IEEE_DEBUG +#include <stdio.h> + /* This is to be run on a host which uses IEEE floating point. */ void @@ -475,19 +560,31 @@ ieee_test (n) double n; { double result; - char exten[16]; - floatformat_to_double (&floatformat_ieee_double_big, &n, &result); - if (n != result) + floatformat_to_double (&floatformat_ieee_double_little, (char *) &n, + &result); + if ((n != result && (! isnan (n) || ! isnan (result))) + || (n < 0 && result >= 0) + || (n >= 0 && result < 0)) printf ("Differ(to): %.20g -> %.20g\n", n, result); - floatformat_from_double (&floatformat_ieee_double_big, &n, &result); - if (n != result) + + floatformat_from_double (&floatformat_ieee_double_little, &n, + (char *) &result); + if ((n != result && (! isnan (n) || ! isnan (result))) + || (n < 0 && result >= 0) + || (n >= 0 && result < 0)) printf ("Differ(from): %.20g -> %.20g\n", n, result); - floatformat_from_double (&floatformat_m68881_ext, &n, exten); - floatformat_to_double (&floatformat_m68881_ext, exten, &result); - if (n != result) - printf ("Differ(to+from): %.20g -> %.20g\n", n, result); +#if 0 + { + char exten[16]; + + floatformat_from_double (&floatformat_m68881_ext, &n, exten); + floatformat_to_double (&floatformat_m68881_ext, exten, &result); + if (n != result) + printf ("Differ(to+from): %.20g -> %.20g\n", n, result); + } +#endif #if IEEE_DEBUG > 1 /* This is to be run on a host which uses 68881 format. */ @@ -502,12 +599,22 @@ ieee_test (n) int main () { + ieee_test (0.0); ieee_test (0.5); ieee_test (256.0); ieee_test (0.12345); ieee_test (234235.78907234); ieee_test (-512.0); ieee_test (-0.004321); + ieee_test (1.2E-70); + ieee_test (1.2E-316); + ieee_test (4.9406564584124654E-324); + ieee_test (- 4.9406564584124654E-324); + ieee_test (- 0.0); + ieee_test (- INFINITY); + ieee_test (- NAN); + ieee_test (INFINITY); + ieee_test (NAN); return 0; } #endif diff --git a/libiberty/testsuite/Makefile.in b/libiberty/testsuite/Makefile.in index 515dcd5..6f2a4fe 100644 --- a/libiberty/testsuite/Makefile.in +++ b/libiberty/testsuite/Makefile.in @@ -49,7 +49,7 @@ check-cplus-dem: test-demangle $(srcdir)/demangle-expected ./test-demangle < $(srcdir)/demangle-expected TEST_COMPILE = $(CC) @DEFS@ $(LIBCFLAGS) -I.. -I$(INCDIR) $(HDEFINES) -test-demangle: $(srcdir)/test-demangle.c +test-demangle: $(srcdir)/test-demangle.c ../libiberty.a $(TEST_COMPILE) -o test-demangle \ $(srcdir)/test-demangle.c ../libiberty.a diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 8dfab8e..b39e2f4 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -2629,7 +2629,7 @@ operator<<(X const&, X const&) # --format=gnu-v3 _ZN3FooIA4_iE3barE -Foo<int[4]>::bar +Foo<int [4]>::bar # --format=gnu-v3 _Z1fIiEvi @@ -2697,7 +2697,7 @@ typeinfo for a_class # --format=gnu-v3 U4_farrVKPi -int* restrict volatile const _far +int* const volatile restrict _far # --format=gnu-v3 _Z3fooILi2EEvRAplT_Li1E_i @@ -2749,11 +2749,11 @@ f(int (* const)(int)) # --format=gnu-v3 _Z1fAszL_ZZNK1N1A1fEvE3foo_0E_i -f(int[sizeof(N::A::f() const::foo)]) +f(int [sizeof (N::A::f() const::foo)]) # --format=gnu-v3 _Z1fA37_iPS_ -f(int[37], int (*) [37]) +f(int [37], int (*) [37]) # --format=gnu-v3 _Z1fM1AFivEPS0_ @@ -2777,7 +2777,7 @@ s(int (*) [37], int (**) [37]) # --format=gnu-v3 _Z3fooA30_A_i -foo(int[30][]) +foo(int [30][]) # --format=gnu-v3 _Z3kooPA28_A30_i @@ -2858,12 +2858,80 @@ global constructors keyed to _Z2fnv --format=gnu-v3 _Z1rM1GFivEMS_KFivES_M1HFivES1_4whatIKS_E5what2IS8_ES3_ r(int (G::*)(), int (G::*)() const, G, int (H::*)(), int (G::*)(), what<G const>, what2<G const>, int (G::*)() const) -# +# +# This is from the gdb testsuite gdb.cp/cplusfuncs.exp. +--format=gnu-v3 +_Z10hairyfunc5PFPFilEPcE +hairyfunc5(int (*(*)(char*))(long)) +# +# This is from gcc PR 8861 +--format=gnu-v3 +_Z1fILi1ELc120EEv1AIXplT_cviLd810000000000000000703DAD7A370C5EEE +void f<1, 120>(A<(1) + (((int)((double)810000000000000000703DAD7A370C5)))>) +# +# This is also from gcc PR 8861 +--format=gnu-v3 +_Z1fILi1EEv1AIXplT_cvingLf3f800000EEE +void f<1>(A<(1) + (((int)(-((float)3f800000))))>) +# +# This is from a libstdc++ debug mode patch. +--format=gnu-v3 +_ZNK11__gnu_debug16_Error_formatter14_M_format_wordImEEvPciPKcT_ +void __gnu_debug::_Error_formatter::_M_format_word<unsigned long>(char*, int, char const*, unsigned long) const +# +# The new demangler used to core dump on this. +--format=gnu-v3 +_ZSt18uninitialized_copyIN9__gnu_cxx17__normal_iteratorIPSt4pairISsPFbP6sqlitePPcEESt6vectorIS9_SaIS9_EEEESE_ET0_T_SG_SF_ +__gnu_cxx::__normal_iterator<std::pair<std::string, bool (*)(sqlite*, char**)>*, std::vector<std::pair<std::string, bool (*)(sqlite*, char**)>, std::allocator<std::pair<std::string, bool (*)(sqlite*, char**)> > > > std::uninitialized_copy<__gnu_cxx::__normal_iterator<std::pair<std::string, bool (*)(sqlite*, char**)>*, std::vector<std::pair<std::string, bool (*)(sqlite*, char**)>, std::allocator<std::pair<std::string, bool (*)(sqlite*, char**)> > > >, __gnu_cxx::__normal_iterator<std::pair<std::string, bool (*)(sqlite*, char**)>*, std::vector<std::pair<std::string, bool (*)(sqlite*, char**)>, std::allocator<std::pair<std::string, bool (*)(sqlite*, char**)> > > > >(__gnu_cxx::__normal_iterator<std::pair<std::string, bool (*)(sqlite*, char**)>*, std::vector<std::pair<std::string, bool (*)(sqlite*, char**)>, std::allocator<std::pair<std::string, bool (*)(sqlite*, char**)> > > >, __gnu_cxx::__normal_iterator<std::pair<std::string, bool (*)(sqlite*, char**)>*, std::vector<std::pair<std::string, bool (*)(sqlite*, char**)>, std::allocator<std::pair<std::string, bool (*)(sqlite*, char**)> > > >, __gnu_cxx::__normal_iterator<std::pair<std::string, bool (*)(sqlite*, char**)>*, std::vector<std::pair<std::string, bool (*)(sqlite*, char**)>, std::allocator<std::pair<std::string, bool (*)(sqlite*, char**)> > > >) +# +# The new demangler used to fail on this. +--format=gnu-v3 +_Z1fP1cIPFiiEE +f(c<int (*)(int)>*) +# +# Wrap expressions using '>' in an extra layer of parens to avoid +# confusion with the '>' which ends the template parameters. +--format=gnu-v3 +_Z4dep9ILi3EEvP3fooIXgtT_Li2EEE +void dep9<3>(foo<((3) > (2))>*) +# +# Watch out for templated version of `operator<'--it needs an extra +# space. +--format=gnu-v3 +_ZStltI9file_pathSsEbRKSt4pairIT_T0_ES6_ +bool std::operator< <file_path, std::string>(std::pair<file_path, std::string> const&, std::pair<file_path, std::string> const&) +# +# More hairy qualifier handling. +--format=gnu-v3 +_Z9hairyfuncM1YKFPVPFrPA2_PM1XKFKPA3_ilEPcEiE +hairyfunc(int (* const (X::** (* restrict (* volatile*(Y::*)(int) const)(char*)) [2])(long) const) [3]) +# +# Check that negative numbers are handled correctly. +--format=gnu-v3 +_Z1fILin1EEvv +void f<-1>() +# +# Check a destructor of a standard substitution. +--format=gnu-v3 +_ZNSdD0Ev +std::basic_iostream<char, std::char_traits<char> >::~basic_iostream() +# # This caused an infinite loop. -# We still don't demangle this correctly, but at least we don't hang. +# +# This is generated by an EDG compiler (kcc 4.0). To demangle it +# correctly, I believe that we have to understand that the J37J deep +# in the string somehow refers back to the type starting 37 characters +# in from some starting point, so that it winds up being the type +# starting with 41THandle.... However, lacking a spec for EDG +# demangling, it's hard to implement this. +# +# In the meantime, this symbol can be successfully demangled in GNU +# mode. Of course the result is more or less nonsense, but an older +# version of g++ would indeed generate this mangled name given the +# appropriate input, so the demangling is correct. --format=auto __CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm__7_Z1ZZ2Z8iterator -__CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm__7_Z1ZZ2Z8iterator +_Z1ZZ2Z::__CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm(iterator) # # This used to cause a crash. It doesn't follow the C++ encoding so # the demangled name should be identical to the original symbol name. diff --git a/libiberty/testsuite/test-demangle.c b/libiberty/testsuite/test-demangle.c index 6e5d0b4..ed28229 100644 --- a/libiberty/testsuite/test-demangle.c +++ b/libiberty/testsuite/test-demangle.c @@ -146,7 +146,7 @@ main(argc, argv) cplus_demangle_set_style (style); result = cplus_demangle (input.data, - DMGL_PARAMS|DMGL_ANSI|DMGL_VERBOSE|DMGL_TYPES); + DMGL_PARAMS|DMGL_ANSI|DMGL_TYPES); if (result ? strcmp (result, expect.data) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 2f613cb..7bf5b45 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,93 @@ +2003-12-15 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + * m32r-opc.c: Regenerate. + +2003-12-14 Mark Mitchell <mark@codesourcery.com> + + * arm-opc.h (arm_opcodes): Put V6 instructions before XScale + instructions. + +2003-12-13 Hans-Peter Nilsson <hp@bitrange.com> + + * mmix-opc.c (mmix_opcodes): Use GO_INSN_BYTE, PUSHGO_INSN_BYTE, + SETL_INSN_BYTE, INCH_INSN_BYTE, INCMH_INSN_BYTE, INCML_INSN_BYTE + and SWYM_INSN_BYTE instead of raw numbers. + +2003-12-10 Zack Weinberg <zack@codesourcery.com> + + * ppc-opc.c (MO): Make optional. + (RAO, RSO, SHO): New optional forms of RA, RS, SH operands. + (tlbwe): Accept for both PPC403 and BOOKE. Make all operands optional. + +2003-12-05 Ricardo Anguiano <anguiano@codesourcery.com> + Mark Mitchell <mark@codesourcery.com> + Richard Earnshaw <rearnsha@arm.com> + + * arm-dis.c (print_arm_insn): Add 'W' macro. + * arm-opc.h (arm_opcodes): Add V6 instructions. + (thumb_opcodes): Likewise. + +2003-12-04 Alan Modra <amodra@bigpond.net.au> + + * openrisc-asm.c: Regenerate. + * pj-opc.c: Update copyright date. + +2003-12-03 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + * m32r-asm.c: Regenerate. + * m32r-desc.c: Regenerate. + * m32r-desc.h: Regenerate. + * m32r-dis.c: Regenerate. + * m32r-ibld.c: Regenerate. + * m32r-opc.c: Regenerate. + * m32r-opc.h: Regenerate. + * m32r-opinst.c: Regenerate. + +2003-12-02 Alexandre Oliva <aoliva@redhat.com> + + * sh-opc.h: Add support for sh4a and no-fpu variants. + * sh-dis.c: Ditto. + +2003-12-02 Kazu Hirata <kazu@cs.umass.edu> + + * alpha-opc.c: Remove ARGSUSED. + * i370-opc.c: Likewise. + * ppc-opc.c: Likewise. + +2003-12-02 Alan Modra <amodra@bigpond.net.au> + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + +2003-11-28 Christian Groessler <chris@groessler.org> + + * z8k-dis.c: Convert to ISO C90. + * z8kgen.c: Convert to ISO C90. + (opt): Move long opcode for "ldb rdb,imm8" after short one, now + the short one is created when assembling. + * z8k-opc.h: Regenerate with new z8kgen.c. + +2003-11-19 Kazu Hirata <kazu@cs.umass.edu> + + * h8300-dis.c (print_colon_thingie): Remove. + +2003-11-18 Maciej W. Rozycki <macro@ds2.pg.gda.pl> + + * mips-opc.c (mips_builtin_opcodes): Handle new macros: "lca" and + "dlca". + +2003-11-14 Nick Clifton <nickc@redhat.com> + + * dis-init.c (init_disassemble_info): Initialise + symbol_is_valid field. + * dis-buf.c (generic_symbol_is_valid): New function. Always + returns TRUE. + * arm-dis.c (arm_symbol_is_valid): New function. Return FALSE + for ARM ELF mapping symbols. + * disassemble.c (disassemble_init_for_target): Set + symbol_is_valid field to arm_symbol_is_valid of the target is + an ARM. + 2003-11-05 H.J. Lu <hongjiu.lu@intel.com> * m68k-opc.c (m68k_opcodes): Reorder "fmovel". @@ -15,7 +105,7 @@ * m68hc11-dis.c: Convert to ISO C90 prototypes. 2003-10-21 Peter Barada <pbarada@mail.wm.sps.mot.com> - Bernardo Innocenti <bernie@develer.com> + Bernardo Innocenti <bernie@develer.com> * m68k-dis.c: Add MCFv4/MCF5528x support. * m68k-opc.c: Likewise. @@ -75,7 +165,7 @@ * v850-dis.c (disassemble): Accept bfd_mach_v850e1. * v850-opc.c (v850_opcodes): Add DBTRAP and DBRET instructions. - + 2003-09-04 Alan Modra <amodra@bigpond.net.au> * ppc-dis.c (struct dis_private): New. diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am index 6859a9d..e227b1f 100644 --- a/opcodes/Makefile.am +++ b/opcodes/Makefile.am @@ -558,7 +558,7 @@ dlx-dis.lo: dlx-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ dis-buf.lo: dis-buf.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h opintl.h dis-init.lo: dis-init.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h opintl.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h disassemble.lo: disassemble.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h fr30-asm.lo: fr30-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in index 57aee2d..de427ea 100644 --- a/opcodes/Makefile.in +++ b/opcodes/Makefile.in @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p6 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. @@ -468,7 +468,7 @@ acinclude.m4 aclocal.m4 config.in configure configure.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = libopcodes.a.c $(libopcodes_la_SOURCES) OBJECTS = libopcodes.a.$(OBJEXT) $(libopcodes_la_OBJECTS) @@ -617,7 +617,7 @@ maintainer-clean-recursive: 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//`; \ @@ -1054,7 +1054,7 @@ dlx-dis.lo: dlx-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ dis-buf.lo: dis-buf.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h opintl.h dis-init.lo: dis-init.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h opintl.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h disassemble.lo: disassemble.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h fr30-asm.lo: fr30-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ diff --git a/opcodes/alpha-opc.c b/opcodes/alpha-opc.c index 7cac7f8..5371597 100644 --- a/opcodes/alpha-opc.c +++ b/opcodes/alpha-opc.c @@ -214,7 +214,6 @@ const unsigned alpha_num_operands = sizeof(alpha_operands)/sizeof(*alpha_operand the RA field into the RB field, and the extraction function just checks that the fields are the same. */ -/*ARGSUSED*/ static unsigned insert_rba(insn, value, errmsg) unsigned insn; @@ -238,7 +237,6 @@ extract_rba(insn, invalid) /* The same for the RC field */ -/*ARGSUSED*/ static unsigned insert_rca(insn, value, errmsg) unsigned insn; @@ -262,7 +260,6 @@ extract_rca(insn, invalid) /* Fake arguments in which the registers must be set to ZERO */ -/*ARGSUSED*/ static unsigned insert_za(insn, value, errmsg) unsigned insn; @@ -282,7 +279,6 @@ extract_za(insn, invalid) return 0; } -/*ARGSUSED*/ static unsigned insert_zb(insn, value, errmsg) unsigned insn; @@ -302,7 +298,6 @@ extract_zb(insn, invalid) return 0; } -/*ARGSUSED*/ static unsigned insert_zc(insn, value, errmsg) unsigned insn; @@ -336,7 +331,6 @@ insert_bdisp(insn, value, errmsg) return insn | ((value / 4) & 0x1FFFFF); } -/*ARGSUSED*/ static int extract_bdisp(insn, invalid) unsigned insn; @@ -359,7 +353,6 @@ insert_jhint(insn, value, errmsg) return insn | ((value / 4) & 0x3FFF); } -/*ARGSUSED*/ static int extract_jhint(insn, invalid) unsigned insn; @@ -381,7 +374,6 @@ insert_ev6hwjhint(insn, value, errmsg) return insn | ((value / 4) & 0x1FFF); } -/*ARGSUSED*/ static int extract_ev6hwjhint(insn, invalid) unsigned insn; diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c index 5f8fc4c..e918daf 100644 --- a/opcodes/arm-dis.c +++ b/opcodes/arm-dis.c @@ -639,6 +639,16 @@ print_insn_arm (pc, info, given) func (stream, "%d", reg); } break; + case 'W': + { + long reg; + + reg = given >> bitstart; + reg &= (2 << (bitend - bitstart)) - 1; + + func (stream, "%d", reg + 1); + } + break; case 'x': { long reg; @@ -1145,6 +1155,23 @@ print_insn_thumb (pc, info, given) abort (); } +/* Disallow mapping symbols ($a, $b, $d, $t etc) from + being displayed in symbol relative addresses. */ + +bfd_boolean +arm_symbol_is_valid (asymbol * sym, + struct disassemble_info * info ATTRIBUTE_UNUSED) +{ + const char * name; + + if (sym == NULL) + return FALSE; + + name = bfd_asymbol_name (sym); + + return (name && *name != '$'); +} + /* Parse an individual disassembler option. */ void diff --git a/opcodes/arm-opc.h b/opcodes/arm-opc.h index 22313cb..cc59b8f 100644 --- a/opcodes/arm-opc.h +++ b/opcodes/arm-opc.h @@ -35,6 +35,7 @@ struct thumb_opcode %<bitfield>d print the bitfield in decimal %<bitfield>x print the bitfield in hex %<bitfield>X print the bitfield as 1 hex digit without leading "0x" + %<bitfield>w print the bitfield plus one in decimal %<bitfield>r print as an ARM register %<bitfield>f print a floating point constant if >7 else a floating point register @@ -97,6 +98,132 @@ static const struct arm_opcode arm_opcodes[] = {0x00800090, 0x0fa000f0, "%22?sumull%c%20's\t%12-15r, %16-19r, %0-3r, %8-11r"}, {0x00a00090, 0x0fa000f0, "%22?sumlal%c%20's\t%12-15r, %16-19r, %0-3r, %8-11r"}, + /* ARM V6 instructions. */ + {0xfc500000, 0xfff00000, "mrrc2\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"}, + {0xfc400000, 0xfff00000, "mcrr2\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"}, + {0xf1080000, 0xfffdfe3f, "cpsie\t%8'a%7'i%6'f"}, + {0xf1080000, 0xfffdfe20, "cpsie\t%8'a%7'i%6'f,#%0-4d"}, + {0xf10C0000, 0xfffdfe3f, "cpsid\t%8'a%7'i%6'f"}, + {0xf10C0000, 0xfffdfe20, "cpsid\t%8'a%7'i%6'f,#%0-4d"}, + {0xf1000000, 0xfff1fe20, "cps\t#%0-4d"}, + {0x06800010, 0x0ff00ff0, "pkhbt%c\t%12-15r, %16-19r, %0-3r"}, + {0x06800010, 0x0ff00070, "pkhbt%c\t%12-15r, %16-19r, %0-3r, LSL #%7-11d"}, + {0x06800050, 0x0ff00ff0, "pkhtb%c\t%12-15r, %16-19r, %0-3r, ASR #32"}, + {0x06800050, 0x0ff00070, "pkhtb%c\t%12-15r, %16-19r, %0-3r, ASR #%7-11d"}, + {0x01900f9f, 0x0ff00fff, "ldrex%c\tr%12-15d, [%16-19r]"}, + {0x06200f10, 0x0ff00ff0, "qadd16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06200f90, 0x0ff00ff0, "qadd8%c\t%12-15r, %16-19r, %0-3r"}, + {0x06200f30, 0x0ff00ff0, "qaddsubx%c\t%12-15r, %16-19r, %0-3r"}, + {0x06200f70, 0x0ff00ff0, "qsub16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06200ff0, 0x0ff00ff0, "qsub8%c\t%12-15r, %16-19r, %0-3r"}, + {0x06200f50, 0x0ff00ff0, "qsubaddx%c\t%12-15r, %16-19r, %0-3r"}, + {0x06100f10, 0x0ff00ff0, "sadd16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06100f90, 0x0ff00ff0, "sadd8%c\t%12-15r, %16-19r, %0-3r"}, + {0x06100f30, 0x0ff00ff0, "saddaddx%c\t%12-15r, %16-19r, %0-3r"}, + {0x06300f10, 0x0ff00ff0, "shadd16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06300f90, 0x0ff00ff0, "shadd8%c\t%12-15r, %16-19r, %0-3r"}, + {0x06300f30, 0x0ff00ff0, "shaddsubx%c\t%12-15r, %16-19r, %0-3r"}, + {0x06300f70, 0x0ff00ff0, "shsub16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06300ff0, 0x0ff00ff0, "shsub8%c\t%12-15r, %16-19r, %0-3r"}, + {0x06300f50, 0x0ff00ff0, "shsubaddx%c\t%12-15r, %16-19r, %0-3r"}, + {0x06100f70, 0x0ff00ff0, "ssub16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06100ff0, 0x0ff00ff0, "ssub8%c\t%12-15r, %16-19r, %0-3r"}, + {0x06100f50, 0x0ff00ff0, "ssubaddx%c\t%12-15r, %16-19r, %0-3r"}, + {0x06500f10, 0x0ff00ff0, "uadd16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06500f90, 0x0ff00ff0, "uadd8%c\t%12-15r, %16-19r, %0-3r"}, + {0x06500f30, 0x0ff00ff0, "uaddsubx%c\t%12-15r, %16-19r, %0-3r"}, + {0x06700f10, 0x0ff00ff0, "uhadd16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06700f90, 0x0ff00ff0, "uhadd8%c\t%12-15r, %16-19r, %0-3r"}, + {0x06700f30, 0x0ff00ff0, "uhaddsubx%c\t%12-15r, %16-19r, %0-3r"}, + {0x06700f70, 0x0ff00ff0, "uhsub16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06700ff0, 0x0ff00ff0, "uhsub8%c\t%12-15r, %16-19r, %0-3r"}, + {0x06700f50, 0x0ff00ff0, "uhsubaddx%c\t%12-15r, %16-19r, %0-3r"}, + {0x06600f10, 0x0ff00ff0, "uqadd16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06600f90, 0x0ff00ff0, "uqadd8%c\t%12-15r, %16-19r, %0-3r"}, + {0x06600f30, 0x0ff00ff0, "uqaddsubx%c\t%12-15r, %16-19r, %0-3r"}, + {0x06600f70, 0x0ff00ff0, "uqsub16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06600ff0, 0x0ff00ff0, "uqsub8%c\t%12-15r, %16-19r, %0-3r"}, + {0x06600f50, 0x0ff00ff0, "uqsubaddx%c\t%12-15r, %16-19r, %0-3r"}, + {0x06500f70, 0x0ff00ff0, "usub16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06500ff0, 0x0ff00ff0, "usub8%c\t%12-15r, %16-19r, %0-3r"}, + {0x06500f50, 0x0ff00ff0, "usubaddx%c\t%12-15r, %16-19r, %0-3r"}, + {0x06bf0f30, 0x0fff0ff0, "rev%c\t\%12-15r, %0-3r"}, + {0x06bf0fb0, 0x0fff0ff0, "rev16%c\t\%12-15r, %0-3r"}, + {0x06ff0fb0, 0x0fff0ff0, "revsh%c\t\%12-15r, %0-3r"}, + {0xf8100a00, 0xfe50ffff, "rfe%23?id%24?ba\t\%16-19r%21'!"}, + {0x06bf0070, 0x0fff0ff0, "sxth%c %12-15r,%0-3r"}, + {0x06bf0470, 0x0fff0ff0, "sxth%c %12-15r,%0-3r, ROR #8"}, + {0x06bf0870, 0x0fff0ff0, "sxth%c %12-15r,%0-3r, ROR #16"}, + {0x06bf0c70, 0x0fff0ff0, "sxth%c %12-15r,%0-3r, ROR #24"}, + {0x068f0070, 0x0fff0ff0, "sxtb16%c %12-15r,%0-3r"}, + {0x068f0470, 0x0fff0ff0, "sxtb16%c %12-15r,%0-3r, ROR #8"}, + {0x068f0870, 0x0fff0ff0, "sxtb16%c %12-15r,%0-3r, ROR #16"}, + {0x068f0c70, 0x0fff0ff0, "sxtb16%c %12-15r,%0-3r, ROR #24"}, + {0x06af0070, 0x0fff0ff0, "sxtb%c %12-15r,%0-3r"}, + {0x06af0470, 0x0fff0ff0, "sxtb%c %12-15r,%0-3r, ROR #8"}, + {0x06af0870, 0x0fff0ff0, "sxtb%c %12-15r,%0-3r, ROR #16"}, + {0x06af0c70, 0x0fff0ff0, "sxtb%c %12-15r,%0-3r, ROR #24"}, + {0x06ff0070, 0x0fff0ff0, "uxth%c %12-15r,%0-3r"}, + {0x06ff0470, 0x0fff0ff0, "uxth%c %12-15r,%0-3r, ROR #8"}, + {0x06ff0870, 0x0fff0ff0, "uxth%c %12-15r,%0-3r, ROR #16"}, + {0x06ff0c70, 0x0fff0ff0, "uxth%c %12-15r,%0-3r, ROR #24"}, + {0x06cf0070, 0x0fff0ff0, "uxtb16%c %12-15r,%0-3r"}, + {0x06cf0470, 0x0fff0ff0, "uxtb16%c %12-15r,%0-3r, ROR #8"}, + {0x06cf0870, 0x0fff0ff0, "uxtb16%c %12-15r,%0-3r, ROR #16"}, + {0x06cf0c70, 0x0fff0ff0, "uxtb16%c %12-15r,%0-3r, ROR #24"}, + {0x06ef0070, 0x0fff0ff0, "uxtb%c %12-15r,%0-3r"}, + {0x06ef0470, 0x0fff0ff0, "uxtb%c %12-15r,%0-3r, ROR #8"}, + {0x06ef0870, 0x0fff0ff0, "uxtb%c %12-15r,%0-3r, ROR #16"}, + {0x06ef0c70, 0x0fff0ff0, "uxtb%c %12-15r,%0-3r, ROR #24"}, + {0x06b00070, 0x0ff00ff0, "sxtah%c\t%12-15r, %16-19r, %0-3r"}, + {0x06b00470, 0x0ff00ff0, "sxtah%c\t%12-15r, %16-19r, %0-3r, ROR #8"}, + {0x06b00870, 0x0ff00ff0, "sxtah%c\t%12-15r, %16-19r, %0-3r, ROR #16"}, + {0x06b00c70, 0x0ff00ff0, "sxtah%c\t%12-15r, %16-19r, %0-3r, ROR #24"}, + {0x06800070, 0x0ff00ff0, "sxtab16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06800470, 0x0ff00ff0, "sxtab16%c\t%12-15r, %16-19r, %0-3r, ROR #8"}, + {0x06800870, 0x0ff00ff0, "sxtab16%c\t%12-15r, %16-19r, %0-3r, ROR #16"}, + {0x06800c70, 0x0ff00ff0, "sxtab16%c\t%12-15r, %16-19r, %0-3r, ROR #24"}, + {0x06a00070, 0x0ff00ff0, "sxtab%c\t%12-15r, %16-19r, %0-3r"}, + {0x06a00470, 0x0ff00ff0, "sxtab%c\t%12-15r, %16-19r, %0-3r, ROR #8"}, + {0x06a00870, 0x0ff00ff0, "sxtab%c\t%12-15r, %16-19r, %0-3r, ROR #16"}, + {0x06a00c70, 0x0ff00ff0, "sxtab%c\t%12-15r, %16-19r, %0-3r, ROR #24"}, + {0x06f00070, 0x0ff00ff0, "uxtah%c\t%12-15r, %16-19r, %0-3r"}, + {0x06f00470, 0x0ff00ff0, "uxtah%c\t%12-15r, %16-19r, %0-3r, ROR #8"}, + {0x06f00870, 0x0ff00ff0, "uxtah%c\t%12-15r, %16-19r, %0-3r, ROR #16"}, + {0x06f00c70, 0x0ff00ff0, "uxtah%c\t%12-15r, %16-19r, %0-3r, ROR #24"}, + {0x06c00070, 0x0ff00ff0, "uxtab16%c\t%12-15r, %16-19r, %0-3r"}, + {0x06c00470, 0x0ff00ff0, "uxtab16%c\t%12-15r, %16-19r, %0-3r, ROR #8"}, + {0x06c00870, 0x0ff00ff0, "uxtab16%c\t%12-15r, %16-19r, %0-3r, ROR #16"}, + {0x06c00c70, 0x0ff00ff0, "uxtab16%c\t%12-15r, %16-19r, %0-3r, ROR #24"}, + {0x06e00070, 0x0ff00ff0, "uxtab%c\t%12-15r, %16-19r, %0-3r"}, + {0x06e00470, 0x0ff00ff0, "uxtab%c\t%12-15r, %16-19r, %0-3r, ROR #8"}, + {0x06e00870, 0x0ff00ff0, "uxtab%c\t%12-15r, %16-19r, %0-3r, ROR #16"}, + {0x06e00c70, 0x0ff00ff0, "uxtab%c\t%12-15r, %16-19r, %0-3r, ROR #24"}, + {0x068000b0, 0x0ff00ff0, "sel%c\t%12-15r, %16-19r, %0-3r"}, + {0xf1010000, 0xfffffc00, "setend\t%9?ble"}, + {0x0700f010, 0x0ff0f0d0, "smuad%5'x%c\t%16-19r, %0-3r, %8-11r"}, + {0x0700f050, 0x0ff0f0d0, "smusd%5'x%c\t%16-19r, %0-3r, %8-11r"}, + {0x07000010, 0x0ff000d0, "smlad%5'x%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, + {0x07400010, 0x0ff000d0, "smlald%5'x%c\t%12-15r, %16-19r, %0-3r, %8-11r"}, + {0x07000050, 0x0ff000d0, "smlsd%5'x%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, + {0x07400050, 0x0ff000d0, "smlsld%5'x%c\t%12-15r, %16-19r, %0-3r, %8-11r"}, + {0x0750f010, 0x0ff0f0d0, "smmul%5'r%c\t%16-19r, %0-3r, %8-11r"}, + {0x07500010, 0x0ff000d0, "smmla%5'r%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, + {0x075000d0, 0x0ff000d0, "smmls%5'r%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, + {0xf84d0500, 0xfe5fffe0, "srs%23?id%24?ba\t#%0-4d%21'!"}, + {0x06a00010, 0x0fe00ff0, "ssat%c\t%12-15r, #%16-20W, %0-3r"}, + {0x06a00010, 0x0fe00070, "ssat%c\t%12-15r, #%16-20W, %0-3r, LSL #%7-11d"}, + {0x06a00050, 0x0fe00070, "ssat%c\t%12-15r, #%16-20W, %0-3r, ASR #%7-11d"}, + {0x06a00f30, 0x0ff00ff0, "ssat16%c\t%12-15r, #%16-19W, %0-3r"}, + {0x01800f90, 0x0ff00ff0, "strex%c\t%12-15r, %0-3r, [%16-19r]"}, + {0x00400090, 0x0ff000f0, "umaal%c\t%12-15r, %16-19r, %0-3r, %8-11r"}, + {0x0780f010, 0x0ff0f0f0, "usad8%c\t%16-19r, %0-3r, %8-11r"}, + {0x07800010, 0x0ff000f0, "usada8%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, + {0x06e00010, 0x0fe00ff0, "usat%c\t%12-15r, #%16-20d, %0-3r"}, + {0x06e00010, 0x0fe00070, "usat%c\t%12-15r, #%16-20d, %0-3r, LSL #%7-11d"}, + {0x06e00050, 0x0fe00070, "usat%c\t%12-15r, #%16-20d, %0-3r, ASR #%7-11d"}, + {0x06e00f30, 0x0ff00ff0, "usat16%c\t%12-15r, #%16-19d, %0-3r"}, + /* V5J instruction. */ {0x012fff20, 0x0ffffff0, "bxj%c\t%0-3r"}, @@ -459,6 +586,19 @@ static const struct thumb_opcode thumb_opcodes[] = { /* Thumb instructions. */ + /* ARM V6. */ + {0xb660, 0xfff8, "cpsie\t%2'a%1'i%0'f"}, + {0xb670, 0xfff8, "cpsid\t%2'a%1'i%0'f"}, + {0x4600, 0xffc0, "cpy\t%0-2r, %3-5r"}, + {0xba00, 0xffc0, "rev\t%0-2r, %3-5r"}, + {0xba40, 0xffc0, "rev16\t%0-2r, %3-5r"}, + {0xbac0, 0xffc0, "revsh\t%0-2r, %3-5r"}, + {0xb650, 0xfff7, "setend\t%3?ble\t"}, + {0xb200, 0xffc0, "sxth\t%0-2r, %3-5r"}, + {0xb240, 0xffc0, "sxtb\t%0-2r, %3-5r"}, + {0xb280, 0xffc0, "uxth\t%0-2r, %3-5r"}, + {0xb2c0, 0xffc0, "uxtb\t%0-2r, %3-5r"}, + /* ARM V5 ISA extends Thumb. */ {0xbe00, 0xff00, "bkpt\t%0-7x"}, {0x4780, 0xff87, "blx\t%3-6r"}, /* note: 4 bit register number. */ diff --git a/opcodes/dis-buf.c b/opcodes/dis-buf.c index 8f846a9..83fbfbd 100644 --- a/opcodes/dis-buf.c +++ b/opcodes/dis-buf.c @@ -107,7 +107,7 @@ generic_strcat_address (addr, buf, len) } #endif -/* Just return the given address. */ +/* Just return true. */ int generic_symbol_at_address (addr, info) @@ -116,3 +116,12 @@ generic_symbol_at_address (addr, info) { return 1; } + +/* Just return TRUE. */ + +bfd_boolean +generic_symbol_is_valid (asymbol * sym ATTRIBUTE_UNUSED, + struct disassemble_info *info ATTRIBUTE_UNUSED) +{ + return TRUE; +} diff --git a/opcodes/dis-init.c b/opcodes/dis-init.c index 4c3e36e..35a5ee7 100644 --- a/opcodes/dis-init.c +++ b/opcodes/dis-init.c @@ -26,6 +26,7 @@ init_disassemble_info (struct disassemble_info *info, void *stream, fprintf_ftype fprintf_func) { memset (info, 0, sizeof (*info)); + info->flavour = bfd_target_unknown_flavour; info->arch = bfd_arch_unknown; info->endian = BFD_ENDIAN_UNKNOWN; @@ -36,6 +37,7 @@ init_disassemble_info (struct disassemble_info *info, void *stream, info->memory_error_func = perror_memory; info->print_address_func = generic_print_address; info->symbol_at_address_func = generic_symbol_at_address; + info->symbol_is_valid = generic_symbol_is_valid; info->display_endian = BFD_ENDIAN_UNKNOWN; } diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c index 14113b5..d5b17be 100644 --- a/opcodes/disassemble.c +++ b/opcodes/disassemble.c @@ -397,3 +397,21 @@ disassembler_usage (stream) return; } + +void +disassemble_init_for_target (struct disassemble_info * info) +{ + if (info == NULL) + return; + + switch (info->arch) + { +#ifdef ARCH_arm + case bfd_arch_arm: + info->symbol_is_valid = arm_symbol_is_valid; + break; +#endif + default: + break; + } +} diff --git a/opcodes/h8300-dis.c b/opcodes/h8300-dis.c index ea8d30b..895a9ef 100644 --- a/opcodes/h8300-dis.c +++ b/opcodes/h8300-dis.c @@ -45,25 +45,6 @@ static void extract_immediate PARAMS ((FILE *, int *, int *, const struct h8_opcode *)); -static void print_colon_thingie PARAMS ((op_type *)); - -static void -print_colon_thingie (op_type *nib) -{ - switch (*nib & SIZE) { - case L_2: fprintf (stdout, "2"); break; - case L_3: - case L_3NZ: fprintf (stdout, "3"); break; - case L_4: fprintf (stdout, "4"); break; - case L_5: fprintf (stdout, "5"); break; - case L_8: fprintf (stdout, "8"); break; - case L_16: - case L_16U: fprintf (stdout, "16"); break; - case L_24: fprintf (stdout, "24"); break; - case L_32: fprintf (stdout, "32"); break; - } -} - /* Run through the opcodes and sort them into order to make them easy to disassemble. */ diff --git a/opcodes/i370-opc.c b/opcodes/i370-opc.c index 4ce7994..a045f72 100644 --- a/opcodes/i370-opc.c +++ b/opcodes/i370-opc.c @@ -229,7 +229,6 @@ const struct i370_operand i370_operands[] = /* The functions used to insert and extract complicated operands. */ -/*ARGSUSED*/ static i370_insn_t insert_ss_b2 (i370_insn_t insn, long value, const char **errmsg ATTRIBUTE_UNUSED) diff --git a/opcodes/m32r-asm.c b/opcodes/m32r-asm.c index a8c9485..8c2cc81 100644 --- a/opcodes/m32r-asm.c +++ b/opcodes/m32r-asm.c @@ -147,7 +147,11 @@ parse_slo16 (cd, strp, opindex, valuep) ++*strp; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - value &= 0xffff; + { + value &= 0xffff; + if (value & 0x8000) + value |= 0xffff0000; + } *valuep = value; return errmsg; } @@ -310,12 +314,18 @@ m32r_cgen_parse_operand (cd, opindex, strp, fields) fields->f_uimm24 = value; } break; + case M32R_OPERAND_UIMM3 : + errmsg = cgen_parse_unsigned_integer (cd, strp, M32R_OPERAND_UIMM3, &fields->f_uimm3); + break; case M32R_OPERAND_UIMM4 : errmsg = cgen_parse_unsigned_integer (cd, strp, M32R_OPERAND_UIMM4, &fields->f_uimm4); break; case M32R_OPERAND_UIMM5 : errmsg = cgen_parse_unsigned_integer (cd, strp, M32R_OPERAND_UIMM5, &fields->f_uimm5); break; + case M32R_OPERAND_UIMM8 : + errmsg = cgen_parse_unsigned_integer (cd, strp, M32R_OPERAND_UIMM8, &fields->f_uimm8); + break; case M32R_OPERAND_ULO16 : errmsg = parse_ulo16 (cd, strp, M32R_OPERAND_ULO16, &fields->f_uimm16); break; diff --git a/opcodes/m32r-desc.c b/opcodes/m32r-desc.c index 023ab62..711aff0 100644 --- a/opcodes/m32r-desc.c +++ b/opcodes/m32r-desc.c @@ -48,6 +48,7 @@ static const CGEN_ATTR_ENTRY MACH_attr[] = { "base", MACH_BASE }, { "m32r", MACH_M32R }, { "m32rx", MACH_M32RX }, + { "m32r2", MACH_M32R2 }, { "max", MACH_MAX }, { 0, 0 } }; @@ -65,6 +66,7 @@ static const CGEN_ATTR_ENTRY PIPE_attr[] = { "O", PIPE_O }, { "S", PIPE_S }, { "OS", PIPE_OS }, + { "O_OS", PIPE_O_OS }, { 0, 0 } }; @@ -123,6 +125,8 @@ const CGEN_ATTR_TABLE m32r_cgen_insn_attr_table[] = { "PBB", &bool_attr[0], &bool_attr[0] }, { "FILL-SLOT", &bool_attr[0], &bool_attr[0] }, { "SPECIAL", &bool_attr[0], &bool_attr[0] }, + { "SPECIAL_M32R", &bool_attr[0], &bool_attr[0] }, + { "SPECIAL_FLOAT", &bool_attr[0], &bool_attr[0] }, { 0, 0, 0 } }; @@ -138,6 +142,7 @@ static const CGEN_ISA m32r_cgen_isa_table[] = { static const CGEN_MACH m32r_cgen_mach_table[] = { { "m32r", "m32r", MACH_M32R, 0 }, { "m32rx", "m32rx", MACH_M32RX, 0 }, + { "m32r2", "m32r2", MACH_M32R2, 0 }, { 0, 0, 0, 0 } }; @@ -180,6 +185,7 @@ static CGEN_KEYWORD_ENTRY m32r_cgen_opval_cr_names_entries[] = { "bpc", 6, {0, {0}}, 0, 0 }, { "bbpsw", 8, {0, {0}}, 0, 0 }, { "bbpc", 14, {0, {0}}, 0, 0 }, + { "evb", 5, {0, {0}}, 0, 0 }, { "cr0", 0, {0, {0}}, 0, 0 }, { "cr1", 1, {0, {0}}, 0, 0 }, { "cr2", 2, {0, {0}}, 0, 0 }, @@ -201,7 +207,7 @@ static CGEN_KEYWORD_ENTRY m32r_cgen_opval_cr_names_entries[] = CGEN_KEYWORD m32r_cgen_opval_cr_names = { & m32r_cgen_opval_cr_names_entries[0], - 23, + 24, 0, 0, 0, 0, "" }; @@ -241,7 +247,7 @@ const CGEN_HW_ENTRY m32r_cgen_hw_table[] = { "h-gr", HW_H_GR, CGEN_ASM_KEYWORD, (PTR) & m32r_cgen_opval_gr_names, { 0|A(CACHE_ADDR)|A(PROFILE), { (1<<MACH_BASE) } } }, { "h-cr", HW_H_CR, CGEN_ASM_KEYWORD, (PTR) & m32r_cgen_opval_cr_names, { 0, { (1<<MACH_BASE) } } }, { "h-accum", HW_H_ACCUM, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } }, - { "h-accums", HW_H_ACCUMS, CGEN_ASM_KEYWORD, (PTR) & m32r_cgen_opval_h_accums, { 0, { (1<<MACH_M32RX) } } }, + { "h-accums", HW_H_ACCUMS, CGEN_ASM_KEYWORD, (PTR) & m32r_cgen_opval_h_accums, { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2) } } }, { "h-cond", HW_H_COND, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } }, { "h-psw", HW_H_PSW, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } }, { "h-bpsw", HW_H_BPSW, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } }, @@ -273,8 +279,10 @@ const CGEN_IFLD m32r_cgen_ifld_table[] = { M32R_F_SIMM8, "f-simm8", 0, 32, 8, 8, { 0, { (1<<MACH_BASE) } } }, { M32R_F_SIMM16, "f-simm16", 0, 32, 16, 16, { 0, { (1<<MACH_BASE) } } }, { M32R_F_SHIFT_OP2, "f-shift-op2", 0, 32, 8, 3, { 0, { (1<<MACH_BASE) } } }, + { M32R_F_UIMM3, "f-uimm3", 0, 32, 5, 3, { 0, { (1<<MACH_BASE) } } }, { M32R_F_UIMM4, "f-uimm4", 0, 32, 12, 4, { 0, { (1<<MACH_BASE) } } }, { M32R_F_UIMM5, "f-uimm5", 0, 32, 11, 5, { 0, { (1<<MACH_BASE) } } }, + { M32R_F_UIMM8, "f-uimm8", 0, 32, 8, 8, { 0, { (1<<MACH_BASE) } } }, { M32R_F_UIMM16, "f-uimm16", 0, 32, 16, 16, { 0, { (1<<MACH_BASE) } } }, { M32R_F_UIMM24, "f-uimm24", 0, 32, 8, 24, { 0|A(RELOC)|A(ABS_ADDR), { (1<<MACH_BASE) } } }, { M32R_F_HI16, "f-hi16", 0, 32, 16, 16, { 0|A(SIGN_OPT), { (1<<MACH_BASE) } } }, @@ -287,6 +295,7 @@ const CGEN_IFLD m32r_cgen_ifld_table[] = { M32R_F_ACCS, "f-accs", 0, 32, 12, 2, { 0, { (1<<MACH_BASE) } } }, { M32R_F_ACCD, "f-accd", 0, 32, 4, 2, { 0, { (1<<MACH_BASE) } } }, { M32R_F_BITS67, "f-bits67", 0, 32, 6, 2, { 0, { (1<<MACH_BASE) } } }, + { M32R_F_BIT4, "f-bit4", 0, 32, 4, 1, { 0, { (1<<MACH_BASE) } } }, { M32R_F_BIT14, "f-bit14", 0, 32, 14, 1, { 0, { (1<<MACH_BASE) } } }, { M32R_F_IMM1, "f-imm1", 0, 32, 15, 1, { 0, { (1<<MACH_BASE) } } }, { 0, 0, 0, 0, 0, 0, {0, {0}} } @@ -354,6 +363,10 @@ const CGEN_OPERAND m32r_cgen_operand_table[] = { "simm16", M32R_OPERAND_SIMM16, HW_H_SINT, 16, 16, { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_SIMM16] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, +/* uimm3: 3 bit unsigned number */ + { "uimm3", M32R_OPERAND_UIMM3, HW_H_UINT, 5, 3, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_UIMM3] } }, + { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* uimm4: 4 bit trap number */ { "uimm4", M32R_OPERAND_UIMM4, HW_H_UINT, 12, 4, { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_UIMM4] } }, @@ -362,6 +375,10 @@ const CGEN_OPERAND m32r_cgen_operand_table[] = { "uimm5", M32R_OPERAND_UIMM5, HW_H_UINT, 11, 5, { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_UIMM5] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, +/* uimm8: 8 bit unsigned immediate */ + { "uimm8", M32R_OPERAND_UIMM8, HW_H_UINT, 8, 8, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_UIMM8] } }, + { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* uimm16: 16 bit unsigned immediate */ { "uimm16", M32R_OPERAND_UIMM16, HW_H_UINT, 16, 16, { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_UIMM16] } }, @@ -369,19 +386,19 @@ const CGEN_OPERAND m32r_cgen_operand_table[] = /* imm1: 1 bit immediate */ { "imm1", M32R_OPERAND_IMM1, HW_H_UINT, 15, 1, { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_IMM1] } }, - { 0|A(HASH_PREFIX), { (1<<MACH_M32RX) } } }, + { 0|A(HASH_PREFIX), { (1<<MACH_M32RX)|(1<<MACH_M32R2) } } }, /* accd: accumulator destination register */ { "accd", M32R_OPERAND_ACCD, HW_H_ACCUMS, 4, 2, { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_ACCD] } }, - { 0, { (1<<MACH_M32RX) } } }, + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2) } } }, /* accs: accumulator source register */ { "accs", M32R_OPERAND_ACCS, HW_H_ACCUMS, 12, 2, { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_ACCS] } }, - { 0, { (1<<MACH_M32RX) } } }, + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2) } } }, /* acc: accumulator reg (d) */ { "acc", M32R_OPERAND_ACC, HW_H_ACCUMS, 8, 1, { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_ACC] } }, - { 0, { (1<<MACH_M32RX) } } }, + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2) } } }, /* hash: # prefix */ { "hash", M32R_OPERAND_HASH, HW_H_SINT, 0, 0, { 0, { (const PTR) 0 } }, @@ -564,12 +581,12 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* bcl.s $disp8 */ { M32R_INSN_BCL8, "bcl8", "bcl.s", 16, - { 0|A(FILL_SLOT)|A(COND_CTI), { (1<<MACH_M32RX), PIPE_O } } + { 0|A(FILL_SLOT)|A(COND_CTI), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_O } } }, /* bcl.l $disp24 */ { M32R_INSN_BCL24, "bcl24", "bcl.l", 32, - { 0|A(COND_CTI), { (1<<MACH_M32RX), PIPE_NONE } } + { 0|A(COND_CTI), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_NONE } } }, /* bnc.s $disp8 */ { @@ -599,12 +616,12 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* bncl.s $disp8 */ { M32R_INSN_BNCL8, "bncl8", "bncl.s", 16, - { 0|A(FILL_SLOT)|A(COND_CTI), { (1<<MACH_M32RX), PIPE_O } } + { 0|A(FILL_SLOT)|A(COND_CTI), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_O } } }, /* bncl.l $disp24 */ { M32R_INSN_BNCL24, "bncl24", "bncl.l", 32, - { 0|A(COND_CTI), { (1<<MACH_M32RX), PIPE_NONE } } + { 0|A(COND_CTI), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_NONE } } }, /* cmp $src1,$src2 */ { @@ -629,12 +646,12 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* cmpeq $src1,$src2 */ { M32R_INSN_CMPEQ, "cmpeq", "cmpeq", 16, - { 0, { (1<<MACH_M32RX), PIPE_OS } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_OS } } }, /* cmpz $src2 */ { M32R_INSN_CMPZ, "cmpz", "cmpz", 16, - { 0, { (1<<MACH_M32RX), PIPE_OS } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_OS } } }, /* div $dr,$sr */ { @@ -656,20 +673,55 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = M32R_INSN_REMU, "remu", "remu", 32, { 0, { (1<<MACH_BASE), PIPE_NONE } } }, +/* remh $dr,$sr */ + { + M32R_INSN_REMH, "remh", "remh", 32, + { 0, { (1<<MACH_M32R2), PIPE_NONE } } + }, +/* remuh $dr,$sr */ + { + M32R_INSN_REMUH, "remuh", "remuh", 32, + { 0, { (1<<MACH_M32R2), PIPE_NONE } } + }, +/* remb $dr,$sr */ + { + M32R_INSN_REMB, "remb", "remb", 32, + { 0, { (1<<MACH_M32R2), PIPE_NONE } } + }, +/* remub $dr,$sr */ + { + M32R_INSN_REMUB, "remub", "remub", 32, + { 0, { (1<<MACH_M32R2), PIPE_NONE } } + }, +/* divuh $dr,$sr */ + { + M32R_INSN_DIVUH, "divuh", "divuh", 32, + { 0, { (1<<MACH_M32R2), PIPE_NONE } } + }, +/* divb $dr,$sr */ + { + M32R_INSN_DIVB, "divb", "divb", 32, + { 0, { (1<<MACH_M32R2), PIPE_NONE } } + }, +/* divub $dr,$sr */ + { + M32R_INSN_DIVUB, "divub", "divub", 32, + { 0, { (1<<MACH_M32R2), PIPE_NONE } } + }, /* divh $dr,$sr */ { M32R_INSN_DIVH, "divh", "divh", 32, - { 0, { (1<<MACH_M32RX), PIPE_NONE } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_NONE } } }, /* jc $sr */ { M32R_INSN_JC, "jc", "jc", 16, - { 0|A(SPECIAL)|A(COND_CTI), { (1<<MACH_M32RX), PIPE_O } } + { 0|A(SPECIAL)|A(COND_CTI), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_O } } }, /* jnc $sr */ { M32R_INSN_JNC, "jnc", "jnc", 16, - { 0|A(SPECIAL)|A(COND_CTI), { (1<<MACH_M32RX), PIPE_O } } + { 0|A(SPECIAL)|A(COND_CTI), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_O } } }, /* jl $sr */ { @@ -764,7 +816,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* machi $src1,$src2,$acc */ { M32R_INSN_MACHI_A, "machi-a", "machi", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* maclo $src1,$src2 */ { @@ -774,7 +826,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* maclo $src1,$src2,$acc */ { M32R_INSN_MACLO_A, "maclo-a", "maclo", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* macwhi $src1,$src2 */ { @@ -784,7 +836,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* macwhi $src1,$src2,$acc */ { M32R_INSN_MACWHI_A, "macwhi-a", "macwhi", 16, - { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_S } } + { 0|A(SPECIAL), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* macwlo $src1,$src2 */ { @@ -794,7 +846,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* macwlo $src1,$src2,$acc */ { M32R_INSN_MACWLO_A, "macwlo-a", "macwlo", 16, - { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_S } } + { 0|A(SPECIAL), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* mul $dr,$sr */ { @@ -809,7 +861,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* mulhi $src1,$src2,$acc */ { M32R_INSN_MULHI_A, "mulhi-a", "mulhi", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* mullo $src1,$src2 */ { @@ -819,7 +871,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* mullo $src1,$src2,$acc */ { M32R_INSN_MULLO_A, "mullo-a", "mullo", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* mulwhi $src1,$src2 */ { @@ -829,7 +881,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* mulwhi $src1,$src2,$acc */ { M32R_INSN_MULWHI_A, "mulwhi-a", "mulwhi", 16, - { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_S } } + { 0|A(SPECIAL), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* mulwlo $src1,$src2 */ { @@ -839,7 +891,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* mulwlo $src1,$src2,$acc */ { M32R_INSN_MULWLO_A, "mulwlo-a", "mulwlo", 16, - { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_S } } + { 0|A(SPECIAL), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* mv $dr,$sr */ { @@ -854,7 +906,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* mvfachi $dr,$accs */ { M32R_INSN_MVFACHI_A, "mvfachi-a", "mvfachi", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* mvfaclo $dr */ { @@ -864,7 +916,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* mvfaclo $dr,$accs */ { M32R_INSN_MVFACLO_A, "mvfaclo-a", "mvfaclo", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* mvfacmi $dr */ { @@ -874,7 +926,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* mvfacmi $dr,$accs */ { M32R_INSN_MVFACMI_A, "mvfacmi-a", "mvfacmi", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* mvfc $dr,$scr */ { @@ -889,7 +941,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* mvtachi $src1,$accs */ { M32R_INSN_MVTACHI_A, "mvtachi-a", "mvtachi", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* mvtaclo $src1 */ { @@ -899,7 +951,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* mvtaclo $src1,$accs */ { M32R_INSN_MVTACLO_A, "mvtaclo-a", "mvtaclo", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* mvtc $sr,$dcr */ { @@ -929,7 +981,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* rac $accd,$accs,$imm1 */ { M32R_INSN_RAC_DSI, "rac-dsi", "rac", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* rach */ { @@ -939,7 +991,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* rach $accd,$accs,$imm1 */ { M32R_INSN_RACH_DSI, "rach-dsi", "rach", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* rte */ { @@ -954,7 +1006,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* sll $dr,$sr */ { M32R_INSN_SLL, "sll", "sll", 16, - { 0, { (1<<MACH_BASE), PIPE_O } } + { 0, { (1<<MACH_BASE), PIPE_O_OS } } }, /* sll3 $dr,$sr,$simm16 */ { @@ -964,12 +1016,12 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* slli $dr,$uimm5 */ { M32R_INSN_SLLI, "slli", "slli", 16, - { 0, { (1<<MACH_BASE), PIPE_O } } + { 0, { (1<<MACH_BASE), PIPE_O_OS } } }, /* sra $dr,$sr */ { M32R_INSN_SRA, "sra", "sra", 16, - { 0, { (1<<MACH_BASE), PIPE_O } } + { 0, { (1<<MACH_BASE), PIPE_O_OS } } }, /* sra3 $dr,$sr,$simm16 */ { @@ -979,12 +1031,12 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* srai $dr,$uimm5 */ { M32R_INSN_SRAI, "srai", "srai", 16, - { 0, { (1<<MACH_BASE), PIPE_O } } + { 0, { (1<<MACH_BASE), PIPE_O_OS } } }, /* srl $dr,$sr */ { M32R_INSN_SRL, "srl", "srl", 16, - { 0, { (1<<MACH_BASE), PIPE_O } } + { 0, { (1<<MACH_BASE), PIPE_O_OS } } }, /* srl3 $dr,$sr,$simm16 */ { @@ -994,7 +1046,7 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* srli $dr,$uimm5 */ { M32R_INSN_SRLI, "srli", "srli", 16, - { 0, { (1<<MACH_BASE), PIPE_O } } + { 0, { (1<<MACH_BASE), PIPE_O_OS } } }, /* st $src1,@$src2 */ { @@ -1031,6 +1083,16 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = M32R_INSN_ST_PLUS, "st-plus", "st", 16, { 0, { (1<<MACH_BASE), PIPE_O } } }, +/* sth $src1,@$src2+ */ + { + M32R_INSN_STH_PLUS, "sth-plus", "sth", 16, + { 0|A(SPECIAL), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_O } } + }, +/* stb $src1,@$src2+ */ + { + M32R_INSN_STB_PLUS, "stb-plus", "stb", 16, + { 0|A(SPECIAL), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_O } } + }, /* st $src1,@-$src2 */ { M32R_INSN_ST_MINUS, "st-minus", "st", 16, @@ -1064,57 +1126,82 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] = /* satb $dr,$sr */ { M32R_INSN_SATB, "satb", "satb", 32, - { 0, { (1<<MACH_M32RX), PIPE_NONE } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_NONE } } }, /* sath $dr,$sr */ { M32R_INSN_SATH, "sath", "sath", 32, - { 0, { (1<<MACH_M32RX), PIPE_NONE } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_NONE } } }, /* sat $dr,$sr */ { M32R_INSN_SAT, "sat", "sat", 32, - { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_NONE } } + { 0|A(SPECIAL), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_NONE } } }, /* pcmpbz $src2 */ { M32R_INSN_PCMPBZ, "pcmpbz", "pcmpbz", 16, - { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_OS } } + { 0|A(SPECIAL), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_OS } } }, /* sadd */ { M32R_INSN_SADD, "sadd", "sadd", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* macwu1 $src1,$src2 */ { M32R_INSN_MACWU1, "macwu1", "macwu1", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* msblo $src1,$src2 */ { M32R_INSN_MSBLO, "msblo", "msblo", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* mulwu1 $src1,$src2 */ { M32R_INSN_MULWU1, "mulwu1", "mulwu1", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* maclh1 $src1,$src2 */ { M32R_INSN_MACLH1, "maclh1", "maclh1", 16, - { 0, { (1<<MACH_M32RX), PIPE_S } } + { 0, { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* sc */ { M32R_INSN_SC, "sc", "sc", 16, - { 0|A(SPECIAL)|A(SKIP_CTI), { (1<<MACH_M32RX), PIPE_O } } + { 0|A(SPECIAL)|A(SKIP_CTI), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_O } } }, /* snc */ { M32R_INSN_SNC, "snc", "snc", 16, - { 0|A(SPECIAL)|A(SKIP_CTI), { (1<<MACH_M32RX), PIPE_O } } + { 0|A(SPECIAL)|A(SKIP_CTI), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_O } } + }, +/* clrpsw $uimm8 */ + { + M32R_INSN_CLRPSW, "clrpsw", "clrpsw", 16, + { 0|A(SPECIAL_M32R), { (1<<MACH_BASE), PIPE_O } } + }, +/* setpsw $uimm8 */ + { + M32R_INSN_SETPSW, "setpsw", "setpsw", 16, + { 0|A(SPECIAL_M32R), { (1<<MACH_BASE), PIPE_O } } + }, +/* bset $uimm3,@($slo16,$sr) */ + { + M32R_INSN_BSET, "bset", "bset", 32, + { 0|A(SPECIAL_M32R), { (1<<MACH_BASE), PIPE_NONE } } + }, +/* bclr $uimm3,@($slo16,$sr) */ + { + M32R_INSN_BCLR, "bclr", "bclr", 32, + { 0|A(SPECIAL_M32R), { (1<<MACH_BASE), PIPE_NONE } } + }, +/* btst $uimm3,$sr */ + { + M32R_INSN_BTST, "btst", "btst", 16, + { 0|A(SPECIAL_M32R), { (1<<MACH_BASE), PIPE_O } } }, }; diff --git a/opcodes/m32r-desc.h b/opcodes/m32r-desc.h index 8781772..ef61b69 100644 --- a/opcodes/m32r-desc.h +++ b/opcodes/m32r-desc.h @@ -38,6 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc., /* Selected cpu families. */ #define HAVE_CPU_M32RBF #define HAVE_CPU_M32RXF +#define HAVE_CPU_M32R2F #define CGEN_INSN_LSB0_P 0 @@ -90,18 +91,19 @@ typedef enum gr_names { /* Enum declaration for . */ typedef enum cr_names { H_CR_PSW = 0, H_CR_CBR = 1, H_CR_SPI = 2, H_CR_SPU = 3 - , H_CR_BPC = 6, H_CR_BBPSW = 8, H_CR_BBPC = 14, H_CR_CR0 = 0 - , H_CR_CR1 = 1, H_CR_CR2 = 2, H_CR_CR3 = 3, H_CR_CR4 = 4 - , H_CR_CR5 = 5, H_CR_CR6 = 6, H_CR_CR7 = 7, H_CR_CR8 = 8 - , H_CR_CR9 = 9, H_CR_CR10 = 10, H_CR_CR11 = 11, H_CR_CR12 = 12 - , H_CR_CR13 = 13, H_CR_CR14 = 14, H_CR_CR15 = 15 + , H_CR_BPC = 6, H_CR_BBPSW = 8, H_CR_BBPC = 14, H_CR_EVB = 5 + , H_CR_CR0 = 0, H_CR_CR1 = 1, H_CR_CR2 = 2, H_CR_CR3 = 3 + , H_CR_CR4 = 4, H_CR_CR5 = 5, H_CR_CR6 = 6, H_CR_CR7 = 7 + , H_CR_CR8 = 8, H_CR_CR9 = 9, H_CR_CR10 = 10, H_CR_CR11 = 11 + , H_CR_CR12 = 12, H_CR_CR13 = 13, H_CR_CR14 = 14, H_CR_CR15 = 15 } CR_NAMES; /* Attributes. */ /* Enum declaration for machine type selection. */ typedef enum mach_attr { - MACH_BASE, MACH_M32R, MACH_M32RX, MACH_MAX + MACH_BASE, MACH_M32R, MACH_M32RX, MACH_M32R2 + , MACH_MAX } MACH_ATTR; /* Enum declaration for instruction set selection. */ @@ -112,6 +114,7 @@ typedef enum isa_attr { /* Enum declaration for parallel execution pipeline selection. */ typedef enum pipe_attr { PIPE_NONE, PIPE_O, PIPE_S, PIPE_OS + , PIPE_O_OS } PIPE_ATTR; /* Number of architecture variants. */ @@ -138,11 +141,12 @@ typedef enum cgen_ifld_attr { typedef enum ifield_type { M32R_F_NIL, M32R_F_ANYOF, M32R_F_OP1, M32R_F_OP2 , M32R_F_COND, M32R_F_R1, M32R_F_R2, M32R_F_SIMM8 - , M32R_F_SIMM16, M32R_F_SHIFT_OP2, M32R_F_UIMM4, M32R_F_UIMM5 - , M32R_F_UIMM16, M32R_F_UIMM24, M32R_F_HI16, M32R_F_DISP8 - , M32R_F_DISP16, M32R_F_DISP24, M32R_F_OP23, M32R_F_OP3 - , M32R_F_ACC, M32R_F_ACCS, M32R_F_ACCD, M32R_F_BITS67 - , M32R_F_BIT14, M32R_F_IMM1, M32R_F_MAX + , M32R_F_SIMM16, M32R_F_SHIFT_OP2, M32R_F_UIMM3, M32R_F_UIMM4 + , M32R_F_UIMM5, M32R_F_UIMM8, M32R_F_UIMM16, M32R_F_UIMM24 + , M32R_F_HI16, M32R_F_DISP8, M32R_F_DISP16, M32R_F_DISP24 + , M32R_F_OP23, M32R_F_OP3, M32R_F_ACC, M32R_F_ACCS + , M32R_F_ACCD, M32R_F_BITS67, M32R_F_BIT4, M32R_F_BIT14 + , M32R_F_IMM1, M32R_F_MAX } IFIELD_TYPE; #define MAX_IFLD ((int) M32R_F_MAX) @@ -186,15 +190,16 @@ typedef enum cgen_operand_attr { typedef enum cgen_operand_type { M32R_OPERAND_PC, M32R_OPERAND_SR, M32R_OPERAND_DR, M32R_OPERAND_SRC1 , M32R_OPERAND_SRC2, M32R_OPERAND_SCR, M32R_OPERAND_DCR, M32R_OPERAND_SIMM8 - , M32R_OPERAND_SIMM16, M32R_OPERAND_UIMM4, M32R_OPERAND_UIMM5, M32R_OPERAND_UIMM16 - , M32R_OPERAND_IMM1, M32R_OPERAND_ACCD, M32R_OPERAND_ACCS, M32R_OPERAND_ACC - , M32R_OPERAND_HASH, M32R_OPERAND_HI16, M32R_OPERAND_SLO16, M32R_OPERAND_ULO16 - , M32R_OPERAND_UIMM24, M32R_OPERAND_DISP8, M32R_OPERAND_DISP16, M32R_OPERAND_DISP24 - , M32R_OPERAND_CONDBIT, M32R_OPERAND_ACCUM, M32R_OPERAND_MAX + , M32R_OPERAND_SIMM16, M32R_OPERAND_UIMM3, M32R_OPERAND_UIMM4, M32R_OPERAND_UIMM5 + , M32R_OPERAND_UIMM8, M32R_OPERAND_UIMM16, M32R_OPERAND_IMM1, M32R_OPERAND_ACCD + , M32R_OPERAND_ACCS, M32R_OPERAND_ACC, M32R_OPERAND_HASH, M32R_OPERAND_HI16 + , M32R_OPERAND_SLO16, M32R_OPERAND_ULO16, M32R_OPERAND_UIMM24, M32R_OPERAND_DISP8 + , M32R_OPERAND_DISP16, M32R_OPERAND_DISP24, M32R_OPERAND_CONDBIT, M32R_OPERAND_ACCUM + , M32R_OPERAND_MAX } CGEN_OPERAND_TYPE; /* Number of operands types. */ -#define MAX_OPERANDS 26 +#define MAX_OPERANDS 28 /* Maximum number of operands referenced by any insn. */ #define MAX_OPERAND_INSTANCES 11 @@ -206,8 +211,8 @@ typedef enum cgen_insn_attr { CGEN_INSN_ALIAS, CGEN_INSN_VIRTUAL, CGEN_INSN_UNCOND_CTI, CGEN_INSN_COND_CTI , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAXED , CGEN_INSN_NO_DIS, CGEN_INSN_PBB, CGEN_INSN_FILL_SLOT, CGEN_INSN_SPECIAL - , CGEN_INSN_END_BOOLS, CGEN_INSN_START_NBOOLS = 31, CGEN_INSN_MACH, CGEN_INSN_PIPE - , CGEN_INSN_END_NBOOLS + , CGEN_INSN_SPECIAL_M32R, CGEN_INSN_SPECIAL_FLOAT, CGEN_INSN_END_BOOLS, CGEN_INSN_START_NBOOLS = 31 + , CGEN_INSN_MACH, CGEN_INSN_PIPE, CGEN_INSN_END_NBOOLS } CGEN_INSN_ATTR; /* Number of non-boolean elements in cgen_insn_attr. */ @@ -228,6 +233,7 @@ extern CGEN_KEYWORD m32r_cgen_opval_gr_names; extern CGEN_KEYWORD m32r_cgen_opval_cr_names; extern CGEN_KEYWORD m32r_cgen_opval_h_accums; +extern const CGEN_HW_ENTRY m32r_cgen_hw_table[]; diff --git a/opcodes/m32r-dis.c b/opcodes/m32r-dis.c index e8abbc6..6e5ea70 100644 --- a/opcodes/m32r-dis.c +++ b/opcodes/m32r-dis.c @@ -100,6 +100,8 @@ my_print_insn (cd, pc, info) char *buf = buffer; int status; int buflen = (pc & 3) == 0 ? 4 : 2; + int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG; + char *x; /* Read the base part of the insn. */ @@ -111,22 +113,25 @@ my_print_insn (cd, pc, info) } /* 32 bit insn? */ - if ((pc & 3) == 0 && (buf[0] & 0x80) != 0) + x = (big_p ? &buf[0] : &buf[3]); + if ((pc & 3) == 0 && (*x & 0x80) != 0) return print_insn (cd, pc, info, buf, buflen); /* Print the first insn. */ + buf += (big_p ? 0 : 2); if ((pc & 3) == 0) { if (print_insn (cd, pc, info, buf, 2) == 0) (*info->fprintf_func) (info->stream, UNKNOWN_INSN_MSG); - buf += 2; } + buf += (big_p ? 2 : -2); - if (buf[0] & 0x80) + x = (big_p ? &buf[0] : &buf[1]); + if (*x & 0x80) { /* Parallel. */ (*info->fprintf_func) (info->stream, " || "); - buf[0] &= 0x7f; + *x &= 0x7f; } else (*info->fprintf_func) (info->stream, " -> "); @@ -235,12 +240,18 @@ m32r_cgen_print_operand (cd, opindex, xinfo, fields, attrs, pc, length) case M32R_OPERAND_UIMM24 : print_address (cd, info, fields->f_uimm24, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_RELOC)|(1<<CGEN_OPERAND_ABS_ADDR), pc, length); break; + case M32R_OPERAND_UIMM3 : + print_normal (cd, info, fields->f_uimm3, 0|(1<<CGEN_OPERAND_HASH_PREFIX), pc, length); + break; case M32R_OPERAND_UIMM4 : print_normal (cd, info, fields->f_uimm4, 0|(1<<CGEN_OPERAND_HASH_PREFIX), pc, length); break; case M32R_OPERAND_UIMM5 : print_normal (cd, info, fields->f_uimm5, 0|(1<<CGEN_OPERAND_HASH_PREFIX), pc, length); break; + case M32R_OPERAND_UIMM8 : + print_normal (cd, info, fields->f_uimm8, 0|(1<<CGEN_OPERAND_HASH_PREFIX), pc, length); + break; case M32R_OPERAND_ULO16 : print_normal (cd, info, fields->f_uimm16, 0, pc, length); break; diff --git a/opcodes/m32r-ibld.c b/opcodes/m32r-ibld.c index 2a8d104..32224da 100644 --- a/opcodes/m32r-ibld.c +++ b/opcodes/m32r-ibld.c @@ -646,12 +646,18 @@ m32r_cgen_insert_operand (cd, opindex, fields, buffer, pc) case M32R_OPERAND_UIMM24 : errmsg = insert_normal (cd, fields->f_uimm24, 0|(1<<CGEN_IFLD_RELOC)|(1<<CGEN_IFLD_ABS_ADDR), 0, 8, 24, 32, total_length, buffer); break; + case M32R_OPERAND_UIMM3 : + errmsg = insert_normal (cd, fields->f_uimm3, 0, 0, 5, 3, 32, total_length, buffer); + break; case M32R_OPERAND_UIMM4 : errmsg = insert_normal (cd, fields->f_uimm4, 0, 0, 12, 4, 32, total_length, buffer); break; case M32R_OPERAND_UIMM5 : errmsg = insert_normal (cd, fields->f_uimm5, 0, 0, 11, 5, 32, total_length, buffer); break; + case M32R_OPERAND_UIMM8 : + errmsg = insert_normal (cd, fields->f_uimm8, 0, 0, 8, 8, 32, total_length, buffer); + break; case M32R_OPERAND_ULO16 : errmsg = insert_normal (cd, fields->f_uimm16, 0, 0, 16, 16, 32, total_length, buffer); break; @@ -779,12 +785,18 @@ m32r_cgen_extract_operand (cd, opindex, ex_info, insn_value, fields, pc) case M32R_OPERAND_UIMM24 : length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_RELOC)|(1<<CGEN_IFLD_ABS_ADDR), 0, 8, 24, 32, total_length, pc, & fields->f_uimm24); break; + case M32R_OPERAND_UIMM3 : + length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_uimm3); + break; case M32R_OPERAND_UIMM4 : length = extract_normal (cd, ex_info, insn_value, 0, 0, 12, 4, 32, total_length, pc, & fields->f_uimm4); break; case M32R_OPERAND_UIMM5 : length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 5, 32, total_length, pc, & fields->f_uimm5); break; + case M32R_OPERAND_UIMM8 : + length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 8, 32, total_length, pc, & fields->f_uimm8); + break; case M32R_OPERAND_ULO16 : length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_uimm16); break; @@ -889,12 +901,18 @@ m32r_cgen_get_int_operand (cd, opindex, fields) case M32R_OPERAND_UIMM24 : value = fields->f_uimm24; break; + case M32R_OPERAND_UIMM3 : + value = fields->f_uimm3; + break; case M32R_OPERAND_UIMM4 : value = fields->f_uimm4; break; case M32R_OPERAND_UIMM5 : value = fields->f_uimm5; break; + case M32R_OPERAND_UIMM8 : + value = fields->f_uimm8; + break; case M32R_OPERAND_ULO16 : value = fields->f_uimm16; break; @@ -979,12 +997,18 @@ m32r_cgen_get_vma_operand (cd, opindex, fields) case M32R_OPERAND_UIMM24 : value = fields->f_uimm24; break; + case M32R_OPERAND_UIMM3 : + value = fields->f_uimm3; + break; case M32R_OPERAND_UIMM4 : value = fields->f_uimm4; break; case M32R_OPERAND_UIMM5 : value = fields->f_uimm5; break; + case M32R_OPERAND_UIMM8 : + value = fields->f_uimm8; + break; case M32R_OPERAND_ULO16 : value = fields->f_uimm16; break; @@ -1077,12 +1101,18 @@ m32r_cgen_set_int_operand (cd, opindex, fields, value) case M32R_OPERAND_UIMM24 : fields->f_uimm24 = value; break; + case M32R_OPERAND_UIMM3 : + fields->f_uimm3 = value; + break; case M32R_OPERAND_UIMM4 : fields->f_uimm4 = value; break; case M32R_OPERAND_UIMM5 : fields->f_uimm5 = value; break; + case M32R_OPERAND_UIMM8 : + fields->f_uimm8 = value; + break; case M32R_OPERAND_ULO16 : fields->f_uimm16 = value; break; @@ -1163,12 +1193,18 @@ m32r_cgen_set_vma_operand (cd, opindex, fields, value) case M32R_OPERAND_UIMM24 : fields->f_uimm24 = value; break; + case M32R_OPERAND_UIMM3 : + fields->f_uimm3 = value; + break; case M32R_OPERAND_UIMM4 : fields->f_uimm4 = value; break; case M32R_OPERAND_UIMM5 : fields->f_uimm5 = value; break; + case M32R_OPERAND_UIMM8 : + fields->f_uimm8 = value; + break; case M32R_OPERAND_ULO16 : fields->f_uimm16 = value; break; diff --git a/opcodes/m32r-opc.c b/opcodes/m32r-opc.c index 8143b61..a18d5cc 100644 --- a/opcodes/m32r-opc.c +++ b/opcodes/m32r-opc.c @@ -30,6 +30,31 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "m32r-opc.h" #include "libiberty.h" +/* -- opc.c */ +unsigned int +m32r_cgen_dis_hash (buf, value) + const char * buf ATTRIBUTE_UNUSED; + CGEN_INSN_INT value; +{ + unsigned int x; + + if (value & 0xffff0000) /* 32bit instructions */ + value = (value >> 16) & 0xffff; + + x = (value>>8) & 0xf0; + if (x == 0x40 || x == 0xe0 || x == 0x60 || x == 0x50) + return x; + + if (x == 0x70 || x == 0xf0) + return x | ((value>>8) & 0x0f); + + if (x == 0x30) + return x | ((value & 0x70) >> 4); + else + return x | ((value & 0xf0) >> 4); +} + +/* -- */ /* The hash functions are recorded here to help keep assembler code out of the disassembler and vice versa. */ @@ -173,6 +198,18 @@ static const CGEN_IFMT ifmt_satb = { 32, 32, 0xf0f0ffff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } } }; +static const CGEN_IFMT ifmt_clrpsw = { + 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_UIMM8) }, { 0 } } +}; + +static const CGEN_IFMT ifmt_bset = { + 32, 32, 0xf8f00000, { { F (F_OP1) }, { F (F_BIT4) }, { F (F_UIMM3) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } } +}; + +static const CGEN_IFMT ifmt_btst = { + 16, 16, 0xf8f0, { { F (F_OP1) }, { F (F_BIT4) }, { F (F_UIMM3) }, { F (F_OP2) }, { F (F_R2) }, { 0 } } +}; + #undef F #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) @@ -448,6 +485,48 @@ static const CGEN_OPCODE m32r_cgen_insn_opcode_table[MAX_INSNS] = { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } }, & ifmt_div, { 0x90300000 } }, +/* remh $dr,$sr */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } }, + & ifmt_div, { 0x90200010 } + }, +/* remuh $dr,$sr */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } }, + & ifmt_div, { 0x90300010 } + }, +/* remb $dr,$sr */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } }, + & ifmt_div, { 0x90200018 } + }, +/* remub $dr,$sr */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } }, + & ifmt_div, { 0x90300018 } + }, +/* divuh $dr,$sr */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } }, + & ifmt_div, { 0x90100010 } + }, +/* divb $dr,$sr */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } }, + & ifmt_div, { 0x90000018 } + }, +/* divub $dr,$sr */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (DR), ',', OP (SR), 0 } }, + & ifmt_div, { 0x90100018 } + }, /* divh $dr,$sr */ { { 0, 0, 0, 0 }, @@ -898,6 +977,18 @@ static const CGEN_OPCODE m32r_cgen_insn_opcode_table[MAX_INSNS] = { { MNEM, ' ', OP (SRC1), ',', '@', '+', OP (SRC2), 0 } }, & ifmt_cmp, { 0x2060 } }, +/* sth $src1,@$src2+ */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), '+', 0 } }, + & ifmt_cmp, { 0x2030 } + }, +/* stb $src1,@$src2+ */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (SRC1), ',', '@', OP (SRC2), '+', 0 } }, + & ifmt_cmp, { 0x2010 } + }, /* st $src1,@-$src2 */ { { 0, 0, 0, 0 }, @@ -1000,6 +1091,36 @@ static const CGEN_OPCODE m32r_cgen_insn_opcode_table[MAX_INSNS] = { { MNEM, 0 } }, & ifmt_nop, { 0x7501 } }, +/* clrpsw $uimm8 */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (UIMM8), 0 } }, + & ifmt_clrpsw, { 0x7200 } + }, +/* setpsw $uimm8 */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (UIMM8), 0 } }, + & ifmt_clrpsw, { 0x7100 } + }, +/* bset $uimm3,@($slo16,$sr) */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (UIMM3), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } }, + & ifmt_bset, { 0xa0600000 } + }, +/* bclr $uimm3,@($slo16,$sr) */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (UIMM3), ',', '@', '(', OP (SLO16), ',', OP (SR), ')', 0 } }, + & ifmt_bset, { 0xa0700000 } + }, +/* btst $uimm3,$sr */ + { + { 0, 0, 0, 0 }, + { { MNEM, ' ', OP (UIMM3), ',', OP (SR), 0 } }, + & ifmt_btst, { 0xf0 } + }, }; #undef A @@ -1202,12 +1323,12 @@ static const CGEN_IBASE m32r_cgen_macro_insn_table[] = /* bcl $disp8 */ { -1, "bcl8r", "bcl", 16, - { 0|A(RELAXABLE)|A(FILL_SLOT)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_O } } + { 0|A(RELAXABLE)|A(FILL_SLOT)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_O } } }, /* bcl $disp24 */ { -1, "bcl24r", "bcl", 32, - { 0|A(RELAXED)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_NONE } } + { 0|A(RELAXED)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_NONE } } }, /* bnc $disp8 */ { @@ -1232,12 +1353,12 @@ static const CGEN_IBASE m32r_cgen_macro_insn_table[] = /* bncl $disp8 */ { -1, "bncl8r", "bncl", 16, - { 0|A(RELAXABLE)|A(FILL_SLOT)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_O } } + { 0|A(RELAXABLE)|A(FILL_SLOT)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_O } } }, /* bncl $disp24 */ { -1, "bncl24r", "bncl", 32, - { 0|A(RELAXED)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX), PIPE_NONE } } + { 0|A(RELAXED)|A(COND_CTI)|A(ALIAS), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_NONE } } }, /* ld $dr,@($sr) */ { @@ -1292,7 +1413,7 @@ static const CGEN_IBASE m32r_cgen_macro_insn_table[] = /* pop $dr */ { -1, "pop", "pop", 16, - { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } } + { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_O } } }, /* ldi $dr,$simm8 */ { @@ -1307,22 +1428,22 @@ static const CGEN_IBASE m32r_cgen_macro_insn_table[] = /* rac $accd */ { -1, "rac-d", "rac", 16, - { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } } + { 0|A(ALIAS), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* rac $accd,$accs */ { -1, "rac-ds", "rac", 16, - { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } } + { 0|A(ALIAS), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* rach $accd */ { -1, "rach-d", "rach", 16, - { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } } + { 0|A(ALIAS), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* rach $accd,$accs */ { -1, "rach-ds", "rach", 16, - { 0|A(ALIAS), { (1<<MACH_M32RX), PIPE_S } } + { 0|A(ALIAS), { (1<<MACH_M32RX)|(1<<MACH_M32R2), PIPE_S } } }, /* st $src1,@($src2) */ { @@ -1357,7 +1478,7 @@ static const CGEN_IBASE m32r_cgen_macro_insn_table[] = /* push $src1 */ { -1, "push", "push", 16, - { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_NONE } } + { 0|A(ALIAS), { (1<<MACH_BASE), PIPE_O } } }, }; diff --git a/opcodes/m32r-opc.h b/opcodes/m32r-opc.h index 22e6924..5fe7106 100644 --- a/opcodes/m32r-opc.h +++ b/opcodes/m32r-opc.h @@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #undef CGEN_DIS_HASH_SIZE #define CGEN_DIS_HASH_SIZE 256 #undef CGEN_DIS_HASH +#if 0 #define X(b) (((unsigned char *) (b))[0] & 0xf0) #define CGEN_DIS_HASH(buffer, value) \ (X (buffer) | \ @@ -37,6 +38,10 @@ with this program; if not, write to the Free Software Foundation, Inc., : X (buffer) == 0x70 || X (buffer) == 0xf0 ? (((unsigned char *) (buffer))[0] & 0xf) \ : X (buffer) == 0x30 ? ((((unsigned char *) (buffer))[1] & 0x70) >> 4) \ : ((((unsigned char *) (buffer))[1] & 0xf0) >> 4))) +#else +#define CGEN_DIS_HASH(buffer, value) m32r_cgen_dis_hash(buffer, value) +extern unsigned int m32r_cgen_dis_hash(const char *, CGEN_INSN_INT); +#endif /* -- */ /* Enum declaration for m32r instruction types. */ @@ -51,37 +56,41 @@ typedef enum cgen_insn_type { , M32R_INSN_BNE, M32R_INSN_BRA8, M32R_INSN_BRA24, M32R_INSN_BNCL8 , M32R_INSN_BNCL24, M32R_INSN_CMP, M32R_INSN_CMPI, M32R_INSN_CMPU , M32R_INSN_CMPUI, M32R_INSN_CMPEQ, M32R_INSN_CMPZ, M32R_INSN_DIV - , M32R_INSN_DIVU, M32R_INSN_REM, M32R_INSN_REMU, M32R_INSN_DIVH - , M32R_INSN_JC, M32R_INSN_JNC, M32R_INSN_JL, M32R_INSN_JMP - , M32R_INSN_LD, M32R_INSN_LD_D, M32R_INSN_LDB, M32R_INSN_LDB_D - , M32R_INSN_LDH, M32R_INSN_LDH_D, M32R_INSN_LDUB, M32R_INSN_LDUB_D - , M32R_INSN_LDUH, M32R_INSN_LDUH_D, M32R_INSN_LD_PLUS, M32R_INSN_LD24 - , M32R_INSN_LDI8, M32R_INSN_LDI16, M32R_INSN_LOCK, M32R_INSN_MACHI - , M32R_INSN_MACHI_A, M32R_INSN_MACLO, M32R_INSN_MACLO_A, M32R_INSN_MACWHI - , M32R_INSN_MACWHI_A, M32R_INSN_MACWLO, M32R_INSN_MACWLO_A, M32R_INSN_MUL - , M32R_INSN_MULHI, M32R_INSN_MULHI_A, M32R_INSN_MULLO, M32R_INSN_MULLO_A - , M32R_INSN_MULWHI, M32R_INSN_MULWHI_A, M32R_INSN_MULWLO, M32R_INSN_MULWLO_A - , M32R_INSN_MV, M32R_INSN_MVFACHI, M32R_INSN_MVFACHI_A, M32R_INSN_MVFACLO - , M32R_INSN_MVFACLO_A, M32R_INSN_MVFACMI, M32R_INSN_MVFACMI_A, M32R_INSN_MVFC - , M32R_INSN_MVTACHI, M32R_INSN_MVTACHI_A, M32R_INSN_MVTACLO, M32R_INSN_MVTACLO_A - , M32R_INSN_MVTC, M32R_INSN_NEG, M32R_INSN_NOP, M32R_INSN_NOT - , M32R_INSN_RAC, M32R_INSN_RAC_DSI, M32R_INSN_RACH, M32R_INSN_RACH_DSI - , M32R_INSN_RTE, M32R_INSN_SETH, M32R_INSN_SLL, M32R_INSN_SLL3 - , M32R_INSN_SLLI, M32R_INSN_SRA, M32R_INSN_SRA3, M32R_INSN_SRAI - , M32R_INSN_SRL, M32R_INSN_SRL3, M32R_INSN_SRLI, M32R_INSN_ST - , M32R_INSN_ST_D, M32R_INSN_STB, M32R_INSN_STB_D, M32R_INSN_STH - , M32R_INSN_STH_D, M32R_INSN_ST_PLUS, M32R_INSN_ST_MINUS, M32R_INSN_SUB - , M32R_INSN_SUBV, M32R_INSN_SUBX, M32R_INSN_TRAP, M32R_INSN_UNLOCK - , M32R_INSN_SATB, M32R_INSN_SATH, M32R_INSN_SAT, M32R_INSN_PCMPBZ - , M32R_INSN_SADD, M32R_INSN_MACWU1, M32R_INSN_MSBLO, M32R_INSN_MULWU1 - , M32R_INSN_MACLH1, M32R_INSN_SC, M32R_INSN_SNC + , M32R_INSN_DIVU, M32R_INSN_REM, M32R_INSN_REMU, M32R_INSN_REMH + , M32R_INSN_REMUH, M32R_INSN_REMB, M32R_INSN_REMUB, M32R_INSN_DIVUH + , M32R_INSN_DIVB, M32R_INSN_DIVUB, M32R_INSN_DIVH, M32R_INSN_JC + , M32R_INSN_JNC, M32R_INSN_JL, M32R_INSN_JMP, M32R_INSN_LD + , M32R_INSN_LD_D, M32R_INSN_LDB, M32R_INSN_LDB_D, M32R_INSN_LDH + , M32R_INSN_LDH_D, M32R_INSN_LDUB, M32R_INSN_LDUB_D, M32R_INSN_LDUH + , M32R_INSN_LDUH_D, M32R_INSN_LD_PLUS, M32R_INSN_LD24, M32R_INSN_LDI8 + , M32R_INSN_LDI16, M32R_INSN_LOCK, M32R_INSN_MACHI, M32R_INSN_MACHI_A + , M32R_INSN_MACLO, M32R_INSN_MACLO_A, M32R_INSN_MACWHI, M32R_INSN_MACWHI_A + , M32R_INSN_MACWLO, M32R_INSN_MACWLO_A, M32R_INSN_MUL, M32R_INSN_MULHI + , M32R_INSN_MULHI_A, M32R_INSN_MULLO, M32R_INSN_MULLO_A, M32R_INSN_MULWHI + , M32R_INSN_MULWHI_A, M32R_INSN_MULWLO, M32R_INSN_MULWLO_A, M32R_INSN_MV + , M32R_INSN_MVFACHI, M32R_INSN_MVFACHI_A, M32R_INSN_MVFACLO, M32R_INSN_MVFACLO_A + , M32R_INSN_MVFACMI, M32R_INSN_MVFACMI_A, M32R_INSN_MVFC, M32R_INSN_MVTACHI + , M32R_INSN_MVTACHI_A, M32R_INSN_MVTACLO, M32R_INSN_MVTACLO_A, M32R_INSN_MVTC + , M32R_INSN_NEG, M32R_INSN_NOP, M32R_INSN_NOT, M32R_INSN_RAC + , M32R_INSN_RAC_DSI, M32R_INSN_RACH, M32R_INSN_RACH_DSI, M32R_INSN_RTE + , M32R_INSN_SETH, M32R_INSN_SLL, M32R_INSN_SLL3, M32R_INSN_SLLI + , M32R_INSN_SRA, M32R_INSN_SRA3, M32R_INSN_SRAI, M32R_INSN_SRL + , M32R_INSN_SRL3, M32R_INSN_SRLI, M32R_INSN_ST, M32R_INSN_ST_D + , M32R_INSN_STB, M32R_INSN_STB_D, M32R_INSN_STH, M32R_INSN_STH_D + , M32R_INSN_ST_PLUS, M32R_INSN_STH_PLUS, M32R_INSN_STB_PLUS, M32R_INSN_ST_MINUS + , M32R_INSN_SUB, M32R_INSN_SUBV, M32R_INSN_SUBX, M32R_INSN_TRAP + , M32R_INSN_UNLOCK, M32R_INSN_SATB, M32R_INSN_SATH, M32R_INSN_SAT + , M32R_INSN_PCMPBZ, M32R_INSN_SADD, M32R_INSN_MACWU1, M32R_INSN_MSBLO + , M32R_INSN_MULWU1, M32R_INSN_MACLH1, M32R_INSN_SC, M32R_INSN_SNC + , M32R_INSN_CLRPSW, M32R_INSN_SETPSW, M32R_INSN_BSET, M32R_INSN_BCLR + , M32R_INSN_BTST } CGEN_INSN_TYPE; /* Index of `invalid' insn place holder. */ #define CGEN_INSN_INVALID M32R_INSN_INVALID /* Total number of insns in table. */ -#define MAX_INSNS ((int) M32R_INSN_SNC + 1) +#define MAX_INSNS ((int) M32R_INSN_BTST + 1) /* This struct records data prior to insertion or after extraction. */ struct cgen_fields @@ -97,8 +106,10 @@ struct cgen_fields long f_simm8; long f_simm16; long f_shift_op2; + long f_uimm3; long f_uimm4; long f_uimm5; + long f_uimm8; long f_uimm16; long f_uimm24; long f_hi16; @@ -111,6 +122,7 @@ struct cgen_fields long f_accs; long f_accd; long f_bits67; + long f_bit4; long f_bit14; long f_imm1; }; diff --git a/opcodes/m32r-opinst.c b/opcodes/m32r-opinst.c index 5365d15..370aa7c 100644 --- a/opcodes/m32r-opinst.c +++ b/opcodes/m32r-opinst.c @@ -42,42 +42,42 @@ with this program; if not, write to the Free Software Foundation, Inc., #define COND_REF CGEN_OPINST_COND_REF static const CGEN_OPINST sfmt_empty_ops[] = { - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_add_ops[] = { { INPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_add3_ops[] = { { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 }, { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_and3_ops[] = { { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { INPUT, "uimm16", HW_H_UINT, CGEN_MODE_UINT, OP_ENT (UIMM16), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_or3_ops[] = { { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { INPUT, "ulo16", HW_H_ULO16, CGEN_MODE_UINT, OP_ENT (ULO16), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_addi_ops[] = { { INPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, { INPUT, "simm8", HW_H_SINT, CGEN_MODE_INT, OP_ENT (SIMM8), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_addv_ops[] = { @@ -85,7 +85,7 @@ static const CGEN_OPINST sfmt_addv_ops[] = { { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_addv3_ops[] = { @@ -93,7 +93,7 @@ static const CGEN_OPINST sfmt_addv3_ops[] = { { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_addx_ops[] = { @@ -102,21 +102,21 @@ static const CGEN_OPINST sfmt_addx_ops[] = { { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_bc8_ops[] = { { INPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 }, { INPUT, "disp8", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP8), 0, COND_REF }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_bc24_ops[] = { { INPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 }, { INPUT, "disp24", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP24), 0, COND_REF }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_beq_ops[] = { @@ -124,14 +124,14 @@ static const CGEN_OPINST sfmt_beq_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_beqz_ops[] = { { INPUT, "disp16", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP16), 0, COND_REF }, { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_bl8_ops[] = { @@ -139,7 +139,7 @@ static const CGEN_OPINST sfmt_bl8_ops[] = { { INPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 }, { OUTPUT, "h_gr_SI_14", HW_H_GR, CGEN_MODE_SI, 0, 14, 0 }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_bl24_ops[] = { @@ -147,7 +147,7 @@ static const CGEN_OPINST sfmt_bl24_ops[] = { { INPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 }, { OUTPUT, "h_gr_SI_14", HW_H_GR, CGEN_MODE_SI, 0, 14, 0 }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_bcl8_ops[] = { @@ -156,7 +156,7 @@ static const CGEN_OPINST sfmt_bcl8_ops[] = { { INPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF }, { OUTPUT, "h_gr_SI_14", HW_H_GR, CGEN_MODE_SI, 0, 14, COND_REF }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_bcl24_ops[] = { @@ -165,53 +165,53 @@ static const CGEN_OPINST sfmt_bcl24_ops[] = { { INPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF }, { OUTPUT, "h_gr_SI_14", HW_H_GR, CGEN_MODE_SI, 0, 14, COND_REF }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_bra8_ops[] = { { INPUT, "disp8", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP8), 0, 0 }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_bra24_ops[] = { { INPUT, "disp24", HW_H_IADDR, CGEN_MODE_USI, OP_ENT (DISP24), 0, 0 }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_cmp_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_cmpi_ops[] = { { INPUT, "simm16", HW_H_SINT, CGEN_MODE_INT, OP_ENT (SIMM16), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_cmpz_ops[] = { { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_div_ops[] = { { INPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, COND_REF }, { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, COND_REF }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_jc_ops[] = { { INPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 }, { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, COND_REF }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, COND_REF }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_jl_ops[] = { @@ -219,20 +219,20 @@ static const CGEN_OPINST sfmt_jl_ops[] = { { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "h_gr_SI_14", HW_H_GR, CGEN_MODE_SI, 0, 14, 0 }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_jmp_ops[] = { { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_ld_ops[] = { { INPUT, "h_memory_SI_sr", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, 0 }, { INPUT, "sr", HW_H_GR, CGEN_MODE_USI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_ld_d_ops[] = { @@ -240,14 +240,14 @@ static const CGEN_OPINST sfmt_ld_d_ops[] = { { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 }, { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_ldb_ops[] = { { INPUT, "h_memory_QI_sr", HW_H_MEMORY, CGEN_MODE_QI, 0, 0, 0 }, { INPUT, "sr", HW_H_GR, CGEN_MODE_USI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_ldb_d_ops[] = { @@ -255,14 +255,14 @@ static const CGEN_OPINST sfmt_ldb_d_ops[] = { { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 }, { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_ldh_ops[] = { { INPUT, "h_memory_HI_sr", HW_H_MEMORY, CGEN_MODE_HI, 0, 0, 0 }, { INPUT, "sr", HW_H_GR, CGEN_MODE_USI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_ldh_d_ops[] = { @@ -270,7 +270,7 @@ static const CGEN_OPINST sfmt_ldh_d_ops[] = { { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 }, { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_ld_plus_ops[] = { @@ -278,25 +278,25 @@ static const CGEN_OPINST sfmt_ld_plus_ops[] = { { INPUT, "sr", HW_H_GR, CGEN_MODE_USI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, { OUTPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_ld24_ops[] = { { INPUT, "uimm24", HW_H_ADDR, CGEN_MODE_USI, OP_ENT (UIMM24), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_ldi8_ops[] = { { INPUT, "simm8", HW_H_SINT, CGEN_MODE_INT, OP_ENT (SIMM8), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_ldi16_ops[] = { { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_lock_ops[] = { @@ -304,7 +304,7 @@ static const CGEN_OPINST sfmt_lock_ops[] = { { INPUT, "sr", HW_H_GR, CGEN_MODE_USI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, { OUTPUT, "h_lock_BI", HW_H_LOCK, CGEN_MODE_BI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_machi_ops[] = { @@ -312,7 +312,7 @@ static const CGEN_OPINST sfmt_machi_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_machi_a_ops[] = { @@ -320,82 +320,82 @@ static const CGEN_OPINST sfmt_machi_a_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "acc", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACC), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_mulhi_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_mulhi_a_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "acc", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACC), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_mv_ops[] = { { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_mvfachi_ops[] = { { INPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_mvfachi_a_ops[] = { { INPUT, "accs", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACCS), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_mvfc_ops[] = { { INPUT, "scr", HW_H_CR, CGEN_MODE_USI, OP_ENT (SCR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_mvtachi_ops[] = { { INPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 }, { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, { OUTPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_mvtachi_a_ops[] = { { INPUT, "accs", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACCS), 0, 0 }, { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, { OUTPUT, "accs", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACCS), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_mvtc_ops[] = { { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dcr", HW_H_CR, CGEN_MODE_USI, OP_ENT (DCR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_nop_ops[] = { - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_rac_ops[] = { { INPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 }, { OUTPUT, "accum", HW_H_ACCUM, CGEN_MODE_DI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_rac_dsi_ops[] = { { INPUT, "accs", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACCS), 0, 0 }, { INPUT, "imm1", HW_H_UINT, CGEN_MODE_INT, OP_ENT (IMM1), 0, 0 }, { OUTPUT, "accd", HW_H_ACCUMS, CGEN_MODE_DI, OP_ENT (ACCD), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_rte_ops[] = { @@ -407,34 +407,34 @@ static const CGEN_OPINST sfmt_rte_ops[] = { { OUTPUT, "h_cr_USI_6", HW_H_CR, CGEN_MODE_USI, 0, 6, 0 }, { OUTPUT, "h_psw_UQI", HW_H_PSW, CGEN_MODE_UQI, 0, 0, 0 }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_USI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_seth_ops[] = { { INPUT, "hi16", HW_H_HI16, CGEN_MODE_SI, OP_ENT (HI16), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_sll3_ops[] = { { INPUT, "simm16", HW_H_SINT, CGEN_MODE_SI, OP_ENT (SIMM16), 0, 0 }, { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_slli_ops[] = { { INPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, { INPUT, "uimm5", HW_H_UINT, CGEN_MODE_INT, OP_ENT (UIMM5), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_st_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_USI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "h_memory_SI_src2", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_st_d_ops[] = { @@ -442,14 +442,14 @@ static const CGEN_OPINST sfmt_st_d_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "h_memory_SI_add__DFLT_src2_slo16", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_stb_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_QI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_USI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "h_memory_QI_src2", HW_H_MEMORY, CGEN_MODE_QI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_stb_d_ops[] = { @@ -457,14 +457,14 @@ static const CGEN_OPINST sfmt_stb_d_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_QI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "h_memory_QI_add__DFLT_src2_slo16", HW_H_MEMORY, CGEN_MODE_QI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_sth_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_HI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_USI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "h_memory_HI_src2", HW_H_MEMORY, CGEN_MODE_HI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_sth_d_ops[] = { @@ -472,7 +472,7 @@ static const CGEN_OPINST sfmt_sth_d_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_HI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "h_memory_HI_add__DFLT_src2_slo16", HW_H_MEMORY, CGEN_MODE_HI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_st_plus_ops[] = { @@ -480,7 +480,23 @@ static const CGEN_OPINST sfmt_st_plus_ops[] = { { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "h_memory_SI_new_src2", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, 0 }, { OUTPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } +}; + +static const CGEN_OPINST sfmt_sth_plus_ops[] = { + { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, + { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, + { OUTPUT, "h_memory_HI_new_src2", HW_H_MEMORY, CGEN_MODE_HI, 0, 0, 0 }, + { OUTPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } +}; + +static const CGEN_OPINST sfmt_stb_plus_ops[] = { + { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, + { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, + { OUTPUT, "h_memory_QI_new_src2", HW_H_MEMORY, CGEN_MODE_QI, 0, 0, 0 }, + { OUTPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_trap_ops[] = { @@ -495,7 +511,7 @@ static const CGEN_OPINST sfmt_trap_ops[] = { { OUTPUT, "h_cr_USI_6", HW_H_CR, CGEN_MODE_USI, 0, 6, 0 }, { OUTPUT, "h_psw_UQI", HW_H_PSW, CGEN_MODE_UQI, 0, 0, 0 }, { OUTPUT, "pc", HW_H_PC, CGEN_MODE_SI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_unlock_ops[] = { @@ -504,27 +520,27 @@ static const CGEN_OPINST sfmt_unlock_ops[] = { { INPUT, "src2", HW_H_GR, CGEN_MODE_USI, OP_ENT (SRC2), 0, COND_REF }, { OUTPUT, "h_lock_BI", HW_H_LOCK, CGEN_MODE_BI, 0, 0, 0 }, { OUTPUT, "h_memory_SI_src2", HW_H_MEMORY, CGEN_MODE_SI, 0, 0, COND_REF }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_satb_ops[] = { { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_sat_ops[] = { { INPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 }, { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, COND_REF }, { OUTPUT, "dr", HW_H_GR, CGEN_MODE_SI, OP_ENT (DR), 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_sadd_ops[] = { { INPUT, "h_accums_DI_0", HW_H_ACCUMS, CGEN_MODE_DI, 0, 0, 0 }, { INPUT, "h_accums_DI_1", HW_H_ACCUMS, CGEN_MODE_DI, 0, 1, 0 }, { OUTPUT, "h_accums_DI_0", HW_H_ACCUMS, CGEN_MODE_DI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_macwu1_ops[] = { @@ -532,19 +548,48 @@ static const CGEN_OPINST sfmt_macwu1_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "h_accums_DI_1", HW_H_ACCUMS, CGEN_MODE_DI, 0, 1, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_mulwu1_ops[] = { { INPUT, "src1", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC1), 0, 0 }, { INPUT, "src2", HW_H_GR, CGEN_MODE_SI, OP_ENT (SRC2), 0, 0 }, { OUTPUT, "h_accums_DI_1", HW_H_ACCUMS, CGEN_MODE_DI, 0, 1, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; static const CGEN_OPINST sfmt_sc_ops[] = { { INPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 }, - { END } + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } +}; + +static const CGEN_OPINST sfmt_clrpsw_ops[] = { + { INPUT, "h_cr_USI_0", HW_H_CR, CGEN_MODE_USI, 0, 0, 0 }, + { INPUT, "uimm8", HW_H_UINT, CGEN_MODE_BI, OP_ENT (UIMM8), 0, 0 }, + { OUTPUT, "h_cr_USI_0", HW_H_CR, CGEN_MODE_USI, 0, 0, 0 }, + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } +}; + +static const CGEN_OPINST sfmt_setpsw_ops[] = { + { INPUT, "uimm8", HW_H_UINT, CGEN_MODE_USI, OP_ENT (UIMM8), 0, 0 }, + { OUTPUT, "h_cr_USI_0", HW_H_CR, CGEN_MODE_USI, 0, 0, 0 }, + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } +}; + +static const CGEN_OPINST sfmt_bset_ops[] = { + { INPUT, "h_memory_QI_add__DFLT_sr_slo16", HW_H_MEMORY, CGEN_MODE_QI, 0, 0, 0 }, + { INPUT, "slo16", HW_H_SLO16, CGEN_MODE_INT, OP_ENT (SLO16), 0, 0 }, + { INPUT, "sr", HW_H_GR, CGEN_MODE_SI, OP_ENT (SR), 0, 0 }, + { INPUT, "uimm3", HW_H_UINT, CGEN_MODE_UINT, OP_ENT (UIMM3), 0, 0 }, + { OUTPUT, "h_memory_QI_add__DFLT_sr_slo16", HW_H_MEMORY, CGEN_MODE_QI, 0, 0, 0 }, + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } +}; + +static const CGEN_OPINST sfmt_btst_ops[] = { + { INPUT, "sr", HW_H_GR, CGEN_MODE_USI, OP_ENT (SR), 0, 0 }, + { INPUT, "uimm3", HW_H_UINT, CGEN_MODE_UINT, OP_ENT (UIMM3), 0, 0 }, + { OUTPUT, "condbit", HW_H_COND, CGEN_MODE_BI, 0, 0, 0 }, + { END, (const char *)0, (enum cgen_hw_type)0, (enum cgen_mode)0, (enum cgen_operand_type)0, 0, 0 } }; #undef OP_ENT @@ -600,6 +645,13 @@ static const CGEN_OPINST *m32r_cgen_opinst_table[MAX_INSNS] = { & sfmt_div_ops[0], & sfmt_div_ops[0], & sfmt_div_ops[0], + & sfmt_div_ops[0], + & sfmt_div_ops[0], + & sfmt_div_ops[0], + & sfmt_div_ops[0], + & sfmt_div_ops[0], + & sfmt_div_ops[0], + & sfmt_div_ops[0], & sfmt_jc_ops[0], & sfmt_jc_ops[0], & sfmt_jl_ops[0], @@ -674,6 +726,8 @@ static const CGEN_OPINST *m32r_cgen_opinst_table[MAX_INSNS] = { & sfmt_sth_ops[0], & sfmt_sth_d_ops[0], & sfmt_st_plus_ops[0], + & sfmt_sth_plus_ops[0], + & sfmt_stb_plus_ops[0], & sfmt_st_plus_ops[0], & sfmt_add_ops[0], & sfmt_addv_ops[0], @@ -691,6 +745,11 @@ static const CGEN_OPINST *m32r_cgen_opinst_table[MAX_INSNS] = { & sfmt_macwu1_ops[0], & sfmt_sc_ops[0], & sfmt_sc_ops[0], + & sfmt_clrpsw_ops[0], + & sfmt_setpsw_ops[0], + & sfmt_bset_ops[0], + & sfmt_bset_ops[0], + & sfmt_btst_ops[0], }; /* Function to call before using the operand instance table. */ diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c index 340a084..9a80e53 100644 --- a/opcodes/mips-opc.c +++ b/opcodes/mips-opc.c @@ -517,6 +517,7 @@ const struct mips_opcode mips_builtin_opcodes[] = {"divu", "d,v,t", 0, (int) M_DIVU_3, INSN_MACRO, I1 }, {"divu", "d,v,I", 0, (int) M_DIVU_3I, INSN_MACRO, I1 }, {"dla", "t,A(b)", 0, (int) M_DLA_AB, INSN_MACRO, I3 }, +{"dlca", "t,A(b)", 0, (int) M_DLCA_AB, INSN_MACRO, I3 }, {"dli", "t,j", 0x24000000, 0xffe00000, WR_t, I3 }, /* addiu */ {"dli", "t,i", 0x34000000, 0xffe00000, WR_t, I3 }, /* ori */ {"dli", "t,I", 0, (int) M_DLI, INSN_MACRO, I3 }, @@ -640,6 +641,7 @@ const struct mips_opcode mips_builtin_opcodes[] = {"lb", "t,A(b)", 0, (int) M_LB_AB, INSN_MACRO, I1 }, {"lbu", "t,o(b)", 0x90000000, 0xfc000000, LDD|RD_b|WR_t, I1 }, {"lbu", "t,A(b)", 0, (int) M_LBU_AB, INSN_MACRO, I1 }, +{"lca", "t,A(b)", 0, (int) M_LCA_AB, INSN_MACRO, I1 }, {"ld", "t,o(b)", 0xdc000000, 0xfc000000, WR_t|RD_b, I3 }, {"ld", "t,o(b)", 0, (int) M_LD_OB, INSN_MACRO, I1 }, {"ld", "t,A(b)", 0, (int) M_LD_AB, INSN_MACRO, I1 }, diff --git a/opcodes/mmix-opc.c b/opcodes/mmix-opc.c index 76dc5d8..8d553e2 100644 --- a/opcodes/mmix-opc.c +++ b/opcodes/mmix-opc.c @@ -1,5 +1,5 @@ /* mmix-opc.c -- MMIX opcode table - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2003 Free Software Foundation, Inc. Written by Hans-Peter Nilsson (hp@bitrange.com) This file is part of GDB, GAS, and the GNU binutils. @@ -227,7 +227,8 @@ const struct mmix_opcode mmix_opcodes[] = {"prego", Z (0x9c), OP (x_regs_z), N}, {"ldunc", Z (0x96), OP (regs_z_opt), MO}, - {"go", Z (0x9e), OP (regs_z_opt), B}, + {"go", Z (GO_INSN_BYTE), + OP (regs_z_opt), B}, {"stb", Z (0xa0), OP (regs_z_opt), MB}, {"stt", Z (0xa8), OP (regs_z_opt), MT}, @@ -251,7 +252,8 @@ const struct mmix_opcode mmix_opcodes[] = {"syncid", Z (0xbc), OP (x_regs_z), M}, {"stunc", Z (0xb6), OP (regs_z_opt), MO}, - {"pushgo", Z (0xbe), OP (pushgo), J}, + {"pushgo", Z (PUSHGO_INSN_BYTE), + OP (pushgo), J}, /* Synonym for OR with a zero Z. */ {"set", O (0xc1) @@ -287,16 +289,20 @@ const struct mmix_opcode mmix_opcodes[] = {"ormh", O (0xe9), OP (reg_yz), N}, {"setml", O (0xe2), OP (reg_yz), N}, - {"setl", O (0xe3), OP (reg_yz), N}, + {"setl", O (SETL_INSN_BYTE), + OP (reg_yz), N}, {"orml", O (0xea), OP (reg_yz), N}, {"orl", O (0xeb), OP (reg_yz), N}, - {"inch", O (0xe4), OP (reg_yz), N}, - {"incmh", O (0xe5), OP (reg_yz), N}, + {"inch", O (INCH_INSN_BYTE), + OP (reg_yz), N}, + {"incmh", O (INCMH_INSN_BYTE), + OP (reg_yz), N}, {"andnh", O (0xec), OP (reg_yz), N}, {"andnmh", O (0xed), OP (reg_yz), N}, - {"incml", O (0xe6), OP (reg_yz), N}, + {"incml", O (INCML_INSN_BYTE), + OP (reg_yz), N}, {"incl", O (0xe7), OP (reg_yz), N}, {"andnml", O (0xee), OP (reg_yz), N}, {"andnl", O (0xef), OP (reg_yz), N}, @@ -314,7 +320,8 @@ const struct mmix_opcode mmix_opcodes[] = {"geta", Z (0xf4), OP (regaddr), N}, {"sync", O (0xfc), OP (sync), N}, - {"swym", O (0xfd), OP (xyz_opt), N}, + {"swym", O (SWYM_INSN_BYTE), + OP (xyz_opt), N}, {"put", Z (0xf6) | 0xff00, OP (put), N}, {"get", O (0xfe) | 0xffe0, OP (get), N}, diff --git a/opcodes/openrisc-asm.c b/opcodes/openrisc-asm.c index 9f6ee32..ad97790 100644 --- a/opcodes/openrisc-asm.c +++ b/opcodes/openrisc-asm.c @@ -60,7 +60,7 @@ long openrisc_sign_extend_16bit (value) long value; { - return (long) (short) value; + return ((value & 0xffff) ^ 0x8000) - 0x8000; } /* Handle hi(). */ @@ -74,15 +74,16 @@ parse_hi16 (cd, strp, opindex, valuep) { const char *errmsg; enum cgen_parse_operand_result result_type; - bfd_vma value; + unsigned long ret; if (**strp == '#') ++*strp; if (strncasecmp (*strp, "hi(", 3) == 0) { - *strp += 3; + bfd_vma value; + *strp += 3; #if 0 errmsg = cgen_parse_signed_integer (cd, strp, opindex, valuep); if (errmsg != NULL) @@ -92,23 +93,31 @@ parse_hi16 (cd, strp, opindex, valuep) errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16, &result_type, &value); if (**strp != ')') - return "missing `)'"; + return _("missing `)'"); + ++*strp; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) value >>= 16; - *valuep = (long) (short) value; - - return errmsg; + ret = value; } else { if (**strp == '-') - errmsg = cgen_parse_signed_integer (cd, strp, opindex, (long *) &value); + { + long value; + errmsg = cgen_parse_signed_integer (cd, strp, opindex, &value); + ret = value; + } else - errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, (unsigned long *) &value); + { + unsigned long value; + errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, &value); + ret = value; + } } - *valuep = (long) (short) (value & 0xffff); + + *valuep = ((ret & 0xffff) ^ 0x8000) - 0x8000; return errmsg; } @@ -123,15 +132,16 @@ parse_lo16 (cd, strp, opindex, valuep) { const char *errmsg; enum cgen_parse_operand_result result_type; - bfd_vma value; + unsigned long ret; if (**strp == '#') ++*strp; if (strncasecmp (*strp, "lo(", 3) == 0) { - *strp += 3; + bfd_vma value; + *strp += 3; #if 0 errmsg = cgen_parse_signed_integer (cd, strp, opindex, valuep); if (errmsg != NULL) @@ -142,21 +152,28 @@ parse_lo16 (cd, strp, opindex, valuep) errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16, &result_type, &value); if (**strp != ')') - return "missing `)'"; - ++*strp; - if (errmsg == NULL - && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) - value &= 0xffff; - *valuep = (long) (short) value; + return _("missing `)'"); - return errmsg; + ++*strp; + ret = value; } - - if (**strp == '-') - errmsg = cgen_parse_signed_integer (cd, strp, opindex, (long *) &value); else - errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, (unsigned long *) &value); - *valuep = (long) (short) (value & 0xffff); + { + if (**strp == '-') + { + long value; + errmsg = cgen_parse_signed_integer (cd, strp, opindex, &value); + ret = value; + } + else + { + unsigned long value; + errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, &value); + ret = value; + } + } + + *valuep = ((ret & 0xffff) ^ 0x8000) - 0x8000; return errmsg; } diff --git a/opcodes/pj-opc.c b/opcodes/pj-opc.c index 68ca05e..218496d 100644 --- a/opcodes/pj-opc.c +++ b/opcodes/pj-opc.c @@ -1,5 +1,5 @@ /* pj-opc.c -- Definitions for picoJava opcodes. - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright 1999, 2000, 2002 Free Software Foundation, Inc. Contributed by Steve Chamberlain of Transmeta (sac@pobox.com). This program is free software; you can redistribute it and/or modify diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c index c37943b..d011edf 100644 --- a/opcodes/ppc-opc.c +++ b/opcodes/ppc-opc.c @@ -344,7 +344,7 @@ const struct powerpc_operand powerpc_operands[] = /* The MO field in an mbar instruction. */ #define MO MB6 + 1 - { 5, 21, 0, 0, 0 }, + { 5, 21, 0, 0, PPC_OPERAND_OPTIONAL }, /* The NB field in an X form instruction. The value 32 is stored as 0. */ @@ -384,8 +384,12 @@ const struct powerpc_operand powerpc_operands[] = #define RAS RAM + 1 { 5, 16, insert_ras, 0, PPC_OPERAND_GPR }, + /* The RA field of the tlbwe instruction, which is optional. */ +#define RAO RAS + 1 + { 5, 16, 0, 0, PPC_OPERAND_GPR|PPC_OPERAND_OPTIONAL }, + /* The RB field in an X, XO, M, or MDS form instruction. */ -#define RB RAS + 1 +#define RB RAO + 1 #define RB_MASK (0x1f << 11) { 5, 11, 0, 0, PPC_OPERAND_GPR }, @@ -413,8 +417,12 @@ const struct powerpc_operand powerpc_operands[] = #define RTQ RSQ + 1 { 5, 21, insert_rtq, 0, PPC_OPERAND_GPR }, + /* The RS field of the tlbwe instruction, which is optional. */ +#define RSO RTQ + 1 + { 5, 21, 0, 0, PPC_OPERAND_GPR|PPC_OPERAND_OPTIONAL }, + /* The SH field in an X or M form instruction. */ -#define SH RTQ + 1 +#define SH RSO + 1 #define SH_MASK (0x1f << 11) { 5, 11, 0, 0, 0 }, @@ -423,8 +431,12 @@ const struct powerpc_operand powerpc_operands[] = #define SH6_MASK ((0x1f << 11) | (1 << 1)) { 6, 1, insert_sh6, extract_sh6, 0 }, + /* The SH field of the tlbwe instruction, which is optional. */ +#define SHO SH6 + 1 + { 5, 11,0, 0, PPC_OPERAND_OPTIONAL }, + /* The SI field in a D form instruction. */ -#define SI SH6 + 1 +#define SI SHO + 1 { 16, 0, 0, 0, PPC_OPERAND_SIGNED }, /* The SI field in a D form instruction when we accept a wide range @@ -548,7 +560,6 @@ const struct powerpc_operand powerpc_operands[] = and the extraction function just checks that the fields are the same. */ -/*ARGSUSED*/ static unsigned long insert_bat (unsigned long insn, long value ATTRIBUTE_UNUSED, @@ -574,7 +585,6 @@ extract_bat (unsigned long insn, and the extraction function just checks that the fields are the same. */ -/*ARGSUSED*/ static unsigned long insert_bba (unsigned long insn, long value ATTRIBUTE_UNUSED, @@ -597,7 +607,6 @@ extract_bba (unsigned long insn, /* The BD field in a B form instruction. The lower two bits are forced to zero. */ -/*ARGSUSED*/ static unsigned long insert_bd (unsigned long insn, long value, @@ -607,7 +616,6 @@ insert_bd (unsigned long insn, return insn | (value & 0xfffc); } -/*ARGSUSED*/ static long extract_bd (unsigned long insn, int dialect ATTRIBUTE_UNUSED, @@ -629,7 +637,6 @@ extract_bd (unsigned long insn, in BO field, the "a" bit is 00010 for branch on CR(BI) and 01000 for branch on CTR. We only handle the taken/not-taken hint here. */ -/*ARGSUSED*/ static unsigned long insert_bdm (unsigned long insn, long value, @@ -675,7 +682,6 @@ extract_bdm (unsigned long insn, This is like BDM, above, except that the branch is expected to be taken. */ -/*ARGSUSED*/ static unsigned long insert_bdp (unsigned long insn, long value, @@ -829,7 +835,6 @@ extract_boe (unsigned long insn, /* The DQ field in a DQ form instruction. This is like D, but the lower four bits are forced to zero. */ -/*ARGSUSED*/ static unsigned long insert_dq (unsigned long insn, long value, @@ -841,7 +846,6 @@ insert_dq (unsigned long insn, return insn | (value & 0xfff0); } -/*ARGSUSED*/ static long extract_dq (unsigned long insn, int dialect ATTRIBUTE_UNUSED, @@ -916,7 +920,6 @@ extract_ev8 (unsigned long insn, /* The DS field in a DS form instruction. This is like D, but the lower two bits are forced to zero. */ -/*ARGSUSED*/ static unsigned long insert_ds (unsigned long insn, long value, @@ -928,7 +931,6 @@ insert_ds (unsigned long insn, return insn | (value & 0xfffc); } -/*ARGSUSED*/ static long extract_ds (unsigned long insn, int dialect ATTRIBUTE_UNUSED, @@ -939,7 +941,6 @@ extract_ds (unsigned long insn, /* The DE field in a DE form instruction. */ -/*ARGSUSED*/ static unsigned long insert_de (unsigned long insn, long value, @@ -951,7 +952,6 @@ insert_de (unsigned long insn, return insn | ((value << 4) & 0xfff0); } -/*ARGSUSED*/ static long extract_de (unsigned long insn, int dialect ATTRIBUTE_UNUSED, @@ -962,7 +962,6 @@ extract_de (unsigned long insn, /* The DES field in a DES form instruction. */ -/*ARGSUSED*/ static unsigned long insert_des (unsigned long insn, long value, @@ -976,7 +975,6 @@ insert_des (unsigned long insn, return insn | ((value << 2) & 0xfff0); } -/*ARGSUSED*/ static long extract_des (unsigned long insn, int dialect ATTRIBUTE_UNUSED, @@ -1049,7 +1047,6 @@ extract_fxm (unsigned long insn, /* The LI field in an I form instruction. The lower two bits are forced to zero. */ -/*ARGSUSED*/ static unsigned long insert_li (unsigned long insn, long value, @@ -1061,7 +1058,6 @@ insert_li (unsigned long insn, return insn | (value & 0x3fffffc); } -/*ARGSUSED*/ static long extract_li (unsigned long insn, int dialect ATTRIBUTE_UNUSED, @@ -1161,7 +1157,6 @@ extract_mbe (unsigned long insn, /* The MB or ME field in an MD or MDS form instruction. The high bit is wrapped to the low end. */ -/*ARGSUSED*/ static unsigned long insert_mb6 (unsigned long insn, long value, @@ -1171,7 +1166,6 @@ insert_mb6 (unsigned long insn, return insn | ((value & 0x1f) << 6) | (value & 0x20); } -/*ARGSUSED*/ static long extract_mb6 (unsigned long insn, int dialect ATTRIBUTE_UNUSED, @@ -1196,7 +1190,6 @@ insert_nb (unsigned long insn, return insn | ((value & 0x1f) << 11); } -/*ARGSUSED*/ static long extract_nb (unsigned long insn, int dialect ATTRIBUTE_UNUSED, @@ -1215,7 +1208,6 @@ extract_nb (unsigned long insn, invalid, since we never want to recognize an instruction which uses a field of this type. */ -/*ARGSUSED*/ static unsigned long insert_nsi (unsigned long insn, long value, @@ -1267,7 +1259,6 @@ insert_ram (unsigned long insn, /* The RA field in the DQ form lq instruction, which has special value restrictions. */ -/*ARGSUSED*/ static unsigned long insert_raq (unsigned long insn, long value, @@ -1302,7 +1293,6 @@ insert_ras (unsigned long insn, function just copies the BT field into the BA field, and the extraction function just checks that the fields are the same. */ -/*ARGSUSED*/ static unsigned long insert_rbs (unsigned long insn, long value ATTRIBUTE_UNUSED, @@ -1325,7 +1315,6 @@ extract_rbs (unsigned long insn, /* The RT field of the DQ form lq instruction, which has special value restrictions. */ -/*ARGSUSED*/ static unsigned long insert_rtq (unsigned long insn, long value, @@ -1340,7 +1329,6 @@ insert_rtq (unsigned long insn, /* The RS field of the DS form stq instruction, which has special value restrictions. */ -/*ARGSUSED*/ static unsigned long insert_rsq (unsigned long insn, long value ATTRIBUTE_UNUSED, @@ -1354,7 +1342,6 @@ insert_rsq (unsigned long insn, /* The SH field in an MD form instruction. This is split. */ -/*ARGSUSED*/ static unsigned long insert_sh6 (unsigned long insn, long value, @@ -1364,7 +1351,6 @@ insert_sh6 (unsigned long insn, return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4); } -/*ARGSUSED*/ static long extract_sh6 (unsigned long insn, int dialect ATTRIBUTE_UNUSED, @@ -4282,8 +4268,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "tlbwehi", XTLB(31,978,0), XTLB_MASK, PPC403, { RT, RA } }, { "tlbwelo", XTLB(31,978,1), XTLB_MASK, PPC403, { RT, RA } }, -{ "tlbwe", X(31,978), X_MASK, BOOKE, { 0 } }, -{ "tlbwe", X(31,978), X_MASK, PPC403, { RS, RA, SH } }, +{ "tlbwe", X(31,978), X_MASK, PPC403|BOOKE, { RSO, RAO, SHO } }, { "tlbld", X(31,978), XRTRA_MASK, PPC, { RB } }, { "icbi", X(31,982), XRT_MASK, PPC, { RA, RB } }, diff --git a/opcodes/sh-dis.c b/opcodes/sh-dis.c index a23110f..c0e1a2e 100644 --- a/opcodes/sh-dis.c +++ b/opcodes/sh-dis.c @@ -49,18 +49,28 @@ print_movxy (op, rn, rm, fprintf_fn, stream) switch (op->arg[n]) { case A_IND_N: + case AX_IND_N: + case AXY_IND_N: + case AY_IND_N: + case AYX_IND_N: fprintf_fn (stream, "@r%d", rn); break; case A_INC_N: + case AX_INC_N: + case AXY_INC_N: + case AY_INC_N: + case AYX_INC_N: fprintf_fn (stream, "@r%d+", rn); break; - case A_PMOD_N: + case AX_PMOD_N: + case AXY_PMOD_N: fprintf_fn (stream, "@r%d+r8", rn); break; - case A_PMODY_N: + case AY_PMOD_N: + case AYX_PMOD_N: fprintf_fn (stream, "@r%d+r9", rn); break; - case DSP_REG_M: + case DSP_REG_A_M: fprintf_fn (stream, "a%c", '0' + rm); break; case DSP_REG_X: @@ -69,6 +79,26 @@ print_movxy (op, rn, rm, fprintf_fn, stream) case DSP_REG_Y: fprintf_fn (stream, "y%c", '0' + rm); break; + case DSP_REG_AX: + fprintf_fn (stream, "%c%c", + (rm & 1) ? 'x' : 'a', + (rm & 2) ? '1' : '0'); + break; + case DSP_REG_XY: + fprintf_fn (stream, "%c%c", + (rm & 1) ? 'y' : 'x', + (rm & 2) ? '1' : '0'); + break; + case DSP_REG_AY: + fprintf_fn (stream, "%c%c", + (rm & 2) ? 'y' : 'a', + (rm & 1) ? '1' : '0'); + break; + case DSP_REG_YX: + fprintf_fn (stream, "%c%c", + (rm & 2) ? 'x' : 'y', + (rm & 1) ? '1' : '0'); + break; default: abort (); } @@ -102,7 +132,41 @@ print_insn_ddt (insn, info) /* Check if either the x or y part is invalid. */ if (((insn & 0xc) == 0 && (insn & 0x2a0)) || ((insn & 3) == 0 && (insn & 0x150))) - fprintf_fn (stream, ".word 0x%x", insn); + if (info->mach != bfd_mach_sh_dsp + && info->mach != bfd_mach_sh3_dsp) + { + static const sh_opcode_info *first_movx, *first_movy; + const sh_opcode_info *op; + int is_movy; + + if (! first_movx) + { + for (first_movx = sh_table; first_movx->nibbles[1] != MOVX_NOPY;) + first_movx++; + for (first_movy = first_movx; first_movy->nibbles[1] != MOVY_NOPX;) + first_movy++; + } + + is_movy = ((insn & 3) != 0); + + if (is_movy) + op = first_movy; + else + op = first_movx; + + while (op->nibbles[2] != (unsigned) ((insn >> 4) & 3) + || op->nibbles[3] != (unsigned) (insn & 0xf)) + op++; + + print_movxy (op, + (4 * ((insn & (is_movy ? 0x200 : 0x100)) == 0) + + 2 * is_movy + + 1 * ((insn & (is_movy ? 0x100 : 0x200)) != 0)), + (insn >> 6) & 3, + fprintf_fn, stream); + } + else + fprintf_fn (stream, ".word 0x%x", insn); else { static const sh_opcode_info *first_movx, *first_movy; @@ -191,6 +255,7 @@ print_insn_ppi (field_b, info) fprintf_ftype fprintf_fn = info->fprintf_func; void *stream = info->stream; unsigned int nib1, nib2, nib3; + unsigned int altnib1, nib4; char *dc = NULL; const sh_opcode_info *op; @@ -217,6 +282,16 @@ print_insn_ppi (field_b, info) sy_tab[(field_b >> 4) & 3], du_tab[(field_b >> 0) & 3]); } + else if ((field_b & 0xf0) == 0x10 + && info->mach != bfd_mach_sh_dsp + && info->mach != bfd_mach_sh3_dsp) + { + fprintf_fn (stream, "pclr %s \t", du_tab[(field_b >> 0) & 3]); + } + else if ((field_b & 0xf3) != 0) + { + fprintf_fn (stream, ".word 0x%x\t", field_b); + } fprintf_fn (stream, "pmuls%c%s,%s,%s", field_b & 0x2000 ? ' ' : '\t', se_tab[(field_b >> 10) & 3], @@ -228,6 +303,7 @@ print_insn_ppi (field_b, info) nib1 = PPIC; nib2 = field_b >> 12 & 0xf; nib3 = field_b >> 8 & 0xf; + nib4 = field_b >> 4 & 0xf; switch (nib3 & 0x3) { case 0: @@ -246,14 +322,41 @@ print_insn_ppi (field_b, info) nib3 -= 2; break; } + if (nib1 == PPI3) + altnib1 = PPI3NC; + else + altnib1 = nib1; for (op = sh_table; op->name; op++) { - if (op->nibbles[1] == nib1 + if ((op->nibbles[1] == nib1 || op->nibbles[1] == altnib1) && op->nibbles[2] == nib2 && op->nibbles[3] == nib3) { int n; + switch (op->nibbles[4]) + { + case HEX_0: + break; + case HEX_XX00: + if ((nib4 & 3) != 0) + continue; + break; + case HEX_1: + if ((nib4 & 3) != 1) + continue; + break; + case HEX_00YY: + if ((nib4 & 0xc) != 0) + continue; + break; + case HEX_4: + if ((nib4 & 0xc) != 4) + continue; + break; + default: + abort (); + } fprintf_fn (stream, "%s%s\t", dc, op->name); for (n = 0; n < 3 && op->arg[n] != A_END; n++) { @@ -331,8 +434,16 @@ print_insn_sh (memaddr, info) target_arch = arch_sh3e; break; case bfd_mach_sh4: + case bfd_mach_sh4_nofpu: target_arch = arch_sh4; break; + case bfd_mach_sh4a: + case bfd_mach_sh4a_nofpu: + target_arch = arch_sh4a; + break; + case bfd_mach_sh4al_dsp: + target_arch = arch_sh4al_dsp; + break; case bfd_mach_sh5: #ifdef INCLUDE_SHMEDIA status = print_insn_sh64 (memaddr, info); @@ -514,18 +625,21 @@ print_insn_sh (memaddr, info) fprintf_fn (stream, "r%d", rn); break; case A_INC_N: + case AS_INC_N: fprintf_fn (stream, "@r%d+", rn); break; case A_DEC_N: + case AS_DEC_N: fprintf_fn (stream, "@-r%d", rn); break; case A_IND_N: + case AS_IND_N: fprintf_fn (stream, "@r%d", rn); break; case A_DISP_REG_N: fprintf_fn (stream, "@(%d,r%d)", imm, rn); break; - case A_PMOD_N: + case AS_PMOD_N: fprintf_fn (stream, "@r%d+r8", rn); break; case A_REG_M: diff --git a/opcodes/sh-opc.h b/opcodes/sh-opc.h index f415e5e..b9e103c 100644 --- a/opcodes/sh-opc.h +++ b/opcodes/sh-opc.h @@ -34,6 +34,8 @@ typedef enum HEX_D, HEX_E, HEX_F, + HEX_XX00, + HEX_00YY, REG_N, REG_M, SDT_REG_N, @@ -60,9 +62,12 @@ typedef enum NOPY, MOVX, MOVY, + MOVX_NOPY, + MOVY_NOPX, PSH, PMUL, PPI3, + PPI3NC, PDC, PPIC, REPEAT @@ -88,8 +93,6 @@ typedef enum A_INC_N, A_IND_M, A_IND_N, - A_PMOD_N, - A_PMODY_N, A_IND_R0_REG_M, A_IND_R0_REG_N, A_MACH, @@ -113,6 +116,27 @@ typedef enum DSP_REG_E, DSP_REG_F, DSP_REG_G, + DSP_REG_A_M, + DSP_REG_AX, + DSP_REG_XY, + DSP_REG_AY, + DSP_REG_YX, + AX_INC_N, + AY_INC_N, + AXY_INC_N, + AYX_INC_N, + AX_IND_N, + AY_IND_N, + AXY_IND_N, + AYX_IND_N, + AX_PMOD_N, + AXY_PMOD_N, + AY_PMOD_N, + AYX_PMOD_N, + AS_DEC_N, + AS_INC_N, + AS_IND_N, + AS_PMOD_N, A_A0, A_X0, A_X1, @@ -156,24 +180,34 @@ sh_dsp_reg_nums; #define arch_sh3e 0x0008 #define arch_sh4 0x0010 #define arch_sh2e 0x0020 +#define arch_sh4a 0x0040 #define arch_sh_dsp 0x0100 #define arch_sh3_dsp 0x0200 +#define arch_sh4al_dsp 0x0400 +#define arch_sh4_nofpu 0x1000 +#define arch_sh4a_nofpu 0x2000 #define arch_sh1_up (arch_sh1 | arch_sh2_up) #define arch_sh2_up (arch_sh2 | arch_sh2e_up | arch_sh3_up | arch_sh_dsp) #define arch_sh2e_up (arch_sh2e | arch_sh3e_up) -#define arch_sh3_up (arch_sh3 | arch_sh3e_up | arch_sh3_dsp) +#define arch_sh3_up (arch_sh3 | arch_sh3e_up | arch_sh3_dsp_up \ + | arch_sh4_nofp_up) #define arch_sh3e_up (arch_sh3e | arch_sh4_up) -#define arch_sh4_up arch_sh4 +#define arch_sh4_up (arch_sh4 | arch_sh4a_up) +#define arch_sh4a_up (arch_sh4a) #define arch_sh_dsp_up (arch_sh_dsp | arch_sh3_dsp_up) -#define arch_sh3_dsp_up arch_sh3_dsp +#define arch_sh3_dsp_up (arch_sh3_dsp | arch_sh4al_dsp_up) +#define arch_sh4al_dsp_up (arch_sh4al_dsp) + +#define arch_sh4_nofp_up (arch_sh4_nofpu | arch_sh4_up | arch_sh4a_nofp_up) +#define arch_sh4a_nofp_up (arch_sh4a_nofpu | arch_sh4a_up | arch_sh4al_dsp_up) typedef struct { char *name; sh_arg_type arg[4]; - sh_nibble_type nibbles[4]; + sh_nibble_type nibbles[5]; int arch; } sh_opcode_info; @@ -211,6 +245,8 @@ const sh_opcode_info sh_table[] = /* 10001111i8p1.... bf/s <bdisp8> */{"bf/s",{A_BDISP8},{HEX_8,HEX_F,BRANCH_8}, arch_sh2_up}, +/* 0000000010001000 clrdmxy */{"clrdmxy",{0},{HEX_0,HEX_0,HEX_8,HEX_8}, arch_sh4al_dsp_up}, + /* 0000000000101000 clrmac */{"clrmac",{0},{HEX_0,HEX_0,HEX_2,HEX_8}, arch_sh1_up}, /* 0000000001001000 clrs */{"clrs",{0},{HEX_0,HEX_0,HEX_4,HEX_8}, arch_sh1_up}, @@ -249,6 +285,8 @@ const sh_opcode_info sh_table[] = /* 0110nnnnmmmm1101 extu.w <REG_M>,<REG_N>*/{"extu.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_D}, arch_sh1_up}, +/* 0000nnnn11100011 icbi @<REG_N> */{"icbi",{A_IND_N},{HEX_0,REG_N,HEX_E,HEX_3}, arch_sh4a_nofp_up}, + /* 0100nnnn00101011 jmp @<REG_N> */{"jmp",{A_IND_N},{HEX_4,REG_N,HEX_2,HEX_B}, arch_sh1_up}, /* 0100nnnn00001011 jsr @<REG_N> */{"jsr",{A_IND_N},{HEX_4,REG_N,HEX_0,HEX_B}, arch_sh1_up}, @@ -269,7 +307,7 @@ const sh_opcode_info sh_table[] = /* 0100nnnn01001110 ldc <REG_N>,SPC */{"ldc",{A_REG_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_E}, arch_sh3_up}, -/* 0100nnnn11111010 ldc <REG_N>,DBR */{"ldc",{A_REG_N,A_DBR},{HEX_4,REG_N,HEX_F,HEX_A}, arch_sh4_up}, +/* 0100nnnn11111010 ldc <REG_N>,DBR */{"ldc",{A_REG_N,A_DBR},{HEX_4,REG_N,HEX_F,HEX_A}, arch_sh4_nofp_up}, /* 0100nnnn1xxx1110 ldc <REG_N>,Rn_BANK */{"ldc",{A_REG_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_E}, arch_sh3_up}, @@ -289,10 +327,13 @@ const sh_opcode_info sh_table[] = /* 0100nnnn01000111 ldc.l @<REG_N>+,SPC */{"ldc.l",{A_INC_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_7}, arch_sh3_up}, -/* 0100nnnn11110110 ldc.l @<REG_N>+,DBR */{"ldc.l",{A_INC_N,A_DBR},{HEX_4,REG_N,HEX_F,HEX_6}, arch_sh4_up}, +/* 0100nnnn11110110 ldc.l @<REG_N>+,DBR */{"ldc.l",{A_INC_N,A_DBR},{HEX_4,REG_N,HEX_F,HEX_6}, arch_sh4_nofp_up}, /* 0100nnnn1xxx0111 ldc.l <REG_N>,Rn_BANK */{"ldc.l",{A_INC_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_7}, arch_sh3_up}, +/* 0100mmmm00110100 ldrc <REG_M> */{"ldrc",{A_REG_M},{HEX_4,REG_M,HEX_3,HEX_4}, arch_sh4al_dsp_up}, +/* 10001010i8*1.... ldrc #<imm> */{"ldrc",{A_IMM},{HEX_8,HEX_A,IMM0_8}, arch_sh4al_dsp_up}, + /* 10001110i8p2.... ldre @(<disp>,PC) */{"ldre",{A_DISP_PC},{HEX_8,HEX_E,PCRELIMM_8BY2}, arch_sh_dsp_up}, /* 10001100i8p2.... ldrs @(<disp>,PC) */{"ldrs",{A_DISP_PC},{HEX_8,HEX_C,PCRELIMM_8BY2}, arch_sh_dsp_up}, @@ -414,11 +455,16 @@ const sh_opcode_info sh_table[] = /* 11000001i8*2.... mov.w R0,@(<disp>,GBR)*/{"mov.w",{A_R0,A_DISP_GBR},{HEX_C,HEX_1,IMM1_8BY2}, arch_sh1_up}, /* 11000111i8p4.... mova @(<disp>,PC),R0*/{"mova",{A_DISP_PC,A_R0},{HEX_C,HEX_7,PCRELIMM_8BY4}, arch_sh1_up}, -/* 0000nnnn11000011 movca.l R0,@<REG_N> */{"movca.l",{A_R0,A_IND_N},{HEX_0,REG_N,HEX_C,HEX_3}, arch_sh4_up}, +/* 0000nnnn11000011 movca.l R0,@<REG_N> */{"movca.l",{A_R0,A_IND_N},{HEX_0,REG_N,HEX_C,HEX_3}, arch_sh4_nofp_up}, +/* 0000nnnn01110011 movco.l r0,@<REG_N> */{"movco.l",{A_R0,A_IND_N},{HEX_0,REG_N,HEX_7,HEX_3}, arch_sh4a_nofp_up}, +/* 0000mmmm01100011 movli.l @<REG_M>,r0 */{"movli.l",{A_IND_M,A_R0},{HEX_0,REG_M,HEX_6,HEX_3}, arch_sh4a_nofp_up}, /* 0000nnnn00101001 movt <REG_N> */{"movt",{A_REG_N},{HEX_0,REG_N,HEX_2,HEX_9}, arch_sh1_up}, +/* 0100mmmm10101001 movua.l @<REG_M>,r0 */{"movua.l",{A_IND_M,A_R0},{HEX_4,REG_M,HEX_A,HEX_9}, arch_sh4a_nofp_up}, +/* 0100mmmm11101001 movua.l @<REG_M>+,r0 */{"movua.l",{A_INC_M,A_R0},{HEX_4,REG_M,HEX_E,HEX_9}, arch_sh4a_nofp_up}, + /* 0010nnnnmmmm1111 muls.w <REG_M>,<REG_N>*/{"muls.w",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_F}, arch_sh1_up}, /* 0010nnnnmmmm1111 muls <REG_M>,<REG_N>*/{"muls",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_F}, arch_sh1_up}, @@ -434,11 +480,11 @@ const sh_opcode_info sh_table[] = /* 0000000000001001 nop */{"nop",{0},{HEX_0,HEX_0,HEX_0,HEX_9}, arch_sh1_up}, /* 0110nnnnmmmm0111 not <REG_M>,<REG_N> */{"not",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_7}, arch_sh1_up}, -/* 0000nnnn10010011 ocbi @<REG_N> */{"ocbi",{A_IND_N},{HEX_0,REG_N,HEX_9,HEX_3}, arch_sh4_up}, +/* 0000nnnn10010011 ocbi @<REG_N> */{"ocbi",{A_IND_N},{HEX_0,REG_N,HEX_9,HEX_3}, arch_sh4_nofp_up}, -/* 0000nnnn10100011 ocbp @<REG_N> */{"ocbp",{A_IND_N},{HEX_0,REG_N,HEX_A,HEX_3}, arch_sh4_up}, +/* 0000nnnn10100011 ocbp @<REG_N> */{"ocbp",{A_IND_N},{HEX_0,REG_N,HEX_A,HEX_3}, arch_sh4_nofp_up}, -/* 0000nnnn10110011 ocbwb @<REG_N> */{"ocbwb",{A_IND_N},{HEX_0,REG_N,HEX_B,HEX_3}, arch_sh4_up}, +/* 0000nnnn10110011 ocbwb @<REG_N> */{"ocbwb",{A_IND_N},{HEX_0,REG_N,HEX_B,HEX_3}, arch_sh4_nofp_up}, /* 11001011i8*1.... or #<imm>,R0 */{"or",{A_IMM,A_R0},{HEX_C,HEX_B,IMM0_8}, arch_sh1_up}, @@ -447,7 +493,9 @@ const sh_opcode_info sh_table[] = /* 11001111i8*1.... or.b #<imm>,@(R0,GBR)*/{"or.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_F,IMM0_8}, arch_sh1_up}, -/* 0000nnnn10000011 pref @<REG_N> */{"pref",{A_IND_N},{HEX_0,REG_N,HEX_8,HEX_3}, arch_sh4_up}, +/* 0000nnnn10000011 pref @<REG_N> */{"pref",{A_IND_N},{HEX_0,REG_N,HEX_8,HEX_3}, arch_sh4_nofp_up}, + +/* 0000nnnn11010011 prefi @<REG_N> */{"prefi",{A_IND_N},{HEX_0,REG_N,HEX_D,HEX_3}, arch_sh4a_nofp_up}, /* 0100nnnn00100100 rotcl <REG_N> */{"rotcl",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_4}, arch_sh1_up}, @@ -461,6 +509,9 @@ const sh_opcode_info sh_table[] = /* 0000000000001011 rts */{"rts",{0},{HEX_0,HEX_0,HEX_0,HEX_B}, arch_sh1_up}, +/* 0000000010011000 setdmx */{"setdmx",{0},{HEX_0,HEX_0,HEX_9,HEX_8}, arch_sh4al_dsp_up}, +/* 0000000011001000 setdmy */{"setdmy",{0},{HEX_0,HEX_0,HEX_C,HEX_8}, arch_sh4al_dsp_up}, + /* 0000000001011000 sets */{"sets",{0},{HEX_0,HEX_0,HEX_5,HEX_8}, arch_sh1_up}, /* 0000000000011000 sett */{"sett",{0},{HEX_0,HEX_0,HEX_1,HEX_8}, arch_sh1_up}, @@ -514,9 +565,9 @@ const sh_opcode_info sh_table[] = /* 0000nnnn01000010 stc SPC,<REG_N> */{"stc",{A_SPC,A_REG_N},{HEX_0,REG_N,HEX_4,HEX_2}, arch_sh3_up}, -/* 0000nnnn00111010 stc SGR,<REG_N> */{"stc",{A_SGR,A_REG_N},{HEX_0,REG_N,HEX_3,HEX_A}, arch_sh4_up}, +/* 0000nnnn00111010 stc SGR,<REG_N> */{"stc",{A_SGR,A_REG_N},{HEX_0,REG_N,HEX_3,HEX_A}, arch_sh4_nofp_up}, -/* 0000nnnn11111010 stc DBR,<REG_N> */{"stc",{A_DBR,A_REG_N},{HEX_0,REG_N,HEX_F,HEX_A}, arch_sh4_up}, +/* 0000nnnn11111010 stc DBR,<REG_N> */{"stc",{A_DBR,A_REG_N},{HEX_0,REG_N,HEX_F,HEX_A}, arch_sh4_nofp_up}, /* 0000nnnn1xxx0010 stc Rn_BANK,<REG_N> */{"stc",{A_REG_B,A_REG_N},{HEX_0,REG_N,REG_B,HEX_2}, arch_sh3_up}, @@ -536,9 +587,9 @@ const sh_opcode_info sh_table[] = /* 0100nnnn00010011 stc.l GBR,@-<REG_N> */{"stc.l",{A_GBR,A_DEC_N},{HEX_4,REG_N,HEX_1,HEX_3}, arch_sh1_up}, -/* 0100nnnn00110010 stc.l SGR,@-<REG_N> */{"stc.l",{A_SGR,A_DEC_N},{HEX_4,REG_N,HEX_3,HEX_2}, arch_sh4_up}, +/* 0100nnnn00110010 stc.l SGR,@-<REG_N> */{"stc.l",{A_SGR,A_DEC_N},{HEX_4,REG_N,HEX_3,HEX_2}, arch_sh4_nofp_up}, -/* 0100nnnn11110010 stc.l DBR,@-<REG_N> */{"stc.l",{A_DBR,A_DEC_N},{HEX_4,REG_N,HEX_F,HEX_2}, arch_sh4_up}, +/* 0100nnnn11110010 stc.l DBR,@-<REG_N> */{"stc.l",{A_DBR,A_DEC_N},{HEX_4,REG_N,HEX_F,HEX_2}, arch_sh4_nofp_up}, /* 0100nnnn1xxx0011 stc.l Rn_BANK,@-<REG_N> */{"stc.l",{A_REG_B,A_DEC_N},{HEX_4,REG_N,REG_B,HEX_3}, arch_sh3_up}, @@ -596,6 +647,8 @@ const sh_opcode_info sh_table[] = /* 0110nnnnmmmm1001 swap.w <REG_M>,<REG_N>*/{"swap.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_9}, arch_sh1_up}, +/* 0000000010101011 synco */{"synco",{0},{HEX_0,HEX_0,HEX_A,HEX_B}, arch_sh4a_nofp_up}, + /* 0100nnnn00011011 tas.b @<REG_N> */{"tas.b",{A_IND_N},{HEX_4,REG_N,HEX_1,HEX_B}, arch_sh1_up}, /* 11000011i8*1.... trapa #<imm> */{"trapa",{A_IMM},{HEX_C,HEX_3,IMM0_8}, arch_sh1_up}, @@ -634,7 +687,7 @@ const sh_opcode_info sh_table[] = /* 111101nnmmmm0010 movs.w @<REG_N>+,<DSP_REG_M> */ {"movs.w",{A_INC_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_8}, arch_sh_dsp_up}, -/* 111101nnmmmm0011 movs.w @<REG_N>+r8,<DSP_REG_M> */ {"movs.w",{A_PMOD_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_C}, arch_sh_dsp_up}, +/* 111101nnmmmm0011 movs.w @<REG_N>+r8,<DSP_REG_M> */ {"movs.w",{AS_PMOD_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_C}, arch_sh_dsp_up}, /* 111101nnmmmm0100 movs.w <DSP_REG_M>,@-<REG_N> */ {"movs.w",{DSP_REG_M,A_DEC_N},{HEX_F,SDT_REG_N,REG_M,HEX_1}, arch_sh_dsp_up}, @@ -642,7 +695,7 @@ const sh_opcode_info sh_table[] = /* 111101nnmmmm0110 movs.w <DSP_REG_M>,@<REG_N>+ */ {"movs.w",{DSP_REG_M,A_INC_N},{HEX_F,SDT_REG_N,REG_M,HEX_9}, arch_sh_dsp_up}, -/* 111101nnmmmm0111 movs.w <DSP_REG_M>,@<REG_N>+r8 */ {"movs.w",{DSP_REG_M,A_PMOD_N},{HEX_F,SDT_REG_N,REG_M,HEX_D}, arch_sh_dsp_up}, +/* 111101nnmmmm0111 movs.w <DSP_REG_M>,@<REG_N>+r8 */ {"movs.w",{DSP_REG_M,AS_PMOD_N},{HEX_F,SDT_REG_N,REG_M,HEX_D}, arch_sh_dsp_up}, /* 111101nnmmmm1000 movs.l @-<REG_N>,<DSP_REG_M> */ {"movs.l",{A_DEC_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_2}, arch_sh_dsp_up}, @@ -650,7 +703,7 @@ const sh_opcode_info sh_table[] = /* 111101nnmmmm1010 movs.l @<REG_N>+,<DSP_REG_M> */ {"movs.l",{A_INC_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_A}, arch_sh_dsp_up}, -/* 111101nnmmmm1011 movs.l @<REG_N>+r8,<DSP_REG_M> */ {"movs.l",{A_PMOD_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_E}, arch_sh_dsp_up}, +/* 111101nnmmmm1011 movs.l @<REG_N>+r8,<DSP_REG_M> */ {"movs.l",{AS_PMOD_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_E}, arch_sh_dsp_up}, /* 111101nnmmmm1100 movs.l <DSP_REG_M>,@-<REG_N> */ {"movs.l",{DSP_REG_M,A_DEC_N},{HEX_F,SDT_REG_N,REG_M,HEX_3}, arch_sh_dsp_up}, @@ -658,22 +711,51 @@ const sh_opcode_info sh_table[] = /* 111101nnmmmm1110 movs.l <DSP_REG_M>,@<REG_N>+ */ {"movs.l",{DSP_REG_M,A_INC_N},{HEX_F,SDT_REG_N,REG_M,HEX_B}, arch_sh_dsp_up}, -/* 111101nnmmmm1111 movs.l <DSP_REG_M>,@<REG_N>+r8 */ {"movs.l",{DSP_REG_M,A_PMOD_N},{HEX_F,SDT_REG_N,REG_M,HEX_F}, arch_sh_dsp_up}, +/* 111101nnmmmm1111 movs.l <DSP_REG_M>,@<REG_N>+r8 */ {"movs.l",{DSP_REG_M,AS_PMOD_N},{HEX_F,SDT_REG_N,REG_M,HEX_F}, arch_sh_dsp_up}, /* 0*0*0*00** nopx */ {"nopx",{0},{PPI,NOPX}, arch_sh_dsp_up}, /* *0*0*0**00 nopy */ {"nopy",{0},{PPI,NOPY}, arch_sh_dsp_up}, -/* n*m*0*01** movx.w @<REG_N>,<DSP_REG_X> */ {"movx.w",{A_IND_N,DSP_REG_X},{PPI,MOVX,HEX_1}, arch_sh_dsp_up}, -/* n*m*0*10** movx.w @<REG_N>+,<DSP_REG_X> */ {"movx.w",{A_INC_N,DSP_REG_X},{PPI,MOVX,HEX_2}, arch_sh_dsp_up}, -/* n*m*0*11** movx.w @<REG_N>+r8,<DSP_REG_X> */ {"movx.w",{A_PMOD_N,DSP_REG_X},{PPI,MOVX,HEX_3}, arch_sh_dsp_up}, -/* n*m*1*01** movx.w <DSP_REG_M>,@<REG_N> */ {"movx.w",{DSP_REG_M,A_IND_N},{PPI,MOVX,HEX_9}, arch_sh_dsp_up}, -/* n*m*1*10** movx.w <DSP_REG_M>,@<REG_N>+ */ {"movx.w",{DSP_REG_M,A_INC_N},{PPI,MOVX,HEX_A}, arch_sh_dsp_up}, -/* n*m*1*11** movx.w <DSP_REG_M>,@<REG_N>+r8 */ {"movx.w",{DSP_REG_M,A_PMOD_N},{PPI,MOVX,HEX_B}, arch_sh_dsp_up}, -/* *n*m*0**01 movy.w @<REG_N>,<DSP_REG_Y> */ {"movy.w",{A_IND_N,DSP_REG_Y},{PPI,MOVY,HEX_1}, arch_sh_dsp_up}, -/* *n*m*0**10 movy.w @<REG_N>+,<DSP_REG_Y> */ {"movy.w",{A_INC_N,DSP_REG_Y},{PPI,MOVY,HEX_2}, arch_sh_dsp_up}, -/* *n*m*0**11 movy.w @<REG_N>+r9,<DSP_REG_Y> */ {"movy.w",{A_PMODY_N,DSP_REG_Y},{PPI,MOVY,HEX_3}, arch_sh_dsp_up}, -/* *n*m*1**01 movy.w <DSP_REG_M>,@<REG_N> */ {"movy.w",{DSP_REG_M,A_IND_N},{PPI,MOVY,HEX_9}, arch_sh_dsp_up}, -/* *n*m*1**10 movy.w <DSP_REG_M>,@<REG_N>+ */ {"movy.w",{DSP_REG_M,A_INC_N},{PPI,MOVY,HEX_A}, arch_sh_dsp_up}, -/* *n*m*1**11 movy.w <DSP_REG_M>,@<REG_N>+r9 */ {"movy.w",{DSP_REG_M,A_PMODY_N},{PPI,MOVY,HEX_B}, arch_sh_dsp_up}, +/* n*m*0*01** movx.w @<REG_N>,<DSP_REG_X> */ {"movx.w",{AX_IND_N,DSP_REG_X},{PPI,MOVX,HEX_1}, arch_sh_dsp_up}, +/* n*m*0*10** movx.w @<REG_N>+,<DSP_REG_X> */ {"movx.w",{AX_INC_N,DSP_REG_X},{PPI,MOVX,HEX_2}, arch_sh_dsp_up}, +/* n*m*0*11** movx.w @<REG_N>+r8,<DSP_REG_X> */ {"movx.w",{AX_PMOD_N,DSP_REG_X},{PPI,MOVX,HEX_3}, arch_sh_dsp_up}, +/* n*m*1*01** movx.w <DSP_REG_M>,@<REG_N> */ {"movx.w",{DSP_REG_A_M,AX_IND_N},{PPI,MOVX,HEX_9}, arch_sh_dsp_up}, +/* n*m*1*10** movx.w <DSP_REG_M>,@<REG_N>+ */ {"movx.w",{DSP_REG_A_M,AX_INC_N},{PPI,MOVX,HEX_A}, arch_sh_dsp_up}, +/* n*m*1*11** movx.w <DSP_REG_M>,@<REG_N>+r8 */ {"movx.w",{DSP_REG_A_M,AX_PMOD_N},{PPI,MOVX,HEX_B}, arch_sh_dsp_up}, + +/* nnmm000100 movx.w @<REG_Axy>,<DSP_REG_XY> */ {"movx.w",{AXY_IND_N,DSP_REG_XY},{PPI,MOVX_NOPY,HEX_0,HEX_4}, arch_sh4al_dsp_up}, +/* nnmm001000 movx.w @<REG_Axy>+,<DSP_REG_XY> */{"movx.w",{AXY_INC_N,DSP_REG_XY},{PPI,MOVX_NOPY,HEX_0,HEX_8}, arch_sh4al_dsp_up}, +/* nnmm001100 movx.w @<REG_Axy>+r8,<DSP_REG_XY> */{"movx.w",{AXY_PMOD_N,DSP_REG_XY},{PPI,MOVX_NOPY,HEX_0,HEX_C}, arch_sh4al_dsp_up}, +/* nnmm100100 movx.w <DSP_REG_AX>,@<REG_Axy> */ {"movx.w",{DSP_REG_AX,AXY_IND_N},{PPI,MOVX_NOPY,HEX_2,HEX_4}, arch_sh4al_dsp_up}, +/* nnmm101000 movx.w <DSP_REG_AX>,@<REG_Axy>+ */{"movx.w",{DSP_REG_AX,AXY_INC_N},{PPI,MOVX_NOPY,HEX_2,HEX_8}, arch_sh4al_dsp_up}, +/* nnmm101100 movx.w <DSP_REG_AX>,@<REG_Axy>+r8 */{"movx.w",{DSP_REG_AX,AXY_PMOD_N},{PPI,MOVX_NOPY,HEX_2,HEX_C}, arch_sh4al_dsp_up}, + +/* nnmm010100 movx.l @<REG_Axy>,<DSP_REG_XY> */ {"movx.l",{AXY_IND_N,DSP_REG_XY},{PPI,MOVX_NOPY,HEX_1,HEX_4}, arch_sh4al_dsp_up}, +/* nnmm011000 movx.l @<REG_Axy>+,<DSP_REG_XY> */{"movx.l",{AXY_INC_N,DSP_REG_XY},{PPI,MOVX_NOPY,HEX_1,HEX_8}, arch_sh4al_dsp_up}, +/* nnmm011100 movx.l @<REG_Axy>+r8,<DSP_REG_XY> */{"movx.l",{AXY_PMOD_N,DSP_REG_XY},{PPI,MOVX_NOPY,HEX_1,HEX_C}, arch_sh4al_dsp_up}, +/* nnmm110100 movx.l <DSP_REG_AX>,@<REG_Axy> */ {"movx.l",{DSP_REG_AX,AXY_IND_N},{PPI,MOVX_NOPY,HEX_3,HEX_4}, arch_sh4al_dsp_up}, +/* nnmm111000 movx.l <DSP_REG_AX>,@<REG_Axy>+ */{"movx.l",{DSP_REG_AX,AXY_INC_N},{PPI,MOVX_NOPY,HEX_3,HEX_8}, arch_sh4al_dsp_up}, +/* nnmm111100 movx.l <DSP_REG_AX>,@<REG_Axy>+r8 */{"movx.l",{DSP_REG_AX,AXY_PMOD_N},{PPI,MOVX_NOPY,HEX_3,HEX_C}, arch_sh4al_dsp_up}, + +/* *n*m*0**01 movy.w @<REG_N>,<DSP_REG_Y> */ {"movy.w",{AY_IND_N,DSP_REG_Y},{PPI,MOVY,HEX_1}, arch_sh_dsp_up}, +/* *n*m*0**10 movy.w @<REG_N>+,<DSP_REG_Y> */ {"movy.w",{AY_INC_N,DSP_REG_Y},{PPI,MOVY,HEX_2}, arch_sh_dsp_up}, +/* *n*m*0**11 movy.w @<REG_N>+r9,<DSP_REG_Y> */ {"movy.w",{AY_PMOD_N,DSP_REG_Y},{PPI,MOVY,HEX_3}, arch_sh_dsp_up}, +/* *n*m*1**01 movy.w <DSP_REG_M>,@<REG_N> */ {"movy.w",{DSP_REG_A_M,AY_IND_N},{PPI,MOVY,HEX_9}, arch_sh_dsp_up}, +/* *n*m*1**10 movy.w <DSP_REG_M>,@<REG_N>+ */ {"movy.w",{DSP_REG_A_M,AY_INC_N},{PPI,MOVY,HEX_A}, arch_sh_dsp_up}, +/* *n*m*1**11 movy.w <DSP_REG_M>,@<REG_N>+r9 */ {"movy.w",{DSP_REG_A_M,AY_PMOD_N},{PPI,MOVY,HEX_B}, arch_sh_dsp_up}, + +/* nnmm000001 movy.w @<REG_Ayx>,<DSP_REG_YX> */ {"movy.w",{AYX_IND_N,DSP_REG_YX},{PPI,MOVY_NOPX,HEX_0,HEX_1}, arch_sh4al_dsp_up}, +/* nnmm000010 movy.w @<REG_Ayx>+,<DSP_REG_YX> */{"movy.w",{AYX_INC_N,DSP_REG_YX},{PPI,MOVY_NOPX,HEX_0,HEX_2}, arch_sh4al_dsp_up}, +/* nnmm000011 movy.w @<REG_Ayx>+r8,<DSP_REG_YX> */{"movy.w",{AYX_PMOD_N,DSP_REG_YX},{PPI,MOVY_NOPX,HEX_0,HEX_3}, arch_sh4al_dsp_up}, +/* nnmm010001 movy.w <DSP_REG_AY>,@<REG_Ayx> */ {"movy.w",{DSP_REG_AY,AYX_IND_N},{PPI,MOVY_NOPX,HEX_1,HEX_1}, arch_sh4al_dsp_up}, +/* nnmm010010 movy.w <DSP_REG_AY>,@<REG_Ayx>+ */{"movy.w",{DSP_REG_AY,AYX_INC_N},{PPI,MOVY_NOPX,HEX_1,HEX_2}, arch_sh4al_dsp_up}, +/* nnmm010011 movy.w <DSP_REG_AY>,@<REG_Ayx>+r8 */{"movy.w",{DSP_REG_AY,AYX_PMOD_N},{PPI,MOVY_NOPX,HEX_1,HEX_3}, arch_sh4al_dsp_up}, + +/* nnmm100001 movy.l @<REG_Ayx>,<DSP_REG_YX> */ {"movy.l",{AYX_IND_N,DSP_REG_YX},{PPI,MOVY_NOPX,HEX_2,HEX_1}, arch_sh4al_dsp_up}, +/* nnmm100010 movy.l @<REG_Ayx>+,<DSP_REG_YX> */{"movy.l",{AYX_INC_N,DSP_REG_YX},{PPI,MOVY_NOPX,HEX_2,HEX_2}, arch_sh4al_dsp_up}, +/* nnmm100011 movy.l @<REG_Ayx>+r8,<DSP_REG_YX> */{"movy.l",{AYX_PMOD_N,DSP_REG_YX},{PPI,MOVY_NOPX,HEX_2,HEX_3}, arch_sh4al_dsp_up}, +/* nnmm110001 movy.l <DSP_REG_AY>,@<REG_Ayx> */ {"movy.l",{DSP_REG_AY,AYX_IND_N},{PPI,MOVY_NOPX,HEX_3,HEX_1}, arch_sh4al_dsp_up}, +/* nnmm110010 movy.l <DSP_REG_AY>,@<REG_Ayx>+ */{"movy.l",{DSP_REG_AY,AYX_INC_N},{PPI,MOVY_NOPX,HEX_3,HEX_2}, arch_sh4al_dsp_up}, +/* nnmm110011 movy.l <DSP_REG_AY>,@<REG_Ayx>+r8 */{"movy.l",{DSP_REG_AY,AYX_PMOD_N},{PPI,MOVY_NOPX,HEX_3,HEX_3}, arch_sh4al_dsp_up}, /* 01aaeeffxxyyggnn pmuls Se,Sf,Dg */ {"pmuls",{DSP_REG_E,DSP_REG_F,DSP_REG_G},{PPI,PMUL}, arch_sh_dsp_up}, /* 10100000xxyynnnn psubc <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ @@ -687,13 +769,21 @@ const sh_opcode_info sh_table[] = /* 10110100xxyynnnn pwad <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ {"pwad", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_B,HEX_4}, arch_sh_dsp_up}, /* 10001000xxyynnnn pabs <DSP_REG_X>,<DSP_REG_N> */ -{"pabs", {DSP_REG_X,DSP_REG_N},{PPI,PPI3,HEX_8,HEX_8}, arch_sh_dsp_up}, +{"pabs", {DSP_REG_X,DSP_REG_N},{PPI,PPI3NC,HEX_8,HEX_8}, arch_sh_dsp_up}, +/* 1000100!xx01nnnn pabs <DSP_REG_X>,<DSP_REG_N> */ +{"pabs", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_8,HEX_9,HEX_1}, arch_sh4al_dsp_up}, /* 10101000xxyynnnn pabs <DSP_REG_Y>,<DSP_REG_N> */ -{"pabs", {DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_A,HEX_8}, arch_sh_dsp_up}, +{"pabs", {DSP_REG_Y,DSP_REG_N},{PPI,PPI3NC,HEX_A,HEX_8}, arch_sh_dsp_up}, +/* 1010100!01yynnnn pabs <DSP_REG_Y>,<DSP_REG_N> */ +{"pabs", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_A,HEX_9,HEX_4}, arch_sh4al_dsp_up}, /* 10011000xxyynnnn prnd <DSP_REG_X>,<DSP_REG_N> */ -{"prnd", {DSP_REG_X,DSP_REG_N},{PPI,PPI3,HEX_9,HEX_8}, arch_sh_dsp_up}, +{"prnd", {DSP_REG_X,DSP_REG_N},{PPI,PPI3NC,HEX_9,HEX_8}, arch_sh_dsp_up}, +/* 1001100!xx01nnnn prnd <DSP_REG_X>,<DSP_REG_N> */ +{"prnd", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_9,HEX_1}, arch_sh4al_dsp_up}, /* 10111000xxyynnnn prnd <DSP_REG_Y>,<DSP_REG_N> */ -{"prnd", {DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_B,HEX_8}, arch_sh_dsp_up}, +{"prnd", {DSP_REG_Y,DSP_REG_N},{PPI,PPI3NC,HEX_B,HEX_8}, arch_sh_dsp_up}, +/* 1011100!01yynnnn prnd <DSP_REG_Y>,<DSP_REG_N> */ +{"prnd", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_9,HEX_4}, arch_sh4al_dsp_up}, {"dct",{0},{PPI,PDC,HEX_1}, arch_sh_dsp_up}, {"dcf",{0},{PPI,PDC,HEX_2}, arch_sh_dsp_up}, @@ -706,6 +796,8 @@ const sh_opcode_info sh_table[] = /* 00010iiiiiiinnnn psha #<imm>,<DSP_REG_N> */ {"psha",{A_IMM,DSP_REG_N},{PPI,PSH,HEX_1}, arch_sh_dsp_up}, /* 10100001xxyynnnn psub <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ {"psub", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_A,HEX_1}, arch_sh_dsp_up}, +/* 10000101xxyynnnn psub <DSP_REG_Y>,<DSP_REG_X>,<DSP_REG_N> */ +{"psub", {DSP_REG_Y,DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_8,HEX_5}, arch_sh4al_dsp_up}, /* 10110001xxyynnnn padd <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ {"padd", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_1}, arch_sh_dsp_up}, /* 10010101xxyynnnn pand <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ @@ -718,16 +810,16 @@ const sh_opcode_info sh_table[] = {"pdec", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_8,HEX_9}, arch_sh_dsp_up}, /* 10101001xxyynnnn pdec <DSP_REG_Y>,<DSP_REG_N> */ {"pdec", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_A,HEX_9}, arch_sh_dsp_up}, -/* 10011001xxyynnnn pinc <DSP_REG_X>,<DSP_REG_N> */ -{"pinc", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_9}, arch_sh_dsp_up}, -/* 10111001xxyynnnn pinc <DSP_REG_Y>,<DSP_REG_N> */ -{"pinc", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_9}, arch_sh_dsp_up}, +/* 10011001xx00nnnn pinc <DSP_REG_X>,<DSP_REG_N> */ +{"pinc", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_9,HEX_XX00}, arch_sh_dsp_up}, +/* 1011100100yynnnn pinc <DSP_REG_Y>,<DSP_REG_N> */ +{"pinc", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_9,HEX_00YY}, arch_sh_dsp_up}, /* 10001101xxyynnnn pclr <DSP_REG_N> */ {"pclr", {DSP_REG_N},{PPI,PPIC,HEX_8,HEX_D}, arch_sh_dsp_up}, -/* 10011101xxyynnnn pdmsb <DSP_REG_X>,<DSP_REG_N> */ -{"pdmsb", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_D}, arch_sh_dsp_up}, -/* 10111101xxyynnnn pdmsb <DSP_REG_Y>,<DSP_REG_N> */ -{"pdmsb", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_D}, arch_sh_dsp_up}, +/* 10011101xx00nnnn pdmsb <DSP_REG_X>,<DSP_REG_N> */ +{"pdmsb", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_D,HEX_XX00}, arch_sh_dsp_up}, +/* 1011110100yynnnn pdmsb <DSP_REG_Y>,<DSP_REG_N> */ +{"pdmsb", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_D,HEX_00YY}, arch_sh_dsp_up}, /* 11001001xxyynnnn pneg <DSP_REG_X>,<DSP_REG_N> */ {"pneg", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_C,HEX_9}, arch_sh_dsp_up}, /* 11101001xxyynnnn pneg <DSP_REG_Y>,<DSP_REG_N> */ @@ -744,6 +836,10 @@ const sh_opcode_info sh_table[] = {"plds", {DSP_REG_N,A_MACH},{PPI,PPIC,HEX_E,HEX_D}, arch_sh_dsp_up}, /* 11111101xxyynnnn plds <DSP_REG_N>,MACL */ {"plds", {DSP_REG_N,A_MACL},{PPI,PPIC,HEX_F,HEX_D}, arch_sh_dsp_up}, +/* 10011101xx01zzzz pswap <DSP_REG_X>,<DSP_REG_N> */ +{"pswap", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_D,HEX_1}, arch_sh4al_dsp_up}, +/* 1011110101yyzzzz pswap <DSP_REG_Y>,<DSP_REG_N> */ +{"pswap", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_D,HEX_4}, arch_sh4al_dsp_up}, /* 1111nnnn01011101 fabs <F_REG_N> */{"fabs",{F_REG_N},{HEX_F,REG_N,HEX_5,HEX_D}, arch_sh2e_up}, /* 1111nnnn01011101 fabs <D_REG_N> */{"fabs",{D_REG_N},{HEX_F,REG_N,HEX_5,HEX_D}, arch_sh4_up}, @@ -828,13 +924,19 @@ const sh_opcode_info sh_table[] = /* 1111nnnn01001101 fneg <F_REG_N> */{"fneg",{F_REG_N},{HEX_F,REG_N,HEX_4,HEX_D}, arch_sh2e_up}, /* 1111nnnn01001101 fneg <D_REG_N> */{"fneg",{D_REG_N},{HEX_F,REG_N,HEX_4,HEX_D}, arch_sh4_up}, +/* 1111011111111101 fpchg */{"fpchg",{0},{HEX_F,HEX_7,HEX_F,HEX_D}, arch_sh4a_up}, + /* 1111101111111101 frchg */{"frchg",{0},{HEX_F,HEX_B,HEX_F,HEX_D}, arch_sh4_up}, +/* 1111nnn011111101 fsca FPUL,<F_REG_N> */{"fsca",{FPUL_M,D_REG_N},{HEX_F,REG_N,HEX_F,HEX_D}, arch_sh4a_up}, + /* 1111001111111101 fschg */{"fschg",{0},{HEX_F,HEX_3,HEX_F,HEX_D}, arch_sh4_up}, /* 1111nnnn01101101 fsqrt <F_REG_N> */{"fsqrt",{F_REG_N},{HEX_F,REG_N,HEX_6,HEX_D}, arch_sh3e_up}, /* 1111nnnn01101101 fsqrt <D_REG_N> */{"fsqrt",{D_REG_N},{HEX_F,REG_N,HEX_6,HEX_D}, arch_sh4_up}, +/* 1111nnnn01111101 fssra <F_REG_N> */{"fssra",{F_REG_N},{HEX_F,REG_N,HEX_7,HEX_D}, arch_sh4a_up}, + /* 1111nnnn00001101 fsts FPUL,<F_REG_N>*/{"fsts",{FPUL_M,F_REG_N},{HEX_F,REG_N,HEX_0,HEX_D}, arch_sh2e_up}, /* 1111nnnnmmmm0001 fsub <F_REG_M>,<F_REG_N>*/{"fsub",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_1}, arch_sh2e_up}, diff --git a/opcodes/z8k-dis.c b/opcodes/z8k-dis.c index 5d15ee8..02f5dcb 100644 --- a/opcodes/z8k-dis.c +++ b/opcodes/z8k-dis.c @@ -24,7 +24,7 @@ #define DEFINE_TABLE #include "z8k-opc.h" - + #include <setjmp.h> typedef struct @@ -53,9 +53,6 @@ typedef struct } instr_data_s; -static int fetch_data PARAMS ((struct disassemble_info *, int)); - - /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive) to ADDR (exclusive) are valid. Returns 1 for success, longjmps on error. */ @@ -64,9 +61,7 @@ static int fetch_data PARAMS ((struct disassemble_info *, int)); ? 1 : fetch_data ((info), (nibble))) static int -fetch_data (info, nibble) - struct disassemble_info *info; - int nibble; +fetch_data (struct disassemble_info *info, int nibble) { unsigned char mybuf[20]; int status; @@ -142,18 +137,13 @@ static char *ctrl_names[8] = }; static int seg_length; -static int print_insn_z8k PARAMS ((bfd_vma, disassemble_info *, int)); -int z8k_lookup_instr PARAMS ((unsigned char *, disassemble_info *)); -static void output_instr - PARAMS ((instr_data_s *, unsigned long, disassemble_info *)); -static void unpack_instr PARAMS ((instr_data_s *, int, disassemble_info *)); -static void unparse_instr PARAMS ((instr_data_s *, int)); +int z8k_lookup_instr (unsigned char *, disassemble_info *); +static void output_instr (instr_data_s *, unsigned long, disassemble_info *); +static void unpack_instr (instr_data_s *, int, disassemble_info *); +static void unparse_instr (instr_data_s *, int); static int -print_insn_z8k (addr, info, is_segmented) - bfd_vma addr; - disassemble_info *info; - int is_segmented; +print_insn_z8k (bfd_vma addr, disassemble_info *info, int is_segmented) { instr_data_s instr_data; @@ -186,27 +176,20 @@ print_insn_z8k (addr, info, is_segmented) } int -print_insn_z8001 (addr, info) - bfd_vma addr; - disassemble_info *info; +print_insn_z8001 (bfd_vma addr, disassemble_info *info) { return print_insn_z8k (addr, info, 1); } int -print_insn_z8002 (addr, info) - bfd_vma addr; - disassemble_info *info; +print_insn_z8002 (bfd_vma addr, disassemble_info *info) { return print_insn_z8k (addr, info, 0); } int -z8k_lookup_instr (nibbles, info) - unsigned char *nibbles; - disassemble_info *info; +z8k_lookup_instr (unsigned char *nibbles, disassemble_info *info) { - int nibl_index, tabl_index; int nibl_matched; int need_fetch = 0; @@ -295,10 +278,9 @@ z8k_lookup_instr (nibbles, info) } static void -output_instr (instr_data, addr, info) - instr_data_s *instr_data; - unsigned long addr ATTRIBUTE_UNUSED; - disassemble_info *info; +output_instr (instr_data_s *instr_data, + unsigned long addr ATTRIBUTE_UNUSED, + disassemble_info *info) { int num_bytes; char out_str[100]; @@ -314,10 +296,7 @@ output_instr (instr_data, addr, info) } static void -unpack_instr (instr_data, is_segmented, info) - instr_data_s *instr_data; - int is_segmented; - disassemble_info *info; +unpack_instr (instr_data_s *instr_data, int is_segmented, disassemble_info *info) { int nibl_count, loop; unsigned short instr_nibl, instr_byte, instr_word; @@ -501,9 +480,7 @@ static char *intr_names[] = { }; static void -unparse_instr (instr_data, is_segmented) - instr_data_s *instr_data; - int is_segmented; +unparse_instr (instr_data_s *instr_data, int is_segmented) { unsigned short datum_value; unsigned int tabl_datum, datum_class; diff --git a/opcodes/z8k-opc.h b/opcodes/z8k-opc.h index c714bde..4caedd4 100644 --- a/opcodes/z8k-opc.h +++ b/opcodes/z8k-opc.h @@ -1,117 +1,117 @@ /* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically generated by z8kgen. */ -#define ARG_MASK 0x0f -#define ARG_SRC 0x01 -#define ARG_DST 0x02 -#define ARG_RS 0x01 -#define ARG_RD 0x02 -#define ARG_RA 0x03 -#define ARG_RB 0x04 -#define ARG_RR 0x05 -#define ARG_RX 0x06 -#define ARG_IMM4 0x01 -#define ARG_IMM8 0x02 -#define ARG_IMM16 0x03 -#define ARG_IMM32 0x04 -#define ARG_IMMN 0x05 -#define ARG_IMMNMINUS1 0x05 -#define ARG_IMM_1 0x06 -#define ARG_IMM_2 0x07 -#define ARG_DISP16 0x08 -#define ARG_NIM8 0x09 -#define ARG_IMM2 0x0a -#define ARG_IMM1OR2 0x0b -#define ARG_DISP12 0x0b -#define ARG_NIM4 0x0c -#define ARG_DISP8 0x0c -#define ARG_IMM4M1 0x0d -#define CLASS_X 0x10 -#define CLASS_BA 0x20 -#define CLASS_DA 0x30 -#define CLASS_BX 0x40 -#define CLASS_DISP 0x50 -#define CLASS_IMM 0x60 -#define CLASS_CC 0x70 -#define CLASS_CTRL 0x80 -#define CLASS_IGNORE 0x90 -#define CLASS_ADDRESS 0xd0 -#define CLASS_0CCC 0xe0 -#define CLASS_1CCC 0xf0 -#define CLASS_0DISP7 0x100 -#define CLASS_1DISP7 0x200 -#define CLASS_01II 0x300 -#define CLASS_00II 0x400 -#define CLASS_BIT 0x500 -#define CLASS_FLAGS 0x600 -#define CLASS_IR 0x700 +#define ARG_MASK 0x0f +#define ARG_SRC 0x01 +#define ARG_DST 0x02 +#define ARG_RS 0x01 +#define ARG_RD 0x02 +#define ARG_RA 0x03 +#define ARG_RB 0x04 +#define ARG_RR 0x05 +#define ARG_RX 0x06 +#define ARG_IMM4 0x01 +#define ARG_IMM8 0x02 +#define ARG_IMM16 0x03 +#define ARG_IMM32 0x04 +#define ARG_IMMN 0x05 +#define ARG_IMMNMINUS1 0x05 +#define ARG_IMM_1 0x06 +#define ARG_IMM_2 0x07 +#define ARG_DISP16 0x08 +#define ARG_NIM8 0x09 +#define ARG_IMM2 0x0a +#define ARG_IMM1OR2 0x0b +#define ARG_DISP12 0x0b +#define ARG_NIM4 0x0c +#define ARG_DISP8 0x0c +#define ARG_IMM4M1 0x0d +#define CLASS_X 0x10 +#define CLASS_BA 0x20 +#define CLASS_DA 0x30 +#define CLASS_BX 0x40 +#define CLASS_DISP 0x50 +#define CLASS_IMM 0x60 +#define CLASS_CC 0x70 +#define CLASS_CTRL 0x80 +#define CLASS_IGNORE 0x90 +#define CLASS_ADDRESS 0xd0 +#define CLASS_0CCC 0xe0 +#define CLASS_1CCC 0xf0 +#define CLASS_0DISP7 0x100 +#define CLASS_1DISP7 0x200 +#define CLASS_01II 0x300 +#define CLASS_00II 0x400 +#define CLASS_BIT 0x500 +#define CLASS_FLAGS 0x600 +#define CLASS_IR 0x700 #define CLASS_IRO 0x800 #define CLASS_DISP8 0x900 #define CLASS_BIT_1OR2 0xa00 -#define CLASS_REG 0x7000 -#define CLASS_REG_BYTE 0x2000 -#define CLASS_REG_WORD 0x3000 -#define CLASS_REG_QUAD 0x4000 -#define CLASS_REG_LONG 0x5000 -#define CLASS_REGN0 0x8000 -#define CLASS_PR 0x10000 +#define CLASS_REG 0x7000 +#define CLASS_REG_BYTE 0x2000 +#define CLASS_REG_WORD 0x3000 +#define CLASS_REG_QUAD 0x4000 +#define CLASS_REG_LONG 0x5000 +#define CLASS_REGN0 0x8000 +#define CLASS_PR 0x10000 #define CLASS_MASK 0x1fff0 -#define OPC_adc 0 -#define OPC_adcb 1 -#define OPC_add 2 -#define OPC_addb 3 -#define OPC_addl 4 -#define OPC_and 5 -#define OPC_andb 6 -#define OPC_bit 7 -#define OPC_bitb 8 -#define OPC_call 9 -#define OPC_calr 10 -#define OPC_clr 11 -#define OPC_clrb 12 -#define OPC_com 13 -#define OPC_comb 14 -#define OPC_comflg 15 -#define OPC_cp 16 -#define OPC_cpb 17 -#define OPC_cpd 18 -#define OPC_cpdb 19 -#define OPC_cpdr 20 -#define OPC_cpdrb 21 -#define OPC_cpi 22 -#define OPC_cpib 23 -#define OPC_cpir 24 -#define OPC_cpirb 25 -#define OPC_cpl 26 -#define OPC_cpsd 27 -#define OPC_cpsdb 28 -#define OPC_cpsdr 29 -#define OPC_cpsdrb 30 -#define OPC_cpsi 31 -#define OPC_cpsib 32 -#define OPC_cpsir 33 -#define OPC_cpsirb 34 -#define OPC_dab 35 -#define OPC_dbjnz 36 -#define OPC_dec 37 -#define OPC_decb 38 -#define OPC_di 39 -#define OPC_div 40 -#define OPC_divl 41 -#define OPC_djnz 42 -#define OPC_ei 43 -#define OPC_ex 44 -#define OPC_exb 45 -#define OPC_exts 46 -#define OPC_extsb 47 -#define OPC_extsl 48 -#define OPC_halt 49 -#define OPC_in 50 -#define OPC_inb 51 -#define OPC_inc 52 -#define OPC_incb 53 -#define OPC_ind 54 -#define OPC_indb 55 +#define OPC_adc 0 +#define OPC_adcb 1 +#define OPC_add 2 +#define OPC_addb 3 +#define OPC_addl 4 +#define OPC_and 5 +#define OPC_andb 6 +#define OPC_bit 7 +#define OPC_bitb 8 +#define OPC_call 9 +#define OPC_calr 10 +#define OPC_clr 11 +#define OPC_clrb 12 +#define OPC_com 13 +#define OPC_comb 14 +#define OPC_comflg 15 +#define OPC_cp 16 +#define OPC_cpb 17 +#define OPC_cpd 18 +#define OPC_cpdb 19 +#define OPC_cpdr 20 +#define OPC_cpdrb 21 +#define OPC_cpi 22 +#define OPC_cpib 23 +#define OPC_cpir 24 +#define OPC_cpirb 25 +#define OPC_cpl 26 +#define OPC_cpsd 27 +#define OPC_cpsdb 28 +#define OPC_cpsdr 29 +#define OPC_cpsdrb 30 +#define OPC_cpsi 31 +#define OPC_cpsib 32 +#define OPC_cpsir 33 +#define OPC_cpsirb 34 +#define OPC_dab 35 +#define OPC_dbjnz 36 +#define OPC_dec 37 +#define OPC_decb 38 +#define OPC_di 39 +#define OPC_div 40 +#define OPC_divl 41 +#define OPC_djnz 42 +#define OPC_ei 43 +#define OPC_ex 44 +#define OPC_exb 45 +#define OPC_exts 46 +#define OPC_extsb 47 +#define OPC_extsl 48 +#define OPC_halt 49 +#define OPC_in 50 +#define OPC_inb 51 +#define OPC_inc 52 +#define OPC_incb 53 +#define OPC_ind 54 +#define OPC_indb 55 #define OPC_indr 56 #define OPC_indrb 57 #define OPC_ini 58 @@ -1801,21 +1801,21 @@ const opcode_entry_type z8k_table[] = { "ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),}, {CLASS_BIT+6,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,74}, -/* 0010 0000 0000 dddd imm8 imm8 *** ldb rbd,imm8 */ +/* 1100 dddd imm8 *** ldb rbd,imm8 */ { #ifdef NICENAMES -"ldb rbd,imm8",8,7,0x00, +"ldb rbd,imm8",8,5,0x00, #endif "ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+2,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,74}, + {CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},2,2,74}, -/* 1100 dddd imm8 *** ldb rbd,imm8 */ +/* 0010 0000 0000 dddd imm8 imm8 *** ldb rbd,imm8 */ { #ifdef NICENAMES -"ldb rbd,imm8",8,5,0x00, +"ldb rbd,imm8",8,7,0x00, #endif "ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},2,2,74}, + {CLASS_BIT+2,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,74}, /* 1010 0000 ssss dddd *** ldb rbd,rbs */ { diff --git a/opcodes/z8kgen.c b/opcodes/z8kgen.c index df72791..9e46809 100644 --- a/opcodes/z8kgen.c +++ b/opcodes/z8kgen.c @@ -36,7 +36,7 @@ struct op }; #define iswhite(x) ((x) == ' ' || (x) == '\t') -struct op opt[] = +static struct op opt[] = { {"------", 2, 8, "0011 0110 0000 0000", "bpt", 0}, /* Breakpoint used by the simulator. */ {"------", 10, 8, "0000 1111 0000 1100", "brk", 0}, /* Breakpoint used by real hardware. @@ -265,8 +265,8 @@ struct op opt[] = {"------", 7, 8, "0010 0000 ssN0 dddd", "ldb rbd,@rs", 0}, {"------", 9, 8, "0110 0000 0000 dddd address_src", "ldb rbd,address_src", 0}, {"------", 10, 8, "0110 0000 ssN0 dddd address_src", "ldb rbd,address_src(rs)", 0}, - {"------", 7, 8, "0010 0000 0000 dddd imm8 imm8", "ldb rbd,imm8", 0}, {"------", 5, 8, "1100 dddd imm8", "ldb rbd,imm8", 0}, + {"------", 7, 8, "0010 0000 0000 dddd imm8 imm8", "ldb rbd,imm8", 0}, {"------", 3, 8, "1010 0000 ssss dddd", "ldb rbd,rbs", 0}, {"------", 14, 8, "0011 0000 ssN0 dddd imm16", "ldb rbd,rs(imm16)", 0}, {"------", 14, 8, "0111 0000 ssN0 dddd 0000 xxxx 0000 0000", "ldb rbd,rs(rx)", 0}, @@ -552,7 +552,7 @@ struct op opt[] = }; static int -count () +count (void) { struct op *p = opt; int r = 0; @@ -567,9 +567,7 @@ count () } static int -func (a, b) - struct op *a; - struct op *b; +func (struct op *a, struct op *b) { return strcmp ((a)->name, (b)->name); } @@ -588,7 +586,7 @@ struct tok_struct int length; }; -struct tok_struct args[] = +static struct tok_struct args[] = { {"address_src(rs)", "CLASS_X+(ARG_RS)",}, {"address_dst(rd)", "CLASS_X+(ARG_RD)",}, @@ -649,7 +647,7 @@ struct tok_struct args[] = {0, 0} }; -struct tok_struct toks[] = +static struct tok_struct toks[] = { {"0000", "CLASS_BIT+0", 1}, {"0001", "CLASS_BIT+1", 1}, @@ -728,11 +726,8 @@ struct tok_struct toks[] = {0, 0} }; -char * -translate (table, x, length) - struct tok_struct *table; - char *x; - int *length; +static char * +translate (struct tok_struct *table, char *x, int *length) { int found; @@ -760,9 +755,7 @@ translate (table, x, length) } static void -chewbits (bits, length) - char *bits; - int *length; +chewbits (char *bits, int *length) { int n = 0; @@ -788,8 +781,7 @@ chewbits (bits, length) } static int -chewname (name) - char **name; +chewname (char **name) { char *n; int nargs = 0; @@ -830,9 +822,7 @@ chewname (name) } static void -sub (x, c) - char *x; - char c; +sub (char *x, char c) { while (*x) { @@ -851,8 +841,7 @@ sub (x, c) #define D(x) ((x) == '1' || (x) =='0') #define M(y) (strncmp(y,x,4)==0) static void -printmangled (x) - char *x; +printmangled (char *x) { return; while (*x) @@ -886,8 +875,7 @@ printmangled (x) /*#define WORK_TYPE*/ static void -print_type (n) - struct op *n; +print_type (struct op *n) { #ifdef WORK_TYPE while (*s && !iswhite (*s)) @@ -913,7 +901,7 @@ print_type (n) } static void -internal () +internal (void) { int c = count (); struct op *new = (struct op *) xmalloc (sizeof (struct op) * c); @@ -921,7 +909,7 @@ internal () memcpy (new, p, c * sizeof (struct op)); /* Sort all names in table alphabetically. */ - qsort (new, c, sizeof (struct op), func); + qsort (new, c, sizeof (struct op), (int (*)(const void *, const void *))func); p = new; while (p->flags && p->flags[0] != '*') @@ -966,7 +954,7 @@ internal () } static void -gas () +gas (void) { int c = count (); struct op *p = opt; @@ -977,129 +965,129 @@ gas () memcpy (new, p, c * sizeof (struct op)); /* Sort all names in table alphabetically. */ - qsort (new, c, sizeof (struct op), func); + qsort (new, c, sizeof (struct op), (int (*)(const void *, const void *))func); printf ("/* DO NOT EDIT! -*- buffer-read-only: t -*-\n"); printf (" This file is automatically generated by z8kgen. */\n\n"); - printf ("#define ARG_MASK 0x0f\n"); - - printf ("#define ARG_SRC 0x01\n"); - printf ("#define ARG_DST 0x02\n"); - - printf ("#define ARG_RS 0x01\n"); - printf ("#define ARG_RD 0x02\n"); - printf ("#define ARG_RA 0x03\n"); - printf ("#define ARG_RB 0x04\n"); - printf ("#define ARG_RR 0x05\n"); - printf ("#define ARG_RX 0x06\n"); - - printf ("#define ARG_IMM4 0x01\n"); - printf ("#define ARG_IMM8 0x02\n"); - printf ("#define ARG_IMM16 0x03\n"); - printf ("#define ARG_IMM32 0x04\n"); - printf ("#define ARG_IMMN 0x05\n"); - printf ("#define ARG_IMMNMINUS1 0x05\n"); - printf ("#define ARG_IMM_1 0x06\n"); - printf ("#define ARG_IMM_2 0x07\n"); - printf ("#define ARG_DISP16 0x08\n"); - printf ("#define ARG_NIM8 0x09\n"); - printf ("#define ARG_IMM2 0x0a\n"); - printf ("#define ARG_IMM1OR2 0x0b\n"); - - printf ("#define ARG_DISP12 0x0b\n"); - printf ("#define ARG_NIM4 0x0c\n"); - printf ("#define ARG_DISP8 0x0c\n"); - printf ("#define ARG_IMM4M1 0x0d\n"); - - printf ("#define CLASS_X 0x10\n"); - printf ("#define CLASS_BA 0x20\n"); - printf ("#define CLASS_DA 0x30\n"); - printf ("#define CLASS_BX 0x40\n"); - printf ("#define CLASS_DISP 0x50\n"); - printf ("#define CLASS_IMM 0x60\n"); - printf ("#define CLASS_CC 0x70\n"); - printf ("#define CLASS_CTRL 0x80\n"); - printf ("#define CLASS_IGNORE 0x90\n"); - printf ("#define CLASS_ADDRESS 0xd0\n"); - printf ("#define CLASS_0CCC 0xe0\n"); - printf ("#define CLASS_1CCC 0xf0\n"); - printf ("#define CLASS_0DISP7 0x100\n"); - printf ("#define CLASS_1DISP7 0x200\n"); - printf ("#define CLASS_01II 0x300\n"); - printf ("#define CLASS_00II 0x400\n"); - printf ("#define CLASS_BIT 0x500\n"); - printf ("#define CLASS_FLAGS 0x600\n"); - printf ("#define CLASS_IR 0x700\n"); + printf ("#define ARG_MASK 0x0f\n"); + + printf ("#define ARG_SRC 0x01\n"); + printf ("#define ARG_DST 0x02\n"); + + printf ("#define ARG_RS 0x01\n"); + printf ("#define ARG_RD 0x02\n"); + printf ("#define ARG_RA 0x03\n"); + printf ("#define ARG_RB 0x04\n"); + printf ("#define ARG_RR 0x05\n"); + printf ("#define ARG_RX 0x06\n"); + + printf ("#define ARG_IMM4 0x01\n"); + printf ("#define ARG_IMM8 0x02\n"); + printf ("#define ARG_IMM16 0x03\n"); + printf ("#define ARG_IMM32 0x04\n"); + printf ("#define ARG_IMMN 0x05\n"); + printf ("#define ARG_IMMNMINUS1 0x05\n"); + printf ("#define ARG_IMM_1 0x06\n"); + printf ("#define ARG_IMM_2 0x07\n"); + printf ("#define ARG_DISP16 0x08\n"); + printf ("#define ARG_NIM8 0x09\n"); + printf ("#define ARG_IMM2 0x0a\n"); + printf ("#define ARG_IMM1OR2 0x0b\n"); + + printf ("#define ARG_DISP12 0x0b\n"); + printf ("#define ARG_NIM4 0x0c\n"); + printf ("#define ARG_DISP8 0x0c\n"); + printf ("#define ARG_IMM4M1 0x0d\n"); + + printf ("#define CLASS_X 0x10\n"); + printf ("#define CLASS_BA 0x20\n"); + printf ("#define CLASS_DA 0x30\n"); + printf ("#define CLASS_BX 0x40\n"); + printf ("#define CLASS_DISP 0x50\n"); + printf ("#define CLASS_IMM 0x60\n"); + printf ("#define CLASS_CC 0x70\n"); + printf ("#define CLASS_CTRL 0x80\n"); + printf ("#define CLASS_IGNORE 0x90\n"); + printf ("#define CLASS_ADDRESS 0xd0\n"); + printf ("#define CLASS_0CCC 0xe0\n"); + printf ("#define CLASS_1CCC 0xf0\n"); + printf ("#define CLASS_0DISP7 0x100\n"); + printf ("#define CLASS_1DISP7 0x200\n"); + printf ("#define CLASS_01II 0x300\n"); + printf ("#define CLASS_00II 0x400\n"); + printf ("#define CLASS_BIT 0x500\n"); + printf ("#define CLASS_FLAGS 0x600\n"); + printf ("#define CLASS_IR 0x700\n"); printf ("#define CLASS_IRO 0x800\n"); printf ("#define CLASS_DISP8 0x900\n"); printf ("#define CLASS_BIT_1OR2 0xa00\n"); - printf ("#define CLASS_REG 0x7000\n"); - printf ("#define CLASS_REG_BYTE 0x2000\n"); - printf ("#define CLASS_REG_WORD 0x3000\n"); - printf ("#define CLASS_REG_QUAD 0x4000\n"); - printf ("#define CLASS_REG_LONG 0x5000\n"); - printf ("#define CLASS_REGN0 0x8000\n"); - printf ("#define CLASS_PR 0x10000\n"); + printf ("#define CLASS_REG 0x7000\n"); + printf ("#define CLASS_REG_BYTE 0x2000\n"); + printf ("#define CLASS_REG_WORD 0x3000\n"); + printf ("#define CLASS_REG_QUAD 0x4000\n"); + printf ("#define CLASS_REG_LONG 0x5000\n"); + printf ("#define CLASS_REGN0 0x8000\n"); + printf ("#define CLASS_PR 0x10000\n"); printf ("#define CLASS_MASK 0x1fff0\n"); - printf ("#define OPC_adc 0\n"); - printf ("#define OPC_adcb 1\n"); - printf ("#define OPC_add 2\n"); - printf ("#define OPC_addb 3\n"); - printf ("#define OPC_addl 4\n"); - printf ("#define OPC_and 5\n"); - printf ("#define OPC_andb 6\n"); - printf ("#define OPC_bit 7\n"); - printf ("#define OPC_bitb 8\n"); - printf ("#define OPC_call 9\n"); - printf ("#define OPC_calr 10\n"); - printf ("#define OPC_clr 11\n"); - printf ("#define OPC_clrb 12\n"); - printf ("#define OPC_com 13\n"); - printf ("#define OPC_comb 14\n"); - printf ("#define OPC_comflg 15\n"); - printf ("#define OPC_cp 16\n"); - printf ("#define OPC_cpb 17\n"); - printf ("#define OPC_cpd 18\n"); - printf ("#define OPC_cpdb 19\n"); - printf ("#define OPC_cpdr 20\n"); - printf ("#define OPC_cpdrb 21\n"); - printf ("#define OPC_cpi 22\n"); - printf ("#define OPC_cpib 23\n"); - printf ("#define OPC_cpir 24\n"); - printf ("#define OPC_cpirb 25\n"); - printf ("#define OPC_cpl 26\n"); - printf ("#define OPC_cpsd 27\n"); - printf ("#define OPC_cpsdb 28\n"); - printf ("#define OPC_cpsdr 29\n"); - printf ("#define OPC_cpsdrb 30\n"); - printf ("#define OPC_cpsi 31\n"); - printf ("#define OPC_cpsib 32\n"); - printf ("#define OPC_cpsir 33\n"); - printf ("#define OPC_cpsirb 34\n"); - printf ("#define OPC_dab 35\n"); - printf ("#define OPC_dbjnz 36\n"); - printf ("#define OPC_dec 37\n"); - printf ("#define OPC_decb 38\n"); - printf ("#define OPC_di 39\n"); - printf ("#define OPC_div 40\n"); - printf ("#define OPC_divl 41\n"); - printf ("#define OPC_djnz 42\n"); - printf ("#define OPC_ei 43\n"); - printf ("#define OPC_ex 44\n"); - printf ("#define OPC_exb 45\n"); - printf ("#define OPC_exts 46\n"); - printf ("#define OPC_extsb 47\n"); - printf ("#define OPC_extsl 48\n"); - printf ("#define OPC_halt 49\n"); - printf ("#define OPC_in 50\n"); - printf ("#define OPC_inb 51\n"); - printf ("#define OPC_inc 52\n"); - printf ("#define OPC_incb 53\n"); - printf ("#define OPC_ind 54\n"); - printf ("#define OPC_indb 55\n"); + printf ("#define OPC_adc 0\n"); + printf ("#define OPC_adcb 1\n"); + printf ("#define OPC_add 2\n"); + printf ("#define OPC_addb 3\n"); + printf ("#define OPC_addl 4\n"); + printf ("#define OPC_and 5\n"); + printf ("#define OPC_andb 6\n"); + printf ("#define OPC_bit 7\n"); + printf ("#define OPC_bitb 8\n"); + printf ("#define OPC_call 9\n"); + printf ("#define OPC_calr 10\n"); + printf ("#define OPC_clr 11\n"); + printf ("#define OPC_clrb 12\n"); + printf ("#define OPC_com 13\n"); + printf ("#define OPC_comb 14\n"); + printf ("#define OPC_comflg 15\n"); + printf ("#define OPC_cp 16\n"); + printf ("#define OPC_cpb 17\n"); + printf ("#define OPC_cpd 18\n"); + printf ("#define OPC_cpdb 19\n"); + printf ("#define OPC_cpdr 20\n"); + printf ("#define OPC_cpdrb 21\n"); + printf ("#define OPC_cpi 22\n"); + printf ("#define OPC_cpib 23\n"); + printf ("#define OPC_cpir 24\n"); + printf ("#define OPC_cpirb 25\n"); + printf ("#define OPC_cpl 26\n"); + printf ("#define OPC_cpsd 27\n"); + printf ("#define OPC_cpsdb 28\n"); + printf ("#define OPC_cpsdr 29\n"); + printf ("#define OPC_cpsdrb 30\n"); + printf ("#define OPC_cpsi 31\n"); + printf ("#define OPC_cpsib 32\n"); + printf ("#define OPC_cpsir 33\n"); + printf ("#define OPC_cpsirb 34\n"); + printf ("#define OPC_dab 35\n"); + printf ("#define OPC_dbjnz 36\n"); + printf ("#define OPC_dec 37\n"); + printf ("#define OPC_decb 38\n"); + printf ("#define OPC_di 39\n"); + printf ("#define OPC_div 40\n"); + printf ("#define OPC_divl 41\n"); + printf ("#define OPC_djnz 42\n"); + printf ("#define OPC_ei 43\n"); + printf ("#define OPC_ex 44\n"); + printf ("#define OPC_exb 45\n"); + printf ("#define OPC_exts 46\n"); + printf ("#define OPC_extsb 47\n"); + printf ("#define OPC_extsl 48\n"); + printf ("#define OPC_halt 49\n"); + printf ("#define OPC_in 50\n"); + printf ("#define OPC_inb 51\n"); + printf ("#define OPC_inc 52\n"); + printf ("#define OPC_incb 53\n"); + printf ("#define OPC_ind 54\n"); + printf ("#define OPC_indb 55\n"); printf ("#define OPC_indr 56\n"); printf ("#define OPC_indrb 57\n"); printf ("#define OPC_ini 58\n"); @@ -1322,9 +1310,7 @@ gas () } int -main (ac, av) - int ac; - char **av; +main (int ac, char **av) { struct op *p = opt; diff --git a/sim/ChangeLog b/sim/ChangeLog index 2183398..97fecf2 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,16 +1,3 @@ -2003-10-17 Shrinivas Atre <shrinivasa@KPITCummins.com> - * h8300/compile.c : Addition of extern variable h8300_normal_mode - (SP) : Handle normal mode - (bitfrom) : Use normal mode flag to return suitable value - (lvalue) : Use normal mode flag to return command line location - (decode) : Decode instruction correctly for normal mode - (init_pointers) : Initialise memory correctly for normal mode - (sim_resume) : Handle cases for normal mode using h8300_normal_mode flag - (sim_store_register) : Handle 2 byte PC for normal mode - (sim_fetch_register) : Handle 2 byte PC for normal mode - (set_h8300h) : Set normal mode flag as per architechture - (sim_load) : Allocate 64K for normal mode instead of bigger memory - 2003-10-08 Dave Brolley <brolley@redhat.com> * configure.in: Move frv handling to alphabetically correct placement. diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index c7ff605..f95071f 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,8 @@ +2003-11-22 Kazu Hirata <kazu@cs.umass.edu> + + * sim-options.c (standard_options): Fix the names of H8 + variants. + 2003-10-30 Andrew Cagney <cagney@redhat.com> * sim-trace.c, sim-base.h: Replace "struct symbol_cache_entry" diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index df12a63..94d0de4 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -154,13 +154,13 @@ static const OPTION standard_options[] = #ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */ { {"h8300h", no_argument, NULL, OPTION_H8300H}, - 'h', NULL, "Indicate the CPU is h8/300h", + 'h', NULL, "Indicate the CPU is H8/300H", standard_option_handler }, { {"h8300s", no_argument, NULL, OPTION_H8300S}, - 'S', NULL, "Indicate the CPU is h8/300s", + 'S', NULL, "Indicate the CPU is H8S", standard_option_handler }, { {"h8300sx", no_argument, NULL, OPTION_H8300SX}, - 'x', NULL, "Indicate the CPU is h8/300sx", + 'x', NULL, "Indicate the CPU is H8SX", standard_option_handler }, #endif diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog index 3bd23ec..7aa1a75 100644 --- a/sim/h8300/ChangeLog +++ b/sim/h8300/ChangeLog @@ -1,3 +1,22 @@ +2003-12-11 Dhananjay Deshpande <dhananjayd@kpitcummins.com> + + * compile.c (set_h8300h): Initialize globals to zero. + +2003-10-17 Shrinivas Atre <shrinivasa@KPITCummins.com> + + * compile.c (h8300_normal_mode): New. + (SP): Handle normal mode. + (bitfrom): Use normal mode flag to return suitable value. + (lvalue): Use normal mode flag to return command line location. + (decode): Decode instruction correctly for normal mode. + (init_pointers): Initialise memory correctly for normal mode. + (sim_resume): Handle cases for normal mode using h8300_normal_mode + flag. + (sim_store_register): Handle 2 byte PC for normal mode. + (sim_fetch_register): Handle 2 byte PC for normal mode. + (set_h8300h): Set normal mode flag as per architechture. + (sim_load): Allocate 64K for normal mode instead of bigger memory. + 2003-07-18 Michael Snyder <msnyder@redhat.com> * compile.c (decode): Enhancements for mova. diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index f123878..462240c 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -4930,6 +4930,8 @@ set_h8300h (unsigned long machine) This function being replaced by a sim_open:ARGV configuration option. */ + h8300hmode = h8300smode = h8300sxmode = h8300_normal_mode = 0; + if (machine == bfd_mach_h8300sx || machine == bfd_mach_h8300sxn) h8300sxmode = 1; diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog index b6d7c24..4096452 100644 --- a/sim/m32r/ChangeLog +++ b/sim/m32r/ChangeLog @@ -1,3 +1,35 @@ +2003-12-11 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + * Makefile.in: Add support for new machine m32r2. + * cpu2.c: New file for m32r2 support. + * cpu2.h: Likewise. + * decode2.c: Likewise. + * decode2.h: Likewise. + * m32r2.c: Likewise. + * mloop2.in: Likewise. + * model2.c: Likewise. + * sem2-switch.c: Likewise. + * arch.c: Regenerate. + * arch.h: Regenerate. + * cpu.c: Regenerate. + * arch.c: Regenerate. + * cpuall.c: Regenerate. + * cpux.c: Regenerate. + * cpux.h: Regenerate. + * decode.c: Regenerate. + * decode.h: Regenerate. + * decodex.c: Regenerate. + * decodex.h: Regenerate. + * model.c: Regenerate. + * modelx.c: Regenerate. + * sem-switch.c: Regenerate. + * sem.c: Regenerate. + * semx-switch.c: Regenerate. + * m32r-sim.h: Add EVB register support. + * sim-if.c: Likewise. + * sim-main.h: Likewise. + * traps.c: Likewise. + 2003-09-08 Dave Brolley <brolley@redhat.com> On behalf of Doug Evans <dje@sebabeach.org> diff --git a/sim/m32r/Makefile.in b/sim/m32r/Makefile.in index 18d9d3f..ee3f7e8 100644 --- a/sim/m32r/Makefile.in +++ b/sim/m32r/Makefile.in @@ -1,5 +1,5 @@ # Makefile template for Configure for the m32r simulator -# Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc. # Contributed by Cygnus Support. # # This file is part of GDB, the GNU debugger. @@ -22,6 +22,7 @@ M32R_OBJS = m32r.o cpu.o decode.o sem.o model.o mloop.o M32RX_OBJS = m32rx.o cpux.o decodex.o modelx.o mloopx.o +M32R2_OBJS = m32r2.o cpu2.o decode2.o model2.o mloop2.o CONFIG_DEVICES = dv-sockser.o CONFIG_DEVICES = @@ -38,6 +39,7 @@ SIM_OBJS = \ sim-if.o arch.o \ $(M32R_OBJS) \ $(M32RX_OBJS) \ + $(M32R2_OBJS) \ traps.o devices.o \ $(CONFIG_DEVICES) @@ -113,10 +115,35 @@ decodex.o: decodex.c $(M32RXF_INCLUDE_DEPS) semx.o: semx.c $(M32RXF_INCLUDE_DEPS) modelx.o: modelx.c $(M32RXF_INCLUDE_DEPS) +# M32R2 objs + +M32R2F_INCLUDE_DEPS = \ + $(CGEN_MAIN_CPU_DEPS) \ + cpu2.h decode2.h eng2.h + +m32r2.o: m32r2.c $(M32R2F_INCLUDE_DEPS) + +# FIXME: Use of `mono' is wip. +mloop2.c eng2.h: stamp-2mloop +stamp-2mloop: $(srcdir)/../common/genmloop.sh mloop2.in Makefile + $(SHELL) $(srccom)/genmloop.sh \ + -mono -no-fast -pbb -parallel-write -switch sem2-switch.c \ + -cpu m32r2f -infile $(srcdir)/mloop2.in + $(SHELL) $(srcroot)/move-if-change eng.hin eng2.h + $(SHELL) $(srcroot)/move-if-change mloop.cin mloop2.c + touch stamp-2mloop + +mloop2.o: mloop2.c sem2-switch.c $(M32R2F_INCLUDE_DEPS) +cpu2.o: cpu2.c $(M32R2F_INCLUDE_DEPS) +decode2.o: decode2.c $(M32R2F_INCLUDE_DEPS) +sem2.o: sem2.c $(M32R2F_INCLUDE_DEPS) +model2.o: model2.c $(M32R2F_INCLUDE_DEPS) + m32r-clean: rm -f mloop.c eng.h stamp-mloop rm -f mloopx.c engx.h stamp-xmloop - rm -f stamp-arch stamp-cpu stamp-xcpu + rm -f mloop2.c eng2.h stamp-2mloop + rm -f stamp-arch stamp-cpu stamp-xcpu stamp-2cpu rm -f tmp-* # cgen support, enable with --enable-cgen-maint @@ -148,3 +175,12 @@ stamp-xcpu: $(CGEN_READ_SCM) $(CGEN_CPU_SCM) $(CGEN_DECODE_SCM) $(CGEN_CPU_DIR)/ EXTRAFILES="$(CGEN_CPU_SEMSW)" touch stamp-xcpu cpux.h semx-switch.c modelx.c decodex.c decodex.h: $(CGEN_MAINT) stamp-xcpu + +stamp-2cpu: $(CGEN_READ_SCM) $(CGEN_CPU_SCM) $(CGEN_DECODE_SCM) $(CGEN_CPU_DIR)/m32r.cpu + $(MAKE) cgen-cpu-decode $(CGEN_FLAGS_TO_PASS) \ + cpu=m32r2f mach=m32r2 SUFFIX=2 \ + archfile=$(CGEN_CPU_DIR)/m32r.cpu \ + FLAGS="with-scache with-profile=fn" \ + EXTRAFILES="$(CGEN_CPU_SEMSW)" + touch stamp-2cpu +cpu2.h sem2-switch.c model2.c decode2.c decode2.h: $(CGEN_MAINT) stamp-2cpu diff --git a/sim/m32r/arch.c b/sim/m32r/arch.c index 0c02abb..cbdcfba 100644 --- a/sim/m32r/arch.c +++ b/sim/m32r/arch.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -33,6 +33,9 @@ const MACH *sim_machs[] = #ifdef HAVE_CPU_M32RXF & m32rx_mach, #endif +#ifdef HAVE_CPU_M32R2F + & m32r2_mach, +#endif 0 }; diff --git a/sim/m32r/arch.h b/sim/m32r/arch.h index 89aed24..a544d47 100644 --- a/sim/m32r/arch.h +++ b/sim/m32r/arch.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -29,7 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc., /* Enum declaration for model types. */ typedef enum model_type { - MODEL_M32R_D, MODEL_TEST, MODEL_M32RX, MODEL_MAX + MODEL_M32R_D, MODEL_TEST, MODEL_M32RX, MODEL_M32R2 + , MODEL_MAX } MODEL_TYPE; #define MAX_MODELS ((int) MODEL_MAX) @@ -39,7 +40,9 @@ typedef enum unit_type { UNIT_NONE, UNIT_M32R_D_U_STORE, UNIT_M32R_D_U_LOAD, UNIT_M32R_D_U_CTI , UNIT_M32R_D_U_MAC, UNIT_M32R_D_U_CMP, UNIT_M32R_D_U_EXEC, UNIT_TEST_U_EXEC , UNIT_M32RX_U_STORE, UNIT_M32RX_U_LOAD, UNIT_M32RX_U_CTI, UNIT_M32RX_U_MAC - , UNIT_M32RX_U_CMP, UNIT_M32RX_U_EXEC, UNIT_MAX + , UNIT_M32RX_U_CMP, UNIT_M32RX_U_EXEC, UNIT_M32R2_U_STORE, UNIT_M32R2_U_LOAD + , UNIT_M32R2_U_CTI, UNIT_M32R2_U_MAC, UNIT_M32R2_U_CMP, UNIT_M32R2_U_EXEC + , UNIT_MAX } UNIT_TYPE; #define MAX_UNITS (2) diff --git a/sim/m32r/cpu.c b/sim/m32r/cpu.c index bdb7937..197ea43 100644 --- a/sim/m32r/cpu.c +++ b/sim/m32r/cpu.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. diff --git a/sim/m32r/cpu.h b/sim/m32r/cpu.h index 738aa1d..a5ecbe3 100644 --- a/sim/m32r/cpu.h +++ b/sim/m32r/cpu.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -124,6 +124,9 @@ union sem_fields { int empty; } fmt_empty; struct { /* */ + UINT f_uimm8; + } sfmt_clrpsw; + struct { /* */ UINT f_uimm4; } sfmt_trap; struct { /* */ @@ -153,6 +156,13 @@ union sem_fields { unsigned char out_h_gr_SI_14; } sfmt_jl; struct { /* */ + SI* i_sr; + INT f_simm16; + UINT f_r2; + UINT f_uimm3; + unsigned char in_sr; + } sfmt_bset; + struct { /* */ SI* i_dr; UINT f_r1; UINT f_uimm5; @@ -628,6 +638,49 @@ struct scache { f_op2 = EXTRACT_MSB0_UINT (insn, 16, 8, 4); \ f_uimm4 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); \ +#define EXTRACT_IFMT_CLRPSW_VARS \ + UINT f_op1; \ + UINT f_r1; \ + UINT f_uimm8; \ + unsigned int length; +#define EXTRACT_IFMT_CLRPSW_CODE \ + length = 2; \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_uimm8 = EXTRACT_MSB0_UINT (insn, 16, 8, 8); \ + +#define EXTRACT_IFMT_BSET_VARS \ + UINT f_op1; \ + UINT f_bit4; \ + UINT f_uimm3; \ + UINT f_op2; \ + UINT f_r2; \ + INT f_simm16; \ + unsigned int length; +#define EXTRACT_IFMT_BSET_CODE \ + length = 4; \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_bit4 = EXTRACT_MSB0_UINT (insn, 32, 4, 1); \ + f_uimm3 = EXTRACT_MSB0_UINT (insn, 32, 5, 3); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 32, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ + f_simm16 = EXTRACT_MSB0_INT (insn, 32, 16, 16); \ + +#define EXTRACT_IFMT_BTST_VARS \ + UINT f_op1; \ + UINT f_bit4; \ + UINT f_uimm3; \ + UINT f_op2; \ + UINT f_r2; \ + unsigned int length; +#define EXTRACT_IFMT_BTST_CODE \ + length = 2; \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_bit4 = EXTRACT_MSB0_UINT (insn, 16, 4, 1); \ + f_uimm3 = EXTRACT_MSB0_UINT (insn, 16, 5, 3); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 16, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); \ + /* Collection of various things for the trace handler to use. */ typedef struct trace_record { diff --git a/sim/m32r/cpuall.h b/sim/m32r/cpuall.h index d60037b..1985846 100644 --- a/sim/m32r/cpuall.h +++ b/sim/m32r/cpuall.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -41,8 +41,16 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "decodex.h" #endif +#ifdef WANT_CPU_M32R2F +#include "eng2.h" +#include "cgen-engine.h" +#include "cpu2.h" +#include "decode2.h" +#endif + extern const MACH m32r_mach; extern const MACH m32rx_mach; +extern const MACH m32r2_mach; #ifndef WANT_CPU /* The ARGBUF struct. */ diff --git a/sim/m32r/cpux.c b/sim/m32r/cpux.c index 9329789..f460961 100644 --- a/sim/m32r/cpux.c +++ b/sim/m32r/cpux.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. diff --git a/sim/m32r/cpux.h b/sim/m32r/cpux.h index 7fde2cc..1f0390c 100644 --- a/sim/m32r/cpux.h +++ b/sim/m32r/cpux.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -129,6 +129,9 @@ union sem_fields { int empty; } fmt_empty; struct { /* */ + UINT f_uimm8; + } sfmt_clrpsw; + struct { /* */ UINT f_uimm4; } sfmt_trap; struct { /* */ @@ -175,6 +178,13 @@ union sem_fields { unsigned char out_h_gr_SI_14; } sfmt_jl; struct { /* */ + SI* i_sr; + INT f_simm16; + UINT f_r2; + UINT f_uimm3; + unsigned char in_sr; + } sfmt_bset; + struct { /* */ SI* i_dr; UINT f_r1; UINT f_uimm5; @@ -725,6 +735,49 @@ struct scache { f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ f_uimm16 = EXTRACT_MSB0_UINT (insn, 32, 16, 16); \ +#define EXTRACT_IFMT_CLRPSW_VARS \ + UINT f_op1; \ + UINT f_r1; \ + UINT f_uimm8; \ + unsigned int length; +#define EXTRACT_IFMT_CLRPSW_CODE \ + length = 2; \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_uimm8 = EXTRACT_MSB0_UINT (insn, 16, 8, 8); \ + +#define EXTRACT_IFMT_BSET_VARS \ + UINT f_op1; \ + UINT f_bit4; \ + UINT f_uimm3; \ + UINT f_op2; \ + UINT f_r2; \ + INT f_simm16; \ + unsigned int length; +#define EXTRACT_IFMT_BSET_CODE \ + length = 4; \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_bit4 = EXTRACT_MSB0_UINT (insn, 32, 4, 1); \ + f_uimm3 = EXTRACT_MSB0_UINT (insn, 32, 5, 3); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 32, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ + f_simm16 = EXTRACT_MSB0_INT (insn, 32, 16, 16); \ + +#define EXTRACT_IFMT_BTST_VARS \ + UINT f_op1; \ + UINT f_bit4; \ + UINT f_uimm3; \ + UINT f_op2; \ + UINT f_r2; \ + unsigned int length; +#define EXTRACT_IFMT_BTST_CODE \ + length = 2; \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_bit4 = EXTRACT_MSB0_UINT (insn, 16, 4, 1); \ + f_uimm3 = EXTRACT_MSB0_UINT (insn, 16, 5, 3); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 16, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); \ + /* Queued output values of an instruction. */ struct parexec { @@ -921,6 +974,16 @@ struct parexec { USI h_memory_SI_new_src2_idx; SI src2; } sfmt_st_plus; + struct { /* e.g. sth $src1,@$src2+ */ + HI h_memory_HI_new_src2; + USI h_memory_HI_new_src2_idx; + SI src2; + } sfmt_sth_plus; + struct { /* e.g. stb $src1,@$src2+ */ + QI h_memory_QI_new_src2; + USI h_memory_QI_new_src2_idx; + SI src2; + } sfmt_stb_plus; struct { /* e.g. trap $uimm4 */ UQI h_bbpsw_UQI; UQI h_bpsw_UQI; @@ -955,6 +1018,19 @@ struct parexec { struct { /* e.g. sc */ int empty; } sfmt_sc; + struct { /* e.g. clrpsw $uimm8 */ + USI h_cr_USI_0; + } sfmt_clrpsw; + struct { /* e.g. setpsw $uimm8 */ + USI h_cr_USI_0; + } sfmt_setpsw; + struct { /* e.g. bset $uimm3,@($slo16,$sr) */ + QI h_memory_QI_add__DFLT_sr_slo16; + USI h_memory_QI_add__DFLT_sr_slo16_idx; + } sfmt_bset; + struct { /* e.g. btst $uimm3,$sr */ + BI condbit; + } sfmt_btst; } operands; /* For conditionally written operands, bitmask of which ones were. */ int written; diff --git a/sim/m32r/decode.c b/sim/m32r/decode.c index e3b82cd..0831af4 100644 --- a/sim/m32r/decode.c +++ b/sim/m32r/decode.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -145,6 +145,11 @@ static const struct insn_sem m32rbf_insn_sem[] = { M32R_INSN_SUBX, M32RBF_INSN_SUBX, M32RBF_SFMT_ADDX }, { M32R_INSN_TRAP, M32RBF_INSN_TRAP, M32RBF_SFMT_TRAP }, { M32R_INSN_UNLOCK, M32RBF_INSN_UNLOCK, M32RBF_SFMT_UNLOCK }, + { M32R_INSN_CLRPSW, M32RBF_INSN_CLRPSW, M32RBF_SFMT_CLRPSW }, + { M32R_INSN_SETPSW, M32RBF_INSN_SETPSW, M32RBF_SFMT_SETPSW }, + { M32R_INSN_BSET, M32RBF_INSN_BSET, M32RBF_SFMT_BSET }, + { M32R_INSN_BCLR, M32RBF_INSN_BCLR, M32RBF_SFMT_BSET }, + { M32R_INSN_BTST, M32RBF_INSN_BTST, M32RBF_SFMT_BTST }, }; static const struct insn_sem m32rbf_insn_sem_invalid = { @@ -237,6 +242,7 @@ m32rbf_decode (SIM_CPU *current_cpu, IADDR pc, case 12 : itype = M32RBF_INSN_AND; goto extract_sfmt_add; case 13 : itype = M32RBF_INSN_XOR; goto extract_sfmt_add; case 14 : itype = M32RBF_INSN_OR; goto extract_sfmt_add; + case 15 : itype = M32RBF_INSN_BTST; goto extract_sfmt_btst; case 16 : itype = M32RBF_INSN_SRL; goto extract_sfmt_add; case 18 : itype = M32RBF_INSN_SRA; goto extract_sfmt_add; case 20 : itype = M32RBF_INSN_SLL; goto extract_sfmt_add; @@ -344,6 +350,8 @@ m32rbf_decode (SIM_CPU *current_cpu, IADDR pc, switch (val) { case 0 : itype = M32RBF_INSN_NOP; goto extract_sfmt_nop; + case 1 : itype = M32RBF_INSN_SETPSW; goto extract_sfmt_setpsw; + case 2 : itype = M32RBF_INSN_CLRPSW; goto extract_sfmt_clrpsw; case 12 : itype = M32RBF_INSN_BC8; goto extract_sfmt_bc8; case 13 : itype = M32RBF_INSN_BNC8; goto extract_sfmt_bc8; case 14 : itype = M32RBF_INSN_BL8; goto extract_sfmt_bl8; @@ -367,13 +375,15 @@ m32rbf_decode (SIM_CPU *current_cpu, IADDR pc, case 126 : /* fall through */ case 127 : { - unsigned int val = (((insn >> 8) & (3 << 0))); + unsigned int val = (((insn >> 8) & (15 << 0))); switch (val) { - case 0 : itype = M32RBF_INSN_BC8; goto extract_sfmt_bc8; - case 1 : itype = M32RBF_INSN_BNC8; goto extract_sfmt_bc8; - case 2 : itype = M32RBF_INSN_BL8; goto extract_sfmt_bl8; - case 3 : itype = M32RBF_INSN_BRA8; goto extract_sfmt_bra8; + case 1 : itype = M32RBF_INSN_SETPSW; goto extract_sfmt_setpsw; + case 2 : itype = M32RBF_INSN_CLRPSW; goto extract_sfmt_clrpsw; + case 12 : itype = M32RBF_INSN_BC8; goto extract_sfmt_bc8; + case 13 : itype = M32RBF_INSN_BNC8; goto extract_sfmt_bc8; + case 14 : itype = M32RBF_INSN_BL8; goto extract_sfmt_bl8; + case 15 : itype = M32RBF_INSN_BRA8; goto extract_sfmt_bra8; default : itype = M32RBF_INSN_X_INVALID; goto extract_sfmt_empty; } } @@ -395,6 +405,8 @@ m32rbf_decode (SIM_CPU *current_cpu, IADDR pc, case 160 : itype = M32RBF_INSN_STB_D; goto extract_sfmt_stb_d; case 162 : itype = M32RBF_INSN_STH_D; goto extract_sfmt_sth_d; case 164 : itype = M32RBF_INSN_ST_D; goto extract_sfmt_st_d; + case 166 : itype = M32RBF_INSN_BSET; goto extract_sfmt_bset; + case 167 : itype = M32RBF_INSN_BCLR; goto extract_sfmt_bset; case 168 : itype = M32RBF_INSN_LDB_D; goto extract_sfmt_ldb_d; case 169 : itype = M32RBF_INSN_LDUB_D; goto extract_sfmt_ldb_d; case 170 : itype = M32RBF_INSN_LDH_D; goto extract_sfmt_ldh_d; @@ -2005,4 +2017,97 @@ m32rbf_decode (SIM_CPU *current_cpu, IADDR pc, return idesc; } + extract_sfmt_clrpsw: + { + const IDESC *idesc = &m32rbf_insn_data[itype]; + CGEN_INSN_INT insn = entire_insn; +#define FLD(f) abuf->fields.sfmt_clrpsw.f + UINT f_uimm8; + + f_uimm8 = EXTRACT_MSB0_UINT (insn, 16, 8, 8); + + /* Record the fields for the semantic handler. */ + FLD (f_uimm8) = f_uimm8; + TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_clrpsw", "f_uimm8 0x%x", 'x', f_uimm8, (char *) 0)); + +#undef FLD + return idesc; + } + + extract_sfmt_setpsw: + { + const IDESC *idesc = &m32rbf_insn_data[itype]; + CGEN_INSN_INT insn = entire_insn; +#define FLD(f) abuf->fields.sfmt_clrpsw.f + UINT f_uimm8; + + f_uimm8 = EXTRACT_MSB0_UINT (insn, 16, 8, 8); + + /* Record the fields for the semantic handler. */ + FLD (f_uimm8) = f_uimm8; + TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_setpsw", "f_uimm8 0x%x", 'x', f_uimm8, (char *) 0)); + +#undef FLD + return idesc; + } + + extract_sfmt_bset: + { + const IDESC *idesc = &m32rbf_insn_data[itype]; + CGEN_INSN_INT insn = entire_insn; +#define FLD(f) abuf->fields.sfmt_bset.f + UINT f_uimm3; + UINT f_r2; + INT f_simm16; + + f_uimm3 = EXTRACT_MSB0_UINT (insn, 32, 5, 3); + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); + f_simm16 = EXTRACT_MSB0_INT (insn, 32, 16, 16); + + /* Record the fields for the semantic handler. */ + FLD (f_simm16) = f_simm16; + FLD (f_r2) = f_r2; + FLD (f_uimm3) = f_uimm3; + FLD (i_sr) = & CPU (h_gr)[f_r2]; + TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_bset", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_uimm3 0x%x", 'x', f_uimm3, "sr 0x%x", 'x', f_r2, (char *) 0)); + +#if WITH_PROFILE_MODEL_P + /* Record the fields for profiling. */ + if (PROFILE_MODEL_P (current_cpu)) + { + FLD (in_sr) = f_r2; + } +#endif +#undef FLD + return idesc; + } + + extract_sfmt_btst: + { + const IDESC *idesc = &m32rbf_insn_data[itype]; + CGEN_INSN_INT insn = entire_insn; +#define FLD(f) abuf->fields.sfmt_bset.f + UINT f_uimm3; + UINT f_r2; + + f_uimm3 = EXTRACT_MSB0_UINT (insn, 16, 5, 3); + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); + + /* Record the fields for the semantic handler. */ + FLD (f_r2) = f_r2; + FLD (f_uimm3) = f_uimm3; + FLD (i_sr) = & CPU (h_gr)[f_r2]; + TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_btst", "f_r2 0x%x", 'x', f_r2, "f_uimm3 0x%x", 'x', f_uimm3, "sr 0x%x", 'x', f_r2, (char *) 0)); + +#if WITH_PROFILE_MODEL_P + /* Record the fields for profiling. */ + if (PROFILE_MODEL_P (current_cpu)) + { + FLD (in_sr) = f_r2; + } +#endif +#undef FLD + return idesc; + } + } diff --git a/sim/m32r/decode.h b/sim/m32r/decode.h index f7a2237..00a411c 100644 --- a/sim/m32r/decode.h +++ b/sim/m32r/decode.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -60,7 +60,8 @@ typedef enum m32rbf_insn_type { , M32RBF_INSN_ST, M32RBF_INSN_ST_D, M32RBF_INSN_STB, M32RBF_INSN_STB_D , M32RBF_INSN_STH, M32RBF_INSN_STH_D, M32RBF_INSN_ST_PLUS, M32RBF_INSN_ST_MINUS , M32RBF_INSN_SUB, M32RBF_INSN_SUBV, M32RBF_INSN_SUBX, M32RBF_INSN_TRAP - , M32RBF_INSN_UNLOCK, M32RBF_INSN__MAX + , M32RBF_INSN_UNLOCK, M32RBF_INSN_CLRPSW, M32RBF_INSN_SETPSW, M32RBF_INSN_BSET + , M32RBF_INSN_BCLR, M32RBF_INSN_BTST, M32RBF_INSN__MAX } M32RBF_INSN_TYPE; /* Enum declaration for semantic formats in cpu family m32rbf. */ @@ -78,7 +79,8 @@ typedef enum m32rbf_sfmt_type { , M32RBF_SFMT_NOP, M32RBF_SFMT_RAC, M32RBF_SFMT_RTE, M32RBF_SFMT_SETH , M32RBF_SFMT_SLL3, M32RBF_SFMT_SLLI, M32RBF_SFMT_ST, M32RBF_SFMT_ST_D , M32RBF_SFMT_STB, M32RBF_SFMT_STB_D, M32RBF_SFMT_STH, M32RBF_SFMT_STH_D - , M32RBF_SFMT_ST_PLUS, M32RBF_SFMT_TRAP, M32RBF_SFMT_UNLOCK + , M32RBF_SFMT_ST_PLUS, M32RBF_SFMT_TRAP, M32RBF_SFMT_UNLOCK, M32RBF_SFMT_CLRPSW + , M32RBF_SFMT_SETPSW, M32RBF_SFMT_BSET, M32RBF_SFMT_BTST } M32RBF_SFMT_TYPE; /* Function unit handlers (user written). */ diff --git a/sim/m32r/decodex.c b/sim/m32r/decodex.c index 06317f0..893abc9 100644 --- a/sim/m32r/decodex.c +++ b/sim/m32r/decodex.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -152,6 +152,8 @@ static const struct insn_sem m32rxf_insn_sem[] = { M32R_INSN_STH, M32RXF_INSN_STH, M32RXF_SFMT_STH, M32RXF_INSN_PAR_STH, M32RXF_INSN_WRITE_STH }, { M32R_INSN_STH_D, M32RXF_INSN_STH_D, M32RXF_SFMT_STH_D, NOPAR, NOPAR }, { M32R_INSN_ST_PLUS, M32RXF_INSN_ST_PLUS, M32RXF_SFMT_ST_PLUS, M32RXF_INSN_PAR_ST_PLUS, M32RXF_INSN_WRITE_ST_PLUS }, + { M32R_INSN_STH_PLUS, M32RXF_INSN_STH_PLUS, M32RXF_SFMT_STH_PLUS, M32RXF_INSN_PAR_STH_PLUS, M32RXF_INSN_WRITE_STH_PLUS }, + { M32R_INSN_STB_PLUS, M32RXF_INSN_STB_PLUS, M32RXF_SFMT_STB_PLUS, M32RXF_INSN_PAR_STB_PLUS, M32RXF_INSN_WRITE_STB_PLUS }, { M32R_INSN_ST_MINUS, M32RXF_INSN_ST_MINUS, M32RXF_SFMT_ST_PLUS, M32RXF_INSN_PAR_ST_MINUS, M32RXF_INSN_WRITE_ST_MINUS }, { M32R_INSN_SUB, M32RXF_INSN_SUB, M32RXF_SFMT_ADD, M32RXF_INSN_PAR_SUB, M32RXF_INSN_WRITE_SUB }, { M32R_INSN_SUBV, M32RXF_INSN_SUBV, M32RXF_SFMT_ADDV, M32RXF_INSN_PAR_SUBV, M32RXF_INSN_WRITE_SUBV }, @@ -169,6 +171,11 @@ static const struct insn_sem m32rxf_insn_sem[] = { M32R_INSN_MACLH1, M32RXF_INSN_MACLH1, M32RXF_SFMT_MACWU1, M32RXF_INSN_PAR_MACLH1, M32RXF_INSN_WRITE_MACLH1 }, { M32R_INSN_SC, M32RXF_INSN_SC, M32RXF_SFMT_SC, M32RXF_INSN_PAR_SC, M32RXF_INSN_WRITE_SC }, { M32R_INSN_SNC, M32RXF_INSN_SNC, M32RXF_SFMT_SC, M32RXF_INSN_PAR_SNC, M32RXF_INSN_WRITE_SNC }, + { M32R_INSN_CLRPSW, M32RXF_INSN_CLRPSW, M32RXF_SFMT_CLRPSW, M32RXF_INSN_PAR_CLRPSW, M32RXF_INSN_WRITE_CLRPSW }, + { M32R_INSN_SETPSW, M32RXF_INSN_SETPSW, M32RXF_SFMT_SETPSW, M32RXF_INSN_PAR_SETPSW, M32RXF_INSN_WRITE_SETPSW }, + { M32R_INSN_BSET, M32RXF_INSN_BSET, M32RXF_SFMT_BSET, NOPAR, NOPAR }, + { M32R_INSN_BCLR, M32RXF_INSN_BCLR, M32RXF_SFMT_BSET, NOPAR, NOPAR }, + { M32R_INSN_BTST, M32RXF_INSN_BTST, M32RXF_SFMT_BTST, M32RXF_INSN_PAR_BTST, M32RXF_INSN_WRITE_BTST }, }; static const struct insn_sem m32rxf_insn_sem_invalid = { @@ -282,6 +289,7 @@ m32rxf_decode (SIM_CPU *current_cpu, IADDR pc, case 12 : itype = M32RXF_INSN_AND; goto extract_sfmt_add; case 13 : itype = M32RXF_INSN_XOR; goto extract_sfmt_add; case 14 : itype = M32RXF_INSN_OR; goto extract_sfmt_add; + case 15 : itype = M32RXF_INSN_BTST; goto extract_sfmt_btst; case 16 : itype = M32RXF_INSN_SRL; goto extract_sfmt_add; case 18 : itype = M32RXF_INSN_SRA; goto extract_sfmt_add; case 20 : itype = M32RXF_INSN_SLL; goto extract_sfmt_add; @@ -304,7 +312,9 @@ m32rxf_decode (SIM_CPU *current_cpu, IADDR pc, case 29 : itype = M32RXF_INSN_RTE; goto extract_sfmt_rte; case 31 : itype = M32RXF_INSN_TRAP; goto extract_sfmt_trap; case 32 : itype = M32RXF_INSN_STB; goto extract_sfmt_stb; + case 33 : itype = M32RXF_INSN_STB_PLUS; goto extract_sfmt_stb_plus; case 34 : itype = M32RXF_INSN_STH; goto extract_sfmt_sth; + case 35 : itype = M32RXF_INSN_STH_PLUS; goto extract_sfmt_sth_plus; case 36 : itype = M32RXF_INSN_ST; goto extract_sfmt_st; case 37 : itype = M32RXF_INSN_UNLOCK; goto extract_sfmt_unlock; case 38 : itype = M32RXF_INSN_ST_PLUS; goto extract_sfmt_st_plus; @@ -404,6 +414,10 @@ m32rxf_decode (SIM_CPU *current_cpu, IADDR pc, switch (val) { case 0 : itype = M32RXF_INSN_NOP; goto extract_sfmt_nop; + case 2 : /* fall through */ + case 3 : itype = M32RXF_INSN_SETPSW; goto extract_sfmt_setpsw; + case 4 : /* fall through */ + case 5 : itype = M32RXF_INSN_CLRPSW; goto extract_sfmt_clrpsw; case 9 : itype = M32RXF_INSN_SC; goto extract_sfmt_sc; case 11 : itype = M32RXF_INSN_SNC; goto extract_sfmt_sc; case 16 : /* fall through */ @@ -437,15 +451,17 @@ m32rxf_decode (SIM_CPU *current_cpu, IADDR pc, case 126 : /* fall through */ case 127 : { - unsigned int val = (((insn >> 8) & (7 << 0))); + unsigned int val = (((insn >> 8) & (15 << 0))); switch (val) { - case 0 : itype = M32RXF_INSN_BCL8; goto extract_sfmt_bcl8; - case 1 : itype = M32RXF_INSN_BNCL8; goto extract_sfmt_bcl8; - case 4 : itype = M32RXF_INSN_BC8; goto extract_sfmt_bc8; - case 5 : itype = M32RXF_INSN_BNC8; goto extract_sfmt_bc8; - case 6 : itype = M32RXF_INSN_BL8; goto extract_sfmt_bl8; - case 7 : itype = M32RXF_INSN_BRA8; goto extract_sfmt_bra8; + case 1 : itype = M32RXF_INSN_SETPSW; goto extract_sfmt_setpsw; + case 2 : itype = M32RXF_INSN_CLRPSW; goto extract_sfmt_clrpsw; + case 8 : itype = M32RXF_INSN_BCL8; goto extract_sfmt_bcl8; + case 9 : itype = M32RXF_INSN_BNCL8; goto extract_sfmt_bcl8; + case 12 : itype = M32RXF_INSN_BC8; goto extract_sfmt_bc8; + case 13 : itype = M32RXF_INSN_BNC8; goto extract_sfmt_bc8; + case 14 : itype = M32RXF_INSN_BL8; goto extract_sfmt_bl8; + case 15 : itype = M32RXF_INSN_BRA8; goto extract_sfmt_bra8; default : itype = M32RXF_INSN_X_INVALID; goto extract_sfmt_empty; } } @@ -487,6 +503,8 @@ m32rxf_decode (SIM_CPU *current_cpu, IADDR pc, case 160 : itype = M32RXF_INSN_STB_D; goto extract_sfmt_stb_d; case 162 : itype = M32RXF_INSN_STH_D; goto extract_sfmt_sth_d; case 164 : itype = M32RXF_INSN_ST_D; goto extract_sfmt_st_d; + case 166 : itype = M32RXF_INSN_BSET; goto extract_sfmt_bset; + case 167 : itype = M32RXF_INSN_BCLR; goto extract_sfmt_bset; case 168 : itype = M32RXF_INSN_LDB_D; goto extract_sfmt_ldb_d; case 169 : itype = M32RXF_INSN_LDUB_D; goto extract_sfmt_ldb_d; case 170 : itype = M32RXF_INSN_LDH_D; goto extract_sfmt_ldh_d; @@ -2166,6 +2184,68 @@ m32rxf_decode (SIM_CPU *current_cpu, IADDR pc, return idesc; } + extract_sfmt_sth_plus: + { + const IDESC *idesc = &m32rxf_insn_data[itype]; + CGEN_INSN_INT insn = entire_insn; +#define FLD(f) abuf->fields.sfmt_st_plus.f + UINT f_r1; + UINT f_r2; + + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); + + /* Record the fields for the semantic handler. */ + FLD (f_r1) = f_r1; + FLD (f_r2) = f_r2; + FLD (i_src1) = & CPU (h_gr)[f_r1]; + FLD (i_src2) = & CPU (h_gr)[f_r2]; + TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sth_plus", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0)); + +#if WITH_PROFILE_MODEL_P + /* Record the fields for profiling. */ + if (PROFILE_MODEL_P (current_cpu)) + { + FLD (in_src1) = f_r1; + FLD (in_src2) = f_r2; + FLD (out_src2) = f_r2; + } +#endif +#undef FLD + return idesc; + } + + extract_sfmt_stb_plus: + { + const IDESC *idesc = &m32rxf_insn_data[itype]; + CGEN_INSN_INT insn = entire_insn; +#define FLD(f) abuf->fields.sfmt_st_plus.f + UINT f_r1; + UINT f_r2; + + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); + + /* Record the fields for the semantic handler. */ + FLD (f_r1) = f_r1; + FLD (f_r2) = f_r2; + FLD (i_src1) = & CPU (h_gr)[f_r1]; + FLD (i_src2) = & CPU (h_gr)[f_r2]; + TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_stb_plus", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0)); + +#if WITH_PROFILE_MODEL_P + /* Record the fields for profiling. */ + if (PROFILE_MODEL_P (current_cpu)) + { + FLD (in_src1) = f_r1; + FLD (in_src2) = f_r2; + FLD (out_src2) = f_r2; + } +#endif +#undef FLD + return idesc; + } + extract_sfmt_trap: { const IDESC *idesc = &m32rxf_insn_data[itype]; @@ -2395,4 +2475,97 @@ m32rxf_decode (SIM_CPU *current_cpu, IADDR pc, return idesc; } + extract_sfmt_clrpsw: + { + const IDESC *idesc = &m32rxf_insn_data[itype]; + CGEN_INSN_INT insn = entire_insn; +#define FLD(f) abuf->fields.sfmt_clrpsw.f + UINT f_uimm8; + + f_uimm8 = EXTRACT_MSB0_UINT (insn, 16, 8, 8); + + /* Record the fields for the semantic handler. */ + FLD (f_uimm8) = f_uimm8; + TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_clrpsw", "f_uimm8 0x%x", 'x', f_uimm8, (char *) 0)); + +#undef FLD + return idesc; + } + + extract_sfmt_setpsw: + { + const IDESC *idesc = &m32rxf_insn_data[itype]; + CGEN_INSN_INT insn = entire_insn; +#define FLD(f) abuf->fields.sfmt_clrpsw.f + UINT f_uimm8; + + f_uimm8 = EXTRACT_MSB0_UINT (insn, 16, 8, 8); + + /* Record the fields for the semantic handler. */ + FLD (f_uimm8) = f_uimm8; + TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_setpsw", "f_uimm8 0x%x", 'x', f_uimm8, (char *) 0)); + +#undef FLD + return idesc; + } + + extract_sfmt_bset: + { + const IDESC *idesc = &m32rxf_insn_data[itype]; + CGEN_INSN_INT insn = entire_insn; +#define FLD(f) abuf->fields.sfmt_bset.f + UINT f_uimm3; + UINT f_r2; + INT f_simm16; + + f_uimm3 = EXTRACT_MSB0_UINT (insn, 32, 5, 3); + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); + f_simm16 = EXTRACT_MSB0_INT (insn, 32, 16, 16); + + /* Record the fields for the semantic handler. */ + FLD (f_simm16) = f_simm16; + FLD (f_r2) = f_r2; + FLD (f_uimm3) = f_uimm3; + FLD (i_sr) = & CPU (h_gr)[f_r2]; + TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_bset", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_uimm3 0x%x", 'x', f_uimm3, "sr 0x%x", 'x', f_r2, (char *) 0)); + +#if WITH_PROFILE_MODEL_P + /* Record the fields for profiling. */ + if (PROFILE_MODEL_P (current_cpu)) + { + FLD (in_sr) = f_r2; + } +#endif +#undef FLD + return idesc; + } + + extract_sfmt_btst: + { + const IDESC *idesc = &m32rxf_insn_data[itype]; + CGEN_INSN_INT insn = entire_insn; +#define FLD(f) abuf->fields.sfmt_bset.f + UINT f_uimm3; + UINT f_r2; + + f_uimm3 = EXTRACT_MSB0_UINT (insn, 16, 5, 3); + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); + + /* Record the fields for the semantic handler. */ + FLD (f_r2) = f_r2; + FLD (f_uimm3) = f_uimm3; + FLD (i_sr) = & CPU (h_gr)[f_r2]; + TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_btst", "f_r2 0x%x", 'x', f_r2, "f_uimm3 0x%x", 'x', f_uimm3, "sr 0x%x", 'x', f_r2, (char *) 0)); + +#if WITH_PROFILE_MODEL_P + /* Record the fields for profiling. */ + if (PROFILE_MODEL_P (current_cpu)) + { + FLD (in_sr) = f_r2; + } +#endif +#undef FLD + return idesc; + } + } diff --git a/sim/m32r/decodex.h b/sim/m32r/decodex.h index 0880199..e8de9a8 100644 --- a/sim/m32r/decodex.h +++ b/sim/m32r/decodex.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -61,49 +61,53 @@ typedef enum m32rxf_insn_type { , M32RXF_INSN_SRA3, M32RXF_INSN_SRAI, M32RXF_INSN_SRL, M32RXF_INSN_SRL3 , M32RXF_INSN_SRLI, M32RXF_INSN_ST, M32RXF_INSN_ST_D, M32RXF_INSN_STB , M32RXF_INSN_STB_D, M32RXF_INSN_STH, M32RXF_INSN_STH_D, M32RXF_INSN_ST_PLUS - , M32RXF_INSN_ST_MINUS, M32RXF_INSN_SUB, M32RXF_INSN_SUBV, M32RXF_INSN_SUBX - , M32RXF_INSN_TRAP, M32RXF_INSN_UNLOCK, M32RXF_INSN_SATB, M32RXF_INSN_SATH - , M32RXF_INSN_SAT, M32RXF_INSN_PCMPBZ, M32RXF_INSN_SADD, M32RXF_INSN_MACWU1 - , M32RXF_INSN_MSBLO, M32RXF_INSN_MULWU1, M32RXF_INSN_MACLH1, M32RXF_INSN_SC - , M32RXF_INSN_SNC, M32RXF_INSN_PAR_ADD, M32RXF_INSN_WRITE_ADD, M32RXF_INSN_PAR_AND - , M32RXF_INSN_WRITE_AND, M32RXF_INSN_PAR_OR, M32RXF_INSN_WRITE_OR, M32RXF_INSN_PAR_XOR - , M32RXF_INSN_WRITE_XOR, M32RXF_INSN_PAR_ADDI, M32RXF_INSN_WRITE_ADDI, M32RXF_INSN_PAR_ADDV - , M32RXF_INSN_WRITE_ADDV, M32RXF_INSN_PAR_ADDX, M32RXF_INSN_WRITE_ADDX, M32RXF_INSN_PAR_BC8 - , M32RXF_INSN_WRITE_BC8, M32RXF_INSN_PAR_BL8, M32RXF_INSN_WRITE_BL8, M32RXF_INSN_PAR_BCL8 - , M32RXF_INSN_WRITE_BCL8, M32RXF_INSN_PAR_BNC8, M32RXF_INSN_WRITE_BNC8, M32RXF_INSN_PAR_BRA8 - , M32RXF_INSN_WRITE_BRA8, M32RXF_INSN_PAR_BNCL8, M32RXF_INSN_WRITE_BNCL8, M32RXF_INSN_PAR_CMP - , M32RXF_INSN_WRITE_CMP, M32RXF_INSN_PAR_CMPU, M32RXF_INSN_WRITE_CMPU, M32RXF_INSN_PAR_CMPEQ - , M32RXF_INSN_WRITE_CMPEQ, M32RXF_INSN_PAR_CMPZ, M32RXF_INSN_WRITE_CMPZ, M32RXF_INSN_PAR_JC - , M32RXF_INSN_WRITE_JC, M32RXF_INSN_PAR_JNC, M32RXF_INSN_WRITE_JNC, M32RXF_INSN_PAR_JL - , M32RXF_INSN_WRITE_JL, M32RXF_INSN_PAR_JMP, M32RXF_INSN_WRITE_JMP, M32RXF_INSN_PAR_LD - , M32RXF_INSN_WRITE_LD, M32RXF_INSN_PAR_LDB, M32RXF_INSN_WRITE_LDB, M32RXF_INSN_PAR_LDH - , M32RXF_INSN_WRITE_LDH, M32RXF_INSN_PAR_LDUB, M32RXF_INSN_WRITE_LDUB, M32RXF_INSN_PAR_LDUH - , M32RXF_INSN_WRITE_LDUH, M32RXF_INSN_PAR_LD_PLUS, M32RXF_INSN_WRITE_LD_PLUS, M32RXF_INSN_PAR_LDI8 - , M32RXF_INSN_WRITE_LDI8, M32RXF_INSN_PAR_LOCK, M32RXF_INSN_WRITE_LOCK, M32RXF_INSN_PAR_MACHI_A - , M32RXF_INSN_WRITE_MACHI_A, M32RXF_INSN_PAR_MACLO_A, M32RXF_INSN_WRITE_MACLO_A, M32RXF_INSN_PAR_MACWHI_A - , M32RXF_INSN_WRITE_MACWHI_A, M32RXF_INSN_PAR_MACWLO_A, M32RXF_INSN_WRITE_MACWLO_A, M32RXF_INSN_PAR_MUL - , M32RXF_INSN_WRITE_MUL, M32RXF_INSN_PAR_MULHI_A, M32RXF_INSN_WRITE_MULHI_A, M32RXF_INSN_PAR_MULLO_A - , M32RXF_INSN_WRITE_MULLO_A, M32RXF_INSN_PAR_MULWHI_A, M32RXF_INSN_WRITE_MULWHI_A, M32RXF_INSN_PAR_MULWLO_A - , M32RXF_INSN_WRITE_MULWLO_A, M32RXF_INSN_PAR_MV, M32RXF_INSN_WRITE_MV, M32RXF_INSN_PAR_MVFACHI_A - , M32RXF_INSN_WRITE_MVFACHI_A, M32RXF_INSN_PAR_MVFACLO_A, M32RXF_INSN_WRITE_MVFACLO_A, M32RXF_INSN_PAR_MVFACMI_A - , M32RXF_INSN_WRITE_MVFACMI_A, M32RXF_INSN_PAR_MVFC, M32RXF_INSN_WRITE_MVFC, M32RXF_INSN_PAR_MVTACHI_A - , M32RXF_INSN_WRITE_MVTACHI_A, M32RXF_INSN_PAR_MVTACLO_A, M32RXF_INSN_WRITE_MVTACLO_A, M32RXF_INSN_PAR_MVTC - , M32RXF_INSN_WRITE_MVTC, M32RXF_INSN_PAR_NEG, M32RXF_INSN_WRITE_NEG, M32RXF_INSN_PAR_NOP - , M32RXF_INSN_WRITE_NOP, M32RXF_INSN_PAR_NOT, M32RXF_INSN_WRITE_NOT, M32RXF_INSN_PAR_RAC_DSI - , M32RXF_INSN_WRITE_RAC_DSI, M32RXF_INSN_PAR_RACH_DSI, M32RXF_INSN_WRITE_RACH_DSI, M32RXF_INSN_PAR_RTE - , M32RXF_INSN_WRITE_RTE, M32RXF_INSN_PAR_SLL, M32RXF_INSN_WRITE_SLL, M32RXF_INSN_PAR_SLLI - , M32RXF_INSN_WRITE_SLLI, M32RXF_INSN_PAR_SRA, M32RXF_INSN_WRITE_SRA, M32RXF_INSN_PAR_SRAI - , M32RXF_INSN_WRITE_SRAI, M32RXF_INSN_PAR_SRL, M32RXF_INSN_WRITE_SRL, M32RXF_INSN_PAR_SRLI - , M32RXF_INSN_WRITE_SRLI, M32RXF_INSN_PAR_ST, M32RXF_INSN_WRITE_ST, M32RXF_INSN_PAR_STB - , M32RXF_INSN_WRITE_STB, M32RXF_INSN_PAR_STH, M32RXF_INSN_WRITE_STH, M32RXF_INSN_PAR_ST_PLUS - , M32RXF_INSN_WRITE_ST_PLUS, M32RXF_INSN_PAR_ST_MINUS, M32RXF_INSN_WRITE_ST_MINUS, M32RXF_INSN_PAR_SUB - , M32RXF_INSN_WRITE_SUB, M32RXF_INSN_PAR_SUBV, M32RXF_INSN_WRITE_SUBV, M32RXF_INSN_PAR_SUBX - , M32RXF_INSN_WRITE_SUBX, M32RXF_INSN_PAR_TRAP, M32RXF_INSN_WRITE_TRAP, M32RXF_INSN_PAR_UNLOCK - , M32RXF_INSN_WRITE_UNLOCK, M32RXF_INSN_PAR_PCMPBZ, M32RXF_INSN_WRITE_PCMPBZ, M32RXF_INSN_PAR_SADD - , M32RXF_INSN_WRITE_SADD, M32RXF_INSN_PAR_MACWU1, M32RXF_INSN_WRITE_MACWU1, M32RXF_INSN_PAR_MSBLO - , M32RXF_INSN_WRITE_MSBLO, M32RXF_INSN_PAR_MULWU1, M32RXF_INSN_WRITE_MULWU1, M32RXF_INSN_PAR_MACLH1 - , M32RXF_INSN_WRITE_MACLH1, M32RXF_INSN_PAR_SC, M32RXF_INSN_WRITE_SC, M32RXF_INSN_PAR_SNC - , M32RXF_INSN_WRITE_SNC, M32RXF_INSN__MAX + , M32RXF_INSN_STH_PLUS, M32RXF_INSN_STB_PLUS, M32RXF_INSN_ST_MINUS, M32RXF_INSN_SUB + , M32RXF_INSN_SUBV, M32RXF_INSN_SUBX, M32RXF_INSN_TRAP, M32RXF_INSN_UNLOCK + , M32RXF_INSN_SATB, M32RXF_INSN_SATH, M32RXF_INSN_SAT, M32RXF_INSN_PCMPBZ + , M32RXF_INSN_SADD, M32RXF_INSN_MACWU1, M32RXF_INSN_MSBLO, M32RXF_INSN_MULWU1 + , M32RXF_INSN_MACLH1, M32RXF_INSN_SC, M32RXF_INSN_SNC, M32RXF_INSN_CLRPSW + , M32RXF_INSN_SETPSW, M32RXF_INSN_BSET, M32RXF_INSN_BCLR, M32RXF_INSN_BTST + , M32RXF_INSN_PAR_ADD, M32RXF_INSN_WRITE_ADD, M32RXF_INSN_PAR_AND, M32RXF_INSN_WRITE_AND + , M32RXF_INSN_PAR_OR, M32RXF_INSN_WRITE_OR, M32RXF_INSN_PAR_XOR, M32RXF_INSN_WRITE_XOR + , M32RXF_INSN_PAR_ADDI, M32RXF_INSN_WRITE_ADDI, M32RXF_INSN_PAR_ADDV, M32RXF_INSN_WRITE_ADDV + , M32RXF_INSN_PAR_ADDX, M32RXF_INSN_WRITE_ADDX, M32RXF_INSN_PAR_BC8, M32RXF_INSN_WRITE_BC8 + , M32RXF_INSN_PAR_BL8, M32RXF_INSN_WRITE_BL8, M32RXF_INSN_PAR_BCL8, M32RXF_INSN_WRITE_BCL8 + , M32RXF_INSN_PAR_BNC8, M32RXF_INSN_WRITE_BNC8, M32RXF_INSN_PAR_BRA8, M32RXF_INSN_WRITE_BRA8 + , M32RXF_INSN_PAR_BNCL8, M32RXF_INSN_WRITE_BNCL8, M32RXF_INSN_PAR_CMP, M32RXF_INSN_WRITE_CMP + , M32RXF_INSN_PAR_CMPU, M32RXF_INSN_WRITE_CMPU, M32RXF_INSN_PAR_CMPEQ, M32RXF_INSN_WRITE_CMPEQ + , M32RXF_INSN_PAR_CMPZ, M32RXF_INSN_WRITE_CMPZ, M32RXF_INSN_PAR_JC, M32RXF_INSN_WRITE_JC + , M32RXF_INSN_PAR_JNC, M32RXF_INSN_WRITE_JNC, M32RXF_INSN_PAR_JL, M32RXF_INSN_WRITE_JL + , M32RXF_INSN_PAR_JMP, M32RXF_INSN_WRITE_JMP, M32RXF_INSN_PAR_LD, M32RXF_INSN_WRITE_LD + , M32RXF_INSN_PAR_LDB, M32RXF_INSN_WRITE_LDB, M32RXF_INSN_PAR_LDH, M32RXF_INSN_WRITE_LDH + , M32RXF_INSN_PAR_LDUB, M32RXF_INSN_WRITE_LDUB, M32RXF_INSN_PAR_LDUH, M32RXF_INSN_WRITE_LDUH + , M32RXF_INSN_PAR_LD_PLUS, M32RXF_INSN_WRITE_LD_PLUS, M32RXF_INSN_PAR_LDI8, M32RXF_INSN_WRITE_LDI8 + , M32RXF_INSN_PAR_LOCK, M32RXF_INSN_WRITE_LOCK, M32RXF_INSN_PAR_MACHI_A, M32RXF_INSN_WRITE_MACHI_A + , M32RXF_INSN_PAR_MACLO_A, M32RXF_INSN_WRITE_MACLO_A, M32RXF_INSN_PAR_MACWHI_A, M32RXF_INSN_WRITE_MACWHI_A + , M32RXF_INSN_PAR_MACWLO_A, M32RXF_INSN_WRITE_MACWLO_A, M32RXF_INSN_PAR_MUL, M32RXF_INSN_WRITE_MUL + , M32RXF_INSN_PAR_MULHI_A, M32RXF_INSN_WRITE_MULHI_A, M32RXF_INSN_PAR_MULLO_A, M32RXF_INSN_WRITE_MULLO_A + , M32RXF_INSN_PAR_MULWHI_A, M32RXF_INSN_WRITE_MULWHI_A, M32RXF_INSN_PAR_MULWLO_A, M32RXF_INSN_WRITE_MULWLO_A + , M32RXF_INSN_PAR_MV, M32RXF_INSN_WRITE_MV, M32RXF_INSN_PAR_MVFACHI_A, M32RXF_INSN_WRITE_MVFACHI_A + , M32RXF_INSN_PAR_MVFACLO_A, M32RXF_INSN_WRITE_MVFACLO_A, M32RXF_INSN_PAR_MVFACMI_A, M32RXF_INSN_WRITE_MVFACMI_A + , M32RXF_INSN_PAR_MVFC, M32RXF_INSN_WRITE_MVFC, M32RXF_INSN_PAR_MVTACHI_A, M32RXF_INSN_WRITE_MVTACHI_A + , M32RXF_INSN_PAR_MVTACLO_A, M32RXF_INSN_WRITE_MVTACLO_A, M32RXF_INSN_PAR_MVTC, M32RXF_INSN_WRITE_MVTC + , M32RXF_INSN_PAR_NEG, M32RXF_INSN_WRITE_NEG, M32RXF_INSN_PAR_NOP, M32RXF_INSN_WRITE_NOP + , M32RXF_INSN_PAR_NOT, M32RXF_INSN_WRITE_NOT, M32RXF_INSN_PAR_RAC_DSI, M32RXF_INSN_WRITE_RAC_DSI + , M32RXF_INSN_PAR_RACH_DSI, M32RXF_INSN_WRITE_RACH_DSI, M32RXF_INSN_PAR_RTE, M32RXF_INSN_WRITE_RTE + , M32RXF_INSN_PAR_SLL, M32RXF_INSN_WRITE_SLL, M32RXF_INSN_PAR_SLLI, M32RXF_INSN_WRITE_SLLI + , M32RXF_INSN_PAR_SRA, M32RXF_INSN_WRITE_SRA, M32RXF_INSN_PAR_SRAI, M32RXF_INSN_WRITE_SRAI + , M32RXF_INSN_PAR_SRL, M32RXF_INSN_WRITE_SRL, M32RXF_INSN_PAR_SRLI, M32RXF_INSN_WRITE_SRLI + , M32RXF_INSN_PAR_ST, M32RXF_INSN_WRITE_ST, M32RXF_INSN_PAR_STB, M32RXF_INSN_WRITE_STB + , M32RXF_INSN_PAR_STH, M32RXF_INSN_WRITE_STH, M32RXF_INSN_PAR_ST_PLUS, M32RXF_INSN_WRITE_ST_PLUS + , M32RXF_INSN_PAR_STH_PLUS, M32RXF_INSN_WRITE_STH_PLUS, M32RXF_INSN_PAR_STB_PLUS, M32RXF_INSN_WRITE_STB_PLUS + , M32RXF_INSN_PAR_ST_MINUS, M32RXF_INSN_WRITE_ST_MINUS, M32RXF_INSN_PAR_SUB, M32RXF_INSN_WRITE_SUB + , M32RXF_INSN_PAR_SUBV, M32RXF_INSN_WRITE_SUBV, M32RXF_INSN_PAR_SUBX, M32RXF_INSN_WRITE_SUBX + , M32RXF_INSN_PAR_TRAP, M32RXF_INSN_WRITE_TRAP, M32RXF_INSN_PAR_UNLOCK, M32RXF_INSN_WRITE_UNLOCK + , M32RXF_INSN_PAR_PCMPBZ, M32RXF_INSN_WRITE_PCMPBZ, M32RXF_INSN_PAR_SADD, M32RXF_INSN_WRITE_SADD + , M32RXF_INSN_PAR_MACWU1, M32RXF_INSN_WRITE_MACWU1, M32RXF_INSN_PAR_MSBLO, M32RXF_INSN_WRITE_MSBLO + , M32RXF_INSN_PAR_MULWU1, M32RXF_INSN_WRITE_MULWU1, M32RXF_INSN_PAR_MACLH1, M32RXF_INSN_WRITE_MACLH1 + , M32RXF_INSN_PAR_SC, M32RXF_INSN_WRITE_SC, M32RXF_INSN_PAR_SNC, M32RXF_INSN_WRITE_SNC + , M32RXF_INSN_PAR_CLRPSW, M32RXF_INSN_WRITE_CLRPSW, M32RXF_INSN_PAR_SETPSW, M32RXF_INSN_WRITE_SETPSW + , M32RXF_INSN_PAR_BTST, M32RXF_INSN_WRITE_BTST, M32RXF_INSN__MAX } M32RXF_INSN_TYPE; /* Enum declaration for semantic formats in cpu family m32rxf. */ @@ -122,9 +126,10 @@ typedef enum m32rxf_sfmt_type { , M32RXF_SFMT_NOP, M32RXF_SFMT_RAC_DSI, M32RXF_SFMT_RTE, M32RXF_SFMT_SETH , M32RXF_SFMT_SLL3, M32RXF_SFMT_SLLI, M32RXF_SFMT_ST, M32RXF_SFMT_ST_D , M32RXF_SFMT_STB, M32RXF_SFMT_STB_D, M32RXF_SFMT_STH, M32RXF_SFMT_STH_D - , M32RXF_SFMT_ST_PLUS, M32RXF_SFMT_TRAP, M32RXF_SFMT_UNLOCK, M32RXF_SFMT_SATB - , M32RXF_SFMT_SAT, M32RXF_SFMT_SADD, M32RXF_SFMT_MACWU1, M32RXF_SFMT_MSBLO - , M32RXF_SFMT_MULWU1, M32RXF_SFMT_SC + , M32RXF_SFMT_ST_PLUS, M32RXF_SFMT_STH_PLUS, M32RXF_SFMT_STB_PLUS, M32RXF_SFMT_TRAP + , M32RXF_SFMT_UNLOCK, M32RXF_SFMT_SATB, M32RXF_SFMT_SAT, M32RXF_SFMT_SADD + , M32RXF_SFMT_MACWU1, M32RXF_SFMT_MSBLO, M32RXF_SFMT_MULWU1, M32RXF_SFMT_SC + , M32RXF_SFMT_CLRPSW, M32RXF_SFMT_SETPSW, M32RXF_SFMT_BSET, M32RXF_SFMT_BTST } M32RXF_SFMT_TYPE; /* Function unit handlers (user written). */ diff --git a/sim/m32r/m32r-sim.h b/sim/m32r/m32r-sim.h index b1c2410..100274d 100644 --- a/sim/m32r/m32r-sim.h +++ b/sim/m32r/m32r-sim.h @@ -1,27 +1,27 @@ /* collection of junk waiting time to sort out - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 2003 Free Software Foundation, Inc. Contributed by Cygnus Support. -This file is part of the GNU Simulators. + This file is part of GDB, the GNU debugger. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef M32R_SIM_H #define M32R_SIM_H -/* gdb register numbers */ +/* GDB register numbers. */ #define PSW_REGNUM 16 #define CBR_REGNUM 17 #define SPI_REGNUM 18 @@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define ACC1H_REGNUM 25 #define BBPSW_REGNUM 26 #define BBPC_REGNUM 27 +#define EVB_REGNUM 28 extern int m32r_decode_gdb_ctrl_regnum (int); @@ -41,29 +42,35 @@ extern int m32r_decode_gdb_ctrl_regnum (int); FIXME: Eventually move to cgen. */ #define GET_H_SM() ((CPU (h_psw) & 0x80) != 0) -extern SI a_m32r_h_gr_get (SIM_CPU *, UINT); -extern void a_m32r_h_gr_set (SIM_CPU *, UINT, SI); -extern USI a_m32r_h_cr_get (SIM_CPU *, UINT); -extern void a_m32r_h_cr_set (SIM_CPU *, UINT, USI); - -extern USI m32rbf_h_cr_get_handler (SIM_CPU *, UINT); +#ifndef GET_H_CR +extern USI m32rbf_h_cr_get_handler (SIM_CPU *, UINT); extern void m32rbf_h_cr_set_handler (SIM_CPU *, UINT, USI); -extern UQI m32rbf_h_psw_get_handler (SIM_CPU *); +#define GET_H_CR(regno) \ + XCONCAT2 (WANT_CPU,_h_cr_get_handler) (current_cpu, (regno)) +#define SET_H_CR(regno, val) \ + XCONCAT2 (WANT_CPU,_h_cr_set_handler) (current_cpu, (regno), (val)) +#endif + +#ifndef GET_H_PSW +extern UQI m32rbf_h_psw_get_handler (SIM_CPU *); extern void m32rbf_h_psw_set_handler (SIM_CPU *, UQI); -extern DI m32rbf_h_accum_get_handler (SIM_CPU *); -extern void m32rbf_h_accum_set_handler (SIM_CPU *, DI); +#define GET_H_PSW() \ + XCONCAT2 (WANT_CPU,_h_psw_get_handler) (current_cpu) +#define SET_H_PSW(val) \ + XCONCAT2 (WANT_CPU,_h_psw_set_handler) (current_cpu, (val)) +#endif -extern USI m32rxf_h_cr_get_handler (SIM_CPU *, UINT); -extern void m32rxf_h_cr_set_handler (SIM_CPU *, UINT, USI); -extern UQI m32rxf_h_psw_get_handler (SIM_CPU *); -extern void m32rxf_h_psw_set_handler (SIM_CPU *, UQI); -extern DI m32rxf_h_accum_get_handler (SIM_CPU *); -extern void m32rxf_h_accum_set_handler (SIM_CPU *, DI); +#ifndef GET_H_ACCUM +extern DI m32rbf_h_accum_get_handler (SIM_CPU *); +extern void m32rbf_h_accum_set_handler (SIM_CPU *, DI); -extern DI m32rxf_h_accums_get_handler (SIM_CPU *, UINT); -extern void m32rxf_h_accums_set_handler (SIM_CPU *, UINT, DI); +#define GET_H_ACCUM() \ + XCONCAT2 (WANT_CPU,_h_accum_get_handler) (current_cpu) +#define SET_H_ACCUM(val) \ + XCONCAT2 (WANT_CPU,_h_accum_set_handler) (current_cpu, (val)) +#endif /* Misc. profile data. */ @@ -130,32 +137,6 @@ do { \ /* Additional execution support. */ -/* Result of semantic function is one of - - next address, branch only - - NEW_PC_SKIP, sc/snc insn - - NEW_PC_2, 2 byte non-branch non-sc/snc insn - - NEW_PC_4, 4 byte non-branch insn - The special values have bit 1 set so it's cheap to distinguish them. - This works because all cti's are defined to zero the bottom two bits - Note that the m32rx no longer doesn't implement its semantics with - functions, so this isn't used. It's kept around should it be needed - again. */ -/* FIXME: replace 0xffff0001 with 1? */ -#define NEW_PC_BASE 0xffff0001 -#define NEW_PC_SKIP NEW_PC_BASE -#define NEW_PC_2 (NEW_PC_BASE + 2) -#define NEW_PC_4 (NEW_PC_BASE + 4) -#define NEW_PC_BRANCH_P(addr) (((addr) & 1) == 0) - -/* Modify "next pc" support to handle parallel execution. - This is for the non-pbb case. The m32rx no longer implements this. - It's kept around should it be needed again. */ -#if defined (WANT_CPU_M32RXF) && ! WITH_SCACHE_PBB_M32RXF -#undef SEM_NEXT_VPC -#define SEM_NEXT_VPC(abuf, len) (NEW_PC_BASE + (len)) -#undef SEM_SKIP_INSN -#define SEM_SKIP_INSN(cpu, sc, vpcvar, yes) FIXME -#endif /* Hardware/device support. ??? Will eventually want to move device stuff to config files. */ @@ -217,7 +198,7 @@ do { \ /* Start address and length of all device support. */ #define M32R_DEVICE_ADDR 0xff000000 -#define M32R_DEVICE_LEN 0x01000000 +#define M32R_DEVICE_LEN 0x00ffffff /* sim_core_attach device argument. */ extern device m32r_devices; diff --git a/sim/m32r/m32r.c b/sim/m32r/m32r.c index 3e5e4aa..8e9c75e 100644 --- a/sim/m32r/m32r.c +++ b/sim/m32r/m32r.c @@ -1,22 +1,22 @@ /* m32r simulator support code - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 2003 Free Software Foundation, Inc. Contributed by Cygnus Support. -This file is part of GDB, the GNU debugger. + This file is part of GDB, the GNU debugger. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define WANT_CPU m32rbf #define WANT_CPU_M32RBF @@ -39,6 +39,7 @@ m32r_decode_gdb_ctrl_regnum (int gdb_regnum) case BPC_REGNUM : return H_CR_BPC; case BBPSW_REGNUM : return H_CR_BBPSW; case BBPC_REGNUM : return H_CR_BBPC; + case EVB_REGNUM : return H_CR_CR5; } abort (); } @@ -48,10 +49,8 @@ m32r_decode_gdb_ctrl_regnum (int gdb_regnum) int m32rbf_fetch_register (SIM_CPU *current_cpu, int rn, unsigned char *buf, int len) { - int mach = MACH_NUM (CPU_MACH (current_cpu)); - if (rn < 16) - SETTWI (buf, a_m32r_h_gr_get (current_cpu, rn)); + SETTWI (buf, m32rbf_h_gr_get (current_cpu, rn)); else switch (rn) { @@ -62,26 +61,17 @@ m32rbf_fetch_register (SIM_CPU *current_cpu, int rn, unsigned char *buf, int len case BPC_REGNUM : case BBPSW_REGNUM : case BBPC_REGNUM : - SETTWI (buf, a_m32r_h_cr_get (current_cpu, + SETTWI (buf, m32rbf_h_cr_get (current_cpu, m32r_decode_gdb_ctrl_regnum (rn))); break; case PC_REGNUM : - if (mach == MACH_M32R) - SETTWI (buf, m32rbf_h_pc_get (current_cpu)); - else - SETTWI (buf, m32rxf_h_pc_get (current_cpu)); + SETTWI (buf, m32rbf_h_pc_get (current_cpu)); break; case ACCL_REGNUM : - if (mach == MACH_M32R) - SETTWI (buf, GETLODI (m32rbf_h_accum_get (current_cpu))); - else - SETTWI (buf, GETLODI (m32rxf_h_accum_get (current_cpu))); + SETTWI (buf, GETLODI (m32rbf_h_accum_get (current_cpu))); break; case ACCH_REGNUM : - if (mach == MACH_M32R) - SETTWI (buf, GETHIDI (m32rbf_h_accum_get (current_cpu))); - else - SETTWI (buf, GETHIDI (m32rxf_h_accum_get (current_cpu))); + SETTWI (buf, GETHIDI (m32rbf_h_accum_get (current_cpu))); break; default : return 0; @@ -95,10 +85,8 @@ m32rbf_fetch_register (SIM_CPU *current_cpu, int rn, unsigned char *buf, int len int m32rbf_store_register (SIM_CPU *current_cpu, int rn, unsigned char *buf, int len) { - int mach = MACH_NUM (CPU_MACH (current_cpu)); - if (rn < 16) - a_m32r_h_gr_set (current_cpu, rn, GETTWI (buf)); + m32rbf_h_gr_set (current_cpu, rn, GETTWI (buf)); else switch (rn) { @@ -109,42 +97,25 @@ m32rbf_store_register (SIM_CPU *current_cpu, int rn, unsigned char *buf, int len case BPC_REGNUM : case BBPSW_REGNUM : case BBPC_REGNUM : - a_m32r_h_cr_set (current_cpu, + m32rbf_h_cr_set (current_cpu, m32r_decode_gdb_ctrl_regnum (rn), GETTWI (buf)); break; case PC_REGNUM : - if (mach == MACH_M32R) - m32rbf_h_pc_set (current_cpu, GETTWI (buf)); - else - m32rxf_h_pc_set (current_cpu, GETTWI (buf)); + m32rbf_h_pc_set (current_cpu, GETTWI (buf)); break; case ACCL_REGNUM : { - DI val; - if (mach == MACH_M32R) - val = m32rbf_h_accum_get (current_cpu); - else - val = m32rxf_h_accum_get (current_cpu); + DI val = m32rbf_h_accum_get (current_cpu); SETLODI (val, GETTWI (buf)); - if (mach == MACH_M32R) - m32rbf_h_accum_set (current_cpu, val); - else - m32rxf_h_accum_set (current_cpu, val); + m32rbf_h_accum_set (current_cpu, val); break; } case ACCH_REGNUM : { - DI val; - if (mach == MACH_M32R) - val = m32rbf_h_accum_get (current_cpu); - else - val = m32rxf_h_accum_get (current_cpu); + DI val = m32rbf_h_accum_get (current_cpu); SETHIDI (val, GETTWI (buf)); - if (mach == MACH_M32R) - m32rbf_h_accum_set (current_cpu, val); - else - m32rxf_h_accum_set (current_cpu, val); + m32rbf_h_accum_set (current_cpu, val); break; } default : @@ -154,84 +125,6 @@ m32rbf_store_register (SIM_CPU *current_cpu, int rn, unsigned char *buf, int len return -1; /*FIXME*/ } -/* Cover fns for mach independent register accesses. */ - -SI -a_m32r_h_gr_get (SIM_CPU *current_cpu, UINT regno) -{ - switch (MACH_NUM (CPU_MACH (current_cpu))) - { -#ifdef HAVE_CPU_M32RBF - case MACH_M32R : - return m32rbf_h_gr_get (current_cpu, regno); -#endif -#ifdef HAVE_CPU_M32RXF - case MACH_M32RX : - return m32rxf_h_gr_get (current_cpu, regno); -#endif - default : - abort (); - } -} - -void -a_m32r_h_gr_set (SIM_CPU *current_cpu, UINT regno, SI newval) -{ - switch (MACH_NUM (CPU_MACH (current_cpu))) - { -#ifdef HAVE_CPU_M32RBF - case MACH_M32R : - m32rbf_h_gr_set (current_cpu, regno, newval); - break; -#endif -#ifdef HAVE_CPU_M32RXF - case MACH_M32RX : - m32rxf_h_gr_set (current_cpu, regno, newval); - break; -#endif - default : - abort (); - } -} - -USI -a_m32r_h_cr_get (SIM_CPU *current_cpu, UINT regno) -{ - switch (MACH_NUM (CPU_MACH (current_cpu))) - { -#ifdef HAVE_CPU_M32RBF - case MACH_M32R : - return m32rbf_h_cr_get (current_cpu, regno); -#endif -#ifdef HAVE_CPU_M32RXF - case MACH_M32RX : - return m32rxf_h_cr_get (current_cpu, regno); -#endif - default : - abort (); - } -} - -void -a_m32r_h_cr_set (SIM_CPU *current_cpu, UINT regno, USI newval) -{ - switch (MACH_NUM (CPU_MACH (current_cpu))) - { -#ifdef HAVE_CPU_M32RBF - case MACH_M32R : - m32rbf_h_cr_set (current_cpu, regno, newval); - break; -#endif -#ifdef HAVE_CPU_M32RXF - case MACH_M32RX : - m32rxf_h_cr_set (current_cpu, regno, newval); - break; -#endif - default : - abort (); - } -} - USI m32rbf_h_cr_get_handler (SIM_CPU *current_cpu, UINT cr) { diff --git a/sim/m32r/model.c b/sim/m32r/model.c index 841026f..c94e349 100644 --- a/sim/m32r/model.c +++ b/sim/m32r/model.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -2281,6 +2281,107 @@ model_m32r_d_unlock (SIM_CPU *current_cpu, void *sem_arg) } static int +model_m32r_d_clrpsw (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_clrpsw.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_sr = -1; + INT in_dr = -1; + INT out_dr = -1; + cycles += m32rbf_model_m32r_d_u_exec (current_cpu, idesc, 0, referenced, in_sr, in_dr, out_dr); + } + return cycles; +#undef FLD +} + +static int +model_m32r_d_setpsw (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_clrpsw.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_sr = -1; + INT in_dr = -1; + INT out_dr = -1; + cycles += m32rbf_model_m32r_d_u_exec (current_cpu, idesc, 0, referenced, in_sr, in_dr, out_dr); + } + return cycles; +#undef FLD +} + +static int +model_m32r_d_bset (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_bset.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_sr = -1; + INT in_dr = -1; + INT out_dr = -1; + in_sr = FLD (in_sr); + referenced |= 1 << 0; + cycles += m32rbf_model_m32r_d_u_exec (current_cpu, idesc, 0, referenced, in_sr, in_dr, out_dr); + } + return cycles; +#undef FLD +} + +static int +model_m32r_d_bclr (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_bset.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_sr = -1; + INT in_dr = -1; + INT out_dr = -1; + in_sr = FLD (in_sr); + referenced |= 1 << 0; + cycles += m32rbf_model_m32r_d_u_exec (current_cpu, idesc, 0, referenced, in_sr, in_dr, out_dr); + } + return cycles; +#undef FLD +} + +static int +model_m32r_d_btst (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_bset.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_sr = -1; + INT in_dr = -1; + INT out_dr = -1; + in_sr = FLD (in_sr); + referenced |= 1 << 0; + cycles += m32rbf_model_m32r_d_u_exec (current_cpu, idesc, 0, referenced, in_sr, in_dr, out_dr); + } + return cycles; +#undef FLD +} + +static int model_test_add (SIM_CPU *current_cpu, void *sem_arg) { #define FLD(f) abuf->fields.sfmt_add.f @@ -3864,6 +3965,86 @@ model_test_unlock (SIM_CPU *current_cpu, void *sem_arg) #undef FLD } +static int +model_test_clrpsw (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_clrpsw.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + cycles += m32rbf_model_test_u_exec (current_cpu, idesc, 0, referenced); + } + return cycles; +#undef FLD +} + +static int +model_test_setpsw (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_clrpsw.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + cycles += m32rbf_model_test_u_exec (current_cpu, idesc, 0, referenced); + } + return cycles; +#undef FLD +} + +static int +model_test_bset (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_bset.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + cycles += m32rbf_model_test_u_exec (current_cpu, idesc, 0, referenced); + } + return cycles; +#undef FLD +} + +static int +model_test_bclr (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_bset.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + cycles += m32rbf_model_test_u_exec (current_cpu, idesc, 0, referenced); + } + return cycles; +#undef FLD +} + +static int +model_test_btst (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_bset.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + cycles += m32rbf_model_test_u_exec (current_cpu, idesc, 0, referenced); + } + return cycles; +#undef FLD +} + /* We assume UNIT_NONE == 0 because the tables don't always terminate entries with it. */ @@ -3975,6 +4156,11 @@ static const INSN_TIMING m32r_d_timing[] = { { M32RBF_INSN_SUBX, model_m32r_d_subx, { { (int) UNIT_M32R_D_U_EXEC, 1, 1 } } }, { M32RBF_INSN_TRAP, model_m32r_d_trap, { { (int) UNIT_M32R_D_U_EXEC, 1, 1 } } }, { M32RBF_INSN_UNLOCK, model_m32r_d_unlock, { { (int) UNIT_M32R_D_U_LOAD, 1, 1 } } }, + { M32RBF_INSN_CLRPSW, model_m32r_d_clrpsw, { { (int) UNIT_M32R_D_U_EXEC, 1, 1 } } }, + { M32RBF_INSN_SETPSW, model_m32r_d_setpsw, { { (int) UNIT_M32R_D_U_EXEC, 1, 1 } } }, + { M32RBF_INSN_BSET, model_m32r_d_bset, { { (int) UNIT_M32R_D_U_EXEC, 1, 1 } } }, + { M32RBF_INSN_BCLR, model_m32r_d_bclr, { { (int) UNIT_M32R_D_U_EXEC, 1, 1 } } }, + { M32RBF_INSN_BTST, model_m32r_d_btst, { { (int) UNIT_M32R_D_U_EXEC, 1, 1 } } }, }; /* Model timing data for `test'. */ @@ -4085,6 +4271,11 @@ static const INSN_TIMING test_timing[] = { { M32RBF_INSN_SUBX, model_test_subx, { { (int) UNIT_TEST_U_EXEC, 1, 1 } } }, { M32RBF_INSN_TRAP, model_test_trap, { { (int) UNIT_TEST_U_EXEC, 1, 1 } } }, { M32RBF_INSN_UNLOCK, model_test_unlock, { { (int) UNIT_TEST_U_EXEC, 1, 1 } } }, + { M32RBF_INSN_CLRPSW, model_test_clrpsw, { { (int) UNIT_TEST_U_EXEC, 1, 1 } } }, + { M32RBF_INSN_SETPSW, model_test_setpsw, { { (int) UNIT_TEST_U_EXEC, 1, 1 } } }, + { M32RBF_INSN_BSET, model_test_bset, { { (int) UNIT_TEST_U_EXEC, 1, 1 } } }, + { M32RBF_INSN_BCLR, model_test_bclr, { { (int) UNIT_TEST_U_EXEC, 1, 1 } } }, + { M32RBF_INSN_BTST, model_test_btst, { { (int) UNIT_TEST_U_EXEC, 1, 1 } } }, }; #endif /* WITH_PROFILE_MODEL_P */ diff --git a/sim/m32r/modelx.c b/sim/m32r/modelx.c index a4723a2..8e0250c 100644 --- a/sim/m32r/modelx.c +++ b/sim/m32r/modelx.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -2316,6 +2316,70 @@ model_m32rx_st_plus (SIM_CPU *current_cpu, void *sem_arg) } static int +model_m32rx_sth_plus (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_st_plus.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_src1 = 0; + INT in_src2 = 0; + in_src1 = FLD (in_src1); + in_src2 = FLD (in_src2); + referenced |= 1 << 0; + referenced |= 1 << 1; + cycles += m32rxf_model_m32rx_u_store (current_cpu, idesc, 0, referenced, in_src1, in_src2); + } + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_sr = -1; + INT in_dr = -1; + INT out_dr = -1; + in_dr = FLD (in_src2); + out_dr = FLD (out_src2); + cycles += m32rxf_model_m32rx_u_exec (current_cpu, idesc, 1, referenced, in_sr, in_dr, out_dr); + } + return cycles; +#undef FLD +} + +static int +model_m32rx_stb_plus (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_st_plus.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_src1 = 0; + INT in_src2 = 0; + in_src1 = FLD (in_src1); + in_src2 = FLD (in_src2); + referenced |= 1 << 0; + referenced |= 1 << 1; + cycles += m32rxf_model_m32rx_u_store (current_cpu, idesc, 0, referenced, in_src1, in_src2); + } + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_sr = -1; + INT in_dr = -1; + INT out_dr = -1; + in_dr = FLD (in_src2); + out_dr = FLD (out_src2); + cycles += m32rxf_model_m32rx_u_exec (current_cpu, idesc, 1, referenced, in_sr, in_dr, out_dr); + } + return cycles; +#undef FLD +} + +static int model_m32rx_st_minus (SIM_CPU *current_cpu, void *sem_arg) { #define FLD(f) abuf->fields.sfmt_st_plus.f @@ -2692,6 +2756,107 @@ model_m32rx_snc (SIM_CPU *current_cpu, void *sem_arg) #undef FLD } +static int +model_m32rx_clrpsw (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_clrpsw.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_sr = -1; + INT in_dr = -1; + INT out_dr = -1; + cycles += m32rxf_model_m32rx_u_exec (current_cpu, idesc, 0, referenced, in_sr, in_dr, out_dr); + } + return cycles; +#undef FLD +} + +static int +model_m32rx_setpsw (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_clrpsw.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_sr = -1; + INT in_dr = -1; + INT out_dr = -1; + cycles += m32rxf_model_m32rx_u_exec (current_cpu, idesc, 0, referenced, in_sr, in_dr, out_dr); + } + return cycles; +#undef FLD +} + +static int +model_m32rx_bset (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_bset.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_sr = -1; + INT in_dr = -1; + INT out_dr = -1; + in_sr = FLD (in_sr); + referenced |= 1 << 0; + cycles += m32rxf_model_m32rx_u_exec (current_cpu, idesc, 0, referenced, in_sr, in_dr, out_dr); + } + return cycles; +#undef FLD +} + +static int +model_m32rx_bclr (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_bset.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_sr = -1; + INT in_dr = -1; + INT out_dr = -1; + in_sr = FLD (in_sr); + referenced |= 1 << 0; + cycles += m32rxf_model_m32rx_u_exec (current_cpu, idesc, 0, referenced, in_sr, in_dr, out_dr); + } + return cycles; +#undef FLD +} + +static int +model_m32rx_btst (SIM_CPU *current_cpu, void *sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_bset.f + const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg); + const IDESC * UNUSED idesc = abuf->idesc; + int cycles = 0; + { + int referenced = 0; + int UNUSED insn_referenced = abuf->written; + INT in_sr = -1; + INT in_dr = -1; + INT out_dr = -1; + in_sr = FLD (in_sr); + referenced |= 1 << 0; + cycles += m32rxf_model_m32rx_u_exec (current_cpu, idesc, 0, referenced, in_sr, in_dr, out_dr); + } + return cycles; +#undef FLD +} + /* We assume UNIT_NONE == 0 because the tables don't always terminate entries with it. */ @@ -2806,6 +2971,8 @@ static const INSN_TIMING m32rx_timing[] = { { M32RXF_INSN_STH, model_m32rx_sth, { { (int) UNIT_M32RX_U_STORE, 1, 1 } } }, { M32RXF_INSN_STH_D, model_m32rx_sth_d, { { (int) UNIT_M32RX_U_STORE, 1, 2 } } }, { M32RXF_INSN_ST_PLUS, model_m32rx_st_plus, { { (int) UNIT_M32RX_U_STORE, 1, 1 }, { (int) UNIT_M32RX_U_EXEC, 1, 0 } } }, + { M32RXF_INSN_STH_PLUS, model_m32rx_sth_plus, { { (int) UNIT_M32RX_U_STORE, 1, 1 }, { (int) UNIT_M32RX_U_EXEC, 1, 0 } } }, + { M32RXF_INSN_STB_PLUS, model_m32rx_stb_plus, { { (int) UNIT_M32RX_U_STORE, 1, 1 }, { (int) UNIT_M32RX_U_EXEC, 1, 0 } } }, { M32RXF_INSN_ST_MINUS, model_m32rx_st_minus, { { (int) UNIT_M32RX_U_STORE, 1, 1 }, { (int) UNIT_M32RX_U_EXEC, 1, 0 } } }, { M32RXF_INSN_SUB, model_m32rx_sub, { { (int) UNIT_M32RX_U_EXEC, 1, 1 } } }, { M32RXF_INSN_SUBV, model_m32rx_subv, { { (int) UNIT_M32RX_U_EXEC, 1, 1 } } }, @@ -2823,6 +2990,11 @@ static const INSN_TIMING m32rx_timing[] = { { M32RXF_INSN_MACLH1, model_m32rx_maclh1, { { (int) UNIT_M32RX_U_MAC, 1, 1 } } }, { M32RXF_INSN_SC, model_m32rx_sc, { { (int) UNIT_M32RX_U_EXEC, 1, 1 } } }, { M32RXF_INSN_SNC, model_m32rx_snc, { { (int) UNIT_M32RX_U_EXEC, 1, 1 } } }, + { M32RXF_INSN_CLRPSW, model_m32rx_clrpsw, { { (int) UNIT_M32RX_U_EXEC, 1, 1 } } }, + { M32RXF_INSN_SETPSW, model_m32rx_setpsw, { { (int) UNIT_M32RX_U_EXEC, 1, 1 } } }, + { M32RXF_INSN_BSET, model_m32rx_bset, { { (int) UNIT_M32RX_U_EXEC, 1, 1 } } }, + { M32RXF_INSN_BCLR, model_m32rx_bclr, { { (int) UNIT_M32RX_U_EXEC, 1, 1 } } }, + { M32RXF_INSN_BTST, model_m32rx_btst, { { (int) UNIT_M32RX_U_EXEC, 1, 1 } } }, }; #endif /* WITH_PROFILE_MODEL_P */ diff --git a/sim/m32r/sem-switch.c b/sim/m32r/sem-switch.c index 9d08e57..b378010 100644 --- a/sim/m32r/sem-switch.c +++ b/sim/m32r/sem-switch.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -137,6 +137,11 @@ with this program; if not, write to the Free Software Foundation, Inc., { M32RBF_INSN_SUBX, && case_sem_INSN_SUBX }, { M32RBF_INSN_TRAP, && case_sem_INSN_TRAP }, { M32RBF_INSN_UNLOCK, && case_sem_INSN_UNLOCK }, + { M32RBF_INSN_CLRPSW, && case_sem_INSN_CLRPSW }, + { M32RBF_INSN_SETPSW, && case_sem_INSN_SETPSW }, + { M32RBF_INSN_BSET, && case_sem_INSN_BSET }, + { M32RBF_INSN_BCLR, && case_sem_INSN_BCLR }, + { M32RBF_INSN_BTST, && case_sem_INSN_BTST }, { 0, 0 } }; int i; @@ -2504,6 +2509,101 @@ if (CPU (h_lock)) { } NEXT (vpc); + CASE (sem, INSN_CLRPSW) : /* clrpsw $uimm8 */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_clrpsw.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + + { + SI opval = ANDSI (GET_H_CR (((UINT) 0)), ORSI (INVBI (FLD (f_uimm8)), 65280)); + SET_H_CR (((UINT) 0), opval); + TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval); + } + +#undef FLD +} + NEXT (vpc); + + CASE (sem, INSN_SETPSW) : /* setpsw $uimm8 */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_clrpsw.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + + { + SI opval = FLD (f_uimm8); + SET_H_CR (((UINT) 0), opval); + TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval); + } + +#undef FLD +} + NEXT (vpc); + + CASE (sem, INSN_BSET) : /* bset $uimm3,@($slo16,$sr) */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_bset.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 4); + + { + QI opval = ORQI (GETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))), SLLSI (1, SUBSI (7, FLD (f_uimm3)))); + SETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16)), opval); + TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); + } + +#undef FLD +} + NEXT (vpc); + + CASE (sem, INSN_BCLR) : /* bclr $uimm3,@($slo16,$sr) */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_bset.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 4); + + { + QI opval = ANDQI (GETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))), INVQI (SLLSI (1, SUBSI (7, FLD (f_uimm3))))); + SETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16)), opval); + TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); + } + +#undef FLD +} + NEXT (vpc); + + CASE (sem, INSN_BTST) : /* btst $uimm3,$sr */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_bset.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + + { + BI opval = ANDQI (SRLSI (* FLD (i_sr), SUBSI (7, FLD (f_uimm3))), 1); + CPU (h_cond) = opval; + TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval); + } + +#undef FLD +} + NEXT (vpc); + } ENDSWITCH (sem) /* End of semantic switch. */ diff --git a/sim/m32r/sem.c b/sim/m32r/sem.c index 7360933..b06c9f0 100644 --- a/sim/m32r/sem.c +++ b/sim/m32r/sem.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -2563,6 +2563,111 @@ if (CPU (h_lock)) { #undef FLD } +/* clrpsw: clrpsw $uimm8 */ + +static SEM_PC +SEM_FN_NAME (m32rbf,clrpsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_clrpsw.f + ARGBUF *abuf = SEM_ARGBUF (sem_arg); + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + + { + SI opval = ANDSI (GET_H_CR (((UINT) 0)), ORSI (INVBI (FLD (f_uimm8)), 65280)); + SET_H_CR (((UINT) 0), opval); + TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval); + } + + return vpc; +#undef FLD +} + +/* setpsw: setpsw $uimm8 */ + +static SEM_PC +SEM_FN_NAME (m32rbf,setpsw) (SIM_CPU *current_cpu, SEM_ARG sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_clrpsw.f + ARGBUF *abuf = SEM_ARGBUF (sem_arg); + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + + { + SI opval = FLD (f_uimm8); + SET_H_CR (((UINT) 0), opval); + TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval); + } + + return vpc; +#undef FLD +} + +/* bset: bset $uimm3,@($slo16,$sr) */ + +static SEM_PC +SEM_FN_NAME (m32rbf,bset) (SIM_CPU *current_cpu, SEM_ARG sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_bset.f + ARGBUF *abuf = SEM_ARGBUF (sem_arg); + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); + + { + QI opval = ORQI (GETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))), SLLSI (1, SUBSI (7, FLD (f_uimm3)))); + SETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16)), opval); + TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); + } + + return vpc; +#undef FLD +} + +/* bclr: bclr $uimm3,@($slo16,$sr) */ + +static SEM_PC +SEM_FN_NAME (m32rbf,bclr) (SIM_CPU *current_cpu, SEM_ARG sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_bset.f + ARGBUF *abuf = SEM_ARGBUF (sem_arg); + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 4); + + { + QI opval = ANDQI (GETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))), INVQI (SLLSI (1, SUBSI (7, FLD (f_uimm3))))); + SETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16)), opval); + TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); + } + + return vpc; +#undef FLD +} + +/* btst: btst $uimm3,$sr */ + +static SEM_PC +SEM_FN_NAME (m32rbf,btst) (SIM_CPU *current_cpu, SEM_ARG sem_arg) +{ +#define FLD(f) abuf->fields.sfmt_bset.f + ARGBUF *abuf = SEM_ARGBUF (sem_arg); + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + SEM_PC vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + + { + BI opval = ANDQI (SRLSI (* FLD (i_sr), SUBSI (7, FLD (f_uimm3))), 1); + CPU (h_cond) = opval; + TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval); + } + + return vpc; +#undef FLD +} + /* Table of all semantic fns. */ static const struct sem_fn_desc sem_fns[] = { @@ -2671,6 +2776,11 @@ static const struct sem_fn_desc sem_fns[] = { { M32RBF_INSN_SUBX, SEM_FN_NAME (m32rbf,subx) }, { M32RBF_INSN_TRAP, SEM_FN_NAME (m32rbf,trap) }, { M32RBF_INSN_UNLOCK, SEM_FN_NAME (m32rbf,unlock) }, + { M32RBF_INSN_CLRPSW, SEM_FN_NAME (m32rbf,clrpsw) }, + { M32RBF_INSN_SETPSW, SEM_FN_NAME (m32rbf,setpsw) }, + { M32RBF_INSN_BSET, SEM_FN_NAME (m32rbf,bset) }, + { M32RBF_INSN_BCLR, SEM_FN_NAME (m32rbf,bclr) }, + { M32RBF_INSN_BTST, SEM_FN_NAME (m32rbf,btst) }, { 0, 0 } }; diff --git a/sim/m32r/semx-switch.c b/sim/m32r/semx-switch.c index d9919dc..d1d6abb 100644 --- a/sim/m32r/semx-switch.c +++ b/sim/m32r/semx-switch.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU simulators. @@ -140,6 +140,8 @@ with this program; if not, write to the Free Software Foundation, Inc., { M32RXF_INSN_STH, && case_sem_INSN_STH }, { M32RXF_INSN_STH_D, && case_sem_INSN_STH_D }, { M32RXF_INSN_ST_PLUS, && case_sem_INSN_ST_PLUS }, + { M32RXF_INSN_STH_PLUS, && case_sem_INSN_STH_PLUS }, + { M32RXF_INSN_STB_PLUS, && case_sem_INSN_STB_PLUS }, { M32RXF_INSN_ST_MINUS, && case_sem_INSN_ST_MINUS }, { M32RXF_INSN_SUB, && case_sem_INSN_SUB }, { M32RXF_INSN_SUBV, && case_sem_INSN_SUBV }, @@ -157,6 +159,11 @@ with this program; if not, write to the Free Software Foundation, Inc., { M32RXF_INSN_MACLH1, && case_sem_INSN_MACLH1 }, { M32RXF_INSN_SC, && case_sem_INSN_SC }, { M32RXF_INSN_SNC, && case_sem_INSN_SNC }, + { M32RXF_INSN_CLRPSW, && case_sem_INSN_CLRPSW }, + { M32RXF_INSN_SETPSW, && case_sem_INSN_SETPSW }, + { M32RXF_INSN_BSET, && case_sem_INSN_BSET }, + { M32RXF_INSN_BCLR, && case_sem_INSN_BCLR }, + { M32RXF_INSN_BTST, && case_sem_INSN_BTST }, { M32RXF_INSN_PAR_ADD, && case_sem_INSN_PAR_ADD }, { M32RXF_INSN_WRITE_ADD, && case_sem_INSN_WRITE_ADD }, { M32RXF_INSN_PAR_AND, && case_sem_INSN_PAR_AND }, @@ -281,6 +288,10 @@ with this program; if not, write to the Free Software Foundation, Inc., { M32RXF_INSN_WRITE_STH, && case_sem_INSN_WRITE_STH }, { M32RXF_INSN_PAR_ST_PLUS, && case_sem_INSN_PAR_ST_PLUS }, { M32RXF_INSN_WRITE_ST_PLUS, && case_sem_INSN_WRITE_ST_PLUS }, + { M32RXF_INSN_PAR_STH_PLUS, && case_sem_INSN_PAR_STH_PLUS }, + { M32RXF_INSN_WRITE_STH_PLUS, && case_sem_INSN_WRITE_STH_PLUS }, + { M32RXF_INSN_PAR_STB_PLUS, && case_sem_INSN_PAR_STB_PLUS }, + { M32RXF_INSN_WRITE_STB_PLUS, && case_sem_INSN_WRITE_STB_PLUS }, { M32RXF_INSN_PAR_ST_MINUS, && case_sem_INSN_PAR_ST_MINUS }, { M32RXF_INSN_WRITE_ST_MINUS, && case_sem_INSN_WRITE_ST_MINUS }, { M32RXF_INSN_PAR_SUB, && case_sem_INSN_PAR_SUB }, @@ -309,6 +320,12 @@ with this program; if not, write to the Free Software Foundation, Inc., { M32RXF_INSN_WRITE_SC, && case_sem_INSN_WRITE_SC }, { M32RXF_INSN_PAR_SNC, && case_sem_INSN_PAR_SNC }, { M32RXF_INSN_WRITE_SNC, && case_sem_INSN_WRITE_SNC }, + { M32RXF_INSN_PAR_CLRPSW, && case_sem_INSN_PAR_CLRPSW }, + { M32RXF_INSN_WRITE_CLRPSW, && case_sem_INSN_WRITE_CLRPSW }, + { M32RXF_INSN_PAR_SETPSW, && case_sem_INSN_PAR_SETPSW }, + { M32RXF_INSN_WRITE_SETPSW, && case_sem_INSN_WRITE_SETPSW }, + { M32RXF_INSN_PAR_BTST, && case_sem_INSN_PAR_BTST }, + { M32RXF_INSN_WRITE_BTST, && case_sem_INSN_WRITE_BTST }, { 0, 0 } }; int i; @@ -2727,6 +2744,62 @@ PROFILE_COUNT_FILLNOPS (current_cpu, abuf->addr); } NEXT (vpc); + CASE (sem, INSN_STH_PLUS) : /* sth $src1,@$src2+ */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_st_plus.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + +{ + HI tmp_new_src2; + { + HI opval = * FLD (i_src1); + SETMEMHI (current_cpu, pc, tmp_new_src2, opval); + TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); + } + tmp_new_src2 = ADDSI (* FLD (i_src2), 2); + { + SI opval = tmp_new_src2; + * FLD (i_src2) = opval; + TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); + } +} + +#undef FLD +} + NEXT (vpc); + + CASE (sem, INSN_STB_PLUS) : /* stb $src1,@$src2+ */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_st_plus.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + +{ + QI tmp_new_src2; + { + QI opval = * FLD (i_src1); + SETMEMQI (current_cpu, pc, tmp_new_src2, opval); + TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); + } + tmp_new_src2 = ADDSI (* FLD (i_src2), 1); + { + SI opval = tmp_new_src2; + * FLD (i_src2) = opval; + TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); + } +} + +#undef FLD +} + NEXT (vpc); + CASE (sem, INSN_ST_MINUS) : /* st $src1,@-$src2 */ { SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); @@ -3113,6 +3186,101 @@ if (ZEXTBISI (NOTBI (CPU (h_cond)))) } NEXT (vpc); + CASE (sem, INSN_CLRPSW) : /* clrpsw $uimm8 */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_clrpsw.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + + { + SI opval = ANDSI (GET_H_CR (((UINT) 0)), ORSI (INVBI (FLD (f_uimm8)), 65280)); + SET_H_CR (((UINT) 0), opval); + TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval); + } + +#undef FLD +} + NEXT (vpc); + + CASE (sem, INSN_SETPSW) : /* setpsw $uimm8 */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_clrpsw.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + + { + SI opval = FLD (f_uimm8); + SET_H_CR (((UINT) 0), opval); + TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval); + } + +#undef FLD +} + NEXT (vpc); + + CASE (sem, INSN_BSET) : /* bset $uimm3,@($slo16,$sr) */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_bset.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 4); + + { + QI opval = ORQI (GETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))), SLLSI (1, SUBSI (7, FLD (f_uimm3)))); + SETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16)), opval); + TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); + } + +#undef FLD +} + NEXT (vpc); + + CASE (sem, INSN_BCLR) : /* bclr $uimm3,@($slo16,$sr) */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_bset.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 4); + + { + QI opval = ANDQI (GETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16))), INVQI (SLLSI (1, SUBSI (7, FLD (f_uimm3))))); + SETMEMQI (current_cpu, pc, ADDSI (* FLD (i_sr), FLD (f_simm16)), opval); + TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); + } + +#undef FLD +} + NEXT (vpc); + + CASE (sem, INSN_BTST) : /* btst $uimm3,$sr */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_bset.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + + { + BI opval = ANDQI (SRLSI (* FLD (i_sr), SUBSI (7, FLD (f_uimm3))), 1); + CPU (h_cond) = opval; + TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval); + } + +#undef FLD +} + NEXT (vpc); + CASE (sem, INSN_PAR_ADD) : /* add $dr,$sr */ { SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); @@ -5656,6 +5824,104 @@ CASE (sem, INSN_WRITE_ST_PLUS) : /* st $src1,@+$src2 */ } NEXT (vpc); + CASE (sem, INSN_PAR_STH_PLUS) : /* sth $src1,@$src2+ */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_st_plus.f +#define OPRND(f) par_exec->operands.sfmt_sth_plus.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + +{ + HI tmp_new_src2; + { + HI opval = * FLD (i_src1); + OPRND (h_memory_HI_new_src2_idx) = tmp_new_src2; + OPRND (h_memory_HI_new_src2) = opval; + TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); + } + tmp_new_src2 = ADDSI (* FLD (i_src2), 2); + { + SI opval = tmp_new_src2; + OPRND (src2) = opval; + TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); + } +} + +#undef OPRND +#undef FLD +} + NEXT (vpc); + +CASE (sem, INSN_WRITE_STH_PLUS) : /* sth $src1,@$src2+ */ + { + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + const ARGBUF *abuf = SEM_ARGBUF (sem_arg)->fields.write.abuf; +#define FLD(f) abuf->fields.sfmt_st_plus.f +#define OPRND(f) par_exec->operands.sfmt_sth_plus.f + int UNUSED written = abuf->written; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 0); + + SETMEMHI (current_cpu, pc, OPRND (h_memory_HI_new_src2_idx), OPRND (h_memory_HI_new_src2)); + * FLD (i_src2) = OPRND (src2); + +#undef OPRND +#undef FLD + } + NEXT (vpc); + + CASE (sem, INSN_PAR_STB_PLUS) : /* stb $src1,@$src2+ */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_st_plus.f +#define OPRND(f) par_exec->operands.sfmt_stb_plus.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + +{ + QI tmp_new_src2; + { + QI opval = * FLD (i_src1); + OPRND (h_memory_QI_new_src2_idx) = tmp_new_src2; + OPRND (h_memory_QI_new_src2) = opval; + TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); + } + tmp_new_src2 = ADDSI (* FLD (i_src2), 1); + { + SI opval = tmp_new_src2; + OPRND (src2) = opval; + TRACE_RESULT (current_cpu, abuf, "gr", 'x', opval); + } +} + +#undef OPRND +#undef FLD +} + NEXT (vpc); + +CASE (sem, INSN_WRITE_STB_PLUS) : /* stb $src1,@$src2+ */ + { + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + const ARGBUF *abuf = SEM_ARGBUF (sem_arg)->fields.write.abuf; +#define FLD(f) abuf->fields.sfmt_st_plus.f +#define OPRND(f) par_exec->operands.sfmt_stb_plus.f + int UNUSED written = abuf->written; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 0); + + SETMEMQI (current_cpu, pc, OPRND (h_memory_QI_new_src2_idx), OPRND (h_memory_QI_new_src2)); + * FLD (i_src2) = OPRND (src2); + +#undef OPRND +#undef FLD + } + NEXT (vpc); + CASE (sem, INSN_PAR_ST_MINUS) : /* st $src1,@-$src2 */ { SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); @@ -6263,6 +6529,120 @@ CASE (sem, INSN_WRITE_SNC) : /* snc */ } NEXT (vpc); + CASE (sem, INSN_PAR_CLRPSW) : /* clrpsw $uimm8 */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_clrpsw.f +#define OPRND(f) par_exec->operands.sfmt_clrpsw.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + + { + SI opval = ANDSI (GET_H_CR (((UINT) 0)), ORSI (INVBI (FLD (f_uimm8)), 65280)); + OPRND (h_cr_USI_0) = opval; + TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval); + } + +#undef OPRND +#undef FLD +} + NEXT (vpc); + +CASE (sem, INSN_WRITE_CLRPSW) : /* clrpsw $uimm8 */ + { + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + const ARGBUF *abuf = SEM_ARGBUF (sem_arg)->fields.write.abuf; +#define FLD(f) abuf->fields.sfmt_clrpsw.f +#define OPRND(f) par_exec->operands.sfmt_clrpsw.f + int UNUSED written = abuf->written; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 0); + + SET_H_CR (((UINT) 0), OPRND (h_cr_USI_0)); + +#undef OPRND +#undef FLD + } + NEXT (vpc); + + CASE (sem, INSN_PAR_SETPSW) : /* setpsw $uimm8 */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_clrpsw.f +#define OPRND(f) par_exec->operands.sfmt_setpsw.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + + { + SI opval = FLD (f_uimm8); + OPRND (h_cr_USI_0) = opval; + TRACE_RESULT (current_cpu, abuf, "cr", 'x', opval); + } + +#undef OPRND +#undef FLD +} + NEXT (vpc); + +CASE (sem, INSN_WRITE_SETPSW) : /* setpsw $uimm8 */ + { + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + const ARGBUF *abuf = SEM_ARGBUF (sem_arg)->fields.write.abuf; +#define FLD(f) abuf->fields.sfmt_clrpsw.f +#define OPRND(f) par_exec->operands.sfmt_setpsw.f + int UNUSED written = abuf->written; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 0); + + SET_H_CR (((UINT) 0), OPRND (h_cr_USI_0)); + +#undef OPRND +#undef FLD + } + NEXT (vpc); + + CASE (sem, INSN_PAR_BTST) : /* btst $uimm3,$sr */ +{ + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); +#define FLD(f) abuf->fields.sfmt_bset.f +#define OPRND(f) par_exec->operands.sfmt_btst.f + int UNUSED written = 0; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 2); + + { + BI opval = ANDQI (SRLSI (* FLD (i_sr), SUBSI (7, FLD (f_uimm3))), 1); + OPRND (condbit) = opval; + TRACE_RESULT (current_cpu, abuf, "cond", 'x', opval); + } + +#undef OPRND +#undef FLD +} + NEXT (vpc); + +CASE (sem, INSN_WRITE_BTST) : /* btst $uimm3,$sr */ + { + SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc); + const ARGBUF *abuf = SEM_ARGBUF (sem_arg)->fields.write.abuf; +#define FLD(f) abuf->fields.sfmt_bset.f +#define OPRND(f) par_exec->operands.sfmt_btst.f + int UNUSED written = abuf->written; + IADDR UNUSED pc = abuf->addr; + vpc = SEM_NEXT_VPC (sem_arg, pc, 0); + + CPU (h_cond) = OPRND (condbit); + +#undef OPRND +#undef FLD + } + NEXT (vpc); + } ENDSWITCH (sem) /* End of semantic switch. */ diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c index 95568cc..749c79e 100644 --- a/sim/m32r/sim-if.c +++ b/sim/m32r/sim-if.c @@ -1,20 +1,22 @@ /* Main simulator entry points specific to the M32R. - Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999, 2003 Free Software Foundation, Inc. Contributed by Cygnus Support. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. + This file is part of GDB, the GNU debugger. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sim-main.h" #include "sim-options.h" @@ -240,6 +242,11 @@ print_m32r_misc_cpu (SIM_CPU *cpu, int verbose) PROFILE_LABEL_WIDTH, "Parallel insns:", sim_add_commas (buf, sizeof (buf), CPU_M32R_MISC_PROFILE (cpu)->parallel_count)); + if (STATE_ARCHITECTURE (sd)->mach == bfd_mach_m32r2) + sim_io_printf (sd, " %-*s %s\n\n", + PROFILE_LABEL_WIDTH, "Parallel insns:", + sim_add_commas (buf, sizeof (buf), + CPU_M32R_MISC_PROFILE (cpu)->parallel_count)); } } @@ -270,12 +277,12 @@ sim_do_command (sd, cmd) sim_io_eprintf (sd, "Too many arguments in `%s'\n", cmd); else if (strcasecmp (argv[2], "bbpsw") == 0) { - val = a_m32r_h_cr_get (STATE_CPU (sd, 0), H_CR_BBPSW); + val = m32rbf_h_cr_get (STATE_CPU (sd, 0), H_CR_BBPSW); sim_io_printf (sd, "bbpsw 0x%x %d\n", val, val); } else if (strcasecmp (argv[2], "bbpc") == 0) { - val = a_m32r_h_cr_get (STATE_CPU (sd, 0), H_CR_BBPC); + val = m32rbf_h_cr_get (STATE_CPU (sd, 0), H_CR_BBPC); sim_io_printf (sd, "bbpc 0x%x %d\n", val, val); } else diff --git a/sim/m32r/sim-main.h b/sim/m32r/sim-main.h index efd1e91..becfb62 100644 --- a/sim/m32r/sim-main.h +++ b/sim/m32r/sim-main.h @@ -1,4 +1,3 @@ - /* Main header for the m32r. */ #ifndef SIM_MAIN_H @@ -58,8 +57,11 @@ struct _sim_cpu { go after here. Oh for a better language. */ #if defined (WANT_CPU_M32RBF) M32RBF_CPU_DATA cpu_data; -#elif defined (WANT_CPU_M32RXF) +#endif +#if defined (WANT_CPU_M32RXF) M32RXF_CPU_DATA cpu_data; +#elif defined (WANT_CPU_M32R2F) + M32R2F_CPU_DATA cpu_data; #endif }; diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c index 2721ad8..473d0d7 100644 --- a/sim/m32r/traps.c +++ b/sim/m32r/traps.c @@ -1,32 +1,31 @@ /* m32r exception, interrupt, and trap (EIT) support - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2003 Free Software Foundation, Inc. Contributed by Cygnus Solutions. -This file is part of GDB, the GNU debugger. + This file is part of GDB, the GNU debugger. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sim-main.h" #include "targ-vals.h" -/* The semantic code invokes this for invalid (unrecognized) instructions. - CIA is the address with the invalid insn. - VPC is the virtual pc of the following insn. */ +#define TRAP_FLUSH_CACHE 12 +/* The semantic code invokes this for invalid (unrecognized) instructions. */ SEM_PC -sim_engine_invalid_insn (SIM_CPU *current_cpu, IADDR cia, SEM_PC vpc) +sim_engine_invalid_insn (SIM_CPU *current_cpu, IADDR cia, SEM_PC pc) { SIM_DESC sd = CPU_STATE (current_cpu); @@ -48,7 +47,8 @@ sim_engine_invalid_insn (SIM_CPU *current_cpu, IADDR cia, SEM_PC vpc) else #endif sim_engine_halt (sd, current_cpu, NULL, cia, sim_stopped, SIM_SIGILL); - return vpc; + + return pc; } /* Process an address exception. */ @@ -60,21 +60,30 @@ m32r_core_signal (SIM_DESC sd, SIM_CPU *current_cpu, sim_cia cia, { if (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT) { - a_m32r_h_cr_set (current_cpu, H_CR_BBPC, - a_m32r_h_cr_get (current_cpu, H_CR_BPC)); - if (MACH_NUM (CPU_MACH (current_cpu)) == MACH_M32R) + m32rbf_h_cr_set (current_cpu, H_CR_BBPC, + m32rbf_h_cr_get (current_cpu, H_CR_BPC)); + switch (MACH_NUM (CPU_MACH (current_cpu))) { + case MACH_M32R: m32rbf_h_bpsw_set (current_cpu, m32rbf_h_psw_get (current_cpu)); - /* sm not changed */ + /* sm not changed. */ m32rbf_h_psw_set (current_cpu, m32rbf_h_psw_get (current_cpu) & 0x80); + break; + case MACH_M32RX: + m32rxf_h_bpsw_set (current_cpu, m32rxf_h_psw_get (current_cpu)); + /* sm not changed. */ + m32rxf_h_psw_set (current_cpu, m32rxf_h_psw_get (current_cpu) & 0x80); + break; + case MACH_M32R2: + m32r2f_h_bpsw_set (current_cpu, m32r2f_h_psw_get (current_cpu)); + /* sm not changed. */ + m32r2f_h_psw_set (current_cpu, m32r2f_h_psw_get (current_cpu) & 0x80); + break; + default: + abort (); } - else - { - m32rxf_h_bpsw_set (current_cpu, m32rxf_h_psw_get (current_cpu)); - /* sm not changed */ - m32rxf_h_psw_set (current_cpu, m32rxf_h_psw_get (current_cpu) & 0x80); - } - a_m32r_h_cr_set (current_cpu, H_CR_BPC, cia); + + m32rbf_h_cr_set (current_cpu, H_CR_BPC, cia); sim_engine_restart (CPU_STATE (current_cpu), current_cpu, NULL, EIT_ADDR_EXCP_ADDR); @@ -131,8 +140,10 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) if (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT) { /* The new pc is the trap vector entry. - We assume there's a branch there to some handler. */ - USI new_pc = EIT_TRAP_BASE_ADDR + num * 4; + We assume there's a branch there to some handler. + Use cr5 as EVB (EIT Vector Base) register. */ + /* USI new_pc = EIT_TRAP_BASE_ADDR + num * 4; */ + USI new_pc = m32rbf_h_cr_get (current_cpu, 5) + 0x40 + num * 4; return new_pc; } @@ -143,10 +154,10 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) CB_SYSCALL s; CB_SYSCALL_INIT (&s); - s.func = a_m32r_h_gr_get (current_cpu, 0); - s.arg1 = a_m32r_h_gr_get (current_cpu, 1); - s.arg2 = a_m32r_h_gr_get (current_cpu, 2); - s.arg3 = a_m32r_h_gr_get (current_cpu, 3); + s.func = m32rbf_h_gr_get (current_cpu, 0); + s.arg1 = m32rbf_h_gr_get (current_cpu, 1); + s.arg2 = m32rbf_h_gr_get (current_cpu, 2); + s.arg3 = m32rbf_h_gr_get (current_cpu, 3); if (s.func == TARGET_SYS_exit) { @@ -158,9 +169,9 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) s.read_mem = syscall_read_mem; s.write_mem = syscall_write_mem; cb_syscall (cb, &s); - a_m32r_h_gr_set (current_cpu, 2, s.errcode); - a_m32r_h_gr_set (current_cpu, 0, s.result); - a_m32r_h_gr_set (current_cpu, 1, s.result2); + m32rbf_h_gr_set (current_cpu, 2, s.errcode); + m32rbf_h_gr_set (current_cpu, 0, s.result); + m32rbf_h_gr_set (current_cpu, 1, s.result2); break; } @@ -169,9 +180,15 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) sim_stopped, SIM_SIGTRAP); break; + case TRAP_FLUSH_CACHE: + /* Do nothing. */ + break; + default : { - USI new_pc = EIT_TRAP_BASE_ADDR + num * 4; + /* USI new_pc = EIT_TRAP_BASE_ADDR + num * 4; */ + /* Use cr5 as EVB (EIT Vector Base) register. */ + USI new_pc = m32rbf_h_cr_get (current_cpu, 5) + 0x40 + num * 4; return new_pc; } } |